Search completed in 1.50 seconds.
9447 results for "value":
Your results are loading. Please wait...
CSSPrimitiveValue.getFloatValue() - Web APIs
the getfloatvalue() method of the cssprimitivevalue interface is used to get a float value in a specified unit. if this 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. ...
...s are: constant description css_cm the value is a <length> in centimeters. css_deg the value is an <angle> in degrees. css_dimension the value is a <number> with an unknown dimension. css_ems the value is a <length> in em units. css_exs the value is a <length> in ex units. css_grad the value is an <angle> in grads. css_hz the value is a <frequency> in hertz. the value can be obtained by using the getfloatvalue method. css_in the value is a <length> in inches. 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_hz the value is a <frequency> in hertz. the value can be obtained by using the getfloatvalue method. css_in the value is a <length> in inches. css_khz the value is a <frequency> in kilohertz. css_mm the value is a <length> in millimeters. css_ms the value is a <time> in milliseconds. css_number the value is a simple <number>. css_pc the value is a <length> in picas. css_percentage the value is a <percentage>. css_pt the value is a <length> in points. css_px the value is a <length> in pixels. css_rad the value is an <angle> in radians. css_s the value is a <time> in seconds. ...
...And 2 more matches
CSSPrimitiveValue.setFloatValue() - Web APIs
the setfloatvalue() method of the cssprimitivevalue interface is used to set a float value. if the property attached to this value 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. ...
... unit type, in which the value should be returned. valid values are: constant description css_cm the value is a <length> in centimeters. css_deg the value is an <angle> in degrees. css_dimension the value is a <number> with an unknown dimension. css_ems the value is a <length> in em units. css_exs the value is a <length> in ex units. css_grad the value is an <angle> in grads. css_hz the value is a <frequency> in hertz. the value can be obtained by using the getfloatvalue method. css_in the value is a <length> in inches. css_khz the value is a <frequency> in kilohertz. css_mm the value is a <length> in millimeters. ...
...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 the value is a <length> in points. css_px the value is a <length> in pixels. css_rad the value is an <angle> in radians. css_s ...
...And 2 more matches
IDBCursorWithValue.value - Web APIs
the value read-only property of the idbcursorwithvalue interface returns the value of the current cursor, whatever that is. note: this feature is available in web workers. syntax var value = myidbcursorwithvalue.value; value the value of the current cursor. example in this example we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store. within each iteration we log the value of the cursor with cursor.value. the cursor does not require us to select the data based on a key; we can just grab all of it. also note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo. for a complete working example, see our idbcursor example (view example live.) funct...
... recommendation indexed database ap...
... recommendation indexed database api draftthe definition of 'idbdata...
...And 2 more matches
CSSPositionValue.CSSPositionValue() - Web APIs
the csspositionvalue constructor creates a new csspositionvalue object which represents values for properties that take a position, for example object-position. syntax cvar csspositionvalue = new csspositionvalue(x, y) parameters x a position along the web page's horizontal axis. y a position along the web page's vertical axix. examples the following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
...ct-position. syntax cvar csspositionvalue = new csspositionvalue(x, y) parameters x a position along the web page's horizontal axis. y a position along the web page's vertical axix. examples the following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
...b page's horizontal axis. y a position along the web page's vertical axix. ...
...l axis. y a position along the web page's vertical axix. ...
CSSValue.cssValueType - Web APIs
the cssvaluetype read-only property of the cssvalue interface represents the type of the current computed css property value. syntax cssvaluetype = cssvalue.cssvaluetype; value an unsigned short representing a code defining the type of the value. possible values are: constant description css_custom the value is a custom value. css_inherit the value is inherited and the csstext contains "inherit". css_primitive_value the value is a primitive value and an instance of the cssprimitivevalue interface can be obtained by using binding-specific casting methods on this instance of the cssvalue interface. ...
...: constant description css_custom the value is a custom value. css_inherit the value is inherited and the csstext contains "inherit". css_primitive_value the value is a primitive value and an instance of the cssprimitivevalue interface can be obtained by using binding-specific casting methods on this instance of the cssvalue interface. css_value_list the value is a cssvalue list and an instance of the cssvaluelist interface can be obtained by using binding-specific casting methods on this instance of the cssvalue interface. ...
...face can be obtained by using binding-specific casting methods on this instance of the cssvalue interface. css_value_list the value is a cssvalue list and an instance of the cssvaluelist interface can be obtained by using binding-specific casting methods on this instance of the cssvalue interface. example var styledeclaration = document.stylesheets[0].cssrules[0].style; var cssvalue = styledeclaration.getpropertycssvalue("color"); console.log(cssvalue.cssvaluetype); specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssvalue.cssvaluetype' in that specification. obsolete initial definition ...
CSSKeywordValue.CSSKeywordValue() - Web APIs
the csskeywordvalue constructor creates a new csskeywordvalue object which represents css keywords and other identifiers. syntax var csskeywordvalue = new csskeywordvalue(val) parameters value sets or returns the value of the new csskeywordvalue. examples the following example resets the css display property to its defaults, setting the inline style attribute to style="display: initial" if viewed in the developer tools inspector. ...
...csskeywordvalue. examples the following example resets the css display property to its defaults, setting the inline style attribute to style="display: initial" if viewed in the developer tools inspector. #myelement { display: flex; } <div id="myelement">check the developer tools to see the log in the console and to inspect the style attribute on this div.</div> let keyword = new csskeywordvalue('initial'); let myelement = document.getelementbyid('myelement').attributestylemap; myelement.set('display', keyword); console.log( myelement.get('display').value); // 'initial' console.dir( keyword ); specifications specification status comment css typed om level 1the definition of 'csskeywordvalue' in that specification. working draft initial definition.
CSSPrimitiveValue.getRGBColorValue() - Web APIs
the getrgbcolorvalue() method of the cssprimitivevalue interface is used to get an rgb color value. if this css value doesn't contain a rgb color value, a domexception is raised. modification to the corresponding style property can be achieved using the rgbcolor interface. syntax var rgbcolorvalue = cssprimitivevalue.getrgbcolorvalue(); return value an rgbcolor object representing the color value. exceptions type description domexception an invalid_access_err is raised if the attached property can't return an rgb color value (i.e. this is not css_rgbcolor). ...
...ce. syntax var rgbcolorvalue = cssprimitivevalue.getrgbcolorvalue(); return value an rgbcolor object representing the color value. exceptions type description domexception an invalid_access_err is raised if the attached property can't return an rgb color value (i.e. this is not css_rgbcolor). example var cs = window.getcomputedstyle(document.body); var cssvalue = cs.getpropertycssvalue("color"); console.log(cssvalue.getrgbcolorvalue()); specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssprimitivevalue.getrgbcolorvalue' in that specification. obsolete initial definition ...
CSSPrimitiveValue.getRectValue() - Web APIs
the getrectvalue() method of the cssprimitivevalue interface is used to get a rect value. if this css value doesn't contain a rect value, a domexception is raised. modification to the corresponding style property can be achieved using the rect interface. syntax var rectvalue = cssprimitivevalue.getrectvalue(); return value a rect object representing the rect value. exceptions type description domexception an invalid_access_err is raised if the css value doesn't contain a rect value. (i.e. this is not css_rect). ...
...erface. syntax var rectvalue = cssprimitivevalue.getrectvalue(); return value a rect object representing the rect value. exceptions type description domexception an invalid_access_err is raised if the css value doesn't contain a rect value. (i.e. this is not css_rect). example var cs = window.getcomputedstyle(document.getelementbyid("clippeddiv")); var cssvalue = cs.getpropertycssvalue("clip"); console.log(cssvalue.getrectvalue()); specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssprimitivevalue.getrectvalue' in that specification. obsolete initial definition ...
CSSPrimitiveValue.setStringValue() - Web APIs
the setstringvalue() method of the cssprimitivevalue interface is used to set a string value. if the property attached to this value can't accept the specified unit or the string value, the value will be unchanged and a domexception will be raised. syntax cssprimitivevalue.setstringvalue(stringtype, stringvalue); parameters stringtype an unsigned short representing the type of the value. possible values are: constant description css_attr the value is an attr() function. css_ident the value is an identifier. css_string the value is a <string>. css_uri the value is a <uri>. stringvalue a domstring representing the new string value. return value void. exceptions type description ...
...tr the value is an attr() function. css_ident the value is an identifier. css_string the value is a <string>. css_uri the value is a <uri>. stringvalue a domstring representing the new string value. return value void. exceptions type description domexception an invalid_access_err is raised if the css value doesn't contain a string value or if the string value can't be converted into the specified unit. an no_modification_allowed_err is raised if this property is read-only. specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssprimitivevalue.setstringvalue' in that specification. obsolete ini...
CSSKeywordValue.value - Web APIs
the value property of the csskeywordvalue interface returns or sets the value of the csskeywordvalue. syntax var val = csskeywordvalue.value csskeywordvalue.value = val value a usvstring. examples the following example resets the css display property to its defaults. let indicator = document.getelementbyid('indicator'); indicator.attributestylemap.set('display', new csskeywordvalue('initial')); indicator.attributestylemap.get('display').value // 'initial' specifications specification status comment css typed om level 1the definition of 'undefined' in that specification. working draft initial definition. ...
CSSPrimitiveValue.getCounterValue() - Web APIs
the getcountervalue() method of the cssprimitivevalue interface is used to get the counter value. if this css value doesn't contain a counter value, a domexception is raised. modification to the corresponding style property can be achieved using the counter interface. syntax var countervalue = cssprimitivevalue.getcountervalue(); return value a counter object representing the counter value. exceptions type description domexception an invalid_access_err is raised if the css value doesn't contain a counter value (e.g. this is not css_counter). specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssprimitivevalue.getcountervalue' in that specification. obsolete ...
CSSPrimitiveValue.getStringValue() - Web APIs
the getstringvalue() method of the cssprimitivevalue interface is used to get a string value. if this css value doesn't contain a string value, a domexception is raised. syntax var stringvalue = cssprimitivevalue.getstringvalue(); return value a string value. exceptions type description domexception an invalid_access_err is raised if the css value doesn't contain a string value. example var cs = window.getcomputedstyle(document.body); var cssvalue = cs.getpropertycssvalue("display"); console.log(cssvalue.getstringvalue()); specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssprimitivevalue.getstringvalue' in that specification. obsolete initial definitio...
CSSUnitValue.CSSUnitValue() - Web APIs
the cssunitvalue() constructor creates a new cssunitvalue object which returns a new cssunitvalue object which represents values that contain a single unit type. for example, "42px" would be represented by a cssnumericvalue. syntax var cssunitvalue = new cssunitvalue() parameters value returns a double indicating the number of units. unit returns a usvstring indicating the type of unit. examples the following shows a method of creating a csspositionvalue from individual cssunitvalue constructors. let pos = new csspositionvalue( new cssunitvalue(5, "px"), new cssunitvalue(10, "px")); specifications specification status comment css typed om level 1the definition of 'cssunitvalue' in that specification. working draft initial definition. ...
CSSUnitValue.value - Web APIs
the cssunitvalue.value property of the cssunitvalue interface returns a double indicating the number of units. syntax var cssunitvalue = cssunitvalue.value; cssunitvalue.value = cssunitvalue; value a double. examples the following creates a csspositionvalue from individual cssunitvalue constructors, then queries the cssunitvalue.value. let pos = new csspositionvalue( new cssunitvalue( 5, "px" ), new cssunitvalue( 10, "px" )); console.log( pos.x.value ); // 5 console.log( pos.y.value ); // 10 specifications specification status comment css typed om level 1the definition of 'cssunitvalue.value' in that specification. working draft initial definition. ...
CSSUnparsedValue.CSSUnparsedValue() - Web APIs
the cssunparsedvalue() constructor creates a new cssunparsedvalue object which represents 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.values() - Web APIs
the cssunparsedvalue.values() method returns a new array iterator object that contains the values for each index in the cssunparsedvalue object. syntax cssunparsedvalue.values() parameters none. return value a new array. specifications specification status comment css typed om level 1the definition of 'values()' in that specification. working draft initial definition. ...
CSS values and units - Learn web development
previous overview: building blocks next every property used in css has a value or set of values that are allowed for that property, and taking a look at any property page on mdn will help you understand the values that are valid for any particular property. in this lesson we will take a look at some of the most common values and units in use. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn about the different types of values and units used in css properties. ...
...ake a look at some of the most common values and units in use. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn about the different types of values and units used in css properties. what is a css value? ...
...sic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn about the different 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 t...
...And 43 more matches
Key Values - Web APIs
the tables below list the standard key values in various categories of key, with an explanation of what the key is typically used for. corresponding virtual keycodes for common platforms are included where available. ...
... the tables below list the standard key values in various categories of key, with an explanation of what the key is typically used for. corresponding virtual keycodes for common platforms are included where available. ...
... the tables below list the standard key values in various categories of key, with an explanation of what the key is typically used for. corresponding virtual keycodes for common platforms are included where available. ...
...And 34 more matches
Adapting to the new two-value syntax of display - CSS: Cascading Style Sheets
for example, an <h1> or a <p> are block-level by default, and a <span> is inline-level. using the display property we can switch between block and inline. for example to make a heading inline we would use the following css: h1 { display: inline; } more recently we have gained css grid layout and flexbox. ...
...for example, an <h1> or a <p> are block-level by default, and a <span> is inline-level. using the display property we can switch between block and inline. for example to make a heading inline we would use the following css: h1 { display: inline; } more recently we have gained css grid layout and flexbox. ...
...at some elements are block-level and some are inline-level. for example, an <h1> or a <p> are block-level by default, and a <span> is inline-level. using the display property we can switch between block and inline. for example to make a heading inline we would use the following css: h1 { display: inline; } more recently we have gained css grid layout and flexbox. to access these we also use values of the display property — display: grid and display: flex. only when the value of display is changed do the children become flex or grid items and begin to respond to the other properties in the grid or flexbox specifications. changing an element's display value changes the formatting context of its direct children. what grid and flexbox demonstrate, however, is that an element has both an ou...
...And 27 more matches
Value definition syntax - CSS: Cascading Style Sheets
for example: auto, smaller or ease-in. ...
...for example: auto, smaller or ease-in. ...
...for example: auto, smaller or ease-in. ...
...And 22 more matches
CSS values and units - CSS: Cascading Style Sheets
textual data types <custom-ident> pre-defined keywords as an <ident> <string> <url> text data types are either <string>, a quoted series of characters, or an <ident>, a "css identifier" which is an unquoted string. a <string> must be quoted with either single or double quotes. ...
... textual data types <custom-ident> pre-defined keywords as an <ident> <string> <url> text data types are either <string>, a quoted series of characters, or an <ident>, a "css identifier" which is an unquoted string. a <string> must be quoted with either single or double quotes. ...
...data types <custom-ident> pre-defined keywords as an <ident> <string> <url> text data types are either <string>, a quoted series of characters, or an <ident>, a "css identifier" which is an unquoted string. a <string> must be quoted with either single or double quotes. css identifiers, listed in the specifications as <ident> or <custom-ident>, must be unquoted. ...
...And 19 more matches
CSSPrimitiveValue - Web APIs
the cssprimitivevalue interface derives from the cssvalue interface and represents the current computed value of a css property. this interface represents a single css value. it may be used to determine the value of a specific style property currently set in a block or to set a specific style property explicitly within the block. an instance of this interface might be obtained from the getpropertycssvalue() method of the cssstyledeclaration interface. a cssprimitivevalue object only occurs in a context of a css property. conversions are allowed between absolute values (from millimeters to centimeters, from degrees to radians, and so on) but not between relative values. ...
...y explicitly within the block. an instance of this interface might be obtained from the getpropertycssvalue() method of the cssstyledeclaration interface. a cssprimitivevalue object only occurs in a context of a css property. conversions are allowed between absolute values (from millimeters to centimeters, from degrees to radians, and so on) but not between relative values. (for example, a pixel value cannot be converted to a centimeter value.) percentage values can't be converted since they are relative to the parent value (or another property value). there is one exception for color percentage values: since a color percentage value is relative to the range 0-255, a color percentage value can be converted to a number (see also the rgbcolor interface). <div id="interfacediagram" style="di...
... be converted to a number (see also the rgbcolor interface). ...
...And 17 more matches
Using the aria-valuemin attribute - Accessibility
note: opinions may differ on how assistive technology should handle this technique. ...
... note: opinions may differ on how assistive technology should handle this technique. ...
... note: opinions may differ on how assistive technology should handle this technique. ...
...And 16 more matches
JS::Value
js::value is the type of javascript values in the jsapi. a c++ variable of type js::value represents a value in javascript: a string, number, object (including arrays and functions), boolean, symbol, null, or undefined. js::value is a class whose internal structure is an implementation detail. embeddings should not rely on observed representation details or upon the size of js::value. ...
...is the type of javascript values in the jsapi. a c++ variable of type js::value represents a value in javascript: a string, number, object (including arrays and functions), boolean, symbol, null, or undefined. js::value is a class whose internal structure is an implementation detail. embeddings should not rely on observed representation details or upon the size of js::value. ...
...alue represents a value in javascript: a string, number, object (including arrays and functions), boolean, symbol, null, or undefined. js::value is a class whose internal structure is an implementation detail. embeddings should not rely on observed representation details or upon the size of js::value. ...
...And 15 more matches
CSS grids, logical values, and writing modes - CSS: Cascading Style Sheets
in these guides, i have already touched on an important feature of grid layout: the support for different writing modes that is built into the specification. for this guide, we will look at this feature of grid and other modern layout methods, learning a little about writing modes and logical vs. physical properties as we do so. logical and physical properties and values css is full of physical positioning keywords – left and right, top and bottom. if we position an item using absolute positioning, we use these physical keywords as offset values to push the item around. in the code snippet below, the item is placed 20 pixels from the top, and 30 pixels from the left of the container: .container { position: relative; } .item { position: absolute; top: 20px; left: 30px; } <...
...n’t even need to be working in a rtl language to take a look. in the example below, i have two paragraphs. one has no text-align property set, the second has text-align set to left. i have added dir="rtl" to the html element, which switches the writing mode from the default for an english language document of ltr. ...
... text-align set to left. i have added dir="rtl" to the html element, which switches the writing mode from the default for an english language document of ltr. you can see that the first paragraph remains left to right, due to the text-align value being left . the second however, switches direction and the text runs from right to left . this is a very simple example of the problem with physical values and properties being used in css. they prevent the browser being able to do the work to switch writing mode, as they make the assumption that the text is flowing left to right and top to bottom. logical properties and values logical properties and values do not make an assumption about text direction. which is why in grid layout we use the keyword start when aligning something to the start of ...
...And 12 more matches
AudioParam.setValueAtTime() - Web APIs
returns a reference to this audioparam object. in some browsers older implementations of this interface return void. ...
... returns a reference to this audioparam object. in some browsers older implementations of this interface return void. ...
... returns a reference to this audioparam object. in some browsers older implementations of this interface return void. ...
...And 11 more matches
@font-feature-values - CSS: Cascading Style Sheets
the @font-feature-values css at-rule lets you use a common name in the font-variant-alternates property for features activated differently in opentype. this can help simplify your css when using multiple fonts. the @font-feature-values at-rule may be used either at the top level of your css or inside any css conditional-group at-rule. syntax feature value blocks @swash specifies a feature name that will work with the swash() functional notation of font-variant-alternates. a swash feature value definition allows only one value: ident1: 2 is valid, but ident2: 2 4 isn't. @annotation specifies a feature name that will work with the annotation() functional notation of font-variant-alternates. ...
...at-rule. syntax feature value blocks @swash specifies a feature name that will work with the swash() functional notation of font-variant-alternates. a swash feature value definition allows only one value: ident1: 2 is valid, but ident2: 2 4 isn't. @annotation specifies a feature name that will work with the annotation() functional notation of font-variant-alternates. an annotation feature value definition allows only one value: ident1: 2 is valid, but ident2: 2 4 isn't. @ornaments specifies a feature name that will work with the ornaments() functional notation of font-variant-alternates. an ornaments feature value definition allows only one value: ident1: 2 is valid, but ident2: 2 4 isn't. @stylistic specifies a feature name that will work with the stylistic() functional notation of...
...s valid, but ident2: 2 4 isn't. @ornaments specifies a feature name that will work with the ornaments() functional notation of font-variant-alternates. an ornaments feature value definition allows only one value: ident1: 2 is valid, but ident2: 2 4 isn't. @stylistic specifies a feature name that will work with the stylistic() functional notation of font-variant-alternates. a stylistic feature value definition allows only one value: ident1: 2 is valid, but ident2: 2 4 isn't. @styleset specifies a feature name that will work with the styleset() functional notation of font-variant-alternates. ...
...And 11 more matches
List of default Accept values - HTTP
this article documents the default values for the http accept header for specific inputs and browser versions. default values these are the values sent when the context doesn't give better information. note that all browsers add the */* mime type to cover all cases. this is typically used for requests initiated via the address bar of a browser, or via an html <a> element. ...
...his article documents the default values for the http accept header for specific inputs and browser versions. default values these are the values sent when the context doesn't give better information. note that all browsers add the */* mime type to cover all cases. this is typically used for requests initiated via the address bar of a browser, or via an html <a> element. ...
... via an html <a> element. user agent value comment firefox text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 (since firefox 66) text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 (in firefox 65) text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 (before) in firefox 65 and earlier, this value can be modified using the network.http.accept.default parameter. (source) safari, chrome text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8 (source) safari 5 text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 this is an improvement over earlier accept headers as it no longer ranks image/png above text/...
...And 11 more matches
NPN_SetValue - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api summary implemented by browsers. this call is used to inform the browser of variable information controlled by the plugin. syntax #include <npapi.h> nperror npn_setvalue(npp instance, nppvariable variable, void *value); parameters the function has the following parameters: instance pointer to the plugin instance setting the variable. ...
...ed by browsers. this call is used to inform the browser of variable information controlled by the plugin. syntax #include <npapi.h> nperror npn_setvalue(npp instance, nppvariable variable, void *value); parameters the function has the following parameters: instance pointer to the plugin instance setting the variable. ...
... description a good place to set plugin operation mode such as windowless mode is npp_new, so the browser knows right aw...
...And 10 more matches
AudioParam.linearRampToValueAtTime() - Web APIs
returns a reference to this audioparam object. in some browsers older implementations of this interface return void. ...
... returns a reference to this audioparam object. in some browsers older implementations of this interface return void. ...
... returns a reference to this audioparam object. in some browsers older implementations of this interface return void. ...
...And 10 more matches
AudioParam.setValueCurveAtTime() - Web APIs
the setvaluecurveattime() method of the audioparam interface schedules the parameter's value to change following a curve defined by a list of values. the curve is a linear interpolation between the sequence of values defined in an array of floating-point values, which are scaled to fit into the given interval starting at starttime and a specific duration. syntax var paramref = param.setvaluecurveattime(values, starttime, duration); parameters values an array of floating-point numbers representing the value curve the audioparam will change through along the specified duration. every value in the array must be a finite number; if any value is nan, infinity, or -infinity, a typeerror exception is thrown. starttime a double representing the time (in seconds) after the audiocontext was fir...
...n); parameters values an array of floating-point numbers representing the value curve the audioparam will change through along the specified duration. every value in the array must be a finite number; if any value is nan, infinity, or -infinity, a typeerror exception is thrown. starttime a double representing the time (in seconds) after the audiocontext was first created that the change in value will happen. if this value is lower than audiocontext.currenttime, it is clamped to currenttime. duration a double representing the total time (in seconds) over which the parameter's value will change following the specified curve. the specified values are spaced equally along this duration. return value a reference to this audioparam object. some older browser implementations of this interf...
...ed to currenttime. duration a double representing the total time (in seconds) over which the parameter's value will change following the specified curve. the specified values are spaced equally along this duration. return value a reference to this audioparam object. some older browser implementations of this interface return undefined. exceptions invalidstateerror the specified array of values has fewer than 2 items in it. rangeerror the specified starttime is either negative or a non-finite value, or duration is not a finite, strictly positive number. typeerror one or more of the values in the values array is non-finite. non-finite values are nan, infinity, and -infinity. ...
...And 10 more matches
Function return values - Learn web development
previous overview: building blocks next there's one last essential concept about functions for us to discuss — return values. some functions don't return a significant value, but others do. it's important to understand what their values are, how to use them in your code, and how to make functions return useful values. we'll cover all of these below. prerequisites: basic computer literacy, a basic understanding of html and css, javascript first steps, functions — reusable blocks of code. objective: to understand function return values, and how to make use of them. ...
... values are, how to use them in your code, and how to make functions return useful values. we'll cover all of these below. prerequisites: basic computer literacy, a basic understanding of html and css, javascript first steps, functions — reusable blocks of code. objective: to understand function return values, and how to make use of them. what are return values? return values are just what they sound like — the values that a function returns when it has completed. you've already met return values a number of times, although you may not have thought about them explicitly. let's return to a familiar example (from a previous article in this series): let mytext = 'the weather is cold'; let newstring = mytext.replace('cold', 'warm'); console.log(newst...
...ld print "the weather is warm" // the replace() string function takes a string, // replaces one substring with another, and returns // a new string with the replacement made the replace() function is invoked on the mytext string, and is passed two parameters: the substring to find ('cold'). the string to replace it with ('warm'). when the function completes (finishes running), it returns a value, which is a new string with the replacement made. in the code above, the result of this return value is saved in the variable newstring. if you look at the replace() function mdn reference page, you'll see a section called return value. it is very useful to know and understand what values are returned by functions, so we try to include this information wherever possible. some functions don't re...
...And 9 more matches
JS_GetNaNValue
for example, 0/0 and math.sqrt(-1) both return nan. so do number("xyzzy") and math.sin("frank"). ...
...for example, 0/0 and math.sqrt(-1) both return nan. so do number("xyzzy") and math.sin("frank"). ...
...for example, 0/0 and math.sqrt(-1) both return nan. so do number("xyzzy") and math.sin("frank"). ...
...And 9 more matches
mozIStorageValueArray
the mozistoragevaluearray interface obtains provides methods to obtain data from a given result. for an introduction on how to use this interface, see the storage overview document. storage/public/mozistoragevaluearray.idlscriptable please add a summary to this article. last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) inherits from: nsisupports method overview long gettypeofindex(in unsigned long aindex); long getint32(in unsigned long aindex); long long getint64(in unsigned long aindex); double getdouble(in unsigned long aindex); autf8string getutf8string(in unsigned long aindex); astring getstring(in unsigned long aindex); void getblob(in unsigned long aindex, out unsigned long adatas...
... astring getstring(in unsigned long aindex); void getblob(in unsigned long aindex, out unsigned long adatasize, [array,size_is(adatasize)] out octet adata); boolean getisnull(in unsigned long aindex); attributes attribute type description numentries unsigned long the number of entries in the array. constants constant value description value_type_null 0 null data type. value_type_integer 1 integer data type. value_type_float 2 float data type. value_type_text 3 text data type. value_type_blob 4 blob data type. methods gettypeofindex() returns the type of the value at the given column index. long gettypeofindex( in unsigned lo...
... getint32() obtains a int32 from the specified index. ...
...And 9 more matches
IDBCursorWithValue - Web APIs
operations are performed on the underlying index or object store. note: this feature is available in web workers. ...
...operations are performed on the underlying index or object store. note: this feature is available in web workers. ...
...has a source that indicates which index or object store it is iterating over. it has a position within the range, and moves in a direction that is increasing or decreasing in the order of record keys. the cursor enables an application to asynchronously process all the records in the cursor's range. you can have an unlimited number of cursors at the same time. you always get the same idbcursorwithvalue object representing a given cursor. operations are performed on the underlying index or object store. note: this feature is available in web workers. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" ...
...And 9 more matches
Using the aria-valuenow attribute - Accessibility
the aria-valuenow attribute is used to define the current value for a range widget such as a slider, spinbutton or progressbar. if the current value is not known, the author should not set the aria-valuenow attribute. if the aria-valuenow has a known minimum and maximum value, authors should set the aria-valuemin and aria-valuemax attributes. when the rendered value cannot be accurately represented as a number, authors should use the aria-valuetext attribute in conjunction with aria-valuenow to provide a user-friendly representation of the range's current value. for example, a slider may have rendered values of small, medium, and large. ...
...aximum value, authors should set the aria-valuemin and aria-valuemax attributes. when the rendered value cannot be accurately represented as a number, authors should use the aria-valuetext attribute in conjunction with aria-valuenow to provide a user-friendly representation of the range's current value. for example, a slider may have rendered values of small, medium, and large. in this case, the values of aria-valuenow could range from 1 through 3, which indicate the position of each value in the value space, but the aria-valuetext would be one of the strings: small, medium, or large. aria-valuenow is a required attribute of role slider, scrollbar and spinbutton. ...
... of the range's current value. for example, a slider may have rendered values of small, medium, and large. in this case, the values of aria-valuenow could range from 1 through 3, which indicate the position of each value in the value space, but the aria-valuetext would be one of the strings: small, medium, or large. aria-valuenow is a required attribute of role slider, scrollbar and spinbutton. value string representation of a number possible effects on user agents and assistive technology for elements with role progressbar and scrollbar, assistive technologies should render the actual value as a percentage, calculated as a position on the range from aria-valuemin to aria-valuemax if both are defined, otherwise the actual value with a percent indicator. for elements with role slider and ...
...And 9 more matches
WinRegValue - Archive of obsolete content
winregvalue constructor (windows only) creates a winregvalue object. syntax winregvalue ( int datatype, byte[] regdata); parameters the winregvalue constructor takes the following parameter: datatype an integer indicating the type of the data encapsulated by this object. ...
... winregvalue constructor (windows only) creates a winregvalue object. syntax winregvalue ( int datatype, byte[] regdata); parameters the winregvalue constructor takes the following parameter: datatype an integer indicating the type of the data encapsulated by this object. ...
... winregvalue constructor (windows only) creates a winregvalue object. syntax winregvalue ( int datatype, byte[] regdata); parameters the winregvalue constructor takes the following parameter: datatype an integer indicating the type of the data encapsulated by this object. ...
...And 8 more matches
value - Archive of obsolete content
« xul reference home value type: string the string attribute allows you to associate a data value with an element. it is not used for any specific purpose, but you can access it with a script for your own use. be aware, however, that some elements, such as textbox will display the value visually, so in order to merely associate data with an element, you could 1) use another attribute like "value2" or "data-myatt" (as in the html5 draft), as xul does not require validation (less future-proof); 2) use setattributens() to put custom attributes in a non-xul namespace (serializable and future-proof); 3) use setuserdata() (future-proof and clean, but not easily serializable). for user editable menulist elements, the contents, as visible to the user, are read and set using the menulist.v...
...t), as xul does not require validation (less future-proof); 2) use setattributens() to put custom attributes in a non-xul namespace (serializable and future-proof); 3) use setuserdata() (future-proof and clean, but not easily serializable). ...
... does not require validation (less future-proof); 2) use setattributens() to put custom attributes in a non-xul namespace (serializable and future-proof); 3) use setuserdata() (future-proof and clean, but not easily serializable). ...
...And 8 more matches
AudioParam.value - Web APIs
Web › API › AudioParam › value
the web audio api's audioparam interface property value gets or sets the value of this audioparam at the current time. initially, the value is set to audioparam.defaultvalue. setting value has the same effect as calling audioparam.setvalueattime with the time returned by the audiocontext's currenttime property.. syntax var curvalue = audioparam.value; audioparam.value = newvalue; value a floating-point number indicating the parameter's value as of the current time. this value will be between the values specified by the minvalue and maxvalue properties. ...
...tting value has the same effect as calling audioparam.setvalueattime with the time returned by the audiocontext's currenttime property.. syntax var curvalue = audioparam.value; audioparam.value = newvalue; value a floating-point number indicating the parameter's value as of the current time. this value will be between the values specified by the minvalue and maxvalue properties. usage notes value precision and variation the data type used internally to store value is a single-precision (32-bit) floating point number, while javascript uses 64-bit double-precision floating point numbers. as a result, the value you read from the value property may not always exactly equal what you set it to. consider this example: const source = new audiobuffersourcenode(...); const rate = 5.3; source.pla...
... and variation the data type used internally to store value is a single-precision (32-bit) floating point number, while javascript uses 64-bit double-precision floating point numbers. as a result, the value you read from the value property may not always exactly equal what you set it to. consider this example: const source = new audiobuffersourcenode(...); const rate = 5.3; source.playbackrate.value = rate; console.log(source.playbackrate.value === rate); the log output will be false, because the playback rate parameter, rate, was converted to the 32-bit floating-point number closest to 5.3, which yields 5.300000190734863. ...
...And 8 more matches
CSSNumericValue.max() - Web APIs
some of the following examples illustrate what happens when they are not. ...
...some of the following examples illustrate what happens when they are not. ...
...some of the following examples illustrate what happens when they are not. ...
...And 8 more matches
Array.prototype.values() - JavaScript
the values() method returns a new array iterator object that contains the values for each index in the array. syntax arr.values() return value a new array iterator object. examples iteration using for...of loop var arr = ['a', 'b', 'c', 'd', 'e']; var iterator = arr.values(); for (let letter of iterator) { console.log(letter); } //"a" "b" "c" "d" "e" array.prototype.values is default implementation of array.prototype[symbol.iterator]. ...
...he values for each index in the array. syntax arr.values() return value a new array iterator object. examples iteration using for...of loop var arr = ['a', 'b', 'c', 'd', 'e']; var iterator = arr.values(); for (let letter of iterator) { console.log(letter); } //"a" "b" "c" "d" "e" array.prototype.values is default implementation of array.prototype[symbol.iterator]. ...
.....of loop var arr = ['a', 'b', 'c', 'd', 'e']; var iterator = arr.values(); for (let letter of iterator) { console.log(letter); } //"a" "b" "c" "d" "e" array.prototype.values is default implementation of array.prototype[symbol.iterator]. ...
...And 8 more matches
CSSKeywordValue - Web APIs
examples the following example resets the css display property to its defaults, setting the inline style attribute to style="display: initial" if viewed in the developer tools inspector. ...
... examples the following example resets the css display property to its defaults, setting the inline style attribute to style="display: initial" if viewed in the developer tools inspector. ...
... examples the following example resets the css display property to its defaults, setting the inline style attribute to style="display: initial" if viewed in the developer tools inspector. ...
...And 7 more matches
CSSNumericValue.equals() - Web APIs
some of the following examples illustrate what happens when they are not. ...
...some of the following examples illustrate what happens when they are not. ...
...some of the following examples illustrate what happens when they are not. ...
...And 7 more matches
CSSNumericValue.min() - Web APIs
some of the following examples illustrate what happens when they are not. ...
...some of the following examples illustrate what happens when they are not. ...
...some of the following examples illustrate what happens when they are not. ...
...And 7 more matches
CSSPrimitiveValue.primitiveType - Web APIs
the primitivetype read-only 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. ...
...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 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. ...
...le> 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 using the getfloatvalue method. css_ident the value is an identifier. ...
...And 7 more matches
PaymentCurrencyAmount.value - Web APIs
the paymentcurrencyamount property value is a string containing the decimal numeric value of the payment, specified in the currency units indicated by the currency property. the contents of this string must be a valid decimal number; that is, some number of digits between 0 and 9 with up to one optional decimal point. an optional leading minus sign ("-") can be included to indicate a negative value, such as to represent a refund or discount. important note: the number given in this string is always specified using the period (".") as the decimal point, rather than the comma (","), even if the user's locale normally uses the comma. you must convert the entered text to this form or it will not be valid. ...
...this must be a valid decimal number, with an optional leading minus sign ("-"), then one or more decimal digits 0 through 9, optionally with a decimal point (".") with at least one digit following it to represent fractional units. ...
...this must be a valid decimal number, with an optional leading minus sign ("-"), then one or more decimal digits 0 through 9, optionally with a decimal point (".") with at least one digit following it to represent fractional units. ...
...And 7 more matches
Used value - CSS: Cascading Style Sheets
the used value of a css property is its value after all calculations have been performed on the computed value. after the user agent has finished its calculations, every css property has a used value. the used values of dimensions (e.g., width, line-height) are in pixels. the used values of shorthand properties (e.g., background) are consistent with those of their component properties (e.g., background-color or background-size) and with position and float. note: the getcomputedstyle() dom api returns the resolved value, which may either be the computed value or the used value, depending on the property. ...
...he used values of shorthand properties (e.g., background) are consistent with those of their component properties (e.g., background-color or background-size) and with position and float. note: the getcomputedstyle() dom api returns the resolved value, which may either be the computed value or the used value, depending on the property. ...
...the ...
...And 7 more matches
Object.prototype.valueOf() - JavaScript
the valueof() method returns the primitive value of the specified 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 object.valueof() return value the primitive value of the specified object. a (unary) plus sign can sometimes be used as a shorthand for valueof, e.g. in +new number()). also see using unary plus. description javascript calls the valueof method to convert an object to a primitive value. you rarely need to invoke the valueof method yourself; javascript automatically invokes it when encountering an object where a primitive value is expected. ...
...d object. a (unary) plus sign can sometimes be used as a shorthand for valueof, e.g. in +new number()). also see using unary plus. description javascript calls the valueof method to convert an object to a primitive value. you rarely need to invoke the valueof method yourself; javascript automatically invokes it when encountering an object where a primitive value is expected. by default, the valueof method is inherited by every object descended from object. every built-in core object overrides this method to return an appropriate value. if an object has no primitive value, valueof returns the object itself. you can use valueof within your own code to convert a built-in object into a primitive value. ...
... by default, the valueof method is inherited by every object descended from object. every built-in core object overrides this method to return an appropriate value. if an object has no primitive value, valueof returns the object itself. you can use valueof within your own code to convert a built-in object into a primitive value. when you create a custom object, you can override object.prototype.valueof() to call a custom method instead of the default object method. overriding valueof for custom objects you can create a function to be called in place of the default valueof method. your function must take no arguments. suppose you have an object type mynumbertype and you want to create a valueof method for it. ...
...And 7 more matches
NPN_GetValue - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api summary allows the plug-in to query the browser for information. syntax #include <npapi.h> nperror npn_getvalue(npp instance, npnvariable variable, void *value); parameters this function has the following parameters: instance pointer to the current plug-in instance. variable information the call gets. ...
...r side plug-in api summary allows the plug-in to query the browser for information. syntax #include <npapi.h> nperror npn_getvalue(npp instance, npnvariable variable, void *value); parameters this function has the following parameters: instance pointer to the current plug-in instance. variable information the call gets. ...
...sofflinebool: tells whether offline mode is enabled; true=offline mode enabled, false=not enabled npnvtoolkit: npnvsupportsxembedbool: npnvwindownpobject: returns the npobject * pointer for the dom window object; see getting the page url in npapi plugin for a rough example npnvpluginelementnpobject: npnvsupportswindowless: tells whether the browser supports windowless plugins. ...
...And 6 more matches
JS_TypeOfValue
determines the js data type of a js value. syntax jstype js_typeofvalue(jscontext *cx, js::handle<js::value> v); name type description cx jscontext * the context in which to perform the type check. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handle&lt;js::value&gt; the value to examine. description js_typeofvalue examines a specified js value, v, and returns its js data type. the return value is always one of jstype_void, jstype_object, jstype_function, jstype_string, jstype_number, or jstype_boolean. ...
...s_threadsafe build, the caller must be in a request on this jscontext. v js::handle&lt;js::value&gt; the value to examine. description js_typeofvalue examines a specified js value, v, and returns its js data type. the return value is always one of jstype_void, jstype_object, jstype_function, jstype_string, jstype_number, or jstype_boolean. ...
...ld, the caller must be in a request on this jscontext. v js::handle&lt;js::value&gt; the value to examine. description js_typeofvalue examines a specified js value, v, and returns its js data type. the return value is always one of jstype_void, jstype_object, jstype_function, jstype_string, jstype_number, or jstype_boolean. ...
...And 6 more matches
JS_ValueToNumber
obsolete since jsapi 24this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. replaced by js::tonumber. convert any javascript value to a floating-point number of type jsdouble. syntax jsbool js_valuetonumber(jscontext *cx, jsval v, jsdouble *dp); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v jsval the value to convert. dp jsdouble * out parameter. on success, *dp receives the converted floating-point value. description js_valuetonumber converts a javascript value to a number. it im...
...ng-point value. description js_valuetonumber converts a javascript value to a number. it implements the tonumber operator described in ecma 262-3 §9.3. if v is already a number, conversion succeeds. if v is undefined, null, false, or true, conversion succeeds, and the result is nan, 0, 0, or 1 respectively. if v is a string, conversion proceeds as specified in ecma 262-3 §9.3.1. js_valuetonumber always succeeds in this case, returning js_true. if the string is not a numeric string, *dp is set to nan. otherwise v is an object. js_valuetonumber carries out the following steps to convert it to a number. if at any step an error or exception occurs, or conversion succeeds, the rest of the steps are skipped. ...
...2-3 §9.3.1. js_valuetonumber always succeeds in this case, returning js_true. if the string is not a numeric string, *dp is set to nan. otherwise v is an object. js_valuetonumber carries out the following steps to convert it to a number. if at any step an error or exception occurs, or conversion succeeds, the rest of the steps are skipped. (this behavior is implemented by v's jsobjectops.defaultvalue hook, so host objects can override it all.) first, the object's jsclass.convert callback is called. for objects of standard classes, this is js_convertstub, which simply calls v.valueof() if present. if the convert callback produces a primitive value, the value is converted to a number as described above and conversion succeeds. otherwise, the resulting object's tostring method, if any, ...
...And 6 more matches
nsMsgSearchOpValue
nsmsgsearchopvalue defined in comm-central/ mailnews/ base/ search/ public/ nsmsgsearchcore.idl 146 typedef long nsmsgsearchopvalue; 147 148 [scriptable, uuid(9160b196-6fcb-4eba-aaaf-6c806c4ee420)] 149 interface nsmsgsearchop { 150 const nsmsgsearchopvalue contains = 0; /* for text attributes */ 151 const nsmsgsearchopvalue doesntcontain = 1; 152 const nsmsgsearchopvalue is = 2; /* is and isn't also apply to some non-text attrs */ 153 const nsmsgsearchopvalue isnt = 3; 154 const nsmsgsearchopvalue isempty = 4; 155 156 const nsmsgsearchopvalue isbefore = 5; /* for date attributes */ 157 const nsmsgsearchopvalue isafter = 6; 158 159 const nsmsgsearchopvalue ishigherthan = 7; /* for priority. is also applies */ 160 const nsmsgsearchop...
...2; /* is and isn't also apply to some non-text attrs */ 153 const nsmsgsearchopvalue isnt = 3; 154 const nsmsgsearchopvalue isempty = 4; 155 156 const nsmsgsearchopvalue isbefore = 5; /* for date attributes */ 157 const nsmsgsearchopvalue isafter = 6; 158 159 const nsmsgsearchopvalue ishigherthan = 7; /* for priority. ...
.../ 153 const nsmsgsearchopvalue isnt = 3; 154 const nsmsgsearchopvalue isempty = 4; 155 156 const nsmsgsearchopvalue isbefore = 5; /* for date attributes */ 157 const nsmsgsearchopvalue isafter = 6; 158 159 const nsmsgsearchopvalue ishigherthan = 7; /* for priority. ...
...And 6 more matches
HTMLDialogElement.returnValue - Web APIs
examples the following example displays a button to open a <dialog> containing a form via the showmodal() method. from there, either button will close the dialog. ...
... examples the following example displays a button to open a <dialog> containing a form via the showmodal() method. from there, either button will close the dialog. ...
... examples the following example displays a button to open a <dialog> containing a form via the showmodal() method. from there, either button will close the dialog. ...
...And 6 more matches
Using the aria-valuemax attribute - Accessibility
description the aria-valuemax attribute is used to define the maximum value allowed for a range widget such as a slider, spinbutton or progressbar. if the aria-valuenow has a known maximum and minimum, the author should provide properties for aria-valuemax and aria-valuemin. the value of aria-valuemax must be greater than or equal to the value of aria-valuemin. aria-valuemax is a required attribute of role slider, scrollbar and spinbutton. value string representation of a number possible effects on user agents and assistive technology if the aria-valuemax is indeterminate, or if aria-valuemin is not less than or equal to the value of aria-valuemax, this creates an error condition that will be handled by the assistive technology. note: opinions may differ on how assistive tech...
...ia-valuemin is not less than or equal to the value of aria-valuemax, this creates an error condition that will be handled by the assistive technology. note: opinions may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples example 1: the snippet below shows a simple slider with a maximum value of 10. ...
...to the value of aria-valuemax, this creates an error condition that will be handled by the assistive technology. note: opinions may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples example 1: the snippet below shows a simple slider with a maximum value of 10. ...
...And 6 more matches
Using the aria-valuetext attribute - Accessibility
the aria-valuetext attribute is used to define the human readable text alternative of aria-valuenow for a range widget such as progressbar, spinbutton or slider. authors should only set the aria-valuetext attribute when the rendered value cannot be accurately represented as a number. for example, a slider may have rendered values of small, medium, and large. in this case, the values of aria-valuenow could range from 1 through 3, which indicate the position of each value in the value space, but thearia-valuetext would be one of the strings: small, medium, or large. ...
...ould only set the aria-valuetext attribute when the rendered value cannot be accurately represented as a number. for example, a slider may have rendered values of small, medium, and large. in this case, the values of aria-valuenow could range from 1 through 3, which indicate the position of each value in the value space, but thearia-valuetext would be one of the strings: small, medium, or large. value string representation of a number possible effects on user agents and assistive technology if the aria-valuetext attribute is absent, assistive technologies will rely solely on the aria-valuenow attribute for the current value. if aria-valuetext is specified, assistive technologies should render that value instead of the value of aria-valuenow. note: opinions may differ on how assistive tech...
...nt value. if aria-valuetext is specified, assistive technologies should render that value instead of the value of aria-valuenow. note: opinions may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples example 1: the snippet below shows a simple slider for selecting a day of the week. the value of the slider is numeric, and the aria-valuetext attribute is used to provide the name of the day. the application would programmatically update aria-valuetext depending on aria-valuenow. ...
...And 6 more matches
Basic concepts of Logical Properties and Values - CSS: Cascading Style Sheets
start and end as opposed to left and right/top and bottom. ...
...start and end as opposed to left and right/top and bottom. ...
...start and end as opposed to left and right/top and bottom. ...
...And 6 more matches
JS::HandleValueArray
this article covers features introduced in spidermonkey 31 a handle to an array of rooted values. syntax js::handlevaluearray(const js::rootedvalue& value); js::handlevaluearray(const js::autovaluevector& values); js::handlevaluearray(const js::autovaluearray<n>& values); js::handlevaluearray(const js::callargs& args); js::handlevaluearray::frommarkedlocation(size_t len, const js::value *elements); js::handlevaluearray::subarray(const js::handlevaluearray& values, size_t startindex, size_t len); js::handlevaluearray::empty(); name type description value js::rootedvalue &amp; an element of newly created 1-length array. ...
... js::callargs& args); js::handlevaluearray::frommarkedlocation(size_t len, const js::value *elements); js::handlevaluearray::subarray(const js::handlevaluearray& values, size_t startindex, size_t len); js::handlevaluearray::empty(); name type description value js::rootedvalue &amp; an element of newly created 1-length array. values js::autovaluevector &amp; elements of newly created array. values js::autovaluearray &amp; elements of newly created array. args js::callargs &amp; elements of newly created array. len size_t (frommarkedlocation only) length of elements array or (subarray only) length of sub array of values. ...
...gth array. values js::autovaluevector &amp; elements of newly created array. values js::autovaluearray &amp; elements of newly created array. args js::callargs &amp; elements of newly created array. len size_t (frommarkedlocation only) length of elements array or (subarray only) length 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. ...
...And 5 more matches
CSSStyleValue.parseAll() - Web APIs
specifications specification status comment css typed om level 1the definition of 'parseall()' in that specification. ...
... specifications specification status comment css typed om level 1the definition of 'parseall()' in that specification. ...
... specifications specification status comment css typed om level 1the definition of 'parseall()' in that specification. ...
...And 5 more matches
Using the CSS properties and values API - Web APIs
the css properties and values api — part of the css houdini umbrella of apis — allows the registration of css custom properties, allowing for property type checking, default values, and properties that do or do not inherit their value. registering a custom property registering a custom property allows you to tell the browser how the custom property should behave; what are allowed types, whether the custom property inherits its value, and what the default value of the custom property is. there are two ways to register a property, in javascript or in css. note: the javascript option has working implementations. the css option does not. ...
...whether the custom property inherits its value, and what the default value of the custom property is. there are two ways to register a property, in javascript or in css. note: the javascript option has working implementations. the css option does not. css.registerproperty the following will register a css custom properties, --my-prop, using css.registerproperty, as a color, give it a default value, and have it not inherit its value: window.css.registerproperty({ name: '--my-prop', syntax: '<color>', inherits: false, initialvalue: '#c0ffee', }); @property the same registration can take place in css. ...
...-prop, using css.registerproperty, as a color, give it a default value, and have it not inherit its value: window.css.registerproperty({ name: '--my-prop', syntax: '<color>', inherits: false, initialvalue: '#c0ffee', }); @property the same registration can take place in css. ...
...And 5 more matches
TypeError: cyclic object value - JavaScript
the javascript exception "cyclic object value" occurs when object references were found in json. json.stringify() doesn't try to solve them and fails accordingly. message typeerror: cyclic object value (firefox) typeerror: converting circular structure to json (chrome and opera) typeerror: circular reference in value argument not supported (edge) error type typeerror what went wrong? the json format per se doesn't support object references (although an ietf draft exists), hence json.stringify() doesn't try to solve them and fails accordingly. examples circular references in a circular structure like the following var circularreference = {otherdata: 123}; circularreference.myself = circularreference; json.stringify() will fail json.stringify(circularreference); // typeerror: cycli...
... se doesn't support object references (although an ietf draft exists), hence json.stringify() doesn't try to solve them and fails accordingly. examples circular references in a circular structure like the following var circularreference = {otherdata: 123}; circularreference.myself = circularreference; json.stringify() will fail json.stringify(circularreference); // typeerror: cyclic object value to serialize circular references you can use a library that supports them (e.g. cycle.js) or implement a solution by yourself, which will require finding and replacing (or removing) the cyclic references by serializable values. the snippet below illustrates how to find and filter (thus causing data loss) a cyclic reference by using the replacer parameter of json.stringify(): const getcircular...
...upports them (e.g. cycle.js) or implement a solution by yourself, which will require finding and replacing (or removing) the cyclic references by serializable values. ...
...And 5 more matches
Object.values() - JavaScript
the object.values() method returns an array of a given object's own enumerable property values, in the same order as that provided by a for...in loop. (the only difference is that a for...in loop enumerates properties in the prototype chain as well.) the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.values(obj) parameters obj the object whose enumerable own property values are to be returned. return value an array containing the given object's own enumerable property values. description object.values() returns an array whose elements are the enumerable property values found on the object. the o...
... object.values(obj) parameters obj the object whose enumerable own property values are to be returned. return value an array containing the given object's own enumerable property values. description object.values() returns an array whose elements are the enumerable property values found on the object. the ordering of the properties is the same as that given by looping over the property values of the object manually. polyfill to add compatible object.values support in older environments that do not natively support it, you can find a polyfill in the tc39/proposal-object-values-entries or in the es-shims/object.values repositories. ...
... property values found on the object. the ordering of the properties is the same as that given by looping over the property values of the object manually. polyfill to add compatible object.values support in older environments that do not natively support it, you can find a polyfill in the tc39/proposal-object-values-entries or in the es-shims/object.values repositories. ...
...And 5 more matches
JS::DoubleValue
this article covers features introduced in spidermonkey 24 convert a c floating-point number of type double to a js::value. syntax js::value js::doublevalue(double dbl) name type description dbl double c double to convert. description js::doublevalue converts a c floating-point number of type double to js::value, the type of javascript values. the result is an floating-point js::value. ...
...ating-point number of type double to a js::value. syntax js::value js::doublevalue(double dbl) name type description dbl double c double to convert. description js::doublevalue converts a c floating-point number of type double to js::value, the type of javascript values. the result is an floating-point js::value. ...
... number of type double to a js::value. syntax js::value js::doublevalue(double dbl) name type description dbl double c double to convert. description js::doublevalue converts a c floating-point number of type double to js::value, the type of javascript values. the result is an floating-point js::value. ...
...And 4 more matches
JS::Float32Value
this article covers features introduced in spidermonkey 24 convert a c floating-point number of type float to a js::value. syntax js::value js::float32value(float f) name type description f float c float to convert. description js::float32value converts a c floating-point number of type float to js::value, the type of javascript values. the result is an floating-point js::value. ...
... c floating-point number of type float to a js::value. syntax js::value js::float32value(float f) name type description f float c float to convert. description js::float32value converts a c floating-point number of type float to js::value, the type of javascript values. the result is an floating-point js::value. ...
...-point number of type float to a js::value. syntax js::value js::float32value(float f) name type description f float c float to convert. description js::float32value converts a c floating-point number of type float to js::value, the type of javascript values. the result is an floating-point js::value. ...
...And 4 more matches
JS::Int32Value
this article covers features introduced in spidermonkey 24 convert a c signed 32-bit integer of type int32_t to a js::value. syntax js::value js::int32value(int32_t i32) name type description i32 int32_t c integer to convert. description js::int32value converts a c signed 32-bit integer of type int32_t to js::value, the type of javascript values. the result is an integer js::value. ...
...c signed 32-bit integer of type int32_t to a js::value. syntax js::value js::int32value(int32_t i32) name type description i32 int32_t c integer to convert. description js::int32value converts a c signed 32-bit integer of type int32_t to js::value, the type of javascript values. the result is an integer js::value. ...
...-bit integer of type int32_t to a js::value. syntax js::value js::int32value(int32_t i32) name type description i32 int32_t c integer to convert. description js::int32value converts a c signed 32-bit integer of type int32_t to js::value, the type of javascript values. the result is an integer js::value. ...
...And 4 more matches
JS::NumberValue
this article covers features introduced in spidermonkey 24 convert a c integer or floating-point value to a js::value. syntax js::value js::numbervalue(float f) js::value js::numbervalue(double dbl) js::value js::numbervalue(int8_t i) js::value js::numbervalue(uint8_t i) js::value js::numbervalue(int16_t i) js::value js::numbervalue(uint16_t i) js::value js::numbervalue(int32_t i) js::value js::numbervalue(uint32_t i) name type description f or dbl or i any c integer or floating-point value to convert. description js::numbervalue converts a c integer or floating-point value to js::value, the type of javascript values. ...
...js::value js::numbervalue(uint16_t i) js::value js::numbervalue(int32_t i) js::value js::numbervalue(uint32_t i) name type description f or dbl or i any c integer or floating-point value to convert. description js::numbervalue converts a c integer or floating-point value to js::value, the type of javascript values. ...
...s::numbervalue(uint16_t i) js::value js::numbervalue(int32_t i) js::value js::numbervalue(uint32_t i) name type description f or dbl or i any c integer or floating-point value to convert. description js::numbervalue converts a c integer or floating-point value to js::value, the type of javascript values. ...
...And 4 more matches
JS_ConvertValue
obsolete since jsapi 38this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. converts a javascript value to a value of a specific javascript type. syntax bool js_convertvalue(jscontext *cx, js::handlevalue v, jstype type, js::mutablehandlevalue vp); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handlevalue the value to convert. type jstype the type to which the value is to be converted. type must be one of jstype_void, jstype_object, jstype_function, jstype_string, jstype_number, ...
...text in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handlevalue the value to convert. type jstype the type to which the value is to be converted. type must be one of jstype_void, jstype_object, jstype_function, jstype_string, jstype_number, or jstype_boolean. otherwise js_convertvalue reports an error. vp js::mutablehandlevalue out parameter. on success, *vp receives the converted value. description js_convertvalue converts a javascript value, v, to the specified type. on success, the converted value is stored in *vp. typically users of this function set vp to point to v, so that if conversion is successful, v now contains the converted value. js_conver...
...reports an error. vp js::mutablehandlevalue out parameter. on success, *vp receives the converted value. description js_convertvalue converts a javascript value, v, to the specified type. on success, the converted value is stored in *vp. typically users of this function set vp to point to v, so that if conversion is successful, v now contains the converted value. js_convertvalue calls other, type-specific conversion routines based on the type argument. converting any value to jstype_void always succeeds. the result is undefined value. converting to jstype_object works exactly like js::toobject if v.isnullorundefined() is false, otherwise the result is nullptr. ...
...And 4 more matches
JS_SameValue
this article covers features introduced in spidermonkey 1.8.1 determines if two jsvals are the same, as determined by the samevalue algorithm in ecmascript 262, 5th edition. samevalue slightly differs from strict equality (===) in that +0 and -0 are not the same and in that nan is the same as nan. ...
... this article covers features introduced in spidermonkey 1.8.1 determines if two jsvals are the same, as determined by the samevalue algorithm in ecmascript 262, 5th edition. samevalue slightly differs from strict equality (===) in that +0 and -0 are not the same and in that nan is the same as nan. ...
... this article covers features introduced in spidermonkey 1.8.1 determines if two jsvals are the same, as determined by the samevalue algorithm in ecmascript 262, 5th edition. samevalue slightly differs from strict equality (===) in that +0 and -0 are not the same and in that nan is the same as nan. ...
...And 4 more matches
Crypto.getRandomValues() - Web APIs
the crypto.getrandomvalues() method lets you get cryptographically strong random values. the array given as the parameter is filled with random numbers (random in its cryptographic meaning). to guarantee enough performance, implementations are not using a truly random number generator, but they are using a pseudo-random number generator seeded with a value with enough entropy. the pseudo-random number generator algorithm (prng) may vary across user agents, but is suitable for cryptographic purposes. implementations are required to use a seed with enough entropy, like a system-level entropy source. getrandomvalues() is the only member of the crypto interface which can be used from an insecure context. ...
... value with enough entropy. the pseudo-random number generator algorithm (prng) may vary across user agents, but is suitable for cryptographic purposes. implementations are required to use a seed with enough entropy, like a system-level entropy source. getrandomvalues() is the only member of the crypto interface which can be used from an insecure context. syntax typedarray = cryptoobj.getrandomvalues(typedarray); parameters typedarray an integer-based typedarray, that is an int8array, a uint8array, an int16array, a uint16array, an int32array, 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, ...
... there is no minimum degree of entropy mandated by the web cryptography specification. ...
...And 4 more matches
KeyboardEvent: code values - Web APIs
the following tables show what code values are used for each native scancode or virtual keycode on major platforms. the reason is that some browsers choose to interpret physical keys differently, there are some differences in which keys map to which codes. these tables show those variations when known. code values code values on windows this table shows the windows scan codes representing keys and the keyboardevent.code values which correspond to those hardware keys. only keys which generate scan codes on windows are listed. ...
...t physical keys differently, there are some differences in which keys map to which codes. these tables show those variations when known. code values code values on windows this table shows the windows scan codes representing keys and the keyboardevent.code values which correspond to those hardware keys. only keys which generate scan codes on windows are listed. ...
... virtual keycode gecko chromium (48) kvk_ansi_a (0x00) "keya" "keya" kvk_ansi_s (0x01) "keys" "keys" kvk_ansi_d (0x02) "keyd" "keyd" kvk_ansi_f...
...And 4 more matches
URLSearchParams.values() - Web APIs
living standard initial definition. ...
... living standard initial definition. ...
... living standard initial definition. ...
...And 4 more matches
XRWebGLLayerInit.ignoreDepthValues - Web APIs
the xrwebgllayerinit dictionary's boolean ignoredepthvalues property can be provided in the options passed into the xrwebgllayer() constructor to indicate that the depth buffer, if it exists, should be ignored while composing the scene. the depth buffer is typically used to assist in ordering vertices and, by extension, polygons while compositing, to ensure that the scene is correctly composited, with objects the correct distance away and with clipping and other distance-related computations performed as accurately as possible. without the depth buffer, these computations must rely entirely on the coordinates of each pixel. ...
...at the scene is correctly composited, with objects the correct distance away and with clipping and other distance-related computations performed as accurately as possible. without the depth buffer, these computations must rely entirely on the coordinates of each pixel. ...
...ng and other distance-related computations performed as accurately as possible. without the depth buffer, these computations must rely entirely on the coordinates of each pixel. this property differs from depth in that depth requests a webgl layer that does not have a depth buffer at all, while ignoredepthvalues merely asks that the depth layer be ignored. syntax let layerinit = { ignoredepthvalues: boolvalue }; let gllayer = new xrwebgllayer(xrsession, gl, layerinit); let gllayer = new xrwebgllayer(xrsession, gl, { ignoredepthvalues: boolvalue }); value a boolean value which can be set to true to disable the use of the depth buffer by the webgl rendering layer created by the xrwebgllayer() constructor. the default value, false, means the depth buffer will be used, if available. usage...
...And 4 more matches
values - SVG: Scalable Vector Graphics
Web › SVG › Attribute › values
the values attribute has different meanings, depending upon the context where itʼs used, either it defines a sequence of values used over the course of an animation, or itʼs a list of numbers for a color matrix, which is interpreted differently depending on the type of color change to be performed. five elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, <animatetransform>, and <fecolormatrix> animate, animatecolor, animatemotion, animatetransform for <animate>, <animatecolor>, <animatemotion>, and <animatetransform>, values is a list of values defining the sequence of values over the course of the animation. if this attribute is specified, any from, to, and by attribute values set on the element are ignored. ...
...ecolor>, <animatemotion>, <animatetransform>, and <fecolormatrix> animate, animatecolor, animatemotion, animatetransform for <animate>, <animatecolor>, <animatemotion>, and <animatetransform>, values is a list of values defining the sequence of values over the course of the animation. if this attribute is specified, any from, to, and by attribute values set on the element are ignored. value <list-of-values> default value none animatable no <list-of-values> the value holds a semicolon-separated list of one or more values. the type of the values is defined by the href and attributename attributes. fecolormatrix for the <fecolormatrix> element, values is a list of numbers interpreted differently depending on the value of the type attribute. ...
...list-of-values> default value none animatable no <list-of-values> the value holds a semicolon-separated list of one or more values. the type of the values is defined by the href and attributename attributes. fecolormatrix for the <fecolormatrix> element, values is a list of numbers interpreted differently depending on the value of the type attribute. ...
...And 4 more matches
NPP_GetValue - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary allows the browser to query the plug-in for information. syntax #include <npapi.h> nperror npp_getvalue(void *instance, nppvariable variable, void *value); parameters the function has the following parameters: instance pointer to the plugin instance from which the value should come. variable variable for which the browser (caller) would like a value. the full list is in the npapi headers. value value for the requested variable. returns if successful, the function returns nperr_no_error. ...
...n has the following parameters: instance pointer to the plugin instance from which the value should come. variable variable for which the browser (caller) would like a value. the full list is in the npapi headers. value value for the requested variable. returns if successful, the function returns nperr_no_error. if unsuccessful, the function returns an error code. for possible values, see error codes. ...
...inter to the plugin instance from which the value should come. variable variable for which the browser (caller) would like a value. the full list is in the npapi headers. value value for the requested variable. returns if successful, the function returns nperr_no_error. if unsuccessful, the function returns an error code. for possible values, see error codes. description npp_getvalue retrieves instance variables. ...
...And 3 more matches
::-ms-value - Archive of obsolete content
other properties are ignored. ...
...other properties are ignored. ...
...other properties are ignored. ...
...And 3 more matches
JS_GetPositiveInfinityValue
retrieve a floating-point infinity as a value of type js::value. syntax // added in spidermonkey 42 js::value js_getpositiveinfinityvalue(jscontext *cx); js::value js_getnegativeinfinityvalue(jscontext *cx); // obsolete since spidermonkey 42 jsval js_getpositiveinfinityvalue(jscontext *cx); jsval js_getnegativeinfinityvalue(jscontext *cx); name type description cx jscontext * a context. description js_getpositiveinfinityvalue returns a js::value that represents an ieee floating-point positive infinity. js_getnegativeinfinityvalue returns the corresponding negative infinity. infinities are typically used to represent numbers that are greater in magnitude than the greatest representable finite values. ...
...me type description cx jscontext * a context. description js_getpositiveinfinityvalue returns a js::value that represents an ieee floating-point positive infinity. js_getnegativeinfinityvalue returns the corresponding negative infinity. infinities are typically used to represent numbers that are greater in magnitude than the greatest representable finite values. as a value in mathematical calculations, an infinite value behaves like infinity. for example, any nonzero value multiplied by infinity is infinity with the expected sign, and any finite value divided by infinity is zero (again with the expected sign). to get a floating-point nan, use js_getnanvalue. ...
...n the greatest representable finite values. as a value in mathematical calculations, an infinite value behaves like infinity. for example, any nonzero value multiplied by infinity is infinity with the expected sign, and any finite value divided by infinity is zero (again with the expected sign). to get a floating-point nan, use js_getnanvalue. ...
...And 3 more matches
JS_NewNumberValue
the result is an integer jsval if d can be stored that way. otherwise, a new floating-point jsval is created. ...
... the result is an integer jsval if d can be stored that way. otherwise, a new floating-point jsval is created. ...
... instead convert a c floating-point number of type jsdouble to a jsval. syntax jsbool js_newnumbervalue(jscontext *cx, jsdouble d, jsval *rval); name type description cx jscontext * the context in which to create the new number. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. d jsdouble the numeric value to convert. rval jsval * out parameter. on success, *rval receives a javascript number with the value d. description js_newnumbervalue converts a c floating-point number of type jsdouble to jsval, the type of javascript values. ...
...And 3 more matches
JS_ValueToFunction
convert a js::value to a jsfunction. syntax jsfunction * js_valuetofunction(jscontext *cx, js::handlevalue v); jsfunction * js_valuetoconstructor(jscontext *cx, js::handlevalue v); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handlevalue the value to convert. description js_valuetofunction converts a specified javascript value, v, to a function. js_valuetoconstructor is the exactly same function as js_valuetofunction. this conversion is dangerous and almost entirely useless, because the resulting jsfunction is not a real function object and therefore cannot be safely passed to any other jsapi fu...
...tion. that includes js_callfunction() and js_getfunctionobject(). a jsfunction represents only the compiled code and not the environment of the function. unless the function happens to be a native function, this means it isn't attached to any global or enclosing scope, and therefore must not be treated like a real function. instead, use jsval_is_object and js_objectisfunction() to check whether a value is already a function, or use js_convertvalue() to convert a value to jstype_function safely. if v is a function object, this returns the associated jsfunction. if v is null, undefined, a boolean, a number, or a string, a typeerror is reported and js_valuetofunction returns null. otherwise, v is an object. the javascript engine attempts to convert it to a function. (implementation note: the...
...safely. if v is a function object, this returns the associated jsfunction. if v is null, undefined, a boolean, a number, or a string, a typeerror is reported and js_valuetofunction returns null. otherwise, v is an object. the javascript engine attempts to convert it to a function. (implementation note: the actual conversion is performed by the object itself. the object's jsobjectops.defaultvalue method is called with hint=jstype_function.) js_valuetofunction returns a pointer to the converted function. ...
...And 3 more matches
JS_ValueToId
convert a js::value to type jsid. syntax bool js_valuetoid(jscontext *cx, js::handlevalue v, js::mutablehandleid idp); bool js_stringtoid(jscontext *cx, js::handlestring s, js::mutablehandleid idp); // added in spidermonkey 38 bool js_indextoid(jscontext *cx, uint32_t index, js::mutablehandleid idp); // added in spidermonkey 17 bool js_charstoid(jscontext* cx, js::twobytechars chars, js::mutablehandleid idp); // added in spidermonkey 24 void js::protokeytoid(jscontext *cx, jsprotokey key, js::mutablehandleid idp); // added in spidermonkey 38 name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handlevalue the js value to convert. s j...
... value to convert. s js::handlestring the js string to convert. index uint32_t an unsigned integer index of array to convert. chars js::twobytechars the string to convert. key jsprotokey the prototype key to convert. idp js::mutablehandleid out parameter. on success, *idp receives the converted jsid. description js_valuetoid converts a specified js::value, v, to a jsid. if v is an integer, *idp receives an integer jsid. otherwise, if e4x support is enabled and v is an object, *idp receives an object jsid. otherwise, *idp receives an interned string jsid based on the value of v. if v is not a string, it is converted to a string as if by calling js_valuetostring. js_stringtoid and js_charstoid convert a specified ...
...eives an object jsid. otherwise, *idp receives an interned string jsid based on the value of v. if v is not a string, it is converted to a string as if by calling js_valuetostring. js_stringtoid and js_charstoid convert a specified string to a jsid. js_indextoid converts a specified integer index to an integer jsid. js::protokeytoid converts a specified prototype key to a jsid. on success, js_valuetoid stores the converted value in *idp and returns true. otherwise it returns false. the inverse of js_valuetoid is js_idtovalue. ...
...And 3 more matches
JS_ValueToObject
converts any javascript value to an object. syntax bool js_valuetoobject(jscontext *cx, js::handlevalue v, js::mutablehandleobject objp); name type description cx jscontext * the context in which to convert the value. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handlevalue the value to convert. objp js::mutablehandleobject out parameter. on success, *objp receives null or a pointer to the resulting object. description js_valuetoobject converts a specified javascript value, v, to an object. on success, this function stores either null or a pointer to the resulting object in *objp and returns true. ...
...andlevalue the value to convert. objp js::mutablehandleobject out parameter. on success, *objp receives null or a pointer to the resulting object. description js_valuetoobject converts a specified javascript value, v, to an object. on success, this function stores either null or a pointer to the resulting object in *objp and returns true. otherwise it returns false and the value left in *objp is unspecified. if v is jsval_null or jsval_void, the result is null. if v is a boolean value, a number, or a string, the result is a new wrapper object of type boolean, number, or string. otherwise v is an object, and the result depends on the object. if v is a native javascript object, this calls the object's valueof method, if any. in any case, the result is not guaranteed to...
... null. if v is a boolean value, a number, or a string, the result is a new wrapper object of type boolean, number, or string. otherwise v is an object, and the result depends on the object. if v is a native javascript object, this calls the object's valueof method, if any. in any case, the result is not guaranteed to be the same object as v. (implementation note: the object's jsobjectops.defaultvalue method is called with hint=jstype_object.) the resulting object is subject to garbage collection unless the variable *objp is protected by a local root scope, an object property, or the js_addroot function. ...
...And 3 more matches
JS_ValueToSource
on error or exception, it returns null. this happens, for example, if v is an object and v.tosource() throws an exception. ...
...on error or exception, it returns null. this happens, for example, if v is an object and v.tosource() throws an exception. ...
...on error or exception, it returns null. this happens, for example, if v is an object and v.tosource() throws an exception. ...
...And 3 more matches
JS_ValueToString
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. convert a jsval to a jsstring. syntax jsstring * js_valuetostring(jscontext *cx, jsval v); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v jsval the value to convert. description js_valuetostring converts a specified javascript value, v, to a string. it implements the tostring operator specified in ecma 262-3 §9.8. the result is like the javascript expression ""+v. if v is already a string, conversion succeeds. if v is t...
...ds, and the result is the string "true", "false", "null", or "undefined", accordingly. if v is a number, conversion succeeds, and the result is a string representation of that number as specified in ecma 262-3 §9.8.1. this might be "nan", "infinity", or "-infinity". otherwise the result is a decimal representation of the number, possibly using exponential notation. otherwise v is an object. ...
...s might be "nan", "infinity", or "-infinity". otherwise the result is a decimal representation of the number, possibly using exponential notation. otherwise v is an object. js_valuetostring uses the steps below to convert it to a string. if at any point an error or exception occurs, or conversion succeeds, the rest of the steps are skipped. (this behavior is implemented by v's jsobjectops.defaultvalue method, so host objects can override it all.) if v.tostring() is a function, it is called. if that method returns a primitive value, the value is converted to a string as described above and conversion succeeds. otherwise, the resulting object's jsclass.convert callback is called. for standard classes, this is js_convertstub, which simply calls v.valueof() if present. if the convert cal...
...And 3 more matches
IAccessibleValue
other-licenses/ia2/accessiblevalue.idlnot scriptable this interface gives access to a single numerical value. 1.0 66 introduced gecko 1.9 inherits from: iunknown last changed in gecko 1.9 (firefox 3) the iaccessiblevalue interface represents a single numerical value and should be implemented by any class that supports numerical value like progress bars and spin boxes. this interface lets you access the value and its upper and lower bounds. method overview [propget] hresult currentvalue([out] variant currentvalue ); [propget] hresult maximumvalue([out] variant maximumvalue ); [propget] hresult minimumvalue([out] variant minimumvalue ); hresult setcurrentvalue([in] variant value ); methods currentvalue() returns the value of this object as a number. t...
...currentvalue([out] variant currentvalue ); [propget] hresult maximumvalue([out] variant maximumvalue ); [propget] hresult minimumvalue([out] variant minimumvalue ); hresult setcurrentvalue([in] variant value ); methods currentvalue() returns the value of this object as a number. the exact return type is implementation dependent. typical types are long and double. [propget] hresult currentvalue( [out] variant currentvalue ); parameters currentvalue returns the current value represented by this object. see the section about. return value s_false if there is nothing to return, [out] value is null. s_ok. maximumvalue() returns the maximal value that can be represented by this object. the type of the returned value is implementation dependent. it does not have to be the same type as th...
...e ); parameters currentvalue returns the current value represented by this object. see the section about. return value s_false if there is nothing to return, [out] value is null. s_ok. maximumvalue() returns the maximal value that can be represented by this object. the type of the returned value is implementation dependent. it does not have to be the same type as that returned by method currentvalue(). [propget] hresult maximumvalue( [out] variant maximumvalue ); parameters maximumvalue returns the maximal value in an implementation dependent type. if this object has no upper bound then an empty object is returned. see the section about. return value s_ok. minimumvalue() returns the minimal value that can be represented by this object. ...
...And 3 more matches
CSSMathValue - Web APIs
event handlers no methods none. examples we create an element with a width determined using a calc() function, then console.log() the operator. ...
... event handlers no methods none. examples we create an element with a width determined using a calc() function, then console.log() the operator. ...
... event handlers no methods none. examples we create an element with a width determined using a calc() function, then console.log() the operator. ...
...And 3 more matches
Node.nodeValue - Web APIs
Web › API › Node › nodeValue
the nodevalue property of the node interface returns or sets the value of the current node. syntax str = node.nodevalue; node.nodevalue = str; value str is a string containing the value of the current node, if any. for the document itself, nodevalue returns null. for text, comment, and cdata nodes, nodevalue returns the content of the node. for attribute nodes, the value of the attribute is returned. ...
...turns or sets the value of the current node. syntax str = node.nodevalue; node.nodevalue = str; value str is a string containing the value of the current node, if any. for the document itself, nodevalue returns null. for text, comment, and cdata nodes, nodevalue returns the content of the node. for attribute nodes, the value of the attribute is returned. ...
...tax str = node.nodevalue; node.nodevalue = str; value str is a string containing the value of the current node, if any. for the document itself, nodevalue returns null. for text, comment, and cdata nodes, nodevalue returns the content of the node. for attribute nodes, the value of the attribute is returned. ...
...And 3 more matches
RadioNodeList.value - Web APIs
if the underlying element collection contains radio buttons, the radionodelist.value property represents the checked radio button. on retrieving the value property, the value of the currently checked radio button is returned as a string. if the collection does not contain any radio buttons or none of the radio buttons in the collection is in checked state, the empty string is returned. on setting the value property, the first radio button input element whose value property is equal to the new value will be set to checked. ...
...rieving the value property, the value of the currently checked radio button is returned as a string. if the collection does not contain any radio buttons or none of the radio buttons in the collection is in checked state, the empty string is returned. on setting the value property, the first radio button input element whose value property is equal to the new value will be set to checked. ...
...erty, the value of the currently checked radio button is returned as a string. if the collection does not contain any radio buttons or none of the radio buttons in the collection is in checked state, the empty string is returned. on setting the value property, the first radio button input element whose value property is equal to the new value will be set to checked. ...
...And 3 more matches
XRInputSourceArray.values() - Web APIs
each pass through the loop, source is the next xrinputsource in the list. ...
...each pass through the loop, source is the next xrinputsource in the list. ...
...each pass through the loop, source is the next xrinputsource in the list. ...
...And 3 more matches
XRWebGLLayer.ignoreDepthValues - Web APIs
the read-only xrwebgllayer property ignoredepthvalues is a boolean value which is true if the session has been configured to ignore the values in the depth buffer while rendering the scene. if the depth buffer is being used to determine the position of vertices, this property is false. the value of ignoredepthvalues can only be set when the xrwebgllayer is instantiated, by setting the corresponding value in the xrwebgllayerinit object specified as the constructor's layerinit parameter. as a parameter you're likely to set yourself, it is unlikely you'll need to read it later, but it's available if the need arises. ...
...alse. the value of ignoredepthvalues can only be set when the xrwebgllayer is instantiated, by setting the corresponding value in the xrwebgllayerinit object specified as the constructor's layerinit parameter. as a parameter you're likely to set yourself, it is unlikely you'll need to read it later, but it's available if the need arises. syntax let ignoringdepthbuffer = xrwebgllayer.ignoredepthvalues; value a boolean value which is true if the webgl context's depth buffer is being used while computing the locations of points in the 3d world. otherwise, if this is true, the depth buffer's values are being used to assist in placing objects in the scene. ...
...need arises. syntax let ignoringdepthbuffer = xrwebgllayer.ignoredepthvalues; value a boolean value which is true if the webgl context's depth buffer is being used while computing the locations of points in the 3d world. otherwise, if this is true, the depth buffer's values are being used to assist in placing objects in the scene. since the xr compositor uses the depth buffer by default, this value is false unless explicitly set otherwise when creating the xrwebgllayer using its constructor, xrwebgllayer(). usage notes when the ignoredepthvalues property is false, the xr compositor uses the values found in the depth buffer, which should be accurate for the scene, in order to potentially improve the quality or the output as well as the comfort level for the viewer. the depth buffer is fra...
...And 3 more matches
CSS Logical Properties and Values - CSS: Cascading Style Sheets
the physical meaning of these terms depends on the writing mode. ...
...the physical meaning of these terms depends on the writing mode. ...
...the physical meaning of these terms depends on the writing mode. ...
...And 3 more matches
tableValues - SVG: Scalable Vector Graphics
the tablevalues attribute defines a list of numbers defining a lookup table of values for a for a color component transfer function. ...
...adient id="gradient" gradientunits="userspaceonuse" x1="0" y1="0" x2="200" y2="0"> <stop offset="0" stop-color="#ff0000" /> <stop offset="0.5" stop-color="#00ff00" /> <stop offset="1" stop-color="#0000ff" /> </lineargradient> </defs> <filter id="componenttransfer1" x="0" y="0" width="100%" height="100%"> <fecomponenttransfer> <fefuncr type="table" tablevalues="0 1"/> <fefuncg type="table" tablevalues="0 1"/> <fefuncb type="table" tablevalues="0 1"/> </fecomponenttransfer> </filter> <filter id="componenttransfer2" x="0" y="0" width="100%" height="100%"> <fecomponenttransfer> <fefuncr type="table" tablevalues="1 0"/> <fefuncg type="table" tablevalues="1 0"/> <fefuncb type="table" tablevalues="1 0"/> </fecom...
...each number can be between 0 and 1. ...
...And 3 more matches
deleteValue - Archive of obsolete content
returns 0 if it succeeded; a nonzero number if it failed to schedule the deletion. ...
... returns 0 if it succeeded; a nonzero number if it failed to schedule the deletion. ...
... returns 0 if it succeeded; a nonzero number if it failed to schedule the deletion. ...
...And 2 more matches
valueExists - Archive of obsolete content
valueexists returns whether a value for the given key exists. method of winreg object syntax boolean valueexists ( string key, string value ); parameters the method has the following parameters: key a string representing the path to the key. value a string representing the value being queried. returns boolean value: true if the key exists and the user has read access to it, otherwise false. ...
...eters the method has the following parameters: key a string representing the path to the key. value a string representing the value being queried. returns boolean value: true if the key exists and the user has read access to it, otherwise false. ...
... parameters: key a string representing the path to the key. value a string representing the value being queried. returns boolean value: true if the key exists and the user has read access to it, otherwise false. ...
...And 2 more matches
NPP_SetValue - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary implemented by plugins. this call is used to inform plugins of variable information controlled by the browser. syntax #include <npapi.h> nperror npp_setvalue(void *instance, npnvariable variable, void *value); parameters the function has the following parameters: instance pointer to plugin instance on which to set the variable. variable the variable being set. value value for the variable being set. ...
... void *value); parameters the function has the following parameters: instance pointer to plugin instance on which to set the variable. variable the variable being set. value value for the variable being set. returns if successful, the function should return nperr_no_error. if unsuccessful, the function should return the most relevant npapi error code. for possible values, see error codes. ...
...rameters: instance pointer to plugin instance on which to set the variable. variable the variable being set. value value for the variable being set. returns if successful, the function should return nperr_no_error. if unsuccessful, the function should return the most relevant npapi error code. ...
...And 2 more matches
JS::AutoValueArray
this article covers features introduced in spidermonkey 31 root an internal fixed-size array of js::values. syntax js::autovaluearray<n> vp(cx); name type description cx jscontext * the context in which to add the root. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. n size_t size of a js::value array. description js::autovaluearray<n> holds a rooted array of js::value. this is typically used for local variables being passed to function which requires js::handlevaluearray or a pointer to js::value array. examples pass to function as a pointer to js::value. ...
... on this jscontext. n size_t size of a js::value array. description js::autovaluearray<n> holds a rooted array of js::value. this is typically used for local variables being passed to function which requires js::handlevaluearray or a pointer to js::value array. examples pass to function as a pointer to js::value. bool somefunction1(jscontext *cx, unsigned argc, const js::value *argv) { /* ... */ } js::autovaluearray<2> args(cx); /* ... initialize args[0] and args[1] here ... */ somefunction1(cx, 2, args.begin()); pass to function as js::handlevaluearray. bool somefunction2(jscontext *cx, const js::handlevaluearray &args) { /* ... */ } js::autovaluearray<2> args(cx); /* ... initialize args[0] and args[1] here ... */ somefunction2(cx, args); see also mxr id...
.../ } js::autovaluearray<2> args(cx); /* ... initialize args[0] and args[1] here ... */ somefunction1(cx, 2, args.begin()); pass to function as js::handlevaluearray. bool somefunction2(jscontext *cx, const js::handlevaluearray &args) { /* ... */ } js::autovaluearray<2> args(cx); /* ... initialize args[0] and args[1] here ... ...
...And 2 more matches
JS::BooleanValue
this article covers features introduced in spidermonkey 24 convert a c boolean of type bool to a js::value. syntax js::value js::booleanvalue(bool boo) name type description boo bool c bool to convert. description js::booleanvalue converts a c boolean of type bool to js::value, the type of javascript values. ...
... this article covers features introduced in spidermonkey 24 convert a c boolean of type bool to a js::value. syntax js::value js::booleanvalue(bool boo) name type description boo bool c bool to convert. description js::booleanvalue converts a c boolean of type bool to js::value, the type of javascript values. ...
...cle covers features introduced in spidermonkey 24 convert a c boolean of type bool to a js::value. syntax js::value js::booleanvalue(bool boo) name type description boo bool c bool to convert. description js::booleanvalue converts a c boolean of type bool to js::value, the type of javascript values. ...
...And 2 more matches
JS::DoubleNaNValue
this article covers features introduced in spidermonkey 24 create a not-a-number (nan) floating-point number as a value of type js::value. syntax js::value js::doublenanvalue() description js::doublenanvalue returns a value of type js::value that represents an ieee floating-point quiet not-a-number (nan). ...
... this article covers features introduced in spidermonkey 24 create a not-a-number (nan) floating-point number as a value of type js::value. syntax js::value js::doublenanvalue() description js::doublenanvalue returns a value of type js::value that represents an ieee floating-point quiet not-a-number (nan). ...
... article covers features introduced in spidermonkey 24 create a not-a-number (nan) floating-point number as a value of type js::value. syntax js::value js::doublenanvalue() description js::doublenanvalue returns a value of type js::value that represents an ieee floating-point quiet not-a-number (nan). ...
...And 2 more matches
JS::FalseValue
this article covers features introduced in spidermonkey 24 create a js::value that represents the javascript value false. syntax js::value js::falsevalue() description js::falsevalue creates a js::value that represents the javascript value false. ...
... this article covers features introduced in spidermonkey 24 create a js::value that represents the javascript value false. syntax js::value js::falsevalue() description js::falsevalue creates a js::value that represents the javascript value false. ...
... this article covers features introduced in spidermonkey 24 create a js::value that represents the javascript value false. syntax js::value js::falsevalue() description js::falsevalue creates a js::value that represents the javascript value false. ...
...And 2 more matches
JS::NullHandleValue
this article covers features introduced in spidermonkey 24 the js::value that represents the javascript value null. syntax const js::handlevalue js::nullhandlevalue; description js::nullhandlevalue is a js::handlevalue constant that represents the javascript value null. ...
... this article covers features introduced in spidermonkey 24 the js::value that represents the javascript value null. syntax const js::handlevalue js::nullhandlevalue; description js::nullhandlevalue is a js::handlevalue constant that represents the javascript value null. ...
... this article covers features introduced in spidermonkey 24 the js::value that represents the javascript value null. syntax const js::handlevalue js::nullhandlevalue; description js::nullhandlevalue is a js::handlevalue constant that represents the javascript value null. ...
...And 2 more matches
JS::TrueHandleValue
this article covers features introduced in spidermonkey 38 the js::value that represents the javascript value true. syntax const js::handlevalue js::truehandlevalue; const js::handlevalue js::falsehandlevalue; description js::truehandlevalue and js::falsehandlevalue are js::handlevalue constants that represent the javascript values true and false. ...
... article covers features introduced in spidermonkey 38 the js::value that represents the javascript value true. syntax const js::handlevalue js::truehandlevalue; const js::handlevalue js::falsehandlevalue; description js::truehandlevalue and js::falsehandlevalue are js::handlevalue constants that represent the javascript values true and false. ...
...pidermonkey 38 the js::value that represents the javascript value true. syntax const js::handlevalue js::truehandlevalue; const js::handlevalue js::falsehandlevalue; description js::truehandlevalue and js::falsehandlevalue are js::handlevalue constants that represent the javascript values true and false. ...
...And 2 more matches
JS::TrueValue
this article covers features introduced in spidermonkey 24 create a js::value that represents the javascript value true. syntax js::value js::truevalue() description js::truevalue creates a js::value that represents the javascript value true. ...
... this article covers features introduced in spidermonkey 24 create a js::value that represents the javascript value true. syntax js::value js::truevalue() description js::truevalue creates a js::value that represents the javascript value true. ...
... this article covers features introduced in spidermonkey 24 create a js::value that represents the javascript value true. syntax js::value js::truevalue() description js::truevalue creates a js::value that represents the javascript value true. ...
...And 2 more matches
JS::UndefinedHandleValue
this article covers features introduced in spidermonkey 24 the js::value that represents the javascript value undefined. syntax const js::handlevalue js::undefinedhandlevalue; description js::undefinedhandlevalue is a js::handlevalue constant that represents the javascript value undefined. ...
... this article covers features introduced in spidermonkey 24 the js::value that represents the javascript value undefined. syntax const js::handlevalue js::undefinedhandlevalue; description js::undefinedhandlevalue is a js::handlevalue constant that represents the javascript value undefined. ...
... this article covers features introduced in spidermonkey 24 the js::value that represents the javascript value undefined. syntax const js::handlevalue js::undefinedhandlevalue; description js::undefinedhandlevalue is a js::handlevalue constant that represents the javascript value undefined. ...
...And 2 more matches
JSObjectOps.defaultValue
l work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. warning! jsobjectops is not a supported api. details of the api may change from one release to the next. this documentation should be considered spidermonkey internals documentation, not api documentation. see bug 408416 for details. the javascript engine calls the jsobjectops.defaultvalue and jsclass.convert callbacks to convert objects to primitive values. syntax typedef jsbool (*jsconvertop)(jscontext *cx, jsobject *obj, jstype type, jsval *vp); name type description cx jscontext * pointer to the js context in which the conversion is needed. obj jsobject * the object to be converted. type jstype the target type...
...ol (*jsconvertop)(jscontext *cx, jsobject *obj, jstype type, jsval *vp); name type description cx jscontext * pointer to the js context in which the conversion is needed. obj jsobject * the object to be converted. type jstype the target type. vp jsval * out parameter. on success, the callback must store the converted value here. description the jsobjectops.defaultvalue callback corresponds to the [[defaultvalue]] method defined in ecma 262-3 §8.6.2.6. many expressions in the ecmascript language, such as a+b, involve implicit conversion of the operands using [[defaultvalue]]. the default [[defaultvalue]] behavior for ordinary objects is as described in es5 §8.12.8. it calls the javascript methods obj.valu...
...corresponds to the [[defaultvalue]] method defined in ecma 262-3 §8.6.2.6. many expressions in the ecmascript language, such as a+b, involve implicit conversion of the operands using [[defaultvalue]]. the default [[defaultvalue]] behavior for ordinary objects is as described in es5 §8.12.8. it calls the javascript methods obj.valueof() and/or obj.tostring(). provide a custom jsobjectops.defaultvalue callback to implement customized [[defaultvalue]] behavior. the jsclass.convert callback should convert obj to the given type, returning js_true with the resulting value in *vp on success, and returning js_false on error or exception. ...
...And 2 more matches
JS_DefaultValue
obsolete since jsapi 44this 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.6 converts a javascript object to a primitive value, using the semantics of that object's internal [[defaultvalue]] hook. renamed to js::toprimitive from jsapi 44. syntax bool js_defaultvalue(jscontext *cx, js::handle<jsobject*> obj, jstype hint, js::mutablehandle<js::value> vp); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handle&lt;jsobject*&g...
...e hint, js::mutablehandle<js::value> vp); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handle&lt;jsobject*&gt; the object to convert. hint jstype the hint to pass to the [[defaultvalue]] hook when converting the object. hint must be jstype_string or jstype_number to pass the corresponding type as a hint, or jstype_void to pass no hint. do not pass any other type. vp js::mutablehandle&lt;js::value&gt; out parameter. on success, *vp receives the converted value. ...
...convert. hint jstype the hint to pass to the [[defaultvalue]] hook when converting the object. hint must be jstype_string or jstype_number to pass the corresponding type as a hint, or jstype_void to pass no hint. do not pass any other type. vp js::mutablehandle&lt;js::value&gt; out parameter. on success, *vp receives the converted value. description js_defaultvalue converts a javascript object, obj, to a primitive value using that object's [[defaultvalue]] hook. ecmascript specifies that all objects have a [[defaultvalue]] hook. objects with classes defined by ecmascript itself all use the [[defaultvalue]] algorithm specified in §8.12.8 (but note the algorithm's special case for date objects). objects with a custom jsclass specified by the embedder will in...
...And 2 more matches
JS_ValueToECMAInt32
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. convert a javascript value to an integer type as specified by the ecmascript standard. syntax jsbool js_valuetoecmaint32(jscontext *cx, jsval v, int32 *ip); jsbool js_valuetoecmauint32(jscontext *cx, jsval v, uint32 *ip); jsbool js_valuetouint16(jscontext *cx, jsval v, uint16 *ip); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v jsval the javascript value to convert. ip int32 * or uint32 * or int16 * out parameter. o...
...t *cx, jsval v, uint16 *ip); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v jsval the javascript value to convert. ip int32 * or uint32 * or int16 * out parameter. on success, *ip receives the converted value. ...
... name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v jsval the javascript value to convert. ip int32 * or uint32 * or int16 * out parameter. on success, *ip receives the converted value. ...
...And 2 more matches
AudioParam.exponentialRampToValueAtTime() - Web APIs
the exponentialramptovalueattime() method of the audioparam interface schedules a gradual exponential change in the value of the audioparam. the change starts at the time specified for the previous event, follows an exponential ramp to the new value given in the value parameter, and reaches the new value at the time given in the endtime parameter. note: exponential ramps are considered more useful when changing frequencies or playback rates than linear ramps because of the way the human ear works. syntax var audioparam = audioparam.exponentialramptovalueattime(value, endtime) parameters value a floating point number representing the value the audioparam will ramp to by the given time. endtime a double representing the exact time (in seconds) after the ramping starts that the chan...
...ng frequencies or playback rates than linear ramps because of the way the human ear works. syntax var audioparam = audioparam.exponentialramptovalueattime(value, endtime) parameters value a floating point number representing the value the audioparam will ramp to by the given time. endtime a double representing the exact time (in seconds) after the ramping starts that the changing of the value will stop. returns a reference to this audioparam object. in some browsers older implementations of this interface return void. ...
... (in seconds) after the ramping starts that the changing of the value will stop. returns a reference to this audioparam object. in some browsers older implementations of this interface return void. examples in this example, we have a media source with two control buttons (see the audio-param repo for the source code, or view the example live.) when these buttons are pressed, exponentialramptovalueattime() is used to fade the gain value up to 1.0, and down to 0, respectively. this is pretty useful for fade in/fade out effects: // 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 = ...
...And 2 more matches
CSSUnparsedValue.entries() - Web APIs
specifications specification status comment css typed om level 1the definition of 'entries()' in that specification. ...
... specifications specification status comment css typed om level 1the definition of 'entries()' in that specification. ...
... specifications specification status comment css typed om level 1the definition of 'entries()' in that specification. ...
...And 2 more matches
CSSValueList - Web APIs
the cssvaluelist interface derives from the cssvalue interface and provides the abstraction of an ordered collection of css values. some properties allow an empty list in their syntax. in that case, these properties take the none identifier. so, an empty list means that the property has the value none. the items in the cssvaluelist are accessible via an integral index, starting from 0. ...
...elist are accessible via an integral index, starting from 0. ...
...; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/cssvalue" target="_top"><rect x="1" y="1" width="80" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="41" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">cssvalue</text></a><polyline points="81,25 91,20 91,30 81,25" stroke="#d4dde4" fill="none"/><line x1="91" y1="25" x2="121" y2="25" stroke="#d4dde4"/><a xlink:href="/docs/web/api/cssvaluelist" target="_top"><rect x="121" y="1" width="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="#4d4e...
...And 2 more matches
Headers.values() - Web APIs
Web › API › Headers › values
the headers.values() method returns an iterator allowing to go through all values contained in this object. the values are bytestring objects. note: this method is available in web workers. syntax headers.values(); return value returns an iterator. ...
...an iterator allowing to go through all values contained in this object. the values are bytestring objects. note: this method is available in web workers. syntax headers.values(); return value returns an iterator. ...
...wing to go through all values contained in this object. the values are bytestring objects. note: this method is available in web workers. syntax headers.values(); return value returns an iterator. ...
...And 2 more matches
MutationObserverInit.attributeOldValue - Web APIs
the mutationobserverinit dictionary's optional attributeoldvalue property is used to specify whether or not to record the prior value of the altered attribute in mutationrecord objects denoting attribute value changes. syntax var options = { attributeoldvalue: true | false } value a boolean value indicating whether or not the prior value of a changed attribute should be included in the mutationobserver.oldvalue property when reporting attribute value changes. if true, oldvalue is set accordingly. if false, it is not. when using attributeoldvalue, setting the attributes option to true is optional. example in this example, a mutation observer is set up to watch for changes to the status and username attributes in any elements contained within a subtree that displays the names of users ...
...ple, reflect changes to users' nicknames, or to mark them as away from keyboard (afk) or offline. function callback(mutationlist) { mutationlist.foreach(function(mutation) { switch(mutation.type) { case "attributes": notifyuser("attribute name " + mutation.attributename + " changed to " + mutation.target[mutation.attributename] + " (was " + mutation.oldvalue + ")"); break; } }); } var targetnode = document.queryselector("#target"); var observer = new mutationobserver(callback); observer.observe(targetnode, { attributes: true, attributeoldvalue: true }); the callback() function—which will be passed into the observe() method when starting the observer, looks at each item in the list of mutationrecord objects. for any items repres...
...ocument.queryselector("#target"); var observer = new mutationobserver(callback); observer.observe(targetnode, { attributes: true, attributeoldvalue: true }); the callback() function—which will be passed into the observe() method when starting the observer, looks at each item in the list of mutationrecord objects. ...
...And 2 more matches
Shapes from box values - CSS: Cascading Style Sheets
a straightforward way to create a shape is to use a value from the css box model. this article explains how to do this. the box values allowable as a shape value are: content-box padding-box border-box margin-box the border-radius values are also supported, this means that you can have something in your page with a curved border, and your shape can follow the created shape. css box model the values listed above correspond to the various parts of the css box model. a box in css has content, padding, border, and margin. by using box values for shapes we can wrap our content around the edges defined by these values. in all of the examples below i am using an element which has padding, a border, and a margin defined in order that you can see the different ways in which content will f...
...ve been used in defining the element. in the example below, we have a circular purple item which is a <div> with a height, width, and background colour. the border-radius property has been used to create a circle by setting border-radius: 50%. as the element has a margin, you can see that the content is flowing around the circular shape and the margin applied to it. border-box the border-box value is the shape defined by the outside border edge. this shape follows all of the normal border radius shaping rules for the outside of the border. you still have a border, even if you have not used the css border property. in this case it will be the same as padding-box, the shape defined by the outside padding edge. in the example below you can see how the text now follows the line created by the...
......
...And 2 more matches
<alpha-value> - CSS: Cascading Style Sheets
the <alpha-value> css data type represents a value that can be either a <number> or a <percentage>, specifying the alpha channel or transparency of a color. syntax the value of an <alpha-value> is given as either a <number> or a <percentage>. if given as a number, the useful range is 0 (fully transparent) to 1.0 (fully opaque), with decimal values in between; that is, 0.5 indicates that half of the foreground color is used and half of the background color is used. values outside the range of 0 to 1 are permitted, but are clamped to like within the range 0 to 1. if the alpha value is given as a percentage, 0% corresponds to fully transparent while 100% indicates fully opaque. ...
...ully opaque), with decimal values in between; that is, 0.5 indicates that half of the foreground color is used and half of the background color is used. values outside the range of 0 to 1 are permitted, but are clamped to like within the range 0 to 1. if the alpha value is given as a percentage, 0% corresponds to fully transparent while 100% indicates fully opaque. interpolation when animated, values of the <alpha-value> css data type are interpolated as real, floating-point numbers. the speed of the interpolation is determined by the timing function associated with the animation. ...
...0 to 1. if the alpha value is given as a percentage, 0% corresponds to fully transparent while 100% indicates fully opaque. interpolation when animated, values of the <alpha-value> css data type are interpolated as real, floating-point numbers. the speed of the interpolation is determined by the timing function associated with the animation. ...
...And 2 more matches
TypeError: Reduce of empty array with no initial value - JavaScript
the javascript exception "reduce of empty array with no initial value" occurs when a reduce function is used. message typeerror: reduce of empty array with no initial value error type typeerror what went wrong? in javascript, there are several reduce functions: array.prototype.reduce(), array.prototype.reduceright() and typedarray.prototype.reduce(), typedarray.prototype.reduceright()). these functions optionally take an initialvalue (which will be used as the first argument to the first call of the callback). however, if no initial value is provided, it will use the first element of the array or typedarray as the initial value. this error is raised when an empty array is provided because no initial value can be returned in that case. examples invalid cases this problem appear...
...st element of the array or typedarray as the initial value. this error is raised when an empty array is provided because no initial value can be returned in that case. examples invalid cases this problem appears frequently when combined with a filter (array.prototype.filter(), typedarray.prototype.filter()) which will remove all elements of the list. thus leaving none to be used as the initial value. var ints = [0, -1, -2, -3, -4, -5]; ints.filter(x => x > 0) // removes all elements .reduce((x, y) => x + y) // no more elements to use for the initial value. similarly, the same issue can happen if there is a typo in a selector, or an unexpected number of elements in a list: var names = document.getelementsbyclassname("names"); var name_list = array.prototype.reduce.call(names...
... to use for the initial value. similarly, the same issue can happen if there is a typo in a selector, or an unexpected number of elements in a list: var names = document.getelementsbyclassname("names"); var name_list = array.prototype.reduce.call(names, (acc, name) => acc + ", " + name); valid cases these problems can be solved in two different ways. one way is to actually provide an initialvalue as the neutral element of the operator, such as 0 for the addition, 1 for a multiplication, or an empty string for a concatenation. ...
...And 2 more matches
value - Archive of obsolete content
Archive › Mozilla › XUL › Property › value
« xul reference value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. ...
... « xul reference value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. ...
... « xul reference value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. ...
... « xul reference value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. ...
valueNumber - Archive of obsolete content
...
... ...
... ...
... ...
NPN_GetValueForURL - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api summary provides information to a plugin which is associated with a given url, for example the cookies or preferred proxy. syntax #include <npapi.h> typedef enum { npnurlvcookie = 501, npnurlvproxy } npnurlvariable; nperror npn_getvalueforurl(npp instance, npnurlvariable variable, const char *url, char **value, uint32_t *len); parameters this function has the following parameters: instance pointer to the current plug-in instance. variable selects the type of information to be retrieved (npnurlvcookie or npnurlvproxy) url the url for which to fetch information. value out parameter. the browser passes back the reques...
...stance pointer to the current plug-in instance. variable selects the type of information to be retrieved (npnurlvcookie or npnurlvproxy) url the url for which to fetch information. value out parameter. the browser passes back the requested 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. ...
...the url for which to fetch information. value out parameter. the browser passes back 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...
...e3 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. ...
JS::NullValue
this article covers features introduced in spidermonkey 24 create a js::value that represents the javascript value null. syntax js::value js::nullvalue(); description js::nullvalue creates a js::value that represents the javascript value null. ...
... this article covers features introduced in spidermonkey 24 create a js::value that represents the javascript value null. syntax js::value js::nullvalue(); description js::nullvalue creates a js::value that represents the javascript value null. ...
... this article covers features introduced in spidermonkey 24 create a js::value that represents the javascript value null. syntax js::value js::nullvalue(); description js::nullvalue creates a js::value that represents the javascript value null. ...
... this article covers features introduced in spidermonkey 24 create a js::value that represents the javascript value null. syntax js::value js::nullvalue(); description js::nullvalue creates a js::value that represents the javascript value null. ...
JS::ObjectOrNullValue
this article covers features introduced in spidermonkey 24 convert a jsobject or null pointer to a js::value. syntax js::value js::objectornullvalue(jsobject* obj) name type description str jsobject* a pointer to a jsobject or null to convert. description js::objectvalue converts a given jsobject to js::value. if the pointer is null, it returns javascript null. ...
...pointer to a js::value. syntax js::value js::objectornullvalue(jsobject* obj) name type description str jsobject* a pointer to a jsobject or null to convert. description js::objectvalue converts a given jsobject to js::value. if the pointer is null, it returns javascript null. the conversion always succeeds. ...
...a js::value. syntax js::value js::objectornullvalue(jsobject* obj) name type description str jsobject* a pointer to a jsobject or null to convert. description js::objectvalue converts a given jsobject to js::value. if the pointer is null, it returns javascript null. the conversion always succeeds. ...
...ntax js::value js::objectornullvalue(jsobject* obj) name type description str jsobject* a pointer to a jsobject or null to convert. description js::objectvalue converts a given jsobject to js::value. if the pointer is null, it returns javascript null. the conversion always succeeds. ...
JS::ObjectValue
this article covers features introduced in spidermonkey 24 convert a jsobject to a js::value. syntax js::value js::objectvalue(jsobject& obj) name type description str jsobject&amp; a reference to a jsobject to convert. description js::objectvalue converts a given jsobject to js::value. the conversion always succeeds. ...
...ticle covers features introduced in spidermonkey 24 convert a jsobject to a js::value. syntax js::value js::objectvalue(jsobject& obj) name type description str jsobject&amp; a reference to a jsobject to convert. description js::objectvalue converts a given jsobject to js::value. the conversion always succeeds. ...
...s features introduced in spidermonkey 24 convert a jsobject to a js::value. syntax js::value js::objectvalue(jsobject& obj) name type description str jsobject&amp; a reference to a jsobject to convert. description js::objectvalue converts a given jsobject to js::value. the conversion always succeeds. ...
...n spidermonkey 24 convert a jsobject to a js::value. syntax js::value js::objectvalue(jsobject& obj) name type description str jsobject&amp; a reference to a jsobject to convert. description js::objectvalue converts a given jsobject to js::value. the conversion always succeeds. ...
JS::UndefinedValue
this article covers features introduced in spidermonkey 24 create a js::value that represents the javascript value undefined. syntax js::value js::undefinedvalue(); description js::undefinedvalue creates a js::value that represents the javascript value undefined. ...
... this article covers features introduced in spidermonkey 24 create a js::value that represents the javascript value undefined. syntax js::value js::undefinedvalue(); description js::undefinedvalue creates a js::value that represents the javascript value undefined. ...
... this article covers features introduced in spidermonkey 24 create a js::value that represents the javascript value undefined. syntax js::value js::undefinedvalue(); description js::undefinedvalue creates a js::value that represents the javascript value undefined. ...
... this article covers features introduced in spidermonkey 24 create a js::value that represents the javascript value undefined. syntax js::value js::undefinedvalue(); description js::undefinedvalue creates a js::value that represents the javascript value undefined. ...
JS_NewDoubleValue
obsolete since jsapi 17this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. use js_numbervalue instead. create a floating-point jsval syntax jsbool js_newdoublevalue(jscontext *cx, jsdouble d, jsval *rval); name type description cx jscontext * the context in which to create the new number. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. d jsdouble the numeric value to convert. this must not be a value that could fit in an integer jsval (see int_fits_in_jsval). rval jsval * out parameter. on success, *rval receives a javascript number with the value d. description ...
...to create the new number. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. d jsdouble the numeric value to convert. this must not be a value that could fit in an integer jsval (see int_fits_in_jsval). rval jsval * out parameter. on success, *rval receives a javascript number with the value d. description js_newdoublevalue creates a floating-point jsval. warning: the argument d must not be a value that could fit in an integer jsval. if it is, js_newdoublevalue creates a bad jsval that might behave as desired in some cases but not others. the result is subject to garbage collection until you protect against it using a local root, an object property, or the js_addroot function. this can be avoided by using the ...
...must not be a value that could fit in an integer jsval. if it is, js_newdoublevalue creates a bad jsval that might behave as desired in some cases but not others. the result is subject to garbage collection until you protect against it using a local root, an object property, or the js_addroot function. this can be avoided by using the address of a rooted variable as rval. on success, js_newdoublevalue stores a numeric jsval in *rval and returns js_true. otherwise it returns js_false and the value left in *rval is unspecified. ...
...t others. the result is subject to garbage collection until you protect against it using a local root, an object property, or the js_addroot function. ...
JS_NumberValue
this article covers features introduced in spidermonkey 17 convert a c floating-point number of type double to a js::value. replacement to js_newnumbervalue, js_newdoublevalue, js_newdouble. syntax // added in spidermonkey 42 js::value js_numbervalue(double d); // obsolete since spidermonkey 42 jsval js_numbervalue(double d); name type description d double the numeric value to convert. description js_numbervalue converts a c floating-point number of type double to js::value, the type of javascript values. the result is an integer js::value if d can be stored that way. ...
...uble d); // obsolete since spidermonkey 42 jsval js_numbervalue(double d); name type description d double the numeric value to convert. description js_numbervalue converts a c floating-point number of type double to js::value, the type of javascript values. the result is an integer js::value if d can be stored that way. otherwise, a new floating-point js::value is created. ...
...rvalue(double d); name type description d double the numeric value to convert. description js_numbervalue converts a c floating-point number of type double to js::value, the type of javascript values. the result is an integer js::value if d can be stored that way. otherwise, a new floating-point js::value is created. ...
...n d double the numeric value to convert. description js_numbervalue converts a c floating-point number of type double to js::value, the type of javascript values. the result is an integer js::value if d can be stored that way. otherwise, a new floating-point js::value is created. ...
JS_ValueToBoolean
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. replaced by js::toboolean convert any javascript value to a boolean value. syntax jsbool js_valuetoboolean(jscontext *cx, jsval v, jsbool *bp); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v jsval the value to convert. bp jsbool * out parameter. on success, *bp receives the converted boolean value. description js_valuetoboolean converts a specified javascript value, v, to a boolean value. it implements the ...
... for versions greater than jsversion_1_2, all objects convert to js_true, even boolean wrapper objects like the one produced by new boolean(false). ...
...must be in a request on this jscontext. v jsval the value to convert. bp jsbool * out parameter. on success, *bp receives the converted boolean value. description js_valuetoboolean converts a specified javascript value, v, to a boolean value. it implements the toboolean operator specified in ecma 262-3 §9.2. on success, js_valuetoboolean stores the converted value in *bp and returns js_true. on error or exception, it returns js_false, and the value left in *bp is undefined. for versions greater than jsversion_1_2, all objects convert to js_true, even boolean wrapper objects like the one produced by new boolean(false). this is the behavior specified in ecma 262-3 §9.2. ...
...verted value in *bp and returns js_true. on error or exception, it returns js_false, and the value left in *bp is undefined. for versions greater than jsversion_1_2, all objects convert to js_true, even boolean wrapper objects like the one produced by new boolean(false). this is the behavior specified in ecma 262-3 §9.2. see related discussion on google groups. ...
JS_ValueToInt32
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. convert a javascript value to a 32-bit signed integer. syntax jsbool js_valuetoint32(jscontext *cx, jsval v, int32 *ip); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v jsval the value to convert. ip int32 * out parameter. on success, *ip receives the converted integer value. description js_valuetoint32 converts a specified js value, v, to a 32-bit signed integer (-2147483648 to 2147483647). first it converts v...
... the value to convert. ip int32 * out parameter. on success, *ip receives the converted integer value. description js_valuetoint32 converts a specified js value, v, to a 32-bit signed integer (-2147483648 to 2147483647). first it converts v to a floating-point number as if by calling js::tonumber. if the result is nan, an infinity, or a number outside the 32-bit range, js_valuetoint32 reports an error and conversion fails. otherwise, the floating-point number is rounded to the nearest integer value. on success, js_valuetoint32 stores the converted value in *ip and returns js_true. on error or exception, it returns js_false, and the value left in *ip is undefined. ...
...this routine was added for layers-based graphics programming in netscape 4, but unless you know you need its rounding behavior, it is best to avoid it in favour of js::toint32. ...
...this routine was added for layers-based graphics programming in netscape 4, but unless you know you need its rounding behavior, it is best to avoid it in favour of js::toint32. ...
readValue() - Web APIs
draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetreadvalue experimentalchrome full support 57notes full support 57notes notes macos only. full support 57notes disabled notes linux and versions of windows earlier than 10.disabled from version 57: this feature is behind the #enable-experimental-web-platform-features prefer...
CSSNumericValue - Web APIs
the cssnumericvalue interface of the css typed object model api represents operations that all numeric values can perform. interfaces based on cssnumericvalue below is a list of interfaces based on the cssnumericvalue interface. cssmathinvert cssmathmax cssmathmin cssmathnegate cssmathproduct cssmathsum cssmathvalue cssnumericarray cssperspective csspositionvalue cssrotate cssskew cssskeyx cssskeyw csstranslate cssunitvalue properties none. event handlers no methods cssnumericvalue.add adds a supplied number to the cssnumericvalue. cssnumericvalue.sub subtracts a supplied number from the cssnumericvalue. cssnumericvalue.mul multiplies the cssnumericvalue by the supplied value. cssnumericvalue.div divides the cssnumericvalue by the supplied value. cssnu...
...keyx cssskeyw csstranslate cssunitvalue properties none. event handlers no methods cssnumericvalue.add adds a supplied number to the cssnumericvalue. cssnumericvalue.sub subtracts a supplied number from the cssnumericvalue. cssnumericvalue.mul multiplies the cssnumericvalue by the supplied value. cssnumericvalue.div divides the cssnumericvalue by the supplied value. cssnumericvalue.min returns the minimum value passed cssnumericvalue.max returns the maximum value passed cssnumericvalue.equals true if all the values are the exact same type and value, in the same order. otherwise, false. cssnumericvalue.to converts value into another one with the specified unit. ...
... working draft initial definition. ...
... divides the cssnumericvalue by the supplied value. cssnumericvalue.min returns the minimum value passed cssnumericvalue.max returns the maximum value passed cssnumericvalue.equals true if all the values are the exact same type and value, in the same order. otherwise, false. cssnumericvalue.to converts value into another one with the specified unit. cssnumericvalue.tosum tbd cssnumericvalue.type tbd cssnumericvalue.parse allows a cssnumericvalue to be constructed directly from a string containing css. specifications specification status comment css typed om level 1the definition of 'cssnumericvalue' in that specification. working draft initial definition. ...
CSSPositionValue.x - Web APIs
the x property of the csspositionvalue interface returns returns the item's position along the web page's horizontal axis. syntax var x = csspositionvalue.x value a cssnumericvalue. example the following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
... the x property of the csspositionvalue interface returns returns the item's position along the web page's horizontal axis. syntax var x = csspositionvalue.x value a cssnumericvalue. example the following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
...rizontal axis. syntax var x = csspositionvalue.x value a cssnumericvalue. example the following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
...yntax var x = csspositionvalue.x value a cssnumericvalue. example the following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
CSSPositionValue.y - Web APIs
the y property of the csspositionvalue interface returns the item's position along the vertical axis. syntax var y = csspositionvalue.y value a cssnumericvalue. example the following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
... the y property of the csspositionvalue interface returns the item's position along the vertical axis. syntax var y = csspositionvalue.y value a cssnumericvalue. example the following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
...rtical axis. syntax var y = csspositionvalue.y value a cssnumericvalue. example the following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
...tax var y = csspositionvalue.y value a cssnumericvalue. example the following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
CSSUnitValue - Web APIs
the cssunitvalue interface of the css typed object model api represents values that contain a single unit type. for example, "42px" would be represented by a cssnumericvalue. constructor cssstylevalue.cssunitvalue() creates a new cssunitvalue object. properties cssunitvalue.value returns a double indicating the number of units. cssunitvalue.unit returns a usvstring indicating the type of unit. event handlers none. methods none. examples the following shows a method of creating a csspositionvalue from individual cssunitvalue constructors. ...
... working draft initial definition. ...
... working draft initial definition. ...
...alue object. properties cssunitvalue.value returns a double indicating the number of units. cssunitvalue.unit returns a usvstring indicating the type of unit. event handlers none. methods none. examples the following shows a method of creating a csspositionvalue from individual cssunitvalue constructors. let pos = new csspositionvalue( new cssunitvalue(5, "px"), new cssunitvalue(10, "px")); specifications specification status comment css typed om level 1the definition of 'cssunitvalue' in that specification. working draft initial definition. ...
CSS Properties and Values API - Web APIs
the css properties and values api — part of the css houdini umbrella of apis — allows developers to explicitly define their css custom properties, allowing for property type checking, default values, and properties that do or do not inherit their value. interfaces css.registerproperty defines how a browser should parse a css custom properties. access this interface through css.registerproperty in javascript. @property defines how a browser should parse a css custom properties. access this interface through @property in css. ...
...roperty defines how a browser should parse a css custom properties. access this interface through css.registerproperty in javascript. @property defines how a browser should parse a css custom properties. access this interface through @property in css. ...
...arse a css custom properties. access this interface through css.registerproperty in javascript. @property defines how a browser should parse a css custom properties. access this interface through @property in css. ...
...efines how a browser should parse a css custom properties. access this interface through @property in css. examples the following uses css.registerproperty in javascript to type a css custom properties, --my-color, as a color, give it a default value, and not allow it to inherit its value: window.css.registerproperty({ name: '--my-color', syntax: '<color>', inherits: false, initialvalue: '#c0ffee', }); the same registration can take place in css using the following @property: @property --my-color { syntax: '<color>'; inherits: false; initial-value: #c0ffee; } specifications specification status comment css properties and values api level 1 working draft initial definition. ...
NodeList.values() - Web APIs
Web › API › NodeList › values
the nodelist.values() method returns an iterator allowing to go through all values contained in this object. the values are node objects. syntax nodelist.values(); return value returns an iterator. ...
... the values are node objects. syntax nodelist.values(); return value returns an iterator. ...
...e node objects. syntax nodelist.values(); return value returns an iterator. ...
...odelist.values(); return value returns an iterator. ...
Using URL values for the cursor property - CSS: Cascading Style Sheets
gecko 1.8 supports url values for the css cursor property on windows and linux. mac support was added in gecko 2 (firefox 4). this allows specifying arbitrary images as mouse cursors — any image format supported by gecko can be used. syntax the basic (css 2.1) syntax for this property is: cursor: [ <url> , ]* <keyword> this means that zero or more urls may be specified (comma-separated), which must be followed by one of the keywords defined in the css specification, such as auto or pointer. for example, the following value would be allowed: cursor: url(foo.cur), url(http://www.example.com/bar.gif), auto; this will first try loading foo.cur. if that file does not exist or is not valid for some other reason, bar.gif is tried, and if that can't be used either, auto will be used. support...
...words defined in the css specification, such as auto or pointer. for example, the following value would be allowed: cursor: url(foo.cur), url(http://www.example.com/bar.gif), auto; this will first try loading foo.cur. if that file does not exist or is not valid for some other reason, bar.gif is tried, and if that can't be used either, auto will be used. support for the css 3 syntax for cursor values got added in gecko 1.8 (firefox 1.5): cursor: [ <uri> [ <x> <y> ]? , ]* <keyword> it allows specifying the coordinates of the cursor's hotspot, which will be clamped to the boundaries of the cursor image. if none are specified, the coordinates of the hotspot are read from the file itself (for cur and xbm files) or are set to the top left corner of the image. an example of the css3 syntax is: ...
...tspot 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 operating...
...ver, you should limit yourself to the size 32×32 for maximum compatibility with operating systems and platforms. (due to a bug in gecko 1.9.2-1.9.2.6, firefox 3.6-3.6.6 on windows limits to 32×32px. this is fixed in later versions.) translucent cursors are not supported on windows releases earlier than xp. this is a limitation of the operating system. transparency works on all platforms. url values as cursors are supported in windows, os/2, and linux (when using gtk+ 2.4 or better) releases of mozilla. mac os x support was added with gecko 2 (firefox 4). ...
Specified value - CSS: Cascading Style Sheets
the specified value of a css property is the value it receives from the document's style sheet. the specified value for a given property is determined according to the following rules: if the document's style sheet explicitly specifies a value for the property, the given value will be used. if the document's style sheet doesn't specify a value but it is an inherited property, the value will be taken from the parent element. if none of the above pertain, the element's initial value will be used. ...
...nt's style sheet explicitly specifies a value for the property, the given value will be used. if the document's style sheet doesn't specify a value but it is an inherited property, the value will be taken from the parent element. if none of the above pertain, the element's initial value will be used. examples html <p>my specified color is given explicitly in the css.</p> <div>the specified values of all my properties default to their initial values, because none of them are given in the css.</div> <div class="fun"> <p>the specified value of my font family is not given explicitly in the css, so it is inherited from my parent. however, the border is not an inheriting property.</p> </div> css .fun { border: 1px dotted pink; font-family: fantasy; } p { color: gree...
... recommendation initial definition. ...
... recommendation initial definition. ...
enumValueNames - Archive of obsolete content
enumvaluenames enumerates the value of a given key. method of winreg object syntax string enumvaluenames ( string key, int subkeyindex ); parameters the enumvaluenames method has the following parameters: key the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". subkeyindex an integer representing the 0-based index of the key value being sought. returns the value of the key as a string if it succeeded; null if the referenced subkey does not exist. description enumvaluenames can be used to iterate through the values for a given key. the following brief example retrieves a key value using this method. ...
...e 0-based index of the key value being sought. returns the value of the key as a string if it succeeded; null if the referenced subkey does not exist. description enumvaluenames can be used to iterate through the values for a given key. the following brief example retrieves a key value using this method. ...
...f the key as a string if it succeeded; null if the referenced subkey does not exist. description enumvaluenames can be used to iterate through the values for a given key. the following brief example retrieves a key value using this method. ...
getSessionValueAt - Archive of obsolete content
...
... ...
... ...
NPN_SetValueForURL - Archive of obsolete content
ummary allows a plugin to change the stored information associated with a url, in particular its cookies. (while the api theoretically allows the preferred proxy for a given url to be changed, doing so does not have much meaning given how proxies are configured, and is not supported.) syntax #include <npapi.h> typedef enum { npnurlvcookie = 501, npnurlvproxy } npnurlvariable; nperror npn_setvalueforurl(npp instance, npnurlvariable variable, const char *url, const char *value, uint32_t len); parameters this function has the following parameters: instance pointer to the current plug-in instance. variable selects the type of information to be changed. the only supported type is np...
... variable, const char *url, const char *value, uint32_t len); parameters this function has the following parameters: instance pointer to the current plug-in instance. variable selects the type of information to be 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 b...
... 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. ...
NP_GetValue - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary allows the browser to query the plug-in for information. syntax #include <npapi.h> nperror np_getvalue(void *instance, nppvariable variable, void *value); parameters the function has the following parameters: instance pointer to the current plug-in instance. instance parameter is null because no instance has been created. variable plug-in information the call gets. values: nppvpluginnamestring: gets the name of the plug-in nppvplugindescriptionstring: gets the description string of the plug-in value plug-in name, returned by the function. returns if successful, the function returns nperr_no_error. if unsuccessful, the function returns an error c...
...instance has been created. variable plug-in information the call gets. values: nppvpluginnamestring: gets the name of the plug-in nppvplugindescriptionstring: gets the description string of the plug-in value plug-in name, returned by the function. returns if successful, the function returns nperr_no_error. if unsuccessful, the function returns an error code. for possible values, see error codes. ...
... call gets. values: nppvpluginnamestring: gets the name of the plug-in nppvplugindescriptionstring: gets the description string of the plug-in value plug-in name, returned by the function. returns if successful, the function returns nperr_no_error. if unsuccessful, the function returns an error code. for possible values, see error codes. description none. ...
Quality values - MDN Web Docs Glossary: Definitions of Web-related terms
quality values, or q-values and q-factors, are used to describe the order of priority of values in a comma-separated list. it is a special syntax allowed in some http headers and in html. the importance of a value is marked by the suffix ';q=' immediately followed by a value between 0 and 1 included, with up to three decimal digits, the highest value denoting the highest priority. when not present, the default value is 1. examples the following syntax text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 indicates the order of priority: value priority text/html and application/xhtml+xml 1.0 application/xml 0.9 */* 0.8 if there is no priority defined for the first two values, the order in the list is irrelevant. ne...
...wing syntax text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 indicates the order of priority: value priority text/html and application/xhtml+xml 1.0 application/xml 0.9 */* 0.8 if there is no priority defined for the first two values, the order in the list is irrelevant. nevertheless, with the same quality, more specific values have priority over less specific ones: text/html;q=0.8,text/*;q=0.8,*/*;q=0.8 value priority text/html 0.8 (but totally specified) text/* 0.8 (partially specified) */* 0.8 (not specified) some syntax, like the one of accept, allow additional specifiers like text/html;level=1. these increase the specificity of the value. their use is extre...
...e priority text/html 0.8 (but totally specified) text/* 0.8 (partially specified) */* 0.8 (not specified) some syntax, like the one of accept, allow additional specifiers like text/html;level=1. these increase the specificity of the value. their use is extremely rare. browser-specific information firefox starting with firefox 18, the quality factor values are clamped to 2 decimal places. they used to be clamped to only 1 decimal place in earlier versions (bug 672448). more information http headers using q-values in their syntax: accept, accept-charset, accept-language, accept-encoding, te. ...
Test your skills: values and units - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. task one in this task, the first list item has been given a background color using hex color codes. your task is to complete the css using the same color in different formats, plus a final list item where you should make the background semi-opaque. ...
...es. your task is to complete the css using the same color in different formats, plus a final list item where you should make the background semi-opaque. the second list item should use rgb color. the third should use hsl color. the fourth should use rgb color but with the alpha channel set to .2. you can find conversions for the hex color at this link. you need to figure out how to use the values in css. try updating the live code below to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. task two in this task you need to set the size of various items of text. the <h1> should be 50 pixels. the <h2> should be 2em. all <p> elements should be 16 pixels. a <p> el...
...r are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for values and units skill test 1". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into — it's very hard to help someone with a coding problem if you can't see th...
FC_GetAttributeValue
name fc_getattributevalue - get the value of attributes of an object. syntax ck_rv fc_getattributevalue( ck_session_handle hsession, ck_object_handle hobject, ck_attribute_ptr ptemplate, ck_ulong uscount ); parameters hsession [in] session handle. hobject [in] object handle. ptemplate [in, out] pointer to template. uscount [in] number of attributes in the template. description fc_getattributevalue gets the value of one or more attributes of an object. a user must log into the token (to assume the nss user role) before getting the attribute values of a secret or private key object. ...
... ); parameters hsession [in] session handle. hobject [in] object handle. ptemplate [in, out] pointer to template. uscount [in] number of attributes in the template. description fc_getattributevalue gets the value of one or more attributes of an object. ...
.... hobject [in] object handle. ptemplate [in, out] pointer to template. uscount [in] number of attributes in the template. description fc_getattributevalue gets the value of one or more attributes of an object. ...
FC_SetAttributeValue
name fc_setattributevalue - set the values of attributes of an object. syntax ck_rv fc_setattributevalue( ck_session_handle hsession, ck_object_handle hobject, ck_attribute_ptr ptemplate, ck_ulong uscount ); parameters hsession [in] session handle. hobject [in] object handle. ptemplate [in, out] pointer to template. uscount [in] number of attributes in the template. description fc_setattributevalue sets the value of one or more attributes of an object. a user must log into the token before setting the attribute values of a secret or private key object. ...
... ptemplate, ck_ulong uscount ); parameters hsession [in] session handle. hobject [in] object handle. ptemplate [in, out] pointer to template. uscount [in] number of attributes in the template. ...
... hsession [in] session handle. hobject [in] object handle. ptemplate [in, out] pointer to template. uscount [in] number of attributes in the template. description fc_setattributevalue sets the value of one or more attributes of an object. ...
JS::StringValue
this article covers features introduced in spidermonkey 24 convert a jsstring to a js::value. syntax js::value js::stringvalue(jsstring* str) name type description str jsstring* a pointer to a jsstring to convert. description js::stringvalue converts a given jsstring to js::value. ...
...his article covers features introduced in spidermonkey 24 convert a jsstring to a js::value. syntax js::value js::stringvalue(jsstring* str) name type description str jsstring* a pointer to a jsstring to convert. description js::stringvalue converts a given jsstring to js::value. ...
... covers features introduced in spidermonkey 24 convert a jsstring to a js::value. syntax js::value js::stringvalue(jsstring* str) name type description str jsstring* a pointer to a jsstring to convert. description js::stringvalue converts a given jsstring to js::value. the conversion always succeeds. ...
JS::SymbolValue
this article covers features introduced in spidermonkey 38 convert a js::symbol to a js::value. syntax js::value js::symbolvalue(js::symbol* sym) name type description sym js::symbol* a pointer to a js::symbol to convert. description js::symbolvalue converts a given js::symbol to js::value. ...
...e covers features introduced in spidermonkey 38 convert a js::symbol to a js::value. syntax js::value js::symbolvalue(js::symbol* sym) name type description sym js::symbol* a pointer to a js::symbol to convert. description js::symbolvalue converts a given js::symbol to js::value. the conversion always succeeds. ...
...atures introduced in spidermonkey 38 convert a js::symbol to a js::value. syntax js::value js::symbolvalue(js::symbol* sym) name type description sym js::symbol* a pointer to a js::symbol to convert. description js::symbolvalue converts a given js::symbol to js::value. the conversion always succeeds. ...
JS_GetEmptyStringValue
get the empty string as a value of type js::value. syntax // added in spidermonkey 42 js::value js_getemptystringvalue(jscontext *cx); // obsolete since spidermonkey 42 jsval js_getemptystringvalue(jscontext *cx); name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. description js_getemptystringvalue returns the empty string as a js::value. ...
...ontext *cx); // obsolete since spidermonkey 42 jsval js_getemptystringvalue(jscontext *cx); name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. description js_getemptystringvalue returns the empty string as a js::value. ...
...y 42 jsval js_getemptystringvalue(jscontext *cx); name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. description js_getemptystringvalue returns the empty string as a js::value. ...
JS_IdToValue
convert a js id to a js value. syntax bool js_idtovalue(jscontext *cx, jsid id, js::mutablehandle<js::value> vp); 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. id jsid the property identifier to convert. vp js::mutablehandle&lt;js::value&gt; out parameter. on success, *vp receives the converted value. description js_idtovalue converts a specified js id, id, to a js value. on success, js_idtovalue stores the converted value in *vp and returns true. otherwise it returns false. the inverse of js_idtovalue is js_valuetoid. ...
...fier to convert. vp js::mutablehandle&lt;js::value&gt; out parameter. on success, *vp receives the converted value. description js_idtovalue converts a specified js id, id, to a js value. on success, js_idtovalue stores the converted value in *vp and returns true. otherwise it returns false. the inverse of js_idtovalue is js_valuetoid. ...
...nvert. vp js::mutablehandle&lt;js::value&gt; out parameter. on success, *vp receives the converted value. description js_idtovalue converts a specified js id, id, to a js value. on success, js_idtovalue stores the converted value in *vp and returns true. otherwise it returns false. the inverse of js_idtovalue is js_valuetoid. ...
nsIMsgSearchValue
defined in comm-central/ mailnews/ base/ search/ public/ nsimsgsearchvalue.idl #include "nsmsgsearchcore.idl" interface nsimsgfolder; [scriptable, uuid(783758a0-cdb5-11dc-95ff-0800200c9a66)] interface nsimsgsearchvalue : nsisupports { // type of object attribute nsmsgsearchattribvalue attrib; // accessing these will throw an exception if the above // attribute does not match the type! ...
...gsearchvalue.idl #include "nsmsgsearchcore.idl" interface nsimsgfolder; [scriptable, uuid(783758a0-cdb5-11dc-95ff-0800200c9a66)] interface nsimsgsearchvalue : nsisupports { // type of object attribute nsmsgsearchattribvalue attrib; // accessing these will throw an exception if the above // attribute does not match the type! ...
... above // attribute does not match the type! attribute astring str; attribute nsmsgpriorityvalue priority; attribute prtime date; // see nsmsgmessageflags.idl and nsmsgfolderflags.idl attribute unsigned long status; attribute unsigned long size; attribute nsmsgkey msgkey; attribute long age; // in days attribute nsimsgfolder folder; attribute nsmsglabelvalue label; attribute nsmsgjunkstatus junkstatus; /* * junkpercent is set by the message filter plugin, and is approximately * proportional to the probability that a message is junk. * (range 0-100, 100 is junk) */ attribute unsigned long junkpercent; astring tostring(); }; ...
nsIMsgSearchValue
defined in comm-central/ mailnews/ base/ search/ public/ nsimsgsearchvalue.idl #include "nsmsgsearchcore.idl" interface nsimsgfolder; [scriptable, uuid(783758a0-cdb5-11dc-95ff-0800200c9a66)] interface nsimsgsearchvalue : nsisupports { // type of object attribute nsmsgsearchattribvalue attrib; // accessing these will throw an exception if the above // attribute does not match the type! ...
...gsearchvalue.idl #include "nsmsgsearchcore.idl" interface nsimsgfolder; [scriptable, uuid(783758a0-cdb5-11dc-95ff-0800200c9a66)] interface nsimsgsearchvalue : nsisupports { // type of object attribute nsmsgsearchattribvalue attrib; // accessing these will throw an exception if the above // attribute does not match the type! ...
... above // attribute does not match the type! attribute astring str; attribute nsmsgpriorityvalue priority; attribute prtime date; // see nsmsgmessageflags.idl and nsmsgfolderflags.idl attribute unsigned long status; attribute unsigned long size; attribute nsmsgkey msgkey; attribute long age; // in days attribute nsimsgfolder folder; attribute nsmsglabelvalue label; attribute nsmsgjunkstatus junkstatus; /* * junkpercent is set by the message filter plugin, and is approximately * proportional to the probability that a message is junk. * (range 0-100, 100 is junk) */ attribute unsigned long junkpercent; astring tostring(); }; ...
value - Web APIs
draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...efinition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetvalue experimentalchrome full support 57notes full support 57notes notes macos only. full support 57notes disabled notes linux and versions of windows earlier than 10.disabled from version 57: this feature is behind the #enable-experimental-web-platform-features prefer...
writeValue() - Web APIs
draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tion. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetwritevalue experimentalchrome full support 57notes full support 57notes notes macos only. full support 57notes disabled notes linux and versions of windows earlier than 10.disabled from version 57: this feature is behind the #enable-experimental-web-platform-features prefer...
CSSMathValue.operator - Web APIs
the cssmathvalue.operator read-only property of the cssmathvalue interface indicates the operator that the current subtype represents. for example, if the current cssmathvalue subtype is cssmathsum, this property will return the string "sum". syntax var astring = cssmathvalue.operator; value a string. interface value cssmathsum "sum" cssmathproduct "product" cssmathmin "min" cssmathmax "max" cssmathclamp "clamp" cssmathnegate "negate" cssmathinvert "invert" examples we create an element with a width determined using a calc() function, then console.log() the operator. <div>my width has a <code>calc()</code> function</div> we assign a width with a calculation div { width: cal...
... we create an element with a width determined using a calc() function, then console.log() the operator. <div>my width has a <code>calc()</code> function</div> we assign a width with a calculation div { width: calc(50% - 0.5vw); } 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').values ); // cssnumericarray {0: cssunitvalue, 1: cssmathnegate, length: 2} console.log( stylemap.get('width').operator ); // 'sum' console.log( stylemap.get('width').values[1].operator ) // 'negate' the cssmathvalue.operator returns sum for the equation and negate for the operator on the second value. ...
... working draft initial definition. ...
CSSNumericValue.to() - Web APIs
examples // prints "0.608542cm" console.log(css.px("23").to("com").tostring()); specifications specification status comment css typed om level 1the definition of 'to' in that specification. ...
... examples // prints "0.608542cm" console.log(css.px("23").to("com").tostring()); specifications specification status comment css typed om level 1the definition of 'to' in that specification. ...
... examples // prints "0.608542cm" console.log(css.px("23").to("com").tostring()); specifications specification status comment css typed om level 1the definition of 'to' in that specification. ...
CSSUnparsedValue.keys() - Web APIs
specifications specification status comment css typed om level 1the definition of 'keys()' in that specification. ...
... specifications specification status comment css typed om level 1the definition of 'keys()' in that specification. ...
... specifications specification status comment css typed om level 1the definition of 'keys()' in that specification. ...
CSSUnparsedValue - Web APIs
the cssunparsedvalue interface of the css typed 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). cssunparsed...
...edvalue object. properties cssunparsedvalue.length returns the number of items in the cssunparsedvalue object. methods cssunparsedvalue.entries() returns an array of a given object's own enumerable property [key, value] pairs in the same order as that provided by a for...in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well). cssunparsedvalue.foreach() executes a provided function once for each element of the cssunparsedvalue object. cssunparsedvalue.keys() returns a new array iterator object that contains the keys for each index in the cssunparsedvalue object. cssunparsedvalue.values() returns a new array iterator object that contains the values for each index in the cssunparsedvalue object. specifications specificat...
...ue object. cssunparsedvalue.keys() returns a new array iterator object that contains the keys for each index in the cssunparsedvalue object. cssunparsedvalue.values() returns a new array iterator object that contains the values for each index in the cssunparsedvalue object. specifications specification status comment css typed om level 1the definition of 'cssunparsedvalue' in that specification. working draft initial definition. ...
Event.returnValue - Web APIs
Web › API › Event › returnValue
the event property returnvalue indicates whether the default action for this event has been prevented or not. it is set to true by default, allowing the default action to occur. setting this property to false prevents the default action. note: while returnvalue has been adopted into the dom standard, it is present primarily to support existing code. you should use preventdefault(), and defaultprevented instead of this historical property. syntax event.returnvalue = bool; var bool = event.returnvalue; value a boolean value which is true if the event has not been canceled; otherwise, if the event has been canceled or the default has been prevented, the value is false. the value returned by returnvalue is the opposite of the value returned by defaultprevented. ...
...prevented instead of this historical property. syntax event.returnvalue = bool; var bool = event.returnvalue; value a boolean value which is true if the event has not been canceled; otherwise, if the event has been canceled or the default has been prevented, the value is false. the value returned by returnvalue is the opposite of the value returned by defaultprevented. usage notes returnvalue was introduced into the dom by internet explorer 6, and due to that browser's ubiquity became so commonly used that other browsers eventually implemented it as well. it has been adopted into the dom specification, primarily to ensure that existing web content continues to function going forward. new projects should generally avoid using returnvalue, although they may if they choose to do so. sp...
...ommonly used that other browsers eventually implemented it as well. it has been adopted into the dom specification, primarily to ensure that existing web content continues to function going forward. new projects should generally avoid using returnvalue, although they may if they choose to do so. specifications specification status comment domthe definition of 'returnvalue' in that specification. living standard added for legacy compatibility. ...
MutationObserverInit.characterDataOldValue - Web APIs
the mutationobserverinit dictionary's optional characterdataoldvalue property is used to specify whether or not the mutationrecord.oldvalue property for dom mutations should be set to the previous value of text nodes which changed. if you set the mutationobserverinit.characterdata property to true but don't set characterdataoldvalue to true as well, the mutationrecord will not include information describing the prior state of the text node's contents. character data changes are detectable on any text node, including nodes based on the text, processinginstruction, and comment interfaces. ...
... set the mutationobserverinit.characterdata property to true but don't set characterdataoldvalue to true as well, the mutationrecord will not include information describing the prior state of the text node's contents. character data changes are detectable on any text node, including nodes based on the text, processinginstruction, and comment interfaces. syntax var options = { characterdataoldvalue: true | false } value a boolean value indicating whether or not to set the mutationrecord's oldvalue property to be a string containing the value of the character node's contents prior to the change represented by the mutation record. by default, only changes to the text of the node specified as the target parameter when you called observe() are monitored. to watch for changes to the text con...
...oldvalue property to be a string containing the value of the character node's contents prior to the change represented by the mutation record. by default, only changes to the text of the node specified as the target parameter when you called observe() are monitored. to watch for changes to the text contents of all descendants of target, set the subtree option to true. if you set characterdataoldvalue to true, characterdata is automatically assumed to be true, even if you don't expressly set it as such. example specifications specification status comment domthe definition of 'mutationobserverinit.characterdataoldvalue' in that specification. living standard ...
::-webkit-meter-even-less-good-value - CSS: Cascading Style Sheets
the ::-webkit-meter-even-less-good-value gives a red color to a <meter> element when the value and the optimum attributes fall outside the low-high range, but in opposite zones. to illustrate, it applies when value < low < high < optimum or value > high > low > optimum. syntax ::-webkit-meter-even-less-good-value specifications not part of any standard. ...
...he ::-webkit-meter-even-less-good-value gives a red color to a <meter> element when the value and the optimum attributes fall outside the low-high range, but in opposite zones. to illustrate, it applies when value < low < high < optimum or value > high > low > optimum. syntax ::-webkit-meter-even-less-good-value specifications not part of any standard. ...
...nt when the value and the optimum attributes fall outside the low-high range, but in opposite zones. to illustrate, it applies when value < low < high < optimum or value > high > low > optimum. syntax ::-webkit-meter-even-less-good-value specifications not part of any standard. ...
::-webkit-meter-optimum-value - CSS: Cascading Style Sheets
the ::-webkit-meter-optimum-value css pseudo-element styles the <meter> element when its value is inside the low-high range. green is the default color. syntax ::-webkit-meter-optimum-value specifications not part of any standard. examples this example will only work in browsers based on webkit or blink. ...
... the ::-webkit-meter-optimum-value css pseudo-element styles the <meter> element when its value is inside the low-high range. green is the default color. syntax ::-webkit-meter-optimum-value specifications not part of any standard. examples this example will only work in browsers based on webkit or blink. ...
...ations not part of any standard. examples this example will only work in browsers based on webkit or blink. ...
Computed value - CSS: Cascading Style Sheets
the computed value of a css property is the value that is transferred from parent to child during inheritance. it is calculated from the specified value by: handling the special values inherit, initial, unset, and revert. doing the computation needed to reach the value described in the "computed value" line in the property's definition table. the computation needed to reach a property's computed value typically involves converting relative values (such as those in em units or percentages) to absolute values. for example, if an element has specified values font-size: 16px and padding-top: 2em, then the computed value of padding-top is 32px (double the font size). however, for some properties (those where percentages are relative to something that may require layout to determine, such as ...
...se in em units or percentages) to absolute values. for example, if an element has specified values font-size: 16px and padding-top: 2em, then the computed value of padding-top is 32px (double the font size). however, for some properties (those where percentages are relative to something that may require layout to determine, such as width, margin-right, text-indent, and top), percentage-specified values turn into percentage-computed values. additionally, unitless numbers specified on the line-height property become the computed value, as specified. the relative values that remain in the computed value become absolute when the used value is determined. ...
...rmine, such as width, margin-right, text-indent, and top), percentage-specified values turn into percentage-computed values. additionally, unitless numbers specified on the line-height property become the computed value, as specified. the relative values that remain in the computed value become absolute when the used value is determined. note: the getcomputedstyle() dom api returns the resolved value, which may either be the computed value or the used value, depending on the property. specifications specification status comment css level 2 (revision 2)the definition of 'computed-value' in that specification. working draft no change. css level 2 (revision 1)the definition of 'computed value' in that specification. recommendation init...
Number.MIN_VALUE - JavaScript
the number.min_value property represents the smallest positive numeric value representable in javascript. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of number.min_value writable no enumerable no configurable no description the min_value property is the number closest to 0, not the most negative number, that javascript can represent. min_value has a value of approximately 5e-324. values smaller than min_value ("underflow values") are converted to 0. ...
...f number.min_value writable no enumerable no configurable no description the min_value property is the number closest to 0, not the most negative number, that javascript can represent. min_value has a value of approximately 5e-324. values smaller than min_value ("underflow values") are converted to 0. because min_value is a static property of number, you always use it as number.min_value, rather than as a property of a number object you created. examples using min_value the following code divides two numeric values. if the result is greater than or equal to min_value, the func1 function is called; otherwise, the func2 function is called. ...
...) are converted to 0. because min_value is a static property of number, you always use it as number.min_value, rather than as a property of a number object you created. examples using min_value the following code divides two numeric values. if the result is greater than or equal to min_value, the func1 function is called; otherwise, the func2 function is called. if (num1 / num2 >= number.min_value) { func1(); } else { func2(); } specifications specification ecmascript (ecma-262)the definition of 'number.min_value' in that specification. ...
TypedArray.prototype.values() - JavaScript
the values() method returns a new array iterator object that contains the values for each 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. syntax arr.values() return value a new array iterator 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 arr.values() return value a new array iterator object. ...
.... syntax arr.values() return value a new array iterator object. examples iteration using for...of loop var arr = new uint8array([10, 20, 30, 40, 50]); var earray = arr.values(); // your browser must support for..of loop // and let-scoped variables in for loops for (let n of earray) { console.log(n); } alternative iteration var arr = new uint8array([10, 20, 30, 40, 50]); var earr = arr.values(); console.log(earr.next().value); // 10 console.log(earr.next().value); // 20 console.log(earr.next().value); // 30 console.log(earr.next().value); // 40 console.log(earr.next().value); // 50 specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype.values()' in that specification. ...
getValue - Archive of obsolete content
getvalue netscape 6 and mozilla do not currently support this method. retrieves the value of an arbitrary key. method of winreg object syntax winregvalue getvalue ( string subkey, string valname); parameters the getvalue method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". valname the name of the value-name/value pair whose value you want. returns a winregvalue object representing the value of the named value-name/value pair or null if there is no value or if there is an error. see winregvalue for information about these values. description the getvalue method retrieves the value of an arbitraty key. use this method if the value you want is not a string. if...
...ame the name of the value-name/value pair whose value you want. returns a winregvalue object representing the value of the named value-name/value pair or null if there is no value or if there is an error. see winregvalue for information about these values. description the getvalue method retrieves the value of an arbitraty key. use this method if the value you want is not a string. if the value is a string, the getvaluestring method is more convenient. ...
setValue - Archive of obsolete content
setvalue netscape 6 and mozilla do not currently support this method. sets the value of an arbitrary key. method of winreg object syntax string setvalue ( string subkey, string valname, winregvalue value); parameters the setvalue method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". valname the name of the value-name/value pair whose value you want to change. value a winregvalue object representing the new non-string value. see winregvalue for information about these values. returns 0 if it succeeded; a nonzero number if it failed to schedule the action. for a list of possible values, see return codes. ...
...scape\\navigator\\mail". valname the name of the value-name/value pair whose value you want to change. value a winregvalue object representing the new non-string value. see winregvalue for information about these values. returns 0 if it succeeded; a nonzero number if it failed to schedule the action. for a list of possible values, see return codes. description the setvalue method sets the value of an arbitrary key. use this method if the value you want to set is not a string. if the value is a string, the setvaluestring method is more convenient. ...
setValueNumber - Archive of obsolete content
summary sets the value of a key, when that value is a number. method of winreg object syntax int setvaluenumber ( string subkey, string valname, number value ); parameters the method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". valname the name of the value-name/value pair whose value you want to change. value a number representing the new string value. returns 0 if it succeeded; a nonzero number if it failed to schedule the action. for a list of possible values, see return codes. description the setvaluenumber method sets the value of a key when that value is a number. use this method if the value you want to set is a number. if the ...
...me/value pair whose value you want to change. value a number representing the new string value. returns 0 if it succeeded; a nonzero number if it failed to schedule the action. for a list of possible values, see return codes. description the setvaluenumber method sets the value of a key when that value is a number. use this method if the value you want to set is a number. if the value is not a number, use the setvalue or setvaluestring methods instead. ...
setValueString - Archive of obsolete content
setvaluestring sets the value of a key, when that value is a string. method of winreg object syntax int setvaluestring ( string subkey, string valname, string value); parameters the method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". valname the name of the value-name/value pair whose value you want to change. value the new string value. returns 0 if it succeeded; a nonzero number if it failed to schedule the action. for a list of possible values, see return codes. description the setvaluestring method sets the value of a key when that value is a string. use this method if the value you want to set is a string. ...
...the name of the value-name/value pair whose value you want to change. value the new string value. returns 0 if it succeeded; a nonzero number if it failed to schedule the action. for a list of possible values, see return codes. description the setvaluestring method sets the value of a key when that value is a string. use this method if the value you want to set is a string. if the value is not a string, use the setvalue method instead. ...
datepicker.value - Archive of obsolete content
...
... ...
textbox.value - Archive of obsolete content
« xul reference home value type: string the default value entered in a textbox. the attribute only holds the default value and is never modified when the user enters text. to get the updated value, use the value property. for number boxes, the default is 0 or the minimum value returned by the min property, whichever is higher. ...
... « xul reference home value type: string the default value entered in a textbox. the attribute only holds the default value and is never modified when the user enters text. to get the updated value, use the value property. for number boxes, the default is 0 or the minimum value returned by the min property, whichever is higher. ...
textnode.value - Archive of obsolete content
« xul reference home value type: uri the text value to display. this value should be an rdf property (predicate). ...
... « xul reference home value type: uri the text value to display. this value should be an rdf property (predicate). ...
timepicker.value - Archive of obsolete content
...
... ...
hasUserValue - Archive of obsolete content
...
... ...
hasUserValue - Archive of obsolete content
...
... ...
defaultValue - Archive of obsolete content
...
... ...
NPN_ReleaseVariantValue - Archive of obsolete content
« gecko plugin api reference « scripting plugins summary npn_releasevariantvalue() releases the value in the given variant. syntax #include <npruntime.h> void npn_releasevariantvalue(npvariant *variant); parameters the function has the following parameters: <tt>variant</tt> the variant whose value is to be released. returns nothing. description npn_releasevariantvalue() releases the value in the given variant. this must always be called on result variants and such in this api, i.e. any npvariant whose value comes from a call that passes back an npvariant must be released using this function. ...
...as the following parameters: <tt>variant</tt> the variant whose value is to be released. returns nothing. description npn_releasevariantvalue() releases the value in the given variant. this must always be called on result variants and such in this api, i.e. any npvariant whose value comes from a call that passes back an npvariant must be released using this function. access to the value in an npvariant that has been released will result in undefined behavior. npn_releasevariantvalue() will call npn_releaseobject() on npvariants of type npvarianttype_object, and npn_memfree() on npvariants of type npvarianttype_string. ...
JS_SetCallReturnValue2
obsolete since javascript 1.8.5this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. causes a native to return a reference value (as allowed by ecma 262-3 §11.2.3). syntax void js_setcallreturnvalue2(jscontext *cx, jsval v); name type description cx jscontext * the context in which the native function is running. v jsval the id of the property of the reference value to be returned from the native. descript...
... type description cx jscontext * the context in which the native function is running. v jsval the id of the property of the reference value to be returned from the native. description calling js_setcallreturnvalue2 indicates to the runtime that the native will return a value of type reference. the native must store the object part of the reference value in *rval, and the argument v gives the id of the property part of the reference value. this reference value can then be used as an lvalue in script. an example is in js/src/js.c; searching for js_setcallreturnvalue2 should find it. ...
Stored value
in the jsapi, the stored value of an object property is its last known value. for a data property, this is exactly the same thing as the property's current value. the javascript engine sets aside a field of type jsval for the stored value of most object properties, even properties that have getters. the stored value is updated each time the program gets or sets the property. 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; },...
...eproperty 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. ...
Value
« nsiaccessible page summary accessible value -- a number or a secondary text equivalent for this node. widgets that use role attribute can force a value using the valuenow attribute. ...
... « nsiaccessible page summary accessible value -- a number or a secondary text equivalent for this node. widgets that use role attribute can force a value using the valuenow attribute. ...
nsIAccessibleValue
accessible/public/nsiaccessiblevalue.idlscriptable please add a summary to this article. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview boolean setcurrentvalue(in double value); obsolete since gecko 1.9 attributes attribute type description currentvalue double maximumvalue double read only. minimumincrement double read only. minimumvalue double read only. methods setcurrentvalue() obsolete since gecko 1.9 (firefox 3) return a success condition of the value getting set. that is if the value is within the range of minimumvalue - maximumvalue. boolean setcurrentvalue( in double value ); parameters value new value for current value. ...
...ad only. minimumincrement double read only. minimumvalue double read only. methods setcurrentvalue() obsolete since gecko 1.9 (firefox 3) return a success condition of the value getting set. that is if the value is within the range of minimumvalue - maximumvalue. boolean setcurrentvalue( in double value ); parameters value new value for current value. return value true if the value is within the range of minimumvalue - maximumvalue, false if it is not. ...
AudioParam.cancelScheduledValues() - Web APIs
the cancelscheduledvalues() method of the audioparam interface cancels all scheduled future changes to the audioparam. syntax var audioparam = audioparam.cancelscheduledvalues(starttime) parameters starttime a double representing the time (in seconds) after the audiocontext was first created after which all scheduled changes will be cancelled. returns a reference to this audioparam object. in some older implementations this method returns void. ...
...x var audioparam = audioparam.cancelscheduledvalues(starttime) parameters starttime a double representing the time (in seconds) after the audiocontext was first created after which all scheduled changes will be cancelled. returns a reference to this audioparam object. in some older implementations this method returns void. examples var gainnode = audioctx.creategain(); gainnode.gain.setvaluecurveattime(wavearray, audioctx.currenttime, 2); //'gain' is the audioparam gainnode.gain.cancelscheduledvalues(audioctx.currenttime); specifications specification status comment web audio apithe definition of 'cancelscheduledvalues' in that specification. working draft ...
CSSImageValue - Web APIs
properties none. methods none. examples we create an element <button>magic wand</button> we add some css, including a background image requesting a binary file: button { display: inline-block; min-height: 100px; min-width: 100px; background: no-repeat 5% center url(https://mdn.mozillademos.org/files/16793/magicwand.png) aqua; } we get the element's style map. ...
...nd: no-repeat 5% center url(https://mdn.mozillademos.org/files/16793/magicwand.png) aqua; } we get the element's style map. we then get() the background-image from the stylemap and stringify it: // get the element const button = document.queryselector( 'button' ); // retrieve all computed styles with computedstylemap() const allcomputedstyles = button.computedstylemap(); // return the cssimagevalue example console.log( allcomputedstyles.get('background-image') ); console.log( allcomputedstyles.get('background-image').tostring() ); specifications specification status comment css typed om level 1the definition of 'cssimagevalue' in that specification. working draft initial definition. ...
CSSPositionValue - Web APIs
the csspositionvalue interface of the the css typed object model api represents values for properties that take a position, for example object-position. constructor csspositionvalue.csspositionvalue() creates a new csspositionvalue object. properties csspositionvalue.x returns the item's position along the web page's horizontal axis. csspositionvalue.y returns the item's position along the vertical axis. methods none. examples the following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
...properties csspositionvalue.x returns the item's position along the web page's horizontal axis. csspositionvalue.y returns the item's position along the vertical axis. methods none. examples the following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. let replacedel = document.getelementbyid( 'image' ); let position = new csspositionvalue( css.px(35), css.px(40) ); replacedel.attributestylemap.set( 'object-position', position ); console.log( position.x.value, position.y.value ); console.log( replacedel.computedstylemap().get('object-position') ); we set the object-position property, then check the values returned. #image { width: 300px; height: 300px; border: 1px solid black; background-color: #dededf; object-fit: non...
CSSStyleDeclaration.getPropertyCSSValue() - Web APIs
the cssstyledeclaration.getpropertycssvalue() method interface returns a cssvalue containing the css value for a property. note that it returns null if the property name is a shorthand property. you should use cssstyledeclaration.getpropertyvalue() instead. syntax var value = style.getpropertycssvalue(property); parameters property is a domstring representing the property name to be retrieved. return value value is a cssvalue containing the css value for a property. if none exists, returns null. ...
...ou should use cssstyledeclaration.getpropertyvalue() instead. syntax var value = style.getpropertycssvalue(property); parameters property is a domstring representing the property name to be retrieved. return value value is a cssvalue containing the css value for a property. if none exists, returns null. example the following javascript code gets an object containing the computed rgb values of the color css property: var style = window.getcomputedstyle(elem, null); var rgbobj = style.getpropertycssvalue('color').getrgbcolorvalue(); specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssstyledeclaration' in that specification. obsolete declared as obsolete in july 2003. ...
CSSStyleValue.parse() - Web APIs
the parse() method of the cssstylevalue interface sets a specific css property to the specified values and returns the first value as a cssstylevalue object. syntax cssstylevalue.parse(property, csstext) parameters property a css property to set. csstext a comma-separated string containing one or more values to apply to the provided property. return value a 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. ...
.... csstext a comma-separated string containing one or more values to apply to the provided property. return value a 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. ...
CSSStyleValue - Web APIs
the cssstylevalue interface of the the css typed object model api is the base class of all css values accessible through the typed om api. an instance of this class may be used anywhere a string is expected. interfaces based on cssstylevalue below is a list of interfaces based on the cssstylevalue interface. cssimagevalue csskeywordvalue cssnumericvalue csspositionvalue csstransformvalue cssunparsedvalue methods cssstylevalue.parse() sets a specific css property to the specified values and returns the first value as a cssstylevalue object. cssstylevalue.parseall() sets all occurences of a specific css property to the specified valueand returns an array of cssstylevalue objects, each containing one of the supplied values. specifications specification status ...
...ic css property to the specified values and returns the first value as a cssstylevalue object. cssstylevalue.parseall() sets all occurences of a specific css property to the specified valueand returns an array of cssstylevalue objects, each containing one of the supplied values. specifications specification status comment css typed om level 1the definition of 'cssstylevalue' in that specification. working draft initial definition. ...
CSSValue - Web APIs
Web › API › CSSValue
the cssvalue interface represents the current computed value of a css property. properties cssvalue.csstext a domstring representing the current value. cssvalue.cssvaluetyperead only an unsigned short representing a code defining the type of the value. possible values are: constant description css_custom the value is a custom value. css_inherit the value is inherited and the csstext contains "inherit". css_primitive_value the value is a primitive value and an instance of the cssprimitivevalue interface can be obtained by using binding-specific casting methods on this instance of the cssvalue interface. ...
...tant description css_custom the value is a custom value. css_inherit the value is inherited and the csstext contains "inherit". css_primitive_value the value is a primitive value and an instance of the cssprimitivevalue interface can be obtained by using binding-specific casting methods on this instance of the cssvalue interface. css_value_list the value is a cssvalue list and an instance of the cssvaluelist interface can be obtained by using binding-specific casting methods on this instance of the cssvalue interface. specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssvalue' in that specification. obsolete initial d...
DOMTokenList.values() - Web APIs
the values() method of the domtokenlist interface returns an iterator allowing developers to go through all values contained in the domtokenlist. the individual values are domstring objects. syntax tokenlist.values(); parameters none. return value returns an iterator. examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist. we when retrieve an iterator containing the values using values(), then iterate through those values using a for ... of loop, writing each one to the <span>'s node.textcontent. ...
...<span> element as a domtokenlist using element.classlist. we when retrieve an iterator containing the values using values(), then iterate through those values using a for ... of loop, writing each one to the <span>'s node.textcontent. first, the html: <span class="a b c"></span> now the javascript: var span = document.queryselector("span"); var classes = span.classlist; var iterator = classes.values(); for(var value of iterator) { span.textcontent += value + ' ++ '; } the output looks like this: specifications specification status comment domthe definition of 'values() (as iterable<node>)' in that specification. living standard initial definition ...
MediaKeyStatusMap.values() - Web APIs
the values property of the mediakeystatusmap interface returns a new iterator object, containing values for each element in the status map, in insertion order. syntax var iterator = mediakeystatusmap.values() parameters none. returns a new iterator. specifications specification status comment encrypted media extensions recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...efinition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
XPathResult.booleanValue - Web APIs
the read-only booleanvalue property of the xpathresult interface returns the boolean value of a result with xpathresult.resulttype being boolean_type. note: this feature is available in web workers. syntax var value = result.booleanvalue; return value the return value is the boolean value of the xpathresult returned by document.evaluate(). exceptions type_err in case xpathresult.resulttype is not boolean_type, an xpathexception of type type_err is thrown. example the following example shows the use of the booleanvalue property. html <div>xpath example</div> <p>text is 'xpath example': <output></output></p> javascript var xpath = "//div/text() = 'xpath example'"; var result = document.evaluate(xpath, document, null, xpathresult.boolean_type, null); document.queryselector("output...
...ption of type type_err is thrown. example the following example shows the use of the booleanvalue property. html <div>xpath example</div> <p>text is 'xpath example': <output></output></p> javascript var xpath = "//div/text() = 'xpath example'"; var result = document.evaluate(xpath, document, null, xpathresult.boolean_type, null); document.queryselector("output").textcontent = result.booleanvalue; result specifications specification status comment document object model (dom) level 3 xpath specificationthe definition of 'xpathresult.booleanvalue' in that specification. recommendation initial definition ...
XPathResult.numberValue - Web APIs
the read-only numbervalue property of the xpathresult interface returns the numeric value of a result with xpathresult.resulttype being number_type. note: this feature is available in web workers. syntax var value = result.numbervalue; return value the return value is the numeric value of the xpathresult returned by document.evaluate(). exceptions type_err in case xpathresult.resulttype is not number_type, an xpathexception of type type_err is thrown. example the following example shows the use of the numbervalue property. html <div>xpath example</div> <div>number of &lt;div&gt;s: <output></output></div> javascript var xpath = "count(//div)"; var result = document.evaluate(xpath, document, null, xpathresult.number_type, null); document.queryselector("output").textcontent = resu...
...type, an xpathexception of type type_err is thrown. example the following example shows the use of the numbervalue property. html <div>xpath example</div> <div>number of &lt;div&gt;s: <output></output></div> javascript var xpath = "count(//div)"; var result = document.evaluate(xpath, document, null, xpathresult.number_type, null); document.queryselector("output").textcontent = result.numbervalue; result specifications specification status comment document object model (dom) level 3 xpath specificationthe definition of 'xpathresult.numbervalue' in that specification. recommendation initial definition ...
XPathResult.singleNodeValue - Web APIs
the read-only singlenodevalue property of the xpathresult interface returns a node value or null in case no node was matched of a result with xpathresult.resulttype being any_unordered_node_type or first_ordered_node_type. note: this feature is available in web workers. syntax var value = result.singlenodevalue; return value the return value is the node value of the xpathresult returned by document.evaluate(). exceptions type_err in case xpathresult.resulttype is not any_unordered_node_type or first_ordered_node_type, an xpathexception of type type_err is thrown. example the following example shows the use of the singlenodevalue property. html <div>xpath example</div> <div>tag name of the element having the text content 'xpath example': <output></output></div> javascript var xp...
...example shows the use of the singlenodevalue property. html <div>xpath example</div> <div>tag name of the element having the text content 'xpath example': <output></output></div> javascript var xpath = "//*[text()='xpath example']"; var result = document.evaluate(xpath, document, null, xpathresult.first_ordered_node_type, null); document.queryselector("output").textcontent = result.singlenodevalue.localname; result specifications specification status comment document object model (dom) level 3 xpath specificationthe definition of 'xpathresult.singlenodevalue' in that specification. recommendation initial definition ...
XPathResult.stringValue - Web APIs
the read-only stringvalue property of the xpathresult interface returns the string value of a result with xpathresult.resulttype being string_type. note: this feature is available in web workers. syntax var value = result.stringvalue; return value the return value is the string value of the xpathresult returned by document.evaluate(). exceptions type_err in case xpathresult.resulttype is not string_type, an xpathexception of type type_err is thrown. example the following example shows the use of the stringvalue property. html <div>xpath example</div> <div>text content of the &lt;div&gt; above: <output></output></div> javascript var xpath = "//div/text()"; var result = document.evaluate(xpath, document, null, xpathresult.string_type, null); document.queryselector("output").textc...
...xception of type type_err is thrown. example the following example shows the use of the stringvalue property. html <div>xpath example</div> <div>text content of the &lt;div&gt; above: <output></output></div> javascript var xpath = "//div/text()"; var result = document.evaluate(xpath, document, null, xpathresult.string_type, null); document.queryselector("output").textcontent = result.stringvalue; result specifications specification status comment document object model (dom) level 3 xpath specificationthe definition of 'xpathresult.stringvalue' in that specification. recommendation initial definition ...
Actual value - CSS: Cascading Style Sheets
the actual value of a css property is the used value of that property after any necessary approximations have been applied. for example, a user agent that can only render borders with a whole-number pixel width may round the thickness of the border to the nearest integer. calculating a property's actual value the user agent performs four steps to calculate a property's actual (final) value: first, the specified value is determined based on the result of cascading, inheritance, or using the initial value. next, the computed value is calculated according to the specification (for example, a span with position: absolute will have its computed display changed to block). then, layout is calculated, resulting in the used value. ...
...te a property's actual (final) value: first, the specified value is determined based on the result of cascading, inheritance, or using the initial value. next, the computed value is calculated according to the specification (for example, a span with position: absolute will have its computed display changed to block). then, layout is calculated, resulting in the used value. finally, the used value is transformed according to the limitations of the local environment, resulting in the actual value. specifications specification status comment css level 2 (revision 1)the definition of 'actual value' in that specification. recommendation initial definition. ...
Initial value - CSS: Cascading Style Sheets
the initial value of a css property is its default value, as listed in its definition table in the specification. the usage of the initial value depends on whether a property is inherited or not: for inherited properties, the initial value is used on the root element only, as long as no specified value is supplied. for non-inherited properties, the initial value is used on all elements, as long as no specified value is supplied. you can explicitly specify the initial value by using the initial keyword. note: the initial value should not be confused with the value specified by the browser's style sheet. specifications specification status comment css cascade 4 formal definition. ...
... as long as no specified value is supplied. you can explicitly specify the initial value by using the initial keyword. note: the initial value should not be confused with the value specified by the browser's style sheet. specifications specification status comment css cascade 4 formal definition. css level 2 (revision 1)the definition of 'initial value' in that specification. recommendation implicit definition. ...
Boolean.prototype.valueOf() - JavaScript
the valueof() method returns the primitive value of a boolean 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 bool.valueof() return value the primitive value of the given boolean object description the valueof() method of boolean returns the primitive value of a boolean object or literal boolean as a boolean data type. this method is usually called internally by javascript and not explicitly in code. ...
...ne https://github.com/mdn/interactive-examples and send us a pull request. syntax bool.valueof() return value the primitive value of the given boolean object description the valueof() method of boolean returns the primitive value of a boolean object or literal boolean as a boolean data type. this method is usually called internally by javascript and not explicitly in code. examples using valueof() x = new boolean(); myvar = x.valueof(); // assigns false to myvar specifications specification ecmascript (ecma-262)the definition of 'boolean.prototype.valueof' in that specification. ...
Map.prototype.values() - JavaScript
the values() method returns a new iterator object that contains the values for each element in the map object in insertion order. the source for this interactive example is stored in a github repository. if 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 mymap.values() return value a new map iterator object. ...
...or object that contains the values for each element in the map object in insertion order. the source for this interactive example is stored in a github repository. if 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 mymap.values() return value a new map iterator object. examples using values() var mymap = new map(); mymap.set('0', 'foo'); mymap.set(1, 'bar'); mymap.set({}, 'baz'); var mapiter = mymap.values(); console.log(mapiter.next().value); // "foo" console.log(mapiter.next().value); // "bar" console.log(mapiter.next().value); // "baz" specifications specification ecmascript (ecma-262)the definition of 'map.prototype.values' in that specification. ...
Number.MAX_VALUE - JavaScript
the number.max_value property represents the maximum numeric value representable in javascript. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of number.max_value writable no enumerable no configurable no description the max_value property has a value of approximately 1.79e+308, or 21024. values larger than max_value are represented as infinity. because max_value is a static property of number, you always use it as number.max_value, rather than as a property of a number object you created. example...
...o enumerable no configurable no description the max_value property has a value of approximately 1.79e+308, or 21024. values larger than max_value are represented as infinity. because max_value is a static property of number, you always use it as number.max_value, rather than as a property of a number object you created. examples using max_value the following code multiplies two numeric values. if the result is less than or equal to max_value, the func1 function is called; otherwise, the func2 function is called. if (num1 * num2 <= number.max_value) { func1(); } else { func2(); } specifications specification ecmascript (ecma-262)the definition of 'number.max_value' in that specification. ...
Number.prototype.valueOf() - JavaScript
the valueof() method returns the wrapped primitive value of a number object. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax numobj.valueof() return value a number representing the primitive value of the specified number object. description this method is usually called internally by javascript and not explicitly in web code. ...
...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 numobj.valueof() return value a number representing the primitive value of the specified number object. description this method is usually called internally by javascript and not explicitly in web code. examples using valueof let numobj = new number(10) console.log(typeof numobj) // object let num = numobj.valueof() console.log(num) // 10 console.log(typeof num) // number specifications specification ecmascript (ecma-262)the definition of 'number.prototype.valueof' in that specification. ...
Set.prototype.values() - JavaScript
the values() method returns a new iterator object that contains the values for each element in the set object in insertion order. the keys() method is an alias for this method (for similarity with map objects); it behaves exactly the same and returns values of set 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 myset.values(); return value a new iterator object containing the values for each element in the given set, in insertion order. ...
...f set 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 myset.values(); return value a new iterator object containing the values for each element in the given set, in insertion order. examples using values() var myset = new set(); myset.add('foo'); myset.add('bar'); myset.add('baz'); var setiter = myset.values(); console.log(setiter.next().value); // "foo" console.log(setiter.next().value); // "bar" console.log(setiter.next().value); // "baz" specifications specification ecmascript (ecma-262)the definition of 'set.prototype.values' in that specification. ...
Values - MathML
lengths several mathml presentation elements have attributes that accept length values used for size or spacing. mathml accepts different units and constants for specifying lengths. 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. constants a replacement for the deprecated constants below is: veryverythinmathspace => 0.05555555555555555em verythinmathspace => 0.1111111111111111em thinmathspace ...
...cement for the deprecated constants below is: veryverythinmathspace => 0.05555555555555555em verythinmathspace => 0.1111111111111111em thinmathspace => 0.16666666666666666em mediummathspace => 0.2222222222222222em thickmathspace => 0.2777777777777778em verythickmathspace => 0.3333333333333333em veryverythickmathspace => 0.3888888888888889em constant value veryverythinmathspace 1/18em verythinmathspace 2/18em thinmathspace 3/18em mediummathspace 4/18em thickmathspace 5/18em verythickmathspace 6/18em veryverythickmathspace 7/18em negative contstants are introduced in gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) (bug 650530) ...
getValueNumber - Archive of obsolete content
getvaluenumber gets the value of a key when that value is a number. method of winreg object syntax number getvaluenumber ( string subkey, string valname); parameters the getvaluestring method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". valname the name of the value-name/value pair whose value you want. returns number value of the specified key or null if there's an error, the value is not found, or the value is not a string. ...
getValueString - Archive of obsolete content
getvaluestring retrieves the value of a key when that value is a string. method of winreg object syntax string getvaluestring ( string subkey, string valname); parameters the getvaluestring method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". valname the name of the value-name/value pair whose value you want. returns a string representing the value of the named value-name/value pair or null if there's an error, the value is not found, or the value is not a string. description the getvaluestring method gets the value of a string. if the value is not a string, use the getvalue method instead. ...
label.value - Archive of obsolete content
« xul reference home value type: string the text to be used for the label. ...
progressmeter.value - Archive of obsolete content
« xul reference home 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. ...
where.value - Archive of obsolete content
« xul reference home value type: string the value to compare. ...
ValueChange - Archive of obsolete content
this event is used mainly for an accessibility purpose. general info specification xul interface event bubbles yes cancelable yes target element default action none properties property type description target read only eventtarget the event target (the topmost target in the dom tree). type read only domstring the type of event. ...
getNotificationWithValue - Archive of obsolete content
« xul reference home getnotificationwithvalue( value ) return type: notification element retrieve the notification with a particular value. the value is specified when adding the notification with appendnotification. if no matching value is found, returns null. ...
getResultValueAt - Archive of obsolete content
« xul reference home getresultvalueat( index ) return type: result value returns the result value at the specified index. the item will correspond to the text of that item that appears in the popup. ...
dateValue - Archive of obsolete content
...
datepicker.value - Archive of obsolete content
« xul reference value type: string the currently selected date in the form yyyy-mm-dd. unlike the month property, months in this value range from 01 to 12. set this property to change the selected date. ...
textValue - Archive of obsolete content
« xul reference textvalue new in thunderbird 15 requires seamonkey 2.12 type: string returns the content of the textbox. equivalent to the value property. note: setting the value causes an input event to be generated without triggering autocompletion. ...
textbox.value - Archive of obsolete content
« xul reference value type: string holds the current value of the textbox as a string. the current value may be modified by setting this property. ...
timepicker.value - Archive of obsolete content
« xul reference value type: string the currently entered time of the form hh:mm:ss. set this property to change the time. ...
Nullish value - MDN Web Docs Glossary: Definitions of Web-related terms
in javascript, a nullish value is the value which is either null or undefined. nullish values are always falsy. ...
Value - MDN Web Docs Glossary: Definitions of Web-related terms
in the context of data or an object wrapper around that data, the value is the primitive value that the object wrapper contains. in the context of a variable or property, the value can be either a primitive or an object reference. learn more general knowledge primitive wrapper class on wikipedia ...
Makefile - macro values
variable values moz_widget_toolkit cocoa ...
PL_CompareValues
compares two void * values numerically. syntax #include <plhash.h> printn pl_comparevalues(const void *v1, const void *v2); description pl_comparevalues compares the two void * values v1 and v2 numerically, i.e., it returns the value of the expression v1 == v2. pl_comparevalues can be used as the comparator function for integer or pointer-valued key or entry value. ...
GetComputedStyleCSSValue
...
GetComputedStyleValue
...
nsMsgFilterFileAttribValue
defined in comm-central/ mailnews/ base/ search/ public/ nsimsgfilterlist.idl const nsmsgfilterfileattribvalue attribnone = 0; const nsmsgfilterfileattribvalue attribversion = 1; const nsmsgfilterfileattribvalue attriblogging = 2; const nsmsgfilterfileattribvalue attribname = 3; const nsmsgfilterfileattribvalue attribenabled = 4; const nsmsgfilterfileattribvalue attribdescription = 5; const nsmsgfilterfileattribvalue attribtype = 6; const nsmsgfilterfileattribvalue attribscriptfile = 7; const nsmsgfilterfileattribvalue attribaction = 8; const nsmsgfilterfileattribvalue attribactionvalue = 9; const nsmsgfilterfileattribvalue attribcondition = 10; const nsmsgfilterfileattribvalue attribcustomid = 11; ...
nsMsgLabelValue
defined in comm-central/ mailnews/ base/ public/ mailnewstypes2.idl typedef unsigned long nsmsglabelvalue; ...
nsMsgPriorityValue
defined in comm-central/ mailnews/ base/ public/ mailnewstypes2.idl typedef long nsmsgpriorityvalue; [scriptable, uuid(94c0d8d8-2045-11d3-8a8f-0060b0fc04d2)] interface nsmsgpriority { const nsmsgpriorityvalue notset = 0; const nsmsgpriorityvalue none = 1; const nsmsgpriorityvalue lowest = 2; const nsmsgpriorityvalue low = 3; const nsmsgpriorityvalue normal = 4; const nsmsgpriorityvalue high = 5; const nsmsgpriorityvalue highest = 6; // the default for a priority picker const nsmsgpriorityvalue default = 4; }; ...
nsMsgSearchTypeValue
defined in comm-central/ mailnews/ base/ search/ public/ nsmsgsearchcore.idl used to specify type of search to be performed [scriptable,uuid(964b7f32-304e-11d3-ae13-00a0c900d445)] interface nsmsgsearchtype { const nsmsgsearchtypevalue none = 0; const nsmsgsearchtypevalue rootdse = 1; const nsmsgsearchtypevalue normal = 2; const nsmsgsearchtypevalue ldapvlv = 3; const nsmsgsearchtypevalue namecompletion = 4; }; ...
nsMsgSearchValue
defined in comm-central/ mailnews/ base/ search/ public/ nsmsgsearchcore.idl use this to specify the value of a search term [ptr] native nsmsgsearchvalue(nsmsgsearchvalue); %{c++ typedef struct nsmsgsearchvalue { nsmsgsearchattribvalue attribute; union { nsmsgpriorityvalue priority; prtime date; pruint32 msgstatus; /* see msg_flag in msgcom.h */ pruint32 size; nsmsgkey key; print32 age; /* in days */ nsimsgfolder *folder; nsmsglabelvalue label; pruint32 junkstatus; pruint32 junkpercent; } u; char *string; } nsmsgsearchvalue; ...
nsMsgSearchWidgetValue
defined in comm-central/ mailnews/ base/ search/ public/ nsmsgsearchcore.idl fes use this to help build the search dialog box typedef long nsmsgsearchwidgetvalue; /* fes use this to help build the search dialog box */ [scriptable,uuid(903dd2e8-304e-11d3-92e6-00a0c900d445)] interface nsmsgsearchwidget { const nsmsgsearchwidgetvalue text = 0; const nsmsgsearchwidgetvalue date = 1; const nsmsgsearchwidgetvalue menu = 2; const nsmsgsearchwidgetvalue int = 3; /* added to account for age in days which requires an integer field */ const nsmsgsearchwidgetvalue none = 4; }; ...
AudioParam.defaultValue - Web APIs
the defaultvalue read-only property of the audioparam interface represents the initial value of the attributes as defined by the specific audionode creating the audioparam. syntax var defaultval = audioparam.defaultvalue; value a floating-point number. example const audioctx = new audiocontext(); const gainnode = audioctx.creategain(); const defaultval = gainnode.gain.defaultvalue; console.log(defaultval); // 1 console.log(defaultval === gainnode.gain.value); // true specifications specification status comment web audio apithe definition of 'defaultvalue' in that specification. working draft ...
AudioParam.maxValue - Web APIs
the maxvalue read-only property of the audioparam interface represents the maximum possible value for the parameter's nominal (effective) range. syntax var maxval = audioparam.maxvalue; value a floating-point number indicating the maximum value permitted for the parameter's nominal range. the default value of maxvalue is the maximum positive single-precision floating-point value (+340,282,346,638,528,859,811,704,183,484,516,925,440). example const audioctx = new audiocontext(); const gainnode = audioctx.creategain(); console.log(gainnode.gain.maxvalue); // 3.4028234663852886e38 specifications specification status comment web audio apithe definition of 'maxvalue' in that specification. working draft ...
AudioParam.minValue - Web APIs
the minvalue read-only property of the audioparam interface represents the minimum possible value for the parameter's nominal (effective) range. syntax var minval = audioparam.minvalue; value a floating-point number indicating the minimum value permitted for the parameter's nominal range. the default value of minvalue is the minimum negative single-precision floating-point value (-340,282,346,638,528,859,811,704,183,484,516,925,440). example const audioctx = new audiocontext(); const gainnode = audioctx.creategain(); console.log(gainnode.gain.minvalue); // -3.4028234663852886e38 specifications specification status comment web audio apithe definition of 'minvalue' in that specification. working draft ...
BluetoothRemoteGATTCharacteristic.readValue() - Web APIs
the bluetoothremotegattcharacteristic.readvalue() method returns a promise that resolves to a dataview holding a duplicate of the value property if it is available and supported. otherwise it throws an error. syntax bluetoothremotegattcharacteristic.readvalue().then(function(dataview) { ... }) returns a promise that resolves to an dataview. specifications specification status comment web bluetooththe definition of 'readvalue()' in that specification. draft initial definition. ...
BluetoothRemoteGATTCharacteristic.value - Web APIs
the bluetoothremotegattcharacteristic.value read-only property returns currently cached characteristic value. this value gets updated when the value of the characteristic is read or updated via a notification or indication. syntax var value = bluetoothremotegattcharacteristic.value returns the currently cached characteristic value. specifications specification status comment web bluetooththe definition of 'value' in that specification. draft initial definition. ...
BluetoothRemoteGATTCharacteristic.writeValue() - Web APIs
the bluetoothremotegattcharacteristic.writevalue() method sets the value property to the bytes contained in an arraybuffer and returns a promise. syntax bluetoothremotegattcharacteristic.writevalue(value).then(function() { ... }) returns a promise. parameters value an arraybuffer. specifications specification status comment web bluetooththe definition of 'writevalue()' in that specification. draft initial definition. ...
CSSMathProduct.values - Web APIs
the cssmathproduct.values read-only property of the cssmathproduct interface returns a cssnumericarray object which contains one or more cssnumericvalue objects. syntax var cssnumericarray = cssmathproduct.values; value a cssnumericarray. specifications specification status comment css typed om level 1the definition of 'values' in that specification. working draft initial definition. ...
CSSMathSum.values - Web APIs
Web › API › CSSMathSum › values
the cssmathsum.values read-only property of the cssmathsum interface returns a cssnumericarray object which contains one or more cssnumericvalue objects. syntax var cssnumericarray = cssmathsum.values; value a cssnumericarray. specifications specification status comment css typed om level 1the definition of 'values' in that specification. working draft initial definition. ...
CSSNumericValue.add() - Web APIs
examples let mathsum = css.px("23").add(css.percent("4")).add(css.cm("3")).add(css.in("9")); // prints "calc(23px + 4% + 3cm + 9in)" console.log(mathsum.tostring()); specifications specification status comment css typed om level 1the definition of 'add' in that specification. ...
CSSNumericValue.div() - Web APIs
exceptions typeerror indicates that an invalid type was passed to the method. examples let mathproduct = css.px("24").div(css.percent("4")); // prints "calc(24px / 4%)" mathproduct.tostring(); specifications specification status comment css typed om level 1the definition of 'div' in that specification. ...
CSSNumericValue.mul() - Web APIs
examples let mathsum = css.px("23").mul(css.percent("4")).mul(css.cm("3")).mul(css.in("9")); // prints "calc(23px * 4% * 3cm * 9in)" console.log(mathsum.tostring()); specifications specification status comment css typed om level 1the definition of 'mul' in that specification. ...
CSSNumericValue.parse() - Web APIs
the parse() method of the cssnumericvalue interface converts a value string into an object whose members are value and the units. syntax var cssnumericvalue = cssnumericvalue.parse(csstext); parameters csstext a string containing numeric and unit parts. return value a cssnumericvalue. exceptions syntaxerror tbd examples the following returns a cssunitvalue object with a unit property equal to "px" and a value property equal to 42. let numvalue = cssnumericvalue.parse("42.0px"); specifications specification status comment css typed om level 1the definition of 'parse' in that specification. working draft initial definition. ...
CSSNumericValue.sub() - Web APIs
examples let mathsum = css.px("23").sum(css.percent("4")).sum(css.cm("3")).sum(css.in("9")); // prints "calc(23px - 4% - 3cm - 9in)" console.log(mathsum.tostring()); and/or include a list of links to useful code samples that live elsewhere: specifications specification status comment css typed om level 1the definition of 'sub' in that specification. ...
CSSNumericValue.sum() - Web APIs
examples let mathsum = css.px("23").sum(css.percent("4")).sum(css.cm("3")).sum(css.in("9")); // prints "calc(23px - 4% - 3cm - 9in)" console.log(mathsum.tostring()); and/or include a list of links to useful code samples that live elsewhere: specifications specification status comment css typed om level 1the definition of 'sub' in that specification. ...
CSSNumericValue.toSum() - Web APIs
exceptions syntaxerror undefined typeerror indicates that an invalid type was passed to the method. examples let v = css.px("23").add(css.percent("4")).add(css.cm("3")).add(css.in("9")); v.tostring() // => "calc(23px + 4% + 3cm + 9in)" v.tosum("px", "percent").tostring() // => "calc(1000.39px + 4%)" specifications specification status comment css typed om level 1the definition of 'tosum' in that specification. ...
CSSNumericValue.type - Web APIs
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. ...
CSSStyleDeclaration.getPropertyValue() - Web APIs
the cssstyledeclaration.getpropertyvalue() method interface returns a domstring containing the value of a specified css property. syntax var value = style.getpropertyvalue(property); parameters property is a domstring representing the property name to be checked. return value value is a domstring containing the value of the property. if not set, returns the empty string. example the following javascript code queries the value of the margin property in a css selector rule: var declaration = document.stylesheets[0].cssrules[0].style; var value = declaration.getpropertyvalue('margin'); // "1px 2px" specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration.getpropertyvalue()' in that specification. wo...
CSSUnitValue.unit - Web APIs
Web › API › CSSUnitValue › unit
the cssunitvalue.unit read-only property of the cssunitvalue interface returns a usvstring indicating the type of unit. syntax var astring = cssunitvalue.unit; value a usvstring. examples the following creates a csspositionvalue from individual cssunitvalue constructors, then queries the cssunitvalue.unit. let pos = new csspositionvalue( new cssunitvalue( 5, "px" ), new cssunitvalue( 10, "em" )); console.log( pos.x.unit ); // "px" console.log( pos.y.unit ); // "em" specifications specification status comment css typed om level 1the definition of 'cssunitvalue.unit' in that specification. working draft initial definition. ...
CSSUnparsedValue.forEach() - Web APIs
the cssunparsedvalue.foreach() method executes a provided function once for each element of the cssunparsedvalue. syntax cssunparsedvalue.foreach(function callback(currentvalue[, index[, array]]) { // your iterator }[, thisarg]); parameters callback the function to execute for each element, taking three arguments: currentvalue the value of the current element being processed. indexoptional the index of the current element being processed. arrayoptional the cssunparsedvalue that foreach() is being called on. thisarg optional value to use as this (i.e the reference object) when executing callback. return value undefined. specifications specification status comment css typed om level 1the definition of 'foreach()' in that specific...
CSSUnparsedValue.length - Web APIs
the length read-only property of the cssunparsedvalue interface returns the number of items in the object. syntax var length = cssunparsedvalue.length; value an integer. examples in this example we employ the cssunparsedvalue.cssunparsedvalue() constructor, then query the length: let values = new cssunparsedvalue( ['1em', '#445566', '-45px'] ); console.log( values.length ) // 3 specifications specification status comment css typed om level 1the definition of 'length' in that specification. working draft initial definition. ...
CSSValue.cssText - Web APIs
Web › API › CSSValue › cssText
the csstext property of the cssvalue interface represents the current computed css property value. syntax csstext = cssvalue.csstext; value a domstring representing the current css property value. example var styledeclaration = document.stylesheets[0].cssrules[0].style; var cssvalue = styledeclaration.getpropertycssvalue("color"); console.log(cssvalue.csstext); specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssvalue.csstext' in that specification. obsolete initial definition ...
CSSValueList.item() - Web APIs
Web › API › CSSValueList › item
the item() method of the cssvaluelist interface 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 the index is greater than or equal to the number of values in the list, this method returns null. syntax var cssvalue = cssvaluelist.item(index); parameters index an unsigned long representing the index of the css value within the collection. return value a cssvalue object at the index position in the cssvaluelist, or null if that is not a valid index. specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssvaluelist.item' in that specification. obsolete initial definition ...
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 ...
CSSVariableReferenceValue() - Web APIs
creates a new cssvariablereferencevalue. syntax new cssvariablereferencevalue(variable[, fallback]]) parameters variable a custom property name. fallback optional. a custom property fallback value. specifications specification status comment css typed om level 1the definition of 'cssvariablereferencevalue()' in that specification. working draft initial definition. ...
CSSVariableReferenceValue.fallback - Web APIs
the fallback read-only property of the cssvariablereferencevalue interface returns the custom property fallback value of the cssvariablereferencevalue. syntax var fallback = cssvariablereferencevalue.fallback; value a cssunparsedvalue. specifications specification status comment css typed om level 1the definition of 'fallback' in that specification. working draft ...
CSSVariableReferenceValue.variable - Web APIs
the variable property of the cssvariablereferencevalue interface returns the custom property name of the cssvariablereferencevalue. syntax var variable = cssvariablereferencevalue.variable; value a usvstring beginning with -- (that is, a custom property name). specifications specification status comment css typed om level 1the definition of 'variable' in that specification. working draft ...
CSSVariableReferenceValue - Web APIs
the cssvariablereferencevalue interface of the css typed object model api allows you to create a custom name for a built-in css value. this object functionality is sometimes called a "css variable" and serves the same purpose as the var() function. the custom name must begin with two dashes. constructor cssvariablereferencevalue.cssvariablereferencevalue() creates a new cssvariablereferencevalue object. properties cssvariablereferencevalue.variable returns the custom name passed to the constructor. cssvariablereferencevalue.fallback read only returns the built-in css value for the custom name. methods none. specifications specification status comment css typed om level 1the definition of 'cssvariablereferencevalue' in that specification. working...
DOMTokenList.value - Web APIs
the value property of the domtokenlist interface is a stringifier that returns the value of the list as a domstring, or clears and sets the list to the given value. syntax tokenlist.value; value a domstring 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 value 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; span.textcontent = classes.value; the output looks like this: specifications specification status comment domthe definition of 'value' in that specification. living standard initial definition ...
DeviceLightEvent.value - Web APIs
specifications specification status comment ambient light sensorthe definition of 'ambient light events' in that specification. ...
DeviceProximityEvent.value - Web APIs
the value property of deviceproximityevent objects provides the current distance between the device and the detected object, in centimeters. syntax var distance = instanceofdeviceproximityevent.value; value a positive number representing a distance in centimeters (cm) between the device's proximity sensor and the detected object. ...
FormData.values() - Web APIs
Web › API › FormData › values
the formdata.values() method returns an iterator allowing to go through all values contained in this object. the values are usvstring or blob objects. note: this method is available in web workers. syntax formdata.values(); return value returns an iterator. example // create a test formdata object var formdata = new formdata(); formdata.append('key1', 'value1'); formdata.append('key2', 'value2'); // display the values for (var value of formdata.values()) { console.log(value); } the result is: value1 value2 specifications specification status comment xmlhttprequestthe definition of 'values() (as iterator<>)' in that specification. living standard initial definition ...
FormDataEntryValue - Web APIs
a string or file that represents a single value from a set of formdata key-value pairs. this type is returned by the formdata.get() and formdata.getall() methods. the formdata.get() method returns a single value while formdata.getall() returns an array of formdataentryvalues. note that the formdata.append() and formdata.set() methods allow passing a blob value, which is converted to a file in the process. ...
GamepadButton.value - Web APIs
the gamepadbutton.value property of the gamepadbutton interface returns a double value used to represent the current state of analog buttons on many modern gamepads, such as the triggers. the values are normalized to the range 0.0 — 1.0, with 0.0 representing a button that is not pressed, and 1.0 representing a button that is fully pressed. syntax readonly attribute double value; example var gp = navigator.getgamepads()[0]; if(gp.buttons[0].value > 0) { // respond to analog button being pressed in } value a double. specifications specification status comment gamepadthe definition of 'gamepadbutton.value' in that specification. working draft initial definition ...
HTMLDataElement.value - Web APIs
the value property of the htmldataelement interface returns a domstring reflecting the value html attribute. syntax var avalue = htmldataelement.value htmldataelement.value = avalue value a domstring. specifications specification status comment html living standardthe definition of 'htmldataelement.value' in that specification. living standard html5the definition of 'value' in that specification. recommendation ...
KeyboardLayoutMap.values - Web APIs
the values read-only property of the keyboardlayoutmap interface returns a new array iterator object that contains the values for each index in the map. syntax var iterator = keyboardlayoutmap.values value an iterator. specifications specification status comment keyboard mapthe definition of 'values' in that specification. editor's draft initial definition. ...
StylePropertyMapReadOnly.values() - Web APIs
the stylepropertymapreadonly.values() method returns a new array iterator containing the values for each index in the stylepropertymapreadonly object. syntax stylepropertymapreadonly.values() parameters none. return value a new array. example // tbd specifications specification status comment css typed om level 1the definition of 'values()' in that specification. working draft initial definition. ...
USBConfiguration.configurationValue - Web APIs
the configurationvalue read-only property of the usbconfiguration interface null syntax var value = usbconfiguration.configurationvalue value the configuration descriptor of the usbdevice specified in the constructor of the current usbconfiguration instance. specifications specification status comment unknownthe definition of 'configurationvalue' in that specification. unknown initial definition. ...
::-webkit-meter-suboptimum-value - CSS: Cascading Style Sheets
the ::-webkit-meter-suboptimum-value pseudo-element gives a yellow color to the <meter> element when the value attribute falls outside of the low-high range. syntax ::-webkit-meter-suboptimum-value examples this example will only work in browsers based on webkit or blink. html <meter min="0" max="10" value="6">score out of 10</meter> css meter::-webkit-meter-suboptimum-value { background: -webkit-gradient linear, left top, left bottom; height: 100%; box-sizing: border-box; } result specifications not part of any standard. ...
::-webkit-progress-value - CSS: Cascading Style Sheets
the ::-webkit-progress-value css pseudo-element represents the filled-in portion of the bar of a <progress> element. it is a child of the ::-webkit-progress-bar pseudo-element. note: in order to let ::-webkit-progress-value take effect, -webkit-appearance needs to be set to none on the <progress> element. syntax ::-webkit-progress-value examples this example will only work in browsers based on blink or webkit. html <progress value="10" max="50"> css progress { -webkit-appearance: none; } ::-webkit-progress-value { background-color: orange; } result result screenshot a progress bar using the style above would look like this: specifications not part of any standard. ...
Resolved value - CSS: Cascading Style Sheets
the resolved value of a css property is the value returned by getcomputedstyle(). for most properties, it is the computed value, but for a few legacy properties (including width and height), it is instead the used value. see the specification link below for more per-property details. specifications specification status comment css object model (cssom)the definition of 'resolved value' in that specification. working draft initial definition. ...
BigInt.prototype.valueOf() - JavaScript
the valueof() method returns the wrapped primitive value of a bigint 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 bigintobj.valueof() return value a bigint representing the primitive value of the specified bigint object. examples using valueof typeof object(1n); // object typeof object(1n).valueof(); // bigint specifications specification ecmascript (ecma-262)the definition of 'bigint.prototype.valueof()' in that specification. ...
Date.prototype.valueOf() - JavaScript
the valueof() method returns the primitive value of a date object. syntax dateobj.valueof() return value the number of milliseconds between 1 january 1970 00:00:00 utc and the given date. description the valueof() method returns the primitive value of a date object as a number data type, the number of milliseconds since midnight 01 january, 1970 utc. this method is functionally equivalent to the date.prototype.gettime() method. this method is usually called internally by javascript and not explicitly in code. examples using valueof() var x = new date(56, 6, 17); var myvar = x.valueof(); // assigns -424713600000 to myvar specifications specification ecmascript (ecma-262)the definition of 'date.prototype.valueof' in that specification. ...
String.prototype.valueOf() - JavaScript
the valueof() method returns the primitive value of a string object. syntax str.valueof() return value a string representing the primitive value of a given string object. description the valueof() method of string returns the primitive value of a string object as a string data type. this value is equivalent to string.prototype.tostring(). this method is usually called internally by javascript and not explicitly in code. examples using valueof() var x = new string('hello world'); console.log(x.valueof()); // displays 'hello world' specifications specification ecmascript (ecma-262)the definition of 'string.prototype.valueof' in that specification. ...
Symbol.prototype.valueOf() - JavaScript
the valueof() method returns the primitive value of a symbol object. syntax symbol().valueof() return value the primitive value of the specified symbol object. description the valueof method of symbol returns the primitive value of a symbol object as a symbol data type. javascript calls the valueof method to convert an object to a primitive value. you rarely need to invoke the valueof method yourself; javascript automatically invokes it when encountering an object where a primitive value is expected. examples using valueof const sym = symbol("example"); sym === sym.valueof(); // true specifications specification ecmascript (ecma-262)the definition of 'symbol.prototype.valueof' in that specification. ...
<xsl:value-of> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › value-of
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:value-of> element evaluates an xpath expression, converts it to a string, and writes that string to the result tree. syntax <xsl:value-of select=expression disable-output-escaping="yes" | "no" /> required attributes select specifies the xpath expression to be evaluated and written to the output tree. optional attributes disable-output-escaping (netscape does not serialize the result of transformation - the "output" below - so this attribute is essentially irrelevant in context. to output html-entities, use numerical values instead, eg &#160 for &nbsp) specifies whether special characters are escaped when written to the output. the available values are "yes" or "no". if "yes" i...
Index - Web APIs
Web › API › Index
y of strings in the address's addressline. the returned string explains the error and should offer suggestions for how to correct it. 31 addresserrors.city api, address, addresserrors, error, payment request, payment request api, property, read-only, reference, city, payment an object based on addresserrors includes a city property when validation of the address fails for the value given for the address's city property. the returned string explains the error and should offer suggestions for how to correct it. 32 addresserrors.country api, addresserrors, error, payment request, payment request api, property, reference, validation, country, payment an object based on addresserrors includes a country property if during validation of the address the specifi...
...ven for the address's city property. the returned string explains the error and should offer suggestions for how to correct it. 32 addresserrors.country api, addresserrors, error, payment request, payment request api, property, reference, validation, country, payment an object based on addresserrors includes a country property if during validation of the address the specified value of country was determined to be invalid. the value is a string describing the error and should offer suggestions for how to correct it. 33 addresserrors.dependentlocality api, addresserrors, error, locality, payment request, payment request api, property, read-only, reference, dependentlocality, payment an object based on addresserrors includes a dependentlocality property wh...
...ns. 52 analysernode.analysernode() api, analysernode, audio, constructor, media, reference, web audio api the analysernode constructor of the web audio api creates a new analysernode object instance. 53 analysernode.fftsize api, analysernode, property, reference, web audio api, fftsize the fftsize property of the analysernode interface is an unsigned long value and represents the window size in samples that is used when performing a fast fourier transform (fft) to get frequency domain data. 54 analysernode.frequencybincount api, analysernode, property, reference, web audio api, frequencybincount the frequencybincount read-only property of the analysernode interface is an unsigned integer half that of the analysernode.fftsize. this g...
...And 593 more matches
JXON - Archive of obsolete content
e doc — the dom tree — to a javascript object tree (you can read more about working with objects and how javascript is object-oriented). we can use several algorithms to convert its content to a javascript object tree. algorithm #1: a verbose way this simple recursive constructor will convert an xml dom tree to a javascript object tree. the text content of each element is stored into the keyvalue property, while nodeattributes, if they exist, are listed under the child object keyattributes. the constructor's argument can be the entire xml document, a documentfragment or simply an element node. /*\ |*| |*| jxon snippet #1 mdndeveloper network |*| |*| https://developer.mozilla.org/docs/jxon |*| https://developer.mozilla.org/user:fusionchess |*| |*| this framework is released under the ...
... be the entire xml document, a documentfragment or simply an element node. /*\ |*| |*| jxon snippet #1 mdndeveloper network |*| |*| https://developer.mozilla.org/docs/jxon |*| https://developer.mozilla.org/user:fusionchess |*| |*| this framework is released under the gnu public license, version 3 or later. ...
...a documentfragment or simply an element node. /*\ |*| |*| jxon snippet #1 mdndeveloper network |*| |*| https://developer.mozilla.org/docs/jxon |*| https://developer.mozilla.org/user:fusionchess |*| |*| this framework is released under the gnu public license, version 3 or later. ...
...And 131 more matches
WebIDL bindings
n will eventually get you to a window, so that every webidl object is associated with a particular window. for example, nsinode::getparentobject returns the node's owner document. the return type of getparentobject doesn't matter other than it must either singly-inherit from nsisupports or have a corresponding tosupports method that can produce an nsisupports from it. (this allows the return value to be implicitly converted to a parentobject instance by the compiler via one of that class's non-explicit constructors.) if many instances of myinterface are expected to be created quicky, the return value of getparentobject should itself inherit from nswrappercache for optimal performance. returning null from getparentobject is allowed in situations in which it's ok to associate the result...
...dd an entry either and the code generator will simply assume the defaults here. note that using a 'headerfile' annotation is generally not recommended. if you do use it, you will need to make sure your header includes all the headers needed for your func annotations. add external interface entries to bindings.conf for whatever non-webidl interfaces your new interface has as arguments or return values. implement a wrapobject override on mozilla::dom::myinterface that just calls through to mozilla::dom::myinterface_binding::wrap. note that if your c++ type is implementing multiple distinct web idl interfaces, you need to choose which mozilla::dom::myinterface_binding::wrap to call here. see audiocontext::wrapobject, for example. expose whatever methods the interface needs on mozilla::dom::m...
...ple patch that migrates window.performance.* to webidl bindings. note: if your object can only be reflected into js by creating it, not by retrieving it from somewhere, you can skip steps 1 and 2 above and instead add 'wrappercache': false to your descriptor. you will need to flag the functions that return your object as [newobject] in the webidl. if your object is not refcounted then the return value of functions that return it should return an nsautoptr. c++ reflections of webidl constructs c++ reflections of webidl operations (methods) a webidl operation is turned into a method call on the underlying c++ object. the return type and argument types are determined as described below. in addition to those, all methods that are allowed to throw will get an errorresult& argument appended to ...
...And 103 more matches
Index
buffer 18 boolean_to_jsval jsapi reference, obsolete, spidermonkey boolean_to_jsval converts a bool argument, b, to a boolean jsval. 19 double_to_jsval jsapi reference, obsolete, spidermonkey double_to_jsval is the inverse of js::tonumber. 20 int_fits_in_jsval jsapi reference, obsolete, spidermonkey determines if a specified c integer value, i, lies within the range allowed for integer jsvals. if so, int_fits_in_jsval returns true, and i can be cast to jsval by calling int_to_jsval(i). otherwise, int_fits_in_jsval returns false. in this case, the application can still convert i to a jsval using js_newnumbervalue. 21 int_to_jsval jsapi reference, obsolete, spidermonkey int_to_jsval converts a c integer, i, to a j...
...api reference, reference, référence(2), spidermonkey js::autoidarray takes the ownership of jsidarray, and frees it in destructor by calling js_destroyidarray. 24 js::autosaveexceptionstate jsapi reference, reference, référence(2), spidermonkey js::autosaveexceptionstate saves and later restores the current exception state of a given jscontext. 25 js::autovaluearray jsapi reference, reference, référence(2), spidermonkey js::autovaluearray<n> holds a rooted array of js::value. this is typically used for local variables being passed to function which requires js::handlevaluearray or a pointer to js::value array. 26 js::autovectorrooter jsapi reference, reference, référence(2), spidermonkey js::autovectorrooter<t> holds a...
... 28 js::call jsapi reference, reference, spidermonkey js::call calls a specified function, fun, on an object, thisobj. in terms of function execution, the object is treated as this. ...
...And 102 more matches
Bytecode Descriptions
bytecode listing this document is automatically generated from opcodes.h by make_opcode_doc.py. constants undefined stack: ⇒ undefined push undefined. null stack: ⇒ null push null. false, true stack: ⇒ true/false push a boolean constant. int32 operands: (int32_t val) stack: ⇒ val push the int32_t immediate operand as an int32value. jsop::zero, jsop::one, jsop::int8, jsop::uint16, and jsop::uint24 are all compact encodings for jsop::int32. zero stack: ⇒ 0 push the number 0. one stack: ⇒ 1 push the number 1. int8 operands: (int8_t val) stack: ⇒ val push the int8_t immediate operand as an int32value. uint16 operands: (uint16_t val) stack: ⇒ val push the uint16_t immediate operand as an int32value. uint24 operands: (uint24_t val) stack: ⇒ val push the ...
...if the operand is a nan, it must be the canonical nan (see js::detail::canonicalizenan). ...
...if the operand is a nan, it must be the canonical nan (see js::detail::canonicalizenan). bigint operands: (uint32_t bigintindex) stack: ⇒ bigint push the bigint constant script->getbigint(bigintindex). string operands: (uint32_t atomindex) stack: ⇒ string push the string constant script->getatom(atomindex). ...
...And 98 more matches
sslfnc.html
services. database files are opened read-only. syntax #include "nss.h" secstatus nss_init(char *configdir); parameter this function has the following parameter: configdir a pointer to a string containing the pathname of the directory where the certificate, key, and security module databases reside. returns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. use pr_geterror to retrieve the error code. description nss_init opens the certn.db, keyn.db, and secmod.db files (wheren is a numeric digit) in the specified directory. nss_init isnot idempotent, so call it only once. nss_init opens the database files read-only. if you are performing operations that require write permissio...
...d and write access to database files. syntax #include "nss.h" secstatus nss_initreadwrite(char *configdir); parameter this function has the following parameter: configdir a pointer to a string containing the pathname of the directory where the certificate, key, and security module databases reside. returns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. use pr_geterror to retrieve the error code. description nss_initreadwrite opens the certn.db, keyn.db, and secmod.db files (wheren is a numeric digit) with both read and write permission in the specified directory. nss_initreadwrite isnot idempotent, so call it only once. use nss_initreadwrite rather than nss_init if you are...
... configuration files. important: this nss function is not intended for use with ssl, which requires that the certificate and key database files be opened. syntax #include "nss.h" secstatus nss_nodb_init(char *reserved); parameter this function has the following parameter: reserved should be null.. returns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. use pr_geterror to retrieve the error code. description nss_nodb_init opens only the temporary database and the internal pkcs #112 module. unlike nss_init, nss_nodb_init allows applications that do not have access to storage for databases to run raw crypto, hashing, and certificate functions. nss_nodb_init isnot idempotent, ...
...And 91 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
Web › HTML › Element › input
and complex in all of html due to the sheer number of combinations of input types and attributes. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... <input type="checkbox" name="checkbox"/> color a control for specifying a color; opening a color picker when active in supporting browsers. ...
... <input type="checkbox" name="checkbox"/> color a control for specifying a color; opening a color picker when active in supporting browsers. ...
...And 90 more matches
Index - Archive of obsolete content
private bytes memory (high water mark) for a test. by default each test is run a single time. to run each test multiple times use the --iterations flag. when the number of iterations is greater than 2 all times are displayed in [], faster time is displayed in the output column, and the 95% confidence interval is calculated. the 95% confidence interval is the calculated percentage of the mean value to fall within 95% of the measured results. for example if the mean is 100 and the 95% confidence interval is 2%, 95% of the expected values should fall between 98 and 102. to compare two vms against each other export avm2=<path to 2nd vm> or use --avm2=<path to 2nd vm>. the percentage difference is calculated between the two vms. see the --help usage for more details about performance tests.
...are defined as part of the xpinstall object (formerly the softwareupdate object in netscape communicator 4.5). 733 winprofile object (windows only) windows developers use this object to manipulate the content of a windows .ini file. ...
...ll object (formerly the softwareupdate object in netscape communicator 4.5). 733 winprofile object (windows only) windows developers use this object to manipulate the content of a windows .ini file. 734 methods no summary! 735 winreg object (windows only) 736 methods the winregvalue constructor creates a winregvalue object. ...
...And 74 more matches
Index
Mozilla › Tech › XPCOM › Index
ct new instances of xpcom components. 18 components.exception xpcom:language bindings, xpconnect components.exception is a javascript constructor to create nsixpcexception objects. these exception objects may be thrown when implementing xpcom interfaces in javascript, and they can provide better diagnostics in the error console if not caught than simply throwing an nsresult's value will. 19 components.id xpcom:language bindings, xpconnect components.id is a constructor that creates native objects that conform to the nsijsid interface. 20 components.classes xpcom:language bindings, xpconnect components.classes is a read-only object whose properties are classes indexed by contractid. 21 components.classesbyid xpcom:lang...
...aces is a read-only object whose properties are interfaces indexed by their names. 23 components.interfacesbyid xpcom:language bindings, xpconnect components.interfacesbyid is a read-only array of classes indexed by iid. 24 components.issuccesscode xpcom, xpcom:language bindings, xpconnect determines whether a given xpcom return code (that is, an nsresult value) indicates the success or failure of an operation, returning true or false respectively. 25 components.lastresult xpcom:language bindings, xpconnect no summary! 26 components.manager xpcom:language bindings, xpconnect components.manager is a convenience reflection of the global native component manager service. the scriptable methods on the nsicomponentma...
... global native component manager service. the scriptable methods on the nsicomponentmanager interface can be called directly on this object. 27 components.results xpcom:language bindings, xpconnect components.results is a read-only object whose properties are the names listed as the first parameters of the macros in js/xpconnect/src/xpc.msg (also at table of errors), with the value of each corresponding to that constant's value. 28 components.returncode xpcom:language bindings, xpconnect no summary! 29 components.stack xpcom:language bindings, xpconnect components.stack is a read only property of type nsistackframe (idl definition) that represents a snapshot of the current javascript callstack. this can be used for various diagnosti...
...And 71 more matches
Linear-gradient Generator - CSS: Cascading Style Sheets
div id="container"> <div id="gradient-container" data-alpha="true"> </div> <div id="controls"> <div class="section"> <div class="title"> active point </div> <div class="property"> <div class="ui-input-slider" data-topic="point-position" data-info="position" data-unit="px" data-min="-1000" data-value="0" data-max="1000" data-sensivity="5"></div> <div id="delete-point" class="button"> delete point </div> </div> <div class="ui-color-picker" data-topic="picker"></div> </div> <div class="section"> <div class="title"> active axis </div> <div class="property"> <div class=...
...v> <div class="ui-color-picker" data-topic="picker"></div> </div> <div class="section"> <div class="title"> active axis </div> <div class="property"> <div class="name"> axis unit </div> <div class="ui-dropdown" data-topic="axis-unit" data-selected="1"> <div data-value='px'> pixels (px) </div> <div data-value='%'> percentage (%) </div> </div> <div id="delete-axis" class="button"> delete line </div> </div> <div class="property"> <div class="ui-slider" data-topic="axis-rotation" data-info="rotation" data-min="-180" data-value...
...lass="button"> add line </div> </div> <div id="order"> <div id="gradient-axes"></div> <div id="gradient-order"></div> </div> </div> </div> <div id="output"> <div class="css-property"> <span class="property">background:</span> <span class="value"></span> </div> </div> </div> css content /* * color picker tool */ .ui-color-picker { width: 420px; margin: 0; border: 1px solid #ddd; background-color: #fff; display: table; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; } .ui-color-picker .picking-area { width: 198px; height: 198px; margin: 5px; border: 1...
...And 71 more matches
Making decisions in your code — conditionals - Learn web development
itional statement you'll use in javascript — the humble if...else statement. basic if ... else syntax basic if...else syntax looks like the following in pseudocode: if (condition) { code to run if condition is true } else { run some other code instead } here we've got: the keyword if followed by some parentheses. a condition to test, placed inside the parentheses (typically "is this value bigger than this other value?", or "does this value exist?"). the condition makes use of the comparison operators we discussed in the last module and returns true or false. a set of curly braces, inside which we have some code — this can be any code we like, and it only runs if the condition returns true. the keyword else. another set of curly braces, inside which we have some more code — ...
...than two? there is a way to chain on extra choices/outcomes to your if...else — using else if. each extra choice requires an additional block to put in between if() { ... } and else { ... ...
...oices/outcomes to your if...else — using else if. each extra choice requires an additional block to put in between if() { ... } and else { ... ...
...And 55 more matches
WebGL constants - Web APIs
as more information, examples, and resources on how to get started with webgl. table of contents standard webgl 1 constants standard webgl 2 constants webgl extension constants standard webgl 1 constants these constants are defined on the webglrenderingcontext interface. clearing buffers constants passed to webglrenderingcontext.clear() to clear buffer masks. constant name value description depth_buffer_bit 0x00000100 passed to clear to clear the current depth buffer. stencil_buffer_bit 0x00000400 passed to clear to clear the current stencil buffer. color_buffer_bit 0x00004000 passed to clear to clear the current color buffer. rendering primitives constants passed to webglrenderingcontext.drawelements() or webgl...
...pth buffer. stencil_buffer_bit 0x00000400 passed to clear to clear the current stencil buffer. color_buffer_bit 0x00004000 passed to clear to clear the current color buffer. rendering primitives constants passed to webglrenderingcontext.drawelements() or webglrenderingcontext.drawarrays() to specify what kind of primitive to render. constant name value description points 0x0000 passed to drawelements or drawarrays to draw single points. lines 0x0001 passed to drawelements or drawarrays to draw lines. each vertex connects to the one after it. line_loop 0x0002 passed to drawelements or drawarrays to draw lines. each set of two vertices is treated as a separate line segment. line_strip ...
... triangle_fan 0x0006 passed to drawelements or drawarrays to draw a connected group of triangles. each vertex connects to the previous and the first vertex in the fan. blending modes constants passed to webglrenderingcontext.blendfunc() or webglrenderingcontext.blendfuncseparate() to specify the blending mode (for both, rbg and alpha, or separately). constant name value description zero 0 passed to blendfunc or blendfuncseparate to turn off a component. one 1 passed to blendfunc or blendfuncseparate to turn on a component. src_color 0x0300 passed to blendfunc or blendfuncseparate to multiply a component by the source elements color. one_minus_src_color 0x0301 passed to blendfunc or blendfuncsepar...
...And 55 more matches
Border-image generator - CSS: Cascading Style Sheets
this tool can be used to generate css3 border-image values. border image generator html content <div id="container"> <div id="gallery"> <div id="image-gallery"> <img class="image" src="https://udn.realityripple.com/samples/2c/fa0192d18e.png" data-stateid="border1"/> <img class="image" src="https://udn.realityripple.com/samples/b8/dacdd63e77.png" data-stateid="border2"/> <img class="image" src="https://udn.realityripple.com/samples/07/1fcc357205.png" data-stateid="border3"/> <img class="image" src="https://udn.realityripple.com/samples/7b/dd37c1d691.png" data-stateid="border4"/> <img class="image" src="https://udn.realityripple.com/samples/a9/b9fff72dab.png" data-stateid="border5"...
...iv> <!-- other-settings --> <div id="aditional-properties" class="category"> <div class="title"> aditional-properties </div> <div class="property"> <div class="name"> repeat-x </div> <div class="ui-dropdown border-repeat" data-topic="image-repeat-x" data-selected="2"> <div data-value="0">repeat</div> <div data-value="0">stretch</div> <div data-value="0">round</div> </div> </div> <div class="property"> <div class="name"> repeat-y </div> <div class="ui-dropdown border-repeat" data-topic="image-repeat-y" data-selected="2"> ...
...> <div data-value="0">stretch</div> <div data-value="0">round</div> </div> </div> <div class="property"> <div class="name"> repeat-y </div> <div class="ui-dropdown border-repeat" data-topic="image-repeat-y" data-selected="2"> <div data-value="1">repeat</div> <div data-value="1">stretch</div> <div data-value="1">round</div> </div> </div> <div class="property"> <div class="ui-input-slider" data-topic="font-size" data-info="em size" data-unit="px" data-value="12" data-sensivity="3"> ...
...And 55 more matches
Box-shadow generator - CSS: Cascading Style Sheets
" class="hue"> <div id="hue_selector"> </div> </div> <div class="info"> <div class="input" data-topic="hue" data-title='h:' data-action="hsv"></div> <div class="input" data-topic="saturation" data-title='s:' data-action="hsv"></div> <div class="input" data-topic="value" data-title='v:' data-action="hsv"></div> </div> <div class="alpha"> <div id="alpha" data-topic="alpha"> <div id="alpha_selector"> </div> </div> </div> <div class="info"> <div class="input" data-topic="r" data-title='r:...
...t="px"></div> </div> <div class="slidergroup"> <div class="ui-slider-name"> spread </div> <div class="ui-slider-btn-set" data-topic="spread" data-type="sub"></div> <div class="ui-slider" data-topic="spread" data-min="-100" data-max="100" data-step="1" data-value="50"> </div> <div class="ui-slider-btn-set" data-topic="spread" data-type="add"></div> <div class="ui-slider-input" data-topic="spread" data-unit="px"></div> </div> </div> </div> <div id="element_properties" class="category"> <div class="title"> clas...
... </div> <div id="transform_rotate" class="slidergroup"> <div class="ui-slider-name"> rotate </div> <div class="ui-slider-btn-set" data-topic="rotate" data-type="sub"></div> <div class="ui-slider" data-topic="rotate" data-min="-360" data-max="360" data-step="1" data-value="0"> </div> <div class="ui-slider-btn-set" data-topic="rotate" data-type="add"></div> <div class="ui-slider-input" data-topic="rotate" data-unit="deg"></div> </div> <div class="slidergroup"> <div class="ui-slider-name"> width </div> <div c...
...And 55 more matches
Color picker tool - CSS: Cascading Style Sheets
d #ddd; background-color: #fff; display: table; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; } .ui-color-picker .picking-area { width: 198px; height: 198px; margin: 5px; border: 1px solid #ddd; position: relative; float: left; display: table; } .ui-color-picker .picking-area:hover { cursor: default; } /* hsv format - hue-saturation-value(brightness) */ .ui-color-picker .picking-area { background: url('https://mdn.mozillademos.org/files/5707/picker_mask_200.png') center center; background: -moz-linear-gradient(bottom, #000 0%, rgba(0, 0, 0, 0) 100%), -moz-linear-gradient(left, #fff 0%, rgba(255, 255, 255, 0) 100%); background: -webkit-linear-gradient(bottom, #000 0%, rgba(0, 0, 0, 0) 100%), -webkit-linear-gradient(left...
...-size: 14px; line-height: 18px; float: left; } .ui-color-picker .input input { width: 30px; height: 18px; margin: 0; padding: 0; border: 1px solid #ddd; text-align: center; float: right; -moz-user-select: text; -webkit-user-select: text; -ms-user-select: text; } .ui-color-picker .input[data-topic="lightness"] { display: none; } .ui-color-picker[data-mode='hsl'] .input[data-topic="value"] { display: none; } .ui-color-picker[data-mode='hsl'] .input[data-topic="lightness"] { display: block; } .ui-color-picker .input[data-topic="alpha"] { margin-top: 10px; width: 93px; } .ui-color-picker .input[data-topic="alpha"] > .name { width: 60px; } .ui-color-picker .input[data-topic="alpha"] > input { float: right; } .ui-color-picker .input[data-topic="hexa"] { width: auto; floa...
... background-position: center left 30%; } #color-info .copy-container { position: absolute; top: -100%; } #color-info .property { min-width: 280px; height: 30px; margin: 10px 0; text-align: center; line-height: 30px; } #color-info .property > * { float: left; } #color-info .property .type { width: 60px; height: 100%; padding: 0 16px 0 0; text-align: right; } #color-info .property .value { width: 200px; height: 100%; padding: 0 10px; font-family: "segoe ui", arial, helvetica, sans-serif; font-size: 16px; color: #777; text-align: center; background-color: #fff; border: none; } #color-info .property .value:hover { color: #37994a; } #color-info .property .value:hover + .copy { background-position: center right; } #color-info .property .copy { width: 24px; height: 100...
...And 51 more matches
nsIDOMWindowUtils
owutils = window.windowutils; method overview void activatenativemenuitemat(in astring indexstring); void clearmozafterpaintevents(); pruint32 comparecanvases(in nsidomhtmlcanvaselement acanvas1, in nsidomhtmlcanvaselement acanvas2, out unsigned long amaxdifference); double computeanimationdistance(in nsidomelement element, in astring property, in astring value1, in astring value2); nsicompositionstringsynthesizer createcompositionstringsynthesizer(); obsolete since gecko 38.0 void disablenontestmouseevents(in boolean adisable); boolean dispatchdomeventviapresshell(in nsidomnode atarget, in nsidomevent aevent, in boolean atrusted); nsidomelement elementfrompoint(in float ax, in float ay, in boolean aignorerootscro...
...an inline element contains blocks). this number also counts restyling of pseudo-elements and anonymous boxes. throws ns_error_not_available if the count can't be provided. focusedinputtype string the type of the currently-focused html <input> element, if one is focused. imageanimationmode unsigned short returns the image animation mode of the window. the attribute's value must be one of the animationmode values from imgicontainer. imeisopen boolean returns the ime open state. true if it's open, otherwise false. this attribute only works when imestatus is ime_status_enabled. read only. imestatus unsigned long returns the current ime status. values correspond to the ime_status_* constants defined below. read only. ismozafterp...
...of screen pixels per css pixel. read only. audiomuted boolean with this it's possible to mute all the mediaelements in this window. we have audiomuted and audiovolume to preserve the volume across mute/umute. audiovolume float range: greater or equal to 0. the real volume level is affected by the volume of all ancestor windows. constants constant value description modifier_alt 0x0001 getmodifierstate("alt") of the send event will return true if this is specified for amodifiers of send*event() except sendnative*event(). modifier_control 0x0002 getmodifierstate("control") of the send event will return true if this is specified for amodifiers of send*event() except sendnative*event(). modifier_shift 0...
...And 44 more matches
Using the CSS Typed Object Model - Web APIs
the css typed object model api exposes css values as typed javascript objects to allow their performant manipulation. converting css object model value strings into meaningfully-typed javascript representations and back (via htmlelement.style) can incur a significant performance overhead. the css typed om makes css manipulation more logical and performant by providing object features (rather than cssom string manipulation), providing access to types, methods, and an object model for css values. this article provides an introduction to all of its main features. computedstylemap() with the css typed om api, we can access all the css properties and values — including custom properties — that are impacting an element. let's see how this works by creating our first example, which e...
...f its main features. computedstylemap() with the css typed om api, we can access all the css properties and values — including custom properties — that are impacting an element. let's see how this works by creating our first example, which explores computedstylemap(). we start with some html: a paragraph with a link, as well as a definition list to which we will add all the css property / value pairs. <p> <a href="https://example.com">link</a> </p> <dl id="regurgitation"></dl> we add javascript to grab our unstyled link and return back a definition list of all the default css property values impacting the link using computedstylemap(). // get the element const myelement = document.queryselector('a'); // get the <dl> we'll be populating const styleslist = document.queryselector('#...
...t css property values impacting the link using computedstylemap(). ...
...And 44 more matches
<input type="range"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › range
<input> elements of type range let the user specify a numeric value which must be no less than a given value, and no more than another given value. the precise value, however, is not considered important. this is typically represented using a slider or dial control rather than a text entry box like the number input type. because this kind of widget is imprecise, it shouldn't typically be used unless the control's exact value isn't important. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...cally be used unless the control's exact value isn't important. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. if the user's browser doesn't support type range, it will fall back and treat it as a text input. value a domstring containing the string representation of the selected numeric value; use valueasnumber to get the value as a number. ...
...uest. if the user's browser doesn't support type range, it will fall back and treat it as a text input. value a domstring containing the string representation of the selected numeric value; use valueasnumber to get the value as a number. events change and input supported common attributes autocomplete, list, max, min, and step idl attributes list, value, and valueasnumber methods stepdown() and stepup() validation there is no pattern validation available; however, the following forms of automatic validation are performed: if the value is set to something which can't be converted into a valid floating-point number, validation fails because the input is suffering from a bad input. the value won't be less than min. the defau...
...And 44 more matches
Array.prototype.reduce() - JavaScript
the reduce() method executes a reducer function (that you provide) on each element of the array, resulting in single output value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...educer function (that you provide) on each element of the array, resulting in single output value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the reducer function takes four arguments: accumulator (acc) current value (cur) current index (idx) source array (src) your reducer function's returned value is assigned to the accumulator, whose value is remembered across each iteration throughout the array, and ultimately becomes the final, single resulting value. ...
...nd us a pull request. the reducer function takes four arguments: accumulator (acc) current value (cur) current index (idx) source array (src) your reducer function's returned value is assigned to the accumulator, whose value is remembered across each iteration throughout the array, and ultimately becomes the final, single resulting value. syntax arr.reduce(callback( accumulator, currentvalue, [, index[, array]] )[, initialvalue]) parameters callback a function to execute on each element in the array (except for the first, if no initialvalue is supplied). it takes four arguments: accumulator the accumulator accumulates callback's return values. ...
...And 44 more matches
<input type="number"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › number
<input> elements of type number are used to let the user enter a number. they include built-in validation to reject non-numerical entries. the browser may opt to provide stepper arrows to let the user increase and decrease the value using their mouse or by simply tapping with a fingertip. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. on browsers that don't support inputs of type number, a number input falls back to type text. value any floating-point number, or empty. events change and input supported common attributes autocomplete, list, placeholder, readonly idl attri...
...les project, please clone https://github.com/mdn/interactive-examples and send us a pull request. on browsers that don't support inputs of type number, a number input falls back to type text. value any floating-point number, or empty. events change and input supported common attributes autocomplete, list, placeholder, readonly idl attributes list, value, valueasnumber methods select(), stepup(), stepdown() value any floating-point number, or empty. ...
...number, a number input falls back to type text. value any floating-point number, or empty. events change and input supported common attributes autocomplete, list, placeholder, readonly idl attributes list, value, valueasnumber methods select(), stepup(), stepdown() value any floating-point number, or empty. ...
...And 43 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
that we had set up ourselves. the xul box model in principle, xul lays out all ui components using combinations of two kinds of boxes: horizontal and vertical. as shown in listing 3, elements can be laid out horizontally using the hbox (horizontal box) element or vertically using the vbox (vertical box) element. when this file is opened in firefox, it is displayed as shown in figure 1. ...
... of two kinds of boxes: horizontal and vertical. as shown in listing 3, elements can be laid out horizontally using the hbox (horizontal box) element or vertically using the vbox (vertical box) element. when this file is opened in firefox, it is displayed as shown in figure 1. ...
...y using the hbox (horizontal box) element or vertically using the vbox (vertical box) element. when this file is opened in firefox, it is displayed as shown in figure 1. ...
...And 41 more matches
source-editor.jsm
editorelement element the element containing the editor. when using the default orion editor, this is...
...ent void addbreakpoint(number alineindex, [optional] string acondition); array getbreakpoints(); boolean removebreakpoint(number alineindex); properties attribute type description dirty boolean set this value to false whenever you save the text; the editor will update it to true when the content is changed. you can then use this value to detect when the contents of the text are different from your most recent save. in addition, when this value changes, the "dirtychanged" event is sent. editorelement element the element containing the editor. when using the default orion editor, this is a xul <xul:iframe> element. read only. lastfind object an object describing the result of the last find ope...
... an object describing the result of the last find operation performed using the find(), findnext(), or findprevious() method. read only. this object has the following properties: property type description str string the last string that was searched for. index number an integer value indicating the result of the most recent find operation; this is the index into the text at which str was found, or -1 if the string wasn't found. lastfound number the index of the previous location at which str was found, for multiple find operations (such as find() followed by findnext()). this can be -1 if the string was never found. igno...
...And 41 more matches
Mozilla internal string guide
from either nsastring or nsstring. thus, every string class is compatible with nsastring. since every string derives from nsastring (or nsacstring), they all share a simple api. common read-only methods: .length() - the number of code units (bytes for 8-bit string classes and char16_ts for 16-bit string classes) in the string. .isempty() - the fastest way of determining if the string has any value. use this instead of testing string.length == 0 .equals(string) - true if the given string has the same value as the current string. common methods that modify the string: .assign(string) - assigns a new value to the string. .append(string) - appends a value to the string. .insert(string, position) - inserts the given string before the code unit at position. .truncate(length) - shortens ...
...es four arguments: the new capacity (which may be rounded up), the number of code units at the beginning of the string to preserve (typically the old logical length), a boolean indicating whether reallocating a smaller buffer is ok if the requested capacity would fit in a buffer that's smaller than current one, and a reference to an nsresult for indicating failure on oom. (don't access the return value if the nsresult indicates failure. unfortunately mozilla::result is not versatile enough to be used here.) bulkwrite() returns a mozilla::bulkwritehandle<t>, where t is either char or char16_t. the actual writes are performed through this handle. you must not access the string except via the handle until you call finish() on the handle in the success case or you let the handle go out of scope wi...
... nsastring::const_iterator start, nsastring::const_iterator end, nsstringcomparator& acomparator = nsdefaultstringcomparator()); to use this, start and end should point to the beginning and end of a string that you would like to search. if the search string is found, start and end will be adjusted to point to the beginning and end of the found pattern. ...
...And 41 more matches
nsIAnnotationService
". to use this service, use: var annotationservice = components.classes["@mozilla.org/browser/annotation-service;1"] .getservice(components.interfaces.nsiannotationservice); note: the annotation service is not thread-safe. you should only use it from the main thread. ...
...service(components.interfaces.nsiannotationservice); note: the annotation service is not thread-safe. you should only use it from the main thread. ...
...hread. ...
...And 40 more matches
Web audio spatialization basics - Web APIs
to the position of the listener. ...
... let's create our context and listener and set the listener's position to emulate a person looking into our room: const audiocontext = window.audiocontext || window.webkitaudiocontext; const audioctx = new audiocontext(); const listener = audioctx.listener; const posx = window.innerwidth/2; const posy = window.innerheight/2; const posz = 300; listener.positionx.value = posx; listener.positiony.value = posy; listener.positionz.value = posz-5; we could move the listener left or right using positionx, up or down using positiony, or in or out of the room using positionz. here we are setting the listener to be in the middle of the viewport and slightly in front of our boombox. we can also set the direction the listener is facing. the default values for these work well: listener.forwardx.value ...
...the direction they are facing in), while the up properties represent the 3d coordinate position of the top of the listener's head. these two together can nicely set the direction. ...
...And 40 more matches
Object.defineProperty() - JavaScript
ontribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.defineproperty(obj, prop, descriptor) parameters obj the object on which to define the property. prop the name or symbol of the property to be defined or modified. descriptor the descriptor for the property being defined or modified. return value the object that was passed to the function. description this method allows a precise addition to or modification of a property on an object. normal property addition through assignment creates properties which show up during property enumeration (for...in loop or object.keys method), whose values may be changed, and which may be deleted. this method allows these extra details to be changed fro...
...o the function. description this method allows a precise addition to or modification of a property on an object. normal property addition through assignment creates properties which show up during property enumeration (for...in loop or object.keys method), whose values may be changed, and which may be deleted. this method allows these extra details to be changed from their defaults. by default, values added using object.defineproperty() are immutable and not enumerable. property descriptors present in objects come in two main flavors: data descriptors and accessor descriptors. a data descriptor is a property that has a value, which may or may not be writable. an accessor descriptor is a property described by a getter-setter pair of functions. a descriptor must be one of these two flavors; it...
... defaults to false. ...
...And 40 more matches
x - SVG: Scalable Vector Graphics
Web › SVG › Attribute › x
{ height:100% } <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. ...
..." 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. ...
... 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. ...
...And 39 more matches
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
ref ) for the record/history purpose ... the old netscape 4.x the file is encoded (byte-shift/rotary is 7), and the presence of the file (netscape.cfg) in the mozilla_home directory suffices for it to be read and executed. for mozilla 1.x.x, firefox, thunderbird or netscape 7 it is still a javascript file, the byte-shift is 13 by default, but can be removed using the pref("general.config.obscure_value", 0); preference in any appropriate .js file dedicated to autoconfig (here autoconf.js). the name of the file can be anything you want because it is named by a general.config preference that should be added at the end of file mozilla_home/default/pref/autoconf.js or mozilla_home/greprefs/autoconf.js: pref("general.config.filename", "mozilla.cfg");. file api that centralized preference file use...
...a_home/default/autoconfig/prefcalls.js. the presence of pref("general.config.filename", "mozilla.cfg"); in any appropriate .js file (here we use autoconf.js dedicated file) enables the read and execution of prefcalls.js. do not use the name all.js because it is reserved. ...
.... the presence of pref("general.config.filename", "mozilla.cfg"); in any appropriate .js file (here we use autoconf.js dedicated file) enables the read and execution of prefcalls.js. do not use the name all.js because it is reserved. ...
...And 38 more matches
Index - Archive of obsolete content
Archive › Mozilla › XUL › Index
31 browserid xul, xul reference no summary! 32 button.type xul attributes, xul reference no summary! 33 buttonaccesskeyaccept xul attributes, xul reference no summary! 34 buttonaccesskeycancel xul attributes, xul refer...
...ustomindex xul attributes, xul reference no summary! 82 customizable xul attributes, xul reference no summary! 83 cycler xul attributes, xul reference no summary! 84 datasources xul attributes, xul reference no summary! 85 datepicker.type xul attributes, xul reference no summary! 86 datepicker.value xul attributes, xul reference no summary! 87 decimalplaces xul attributes, xul reference no summary! 88 default xul attributes, xul reference no summary! 89 defaultbutton xul attributes, xul reference no summary! 90 defaultset xul attributes, xul reference no summary! 91 description xul at...
... summary! 166 isempty xul attributes, xul reference no summary! 167 key xul attributes, xul reference no summary! 168 keycode xul attributes, xul reference no summary! 169 keytext xul attributes, xul reference no summary! 170 label xul attributes, xul reference no summary! 171 label.value xul attributes, xul reference no summary! 172 last-tab xul attributes, xul reference no summary! 173 lastselected xul attributes, xul reference no summary! 174 lastpage xul attributes, xul reference no summary! 175 left xul attributes, xul reference no summary! 176 lightweightthemes lightw...
...And 38 more matches
nsIMsgIncomingServer
nsimsgincomingserver mailnews/base/public/nsimsgincomingserver.idlscriptable ??? add brief description of interface ??? ...
...n nsimsgfilterlist filterlist); void configuretemporaryreturnreceiptsfilter(in nsimsgfilterlist filterlist); obsolete since gecko 1.8 void displayofflinemsg(in nsimsgwindow awindow); boolean equals(in nsimsgincomingserver server); void forgetpassword(); void forgetsessionpassword(); astring generateprettynameformigration(); boolean getboolattribute(in string name); boolean getboolvalue(in string attr); acstring getcharattribute(in string name); acstring getcharvalue(in string attr); nsilocalfile getfilevalue(in string relpref, in string abspref); nsimsgfilterlist getfilterlist(in nsimsgwindow amsgwindow); long getintattribute(in string name); long getintvalue(in string attr); nsimsgfolder getmsgfolderfromuri(in nsimsgfolder afolderresource, in acstring auri); vo...
...w); long getintattribute(in string name); long getintvalue(in string attr); nsimsgfolder getmsgfolderfromuri(in nsimsgfolder afolderresource, in acstring auri); void getnewmessages(in nsimsgfolder afolder, in nsimsgwindow amsgwindow, in nsiurllistener aurllistener); acstring getpasswordwithui(in astring apromptstring, in astring aprompttitle, in nsimsgwindow amsgwindow, out boolean okayvalue); astring getunicharattribute(in string name); astring getunicharvalue(in string attr); boolean isnewhdrduplicate(in nsimsgdbhdr anewhdr); void onuserorhostnamechanged(in acstring oldname, in acstring newname); void performbiff(in nsimsgwindow amsgwindow); void performexpand(in nsimsgwindow amsgwindow); void removefiles(); void setboolattribute(in string name, in boolean value); ...
...And 38 more matches
y - SVG: Scalable Vector Graphics
Web › SVG › Attribute › y
{ height:100% } <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. ...
..." 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. ...
... 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. ...
...And 38 more matches
HTML text fundamentals - Learn web development
div> <h2>editable code</h2> <p class="a11y-label">press esc to move focus away from the code area (tab inserts a tab character).</p> <textarea id="code" class="input" style="min-height: 100px; width: 95%">my short story i am a statistician and my name is trish. ...
...ress esc to move focus away from the code area (tab inserts a tab character).</p> <textarea id="code" class="input" style="min-height: 100px; width: 95%">my short story i am a statistician and my name is trish. ...
...-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; background: #f5f9fa; } var textarea = document.getelementbyid('code'); var reset = document.getelementbyid('reset'); var solution = document.getelementbyid('solution'); var output = document.queryselector('.output'); var code = textarea.value; var userentry = textarea.value; function updatecode() { output.innerhtml = textarea.value; } reset.addeventlistener('click', function() { textarea.value = code; userentry = textarea.value; solutionentry = htmlsolution; solution.value = 'show solution'; updatecode(); }); solution.addeventlistener('click', function() { if(solution.value === 'show solution') { textarea.value = ...
...And 37 more matches
<input type="datetime-local"> - HTML: Hypertext Markup Language
time-local, and the variations in how the inputs work, it may currently still be best to use a framework or library to present these, or to use a custom input of your own. another option is to use separate date and time inputs, each of which is more widely supported than datetime-local. some browsers may resort to a text-only input element that validates that the results are legitimate date/time values before letting them be delivered to the server, as well, but you shouldn't rely on this behavior since you can't easily predict it. for those of you not using a supporting browser, the chrome/opera datetime-local control looks like the below screenshot. clicking the down arrow on the right hand side brings up a date picker to allow you to choose a date; you have to enter the time manually. t...
...r since you can't easily predict it. for those of you not using a supporting browser, the chrome/opera datetime-local control looks like the below screenshot. clicking the down arrow on the right hand side brings up a date picker to allow you to choose a date; you have to enter the time manually. the edge datetime-local control looks like the below; clicking the date and the time parts of the value bring up two separate pickers for you, so you can easily set both the date and the time. this is somewhat like having date and time widgets both created for you and merged into one. value a domstring representing a date and time (in the local time zone), or empty. events change and input supported common attributes autocomplete, list, readonly, and step ...
...for you, so you can easily set both the date and the time. this is somewhat like having date and time widgets both created for you and merged into one. value a domstring representing a date and time (in the local time zone), or empty. events change and input supported common attributes autocomplete, list, readonly, and step idl attributes list, value, valueasnumber. methods select(), stepdown(), stepup() value a domstring representing the value of the date entered into the input. ...
...And 37 more matches
Cross-browser Flexbox mixins - CSS: Cascading Style Sheets
s-tricks visual guide to css3 flexbox: flexbox playground | note: mixins are not currently supported natively in browsers. instead, you will need to use a css pre-processor to make the most of the following. however, css pre-processors simply generate valid css, so the techniques used below can be written in pure css instead, if preferred. ...
...rrently supported natively in browsers. instead, you will need to use a css pre-processor to make the most of the following. however, css pre-processors simply generate valid css, so the techniques used below can be written in pure css instead, if preferred. flexbox containers using the display property's flex value causes an element to generate a block-level flex container box. the inline-flex value causes an element to generate an inline-level flex container box. ...
... pre-processor to make the most of the following. however, css pre-processors simply generate valid css, so the techniques used below can be written in pure css instead, if preferred. flexbox containers using the display property's flex value causes an element to generate a block-level flex container box. the inline-flex value causes an element to generate an inline-level flex container box. ...
...And 36 more matches
Textbox (XPFE autocomplete) - Archive of obsolete content
attributes | properties | methods | related ] this element is created by setting the type attribute of a textbox to autocomplete. it is used to create a textbox with a popup containing a list of possible completions for what the user has started to type. the autocomplete functionality is handled through one of more session objects, each of which can return a set of results given the current value of the textbox. the sessions can be set using the searchsessions attribute or by calling the addsession method. attributes accesskey, alwaysopenpopup, autocompletesearch, autocompletesearchparam, autofill, autofillaftermatch, autofill, completedefaultindex, crop, disableautocomplete, disableautocomplete, disabled, disablehistory, enablehistory, focused, forcecomplete, forcecomplete...
...hilesearching, ignoreblurwhilesearching, inputtooltiptext, label, maxlength, maxrows, minresultsforpopup, minresultsforpopup, nomatch, onchange, onerrorcommand, oninput, onsearchcomplete, ontextcommand, ontextentered, ontextrevert, ontextreverted, open, readonly, searchsessions, 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, maxlength, maxrows, minresultsforpopup, nomatch, open, popup, popupopen, resultspopup, searchcount, searchparam, searchsessions, s...
...bleautocomplete, disabled, editable, focused, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, inputfield, issearching, iswaiting, label, maxlength, maxrows, minresultsforpopup, nomatch, open, popup, popupopen, resultspopup, searchcount, searchparam, searchsessions, selectionend, selectionstart, sessioncount, showcommentcolumn, showpopup, size, tabindex, tabscrolling, textlength, textvalue, timeout, type, useraction, value methods addsession, clearresults, getdefaultsession, getresultat, getresultcount, getresultvalueat, getsession, getsessionbyname, getsessionresultat, getsessionstatusat, getsessionvalueat, removesession, select, setselectionrange, syncsessions examples (example needed) attributes accesskey type: character this should be set to a charact...
...And 34 more matches
A re-introduction to JavaScript (JS tutorial) - JavaScript
object-oriented programming with object prototypes, instead of classes (see more about prototypical inheritance and es2015 classes). javascript also supports functional programming — because they are objects, functions may be stored in variables and passed around like any other object. let's start off by looking at the building blocks of any language: the types. javascript programs manipulate values, and those values all belong to a type. javascript's types are: number string boolean function object symbol (new in es2015) ... oh, and undefined and null, which are ... slightly odd. and array, which is a special kind of object. and date and regexp, which are objects that you get for free. and to be technically accurate, functions are just a special type of object. so the type diagra...
... diagram looks more like this: number string boolean symbol (new in es2015) object function array date regexp null undefined and there are some built-in error types as well. things are a lot easier if we stick with the first diagram, however, so we'll discuss the types listed there for now. ...
...this can be important for bit-wise operations. the standard arithmetic operators are supported, including addition, subtraction, modulus (or remainder) arithmetic, and so forth. ...
...And 34 more matches
Details of the object model - JavaScript
this chapter attempts to clarify the situation. this chapter assumes that you are already somewhat familiar with javascript and that you have used javascript functions to create simple objects. class-based vs. ...
...run time. in addition, any object can be associated as the prototype for another object, allowing the second object to share the first object's properties. defining a class in class-based languages, you define a class in a separate class definition. in that definition you can specify special methods, called constructors, to create instances of the class. a constructor method can specify initial values for the instance's properties and perform other processing appropriate at creation time. you use the new operator in association with the constructor method to create class instances. javascript follows a similar model, but does not have a class definition separate from the constructor. instead, you define a constructor function to create objects with a particular initial set of properties and ...
...s for the instance's properties and perform other processing appropriate at creation time. you use the new operator in association with the constructor method to create class instances. javascript follows a similar model, but does not have a class definition separate from the constructor. instead, you define a constructor function to create objects with a particular initial set of properties and values. any javascript function can be used as a constructor. you use the new operator with a constructor function to create a new object. note that ecmascript 2015 introduces a class declaration: javascript classes, introduced in ecmascript 2015, are primarily syntactical sugar over javascript's existing prototype-based inheritance. the class syntax does not introduce a new object-oriented inherit...
...And 34 more matches
Index
* set "this update" or "next update" crl fields: update=yyyymmddhhmmssz nextupdate=yyyymmddhhmmssz field "next update" is optional. time should be in generalizedtime format (yyyymmddhhmmssz). ...
...string value of a name of known extensions. critical/non-critical: is 1 when extension is critical and 0 otherwise. arg1, arg2: specific to extension type extension parameters addext uses the range that was set earlier by addcert and will install an extension to every cert entries within the range. * add certificate entries(s) to crl: addcert range date range: two integer values separated by dash: range of certificates that will be added by this command. dash is used as a delimiter. only one cert will be added if there is no delimiter. date: revocation date of a cert. date should be represented in generalizedtime format (yyyymmddhhmmssz). ...
...e range: two integer values separated by dash: range of certificates that will be added by this command. dash is used as a delimiter. only one cert will be added if there is no delimiter. date: revocation date of a cert. date should be represented in generalizedtime format (yyyymmddhhmmssz). * remove certificate entry(s) from crl rmcert range where: range: two integer values separated by dash: range of certificates that will be added by this command. dash is used as a delimiter. only one cert will be added if there is no delimiter. * change range of certificate entry(s) in crl range new-range where: new-range: two integer values separated by dash: range of certificates that will be added by this command. dash is used as a delimiter. only one...
...And 33 more matches
<input type="time"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › time
e https://github.com/mdn/interactive-examples and send us a pull request. appearance chrome and opera in chrome/opera the time control is simple, with slots to enter hours and minutes in 12 or 24-hour format depending on operating system locale, and up and down arrows to increment and decrement the currently selected component. in some versions, an "x" button is provided to clear the control's value. 12-hour 24-hour chrome 83 in chrome 83, the ui controls have been updated with a new look and feel. the new element is functionally identical to the old one, but has a similar ui to edge. 24-hour firefox firefox's time control is very similar to chrome's, except that it doesn't have the up and down arrows. it also uses a 12- or 24-hour format for inputting times, based on system local...
...ui controls have been updated with a new look and feel. the new element is functionally identical to the old one, but has a similar ui to edge. 24-hour firefox firefox's time control is very similar to chrome's, except that it doesn't have the up and down arrows. it also uses a 12- or 24-hour format for inputting times, based on system locale. an "x" button is provided to clear the control's value. 12-hour 24-hour edge the edge time control is somewhat more elaborate, opening up an hour and minute picker with sliding reels. it, like chrome, uses a 12- or 24-hour format for inputting times, based on system locale: 12-hour 24-hour value a domstring representing a time, or empty. events change and input supported common attributes autocomplete, l...
...is somewhat more elaborate, opening up an hour and minute picker with sliding reels. it, like chrome, uses a 12- or 24-hour format for inputting times, based on system locale: 12-hour 24-hour value a domstring representing a time, or empty. events change and input supported common attributes autocomplete, list, readonly, and step idl attributes value, valueasdate, valueasnumber, and list. methods select(), stepdown(), and stepup(). value a domstring containing the value of the time entered into the input. ...
...And 33 more matches
<input type="url"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › url
<input> elements of type url are used to let the user enter and edit a url. the source for this interactive example is stored in a github repository. if 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 input value is automatically validated to ensure that it's either empty or a properly-formatted url before the form can be submitted. ...
...e to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the input value is automatically validated to ensure that it's either empty or a properly-formatted url before the form can be submitted. the :valid and :invalid css pseudo-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. ...
...utomatically validated to ensure that it's either empty or a properly-formatted url before the form can be submitted. the :valid and :invalid css pseudo-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. ...
...And 33 more matches
How to build custom form controls - Learn web development
state when: the user clicks on it or touches it on a touch screen. the user hits the tab key and it gains focus. the control was in its open state and the user clicks on it. the control is in its open state when: the control is in any other state than open and the user clicks on it. once we know how to change states, it is important to define how to change the control's value: the value changes when: the user clicks on an option when the control is in the open state. the user hits the up or down arrow keys when the control is in its active state. the value does not change when: the user hits the up arrow key when the first option is selected. the user hits the down arrow key when the last option is selected. finally, let's define how the ...
...hits the up or down arrow keys while the control is in the open state? this one is a little bit trickier. if you consider that the active state and the open state are completely different, the answer is again "nothing will happen" because we did not define any keyboard interactions for the opened state. on the other hand, if you consider that the active state and the open state overlap a bit, the value may change but the option will definitely not be highlighted accordingly, once again because we did not define any keyboard interactions over options when the control is in its opened state (we have only defined what should happen when the control is opened, but nothing after that). we have to think a little further: what about the escape key? pressing esc key closes an open select. remember, if...
...ne its html structure and to give it some basic semantics. here is what we need to rebuild a <select> element: <!-- this is our main container for our control. the tabindex attribute is what allows the user to focus the control. we'll see later that it's better to set it through javascript. ...
...And 32 more matches
nsIPromptService
uld be the access key for that button. if you need to include an ampersand in the button's text, use two of them, like this: "&&". note: some of these interface methods use out and inout parameters. in c++, out parameters are pointers. for javascript, they are extra work, as you can't use an out parameter directly. you need to wrap them in a temporary object, which can be either empty or have a value property set to the out parameter type. for more information on out parameters and javascript refer to working with out parameters. implemented by: @mozilla.org/embedcomp/prompt-service;1. to get an instance, use: var promptservice = components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getservice(components.interfaces.nsipromptservice); method overview ...
...ring acheckmsg, inout boolean acheckstate); print32 confirmex(in nsidomwindow aparent,in wstring adialogtitle,in wstring atext, in unsigned long abuttonflags,in wstring abutton0title, in wstring abutton1title,in wstring abutton2title,in wstring acheckmsg, inout boolean acheckstate); boolean prompt(in nsidomwindow aparent, in wstring adialogtitle, in wstring atext, inout wstring avalue, in wstring acheckmsg, inout boolean acheckstate); boolean promptusernameandpassword(in nsidomwindow aparent, in wstring adialogtitle, in wstring atext, inout wstring ausername, inout wstring apassword, in wstring acheckmsg, inout boolean acheckstate); boolean promptpassword(in nsidomwindow aparent, in wstring adialogtitle, in wstring atext, inout wstring apassword, in wstring a...
...o confirmex. all flags are defined as unsigned long constants and can be accessed as components.interfaces.nsipromptservice.flagname from javascript and as nsipromptservice::flagname from c++. button position flags on linux and mac, button 2 is on the left of the prompt, while buttons 1 and 0 are on the right. on windows and os/2, the buttons are centred in the order 0, 2, 1. constant value description button_pos_0 1 this is usually the button used to confirm the prompt. it typically has the label "ok", "yes", or "save". button_pos_1 256 this is the button used to cancel the prompt. it typically has the label "cancel" or "no". it is equivalent to pressing the escape key (or cmd+. on the mac), or closing the window through the os controls. bu...
...And 32 more matches
SVG Presentation Attributes - SVG: Scalable Vector Graphics
olor stop-opacity stroke stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering transform unicode-bidi vector-effect visibility word-spacing writing-mode attributes alignment-baseline it specifies how an object is aligned along the font baseline with respect to its parent. ...
...-baseline it specifies how an object is aligned 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. ...
... 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 its target. ...
...And 32 more matches
nsIWindowsRegKey
seamonkey 1.0) the interface represents a single key in the registry. this interface is highly win32 specific. ...
... registry. this interface is highly win32 specific. ...
... long rootkey, in astring relpath, in unsigned long mode); nsiwindowsregkey createchild(in astring relpath, in unsigned long mode); astring getchildname(in unsigned long index); astring getvaluename(in unsigned long index); unsigned long getvaluetype(in astring name); boolean haschanged(); boolean haschild(in astring name); boolean hasvalue(in astring name); boolean iswatching(); void open(in unsigned long rootkey, in astring relpath, in unsigned long mode); nsiwindowsregkey openchild(in astring relpath, in unsigned long mode); acstring readbinaryvalue(in astring name); unsigned long long readint64value(in astring name); unsigned long readintvalue(in astring name); astri...
...And 31 more matches
HTML documentation index - HTML: Hypertext Markup Language
Web › HTML › Index
5 dash adaptive streaming for html 5 video guide, html, html5 dynamic adaptive streaming over http (dash) is an adaptive streaming protocol. 6 date and time formats used in html date, element, format, html, iso 8601, input, reference, string, time, week, datetime, datetime-local, del, ins, month, month-year, week-year certain html elements use date and/or time values. the formats of the strings that specify these values are described in this article. 7 global attributes attribute, html, reference, web global attributes are attributes common to all html elements; they can be used on all elements, though they may have no effect on some elements. 8 accesskey global attributes, html, reference, accesskey the accesskey gl...
...l attributes attribute, html, reference, web global attributes are attributes common to all html elements; they can be used on all elements, though they may have no effect on some elements. 8 accesskey global attributes, html, reference, accesskey the accesskey global attribute provides a hint for generating a keyboard shortcut for the current element. the attribute value must consist of a single printable character (which includes accented and other characters that can be generated by the keyboard). 9 autocapitalize autocapitalize, global attributes, html, reference the autocapitalize global attribute is an enumerated attribute that controls whether and how text input is automatically capitalized as it is entered/edited by the user. 10...
... enumerated attribute that indicates whether the element can be dragged, either with native browser behavior or the html drag and drop api. 16 dropzone deprecated, global attributes, html, reference the dropzone global attribute is an enumerated attribute indicating what types of content can be dropped on an element, using the html drag and drop api. it can have the following values: 17 hidden global attributes, html, reference the hidden global attribute is a boolean attribute indicating that the element is not yet, or is no longer, relevant. for example, it can be used to hide elements of the page that can't be used until the login process has been completed. 18 id global attributes, html, reference, web, id the id global attribut...
...And 31 more matches
Preferences - Archive of obsolete content
setboolpref(), getcharpref(), setcharpref(), getintpref(), and setintpref(). using them is as easy as: // get the "accessibility." branch var prefs = components.classes["@mozilla.org/preferences-service;1"] .getservice(components.interfaces.nsiprefservice).getbranch("accessibility."); // prefs is an nsiprefbranch. // look in the above section for examples of getting one. var value = prefs.getboolpref("typeaheadfind"); // get a pref (accessibility.typeaheadfind) prefs.setboolpref("typeaheadfind", !value); // set a pref (accessibility.typeaheadfind) complex types as noted in the previous section, each entry in the preferences database (prefs.js) must have a string, an integer, or a boolean value. however, there is a concept of complex types, which makes it easier for devel...
...aheadfind) complex types as noted in the previous section, each entry in the preferences database (prefs.js) must have a string, an integer, or a boolean value. however, there is a concept of complex types, which makes it easier for developers to save and load nsilocalfile and nsisupportsstring objects in preferences (as strings — note that from the preferences system's point of view, complex values have a nsiprefbranch.pref_string type.) there are two nsiprefbranch methods implementing the concept — setcomplexvalue() and getcomplexvalue(). you can look up their implementations in nsprefbranch.cpp. ...
...oad nsilocalfile and nsisupportsstring objects in preferences (as strings — note that from the preferences system's point of view, complex values have a nsiprefbranch.pref_string type.) there are two nsiprefbranch methods implementing the concept — setcomplexvalue() and getcomplexvalue(). you can look up their implementations in nsprefbranch.cpp. ...
...And 30 more matches
Client-side form validation - Learn web development
ata 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. minlength and maxlength: specifies the minimum and maximum length of textual data (strings) min and max: specifies the minimum and maximum values of numerical input types type: specifies whether the data needs to be a number, an email address, or some other specific preset type. pattern: specifies a regular expression that defines a pattern the entered data needs to follow. if the data entered in a form field follows all of the rules specified by the above attributes, it is considered valid. if not, it is considered invalid. when an...
...out-of-range) depending on the error, which lets you apply a specific style to invalid elements. if the user tries to send the data, the browser will block the form and display an error message. note: there are several errors that will prevent the form from being submitted, including a badinput, patternmismatch, rangeoverflow or rangeunderflow, stepmismatch, toolong or tooshort, typemismatch, valuemissing, or a customerror. built-in form validation examples in this section, we'll test out some of the attributes that we discussed above. simple start file let's start with a simple example: an input that allows you to choose whether you prefer a banana or a cherry. this example involves a simple text <input> with an associated <label> and a submit <button>. find the source code on github ...
...olid black; } this css causes the input to have a red dashed border when it is invalid and a more subtle solid black border when valid. we also added a background gradient when the input is required and invalid. try out the new behavior in the example below: note: you can find this example live on github as fruit-validation.html (see also the source code.) try submitting the form without a value. note how the invalid input gets focus, a default error message ("please fill out this field") appears, and the form is prevented from being sent. the presence of the required attribute on any element that supports this attribute means the element matches the :required pseudoclass whether it has a value or not. if the <input> has no value, the input will match the :invalid pseudoclass. note: f...
...And 30 more matches
Accessing the Windows Registry Using XPCOM
to read this section. a simple example here's a simple example showing how to read your windows productid: var wrk = components.classes["@mozilla.org/windows-registry-key;1"] .createinstance(components.interfaces.nsiwindowsregkey); wrk.open(wrk.root_key_local_machine, "software\\microsoft\\windows\\currentversion", wrk.access_read); var id = wrk.readstringvalue("productid"); wrk.close(); this example, while simple, shows several important things about using the interface. first, you must use createinstance() to get an object implementing this interface, not getservice(). second, you must call open() on the key before attempting to read a value. notice in the open() call that the root key to use is specified using the named constants available on the ...
...e, which corresponds to hkey_local_machine in the windows registry. also notice that the path to the key has backslashes escaped, a necessity in javascript and c++ string constants. the desired access rights are specified using a named constant from the interface, in this example access_read. this can be very important when dealing with non-administrator accounts with restricted privileges. the value is read using readstringvalue(). you have to specify what type of data you expect to read, which we will expand on later. finally, note that you should close the key when you are done to avoid wasting system resources. opening registry keys before doing anything with a registry key you must first open the key you are interested in. the example above demonstates this using the open() method. if ...
...h to the key. as noted in the example above, you will need to escape backslashes within the string. the third parameter for open() and create() is the access mode. it is specified as a bitwise combination of flags defined on the interface. you can read the interface documentation for a full explanation, but we will show only the three most commonly used modes here: access_read — for reading values, enumerating keys, and receiving notifications access_write — for setting values and creating sub keys access_all — access for all operations in addition to open() and create(), there are the openchild() and createchild() methods. you can call these methods on an already-opened registry key to open a child key. both methods take a relative path and access mode as parameters and return a ...
...And 30 more matches
nsITextInputProcessor
repeat: false, ...
... repeat: false, // optional. }); // the other attributes are always ignored. ...
...d sharemodifierstateof(in nsitextinputprocessor aother); boolean startcomposition([optional] in nsidomkeyevent adomkeyevent, [optional] in unsigned long akeyflags); attributes attribute type description hascomposition boolean whether the instance has composition or not. true if it has composition. read only. constants constant value description attr_raw_clause 0x02 a clause attribute. this means that the clause is not converted, i.e., raw text of user input. attr_raw_selected_clause 0x03 a clause attribute but this is typically not used. this means that the clause is not converted but selected to convert or modify. attr_converted_clause 0x04 a clause attribute. this means t...
...And 30 more matches
display - CSS: Cascading Style Sheets
Web › CSS › display
the display css property sets whether an element is treated as a block or inline element and the layout used for its children, such as flow layout, grid or flex. formally, the display property sets an element's inner and outer display types. the outer type sets an element's participation in flow layout; the inner type sets the layout of children. ...
...ut; the inner type sets the layout of children. some values of display are fully defined in their own individual specifications; for example the detail of what happens when display: flex is declared is defined in the css flexible box model specification. see the table at the end of this document for all of the individual specifications. syntax the css display property is specified using keyword values. keyword values are grouped into six value categories: .container { display: [ <display-outside> || <display-inside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy> ; } outside <display-outside> these keywords specify the element’s outer display type, which is essentially its role in flow layout. ...
... inline the element generates one or more inline element boxes that do not generate line breaks before or after themselves. ...
...And 30 more matches
Building accessible custom components in XUL - Archive of obsolete content
t to contain the other elements and position them in rows and columns. description elements for each row and column header. label elements for each cell in the spreadsheet. the xul markup is straightforward. we define the grid, then define the headers for each row (numbered 1 through 7), then define the column header and cells for each column. the label for each header and cell is defined in the value attribute. the flex attributes are simply for layout. note: the row and column headers are denoted by description elements, and individual cells are denoted by label elements. this is not an accessibility requirement; as we'll see in the next section, the actual xul elements are irrelevant because we will define the role of each element in a separate attribute. <code> <grid class="spreadsheet" id...
...ption elements, and individual cells are denoted by label elements. this is not an accessibility requirement; as we'll see in the next section, the actual xul elements are irrelevant because we will define the role of each element in a separate attribute. ...
...are denoted by label elements. this is not an accessibility requirement; as we'll see in the next section, the actual xul elements are irrelevant because we will define the role of each element in a separate attribute. ...
...And 29 more matches
textbox (Toolkit autocomplete) - Archive of obsolete content
eteselectedindex,crop, disableautocomplete, disabled, disablekeynavigation, enablehistory, focused, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, inputtooltiptext, label, maxlength, maxrows, minresultsforpopup, nomatch, onchange, 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, maxlength, maxrows, minresultsforpopup, open, popup, popupopen, searchcount, searchparam, selectionend, selectionstart, showcommentcolumn, showimagecolumn,size, tabindex...
...this should be one of the characters that appears in the label attribute for the elemen...
...this should be one of the characters that appears in the label attribute for the element. ...
...And 29 more matches
textbox - Archive of obsolete content
the multiline attribute can be specified to display a field with multiple rows. more information is available in the xul tutorial. ...
... in the xul tutorial. ...
... decimalplaces type: integer the number of decimal...
...And 29 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
gation, webmechanics safari is a web browser developed by apple and bundled with both macos and ios. it's based on the open source webkit engine. 20 application context codingscripting, glossary an application context is a top-level browsing context that has a manifest applied to it. 21 argument codingscripting, glossary, javascript an argument is a value (primitive or object) passed as input to a function. 22 arpanet glossary, infrastructure the arpanet (advanced research projects agency network) was an early computer network, constructed in 1969 as a robust medium to transmit sensitive military data and to connect leading research groups throughout the united states. arpanet first ran ncp (network control protocol) and subse...
...protocol) and subsequently the first version of the internet protocol or tcp/ip suite, making arpanet a prominent part of the nascent internet. arpanet was closed in early 1990. 23 array array, codingscripting, glossary, javascript, programming an array is an ordered collection of data (either primitive or object depending upon the language). arrays are used to store multiple values in a single variable. this is compared to a variable that can store only one value. 24 asynchronous glossary, web, webmechanics, asynchronous the term asynchronous refers to or multiple related things happening without waiting for the previous one to complete). 25 attribute codingscripting, glossary, html an attribute extends an element, changing its beh...
...ssary, security a block cipher mode of operation, usually just called a "mode" in context, specifies how a block cipher should be used to encrypt or decrypt messages that are longer than the block size. 36 boolean boolean, codingscripting, glossary, javascript, programming languages, data types in computer science, a boolean is a logical data type that can have only the values true or false. 37 boot2gecko boot2gecko, firefox os, glossary, infrastructure, intro boot2gecko (b2g) is the engineering codename for firefox os and refers to builds that haven't yet received official firefox os branding. (firefox os was also often called boot2gecko before the project had an official name.) 38 bootstrap bootstrap, css, glossary, intro, framewo...
...And 29 more matches
filter - CSS: Cascading Style Sheets
Web › CSS › filter
ects. you can also reference an svg filter with a url to an svg filter 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. ...
...ilter-id"); /* <filter-function> values */ filter: blur(5px); filter: brightness(0.4); filter: contrast(200%); filter: drop-shadow(16px 16px 20px blue); filter: grayscale(50%); filter: hue-rotate(90deg); filter: invert(75%); filter: opacity(25%); filter: saturate(30%); filter: sepia(60%); /* multiple filters */ filter: contrast(175%) brightness(3%); /* use no filter */ filter: none; /* global values */ filter: inherit; filter: initial; filter: unset; with a function, 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 int...
... 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 specific rules. otherwise, discrete interpolation is used. functions the filter property is specified as none or one or more of...
...And 29 more matches
<input type="radio"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › radio
eractive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. they are called radio buttons because they look and operate in a similar manner to the push buttons on old-fashioned radios, such as the one shown below. ...
...interactive-examples and send us a pull request. they are called radio buttons because they look and operate in a similar manner to the push buttons on old-fashioned radios, such as the one shown below. note: checkboxes are similar to radio buttons, but with an important distinction: radio buttons are designed for selecting one value out of a set, whereas checkboxes let you turn individual values on and off. ...
...sh buttons on old-fashioned radios, such as the one shown below. note: checkboxes are similar to radio buttons, but with an important distinction: radio buttons are designed for selecting one value out of a set, whereas checkboxes let you turn individual values on and off. where multiple controls exist, radio buttons allow one to be selected out of them all, whereas checkboxes allow multiple values to be selected. value a domstring representing the value of the radio button. ...
...And 29 more matches
The "codecs" parameter in common media types - Web media technologies
ebm file containing vp8 video and/or vorbis audio. video/mp4; codecs="avc1.4d002a" an mpeg-4 file containing avc (h.264) video, main profile, level 4.2. as is the case with any mime type parameter, codecs must be changed to codecs* (note the asterisk character, *) if any of the properties of the codec use special characters which must be percent-encoded per rfc 2231, section 4: mime parameter value and encoded word extensions. you can use the javascript encodeuri() function to encode the parameter list; similarly, you can use decodeuri() to decode a previously encoded parameter list. when the codecs parameter is used, the specified list of codecs must include every codec used for the contents of the file. the list may also contain codecs not present in the file.= codec options by contai...
...format (iso bmff), so they share the same syntax. av1 the syntax of the codecs parameter for av1 is defined the av1 codec iso media file format binding specification, section 5: codecs parameter string. av01.p.llt.dd[.m[.ccc[.cp[.tc[.mc[.f]]]]]] this codec parameter string's components are described in more detail in the table below. each component is a fixed number of characters long; if the value is less than that length, it must be padded with leading zeros. av1 codec parameter string components component details p the one-digit profile number: av1 profile numbers profile number description 0 "main" profile; supports yuv 4:2:0 or monochrome bitstreams with bit depth of 8 or 10...
... where x = 2 + (ll >> 2) and y = ll & 3. see appendix a, section 3 in the av1 specification for details. t the one-character tier indicator. for the main tier (seq_tier equals 0), this character is the letter m. for the high tier (seq_tier is 1), this character is the letter h. the high tier is only available for level 4.0 and up. dd the two-digit component bit depth. this value must be one of 8, 10, or 12; which values are valid varies depending on the profile and other properties. m the one-digit monochrome flag; if this is 0, the video includes the u and v planes in addition to the y plane. otherwise, the video data is entirely in the y plane and is therefore monochromatic. see yuv in digital video concepts for details on how the yuv color system works. th...
...And 29 more matches
SVG documentation index - SVG: Scalable Vector Graphics
Web › SVG › Index
svg attribute the alignment-baseline attribute specifies how an object is aligned with respect to its parent. this property specifies which baseline of this element is to be aligned with the corresponding baseline of the parent. for example, this allows alphabetic baselines in roman text to stay aligned across font size changes. it defaults to the baseline with the same name as the computed value of the alignment-baseline property. 23 alphabetic deprecated, svg, svg attribute the alphabetic attribute defines the lower baseline of a font. it has the same syntax and semantics as the baseline descriptor within an @font-face. 24 amplitude needscompattable, svg, svg attribute the amplitude attribute controls the amplitude of the gamma function of a com...
...attributename needscompattable, svg, svg attribute the attributename attribute indicates the name of the css property or attribute of the target element that is going to be changed during an animation. 28 attributetype deprecated, needscompattable, svg, svg attribute the attributetype attribute specifies the namespace in which the target attribute and its associated values are defined. 29 azimuth filters, svg, svg attribute the azimuth attribute specifies the direction angle for the light source on the xy plane (clockwise), in degrees from the x axis. 30 basefrequency filters, svg, svg attribute the basefrequency attribute represents the base frequency parameter for the noise function of the <feturbulence> filter primitive...
...animation should begin or when an element should be discarded. 35 bias filters, needsexample, svg, svg attribute the bias attribute shifts the range of the filter. after applying the kernelmatrix of the <feconvolvematrix> element to the input image to yield a number and applied the divisor attribute, the bias attribute is added to each component. this allows representation of values that would otherwise be clamped to 0 or 1. 36 by svg, svg attribute the by attribute specifies a relative offset value for an attribute that will be modified during an animation. 37 calcmode needscompattable, needsexample, svg, svg attribute the calcmode attribute specifies the interpolation mode for the animation. 38 cap-height deprecated...
...And 29 more matches
LiveConnect Overview - Archive of obsolete content
ped java array, accessed from within javascript code. javaclass a javascript reference to a java class. javaobject a wrapped java object, accessed from within javascript code. javapackage a javascript reference to a java package. note: because java is a strongly typed language and javascript is weakly typed, the javascript runtime engine converts argument values into the appropriate data types for the other language when you use liveconnect. see data type conversion for complete information. in some ways, the existence of the liveconnect objects is transparent, because you interact with java in a fairly intuitive way. for example, you can create a java string object and assign it to the javascript variable mystring by using the new operator with the jav...
...n 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. to create an instance of the helloworld class in redwood, you access the constructor of the class as follows: var re...
...nstance(java.lang.string, 5); arguments of type char in javascript 1.4 and later, you can pass a one-character string to a java method which requires an argument of type char. for example, you can pass the string "h" to the character constructor as follows: var c = new java.lang.character("h"); in javascript 1.3 and earlier, you must pass such methods an integer which corresponds to the unicode value of the character. for example, the following code also assigns the value "h" to the variable c: var c = new java.lang.character(72); handling java exceptions in javascript when java code fails at run time, it throws an exception. if your javascript code accesses a java data member or method and fails, the java exception is passed on to javascript for you to handle. beginning with javascript 1.4,...
...And 28 more matches
TypeScript support in Svelte - Learn web development
like traget instead of target) typescript will complain: in the app.svelte component, the setuptypescript.js script has added the lang="ts" attribute to the <script> tag. moreover, thanks to type inference, in many cases we won't even need to specify types to get code assistance. for example, if you start adding an ms property to the alert component call, typescript will infer from the default value that the ms property should be a number: and if you pass something that is not a number it will complain about it: the application template has a validate script configured that runs svelte-check against your code. this package allows you to detect errors and warnings normally displayed by a code editor from the command line, which makes it pretty useful for running it in a continuous integ...
...corresponding types, like so: export let ms = 3000 let visible: boolean let timeout: number const onmessagechange = (message: string, ms: number) => { cleartimeout(timeout) if (!message) { // hide alert if message is empty note: there's no need to specify the ms type with export let ms:number = 3000 because typescript is already inferring it from its default value. moreactions.svelte now we'll do the same for the moreactions.svelte component. add the lang='ts' attribute, 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...
...dtodos: 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. add the lang='ts' attribute to the <script> tag, as usual. you'll notice there are no warnings — typescript infers the type of the filter variable from the default value. but we know that there are only three valid values for the filter: all, active, and completed. so we can let typescript know about them by creating an enum filter. create a filter.enum.ts file in the types folder. give it the following contents: export enum filter { all = 'all', active = 'active', completed = 'completed', } now we will use this from the filterbutton co...
...And 28 more matches
JSAPI reference
ception js_clearpendingexception js_throwstopiteration added in spidermonkey 1.8 js_isstopiteration added in spidermonkey 31 typedef jsexceptionstate js_saveexceptionstate js_restoreexceptionstate js_dropexceptionstate these functions translate errors into exceptions and vice versa: js_reportpendingexception js_errorfromexception js_throwreportederror obsolete since jsapi 29 values and types typedef jsval js::value js::value constructors: js::nullvalue added in spidermonkey 24 js::undefinedvalue added in spidermonkey 24 js::booleanvalue added in spidermonkey 24 js::truevalue added in spidermonkey 24 js::falsevalue added in spidermonkey 24 js::numbervalue added in spidermonkey 24 js::int32value added in spidermonkey 24 js::doublevalue added in spidermonkey...
...ypedef jsval js::value js::value constructors: js::nullvalue added in spidermonkey 24 js::undefinedvalue added in spidermonkey 24 js::booleanvalue added in spidermonkey 24 js::truevalue added in spidermonkey 24 js::falsevalue added in spidermonkey 24 js::numbervalue added in spidermonkey 24 js::int32value added in spidermonkey 24 js::doublevalue added in spidermonkey 24 js::float32value added in spidermonkey 24 js::stringvalue added in spidermonkey 24 js::objectvalue added in spidermonkey 24 js::objectornullvalue added in spidermonkey 24 js::symbolvalue added in spidermonkey 38 js::value constants: js::nullhandlevalue added in spidermonkey 24 js::undefinedhandlevalue added in spidermonkey 24 js::truehandlevalue added in spidermonkey 38 js::falsehandlevalue added in s...
...ndlevalue added in spidermonkey 38 js::falsehandlevalue added in spidermonkey 38 jsval constants: jsval_null obsolete since jsapi 42 jsval_void obsolete since jsapi 42 jsval_true obsolete since jsapi 42 jsval_false obsolete since jsapi 42 jsval_zero obsolete since jsapi 42 jsval_one obsolete since jsapi 42 function and macros for checking the type of a jsval: enum jstype js_typeofvalue all of the following are deprecated. see js::value for their modern replacements. jsval_is_null obsolete since jsapi 32 jsval_is_void obsolete since jsapi 32 jsval_is_boolean obsolete since jsapi 32 jsval_is_number obsolete since jsapi 32 jsval_is_int obsolete since jsapi 32 jsval_is_double obsolete since jsapi 32 jsval_is_string obsolete since jsapi 32 jsval_is_object obsolete since ...
...And 28 more matches
nsIHTMLEditor
editor/idl/nsihtmleditor.idlscriptable please add a summary to this article. ...
...sidomnode anode); astring getfontcolorstate(out boolean amixed); astring getfontfacestate(out boolean amixed); astring getheadcontentsashtml(); astring gethighlightcolorstate(out boolean amixed); void getindentstate(out boolean acanindent, out boolean acanoutdent); void getinlineproperty(in nsiatom aproperty, in astring aattribute, in astring avalue, out boolean afirst, out boolean aany, out boolean aall); astring getinlinepropertywithattrvalue(in nsiatom aproperty, in astring aattribute, in astring avalue, out boolean afirst, out boolean aany, out boolean aall); nsisupportsarray getlinkedobjects(); void getlistitemstate(out boolean amixed, out boolean ali, out boolean adt, out boolean add); void getlistst...
... boolean entirelist, in astring abullettype); boolean nodeisblock(in nsidomnode node); void pastenoformatting(in long aselectiontype); void rebuilddocumentfromsource(in astring asourcestring); void removealldefaultproperties(); void removeallinlineproperties(); void removedefaultproperty(in nsiatom aproperty, in astring aattribute, in astring avalue); void removeinlineproperty(in nsiatom aproperty, in astring aattribute); void removeinsertionlistener(in nsicontentfilter infilter); void removelist(in astring alisttype); void replaceheadcontentswithhtml(in astring asourcetoinsert); void selectelement(in nsidomelement aelement); void setbackgroundcolor(in astring acolor); void setbo...
...And 28 more matches
Component; nsIPrefBranch
/libpref/public/nsiprefbranch.idlscriptable this interface is used to manipulate the preferences data. this object may be obtained from the preferences service (nsiprefservice) and used to get and set default and/or user preferences across the application. inherits from: nsisupports last changed in gecko 58 (firefox 58 / thunderbird 58 / seamonkey 2.55) this object is created with a "root" value which describes the base point in the preferences "tree" from which this "branch" stems. preferences are accessed off of this root by using just the final portion of the preference. for example, if this object is created with the root "browser.startup.", the preferences "browser.startup.page", "browser.startup.homepage", and "browser.startup.homepage_override" can be accessed by simply passing "p...
...mply passing "page", "homepage", or "homepage_override" to the various get/set methods. ...
...w void addobserver(in string adomain, in nsiobserver aobserver, in boolean aholdweak); void clearuserpref(in string aprefname); void deletebranch(in string astartingat); boolean getboolpref(in string aprefname, requires gecko 54 [optional] in boolean adefaultvalue); string getcharpref(in string aprefname,requires gecko 54 [optional] in string adefaultvalue); requires gecko 58 utf8tring getstringpref(in string aprefname, [optional] in utf8string adefaultvalue); void getchildlist(in string astartingat, [optional] out unsigned long acount, [array, size_is(acount), retval] out string achildarray); void getcomplexvalue(in string aprefname, in nsiidref atype, [iid_is(atype), retval] out nsqiresult avalue); long getintp...
...And 28 more matches
Working with Svelte stores - Learn web development
cript frameworks next in the last article we completed the development of our app, finished organizing it into components, and discussed some advanced techniques for dealing with reactivity, working with dom nodes, and exposing component functionality. in this article we will show another way to handle state management in svelte — stores. stores are global global data repositories that hold values. components can subscribe to stores and receive notifications when their values change. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. you'll need a terminal with node + npm installed to compile and build your app. objective: learn how to ...
...r components to relay data between each other. in that case, moving to a global data store might be a good option. if you’ve already worked with redux or vuex, then you'll be familiar with how this kind of store works. svelte stores offer similar features for state management. a store is simply an object with a subscribe() method that allows interested parties to be notified whenever the store value changes, and an optional set() method that allows you to set new values for the store. this minimal api is known as the store contract. svelte provides functions for creating readable, writable, and derived stores in the svelte/store module. svelte also provides a very intuitive way to integrate stores into its reactivity system using the reactive $store syntax. if you create your own stores ho...
... give it the following content: import { writable } from 'svelte/store' export const alert = writable('welcome to the to-do list app!') note: stores can be defined and used outside of svelte components, so you can organize them in any way you please. in the above code we import the writable() function from svelte/store and use it to create a new store called alert with an initial value of "welcome to the to-do list app!". we then export the store. creating the actual component let's now create our alert component and see how we can read values from the store. create another new file named src/components/alert.svelte. give it the following content: <script> import { alert } from '../stores.js' import { ondestroy } from 'svelte' let alertcontent = '' co...
...And 27 more matches
Advanced techniques: Creating and sequencing audio - Web APIs
ves, and envelopes for what we will call the "sweep" sound, that first noise you hear when you dial up, we're going to create an oscillator to generate the sound. the oscillatornode comes with basic waveforms out of the box — sine, square, triangle or sawtooth. ...
...re, triangle or sawtooth. however, instead of using the standard waves that come by default, we're going to create our own using the periodicwave interface and values set in a wavetable. we can use the baseaudiocontext.createperiodicwave method to use this custom wave with an oscillator. the periodic wave first of all, we'll create our periodic wave. to do so, we need to pass real and imaginary values into the baseaudiocontext.createperiodicwave() method.: let wave = audioctx.createperiodicwave(wavetable.real, wavetable.imag); note: in our example the wavetable is held in a separate javascript file (wavetable.js), because there are so many values. it is taken from a repository of wavetables, which can be found in the web audio api examples from google chrome labs. the oscillator now we...
...avascript file (wavetable.js), because there are so many values. it is taken from a repository of wavetables, which can be found in the web audio api examples from google chrome labs. the oscillator now we can create an oscillatornode and set its wave to the one we've created: function playsweep() { let osc = audioctx.createoscillator(); osc.setperiodicwave(wave); osc.frequency.value = 440; osc.connect(audioctx.destination); osc.start(); osc.stop(audioctx.currenttime + 1); } controlling amplitude this is great, but wouldn't it be nice if we had an amplitude envelope to go with it? let's create a simple one so we get used to the methods we need to create an envelope with the web audio api. let's say our envelope has attack and release. we can allow the user t...
...And 27 more matches
<input type="email"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › email
<input> elements of type email are used to let the user enter and edit an e-mail address, or, if the multiple attribute is specified, a list of e-mail addresses. the source for this interactive example is stored in a github repository. if 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 input value is automatically validated to ensure that it's either empty or a properly-formatted e-mail address (or list of addresses) before the form can be submitted. the :valid and :invalid css pseudo-classes are automatically 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...
... empty or a properly-formatted e-mail address (or list of addresses) before the form can be submitted. the :valid and :invalid css pseudo-classes are automatically 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. ...
...ers 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, maxlength, minlength, 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 ("") indicating that the user did not enter a value or that the value was removed. a single properly-formed e-mail address. thi...
...And 27 more matches
Expressions and operators - JavaScript
l ternary operator, the conditional operator. a binary operator requires two operands, one before the operator and one after the operator: operand1 operator operand2 for example, 3+4 or x*y. a unary operator requires a single operand, either before or after the operator: operator operand or operand operator for example, x++ or ++x. assignment operators an assignment operator assigns a value to its left operand based on the value of its right operand. the simple assignment operator is equal (=), which assigns the value of its right operand to its left operand. that is, x = y assigns the value of y to x. there are also compound assignment operators that are shorthand for the operations listed in the following table: compound assignment operators name shorthand operator ...
...ift assignment x >>>= y x = x >>> y bitwise and assignment x &= y x = x & y bitwise xor assignment x ^= y x = x ^ y bitwise or assignment x |= y x = x | y logical and assignment x &&= y x && (x = y) logical or assignment x ||= y x || (x = y) logical nullish assignment x ??= y x ?? ...
...= y x = x & y bitwise xor assignment x ^= y x = x ^ y bitwise or assignment x |= y x = x | y logical and assignment x &&= y x && (x = y) logical or assignment x ||= y x || (x = y) logical nullish assignment x ??= y x ?? (x = y) return value and chaining like most expressions, assignments like x = y have a return value. it can be retrieved by e.g. assigning the expression or logging it: const z = (x = y); // or equivalently: const z = x = y; console.log(z); // log the return value of the assignment x = y. console.log(x = y); // or log the return value directly. the return value matches the expression to the right of the = sign in the “meaning” column of the table above. that means that (x = y) returns y...
...And 27 more matches
Getting started with HTML - Learn web development
answer. playable code <h2>live output</h2> <div class="output" style="min-height: 50px;"> </div> <h2>editable code</h2> <p class="a11y-label">press esc to move focus away from the code area (tab inserts a tab character).</p> <textarea id="code" class="playable-code" style="min-height: 100px;width: 95%"> this is my text. ...
...ass="output" style="min-height: 50px;"> </div> <h2>editable code</h2> <p class="a11y-label">press esc to move focus away from the code area (tab inserts a tab character).</p> <textarea id="code" class="playable-code" style="min-height: 100px;width: 95%"> this is my text. ...
...a,arial,sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; background: #f5f9fa; } var textarea = document.getelementbyid('code'); var reset = document.getelementbyid('reset'); var solution = document.getelementbyid('solution'); var output = document.queryselector('.output'); var code = textarea.value; var userentry = textarea.value; function updatecode() { output.innerhtml = textarea.value; } reset.addeventlistener('click', function() { textarea.value = code; userentry = textarea.value; solutionentry = htmlsolution; solution.value = 'show solution'; updatecode(); }); solution.addeventlistener('click', function() { if(solution.value === 'show solution') { textarea.value = ...
...And 26 more matches
IAccessibleTable
[in] long column, [out] iunknown accessible ); parameters row the 0 based row index for which to retrieve the cell. column the 0 based column index for which to retrieve the cell. accessible if both row and column index are valid then the corresponding accessible object is returned that represents the requested cell regardless of whether the cell is currently visible (on the screen). ...
...e ); parameters row the 0 based row index for which to retrieve the cell. column the 0 based column index for which to retrieve the cell. accessible if both row and column index are valid then the corresponding accessible object is returned that represents the requested cell regardless of whether the cell is currently visible (on the screen). return value e_invalidarg if bad [in] passed, [out] value is null. s_ok. caption() returns the caption for the table. the returned object could be an iaccessible or an iaccessible2. [propget] hresult caption( [out] iunknown accessible ); parameters accessible if the table has a caption then a reference to it is returned, else a null pointer is returned. return value s_false if there is nothing to return, [out] value is null. s_ok. childindex() tran...
... s_ok. childindex() translates the given row and column indexes into the corresponding cell index. [propget] hresult childindex( [in] long rowindex, [in] long columnindex, [out] long cellindex ); parameters rowindex 0 based row index for the cell. columnindex 0 based column index for the cell. cellindex returns the 0 based index of the cell at the specified row and column indexes. return value e_invalidarg if bad [in] passed, [out] value is 0. s_ok. columndescription() returns the description text of the specified column in the table. [propget] hresult columndescription( [in] long column, [out] bstr description ); parameters column the 0 based index of the column for which to retrieve the description. description returns the description text of the specified column in the table i...
...And 26 more matches
nsIMsgDBView
designates different types of view's available. available in the mozilla codebase are types "quicksearch", "threadswithunread", "watchedthreadswithunread", "xfvf" (virtual folders), "search", "group", and "threaded" each with their own implementation of nsimsgdbview that provides a different sorting/view of the data. ...
...available. available in the mozilla codebase are types "quicksearch", "threadswithunread", "watchedthreadswithunread", "xfvf" (virtual folders), "search", "group", and "threaded" each with their own implementation of nsimsgdbview that provides a different sorting/view of the data. ...
...debase are types "quicksearch", "threadswithunread", "watchedthreadswithunread", "xfvf" (virtual folders), "search", "group", and "threaded" each with their own implementation of nsimsgdbview that provides a different sorting/view of the data. ...
...And 26 more matches
<input type="tel"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › tel
the source for this interactive example is stored in a github repository. if 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 most quickly apparent of these is that mobile browsers — especially on mobile phones — may opt to present a custom keypad optimized for entering phone numbers. 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. ...
... 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, maxlength, minlength, 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 attributes that operate on all <input> elements regardless of their type, telephone number inputs support the following attributes: attri...
...And 26 more matches
nsIXPConnect
tr ajscontext, in jsobjectptr aobject); void initclasses(in jscontextptr ajscontext, in jsobjectptr aglobaljsobj); nsixpconnectjsobjectholder initclasseswithnewwrappedglobal(in jscontextptr ajscontext, in nsisupports acomobj, in nsiidref aiid, in nsiprincipal aprincipal, in nsisupports aextraptr, in pruint32 aflags); nsivariant jstovariant(in jscontextptr ctx, in jsval value); nsivariant jsvaltovariant(in jscontextptr cx, in jsvalptr ajsval); void movewrappers(in jscontextptr ajscontext, in jsobjectptr aoldscope, in jsobjectptr anewscope); [noscript,notxpcom] void notejscontext(in jscontextptr ajscontext, in nscctraversalcallbackref acb); void releasejscontext(in jscontextptr ajscontext, in prbool nogc); void removejsh...
...; void setsecuritymanagerforjscontext(in jscontextptr ajscontext, in nsixpcsecuritymanager amanager, in pruint16 flags); void syncjscontexts(); void updatexows(in jscontextptr ajscontext, in nsixpconnectwrappednative aobject, in pruint32 away); native code only! ...
... description collectgarbageonmainthreadonly prbool obsolete since gecko 1.9 currentjsstack nsistackframe read only. currentnativecallcontext nsaxpcnativecallcontextptr read only. deferreleasesuntilaftergarbagecollection prbool obsolete since gecko 1.9 pendingexception nsiexception constants constant value description init_js_standard_classes 1 << 0 flag_system_global_object 1 << 1 omit_components_object 1 << 2 xpc_xow_clearscope 1 tells updatexows() to clear the scope of all of the xows it finds. obsolete since gecko 2.0 methods native code only!addjsholder root js objects held by aholder. void addjsholder( in voidptr...
...And 25 more matches
Debugger.Object - Firefox Developer Tools
a given object. this allows the code using each debugger instance to place whatever properties it likes on its own debugger.object instances, without worrying about interfering with other debuggers. while most debugger.object instances are created by spidermonkey in the process of exposing debuggee’s behavior and state to the debugger, the debugger can use debugger.object.prototype.makedebuggeevalue to create debugger.object instances for given debuggee objects, or use debugger.object.prototype.copy and debugger.object.prototype.create to create new objects in debuggee compartments, allocated as if by particular debuggee globals. debugger.object instances protect their referents from the garbage collector; as long as the debugger.object instance is live, the referent remains live. this mean...
...thus, we use a/b to refer to theb defined withina, and a< to refer to a function that occurs somewhere within an expression that is assigned toa. for example: function h() { var i = function() {}; // display name: h/i f(function () {}); // display name: h/< } var s = f(function () {}); // display name: s< parameternames if the referent is a deb...
...ter, each of which is undefined. if the referent is a function proxy, return an empty array. if the referent uses destructuring parameters, then the array’s elements reflect the structure of the parameters. for example, if the referent is a function declared in this way: function f(a, [b, c], {d, e:f}) { ... } then this debugger.object instance’s parameternames property would have the value: ["a", ["b", "c"], {d:"d", e:"f"}] script if the referent is a function that is debuggee code, this is that function’s script, as a debugger.script instance. if the referent is a function proxy or not debuggee code, this is undefined. environment if the referent is a function that is debuggee code, a debugger.environment instance representing the lexical environment enclosing the functi...
...And 25 more matches
Applying styles and colors - Web APIs
there are two important properties we can use: fillstyle and strokestyle. fillstyle = color sets the style used when filling shapes. strokestyle = color sets the style for shapes' outlines. color is a string representing a css <color>, a gradient object, or a pattern object. we'll look at gradient and pattern objects later. by default, the stroke and fill color are set to black (css color value #000000). note: when you set the strokestyle and/or fillstyle property, the new value becomes the default for all shapes being drawn from then on. for every shape you want in a different color, you will need to reassign the fillstyle or strokestyle property. the valid strings you can enter should, according to the specification, be css <color> values. each of the following examples describe t...
...)'; ctx.fillstyle = 'rgba(255, 165, 0, 1)'; a fillstyle example in this example, we once again use two for loops to draw a grid of rectangles, each in a different color. the resulting image should look something like the screenshot. there is nothing too spectacular happening here. we use the two variables i and j to generate a unique rgb color for each square, and only modify the red and green values. the blue channel has a fixed value. by modifying the channels, you can generate all kinds of palettes. by increasing the steps, you can achieve something that looks like the color palettes photoshop uses. function draw() { var ctx = document.getelementbyid('canvas').getcontext('2d'); for (var i = 0; i < 6; i++) { for (var j = 0; j < 6; j++) { ctx.fillstyle = 'rgb(' + math.floor(2...
...anvas id="canvas" width="150" height="150"></canvas> draw(); the result looks like this: screenshotlive sample transparency in addition to drawing opaque shapes to the canvas, we can also draw semi-transparent (or translucent) shapes. this is done by either setting the globalalpha property or by assigning a semi-transparent color to the stroke and/or fill style. globalalpha = transparencyvalue applies the specified transparency value to all future shapes drawn on the canvas. the value must be between 0.0 (fully transparent) to 1.0 (fully opaque). this value is 1.0 (fully opaque) by default. the globalalpha property can be useful if you want to draw a lot of shapes on the canvas with similar transparency, but otherwise it's generally more useful to set the transparency on individual ...
...And 25 more matches
Using IndexedDB - Web APIs
we start the whole process like this: // let us open our database var request = window.indexeddb.open("mytestdatabase", 3); see that? opening a database is just like any other operation — you have to "request" it. the open request doesn't open the database or start the transaction right away. the call to the open() function returns an idbopendbrequest object with a result (success) or error value that you handle as an event. most other asynchronous functions in indexeddb do the same thing - return an idbrequest object with the result or error. the result for the open function is an instance of an idbdatabase. the second parameter to the open method is the version of the database. the version of the database determines the database schema — the object stores in the database and their st...
... and thus do not support the indexeddb.open(name, version).onupgradeneeded signature yet. for more information on how to upgrade the version of the database in older webkit/blink, see the idbdatabase reference article. structuring the database now to structure the database. indexeddb uses object stores rather than tables, and a single database can contain any number of object stores. whenever a value is stored in an object store, it is associated with a key. there are several different ways that a key can be supplied depending on whether the object store uses a key path or a key generator. the following table shows the different ways the keys are supplied: key path (keypath) key generator (autoincrement) description no no this object store can hold any kind...
...stored in an object store, it is associated with a key. there are several different ways that a key can be supplied depending on whether the object store uses a key path or a key generator. the following table shows the different ways the keys are supplied: key path (keypath) key generator (autoincrement) description no no this object store can hold any kind of value, even primitive values like numbers and strings. you must supply a separate key argument whenever you want to add a new value. yes no this object store can only hold javascript objects. the objects must have a property with the same name as the key path. no yes this object store can hold any kind of value. the key is generated for you automatically, or you can supply...
...And 25 more matches
<input type="date"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › date
the time and datetime-local input types support time and date+time input. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...t. the input ui generally varies from browser to browser; see browser compatibility for further details. in unsupported browsers, the control degrades gracefully to <input type="text">. among browsers with custom interfaces for selecting dates are chrome and opera, whose data control looks like so: the edge date control looks like: and the firefox date control looks like this: value a domstring representing a date in yyyy-mm-dd format, or empty events change and input supported common attributes autocomplete, list, readonly, and step idl attributes list, value, valueasdate, valueasnumber. methods select(), stepdown(), stepup() value a domstring representing the date entered in the input. the date is formatted accordi...
...d common attributes autocomplete, list, readonly, and step idl attributes list, value, valueasdate, valueasnumber. methods select(), stepdown(), stepup() value a domstring representing the date entered in the input. the date is formatted according to iso8601, described in format of a valid date string in date and time formats used in html. you can set a default value for the input with a date inside the value attribute, like so: <input type="date" value="2017-06-01"> the displayed date format will differ from the actual value — the displayed date is formatted based on the locale of the user's browser, but the parsed value is always formatted yyyy-mm-dd. ...
...And 25 more matches
Map - JavaScript
objects vs. ...
... objects vs. ...
... objects vs. ...
...And 25 more matches
JSAPI Cookbook
this article shows the jsapi equivalent for a tiny handful of common javascript idioms. note: the foss wiki page contains a few links to other libraries and programs that can make life easier when using spidermonkey and jsapi. basics working with values the basic, undifferentiated value type in the jsapi is js::value. ...
... this article shows the jsapi equivalent for a tiny handful of common javascript idioms. note: the foss wiki page contains a few links to other libraries and programs that can make life easier when using spidermonkey and jsapi. basics working with values the basic, undifferentiated value type in the jsapi is js::value. ...
...f common javascript idioms. note: the foss wiki page contains a few links to other libraries and programs that can make life easier when using spidermonkey and jsapi. basics working with values the basic, undifferentiated value type in the jsapi is js::value. ...
...And 24 more matches
Debugger.Object - Firefox Developer Tools
r a given object. this allows the code using each debugger instance to place whatever properties it likes on its own debugger.object instances, without worrying about interfering with other debuggers. while most debugger.object instances are created by spidermonkey in the process of exposing debuggee's behavior and state to the debugger, the debugger can use debugger.object.prototype.makedebuggeevalue to create debugger.object instances for given debuggee objects, or use debugger.object.prototype.copy and debugger.object.prototype.create to create new objects in debuggee compartments, allocated as if by particular debuggee globals. debugger.object instances protect their referents from the garbage collector; as long as the debugger.object instance is live, the referent remains live. this mean...
...thus, we use a/b to refer to the b defined within a, and a< to refer to a function that occurs somewhere within an expression that is assigned to a. for example: function h() { var i = function() {}; // display name: h/i f(function () {}); // display name: h/< } var s = f(function () {}); // display name: s< parameternames if the referent is a...
...rameter, each of which is undefined. if the referent is a function proxy, return an empty array. if the referent uses destructuring parameters, then the array's elements reflect the structure of the parameters. for example, if the referent is a function declared in this way: function f(a, [b, c], {d, e:f}) { ... } then this debugger.object instance's parameternames property would have the value: ["a", ["b", "c"], {d:"d", e:"f"}] script if the referent is a function that is debuggee code, this is that function's script, as a debugger.script instance. if the referent is a function proxy or not debuggee code, this is undefined. environment if the referent is a function that is debuggee code, a debugger.environment instance representing the lexical environment enclosing the fu...
...And 24 more matches
EventTarget.addEventListener() - Web APIs
always been optional. ideally, you should include it for the widest possible browser compatibility. wantsuntrusted a firefox (gecko)-specific parameter. if true, the listener receives synthetic events dispatched by web content (the default is false for browser chrome and true for regular web pages). this parameter is useful for code found in add-ons, as well as the browser itself. ...
... web pages). this parameter is useful for code found in add-ons, as well as the browser itself. return value undefined usage notes the event listener callback the event listener can be specified as either a callback function or an object that implements eventlistener, whose handleevent() method serves as the callback function. the callback function itself has the same parameters and return value as the handleevent() method; that is, the callback accepts a single parameter: an object based on event describing the event that has occurred, and it returns nothing. for example, an event handler callback that can be used to handle both fullscreenchange and fullscreenerror might look like this: function eventhandler(event) { if (event.type == 'fullscreenchange') { /* handle a full scree...
... because ol...
...And 24 more matches
Basic concepts of flexbox - CSS: Cascading Style Sheets
orking with flexbox you need to think in terms of two axes — the main axis and the cross axis. the main axis is defined by the flex-direction property, and the cross axis runs perpendicular to it. everything we do with flexbox refers back to these axes, so it is worth understanding how they work from the outset. the main axis the main axis is defined by flex-direction, which has four possible values: row row-reverse column column-reverse should you choose row or row-reverse, your main axis will run along the row in the inline direction. choose column or column-reverse and your main axis will run from the top of the page to the bottom — in the block direction. the cross axis the cross axis runs perpendicular to the main axis, therefore if your flex-direction (main axis) is s...
...ottom, as both languages have a horizontal writing mode. after a while, thinking about start and end rather than left and right becomes natural, and will be useful to you when dealing with other layout methods such as css grid layout which follow the same patterns. the flex container an area of a document laid out using flexbox is called a flex container. to create a flex container, we set the value of the area's container's display property to flex or inline-flex. as soon as we do this the direct children of that container become flex items. as with all properties in css, some initial values are defined, so when creating a flex container all of the contained flex items will behave in the following way. items display in a row (the flex-direction property's default is row). the items star...
...ch our flex items display. setting flex-direction: row-reverse will keep the items displaying along the row, however the start and end lines are switched. if we change flex-direction to column the main axis switches and our items now display in a column. set column-reverse and the start and end lines are again switched. the live example below has flex-direction set to row-reverse. try the other values — row, column and column-reverse — to see what happens to the content. multi-line flex containers with flex-wrap while flexbox is a one dimensional model, it is possible to cause our flex items to wrap onto multiple lines. in doing so, you should consider each line as a new flex container. any space distribution will happen across that line, without reference to the lines either side. t...
...And 24 more matches
Shorthand properties - CSS: Cascading Style Sheets
similarly, the most common font-related properties can be defined using the shorthand font, and the different margins around a box can be defined using the margin shorthand. ...
...u set the values of multiple other css properties simultaneously. using a shorthand property, you can write more concise (and often more readable) style sheets, saving time and energy. the css specification defines shorthand properties to group the definition of common properties acting on the same theme. for instance, the css background property is a shorthand property that's able to define the values of background-color, background-image, background-repeat, and background-position. similarly, the most common font-related properties can be defined using the shorthand font, and the different margins around a box can be defined using the margin shorthand. ...
...efine the values of background-color, background-image, background-repeat, and background-position. similarly, the most common font-related properties can be defined using the shorthand font, and the different margins around a box can be defined using the margin shorthand. tricky edge cases even if they are very convenient to use, there are a few edge cases to keep in mind when using them: a value which is not specified is set to its initial value. that sounds anecdotal, but it really means that it overrides previously set values. therefore: background-color: red; background: url(images/bg.gif) no-repeat left top; will not set the color of the background to red but to background-color's default, transparent, as the second rule has precedence. ...
...And 24 more matches
Grammar and types - JavaScript
javascript files, which looks something like this: #!/usr/bin/env node. this is called hashbang comment syntax, and is a special comment used to specify the path to a particular javascript engine that should execute the script. see hashbang comments for more details. declarations javascript has three kinds of variable declarations. var declares a variable, optionally initializing it to a value. let declares a block-scoped, local variable, optionally initializing it to a value. const declares a block-scoped, read-only named constant. variables you use variables as symbolic names for values in your application. the names of variables, called identifiers, conform to certain rules. a javascript identifier must start with a letter, underscore (_), or dollar sign ($). subsequent char...
...e. declaring variables you can declare a variable in two ways: with the keyword var. for example, var x = 42. this syntax can be used to declare both local and global variables, depending on the execution context. with the keyword const or let. for example, let y = 13. this syntax can be used to declare a block-scope local variable. (see variable scope below.) you can also simply assign a value to a variable for example, x = 42. this form creates an undeclared global variable. it also generates a strict javascript warning. undeclared global variables can often lead to unexpected behavior. thus, it is discouraged to use undeclared global variables. evaluating variables a variable declared using the var or let statement with no assigned value specified has the value of undefined. an at...
...script warning. undeclared global variables can often lead to unexpected behavior. thus, it is discouraged to use undeclared global variables. evaluating variables a variable declared using the var or let statement with no assigned value specified has the value of undefined. ...
...And 24 more matches
Content type - SVG: Scalable Vector Graphics
svg makes use of a number of data types. this article lists these types along with their syntax and descriptions of what they're used for. angle <angle> angles are specified in one of two ways. when used in the value of a property in a stylesheet, an <angle> is defined as follows: angle ::= number (~"deg" | ~"grad" | ~"rad")? where deg indicates degrees, grad indicates grads and rad indicates radians. for properties defined in css2, an angle unit identifier must be provided. for angle values in svg-specific properties and their corresponding presentation attributes, the angle unit identifier is optional. if not provided, the angle value is assumed to be in degrees. in presentation attributes for all properties, whether defined in svg1.1 or in css2, the angle identifier, if ...
...it identifier is optional. if not provided, the angle value is assumed to be in degrees. in presentation attributes for all properties, whether defined in svg1.1 or in css2, the angle identifier, if specified, must be in lower case. when angles are used in an svg attribute, <angle> is instead defined as follows: angle ::= number ("deg" | "grad" | "rad")? ...
...lue is assumed to be in degrees. in presentation attributes for all properties, whether defined in svg1.1 or in css2, the angle identifier, if specified, must be in lower case. when angles are used in an svg attribute, <angle> is instead defined as follows: angle ::= number ("deg" | "grad" | "rad")? the unit identifiers in such <angle> values must be in lower case. in the svg dom, <angle> values are represented using svgangle or svganimatedangle objects. anything <anything> the basic type <anything> is a sequence of zero or more characters. specifically: anything ::= char* where char is the production for a character, as defined in xml 1.0 , section 2.2. clock-value <clock-value> clock values have the same syntax as in smil animation specification. the grammar fo...
...And 24 more matches
Useful string methods - Learn web development
esent inside a string). this can be done using the indexof() method, which takes a single parameter — the substring you want to search for. if the substring is found inside the main string, it returns a number representing the index position of the substring — which character number of the main string the substring starts at. if the substring is not found inside the main string, it returns a value of -1. try this: browsertype.indexof('zilla'); this gives us a result of 2, because the substring "zilla" starts at position 2 (0, 1, 2 — so 3 characters in) inside "mozilla". such code could be used to filter strings. for example, we may have a list of web addresses and only want to print out the ones that contain "mozilla". this can be done in another way, which is possibly even m...
...ng with another substring using the replace() method. this works very simply at a basic level, although there are some advanced things you can do with it that we won't go into yet. it takes two parameters — the string you want to replace, and the string you want to replace it with. try this example: browsertype.replace('moz','van'); this returns "vanilla" in the console. but if you check the value of browsertype, it is still "mozilla". to actually update the value of the browsertype variable in a real program, you'd have to set the variable value to be the result of the operation; it doesn't just update the substring value automatically. so you'd have to actually write this: browsertype = browsertype.replace('moz','van'); active learning examples in this section we'll get you to try your...
...you don't need to understand arrays or loops right now — these will be explained in future articles. all you need to do in each case is write the code that will output the strings in the format that we want them in. ...
...And 23 more matches
Shell global objects
if the property is omitted or v is null, don't attribute the source to any dom element. elementattributename if present and not undefined, the name of property of element that holds this code. this is what debu...
...mber for error messages and debug info columnnumber starting column number for error messages and debug info global global in which to execute the code newcontext if true, create and use a new cx (default: false) catchtermination if true, catch termination (failure without an exception value, as for slow scripts or out-of-memory) and return 'terminated' element if present with value v, convert v to an object o and mark the source as being attached to the dom element o. ...
...if omitted, attach no source map url to the code (although the code may provide one itself, via a //#sourcemappingurl comment). sourceislazy if present and 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. ...
...And 23 more matches
background-position - CSS: Cascading Style Sheets
ound-position css property sets the initial position for each background image. the position is relative to the position layer set by background-origin. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...epository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 23 more matches
height - SVG: Scalable Vector Graphics
Web › SVG › Attribute › height
ht: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. ...
...://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 <fecomponenttransfer>, height defines the vertical length for the rendering area of the primitive. val...
...lormatrix 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 23 more matches
width - SVG: Scalable Vector Graphics
Web › SVG › Attribute › width
ht: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. ...
...://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 <fecomponenttransfer>, width defines the horizontal length for the rendering area of the primitive. v...
...rmatrix 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 23 more matches
Understanding WebAssembly text format - WebAssembly
4: 0100 0000 ; wasm_binary_version adding functionality to your module ok, that’s not very interesting, let’s add some executable code to this module. all code in a webassembly module is grouped into functions, which have the following pseudo-code structure: ( func <signature> <locals> <body> ) the signature declares what the function takes (parameters) and returns (return values). the locals are like vars in javascript, but with explicit types declared. the body is just a linear list of low-level instructions. so this is similar to functions in other languages, even if it looks different because it is an s-expression. signatures and parameters the signature is a sequence of parameter type declarations followed by a list of return type declarations. it is worth not...
...t a single parameter is written (param i32) and the return type is written (result i32), hence a binary function that takes two 32-bit integers and returns a 64-bit float would be written like this: (func (param i32) (param i32) (result f64) ... ) after the signature, locals are listed with their type, for example (local i32). parameters are basically just locals that are initialized with the value of the corresponding argument passed by the caller. getting and setting locals and parameters locals/parameters can be read and written by the body of the function with the local.get and local.set instructions. the local.get/local.set commands refer to the item to be got/set by its numeric index: parameters are referred to first, in order of their declaration, followed by locals in order of th...
...ted to binary, though, the binary will contain only the integer.) stack machines before we can write a function body, we have to talk about one more thing: stack machines. although the browser compiles it to something more efficient, wasm execution is defined in terms of a stack machine where the basic idea is that every type of instruction pushes and/or pops a certain number of i32/i64/f32/f64 values to/from a stack. for example, local.get is defined to push the value of the local it read onto the stack, and i32.add pops two i32 values (it implicitly grabs the previous two values pushed onto the stack), computes their sum (modulo 2^32) and pushes the resulting i32 value. when a function is called, it starts with an empty stack which is gradually filled up and emptied as the body’s instru...
...And 23 more matches
XUL element attributes - Archive of obsolete content
for boxes that have horizontal orientation, it specifies how its children will be aligned vertically. for boxes that have vertical orientation, it specifies how its children will be aligned horizontally. start child elements are aligned starting from the left or top edge of the box. ...
... extra space is split equally along each side of the child elements, resulting in the children being placed in the center of the box. end child elements are placed on the right or bottom edge of the box. if the box is larger than the total size of the children, the extra space is placed on the left or top side. baseline this value applies to horizontally oriented boxes only. it causes the child elements to be aligned so that their text labels are lined up. stretch this is the default value. the child elements are stretched to fit the size of the box. for a horizontal box, the children are stretched to be the height of the box. for a vertical box, the children are stretched to be the width of t...
...n. left the elements are aligned on their left edges. center the elements are centered horizontally. right the elements are aligned on their right edges. the pack attribute is related to the alignment but is used to specify the position in the opposite direction. you can also specify the value of align using the style property -moz-box-align. allowevents type: boolean if true, events are passed to children of the element. otherwise, events are passed to the element only. allownegativeassertions type: boolean valid on any element that has a datasources attribute. when multiple datasources are used, one may override an assertion from another. this attribute, if tr...
...And 22 more matches
Basic native form controls - Learn web development
seen a few simple examples. note: html form text fields are simple plain text input controls. this means that you cannot use them to perform rich editing (bold, italic, etc.). all rich text editors you'll encounter are custom widgets created with html, css, and javascript. all basic text controls share some common behaviors: they can be marked as readonly (the user 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 maxlength (the maximum number of c...
...urpose of the box. they can be constrained in size (the physical size of the box) and maxlength (the maximum number of characters that can be entered into the box). they can benefit from spell checking (using the spellcheck attribute), if the browser supports it. note: the <input> element is unique amongst html elements because it can take many different forms depending on its type attribute value. ...
...elements because it can take many different forms depending on its type attribute value. it is used for creating most types of form widgets including single line text fields, time and date controls, controls without text input like checkboxes, radio buttons, and color pickers, and buttons. single line text fields a single line text field is created using an <input> element whose type attribute value is set to text, or by omitting the type attribute altogether (text is the default value). the value text for this attribute is also the fallback value if the value you specify for the type attribute is unknown by the browser (for example if you specify type="color" and the browser doesn't support native color pickers). note: you can find examples of all the single line text field types on gith...
...And 22 more matches
<input type="button"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › button
ive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: while <input> elements of type button are still perfectly valid html, the newer <button> element is now the favored way to create buttons. given that a <button>’s label text is inserted between the opening and closing tags, you can include html in the label, even images. ...
...nput> elements of type button are still perfectly valid html, the newer <button> element is now the favored way to create buttons. given that a <button>’s label text is inserted between the opening and closing tags, you can include html in the label, even images. ...
... still perfectly valid html, the newer <button> element is now the favored way to create buttons. given that a <button>’s label text is inserted between the opening and closing tags, you can include html in the label, even images. value a domstring used as the button's label events click supported common attributes type, and value idl attributes value methods none value an <input type="button"> elements' value attribute contains a domstring that is used as the button's label. ...
...And 22 more matches
PKCS #11 Module Specs
pkcs #11 module specs the following is a proposal to the pkcs #11 working group made in august 2001 for configuring pkcs #11 modules. nss currently implements this proposal internally. the file format consists of name/value pairs of the form name=value. each name/value pair is separated by a blank value. a single line, terminated by a '\n', '\r\n', or '\r' represents a single pkcs #11 library. names can be any alpha/numeric combination, and are parsed case-insensitive. values can contain any printable ascii value, including utf8 characters. ...
...plements this proposal internally. the file format consists of name/value pairs of the form name=value. each name/value pair is separated by a blank value. a single line, terminated by a '\n', '\r\n', or '\r' represents a single pkcs #11 library. names can be any alpha/numeric combination, and are parsed case-insensitive. values can contain any printable ascii value, including utf8 characters. values can contain embedded blanks either through quoting the entire value, or by escaping the embedded blanks with '\'. the value is considered quoted if the first character after the '=' is ', ", {, [, or <. if the value is quoted, then the value is terminated with and ending quote of the form ', ", ), ], }, or > matching the respective starting quote. ending quotes can be escaped. embedded '\' chara...
... name this specifies the name of the pkcs #11 library. ...
...And 21 more matches
mozIStorageBindingParams
the mozistoragebindingparams interface is used to bind values to parameters prior to calling mozistoragestatement.executeasync(). storage/public/mozistoragebindingparams.idlscriptable please add a summary to this article. last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) inherits from: nsisupports you can only create mozistoragebindingparams objects by calling the mozistoragebindingparamsarray.newbindingparams(). ...
...age/public/mozistoragebindingparams.idlscriptable please add a summary to this article. last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) inherits from: nsisupports you can only create mozistoragebindingparams objects by calling the mozistoragebindingparamsarray.newbindingparams(). ...
...e. last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) inherits from: nsisupports you can only create mozistoragebindingparams objects by calling the mozistoragebindingparamsarray.newbindingparams(). ...
...And 21 more matches
<input type="checkbox"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › checkbox
<input> elements of type checkbox are rendered by default as boxes that are checked (ticked) when activated, like you might see in an official government paper form. the exact appearance depends upon the operating system configuration under which the browser is running. generally this is a square but it may have rounded corners. a checkbox allows you to select single values for submission in a form (or not). the source for this interactive example is stored in a github repository. if 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: radio buttons are similar to checkboxes, but with an important distinction — radio buttons are grouped into a set in which only one radio button can be se...
...n a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ples and send us a pull request. note: radio buttons are similar to checkboxes, but with an important distinction — radio buttons are grouped into a set in which only one radio button can be selected at a time, whereas checkboxes allow you to turn single values on and off. where multiple controls exist, radio buttons allow one to be selected out of them all, whereas checkboxes allow multiple values to be selected. value a domstring representing the value of the checkbox. events change and input supported common attributes checked idl attributes checked, indeterminate and value methods select() value a domstring representing the value of the checkbox. this is never seen on the client-side, but on the server this is the va...
...And 21 more matches
<input type="week"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › week
xamples and send us a pull request. the control's user interface varies from browser to browser; cross-browser support is currently a bit limited, with only chrome/opera and microsoft edge supporting it at this time. in non-supporting browsers, the control degrades gracefully to function identically to <input type="text">. ...
...wser support is currently a bit limited, with only chrome/opera and microsoft edge supporting it at this time. in non-supporting browsers, the control degrades gracefully to function identically to <input type="text">. in chrome/opera the week control provides slots to fill in week and year values, a pop-up calendar interface to select them more visually, and an "x" button to clear the control's value. the edge week control is somewhat more elaborate, opening up week and year pickers with sliding reels. value a domstring representing a week and year, or empty events change and input supported common attributes autocomplete, list, readonly, and step idl attributes value, valueasdate, valueasnumber, and list. methods select(), ste...
... somewhat more elaborate, opening up week and year pickers with sliding reels. value a domstring representing a week and year, or empty events change and input supported common attributes autocomplete, list, readonly, and step idl attributes value, valueasdate, valueasnumber, and list. methods select(), stepdown(), and stepup() value a domstring representing the value of the week/year entered into the input. the format of the date and time value used by this input type is described in format of a valid week string in date and time formats used in html. ...
...And 21 more matches
itemprop - HTML: Hypertext Markup Language
examples the example below shows the source for a set of elements marked up with itemprop attributes, followed by a table showing the resulting structured data. ...
... examples the example below shows the source for a set of elements marked up with itemprop attributes, followed by a table showing the resulting structured data. ...
... examples the example below shows the source for a set of elements marked up with itemprop attributes, followed by a table showing the resulting structured data. ...
...And 21 more matches
Indexed collections - JavaScript
for example, consider an array called emp, which contains employees' names indexed by their numerical employee number. so emp[0] would be employee number zero, emp[1] employee number one, and so on. javascript does not have an explicit array data type. however, you can use the predefined array object and its methods to work with arrays in your applications. ...
...g, 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 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-ze...
...ate an array with non-zero length, but without any items, either of the following can be used: // this... let arr = new array(arraylength) // ...results in the same array as this let arr = array(arraylength) // this has exactly the same effect let arr = [] arr.length = arraylength note: in the above code, arraylength must be a number. otherwise, an array with a single element (the provided value) will be created. calling arr.length will return arraylength, but the array doesn't contain any elements. a for...in loop will not find any property on the array. in addition to a newly defined variable as shown above, arrays can also be assigned as a property of a new or an existing object: let obj = {} // ... obj.prop = [element0, element1, ..., elementn] // or let obj = {prop: [element0, e...
...And 21 more matches
Elements - Archive of obsolete content
ons). the url specifies a particular binding document. the # notation must be used to point to a specific binding id within a binding document. note that content cannot be inherited, only behavior. display - this attribute specifies how the tag is displayed. by setting this attribute, you can have an element have the layout and display characteristics of an existing element. for example, use the value 'xul:button' to create an element that is displayed like a button. the part before the colon is a namespace prefix so you must declare the xul namespace as well. not all tags have a unique display type. the following xul display types may be used: browser, button, checkbox, description, editor, grippy, iframe, image, label, menu, menuitem, menubar, progressmeter, radio, resizer, scrollbar, scroll...
...pes may be used: browser, button, checkbox, description, editor, grippy, iframe, image, label, menu, menuitem, menubar, progressmeter, radio, resizer, scrollbar, scrollbox, spacer, splitter, titlebar, treechildren and treecol. you may also use a number of html, mathml and svg tags. the 'display' attribute does not work unless the extends attribute is set, see bug bug 119389. in that case, put the value of the display attribute into the extends attribute. inheritstyle - the inheritstyle attribute indicates whether style rules from the document will affect anonymous content generated by the xbl binding. if this attribute is true, styles from the document will also be applied to the xbl generated anonymous content. content <!element content any> <!attlist content id id ...
...ent. if the element the binding is attached to contains content, the default content will be ignored. if the element does not contain content, the default content will be added. id - the id attribute is a document-unique identifier. includes - the includes attribute can be used to indicate that only certain content should be placed at the insertion point specified by the children element. its value can be a tag name or multiple tag names separated by the pipe character ("|"). a child can only be placed within the insertion point if it is matched by the value in the includes attribute. only immediate children are matched against the selector. for example, an xml fragment <customelement><foobar><hoge/></foobar></customelement> with an binding definition <binding id="customelement"><content><x...
...And 20 more matches
menulist - Archive of obsolete content
t. to create the drop-down, put a menupopup inside the menulist containing the choices as menuitem elements. the command event may be used to execute code when the menulist selection changes. more information is available in the xul tutorial. ...
... available in the xul tutorial. ...
...this should be one of the characters that appears in the label attribute for the element. crop ty...
...And 20 more matches
Other form controls - Learn web development
between a <textarea> and a regular single line text field is that users are allowed to include hard line breaks (i.e. pressing return) that will be included when the data is submitted. <textarea> also takes a closing tag, and any default text you want it to contain should be put between the opening and closing tags. in contrast, the <input> is an empty element with no closing tag — any default value is put inside the value attribute. note that even though you can put anything inside a <textarea> element (including other html elements, css, and javascript), because of its nature, it is all rendered as if it was plain text content. (using contenteditable on non-form controls provides an api for capturing html/"rich" content instead of plain text). visually, the text entered wraps and the for...
...rticle of the series (see the source code also). controlling multi-line rendering <textarea> accepts three attributes to control its rendering across several lines: cols specifies the visible width (columns) of the text control, measured in average character widths. this is effectively the starting width, as it can be changed by resizing the <textarea>, and overriden using css. ...
...control, measured in average character widths. this is effectively the starting width, as it can be changed by resizing the <textarea>, and overriden using css. the default value if none is specified is 20. rows specifies the number of visible text rows for the control. this is effectively the starting height, as it can be changed by resizing the <textarea>, and overriden using css. the default value if none is specified is 2. wrap specifies how the control wraps text. the values are soft (the default value), which means the text submitted is not wrapped but the text rendered by the browser is wrapped; hard (the cols attribute must be specified when using this value), which means both the submitted and rendered texts are wrapped, and off, which stops wrapping. controlling textarea resizab...
...And 20 more matches
Looping code - Learn web development
ogramming loops are all to do with doing the same thing over and over again — which is termed iteration in programming speak. let's consider the case of a farmer that is making sure he has enough food to feed his family for the week. he might use the following loop to achieve this: a loop usually has one or more of the following features: a counter, which is initialized with a certain value — this is the starting point of the loop ("start: i have no food", above). a condition, which is a true/false test to determine whether the loop continues to run, or stops — usually when the counter reaches a certain value. this is illustrated by "have i got enough food?", above. let's say he needs 10 portions of food to feed his family. an iterator, which generally increments the counter b...
...<input id="search" type="text"> <button>search</button> <p></p> now on to the javascript: const contacts = ['chris:2232322', 'sarah:3453456', 'bill:7654322', 'mary:9998769', 'dianne:9384975']; const para = document.queryselector('p'); const input = document.queryselector('input'); const btn = document.queryselector('button'); btn.addeventlistener('click', function() { let searchname = input.value.tolowercase(); input.value = ''; input.focus(); for (let i = 0; i < contacts.length; i++) { let splitcontact = contacts[i].split(':'); if (splitcontact[0].tolowercase() === searchname) { para.textcontent = splitcontact[0] + '\'s number is ' + splitcontact[1] + '.'; break; } else { para.textcontent = 'contact not found.'; } } }); hidden code 3 <!doctype...
...ch" type="text"> <button>search</button> <p></p> <script> const contacts = ['chris:2232322', 'sarah:3453456', 'bill:7654322', 'mary:9998769', 'dianne:9384975']; const para = document.queryselector('p'); const input = document.queryselector('input'); const btn = document.queryselector('button'); btn.addeventlistener('click', function() { let searchname = input.value.tolowercase(); input.value = ''; input.focus(); for (let i = 0; i < contacts.length; i++) { let splitcontact = contacts[i].split(':'); if (splitcontact[0].tolowercase() === searchname) { para.textcontent = splitcontact[0] + '\'s number is ' + splitcontact[1] + '.'; break; } else if (i === contacts.length-1) para.textconte...
...And 20 more matches
Drawing graphics - Learn web development
ight and the canvas' height property equal to window.innerheight (which gives us the viewport height). so now we have a canvas that fills the entire width and height of the browser window! you'll also see that we are chaining assignments together with multiple equals signs — this is allowed in javascript, and it is a good technique if you want to make multiple variables all equal to the same value. we wanted to make the canvas width and height easily accessible in the width/height variables, as they are useful values to have available for later (for example, if you want to draw something exactly halfway across the width of the canvas). if you save and load your example in a browser now, you'll see nothing, which is fine, but you'll also see scrollbars — this is a problem for us, wh...
...ference to the drawing area called a context. this is done using the htmlcanvaselement.getcontext() method, which for basic usage takes a single string as a parameter representing the type of context you want to retrieve. in this case we want a 2d canvas, so add the following javascript line below the others inside the <script> element: const ctx = canvas.getcontext('2d'); note: other context values you could choose include webgl for webgl, webgl2 for webgl 2, etc., but we won't need those in this article. so that's it — our canvas is now primed and ready for drawing on! the ctx variable now contains a canvasrenderingcontext2d object, and all drawing operations on the canvas will involve manipulating this object. let's do one last thing before we move on. we'll color the canvas backgro...
...ns on the canvas will involve manipulating this object. let's do one last thing before we move on. we'll color the canvas background black to give you a first taste of the canvas api. add the following lines at the bottom of your javascript: ctx.fillstyle = 'rgb(0, 0, 0)'; ctx.fillrect(0, 0, width, height); here we are setting a fill color using the canvas' fillstyle property (this takes color values just like css properties do), then drawing a rectangle that covers the entire area of the canvas with thefillrect method (the first two parameters are the coordinates of the rectangle's top left hand corner; the last two are the width and height you want the rectangle drawn at — we told you those width and height variables would be useful)! ok, our template is done and it's time to move on. ...
...And 20 more matches
Basic math in JavaScript — numbers and operators - Learn web development
had to learn multiplication tables and long division in school, and some of us sit somewhere in between the two. but none of us can deny that math is a fundamental part of life that we can't get very far without. this is especially true when we are learning to program javascript (or any other language for that matter) — so much of what we do relies on processing numerical data, calculating new values, and so on, that you won't be surprised to learn that javascript has a full-featured set of math functions available. this article discusses only the basic parts that you need to know now. types of numbers in programming, even the humble decimal number system that we all know so well is more complicated than you might think. we use different terms to describe different types of decimal number...
...ng languages, javascript only has one data type for numbers, both integers and decimals — you guessed it, number. this means that whatever type of numbers you are dealing with in javascript, you handle them in exactly the same way. note: actually, javascript has a second number type, bigint, used for very, very large integers. but for the purposes of this course, we'll just worry about number values. it's all numbers to me let's quickly play with some numbers to reacquaint ourselves with the basic syntax we need. enter the commands listed below into your developer tools javascript console. first of all, let's declare a couple of variables and initialize them with an integer and a float, respectively, then type the variable names back in to check that everything is in order: let myin...
...ome numbers to reacquaint ourselves with the basic syntax we need. enter the commands listed below into your developer tools javascript console. first of all, let's declare a couple of variables and initialize them with an integer and a float, respectively, then type the variable names back in to check that everything is in order: let myint = 5; let myfloat = 6.667; myint; myfloat; number values are typed in without quote marks — try declaring and initializing a couple more variables containing numbers before you move on. now let's check that both our original variables are of the same datatype. there is an operator called typeof in javascript that does this. enter the below two lines as shown: typeof myint; typeof myfloat; you should get "number" returned in both cases — this ...
...And 20 more matches
mozIStorageStatement
storage/public/mozistoragestatement.idlscriptable this interface lets you create and execute sql statements on a mozistorageconnection. inherits from: mozistoragevaluearray last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) for an introduction on how to use this interface, see the storage overview document. method overview void initialize(in mozistorageconnection adbconnection, in autf8string asqlstatement); obsolete since gecko 1.9.1 void finalize(); mozistoragestatement clone(); autf8string getparametername(in unsigned long aparamindex); unsigned long getparameterindex(in autf8string aname); autf8string getcolumnname(in unsigned long acolumnindex); unsigned long getcolumnindex(in autf8strin...
... void finalize(); mozistoragestatement clone(); autf8string getparametername(in unsigned long aparamindex); unsigned long getparameterindex(in autf8string aname); autf8string getcolumnname(in unsigned long acolumnindex); unsigned long getcolumnindex(in autf8string aname); void reset(); astring escapestringforlike(in astring avalue, in wchar aescapechar); void bindparameters(in mozistoragebindingparamsarray aparameters); mozistoragebindingparamsarray newbindingparamsarray(); void bindutf8stringparameter(in unsigned long aparamindex, in autf8string avalue); void bindstringparameter(in unsigned long aparamindex, in astring avalue); void binddoubleparameter(in unsigned long aparam...
...char); void bindparameters(in mozistoragebindingparamsarray aparameters); mozistoragebindingparamsarray newbindingparamsarray(); void bindutf8stringparameter(in unsigned long aparamindex, in autf8string avalue); void bindstringparameter(in unsigned long aparamindex, in astring avalue); void binddoubleparameter(in unsigned long aparamindex, in double avalue); void bindint32parameter(in unsigned long aparamindex, in long avalue); void bindint64parameter(in unsigned long aparamindex, in long long avalue); void bindnullparameter(in unsigned long aparamindex); void bindblobparameter(in unsigned long aparamindex, [array,const,size_is(avaluesize)] in octet avalue, in unsigned long avaluesize); mozistoragependin...
...And 20 more matches
nsINavBookmarksService
item id of the top-level folder that contains the tag "folders". read only. note: renamed from tagroot in gecko 1.9 toolbarfolder long long the item id of the personal toolbar folder. read only. note: renamed from toolbarroot in gecko 1.9 unfiledbookmarksfolder long long the item id of the unfiled bookmarks folder. read only. constants constant value description default_index -1 this is the default index; this value should be used for apis that allow passing in an index where the index is not known or is not required to be specified, such as when appending an item to a folder. type_bookmark 1 this is an index for type "bookmark". type_folder 2 this is an index for type "folder". type_se...
...ng createdynamiccontainer( in long long aparentfolder, in autf8string aname, in astring acontractid, in long aindex ); parameters aparentfolder the id of the parent folder. aname the name of the new folder. acontractid the contract id of the service which is to manipulate this container. aindex the index to insert at, or default_index to append to the end of the list. return value returns the id of the newly-inserted folder. createfolder() this method creates a new child folder and inserts it under the given parent. long long createfolder( in long long aparentfolder, in autf8string name, in long index ); parameters aparentfolder the id of the parent folder. name the name of the new folder. index the index to insert at, or default_index to append to the ...
...wly-inserted folder. createfolder() this method creates a new child folder and inserts it under the given parent. long long createfolder( in long long aparentfolder, in autf8string name, in long index ); parameters aparentfolder the id of the parent folder. name the name of the new folder. index the index to insert at, or default_index to append to the end of the list. return value returns the id of the newly-inserted folder. endupdatebatch() obsolete since gecko 1.9 (firefox 3) causes observers to be notified of an endupdatebatch when a batch is done changing. should match beginupdatebatch() or bad things will happen. void endupdatebatch(); parameters none. exportbookmarkshtml() obsolete since gecko 1.9 (firefox 3) ...
...And 20 more matches
nsISessionStore
details. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) in versions of firefox prior to 3.5, the user preference browser.sessionstore.enabled must be true for these calls to be successful. starting in firefox 3.5, this preference is no longer used. ...
...its from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) in versions of firefox prior to 3.5, the user preference browser.sessionstore.enabled must be true for these calls to be successful. starting in firefox 3.5, this preference is no longer used. ...
...ndex); nsidomnode forgetclosedwindow(in unsigned long aindex); astring getbrowserstate(); unsigned long getclosedtabcount(in nsidomwindow awindow); astring getclosedtabdata(in nsidomwindow awindow); unsigned long getclosedwindowcount(); astring getclosedwindowdata(); astring gettabstate(in nsidomnode atab); astring gettabvalue(in nsidomnode atab, in astring akey); astring getwindowstate(in nsidomwindow awindow); astring getwindowvalue(in nsidomwindow awindow, in astring akey); void init(in nsidomwindow awindow); void persisttabattribute(in astring aname); void restorelastsession(); void setbrowserstate(in astring astate); void settabstate(in nsidomnode ata...
...And 20 more matches
Debugger - Firefox Developer Tools
d as a constructor, the debugger object creates a new debugger instance. new debugger([global, …]) create a debugger object, and apply its adddebuggee method to each of the givenglobal objects to add them as the initial debuggees. accessor properties of the debugger prototype object a debugger instance inherits the following accessor properties from its prototype: enabled a boolean value indicating whether this debugger instance’s handlers, breakpoints, and the like are currently enabled. it is an accessor property with a getter and setter: assigning to it enables or disables this debugger instance; reading it produces true if the instance is enabled, or false otherwise. this property is initially true in a freshly created debugger instance. this property gives debugger code ...
... this debugger instance; reading it produces true if the instance is enabled, or false otherwise. this property is initially true in a freshly created debugger instance. this property gives debugger code a single point of control for disentangling itself from the debuggee, regardless of what sort of events or handlers or “points” we add to the interface. allowunobservedasmjs a boolean value indicating whether asm.js code running inside this debugger instance’s debuggee globals is invisible to debugger api handlers and breakpoints. setting this to false inhibits the ahead-of-time asm.js compiler and forces asm.js code to run as normal javascript. this is an accessor property with a getter and setter. it is initially false in a freshly created debugger instance. setting this flag ...
...time asm.js compiler and forces asm.js code to run as normal javascript. this is an accessor property with a getter and setter. it is initially false in a freshly created debugger instance. setting this flag to true is intended for uses of subsystems of the debugger api (e.g, debugger.source) for purposes other than step debugging a target javascript program. allowwasmbinarysource a boolean value indicating whether webassembly sources will be available in binary form. the webassembly text generation will be disabled. collectcoverageinfo a boolean value indicating whether code coverage should be enabled inside each debuggee of this debugger instance. changing this flag value will recompile all jit code to add or remove code coverage instrumentation. changing this flag when any frame of...
...And 20 more matches
HTMLInputElement - Web APIs
ute of the parent form. properties that apply to any type of input element that is not hidden name string: returns / sets the element's name attribute, containing a name that identifies the element when submitting the form. type string: returns / sets the element's type attribute, indicating the type of control to display. see type attribute of <input> for possible values. disabled boolean: returns / sets the element's disabled attribute, indicating that the control is not available for interaction. the input values will not be submitted with the form. see also readonly autofocus boolean: returns / sets the element's autofocus attribute, which specifies that a form control should have input focus when the page loads, unless the user overri...
... loads, unless the user overrides it, for example by typing in a different control. only one form element in a document can have the autofocus attribute. it cannot be applied if the type attribute is set to hidden (that is, you cannot automatically set focus to a hidden control). required boolean: returns / sets the element's required attribute, indicating that the user must fill in a value before submitting a form. value string: returns / sets the current value of the control. note: if the user enters a value different from the value expected, this may return an empty string. validity read only validitystate object: returns the element's current validity state. validationmessage read only string: returns a localized message that describe...
...idity read only validitystate object: returns the element's current validity state. 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 constraint validation (willvalidate is false), or it satisfies its constraints. this value can be set by the setcustomvalidity method. willvalidate read only boolean: returns whether the element is a candidate for constraint validation. it is false if any conditions bar it from constraint validation, including: its type is hidden, reset, or button; it has a <datalist> ancestor; its disabled property is true. properties that apply only to elements of type checkbox ...
...And 20 more matches
<color> - CSS: Cascading Style Sheets
the <color> css data type represents a color in the srgb color space. a <color> may also include an alpha-channel transparency value, indicating how the color should composite with its background. a <color> can be defined in any of the following ways: using a keyword (such as blue or transparent) using the rgb cubic-coordinate system (via the #-hexadecimal or the rgb() and rgba() functional notations) using the hsl cylindrical-coordinate system (via the hsl() and hsla() functional notations) note: this article describes the <color> data type in detail. to learn more about using color in html, see applying color to html elements using css. ...
...r the rgb() and rgba() functional notations) using the hsl cylindrical-coordinate system (via the hsl() and hsla() functional notations) note: this article describes the <color> data type in detail. to learn more about using color in html, see applying color to html elements using css. syntax the <color> data type is specified using one of the options listed below. note: although <color> values are precisely defined, their actual appearance may vary (sometimes significantly) from device to device. this is because most devices are not calibrated, and some browsers do not support output devices' color profiles. color keywords color keywords are case-insensitive identifiers that represent a specific color, such as red, blue, black, or lightseagreen. although the names more or less desc...
...esent a specific color, such as red, blue, black, or lightseagreen. although the names more or less describes their respective colors, they are essentially artificial, without a strict rationale behind the names used. there are a few caveats to consider when using color keywords: html only recognizes the 16 basic color keywords found in css1, using a specific algorithm to convert unrecognized values (often to completely different colors). the other color keywords should only be used in css and svg. unlike html, css will completely ignore unknown keywords. the color keywords all represent plain, solid colors, without transparency. several keywords are aliases for each other: aqua / cyan fuchsia / magenta darkgray / darkgrey darkslategray / darkslategrey dimgray / dimgrey...
...And 20 more matches
font - CSS: Cascading Style Sheets
Web › CSS › font
property sets all the different properties of an element's font. alternatively, it sets an element's font to a system font. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. as with any shorthand property, any individual value that is not specified is set to its corresponding initial value (possibly overriding values previously set using non-shorthand properties). though not directly settable by font, the longhands font-size-adjust and font-kerning are also reset to their initial values. constituent properties this property is a shorthand for the following css properties: font-family font-size font-stretch font...
...ght line-height syntax the font property may be specified as either a single keyword, which will select a system font, or as a shorthand for various font-related properties. if font is specified as a system keyword, it must be one of: caption, icon, menu, message-box, small-caption, status-bar. if font is specified as a shorthand for several font-related properties, then: it must include values for: <font-size> <font-family> it may optionally include values for: <font-style> <font-variant> <font-weight> <font-stretch> <line-height> font-style, font-variant and font-weight must precede font-size font-variant may only specify the values defined in css 2.1, that is normal and small-caps font-stretch may only be a single keyword value. line-height ...
... <'font-variant'> see the font-variant css property. <'font-weight'> see the font-weight css property. ...
...And 20 more matches
<input type="month"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › month
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...h there may be automatic validation of the entered text to ensure it's formatted as expected. for those of you using a browser that doesn't support month, the screenshot below shows what it looks like in chrome and opera. clicking the down arrow on the right hand side brings up a date picker that lets you select the month and year. ...
...chrome and opera. clicking the down arrow on the right hand side brings up a date picker that lets you select the month and year. the microsoft edge month control looks like this: value a domstring representing a month and year, or empty. events change and input supported common attributes autocomplete, list, readonly, and step. idl attributes value methods select(), stepdown(), stepup(). value a domstring representing the value of the month and year entered into the input, in the form yyyy-mm (four or more digit year, then a hyphen ("-"), followed by the two-digit month). the format of the month string used by this input type is described in format of a valid local month string in date and time formats used in html. you...
...And 20 more matches
<input type="search"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › search
text fields designed for the user to enter search queries into. these are functionally identical to text inputs, but may be styled differently by the user agent. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...nter search queries into. these are functionally identical to text inputs, but may be styled differently by the user agent. the source for this interactive example is stored in a github repository. if 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, maxlength, minlength, 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...
...s change and input supported common attributes autocomplete, list, maxlength, minlength, 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 are in place for the input (see validation for more details), the value can be any text string or an empty string (""). additional attributes in addition to the attributes that operate on all <input> elements regardless of their type, search field inputs support the following attributes: attribute ...
...And 20 more matches
Image file type and format guide - Web media technologies
been introduced later. image file type details the following sections provide a brief overview of each of the image file types supported by web browsers. in the tables below, the term bits per component refers to the number of bits used to represent each color component. for example, an rgb color depth of 8 indicates that each of the red, green, and blue components are represented by an 8-bit value. bit depth, on the other hand, is the total number of bits used to represent each pixel in memory. apng (animated portable network graphics) apng is a file format first introduced by mozilla which extends the png standard to add support for animated images. conceptually similar to the animated gif format which has been in use for decades, apng is more capable in that it supports a variety of co...
..._specification browser compatibility chrome 59, edge 12, firefox 3, opera 46, safari 8 maximum dimensions 2,147,483,647×2,147,483,647 pixels supported color modes color mode bits per component (d) description greyscale 1, 2, 4, 8, and 16 each pixel consists of a single d-bit value indicating the brightness of the greyscale pixel. true color 8 and 16 each pixel is represented by three d-bit values indicating the level of the red, green, and blue color components. indexed color 1, 2, 4, and 8 each pixel is a d-bit value indicating an index into a color palette which is contained within a plte chunk in the ...
...the level of the red, green, and blue color components. indexed color 1, 2, 4, and 8 each pixel is a d-bit value indicating an index into a color palette which is contained within a plte chunk in the apng file; the colors in the palette all use an 8-bit depth. greyscale with alpha 8 and 16 each pixel is represented by two d-bit values: the intensity of the greyscale pixel and an alpha sample, indicating how opaque the pixel is. true color with alpha 8 and 16 each pixel is comprised of four d-pixel color components: red, green, blue, and the alpha sample indicating how opaque the pixel is. compression lossless licensing free and open under the cre...
...And 20 more matches
Tree Box Objects - Archive of obsolete content
is equivalent to: let boxobject = tree.boxobject; boxobject.queryinterface("components.interfaces.nsitreeboxobject"); scrolling the tree you can also scroll the tree using four different methods, similar to those available for listboxes. the scrolltorow() function may be used to scroll to a particular row. here is a simple example. ...
...boxobject; boxobject.queryinterface("components.interfaces.nsitreeboxobject"); scrolling the tree you can also scroll the tree using four different methods, similar to those available for listboxes. the scrolltorow() function may be used to scroll to a particular row. here is a simple example. ...
...ble for listboxes. the scrolltorow() function may be used to scroll to a particular row. here is a simple example. ...
...And 19 more matches
listbox - Archive of obsolete content
ntain listitem elements. all the rows in the listbox are the same height, which is the height of the tallest item in the list. if you wish to create a list with variable height rows, or with non-text content, you should instead use the richlistbox element. see list controls for more information. ...
... instead use the richlistbox element. see list controls for more information. ...
...dow. more information is available in the preferences system article. rows type: integer the number of rows to display in the element. if the element contains more than this number of rows, a scrollbar will appear which the user can use to scroll to the other rows. to get the actual number of rows in the element, use the getrowcount method. ...
...And 19 more matches
richlistbox - Archive of obsolete content
to create a list of listitems (richlistitems), similar to a listbox, but is designed to be used when the items do not contain simple text content. note: in versions of firefox prior to firefox 3, rich list boxes support only single selection. firefox 3 introduced multiple selection to rich list boxes. ...
...only single selection. firefox 3 introduced multiple selection to rich list boxes. ...
...abel. this is done incrementally, so typing more letters with select more specific items. this feature may be disabled by setting this attribute to true. preference type: id connects the element to a corresponding preference. this attribute only has any effect when used inside a prefwindow. more information is available in the preferences system article. ...
...And 19 more matches
tree - Archive of obsolete content
Archive › Mozilla › XUL › tree
so typing more letters with select more specific items. this feature may be disabled by setting this attribute to true. editable type: boolean indicates that the cells of the tree may be edited. enablecolumndrag type: boolean when set to true, the user may drag the column headers around to change the order in which they are displayed. flags type: space-separated list of the values below a set of flags used for miscellaneous purposes. two flags are defined, which may be the value of this attribute. dont-test-empty: for template generated content, the builder will not check that a container is empty. dont-build-content: this flag may be used on a tree to indicate that content elements should not be generated. this results in a performance enhancement, but you will no...
...content elements should not be generated. this results in a performance enhancement, but you will not be able to use the dom functions to retrieve the tree rows. hidecolumnpicker type: boolean when set to false, a drop-down will appear in the upper right corner of the tree, which the user may use to show and hide columns. when set to true, the column picker will be hidden. the default value is false. onselect type: script code this event is sent to a tree when a row is selected, or whenever the selection changes. the user can select multiple rows by holding down shift or control and clicking on a row. the onselect event will be sent for each item added to or removed from the selection. rows type: integer the number of rows to display in the element...
... will be sent for each item added to or removed from the selection. rows type: integer the number of rows to display in the element. if the element contains more than this number of rows, a scrollbar will appear which the user can use to scroll to the other rows. to get the actual number of rows in the element, use the getrowcount method. ...
...And 19 more matches
The HTML5 input types - Learn web development
previous overview: forms next in the previous article we looked at the <input> element, covering the original values of the type attribute available since the early days of html. now we'll look at the functionality of newer form controls in detail, including some new input types, which were added in html5 to allow collection of specific types of data. prerequisites: basic computer literacy, and a basic understanding of html. objective: to understand the newer input type values available to create native form controls, and how to implement them using html. note: most of the features discussed in this article have wide support across browsers. we'll note any exceptions. if you want more detail on browser support, you should consult our html forms element...
...ou should consult our html forms element reference, and in particular our extensive <input> types reference. because html form control appearance may be quite different from a designer's specifications, web developers sometimes build their own custom form controls. we cover this in an advanced tutorial: how to build custom form widgets. e-mail address field this type of field is set using the value email for the type attribute: <input type="email" id="email" name="email"> when this type is used, the user is required to type a valid email address into the field. any other content causes the browser to display an error when the form is submitted. you can see this in action in the below screenshot. you can also use the multiple attribute in combination with the email input type to allow s...
...m the error messages; we'll talk how to use these features in the client-side form validation article later on. note: if the data entered is not an email address, the :invalid pseudo-class will match, and the validitystate.typemismatch property will return true. search field search fields are intended to be used to create search boxes on pages and apps. this type of field is set by using the value search for the type attribute: <input type="search" id="search" name="search"> the main difference between a text field and a search field is how the browser styles its appearance. often, search fields are rendered with rounded corners; they also sometimes display an "Ⓧ", which clears the field of any value when clicked). additionally, on devices with dynamic keyboards, the keyboard's enter k...
...And 19 more matches
nsIFile
ements in a directory. each element in the enumeration is an nsifile. read only. exceptions thrown ns_error_file_not_directory indicates that this nsifile does not reference a directory. diskspaceavailable print64 the number of bytes available to non-superuser on the disk volume containing the nsifile. read only. filesize print64 the value of this attribute is the number of bytes corresponding to the data represented by the file. on the mac, getting/setting the file size with nsifile only deals with the size of the data fork. if you need to know the size of the combined data and resource forks use nsilocalfilemac.getfilesizewithresfork(). changing the size of a nsifile operates on the underlying filesystem, possibly trunca...
... nsifile operates on the underlying filesystem, possibly truncating the existing file to specified size. filesizeoflink print64 this attribute exposes the size of the symbolic link referenced by this nsifile. unlike filesize, this attribute corresponds to the size of the symbolic link referenced by this nsifile. if this nsifile does not reference a symbolic link, then the value of this attribute is undefined. the value of this attribute is the number of bytes corresponding to the data represented by the symbolic link. any meta data, such as a resource fork on the mac, is not included in the measurement of the file size. read only. followlinks prbool determines whether or not the nsifile will automatically resolve symbolic links. by default, t...
...this attribute is undefined. the value of this attribute is the number of bytes corresponding to the data represented by the symbolic link. any meta data, such as a resource fork on the mac, is not included in the measurement of the file size. read only. followlinks prbool determines whether or not the nsifile will automatically resolve symbolic links. by default, this value is false on all non-unix systems. as of mozilla 1.7, this attribute is ignored on unix systems. lastmodifiedtime print64 this attribute exposes the time when the file referenced by this nsifile was last modified. the value of this attribute is milliseconds since midnight (00:00:00), january 1, 1970 greenwich mean time (gmt). changing the last modified time of a nsifil...
...And 19 more matches
nsMsgSearchAttrib
defined in comm-central/ mailnews/ base/ search/ public/ nsmsgsearchcore.idl typedef long nsmsgsearchattribvalue; /** * definitions of search attribute types. the numerical order * from here will also be used to determine the order that the * attributes display in the filter editor. ...
... in comm-central/ mailnews/ base/ search/ public/ nsmsgsearchcore.idl typedef long nsmsgsearchattribvalue; /** * definitions of search attribute types. the numerical order * from here will also be used to determine the order that the * attributes display in the filter editor. ...
...attribvalue; /** * definitions of search attribute types. the numerical order * from here will also be used to determine the order that the * attributes display in the filter editor. ...
...And 19 more matches
Capabilities, constraints, and settings - Web APIs
and so forth. the result has been a lot of very fragile code, or a reliance on libraries which figure this stuff out for you, then implement polyfills to patch the holes in the implementation on your behalf. the twin concepts of constraints and capabilities let the browser and web site or app exchange information about what constrainable properties the browser's implementation supports and what values it supports for each one. this article discusses capabilities and constraints, as well as media settings, and includes an example we call the constraint exerciser. the constraint exerciser lets you experiment with the results of different constraint sets being applied to the audio and video tracks coming from the computer's a/v input devices (such as its webcam and microphone). overview the pr...
...hem—but if you have any that you can't get by without, you can start by checking to be sure they're on the list. once the script knows whether the property or properties it wishes to use are supported, it can then check the capabilities of the api and its implementation by examining the object returned by the track's getcapabilities() method; this object lists each supported constraint and the values or range of values which are supported. finally, the track's applyconstraints() method is called to configure the api as desired by specifying the values or ranges of values it wishes to use for any of the constrainable properties about which it has a preference. the track's getconstraints() method returns the set of constraints passed into the most recent call to applyconstraints(). this may ...
...for a complete representation of the track's current configuration, use getsettings(). in the media stream api, both mediastream and mediastreamtrack have constrainable properties. ...
...And 19 more matches
font-variant - CSS: Cascading Style Sheets
the font-variant css shorthand property allows you to set all the font variants for a font. you can also set the css level 2 (revision 1) values of font-variant, (that is, normal or small-caps), by using the font shorthand. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...mples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...d us a pull request. ...
...And 19 more matches
<input type="password"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › password
they pressed the key they meant to press; this is helpful given the small size of keys and the ease with which the wrong one can be pressed, especially on virtual keyboards. note: any forms involving sensitive information like passwords (e.g. login forms) should be served over https; many browsers now implement mechanisms to warn against insecure login forms; see insecure passwords. ...
...ement 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, maxlength, minlength, 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 anything yet, this value is an empty string (""). ...
...rection, 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 anything yet, this value is an empty string (""). if the required property is specified, then the password edit box must contain a value other than an empty string to be valid. if the pattern attribute is specified, the content of a password control is only considered valid if the value passes validation; see validation for more information. note: the line feed (u+000a) and carriage return (u+000d) characters are not permitted in a password value. ...
...And 19 more matches
JavaScript data types and data structures - JavaScript
r from one language to another. this article attempts to list the built-in data structures available in javascript and what properties they have. these can be used to build other data structures. wherever possible, comparisons with other languages are drawn. dynamic typing javascript is a loosely typed and dynamic language. ...
...he built-in data structures available in javascript and what properties they have. these can be used to build other data structures. wherever possible, comparisons with other languages are drawn. dynamic typing javascript is a loosely typed and dynamic language. ...
...are primitives, checked by typeof operator: undefined : typeof instance === "undefined" boolean : typeof instance === "boolean" number : typeof instance === "number" string : typeof instance === "string" bigint : typeof instance === "bigint" symbol : typeof instance === "symbol" null : typeof instance === "object". special primitive type having additional usage for its value: if object is not inherited, then null is shown; object : typeof instance === "object". special non-data but structural type for any constructed object instance also used as data structures: new object, new array, new map, new set, new weakmap, new set, new date and almost everything made with new keyword; function : a non-data structure, though it also answers for typeof operator: typeof insta...
...And 19 more matches
Numbers and dates - JavaScript
n in various bases including decimal, binary, and hexadecimal, as well as the use of the global math object to perform a wide variety of mathematical operations on numbers. numbers in javascript, numbers are implemented in double-precision 64-bit binary format ieee 754 (i.e., a number between ±2−1022 and ±2+1023, or about ±10−308 to ±10+308, with a numeric precision of 53 bits). integer values up to ±253 − 1 can be represented exactly. in addition to being able to represent floating-point numbers, the number type has three symbolic values: +infinity, -infinity, and nan (not-a-number). a more recent addition to javascript is bigint which lets you represent integers that may be very large. there are caveats to using bigint, however; for example, you can't mix and match bigint and n...
... see also javascript data types and structures for context with other primitive types in javascript. ...
... see also javascript data types and structures for context with other primitive types in javascript. you can use four types of number literals: decimal, binary, octal, and hexadecimal. ...
...And 19 more matches
Math.ceil() - JavaScript
a number up to the next largest integer. note: math.ceil(null) returns integer 0 and does not give a nan error. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.ceil(x) parameters x a number. return value the smallest integer greater than or equal to the given number. description because ceil() is a static method of math, you always use it as math.ceil(), rather than as a method of a math object you created (math is not a constructor). examples using math.ceil() the following example shows example usage of math.ceil(). math.ceil(.95); // 1 math.ceil(4); // 4 math.ceil(7.004); // 8 ...
...ples using math.ceil() the following example shows example usage of math.ceil(). math.ceil(.95); // 1 math.ceil(4); // 4 math.ceil(7.004); // 8 math.ceil(-0.95); // -0 math.ceil(-4); // -4 math.ceil(-7.004); // -7 decimal adjustment // closure (function() { /** * decimal adjustment of a number. * * @param {string} type the type of adjustment. ...
...eil(7.004); // 8 math.ceil(-0.95); // -0 math.ceil(-4); // -4 math.ceil(-7.004); // -7 decimal adjustment // closure (function() { /** * decimal adjustment of a number. * * @param {string} type the type of adjustment. * @param {number} value the number. * @param {integer} exp the exponent (the 10 logarithm of the adjustment base). * @returns {number} the adjusted value. */ function decimaladjust(type, value, exp) { // if the exp is undefined or zero... ...
...And 19 more matches
Math.floor() - JavaScript
the math.floor() function returns the largest integer less than or equal to a given number. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.floor(x) parameters x a number. return value a number representing the largest integer less than or equal to the specified number. description because floor() is a static method of math, you always use it as math.floor(), rather than as a method of a math object you created (math is not a constructor). note: math.floor(null) returns 0, not a nan. examples using math.floor() math.floor( 45.95); // 45 math.floor( 45.05); // 45 math.floor( 4 ); // ...
...ath object you created (math is not a constructor). note: math.floor(null) returns 0, not a nan. examples using math.floor() math.floor( 45.95); // 45 math.floor( 45.05); // 45 math.floor( 4 ); // 4 math.floor(-45.05); // -46 math.floor(-45.95); // -46 decimal adjustment /** * decimal adjustment of a number. * * @param {string} type the type of adjustment. ...
...h.floor( 45.95); // 45 math.floor( 45.05); // 45 math.floor( 4 ); // 4 math.floor(-45.05); // -46 math.floor(-45.95); // -46 decimal adjustment /** * decimal adjustment of a number. * * @param {string} type the type of adjustment. * @param {number} value the number. * @param {integer} exp the exponent (the 10 logarithm of the adjustment base). * @returns {number} the adjusted value. */ function decimaladjust(type, value, exp) { // if the exp is undefined or zero... ...
...And 19 more matches
core/promise - Archive of obsolete content
an call a function on the promise to observe either its fulfillment or rejection. if the promise is rejected and the rejection is not explicitly observed, any derived promises will be implicitly rejected for the same reason. in the add-on sdk we follow commonjs promises/a specification and model a promise as an object with a then method, which can be used to get the eventual return (fulfillment) value or thrown exception (rejection): foo().then(function success(value) { // ... }, function failure(reason) { // ... }); if foo returns a promise that gets fulfilled with the value, success callback (the value handler) will be called with that value. however, if the returned promise gets rejected, the failure callback (the error handler) will be called with the reason of an error. propagation...
...nction failure(reason) { // ... }); if foo returns a promise that gets fulfilled with the value, success callback (the value handler) will be called with that value. however, if the returned promise gets rejected, the failure callback (the error handler) will be called with the reason of an error. propagation the then method of a promise returns a new promise that is resolved with the return value of either handler. since a function can either return a value or throw an exception, only one handler will ever be called. var bar = foo().then(function success(value) { // compute something from a value... }, function failure(reason) { // handle an error... ...
...value of either handler. since a function can either return a value or throw an exception, only one handler will ever be called. var bar = foo().then(function success(value) { // compute something from a value... }, function failure(reason) { // handle an error... }); in this example bar is a promise and it's fulfilled by one of two handlers that are responsible for: if handler returns a value, bar will be resolved with it. if handler throws an exception, bar will be rejected with it. if handler returns a promise, bar will "become" that promise. to be more precise it will be resolved with a resolution value of the returned promise, which will appear and feel as if it was that returned promise. if the foo() promise gets rejected and you omit the error handler, the error will propaga...
...And 18 more matches
Advanced text formatting - Learn web development
esc to move focus away from the code area (tab inserts a tab character).</p> <textarea id="code" class="input" style="min-height: 100px; width: 95%"> bacon the glue that binds the world together. eggs the glue that binds the cake together. coffee the drink that gets the world running in the morning. ...
...ts a tab character).</p> <textarea id="code" class="input" style="min-height: 100px; width: 95%"> bacon the glue that binds the world together. eggs the glue that binds the cake together. coffee the drink that gets the world running in the morning. ...
...ans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; background: #f5f9fa; } const textarea = document.getelementbyid('code'); const reset = document.getelementbyid('reset'); const solution = document.getelementbyid('solution'); const output = document.queryselector('.output'); const code = textarea.value; const userentry = textarea.value; function updatecode() { output.innerhtml = textarea.value; } reset.addeventlistener('click', function() { textarea.value = code; userentry = textarea.value; solutionentry = htmlsolution; solution.value = 'show solution'; updatecode(); }); solution.addeventlistener('click', function() { if(solution.value === 'show solution') { textarea.value ...
...And 18 more matches
A first splash into JavaScript - Learn web development
padding: 3px; } </style> </head> <body> <h1>number guessing game</h1> <p>we have selected a random number between 1 and 100. see if you can guess it in 10 turns or fewer. ...
...you got it right!'; lastresult.style.backgroundcolor = 'green'; loworhi.textcontent = ''; setgameover(); } else if (guesscount === 10) { ...
...t = ''; setgameover(); } else { lastresult.textcontent = 'wrong!'; lastresult.style.backgroundcolor = 'red'; if(userguess < randomnumber) { loworhi.textcontent = 'last guess was too low!' ; } else if(userguess > randomnumber) { loworhi.textcontent = 'last guess was too high!'; } } guesscount++; guessfield.value = ''; } guesssubmit.addeventlistener('click', checkguess); function setgameover() { guessfield.disabled = true; guesssubmit.disabled = true; resetbutton = document.createelement('button'); resetbutton.textcontent = 'start new game'; document.body.append(resetbutton); resetbutton.addeventlistener('click', resetgame); } function resetgame()...
...And 18 more matches
IAccessibleText
ia2_text_boundary_sentence is optional. when a method doesn't implement this method it must return s_false. typically this feature would not be implemented by an application. ...
... textbeforeoffset([in] long offset, [in] enum ia2textboundarytype boundarytype, [out] long startoffset, [out] long endoffset, [out] bstr text ); methods addselection() adds a text() selection(). hresult addselection( [in] long startoffset, [in] long endoffset ); parameters startoffset starting offset ( 0 based). endoffset offset of first character after new selection() (0 based). return value e_invalidarg if bad [in] passed. s_ok. attributes() returns text() attributes. [propget] hresult attributes( [in] long offset, [out] long startoffset, [out] long endoffset, [out] bstr textattributes ); parameters offset text() offset (0 based) startoffset the starting offset of the character range over which all text() attributes match those of offset. (0 based) endoffset the offset of ...
...ng offset of the character range over which all text() attributes match those of offset. (0 based) endoffset the offset of the first character past the character range over which all text() attributes match those of offset. (0 based) textattributes a string of attributes describing the text(). the attributes are described in the; text attributes specification on the iaccessible2 web site. return value e_invalidarg if bad [in] passed, [out] values are 0s and null respectively. s_false if there is nothing to return, [out] values are 0s and null respectively. s_ok. caretoffset() returns the position of the caret. returns the 0-based offset of the caret within the text(). if the text() is implemented as a tree of text() objects with embed characters in higher levels representing substrings of chil...
...And 18 more matches
nsIMsgSearchSession
use: var searchsession = components.classes["@mozilla.org/messenger/searchsession;1"] .createinstance(components.interfaces.nsimsgsearchsession); to use the instance append search terms, set the scope, and then call search(). ...
...ssion = components.classes["@mozilla.org/messenger/searchsession;1"] .createinstance(components.interfaces.nsimsgsearchsession); to use the instance append search terms, set the scope, and then call search(). ...
... components.classes["@mozilla.org/messenger/searchsession;1"] .createinstance(components.interfaces.nsimsgsearchsession); to use the instance append search terms, set the scope, and then call search(). ...
...And 18 more matches
nsITreeView
yclecell(in long row, in nsitreecolumn col); void cycleheader(in nsitreecolumn col); void drop(in long row, in long orientation, in nsidomdatatransfer datatransfer); astring getcellproperties(in long row, in nsitreecolumn col, in nsisupportsarray properties obsolete since gecko 22); astring getcelltext(in long row, in nsitreecolumn col); astring getcellvalue(in long row, in nsitreecolumn col); astring getcolumnproperties(in nsitreecolumn col, in nsisupportsarray properties obsolete since gecko 22); astring getimagesrc(in long row, in nsitreecolumn col); long getlevel(in long index); long getparentindex(in long rowindex); long getprogressmode(in long row, in nsitreecolumn col); astring getrowproper...
...read only. selection nsitreeselection the sele...
...read only. selection nsitreeselection the selection for this view. c...
...And 18 more matches
Checking when a deadline is due - Web APIs
ng. number inputs for the hour and minute parts of the deadline. on browsers that support type="number", you get a nice little up and down arrow number picker. on mobile platforms you tend to get a numeric keypad for entering data, which is helpful. on others you just get a standard text input, which is okay. <select> elements for inputting the day, month and year of the deadline. because these values are the most ambiguous for users to enter (7, sunday, sun? 04, 4, april, apr? 2013, '13, 13?), i decided the best solution was to give them a choice to pick from, which also saves on annoying typing for mobile users. the days are recorded as numerical days of the month, the months are recorded as full month names, and the years are recorded as full four digit year numbers. when the form's subm...
...ve them a choice to pick from, which also saves on annoying typing for mobile users. the days are recorded as numerical days of the month, the months are recorded as full month names, and the years are recorded as full four digit year numbers. when the form's submit button is pressed, we run the adddata() function, which starts like this: function adddata(e) { e.preventdefault(); if(title.value == '' || hours.value == null || minutes.value == null || day.value == '' || month.value == '' || year.value == null) { note.innerhtml += '<li>data not submitted — form incomplete.</li>'; return; } in this segment, we check to see if the form fields have all been filled in. if not, we drop a message into our developer notifications pane (see the bottom left of the app ui) to tell the...
...filled in. if not, we drop a message into our developer notifications pane (see the bottom left of the app ui) to tell the user what is going on, and exit out of the function. ...
...And 18 more matches
SVGLength - Web APIs
Web › API › SVGLength
svg length interface the svglength interface correspond to the <length> basic data type. an svglength object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. ...
... svg length interface the svglength interface correspond to the <length> basic data type. an svglength object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. ...
...s that attempts to modify the object will result in an exception being thrown. ...
...And 18 more matches
Border-radius generator - CSS: Cascading Style Sheets
* ui-inputslidermanager */ var inputslidermanager = (function inputslidermanager() { var subscribers = {}; var sliders = []; var inputcomponent = function inputcomponent(obj) { var input = document.createelement('input'); input.setattribute('type', 'text'); input.addeventlistener('click', function(e) { this.select(); }); input.addeventlistener('change', function(e) { var value = parseint(e.target.value); if (isnan(value) === true) setvalue(obj.topic, obj.value); else setvalue(obj.topic, value); }); subscribe(obj.topic, function(value) { input.value = value + obj.unit; }); return input; } var slidercomponent = function slidercomponent(obj, sign) { var slider = document.createelement('div'); var startx = null; var start_value = 0; ...
... true) setvalue(obj.topic, obj.value); else setvalue(obj.topic, value); }); subscribe(obj.topic, function(value) { input.value = value + obj.unit; }); return input; } var slidercomponent = function slidercomponent(obj, sign) { var slider = document.createelement('div'); var startx = null; var start_value = 0; slider.addeventlistener("click", function(e) { setvalue(obj.topic, obj.value + obj.step * sign); }); slider.addeventlistener("mousedown", function(e) { startx = e.clientx; start_value = obj.value; document.body.style.cursor = "e-resize"; document.addeventlistener("mousemove", slidermotion); }); document.addeventlistener("mouseup", function(e) { document.removeeventlistener("mousemove", slidermotion); document.body.style.cur...
...nt.addeventlistener("mousemove", slidermotion); }); document.addeventlistener("mouseup", function(e) { document.removeeventlistener("mousemove", slidermotion); document.body.style.cursor = "auto"; slider.style.cursor = "pointer"; }); var slidermotion = function slidermotion(e) { slider.style.cursor = "e-resize"; var delta = (e.clientx - startx) / obj.sensivity | 0; var value = delta * obj.step + start_value; setvalue(obj.topic, value); } return slider; } var inputslider = function(node) { var min = node.getattribute('data-min') | 0; var max = node.getattribute('data-max') | 0; var step = node.getattribute('data-step') | 0; var value = node.getattribute('data-value') | 0; var topic = node.getattribute('data-topic'); var unit = node.getattribut...
...And 18 more matches
Constraint validation - Developer guides
html5 introduced new mechanisms for forms: it added new semantic types for the <input> element and constraint validation to ease the work of checking the form content on the client side. basic, usual constraints can be checked, without the need for javascript, by setting new attributes; more complex constraints can be tested using the constraint validation api. ...
...e, browsers without html5 and without javascript) or by bad people trying to trick your web application. therefore, like with html4, you need to also validate input constraints on the server side, in a way that is consistent with what is done on the client side. intrinsic and basic constraints in html5, basic constraints are declared in two ways: by choosing the most semantically appropriate value for the type attribute of the <input> element, e.g., choosing the email type automatically creates a constraint that checks whether the value is a valid e-mail address. by setting values on validation-related attributes, allowing basic constraints to be described in a simple way, without the need for javascript. semantic input types the intrinsic constraints for the type attribute are: ...
...nstraint that checks whether the value is a valid e-mail address. by setting values on validation-related attributes, allowing basic constraints to be described in a simple way, without the need for javascript. semantic input types the intrinsic constraints for the type attribute are: input type constraint description associated violation <input type="url"> the value must be an absolute url, as defined in the url living standard. typemismatch constraint violation <input type="email"> the value must be a syntactically valid email address, which generally has the format username@hostname.tld. ...
...And 18 more matches
HTML attribute reference - HTML: Hypertext Markup Language
attribute list attribute name elements description accept <form>, <input> list of types the server accepts, typically a file type. accept-charset <form> list of supported charsets. accesskey global attribute keyboard shortcut to activate or add focus to the element. action <form> the uri of a program that processes the information submitted via the form. ...
...let>, <area>, <img>, <input> alternative text in case an image can't be displayed. async <script> executes the script asynchronously. autocapitalize global attribute sets whether input is automatically capitalized when entered by user autocomplete <form>, <input>, <select>, <textarea> indicates whether controls in this form can by default have their values automatically completed by the browser. autofocus <button>, <input>, <keygen>, <select>, <textarea> the element should be automatically focused after the page loaded. autoplay <audio>, <video> the audio or video should play as soon as possible. background <body>, <table>, <td>, <th> specifies the url of an image file. note: although browsers and e...
... color using either a named color or a color specified in the hexadecimal #rrggbb format. note: this is a legacy attribute. please use the css color property instead. cols <textarea> defines the number of columns in a textarea. colspan <td>, <th> the colspan attribute defines the number of columns a cell should span. content <meta> a value associated with http-equiv or name depending on the context. contenteditable global attribute indicates whether the element's content is editable. contextmenu global attribute defines the id of a <menu> element which will serve as the element's context menu. controls <audio>, <video> indicates whether the browser should show playback controls to the us...
...And 18 more matches
<input type="text"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › text
<input> elements of type text create basic single-line text fields. the source for this interactive example is stored in a github repository. if 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, maxlength, minlength, 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 ...
...nput supported common attributes autocomplete, list, maxlength, minlength, 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 validation constraints are in place for the input (see validation for more details), the value may be an empty string (""). additional attributes in addition to the attributes that operate on all <input> elements regardless of their type, text inputs support the following attributes: attribute description ...
... the <datalist> element that contains the optional pre-defined autocomplete options maxlength the maximum number of characters the input should accept minlength the minimum number of characters long the input can be and still be considered valid pattern a regular expression the input's contents must match in order to be valid placeholder an exemplar value to display in the input field whenever it is empty readonly a boolean attribute indicating whether or not the contents of the input should be read-only size a number indicating how many characters wide the input field should be spellcheck controls whether or not to enable spell checking for the input field, or if the default spell checking configuration should ...
...And 18 more matches
Functions - JavaScript
to use a function, you must define it somewhere in the scope from which you wish to call it. see also the exhaustive reference chapter about javascript functions to get to know the details. ...
...the function, enclosed in curly brackets, {...}. for example, the following code defines a simple function named square: function square(number) { return number * number; } the function square takes one parameter, called number. the function consists of one statement that says to return the parameter of the function (that is, number) multiplied by itself. ...
...nction square(number) { return number * number; } the function square takes one parameter, called number. the function consists of one statement that says to return the parameter of the function (that is, number) multiplied by itself. ...
...And 18 more matches
Array.prototype.reduceRight() - JavaScript
the reduceright() method applies a function against an accumulator and each value of the array (from right-to-left) to reduce it to a single value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. see also array.prototype.reduce() for left-to-right. ...
...f the array (from right-to-left) to reduce it to a single value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. see also array.prototype.reduce() for left-to-right. syntax arr.reduceright(callback(accumulator, currentvalue[, index[, array]])[, initialvalue]) parameters callback function to execute on each value in the array, taking four arguments: accumulator the value previously returned in the last invocation of the callback, or initialvalue, if supplied. (see below.) currentvalue the current element being processed in the array. indexoptional the index of the current element being processed in...
...n each value in the array, taking four arguments: accumulator the value previously returned in the last invocation of the callback, or initialvalue, if supplied. (see below.) currentvalue the current element being processed in the array. indexoptional the index of the current element being processed in the array. arrayoptional the array reduceright() was called upon. initialvalueoptional value to use as accumulator to the first call of the callback. if no initial value is supplied, the last element in the array will be used and skipped. calling reduce or reduceright on an empty array without an initial value creates a typeerror. return value the value that results from the reduction. description reduceright executes the callback function once for each element presen...
...And 18 more matches
Array.prototype.map() - JavaScript
ates a new array populated with the results of calling a provided function on every element in the calling 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 let new_array = arr.map(function callback( currentvalue[, index[, array]]) { // return element for new_array }[, thisarg]) parameters callback function that is called for every element of arr. each time callback executes, the returned value is added to new_array. the callback function accepts the following arguments: currentvalue the current element being processed in the array. indexoptional the index of the current element b...
...function that is called for every element of arr. each time callback executes, the returned value is added to new_array. the callback function accepts the following arguments: currentvalue the current element being processed in the array. indexoptional the index of the current element being processed in the array. arrayoptional the array map was called upon. thisargoptional value to use as this when executing callback. return value a new array with each element being the result of the callback function. description map calls a provided callback function once for each element in an array, in order, and constructs a new array from the results. callback is invoked only for indexes of the array which have assigned values (including undefined). it is not called for missi...
...ription map calls a provided callback function once for each element in an array, in order, and constructs a new array from the results. callback is invoked only for indexes of the array which have assigned values (including undefined). it is not called for missing elements of the array; that is: indexes that have never been set; which have been deleted; or which have never been assigned a value. when not to use map() since map builds a new array, using it when you aren't using the returned array is an anti-pattern; use foreach or for-of instead. ...
...And 18 more matches
lang/type - Archive of obsolete content
functions for working with type detection. globals functions isundefined(value) returns true if value is undefined, false otherwise. let { isundefined } = require('sdk/lang/type'); var foo; isundefined(foo); // true isundefined(0); // false parameters value : mixed the variable to check. returns boolean : boolean indicating if value is undefined. isnull(value) returns true if value is null, false otherwise. let { isnull } = require('sdk/lang/type'); isnull(null); // true isnull(false); // false parameters value : mixed the variable to check. returns boolean : boolean indicating if value is null. isstring(value) returns true if value is a string, false otherwise. uses typeof operator to check type, and will only properly detect string primitives: for example, a string c...
...uses typeof operator to check type, and will only properly detect number primitives: for example, a number created with new number() will always return false. ...
...ng, false otherwise. uses typeof operator to check type, and will only properly detect string primitives: for example, a string created with new string() will always return false. let { isstring } = require('sdk/lang/type'); isstring('my string'); // true isstring(100); // false isstring('100'); // true parameters value : mixed the variable to check. returns boolean : boolean indicating if value is a string. ...
...And 17 more matches
tooltip - Archive of obsolete content
l tutorial. ...
...an ellipsis will be used in place ...
...an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. ...
...And 17 more matches
Backgrounds and borders - Learn web development
a of how css works (study css first steps.) objective: to learn how to style the background and border of boxes. styling backgrounds in css the css background property is a shorthand for a number of background longhand properties that we will meet in this lesson. if you discover a complex background property in a stylesheet, it might seem a little hard to understand as so many values can be passed in at once. .box { background: linear-gradient(105deg, rgba(255,255,255,.2) 39%, rgba(51,56,57,1) 96%) center center / 400px 200px no-repeat, url(big-star.png) center no-repeat, rebeccapurple; } we'll return to how the shorthand works later in the tutorial, but first let's have a look at the different things you can do with backgrounds in css, by looking at the individual b...
...s have a look at the different things you can do with backgrounds in css, by looking at the individual background properties. background colors the background-color property defines the background color on any element in css. the property accepts any valid <color>. a background-color extends underneath the content and padding box of the element. in the example below, we have used various color values to add a background color to the box, a heading, and a <span> element. play around with these, using any available <color> value. background images the background-image property enables the display of an image in the background of an element. in the example below, we have two boxes — one has a background image which is larger than the box, the other has a small image of a star. this exam...
...ed to fill the box. in this case, the actual image is just a single star. if you specify a background color in addition to a background image then the image displays on top of the color. try adding a background-color property to the example above to see that in action. controlling background-repeat the background-repeat property is used to control the tiling behavior of images. the available values are: no-repeat — stop the background from repeating altogether. repeat-x — repeat horizontally. repeat-y — repeat vertically. repeat — the default; repeat in both directions. try these values out in the example 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. sizin...
...And 17 more matches
Flexbox - Learn web development
...
...ction>: section { display: flex; } this causes the <section> element to become a flex container, and its children to become flex items. the result of this should be something like so: so, this single declaration gives us everything we need — incredible, right? we have our multiple column layout with equal sized columns, and the columns are all the same height. ...
...le declaration gives us everything we need — incredible, right? we have our multiple column layout with equal sized columns, and the columns are all the same height. this is because the default values given to flex items (the children of the flex container) are set up to solve common problems such as this. to be clear, let's reiterate what is happening here. the element we've given a display value of flex to is acting like a block-level element in terms of how it interacts with the rest of the page, but its children are being laid out as flex items — the next section will explain in more detail what this means. note also that you can use a display value of inline-flex if you wish to lay out an element's children as flex items, but have that element behave like an inline element. the fle...
...And 17 more matches
Fundamental text and font styling - Learn web development
ected strokes. my big red elephant fantasy fonts that are intended to be decorative. my big red elephant font stacks since you can't guarantee the availability of the fonts you want to use on your webpages (even a web font could fail for some reason), you can supply a font stack so that the browser has multiple fonts it can choose from. this simply involves a font-family value consisting of multiple font names separated by commas, e.g. p { font-family: "trebuchet ms", verdana, sans-serif; } in such a case, the browser starts at the beginning of the list and looks to see if that font is available on the machine. if it is, it applies that font to the selected elements. if not, it moves on to the next font, and so on. it is a good idea to provide a suitable generic f...
...to clear whatever foreign matter may 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. ...
...s 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. ems: 1 em is equal to the font size set on the parent element of the current...
...And 17 more matches
Client-side storage - Learn web development
to store data related to user personalization and state, e.g. session ids and access tokens. for more information on cookies see our using http cookies article. new school: web storage and indexeddb the "easier" features we mentioned above are as follows: the web storage api provides a very simple syntax for storing and retrieving smaller, data items consisting of a name and a corresponding value. this is useful when you just need to store some simple data, like the user's name, whether they are logged in, what color to use for the background of the screen, etc. the indexeddb api provides the browser with a complete database system for storing complex data. this can be used for things from complete sets of customer records to even complex data types like audio or video files. you'll le...
...che is usually used in combination with the service worker api, although it doesn't have to be. use of cache and service workers is an advanced topic, and we won't be covering it in great detail in this article, although we will show a simple example in the offline asset storage section below. storing simple data — web storage the web storage api is very easy to use — you store simple name/value pairs of data (limited to strings, numbers, etc.) and retrieve these values when needed. basic syntax let's show you how: first, go to our web storage blank template on github (open this in a new tab). open the javascript console of your browser's developer tools. all of your web storage data is contained within two object-like structures inside the browser: sessionstorage and...
...first one persists data for as long as the browser is open (the data is lost when the browser is closed) and the second one persists data even after the browser is closed and then opened again. we'll use the second one in this article as it is generally more useful. the storage.setitem() method allows you to save a data item in storage — it takes two parameters: the name of the item, and its value. try typing this into your javascript console (change the value to your own name, if you wish!): localstorage.setitem('name','chris'); the storage.getitem() method takes one parameter — the name of a data item you want to retrieve — and returns the item's value. now type these lines into your javascript console: let myname = localstorage.getitem('name'); myname upon typing in t...
...And 17 more matches
IAccessibleTable2
ssible ); hresult unselectcolumn([in] long column ); hresult unselectrow([in] long row ); methods caption() returns the caption for the table. the returned object could be an iaccessible or an iaccessible2. [propget] hresult caption( [out] iunknown accessible ); parameters accessible if the table has a caption then a reference to it is returned, else a null pointer is returned. return value s_false if there is nothing to return, [out] value is null. s_ok. cellat() returns the accessible object at the specified row and column in the table. this object could be an iaccessible or an iaccessible2. [propget] hresult cellat( [in] long row, [in] long column, [out] iunknown cell ); parameters row the 0 based row index for which to retrieve the cell. column the 0 based column index f...
... long row, [in] long column, [out] iunknown cell ); parameters row the 0 based row index for which to retrieve the cell. column the 0 based column index for which to retrieve the cell. cell if both row and column index are valid then the corresponding accessible object is returned that represents the requested cell regardless of whether the cell is currently visible (on the screen). return value e_invalidarg if bad [in] passed, [out] value is null. s_ok. columndescription() returns the description text of the specified column in the table. [propget] hresult columndescription( [in] long column, [out] bstr description ); parameters column the 0 based index of the column for which to retrieve the description. description returns the description text of the specified column in the tabl...
...() returns the description text of the specified column in the table. [propget] hresult columndescription( [in] long column, [out] bstr description ); parameters column the 0 based index of the column for which to retrieve the description. description returns the description text of the specified column in the table if such a description exists. otherwise a null pointer is returned. return value e_invalidarg if bad [in] passed, [out] value is null. s_false if there is nothing to return, [out] value is null. s_ok. iscolumnselected() returns a boolean value indicating whether the specified column is completely selected. [propget] hresult iscolumnselected( [in] long column, [out] boolean isselected ); parameters column 0 based index of the column for which to determine whether it is s...
...And 17 more matches
Working with data
types for use with js-ctypes are represented by ctype objects. these are javascript constructors; as such, they're callable functions that you can use to create new cdata objects of that type. there are several ways you can go about creating new cdata objects. creating uninitialized cdata objects there are three forms of the syntax for creating cdata objects without immediately assigning them a value: var mycdataobj = new type; var mycdataobj = new type(); var mycdataobj = type(); these all do the same thing: they return a new cdata object of the specified type, whose data buffer has been populated entirely with zeroes. note: if type.size is undefined, creating a new object this way will throw a typeerror exception. creating initialized cdata objects similarly, you can initialize cdata...
... type; var mycdataobj = new type(); var mycdataobj = type(); these all do the same thing: they return a new cdata object of the specified type, whose data buffer has been populated entirely with zeroes. note: if type.size is undefined, creating a new object this way will throw a typeerror exception. creating initialized cdata objects similarly, you can initialize cdata objects with specific values at the type of creation by specifying them as a parameter when calling the ctype's constructor, like this: var mycdataobj = new type(value); var mycdataobj = 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 ...
...type of creation by specifying them as a parameter when calling the ctype's constructor, like this: var mycdataobj = new type(value); var mycdataobj = 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 ...
...And 17 more matches
MediaTrackSettings - Web APIs
the mediatracksettings dictionary is used to return the current values configured for each of a mediastreamtrack's settings. these values will adhere as closely as possible to any constraints previously described using a mediatrackconstraints object and set using applyconstraints(), and will adhere to the default constraints for any properties whose constraints haven't been changed, or whose customized constraints couldn't be matched. to learn more about how constraints and settings work, see capabilities, constraints, and settings. properties some or all of the following will be included in the object, either because it's not supported by the browser or because it's not available due to context. ...
...haven't been changed, or whose customized constraints couldn't be matched. to learn more about how constraints and settings work, see capabilities, constraints, and settings. properties some or all of the following will be included in the object, either because it's not supported by the browser or because it's not available due to context. ...
...tings work, see capabilities, constraints, and settings. properties some or all of the following will be included in the object, either because it's not supported by the browser or because it's not available due to context. for example, because rtp doesn't provide some of these values during negotiation of a webrtc connection, a track associated with a rtcpeerconnection will not include certain values, such as facingmode or groupid. ...
...And 17 more matches
Example and tutorial: Simple synth keyboard - Web APIs
to select what periodic waveform to use when generating notes. the volume control first we create the <div> to contain the settings bar, so it can be styled as needed. then we establish a box that will be presented on the left side of the bar and place a label and an <input> element of type "range". ...
...at will be presented on the left side of the bar and place a label and an <input> element of type "range". the range element will typically be presented as a slider control; we configure it to allow any value between 0.0 and 1.0, stepping by 0.01 each position. <div class="settingsbar"> <div class="left"> <span>volume: </span> <input type="range" min="0.0" max="1.0" step="0.01" value="0.5" list="volumes" name="volume"> <datalist id="volumes"> <option value="0.0" label="mute"> <option value="1.0" label="100%"> </datalist> </div> we specify a default value of 0.5, and we provide a <datalist> element which is connected to the range using the name attribute to find an option list whose id matches; in this case, the data set is named "volume". this lets us ...
... the waveform picker on the right side of the settings bar, we place a label and a <select> element named "waveform" whose options correspond to the available waveforms. ...
...And 17 more matches
WindowOrWorkerGlobalScope.setInterval() - Web APIs
alling clearinterval(). this method is defined by the windoworworkerglobalscope mixin. syntax var intervalid = scope.setinterval(func, [delay, arg1, arg2, ...]); var intervalid = scope.setinterval(function[, delay]); var intervalid = scope.setinterval(code, [delay]); parameters func a function to be executed every delay milliseconds. the function is not passed any arguments, and no return value is expected. code an optional syntax allows you to include a string instead of a function, which is compiled and executed every delay milliseconds. this syntax is not recommended for the same reasons that make using eval() a security risk. delayoptional the time, in milliseconds (thousandths of a second), the timer should delay in between executions of the specified function or code. see dela...
...tring instead of a function, which is compiled and executed every delay milliseconds. this syntax is not recommended for the same reasons that make using eval() a security risk. delayoptional the time, in milliseconds (thousandths of a second), the timer should delay in between executions of the specified function or code. ...
... it may be helpful to be aware that setinterval() and settimeout() share the same pool of ids, and that clearinterval() and cleartimeout() can technically be used interchangeably. ...
...And 17 more matches
background-size - 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. spaces not covered by a background image are filled with the background-color property, and the background color will be visible behind background images that have transparency/translucency. ...
... the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. spaces not covered by a background image are filled with the background-color property, and the background color will be visible behind background images that have transparency/translucency. ...
...led with the background-color property, and the background color will be visible behind background images that have transparency/translucency. ...
...And 17 more matches
content - CSS: Cascading Style Sheets
Web › CSS › content
the content css property replaces an element with a generated value. objects inserted using the content property are anonymous replaced elements. ...
... the content css property replaces an element with a generated value. objects inserted using the content property are anonymous replaced elements. ...
... the content css property replaces an element with a generated value. objects inserted using the content property are anonymous replaced elements. ...
...And 17 more matches
font-variant-ligatures - CSS: Cascading Style Sheets
ich ligatures and contextual forms are used in textual content of the elements it applies to. this leads to more harmonized forms in the resulting text. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...sulting text. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 17 more matches
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
css, you have to find a way to translate the analog concept of "color" into a digital form that a computer can use. this is typically done by breaking down the color into components, such as how much of each of a set of primary colors to mix together, or how bright to make the color. as such, there are several ways you can describe color in css. for more detailed discussion of each of the color value types, see the reference for the css <color> unit. keywords a set of standard color names have been defined, letting you use these keywords instead of numeric representations of colors if you choose to do so and there's a keyword representing the exact color you want to use. color keywords include the standard primary and secondary colors (such as red, blue, or orange), shades of gray (from bla...
...senting the exact color you want to use. color keywords include the standard primary and secondary colors (such as red, blue, or orange), shades of gray (from black to white, including colors like darkgray and lightgrey), and a variety of other blended colors including lightseagreen, cornflowerblue, and rebeccapurple. see color keywords in <color> for a list of all available color keywords. rgb values there are three ways to represent an rgb color in css. hexadecimal string notation hexadecimal string notation represents a color using hexadecimal digits to represent each of the color components (red, green, and blue). it may also include a fourth component: the alpha channel (or opacity). each color component can be represented as a number between 0 and 255 (0x00 and 0xff) or, optionally, ...
...digits of the color code. the string is case-insensitive. "#rrggbb" specifies a fully-opaque color whose red component is the hexadecimal number 0xrr, green component is 0xgg, and blue component is 0xbb. "#rrggbbaa" specifies a color whose red component is the hexadecimal number 0xrr, green component is 0xgg, and blue component is 0xbb. ...
...And 17 more matches
<link>: The External Resource Link element - HTML: Hypertext Markup Language
Web › HTML › Element › link
ory. if 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 link an external stylesheet, you'd include a <link> element inside your <head> like this: <link href="main.css" rel="stylesheet"> this simple example provides the path to the stylesheet inside an href attribute, and a rel attribute with a value of stylesheet. the rel stands for "relationship", and is probably one of the key features of the <link> element — the value denotes how the item being linked to is related to the containing document. as you'll see from our link types reference, there are many different kinds of relationship. there are a number of other common types you'll come across. for example, a link to the site's favicon:...
... key features of the <link> element — the value denotes how the item being linked to is related to the containing document. as you'll see from our link types reference, there are many different kinds of relationship. there are a number of other common types you'll come across. for example, a link to the site's favicon: <link rel="icon" href="favicon.ico"> there are a number of other icon rel values, mainly used to indicate special icon types for use on various mobile platforms, e.g.: <link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-icon-114.png" type="image/png"> the sizes attribute indicates the icon size, while the type contains the mime type of the resource being linked. these provide useful hints to allow the browser to choose the most appropriate icon avail...
... media condition is true. for example: <link href="print.css" rel="stylesheet" media="print"> <link href="mobile.css" rel="stylesheet" media="screen and (max-width: 600px)"> some interesting new performance and security features have been added to the <link> element too. take this example: <link rel="preload" href="myfont.woff2" as="font" type="font/woff2" crossorigin="anonymous"> a rel value of preload indicates that the browser should preload this resource (see preloading content with rel="preload" for more details), with the as attribute indicating the specific class of content being fetched. the crossorigin attribute indicates whether the resource should be fetched with a cors request. other usage notes: a <link> element can occur either in the <head> or <body> element, depend...
...And 17 more matches
HTTP Index - HTTP
Web › HTTP › Index
content negotiation, content negotiation reference, http, reference in http, content negotiation is the mechanism that is used for serving different representations of a resource at the same uri, so that the user agent can specify which is best suited for the user (for example, which language of a document, which image format, or which content encoding). 18 list of default accept values accept, content negotiation, http, reference this article documents the default values for the http accept header for specific inputs and browser versions. 19 cross-origin resource policy (corp) http, reference, security cross-origin resource policy is an opt-in mechanism that allows web applications to protect against certain cross-origin requests, such as those i...
... file, using a file:/// url. 30 reason: credential is not supported if the cors header ‘access-control-allow-origin’ is ‘*’ cors, corsnotsupportingcredentials, cross-origin, error, http, https, messages, reasons, security, console, troubleshooting the cors request was attempted with the credentials flag set, but the server is configured using the wildcard ("*") as the value of access-control-allow-origin, which doesn't allow the use of credentials. 31 reason: did not find method in cors header ‘access-control-allow-methods’ cors, corsmethodnotfound, cross-origin, error, http, https, messages, reasons, security, console, troubleshooting the http method being used by the cors request is not included in the list of methods specified by the resp...
...ent by the server. this isn't allowed. 33 reason: expected ‘true’ in cors header ‘access-control-allow-credentials’ cors, corsmissingallowcredentials, cross-origin, error, http, https, messages, reasons, security, console, troubleshooting the cors request requires that the server permit the use of credentials, but the server's access-control-allow-credentials header's value isn't set to true to enable their use. 34 reason: invalid token ‘xyz’ in cors header ‘access-control-allow-headers’ cors, corsinvalidallowheader, cross-origin, error, http, https, messages, reasons, security, console, troubleshooting the response to the cors request that was sent by the server includes an access-control-allow-headers header which includes at least one...
...And 17 more matches
JSON.stringify() - JavaScript
the json.stringify() method converts a javascript object or value to a json string, optionally replacing values if a replacer function is specified or optionally including only the specified properties if a replacer array is specified. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax json.stringify(value[, replacer[, space]]) parameters value the value to convert to a json string. ...
... space optional a string or number object that's used to insert white space into the output json string for readability purposes. ...
...examples and send us a pull request. syntax json.stringify(value[, replacer[, space]]) parameters value the value to convert to a json string. replacer optional a function that alters the behavior of the stringification process, or an array of string and number that serve as an allowlist for selecting/filtering the properties of the value object to be included in the json string. if this value is null or not provided, all properties of the object are included in the resulting json string. space optional a string or number object that's used to insert white space into the output json string for readability purposes. ...
...And 17 more matches
Set - JavaScript
however, this was changed in the ecmascript 2015 specification. see "key equality for -0 and 0" in the browser compatibility table for details. ...
...however, this was changed in the ecmascript 2015 specification. see "key equality for -0 and 0" in the browser compatibility table for details. ...
...however, this was changed in the ecmascript 2015 specification. see "key equality for -0 and 0" in the browser compatibility table for details. ...
...And 17 more matches
preserveAspectRatio - SVG: Scalable Vector Graphics
<svg viewbox="0 0 100 100" width="160" height="60" preserveaspectratio="none" x="0" y="30"> <use href="#smiley" /> </svg> </svg> path { fill: yellow; stroke: black; stroke-width: 8px; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; } rect:hover, rect:active { outline: 1px solid red; } syntax preserveaspectratio="<align> [<meetorslice>]" its value is made of one or two keywords: a required alignment value and an optional "meet or slice" reference as described below: alignment value the alignment value indicates whether to force uniform scaling and, if so, the alignment method to use in case the aspect ratio of the viewbox doesn't match the aspect ratio of the viewport. the alignment value must be one of the following keywords: none...
... case the aspect ratio of the viewbox doesn't match the aspect ratio of the viewport. the alignment value must be one of the following keywords: none do not force uniform scaling. scale the graphic content of the given element non-uniformly if necessary such that the element's bounding box exactly matches the viewport rectangle. note that if <align> is none, then the optional <meetorslice> value is ignored. xminymin - force uniform scaling. align the <min-x> of the element's viewbox with the smallest x value of the viewport. align the <min-y> of the element's viewbox with the smallest y value of the viewport. xmidymin - force uniform scaling. align the midpoint x value of the element's viewbox with the midpoint x value of the viewport. align the <min-y> of the element's v...
...orce uniform scaling. align the <min-x> of the element's viewbox with the smallest x value of the viewport. align the <min-y> of the element's viewbox with the smallest y value of the viewport. xmidymin - force uniform scaling. align the midpoint x value of the element's viewbox with the midpoint x value of the viewport. align the <min-y> of the element's viewbox with the smallest y value of the viewport. xmaxymin - force uniform scaling. align the <min-x>+<width> of the element's viewbox with the maximum x value of the viewport. align the <min-y> of the element's viewbox with the smallest y value of the viewport. xminymid - force uniform scaling. ...
...And 17 more matches
simple-prefs - Archive of obsolete content
experimental store preferences across application restarts. you can store booleans, integers, and string values, and users can configure these preferences in the add-ons manager. this gives users a consistent way to access and modify preferences across different add-ons. this api is for your add-on's preferences. if you need to get and set the general browser preferences, use preferences/service. usage defining and initializing preferences to define preferences and give them initial values, add a new json array called preferences to your package.json file, and give it one entry for each preference: { "fullname": "example add-on", ... "preferences": [{ "name": "somepreference", "title": "some preference title", "description": "some short description f...
...e preferences and give them initial values, add a new json array called preferences to your package.json file, and give it one entry for each preference: { "fullname": "example add-on", ... "preferences": [{ "name": "somepreference", "title": "some preference title", "description": "some short description for the preference", "type": "string", "value": "this is the default string value" }, { "description": "how many of them we have.", "name": "myinteger", "type": "integer", "value": 8, "title": "how many?" }] } each preference is defined by a group of attributes. there are: mandatory attributes that all preferences must have optional attributes attributes that are specific to the prefe...
... this means that it must be a valid javascript identifier. title this is used as a label for the preference in the add-ons manager user interface. optional common attributes these are attributes that all preferences may have: attribute description description this appears below the preference title in the add-ons manager ui. value a default value for the preference. depending on the preference type, this may be an integer, string, or boolean value. hidden a boolean value which, if present and set to true, means that the preference won't appear in the add-ons manager interface, so users of your add-on won't be able to see or alter it. { "name": "myhiddeninteger", "type": "integer", "titl...
...And 16 more matches
Multiple Rules - Archive of obsolete content
the query generates a list of the photos and assigns the title of each photo to the variable '?title'...
...mple, the where element in the first rule defines a condition which matches results that have a title of 'canal'. three attributes are used for this purpose. the subject is the variable from the result that want to compare. in this case, '?title' is used to compare the title. the rel specifies a relation operator to compare with. here 'equals' is the operator used so an exact match is needed. the value attribute is the value to compare to, which here is 'canal'. as the datasource has three photos, one of which has a title of 'canal', this photo will match the first rule and the content's of that rule's action body will be generated. the remaining two photos do not match the first rule, however they do match the second rule, as the second rule has no where clauses. for these two photos, the acti...
...ifferently that the others. in fact, the content for this photo is that of the first rule with the button, whereas the content for the other photos is that of the second rule with the normal images. here is another example for an xml source: <radiogroup datasources="people.xml" ref="*" querytype="xml"> <template> <query expr="person"/> <rule> <where subject="?gender" rel="equals" value="male"/> <action> <radio uri="?" label="?name is male"/> </action> </rule> <rule> <action> <radio uri="?" label="?name is female" disabled="true"/> </action> </rule> </template> </radiogroup> in this example, all male people are matched with the first rule, and a radio button is generated for each one. we assume that anyone that isn't male is...
...And 16 more matches
menuitem - Archive of obsolete content
e [ examples | attributes | properties | methods | related ] a single choice in a menupopup element. it acts much like a button but it is rendered on a menu. more information is available in the xul tutorial. ...
...rendered on a menu. more information is available in the xul tutorial. ...
... checked, closemenu, command, crop, description, disabled, image, key, label, name, selected, tabindex, type, validate, value properties accessibletype, accesskey, command, control, crop, disabled, image, label, labelelement, parentcontainer, selected, tabindex, value style classes menuitem-iconic, menuitem-non-iconic examples <menulist> <menupopup> <menuitem label="option 1" value="1"/> <menuitem label="option 2" value="2"/> <menuitem label="option 3" value="3"/> <menuitem label="option 4" value="4"/> </menupopup> </menulist> attributes acceltext type: string text that appears beside the menu label to indicate the shortcut key (accelerator key) to use to invoke the command. if this value is set, it overrides an assigned key set in t...
...And 16 more matches
panel - Archive of obsolete content
Archive › Mozilla › XUL › panel
onpopuphiding, onpopupshowing, onpopupshown, position, titlebar, top, type properties accessibletype, label, popupboxobject, popup, state methods hidepopup, moveto, openpopup, openpopupatscreen, sizeto examples the following example shows how a panel may be attached to a label. <panel id="thepanel"> <hbox align="start"> <image src="warning.png"/> <vbox> <description value="you have 6 new messages."/> <hbox> <button label="read mail"/> <button label="new message"/> </hbox> </vbox> </hbox> </panel> <description value="6 new messages" popup="thepanel"/> attributes backdrag type: boolean setting the backdrag attribute on a xul panel lets the user move the panel by clicking and dragging anywhere on its background area. ...
...ontrols whether or not the event that caused the popup to be automatically dismissed (or "rolled up") should be consumed or be dispatched as a normal event. if it is not set, it defaults to the platform behavior. if it set to true the rollup event is consumed. if set to false, the rollup event is not consumed. this attribute should be used instead of setconsumerollupevent. fadetype: one of the values belowthe fade attribute, which may only be used with arrow panels, lets you set up a panel that will automatically fade away after a short time. the default is none. nonethe panels doesn't automatically fade away.slowthe panels slowly fades away after a short time.fastthe panels quickly fades away after a short time. flip type: string normally, when a popup opens nea...
... this is a vertical flip. horizontal flipping doesn't normally happen, since this would cause menus to open in strange places. for arrow popups, however, being able to flip horizontally makes sense. this attribute, set to both, permits that behavior. you will not normally have to use this attribute, since it's automatically applied to arrow panels. an arrow panel can also specify a value of slide, which causes the arrow to "slide" instead of flipping when the panel doesn't have room. a sliding panel will have the start (or end) position extended such that the panel can be the requested size, meaning the arrow will no longer be at the start (or end) of the panel - i.e., the arrow will appear to have been slid along the panel to ensure the arrow is still pointing at the anchor. ...
...And 16 more matches
preference - Archive of obsolete content
lement corresponds to a preference which is stored in the user's preferences file. you can connect a user interface element such as a checkbox to a preference element using the user interface element's preference attribute. more information is available in the preferences system article. attributes disabled, instantapply, inverted, name, onchange, readonly, tabindex, type properties defaultvalue, disabled, hasuservalue, inverted, locked, name, preferences, readonly, tabindex, type, value, valuefrompreferences methods reset examples <preferences> <preference id="pref_id" name="preference.name" type="int"/> </preferences> see preferences system for a complete example. attributes disabled type: boolean indicates whether the element is disabled or not. if this attribute is...
...le controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update additional state. instantapply type: boolean if true, the preference will be changed as soon as the user interface is modified. inverted type: boolean for boolean preferences, if this attribute is set to true, it indicates that the value of the preference is the reverse of the user interface element attached to it. for instance, checking the checkbox disables the preference instead of enabling it. name type: string the name of the preference to change. for example, the browser's home page is set with the preference browser.startup.homepage. overview an onchange attribute is an event listener to the object for the...
... change. a change event is fired in different ways for different xul input elements as listed below: onchange type: script code textbox when enter key is pressed radio/check box when the state is changed select list when the selected item is changed what is accessible the script context at this point can only access the following things: global values/functions i.e. window, document, or any of the functions/objects/variables bound to the window object event object example <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findfile-window" title="find files" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="text/javascri...
...And 16 more matches
toolbarbutton - Archive of obsolete content
racters that appears in the label attribute for the element. autocheck type: boolean if this attribute is true or left out, the checked state of the button will be switched each time the button is pressed. if this attribute is false, the checked state must be adjusted manually. when autocheck is true, the button type should be "checkbox" or "radio". checkstate type: integer, values 0, 1, or 2 this attribute may be used to create three state buttons, numbered 0, 1 and 2. when in state 0 or 1, pressing the button will switch to the opposite state. when in state 2, pressing the button will switch to state 0. this means that the button acts like a checkbox except that there is a third state which must be set manually by adjusting the check state. if you wish to have different...
... to state 0. this means that the button acts like a checkbox except that there is a third state which must be set manually by adjusting the check state. if you wish to have different behavior for how the states are adjusted, set the autocheck attribute to false and adjust the state with a script. the type attribute must be set to checkbox for buttons with a check state. constants for the possible values for this attribute are in the nsidomxulbuttonelement interface. checked type: boolean indicates whether the element is checked or not. use hasattribute() to determine whether this attribute is set instead of getattribute(). for buttons, the type attribute must be set to checkbox or radio for this attribute to have any effect. command type: id set to the id of a command element ...
...type: boolean indicates whether the element is checked or not. use hasattribute() to determine whether this attribute is set instead of getattribute(). for buttons, the type attribute must be set to checkbox or radio for this attribute to have any effect. command type: id set to the id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right sid...
...And 16 more matches
Cascade and inheritance - Learn web development
ally apply to the same element. the cascade, and the closely-related concept of specificity, are mechanisms that control which rule applies when there is such a conflict. which rule is styling your element may not be the one you expect, so you need to understand how these mechanisms work. also significant here is the concept of inheritance, which means that some css properties by default inherit values set on the current element's parent element, and some don't. this can also cause some behavior that you might not expect. let's start by taking a quick look at the key things we are dealing with, then we'll look at each in turn and see how they interact with each other and your css. this can seem like a set of tricky concepts to understand. as you get more practice writing css, however, the way...
...have different selectors, but could still apply to the same element. it is basically a measure of how specific a selector's selection will be: an element selector is less specific — it will select all elements of that type that appear on a page — so will get a lower score. a class selector is more specific — it will select only the elements on a page that have a specific class attribute value — so will get a higher score. example time! below we again have two rules that could apply to the h1. the below h1 ends up being colored red — the class selector gives its rule a higher specificity, and so it will be applied even though the rule with the element selector appears further down in the source order. we'll explain specificity scoring and other such things later on. inherita...
... could apply to the h1. the below h1 ends up being colored red — the class selector gives its rule a higher specificity, and so it will be applied even though the rule with the element selector appears further down in the source order. we'll explain specificity scoring and other such things later on. inheritance inheritance also needs to be understood in this context — some css property values set on parent elements are inherited by their child elements, and some aren't. for example, if you set a color and font-family on an element, every element inside it will also be styled with that color and font, unless you've applied different color and font values directly to them. some properties do not inherit — for example if you set a width of 50% on an element, all of its descendant...
...And 16 more matches
IAccessible2
in] long x, [in] long y ); [propget] hresult states([out] accessiblestates states ); [propget] hresult uniqueid([out] long uniqueid ); [propget] hresult windowhandle([out] hwnd windowhandle ); methods attributes() returns the attributes specific to this iaccessible2 object, such as a cell's formula. ...
...accessiblestates states ); [propget] hresult uniqueid([out] long uniqueid ); [propget] hresult windowhandle([out] hwnd windowhandle ); methods attributes() returns the attributes specific to this iaccessible2 object, such as a cell's formula. [propget] hresult attributes( [out] bstr attributes ); parameters attributes return value s_false returned if there is nothing to return, [out] value is null. s_ok. extendedrole() returns the extended role. an extended role is a role which is dynamically generated by the application. it is not predefined by the iaccessible2 specification. [propget] hresult extendedrole( [out] bstr extendedrole ); parameters extendedrole return value s_false if there is nothing to return, [out] value is null. s_ok. extendedstates() returns the extended st...
...extendedstates)] bstr extendedstates, [out] long nextendedstates ); parameters maxextendedstates this parameter is ignored. refer to @ref _arrayconsideration "special consideration when using arrays" for more details. extendedstates this array is allocated by the server. free it with cotaskmemfree. nextendedstates the number of extended states returned; the size of the returned array. return value s_false if there are no states, [out] values are null and 0 respectively. s_ok. groupposition() returns grouping information. used for tree items, list items, tab panel labels, radio buttons, and so on. also used for collections of non-text objects. [propget] hresult groupposition( [out] long grouplevel, [out] long similaritemsingroup, [out] long positioningroup ); parameters grouplevel 1...
...And 16 more matches
nsIHttpChannel
der); acstring getresponseheader(in acstring header); boolean isnocacheresponse(); boolean isnostoreresponse(); void redirectto(in nsiuri anewuri); void setemptyrequestheader(in acstring aheader); void setreferrerwithpolicy(in nsiuri referrer, in unsigned long referrerpolicy); void setrequestheader(in acstring aheader, in acstring avalue, in boolean amerge); void setresponseheader(in acstring header, in acstring value, in boolean merge); void visitoriginalresponseheaders(in nsihttpheadervisitor avisitor); void visitrequestheaders(in nsihttpheadervisitor avisitor); void visitresponseheaders(in nsihttpheadervisitor avisitor); constants constant description referrer_p...
...een opened. redirectionlimit unsigned long this attribute specifies the number of redirects this channel is allowed to make. if zero, the channel will fail to redirect and will generate a ns_error_redirect_loop failure status. note: an http redirect results in a new channel being created. if the new channel supports nsihttpchannel, then it will be assigned a value to its redirectionlimit attribute one less than the value of the redirected channel's redirectionlimit attribute. the initial value for this attribute may be a configurable preference (depending on the implementation). referrer nsiuri get or set the uri of the http referer: header. this is the address (uri) of the resource from which this channel's uri was obtained (s...
...rity checks (e.g., a "https://" url will never be sent as the referrer for a plaintext http request). the implementation is not required to throw an exception when the referrer uri is rejected. exceptions thrown ns_error_in_progress if set after the channel has been opened. ns_error_failure if used for setting referrer during visitrequestheaders(). getting the value will not throw. requestmethod acstring set or get the http request method (default is "get"). setter is case insensitive; getter returns an uppercase string. this attribute may only be set before the channel is opened. note: the data for a "post" or "put" request can be configured via nsiuploadchannel. however, after setting the upload data, it may be n...
...And 16 more matches
Using the slider role - Accessibility
see the examples section below for more information. ...
...see the examples section below for more information. ...
...see the examples section below for more information. keyboard and focus the slider should be keyboard focusable and operable. ...
...And 16 more matches
attr() - CSS: Cascading Style Sheets
Web › CSS › attr
note: the attr() function can be used with any css property, but support for properties other than content is experimental, and support for the type-or-unit parameter is sparse. the attr() css function is used to retrieve the value of an attribute of the selected element and use it in the stylesheet. it can also be used on pseudo-elements, in which case the value of the attribute on the pseudo-element's originating element is returned. ...
...lso be used on pseudo-elements, in which case the value of the attribute on the pseudo-element's originating element is returned. /* simple usage */ attr(data-count); attr(title); /* with type */ attr(src url); attr(data-count number); attr(data-width px); /* with fallback */ attr(data-count number, 0); attr(src url, ""); attr(data-width px, inherit); attr(data-something, "default"); syntax values attribute-name is the name of an attribute on the html element referenced in the css. <type-or-unit> is a keyword representing either the type of the attribute's value, or its unit, as in html some attributes have implicit units. if the use of <type-or-unit> as a value for the given attribute is invalid, the attr() expression will be invalid too. if omitted, it defaults to string. the li...
...te-name is the name of an attribute on the html element referenced in the css. <type-or-unit> is a keyword representing either the type of the attribute's value, or its unit, as in html some attributes have implicit units. if the use of <type-or-unit> as a value for the given attribute is invalid, the attr() expression will be invalid too. if omitted, it defaults to string. the list of valid values are: keyword associated type comment default value string <string> the attribute value is treated as a css <string>. ...
...And 16 more matches
Array.prototype.sort() - JavaScript
the time and space complexity of the sort cannot be guaranteed as it depends on the implementation. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...y. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.sort([comparefunction]) parameters comparefunction optional specifies a function that defines the sort order. if omitted, the array elements are converted to strings, then sorted according to each character's unicode code point value. firstel the first element for comparison. secondel the second element for comparison. return value the sorted array. note that the array is sorted in place, and no copy is made. description if comparefunction is not supplied, all non-undefined array elements are sorted by converting them to strings and comparing strings in utf-16 code units order. for example, "banana" comes b...
...paring strings in utf-16 code units order. for example, "banana" comes before "cherry". in a numeric sort, 9 comes before 80, but because numbers are converted to strings, "80" comes before "9" in the unicode order. all undefined elements are sorted to the end of the array. note : in utf-16, unicode characters above \uffff are encoded as two surrogate code units, of the range \ud800-\udfff. ...
...And 16 more matches
Intl.DateTimeFormat.prototype.formatToParts() - JavaScript
the intl.datetimeformat.prototype.formattoparts() method allows locale-aware formatting of strings produced by datetimeformat formatters. syntax datetimeformat.formattoparts(date) parameters date optional the date to format. return value an array of objects containing the formatted date in parts. description the formattoparts() method is useful for custom formatting of date strings. it returns an array of objects containing the locale-specific tokens from which it possible to build custom strings while preserving the locale-specific parts. the structure the formattoparts() method returns, looks like this: [ { type: 'day', value: '17' }, { type: 'weekday', value: 'monday' } ] possible types are the following: day the string used for the day, for example "17". dayperiod t...
... day, for example "17". dayperiod the string used for the day period, for example, "am", "pm", "in the morning", or "noon" era the string used for the era, for example "bc" or "ad". fractionalsecond the string used for the fractional seconds, for example "0" or "00" or "000". hour the string used for the hour, for example "3" or "03". literal the string used for separating date and time values, for example "/", ",", "o'clock", "de", etc. minute the string used for the minute, for example "00". month the string used for the month, for example "12". relatedyear the string used for the related 4-digit gregorian year, in the event that the calendar's representation would be a yearname instead of a year, for example "2019". second the string used for the second, for example "07" o...
...nddigits: 3, hour12: true, timezone: 'utc' }); formatter.format(date); // "monday, 12/17/2012, 3:00:42.000 am" however, in many user interfaces there is a desire to customize the formatting of this string. ...
...And 16 more matches
Proxy - JavaScript
d"; } return reflect.get(...arguments); }, }; const proxy3 = new proxy(target, handler3); console.log(proxy3.message1); // hello console.log(proxy3.message2); // world constructor proxy() creates a new proxy object. static methods proxy.revocable() creates a revocable proxy object. examples basic example in this simple example, the number 37 gets returned as the default value when the property name is not in the object. it is using the get handler. const handler = { get: function(obj, prop) { return prop in obj ? obj[prop] : 37; } }; const p = new proxy({}, handler); p.a = 1; p.b = undefined; console.log(p.a, p.b); // 1, undefined console.log('c' in p, p.c); // false, 37 no-op forwarding proxy in this example, we are using a native javascr...
...rations that are applied to it. const target = {}; const p = new proxy(target, {}); p.a = 37; // operation forwarded to the target console.log(target.a); // 37 // (the operation has been properly forwarded!) note that while this "no-op" works for javascript objects, it does not work for native browser objects like dom elements. ...
...eration forwarded to the target console.log(target.a); // 37 // (the operation has been properly forwarded!) note that while this "no-op" works for javascript objects, it does not work for native browser objects like dom elements. validation with a proxy, you can easily validate the passed value for an object. this example uses the set handler. ...
...And 16 more matches
fill - SVG: Scalable Vector Graphics
Web › SVG › Attribute › fill
ircle with a radius of 40. --> <circle cx="250" cy="50" r="20"> <animate attributetype="xml" attributename="r" from="0" to="40" dur="5s" fill="freeze" /> </circle> </svg> altglyph warning: as of svg2 <altglyph> is deprecated and shouldn't be used. for <altglyph>, fill is a presentation attribute that defines the color of the glyph. ...
... <circle cx="250" cy="50" r="20"> <animate attributetype="xml" attributename="r" from="0" to="40" dur="5s" fill="freeze" /> </circle> </svg> altglyph warning: as of svg2 <altglyph> is deprecated and shouldn't be used. for <altglyph>, fill is a presentation attribute that defines the color of the glyph. ...
...warning: as of svg2 <altglyph> is deprecated and shouldn't be used. for <altglyph>, fill is a presentation attribute that defines the color of the glyph. value <paint> default value black animatable yes note: as a presentation attribute fill can be used as a css property. animate for <animate>, fill defines the final state of the animation. ...
...And 16 more matches
xlink:href - SVG: Scalable Vector Graphics
<image>, <lineargradient>, <mpath>, <pattern>, <radialgradient>, <script>, <set>, <textpath>, <tref>, and <use>} html, body, svg { height: 100%; } <svg viewbox="0 0 160 40" xmlns="http://www.w3.org/2000/svg"> <a xlink:href="https://developer.mozilla.org/"><text x="10" y="25">mdn web docs</text></a> </svg> a for <a>, xlink:href defines the location of the referenced object. value <iri> default value none animatable yes altglyph for <altglyph>, xlink:href defines the reference either to a <glyph> element in an svg document fragment or to an <altglyphdef> element. if the reference is to a <glyph> element and that glyph is available, then that glyph is rendered instead of the characters that are inside of the <altglyph> element. if th...
... and that glyph is available, then that glyph is rendered instead of the characters that are inside of the <altglyph> element. if the reference is to an <altglyphdef> element, then if an appropriate set of alternate glyphs is located from processing the <altglyphdef> element, then those alternate glyphs are rendered instead of the characters that are inside of the <altglyph> element. value <iri> default value none animatable no animate, animatecolor, animatemotion, animatetransform, set for <animate>, <animatecolor>, <animatemotion>, <animatetransform>, and <set>, xlink:href defines the reference to the element which is the target of this animation and which therefore will be modified over time. the target element must be part of the current svg ...
... if the xlink:href attribute is not provided, the target element will be the immediate parent element of the current animation element. ...
...And 16 more matches
button - Archive of obsolete content
cters that appears in the label attribute for the element. autocheck type: boolean if this attribute is true or left out, the checked state of the button will be switched each time the button is pressed. if this attribute is false, the checked state must be adjusted manually. when autocheck is true, the button type should be "checkbox" or "radio". checkstate type: integer, values 0, 1, or 2 this attribute may be used to create three state buttons, numbered 0, 1 and 2. when in state 0 or 1, pressing the button will switch to the opposite state. when in state 2, pressing the button will switch to state 0. this means that the button acts like a checkbox except that there is a third state which must be set manually by adjusting the check state. if you wish to have different...
... to state 0. this means that the button acts like a checkbox except that there is a third state which must be set manually by adjusting the check state. if you wish to have different behavior for how the states are adjusted, set the autocheck attribute to false and adjust the state with a script. the type attribute must be set to checkbox for buttons with a check state. constants for the possible values for this attribute are in the nsidomxulbuttonelement interface. checked type: boolean indicates whether the element is checked or not. use hasattribute() to determine whether this attribute is set instead of getattribute(). for buttons, the type attribute must be set to checkbox or radio for this attribute to have any effect. command type: id set to the id of a command elemen...
...pe: boolean indicates whether the element is checked or not. use hasattribute() to determine whether this attribute is set instead of getattribute(). for buttons, the type attribute must be set to checkbox or radio for this attribute to have any effect. command type: id set to the id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right sid...
...And 15 more matches
tabbrowser - Archive of obsolete content
this read-only property contains the nsidocumentcharsetinfo object for the document which is used to handle which character set should be used to display the document. the properties of the nsidocumentcharsetinfo object were merged into the docshell in gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9). homepage type: string home page url this property holds the value of the user's home page setting. markupdocumentviewer type: nsimarkupdocumentviewer this read-only property contains the nsimarkupdocumentviewer which is responsible for drawing the document. securityui type: nsisecurebrowserui the read-only property holds an object which may be used to determine the security level of the loaded document. selected...
...rowserui the read-only property holds an object which may be used to determine the security level of the loaded document. selectedbrowser type: browser element this read-only property returns the currently displayed browser element. selectedtab type: tab element a reference to the currently selected tab, which will always be one of the tab elements in the tabs element. assign a value to this property to modify the currently selected tab. sessionhistory type: nsishistory this read-only property contains the nsishistory object which holds the session history. tabcontainer type: tabs element returns the tabs element that contains the tabs. this is useful for add-ons that need to use events related to tabs in the browser window. tabs type: array...
...the progress listener should implement the nsiwebprogresslistener interface. addtab( url, referreruri, charset, postdata, owner, allowthirdpartyfixup ) addtab( url, {referreruri: ..., charset: ..., postdata: ..., owner: ..., allowthirdpartyfixup: ..., relatedtocurrent: ... }) return type: tab element opens a n...
...And 15 more matches
Graceful asynchronous programming with Promises - Learn web development
onse => response.blob() which is shorthand for function(response) { return response.blob(); } unfortunately, we need to do slightly more than this. fetch promises do not fail on 404 or 500 errors — only on something catasrophic like a network failure. instead, they succeed, but with the response.ok property set to false. to produce an error on a 404, for example, we need to check the value of response.ok, and if false, throw an error, only returning the blob if it is true. this can be done like so — add the following lines below your first line of javascript. let promise2 = promise.then(response => { if (!response.ok) { throw new error(`http error! status: ${response.status}`); } else { return response.blob(); } }); each call to .then() creates a new promis...
...e dom, so the image will display on the page! if you save the html file you've just created and load it in your browser, you'll see that the image is displayed in the page as expected. good work! note: you will probably notice that these examples are somewhat contrived. you could just do away with the whole fetch() and blob() chain, and just create an <img> element and set its src attribute value to the url of the image file, coffee.jpg. we did, however, pick this example because it demonstrates promises in a nice simple fashion, rather than for its real-world appropriateness. responding to failure something is missing — currently, there is nothing to explicitly handle errors if one of the promises fails (rejects, in promise-speak). we can add error handling by running the .catch() m...
... note: .then()/.catch() blocks in promises are basically the async equivalent of a try...catch block in sync code. bear in mind that synchronous try...catch won't work in async code. promise terminology recap there was a lot to cover in the above section, so let's go back over it quickl...
...And 15 more matches
Storing the information you need — Variables - Learn web development
t variables. tools you need throughout this article, you'll be asked to type in lines of code to test your understanding of the content. if you are using a desktop browser, the best place to type your sample code is your browser's javascript console (see what are browser developer tools for more information on how to access this tool). what is a variable? a variable is a container for a value, like a number we might use in a sum, or a string that we might use as part of a sentence. but one special thing about variables is that their contained values can change. let's look at a simple example: <button>press me</button> const button = document.queryselector('button'); button.onclick = function() { let name = prompt('what is your name?'); alert('hello ' + name + ', nice to see you...
... at a simple example: <button>press me</button> const button = document.queryselector('button'); button.onclick = function() { let name = prompt('what is your name?'); alert('hello ' + name + ', nice to see you!'); } in this example pressing the button runs a couple of lines of code. the first line pops a box up on the screen that asks the reader to enter their name, and then stores the value in a variable. the second line displays a welcome message that includes their name, taken from the variable value. to understand why this is so useful, let's think about how we'd write this example without using a variable. it would end up looking something like this: let name = prompt('what is your name?'); if (name === 'adam') { alert('hello adam, nice to see you!'); } else if (name === 'a...
...oices. variables just make sense, and as you learn more about javascript they will start to become second nature. another special thing about variables is that they can contain just about anything — not just strings and numbers. variables can also contain complex data and even entire functions to do amazing things. you'll learn more about this as you go along. note: we say variables contain values. this is an important distinction to make. variables aren't the values themselves; they are containers for values. you can think of them being like little cardboard boxes that you can store things in. declaring a variable to use a variable, you've first got to create it — more accurately, we call this declaring the variable. to do this, we type the keyword var or let followed by the name ...
...And 15 more matches
JavaScript object basics - Learn web development
to work, try comparing your code against our version — see oojs-finished.html (also see it running live). the live version will give you a blank screen, but that's ok — again, open your devtools and try typing in the above commands to see the object structure. so what is going on here? well, an object is made up of multiple members, each of which has a name (e.g. ...
...rsion — see oojs-finished.html (also see it running live). the live version will give you a blank screen, but that's ok — again, open your devtools and try typing in the above commands to see the object structure. so what is going on here? well, an object is made up of multiple members, each of which has a name (e.g. name and age above), and a value (e.g. ['bob', 'smith'] and 32). each name/value pair must be separated by a comma, and the name and value in each case are separated by a colon. the syntax always follows this pattern: const objectname = { member1name: member1value, member2name: member2value, member3name: member3value }; the value of an object member can be pretty much anything — in our person object we've got a string, a number, two arrays, and two functions. the fi...
...ct name (person) acts as the namespace — it must be entered first to access anything encapsulated inside the object. next you write a dot, then the item you want to access — this can be the name of a simple property, an item of an array property, or a call to one of the object's methods, for example: person.age person.interests[1] person.bio() sub-namespaces it is even possible to make the value of an object member another object. for example, try changing the name member from name: ['bob', 'smith'], to name : { first: 'bob', last: 'smith' }, here we are effectively creating a sub-namespace. this sounds complex, but really it's not — to access these items you just need to chain the extra step onto the end with another dot. try these in the js console: person.name.first person.
...And 15 more matches
JSAPI User Guide
n status; } each jsnative has the same signature, regardless of what arguments it expects to receive from javascript. the javascript arguments to the function are given in argc and vp. argc tells how many actual arguments the caller passed, and js_argv(cx, vp) returns an array of those arguments. the arguments do not have native c++ types like int and float; rather, they are jsvals, javascript values. the native function uses js_convertarguments to convert the arguments to c++ types and store them in local variables. the native function uses js_set_rval(cx, vp, val) to store its javascript return value. on success, a jsnative must call js_set_rval and return true. the value passed to js_set_rval is returned to the javascript caller. on failure, a jsnative calls an error-reporting function,...
... script that uses global as the global object can call them, just as any web page can call alert. in the environment we have created, the "hello world" script looks like this: system("echo hello world"); jsapi concepts this section aims to fill in the major gaps in the picture of the jsapi presented so far. to do anything useful with spidermonkey, you must read all three sections. javascript values main article: js::value javascript is a dynamically typed language: variables and properties do not have a type that is fixed at compile time. how can a statically typed language, like c or c++, in which all variables have types, interact with javascript? the jsapi provides a data type, js::value (also with a deprecated jsval typedef), which can contain javascript values of any type. a js::val...
...s a dynamically typed language: variables and properties do not have a type that is fixed at compile time. how can a statically typed language, like c or c++, in which all variables have types, interact with javascript? ...
...And 15 more matches
nsIVariant
aswstring(); native code only! void getaswstringwithsize(out pruint32 size, [size_is(size), retval] out wstring str); native code only! attributes attribute type description datatype pruint16 read only. native code only! methods native code only!getasacstring acstring getasacstring(); parameters none. return value 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. violates the xpcom interface guidelines getasarray() nsresult getasarray( out pruint16 type, out nsiid iid, out ...
... out pruint32 count, out voidptr ptr ); parameters type the type of the array elements. iid the iid of the array elements, if they are interface pointers. count the number of elements in the array. ptr a copy of the array of underlying elements. (reference counted elements are not cloned, but their reference count is increased.) return value native code only!getasastring astring getasastring(); parameters none. return value the internal value is converted to a utf16 string. arrays and interface pointers cannot be converted to a string. native code only!getasautf8string autf8string getasautf8string(); parameters none. return value the internal value is converted to a utf8 string. an iso-8859-1 string is widened to a utf16 string fi...
...rays and interface pointers cannot be converted to a string. native code only!getasautf8string autf8string getasautf8string(); parameters none. return value the internal value is converted to a utf8 string. an iso-8859-1 string is widened to a utf16 string first. arrays and interface pointers cannot be converted to a string. native code only!getasbool prbool getasbool(); parameters none. return value if possible, the internal value is converted to a double, which is then compared to zero. native code only!getaschar char getaschar(); parameters none. return value if the internal value is a string, it is first converted to a double, if possible. ...
...And 15 more matches
Debugger.Frame - Firefox Developer Tools
to handler methods to report events in the debuggee are never considered visible frames.) invocation functions and “debugger” frames aninvocation function is any function in this interface that allows the debugger to invoke code in the debuggee: debugger.object.prototype.call, debugger.frame.prototype.eval, and so on. while invocation functions differ in the code to be run and how to pass values to it, they all follow this general procedure: letolder be the youngest visible frame on the stack, or null if there is no such frame. (this is never one of the the debugger’s own frames; those never appear as debugger.frame instances.) push a "debugger" frame on the stack, witholder as its older property. invoke the debuggee code as appropriate for the given invocation function...
...iate for the given invocation function, with the "debugger" frame as its continuation. for example, debugger.frame.prototype.eval pushes an "eval" frame for code it runs, whereas debugger.object.prototype.call pushes a "call" frame. when the debuggee code completes, whether by returning, throwing an exception or being terminated, pop the "debugger" frame, and return an appropriate completion value from the invocation function to the debugger. when a debugger calls an invocation function to run debuggee code, that code’s continuation is the debugger, not the next debuggee code frame. pushing a "debugger" frame makes this continuation explicit, and makes it easier to find the extent of the stack created for the invocation. accessor properties of the debugger.frame prototype object a ...
...ee the eval method below). implementation a string describing which tier of the javascript engine this frame is executing in: "interpreter": a frame running in the interpreter. "baseline": a frame running in the unoptimizing, baseline jit. "ion": a frame running in the optimizing jit. "wasm": a frame running in webassembly baseline jit. this the value of this for this frame (a debuggee value). for a wasmcall frame, this property throws a typeerror. older the next-older visible frame, in which control will resume when this frame completes. if there is no older frame, this is null. depth the depth of this frame, counting from oldest to youngest; the oldest frame has a depth of zero. live true if the frame this debugger.frame instance refer...
...And 15 more matches
DevTools API - Firefox Developer Tools
rameters: target {target} - the target the toolbox will debug. toolid {string} - the tool that should be activated. if unspecified the previously active tool is shown. hosttype {string} - the position the toolbox will be placed. one of bottom, side, window, custom. see hosttype for details. hostoptions {object} - an options object passed to the selected host. see hosttype for details. return value: a promise that is fulfilled with the toolbox instance once it has been initialized and the selected tool is loaded. gettoolbox(target) fetch the toolbox object for the given target. parameters: target {target} - the target the toolbox is debugging. return value: toolbox object or undefined if there's no toolbox for the given target.. closetoolbox(target) closes the toolbox f...
... getdefaulttools() returns an array of tooldefinition objects for the built-in tools. ...
...ulfilled once the toolbox has been destroyed. getdefaulttools() returns an array of tooldefinition objects for the built-in tools. getadditionaltools() returns an array of tooldefinition objects for tools added by addons. gettooldefinition(toolid) fetch the tooldefinition object for a tool if it exists and is enabled. parameters: toolid {string} - the id of the tool. return value: a tooldefinition if a tool with the given id exists and is enabled, null otherwise. gettooldefinitionmap() returns a toolid → tooldefinition map for tools that are enabled. gettooldefinitionarray() returns an array of tooldefinition objects for enabled tools sorted by the order they appear in the toolbox. getthemedefinition(themeid) fetch the themedefinition object for the t...
...And 15 more matches
Background audio processing using AudioWorklet - Web APIs
bout those inputs and outputs. the input and output lists the lists of inputs and outputs can be a little confusing at first, even though they're actually very simple once you realize what's going on. let's start at the inside and work our way out. fundamentally, the audio for a single audio channel (such as the left 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 ...
... } output[channelnum][i] = sample; } } }; return true; } this is similar code to the previous sample in many ways, but only the first output—outputlist[0]—is altered. ...
...le code fragment in place to prevent the samples from exceeding the legal range of -1.0 to 1.0 by capping the values; there are other ways to avoid clipping that are perhaps less prone to distortion, but this is a simple example that's better than nothing. lifetime of an audio worklet processor the only means by which you can influence the lifespan of your audio worklet processor is through the value returned by process(), which should be a boolean value indicating whether or not to override the user agent's decision-making as to whether or not your node is still in use. in general, the lifetime policy of any audio node is simple: if the node is still considered to be actively processing audio, it will continue to be used. in the case of an audioworkletnode, the node is considered to be acti...
...And 15 more matches
font-variant-alternates - CSS: Cascading Style Sheets
the font-variant-alternates css property controls the usage of alternate glyphs. these alternate glyphs may be referenced by alternative names defined in @font-feature-values. ...
... the font-variant-alternates css property controls the usage of alternate glyphs. these alternate glyphs may be referenced by alternative names defined in @font-feature-values. ...
... the font-variant-alternates css property controls the usage of alternate glyphs. these alternate glyphs may be referenced by alternative names defined in @font-feature-values. ...
...And 15 more matches
font-variant-numeric - CSS: Cascading Style Sheets
ers. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 15 more matches
shape-outside - CSS: Cascading Style Sheets
ts margin box; shape-outside provides a way to customize this wrapping, making it possible to wrap text around complex objects rather than simple boxes. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...the float area determines the shape around...
...And 15 more matches
Equality comparisons and sameness - JavaScript
which operation you choose depends on what sort of comparison you are looking to perform. briefly: double equals (=...
... which operation you choose depends on what sort of comparison you are looking to perform. briefly: double equals (=...
...tract equality comparison (==) strict equality comparison (===): used by array.prototype.indexof, array.prototype.lastindexof, and case-matching samevaluezero: used by %typedarray% and arraybuffer constructors, as well as map and set operations, and also string.prototype.includes and array.prototype.includes since es2016 samevalue: used in all other places javascript provides three different value-comparison operations: === - strict equality comparison ("strict equality", "identity", "triple equals") == - abstract equality comparison ("loose equality", "double equals") object.is provides samevalue (new in es2015). which operation you choose depends on what sort of comparison you are looking to perform. briefly: double equals (==) will perform a type conversion when comparing two ...
...And 15 more matches
Working with objects - JavaScript
in addition to objects that are predefined in the browser, you can define your own objects. this chapter describes how to use objects, properties, functions, and methods, and how to create your own objects. ...
...in addition to objects that are predefined in the browser, you can define your own objects. this chapter describes how to use objects, properties, functions, and methods, and how to create your own objects. ...
...dinary javascript variables, except for the attachment to objects. the properties of an object define the characteristics of the object. you access the properties of an object with a simple dot-notation: objectname.propertyname like all javascript variables, both the object name (which could be a normal variable) and property name are case sensitive. you can define a property by assigning it a value. ...
...And 15 more matches
Promise.prototype.then() - JavaScript
both arguments are omitted or are provided non-functions, then then will be missing the handler(s), but will not generate any errors. if the promise that then is called on adopts a state (fulfillment or rejection) for which then has no handler, the returned promise simply adopts the final state of the original promise on which then was called. syntax p.then(onfulfilled[, onrejected]); p.then(value => { // fulfillment }, reason => { // rejection }); parameters onfulfilled optional a function called if the promise is fulfilled. this function has one argument, the fulfillment value. if it is not a function, it is internally replaced with an "identity" function (it returns the received argument). onrejected optional a function called if the promise is rejected. this function has on...
...gument, the fulfillment value. if it is not a function, it is internally replaced with an "identity" function (it returns the received argument). onrejected optional a function called if the promise is rejected. this function has one argument, the rejection reason. if it is not a function, it is internally replaced with a "thrower" function (it throws an error it received as argument). return value once a promise is fulfilled or rejected, the respective handler function (onfulfilled or onrejected) will be called asynchronously (scheduled in the current thread loop). the behavior of the handler function follows a specific set of rules. if a handler function: returns a value, the promise returned by then gets resolved with the returned value as its value. doesn't return anything, the pro...
...ive handler function (onfulfilled or onrejected) will be called asynchronously (scheduled in the current thread loop). the behavior of the handler function follows a specific set of rules. if a handler function: returns a value, the promise returned by then gets resolved with the returned value as its value. doesn't return anything, the promise returned by then gets resolved with an undefined value. throws an error, the promise returned by then gets rejected with the thrown error as its value. returns an already fulfilled promise, the promise returned by then gets fulfilled with that promise's value as its value. returns an already rejected promise, the promise returned by then gets rejected with that promise's value as its value. returns another pending promise object, the resolution/r...
...And 15 more matches
Install Manifests - Archive of obsolete content
s xpi file. layout the basic layout of an install manifest is like so: <?xml version="1.0" encoding="utf-8"?> <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <description about="urn:mozilla:install-manifest"> <!-- properties --> </description> </rdf> some properties are required, some are optional. some have simple string values, some are complex resources. required property reference your install manifest must specify these properties correctly otherwise your add-on may not install. id the id of the extension, which must be one of the following: guid (firefox 1.0) a string formatted like so: extensionname@example.org the latter format is significantly easier to generate and manipulate. firefox 1.5 has checkin...
...0e-13a3a9e97384}</em:id> <!--firefox--> <em:minversion>1.5</em:minversion> <em:maxversion>3.0.*</em:maxversion> </description> </em:targetapplication> gecko 1.9 based applications allow you to use the special targetapplication id toolkit@mozilla.org to say that the add-on is compatible with any toolkit app with a toolkit version matching the minversion and maxversion. type an integer value representing the type of add-on. 2 extensions 4 themes 8 locale 32 multiple item package 64 spell check dictionary 128 telemetry experiment 256 webextension experiment examples <em:type>2</em:type> this property was added for firefox 1.5, and is only required for add-on types other than extensions and th...
... 2 extensions 4 themes 8 locale 32 multiple item package 64 spell check dictionary 128 telemetry experiment 256 webextension experiment examples <em:type>2</em:type> this property was added for firefox 1.5, and is only required for add-on types other than extensions and themes. firefox 2 and previous supported a value of 16 to represent plug-ins. in firefox 3 this has been removed. version a version string identifying the version of the add-on being supplied. for firefox/thunderbird 1.0, the format must conform to the rules specified in extension versioning, update and compatibility. for firefox/thunderbird 1.5, see toolkit version format. examples <em:version>2.0</em:version> <em:version>1.0.2</em:versi...
...And 14 more matches
listitem - Archive of obsolete content
he listitem is specified either using listcell elements, or by placing a label attribute directly on the listitem element. by default it contains a single listcell element of type and class appropriate to that of the listitem. more information is available in the xul tutorial. ...
... by default it contains a single listcell element of type and class appropriate to that of the listitem. more information is available in the xul tutorial. attributes accesskey, checked, command, crop, current, disabled, image, label, preference, selected, tabindex, type, value properties accesskey, accessible, checked, control, crop, current, disabled, image, label, selected, tabindex, value style classes listitem-iconic examples <listbox id="thelist"> <listitem label="ruby"/> <listitem label="emerald"/> <listitem label="sapphire" selected="true"/> <listitem label="diamond"/> </listbox> attributes accesskey type: character this should be set to a character that is used as a shortcut key. this should be one of the characters that appears in the label attr...
...type: boolean indicates whether the element is checked or not. use hasattribute() to determine whether this attribute is set instead of getattribute(). for buttons, the type attribute must be set to checkbox or radio for this attribute to have any effect. command type: id set to the id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right sid...
...And 14 more matches
menu - Archive of obsolete content
Archive › Mozilla › XUL › menu
thods | related ] an element, much like a button, that is placed on a menubar. when the user clicks the menu element, the child menupopup of the menu will be displayed. this element is also used to create submenus. more information is available in the xul tutorial. ...
... element is also used to create submenus. more information is available in the xul tutorial. ...
...em label="exit"/> </menupopup> </menu> <menu id="edit-menu" label="edit"> <menupopup id="edit-popup"> <menuitem label="undo"/> <menuitem label="redo"/> </menupopup> </menu> </menubar> attributes acceltext type: string text that appears beside the menu label to indicate the shortcut key (accelerator key) to use to invoke the command. if this value is set, it overrides an assigned key set in the key attribute. this attribute does not apply to menus directly on the menubar. accesskey type: character this should be set to a character that is used as a shortcut key. this should be one of the characters that appears in the label attribute for the element. allowevents type: boolean if true, events are passed to childre...
...And 14 more matches
How CSS is structured - Learn web development
cascade and inheritance section in the next module explains this in detail, including how to calculate specificity. for now, remember that specificity exists. sometimes, css might not apply as you expected because something else in the stylesheet has more specificity. recognizing that more than one rule could apply to an element, is the first step in fixing these kinds of issues. properties and values at its most basic level, css consists of two components: properties: these are human-readable identifiers that indicate which stylistic features you want to modify. for example, font-size, width, background-color. values: each property is assigned a value. this value indicates how to style the property. the example below highlights a single property and value. the property name is color a...
...css declarations are found within css declaration blocks. ...
...css declarations are found within css declaration blocks. in the example below, highlighting identifies the css declaration block.. ...
...And 14 more matches
Images in HTML - Learn web development
imple image on a webpage, we use the <img> element. this is an empty element (meaning that it has no text content or closing tag) that requires a minimum of one attribute to be useful — src (sometimes spoken as its full title, source). the src attribute contains a path pointing to the image you want to embed in the page, which can be a relative or absolute url, in the same way as href attribute values in <a> elements. note: you should read a quick primer on urls and paths to refresh your memory on relative and absolute urls before continuing. so for example, if your image is called dinosaur.jpg, and it sits in the same directory as your html page, you could embed the image like so: <img src="dinosaur.jpg"> if the image was in an images subdirectory, which was inside the same directory a...
... like <img> and <video> are sometimes referred to as replaced elements. this is because the element's content and size are defined by an external resource (like an image or video file), not by the contents of the element itself. note: you can find the finished example from this section running on github (see the source code too.) alternative text the next attribute we'll look at is alt. its value is supposed to be a textual description of the image, for use in situations where the image cannot be seen/displayed or takes a long time to render because of a slow internet connection. for example, our above code could be modified like so: <img src="images/dinosaur.jpg" alt="the head and torso of a dinosaur skeleton; it has a large head with long sharp teeth"> the easiest way t...
...udn.realityripple.com/samples/ec/5a13bd14f6.jpg earlier we said to never hotlink to images on other servers, but this is just for learning purposes, so we'll let you off this one time. we would also like you to: add some alt text, and check that it works by misspelling the image url. set the image's correct width and height (hint: it is 200px wide and 171px high), then experiment with other values to see what the effect is. set a title on the image. if you make a mistake, you can always reset it using the reset button. if you get really stuck, press the show solution button to see an answer: playable code <h2>live output</h2> <div class="output" style="min-height: 50px;"> </div> <h2>editable code</h2> <p class="a11y-label">press esc to move focus away from the code area (tab inser...
...And 14 more matches
Functions — reusable blocks of code - Learn web development
onst mybutton = document.queryselector('button'); mybutton.onclick = function() { alert('hello'); } the above example would require there to be a <button> element available on the page to select and click. you've already seen this structure a few times throughout the course, and you'll learn more about and see it in use in the next article. ...
...s structure a few times throughout the course, and you'll learn more about and see it in use in the next article. ...
...e anonymous functions to just run a load of code in response to an event firing — like a button being clicked — using an event handler. again, this looks something like this: mybutton.onclick = function() { alert('hello'); // i can put as much code // inside here as i want } function parameters some functions require parameters to be specified when you are invoking them — these are values that need to be included inside the function parentheses, which it needs to do its job properly. note: parameters are sometimes called arguments, properties, or even attributes. as an example, the browser's built-in math.random() function doesn't require any parameters. when called, it always returns a random number between 0 and 1: let mynumber = math.random(); the browser's built-in stri...
...And 14 more matches
Arrays - Learn web development
ored in an array, and more besides. prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascript is. objective: to understand what arrays are and how to manipulate them in javascript. what is an array? arrays are generally described as "list-like objects"; they are basically single objects that contain multiple values stored in a list. array objects can be stored in variables and dealt with in much the same way as any other type of value, the difference being that we can access each value inside the list individually, and do super useful and efficient things with the list, like loop through it and do the same thing to every value. maybe we've got a series of product items and their prices stored in an array, ...
...5, [0, 1, 2]]; before proceeding, create a few example arrays. accessing and modifying array items you can then access individual items in the array using bracket notation, in the same way that you accessed the letters in a string. enter the following into your console: shopping[0]; // returns "bread" you can also modify an item in an array by simply giving a single array item a new value. try this: shopping[0] = 'tahini'; shopping; // shopping will now return [ "tahini", "milk", "cheese", "hummus", "noodles" ] note: we've said it before, but just as a reminder — computers start counting from 0! note that an array inside an array is called a multidimensional array. you can access an item inside an array that is itself inside another array by chaining two sets of square b...
...w to do this, consult the useful string methods article for some help, or even better, look at the converting between strings and arrays section of this article. as part of the above line of code, you'll also want to convert the price from a string to a number. if you can't remember how to do this, check out the first strings article. there is a variable called total that is created and given a value of 0 at the top of the code. inside the loop (below // number 4) we want you to add a line that adds the current item price to that total in each iteration of the loop, so that at the end of the code the correct total is printed onto the invoice. you might need an assignment operator to do this. we want you to change the line just below // number 5 so that the itemtext variable is made equal to ...
...And 14 more matches
NSS PKCS11 Functions
nly pk11_setpasswordfunc secmod_loadusermodule load a new pkcs #11 module based on a modulespec. syntax #include "secmod.h" extern secmodmodule *secmod_loadusermodule(char *modulespec, secmodmodule *parent, prbool recurse); parameters this function has the following parameters: modulespec is a pkcs #11 modulespec. parent is the moduledb that presented this module spec. for applications this value should be null. recurse is a boolean indicates whether or not the module should also launch additional pkcs #11 modules. this is only applicable if the loaded module is actually a moduledb rather than a pkcs #11 module (see pkcs11_module_specs). returns the function returns one of these values: if successful, a pointer to a secmodmodule. caller owns the reference if unsuccessful, null. descrip...
...loadusermodule. module will continue to function in the nss infrastructure until unloaded with secmod_unloadusermodule. secmod_unloadusermodule unload a pkcs #11 module. syntax #include "secmod.h" extern secstatus secmod_unloadusermodule(secmodmodule *module); parameters this function has the following parameters: module is the module to be unloaded. returns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. description secmod_unloadusermodule detaches a module from the nss trust domain and unloads it. the module should have previously been loaded by secmod_loadusermodule. secmod_closeuserdb close an already opened user database. note: the database must be in the internal token, and must be one created with secmod_openuserdb(). once the data...
...se is closed, the slot will remain as an empty slot until it's used again with secmod_openuserdb(). syntax #include <pk11pub.h> secstatus secmod_closeuserdb(pk11slotinfo *slot) parameters this function has the following parameter: slot a pointer to a slot info structure. this slot must a a slot created by secmod_openuserdb() at some point in the past. returns the function returns one of these values: if successful, secsuccess). if unsuccessful, secfailure. secmod_openuserdb open a new database using the softoken. syntax #include "pk11pub.h" pk11slotinfo *secmod_openuserdb(const char *modulespec) parameters this function has the following parameters: modulespec is the same data that you would pass to softoken at initialization time under the 'tokens' options. returns the function retur...
...And 14 more matches
Redis Tips
tps://github.com/andymccurdy/redis-py#api-reference select statement not implemented del is 'delete' in python zadd argument order is wrong setex argument order is wrong the default redis port is 6379. in node, create client with explicit host and port like so: > var r = require('redis').createclient(6379, '127.0.0.1') commands are asynchronous. ...
...api-reference select statement not implemented del is 'delete' in python zadd argument order is wrong setex argument order is wrong the default redis port is 6379. in node, create client with explicit host and port like so: > var r = require('redis').createclient(6379, '127.0.0.1') commands are asynchronous. in standard node fashion, first return value is error or null; second return value is result of redis command. ...
...d node fashion, first return value is error or null; second return value is result of redis command. > r.set('foo', 42, console.log) null 'ok' > r.get('foo', console.log) null '42' for the rest of this, i'm going to use the synchronous redis-cli for demonstrations. lines beginning with redis> are input to the redis-cli. things are strings, mostly as you can see from that last example, the values pointed to by keys are strings or they are nil. nil values will be given as null in node, not undefined. but some commands only work with numbers (like incr); for these, if your key can't be parsed as a number, it's an error: redis> set foo pie ok redis> incr foo (error) err value is not an integer or out of range atomic counters i guess that sounds like geiger counters. i mean counte...
...And 14 more matches
DOMException - Web APIs
ng representing a message or description associated with the given error name. domexception.name read only returns a domstring that contains one of the strings associated with an error name. error names common error names are listed here. some apis define their own sets of names, so this is not necessarily a complete list. ...
...error name. domexception.name read only returns a domstring that contains one of the strings associated with an error name. error names common error names are listed here. some apis define their own sets of names, so this is not necessarily a complete list. ...
...ring that contains one of the strings associated with an error name. error names common error names are listed here. some apis define their own sets of names, so this is not necessarily a complete list. note: because historically the errors were identified by a numeric value that corresponded with a named variable defined to have that value, some of the entries below indicate the legacy code value and constant name that were used in the past. indexsizeerror the index is not in the allowed range. ...
...And 14 more matches
PannerNode - Web APIs
thout at least two audio channels! number of inputs 1 number of outputs 1 channel count mode "clamped-max" channel count 2 channel interpretation "speakers" constructor pannernode.pannernode creates a new pannernode object instance. properties inherits properties from its parent, audionode. ...
...utputs 1 channel count mode "clamped-max" channel count 2 channel interpretation "speakers" constructor pannernode.pannernode creates a new pannernode object instance. properties inherits properties from its parent, audionode. the orientation and position value are set and retrieved using different syntaxes, since they're stored as audioparam values. retrieval is done by accessing, for example, pannernode.positionx. while setting the same property is done with pannernode.positionx.value. this is why these values are not marked read only, which is how they appear in the webidl. pannernode.coneinnerangle is a double value describing the angle, in degrees, of a cone inside of which there will be no volume reduction. pannernode.coneoutera...
... done by accessing, for example, pannernode.positionx. while setting the same property is done with pannernode.positionx.value. this is why these values are not marked read only, which is how they appear in the webidl. pannernode.coneinnerangle is a double value describing the angle, in degrees, of a cone inside of which there will be no volume reduction. pannernode.coneouterangle a double value describing the angle, in degrees, of a cone outside of which the volume will be reduced by a constant value, defined by the coneoutergain attribute. ...
...And 14 more matches
SVGSVGElement - Web APIs
attribute of the given <svg> element. svgsvgelement.contentstyletype an svganimatedlength corresponding to the contentstyletype attribute of the given <svg> element. svgsvgelement.viewport an svgrect containing the position and size of the viewport (implicit or explicit) that corresponds to the given <svg> element. ...
... element. svgsvgelement.contentstyletype an svganimatedlength corresponding to the contentstyletype attribute of the given <svg> element. svgsvgelement.viewport an svgrect containing the position and size of the viewport (implicit or explicit) that corresponds to the given <svg> element. when the browser is actually rendering the content, then the position and size values represent the actual values when rendering. ...
... svganimatedlength corresponding to the contentstyletype attribute of the given <svg> element. svgsvgelement.viewport an svgrect containing the position and size of the viewport (implicit or explicit) that corresponds to the given <svg> element. when the browser is actually rendering the content, then the position and size values represent the actual values when rendering. the position and size values are unitless values in the coordinate system of the parent element. if no parent element exists (i.e., <svg> element represents the root of the document tree), if this svg document is embedded as part of another document (e.g., via the html <object> element), then the position and size are unitless values in the coordinate system of the parent document. (if the parent uses css or xsl layout, the...
...And 14 more matches
Controlling multiple parameters with ConstantSourceNode - Web APIs
this article demonstrates how to use a constantsourcenode to link multiple parameters together so they share the same value, which can be changed by simply setting the value of the constantsourcenode.offset parameter. you may have times when you want to have multiple audio parameters be linked so they share the same value even while being changed in some way. for example, perhaps you have a set of oscillators, and two of them need to share the same, configurable volume, or you have a filter that's been applied to certain inputs but not to all of them. ...
...node.offset parameter. you may have times when you want to have multiple audio parameters be linked so they share the same value even while being changed in some way. for example, perhaps you have a set of oscillators, and two of them need to share the same, configurable volume, or you have a filter that's been applied to certain inputs but not to all of them. ...
... run at a more appropriate priority level than your code. the solution is simple, and it involves using an audio node type which, at first glance, doesn't look all that useful: constantsourcenode. the technique this is actually a really easy way to do something that sounds like it might be hard to do. you simply need to create a constantsourcenode and connect it to all of the audioparams whose values should be linked to always match each other. since constantsourcenode's offset value is simply sent straight through to all of its outputs, it acts as a splitter for that value, sending it to each connected parameter. the diagram below shows how this works; an input value, n, is set as the value of the constantsourcenode.offset property. the constantsourcenode can have as many outputs as necess...
...And 14 more matches
Aligning Items in a Flex Container - CSS: Cascading Style Sheets
to a container, the child items all become flex items arranged in a row. they will all stretch to be as tall as the tallest item, as that item is defining the height of the items on the cross axis. if your flex container has a height set, then the items will stretch to that height, regardless of how much content is in the item. ...
...e tallest item, as that item is defining the height of the items on the cross axis. if your flex container has a height set, then the items will stretch to that height, regardless of how much content is in the item. the reason the items become the same height is that the initial value of align-items, the property that controls alignment on the cross axis, is set to stretch. we can use other values to control how the items align: align-items: flex-start align-items: flex-end align-items: center align-items: stretch align-items: baseline in the live example below, the value of align-items is stretch. try the other values and see how all of the items align against each other in the flex container. aligning one item with align-self the align-items property sets the align-self pr...
... in this next live example, the flex container has align-items: flex-start, which means the items are all aligned to the start of the cross axis. ...
...And 14 more matches
Using CSS custom properties (variables) - CSS: Cascading Style Sheets
custom properties (sometimes referred to as css variables or cascading variables) are entities defined by css authors that contain specific values to be reused throughout a document. they are set using custom property notation (e.g., --main-color: black;) and are accessed using the var() function (e.g., color: var(--main-color);). complex websites have very large amounts of css, often with a lot of repeated values. for example, the same color might be used in hundreds of different places, requiring global search and replace if that color needs to change. custom properties allow a value to be stored in one place, then referenced in multiple other places. an additional benefit is semantic identifiers. for example, --main-text-color is easier to understand than #00ff00, especially if this same c...
...global search and replace if that color needs to change. custom properties allow a value to be stored in one place, then referenced in multiple other places. an additional benefit is semantic identifiers. for example, --main-text-color is easier to understand than #00ff00, especially if this same color is also used in other contexts. custom properties are subject to the cascade and inherit their value from their parent. basic usage declaring a custom property is done using a custom property name that begins with a double hyphen (--), and a property value that can be any valid css value. like any other property, this is written inside a ruleset, like so: element { --main-bg-color: brown; } note that the selector given to the ruleset defines the scope that the custom property can be used ...
...t it can be applied globally across your html document: :root { --main-bg-color: brown; } however, this doesn't always have to be the case: you maybe have a good reason for limiting the scope of your custom properties. note: custom property names are case sensitive — --my-color will be treated as a separate custom property to --my-color. ...
...And 14 more matches
clamp() - CSS: Cascading Style Sheets
Web › CSS › clamp
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. ...
... font sizes, as in these examples, allows you to set a font-size that grows with the size of the viewport, but doesn't go below a minimum font-size or above a maximum font-size. it has the same effect as the code in fluid typography but in one line, and without the use of media queries. ...
...n these examples, allows you to set a font-size that grows with the size of the viewport, but doesn't go below a minimum font-size or above a maximum font-size. it has the same effect as the code in fluid typography but in one line, and without the use of media queries. syntax the clamp() function takes three comma separated expressions as its parameter, in the order of minimum value, preferred value, maximum value. ...
...And 14 more matches
font-weight - CSS: Cascading Style Sheets
the font-weight css property sets the weight (or boldness) of the font. the weights available depend on the font-family that is currently set. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...dness) of the font. the weights available depend on the font-family that is currently set. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...e source for this interactive example is stored in a github repository. if 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 */ font-weight: normal; font-weight: bold; /* keyword values relative to the parent */ font-weight: lighter; font-weight: bolder; /* numeric keyword values */ font-weight: 100; font-weight: 200; font-weight: 300; font-weight: 400;// normal font-weight: 500; font-weight: 600; font-weight: 700;// bold font-weight: 800; font-weight: 900; /* global values */ font-weight: inherit; font-weight: initial; font-weight: unset; the font-weight property is specified using any one of the values listed below. values normal normal font weight. same as 400...
...And 14 more matches
HTML attribute: rel - HTML: Hypertext Markup Language
Web › HTML › Attributes › rel
the rel attribute defines the relationship between a linked resource and the current document. valid on <link>, <a>, <area>, and <form>, the supported values depend on the element on which the attribute is found. the type of relationships is given by the value of the rel attribute, which, if present, must have a value that is an unordered set of unique space-separated keywords, which are listed in the following table. every keyword within a space seperated value should be unique within that value. values for the rel attribute, and the elements for which each is relevant rel value description <link> <a> and <area> <form> alternate alternate representations of the current document. link link not allowed author author of the current d...
... link link link nofollow indicates that the current document's original author or publisher does not endorse the referenced document. not allowed annotation annotation noopener creates a top-level browsing context that is not an auxiliary browsing context if the hyperlink would create either of those to begin with (i.e., has an appropriate target attribute value). not allowed annotation annotation noreferrer no referer header will be included. additionally, has the same effect as noopener. not allowed annotation annotation opener creates an auxiliary browsing context if the hyperlink would otherwise create a top-level browsing context that is not anauxiliary browsing context (i.e., has "_blank" as target attribut...
... not allowed annotation annotation noreferrer no referer header will be included. additionally, has the same effect as noopener. not allowed annotation annotation opener creates an auxiliary browsing context if the hyperlink would otherwise create a top-level browsing context that is not anauxiliary browsing context (i.e., has "_blank" as target attribute value). not allowed annotation annotation pingback gives the address of the pingback server that handles pingbacks to the current document. external resource not allowed not allowed preconnect specifies that the user agent should preemptively connect to the target resource's origin. external resource not allowed not allowed prefetch specifi...
...And 14 more matches
<input type="color"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › color
y validates to ensure that the color information is entered in the proper format, or a platform-standard color picker, or some kind of custom color picker window. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...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. value a 7-character domstring specifying a <color> in lower-case hexadecimal notation events change and input supported common attributes autocomplete and list idl attributes list and value methods select() value the value of an <input> element of type color is always a domstring which contains a 7-character string specifying an rgb color in hexadecimal format. ...
... supported common attributes autocomplete and list idl attributes list and value methods select() value the value of an <input> element of type color is always a domstring which contains a 7-character string specifying an rgb color in hexadecimal format. while you can input the color in either upper- or lower-case, it will be stored in lower-case form. the value is never in any other form, and is never empty. note: setting the value to anything that isn't a valid, fully-opaque, rgb color in hexadecimal notation will result in the value being set to #000000. in particular, you can't use css's standardized color names, or any css function syntax, to set the value. this makes sense when you keep in mind that html and css are separate languages and specifi...
...And 14 more matches
Iteration protocols - JavaScript
ple of additions to ecmascript 2015, iteration protocols aren't new built-ins or syntax, but protocols. these protocols can be implemented by any object by simply following some conventions. there are two protocols: the iterable protocol and the iterator protocol. the iterable protocol the iterable protocol allows javascript objects to define or customize their iteration behavior, such as what values are looped over in a for...of construct. some built-in types are built-in iterables with a default iteration behavior, such as array or map, while other types (such as object) are not. in order to be iterable, an object must implement the @@iterator method, meaning that the object (or one of the objects up its prototype chain) must have a property with a @@iterator key which is available via co...
...e built-in types are built-in iterables with a default iteration behavior, such as array or map, while other types (such as object) are not. in order to be iterable, an object must implement the @@iterator method, meaning that the object (or one of the objects up its prototype chain) must have a property with a @@iterator key which is available via constant symbol.iterator: property value [symbol.iterator] a zero-argument function that returns an object, conforming to the iterator protocol. whenever an object needs to be iterated (such as at the beginning of a for...of loop), its @@iterator method is called with no arguments, and the returned iterator is used to obtain the values to be iterated. note that when this zero-argument function is called, it is in...
... access the properties of the iterable object, to decide what to provide during the iteration. this function can be an ordinary function, or it can be a generator function, so that when invoked, an iterator object is returned. inside of this generator function, each entry can be provided by using yield. ...
...And 14 more matches
stroke-linejoin - SVG: Scalable Vector Graphics
ke-linejoin can be used as a css property. ...
... <path>, <polygon>, <polyline>, <rect>, <text>, <textpath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewbox="0 0 18 12" xmlns="http://www.w3.org/2000/svg"> <!-- upper left path: effect of the "miter" value --> <path d="m1,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="miter" /> <!-- center path: effect of the "round" value --> <path d="m7,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="round" /> <!-- upper right path: effect of the "bevel" value --> <path d="m13,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="bevel" /> <!-- bottom left path: effect of the "miter-clip" value with fallback to "miter" if not suppo...
... <path d="m13,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="bevel" /> <!-- bottom left path: effect of the "miter-clip" value with fallback to "miter" if not supported. --> <path d="m3,11 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="miter-clip" /> <!-- bottom right path: effect of the "arcs" value with fallback to "miter" if not supported. --> <path d="m9,11 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="arcs" /> <!-- the following pink lines highlight the position of the path for each stroke --> <g id="highlight"> <path d="m1,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="pink" fill="none" stroke-width="0.025" /> <c...
...And 14 more matches
widget - Archive of obsolete content
cription of the widget used for accessibility, title bars, and error reporting. id string a string used to identify your widget in order to save its location when the user moves it in the browser. this string has to be unique and must not be changed over time. optional options: name type content string an optional string value containing the displayed content of the widget. it may contain html. widgets must have either the content property or the contenturl property set. if the content is an image, it is automatically scaled to be 16x16 pixels. contenturl string an optional string url to content to load into the widget. this can be local content or remote content, an image or web content. w...
...'s mouseout event. onattach function include this to listen to the widget's attach event. tooltip string optional text to show when the user's mouse hovers over the widget. if not given, the label is used. allow object an optional object describing permissions for the content. it should contain a single key named script whose value is a boolean that indicates whether or not to execute script in the content. script defaults to true. contentscriptfile string,array a local file url or an array of local file urls of content scripts to load. content scripts specified by this property are loaded before those specified by the contentscript property. contentscript string,array a strin...
...ecified by the contentscript property. contentscript string,array a string or an array of strings containing the texts of content scripts to load. content scripts specified by this property are loaded after those specified by the contentscriptfile property. contentscriptwhen string when to load the content scripts. ...
...And 13 more matches
CSS3 - Archive of obsolete content
though they haven't yet reached the first published working draft status. css modules status completed modules a few css modules already became a standard as a w3c recommendation. these should be no more changes. css color module level 3 recommendation since june 7th, 2011 adds the opacity property, and the hsl(), hsla(), rgba() and rgb() functions to create <color> values. it also defines the currentcolor keyword as a valid color. the transparent color is now a real color (thanks to the support for the alpha channel) and is a now an alias for rgba(0,0,0,0.0). it deprecates the system-color keywords that shouldn't be used in a production environment anymore. css namespaces module recommendation since september 29th, 2011 ...
... css namespaces module recommendation since september 29th, 2011 adds the support for the xml namespaces by defining the notion of css qualified name, using the ' | ' syntax and adding the @namespace css at-rule. selectors level 3 recommendation since september 29th, 2011 adds: substring matching attribute selectors, e[attribute^="value"], e[attribute$="value"], e[attribute*="value"] . new pseudo-classes: :target, :enabled and :disabled, :checked, :indeterminate, :root, :nth-child and :nth-last-child, :nth-of-type and :nth-last-of-type, :last-child, :first-of-type and :last-of-type, :only-child and :only-of-type,:empty, and :not. pseudo-elements are now characterized by two colons rather than one: :after becomes ::afte...
... to use when fallback fonts are selected via the css font-size-adjust property. the choice of alternative font faces using the css font-stretch, font-variant-alternates, font-variant-caps, font-variant-east-asian, font-variant-ligatures, font-variant-numeric, and font-variant-position properties. it also extends the related css font-variant shorthand property and introduces the @font-feature-values at-rule. the control of the automatic generation of an oblique or bold face when none are found via the css font-synthesis property. css basic user interface module level 3 recommendation since june 21st, 2018 adds: the ability to tweak the box model using the css box-sizing property. at risk: due to insufficient browser support, ...
...And 13 more matches
jspage - Archive of obsolete content
;}};(function(){var a={array:array,date:date,function:function,number:number,regexp:regexp,string:string};for(var h in a){new native({name:h,initialize:a[h],protect:true}); }var d={"boolean":boolean,"native":native,object:object};for(var c in d){native.typize(d[c],c);}var f={array:["concat","indexof","join","lastindexof","pop","push","reverse","shift","slice","sort","splice","tostring","unshift","valueof"],string:["charat","charcodeat","concat","indexof","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...
...guments")?[b]:b):[];}var $time=date.now||function(){return +new date;};function $try(){for(var b=0,a=arguments.length;b<a; b++){try{return arguments[b]();}catch(c){}}return null;}function $type(a){if(a==undefined){return false;}if(a.$family){return(a.$family.name=="number"&&!isfinite(a))?false:a.$family.name; }if(a.nodename){switch(a.nodetype){case 1:return"element";case 3:return(/\s/).test(a.nodevalue)?"textnode":"whitespace";}}else{if(typeof a.length=="number"){if(a.callee){return"arguments"; }else{if(a.item){return"collection";}}}}return typeof a;}function $unlink(c){var b;switch($type(c)){case"object":b={};for(var e in c){b[e]=$unlink(c[e]); }break;case"hash":b=new hash(c);break;case"array":b=[];for(var d=0,a=c.length;d<a;d++){b[d]=$unlink(c[d]);}break;default:return c;}return b;}var browse...
..."";});if(b===true){$exec(a);}else{if($type(b)=="function"){b(a,c); }}return c;},substitute:function(a,b){return this.replace(b||(/\\?{([^{}]+)}/g),function(d,c){if(d.charat(0)=="\\"){return d.slice(1);}return(a[c]!=undefined)?a[c]:""; });}});hash.implement({has:object.prototype.hasownproperty,keyof:function(b){for(var a in this){if(this.hasownproperty(a)&&this[a]===b){return a;}}return null; },hasvalue:function(a){return(hash.keyof(this,a)!==null);},extend:function(a){hash.each(a||{},function(c,b){hash.set(this,b,c);},this);return this;},combine:function(a){hash.each(a||{},function(c,b){hash.include(this,b,c); },this);return this;},erase:function(a){if(this.hasownproperty(a)){delete this[a];}return this;},get:function(a){return(this.hasownproperty(a))?this[a]:null; },set:function(a,b){if(!this[...
...And 13 more matches
Adding Properties to XBL-defined Elements - Archive of obsolete content
of elements. with xbl, you can define your own properties for the elements you create. you can also add methods that can be called. that way, all you need is to get a reference to the element (using document.getelementbyid or a similar function) and then get or set the additional properties and call the methods on it. there are three types of items you can add. fields are used to hold a simple value. properties can also be used to hold a value but may have code execute when an attempt is made to retrieve or modify the value. methods are functions which may be executed. all three are defined within an implementation element, which should be a child of the binding element. within the implementation, you define individual field, property, and method elements, one for each one that you want. ...
...od content goes here -- </method> . . . </implementation> </binding> fields each field is defined using the field element. often, fields would correspond to an attribute placed on the element such as label or disabled, but they do not have to. the name attribute on the field element is used to indicate the name of the field. you can use the name from a script to get and set the value. the example below creates a button which generates and stores a random number. you can retrieve this same number multiple times by getting the number property from the button. most of the work here is done in the oncommand handlers. later, we'll find out how to move this to xbl. xul: <box id="random-box" class="randomizer"/> <button label="generate" oncommand="document.getelementbyi...
...ncommand="document.getelementbyid('random-box').number=math.random();"/> <button label="show" oncommand="alert(document.getelementbyid('random-box').number)"/> xbl: <binding id="randomizer"> <implementation> <field name="number"/> </implementation> </binding> a number field has been defined in the binding, which stores the random number. the two extra buttons set and get the value of this field. the syntax is very similar to getting and setting the properties of html elements. in this example, no content has been placed inside either the xul box or its definition in xbl, which is perfectly valid. this example isn't quite correct because the field is not assigned a default value. to do this, add the default value as the content of the field tag. for example: <field name="nu...
...And 13 more matches
menupopup - Archive of obsolete content
dden, onpopuphiding, onpopupshowing, onpopupshown, position, top properties accessibletype, anchornode, popupboxobject, position, state, triggernode methods hidepopup, moveto, openpopup, openpopupatscreen, setconsumerollupevent, showpopup, sizeto examples the following example shows how a menupopup may be attached to a menulist. <menulist> <menupopup> <menuitem label="mozilla" value="http://mozilla.org"/> <menuitem label="slashdot" value="http://slashdot.org"/> <menuitem label="sourceforge" value="http://sf.net"/> <menuitem label="freshmeat" value="http://freshmeat.net"/> </menupopup> </menulist> the following example shows how a menupopup can be used as a context menu for an element. when the label is right-clicked, the menu will be displayed. <menupopup ...
... left type: integer overrides the horizontal position of the popup specified by the showpopup method. onpopuphidden type: script code this event is sent to a popup after it has been hidden. ...
...pened, much like the onload event is sent to a window when it is opened. position type: string the position attribute determines where the popup appears relative to the element the user clicked to invoke the popup. this allows you to place the popup on one side of a button. note that a context menu will never respect this attribute, always appearing relative to the mouse cursor. ...
...And 13 more matches
Using the Right Markup to Invoke Plugins - Archive of obsolete content
s netscape 7. in ie, the object element is used to invoke a plugin that is built on the activex architecture. here's an example of this kind of usage for ie: <!-- ie only code --> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="366" height="142" id="myflash"> <param name="movie" value="javascript-to-flash.swf" /> <param name="quality" value="high" /> <param name="swliveconnect" value="true" /> </object> in the above example, the classid attribute that goes along with the object element points to a "clsid:" urn followed by the unique identifier of an activex control (in the above example, the string beginning with "d27..."). this is, in fact, the unique identifier of ...
... based like activex (and thus, not invoked via a unique identifier) but rather, mime type based. mozilla-based browsers support the use of the object element along with a mime type. ...
...ifier) but rather, mime type based. mozilla-based browsers support the use of the object element along with a mime type. here is an example of this usage, once again for the macromedia flash plugin: <object type="application/x-shockwave-flash" data="javascript-to-flash.swf" width="366" height="142" id="myflash"> <param name="movie" value="javascript-to-flash.swf" /> <param name="quality" value="high" /> <param name="swliveconnect" value="true" /> <p>you need flash -- get the latest version from <a href= "http://www.macromedia.com/downloads/">here.</a></p> </object> in the above example, application/x-shockwave-flash is the flash mime type, and will invoke the netscape-specific flash architecture in mozilla-based browsers. the data attribute points to the swf file to play,...
...And 13 more matches
JavaScript basics - Learn web development
loading strategies. what happened? the heading text changed to hello world! using javascript. you did this by using a function called queryselector() to grab a reference to your heading, and then store it in a variable called myheading. this is similar to what we did using css selectors. when you want to do something to an element, you need to select it first. following that, the code set the value of the myheading variable's textcontent property (which represents the content of the heading) to hello world!. note: both of the features you used in this exercise are parts of the document object model (dom) api, which has the capability to manipulate documents. language basics crash course to give you a better understanding of how javascript works, let's explain some of the core features ...
...ting that these features are common to all programming languages. if you master these fundamentals, you have a head start on coding in other languages too! important: in this article, try entering the example code lines into your javascript console to see what happens. for more details on javascript consoles, see discover browser developer tools. variables variables are containers that store values. you start by declaring a variable with the var (less recommended, dive deeper for the explanation) or the let keyword, followed by the name you give to the variable: let myvariable; note: a semicolon at the end of a line indicates where a statement ends. it is only required when you need to separate statements on a single line. however, some people believe it's good practice to have semicolo...
...ction about naming rules.) if you are unsure, you can check your variable name to see if it's valid. note: javascript is case sensitive. this means myvariable is not the same as myvariable. if you have problems in your code, check the case! note: for more details about the difference between var and let, see the difference between var and let. ...
...And 13 more matches
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
e, creates a dependency tree, and then generates the required javascript to update only the parts of the dom that need to be updated. this approach usually generates optimal javascript code with minimal overhead, but it also has its limitations. sometimes svelte cannot detect changes to variables being watched. remember that to tell svelte that a variable has changed, you have to assign it a new value. a simple rule of thumb is that the name of the updated variable must appear on the left hand side of the assignment. for example, in the following piece of code: const foo = obj.foo foo.bar = 'baz' svelte won't update references to obj.foo.bar, unless you follow it up with obj = obj. that's because svelte can't track object references, so we have to explicitly tell it that obj has changed by ...
...our t variable inside the foreach() method, we are also modifying the todos array. and that makes sense, because otherwise svelte would be aware of the inner workings of the foreach() method; the same would therefore be true for any method attached to any object or array. nevertheless, there are different techniques that we can apply to solve this problem, and all of them involve assigning a new value to the variable being watched. like we already saw, we could just tell svelte to update the variable with a self-assignment, like this: const checkalltodos = (completed) => { todos.foreach(t => t.completed = completed) todos = todos } this will solve the problem. internally svelte will flag todos as changed and remove the apparently redundant self-assignment. apart from the fact that it lo...
...at it looks weird, it's perfectly ok to use this technique, and sometimes it's the most concise way to do it. we could also access the todos array by index, like this: const checkalltodos = (completed) => { todos.foreach( (t,i) => todos[i].completed = completed) } assignments to properties of arrays and objects — e.g. obj.foo += 1 or array[i] = x — work the same way as assignments to the values themselves. when svelte analyzes this code, if can detect that the todos array is being modified. another solution is to assign a new array to todos containing a copy of all the todos with the completed property updated accordingly, like this: const checkalltodos = (completed) => { todos = todos.map(t => { // shorter version: todos = todos.map(t => ({...t, completed})) r...
...And 13 more matches
Dynamic behavior in Svelte: working with variables and props - Learn web development
number of active and completed tasks with dynamic expressions: <h2 id="list-heading">{completedtodos} out of {totaltodos} items completed</h2> go to the app, and you should see the "2 out of 3 items completed" message as before, but this time the information is coming from the todos array. to prove it, go to that array, and try changing some of the todo object's completed property values, and even add a new todo object. observe how the numbers in the message are updated appropriately. dynamically generating the todos from the data at the moment, our displayed todo items are all static. we want to iterate over each item in our todos array and render the markup for each task, so let's do that now. html doesn't have a way of expressing logic — like conditionals and loops. s...
...this may feel a little weird at first. that's not how export normally works in javascript modules! this is how svelte 'extends' javascript by taking valid syntax and giving it a new purpose. in this case svelte is using the export keyword to mark a variable declaration as a property or prop, which means it becomes accessible to consumers of the component. you can also specify a default initial value for a prop. this will be used if the component's consumer doesn't specify the prop on the component — or if its initial value is undefined — when instantiating the component. so with export let todos = [], we are telling svelte that our todos.svelte component will accept a todos attribute, which when omitted will be initialized to an empty array. have a look at the app, and you'll se...
... now let's move our todos to app.svelte and pass them to the todos.svelte component as a prop. ...
...And 13 more matches
Gecko info for Windows accessibility vendors
s and docs that come with the active accessibility 2.0 sdk tools. the method accessibleobjectfromwindow() will get you the root iaccessible corresponding to the top level window. hold on to this root iaccessible, and use it to walk through the entire tree of iaccessible's. ...
... event_scrollingstart is fired when the user has jumped to a named anchor within the page. the event is fired on the first accessible object in the part of the document that has been jumped to. event_menupopupstart and event_menupopupend are fired when xul menus are opened or closed. event_menustart and event_menuend are fired when the xul menubar is activated or deactivated. event_valuechange is fired for sliders, progress meters and other objects who's get_accvalue() may change. event_show, event_hide and event_locationchange are fired for the caret object. event_reorder is fired on an object whenever its children change. event_show and event_hide may also be fired with the reorder event, for the child who's visibility changed. the show and hide events are not fired on ...
... that the child id system that is used by msaa doesn't work well when you have a deep tree of objects in a window. it would be impractical to number all of the nodes in a document starting at 0, because whenever a node is inserted or removed it would be computationally very expensive to renumber things. so, the firefox childid handed back from events is based on an algorithm that uses the pointer value of the related internal dom node. this computed child id for events is always a negative value, unique to the iaccessible firing the event these negative childid's from events can be used with accessibleobjectfromevent(), or on the root accessible of a window with any iaccessible method that takes a variant, such as get_accchild(). because screen readers usually cache an entire document's...
...And 13 more matches
Starting WebLock
tation knows that the component also supports nsiobserver. the weblock class definition with support for startup observation is below. class weblock: public nsiobserver { public: weblock(); virtual ~weblock(); ns_decl_isupports ns_decl_nsiobserver }; ns_impl_isupports1(weblock, nsiobserver); the standard implementation of observe() simply compares the atopic string with the value defined by the event the object is expecting. when there is a match, you can handle the event any way you see fit. if the object has only registered for one notification, then you can ignore the atopic string and simply handle the event as it occurs. in other words, the observe method should never be called in response to some event for which the object is not registered. ns_imethodimp weblock::...
... persistent data (after all, we want to have the component start up every time the application does). this is where a new service that manages sets of related data comes in handy. this service, the nsicategoryservice, is what xpcom and gecko embedding applications use to persist lists of nsiobserver components that want to have startup notification. the nsicategoryservice maintains sets of name-value pairs like the one below. the category manager every category is identified by a string that represents the name of the category. each category contains a set of name-value pairs. for example, you might have a category named "important people" in which the name-value pairs would be names and phone numbers. the format of the name-value pair is left up to you. this data structure is more than ...
...in fact, this is exactly how categories are used to handle registration with xpcom for startup notification. you will see the code which does this in the next section. ...
...And 13 more matches
nsIContentPrefService
dom/interfaces/base/nsicontentprefservice.idlscriptable please add a summary to this article. last changed in gecko 2 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) inherits from: nsisupports implemented by: @mozilla.org/content-pref/service;1. ...
...useful for accessing and manipulating preferences in ways that are caller-specific or for which there is not yet a generic method, although generic functionality useful to multiple callers should generally be added to this unfr...
... preference for changes. void addobserver( in astring aname, in nsicontentprefobserver aobserver ); parameters aname the name of the preference to observe. you may specify null to add a generic observer that is notified of all preference changes. aobserver the name of an object implementing nsicontentprefobserver that will receive notifications of changes to the preference's value. getpref() returns the value of a preference saved for a particular site. note: prior to gecko 2.0, the site could only be specified by nsiuri. now a string can be used as well. nsivariant getpref( in nsivariant agroup, in astring aname, in nsicontentprefcallback acallback optional ); parameters agroup the group for which to retrieve a preference; this may be specified as eith...
...And 13 more matches
nsIDBFolderInfo
obsolete since gecko 1.
... void getlocale(in nsstring result); native code only! obsolete since gecko 1.8 void getmailboxname(in nsstring boxname); native code only! ...
...ng getproperty(in string propertyname); nsidbfolderinfo gettransferinfo(); unsigned long getuint32property(in string propertyname, in unsigned long defaultvalue); void initfromtransferinfo(in nsidbfolderinfo transferinfo); long orflags(in long flags); void setbooleanproperty(in string propertyname, in boolean apropertyvalue); void setcharacterset(in string charset); void setcharactersetoverride(in boolean charactersetoverride); obsolete since gecko 1.8 void setcharptrproperty(in string apropertyname, in string apropertyvalue); void sethighwater(in nsmsgkey highwater, in boolean force); void setlocale(in nsstring locale); native code only...
...And 13 more matches
Drawing and Event Handling - Plugins
/* whether this is a window or a drawable */ } npwindow; the window parameter is a platform-specific handle to a native window element in the browser window hierarchy on windows and unix. on mac os, window is a pointer to an np_port. the x and y fields specify the top-left corner of the plug-in relative to the page. the width and height fields specify the dimensions of the plug-in area. these values should not be modified by the plug-in. the cliprect field defines the clipping rectangle of the plug-in in a coordinate system where the origin is the top-left corner of the drawable or window. the browser calls npp_setwindow whenever the drawable changes. for windowless plugins, a cliprect of 0,0,0,0 signals that the plugin is not visible. the type field indicates the npwindow type of the tar...
...indow rectangle are in twips format. for this reason, you need to convert the x - and y - coordinates using the windows api call dptolp when you output text. setting the window the browser calls the npp_setwindow function to set the window in which a plug-in draws or returns an error code. this window is valid for the life of the instance, or until npp_setwindow is called again with a different value. subsequent calls to npp_setwindow for a given instance usually mean that the window has been resized. if either window or window->window is null, the plug-in must not perform any additional graphics operations on the window and should free any associated resources. nperror npp_setwindow(npp instance, npwindow *window); the instance parameter represents the current plug-in. the window parame...
...ow information specified in window->window is a platform-specific handle to a drawable. ms windows and unix for windowed plug-ins on ms windows and unix, the window->window field is a handle to a subwindow of the netscape window hierarchy. mac os the window->window field points to an np_port structure. ...
...And 13 more matches
Network request details - Firefox Developer Tools
you to the list view. headers tab the headers tab has a toolbar, followed by three main sections. this includes: information about the request status: the response status code for the request; click the "?" icon to go to the reference page for the status code. version: the version of http used. transferred: the amount of data transferred for the request. referrer policy: the value of the referrer-policy header. http response headers http request headers each section has a disclosure triangle to expand the section to show more information. headers toolbar using the headers toolbar, you can: filter the headers in the response headers and request headers sections. block the domain involved in this request. the domain is added to the blocking sidebar. resend th...
...following information is shown in both the collapsed and the expanded states: status: the http response code for the request. version: the http version used transferred: the amount of data transferred with the request the referrer policy, which governs which referrer information, sent in the referer header, should be included with requests. (see referrer-policy for a description of possible values) blocking: if the request is to a site that is associated with a known tracker, an icon and a message are shown; otherwise, this field is not shown. response headers the response headers section shows details about the response. for each line in the response headers section, a question mark links to the documentation for that response header, if one is available. a raw toggle button in the ...
...e header are all in lowercase, while the request headers keys are not. http/2 requires that all headers be lowercase; response headers are shown as they are received from the server. ...
...And 13 more matches
Document.cookie - Web APIs
Web › API › Document › cookie
the document property cookie lets you read and write cookies associated with the document. it serves as a getter and setter for the actual values of the cookies. syntax read all cookies accessible from this location allcookies = document.cookie; in the code above allcookies is a string containing a semicolon-separated list of all cookies (i.e. key=value pairs). note that each key and value may be surrounded by whitespace (space and tab characters): in fact, rfc 6265 mandates a single space after each semicolon, but some user agents may not abide by this. write a new cookie document.cookie = newcookie; in the code above, newcookie is a string of form key=value. note that you can only set/update a single cookie at a time using this method. consider also that: any of the following cooki...
...y whitespace (space and tab characters): in fact, rfc 6265 mandates a single space after each semicolon, but some user agents may not abide by this. write a new cookie document.cookie = newcookie; in the code above, newcookie is a string of form key=value. note that you can only set/update a single cookie at a time using this method. consider also that: any of the following cookie attribute values can optionally follow the key-value pair, specifying the cookie to set/update, and preceded by a semi-colon separator: ;path=path (e.g., '/', '/mydir') if not specified, defaults to the current path of the current document location. note: prior to gecko 6.0, paths with quotes were treated as if the quotes were part of the string, instead of as if they were delimiters surrounding ...
...nor max-age specified it will expire at the end of session. when user privacy is a concern, it's important that any web app implementation invalidate cookie data after a certain timeout instead of relying on the browser to do it. many browsers let users specify that cookies should never expire, which is not necessarily safe. see date.toutcstring() for help formatting this value. ...
...And 13 more matches
SubtleCrypto.verify() - Web APIs
the verify() method of the subtlecrypto interface verifies a digital signature. it takes as its arguments a key to verify the signature with, some algorithm-specific parameters, the signature, and the original signed data. it returns a promise which will be fulfilled with a boolean value indicating whether the signature is valid. syntax const result = crypto.subtle.verify(algorithm, key, signature, data); parameters algorithm is a domstring or object defining the algorithm to use, and for some algorithm choices, some extra parameters. the values given for the extra parameters must match those passed into the corresponding sign() call. to use rsassa-pkcs1-v1_5, pass the string "rsassa-pkcs1-v1_5" or an object of the form { "name": "rsassa-pkcs1-v1_5" }. to use rsa-pss, pass ...
..., pass the string "hmac" or an object of the form { "name": "hmac" }. key is a cryptokey containing the key that will be used to verify the signature. it is the secret key for a symmetric algorithm and the public key for a public-key system. signature is a arraybuffer containing the signature to verify. data is a arraybuffer containing the data whose signature is to be verified. return value result is a promise that fulfills with a boolean: true if the signature is valid, false otherwise. exceptions the promise is rejected when the following exception is encountered: invalidaccesserror raised when the encryption key is not a key for the requested verifying algorithm or when trying to use an algorithm that is either unknown or isn't suitable for a verify operation. support...
...s note: you can try the working examples out on github. rsassa-pkcs1-v1_5 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. ...
...And 13 more matches
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
take a scene that would otherwise look as flat as a typical 2d screen and make it pop as if it were truly 3d. there are several kinds of perspective; those are defined and their mathematics explained in the article webgl model view projection. importantly, the effect of perspective on a vector can be represented by adding a fourth component to the vector: the perspective component, called w. the value of w is applied by dividing each of the other three components by it to get the final position or vector; that is, for a coordinate given as (x, y, z, w), the point in the 3d space is actually (x/w, y/w, z/w, 1) or simply (x/w, y/w, z/w). if you're not using perspective, w is always 1. in that situation, the complete coordinates for an object located at (1, 0, 3) are (1, 0, 3, 1). but the locati...
...hree 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 coordinates and the facing direction vector, the vector needs to include the w component. ...
...hanges with the virtual camera. it's also entirely possible to perform more than one of these movements at the same time; for example, you can pan the camera while also zooming in on the scene. keep in mind that the majority of camera movements are described relative to the camera's reference space. the format for storing matrices is generally as a flat array in column-major order; that is, the values from the matrix are written starting with the top-left corner and moving down to the bottom, then moving over to the right a row and repeating until all values are in the array. thus a matrix that looks like this: [a1a5a9a13a2a6a10a14a3a7a11a15a4a8a12a16]\left [ \begin{matrix} a_{1} & a_{5} & a_{9} & a_{13} \\ a_{2} & a_{6} & a_{10} & a_{14} \\ a_{3} & a_{7} & a_{11} & a_{15} \\ a_{4} & a_{8} ...
...And 13 more matches
Movement, orientation, and motion: A WebXR example - Web APIs
sible for the webxr api's specification. by importing this polyfill, we allow the example to work on many browsers that don't yet have webxr implementations in place, and we smooth out any transient deviations from the specification that occur during these still somewhat experimental days of the webxr specification. options this example has a number of options you can configure by adjusting the values of constants before you load it in the browser. the code looks like this: const xrotationdegreespersecond = 25; const yrotationdegreespersecond = 15; const zrotationdegreespersecond = 35; const enablerotation = true; const allowmouserotation = true; const allowkeyboardmotion = true; const enableforcepolyfill = false; //const session_type = "immersive-vr"; const session_type = "inline"; const mo...
...ources = null; let xrreferencespace = null; let xrbutton = null; let gl = null; let animationframerequestid = 0; let shaderprogram = null; let programinfo = null; let buffers = null; let texture = null; let mouseyaw = 0; let mousepitch = 0; this is followed by a set of constants, mostly to contain various vectors and matrices used while rendering the scene. ...
...null; let gl = null; let animationframerequestid = 0; let shaderprogram = null; let programinfo = null; let buffers = null; let texture = null; let mouseyaw = 0; let mousepitch = 0; this is followed by a set of constants, mostly to contain various vectors and matrices used while rendering the scene. ...
...And 13 more matches
align-content - CSS: Cascading Style Sheets
the css align-content property sets the distribution of space between and around content items along a flexbox's cross-axis or a grid's block axis. the interactive example below use grid layout to demonstrate some of the values of this property. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this property has no effect on single line flex containers (i.e. ...
...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. this property has no effect on single line flex containers (i.e. ones with flex-wrap: nowrap). ...
... end the items are packed flush to each other against the end edge of the alignment container in the cross axis. flex-start the items are packed flush to each other against the edge of the alig...
...And 13 more matches
color - CSS: Cascading Style Sheets
Web › CSS › color
the color css property sets the foreground color value of an element's text and text decorations, and sets the currentcolor value. currentcolor may be used as an indirect value on other properties and is the default for other color properties, such as border-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. for an overview of using color in html, see applying color to html elements using css. ...
...is the default for other color properties, such as border-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. for an overview of using color in html, see applying color to html elements using css. ...
...s border-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. for an overview of using color in html, see applying color to html elements using css. ...
...And 13 more matches
Control flow and error handling - JavaScript
cause the assignment can be confused with equality when glancing over the code. ...
...an be confused with equality when glancing over the code. ...
...r the code. ...
...And 13 more matches
Iterators and generators - JavaScript
ple for loops to map() and filter(). iterators and generators bring the concept of iteration directly into the core language and provide a mechanism for customizing the behavior of for...of loops. for details, see also: iteration_protocols for...of function* and generator yield and yield* iterators in javascript an iterator is an object which defines a sequence and potentially a return value upon its termination. specifically, an iterator is any object which implements the iterator protocol by having a next() method that returns an object with two properties: value the next value in the iteration sequence. done this is true if the last value in the sequence has already been consumed. if value is present alongside done, it is the iterator's return value. once created, an iter...
... while it is easy to imagine that all iterators could be expressed as arrays, this is not true. ...
... while it is easy to imagine that all iterators could be expressed as arrays, this is not true. ...
...And 13 more matches
Inheritance and the prototype chain - JavaScript
. // o.[[prototype]].[[prototype]] is object.prototype. // finally, o.[[prototype]].[[prototype]].[[prototype]] is null. // this is the end of the prototype chain, as null, // by definition, has no [[prototype]]. // thus, the full prototype chain looks like: // {a: 1, b: 2} ---> {b: 3, c: 4} ---> object.prototype ---> null console.log(o.a); // 1 // is there an 'a' own property on o? yes, and its value is 1. console.log(o.b); // 2 // is there a 'b' own property on o? yes, and its value is 2. // the prototype also has a 'b' property, but it's not visited. // this is called property shadowing console.log(o.c); // 4 // is there a 'c' own property on o? no, check its prototype. // is there a 'c' own property on o.[[prototype]]? yes, its value is 4. console.log(o.d); // undefined // is there a 'd...
...getter or a setter. inheriting "methods" javascript does not have "methods" in the form that class-based languages define them. in javascript, any function can be added to an object in the form of a property. an inherited function acts just as any other property, including property shadowing as shown above (in this case, a form of method overriding). when an inherited function is executed, the value of this points to the inheriting object, not to the prototype object where the function is an own property. var o = { a: 2, m: function() { return this.a + 1; } }; console.log(o.m()); // 3 // when calling o.m in this case, 'this' refers to o var p = object.create(o); // p is an object that inherits from o p.a = 4; // creates a property 'a' on p console.log(p.m()); // 5 // when p.m i...
...s code, the console should have displayed an object that looks similar to this. { constructor: ƒ dosomething(), __proto__: { constructor: ƒ object(), hasownproperty: ƒ hasownproperty(), isprototypeof: ƒ isprototypeof(), propertyisenumerable: ƒ propertyisenumerable(), tolocalestring: ƒ tolocalestring(), tostring: ƒ tostring(), valueof: ƒ valueof() } } we can add properties to the prototype of dosomething(), as shown below. function dosomething(){} dosomething.prototype.foo = "bar"; console.log( dosomething.prototype ); this results in: { foo: "bar", constructor: ƒ dosomething(), __proto__: { constructor: ƒ object(), hasownproperty: ƒ hasownproperty(), isprototypeof: ƒ isprotot...
...And 13 more matches
Promise - JavaScript
the promise object represents the eventual completion (or failure) of an asynchronous operation, and its resulting value. to learn about the way promises work and how you can use them, we advise you to read using promises first. description a promise is a proxy for a value not necessarily known when the promise is created. it allows you to associate handlers with an asynchronous action's eventual success value or failure reason. this lets asynchronous methods return values like synchronous methods: instead of immediately returning the final value, the asynchronous method returns a promise to supply the value at some point in the future. a promise is in one of these states: pending: initial state, neither fulfilled nor rejected. fulfilled: meaning that the operation completed successful...
...when either of these options happens, the associated handlers queued up by a promise's then method are called. ...
...nt. the signatures of these two functions are simple, they accept a single parameter of any type. these functions are written by you, the programmer. the termination condition of these functions determines the "settled" state of the next promise in the chain. any termination other than a throw creates a "resolved" state, while terminating with a throw creates a "rejected" state. handlefulfilled(value) { /*...*/; return nextvalue; } handlerejection(reason) { /*...*/; throw nextreason; } handlerejection(reason) { /*...*/; return nextvalue; } the returned nextvalue can be another promise object, in which case the promise gets dynamically inserted into the chain. when a .then() lacks the appropriate function that return a promise object, processing simply continues to the next link o...
...And 13 more matches
var - JavaScript
description var declarations, wherever they occur, are processed before any code is executed. ...
... description var declarations, wherever they occur, are processed before any code is executed. ...
... description var declarations, wherever they occur, are processed before any code is executed. ...
...And 13 more matches
href - SVG: Scalable Vector Graphics
Web › SVG › Attribute › href
radient>, <mpath>, <pattern>, <radialgradient>, <script>, <set>, <textpath>, and <use> html, body, svg { height: 100%; } <svg viewbox="0 0 160 40" xmlns="http://www.w3.org/2000/svg"> <a href="https://developer.mozilla.org/"><text x="10" y="25">mdn web docs</text></a> </svg> in svg a for <a>, href defines the location of the referenced object, expressed as a url reference. value <url> default value none animatable yes animate, animatemotion, animatetransform, set for the <animate>, <animatemotion>, <animatetransform>, and <set>, href defines a url referring to the element which is the target of this animation element and which therefore will be modified over time. the url must point to exactly one target element which is capable of bei...
...ng properties. specifically, timeevents are dispatched and the animation element can be used as syncbase in an identical fashion to when the url refers to a valid target element. if the href attribute or the deprecated xlink:href attribute is not provided, then the target element will be the immediate parent element of the current animation element. if both xlink:href and href are specified, the value of the latter attribute is used. refer to the descriptions of the individual animation elements for any restrictions on what types of elements can be targets of particular types of animations. except for any svg-specific rules explicitly mentioned in this specification, the normative definition for this attribute is the smil animation specification. in particular, see smil animation: specifying...
... refer to the descriptions of the individual animation elements for any restrictions on what types of elements can be targets of particular types of animations. except for any svg-specific rules explicitly mentioned in this specification, the normative definition for this attribute is the smil animation specification. in particular, see smil animation: specifying the animation target. value <url> default value none animatable no discard for <discard>, href defines a url referring the target element to discard. see the definition of href on animation elements for details on identifying a target element. note: unlike other animation elements, the <discard> element does not support the deprecated xlink:href attribute. note that if the target eleme...
...And 13 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
manager will appear, where you can create the dev profile and configure its home-path. change your preferences for more efficient development before you get to work developing your extension, you’ll want to change some of your firefox preferences. this isn’t a requirement for extension development, but i recommend it as a way to work more efficiently. preference description value nglayout.debug.disable_xul_cache (not present in firefox 3.5+) ordinarily, firefox will cache xul documents after they have been read in once, to speed subsequent displays. disabling this cache forces xul documents to be reloaded any every time they are displayed. true browser.dom.window.dump.enabled (not present in firefox 3.5+) enables use of the...
...preferences to set for developing extensions to make these changes, start your development profile, type about:config into firefox’s location bar and open the preferences window; find the preferences listed in table 1 and double-click on them to set them accordingly. some of these preferences do not exist—to create them, right-click, select “new>boolean”, and type in the name and set the value accordingly. install the dom inspector the dom inspector is an extension that lets you examine html and xul dom tree structures, javascript objects and css properties, etc. this is not required for developing extensions, but it is handy to have around. install extensions for firefox from the mozilla add-ons website. optional - install firebug and chromebug chromebug is used by the firebug de...
...horizontally. ...
...And 12 more matches
Search Extension Tutorial (Draft) - Archive of obsolete content
way of changing preferences such that they are automatically restored on add-on uninstall, is to make such changes in the default preference branch, as explained below. while the technical details below are important to understand, a library which encapsulates the appropriate logic is provided along with the example add-on at the end, and should be used where possible. changing default preference values there are two common ways of changing default preference values. the simplest, which works only for traditional, non-restartless add-ons, is to add the preference changes to a file in an extension's defaults/preferences/ directory. the following file, for instance, would change the default keyword search engine, assuming that an engine with the name example engine is installed, as described belo...
...aining the preference name as a // property. we use a data: url for simplicity. pref("browser.search.defaultenginename", "data:text/plain,browser.search.defaultenginename=example engine"); in the case or restartless extensions, the preferences need to be changed manually, and reverted when the extension is disabled if they have not been changed in the meantime. while changes to default preference values will not persist across sessions, restartless extensions must nevertheless restore them for the balance of the session after they have been disabled. the following example bootstrap.js file illustrates the method: const { classes: cc, interfaces: ci, utils: cu, results: cr } = components; // import the services module. cu.import("resource://gre/modules/services.jsm"); // keep track of whether ...
...utils: cu, results: cr } = components; // import the services module. cu.import("resource://gre/modules/services.jsm"); // keep track of whether this is the first run. var firstrun = false; // get the root user preference branch. var userprefs = services.prefs.getbranch(""); // get the root default preference branch. ...
...And 12 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
function getelement(aid){ return (document.getelementbyid) ? document.getelementbyid(aid) : document.all[aid]); } differences between mozilla and internet explorer first, i'll discuss the differences in the way html behaves between mozilla and internet explorer. tooltips legacy browsers introduced tooltips into html by showing them on links and using the value of the alt attribute as a tooltip's content. the latest w3c html specification created the title attribute, which is meant to contain a detailed description of the link. modern browsers will use the title attribute to display tooltips, and mozilla only supports showing tooltips for that attribute and not the alt attribute. entities html markup can contain several entities, which the w3c web sta...
...ports these apis as well, but it also supports its legacy apis for walking a dom tree, such as the children property. table 2. methods used to traverse the dom property/method description childnodes returns an array of all child nodes of the element. firstchild returns the first child node of the element. getattribute( aattributename ) returns the value for the specified attribute. hasattribute( aattributename ) returns a boolean stating if the current node has an attribute defined with the specified name. haschildnodes() returns a boolean stating whether the current node has any child nodes. lastchild returns the last child node of the element. nextsibling returns the node immediately following th...
... haschildnodes() returns a boolean stating whether the current node has any child nodes. lastchild returns the last child node of the element. nextsibling returns the node immediately following the current one. nodename returns the name of the current node as a string. nodetype returns the type of the current node. ...
...And 12 more matches
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
you how they can be used. settimeout() as we said before, settimeout() executes a particular block of code once after a specified time has elapsed. it takes the following parameters: a function to run, or a reference to a function defined elsewhere. a number representing the time interval in milliseconds (1000 miliseconds equals 1 second) to wait before executing the code. if you specify a value of 0 (or simply omit the value), the function will run as soon as possible. (see the note below on why it runs "as soon as possible" and not "immediately".) more on why you might want to do this later. zero or more values that represent any parameters you want to pass to the function when it is run. note: the specified amount of time (or the delay) is not the guaranteed time to execution, bu...
...ion defined separately function sayhi() { alert('hello mr. universe!'); } let mygreeting = settimeout(sayhi, 2000); that can be useful if you have a function that needs to be called both from a timeout and in response to an event, for example. but it can also just help keep your code tidy, especially if the timeout callback is more than a few lines of code. settimeout() returns an identifier value that can be used to refer to the timeout later, such as when you want to stop it. see clearing timeouts (below) to learn how to do that. passing parameters to a settimeout() function any parameters that you want to pass to the function being run inside the settimeout() must be passed to it as additional parameters at the end of the list. for example, you could refactor the previous function so...
... clearing intervals setinterval() keeps running a task forever, unless you do something about it. you'll probably want a way to stop such tasks, otherwise you may end up getting errors when the browser can't complete any further versions of the task, or if the animation being handled by the task has finished. you can do this the same way you...
...And 12 more matches
How to implement a custom autocomplete search component
te" turns on the autocomplete mechanism and the autocompletesearch="history" sets the source for the autocomplete. there are more options and features, see xul:textbox_(firefox_autocomplete) for more details. the toolkit mechanism has built-in support for several autocomplete sources, including: history: search the browser's url history (firefox: 1.0+; seamonkey: 1.1+) form-history: search the values that the user has entered into form fields. (firefox: 1.0+; seamonkey: 2.0+) file: search file names (firefox: 2.0+; thunderbird: 2.0+; seamonkey: 1.1+; gtk builds only). the component uses the autocompletesearchparam attribute or searchparam property to allow the developer to define the default directory otherwise only paths beginning with / or ~/ will be autocompleted. building your custom a...
... 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 hint for the result at the given index */ ...
...no special styling if (index == 0) return 'suggestfirst'; // category label on first line of results return 'suggesthint'; // category label on any other line of results }, /** * gets the image for the result at the given index * * @return {string} the uri to the image to display */ getimageat : function (index) { return ''; }, /** * get the final value that should be completed when the user confirms * the match at the given index. * @return {string} the final value of the result at the given index */ getfinalcompletevalueat: function(index) { return this.getvalueat(index); }, /** * removes the value at the given index from the autocomplete results. * if removefromdb is set to true, the value should be removed from *...
...And 12 more matches
IPDL Tutorial
tual void recvbaz() = 0; public: void sendbar() { /* boilerplate */ } void sendbaz() { /* boilerplate */ } }; you can use the child, parent, and both labels multiple times in a protocol specification. they behave like public, protected, and private labels in c++. parameters message declarations allow any number of parameters. parameters specify data that are sent with the message. their values are serialized by the sender and deserialized by the receiver. ipdl supports built-in and custom primitive types, as well as unions and arrays. the built-in simple types include the c++ integer types (bool, char, int, double) and xpcom string types (nsstring, nscstring). ipdl imports these automatically because they are common, and because the base ipc library knows how to serialize and dese...
...pdl/builtin.py for the most up-to-date list of automatically imported types. actors may be passed as parameters. the c++ signature will accept a pprotocolparent* on one side and convert it to a pprotocolchild* on the other. maybe types if you want to pass a potentially undefined argument, you can add ? postfix after the type name. then you can pass a mozilla::maybe object instead of a concrete value. protocol pmaybe { child: async maybe(nscstring? maybe); }; custom primitive types when you need to send data of a type other than one built into ipdl, you can add a using declaration in an ipdl specification. a custom serializer and deserializer must be provided by your c++ code. using mozilla::plugins::npremoteevent; sync protocol pplugininstance { child: async handleevent(npremoteev...
...; type type(); void_t& get_void_t(); bool& get_bool(); int& get_int(); double& get_double(); nscstring& get_nscstring(); ppluginscriptableobject* get_ppluginscriptableobject(); }; aunion.type() can be used to determine the type of a union received in an ipdl message handler, with the remaining functions granting access to its contents. ...
...And 12 more matches
CustomizableUI.jsm
is not in any area, or if the widget is already at the indicated position, this will no-op. otherwise, this will move the widget and fire an onwidgetmoved notification, and an onwidgetbeforedomchange and onwidgetafterdomchange notification for each window customizableui knows about. parameters awidgetid the id of the widget to move aposition the position to move the widget to. negative values or values greater than the number of widgets will be interpreted to mean moving the widget to respectively the first or last position. ensurewidgetplacedinwindow() ensure a xul-based widget created in a window after areas were initialized moves to its correct position. this is roughly equivalent to manually looking up the position and using insertitem in the old api, but a lot less work for c...
...rty=true, we will flush to the prefs file. parameters aforcedirty force customizableui to flush to the prefs file when all batch updates have finished. createwidget() create a widget. to create a widget, you should pass an object with its desired properties. for a list of supported properties, see api-provided widgets. parameters aproperties the specification for the widget return value a wrapper around the created widget. note: if your extension is compatible with versions of firefox below 29, i.e. before customizableui was introduced, then you have to make sure that in case of running on newer browsers, xul overlay does not contain description of the button that you are creating with createwidget() method. otherwise, conflicting static xul overlay button and dynamic customiz...
...owever, it will keep the widget in the placements for whatever area it was in at the time. you can remove it from there yourself by calling customizableui.removewidgetfromarea(awidgetid). parameters awidgetid the id of the widget to destroy getwidget() get a wrapper object with information about the widget. parameters awidgetid the id of the widget whose information you need return value a wrapper around the widget as described above, or null if the widget is known not to exist (any more). nb: non-null return is no guarantee the widget exists because we cannot know in advance if an xul widget exists or not. getunusedwidgets() get an array of widget wrappers for all the widgets which are currently not in any area (so which are in the palette). parameters awindowpalette the...
...And 12 more matches
Sqlite.jsm
s the sqlite symbol. this symbol is an object with a single function: openconnection. this function takes an object defining connection options: path (required) the database file to open. this can be an absolute or relative path. if a relative path is given, it is interpreted as relative to the current profile's directory. if the path does not exist, a new sqlite database will be created. the value typically ends with .sqlite. sharedmemorycache (optional) boolean indicating whether multiple connections to the database share the same memory cache. sharing the memory cache likely results in less memory utilization. however, sharing also requires connections to obtain a lock, possibly making database access slower. defaults to true. shrinkmemoryonconnectionidlems (optional) if defined, the...
...ikely results in less memory utilization. however, sharing also requires connections to obtain a lock, possibly making database access slower. defaults to true. shrinkmemoryonconnectionidlems (optional) if defined, the connection will attempt to minimize its memory usage after this many milliseconds of connection idle. the connection is idle when no statements are executing. there is no default value which means no automatic memory minimization will occur. please note that this is not a timer on the idle service and this could fire while the application is active. openconnection(options) returns a promise that resolves to an opened connection instance or is rejected if an error occurred while opening the database. here is an example: components.utils.import("resource://gre/modules/sqlite.
...ore, it is safe to call this any time. this returns an integer count of the number of cached statements that were discarded. table and schema management these apis deal with management of tables and database schema. getschemaversion() the user-set version associated with the schema for the current database. if no schema version has been set, this will return the string "0". setschemaversion(value) sets value as the new version associated with the schema for the current database. this is a wrapper around the pragma user_version statement. tableexists(name) this function determines whether a table exists in the current database. it returns a promise that is resolved with a boolean indicating whether the table exists. indexexists(name) this functions determines whether a named index exi...
...And 12 more matches
GC Rooting Guide
pi user. since spidermonkey has a moving gc, it is very important that it knows about each and every pointer to a gc thing in the system. spidermonkey's rooting api tries to make this task as simple as possible. what is a gc thing pointer? "gc thing" is the term used to refer to memory allocated and managed by the spidermonkey garbage collector. the main types of gc thing pointer are: js::value jsobject* jsstring* jsscript* jsid note that js::value and jsid can contain pointers internally even though they are not a normal pointer type, hence their inclusion in this list. if you use these types directly, or create classes, structs or arrays that contain them, you must follow the rules set out in this guide. if you do not your program will not work correctly - if it works at all. ...
...hing pointers stored on the stack (i.e., local variables and parameters to functions) must use the js::rooted<t> class. this is a template class where the template parameter is the type of the gc thing it contains. from the user perspective, a js::rooted<t> instance behaves exactly as if it were the underlying pointer. js::rooted must be constructed with a jscontext*, and optionally an initial value. ...
...rooted<t> instance behaves exactly as if it were the underlying pointer. js::rooted must be constructed with a jscontext*, and optionally an initial value. there are typedefs available for the main types. ...
...And 12 more matches
BiquadFilterNode() - Web APIs
lter() method. syntax var biquadfilternode = new biquadfilternode(context, options) parameters inherits parameters from the audionodeoptions dictionary. context a reference to an audiocontext. options optional options are as follows: type: one of "lowpass", "highpass", "bandpass", "lowshelf", "highshelf", "peaking", "notch", "allpass". the meaning of the other options depends on the value of this one. the defaults for all are as follows: q: 1 detune: 0 frequency: 350 gain: 0 lowpass: (default) allows frequencies below a cutoff frequency to pass through, and attenuates frequencies above the cutoff. this is a standard second-order resonant lowpass filter with 12db/octave rolloff. q: controls how peaked the response will be at the cutoff frequency.
...one. the defaults for all are as follows: q: 1 detune: 0 frequency: 350 gain: 0 lowpass: (default) allows frequencies below a cutoff frequency to pass through, and attenuates frequencies above the cutoff. this is a standard second-order resonant lowpass filter with 12db/octave rolloff. q: controls how peaked the response will be at the cutoff frequency. a large value makes the response more peaked. please note that for this filter type, this value is not a traditional q, but is a resonance value in decibels. frequency: the cutoff frequency. gain: not used. highpass: a highpass filter is the opposite of a lowpass filter. frequencies above the cutoff frequency are passed through, but frequencies below the cutoff are attenuated. it implements a standa...
...equency: the cutoff frequency. gain: not used. highpass: a highpass filter is the opposite of a lowpass filter. frequencies above the cutoff frequency are passed through, but frequencies below the cutoff are attenuated. it implements a standard second-order resonant highpass filter with 12db/octave rolloff. q: controls how peaked the response will be at the cutoff frequency. a large value makes the response more peaked. please note that for this filter type, this value is not a traditional q, but is a resonance value in decibels. frequency: the cutoff frequency. gain: not used. bandpass: a bandpass filter allows a range of frequencies to pass through and attenuates the frequencies below and above this frequency range. it implements a second-order bandpass filter. q...
...And 12 more matches
CSS Typed Object Model API - Web APIs
the css typed object model api simplifies css property manipulation by exposing css values as typed javascript objects rather than strings. this not only simplifies css manipulation, but also lessens the negative impact on performance as compared to htmlelement.style. generally, css values can be read and written in javascript as strings, which can be slow and cumbersome. css typed object model api provides interfaces to interact with underlying values, by representing them with specialized js objects that can be manipulated and understood more easily and more reliably than string parsing and concatenation. this is easier for authors (for example, numeric values are reflected with actual js numbers, and have unit-aware mathematical operations defined for them). it is also generally faster, as...
...ovides interfaces to interact with underlying values, by representing them with specialized js objects that can be manipulated and understood more easily and more reliably than string parsing and concatenation. this is easier for authors (for example, numeric values are reflected with actual js numbers, and have unit-aware mathematical operations defined for them). it is also generally faster, as values can be directly manipulated and then cheaply translated back into underlying values without having to both build and parse strings of css. css typed om both allows for the performant manipulation of values assigned to css properties while enabling maintainable code that is both more understand and easier to write. ...
...ons defined for them). it is also generally faster, as values can be directly manipulated and then cheaply translated back into underlying values without having to both build and parse strings of css. css typed om both allows for the performant manipulation of values assigned to css properties while enabling maintainable code that is both more understand and easier to write. interfaces cssstylevalue the cssstylevalue interface of the the css typed object model api is the base class of all css values accessible through the typed om api. an instance of this class may be used anywhere a string is expected. cssstylevalue.parse(property, csstext) the parse() method of the cssstylevalue interface allows a cssnumericvalue to be constructed from a css string. it sets a specific css property ...
...And 12 more matches
Using the Web Speech API - Web APIs
, just like in javascript. the first line — #jsgf v1.0; — states the format and version used. this always needs to be included first. the second line indicates a type of term that we want to recognise. public declares that it is a public rule, the string in angle brackets defines the recognised name for this term (color), and the list of items that follow the equals sign are the alternative values that will be recognised and accepted as appropriate values for the term. note how each is separated by a pipe character. you can have as many terms defined as you want on separate lines following the above structure, and include fairly complex grammar definitions. for this basic demo, we are just keeping things simple. plugging the grammar into our speech recognition the next thing to do is...
...peechrecognition() constructor. we also create a new speech grammar list to contain our grammar, using the speechgrammarlist() constructor. var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); we add our grammar to the list using the speechgrammarlist.addfromstring() method. ...
...we also set a few other properties of the recognition instance before we move on: speechrecognition.continuous: controls whether continuous results are captured (true), or just a single result each time recognition is started (false). speechrecognition.lang: sets the language of the recognition. ...
...And 12 more matches
Variable fonts guide - CSS: Cascading Style Sheets
ed in order to test the early implementations of variable font support, and is necessary to utilize new or custom axes beyond the five registered ones. however, the w3c’s intent was for this syntax not to be used when other attributes are available. ...
... set values or axes not available otherwise. notes when using font-variation-settings it is important to note that axis names are case-sensitive. the registered axis names must be in lower case, and custom axes must be in upper case. for example: font-variation-settings: 'wght' 375, 'grad' 88; wght (weight) is a registered axis, and grad (grade) is a custom one. if you have set values using font-variation-settings and want to change one of those values, you must redeclare all of them (in the same way as when you set opentype font features using font-feature-settings). you can work around this limitation by using css custom properties (css variables) for the individual values, and simply modifying the value of an individual custom property. example code follows at the end of t...
...these are still applied when dealing with non-variable or variable fonts, but with variable ones, any number from 1 to 1000 is now valid. ...
...And 12 more matches
Basic Shapes - CSS: Cascading Style Sheets
css shapes can be defined using the <basic-shape> type, and in this guide i’ll explain how each of the different values accepted by this type work. they range from simple circles to complex polygons. before looking at the shapes, it is worth understanding two pieces of information that go together to make these shapes possible: the <basic-shape> type the reference box the <basic-shape> type the <basic-shape> type is used as the value for all of our basic shapes. this type uses functional notation: the type of shape is followed by brackets, inside of which are additional values used to describe the shape. the arguments which are accepted vary depending on the shape that you are creating. we will cover these in the examples below. the reference box understanding the reference box us...
... the firefox shapes inspector helpfully shows the reference box in use when you inspect a shape. in the screenshot below i have created a circle, using shape-outside: circle(50%). the floated element has 20 pixels of padding, border and margin applied, and the shapes inspector highlights these reference boxes. ...
...reated a circle, using shape-outside: circle(50%). the floated element has 20 pixels of padding, border and margin applied, and the shapes inspector highlights these reference boxes. when using a basic shape the reference box used by default is the margin-box. you can see in the screenshot that the shape is being defined with reference to that part of the box model. you can add the various box values after your basic shape definition. therefore the default behaviour is as if you have defined. .shape { shape-outside: circle(50%) margin-box; } you can therefore change this in order that your shape uses the different parts of the box model, for example to use the border. .shape { shape-outside: circle(50%) border-box; } what is worth noting is that the margin-box will clip the shape, ...
...And 12 more matches
break-after - CSS: Cascading Style Sheets
the break-after css property sets how page, column, or region breaks should behave after a generated box. if there is no generated box, the property is ignored. ...
... the break-after css property sets how page, column, or region breaks should behave after a generated box. if there is no generated box, the property is ignored. ...
...s how page, column, or region breaks should behave after a generated box. if there is no generated box, the property is ignored. ...
...And 12 more matches
break-before - CSS: Cascading Style Sheets
the break-before css property sets how page, column, or region breaks should behave before a generated box. if there is no generated box, the property is ignored. ...
... the break-before css property sets how page, column, or region breaks should behave before a generated box. if there is no generated box, the property is ignored. ...
... column, or region breaks should behave before a generated box. if there is no generated box, the property is ignored. ...
...And 12 more matches
font-size - CSS: Cascading Style Sheets
Web › CSS › font-size
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. ...
...s stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...o the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 12 more matches
place-content - CSS: Cascading Style Sheets
ve example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...operty is a shorthand for the following css properties: align-content justify-content syntax /* positional alignment */ /* align-content does not take left and right values */ place-content: center start; place-content: start center; place-content: end left; place-content: flex-start center; place-content: flex-end center; /* baseline alignment */ /* justify-content does not take baseline values */ place-content: baseline center; place-content: first baseline space-evenly; place-content: last baseline right; /* distributed alignment */ place-content: space-between space-evenly; place-content: space-around space-evenly; place-content: space-evenly stretch; place-content: stretch space-evenly; /* global values */ place-content: inherit; place-content: initial; place-content: unset; the...
...ace-content: baseline center; place-content: first baseline space-evenly; place-content: last baseline right; /* distributed alignment */ place-content: space-between space-evenly; place-content: space-around space-evenly; place-content: space-evenly stretch; place-content: stretch space-evenly; /* global values */ place-content: inherit; place-content: initial; place-content: unset; the first value is the align-content property value, the second the justify-content one. ...
...And 12 more matches
place-items - CSS: Cascading Style Sheets
the css place-items shorthand property allows you to align items along both the block and inline directions at once (i.e. the align-items and justify-items properties) in a relevant layout system such as grid or flexbox. if the second value is not set, the first value is also used for it. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... first value is also used for it. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... normal the effect of this keyword is dependent of the layout mode we are in: in block-level layouts, the keyword is a synonym of s...
...And 12 more matches
Default parameters - JavaScript
default function parameters allow named parameters to be initialized with default values if no value or undefined is passed. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax function [name]([param1[ = defaultvalue1 ][, ..., paramn[ = defaultvaluen ]]]) { statements } description in javascript, function parameters default to undefined. however, it's often useful to set a different default value. this is where default parameters can help. in the past, the general strategy for setting defaults was to test parameter values in the function body and assign a value if they are undefined. in the following exam...
...mn[ = defaultvaluen ]]]) { statements } description in javascript, function parameters default to undefined. however, it's often useful to set a different default value. this is where default parameters can help. in the past, the general strategy for setting defaults was to test parameter values in the function body and assign a value if they are undefined. in the following example, if no value is provided for b when multiply is called, b's value would be undefined when evaluating a * b and multiply would return nan. function multiply(a, b) { return a * b } multiply(5, 2) // 10 multiply(5) // nan ! to guard against this, something like the second line would be used, where b is set to 1 if multiply is called with only one argument: function multiply(a, b) { b = (typeof b !=...
...nan ! to guard against this, something like the second line would be used, where b is set to 1 if multiply is called with only one argument: function multiply(a, b) { b = (typeof b !== 'undefined') ? b : 1 return a * b } multiply(5, 2) // 10 multiply(5) // 5 with default parameters in es2015, checks in the function body are no longer necessary. ...
...And 12 more matches
Promise.all() - JavaScript
hrowing an error, and will reject with this first rejection message / error. the source for this interactive demo is stored in a github repository. if you'd like to contribute to the interactive demo project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax promise.all(iterable); parameters iterable an iterable object such as an array. return value an already resolved promise if the iterable passed is empty. an asynchronously resolved promise if the iterable passed contains no promises. note, google chrome 58 returns an already resolved promise in this case. a pending promise in all other cases. this returned promise is then resolved/rejected asynchronously (as soon as the stack is empty) when all the promises in the given iterable hav...
...no promises. note, google chrome 58 returns an already resolved promise in this case. a pending promise in all other cases. this returned promise is then resolved/rejected asynchronously (as soon as the stack is empty) when all the promises in the given iterable have resolved, or if any of the promises reject. see the example about "asynchronicity or synchronicity of promise.all" below. returned values will be in order of the promises passed, regardless of completion order. description this method can be useful for aggregating the results of multiple promises. it is typically used when there are multiple asynchronous tasks that are dependent on one another to complete successfully, as it does not wait and will reject immediately upon any of the input promises rejecting. in comparison, th...
...eject immediately upon any of the input promises rejecting. in comparison, the promise returned by promise.allsettled() will wait for all input promises to complete, regardless of whether or not one rejects. consequently, it will always return the final result of every promise and function from the input iterable. fulfillment the returned promise is fulfilled with an array containing all the values of the iterable passed as argument (also non-promise values). if an empty iterable is passed, then this method returns (synchronously) an already resolved promise. if all of the passed-in promises fulfill, or are not promises, the promise returned by promise.all is fulfilled asynchronously. rejection if any of the passed-in promises reject, promise.all asynchronously rejects with the valu...
...And 12 more matches
TypedArray - JavaScript
on the following pages you will find common properties and methods that can be used with any typed array containing elements of any type. the source for this interactive example is stored in a github repository. ...
...seful to polyfill functions or properties onto all typedarray constructors. when creating an instance of a typedarray (e.g. int8array), an array buffer is created internally in memory or, if an arraybuffer object is given as constructor argument, then this is used instead. the buffer address is saved as an internal property of the instance and all the methods of %typedarray%.prototype, i.e. ...
...ill functions or properties onto all typedarray constructors. when creating an instance of a typedarray (e.g. int8array), an array buffer is created internally in memory or, if an arraybuffer object is given as constructor argument, then this is used instead. the buffer address is saved as an internal property of the instance and all the methods of %typedarray%.prototype, i.e. ...
...And 12 more matches
Destructuring assignment - 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. ...
...(finished) proposal ({a, b, ...rest} = {a: 10, b: 20, c: 30, d: 40}); console.log(a); // 10 console.log(b); // 20 console.log(rest); // {c: 30, d: 40} description the object and array literal expressions provide an easy way to create ad hoc packages of data. const x = [1, 2, 3, 4, 5]; the destructuring assignment uses similar syntax, but on the left-hand side of the assignment to define what values to unpack from the sourced variable. const x = [1, 2, 3, 4, 5]; const [y, z] = x; console.log(y); // 1 console.log(z); // 2 this capability is similar to features present in languages such as perl and python. examples array destructuring basic variable assignment const foo = ['one', 'two', 'three']; const [red, yellow, green] = foo; console.log(red); // "one" console.log(yellow); // "two...
...1 console.log(z); // 2 this capability is similar to features present in languages such as perl and python. ...
...And 12 more matches
this - JavaScript
a function's this keyword behaves a little differently in javascript compared to other languages. it also has some differences between strict mode and non-strict mode. in most cases, the value of this is determined by how a function is called (runtime binding). it can't be set by assignment during execution, and it may be different each time the function is called. es5 introduced the bind() method to set the value of a function's this regardless of how it's called, and es2015 introduced arrow functions which don't provide their own this binding (it retains the this value of the enclosing lexical context). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-...
...w it's called, and es2015 introduced arrow functions which don't provide their own this binding (it retains the this value of the enclosing lexical context). the source for this interactive example is stored in a github repository. if 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 this value a property of an execution context (global, function or eval) that, in non–strict mode, is always a reference to an object and in strict mode can be any value. description global context in the global execution context (outside of any function), this refers to the global object whether in strict mode or not. // in web browsers, the window object is also the global object: console.log(this ...
...he window object is also the global object: console.log(this === window); // true a = 37; console.log(window.a); // 37 this.b = "mdn"; console.log(window.b) // "mdn" console.log(b) // "mdn" note: you can always easily get the global object using the global globalthis property, regardless of the current context in which your code is running. ...
...And 12 more matches
dx - SVG: Scalable Vector Graphics
Web › SVG › Attribute › dx
"0" y2="100%" /> <!-- some reference text --> <text x="10%" y="50%" fill="grey">svg</text> <!-- the same text with a shift along the x-axis --> <text dx="50%" x="10%" y="50%">svg</text> </svg> line { stroke: red; stroke-width: .5px; stroke-dasharray: 3px; } altglyph warning: as of svg2 <altglyph> is deprecated and shouldn't be used. ...
.../text> <!-- the same text with a shift along the x-axis --> <text dx="50%" x="10%" y="50%">svg</text> </svg> line { stroke: red; stroke-width: .5px; stroke-dasharray: 3px; } altglyph warning: as of svg2 <altglyph> is deprecated and shouldn't be used. for <altglyph>, if it contains a single value, dx defines a shift along the x-axis for all alternate glyph. ...
... stroke: red; stroke-width: .5px; stroke-dasharray: 3px; } altglyph warning: as of svg2 <altglyph> is deprecated and shouldn't be used. for <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. ...
...And 12 more matches
dy - SVG: Scalable Vector Graphics
Web › SVG › Attribute › dy
"80%" y2="80%" /> <!-- some reference text --> <text x="10%" y="30%" fill="grey">svg</text> <!-- the same text with a shift along the y-axis --> <text dy="50%" x="10%" y="30%">svg</text> </svg> line { stroke: red; stroke-width: .5px; stroke-dasharray: 3px; } altglyph warning: as of svg2 <altglyph> is deprecated and shouldn't be used. ...
.../text> <!-- the same text with a shift along the y-axis --> <text dy="50%" x="10%" y="30%">svg</text> </svg> line { stroke: red; stroke-width: .5px; stroke-dasharray: 3px; } altglyph warning: as of svg2 <altglyph> is deprecated and shouldn't be used. for <altglyph>, if it contains a single value, dy defines a shift along the y-axis for all alternate glyph. ...
... stroke: red; stroke-width: .5px; stroke-dasharray: 3px; } altglyph warning: as of svg2 <altglyph> is deprecated and shouldn't be used. for <altglyph>, 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. ...
...And 12 more matches
<pattern> - SVG: Scalable Vector Graphics
Web › SVG › Element › pattern
> <defs> <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. ...
...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. ...
... </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; animatable: yes note: this attribute has no effect if a viewbox attribute is specified on the <pattern> element. patterntransfo...
...And 12 more matches
Using the WebAssembly JavaScript API - WebAssembly
cess its exported function — all in one step. add the following to your script, below the first block: webassembly.instantiatestreaming(fetch('simple.wasm'), importobject) .then(obj => obj.instance.exports.exported_func()); the net result of this is that we call our exported webassembly function exported_func, which in turn calls our imported javascript function imported_func, which logs the value provided inside the webassembly instance (42) to the console. if you save your example code now and load it a browser that supports webassembly, you’ll see this in action! note: this is a convoluted, longwinded example that achieves very little, but it does serve to illustrate what is possible — using webassembly code alongside javascript in your web applications. as we’ve said elsewhere,...
...fixed to 64kb in size. this means that the above memory instance has an initial size of 640kb, and a maximum size of 6.4mb. webassembly memory exposes its bytes by simply providing a buffer getter/setter that returns an arraybuffer. ...
...the engine takes advantage of this supplied upper-bounds to reserve memory ahead of time, which can make resizing more efficient. ...
...And 12 more matches
JavaScript Daemons Management - Archive of obsolete content
invoked repeatedly. it will be called with three parameters: index (the iterative index of each invocation), length (the number of total invocations assigned to the daemon - finite or infinity), and backwards (a boolean expressing whether the process is going backwards or not). it will be something like callback.call(thisobject, index, length, backwards). if the callback function returns a false value, the daemon will be paused. rate optional the time lapse (in number of milliseconds) between each invocation. the default value is 100. length optional the total number of invocations. it can be a positive integer or infinity. the default value is infinity. init optional the function which will be synchronously invoked once during the creation of the daemon and then assigned to the onstop p...
... onstart optional the function which will be synchronously invoked whenever the start event occurs. it will be assigned to the onstart property. ...
...he this object of your callback function. so you can populate it with all your custom properties and methods. the only required one property is perform. sample usage: var mydaemon = daemon.buildaround({ "create": function () { [custom code] }, // optional "prepare": function () { [custom code] }, // optional "perform": function () { [custom code] }, // required "customproperty": [custom value], "mycustommethod": function () { [custom code] }, "anothercustomproperty": [custom value], "etc.": "etc." }, 200, 30); daemon.incorporate(function) the function.prototype property will replaced with a new daemon() object. the old replaced prototype will be preserved within a new property of the new function.prototype object named legacy. other constructors daemon.blank() constructs...
...And 11 more matches
SQLite Templates - Archive of obsolete content
« previousnext » templates may use a datasource that is retrieved from an sqlite database, such as those used by the mozstorage api. this allows information from the database to be used to generate xul content. to do this, set the querytype attribute on the root node of the template to the value storage. this will cause the datasource to be treated as an sqlite database. the datasources attribute may be set to one of two possible types of values. first, it may a file url pointing to a file on disk. in this case, you will often be setting the datasources attribute dynamically after determining the file path. (if you intend to set it by script, you must set datasources in the xul to rdf:null). the second method involves using a special url form: profile:filename.sqlite this for...
...ectory. this is useful for user data, and is suitable as you do not need to calculate where this directory is located. the file within this directory is specified after the colon, in this case 'filename.sqlite'. sqlite files typically have the 'sqlite' extension. as with xml datasources, the ref attribute isn't currently used for sqlite sources, so you should just set the ref attribute to a dummy value; '*' is typically used. the query for an sqlite datasource is just an sql select statement, as text inside the query element. this simple example shows how to display a listbox containing the values in one column in a database table. <listbox datasources="profile:userdata.sqlite" ref="*" querytype="storage"> <template> <query> select name from myfriends </query> <action> ...
...e the query element. this simple example shows how to display a listbox containing the values in one column in a database table. <listbox datasources="profile:userdata.sqlite" ref="*" querytype="storage"> <template> <query> select name from myfriends </query> <action> <listitem uri="?" label="?name"/> </action> </template> </listbox> the query returns the list of values from the 'name' column in the table 'myfriends'. the action body, starting at the node with uri="?" is repeated for each result returned from the query. if the query returns six results, six listitems will be generated. the labels have the special value '?name'. ...
...And 11 more matches
Using Remote XUL - Archive of obsolete content
a xul iframe element. <?xml version="1.0"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <iframe src="https://www.mozilla.org/" flex="1" /> </window> the xul iframe element is just like its html counterpart: it defines an area within which web content can be displayed. its src attribute contains the url of the page being displayed in the iframe. ...
...e iframe. we set this value to the mozilla.org home page by default so that page loads into the iframe when we first load the xul document. the iframe's flex attribute tells the browser to stretch the iframe to fill the space available to it. without it, the iframe's size would be a fixed default and wouldn't change when the user resized their window. [optionally show what this looks like] the value of the flex attribute determines the extent to which the element will stretch relative to other flexible elements. an element with a flex of "2" is twice as flexible as an element with a flex of "1", so the first element might show up as twice as wide as the second. ...
... [optionally add something about how flex only applies to one axis] note that for remote xul documents you can see changes you make to the ui by reloading the document with your browser's "reload" function, just as with a typical html page. ...
...And 11 more matches
menuseparator - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] used to create a separator between menu items. typically drawn as a thin line. more information is available in the xul tutorial. ...
...related ] used to create a separator between menu items. typically drawn as a thin line. more information is available in the xul tutorial. ...
...this attribute does not apply to menus directly on the menubar. accesskey type: character this should be set to a character that is used as a shortcut key. this should be one of the characters that appears in the label attribute for the element. ...
...And 11 more matches
scale - Archive of obsolete content
Archive › Mozilla › XUL › scale
« xul reference home [ examples | attributes | properties | methods | related ] a scale (sometimes referred to as a "slider") allows the user to select a value from a range. a bar displayed either horizontally or vertically allows the user to select a value by dragging a thumb on the bar. use the orient attribute to specify the orientation of the scale. the default value is horizontal which displays a horizontal scale. lower values are to the left and higher values are to the right. set the orient attribute to vertical to use a vertical scale. the user may use the arrow keys to increment and decrement the value by one unit, or the page up and page down keys to increment and decrement the value by one page, as specified by the pageincrement attribute. the home and end keys set th...
...ys a horizontal scale. lower values are to the left and higher values are to the right. set the orient attribute to vertical to use a vertical scale. the user may use the arrow keys to increment and decrement the value by one unit, or the page up and page down keys to increment and decrement the value by one page, as specified by the pageincrement attribute. the home and end keys set the scale's value to the minimum and maximum values, respectively. a scale will fire a change event whenever the scale's value is modified. ...
...ue by one unit, or the page up and page down keys to increment and decrement the value by one page, as specified by the pageincrement attribute. the home and end keys set the scale's value to the minimum and maximum values, respectively. a scale will fire a change event whenever the scale's value is modified. attributes dir, disabled, increment, max, min, movetoclick, pageincrement, tabindex, value properties disabled, max, min, increment, pageincrement, tabindex, value, methods decrease, decreasepage, increase, increasepage, examples horizontal scale: <scale min="1" max="10"/> vertical scale: <scale min="1" max="10" orient="vertical"/> attributes dir type: one of the values below the direction in which the child elements of the element are placed. normal ...
...And 11 more matches
Using the W3C DOM - Archive of obsolete content
w3c standards means that code will run in compliant browsers with minimal need for cross-browser support, whereas code based on proprietary standards requires much more effort to be compatible with multiple user agents. ...
...iant browsers with minimal need for cross-browser support, whereas code based on proprietary standards requires much more effort to be compatible with multiple user agents. ...
...or cross-browser support, whereas code based on proprietary standards requires much more effort to be compatible with multiple user agents. unsupported dom-related properties the following ie proprietary document object properties are not supported in the w3c document object model: document.layers[] id_attribute_value document.all document.all.id_attribute_value document.all[id_attribute_value] the following form related properties (originally from internet explorer) are not supported in the w3c document object model: formname.inputname.value inputname.value formctrlname document.forms(0) (note: document.forms[0] (using square brackets) uses the dom standard forms collection) scripts that use these properties will throw errors in most standards-compliant browsers. instead, us...
...And 11 more matches
Dict.jsm
introduced in firefox 5, this is now obsolete and has been removed in firefox 40: use es2015 map. the dict.jsm javascript code module offers routines for managing dictionaries of key/value pairs. to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://gre/modules/dict.jsm"); creating a dictionary you can create a new, empty dictionary by simply calling the dict() constructor: var newdict = new dict(); if you wish, you may also pass in an object literal of key/value pairs with which to initialize the dictionary: var someobj = {}; var newdict = new dict({key1: "foo", key2: someobj}); note that values may be any javascript object type. note: you can actually specify non-strings as keys; these are converted to strings...
...lize the dictionary: var somejson = '{key1: "foo", key2: {}}'; var newdict = new dict(somejson); note: any string you pass will be assumed to be json. method overview dict copy(); boolean del(string akey); object get(string akey, [optional] object adefault); boolean has(string akey); array listitems(); array listkeys(); array listvalues(); void set(string akey, object avalue); string tojson(); string tostring(); properties attribute type description count number the number of items in the dictionary. items iterator returns an iterator over all of the items in the dictionary; each item is returned as a pair (a two-element array) with the first ...
...ue); string tojson(); string tostring(); properties attribute type description count number the number of items in the dictionary. items iterator returns an iterator over all of the items in the dictionary; each item is returned as a pair (a two-element array) with the first element being the key and the second being the value. note: the order in which items are returned is arbitrary, and may change without notice. in addition, if the dictionary changes during iteration, no guarantees are made as to what will happen. keys iterator returns an iterator over all the keys in the dictionary. note: the order in which items are returned is arbitrary, and may change without notice. in addition...
...And 11 more matches
Mork
Mozilla › Tech › Mork
formation on this page was constructed by reading the source code of the mork database in mozilla and attempting to codify what it parses as faithfully as possible. in a few cases, constructs that the parser supported but were never used in mozilla's code are left unspecified. mork structure mork is a schema-less database format. ...
... what it parses as faithfully as possible. in a few cases, constructs that the parser supported but were never used in mozilla's code are left unspecified. mork structure mork is a schema-less database format. at its core, it can be viewed as a set of rows, collections of name-value pairs, which can be organized into various tables. rows need not be in a table, nor need they be in only one table. values are merely an opaque sequence of bytes, so their actual content is dependent on the mork consumer. except when parsing values, whitespace ('\b', '\t', '\r', '\n', '\f', ' ', and '\x7f'), line continuations ('\\' followed by a newline), and comments (c++ or c style) can be ignored. in practice, only c++-style comments, and the standard whitespace characters ('\t', ' ', '\r', '\n') appear to be us...
...it is structured as a comment so it can be s...
...And 11 more matches
Using the Places annotation service
vice so that you require hundreds of unique annotation names. setting an annotation the annotation provides a variety of scriptable and non-scriptable setters for annotations on both pages and on items in the places database (see nsiannotationservice.idl for the exact declarations). ...
...ing an annotation the annotation provides a variety of scriptable and non-scriptable setters for annotations on both pages and on items in the places database (see nsiannotationservice.idl for the exact declarations). ...
...and non-scriptable setters for annotations on both pages and on items in the places database (see nsiannotationservice.idl for the exact declarations). ...
...And 11 more matches
inIDOMUtils
nt aelement, in domstring apseudoclass); astring rgbtocolorname(in octet ar, in octet ag, in octet ab); bool selectormatcheselement(in nsidomelement aelement, in nsidomcssstylerule arule, in unsigned long aselectorindex, [optional] in domstring apseudo); void setcontentstate(in nsidomelement aelement, in unsigned long long astate); constants constant value description exclude_shorthands (1<<0) include_aliases (1<<1) content state flags the content state flags are used in a bitmask. value state 1 :active 2 :focus 4 :hover 8 :-moz-drag-over 16 :target 1<<29 :-moz-focusring methods getbindingurls() returns an array o...
...ve 2 :focus 4 :hover 8 :-moz-drag-over 16 :target 1<<29 :-moz-focusring methods getbindingurls() returns an array of nsiuri objects representing the current xml binding for the specified element. nsiarray getbindingurls( in nsidomelement aelement ); parameters aelement a dom element to retrieve the bindings of. return value an array of nsiuri objects representing the current xbl binding (if any) for the element and its hierarchy of base bindings. getchildrenfornode() returns a list of dom nodes that are children of the specified node. nsidomnodelist getchildrenfornode( in nsidomnode anode, in boolean ashowinganonymouscontent ); parameters anode a dom node for which to retrieve the style nodes. ashowin...
... element and its hierarchy of base bindings. getchildrenfornode() returns a list of dom nodes that are children of the specified node. nsidomnodelist getchildrenfornode( in nsidomnode anode, in boolean ashowinganonymouscontent ); parameters anode a dom node for which to retrieve the style nodes. ashowinganonymouscontent whether you are interested in the xbl flattened tree. return value a dom nodelist of the child nodes. if you have requested anonymous content, then if the element has an xbl binding then this will be the binding's anonymous nodes, otherwise if the element is itself an anonymous node containing an insertion point then this will be a list combining the element's explicit children from its binding parent's anonymous nodes and any children inserted as a result of t...
...And 11 more matches
nsIXULTemplateQueryProcessor
ant when generating output recursively, as the query will be the same for each iteration, however, the reference point will differ. for instance, when examining an xml source, an xml query processor might begin at the node referred by the reference variable and end at a list of that node's children. some queries may not need the reference variable if the syntax or the form of the data implies the value. ...
...for example, a query might have the following syntax: (?id, ?name, ?url) from bookmarks where parentfolder = ?start this query might generate a result for each bookmark within a given folder. ...
... template by setting the "container" attribute on the <template> element to the variable to use. the member variable may be specified in a similar way using the "member" attribute, or it may be specified in the first <action> body in the template as the value of a uri attribute on an element. a breadth-first search of the first action is performed to find this element. if unspecified, the default value of the reference variable is ?uri. for example, a query might have the following syntax: (?id, ?name, ?url) from bookmarks where parentfolder = ?start this query might generate a result for each bookmark within a given folder. the variable ?start would be the reference variable, while the variable ?id would be the member variable, since it is the unique value that identifies a result. each result...
...And 11 more matches
nsIAbCard/Thunderbird3
hyear, birthmonth, birthday webpage1 (work), webpage2 (home) custom1, custom2, custom3, custom4 notes integral properties: lastmodifieddate popularityindex prefermailformat (see nsiabprefermailformat) boolean properties: allowremotecontent inherits from: nsiabitem method overview nsivariant getproperty(in autf8string name, in nsivariant defaultvalue); [noscript] astring getpropertyasastring(in string name); [noscript] autf8string getpropertyasautf8string(in string name); [noscript] pruint32 getpropertyasuint32(in string name); [noscript] boolean getpropertyasbool(in string name); void setproperty(in autf8string name, in nsivariant value); [noscript] void setpropertyasastring(in string nam...
...oscript] astring getpropertyasastring(in string name); [noscript] autf8string getpropertyasautf8string(in string name); [noscript] pruint32 getpropertyasuint32(in string name); [noscript] boolean getpropertyasbool(in string name); void setproperty(in autf8string name, in nsivariant value); [noscript] void setpropertyasastring(in string name, in astring value); [noscript] void setpropertyasautf8string(in string name, in autf8string value); [noscript] void setpropertyasuint32(in string name, in pruint32 value); [noscript] void setpropertyasbool(in string name, in boolean value); void deleteproperty(in autf8string name); autf8string translateto(in autf8string atype); void copy(in nsiabcard srccard) ...
...ail list. this will be removed from the interface at a later date. maillisturi string if ismaillist is true then maillisturi will contain the uri of the associated mail list. this will be removed from the interface at a later date. methods getproperty() returns a property for the given name. nsivariant getproperty(in autf8string name, in nsivariant defaultvalue); parameters name the case-sensitive name of the property to get. defaultvalue the value to return if the property does not exist. return value the value of the attribute asked for. exceptions thrown ns_error_not_available<tt> if the named property does not exist. <tt>ns_error_cannot_convert_data if the property cannot be converted to the desired type. getpropertyasastring(...
...And 11 more matches
Constraint validation API - Web APIs
the constraint validation api enables checking values that users have entered into form controls, before submitting the values to the server. concepts and usage certain html form controls, such as <input>, <select> and <textarea>, can restrict the format of allowable values, using attributes like required and pattern to set basic constraints. however, you may want to impose more complex constraints, or to provide clearer reporting of validation failures than the defaults. this can be done using the constraint validation api. note: client-side constraint validation doesn't remove the need for validation on the server side. ...
...d pattern to set basic constraints. however, you may want to impose more complex constraints, or to provide clearer reporting of validation failures than the defaults. this can be done using the constraint validation api. note: client-side constraint validation doesn't remove the need for validation on the server side. even though client-side validation can prevent many common kinds of invalid values, invalid ones can still be sent by older browsers or by attackers trying to trick your web application. therefore, you need to also validate input values on the server side, in a way that is consistent with what is done on the client side. client side validation is a tool for giving quick feedback to the user. you should not rely on it to completely sanitize data received by the server. valida...
...idation of constraints through the constraint validation api is done either on a single form element or at the form level, on the <form> element itself. constraint validation interfaces validitystate the validitystate interface represents the validity states that a form control element can have, with respect to its defined constraints. together, they help explain whether and why an element's value fails to validate. invalid event this event type is fired at a form control element if the element does not satisfy its constraints. extensions to other interfaces the constraint validation api extends the interfaces for the form-associated elements listed below with a number of new properties and methods (elements that can have a form attribute that indicates their form owner): htmlbutto...
...And 11 more matches
Element.classList - Web APIs
Web › API › Element › classList
object, hasownprop = object.prototype.hasownproperty; var defineproperty = object.defineproperty, 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]; t...
...ion(){ 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, 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="", i...
..." 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.length -= 1, proto.value = resstr; } skippropchange = 1, ele.classname = proto.value, skippropchange = 0; }; window.domtokenlist = domtokenlist; function whenpropchanges(){ var evt = window.event, prop = evt.propertyname; if ( !skippropchange && (prop==="classname" || (prop==="classlist" && !defineproperty)) ) { var target = evt.srcelement, protoobjproto = target[" ...
...And 11 more matches
KeyboardEvent.key - Web APIs
Web › API › KeyboardEvent › key
the keyboardevent interface's key read-only property returns the value of the key pressed by the user, taking into consideration the state of modifier keys such as shift as well as the keyboard locale and layout. its value is determined as follows: key values see a full list of key values. if the pressed key has a printed representation, the returned value is a non-empty unicode character string containing the printable representation of the key. if the pressed key is a control or special character, the returned value is one of the pre-defined key values. if the keyboardevent represents the press of a dead key, the key value must be "dead". some specialty keyboard keys (such as the extended keys for controlling media on multimedia keyboards) don't generate key codes on windows; inste...
...e must be "dead". some specialty keyboard keys (such as the extended keys for controlling media on multimedia keyboards) don't generate key codes on windows; instead, they trigger wm_appcommand events. these events get mapped to dom keyboard events, and are listed among the "virtual key codes" for windows, even though they aren't actually key codes. if the key cannot be identified, the returned value is unidentified. keyboardevent sequence every keyboardevent is fired in a pre-determined sequence. for a given key press, the sequence of keyboardevents fired is as follows assuming that event.preventdefault is not called: a keydown event is first fired. if the key is held down further and the key produces a character key, then the event continues to be emitted in a platform implementation ...
...tenteditable set to true, the beforeinput and input event types are fired in that order. note that some other implementations may fire keypress event if supported. the events will be fired repeatedly while the key is held down. a keyup event is fired once the key is released. this completes the process. in sequence 1 & 3, the keyboardevent.key attribute is defined and is set appropriately to a value according to the rules defined ealier. keyboardevent sequence example consider the event sequence generated when we interact with the shift and the 2 key using a u.s keyboard layout as compared to when we do so using a uk keyboard layout. try experimenting using the following two test cases: press and hold the shift key, then press 2 and release it. next, release the shift key. press and h...
...And 11 more matches
MediaTrackConstraints - Web APIs
the specifics vary somewhat depending on the type of the constrainable property. ...
...the specifics vary somewhat depending on the type of the constrainable property. ...
...the specifics vary somewhat depending on the type of the constrainable property. ...
...And 11 more matches
RTCIceCandidatePairStats - Web APIs
tcpeerconnection while connected and configured as described by the specified pair of ice candidates. if a rtcstats-based object's type is candidate-pair, it's an rtcicecandidatepairstats object. properties rtcicecandidatepairstats is based upon rtcstats and inherits its properties. ...
...this does not take into account the size of the ip overhead, nor any other transport layers such as tcp or udp. ...
...oad bytes received (that is, the total number of bytes received minus any headers, padding, or other administrative overhead) on this candidate pair so far. bytessent optional the total number of payload bytes sent (that is, the total number of bytes sent minus any headers, padding, or other administrative overhead) so far on this candidate pair. circuitbreakertriggercount optional an integer value indicating the number of times the circuit-breaker has been triggered for this particular 5-tuple (the set of five values comprising a tcp connection: source ip address, source port number, destination ip address, destination port number, and protocol). the circuit breaker is triggered whenever a connection times out or otherwise needs to be automatically aborted. consentexpiredtimestamp optiona...
...And 11 more matches
WebGLRenderingContext.vertexAttribPointer() - Web APIs
er object and specifies its layout. syntax void gl.vertexattribpointer(index, size, type, normalized, stride, offset); parameters index a gluint specifying the index of the vertex attribute that is to be modified. size a glint specifying the number of components per vertex attribute. must be 1, 2, 3, or 4. type a glenum specifying the data type of each component in the array. ...
...d gl.vertexattribpointer(index, size, type, normalized, stride, offset); parameters index a gluint specifying the index of the vertex attribute that is to be modified. size a glint specifying the number of components per vertex attribute. must be 1, 2, 3, or 4. type a glenum specifying the data type of each component in the array. ...
..., offset); parameters index a gluint specifying the index of the vertex attribute that is to be modified. size a glint specifying the number of components per vertex attribute. must be 1, 2, 3, or 4. type a glenum specifying the data type of each component in the array. ...
...And 11 more matches
Using XMLHttpRequest - Web APIs
ast chunk in cases in which the last packet is received and the connection closed before the progress event is fired. in this case, the progress event is automatically fired when the load event occurs for that packet. this lets you now reliably monitor progress by only watching the "progress" event. note: as of gecko 12.0, if your progress event is called with a responsetype of "moz-blob", the value of response is a blob containing the data received so far. one can also detect all three load-ending conditions (abort, load, or error) using the loadend event: req.addeventlistener("loadend", loadend); function loadend(e) { console.log("the transfer finished (although we don't know if it succeeded or not)."); } note there is no way to be certain, from the information received by the load...
...sfieldtype !== "checkbox") || ofield.checked) { /* note: this will submit _all_ submit buttons. detecting the correct one is non-trivial. ...
... type is not file or is file but is empty */ this.segments.push( this.technique === 3 ? ...
...And 11 more matches
Accessibility documentation index - Accessibility
s technique demonstrates how to use the aria-hidden attribute. the aria-hidden attribute can either expose or hide non-interactive content from the accessibility api. 20 using the aria-invalid attribute aria, accessibility, attribute, codingscripting, html, javascript, needscontent, role(2), agent, alert, user, useragent the aria-invalid attribute is used to indicate that the value entered into an input field does not conform to the format expected by the application.this may include formats such as email addresses or telephone numbers. aria-invalid can also be used to indicate that a required field has not been filled in.the attribute should be programmatically set as a result of a validation process. 21 using the aria-label attribute aria, accessibility, co...
...ibute is used to define a string that labels the current element. use it in cases where a text label is not visible on the screen. if there is visible text labeling the element, use aria-labelledby instead. 22 using the aria-labelledby attribute aria, accessibility, broken link the aria-labelledby attribute establishes relationships between objects and their label(s), and its value should be one or more element ids, which refer to elements that have the text needed for labeling. list multiple element ids in a space delimited fashion.this idea is similar to how the "for" attribute is used to link a label to an input.assistive technology, such as screen readers, use this attribute to catalog the objects in a document so that users can navigate between them. without an element...
...sistive technology cannot catalog the object. 23 using the aria-orientation attribute aria, accessibility, attribute the aria-orientation attribute is used to indicate whether an element is oriented horizontally or vertically. 24 using the aria-relevant attribute aria, accessibility, needsexample, arialive, attri the aria-relevant attribute is an optional value used to describe what types of changes have occurred to an aria-live region, and which are relevant and should be announced. any change that is not relevant acts in the same manner it would if the aria-live attribute were set to off. 25 using the aria-required attribute aria, accessibility, needscontent the aria-required attribute is used to indicate that user input is requir...
...And 11 more matches
background-color - CSS: Cascading Style Sheets
the background-color css property sets the background color 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. ...
... the background-color css property sets the background color 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. ...
...red; background-color: indigo; /* hexadecimal value */ background-color: #bbff00; /* fully opaque */ background-color: #bf0; /* fully opaque shorthand */ background-color: #11ffee00; /* fully transparent */ background-color: #1fe0; /* fully transparent shorthand */ background-color: #11ffeeff; /* fully opaque */ background-color: #1fef; /* fully opaque shorthand */ /* rgb value */ background-color: rgb(255, 255, 128); /* fully opaque */ background-color: rgba(117, 190, 218, 0.5); /* 50% transparent */ /* hsl value */ background-color: hsl(50, 33%, 25%); /* fully opaque */ background-color: hsla(50, 33%, 25%, 0.75); /* 75% transparent */ /* special keyword values */ background-color: currentcolor; background-color: transparent; /* global values */ bac...
...And 11 more matches
<basic-shape> - CSS: Cascading Style Sheets
s interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax the <basic-shape> data type is defined with one of the basic shape functions listed below. ...
... inset() inset( <shape-arg>{1,4} [round <border-radius>]? ) defines an inset rectangle. ...
...e 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 represent the top, right, bottom and left offsets from the reference box inward that define the positions of the edges of the inset rectangle. these arguments follow the syntax of the margin shorthand, that let you set all four ...
...And 11 more matches
clip-path - CSS: Cascading Style Sheets
Web › CSS › clip-path
creates a clipping region that sets what part of an element should be shown. parts that are inside the region are shown, while those outside are hidden. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... of an element should be shown. parts that are inside the region are shown, while those outside are hidden. the source for this interactive example is stored in a github repository. if 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 are shown, while those outside are hidden. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 11 more matches
env() - CSS: Cascading Style Sheets
Web › CSS › env
the env() css function can be used to insert the value of a user agent-defined environment variable into your css, in a similar fashion to the var() function and custom properties. the difference is that, as well as being user-agent defined rather than user-defined, environment variables are globally scoped to a document, whereas custom properties are scoped to the element(s) on which they are declared. ...
...nd custom properties. the difference is that, as well as being user-agent defined rather than user-defined, environment variables are globally scoped to a document, whereas custom properties are scoped to the element(s) on which they are declared. ...
...new viewport meta value: <meta name="viewport" content="viewport-fit=cover" /> body { padding: env(safe-area-inset-top, 20px) env(safe-area-inset-right, 20px) env(safe-area-inset-bottom, 20px) env(safe-area-inset-left, 20px); } in addition, unlike custom properties, which cannot be used outside of declarations, the env() function can be used in place of any part of a property value, or any part of a descriptor (e.g. in media query rules). as the spec evolves, it may also be usable in other places such as selectors. ...
...And 11 more matches
justify-items - CSS: Cascading Style Sheets
les project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the effect of this property is dependent of the layout mode we are in: in block-level layouts, it aligns the items inside their containing block on the inline axis. for absolutely-positioned elements, it aligns the items inside their containing block on the inline axis, accounting for the offset values of top, left, bottom, and right. in table cell layouts, this property is ignored (more about alignment in block, absolute positioned and table layout) in flexbox layouts, this property is ignored (more about alignment in flexbox) in grid layouts, it aligns the items inside their grid areas on the inline axis (more about alignment in grid layouts) syntax /* basic keywords */ justify-items: ...
... baseline alignment: the baseline keyword, plus optionally one of first or last. positional alignment: one of: center, start, end, flex-start, flex-end, self-start, self-end, left, or right. plus opt...
...ow alignment (for positional alignment only) */ justify-items: safe center; justify-items: unsafe center; /* legacy alignment */ justify-items: legacy right; justify-items: legacy left; justify-items: legacy center; /* global values */ justify-items: inherit; justify-items: initial; justify-items: unset; this property can take one of four different forms: basic keywords: one of the keyword values normal, auto, or stretch. baseline alignment: the baseline keyword, plus optionally one of first or last. ...
...And 11 more matches
mask-repeat - CSS: Cascading Style Sheets
the mask-repeat css property sets how mask images are repeated. a mask image can be repeated along the horizontal axis, the vertical axis, both axes, or not repeated at all. ...
... the mask-repeat css property sets how mask images are repeated. a mask image can be repeated along the horizontal axis, the vertical axis, both axes, or not repeated at all. ...
...he horizontal axis, the vertical axis, both axes, or not repeated at all. ...
...And 11 more matches
mask - CSS: Cascading Style Sheets
Web › CSS › mask
the mask css shorthand property hides an element (partially or fully) by masking or clipping the image at specific points. as well as the properties listed below, the mask shorthand also resets mask-border to its initial value. it is therefore recommended to use the mask shorthand rather than other shorthands or the individual properties to override any mask settings earlier in the cascade. this will ensure that mask-border has also been reset to allow the new styles to take effect. ...
...orthands or the individual properties to override any mask settings earlier in the cascade. this will ensure that mask-border has also been reset to allow the new styles to take effect. ...
...rties to override any mask settings earlier in the cascade. this will ensure that mask-border has also been reset to allow the new styles to take effect. ...
...And 11 more matches
Creating a cross-browser video player - Developer guides
" type="video/mp4"> <source src="video/tears-of-steel-battle-clip-medium.webm" type="video/webm"> <source src="video/tears-of-steel-battle-clip-medium.ogg" type="video/ogg"> <!-- flash fallback --> <object type="application/x-shockwave-flash" data="flash-player.swf?videourl=video/tears-of-steel-battle-clip-medium.mp4" width="1024" height="576"> <param name="movie" value="flash-player.swf?videourl=video/tears-of-steel-battle-clip-medium.mp4" /> <param name="allowfullscreen" value="true" /> <param name="wmode" value="transparent" /> <param name="flashvars" value="controlbar=over&amp;image=img/poster.jpg&amp;file=flash-player.swf?videourl=video/tears-of-steel-battle-clip-medium.mp4" /> <img alt="tears of steel poster image" src="...
... and ie9). this list is inserted after the <video> element, but inside the <figure> element (this is important for the fullscreen functionality, which is explained later on). ...
...d on the play/pause button, the handler first of all checks if the video is currently paused or has ended (via the media api's paused and ended attributes); if so, it uses the play() method to playback the video. otherwise the video must be playing, so it is paused using the pause() method. stop stop.addeventlistener('click', function(e) { video.pause(); video.currenttime = 0; progress.value = 0; }); the media api doesn't have a stop method, so to mimic this the video is paused, and its currenttime (i.e. the video's current playing position) and the <progress> element's position is set to 0 (more on the <progress> element later). mute mute.addeventlistener('click', function(e) { video.muted = !video.muted; }); the mute button is a simple toggle button that uses the media api...
...And 11 more matches
<img>: The Image Embed element - HTML: Hypertext Markup Language
Web › HTML › Element › img
hich a browser might not display images, such as: non-visual browsers (such as those used by people with visual impairments) the user chooses not to display images (saving bandwidth, privacy reasons) the image is invalid or an unsupported type in these cases, the browser may replace the image with the text in the element's alt attribute. for these reasons and others, provide a useful value for alt whenever possible. omitting alt altogether indicates that the image is a key part of the content and no textual equivalent is available. setting this attribute to an empty string (alt="") indicates that this image is not a key part of the content (it’s decoration or a tracking pixel), and that non-visual browsers may omit it from rendering. visual browsers will also hide the broken ...
...rver does not opt into allowing cross-origin access to the image data by the origin site (by not sending any access-control-allow-origin response header, or by not including the site's origin in any access-control-allow-origin response header it does send), then the browser marks the image as tainted and restricts access to its image data, preventing its usage in <canvas> elements. allowed values: anonymous a cors request is sent with credentials omitted (that is, no cookies, x.509 certificates, or authorization request header). use-credentials the cors request is sent with any credentials included (that is, cookies, x.509 certificates, and the authorization request header). if the server does not opt into sharing credentials with the origin site (by sending back the access-co...
...cors request is sent with any credentials included (that is, cookies, x.509 certificates, and the authorization request header). if the server does not opt into sharing credentials with the origin site (by sending back the access-control-allow-credentials: true response header), then the browser marks the image as tainted and restricts access to its image data. if the attribute has an invalid value, browsers handle it as if the anonymous value was used. see cors settings attributes for additional information. decoding provides an image decoding hint to the browser. allowed values: sync decode the image synchronously, for atomic presentation with other content. async decode the image asynchronously, to reduce delay in presenting other content. auto default: no prefere...
...And 11 more matches
<textarea> - HTML: Hypertext Markup Language
Web › HTML › Element › textarea
essibility purposes a name attribute to set the name of the associated data point submitted to the server when the form is submitted. rows and cols attributes to allow you to specify an exact size for the <textarea> to take. setting these is a good idea for consistency, as browser defaults can differ. default content entered between the opening and closing tags. <textarea> does not support the value attribute. the <textarea> element also accepts several attributes common to form <input>s, such as autocomplete, autofocus, disabled, placeholder, readonly, and required. attributes this element includes the global attributes. autocapitalize this is a non-standard attribute supported by webkit on ios (therefore nearly all browsers running on ios, including safari, firefox, and chrome), ...
...o accepts several attributes common to form <input>s, such as autocomplete, autofocus, disabled, placeholder, readonly, and required. attributes this element includes the global attributes. autocapitalize this is a non-standard attribute supported by webkit on ios (therefore nearly all browsers running on ios, including safari, firefox, and chrome), which controls whether and how the text value should be automatically capitalized as it is entered/edited by the user. the non-deprecated values are available in ios 5 and later. possible values are: none: completely disables automatic capitalization. sentences: automatically capitalize the first letter of sentences. words: automatically capitalize the first letter of words. characters: automatically capitalize all characters. on...
...ios 5 and later. possible values are: none: completely disables automatic capitalization. sentences: automatically capitalize the first letter of sentences. words: automatically capitalize the first letter of words. characters: automatically capitalize all characters. on: deprecated since ios 5. off: deprecated since ios 5. autocomplete this attribute indicates whether the value of the control can be automatically completed by the browser. possible values are: off: the user must explicitly enter a value into this field for every use, or the document provides its own auto-completion method; the browser does not automatically complete the entry. on: the browser can automatically complete the value based on values that the user has entered during previous uses. if...
...And 11 more matches
Set-Cookie - HTTP
header, as required by the fetch spec, which defines set-cookie as a forbidden response-header name that must be filtered out from any response exposed to frontend code. for more information, see the guide on http cookies. ...
...hich defines set-cookie as a forbidden response-header name that must be filtered out from any response exposed to frontend code. for more information, see the guide on http cookies. ...
...me that must be filtered out from any response exposed to frontend code. for more information, see the guide on http cookies. ...
...And 11 more matches
Array.prototype.every() - JavaScript
the every() method tests whether all elements in the array pass the test implemented by the provided function. it returns a boolean value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.every(callback(element[, index[, array]])[, thisarg]) parameters callback a function to test for each element, taking three arguments: element the current element being processed in the array. index optional the index of the current element being processed in the array. ...
...send us a pull request. syntax arr.every(callback(element[, index[, array]])[, thisarg]) parameters callback a function to test for each element, taking three arguments: element the current element being processed in the array. index optional the index of the current element being processed in the array. array optional the array every was called upon. thisarg optional a value to use as this when executing callback. return value true if the callback function returns a truthy value for every array element. otherwise, false. description the every method executes the provided callback function once for each element present in the array until it finds the one where callback returns a falsy value. if such an element is found, the every method immediately returns false.
... return value true if the callback function returns a truthy value for every array element. otherwise, false. description the every method executes the provided callback function once for each element present in the array until it finds the one where callback returns a falsy value. if such an element is found, the every method immediately returns false. otherwise, if callback returns a truthy value for all elements, every returns true. caution: calling this method on an empty array will return true for any condition! ...
...And 11 more matches
Object.create() - JavaScript
ertiesobject optional if specified and not undefined, an object whose enumerable own properties (that is, those properties defined upon itself and not enumerable properties along its prototype chain) specify property descriptors to be added to the newly-created object, with the corresponding property names. these properties correspond to the second argument of object.defineproperties(). return value a new object with the specified prototype object and properties. exceptions the proto parameter has to be either null or an object excluding primitive wrapper objects. if proto is neither of these a typeerror is thrown. custom and null objects a new object created from a completely custom object (especially one created from the null object, which is basically a custom object with no me...
..." obj > console.log(oco) // {p: 1} -- still seems normal > console.log(ocn) // {p: 0} -- still seems normal here too. but wait... as shown above, all seems normal so far. ...
...bjects, their differences quickly become apparent: > "oco is: " + oco // shows "oco is: [object object]" > "ocn is: " + ocn // throws error: cannot convert object to primitive value testing just a few of the many most basic built-in functions shows the magnitude of the problem more clearly: > alert(oco) // shows [object object] > alert(ocn) // throws error: cannot convert object to primitive value > oco.tostring() // shows [object object] > ocn.tostring() // throws error: ocn.tostring is not a function > oco.valueof() // shows {} > ocn.valueof() // throws error: ocn.valueof is not a function > oco.hasownproperty("p") // shows "true" > ocn.hasownproperty("p") // throws error: ocn.hasownproperty is not a function > oco.constructor // shows "object() { [native code] }" > ocn.constructor /...
...And 11 more matches
String - JavaScript
two ways to access an individual character in a string. the first is the charat() method: return 'cat'.charat(1) // returns "a" the other way (introduced in ecmascript 5) is to treat the string as an array-like object, where individual characters correspond to a numerical index: return 'cat'[1] // returns "a" when using bracket notation for character access, attempting to delete or assign a value to these properties will not succeed. the properties involved are neither writable nor configurable. (see object.defineproperty() for more information.) comparing strings in c, the strcmp() function is used for comparing strings. in javascript, you just use the less-than and greater-than operators: let a = 'a' let b = 'b' if (a < b) { // true console.log(a + ' is less than ' + b) } else if (...
... upper or lower case characters, use a function similar to this: function isequal(str1, str2) { return str1.touppercase() === str2.touppercase() } // isequal upper case is used instead of lower case in this function, due to problems with certain utf-8 character conversions. string primitives and string objects note that javascript distinguishes between string objects and primitive string values. (the same is true of boolean and numbers.) string literals (denoted by double or single quotes) and strings returned from string calls in a non-constructor context (that is, called without using the new keyword) are primitive strings. javascript automatically converts primitives to string objects, so that it's possible to use string object methods for primitive strings. in contexts where a met...
...reates a string object console.log(eval(s1)) // returns the number 4 console.log(eval(s2)) // returns the string "2 + 2" for these reasons, the code may break when it encounters string objects when it expects a primitive string instead, although generally, authors need not worry about the distinction. ...
...And 11 more matches
yield - JavaScript
ld keyword is used to pause and resume a generator function (function* or legacy generator 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 [rv] = yield [expression] expression optional defines the value to return from the generator function via the iterator protocol. if omitted, undefined is returned instead. rv optional retrieves the optional value passed to the generator's next() method to resume its execution. description the yield keyword pauses generator function execution and the value of the expression following the yield keyword is returned to the generator's caller. it can be t...
...ing the yield keyword is returned to the generator's caller. it can be thought of as a generator-based version of the return keyword. yield can only be called directly from the generator function that contains it. it cannot be called from nested functions or from callbacks. the yield keyword causes the call to the generator's next() method to return an iteratorresult object with two properties: value and done. the value property is the result of evaluating the yield expression, and done is false, indicating that the generator function has not fully completed. once paused on a yield expression, the generator's code execution remains paused until the generator's next() method is called. each time the generator's next() method is called, the generator resumes execution, and runs until it reache...
... the generator function has not fully completed. once paused on a yield expression, the generator's code execution remains paused until the generator's next() method is called. each time the generator's next() method is called, the generator resumes execution, and runs until it reaches one of the following: a yield, which causes the generator to once again pause and return the generator's new value. the next time next() is called, execution resumes with the statement immediately after the yield. throw is used to throw an exception from the generator. this halts execution of the generator entirely, and execution resumes in the caller (as is normally the case when an exception is thrown). the end of the generator function is reached. in this case, execution of the generator ends and an iter...
...And 11 more matches
for...of - JavaScript
the for...of statement creates a loop iterating over iterable objects, including: built-in string, array, array-like objects (e.g., arguments or nodelist), typedarray, map, set, and user-defined iterables. it invokes a custom iteration hook with statements to be executed for the value of each distinct property of the 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 for (variable of iterable) { statement } variable on each iteration a value of a different property is assigned to variable. variable may be declared with const, let, or var. iterable object whose iterable properties are iterated. ...
...ttps://github.com/mdn/interactive-examples and send us a pull request. syntax for (variable of iterable) { statement } variable on each iteration a value of a different property is assigned to variable. variable may be declared with const, let, or var. iterable object whose iterable properties are iterated. examples iterating over an array const iterable = [10, 20, 30]; for (const value of iterable) { console.log(value); } // 10 // 20 // 30 you can use let instead of const too, if you reassign the variable inside the block. ...
...signed to variable. variable may be declared with const, let, or var. iterable object whose iterable properties are iterated. examples iterating over an array const iterable = [10, 20, 30]; for (const value of iterable) { console.log(value); } // 10 // 20 // 30 you can use let instead of const too, if you reassign the variable inside the block. ...
...And 11 more matches
begin - SVG: Scalable Vector Graphics
Web › SVG › Attribute › begin
the begin attribute defines when an animation should begin or when an element should be discarded. the attribute value is a semicolon separated list of values. the interpretation of a list of start times is detailed in the smil specification in "evaluation of begin and end time lists". each individual value can be one of the following : <offset-value>, <syncbase-value>, <event-value>, <repeat-value>, <accesskey-value>, <wallclock-sync-value> or the keyword indefinite. six elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, <animatetransform>, <discard>, and <set> animate, animatecolor, animatemotion, animatetransform, set for <animate>, <animatecolor>, <animatemotion>, <animatetransform>, and <set>, begin defines when the element should begin, i.e. become active.
...-value>, <wallclock-sync-value> or the keyword indefinite. six elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, <animatetransform>, <discard>, and <set> animate, animatecolor, animatemotion, animatetransform, set for <animate>, <animatecolor>, <animatemotion>, <animatetransform>, and <set>, begin defines when the element should begin, i.e. become active. value <begin-value-list> default value 0s animatable no the <begin-value-list> is a semicolon-separated list of values. each value can be one of the following: <offset-value> this value defines a clock-value that represents a point in time relative to the beginning of the svg document (usually the load or domcontentloaded event). negative values are valid. <syncba...
... <begin-value-list> default value 0s animatable no the <begin-value-list> is a semicolon-separated list of values. each value can be one of the following: <offset-value> this value defines a clock-value that represents a point in time relative to the beginning of the svg document (usually the load or domcontentloaded event). negative values are valid. <syncbase-value> this value defines a syncbase and an optional offset from that syncbase. the element's animation start time is defined relative to the begin or active end of another animation. ...
...And 11 more matches
<marker> - SVG: Scalable Vector Graphics
Web › SVG › Element › marker
10 10,90 90,90" 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. ...
...oke="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. ...
..." 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. 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. ...
...And 11 more matches
context-menu - Archive of obsolete content
. when matchpattern is an array, the context occurs when the menu is invoked on a page whose url matches any of the patterns. these are the same match pattern strings that you use with the page-mod include property. read more about patterns. predicatecontext(predicatefunction) predicatefunction is called when the menu is invoked, and the context occurs when the function returns a true value. the function is passed an object with properties describing the menu invocaton context. array an array of any of the other types. this context occurs when all contexts in the array occur. menu items also have a context property that can be used to add and remove declarative contexts after construction. for example: var context = require("sdk/context-menu").selectorcontext("im...
...ontext: cm.pagecontext(), contentscript: script }); it will log the name of the actual node clicked: info: contextmenu-example: clicked: p the "data" argument data is the data property of the menu item that was clicked. note that when you have a hierarchy of menu items the click event will be sent to the content script of the item clicked and all ancestors so be sure to verify that the data value passed matches the item you expect. you can use this to simplify click handling by providing just a single click listener on a menu that reacts to clicks for any child items.: var cm = require("sdk/context-menu"); cm.menu({ label: "my menu", contentscript: 'self.on("click", function (node, data) {' + ' console.log("you clicked " + data);' + '});', items: ...
... as a trigger and subsequently will add the tooltips to the actual menu items. it is easy to find out which menu items are constructed by the addon-sdk module because they have the class addon-context-menu-item. the difficult part it to identify those that belong to your extension. one way to achieve this it to utilize the data attribute of item class constructor, which conveniently maps to the value attribute of the underlying xul element. so if data consists of unique prefix and the desired tooltip text, it is just a matter of kicking in the right moment. const { getmostrecentbrowserwindow } = require("sdk/window/utils"); var cm = require("sdk/context-menu"); var uuid = require('sdk/util/uuid').uuid(); var uuidstr = uuid.number.substring(1,37); cm.item({ data: uuidstr+"this is a toolt...
...And 10 more matches
rel - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › rel
« xul reference home rel type: one of the values below the type of comparison to perform. equals the subject and value must match exactly. ...
... « xul reference home rel type: one of the values below the type of comparison to perform. equals the subject and value must match exactly. ...
... « xul reference home rel type: one of the values below the type of comparison to perform. equals the subject and value must match exactly. ...
...And 10 more matches
Template Logging - Archive of obsolete content
fortunately, some debugging and logging support is provided with templates that may help. logging template results there are two main ways in which template errors may be detected. ...
..., as the logging can take up extra time that is not necessary when the template is working. each result is logged in a form much like the following: in template with id root using ref http://www.some-fictitious-zoo.com/birds new active result for query 2 matching rule 1: http://www.some-fictitious-zoo.com/birds/emperorpenguin in the example above, a new result has been added. for references, the value of the template's id and ref attributes are provided in each logged message. this is useful if multiple templates are being used. the second line gives details about the new result. the id of the result is specified at the end, in this case 'http://www.some-fictitious-zoo.com/b...emperorpenguin'. this corresponds to the id attribute set on a generated row. for an rdf datasource, this will be the ...
...sage. this is useful if multiple templates are being used. the second line gives details about the new result. the id of the result is specified at the end, in this case 'http://www.some-fictitious-zoo.com/b...emperorpenguin'. this corresponds to the id attribute set on a generated row. for an rdf datasource, this will be the result's resource. for other datasources, this may be a somewhat random value. however, calling getelementbyid using this id will retrieve the generated content for that result if you want to further study the content that was generated. the example also specifies 'query 2 matching rule 1'. this indicates that the result is for the second <query> element. if only one <query> is used, naturally this will always indicate a query of 1. in addition, this result matches the fir...
...And 10 more matches
XUL controls - Archive of obsolete content
cker reference <colorpicker type="button"> a specialized type of color picker which shows only a button. pressing the button displays a color picker popup window. <colorpicker type="button" color="#cc0080"/> colorpicker reference <datepicker> a set of textboxes which may be used to allow the entry of a date. ...
...cker type="button" color="#cc0080"/> colorpicker reference <datepicker> a set of textboxes which may be used to allow the entry of a date. <datepicker value="2007/03/26"/> datepicker reference <datepicker type="grid"> a datepicker which displays a calendar grid for selecting a date. ...
... <datepicker type="grid"> a datepicker which displays a calendar grid for selecting a date. <datepicker type="grid" value="2007/02/20"/> datepicker reference <datepicker type="popup" > a datepicker which displays a set of textboxes for date entry, but also has a button for displaying a popup calendar grid. <datepicker type="popup" value="2008/08/24"/> datepicker reference <description> the description element is used for descriptive text. <description> select a time for the event to start </description> more information about the description element. description reference <groupbox> a groupbox displays a labelled box around other user interf...
...And 10 more matches
radio - Archive of obsolete content
Archive › Mozilla › XUL › radio
ted at a time. the user can switch which radio button is turned on by selecting it with the mouse or keyboard. other radio buttons in the same group are turned off. a label, specified with the label attribute may be added beside the radio button. more information is available in the xul tutorial. ...
...io buttons in the same group are turned off. a label, specified with the label attribute may be added beside the radio button. more information is available in the xul tutorial. attributes accesskey, command, crop, disabled, focused, group, image, label, selected, tabindex, value properties accesskey, accessibletype, control, crop, disabled, image, label, radiogroup, selected, tabindex, value examples <radiogroup> <radio id="orange" label="red" accesskey="r"/> <radio id="violet" label="green" accesskey="g" selected="true"/> <radio id="yellow" label="blue" accesskey="b" disabled="true"/> </radiogroup> attributes accesskey type: character this should be set to a character that is used as a shortcut key. this should be one of the characters that appears in the l...
...cesskey="b" disabled="true"/> </radiogroup> attributes accesskey type: character this should be set to a character that is used as a shortcut key. this should be one of the characters that appears in the label attribute for the element. command type: id set to the id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right sid...
...And 10 more matches
XForms Select1 Element - Archive of obsolete content
introduction allows the user to choose a single value from a list of pre-defined values (see the spec). the list of pre-defined items can be specified by either item (see the spec) or itemset (see the spec) elements. you can visually group these pre-defined items by using the choices (see the spec) element to contain them. note, some representations of the select1 element do not support visual grouping. attributes ui common appearance - the value of this attribute gives a hint to the xforms processor as to which type of widget(s) to use to represent this control. accesskey - used to specify the keyboard shortcut for focusing this control. ...
...ual grouping. attributes ui common appearance - the value of this attribute gives a hint to the xforms processor as to which type of widget(s) to use to represent this control. accesskey - used to specify the keyboard shortcut for focusing this control. single-node binding special selection - this attribute, when set to 'open', allows the user to provide free entry to the list. possible values are open and closed, default is closed (see #representations section to refer if the attribute is supported for every representation). incremental - supported, default value is true properties selection - see corresponding attribute incremental - see corresponding attribute type restrictions the select1 element can be bound to a node containing simple content. the data binding restrict...
...n - see corresponding attribute incremental - see corresponding attribute type restrictions the select1 element can be bound to a node containing simple content. the data binding restriction to simple content may be relaxed when an itemset element is used, which allows the available choices to be obtained from an xforms model. ...
...And 10 more matches
Introduction to CSS layout - Learn web development
prerequisites: the basics of html (study introduction to html), and an idea of how css works (study introduction to css.) objective: to give you an overview of css page layout techniques. each technique can be learned in greater detail in subsequent tutorials. ...
...er for more complex layouts you will need to alter this default behavior using some of the tools available to you in css. starting with a well-structured html document is very important, as you can then work with the way things are laid out by default rather than fighting against it. the methods that can change how elements are laid out in css are as follows: the display property — standard values such as block, inline or inline-block can change how elements behave in normal flow, for example making a block-level element behave like an inline element (see types of css boxes for more information). we also have entire layout methods that are switched on via specific display values, for example css grid and flexbox, which alter how elements inside the element they are set on are laid out. f...
...inline-block can change how elements behave in normal flow, for example making a block-level element behave like an inline element (see types of css boxes for more information). we also have entire layout methods that are switched on via specific display values, for example css grid and flexbox, which alter how elements inside the element they are set on are laid out. ...
...And 10 more matches
CSS basics - Learn web development
xample, <p> elements). to style a different element, change the selector. declaration this is a single rule like color: red;. it specifies which of the element's properties you want to style. properties these are ways in which you can style an html element. (in this example, color is a property of the <p> elements.) in css, you choose which properties you want to affect in the rule. property value to the right of the property—after the colon—there is the property value. this chooses one out of many possible appearances for a given property. (for example, there are many color values in addition to red.) note the other important parts of the syntax: apart from the selector, each ruleset must be wrapped in curly braces. ({}) within each declaration, you must use a colon (:) to sepa...
...rty—after the colon—there is the property value. this chooses one out of many possible appearances for a given property. (for example, there are many color values in addition to red.) note the other important parts of the syntax: apart from the selector, each ruleset must be wrapped in curly braces. ({}) within each declaration, you must use a colon (:) to separate the property from its value or values. within each ruleset, you must use a semicolon (;) to separate each declaration from the next one. to modify multiple property values in one ruleset, write them separated by semicolons, like this: p { color: red; width: 500px; border: 1px solid black; } selecting multiple elements you can also select multiple elements and apply a single ruleset to all of them. separate multi...
... but we can make more specific selections as well. here are some of the more common types of selectors: selector name what does it select example element selector (sometimes called a tag or type selector) all html elements of the specified type. p selects <p> id selector the element on the page with the specified id. on a given html page, each id value should be unique. #my-id selects <p id="my-id"> or <a id="my-id"> class selector the element(s) on the page with the specified class. multiple instances of the same class can appear on a page. .my-class selects <p class="my-class"> and <a class="my-class"> attribute selector the element(s) on the page with the specified attribute. img[src] selects <img...
...And 10 more matches
Third-party APIs - Learn web development
on't need to fill in a url here: just leave it blank.) open up your starting file, and replace the api key placeholder with your key. changing the type of map there are a number of different types of map that can be shown with the mapquest api. to do this, find the following line: layers: l.mapquest.tilelayer('map') try changing 'map' to 'hybrid' to show a hybrid-style map. try some other values too. the tilelayer reference page shows the different available options, plus a lot more information. adding different controls the map has a number of different controls available; by default it just shows a zoom control. you can expand the controls available using the map.addcontrol() method; add this to your code, inside the window.onload handler: map.addcontrol(l.mapquest.control()); the...
...ble using the map.addcontrol() method; add this to your code, inside the window.onload handler: map.addcontrol(l.mapquest.control()); the mapquest.control() method just creates a simple full-featured control set, and it is placed in the top-right hand corner by default. you can adjust the position by specifying an options object as a parameter for the control containing a position property, the value of which is a string specifying a position for the control. try this, for example: map.addcontrol(l.mapquest.control({ position: 'bottomright' })); there are other types of control available, for example mapquest.searchcontrol() and mapquest.satellitecontrol(), and some are quite complex and powerful. have a play around and see what you can come up with. adding a custom marker adding a mark...
...this first calls preventdefault() on the event object, to stop the form actually submitting (which would break ...
...And 10 more matches
Video and Audio APIs - Learn web development
on','u'); media.play(); } else { play.setattribute('data-icon','p'); media.pause(); } } here we use an if statement to check whether the video is paused. the htmlmediaelement.paused property returns true if the media is paused, which is any time the video is not playing, including when it is set at 0 duration after it first loads. if it is paused, we set the data-icon attribute value on the play button to "u", which is a "paused" icon, and invoke the htmlmediaelement.play() method to play the media. on the second click, the button will be toggled back again — the "play" icon will be shown again, and the video will be paused with htmlmediaelement.pause(). stopping the video next, let's add functionality to handle stopping the video. add the following addeventlis...
...unction on that event firing too. next, let's define stopmedia() — add the following function below playpausemedia(): function stopmedia() { media.pause(); media.currenttime = 0; play.setattribute('data-icon','p'); } there is no stop() method on the htmlmediaelement api — the equivalent is to pause() the video, and set its currenttime property to 0. setting currenttime to a value (in seconds) immediately jumps the media to that position. all there is left to do after that is to set the displayed icon to the "play" icon. regardless of whether the video was paused or playing when the stop button is pressed, you want it to be ready to play afterwards. seeking back and forth there are many ways that you can implement rewind and fast forward functionality; here we are ...
...d start the video playing normally. if it hasn't yet been set, we add the active class to the rwd button using classlist.add(), pause the video using htmlmediaelement.pause(), then set the intervalrwd variable to equal a setinterval() call. when invoked, setinterval() creates an active interval, meaning that it runs the function given as the first parameter every x milliseconds, where x is the value of the 2nd parameter. so here we are running the windbackward() function every 200 milliseconds — we'll use this function to wind the video backwards constantly. to stop a setinterval() running, you have to call clearinterval(), giving it the identifying name of the interval to clear, which in this case is the variable name intervalrwd (see the clearinterval() call earlier on in the function). ...
...And 10 more matches
Promise
a promise object represents a value that may not be available yet. a reference to an existing promise may be received by different means, for example as the return value of a call into an asynchronous api. once you have a reference to a promise, you can call its then() method to execute an action when the value becomes available, or when an error occurs. promises may also be created using the new promise() constructor. you don't need to import the promise.jsm module to use a promise object to which you already have a reference. internally, a promise can be in one of three states: pending, when the final value is not available yet. this is the only state that may transition to one of the other two states. fulfilled, when and if the final value becomes available. a fulfillment valu...
...m module to use a promise object to which you already have a reference. internally, a promise can be in one of three states: pending, when the final value is not available yet. this is the only state that may transition to one of the other two states. fulfilled, when and if the final value becomes available. a fulfillment value becomes permanently associated with the promise. this may be any value, including undefined. rejected, if an error prevented the final value from being determined. a rejection reason becomes permanently associated with the promise. this may be any value, including undefined, though it is generally an error object, like in exception handling. note: you should always handle, forward, or report errors (rejection reasons). if you see the message "a promise chain fa...
...ined, though it is generally an error object, like in exception handling. note: you should always handle, forward, or report errors (rejection reasons). if you see the message "a promise chain failed to handle a rejection", there is likely something to be fixed in the code. see handling errors and common pitfalls below. documentation conventions in documentation, the type of the fulfillment value is usually specified between angular brackets. for example, the os.file.exists function returns a promise that will eventually fulfill with a boolean: promise<boolean> exists(string path); the rejection reason may be specified separately in the function's documentation, and is considered to be an error object unless otherwise specified. method overview promise then([optional] functi...
...And 10 more matches
NSS Tools modutil
a complex string must not...
...a complex string must notinclude n...
...a complex string must notinclude newlines or car...
...And 10 more matches
JS_CallFunction
calls a specified js function. ...
... calls a specified js function. ...
... calls a specified js function. ...
...And 10 more matches
JS_DefineProperty
create a new property on an object. ...
... create a new property on an object. ...
... create a new property on an object. ...
...And 10 more matches
SpiderMonkey 1.8.5
he slow native function type has been removed, and the fast signature has been renamed to jsnative. embeddings that defined jsnatives in previous versions must update all those functions to the new signature. getters and setters of type jspropertyop took an id parameter of type jsval. the type of the parameter has been changed to jsid. many getters and setters simply ignore the id anyway; if the value is needed, use js_idtovalue. the type of setters has changed from jspropertyop to jsstrictpropertyop (to accomodate es5 strict mode). to migrate, simply add a jsbool strict parameter to each setter function. it is safe for the setter to ignore the value of the argument. the rooting apis (js_addroot, js_removeroot, etc.) have been replaced with a family of type-safe functions (js_addstringroot, ...
...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. ...
...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. ...
...And 10 more matches
mozIStorageFunction
ere are a number of already defined functions provided by sqlite. objects implementing this interface can be registered with mozistorageconnection.createfunction(). storage/public/mozistoragefunction.idlscriptable please add a summary to this article. last changed in gecko 1.9.1.4 (firefox 3.5.4) inherits from: nsisupports method overview nsivariant onfunctioncall(in mozistoragevaluearray afunctionarguments); methods onfunctioncall() the implementation of the function. this is called by the database engine when the function registered with mozistorageconnection.createfunction() is used in an executing sql statement or trigger. note this callback is executed on the thread that the statement or trigger is executing on. if you use mozistorageconnection.executeasync()...
... you use mozistorageconnection.executeasync() or, mozistoragestatement.executeasync() this callback will run on a different thread from the rest of your code. likewise, if you execute sql on a different thread, this callback will be executed on that thread. this callback should be reentrant if any of the above applies to your use of the storage apis! nsivariant onfunctioncall( in mozistoragevaluearray afunctionarguments ); parameters afunctionarguments a mozistoragevaluearray holding the arguments passed in to the function. return value an nsivariant this is the return value of the function. sample code both of the following code samples assume that the variable dbconn is an opened mozistorageconnection. javascript starting in gecko 1.9.1.4 (firefox 3.0.15), you can directly...
...ivariant this is the return value of the function. sample code both of the following code samples assume that the variable dbconn is an opened mozistorageconnection. javascript starting in gecko 1.9.1.4 (firefox 3.0.15), you can directly pass your function into the mozistorageconnection method mozistorageconnection, like this: dbconn.createfunction("square", 1, function(aarguments) { let value = aarguments.getint32(0); return value * value; }); // run some query that uses the function. let stmt = dbconn.createstatement("select square(value) from some_table"); try { while (stmt.executestep()) { // handle the results } } finally { stmt.reset(); } in earlier versions of gecko, however, you'll need to actually create an object containing the onfunctioncall method. this sti...
...And 10 more matches
nsIDocShell
mozilla code, all text is encoded as unicode. when reading a document, a converter is used to translate the text from its original format into unicode. this attribute lets you: see what converter was used when retrieving the document's data. override that character set for documents for which the specified fallback or auto-detected character set is incorrect. reading this value reports the encoding that was used when loading the data into the document. setting this attribute overrides the encoding; however, to update the dom or display of the content, you need have the data reparsed. overriding the character set also sets the fallback encoding for the container frame. note: prior to gecko 12.0, this attribute was part of a separate nsidoccharset interface.
...revious shtransaction index and the current shtransaction index at the time that the doc shell begins to load. used for contentviewer eviction. read only. loadtype unsigned long load type for the document. valid states are defined in constants. note that nsidocshell may use other states internally so you should check for the specific state bit. marginheight long the value of the marginheight attribute on the frame element, or negative if it was not set. marginwidth long the value of the marginwidth attribute on the frame element, or negative if it was not set. parentcharset nsiatom indicates the docshell's parent document's character set. note: prior to gecko 12.0, this attribute was part of a separate nsidoccharsetinfo...
...set nsiatom indicates the docshell's parent document's character set. note: prior to gecko 12.0, this attribute was part of a separate nsidoccharsetinfo interface. parentcharsetsource print32 indicates the source from which the character set being used was obtained. higher numbers override lower ones. see character set source constants for defined values. note: prior to gecko 12.0, this attribute was part of a separate nsidoccharsetinfo interface. parenturicontentlistener nsiuricontentlistener uri content listener parent. this is not refcounted and is assumed to be nulled out by the parent when the parent is going away. obsolete since gecko 1.8 prescontext nsprescontext presentation context for t...
...And 10 more matches
nsIJSON
tually be properly described by idl; however, for the purposes of this article, we'll pretend they can be and ignore that issue. ...
...we'll pretend they can be and ignore that issue. ...
...ring str, in jscontext cx); native code only! jsobject decodefromstream(in nsiinputstream stream, in long contentlength); astring encode(in jsobject value); obsolete since gecko 7.0 astring encodefromjsval(in jsvaljsval value, in jscontext cx); native code only! void encodetostream(in nsioutputstream stream, in string charset, in boolean writebom, in jsobject value); jsval legacydecode(in astring str); deprecated since gecko 2.0 jsval legacydecodefromstream(in astring str); deprecated since gecko 2.0 jsval legacydecodetojsval(in astring str, in jscontext cx); native code only! deprecated since gecko 2.0 methods decode() obsolete since gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) d...
...And 10 more matches
nsIMsgDBHdr
). it is also mandatory to set msghdr.folder.msgdatabase = null after performing this kind of operations to prevent leaking. don't even think about using orflags and/or andflags. ...
... is starred in the ui. iskilled boolean readonly: indicates whether or not this message belongs to a subthread that has been ignored in the ui. if you want to know whether the message is the root of an ignored subthread then you should check for the ignored flag. any children of the ignored message will be marked as read when added to the database. priority nsmsgpriorityvalue indicates the priority of this message. flags unsigned long indicates the flags of the message. see nsmsgmessageflags for a list of what may or may not be set on this message. note that the elided flag should not be set on messages, as it is a flag strictly dealing with the database view. threadid nsmsgkey indicates the id of the thread to which this message belon...
... indicates the size of the offline copy of an imap or news message. date prtime indicates the date of this message; the equivalent header is the date: header. dateinseconds unsigned long readonly: indicates the date of this message as a unix timestamp. messageid string indicates the message id of this message, without angle brackets. if setting this value, outer angle brackets will be stripped if present. cclist string indicates the cc list of this message; the equivalent header is the cc: header. bcclist string [new in .31] indicates the bcc list of this message; the equivalent header is the bcc: header. author string indicates the author of this message; the equivalent header is the from: header. the ...
...And 10 more matches
XPIDL
receives the context of the caller. if optional_argc is present, then an additional uint8_t _argc method is added at the end which receives the number of optional arguments that were actually used (obviously, you need to have an optional argument in the first place). note that if both properties are set, the jscontext *cx is added first, followed by the uint8_t _argc, and then ending with return value parameter. finally, as an exception to everything already mentioned, for attribute getters and setters the jscontext *cx comes before any other arguments. another native-only property is nostdcall. normally, declarations are made in the stdcall abi on windows to be abi-compatible with com interfaces. any non-scriptable method or attribute with nostdcall instead uses the thiscall abi convention. ...
... present, it causes an infallible c++ getter function definition to be generated for the attribute alongside the normal fallible c++ getter declaration. it should only be used if the fallible getter will be infallible in practice (i.e. always return ns_ok) for all possible implementations. this infallible getter contains code that calls the fallible getter, asserts success, and returns the gotten value directly. the point of using this property is to make c++ code nicer -- a call to the infallible getter is more concise and readable than a call to the fallible getter. this property can only be used for attributes having built-in or interface types, and within classes that are marked with builtinclass. the latter restriction is because c++ implementations of fallible getters can be audited for i...
... parameter to the c++ implementation y y infallible n y generates an infallible c++ getter for the attribute n n must_use y y adds moz_must_use to the generated function declarations n n method parameters each method parameter can be specified in one of three modes: in, out, or inout. ...
...And 10 more matches
Add to iPhoto
es.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 core foundation data types are based upon a core cftype data type. basic cftype routines handle memory management, dumping cftype objects to the console, comparing cftype values, and so forth. we'll be using a number of these methods, but for brevity's sake, since these are generally simple declarations, let's look at only the cfrelease() and cfretain() declarations. in c, these are declared thusly: void cfrelease(cftyperef cf); void cfretain(cftyperef cf); in javascript, this translates to: this.cfrelease = this.lib.declare("cfrelease", ...
....void_t, ctypes.voidptr_t); // input: object to retain these methods are used to manage the reference counting for core foundation objects. cfstring a cfstring is an opaque data type that contains a string. the string can be stored in any of a number of encodings, so you use assorted functions that know how to cope with different encodings to set and get values of cfstrings, as well as to perform typical string operations. the first declaration to be done here is to actually declare the cfstringref data type; this is an opaque pointer to a cfstring object. this.cfstringref = new ctypes.pointertype("cfstringref"); now that we've declared the core type, we can declare the methods we use that work with cfstring objects. let's take a look at one of the...
...ring length ctypes.bool) // input: isdirectory this method is used to convert a unix pathname into an url. the interesting things to note about the declaration of corefoundation.cfurlcreatefromfilesystemrepresentation() are: it returns a cfurlref, which is an opaque pointer similar to the cfstringref we noted above. the pathname is specified as a value of type ctypes.unsigned_char.ptr, which is a pointer to an unsigned character. "file system representation" strings on mac os x are in utf-8 format. we use our cfindex type here to specify the length of the string. this.cfurlgetfsref = this.lib.declare("cfurlgetfsref", ctypes.default_abi, ctypes.bool, // returns a...
...And 10 more matches
Plug-in Basics - Plugins
ctories for plug-ins, in this order: windows directory pointed to by moz_plugin_path environment variable. %appdata%\mozilla\plugins, where %appdata% denotes per-user application data directory. plug-ins within toolkit bundles. profile directory\plugins, where profile directory is a user profile directory. directories pointed to by hkey_current_user\software\mozillaplugins\*\path registry value, where * can be replaced by any name. directories pointed to by hkey_local_machine\software\mozillaplugins\*\path registry value, where * can be replaced by any name. mac os x ~/library/internet plug-ins. /library/internet plug-ins. /system/library/frameworks/javavm.framework/versions/current/resources. plug-ins within toolkit bundles. profile directory/plugins, where profile directory ...
...ct elements <html> <head> <title>example 1: nesting object elements</title> <style type="text/css"> .myplugin { width: 470px; height: 231px; } </style> </head> <body><p> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,30,0" class="myplugin"> <param name="movie" value="foo.swf"/> <param name="quality" value="high"/> <param name="salign" value="tl"/> <param name="menu" value="0"/> <object data="foo_movie.swf" type="application/x-shockwave-flash" class="myplugin"/> <param name="quality" value="high"/> <param name="salign" value="tl"/> <param name="menu" value="0"/> <object type="*...
...lue="tl"/> <param name="menu" value="0"/> <object data="foo_movie.swf" type="application/x-shockwave-flash" class="myplugin"/> <param name="quality" value="high"/> <param name="salign" value="tl"/> <param name="menu" value="0"/> <object type="*" class="myplugin"> <param name="pluginspage" value="http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash"/> </object> </object> </object> </p></body> </html> the outermost object element defines the classid; the first nested object uses the type value application/x-shockwave-flash to load the adobe flash plug-in, and the innermost object exposes a download page for users that do not already hav...
...And 10 more matches
Using the Gamepad API - Web APIs
xt time an event fires. performing such checks tends to involve using the gamepad object in conjunction with an animation loop (e.g., requestanimationframe), where developers want to make decisions for the current frame based on the state of the gamepad or gamepads. the navigator.getgamepads() method returns an array of all devices currently visible to the webpage, as gamepad objects (the first value is always null, so null will 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.ind...
...ng indicating whether the browser has remapped the controls on the device to a known layout. currently there is only one supported known layout — the standard gamepad. if the browser is able to map controls on the device to that layout the mapping property will be set to the string standard. connected: a boolean indicating whether the gamepad is still connected to the system. ...
...d. if the browser is able to map controls on the device to that layout the mapping property will be set to the string standard. connected: a boolean indicating whether the gamepad is still connected to the system. if this is so the value is true; if not, it is false. buttons: an array of gamepadbutton objects representing the buttons present on the device. each gamepadbutton has a pressed and a value property: the pressed property is a boolean indicating whether the button is currently pressed (true) or unpressed (false). ...
...And 10 more matches
HTMLTextAreaElement - Web APIs
aco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmltextareaelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties accesskey string: returns / sets the element's accesskey attribute. autocapitalize string: returns / sets the element's capitalization behavior for user input. ...
... 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. ...
...cters, words, sentences. autocomplete autofocus boolean: returns / sets the element's autofocus attribute, indicating that the control should have input focus when the page loads cols unsigned long: returns / sets the element's cols attribute, indicating the visible width of the text area. defaultvalue string: returns / sets the control's default value, which behaves like the node.textcontent property. 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 o...
...And 10 more matches
Writing a WebSocket server in C# - Web APIs
tcpclient client = server.accepttcpclient(); console.writeline("a client connected."); } } tcpclient methods: system.net.sockets.networkstream getstream() 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(); consol...
..., 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. ...
...d. 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. ...
...And 10 more matches
Using the progressbar role - Accessibility
the progressbar role and describes the effect it has on browsers and assistive technology. the progressbar role should be used for an element that displays the progress status for a task that take a long time or consists of several steps. a progressbar indicates that the user's request has been received and the application is making progress toward completing the requested action. if the actual value of the progressbar can be determined, the developer has to indicate this progress using the aria-valuenow, aria-valuemin, and aria-valuemax attributes. if the progress value is indeterminate, the developer should omit the aria-valuenow attribute. as the task progresses, the aria-valuenow value has to be updated dynamically to indicate this progress to assistive technology products. if the pro...
...es, the aria-valuenow value has to be updated dynamically to indicate this progress to assistive technology products. if the progressbar is describing the loading progress of a particular region of a page, the author should use aria-describedby to point to the status, and set the aria-busy attribute to true on the region until it is finished loading. it is not possible for the user to alter the value of a progressbar because it is always readonly. note: assistive technologies generally will render the value of aria-valuenow as a percent of the range between the value of aria-valuemin and aria-valuemax, unless aria-valuetext is specified. it is best to set the values for aria-valuemin, aria-valuemax, and aria-valuenow in a manner that is appropriate for this calculation. note: elements with ...
... possible effects on user agents and assistive technology screen readers should announce the progress updates as they occur. if the progress bar is labeled, the label text should be mentioned as well. note: opinions may differ on how assistive technology should handle this. ...
...And 10 more matches
caption-side - CSS: Cascading Style Sheets
the caption-side css property puts the content of a table's <caption> on the specified side. the values are relative to the writing-mode of the table. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...e caption-side css property puts the content of a table's <caption> on the specified side. the values are relative to the writing-mode of the table. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ecified side. the values are relative to the writing-mode of the table. the source for this interactive example is stored in a github repository. if 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 /* directional values */ caption-side: top; caption-side: bottom; /* warning: non-standard values */ caption-side: left; caption-side: right; caption-side: top-outside; caption-side: bottom-outside; /* global values */ caption-side: inherit; caption-side: initial; caption-side: unset; the caption-side property is specified as one of the keyword values listed below. values top the caption box should be positioned above the table. bottom the caption box should be positioned below the...
...And 10 more matches
font-variant-east-asian - CSS: Cascading Style Sheets
the font-variant-east-asian css property controls the use of alternate glyphs for east asian scripts, like japanese and chinese. ...
... the font-variant-east-asian css property controls the use of alternate glyphs for east asian scripts, like japanese and chinese. ...
...t-asian css property controls the use of alternate glyphs for east asian scripts, like japanese and chinese. ...
...And 10 more matches
mask-size - CSS: Cascading Style Sheets
Web › CSS › mask-size
the mask-size css property specifies the sizes of the mask images. the size of the image can be fully or partially constrained in order to preserve its intrinsic ratio. ...
... the mask-size css property specifies the sizes of the mask images. the size of the image can be fully or partially constrained in order to preserve its intrinsic ratio. ...
...ask-size css property specifies the sizes of the mask images. the size of the image can be fully or partially constrained in order to preserve its intrinsic ratio. ...
...And 10 more matches
<select>: The HTML Select element - HTML: Hypertext Markup Language
Web › HTML › Element › select
and send us a pull request. the above example shows typical <select> usage. it is given an id attribute to enable it to be associated with a <label> for accessibility purposes, as well as a name attribute to represent the name of the associated data point submitted to the server. each menu option is defined by an <option> element nested inside the <select>. each <option> element should have a value attribute containing the data value to submit to the server when that option is selected. if no value attribute is included, the value defaults to the text contained inside the element. you can include a selected attribute on an <option> element to make it selected by default when the page first loads. the <select> element has some unique attributes you can use to control it, such as multiple to...
... you can further nest <option> elements inside <optgroup> elements to create separate groups of options inside the dropdown. for further examples, see the native form widgets: drop-down content. attributes this element includes the global attributes. autocomplete a domstring providing a hint for a user agent's autocomplete feature. see the html autocomplete attribute for a complete list of values and details on how to use autocomplete. autofocus this boolean attribute lets you specify that a form control should have input focus when the page loads. only one form element in a document can have the autofocus attribute. disabled this boolean attribute indicates that the user cannot interact with the control. if this attribute is not specified, the control inherits its setting from the c...
...attribute. disabled this boolean attribute indicates that the user cannot interact with the control. if this attribute is not specified, the control inherits its setting from the containing element, for example <fieldset>; if there is no containing element with the disabled attribute set, then the control is enabled. form the <form> element to associate the <select> with (its form owner). the value of this attribute must be the id of a <form> in the same document. (if this attribute is not set, the <select> is associated with its ancestor <form> element, if any.) this attribute lets you associate <select> elements to <form>s anywhere in the document, not just inside a <form>. it can also override an ancestor <form> element. multiple this boolean attribute indicates that multiple options ...
...And 10 more matches
Array.from() - JavaScript
in a github repository. if 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 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. m...
...l 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 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 ed...
...6th edition (es2015). as such, it may not be present in other implementations of the standard. you can work around this by inserting the following code at the beginning of your scripts, allowing use of array.from() in implementations that don't natively support it. polyfill notes: this algorithm is exactly as specified in ecma-262 6th edition (assuming object and typeerror have their original values and that callback.call() evaluates to the original value of function.prototype.call()). in addition, since true iterables cannot be polyfilled, this implementation does not support generic iterables as defined in the 6th edition of ecma-262. // production steps of ecma-262, edition 6, 22.1.2.1 if (!array.from) { array.from = (function () { var symboliterator; try { ...
...And 10 more matches
Array.prototype.some() - JavaScript
the some() method tests whether at least one element in the array passes the test implemented by the provided function. it returns a boolean value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.some(callback(element[, index[, array]])[, thisarg]) parameters callback a function to test for each element, taking three arguments: element the current element being processed in the array. indexoptional the index of the current element being processed in the array. arrayoptional the array some() was called upon. thisargoptional a value to use as this when executing callback. retu...
...ent[, index[, array]])[, thisarg]) parameters callback a function to test for each element, taking three arguments: element the current element being processed in the array. indexoptional the index of the current element being processed in the array. arrayoptional the array some() was called upon. thisargoptional a value to use as this when executing callback. return value true if the callback function returns a truthy value for at least one element in the array. otherwise, false. description the some() method executes the callback function once for each element present in the array until it finds the one where callback returns a truthy value (a value that becomes true when converted to a boolean). if such an element is found, some() immediately returns true. ot...
...therwise, false. description the some() method executes the callback function once for each element present in the array until it finds the one where callback returns a truthy value (a value that becomes true when converted to a boolean). if such an element is found, some() immediately returns true. otherwise, some() returns false. callback is invoked only for indexes of the array with assigned values. it is not invoked for indexes which have been deleted or which have never been assigned values. callback is invoked with three arguments: the value of the element, the index of the element, and the array object being traversed. if a thisarg parameter is provided to some(), it will be used as the callback's this value. otherwise, the value undefined will be used as its this value. the this val...
...And 10 more matches
Function.prototype.bind() - JavaScript
the bind() method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called. the source for this interactive example is stored in a github repository. if 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 boundfunc = func.bind(thisarg[, arg1[, arg2[, ...argn]]]) parameters thisarg the value to be passed as the this parameter to the target function func when the bound function is called. the value is ignored if the bound function is constructed using the new operator. when using bind to create a function (supplied as a callback) inside a settimeout, any primi...
... a pull request. syntax let boundfunc = func.bind(thisarg[, arg1[, arg2[, ...argn]]]) parameters thisarg the value to be passed as the this parameter to the target function func when the bound function is called. the value is ignored if the bound function is constructed using the new operator. when using bind to create a function (supplied as a callback) inside a settimeout, any primitive value passed as thisarg is converted to object. if no arguments are provided to bind , or if the thisarg is null or undefined, the this of the executing scope is treated as the thisarg for the new function. ...
... description the bind() function creates a new bound function, which is an exotic function object (a term from ecmascript 2015) that wraps the original function object. ...
...And 10 more matches
<symbol> - SVG: Scalable Vector Graphics
Web › SVG › Element › symbol
<use xlink:href="#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. ...
...="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. ...
... 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. ...
...And 10 more matches
Introduction to using XPath in JavaScript - XPath
hich will return the results of the xpath expression as the most natural type. there is a section in the appendix which contains a full list of the available constants. they are explained below in the section "specifying the return type." result: if an existing xpathresult object is specified, it will be reused to return the results. specifying null will create a new xpathresult object. return value returns xpathresult, which is an xpathresult object of the type specified in the resulttype parameter. the xpathresult interface is defined here. implementing a default namespace resolver we create a namespace resolver using the creatensresolver method of the document object. var nsresolver = document.creatensresolver( contextnode.ownerdocument == null ? contextnode.documentelement : contextn...
...ves the implicit xml prefix. specifying the return type the returned variable xpathresult from document.evaluate can either be composed of individual nodes (simple types), or a collection of nodes (node-set types). ...
...ate can either be composed of individual nodes (simple types), or a collection of nodes (node-set types). simple types when the desired result type in resulttype is specified as either: number_type - a double string_type - a string boolean_type - a boolean we obtain the returned value of the expression by accessing the following properties respectively of the xpathresult object. ...
...And 10 more matches
panel - Archive of obsolete content
extentrypanel.hide(); }); the content script "get-text.js" looks like this: // when the user hits return, send the "text-entered" // message to main.js. // the message payload is the contents of the edit box. var textarea = document.getelementbyid("edit-box"); textarea.addeventlistener('keyup', function onkeyup(event) { if (event.keycode == 13) { // remove the newline. text = textarea.value.replace(/(\r\n|\n|\r)/gm,""); self.port.emit("text-entered", text); textarea.value = ''; } }, false); // listen for the "show" event being sent from the // main add-on code. it means that the panel's about // to be shown. // // set the focus to the text area so the user can // just start typing. self.port.on("show", function onshow() { textarea.focus(); }); finally, the "text-entry.h...
...ove, except that instead of self, we use addon to access the messaging apis: // when the user hits return, send the "text-entered" // message to main.js. // the message payload is the contents of the edit box. var textarea = document.getelementbyid("edit-box"); textarea.addeventlistener('keyup', function onkeyup(event) { if (event.keycode == 13) { // remove the newline. text = textarea.value.replace(/(\r\n|\n|\r)/gm,""); addon.port.emit("text-entered", text); textarea.value = ''; } }, false); // listen for the "show" event being sent from the // main add-on code. it means that the panel's about // to be shown. // // set the focus to the text area so the user can // just start typing. addon.port.on("show", function onshow() { textarea.focus(); }); finally, the html file n...
...n attached to the button. see the section on attaching panels to buttons. a widget object. if this is supplied the panel will be shown attached to the widget. an object which specifies where in the window the panel should be shown. the rest of this section describes this object. the position object has one or more of the following properties: top, right, bottom and left. their values are expressed in pixels. any other properties will be ignored. the default alignment along each axis is centered: so to display a panel centred along the vertical or horizontal axis, just omit that axis: // show the panel centered horizontally and // aligned to the bottom of the content area require("sdk/panel").panel({ position: { bottom: 0 } }).show(); // show the panel cent...
...And 9 more matches
preferences/service - Archive of obsolete content
in firefox. this enables add-ons to get and set system-wide settings. these are the same preferences that are exposed to users in the about:config page. preferences/service gives you full access to the preferences system. you can also use the simple-prefs module to access just the preferences for your own add-on and expose them to the user in the add-on manager. ...
...system-wide settings. these are the same preferences that are exposed to users in the about:config page. preferences/service gives you full access to the preferences system. you can also use the simple-prefs module to access just the preferences for your own add-on and expose them to the user in the add-on manager. globals functions set(name, value) sets the application preference name to value. parameters name : string preference name. value : string,number,boolean preference value. example: var name = "extensions.checkcompatibility.nightly"; require("sdk/preferences/service").set(name, false); get(name, defaultvalue) gets the application preference name. parameters name : string defaultvalue : string,number,boolean preference value. returns string,number,boolean : prefe...
...ameters name : string preference name. value : string,number,boolean preference value. example: var name = "extensions.checkcompatibility.nightly"; require("sdk/preferences/service").set(name, false); get(name, defaultvalue) gets the application preference name. parameters name : string defaultvalue : string,number,boolean preference value. returns string,number,boolean : preference value, returns defaultvalue if no preference is set, returns undefined if defaultvalue is not provided. example: var name = "extensions.checkcompatibility.nightly"; var nightlycompatchk = require("sdk/preferences/service").get(name); has(name) parameters name : string preference name. ...
...And 9 more matches
package.json - Archive of obsolete content
package.json by requiring it like any other module: var title = require("./package.json").title; key reference package.json may contain the following keys: author the name of the package's original author; this could be the name of a person or a company. defaults to an empty string. it may include a optional url in parentheses and an email address in angle brackets. this value will be used as the add-on's em:creator element in the install.rdf file generated by cfx. note: jpm supports nodejs people fields. contributors an array of additional author strings, identifying other contributors to the add-on. these values will be used as the add-on's em:contributor elements in its install.rdf. note: this is deprecated along with cfx; it's no...
...is deprecated along with cfx; it's not available when using jpm. dependencies a string or an array of strings specifying the names of packages that this add-on requires in order to function properly. description the add-on's description; this is a human-readable message describing what the add-on does. this defaults to the text "a basic add-on". this value will be used as the add-on's em:description element in its install.rdf. engines object with supported applications (key) and required version numbers (value). the version number can both specify a minimum and maximum version separated by a space. firefox: firefox desktop fennec: firefox for android thunderbird: thunderbird seamonkey: seamonkey a...
... fennec: firefox for android thunderbird: thunderbird seamonkey: seamonkey any application uuid example: "engines": { "firefox": ">= 38.0a1", "fennec": ">= 38.0a1" } fullname note: this is deprecated along with cfx; it's not available when using jpm. the full name of the package. it can contain spaces. if this key is present, its value will be used as the add-on's em:name element in its install.rdf. harnessclassid note: this is deprecated along with cfx; it's not available when using jpm. string in the guid format. this is used as a classid of the "harness service" xpcom component. defaults to a random guid generated by cfx. hasembeddedwebextension new in jpm 1.2.0. ...
...And 9 more matches
Handling Preferences - Archive of obsolete content
scure for regular users to manage, and because the preferences window should be as easy to use as possible. to access all other preferences, enter "about:config" into the location bar. this xul page lists all the preferences defined in the firefox installation, allowing you to change them as you please. as the warning message states, you should be very careful when changing preferences. incorrect values can make firefox behave oddly or break altogether. you can type on the "filter" textbox to search for specific preferences. if you type the word "homepage", it will filter all the preferences and display only the ones which include the word "homepage" in its name or value. right-clicking on the list reveals several options that allow you to modify preference values and add new ones. preferences...
... behave oddly or break altogether. you can type on the "filter" textbox to search for specific preferences. if you type the word "homepage", it will filter all the preferences and display only the ones which include the word "homepage" in its name or value. right-clicking on the list reveals several options that allow you to modify preference values and add new ones. preferences with non-default values are highlighted in bold. all changes done in about:config are saved to the prefs.js file. the list in about:config is not complete. some firefox preferences have no default value, so they are left out unless you add them manually. an extensive specification of firefox preferences can be seen in this page. you don't need to know them by heart; if doing task x requires some preference, then it's ...
...han diving into the preferences list and see if you can find the preference you need. mdc articles and other guides are usually good at specifying the preferences you'll need to use. adding preferences to an extension extensions can read and write firefox preferences and, most importantly, create and manage their own. ...
...And 9 more matches
Install script template - Archive of obsolete content
error code in case secondary installation fails var nosecondaryinstall = 1; // error return codes need some memory var err; // error return codes when we try and install to the current browser var errblock1; // error return codes when we try and do a secondary installation var errblock2 = 0; // global variable containing our secondary install location var secondaryfolder; //special error values used by the cycore developers (www.cycore.com) who helped make this install script var exceptionoccurederror = -4711; var winregisnullerror = -4712; var invalidrootkeyerror = -4713; var registrykeynotwritableerror = -4714; //initinstall block //the installation is initialized here -- if we fail here, cancel the installation // initinstall is quite an overloaded method...
... " + spacerequired + " k"); logcomment(" available: " + spaceavailable + " k"); return(false); } return(true); } /** * function for writing keys to the win32 system registry. * you should not stop the install process because the function failed. * you still have a chance to install the plugin for the * current gecko browser. ...
...ng key "+plidpath+"."); myregstatus = winreg.createkey(plidpath, ""); if (myregstatus != 0) { logcomment("moz registerplid: could not create the key, "+plidpath+"as expected. errorcode="+myregstatus); return myregstatus; } } // ok were done, let's write info about our plugin, path, productname, etc // write a subkey to mozillaplugins with our plid //var mysetstrrc = winreg.setvaluestring(plidpath, plidid, dllabsolutepath); mymozillapluginpath = plidpath+"\\"+plidid; // for instance. software\mozillaplugins\@cycore.com/cult3dviewer myregstatus = winreg.createkey(plidpath+"\\"+plidid, ""); if (myregstatus != 0) { logcomment("moz registerplid: could not create the subkey "+plidid+" to "+plidpath+". errorcode="+myregstatus); return myregstatus; } // write path to d...
...And 9 more matches
Numeric Controls - Archive of obsolete content
« previousnext » xul has two elements used for the entry of numeric values or ranges, and well as two elements for entering dates and times. these elements are only available in firefox 3 and later. number fields a textbox may be used for entering numbers by setting the value of the type attribute to the value number. this type of textbox may only be used to enter numbers. other characters are not allowed and are just ignored if typed. in addition, arrow buttons appear beside the textbox to allow the user to cycle through the values. as with other textboxes, the default value can be specified with the value attribute. naturally, this value should be a number. however, the minimum and maximum values can also be specified using the min and max attributes. if these are set, y...
...e just ignored if typed. in addition, arrow buttons appear beside the textbox to allow the user to cycle through the values. as with other textboxes, the default value can be specified with the value attribute. naturally, this value should be a number. however, the minimum and maximum values can also be specified using the min and max attributes. if these are set, you can control the range of values that the textbox may be set to. if the user enters a value less or greater than this value, it will be reset to the minimum or maximum value as necessary. for instance, the following numeric textbox has a range between 1 and 20. <textbox type="number" min="1" max="20"/> as the default value isn't specified, it will default to 1, the minimum value. the min attribute is set to 1 to indicate a min...
...tbox may be set to. if the user enters a value less or greater than this value, it will be reset to the minimum or maximum value as necessary. for instance, the following numeric textbox has a range between 1 and 20. <textbox type="number" min="1" max="20"/> as the default value isn't specified, it will default to 1, the minimum value. the min attribute is set to 1 to indicate a minimum possible value of 1 and the max attribute is set to 20 to indiciate a maximum possible value of 20. if the minimum value is not specified, it has a default value of 0. the maximum value defaults to the special value infinity which means that there is no limit. other numeric textbox attributes the increment attribute may be used to specify by how much the value changes when the arrows are pressed. the default va...
...And 9 more matches
prefwindow - Archive of obsolete content
preferences system article. important note for xulrunner-based applications: the preferences system - part of the toolkit - still relies on two browser.* preferences. the first one is browser.preferences.instantapply, a boolean preference. the preference window will not run correctly if you do not set this preference in your application's defaults (see bug 485150 for more information). a true value for this preference makes the preference window apply immediately the user choices, without waiting for the dialog to close with ok. the second preference is browser.preferences.animatefadein, again a boolean preference. this one can be safely omitted in xulrunner-based applications but you can override the default behavior (true for mac os x and false for other platforms) setting it. for animat...
...ef-backup"/> <textbox label="duration:" preference="pref-backupduration"/> </prefpane> </prefwindow> attributes activetitlebarcolor type: color string specify background color of the window's titlebar when it is active (foreground). moreover this hides separator between titlebar and window contents. this only affects mac os x. buttonalign type: string the value of the align attribute for the box containing the buttons. buttondir type: string the value of the dir attribute for the box containing the buttons. buttonorient type: string the value of the orient attribute for the box containing the buttons. buttonpack type: string the value of the pack attribute for the box containing the buttons. buttons type: comma-separa...
...tribute for the box containing the buttons. buttondir type: string the value of the dir attribute for the box containing the buttons. buttonorient type: string the value of the orient attribute for the box containing the buttons. buttonpack type: string the value of the pack attribute for the box containing the buttons. buttons type: comma-separated list of the values below a comma-separated list of buttons to appear in the dialog box. the buttons will be placed in suitable locations for the user's platform and basic event handling will be performed automatically. the following values can be used in the list: accept: the ok button, which will accept the changes when pressed. this button will also be the default button. cancel: the cancel button w...
...And 9 more matches
timepicker - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] the timepicker is used to allow the user to enter a time. it contains three fields to enter the hour, minute and second. arrow buttons next to the fields allow the values to be adjusted with the mouse. a fourth textbox appears for 12 hour clocks which allows selection of am or pm. to specify the initial, use the value attribute set to a value of either the form hh:mm:ss or hh:mm. the value may be retrieved and changed using the value property or the datevalue property. the former specifies the time as a string of the form hh:mm:ss whereas the latter specifies the time as a date object. in addition, the hour, minute and second properties may be used to retrieve and modify each component of the...
...ange event handler may encounter erratic behavior when the time is changed using the keyboard instead of the mouse. to avoid this, you can use the workaround described here, i.e., use window.settimeout(actual-event-handler-function, 0); to queue up your event handler to run after the rest of the picker's change event handlers. attributes disabled, hideseconds, increment, readonly, tabindex, value properties amindicator, datevalue, disabled, hideseconds, hour, hourleadingzero, increment, is24hourclock, ispm, minute, minuteleadingzero, pmindicator, readonly, second, secondleadingzero, tabindex, value examples <timepicker value="12:05"/> attributes disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is ...
...he element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update additional state. hideseconds type: boolean indicates whether to show the seconds field. readonly type: boolean if set to true, then the user cannot change the value of the element. however, the value may still be modified by a script. increment type: integer indicates the number of minutes to skip each time the arrows are pressed. this should be used in combination with setting hideseconds to true. tabindex type: integer the tab order of the element. the tab order is the order in which the focus is moved when the user press...
...And 9 more matches
The box model - Learn web development
and borders will apply but will not cause other inline boxes to move away from the box. horizontal padding, margins, and borders will apply and will cause other inline boxes to move away from the box. the <a> element, used for links, <span>, <em> and <strong> are all examples of elements that will display inline by default. the type of box applied to an element is defined by display property values such as block and inline, and relates to the outer value of display. aside: inner and outer display types at this point, we'd better also explain inner and outer display types. as mentioned above, boxes in css have an outer display type, which details whether the box is block or inline. boxes also have an inner display type, however, which dictates how elements inside that box are laid out. b...
...display type, which details whether the box is block or inline. boxes also have an inner display type, however, which dictates how elements inside that box are laid out. by default, the elements inside a box are laid out in normal flow, which means that they behave just like any other block and inline elements (as explained above). ...
...). we can, however, change the inner display type by using display values like flex. if we set display: flex; on an element, the outer display type is block, but the inner display type is changed to flex. any direct children of this box will become flex items and will be laid out according to the rules set out in the flexbox spec, which you'll learn about later on. note: to read more about the values of display, and how boxes work in block and inline layout, take a look at the mdn guide to block and inline layout. when you move on to learn about css layout in more detail, you will encounter flex, and various other inner values that your boxes can have, for example grid. block and inline layout, however, is the default way that things on the web behave — as we said above, it is sometimes...
...And 9 more matches
Index - Learn web development
ngscripting, functions, guide, javascript, learn, tutorial, build, invoke, l10n:priority, parameters with most of the essential theory dealt with in the previous article, this article provides practical experience. here you will get some practice building your own, custom function. along the way, we'll also explain some useful details of dealing with functions. ...
...s with most of the essential theory dealt with in the previous article, this article provides practical experience. here you will get some practice building your own, custom function. along the way, we'll also explain some useful details of dealing with functions. 91 function return values article, beginner, codingscripting, functions, guide, javascript, learn, return, return values, l10n:priority there's one last essential concept about functions for us to discuss — return values. some functions don't return a significant value, but others do. it's important to understand what their values are, how to use them in your code, and how to make functions return useful values. we'll cover all of these below. 92 functions — reusable blocks of code api, ar...
..., events, test your skills this aim of this skill test is to assess whether you've understood our introduction to events article. 99 test your skills: functions beginner, functions, javascript, learn, test your skills this aim of this skill test is to assess whether you've understood our functions — reusable blocks of code, build your own function, and function return values articles. 100 test your skills: loops beginner, javascript, learn, loops this aim 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 ...
...And 9 more matches
Accessibility in React - Learn web development
t at the top of todo.js so that it includes useref: import react, { useref, usestate } from "react"; then, create two new constants beneath the hooks in your todo() function. each should be a ref – one for the "edit" button in the view template and one for the edit field in the editing template. ...
...es useref: import react, { useref, usestate } from "react"; then, create two new constants beneath the hooks in your todo() function. each should be a ref – one for the "edit" button in the view template and one for the edit field in the editing template. ...
...tion. each should be a ref – one for the "edit" button in the view template and one for the edit field in the editing template. const editfieldref = useref(null); const editbuttonref = useref(null); these refs have a default value of null because they will not have value until we attach them to their respective elements. to do that, we'll add an attribute of ref to each element, and set their values to the appropriately named ref objects. ...
...And 9 more matches
React interactivity: Events and state - Learn web development
n the elements in our jsx, like this: <button type="button" onclick={() => alert("hi!")} > say hi! </button> note: this may seem counter-intuitive regarding best-practice advice that tends to advise against use of inline event handlers on html, but remember that jsx is actually part of your javascript. in the above example, we're adding an onclick attribute to the <button> element. the value of that attribute is a function that triggers a simple alert. the onclick attribute has special meaning here: it tells react to run a given function when the user clicks on the button. there are a couple of other things to note: the camel-cased nature of onclick is important — jsx will not recognize onclick (again, it is already used in javascript for a specific purpose, which is related bu...
..., create a function named handlesubmit(). this function should prevent the default behavior of the submit event. after that, it should trigger an alert(), which can say whatever you’d like. it should end up looking something like this: function handlesubmit(e) { e.preventdefault(); alert('hello, world!'); } to use this function, add an onsubmit attribute to the <form> element, and set its value to the handlesubmit function: <form onsubmit={handlesubmit}> now if you head back to your browser and click on the "add" button, your browser will show you an alert dialog with the words "hello, world!" — or whatever you chose to write there. callback props in react applications, interactivity is rarely confined to just one component: events that happen in one component will affect other pa...
...input field! this is what we'll do next. note: we decided to name our callback prop addtask to make it easy to understand what the prop will do. another common convention you may well come across in react code is to prefix callback prop names with the word on, followed by the name of the event that will cause them to be run. for instance, we could have given our form a prop of onsubmit with the value of addtask. state and the usestate hook so far, we've used props to pass data through our components and this has served us just fine. now that we're dealing with user input and data updates, however, we need something more. for one thing, props come from the parent of a component. our <form /> will not be inheriting a new name for our task; our <input /> element lives directly inside of <fo...
...And 9 more matches
Adding a new CSS property
see the gecko overview for more information about the style system. this document assumes that you have a specifcation for the property available. issues about how to write such a specification (including things such as whether it is appropriate to use prefixes or when properties should be inherited by default) are not covered here. ...
...ntry to property_database.js. see the documentation at the top of the file and the other entries for examples. this will cause tests of your new property to be added to many of the mochitests in layout/style/test, which can be run with the command "./mach mochitest -f plain layout/style/". then, unless you're implementing a shorthand property, you need to decide which style struct the computed value of the property should go in. (again, see the gecko overview for more information.) it should generally be grouped with related properties. remember that each style struct contains only properties that inherit by default or only properties that do not. (which set the property is in is given in the specification, which says "inherited: yes" or "inherited: no" in the property's definition.) al...
...'re going to use (or that the property is a shorthand), you can add appropriate entry to nscssproplist.h. again, see the documentation at the top of the file and the other entries for examples, and also see the next section for details about parsing. ...
...And 9 more matches
Task.jsm
.spawn() function takes a generator function and starts running it as a task. every time the task yields a promise, it waits until the promise is resolved. task.spawn() returns a promise that is resolved when the task completes successfully, or is rejected if an exception occurs. you can use the yield operator inside the generator function to wait on a promise, spawn another task, or propagate a value: let resolutionvalue = yield (promise/generator/iterator/value); if you specify a promise, the yield operator returns its resolution value as soon as the promise is resolved. if the promise is rejected, its rejection reason is thrown as an exception. if you specify a generator function or the iterator returned by a generator function, then task.spawn() is implicitly called, and the yield ope...
... function or the iterator returned by a generator function, then task.spawn() is implicitly called, and the yield operator works on the returned promise. this reduces the syntax overhead of calling task.spawn() explicitly when you want to recurse into other task functions. if you specify a function that is not a generator, it is called with no arguments, and the yield operator returns the return value of the function. this comes in handy when iterating over function lists where some items have been converted to tasks and some not. if you specify anything else, the yield operator returns exactly what you specified. method overview function async(atask); promise spawn(atask); properties attribute type description result read only constru...
...ything else, the yield operator returns exactly what you specified. method overview function async(atask); promise spawn(atask); properties attribute type description result read only constructor constructs a special exception that, when thrown inside a legacy generator function, allows the associated task to be resolved with a specific value. ...
...And 9 more matches
JS::Add*Root
ill 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 31 register a variable as a member of the garbage collector's root set, to protect anything the root points at from garbage collection. these functions are obsoleted, use js::persistentrooted instead. ...
...discouraged since it could be removed at any time. try to avoid using it. this article covers features introduced in spidermonkey 31 register a variable as a member of the garbage collector's root set, to protect anything the root points at from garbage collection. these functions are obsoleted, use js::persistentrooted instead. ...
...s a member of the garbage collector's root set, to protect anything the root points at from garbage collection. these functions are obsoleted, use js::persistentrooted instead. ...
...And 9 more matches
imgIContainer
loopcount long number of times to loop the image. note: -1 means forever. obsolete since gecko 2.0 numframes unsigned long the total number of frames in this image. read only. obsolete since gecko 2.0 preferredalphachannelformat gfx_format read only. obsolete since gecko 1.9.2 type unsigned short the type of this image (one of the type_* values above). read only. width print32 the width of the container rectangle. in the case of any error, zero is returned, and an exception will be thrown. read only. constants constant value description type_raster 0 enumerated values for the 'type' attribute (below). type_vector 1 flag_none 0x0 flags for imgiconta...
...ates instead of by tiling. this only affects 'draw()'. flag_sync_decode 0x1 flag_decode_no_premultiply_alpha 0x2 flag_decode_no_colorspace_conversion 0x4 flag_clamp 0x8 frame_first 0 constants for specifying various "special" frames. frame_first: the first frame frame_current: the current frame. frame_max_value should be set to the value of the maximum constant above, as it is used for ensuring that a valid value was passed in. frame_current 1 frame_max_value 1 knormalanimmode 0 animation mode constants 0 = normal 1 = do not animate 2 = loop once. kdontanimmode 1 klooponceanimmode 2 kdisposeclearall -1 ...
... obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. create and return a new copy of the current frame that you can write to and otherwise inspect the pixels of. gfximagesurface copycurrentframe(); parameters none. return value missing description exceptions thrown missing exception missing description native code only!copyframe create and return a new copy of the given frame that you can write to and otherwise inspect the pixels of. gfximagesurface copyframe( in pruint32 awhichframe, in pruint32 aflags ); parameters awhichframe frame specifier of the frame_* variety. aflags flags of the...
...And 9 more matches
mozIStorageAggregateFunction
this is an interface that must be implemented by consumers. it allows consumers to add aggregate functions that are available to sql queries and triggers. an aggregate function is a function that returns one value from a series of values. there are a number of already defined aggregate functions provided by sqlite. objects implementing this interface can be registered with mozistorageconnection.createaggregatefunction(). storage/public/mozistorageaggregatefunction.idlscriptable please add a summary to this article. ...
...umber of already defined aggregate functions provided by sqlite. objects implementing this interface can be registered with mozistorageconnection.createaggregatefunction(). storage/public/mozistorageaggregatefunction.idlscriptable please add a summary to this article. last changed in gecko 1.9 (firefox 3) inherits from: nsisupports method overview void onstep(in mozistoragevaluearray afunctionarguments); nsivariant onfinal(); methods onstep() this is called for each row of results returned by the query. the implementation should store or perform some work to prepare to return a value. note this callback is executed on the thread that the statement or trigger is executing on. if you use mozistorageconnection.executeasync() or, mozistoragestatement.exe...
...ecuting on. if you use mozistorageconnection.executeasync() or, mozistoragestatement.executeasync() this callback will run on a different thread from the rest of your code. likewise, if you execute sql on a different thread, this callback will be executed on that thread. this callback should be reentrant if any of the above applies to your use of the storage apis! void onstep( in mozistoragevaluearray afunctionarguments ); parameters afunctionarguments a mozistoragevaluearray holding the arguments passed in to the function. onfinal() this is called after all results have been obtained and notified via mozistorageaggregatefunction. the implementation should finish its calculations on the data, and return a result. note this callback is executed on the thread that the statement o...
...And 9 more matches
nsIContentPrefService2
synchronous api for content preferences 1.0 66 introduced gecko 20.0 inherits from: nsisupports last changed in gecko 20.0 (firefox 20.0 / thunderbird 20.0 / seamonkey 2.17) description content preferences allow the application to associate arbitrary data, or "preferences", with specific domains, or web "content". specifically, a content preference is a structure with three values: a domain with which the preference is associated, a name that identifies the preference within its domain, and a value. (see nsicontentpref below.) for example, if you want to remember the user's preference for a certain zoom level on www.mozilla.org pages, you might store a preference whose domain is "www.mozilla.org", whose name is "zoomlevel", and whose value is the numeric zoom level. a pre...
...r's preference for a certain zoom level on www.mozilla.org pages, you might store a preference whose domain is "www.mozilla.org", whose name is "zoomlevel", and whose value is the numeric zoom level. a preference need not have a domain, and in that case the preference is called a "global" preference. this interface doesn't impart any special significance to global preferences; they're simply name-value pairs that aren't associated with any particular domain. as a consumer of this interface, you might choose to let a global preference override all non- global preferences of the same name, for example, for whatever definition of "override" is appropriate for your use case. domain parameters many methods of this interface accept a "domain" parameter. domains may be specified either exactly, like "...
...when a set() or remove method is...
...And 9 more matches
nsIDOMElement
domstring getattribute( in domstring name );...
...ring name) nsidomattr removeattributenode(in nsidomattr oldattr) void removeattributens(in domstring namespaceuri, in domstring localname) void setattribute(in domstring name, in domstring value) nsidomattr setattributenode(in nsidomattr newattr) nsidomattr setattributenodens(in nsidomattr newattr) void setattributens(in domstring namespaceuri, in domstring qualifiedname, in domstring value) attributes attribute type description tagname domstring the element tag name. read only. methods getattribute() get an attribute value. domstring getattribute( in domstring name ); parameters name attribute name return value a domstring containing the attribute value. getattributenode() get an attribute node. nsidomattr getattributenode( in domstring name ); parameters name a...
...ribute type description tagname domstring the element tag name. read only. methods getattribute() get an attribute value. domstring getattribute( in domstring name ); parameters name attribute name return value a domstring containing the attribute value. getattributenode() get an attribute node. nsidomattr getattributenode( in domstring name ); parameters name attribute name return value a nsidomattr corresponding to the attribute. getattributenodens() get an attribute node in a given namespace. nsidomattr getattributenodens( in domstring namespaceuri, in domstring localname ); parameters namespaceuri namespace uri localname attribute name return value a nsidomattr corresponding to the attribute. getattributens() get an attribute value in a given namespace. domstring getat...
...And 9 more matches
nsIMsgHeaderParser
lean preserveintegrity); methods extractheaderaddressmailboxes() given a string which contains a list of header addresses, returns a comma-separated list of just the 'mailbox' portions. if any of the addresses doesn't have a mailbox, then the user name is used instead. autf8string extractheaderaddressmailboxes( in string line ); parameters line the header line to parse. return value a comma-separated list of just the mailbox parts of the addresses. exceptions thrown missing exception missing description native code only!extractheaderaddressnames given a string which contains a list of header addresses, returns a comma-separated list of just the 'user name' portions. if any of the addresses doesn't have a name, then the mailbox is used instead. autf8string extracth...
...ng exception missing description native code only!extractheaderaddressnames given a string which contains a list of header addresses, returns a comma-separated list of just the 'user name' portions. if any of the addresses doesn't have a name, then the mailbox is used instead. autf8string extractheaderaddressnames( in string line ); parameters line the header line to parse. ...
... astring makefulladdress( in astring aname, in astring aaddress ); parameters aname the name of the sender. this should be in utf-8. ...
...And 9 more matches
nsIMsgIdentity
the nsimsgidentity interface contains all the personal outgoing mail information for a given person. each identity is identified by a key, which is the id string in the identity preferences, such as in mail.identity.<id>.replyto. ...
...formation for a given person. each identity is identified by a key, which is the id string in the identity preferences, such as in mail.identity.<id>.replyto. ...
... such as in mail.identity.<id>.replyto. ...
...And 9 more matches
Getting Started Guide
d less leaks. for instance, here is a typical snippet of code (at its most compact) where you assign a xpcom interface pointer into a member variable, i.e., the body of a `setter' function, side-by-side using raw xpcom interface pointers and nscomptrs. comparison 1. setting a member variable. // raw xpcom interface pointers... // given: |nsifoo* mfooptr;| /* |addref| the new value if it's not |null|; assign it in; and |release| the old value, if any (so we don't leak it). this order of assignment is special and must be used to avoid particular ownership bugs. */ ns_if_addref(afooptr); nsifoo* temp = mfooptr; mfooptr = afooptr; ns_if_release(temp); // |nscomptr|... // given: |nscomptr<nsifoo> mfooptr;| /* this assignment automatically ...
...; assign it in; and |release| the old value, if any (so we don't leak it). this order of assignment is special and must be used to avoid particular ownership bugs. */ ns_if_addref(afooptr); nsifoo* temp = mfooptr; mfooptr = afooptr; ns_if_release(temp); // |nscomptr|... // given: |nscomptr<nsifoo> mfooptr;| /* this assignment automatically |release|s the old value in |mfooptr|, if any, and |addref|s the new one, in the appropriate sequence to avoid the ownership bug mentioned earlier. */ mfooptr = afooptr; additionally, the class using raw xpcom interface pointers will need a destructor to release mfooptr; and a constructor to ensure that mfooptr is initially set to null (or some other reasonable value). nscomptr helps you...
... // or, if you're a savvy xpcom programmer, // you use the type-safe version... nsresult rv = callqueryinterface(bar, getter_addrefs(foo)); queryinterface is used so frequently, though, that nscomptr has a special facility to call it. this facility is type-safe, and it enables an nscomptr to be directly constructed from the result of queryinterface. construction from the correct value is more efficient that construction followed by assignment. this facility is the do_queryinterface directive. using do_queryinterface, the sample above would look like this how to queryinterface into an nscomptr. // the best way to |queryinterface| into an |nscomptr|... nsresult rv; nscomptr<nsifoo> foo(do_queryinterface(bar, &rv)); // or, if you don't care about the |nsresul...
...And 9 more matches
AudioListener - Web APIs
ner interface represents the position and orientation of the unique person listening to the audio scene, and is used in audio spatialization. all pannernodes spatialize in relation to the audiolistener stored in the baseaudiocontext.listener attribute. it is important to note that there is only one listener per context and that it isn't an audionode. properties the position, forward, and up value are set and retrieved using different syntaxes. retrieval is done by accessing, for example, audiolistener.positionx, while setting the same property is done with audiolistener.positionx.value. this is why these values are not marked read only, which is how they appear in the specification's idl. audiolistener.positionx represents the horizontal position of the listener in a right-hand carte...
...t-hand cartesian coordinate sytem. the default is 0. audiolistener.positionz represents the longitudinal (back and forth) position of the listener in a right-hand cartesian coordinate sytem. the default is 0. audiolistener.forwardx represents the horizontal position of the listener's forward direction in the same cartesian coordinate sytem as the position (positionx, positiony, and positionz) values. the forward and up values are linearly independent of each other. the default is 0. audiolistener.forwardy represents the vertical position of the listener's forward direction in the same cartesian coordinate sytem as the position (positionx, positiony, and positionz) values. the forward and up values are linearly independent of each other. the default is 0. audiolistener.forwardz represent...
...ection in the same cartesian coordinate sytem as the position (positionx, positiony, and positionz) values. the forward and up values are linearly independent of each other. the default is 0. audiolistener.forwardz represents the longitudinal (back and forth) position of the listener's forward direction in the same cartesian coordinate sytem as the position (positionx, positiony, and positionz) values. the forward and up values are linearly independent of each other. the default is -1. audiolistener.upx represents the horizontal position of the top of the listener's head in the same cartesian coordinate sytem as the position (positionx, positiony, and positionz) values. the forward and up values are linearly independent of each other. the default is 0. audiolistener.upy represents the ver...
...And 9 more matches
AudioParam - Web APIs
the web audio api's audioparam interface represents an audio-related parameter, usually a parameter of an audionode (such as gainnode.gain). an audioparam can be set to a specific value or a change in value, and can be scheduled to happen at a specific time and following a specific pattern. there are two kinds of audioparam, a-rate and k-rate parameters: an a-rate audioparam takes the current audio parameter value for each sample frame of the audio signal. a k-rate audioparam uses the same initial audio parameter value for the whole block processed, that is 128 sample frames. in other words, the same value applies to every frame in the audio as it's processed by the node. each audionode defines which of its parameters are a-rate or k-rate in the spec. each audioparam has a list of even...
... audio signal. a k-rate audioparam uses the same initial audio parameter value for the whole block processed, that is 128 sample frames. in other words, the same value applies to every frame in the audio as it's processed by the node. each audionode defines which of its parameters are a-rate or k-rate in the spec. each audioparam has a list of events, initially empty, that define when and how values change. when this list is not empty, changes using the audioparam.value attributes are ignored. this list of events allows us to schedule changes that have to happen at very precise times, using arbitrary timelime-based automation curves. the time used is the one defined in audiocontext.currenttime. ...
... list of events, initially empty, that define when and how values change. when this list is not empty, changes using the audioparam.value attributes are ignored. this list of events allows us to schedule changes that have to happen at very precise times, using arbitrary timelime-based automation curves. the time used is the one defined in audiocontext.currenttime. properties audioparam.defaultvalue read only represents the initial volume of the attribute as defined by the specific audionode creating the audioparam. audioparam.maxvalue read only represents the maximum possible value for the parameter's nominal (effective) range. ...
...And 9 more matches
AudioWorkletProcessor.process - Web APIs
syntax var isactivelyprocessing = audioworkletprocessor.process(inputs, outputs, parameters); parameters inputs an array of inputs connected to the node, each item of which is, in turn, an array of channels. each channel is a float32array containing 128 samples. for example, inputs[n][m][i] will access n-th input, m-th channel of that input, and i-th sample of that channel. each sample value is in range of [-1 .. 1]. the number of inputs and thus the length of that array is fixed at the construction of the node (see audioworkletnodeoptions). if there is no active node connected to the n-th input of the node, inputs[n] will be an empty array (zero input channels available). the number of channels in each input may vary, depending on channelcount and channelcountmode properties. ...
...ount and channelcountmode properties. outputs an array of outputs that is similar to the inputs parameter in structure. it is intended to be filled during the execution of the process() method. each of the output channels is filled with zeros by default — the processor will output silence unless the output arrays are modified. parameters an object containing string keys and float32array values. for each custom audioparam defined using the parameterdescriptors getter, the key in the object is a name of that audioparam, and the value is a float32array. the values of the array are calculated by taking scheduled automation events into consideration. if the automation rate of the parameter is "a-rate", the array will contain 128 values — one for each frame in the current audio block. i...
...t audioparam, and the value is a float32array. the values of the array are calculated by taking scheduled automation events into consideration. if the automation rate of the parameter is "a-rate", the array will contain 128 values — one for each frame in the current audio block. if there's no automation happening during the time represented by the current block, the array may contain a single value that is constant for the entire block, instead of 128 identical values. if the automation rate is "k-rate", the array will contain a single value, which is to be used for each of 128 frames. ...
...And 9 more matches
IDBKeyRange - Web APIs
the idbkeyrange interface of the indexeddb api represents a continuous interval over some data type that is used for keys. records can be retrieved from idbobjectstore and idbindex objects using keys or a range of keys. you can limit the range using lower and upper bounds. for example, you can iterate over all values of a key in the value range a–z. a key range can be a single value or a range with upper and lower bounds or endpoints. if the key range has both upper and lower bounds, then it is bounded; if it has no bounds, it is unbounded. a bounded key range can either be open (the endpoints are excluded) or closed (the endpoints are included). to retrieve all keys within a certain range, you can use the following code constructs: range code all keys ≥ x idbke...
... note: this feature is available in web workers. properties idbkeyrange.lower read only lower bound of the key...
...ys > x &&< y idbkeyrange.bound(x, y, true, true) all keys > x && ≤ y idbkeyrange.bound(x, y, true, false) all keys ≥ x &&< y idbkeyrange.bound(x, y, false, true) the key = z idbkeyrange.only(z) a key is in a key range if the following conditions are true: the lower value of the key range is one of the following: undefined less than key value equal to key value if loweropen is false. the upper value of the key range is one of the following: undefined greater than key value equal to key value if upperopen is false. note: this feature is available in web workers. properties idbkeyrange.lower read only lower bound of the key range. idbkeyrange.upper read only upper bound of the key range. idbkeyrange...
...And 9 more matches
Timing element visibility with the Intersection Observer API - Web APIs
ds, in our case) for intersection changes relative to the document. the options are configured to watch for intersections with the document's viewport (by setting root to null). we have no margins to extend or contract the intersection root's rectangle; we want to match the boundaries of the document's viewport exactly for intersection purposes. and the threshold is set to an array containing the values 0.0 and 0.75; this will cause our callback to execute whenever a targeted element becomes completely obscured or first starts to become unobscured (intersection ratio 0.0) or passes through 75% visible in either direction (intersection ratio 0.75). the observer, adobserver, is created by calling intersectionobserver's constructor, passing in the callback function, intersectioncallback, and our ...
...(function(adbox) { drawadtimer(adbox); }); }); } } the array redrawlist will be used to keep a list of all the ads which need to be redrawn during this refresh cycle, since it may not be exactly the same as the elapsed time due to system activity or because you've set the interval to something other than every 1000 milliseconds. then, for each of the visible ads, we save the value of dataset.totalviewtime (the total number of milliseconds the ad has currently been visible, as of the last time it was updated) and then call updateadtimer() to update the time. if it's changed, then we push the ad onto the redrawlist so we know it needs to be updated during the next animation frame. finally, if there's at least one element to redraw, we use requestanimationframe() to schedule...
...t which the document was created, at which the ad's visibility count was last updated, or the ad last became visible. 0 if the ad was not visible as of the last time it was checked. totalviewtime the total number of milliseconds the ad has been visible. these are accessed through each ad's htmlelement.dataset attribute, which provides a domstringmap mapping each custom attribute's name to its value. the values are strings, but we can convert those to numbers easily enough—in fact, javascript generally does it automatically, although we'll have one instance where we have to do it ourselves. we start by fetching the time at which the ad's previous visibility status check time (adbox.dataset.lastviewstarted) into a local variable named laststarted. we also get the current time-since-creatio...
...And 9 more matches
StorageEvent - Web APIs
text x="176" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">storageevent</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} method overview void initstorageevent( in domstring type, in boolean canbubble, in boolean cancelable, in domstring key, in domstring oldvalue, in domstring newvalue, in usvstring url, in storage storagearea ); attributes attribute type description key domstring represents the key changed. the key attribute is null when the change is caused by the storage clear() method. read only. newvalue domstring the new value of the key. the newvalue is null when the change has been invoked by st...
...read only. ...
...read only. storagearea storage represents the storage object that was affected. read only. ...
...And 9 more matches
A basic 2D WebGL animation example - Web APIs
avertexposition.y * urotationvector.x, avertexposition.y * urotationvector.y - avertexposition.x * urotationvector.x ); gl_position = vec4(rotatedposition * uscalingfactor, 0.0, 1.0); } </script> the main program shares with us the attribute avertexposition, which is the position of the vertex in whatever coordinate system it's using. we need to convert these values so that both components of the position are in the range -1.0 to 1.0. this can be done easily enough by multiplying by a scaling factor that's based on the context's aspect ratio. we'll see that computation shortly. we're also rotating the shape, and we can do that here, by applying a transform. we'll do that first. the rotated position of the vertex is computed by applying the rotation vector,...
...ting the shape, and we can do that here, by applying a transform. we'll do that first. the rotated position of the vertex is computed by applying the rotation vector, found in the uniform urotationvector, that's been computed by the javascript code. then the final position is computed by multiplying the rotated position by the scaling vector provided by the javascript code in uscalingfactor. the values of z and w are fixed at 0.0 and 1.0, respectively, since we're drawing in 2d. the standard webgl global gl_position is then set to the transformed and rotated vertex's position. fragment shader next comes the fragment shader. its role is to return the color of each pixel in the shape being rendered. since we're drawing a solid, untextured object with no lighting applied, this is exceptionally...
...solid, untextured object with no lighting applied, this is exceptionally simple: <script id="fragment-shader" type="x-shader/x-fragment"> #ifdef gl_es precision highp float; #endif uniform vec4 uglobalcolor; void main() { gl_fragcolor = uglobalcolor; } </script> this starts by specifying the precision of the float type, as required. then we set the global gl_fragcolor to the value of the uniform uglobalcolor, which is set by the javascript code to the color being used to draw the square. html the html consists solely of the <canvas> that we'll obtain a webgl context on. <canvas id="glcanvas" width="600" height="460"> oh no! your browser doesn't support canvas! </canvas> javascript globals and initialization first, the global variables. we won't discuss these here; ...
...And 9 more matches
-webkit-border-before - CSS: Cascading Style Sheets
the -webkit-border-before css property is a shorthand property for setting the individual logical block start border property values in a single place in the style sheet. /* border values */ -webkit-border-before: 1px; -webkit-border-before: 2px dotted; -webkit-border-before: medium dashed blue; /* global values */ -webkit-border-before: inherit; -webkit-border-before: initial; -webkit-border-before: unset; -webkit-border-before can be used to set the values for one or more of: -webkit-border-before-width, -webkit-border-before-style, and -webkit-border-before-color. it maps to a physical border depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top, border-right, border-bottom, or border-left property depending on the valu...
...lity, and text orientation. it corresponds to the border-top, border-right, border-bottom, or border-left property depending on the values defined for writing-mode, direction, and text-orientation. it relates to -webkit-border-after, -webkit-border-start, and -webkit-border-end, which define the other borders of the element. this property is on the standard track as border-block-start. ...
...nd text-orientation. it relates to -webkit-border-after, -webkit-border-start, and -webkit-border-end, which define the other borders of the element. this property is on the standard track as border-block-start. ...
...And 9 more matches
CSS Box Alignment - CSS: Cascading Style Sheets
n grid and flexbox. css grid layout alignment example in this example using grid layout, there is extra space in the grid container after laying out the fixed width tracks on the inline (main) axis. this space is distributed using justify-content. on the block (cross) axis the alignment of the items inside their grid areas is controlled with align-items. the first item overrides the align-items value set on the group by setting align-self to center. flexbox alignment example in this example, three flex items are aligned on the main axis using justify-content and on the cross axis using align-items. the first item overrides the align-items set on the group by setting align-self to center. key concepts and terminology the specification details some alignment terminology to make it easie...
...apped when flexbox is set to column. therefore, when working with flexbox it is easier to think about the main and cross axis rather than inline and block. the justify- properties are always used to align on the main axis, the align- properties on the cross axis. the alignment subject the alignment subject is the thing that is being aligned. for justify-self or align-self, or when setting these values as a group with justify-items or align-items, this will be the margin box of the element that this property is being used on. the justify-content and align-content properties differ per layout method. the alignment container the alignment container is the box the subject is being aligned inside. this will typically be the alignment subject’s containing block. an alignment container may conta...
...ects inside. fallback alignment if you set an alignment that cannot be fulfilled, then the fallback alignment will come into play and deal with the available space. this fallback alignment is specified individually for each layout method and detailed on the page for that method. types of alignment there are three different types of alignment that the specification details; these use keyword values. positional alignment: specifying the position of an alignment subject with relation to its alignment container. baseline alignment: these keywords define alignment as a relationship among the baselines of multiple alignment subjects within an alignment context. distributed alignment: these keywords define alignment as a distribution of space among alignment subjects. positional alignment...
...And 9 more matches
Using feature queries - CSS: Cascading Style Sheets
dia query @media rule; when you use feature queries, you will find they behave in a similar way to media queries. the difference is that with a media query you are testing something about the environment in which the web page is running, whereas with feature queries you are testing browser support for css features. ...
...hat with a media query you are testing something about the environment in which the web page is running, whereas with feature queries you are testing browser support for css features. a feature query consists of the @supports rule, followed by the property name and value you would like to test for. ...
...e testing something about the environment in which the web page is running, whereas with feature queries you are testing browser support for css features. a feature query consists of the @supports rule, followed by the property name and value you would like to test for. you may not test for a bare property name such as display; the rule requires a property name and a value: @supports (property: value) { css rules to apply } if you want to check if a browser supports the row-gap property, for example, you would write the following feature query. ...
...And 9 more matches
CSS reference - CSS: Cascading Style Sheets
Web › CSS › Reference
ta types, and at-rules. you can also browse key css concepts and a list of selectors organized by type. also included is a brief dom-css / cssom reference. basic rule syntax style rule syntax style-rule ::= selectors-list { properties-list } ... where : selectors-list ::= selector[:pseudo-class] [::pseudo-element] [, selectors-list] properties-list ::= [property : value] [; properties-list] see the index of selectors, pseudo-classes, and pseudo-elements below. the syntax for each specified value depends on the data type defined for each specified property. style rule examples strong { color: red; } div.menu-bar li:hover > ul { display: block; } for a beginner-level introduction to the syntax of selectors, see our guide on css selectors. be aware that ...
...ment()ellipse()em:emptyempty-cells:enabledenv()exffallback (@counter-style)filter<filter-function>:first:first-child::first-letter (:first-letter)::first-line (:first-line):first-of-typefit-content()<flex>flexflex-basisflex-directionflex-flowflex-growflex-shrinkflex-wrapfloat:focusfont@font-facefont-familyfont-family (@font-face)font-feature-settingsfont-feature-settings (@font-face)@font-feature-valuesfont-kerningfont-language-overridefont-optical-sizingfont-sizefont-size-adjustfont-stretchfont-stretch (@font-face)font-stylefont-style (@font-face)font-synthesisfont-variantfont-variant (@font-face)font-variant-alternatesfont-variant-capsfont-variant-east-asianfont-variant-ligaturesfont-variant-numericfont-variant-positionfont-variation-settingsfont-variation-settings (@font-face)font-weightfont...
...s, which allow styles to be conditional based on various features of elements within the dom. basic selectors basic selectors are fundamental selectors; these are the most basic selectors that are frequently combined to create other, more complex selectors. universal selector *, ns|*, *|*, |* type selector elementname class selector .classname id selector #idname attribute selector [attr=value] grouping selectors selector list a, b specifies that both a and b elements are selected. this is a grouping method to select several matching elements. combinators combinators are selectors that establish a relationship between two or more simple selectors, such as "a is a child of b" or "a is adjacent to b." adjacent sibling combinator a + b specifies that the elements selected by ...
...And 9 more matches
align-items - CSS: Cascading Style Sheets
the css align-items property sets the align-self value on all direct children as a group. in flexbox, it controls the alignment of items on the cross axis. in grid layout, it controls the alignment of items on the block axis within their grid area. the interactive example below demonstrates some of the values for align-items 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. ...
...gn-items 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. ...
... in static position of absolutely-positioned layouts, the keyword behaves...
...And 9 more matches
animation-timing-function - CSS: Cascading Style Sheets
progresses through the duration of each cycle. the source for this interactive example is stored in a github repository. if 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. ...
...s often convenient to use the shorthand property animation to set all animation properties at once. ...
... a keyframe's ti...
...And 9 more matches
background-position-x - CSS: Cascading Style Sheets
ground-position-x css property sets the initial horizontal position for each background image. the position is relative to the position layer set by background-origin. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the value of this property is overridden by any declaration of the background or background-position shorthand properties applied to the element after it. ...
...ive examples project, please clone https://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. ...
...And 9 more matches
background-position-y - CSS: Cascading Style Sheets
ckground-position-y css property sets the initial vertical position for each background image. the position is relative to the position layer set by background-origin. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the value of this property is overridden by any declaration of the background or background-position shorthand properties applied to the element after it. ...
...ive examples project, please clone https://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. ...
...And 9 more matches
border-image-width - CSS: Cascading Style Sheets
the border-image-width css property sets the width of an element's border 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. 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. ...
...rder 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. 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. ...
...xample is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. if this property's value is greater than the element's border-width, the border image will extend beyond the padding (and/or content) edge. ...
...And 9 more matches
border-style - CSS: Cascading Style Sheets
r this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...style: hidden; border-style: dotted; border-style: dashed; border-style: solid; border-style: double; border-style: groove; border-style: ridge; border-style: inset; border-style: outset; /* vertical | horizontal */ border-style: dotted solid; /* top | horizontal | bottom */ border-style: hidden double dashed; /* top | right | bottom | left */ border-style: none solid dotted dashed; /* global values */ border-style: inherit; border-style: initial; border-style: unset; the border-style property may be specified using one, two, three, or four values. when one value is specified, it applies the same style to all four sides. when two values are specified, the first style applies to the top and bottom, the second to the left and right. when three values are specified, the first style appl...
...tyle property may be specified using one, two, three, or four values. when one value is specified, it applies the same style to all four sides. when two values are specified, the first style applies to the top and bottom, the second to the left and right. when three values are specified, the first style applies to the top, the second to the left and right, the third to the bottom. when four values are specified, the styles apply to the top, right, bottom, and left in that order (clockwise). each value is a keyword chosen from the list below. values <line-style> describes the style of the border. it can have the following values: none like the hidden keyword, displays no border. ...
...And 9 more matches
box-shadow - CSS: Cascading Style Sheets
you to cast a drop shadow from the frame of almost any element. if a border-radius is specified on the element with a box shadow, the box shadow takes on the same rounded corners. the z-ordering of multiple box shadows is the same as multiple text shadows (the first specified shadow is on top). box-shadow generator is an interactive tool allowing you to generate a box-shadow. ...
...s | spread-radius | color */ box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.2); /* inset | offset-x | offset-y | color */ box-shadow: inset 5em 1em gold; /* any number of shadows, separated by commas */ box-shadow: 3px 3px red, -1em 0 0.4em olive; /* global keywords */ box-shadow: inherit; box-shadow: initial; box-shadow: unset; specify a single box-shadow using: two, three, or four <length> values. if only two values are given, they are interpreted as <offset-x><offset-y> values. if a third value is given, it is interpreted as a <blur-radius>. 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 not sp...
...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. ...
...And 9 more matches
cross-fade() - CSS: Cascading Style Sheets
the page by combining an image with a radial gradient. syntax important: the specification and current implementations have different syntaxes. the specification syntax is explained first. specification syntax the cross-fade() function takes a list of images with a percentage defining how much of each image is retained in terms of opacity when it is blended with the other images. the percent value must be coded without quotes, must contain the “%” symbol, and its value must be between 0% and 100%. the function can be used in css anywhere an ordinary image reference can be used. cross-fade percentages think of the percentage as an opacity value for each image. this means a value of 0% means the image is fully transparent while a value of 100% makes the image fully opaque. cross-fade...
...y percentages are omitted, all the specified percentages are summed together and subtracted from 100%. if the result is greater than 0%, the result is then divided equally between all images with omitted percentages. in the simplest case, two images are faded between each other. to do that, only one of the images needs to have a percentage, the other one will be faded accordingly. for example, a value of 0% defined for the first image yields only the second image, while 100% yields only the first. a 25% value renders the first image at 25% and the second at 75%. the 75% value is the inverse, showing the first image at 75% and the second at 25%. the above could also have been written as: cross-fade( url(white.png) 0%, url(black.png)); /* fully black */ cross-fade( url(white.png) 25%, url(b...
...% white, 25% black */ cross-fade( url(white.png) 100%, url(black.png)); /* fully white */ cross-fade( url(green.png) 75%, url(red.png) 75%); /* both green and red at 75% */ if no percentages are declared, both the images will be 50% opaque, with a cross-fade rendering as an even merge of both images. the 50%/50% example seen above did not need to have the percentages listed, as when a percentage value is omitted, the included percentages are added together and subtracted from 100%. the result, if greater than 0, is then divided equally between all images with omitted percentages. in the last example, the sum of both percentages is not 100%, and therefore both images include their respective opacities. if no percentages are declared and three images are included, each image will be 33.33% opa...
...And 9 more matches
justify-content - 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. ...
...ems from the start */ justify-content: end; /* pack items from the end */ justify-content: flex-start; /* pack flex items from the start */ justify-content: flex-end; /* pack flex items from the end */ justify-content: left; /* pack items from the left */ justify-content: right; /* pack items from the right */ /* baseline alignment */ /* justify-content does not take baseline values */ /* normal alignment */ justify-content: normal; /* distributed alignment */ justify-content: space-between; /* distribute items evenly the first item is flush with the start, the last is flush with the end */ justify-content: space-around; /* distribute items evenly items have a half-si...
... end the items are packed flush to each other toward the end edge of the alignment container in the main axis. flex-start the items are packed flush to each other toward the edge of the ali...
...And 9 more matches
mask-border-source - CSS: Cascading Style Sheets
the mask-border-source css property sets the source image used to create an element's mask border. the mask-border-slice property is used to divide the source image into regions, which are then dynamically applied to the final mask border. ...
... the mask-border-source css property sets the source image used to create an element's mask border. the mask-border-slice property is used to divide the source image into regions, which are then dynamically applied to the final mask border. ...
...css property sets the source image used to create an element's mask border. the mask-border-slice property is used to divide the source image into regions, which are then dynamically applied to the final mask border. syntax /* keyword value */ mask-border-source: none; /* <image> values */ mask-border-source: url(image.jpg); mask-border-source: linear-gradient(to top, red, yellow); /* global values */ mask-border-source: inherit; mask-border-source: initial; mask-border-source: unset; values none no mask border is used. ...
...And 9 more matches
position - CSS: Cascading Style Sheets
Web › CSS › position
bottom, and left properties determine the final location of 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 the position property is specified as a single keyword chosen from the list of values below. values static the element is positioned according to the normal flow of the document. the top, right, bottom, left, and z-index properties have no effect. this is the default value. relative the element is positioned according to the normal flow of the document, and then offset relative to itself based on the values of top, right, bottom, and left. the offset does not affect the po...
...its effect on table-*-group, table-row, table-column, table-cell, and table-caption elements is undefined. absolute the element is removed from the normal document flow, and no space is created for the element in the page layout. ...
...its effect on table-*-group, table-row, table-column, table-cell, and table-caption elements is undefined. absolute the element is removed from the normal document flow, and no space is created for the element in the page layout. ...
...And 9 more matches
<position> - CSS: Cascading Style Sheets
the <position> (or <bg-position>) css data type denotes a two-dimensional coordinate used to set a location relative to an element box. it is used in the background-position and offset-anchor properties. note: the final position described by the <position> value does not need to be inside the element's box. syntax the <position> data type is specified with one or two keywords, with optional offsets. the keyword values are center, top, right, bottom, and left. ...
...keywords, with optional 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. ...
... 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. ...
...And 9 more matches
transform-origin - CSS: Cascading Style Sheets
epository. if 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 transformation origin is the point around which a transformation is applied. for example, the transformation origin of the rotate() function is the center of rotation. ...
....com/mdn/interactive-examples and send us a pull request. the transformation origin is the point around which a transformation is applied. for example, the transformation origin of the rotate() function is the center of rotation. this property is applied by first translating the element by the value of the property, then applying the element's transform, then translating by the negated property value. ...
... the value of the property, then applying the element's transform, then translating by the negated property value. this means, this definition transform-origin: -100% 50%; transform: rotate(45deg); results in the same transformation as transform-origin: 0 0; transform: translate(-100%, 50%) rotate(45deg) translate(100%, -50%); by default, the origin of a transform is center. ...
...And 9 more matches
transition-timing-function - 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. this, in essence, lets you establish an acceleration curve so that the speed of the transition can vary over its duration. this acceleration curve is defined using one <timing-function> for each property to be transitioned. ...
...ation curve is defined using one <timing-function> for each property to be transitioned. you may specify multiple timing functions; each one will be applied to the corresponding property as specified by the transition-property property, which acts as a transition-property list. ...
...g-function> for each property to be transitioned. you may specify multiple timing functions; each one will be applied to the corresponding property as specified by the transition-property property, which acts as a transition-property list. ...
...And 9 more matches
vertical-align - CSS: Cascading Style Sheets
at this has already happened.</p> </td> </tr> </table> table { margin-left: auto; margin-right: auto; width: 80%; } table, th, td { border: 1px solid black; } td { padding: 0.5em; font-family: 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. ...
...onospace; } 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. ...
...ne-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. ...
...And 9 more matches
<td>: The Table Data Cell element - HTML: Hypertext Markup Language
Web › HTML › Element › td
> or <td> element or if there are no more data in its parent element. permitted parents a <tr> element. implicit aria role cell if a descendant of a <table> element permitted aria roles any dom interface htmltabledatacellelement attributes this element includes the global attributes. ...
... permitted parents a <tr> element. implicit aria role cell if a descendant of a <table> element permitted aria roles any dom interface htmltabledatacellelement attributes this element includes the global attributes. colspan this attribute contains a non-negative integer value that indicates for how many columns the cell extends. its default value is 1. ...
...tted parents a <tr> element. implicit aria role cell if a descendant of a <table> element permitted aria roles any dom interface htmltabledatacellelement attributes this element includes the global attributes. colspan this attribute contains a non-negative integer value that indicates for how many columns the cell extends. its default value is 1. ...
...And 9 more matches
<th> - HTML: Hypertext Markup Language
Web › HTML › Element › th
er permitted aria roles any dom interface htmltableheadercellelement attributes this element includes the global attributes. abbr this attribute contains a short abbreviated description of the cell's content. some user-agents, such as speech readers, may present this description before the content itself. ...
...bleheadercellelement attributes this element includes the global attributes. abbr this attribute contains a short abbreviated description of the cell's content. some user-agents, such as speech readers, may present this description before the content itself. colspan this attribute contains a non-negative integer value that indicates for how many columns the cell extends. its default value is 1. ...
...lelement attributes this element includes the global attributes. abbr this attribute contains a short abbreviated description of the cell's content. some user-agents, such as speech readers, may present this description before the content itself. colspan this attribute contains a non-negative integer value that indicates for how many columns the cell extends. its default value is 1. ...
...And 9 more matches
Global attributes - HTML: Hypertext Markup Language
global attributes accesskey provides a hint for generating a keyboard shortcut for the current element. this attribute consists of a space-separated list of characters. the browser should use the first one that exists on the computer keyboard layout. autocapitalize controls whether and how text input is automatically capitalized as it is entered/edited by the user. ...
... list of the classes of the element. classes allows css and javascript to select and access specific elements via the class selectors or functions like the method document.getelementsbyclassname(). contenteditable an enumerated attribute indicating if the element should be editable by the user. if so, the browser modifies its widget to allow editing. the attribute must take one of the following values: true or the empty string, which indicates that the element must be editable; false, which indicates that the element must not be editable. contextmenu the id of a <menu> to use as the contextual menu for this element. data-* forms a class of attributes, called custom data attributes, that allow proprietary information to be exchanged between the html and its dom representation th...
...butes, that allow proprietary information to be exchanged between the html and its dom representation that may be used by scripts. all such custom data are available via the htmlelement interface of the element the attribute is set on. the htmlelement.dataset property gives access to them. dir an enumerated attribute indicating the directionality of the element's text. it can have the following values: ltr, which means left to right and is to be used for languages that are written from the left to the right (like english); rtl, which means right to left and is to be used for languages that are written from the right to the left (like arabic); auto, which lets the user agent decide. it uses a basic algorithm as it parses the characters inside the element until it finds a character with...
...And 9 more matches
Cross-Origin Resource Sharing (CORS) - HTTP
Web › HTTP › CORS
no readablestream object is used in the request. note: these are the same kinds of cross-site requests that web content can already i...
...the request. note: these are the same kinds of cross-site requests that web content can already issue, and no response data is released to the requester unless the server sends an appropriate header. therefore, sites that prevent cross-site request forgery have nothing new to fear from http access control. ...
...a is released to the requester unless the server sends an appropriate header. therefore, sites that prevent cross-site request forgery have nothing new to fear from http access control. note: webkit nightly and safari technology preview place additional restrictions on the values allowed in the accept, accept-language, and content-language headers. if any of those headers have ”nonstandard” values, webkit/safari does not consider the request to be a “simple request”. ...
...And 9 more matches
Loops and iteration - JavaScript
hapter of the javascript guide introduces the different iteration statements available to javascript. you can think of a loop as a computerized version of the game where you tell someone to take x steps in one direction, then y steps in another. for example, the idea "go five steps to the east" could be expressed this way as a loop: for (let step = 0; step < 5; step++) { // runs 5 times, with values of step 0 through 4. console.log('walking east one step'); } there are many different kinds of loops, but they all essentially do the same thing: they repeat an action some number of times. (note that it's possible that number could be zero!) the various loop mechanisms offer different ways to determine the start and end points of the loop. there are various situations that are more easily ...
...onexpression]; [incrementexpression]) statement when a for loop executes, the following occurs: the initializing expression initialexpression, if any, is executed. this expression usually initializes one or more loop counters, but the syntax allows an expression of any degree of complexity. this expression can also declare variables. the conditionexpression expression is evaluated. if the value of conditionexpression is true, the loop statements execute. if the value of condition is false, the for loop terminates. (if the condition expression is omitted entirely, the condition is assumed to be true.) the statement executes. to execute multiple statements, use a block statement ({ ... }) to group those statements. if present, the update expression incrementexpression is executed. cont...
... for="musictypes">choose some music types, then click the button below:</label> <select id="musictypes" name="musictypes" multiple="multiple"> <option selected="selected">r&b</option> <option>jazz</option> <option>blues</option> <option>new age</option> <option>classical</option> <option>opera</option> </select> </p> <p><input id="btn" type="button" value="how many are selected?" /></p> </form> <script> function howmany(selectobject) { let numberselected = 0; for (let i = 0; i < selectobject.options.length; i++) { if (selectobject.options[i].selected) { numberselected++; } } return numberselected; } let btn = document.getelementbyid('btn'); btn.addeventlistener('click', function() { alert('number of options selected: ' + ...
...And 9 more matches
Warning: JavaScript 1.6's for-each-in loops are deprecated - JavaScript
hen a for each (variable in obj) statement is used. message warning: javascript 1.6's for-each-in loops are deprecated; consider using es6 for-of instead error type warning what went wrong? javascript 1.6's for each (variable in obj) statement is deprecated, and will be removed in the near future. ...
...emoved in the near future. examples object iteration for each...in has been used to iterate over the specified object values. ...
... deprecated syntax var array = [10, 20, 30]; for each (var x in array) ...
...And 9 more matches
Array.prototype.find() - JavaScript
the find() method returns the value of the first element in the provided array that satisfies the provided testing 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. if you need the index of the found element in the array, use findindex(). if you need to find the index of a value, use array.prototype.indexof(). (it’s similar to findindex(), but checks each element for equality with the value instead of using a testing function.) if you need to find if a value exists in an array, use array.prototype.includes(). again, it checks each element for equality with the value instead of using a testing function. ...
...you need to find if a value exists in an array, use array.prototype.includes(). again, it checks each element for equality with the value instead of using a testing function. if you need to find if any element satisfies the provided testing function, use array.prototype.some(). syntax arr.find(callback(element[, index[, array]])[, thisarg]) parameters callback function to execute on each value in the array, taking 3 arguments: element the current element in the array. index optional the index (position) of the current element in the array. array optional the array that find was called on. thisarg optional object to use as this inside callback. return value the value of the first element in the array that satisfies the provided testing function. otherwise, undefin...
...in the array. array optional the array that find was called on. thisarg optional object to use as this inside callback. return value the value of the first element in the array that satisfies the provided testing function. otherwise, undefined is returned. description the find method executes the callback function once for each index of the array until the callback returns a truthy value. if so, find immediately returns the value of that element. otherwise, find returns undefined. callback is invoked for every index of the array, not just those with assigned values. ...
...And 9 more matches
Array - JavaScript
end of array. console.log(vegetables) // ["cabbage", "carrot"] (the original array is changed) console.log(removeditems) // ["turnip", "radish"] copy an array let shallowcopy = fruits.slice() // this is how to make a copy // ["strawberry", "mango"] accessing array elements javascript arrays are zero-indexed. the first element of an array is at index 0, and the last element is at the index value equal to the value of the array's length property minus 1. using an invalid index number returns undefined. let arr = ['this is the first element', 'this is the second element', 'this is the last element'] console.log(arr[0]) // logs 'this is the first element' console.log(arr[1]) // logs 'this is the second element' console.log(arr[arr.length - 1]) // logs 'this is th...
.... as a result, '2' and '02' would refer to two different slots on the years object, and the following example could be true: console.log(years['2'] != years['02']) relationship between length and numerical properties a javascript array's length property and numerical properties are connected. several of the built-in array methods (e.g., join(), slice(), indexof(), etc.) take into account the value of an array's length property when they're called. other methods (e.g., push(), splice(), etc.) also result in updates to an array's length property. const fruits = [] fruits.push('banana', 'apple', 'peach') console.log(fruits.length) // 3 when setting a property on a javascript array when the property is a valid array index and that index is outside the current bounds of the array, the engi...
...a variable number of arguments, regardless of number or type of the arguments. instance properties array.prototype.length reflects the number of elements in an array. array.prototype[@@unscopables] a symbol containing property names to exclude from a with binding scope. instance methods array.prototype.concat() returns a new array that is this array joined with other array(s) and/or value(s). array.prototype.copywithin() copies a sequence of array elements within the array. array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. array.prototype.every() returns true if every element in this array satisfies the testing function. array.prototype.fill() fills all the elements of an array from a start index to...
...And 9 more matches
Intl.NumberFormat() constructor - JavaScript
hub.com/mdn/interactive-examples and send us a pull request. syntax new intl.numberformat([locales[, options]]) parameters locales optional a string with a bcp 47 language tag, or an array of such strings. for the general form and interpretation of the locales argument, see the intl page. the following unicode extension key is allowed: nu the numbering system to be used. ...
... "rohg", "saur", "segment", "shrd", "sind", "sinh", "sora", "sund", "takr", "talu", "tamldec", "telu", "thai", "tibt", "tirh", "vaii", "wara", "wcho". options optional an object with some or all of the following properties: compactdisplay only used when notation is "compact". takes either "short" (default) or "long". currency the currency to use in currency formatting. ...
... some or all of the following properties: compactdisplay only used when notation is "compact". takes either "short" (default) or "long". currency the currency to use in currency formatting. possible values are the iso 4217 currency codes, such as "usd" for the us dollar, "eur" for the euro, or "cny" for the chinese rmb — see the current currency & funds code list. there is no default value; if the style is "currency", the currency property must be provided. currencydisplay how to display the currency in currency formatting. ...
...And 9 more matches
JSON.parse() - JavaScript
the json.parse() method parses a json string, constructing the javascript value or object described by the string. an optional reviver function can be provided to perform a transformation on the resulting object before it is returned. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax json.parse(text[, reviver]) parameters text the string to parse as json. see the json object for a description of json syntax. ...
...eractive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax json.parse(text[, reviver]) parameters text the string to parse as json. see the json object for a description of json syntax. reviver optional if a function, this prescribes how the value originally produced by parsing is transformed, before being returned. return value the object, array, string, number, boolean, or null value corresponding to the given json text. exceptions throws a syntaxerror exception if the string to parse is not valid json. polyfill // from https://github.com/douglascrockford/json-js/blob/master/json2.js if (typeof json.parse !== "function") { var...
...e = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[ee][+\-]?\d+)?/g; var rx_four = /(?:^|:|,)(?:\s*\[)+/g; var rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; json.parse = function(text, reviver) { // the parse method takes a text and an optional reviver function, and returns // a javascript value if the text is a valid json text. var j; function walk(holder, key) { // the walk method is used to recursively walk the resulting structure so // that modifications can be made. var k; var v; var value = holder[key]; if (value && typeof value === "object") { for (k in value) { ...
...And 9 more matches
Number - JavaScript
number is a primitive wrapper object used to represent and manipulate numbers like 37 or -9.25. the number constructor contains constants and methods for working with numbers. values of other types can be converted to numbers using the number() function. the javascript number type is a double-precision 64-bit binary format ieee 754 value, like double in java or c#. this means it can represent fractional values, but there are some limits to what it can store. a number only keeps about 17 decimal places of precision; arithmetic is subject to rounding. the largest value a number can hold is about 1.8×10308. numbers beyond that are replaced with the special number constant infinity. a number literal like 37 in javascript code is a floating-point value, not an integer. there is no separate ...
...e is a floating-point value, not an integer. there is no separate integer type in common everyday use. (javascript now has a bigint type, but it was not designed to replace number for everyday uses. 37 is still a number, not a bigint.) number may also be expressed in literal forms like 0b101, 0o13, 0x0a. learn more on numeric lexical grammar here. description when used as a function, number(value) converts a string or other value to the number type. if the value can't be converted, it returns nan. literal syntax 123 // one-hundred twenty-three 123.0 // same 123 === 123.0 // true function syntax number('123') // returns the number 123 number('123') === 123 // true number("unicorn") // nan number(undefined) // nan constructor number() creates a new number value. static...
...== 123.0 // true function syntax number('123') // returns the number 123 number('123') === 123 // true number("unicorn") // nan number(undefined) // nan constructor number() creates a new number value. static properties number.epsilon the smallest interval between two representable numbers. number.max_safe_integer the maximum safe integer in javascript (253 - 1). number.max_value the largest positive representable number. number.min_safe_integer the minimum safe integer in javascript (-(253 - 1)). number.min_value the smallest positive representable number—that is, the positive number closest to zero (without actually being zero). number.nan special "not a number" value. number.negative_infinity special value representing negative infinity. returned on overflow...
...And 9 more matches
Object.prototype.__defineSetter__() - JavaScript
nction to be called when an attempt is made to set that property. syntax obj.__definesetter__(prop, fun) parameters prop a string containing the name of the property to be bound to the given function. fun a function to be called when there is an attempt to set the specified property. this function takes the form function(val) { . . . ...
...at property. syntax obj.__definesetter__(prop, fun) parameters prop a string containing the name of the property to be bound to the given function. fun a function to be called when there is an attempt to set the specified property. this function takes the form function(val) { . . . } val an alias for the variable that holds the value attempted to be assigned to prop. return value undefined. ...
...ere is an attempt to set the specified property. this function takes the form function(val) { . . . } val an alias for the variable that holds the value attempted to be assigned to prop. return value undefined. description the __definesetter__ method allows a setter to be defined on a pre-existing object. ...
...And 9 more matches
Nullish coalescing operator (??) - JavaScript
the nullish coalescing operator (??) is a logical operator that returns its right-hand side operand when its left-hand side operand is null or undefined, and otherwise returns its left-hand side operand. contrary to the logical or (||) operator, the left operand is returned if it is a falsy value which is not null or undefined. in other words, if you use || to provide some default value to another variable foo, you may encounter unexpected behaviors if you consider some falsy values as usable (eg. '' or 0). see below for more examples. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. see pr #1482 regarding the additi...
...he source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. see pr #1482 regarding the addition of this example. ...
...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. see pr #1482 regarding the addition of this example. ...
...And 9 more matches
MathML attribute reference - MathML
this is an alphabetical list of mathml attributes. more details for each attribute are available on particular element pages. notes: the mathml <mstyle> and <math> elements accept all attributes of all mathml presentation elements. see values for notes on values and units in mathml. the attributes background, color, fontfamily, fontsize, fontstyle, fontweight and xlink:href are deprecated. the xlink attributes on mathml elements: xlink:actuate, xlink:href, xlink:show and xlink:type are deprecated as well. ...
...es for notes on values and units in mathml. the attributes background, color, fontfamily, fontsize, fontstyle, fontweight and xlink:href are deprecated. the xlink attributes on mathml elements: xlink:actuate, xlink:href, xlink:show and xlink:type are deprecated as well. name elements accepting attribute description accent <mo>, <mover>, <munderover> a boolean value specifying whether the operator should be treated as an accent. accentunder <munder>, <munderover> a boolean value specifying whether the operator should be treated as an accent. actiontype <maction> a string value specifying the action happening for this element. align <mtable> <munder>, <mover>, <munderover> <mstack> specifies different ali...
... unimplemented altimg altimg-width altimg-height altimg-valign alttext <math> visual and textual fall-back options. bevelled <mfrac> specifies the style how the fraction should be displayed. deprecated. use u+2044 (fraction slash) instead. ...
...And 9 more matches
Digital audio concepts - Web media technologies
is understood by the audio recording system. each of these captured moments is a sample. by chaining all the samples together, you can approximately represent the original wave, as seen in the diagram below. in this example, the blue line represents the samples taken from the audio waveform, which is black. ...
...ximately represent the original wave, as seen in the diagram below. in this example, the blue line represents the samples taken from the audio waveform, which is black. at regular intervals, the a/d converter circuitry reads the voltage of the signal as a value between (in this case) -1.0 and +1.0. since the amplitude varies over the duration of that time slice, the a/d converter must choose a value to represent that slice, whether by simply taking the value at a particular moment (in the diagram above, the midpoint of each slice is used as the value), or by averaging the amplitude over the duration of each sample. those sample values are then recorded as the amplitude of the waveform at that time. when it comes time to play back that sound later, these amplitudes are used to generate an ap...
...ta format and structure at the most basic level, audio is represented by a stream of samples, each specifying the amplitude of the audio waveform as measured for a given slice of the overall waveform of the audio signal. there are several formats used for the individual samples within an audio file. most audio files use 16-bit signed integers for each sample, but others use 32-bit floating-point values or 24-bit or 32-bit integers. some older audio file formats—which you won't find in use on the web—used 8-bit integer samples. in addition, samples may use signed or unsigned values, as well. the size of an individual sample is called the sample size. the position of each audio source within the audio signal is called a channel. each channel contains a sample indicating the amplitude of the...
...And 9 more matches
Web video codec guide - Web media technologies
the documentation included with your encoding software will help you to understand the specific impact of these options on the encoded video. compression artifacts artifacts are side effects of a lossy encoding process in which the lost or rearranged data results in vis...
... bit rates varies depending on the video's level; theoretical maximum reaches 800 mbps at level 6.3[2] supported frame rates varies by level; for example, level 2.0 has a maximum of 30 fps while level 6.3 can reach 120 fps compression lossy dct-based algorithm supported frame sizes 8 x 8 pixels to 65,535 x 65535 pixels with each dimension allowed to take any value between these supported color modes profile color depths chroma subsampling main 8 or 10 4:0:0 (greyscale) or 4:2:0 high 8 or 10 4:0:0 (greyscale), 4:2:0, or 4:4:4 professional 8, 10, or 12 4:0:0 (greyscale), 4:2:0, 4:2:2, or 4:4:...
...ions on h.263 have been used as the basis for other proprietary formats, such as flash video or the sorenson codec. however, no major browser has ever included h.263 support by default. certain media plugins have enabled support for h.263 media. unlike most codecs, h.263 defines fundamentals of an encoded video in terms of the maximum bit rate per frame (picture), or bppmaxkb. during encoding, a value is selected for bppmaxkb, and then the video cannot exceed this value for each frame. the final bit rate will depend on this, the frame rate, the compression, and the chosen resolution and block format. h.263 has been superseded by h.264 and is therefore considered a legacy media format which you generally should avoid using if you can. the only real reason to use h.263 in new projects is if you...
...And 9 more matches
dominant-baseline - SVG: Scalable Vector Graphics
the dominant-baseline attribute specifies the dominant baseline, which is the baseline used to align the box’s text and inline-level contents. it also indicates the default alignment baseline of any boxes participating in baseline alignment in the box’s alignment context. it is used to determine or re-determine a scaled-baseline-table. a scaled-baseline-table is a compound value with three components: a baseline-identifier for the dominant-baseline, a baseline-table, and a baseline-table font-size. some values of the property re-determine all three values. others only re-establish the baseline-table font-size. when the initial value, auto, would give an undesired result, this property can be used to explicitly set the desired scaled-baseline-table. if there is no baseline table in...
...a, arial, sans-serif; } <svg viewbox="0 0 200 120" xmlns="http://www.w3.org/2000/svg"> <path d="m20,20 l180,20 m20,50 l180,50 m20,80 l180,80" stroke="grey" /> <text dominant-baseline="baseline" x="30" y="20">baseline</text> <text dominant-baseline="middle" x="30" y="50">middle</text> <text dominant-baseline="hanging" x="30" y="80">hanging</text> </svg> usage notes value auto | text-bottom | alphabetic | ideographic | middle | central | mathematical | hanging | text-top default value auto animatable yes auto if this property occurs on a <text> element, then the computed value depends on the value of the writing-mode attribute. if the writing-mode is horizontal, then the value of the dominant-baseline component is alphabeti...
...le | central | mathematical | hanging | text-top default value auto animatable yes auto if this property occurs on a <text> element, then the computed value depends on the value of the writing-mode attribute. if the writing-mode is horizontal, then the value of the dominant-baseline component is alphabetic. otherwise, if the writing-mode is vertical, then the value of the dominant-baseline component is central. if this property occurs on a <tspan>, <tref>, <altglyph>, or <textpath> element, then the dominant-baseline and the baseline-table components remain the same as those of the parent text content element. ...
...And 9 more matches
StringView - Archive of obsolete content
*/ /* instances' methods */ stringview.prototype.makeindex = function (nchrlength, nstartfrom) { var atarget = this.rawdata, nchrend, nrawlength = atarget.length, nstartidx = nstartfrom || 0, nidxend = nstartidx, nstopatchr = isnan(nchrlength) ? infinity : nchrlength; if (nchrlength + 1 > atarget.length) { throw...
...se { nrawidx = isfinite(nchroffset) ? nchroffset : 0; nrawend = isfinite(nchrlen) ? ...
... buffer read only arraybuffer the buffer to be shared between stringview.rawdata and stringview.bufferview view references. ra...
...And 8 more matches
Positioning - Archive of obsolete content
appear offset down and to the right a couple of pixels so that the menu can be dismissed again just by clicking in the same place. if a context menu was opened via the keyboard only, the menu will appear at the top left corner of the document, or underneath the currently selected item if a list is focused. context menus will always appear in this location, and not respect any position attribute value. tooltips will always appear near the current mouse position, offset vertically by a small amount. the position attribute the position of all types of popups can be controlled in two ways. first, the position can be specified when using the popup's openpopup method. this is used when a popup is opened by a script. second, the position can be specified using several attributes placed on the men...
...ooltip is anchored to the element with the tooltip attribute. you wouldn't normally use the position attribute on a tooltip; instead you would just want the tooltip to appear at its default position which is near the mouse pointer. for instance: <menupopup id="edititems" position="end_before"> <menuitem label="cut"/> <menuitem label="copy"/> <menuitem label="paste"/> </menupopup> <label value="clipboard" popup="edititems"/> in this example, a menupopup is attached to a label via the popup attribute, which will cause the popup to appear when the label is left-clicked. the position attribute is used to specify that the popup should appear at the 'end_before' location, which will cause the popup to appear to the right of the label aligned along the top edge. there are several possible ...
...="clipboard" popup="edititems"/> in this example, a menupopup is attached to a label via the popup attribute, which will cause the popup to appear when the label is left-clicked. the position attribute is used to specify that the popup should appear at the 'end_before' location, which will cause the popup to appear to the right of the label aligned along the top edge. there are several possible values for the position attribute, described here, along with images which show how a popup would be aligned in each case. the following assumes a left to right user interface. for right to left user interfaces, the same values should be used, but will cause the popup to appear and be aligned on the opposite side. the position attribute can be specified either as a single word offering pre-defined al...
...And 8 more matches
browser - Archive of obsolete content
tion with the user's browser homepage; instead it is a convenient property to hold a home page. you can switch to this home page using the gohome method. showcaret type: boolean whether or not to cause a typing caret to be visible in the content area. default is false. src type: uri the uri of the content to appear in the element. type type: one of the values below. the type of browser, which can be used to set access of the document loaded inside the browser. if this is not set, the loaded document has the same access as the window containing the browser. more precisely: the document loaded into a chrome window is always of chrome type. subdocuments of chrome documents are of chrome type, unless the container element (one of iframe, browser or edit...
...e used to set access of the document loaded inside the browser. if this is not set, the loaded document has the same access as the window containing the browser. more precisely: the document loaded into a chrome window is always of chrome type. subdocuments of chrome documents are of chrome type, unless the container element (one of iframe, browser or editor) has one of the special type attribute values (the common ones are content, content-targetable and content-primary) indicating that the subdocument is of content type. this boundary has a number of special effects, such as making window.top == window (unless the browser is added to a chrome document), and preventing documents from inheriting the principal of the parent document. the type attribute on all frames in content documents is ignor...
...er is not allowed to access the chrome above it. for instance, in a web browser, this would be the element that displays the web page. the window for the primary content can be retrieved more conveniently using window.content. content-targetable one browser among many for content. the content that is loaded inside the browser is not allowed to access the chrome above it. this is the preferred value for any browser element in an application, which will use multiple browsers of equal privileges, and is unselected at the moment. chrome (default behaviour): a browser, intended to be used for loading privileged content using a chrome:// uri. don't use for content from web, as this may cause serious security problems! properties accessibletype type: integer ...
...And 8 more matches
description - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] this element is used to create a block of text. the text can be set either with the value attribute or by placing text inside the open and close description tags. the value attribute is used to set text that appears in a single line. if text appears as a child of the description, it will wrap to multiple lines. it may contain arbitrary markup, which can be styled as needed. more information is available in the xul tutorial. ...
...ither with the value attribute or by placing text inside the open and close description tags. the value attribute is used to set text that appears in a single line. if text appears as a child of the description, it will wrap to multiple lines. it may contain arbitrary markup, which can be styled as needed. more information is available in the xul tutorial. attributes crop, disabled, tabindex value properties accessibletype, crop, disabled, tabindex, value style classes header, indent, monospace, plain, small-margin examples this is a long section of text that will word wrap when displayed <description> this is a long section of text that will word wrap when displayed. ...
...disabled, tabindex value properties accessibletype, crop, disabled, tabindex, value style classes header, indent, monospace, plain, small-margin examples this is a long section of text that will word wrap when displayed <description> this is a long section of text that will word wrap when displayed. ...
...And 8 more matches
dialog - Archive of obsolete content
moreover this hides separator between titlebar and window contents. this only affects mac os x. buttonaccesskeyaccept type: string the access key to use for the "accept" button. buttonaccesskey...
...ttonaccesskeydisclosure type: string the access key to use for the "disclosure" button. buttonaccesskeyextra1 type: string the access key to use for the first extra button. buttonaccesskeyextra2 type: string the access key to use for the second extra button. buttonaccesskeyhelp type: string the access key to use for the "help" button. buttonalign type: string the value of the align attribute for the box containing the buttons. buttondir type: string the value of the dir attribute for the box containing the buttons. buttondisabledaccept type: boolean if true, the accept button is disabled. buttonlabelaccept type: string the label to appear on the "accept" button. buttonlabelcancel type: string the label to appear on the "cancel" b...
...e "cancel" button. buttonlabeldisclosure type: string the label to appear on the "disclosure" button. buttonlabelextra1 type: string the label to appear on the first extra button. buttonlabelextra2 type: string the label to appear on the second extra button. buttonlabelhelp type: string the label to appear on the "help" button. buttonorient type: string the value of the orient attribute for the box containing the buttons. buttonpack type: string the value of the pack attribute for the box containing the buttons. buttons type: comma-separated list of the values below a comma-separated list of buttons to appear in the dialog box. the buttons will be placed in suitable locations for the user's platform and basic event handling will be perform...
...And 8 more matches
radiogroup - Archive of obsolete content
tons. only one radio button inside the group can be selected at a time. the radio buttons may either direct children of the radiogroup or descendants. place the radiogroup inside a groupbox if you would like a border or caption for the group. the radiogroup defaults to vertical orientation. more information is available in the xul tutorial. ...
...ldren of the radiogroup or descendants. place the radiogroup inside a groupbox if you would like a border or caption for the group. the radiogroup defaults to vertical orientation. more information is available in the xul tutorial. attributes disabled, focused, preference, tabindex, value properties accessibletype, disabled, focuseditem, itemcount, selectedindex, selecteditem, tabindex, value methods appenditem, checkadjacentelement, getindexofitem, getitematindex, insertitemat, removeitemat examples <radiogroup> <radio id="orange" label="red"/> <radio id="violet" label="green" selected="true"/> <radio id="yellow" label="blue"/> </radiogroup> attributes disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the ele...
...s the element to a corresponding preference. this attribute only has any effect when used inside a prefwindow. more information is available in the preferences system article. tabindex type: integer the tab order of the element. the tab order is the order in which the focus is moved when the user presses the "tab" key. elements with a higher tabindex are later in the tab sequence. ...
...And 8 more matches
Browser Detection and Cross Browser Support - Archive of obsolete content
tead. if (document.body && typeof(document.body.offsetheight) == 'number') { height = document.body.offsetheight; } else if (typeof(window.innerheight) == 'number') { height = window.innerheight; } else { height = 0; } note how the previous example does not make assumptions about which browser is being used. instead, it only tests for the objects which it wishes to use. since the numeric values could potentially be zero, the script tests the type of the objects to make sure they are numbers instead. gecko and navigator 4 gecko is the replacement for navigator 4 rendering engine and as such retains many features from navigator 4. the basic differences between navigator 4 and gecko can be easily summarized by: gecko is standards conformant. gecko supports many more standards than ...
...built from the same branch share the same basic version of gecko and can be treated similarly when dealing with html, css, javascript, etc. for example, netscape 6.2, 6.2.1, 6.2.2, 6.2.3 and compuserve 7 are all built from the 0.9.4 branch and therefore share similar behavior in many ways. gecko branch tags browser branch tag netscape 6.0 contained m18 rather than the rv value netscape 6.1 0.9.2 netscape 6.2 0.9.4 netscape 6.2.1 0.9.4 netscape 6.2.2 0.9.4.1 netscape 6.2.3 0.9.4.1 compuserve 7 0.9.4.2 netscape 7.0 1.0.1 netscape 7.01 1.0.2 as you can see, all versions of netscape 6.2 and compuserve 7 were created from the 0.9.4 branch. the distinction between 0.9.4, 0.
...netscape 7.01 1.0.2 as you can see, all versions of netscape 6.2 and compuserve 7 were created from the 0.9.4 branch. the distinction between 0.9.4, 0.9.4.1, 0.9.4.2 is minor. note: the branch tag is a string and can contain more than single digits in any particular level. for example, it is conceivable that someday there will exist branch tags similar to 2.2.0 and 2.12.36. since these values are strings, it is not possible to use relative string comparisons to determine which branch tag came later. in our example, branch 2.2.0 was created before 2.12.36 however comparing these values as strings shows '2.2.0' > '2.12.36'. the javascript function geckogetrv() provides one solution to this problem by converting the branch tag in the user agent string into a floating point number where ...
...And 8 more matches
CSS - Archive of obsolete content
Archive › Web › CSS
ss property is a microsoft extension that specifies the block progression and layout orientation.-ms-content-zoom-chainingthe -ms-content-zoom-chaining css property is a microsoft extension specifying the zoom behavior that occurs when a user hits the zoom limit during page manipulation.-ms-content-zoom-limitthe -ms-content-zoom-limit css shorthand property is a microsoft extension that specifies values for the -ms-content-zoom-limit-min and -ms-content-zoom-limit-max properties.-ms-content-zoom-limit-maxthe -ms-content-zoom-limit-max css property is a microsoft extension that specifies the selected elements' maximum zoom factor.-ms-content-zoom-limit-minthe -ms-content-zoom-limit-min css property is a microsoft extension that specifies the minimum zoom factor.-ms-content-zoom-snapthe -ms-conte...
...es.-ms-content-zoom-limit-maxthe -ms-content-zoom-limit-max css property is a microsoft extension that specifies the selected elements' maximum zoom factor.-ms-content-zoom-limit-minthe -ms-content-zoom-limit-min css property is a microsoft extension that specifies the minimum zoom factor.-ms-content-zoom-snapthe -ms-content-zoom-snap css shorthand property is a microsoft extension that specifies values for the -ms-content-zoom-snap-type and -ms-content-zoom-snap-points properties.-ms-content-zoom-snap-pointsthe -ms-content-zoom-snap-points css property is a microsoft extension that specifies where zoom snap-points are located.-ms-content-zoom-snap-typethe -ms-content-zoom-snap-type css property is a microsoft extension that specifies how zooming is affected by defined snap-points.-ms-content-z...
...w zooming is affected by defined snap-points.-ms-content-zoomingthe -ms-content-zooming css property is a microsoft extension that specifies whether zooming is enabled.-ms-filterthe -ms-filter css property is a microsoft extension that sets or retrieves the filter or collection of filters applied to an object.-ms-flow-fromthe -ms-flow-from css property is a microsoft extension that gets or sets a value identifying a region container in the document that accepts the content flow from the data source.-ms-flow-intothe -ms-flow-into css property is a microsoft extension that gets or sets a value identifying an iframe container in the document that serves as the region's data source.-ms-high-contrast-adjustthe -ms-high-contrast-adjust css property is a microsoft extension that gets or sets a value i...
...And 8 more matches
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
here, we’re including all the...
...a server-side language into javascript. this accounts for added simplicity and promotes rapid development methodologies. managing context to take advantage of all the operating contexts of jaxer, you'll need to specify how your scripts should behave using the runat attribute of the script tag (or by setting a runat property on a javascript function object). the common values for this attribute are explained below, though there are more than just these. runat=”client” – code contained in this block is restricted to execution client-side, which is also what happens if no runat attribute is specified. runat=”server” – code contained in this block is restricted to execution server-side. runat=”both” – code may ...
...s specified. runat=”server” – code contained in this block is restricted to execution server-side. runat=”both” – code may be invoked on the client or server side. runat=”server-proxy” – allows for the exposure of server-side javascript functions to the browser. jaxer manages ajax calls behind the scenes to accomplish this. while most of the runat attribute values above are self explanatory, the server-proxy concept is best explained through example. consider the code in listing 4. listing 4 - demonstration of server and client context <script runat="server"> function exposed() { return "exposed to the browser"; } function notexposed() { return "can't see me!"; } </script> <script runat="client"> alert( exposed() ); alert( n...
...And 8 more matches
XForms Select Element - Archive of obsolete content
tions from a list of pre-defined items (see the spec). the list of pre-defined items can be specified by either item (see the spec) or itemset (see the spec) elements. you can visually group these pre-defined items by using the choices (see the spec) element to contain them. note, some representations of the select element do not support visual grouping. ...
... ui common appearance - the value of this attribute gives a hint to the xforms processor as to which type of widget(s) to use to represent this control. accesskey - used to specify the keyboard shortcut for focusing this control. single-node binding special selection - isn't currently supported. this attribute, when set to 'open', allows the user to provide free entry to the list. possible values are open and closed, default is closed. incremental - supported, default value is true properties selection - see corresponding attribute incremental - see corresponding attribute type restrictions the select element can be bound to a node containing simple content capable of holding a sequence. the data binding restriction to simple content may be relaxed when an itemset element is us...
...te incremental - see corresponding attribute type restrictions the select element can be bound to a node containing simple content capable of holding a sequence. the data binding restriction to simple content may be relaxed when an itemset element is used, which allows the available choices to be obtained from an xforms model. ...
...And 8 more matches
Building up a basic demo with Three.js - Game development
nes to your code, below those previously added. there are other types of camera available (cube, orthographic), but the simplest is perspective. to initialize it, we have to set its field of view and aspect ratio: the former is used to set how much is seen, and the latter is important for the objects on the screen to have the right proportions when rendered, and not look stretched. let's explain values we are setting for the code above: the value we set for the field of view, 70, is something we can experiment with: the higher the value, the greater the amount of scene the camera will show. imagine a normal camera view, versus a fish eye effect, which allows a lot more to be seen. the default value is 50. the aspect ratio is set to the current width and height of the window so it will be d...
...the value, the greater the amount of scene the camera will show. imagine a normal camera view, versus a fish eye effect, which allows a lot more to be seen. the default value is 50. the aspect ratio is set to the current width and height of the window so it will be dynamically adjusted. we could set a fixed ratio — for example 16 ⁄ 9, which is the aspect ratio of a widescreen tv. the default value is 1. the z position, with the value of 50 units, is the distance between the camera and the center of the scene on the z axis. here we're moving the camera back, so the objects in the scene can be viewed. 50 feels about right. it's not too near, or too far, and the sizes of the objects allow them to stay on the scene, within the given field of view. ...
...for the camera z position) are unitless, and can be anything you deem suitable for your scene: milimeters, meters, feet, or miles. it's up to you. ...
...And 8 more matches
Debugging CSS - Learn web development
etween multiple browsers. you will also find that browsers have chosen to focus on different areas when creating their devtools. for example in firefox there are some excellent tools for working visually with css layout, allowing you to inspect and edit grid layouts, flexbox, and shapes. however, all of the different browsers have similar fundamental tools, e.g. for inspecting the properties and values applied to elements on your page, and making changes to them from the editor. in this lesson we will look at some useful features of the firefox devtools for working with css. in order to do so i'll be using an example file. load this up in a new tab if you want to follow along, and open up your devtools as described in the article linked above. the dom versus view source something that can t...
...s select an element on your page, either by right/ctrl-clicking on it and selecting inspect, or selecting it from the html tree on the left of the devtools display. try selecting the element with the class of box1; this is the first element on the page with a bordered box drawn around it. if you look at the rules view to the right of your html, you should be able to see the css properties and values applied to that element. you will see the rules directly applied to class box1 and also the css that is being inherited by the box from its ancestors, in this case to <body>. this is useful if you are seeing some css being applied that you didn't expect. perhaps it is being inherited from a parent element and you need to add a rule to overwrite it in the context of this element. also useful is ...
...if you are seeing some css being applied that you didn't expect. perhaps it is being inherited from a parent element and you need to add a rule to overwrite it in the context of this element. also useful is the ability to expand out shorthand properties. in our example the margin shorthand is used. click on the little arrow to expand the view, showing the different longhand properties and their values. you can toggle values in the rules view on and off, when that panel is active — if you hold your mouse over it checkboxes will appear. uncheck a rule's checkbox, for example border-radius, and the css will stop applying. you can use this to do an a/b comparison, deciding if something looks better with a rule applied or not, and also to help debug it — for example if a layout is going wron...
...And 8 more matches
Attribute selectors - Learn web development
rtain attributes. this lesson will show you how to use these very useful selectors. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn what attribute selectors are and how to use them. ...
...ge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn what attribute selectors are and how to use them. presence and value selectors these selectors enable the selection of an element based on the presence of an attribute alone (for example href), or on various different matches against the value of the attribute. ...
...ibute selectors are and how to use them. presence and value selectors these selectors enable the selection of an element based on the presence of an attribute alone (for example href), or on various different matches against the value of the attribute. selector example description [attr] a[title] matches elements with an attr attribute (whose name is the value in square brackets). [attr=value] a[href="https://example.com"] matches elements with an attr attribute whose value is exactly value — the string inside the quotes. ...
...And 8 more matches
Sending form data - Learn web development
website programming first steps module. on the client side: defining how to send the data the <form> element defines how the data will be sent. all of its attributes are designed to let you configure the request to be sent when a user hits a submit button. the two most important attributes are action and method. the action attribute the action attribute defines where the data gets sent. its value must be a valid relative or absolute url. if this attribute isn't provided, the data will be sent to the url of the page containing the form — the current page. in this example, the data is sent to an absolute url — https://example.com: <form action="https://example.com"> here, we use a relative url — the data is sent to a different url on the same origin: <form action="/somewhere_else"...
...his, the data is encrypted along with the rest of the request, even if the form itself is hosted on an insecure page accessed using http. on the other hand, if the form is hosted on a secure page but you specify an insecure http url with the action attribute, all browsers display a security warning to the user each time they try to send data because the data will not be encrypted. the names and values of the non-file form controls are sent to the server as name=value pairs joined with ampersands. the action value should be a file on the server that can handle the incoming data, including ensuring server-side validation. the server then responds, generally handling the data and loading the url defined by the action attribute, causing a new page load (or a refresh of the existing page, if the a...
...ven resource: "hey server, i want to get this resource." in this case, the browser sends an empty body. because the body is empty, if a form is sent using this method the data sent to the server is appended to the url. ...
...And 8 more matches
UI pseudo-classes - Learn web development
about in-range and out-of-range data). form controls with constraint limitations can be targeted based on these states. :valid and :invalid you can target from control using the :valid and :invalid pseudo-classes. some points worth bearing in mind: controls with no constraint validation will always be valid, and therefore matched with :valid. ...
... there are some other ways to make an element matched by :valid/:invalid, as you'll see in the client-side form validation article. but we'll keep things simple for now. ...
...you can try it here: it is possible for the number input to be both required and o...
...And 8 more matches
Your first form - Learn web development
, plus some additional elements to help structure the overall form — they are often referred to as html forms. the controls can be single or multi-line text fields, dropdown boxes, buttons, checkboxes, or radio buttons, and are mostly created using the <input> element, although there are some other elements to learn about too. form controls can also be programmed to enforce specific formats or values to be entered (form validation), and paired with text labels that describe their purpose to both sighted and blind users. designing your form before starting to code, it's always better to step back and take the time to think about your form. designing a quick mockup will help you to define the right set of data you want to ask your user to enter. from a user experience (ux) point of view, it'...
...<textarea id="msg" name="user_message"></textarea> </li> </ul> </form> update your form code to look like the above. the <li> elements are there to conveniently structure our code and make styling easier (see later in the article). for usability and accessibility, we include an explicit label for each form control. note the use of the for attribute on all <label> elements, which takes as its value the id of the form control with which it is associated — this is how you associate a form control with its label. there is great benefit to doing this — it associates the label with the form control, enabling mouse, trackpad, and touch device users to click on the label to activate the corresponding control, and it also provides an accessible name for screen readers to read out to their user...
...read out to their users. you'll find further details of form labels in how to structure a web form. on the <input> element, the most important attribute is the type attribute. this attribute is extremely important because it defines the way the <input> element appears and behaves. you'll find more about this in the basic native form controls article later on. in our simple example, we use the value <input/text> for the first input — the default value for this attribute. it represents a basic single-line text field that accepts any kind of text input. for the second input, we use the value <input/email>, which defines a single-line text field that only accepts a well-formed e-mail address. this turns a basic text field into a kind of "intelligent" field that will perform some validation c...
...And 8 more matches
From object to iframe — other embedding technologies - Learn web development
button to see an answer. ...
...utput</h2> <div class="output" style="min-height: 250px;"> </div> <h2>editable code</h2> <p class="a11y-label">press esc to move focus away from the code area (tab inserts a tab character).</p> <textarea id="code" class="input" style="width: 95%;min-height: 100px;"> </textarea> <div class="playable-buttons"> <input id="reset" type="button" value="reset"> <input id="solution" type="button" value="show solution"> </div> html { font-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; background: #f5f9fa; } const textarea = document.getelementbyid('code'); const reset = document.getelementbyid('reset'); const solution = document.getelementbyid('solution'); const output = document...
... sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; background: #f5f9fa; } const textarea = document.getelementbyid('code'); const reset = document.getelementbyid('reset'); const solution = document.getelementbyid('solution'); const output = document.queryselector('.output'); let code = textarea.value; let userentry = textarea.value; function updatecode() { output.innerhtml = textarea.value; } reset.addeventlistener('click', function() { textarea.value = code; userentry = textarea.value; solutionentry = htmlsolution; solution.value = 'show solution'; updatecode(); }); solution.addeventlistener('click', function() { if(solution.value === 'show solution') { textarea.value = ...
...And 8 more matches
Componentizing our Svelte app - Learn web development
filter. now our filterbutton component will work again. easier two-way data binding with the bind directive in the previous example we realized that our filterbutton component wasn't working because our application state was flowing down from parent to child through the filter prop — but it wasn't going back up. so we added an onclick prop to let the child component communicate the new filter value to its parent. it works ok, but svelte provides us an easier and more straightforward way to achieve two-way data binding. data ordinarily flows down from parent to child using props. if we want it to also flow the other way — from child to parent — we can use the bind: directive. using bind, we will tell svelte that any changes made to the filter prop in the filterbutton component should p...
...o achieve two-way data binding. data ordinarily flows down from parent to child using props. if we want it to also flow the other way — from child to parent — we can use the bind: directive. using bind, we will tell svelte that any changes made to the filter prop in the filterbutton component should propagate back up to the parent component, todos. ...
...ing. data ordinarily flows down from parent to child using props. if we want it to also flow the other way — from child to parent — we can use the bind: directive. using bind, we will tell svelte that any changes made to the filter prop in the filterbutton component should propagate back up to the parent component, todos. that is, we will bind the filter variable's value in the parent to its value in the child. ...
...And 8 more matches
Creating our first Vue component - Learn web development
king components dynamic with props our todoitem component is still not very useful because we can only really include this once on a page (ids need to be unique), and we have no way to set the label text. nothing about this is dynamic. what we need is some component state. this can be achieved by adding props to our component. you can think of props as being similar to inputs in a function. the value of a prop gives components an initial state that affects their display. registering props in vue, there are two ways to register props: the first way is to just list props out as an array of strings. each entry in the array corresponds to the name of a prop. the second way is to define props as an object, with each key corresponding to the prop name. listing props as an object allows you to...
...components an initial state that affects their display. registering props in vue, there are two ways to register props: the first way is to just list props out as an array of strings. each entry in the array corresponds to the name of a prop. the second way is to define props as an object, with each key corresponding to the prop name. listing props as an object allows you to specify default values, mark props as required, perform basic object typing (specifically around javascript primitive types), and perform simple prop validation. note: prop validation only happens in development mode, so you can't strictly rely on it in production. additionally, prop validation functions are invoked before the component instance is created, so they do not have access to the component state (or othe...
...invoked before the component instance is created, so they do not have access to the component state (or other props). for this component, we’ll use the object registration method. go back to your todoitem.vue file. add a props property inside the export default {} object, which contains an empty object. inside this object, add two properties with the keys label and done. the label key's value should be an object with 2 properties (or props, as they are called in the context of being available to the components). the first is a required property, which will have a value of true. this will tell vue that we expect every instance of this component to have a label field. vue will warn us if a todoitem component does not have a label field. the second property we'll add is a type p...
...And 8 more matches
XPCOMUtils.jsm
egories: [{ // each object in the array specifies the parameters to pass to // nsicategorymanager.addcategoryentry(). 'true' is passed for // both apersist and areplace params. category: "some-category", // optional, defaults to the object's classdescription entry: "entry name", // optional, defaults to the object's contractid (unless // 'service' is specified) value: "...", // optional, defaults to false. when set to true, and only if 'value' // is not specified, the concatenation of the string "service," and the // object's contractid is passed as avalue parameter of addcategoryentry. service: true, // optional array of applications' ids in the form: // [ "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}", ... ] // if this is defined, the ...
...ersimpleenumerator(enumerator, interface); generator iterstringenumerator(enumerator); attributes attribute type description categorymanager nsicategorymanager returns a reference to nsicategorymanager. methods definelazygetter() getter functions in javascript give you a way to define a property of an object, but not calculate the property's value until it is accessed. a getter defers the cost of calculating the value until the value is needed, and if it is never needed, you never pay the cost. a "lazy getter" provides an additional optimization: the value is calculated the first time the getter is called, and is then cached (or memoized), so subsequent accesses return the cached value without recalculating it. this means that you should...
...cost of calculating the value until the value is needed, and if it is never needed, you never pay the cost. a "lazy getter" provides an additional optimization: the value is calculated the first time the getter is called, and is then cached (or memoized), so subsequent accesses return the cached value without recalculating it. this means that you shouldn't use a lazy getter for a property whose value you expect to change, because the getter will not recalculate the value. definelazygetter takes three arguments: the object to define the property on the name of the property defined the getter function itself, which returns the value and which will be called just once, the first time code tries to access the property. example for this is seen at bottom of this page here. function define...
...And 8 more matches
nss tech note4
c constraints, pkcs#7 digested data, etc. there is a long list of pre-defined oids, and new ones can be added dynamically by an application. the oid data structure contains an array of identifier bytes (each byte is a "level" in a hierarchical namespace), a text description, and some other things. ...
...s, pkcs#7 digested data, etc. there is a long list of pre-defined oids, and new ones can be added dynamically by an application. the oid data structure contains an array of identifier bytes (each byte is a "level" in a hierarchical namespace), a text description, and some other things. ...
...extension is critical value : the value of the extension looping through all extensions certcertextension** extensions =cert->extensions; if (extensions) { while (*extensions) { secitem *ext_oid = &(*extensions)->id; secitem *ext_critical = &(*extensions)->critical; secitem *ext_value = &(*extensions)->value; /* id attribute of the extension */ secoiddata *oiddata = secoid_findoid(ext_oid); if (oiddata == null) { /* oid not found */ /* secitem ext_oid has type (secitemtype), data (unsigned char *) and len (unsigned int) fields ...
...And 8 more matches
NSS environment variables
nsrandcount integer (byte count) sets the maximum number of bytes to read from the file named in the environment variable nsrandfile (see below). makes nsrandfile usable with /dev/urandom. 3.12.3 nsrandfile string (file name) uses this file to seed the pseudo random number generator. before 3.0 nss_allow_weak_signature_alg boolean (any non-empty value to enable) enables the use of md2 and md4 inside signatures. this was allowed by default before nss 3.12.3. 3.12.3 nss_debug_pkcs11_module string (module name) name the pkcs#11 module to be traced. pkcs #11 module logger 3.6 nss_default_db_type string ("dbm", "sql", or "extern") determines the default database type to open if the app does not specif...
...t before nss 3.12.3. 3.12.3 nss_debug_pkcs11_module string (module name) name the pkcs#11 module to be traced. pkcs #11 module logger 3.6 nss_default_db_type string ("dbm", "sql", or "extern") determines the default database type to open if the app does not specify. nss_shared_db 3.12 nss_disable_arena_free_list string (any non-empty value) define this variable to get accurate leak allocation stacks when using leak reporting software. nss_memory_allocation 3.4 nss_disable_unload string (any non-empty value) disable unloading of dynamically loaded nss shared libraries during shutdown. necessary on some platforms to get correct function names when using leak reporting software. 3.11.8 nss_enable_a...
... disable unloading of dynamically loaded nss shared libraries during shutdown. necessary on some platforms to get correct function names when using leak reporting software. 3.11.8 nss_enable_audit boolean (1 to enable) enable auditing of activities of the nss cryptographic module in fips mode. audit data 3.11.2 nss_enable_pkix_verify boolean (any non-empty value to enable) use libpkix, rather than the old cert library, to verify certificates. 3.12 nss_fips string ("fips","true","on","1") will start nss in fips mode. 3.12.5 nss_hash_alg_support string specifies agorithms allowed to be used in certain applications, such as in signatures on certificates and crls. see documentation at this link. 3.12.3 n...
...And 8 more matches
JS::PersistentRooted
in spidermonkey 38 js::persistentrooted<t> var(cx); js::persistentrooted<t> var(cx, initial); js::persistentrooted<t> var(rt); js::persistentrooted<t> var(rt, initial); name type description cx jscontext * the context to get the runtime in which to add the root rt jsruntime * the runtime in which to add the root. initial t an initial value for the persistent rooted variable. methods here, ptr represents the private member of js::persistentrooted<t>, typed with t. method description void init(jscontext* cx) initialize with optional initial value (if not provided, it will be initialized with the initial value of the type). added in spidermonkey 38 void init(jscontext* cx, t initial) ...
...stentrooted<t>, typed with t. method description void init(jscontext* cx) initialize with optional initial value (if not provided, it will be initialized with the initial value of the type). added in spidermonkey 38 void init(jscontext* cx, t initial) void init(jsruntime* rt) void init(jsruntime* rt, t initial) void reset() reset the value to initial value of the type. added in spidermonkey 38 t& get() returns ptr. const t& get() const operator const t&() const const t& operator->() const t* address() returns a pointer to ptr. const t* address() const persistentrooted<t>& operator=(const t& p) sets the value of ptr. persistentrooted<t>& operator=(const...
...this is typically used for global variables. js::persistentrooted<t> is a copyable, assignable global gc root type with arbitrary lifetime, an infallible constructor, and automatic unrooting on destruction. ...
...And 8 more matches
mozIStorageConnection
schemaversion long the schema version of the database. this should not be used until the database is ready. the version will be reported as 0 if it is not set. transactioninprogress boolean returns true if there is a transaction in progress on the database. otherwise returns false. read only. constants transaction execution time constants. ...
...this is used by the storage api when creating new databases, and must match the sqlite_default_page_size configured in db/sqlite3/src/makefile.in. ...
...saction_exclusive) clone() clones a database connection, optionally making the new connection read only. note: if your connection is already read-only, you will get a read-only clone. note: due to a bug in sqlite, if you use the shared cache (by calling mozistorageservice.opendatabase()), the cloned connection's access privileges will be the same as the original connection, regardless of the value you specify for the areadonly parameter. mozistorageconnection clone( in boolean areadonly optional ); parameters areadonly if true, the returned database connection is in read only mode. this is false by default. return value a new mozistorageconnection object representing the cloned connection. exceptions thrown ns_error_unexpected the connection is to a memory database. clos...
...And 8 more matches
nsIMsgFolder
gdbhdr amessage,in nsmsgdispositionstate adispositionflag); void markmessagesread(in nsisupportsarray messages, in boolean markread); void markallmessagesread(); void markmessagesflagged(in nsisupportsarray messages, in boolean markflagged); void markthreadread(in nsimsgthread thread); void setlabelformessages(in nsisupportsarray messages, in nsmsglabelvalue label); nsimsgdatabase getmsgdatabase(in nsimsgwindow msgwindow); void setmsgdatabase(in nsimsgdatabase msgdatabase); nsimsgdatabase getdbfolderinfoanddb(out nsidbfolderinfo folderinfo); nsimsgdbhdr getmessageheader(in nsmsgkey msgkey); boolean shouldstoremsgoffline(in nsmsgkey msgkey); boolean hasmsgoffline(in nsmsgkey msgkey); nsiin...
...n 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 findsubfolder(in acstring escapedsubfoldername); void addfolderlistener(in nsifolderlistener listener); void removefolderlistener(in nsifolderlistener listener); void notifypropertycha...
...gfolder folder); boolean containschildnamed(in astring name); nsimsgfolder getchildnamed(in astring aname); nsimsgfolder findsubfolder(in acstring escapedsubfoldername); void addfolderlistener(in nsifolderlistener listener); void removefolderlistener(in nsifolderlistener listener); void notifypropertychanged(in nsiatom property, in acstring oldvalue, in acstring newvalue); void notifyintpropertychanged(in nsiatom property, in long oldvalue, in long newvalue); void notifyboolpropertychanged(in nsiatom property, in boolean oldvalue, in boolean newvalue); void notifypropertyflagchanged(in nsimsgdbhdr item, in nsiatom property, in unsigned long oldvalue, in unsigned long newvalue); void notifyunicharpropertych...
...And 8 more matches
nsISelectionPrivate
formattype, in unsigned long flags, in print32 wrapcolumn); attributes attribute type description cancacheframeoffset boolean frame offset cache can be used just during calling nseditor::endplaceholdertransaction. ...
...ction will give rise to reflow/refreshing view/scroll, and call times of nstextframe::getpointfromoffset whose return value is to be cached. see bug 35296 and bug 199412 native code only! interlineposition boolean type short returns the type of the selection (see nsiselectioncontroller for available constants). read only. constants constant value description endofprecedingline 0 startofnextline 1 tableselection_none 0 tableselection_cell 1 tableselection_row 2 tableselection_column 3 tableselection_table 4 tableselection_allcells 5 methods addselectionlistener() void addselectionlistener( in...
...table 4 tableselection_allcells 5 methods addselectionlistener() void addselectionlistener( in nsiselectionlistener newlistener ); parameters newlistener endbatchchanges() will resume user interface updates after a previous call to startbatchchanges(). void endbatchchanges(); parameters none. ...
...And 8 more matches
nsIWebProgressListener
se flags are mutually exclusive. for any given request, onstatechange() is called once with the state_start flag, zero or more times with the state_transferring flag or once with the state_redirecting flag, and then finally once with the state_stop flag. note: for document requests, a second state_stop is generated (see the description of state_is_window for more details). constant value description state_start 0x00000001 this flag indicates the start of a request. this flag is set when a request is initiated. the request is complete when onstatechange() is called for the same request with the state_stop flag set. state_redirecting 0x00000002 this flag indicates that a request is being redirected. the request passed to onstatechange() is the reque...
... 0x00000010 this flag indicates the completion of a request. the astatus parameter to onstatechange() indicates the final status of the request. state type flags these flags further describe the entity for which the state transition is occurring. these flags are not mutually exclusive (that is an onstatechange() event may indicate some combination of these flags). constant value description state_is_request 0x00010000 this flag indicates that the state transition is for a request, which includes but is not limited to document requests. (see below for a description of document requests.) other types of requests, such as requests for inline content (for example images and stylesheets) are considered normal requests. state_is_document 0x0002000...
...work flag may be set). this second state_stop event may be useful as a way to partition the work that occurs when a document request completes. state modifier flags these flags further describe the entity for which the state transition is occurring. these flags are not mutually exclusive (that is an onstatechange() event may indicate some combination of these flags). constant value description state_restoring 0x01000000 this flag indicates that the state transition corresponds to the start or stop of activity for restoring a previously-rendered presentation. as such, there is no actual network activity associated with this request, and any modifications made to the document or presentation when it was originally loaded will still be present. state ...
...And 8 more matches
nsIWindowMediator
zlevelbottom 2 send window to bottom. zlevelbelow 3 place window below some window. methods addlistener() register a listener for window status changes. void addlistener( in nsiwindowmediatorlistener alistener ); parameters alistener the listener to register. example: of window listene...
... in z-order. calculate whether and how it should be constrained. note this method is advisory only: it changes nothing either in windowmediator's internal state or with the window. note: it compares the nsixulwindow to nsiwidgets. a pure interface would use all nsixulwindows. but we expect this to be called from callbacks originating in native window code. they are expected to hand us comparison values which are pulled from general storage in the native widget, and may not correspond to an nsiwidget at all. for that reason this interface requires only objects one step removed from the native window (nsiwidgets), and its implementation must be very understanding of what may be completely invalid pointers in those parameters. boolean calculatezposition( in nsixulwindow inwindow, in unsigned...
...ion( in nsixulwindow inwindow, in unsigned long inposition, in nsiwidget inbelow, out unsigned long outposition, out nsiwidget outbelow ); parameters inwindow the window in question. inposition requested position one of the zlevel constants. zleveltop send the window to the top window, zlevelbottom to the bottom. if set to zlevelbelow the window will be placed below iobelow. the value of inbelow will be ignored for zleveltop and zlevelbottom.) inbelow if inposition is set to zlevelbelow, the window below which inwindow wants to be placed. otherwise this variable is ignored. outposition constrained position, values like inposition. outbelow the window below which inwindow should be placed, if outposition equals zlevelbelow. otherwise this value will be null. return valu...
...And 8 more matches
nsIXPCScriptable
sobjectptr obj); jsobjectptr innerobject(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj); void postcreateprototype(in jscontextptr cx, in jsobjectptr proto); attributes attribute type description classname string scriptableflags pruint32 the bitwise or'd set of flags (define below) that indicate the behavior of this object. constants constant value description want_precreate 1 << 0 want_create 1 << 1 want_postcreate 1 << 2 want_addproperty 1 << 3 want_delproperty 1 << 4 want_getproperty 1 << 5 want_setproperty 1 << 6 want_enumerate 1 << 7 want_newenumerate 1 << 8 indicates that the object wants to have its newenumerate method called. want_newresolve 1 << 9 indicates that the object wants to have its new...
...ers wrapper cx obj postcreate() void postcreate( in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj ); parameters wrapper cx obj addproperty() prbool addproperty( in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj, in jsval id, in jsvalptr vp ); parameters wrapper cx obj id vp return value delproperty() prbool delproperty( in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj, in jsval id, in jsvalptr vp ); parameters wrapper cx obj id vp return value getproperty() prbool getproperty( in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj, in jsval id, in jsvalptr vp ); parameters wra...
... in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj, in jsval id, in jsvalptr vp ); parameters wrapper cx obj id vp return value getproperty() prbool getproperty( in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj, in jsval id, in jsvalptr vp ); parameters wrapper cx obj id vp return value ns_success_i_did_something if this method does something. setproperty() prbool setproperty( in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj, in jsval id, in jsvalptr vp ); parameters wrapper cx obj id vp return value ns_success_i_did_something if this method does something. enumerate() prbool enumerate( in nsixpconnectwrappednati...
...And 8 more matches
Storage
arameters is strongly discouraged in javascript where named parameters are much easier to use. note: if you need to execute a statement multiple times, caching the result of createstatement will give you a noticeable performance improvement because the sql query does not need to be parsed each time. binding parameters in order to effectively use the statements that you create, you have to bind values to the parameters you placed in the statement. a given placeholder can appear multiple times in the same statement, and all instances of it will be replaced with the bound value. if you neglect to bind a value to a parameter, it will be interpreted as null. you should never try to construct sql statements on the fly with values inserted in them. by binding the parameters, you prevent possible s...
...gly discouraged in javascript where named parameters are much easier to use. binding multiple sets of parameters starting in gecko 1.9.2 (firefox 3.6), there's a new, more convenient way to bind multiple sets of parameters at once prior to executing your statement asynchronously. this api is only available for asynchronous execution. ...
...couraged in javascript where named parameters are much easier to use. binding multiple sets of parameters starting in gecko 1.9.2 (firefox 3.6), there's a new, more convenient way to bind multiple sets of parameters at once prior to executing your statement asynchronously. this api is only available for asynchronous execution. ...
...And 8 more matches
Edit fonts - Firefox Developer Tools
this article provides a tour of the font tools available in the firefox devtools. this tool contains several useful features for viewing and manipulating fonts applied to any document loaded in the browser including inspection of all fonts applied to the page, and precise adjustment of variable font axis values. note: the updated font tools as shown in this article are available in firefox 63 onwards; if you are using an older version of firefox the tools will not look or behave quite the same, but they will be similar (most notably the font editor will not be available). the fonts tab the fonts tab is located on the right-hand side of the page inspector when it is docked to the bottom of the screen. when it is docked to the right or left sides of the screen, the fonts tab appears beneath...
..., grouped by font family. fonts are considered "used" when there is text content in the inspected element that has the font applied to it. empty elements will not have any fonts used and will display the message "no fonts were found for the current element." fonts will be included in this section for one of the following reasons: they are listed in the element's font-family css declaration value. they are applied to the element as part of the browser's default styling (times new roman for most browsers), and no author-defined font has been supplied. they are used by a descendant of the inspected element, for example, when it is a container for other elements which have text content with fonts applied. they are system fallback fonts used when nothing from the font-family css declaratio...
...ont-family css declaration has been applied. fonts editor firefox 63 adds the font editor — a new area below "fonts used" with additional controls for editing the fonts’ characteristics. for standard (static) fonts, you will be able to change the settings listed below size the font-size for the inspected element. this can be set using em, rem, %, px, vh, or vw units. you can select values using the slider or enter a numeric value directly into the text box. note: if you want to use a different unit such as pt for font-size or line-height, you can set the property value applied to the currently inspected element to use that unit via the rules view, and the font editor will automatically pick it up and make it available in the associated units dropdown menu. changing the unit o...
...And 8 more matches
Examine and edit CSS - Firefox Developer Tools
: toggle pseudo-classes; toggle classes; add a new rule; change the display based on the color scheme preference (as of firefox 72, you must set devtools.inspector.color-scheme-simulation.enabled to true in the configuration editor to enable this feature); change the display based on print media rules. a warning icon appears next to unsupported css properties or rules that have invalid values. this can help you understand why certain styles are not being applied. in the following example, a spelling error, "background-colour" instead of "background-color" has made the rule invalid: rule display it displays each rule as in a stylesheet, with a list of selectors followed by a list of property:value; declarations. highlight matched elements: next to the selector is a target ico...
...scheme preference is overridden to light. in order to use this simulator, you must set privacy.resistfingerprinting to false. you can use the color scheme simulator to see how the styles display based on the prefers-color-scheme media query, if it is defined for the page. the color scheme simulator has four states, which you can cycle through by clicking the button repeatedly: icon value description null the prefers-color-scheme media feature is not defined. light the user prefers a light interface. dark the user prefers a dark interface. note that the first three states of the button may be difficult to distinguish visually. they typically produce a similar effect. examine computed css to see the complete computed c...
...ight the user prefers a light interface. dark the user prefers a dark interface. note that the first three states of the button may be difficult to distinguish visually. they typically produce a similar effect. examine computed css to see the complete computed css for the selected element, select the computed panel in the righthand pane. this panel shows the calculated value that each css property has for the selected element. (this calculated value is exactly the same as what getcomputedstyle would return.) you can tab through the styles to select them, and you can find more information about each property — pressing f1 on a selected property will open up its mdn reference page. clicking the arrow next to the property name (or pressing enter or space while it ...
...And 8 more matches
AudioListener.dopplerFactor - Web APIs
example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
... example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
... example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
...And 8 more matches
Document.execCommand() - Web APIs
at manipulate the current editable region, such as form inputs or contenteditable elements. most commands affect the document's selection (bold, italics, etc.), while others insert new elements (adding a link), or affect an entire line (indenting). when using contenteditable, execcommand() affects the currently active editable element. syntax document.execcommand(acommandname, ashowdefaultui, avalueargument) return value a boolean that is false if the command is unsupported or disabled. note: only returns true if part of a user interaction. don't try using the return value to verify browser support before calling a command. parameters acommandname a domstring specifying the name of the command to execute. see commands for a list of possible commands. ashowdefaultui a boolean ind...
...e: only returns true if part of a user interaction. don't try using the return value to verify browser support before calling a command. parameters acommandname a domstring specifying the name of the command to execute. see commands for a list of possible commands. ashowdefaultui a boolean indicating whether the default user interface should be shown. this is not implemented in mozilla. avalueargument for commands which require an input argument, is a domstring providing that information. for example, insertimage requires the url of the image to insert. specify null if no argument is needed. commands backcolor changes the document background color. ...
...note that internet explorer uses this to set the text background color. bold toggles bold on/off for the selection or at the insertion point. internet explorer uses the <strong> tag instead of <b>. clearauthenticationcache clears all authentication credentials from the cache. ...
...And 8 more matches
HTMLInputElement.stepDown() - Web APIs
the htmlinputelement.stepdown([n]) method decrements the value of a numeric type of <input> element by the value of the step attribute or up to n multiples of the step attribute if a number is passed as the parameter. the method, when invoked, decrements the value by (step * n), where n defaults to 1 if not specified, and step defaults to the default value for step if not specified. valid on all numeric, date, and time input types that support the step attribute, includingdate, month, week, time, datetime-local, number, and range. given <input id="mytime" type="time" max="17:00" step="900" value="17:00">, invoking mytime.step(3) will change the value to 16:15, decrementing the time by 3 * 900, or 45 minutes. mytime.step(), with no parameter, would have resulted in 16:45, as n defaults to 1...
...sulted in 16:45, as n defaults to 1. <!-- decrements by intervals of 900 seconds (15 minute) --> <input type="time" max="17:00" step="900"> <!-- decrements by intervals of 7 days (one week) --> <input type="date" max="2019-12-25" step="7"> <!-- decrements by intervals of 12 months (one year) --> <input type="month" max="2019-12" step="12"> the method, when invoked, changes the form control's value by the value given in the step attribute, multiplied by the parameter, within the constraints set within the form control. the default value for the parameter, if not is passed, is 1. the method will not cause the value to go below the min value set or defy the constraints set by the step attribute. a negative value for n will increment the value, but will not increment beyond the max value. if ...
...the value given in the step attribute, multiplied by the parameter, within the constraints set within the form control. the default value for the parameter, if not is passed, is 1. the method will not cause the value to go below the min value set or defy the constraints set by the step attribute. a negative value for n will increment the value, but will not increment beyond the max value. if the value before invoking the stepdown() method is invalid, for example, if it doesn't match the constraints set by the step attribute, invoking the stepdown() method will return a value that does match the form controls constraints. if the form control is non time, date, or numeric in nature, and therefore does not support the step attribute (see the list of supported input types in the the table above),...
...And 8 more matches
HTMLSelectElement.add() - Web APIs
index does not exist), the new element is appended to the end of the collection. exceptions a domerror of the type hierarchyrequesterror if the item passed to the method is an ancestor of the htmlselectelement. examples creating elements from scratch var sel = document.createelement("select"); var opt1 = document.createelement("option"); var opt2 = document.createelement("option"); opt1.value = "1"; opt1.text = "option: value 1"; opt2.value = "2"; opt2.text = "option: value 2"; sel.add(opt1, null); sel.add(opt2, null); /* produces the following, conceptually: <select> <option value="1">option: value 1</option> <option value="2">option: value 2</option> </select> */ the before parameter is optional. so the following is accepted. ... sel.add(opt1); sel.add(opt2); ...
... produces the following, conceptually: <select> <option value="1">option: value 1</option> <option value="2">option: value 2</option> </select> */ the before parameter is optional. so the following is accepted. ... sel.add(opt1); sel.add(opt2); ... ...
...ally: <select> <option value="1">option: value 1</option> <option value="2">option: value 2</option> </select> */ the before parameter is optional. so the following is accepted. ... sel.add(opt1); sel.add(opt2); ... ...
...And 8 more matches
Drag Operations - Web APIs
text may be dragged')"> this text <strong>may</strong> be dragged. </p> the draggable attribute is set to "true", so this element becomes draggable. if this attribute were omitted or set to "false", the element would not be dragged, and instead the text would be selected. the draggable attribute may be used on any element, including images and links. however, for these last two, the default value is true, so you would only use the draggable attribute with a value of false to disable dragging of these elements. note: when an element is made draggable, text or other elements within it can no longer be selected in the normal way by clicking and dragging with the mouse. instead, the user must hold down the alt key to select text with the mouse, or use the keyboard. starting a drag operati...
...g occurs, data must be associated with the drag which identifies what is being dragged. for example, when dragging the selected text within a textbox, the data associated with the drag data item is the text itself. similarly, when dragging a link on a web page, the drag data item is the link's url. the drag data contains two pieces of information, the type (or format) of the data, and the data's value. the format is a type string (such as text/plain for text data), and the value is a string of text. when the drag begins, you add data by providing a type and the data. during the drag, in an event listener for the dragenter and dragover events, you use the data types of the data being dragged to check whether a drop is allowed. for instance, a drop target that accepts links would check for the t...
...pes, often custom types, yet still provide fallback data for drop targets that do not support more specific types. it is usually the case that the least specific type will be normal text data using the type text/plain. this data will be a simple textual representation. to set a drag data item within the datatransfer, use the setdata() method. it takes two arguments: the type of data and the data value. for example: event.datatransfer.setdata("text/plain", "text to drag"); in this case, the data value is "text to drag" and is of the format text/plain. you can provide data in multiple formats. to do this, call the setdata() method multiple times with different formats. you should call it with formats in order from most specific to least specific. const dt = event.datatransfer; dt.setdata("a...
...And 8 more matches
Headers - Web APIs
Web › API › Headers
the headers interface of the fetch api allows you to perform various actions on http request and response headers. these actions include retrieving, setting, adding to, and removing headers from the list of the request's headers. a headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs. ...
...this affects whether the set(), delete(), and append() methods will mutate the header. for more information see guard. you can retrieve a headers object via the request.headers and response.headers properties, and create a new headers object using the headers.headers() constructor. ...
...eaders() constructor. an object implementing headers can directly be used in a for...of structure, instead of entries(): for (var p of myheaders) is equivalent to for (var p of myheaders.entries()). note: you can find more out about the available headers by reading our http headers reference. constructor headers() creates a new headers object. methods headers.append() appends a new value onto an existing header inside a headers object, or adds the header if it does not already exist. headers.delete() deletes a header from a headers object. headers.entries() returns an iterator allowing to go through all key/value pairs contained in this object. headers.foreach() executes a provided function once for each array element. headers.get() returns a bytestring sequence of all th...
...And 8 more matches
Basic concepts - Web APIs
sql are solutions for storage, they do not offer the same functionalities. websql database is a relational database access system, whereas indexeddb is an indexed table system. big concepts if you have assumptions from working with other types of databases, you might get thrown off when working with indexeddb. so keep the following important concepts in mind: indexeddb databases store key-value pairs. the values can be complex structured objects, and keys can be properties of those objects. you can create indexes that use any property of the objects for quick searching, as well as sorted enumeration. keys can be binary objects. indexeddb is built on a transactional database model. everything you do in indexeddb always happens in the context of a transaction. the indexeddb api prov...
... of your web app in two different tabs simultaneously. without transactional operations, the two instances could interfere with each other's modifications. if you are not familiar with transactions in a database, read the wikipedia article on transactions. also see transaction under the definitions section. the indexeddb api is mostly asynchronous. the api doesn't give you data by returning values; instead, you have to pass a callback function. you don't "store" a value into the database, or "retrieve" a value out of the database through synchronous means. instead, you "request" that a database operation happens. you get notified by a dom event when the operation finishes, and the type of event you get lets you know if the operation succeeded or failed. this sounds a little complicated at...
...usly. they have onsuccess and onerror properties, and you can call addeventlistener() and removeeventlistener() on them. they also have readystate, result, and errorcode properties that tell you the status of the request. the result property is particularly magical, as it can be many different things, depending on how the request was generated (for example, an idbcursor instance, or the key for a value that you just inserted into the database). indexeddb uses dom events to notify you when results are available. dom events always have a type property (in indexeddb, it is most commonly set to "success" or "error"). dom events also have a target property that indicates where the event is headed. in most cases, the target of an event is the idbrequest object that was generated as a result of ...
...And 8 more matches
SVGAngle - Web APIs
Web › API › SVGAngle
the svgangle interface is used to represent a value that can be an <angle> or <number> value. an svgangle reflected through the animval attribute is always read only. an svgangle object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. an svgangle object can be associated with a particular element. the associated element is used to determine which element's content attribute to update if the object reflects an attribute. unless otherwise described, an svgangle object is not associated with any element. ...
...the object will result in an exception being thrown. an svgangle object can be associated with a particular element. the associated element is used to determine which element's content attribute to update if the object reflects an attribute. unless otherwise described, an svgangle object is not associated with any element. every svgangle object operates in one of two modes: reflect the base value of a reflected animatable attribute (being exposed through the baseval member of an svganimatedangle), be detached, which is the case for svgangle objects created with svgsvgelement.createsvgangle(). constants svg_angletype_unknown some unknown type of value. svg_angletype_unspecified a unitless <number> interpreted as a value in degrees. svg_angletype_deg an <angle> with a deg unit. ...
... svgangle objects created with svgsvgelement.createsvgangle(). constants svg_angletype_unknown some unknown type of value. svg_angletype_unspecified a unitless <number> interpreted as a value in degrees. svg_angletype_deg an <angle> with a deg unit. svg_angletype_rad an <angle> with a rad unit. svg_angletype_grad an <angle> with a grad unit. properties unittype the type of the value as specified by one of the svg_angletype_* constants defined on this interface. value the value as a floating point value, in user units. setting this attribute will cause valueinspecifiedunits and valueasstring to be updated automatically to reflect this setting. exceptions on setting: a domexception with code no_modification_allowed_err is raised when the length corresponds to a read-only...
...And 8 more matches
Using readable streams - Web APIs
next section), then create a new response out of it, consume it as a blob, create an object url out of that blob using url.createobjecturl(), and then display it on screen in an <img> element, effectively creating a copy of the image we originally fetched. ...
...in the pump() function seen above we first invoke read(), which returns a promise containing a resu...
...=> new response(stream)) .then(response => response.blob()) .then(blob => url.createobjecturl(blob)) .then(url => console.log(image.src = url)) .catch(err => console.error(err)); let’s look in detail at how read() is used. in the pump() function seen above we first invoke read(), which returns a promise containing a results object — this has the results of our read in it, in the form { done, value }: return reader.read().then(({ done, value }) => { the results can be one of three different types: if a chunk is available to read, the promise will be fulfilled with an object of the form { value: thechunk, 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 wil...
...And 8 more matches
Migrating from webkitAudioContext - Web APIs
at it will return immediately, and then when the decoding finishes, one of the success or failure callback functions will get called depending on whether the audio decoding was successful. this means that you may need to restructure your code to run the part which happened after the createbuffer() call in the success callback, as you can see in the example above. renaming of audioparam.settargetvalueattime the settargetvalueattime() method on the audioparam interface has been renamed to settargetattime(). this is also a simple rename to improve the understandability of the api, and the semantics of the method are the same. if your code is using settargetvalueattime(), you can simply rename it to use settargetattime(). for example, if we have code that looks like this: var gainnode = con...
... the audioparam interface has been renamed to settargetattime(). this is also a simple rename to improve the understandability of the api, and the semantics of the method are the same. if your code is using settargetvalueattime(), you can simply rename it to use settargetattime(). ...
... oscillatornode.type oscillatornode's type property has been changed to use web idl enums. ...
...And 8 more matches
Window.open() - Web APIs
Web › API › Window › open
ing context, a new window is created and is given the name specified by windowname. this name can be used as the target for the target attribute of <a> or <form> elements. the name should not contain whitespace. keep in mind that this will not be used as the window's title. ...
... is created and is given the name specified by windowname. this name can be used as the target for the target attribute of <a> or <form> elements. the name should not contain whitespace. keep in mind that this will not be used as the window's title. windowfeatures optional a domstring containing a comma-separated list of window features given with their corresponding values in the form "name=value". ...
...a domstring containing a comma-separated list of window features given with their corresponding values in the form "name=value". these features include options such as the window's default size and position, whether or not to include toolbar, and so forth. there must be no whitespace in the string. see window features below for documentation of each of the features that can be specified. return value a windowproxy object, which is basically a thin wrapper for the window object representing the newly created window, and has all its features available. if the window couldn't be opened, the returned value is instead null. the returned reference can be used to access properties and methods of the new window as long as it complies with same-origin policy security requirements. description the o...
...And 8 more matches
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
alternative syntax that allows you to include a string instead of a function, which is compiled and executed when the timer expires. this syntax is not recommended for the same reasons that make using eval() a security risk. delay optional the time, in milliseconds (thousandths of a second), the timer should wait before the specified function or code is executed. if this parameter is omitted, a value of 0 is used, meaning execute "immediately", or more accurately, the next event cycle. note that in either case, the actual delay may be longer than intended; see reasons for delays longer than specified below. arg1, ..., argn optional additional arguments which are passed through to the function specified by function. note: passing additional parameters to the function in the first syntax d...
...asons for delays longer than specified below. arg1, ..., argn optional additional arguments which are passed through to the function specified by function. note: passing additional parameters to the function in the first syntax does not work in internet explorer 9 and below. if you want to enable this functionality on that browser, you must use a polyfill (see the polyfill section). return value the returned timeoutid is a positive integer value which identifies the timer created by the call to settimeout(); this value can be passed to cleartimeout() to cancel the timeout. it may be helpful to be aware that settimeout() and setinterval() share the same pool of ids, and that cleartimeout() and clearinterval() can technically be used interchangeably. for clarity, however, you should try ...
...ove example can also be written with the help of an arrow function: var intervalid = settimeout(() => { myfunc('one', 'two', 'three'); }, 1000); yet another possibility is to use function's bind. example: settimeout(function(arg1){}.bind(undefined, 10), 1000); the "this" problem when you pass a method to settimeout() (or any other function, for that matter), it will be invoked with a this value that may differ from your expectation. this issue is explained in detail in the javascript reference. explanation code executed by settimeout() is called from an execution context separate from the function from which settimeout 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 wi...
...And 8 more matches
ARIA: button role - Accessibility
convention to inform users a button will launch a dialog is to append "…" (ellipsis) to the button's label, e.g., "save as…". in addition to the ordinary button widget, role="button" should be included when creating a toggle button or menu button using a non button element. a toggle button is a two-state button that can be either off (not pressed) or on (pressed). ...
...e button is a two-state button that can be either off (not pressed) or on (pressed). the aria-pressed attribute values of true or false identify a button as a toggle button. a menu button is a button that controls a menu and has an aria-haspopup property attribute set to either menu or true. associated aria roles, states, and properties aria-pressed defines the button as a toggle button. the value of aria-pressed describes the state of the button. the values include aria-pressed="false" when a button is not currently pressed, aria-pressed="true" to indicate a button is currently pressed, and aria-pressed="mixed" if the button is considered to be partially pressed. ...
... aria-expanded if the button controls a grouping of other elements, the aria-expanded state indicates whether the controlled grouping is currently expanded or collapsed. ...
...And 8 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. ...
... the -webkit-mask-position-x css property sets the initial horizontal position of a mask image. ...
... the -webkit-mask-position-x css property sets the initial horizontal position of a mask image. ...
...And 8 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. ...
... the -webkit-mask-position-y css property sets the initial vertical position of a mask image. ...
... the -webkit-mask-position-y css property sets the initial vertical position of a mask image. ...
...And 8 more matches
negative - CSS: Cascading Style Sheets
when defining custom counter styles, the negative descriptor lets you alter the representations of negative counter values, by providing a way to specify symbols to be appended or prepended to the counter representation when the value is negative. syntax /* <symbol> values */ negative: "-"; /* prepends '-' if value is negative */ negative: "(" ")"; /* surrounds value by '(' and ')' if it is negative */ values first <symbol> this symbol will be prepended to the representation when the counter is negative. second <symbol> if present, this symbol will be appended to the representation when the counter is negative. ...
...> values */ negative: "-"; /* prepends '-' if value is negative */ negative: "(" ")"; /* surrounds value by '(' and ')' if it is negative */ values first <symbol> this symbol will be prepended to the representation when the counter is negative. second <symbol> if present, this symbol will be appended to the representation when the counter is negative. description if the counter value is negative, the symbol provided as value for the descriptor is prepended to the counter representation; and a second symbol if specified, will be appended to the representation. the negative descriptor has effect only if the system value is symbolic, alphabetic, numeric, additive, or extends, if the extended counter style itself uses a negative sign. if the negative descriptor is specified for o...
...e descriptor is prepended to the counter representation; and a second symbol if specified, will be appended to the representation. the negative descriptor has effect only if the system value is symbolic, alphabetic, numeric, additive, or extends, if the extended counter style itself uses a negative sign. if the negative descriptor is specified for other systems that don't support negative counter values, then the descriptor is ignored. ...
...And 8 more matches
symbols - CSS: Cascading Style Sheets
it is not yet implemented.) <custom-ident> description a symbol can be a string, image, or identifier. it is used within the @counter-style at-rule. ...
...it is not yet implemented.) <custom-ident> description a symbol can be a string, image, or identifier. it is used within the @counter-style at-rule. ...
...t is not yet implemented.) <custom-ident> description a symbol can be a string, image, or identifier. it is used within the @counter-style at-rule. ...
...And 8 more matches
system - CSS: Cascading Style Sheets
the system descriptor specifies the algorithm to be used for converting the integer value of a counter to a string representation. it is used in a @counter-style to define the behavior of the defined style. if the algorithm specified in the system descriptor is unable to construct the representation for a particular counter value, then that value's representation will be constructed using the fallback system provided. syntax /* keyword values */ system: cyclic; system: numeric; system: alphabetic; system: symbolic; system: additive; system: fixed; /* combined values */ system: fixed 3; system: extends decimal; this may take one of three forms: one of the keyword values cyclic, numeric, alphabetic, symbolic, additive, or fixed. the keyword value fixed along with an integer. the key...
... cyclic cycles through the list of symbols provided. once the end of the list of symbols is reached, it will loop back to the beginning and start over. this system is useful for simple bullet styles with just one symbol, or for styles having multiple symbols. ...
... over. this system is useful for simple bullet styles with just one symbol, or for styles having multiple symbols. at least one symbol must be specified in the symbols descriptor, or the counter style is not valid. fixed defines a finite set of symbols are specified. once the system has looped through all the specified symbols, it will fall back. this system is useful in cases where the counter values are finite. at least one symbol must be specified in the symbols descriptor or the counter style is not valid. also an optional <integer> can be specified after the the system, as the value of the first symbol. if this integer is omitted, value of the first integer is taken as 1. symbolic cycles through the provided list of symbols. on each successive pass through the cycle, the symbols used f...
...And 8 more matches
Box alignment in CSS Grid Layout - CSS: Cascading Style Sheets
sed on their differences (features and constraints). while the specification currently specifies alignment details for all layout methods, browsers have not fully implemented all of the specification; however, the css grid layout method has been widely adopted. this guide presents demonstrations of how box alignment in grid layout works. you will see many similarities in how these properties and values work in flexbox. due to grid being two-dimensional and flexbox one-dimensional there are some small differences that you should watch out for. so we will start by looking at the two axes that we deal with when aligning things in a grid. the two axes of a grid layout when working with grid layout you have two axes available to align things against – the block axis and the inline axis. the blo...
...s. aligning items on the block axis the align-self and align-items properties control alignment on the block axis. when we use these properties, we are changing the alignment of the item within the grid area you have placed it. in the following example, i have four grid areas within my grid. ...
...is in contrast to omitting align-items completely, in which case the height of each <div> stretches to fill its grid area. the align-items property sets the align-self property for all of the child grid items. this means that you can set the property individually, by using align-self on a grid item. in this next example, i am using the align-self property, to demonstrate the different alignment values. the first area, is showing the default behavior of align-self, which is to stretch. the second item, has an align-self value of start, the third end and the fourth center. * {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:...
...And 8 more matches
appearance (-moz-appearance, -webkit-appearance) - CSS: Cascading Style Sheets
property on websites, you should test it very carefully. although it is supported in most modern browsers, its implementation varies widely. in older browsers, even the keyword none does not have the same effect on all form elements across different browsers, and some do not support it at all. the differences are smaller in the newest browsers. ...
...mentation varies widely. in older browsers, even the keyword none does not have the same effect on all form elements across different browsers, and some do not support it at all. the differences are smaller in the newest browsers. ...
...; appearance: textfield; /* "compat-auto" values, which have the same effect as 'auto' */ appearance: button; appearance: searchfield; appearance: textarea; appearance: push-button; appearance: slider-horizontal; appearance: checkbox; appearance: radio; appearance: square-button; appearance: menulist; appearance: listbox; appearance: meter; appearance: progress-bar; /* partial list of available values in gecko */ -moz-appearance: scrollbarbutton-up; -moz-appearance: button-bevel; /* partial list of available values in webkit/blink (as well as gecko and edge) */ -webkit-appearance: media-mute-button; -webkit-appearance: caret; values standard keywords value demo browser description none div{ color: black; -moz-appearance:none; -webkit-appearance:no...
...And 8 more matches
background-image - CSS: Cascading Style Sheets
user. the borders of the element are then drawn on top of them, and the background-color is drawn beneath them. how the images are drawn relative to the box and its borders is defined by the background-clip and background-origin css properties. if a specified image cannot be drawn (for example, when the file denoted by the specified uri cannot be loaded), browsers handle it as they would a none value. note: even if the images are opaque and the color won't be displayed in normal circumstances, web developers should always specify a background-color. if the images cannot be loaded—for instance, when the network is down—the background color will be used as a fallback. syntax each background image is specified either as the keyword none or as an <image> value. to specify multiple backgro...
...are opaque and the color won't be displayed in normal circumstances, web developers should always specify a background-color. if the images cannot be loaded—for instance, when the network is down—the background color will be used as a fallback. syntax each background image is specified either as the keyword none or as an <image> value. to specify multiple background images, supply multiple values, separated by a comma: background-image: linear-gradient(to bottom, rgba(255,255,0,0.5), rgba(0,0,255,0.5)), url('https://mdn.mozillademos.org/files/7693/catfront.png'); values none is a keyword denoting the absence of images. <image> is an <image> denoting the image to display. there can be several of them, separated by commas, as multiple backgrounds are supported. accessibility ...
... readers, as a screen reader will not announce its presence and therefore convey nothing to its users. if the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. ...
...And 8 more matches
background - CSS: Cascading Style Sheets
t.jpg") repeat-y; /* using a <box> and <background-color> */ background: border-box red; /* a single image, centered and scaled */ background: no-repeat center/80% url("../img/image.png"); the background property is specified as one or more background layers, separated by commas. the syntax of each layer is as follows: each layer may include zero or one occurrences of any of the following values: <attachment> <bg-image> <position> <bg-size> <repeat-style> the <bg-size> value may only be included immediately after <position>, separated with the '/' character, like this: "center/80%". the <box> value may be included zero, one, or two times. if included once, it sets both background-origin and background-clip. if it is included twice, the first occurrence sets back...
...yle> the <bg-size> value may only be included immediately after <position>, separated with the '/' character, like this: "center/80%". the <box> value may be included zero, one, or two times. if included once, it sets both background-origin and background-clip. if it is included twice, the first occurrence sets background-origin, and the second sets background-clip. the <background-color> value may only be included in the last layer specified. values <attachment> see background-attachment <box> see background-clip and background-origin <background-color> see background-color <bg-image> see background-image <position> see background-position <repeat-style> see background-repeat <bg-size> see background-size. accessibility concerns browsers do not provide any special ...
... readers, as a screen reader will not announce its presence and therefore convey nothing to its users. if the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. mdn understanding wcag, guideline 1.1 explanations understanding success criterion 1.1.1 | w3c understanding wcag 2.0 formal definition initial valueas each of the properties of the shorthand:background-image: nonebackground-position: 0% 0%background-size: auto autobackground-repeat: repeatbackground-origin: padding-boxbackground-clip: border-boxbackground-attachment: scrollbackground-color: transparentapplies toall elements. it also applies to ::first-letter and ::first-line.inheritednopercentagesas each of the properties of the shorthand:bac...
...And 8 more matches
border-inline-end - 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. ...
...-end-color border-inline-end-style border-inline-end-width syntax border-inline-end: 1px; border-inline-end: 2px dashed; border-inline-end: medium dashed blue; the physical border to which border-inline-end maps depends on the element's writing mode, directionality, and text orientation. ...
...-end maps depends on the element's writing mode, directionality, and text orientation. it corresponds to the border-top, border-right, border-bottom, or border-left property depending on the values defined for writing-mode, direction, and text-orientation. related properties are border-block-start, border-block-end, and border-inline-start, which define the other borders of the element. ...
...And 8 more matches
border-inline - CSS: Cascading Style Sheets
the border-inline css property is a shorthand property for setting the individual logical inline border property values in a single place in the style sheet. border-inline: 1px; border-inline: 2px dotted; border-inline: medium dashed blue; the physical borders to which border-inline maps depends on the element's writing mode, directionality, and text orientation. it corresponds to the border-top and border-bottom or border-right, and border-left properties, depending on the values defined for writing-mode, direction, 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-inline maps depends on the element's writing mode, directionality, and text orientation. it corresponds to the border-top and border-bottom or border-right, and border-left properties, depending on the values defined for writing-mode, direction, and text-orientation. the borders in the other dimension can be set with border-block, which sets border-block-start, and border-block-end. ...
...order-left properties, depending on the values defined for writing-mode, direction, and text-orientation. the borders in the other dimension can be set with border-block, which sets border-block-start, and border-block-end. ...
...And 8 more matches
border - CSS: Cascading Style Sheets
Web › CSS › border
the border shorthand css property sets an element's border. it sets the values of border-width, border-style, and border-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. ...
... 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: border-color border-style border-width syntax /* style */ border: solid; /* width | style */ border: 2px dotted; /* style | color */ border: outset #f33; /* width | style | color */ border: medium dashed green; /* global values */ border: inherit; border: initial; border: unset; the border property may be specified using one, two, or three of the values listed below. the order of the values does not matter. note: the border will be invisible if its style is not defined. this is because the style defaults to none. values <line-width> sets the thickness of the border. defaults to medium if absent. see border-wi...
... the border shorthand is especially useful when you want all four borders to be the same. ...
...And 8 more matches
column-rule-color - CSS: Cascading Style Sheets
the column-rule-color css property sets the color 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. ...
...e source for this interactive example is stored in a github repository. if 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 /* <color> values */ column-rule-color: red; column-rule-color: rgb(192, 56, 78); column-rule-color: transparent; column-rule-color: hsla(0, 100%, 50%, 0.6); /* global values */ column-rule-color: inherit; column-rule-color: initial; column-rule-color: unset; the column-rule-color property is specified as a single <color> value. ...
...om/mdn/interactive-examples and send us a pull request. syntax /* <color> values */ column-rule-color: red; column-rule-color: rgb(192, 56, 78); column-rule-color: transparent; column-rule-color: hsla(0, 100%, 50%, 0.6); /* global values */ column-rule-color: inherit; column-rule-color: initial; column-rule-color: unset; the column-rule-color property is specified as a single <color> value. values <color> the color of the rule that separates columns. ...
...And 8 more matches
flex - CSS: Cascading Style Sheets
Web › CSS › flex
le in its flex container. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... 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: flex-grow flex-shrink flex-basis syntax /* keyword values */ flex: auto; flex: initial; flex: none; /* one value, unitless number: flex-grow */ flex: 2; /* one value, width/height: flex-basis */ flex: 10em; flex: 30%; flex: min-content; /* two values: flex-grow | flex-basis */ flex: 1 30px; /* two values: flex-grow | flex-shrink */ flex: 2 2; /* three values: flex-grow | flex-shrink | flex-basis */ flex: 2 2 10%; /* global values */ flex: inherit; flex: initial; flex: unset; the flex property may be specified using one, two, or three values. one-valu...
...And 8 more matches
grid-column-start - CSS: Cascading Style Sheets
column by contributing a line, a span, or nothing (automatic) to its grid placement. this start position defines the block-start edge of the grid 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. ...
...utomatic) to its grid placement. this start position defines the block-start edge of the grid 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. ...
...art edge of the grid 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. ...
...And 8 more matches
grid-template-rows - CSS: Cascading Style Sheets
the grid-template-rows css property defines the line names and track sizing functions of the grid rows. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... grid-template-rows css property defines the line names and track sizing functions of the grid rows. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...d us a pull request. ...
...And 8 more matches
margin-left - CSS: Cascading Style Sheets
the margin-left css property sets the margin area on the left side of an element. a positive value places 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. ...
...ples 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. ...
...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. 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. ...
...And 8 more matches
mask-image - CSS: Cascading Style Sheets
the mask-image css property sets the image that is used as mask layer for an element. /* keyword value */ mask-image: none; /* <mask-source> value */ mask-image: url(masks.svg#mask1); /* <image> values */ mask-image: linear-gradient(rgba(0, 0, 0, 1.0), transparent); mask-image: image(url(mask.png), skyblue); /* multiple values */ mask-image: image(url(mask.png), skyblue), linear-gradient(rgba(0, 0, 0, 1.0), transparent); /* global values */ mask-image: inherit; mask-image: initial; mask-image: unset; syntax values none this keyword is interpreted as a transparent black image layer. <mask-source> a <url> reference to a <mask> or to a css image. ...
...ge(url(mask.png), skyblue); /* multiple values */ mask-image: image(url(mask.png), skyblue), linear-gradient(rgba(0, 0, 0, 1.0), transparent); /* global values */ mask-image: inherit; mask-image: initial; mask-image: unset; syntax values none this keyword is interpreted as a transparent black image layer. <mask-source> a <url> reference to a <mask> or to a css image. <image> an image value used as mask image layer. ...
...: image(url(mask.png), skyblue), linear-gradient(rgba(0, 0, 0, 1.0), transparent); /* global values */ mask-image: inherit; mask-image: initial; mask-image: unset; syntax values none this keyword is interpreted as a transparent black image layer. <mask-source> a <url> reference to a <mask> or to a css image. <image> an image value used as mask image layer. ...
...And 8 more matches
max-block-size - CSS: Cascading Style Sheets
s 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" of the content (even though this may not be a vertical value) and max-inline-size to set the maximum "width" of 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/interactiv...
...ent (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. ...
...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. ...
...And 8 more matches
pointer-events - CSS: Cascading Style Sheets
the pointer-events css property sets under what circumstances (if any) a particular graphic element can become the target of pointer 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. ...
... none the element is never the target of p...
...visible; /* svg only */ pointer-events: painted; /* svg only */ pointer-events: fill; /* svg only */ pointer-events: stroke; /* svg only */ pointer-events: all; /* svg only */ /* global values */ pointer-events: inherit; pointer-events: initial; pointer-events: unset; the pointer-events property is specified as a single keyword chosen from the list of values below. values auto the element behaves as it would if the pointer-events property were not specified. in svg content, this value and the value visiblepainted have the same effect. none the element is never the target of pointer events; however, pointer events may target its descendant elements if those descendants have pointer-events set to some other value. in these circumstances, pointe...
...And 8 more matches
quotes - CSS: Cascading Style Sheets
Web › CSS › quotes
the quotes css property sets how the browser should render quotation marks that are added using the open-quotes or close-quotes values of the css content property. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...css property sets how the browser should render quotation marks that are added using the open-quotes or close-quotes values of the css content property. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...otation marks that are added using the open-quotes or close-quotes values of the css content property. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword value */ quotes: none; quotes: auto; /* <string> values */ quotes: "«" "»"; /* set open-quote and close-quote to the french quotation marks */ quotes: "«" "»" "‹" "›"; /* set two levels of quotation marks */ /* global values */ quotes: inherit; quotes: initial; quotes: unset; values none the open-quote and close-quote values of the content property produce no quotation marks. auto appropriate quote marks will be used for ...
...And 8 more matches
scrollbar-color - CSS: Cascading Style Sheets
the scrollbar-color css property sets the color of the scrollbar track and thumb. the track refers to the background of the scrollbar, which is generally fixed regardless of the scrolling position. the thumb refers to the moving part of the scrollbar, which usually floats on top of the track. syntax /* keyword values */ scrollbar-color: auto; scrollbar-color: dark; scrollbar-color: light; /* <color> values */ scrollbar-color: rebeccapurple green; /* two valid colors. the first applies to the thumb of the scrollbar, the second to the track. */ /* global values */ scrollbar-color: inherit; scrollbar-color: initial; scrollbar-color: unset; values <scrollbar-color> defines the color of the scrollbar. auto default platform rendering for the track portion of the scro...
...ded by the platform, or a custom scrollbar with dark colors. light show a light scrollbar, which can be either a light variant of scrollbar provided by the platform, or a custom scrollbar with light colors. <color> <color> applies the first color to the scrollbar thumb, the second to the scrollbar track. ...
...t variant of scrollbar provided by the platform, or a custom scrollbar with light colors. <color> <color> applies the first color to the scrollbar thumb, the second to the scrollbar track. note: user agents must apply any scrollbar-color value set on the root element to the viewport. accessibility concerns when using scrollbar-color property with specific color values, authors should ensure the specified colors have enough contrast between them. ...
...And 8 more matches
text-overflow - CSS: Cascading Style Sheets
verflow its container you have to set other css properties: overflow and white-space. for example: overflow: hidden; white-space: nowrap; the text-overflow property only affects content that is overflowing a block container element in its inline progression direction (not text overflowing at the bottom of a box, for example). ...
...tainer you have to set other css properties: overflow and white-space. for example: overflow: hidden; white-space: nowrap; the text-overflow property only affects content that is overflowing a block container element in its inline progression direction (not text overflowing at the bottom of a box, for example). syntax the text-overflow property may be specified using one or two values. ...
...y affects content that is overflowing a block container element in its inline progression direction (not text overflowing at the bottom of a box, for example). syntax the text-overflow property may be specified using one or two values. if one value is given, it specifies 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 va...
...And 8 more matches
user-select - CSS: Cascading Style Sheets
the user-select css property controls whether the user can select text. this doesn't have any effect on content loaded as chrome, except in textboxes. ...
... the user-select css property controls whether the user can select text. this doesn't have any effect on content loaded as chrome, except in textboxes. ...
... the user-select css property controls whether the user can select text. this doesn't have any effect on content loaded as chrome, except in textboxes. ...
...And 8 more matches
<input type="image"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › image
<input> elements of type image are used to create graphical submit buttons, i.e. submit buttons that take the form of an image rather than text. the source for this interactive example is stored in a github repository. if 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 none — the value attribute should not be specified. events none. supported common attributes alt, src, width, height, formaction, formenctype, formmethod, formnovalidate, formtarget idl attributes none. methods none. value <input type="image"> elements do not accept value attributes. the path to the image to be displayed is specified in the src attribut...
...n <img> elements. formaction a string indicating the url to which to submit the data. this takes precedence over the action attribute on the <form> element that owns the <input>. this attribute is also available on <input type="submit"> and <button> elements. formenctype a string that identifies the encoding method to use when submitting the form data to the server. there are three permitted values: application/x-www-form-urlencoded this, the default value, sends the form data as a string after url encoding the text using an algorithm such as encodeuri(). multipart/form-data uses the formdata api to manage the data, allowing for files to be submitted to the server. you must use this encoding type if your form includes any <input> elements of type file (<input type="file">). text/pla...
... using an algorithm such as encodeuri(). multipart/form-data uses the formdata api to manage the data, allowing for files to be submitted to the server. you must use this encoding type if your form includes any <input> elements of type file (<input type="file">). text/plain plain text; mostly useful only for debugging, so you can easily see the data that's to be submitted. ...
...And 8 more matches
<input type="submit"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › submit
<input> elements of type submit are rendered as buttons. when the click event occurs (typically because the user clicked the button), the user agent attempts to submit the form to the server. <input type="submit" value="send request"> value a domstring used as the button's label events click supported common attributes type and value idl attributes value methods none value an <input type="submit"> element's value attribute contains a domstring which is displayed as the button's label. buttons do not have a true value otherwise. <input type="submit" value="send request"> if you don't specify a value, the button will have a default label, chosen by the user agent. this label is likely to be something along the lines ...
...ing the form formaction a string indicating the url to which to submit the data. this takes precedence over the action attribute on the <form> element that owns the <input>. this attribute is also available on <input type="image"> and <button> elements. formenctype a string that identifies the encoding method to use when submitting the form data to the server. there are three permitted values: application/x-www-form-urlencoded this, the default value, sends the form data as a string after url encoding the text using an algorithm such as encodeuri(). multipart/form-data uses the formdata api to manage the data, allowing for files to be submitted to the server. you must use this encoding type if your form includes any <input> elements of type file (<input type="file">). text/pla...
... using an algorithm such as encodeuri(). multipart/form-data uses the formdata api to manage the data, allowing for files to be submitted to the server. you must use this encoding type if your form includes any <input> elements of type file (<input type="file">). text/plain plain text; mostly useful only for debugging, so you can easily see the data that's to be submitted. ...
...And 8 more matches
<meter>: The HTML Meter element - HTML: Hypertext Markup Language
Web › HTML › Element › meter
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, labelable content, palpable content. permitted content phrasing content, but there must be no <meter> element among its descendants. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. ...
...r> element among its descendants. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlmeterelement attributes this element includes the global attributes. ...
...dants. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlmeterelement attributes this element includes the global attributes. value the current numeric value. ...
...And 8 more matches
Content negotiation - HTTP
the relative degree of preference between the different mime types. the accept header is defined by the browser, or any other user-agent, and can vary according to the context, like fetching an html page or an image, a video, or a script: it is different when fetching a document entered in the address bar or an element linked via an <img>, <video> or <audio> element. browsers are free to use the value of the header that they think is the most adequate; an exhaustive list of default values for common browsers is available. the accept-ch header this is part of an experimental technology called client hints. initial support is in chrome 46 or later. the device-memory value is in chrome 61 or later. the experimental accept-ch lists configuration data that can be used by the server to select...
...for example, 512 megabytes will be reported as 0.5. dpr indicates the client's device pixel ratio. ...
...for example, 512 megabytes will be reported as 0.5. dpr indicates the client's device pixel ratio. ...
...And 8 more matches
Index - HTTP
Web › HTTP › Headers › Index
found 122 pages: # page tags and summary 1 http headers http, http header, networking, overview, reference http headers allow the client and the server to pass additional information with the request or the response. an http header consists of its case-insensitive name followed by a colon ':', then by its value (without line breaks). leading white space before the value is ignored. ...
...e the value is ignored. 2 accept http, http header, reference, request header the accept request http header advertises which content types, expressed as mime types, the client is able to understand. using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the content-type response header. browsers set adequate values for this header depending on the context where the request is done: when fetching a css stylesheet a different value is set for the request than when fetching an image, video or a script. 3 accept-charset content negotiation, http, http header, reference, request header the accept-charset request http header advertises which character set the client is able to understand. us...
...harset content negotiation, http, http header, reference, request header the accept-charset request http header advertises which character set the client is able to understand. using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice within the content-type response header. browsers usually don't set this header as the default value for each content type is usually correct and transmitting it would allow easier fingerprinting. 4 accept-encoding content negotiation, http, http header, reference, request header the accept-encoding request http header advertises which content encoding, usually a compression algorithm, the client is able to understand. using content negotiation, the server selects one of the...
...And 8 more matches
Functions - JavaScript
generally speaking, a function is a "subprogram" that can be called by code external (or internal in the case of recursion) to the function. like the program itself, a function is composed of a sequence of statements called the function body. values can be passed to a function, and the function will return a value. in javascript, functions are first-class objects, because they can have properties and methods just like any other object. what distinguishes them from other objects is that functions can be called. in brief, they are function objects. ...
...operties and methods just like any other object. what distinguishes them from other objects is that functions can be called. in brief, they are function objects. for more examples and explanations, see also the javascript guide about functions. description every function in javascript is a function object. see function for information on properties and methods of function objects. to return a value other than the default, a function must have a return statement that specifies the value to return. a function without a return statement will return a default value. in the case of a constructor called with the new keyword, the default value is the value of its this parameter. for all other functions, the default return value is undefined. the parameters of a function call are the function's ar...
...a return statement that specifies the value to return. a function without a return statement will return a default value. in the case of a constructor called with the new keyword, the default value is the value of its this parameter. for all other functions, the default return value is undefined. the parameters of a function call are the function's arguments. arguments are passed to functions by value. if the function changes the value of an argument, this change is not reflected globally or in the calling function. ...
...And 8 more matches
Date.parse() - JavaScript
2015-02-31). it is not recommended to use date.parse as until es5, parsing of strings was entirely implementation dependent. there are still many differences in how different hosts parse date strings, therefore date strings should be manually parsed (a library can help if many different formats are to be accommodated). ...
... the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax direct call: date.parse(datestring) implicit call: new date(datestring) parameters datestring a string representing a simplification of the iso 8601 calendar date extended format. (other formats may be used, but results are implementation-dependent.) return value a number representing the milliseconds elapsed since january 1, 1970, 00:00:00 utc and the date obtained by parsing the given string representation of a date. if the argument doesn't represent a valid date, nan is returned. description the parse() method takes a date string (such as "2011-10-10t14:48:00") and returns the number of milliseconds since january 1, 1970, 00:00:00 utc. this functio...
...illiseconds elapsed since january 1, 1970, 00:00:00 utc and the date obtained by parsing the given string representation of a date. if the argument doesn't represent a valid date, nan is returned. description the parse() method takes a date string (such as "2011-10-10t14:48:00") and returns the number of milliseconds since january 1, 1970, 00:00:00 utc. this function is useful for setting date values based on string values, for example in conjunction with the settime() method and the date object. date time string format the standard string representation of a date time string is a simplification of the iso 8601 calendar date extended format. (see the section date time string format in the ecmascript specification for more details.) for example, "2011-10-10" (date-only form), "2011-10-10t1...
...And 8 more matches
Intl.DateTimeFormat() constructor - JavaScript
ocales optional a string with a bcp 47 language tag, or an array of such strings. to use the browser's default locale, omit this argument or pass undefined. unicode extension are supported (for example "en-us-u-ca-buddhist"). for the general form and interpretation of the locales argument, see the intl page. the following unicode extension keys are allowed: nu numbering system. possible values include: "arab", "arabext", "bali", "beng", "deva", "fullwide", "gujr", "guru", "hanidec", "khmr", "knda", "laoo", "latn", "limb", "mlym", "mong", "mymr", "orya", "tamldec", "telu", "thai", "tibt". ca calendar. possible values include: "buddhist", "chinese", "coptic", "ethiopia", "ethiopic", "gregory", "hebrew", "indian", "islamic", "iso8601", "japanese", "persian", "roc". hc hour cycle.
... "arab", "arabext", "bali", "beng", "deva", "fullwide", "gujr", "guru", "hanidec", "khmr", "knda", "laoo", "latn", "limb", "mlym", "mong", "mymr", "orya", "tamldec", "telu", "thai", "tibt". ca calendar. possible values include: "buddhist", "chinese", "coptic", "ethiopia", "ethiopic", "gregory", "hebrew", "indian", "islamic", "iso8601", "japanese", "persian", "roc". hc hour cycle. possible values include: "h11", "h12", "h23", "h24". ...
...possible values include: "buddhist", "chinese", "coptic", "ethiopia", "ethiopic", "gregory", "hebrew", "indian", "islamic", "iso8601", "japanese", "persian", "roc". hc hour cycle. possible values include: "h11", "h12", "h23", "h24". options optional an object with some or all of the following properties: datestyle the date formatting style to use when calling format(). possible values include: "full" "long" "medium" "short" timestyle the time formatting style to use when calling format(). possible values include: "full" "long" "medium" "short" fractionalseconddigits the number of fractional seconds to apply when calling format(). valid values are 0-3. calendar calendar. ...
...And 8 more matches
parseInt() - JavaScript
s a string argument and returns an integer of the specified radix (the base in mathematical numeral systems). the source for this interactive example is stored in a github repository. if 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 parseint(string [, radix]) parameters string the value to parse. if this argument is not a string, then it is converted to one using the tostring abstract operation. leading whitespace in this argument is ignored. radix optional an integer between 2 and 36 that represents the radix (the base in mathematical numeral systems) of the string. be careful—this does not default to 10! the description below explains in more detail what happens when radi...
...is not a string, then it is converted to one using the tostring abstract operation. leading whitespace in this argument is ignored. radix optional an integer between 2 and 36 that represents the radix (the base in mathematical numeral systems) of the string. be careful—this does not default to 10! the description below explains in more detail what happens when radix is not provided. ...
...(for example, a radix of 10 converts from a decimal number, 8 converts from octal, 16 from hexadecimal, and so on.) for radices above 10, letters of the english alphabet indicate numerals greater than 9. ...
...And 8 more matches
Conditional (ternary) operator - JavaScript
n is falsy. this operator is frequently used as a shortcut for the if statement. the source for this interactive example is stored in a github repository. if 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 condition ? expriftrue : expriffalse parameters condition an expression whose value is used as a condition. expriftrue an expression which is evaluated if the condition evaluates to a truthy value (one which equals or can be converted to true). expriffalse an expression which is executed if the condition is falsy (that is, has a value which can be converted to false). description besides false, possible falsy expressions are: null, nan, 0, the empty string (""), and undef...
...rted to false). description besides false, possible falsy expressions are: null, nan, 0, the empty string (""), and undefined. if condition is any of these, the result of the conditional expression will be the result of executing the expression expriffalse. ...
...alse, possible falsy expressions are: null, nan, 0, the empty string (""), and undefined. if condition is any of these, the result of the conditional expression will be the result of executing the expression expriffalse. ...
...And 8 more matches
function* - JavaScript
as callback hell and inversion of control. however, an even simpler solution to these problems can be achieved with async functions. calling a generator function does not execute its body immediately; an iterator object for the function is returned instead. when the iterator's next() method is called, the generator function's body is executed until the first yield expression, which specifies the value to be returned from the iterator or, with yield*, delegates to another generator function. the next() method returns an object with a value property containing the yielded value and a done property which indicates whether the generator has yielded its last value, as a boolean. calling the next() method with an argument will resume the generator function execution, replacing the yield expression w...
... the generator has yielded its last value, as a boolean. calling the next() method with an argument will resume the generator function execution, replacing the yield expression where an execution was paused with the argument from next(). a return statement in a generator, when executed, will make the generator finish (i.e. the done property of the object returned by it will be set to true). if a value is returned, it will be set as the value property of the object returned by the generator. much like a return statement, an error is thrown inside the generator will make the generator finished -- unless caught within the generator's body. ...
...f a value is returned, it will be set as the value property of the object returned by the generator. much like a return statement, an error is thrown inside the generator will make the generator finished -- unless caught within the generator's body. when a generator is finished, subsequent next() calls will not execute any of that generator's code, they will just return an object of this form: {value: undefined, done: true}. examples simple example function* idmaker() { var index = 0; while (true) yield index++; } var gen = idmaker(); console.log(gen.next().value); // 0 console.log(gen.next().value); // 1 console.log(gen.next().value); // 2 console.log(gen.next().value); // 3 // ... example with yield* function* anothergenerator(i) { yield i + 1; yield i + 2; yield i + 3;...
...And 8 more matches
operator - SVG: Scalable Vector Graphics
rode" radius="0.4"/> </filter> <filter id="dilate"> <femorphology operator="dilate" radius="0.8"/> </filter> <text x="0" y="15">normal text</text> <text x="0" y="40" filter="url(#erode)">thin text</text> <text x="0" y="65" filter="url(#dilate)">fat text</text> </svg> fecomposite for <fecomposite>, operator defines the compositing operation that is to be performed. ...
...ator="dilate" radius="0.8"/> </filter> <text x="0" y="15">normal text</text> <text x="0" y="40" filter="url(#erode)">thin text</text> <text x="0" y="65" filter="url(#dilate)">fat text</text> </svg> fecomposite for <fecomposite>, operator defines the compositing operation that is to be performed. ...
...">normal text</text> <text x="0" y="40" filter="url(#erode)">thin text</text> <text x="0" y="65" filter="url(#dilate)">fat text</text> </svg> fecomposite for <fecomposite>, operator defines the compositing operation that is to be performed. value over | in | out | atop | xor | lighter | arithmetic default value over animatable yes over this value indicates that the source graphic defined in the in attribute is placed over the destination graphic defined in the in2 attribute. ...
...And 8 more matches
<ellipse> - SVG: Scalable Vector Graphics
Web › SVG › Element › ellipse
re unable to 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. ...
...f 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. ...
...ilted 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. value type: <length>|<percentage> ; default value: 0; animatable: yes cy the y position of the ellipse. ...
...And 8 more matches
<svg> - SVG: Scalable Vector Graphics
Web › SVG › Element › svg
y,svg { height:100% } <svg viewbox="0 0 300 100" xmlns="http://www.w3.org/2000/svg" stroke="red" fill="grey"> <circle cx="50" cy="50" r="40" /> <circle cx="150" cy="50" r="4" /> <svg viewbox="0 0 10 10" x="200" width="100"> <circle cx="5" cy="5" r="4" /> </svg> </svg> attributes baseprofile deprecated since svg 2 the minimum svg language profile that the document requires. ...
...ewbox="0 0 300 100" xmlns="http://www.w3.org/2000/svg" stroke="red" fill="grey"> <circle cx="50" cy="50" r="40" /> <circle cx="150" cy="50" r="4" /> <svg viewbox="0 0 10 10" x="200" width="100"> <circle cx="5" cy="5" r="4" /> </svg> </svg> attributes baseprofile deprecated since svg 2 the minimum svg language profile that the document requires. ...
...="150" cy="50" r="4" /> <svg viewbox="0 0 10 10" x="200" width="100"> <circle cx="5" cy="5" r="4" /> </svg> </svg> attributes baseprofile deprecated since svg 2 the minimum svg language profile that the document requires. value type: <string> ; default value: none; animatable: no contentscripttype deprecated since svg 2 the default scripting language used by the svg fragment. ...
...And 8 more matches
JavaScript crypto - Archive of obsolete content
apped encryption private key to kra kra sends escrow verification back to ca ca creates and signs certificates ca sends certificates back to the user (importusercertificates) typical use the ca's enrollment page could look something like this: <!doctype html> <h2>request a cert</h2> <form name="reqform" method="post" action="http://your.ra.site.org"> <p><input type=hidden name=cert_request value=""> <p>name: <input type=text name=name value=""> <p>password: <input type=password name="password" value=""> <p><input type=submit name="send" value="submit"> </form> <script> /* the following values could be filled in by the server cgi */ var authenticator = "server_magic"; var keytransportcert = null; var crmfobject = null; var form = document.forms[0]; function validate() { // generate key...
...ubmit name="send" value="submit"> </form> <script> /* the following values could be filled in by the server cgi */ var authenticator = "server_magic"; var keytransportcert = null; var crmfobject = null; var form = document.forms[0]; function validate() { // generate keys for nsm. ...
...bmit"> </form> <script> /* the following values could be filled in by the server cgi */ var authenticator = "server_magic"; var keytransportcert = null; var crmfobject = null; var form = document.forms[0]; function validate() { // generate keys for nsm. ...
...And 7 more matches
RDF Modifications - Archive of obsolete content
when the modification functions on the datasource are called. there are four such functions: 'assert', to add a new triple (or arrow) to the rdf graph, 'unassert' to remove a triple, 'change' to adjust the target of a triple, and 'move' to adjust the source of a 'triple'. for mozilla's datasources, the latter two just unassert the old triple and add a new one, creating the effect of changing the value. however, only one notification is made. for instance, an assert call looks like the following: var source = rdf.getresource("http://www.xulplanet.com/ndeakin/images/t/obelisk.jpg"); var predicate = rdf.getresource("http://purl.org/dc/elements/1.1/description"); var target = rdf.getliteral("one of the thirty or so egyptian obelisks"); datasource.assert(source, predicate, target, true); the asse...
...chanism of the change. the template builder will need to check all of the queries and rules to see if this triple could cause a change in what would be displayed. if the triple wouldn't cause any change in the output, the builder won't make any changes. if the output would change, the builder will need to adjust the output, either by adding a new result, removing an old result, or by changing the value of some part of the result. the builder is smart enough to only change what needs to be changed and leave the remaining parts alone. let's assume we have single query with as follows: <query> <content uri="?start"/> <member container="?start" child="?photo"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> <triple sub...
...e change, and moves on to the next step. if the predicate was different, the builder would come to the end of the statements and could just stop there. for instance, if the predicate of the triple being added was 'http://purl.org/dc/elements/1.1/date', the builder could ignore it since the template doesn't even care about the date field. similarly, if the triple didn't use a variable but a static value, this value would also need to match in order to continue processing. now that we know the statements could cause a change in the template, the second step is to fill in the variables for this statement for what could potentially be a new result. in this situation, it fills in the ?photo and ?description variables using the values from the newly added triple. (?photo = http://www.xulplanet.com/n...
...And 7 more matches
Adding Methods to XBL-defined Elements - Archive of obsolete content
arameter-name2"/> . . . <body> <-- method script goes here --> </body> </method> </implementation> a method declaration goes inside the implementation element, like the fields and properties do. the method element contains two type of child elements, parameter elements which describe the parameters to the method and body which contains the script for the method. the value of the name attribute becomes the name of the method. similarly, the name attributes on the parameter elements become the names of each parameter. each parameter element is used to declare one parameter for the method. for example, if the method had three parameters, there would be three parameter elements. you do not need to have any though, in which case the method would take no parameters. th...
...note that the less-than symbol has to be escaped because otherwise it would look like the start of a tag. you can also use a cdata section to escape the entire block of code. you can call the method by using code such as element.getmaximum(5, 10) where element is a reference to an element defined by the xbl containing the getmaximum method. (the bound e...
...re is a special way of getting this anonymous content. elements with an xbl behavior attached to them have a special property which holds an array of the anonymous child elements inside it. each element of the array stores each direct child element of the xbl-defined element. this special property cannot be accessed directly. instead, you must call the document's getanonymousnodes() method: var value=document.getanonymousnodes(element); here, 'element' should be set to a reference to the element that you want to get the anonymous content of. the function returns an array of elements, which is the anonymous content. to get elements below that, you can use the regular dom functions because they aren't hidden. note that it is possible for an xbl-bound element to be placed inside another one, in...
...And 7 more matches
Focus and Selection - Archive of obsolete content
es by adding an onfocus or onblur attribute on an element. they work just like their html counterparts. you might use these event handlers to highlight the element or display text on a status bar. the following example can be used to apply a function to handle a focus event. example 2 : source view <script> function displayfocus(){ var elem=document.getelementbyid('sbar'); elem.setattribute('value','enter your phone number.'); } </script> <textbox id="tbox1"/> <textbox id="tbox2" onfocus="displayfocus();"/> <description id="sbar" value=""/> the focus event, when it occurs, will call the displayfocus function. this function will change the value of the text label. we could extend this example to remove the text when the blur event occurs. typically, you will use focus and blur events to ...
...don't display an alert during a focus or blur event as this will be distracting for the user and is poor user interface design. you can also add event handlers dynamically using the dom function addeventlistener. you can use it for any element and event type. ...
...don't display an alert during a focus or blur event as this will be distracting for the user and is poor user interface design. you can also add event handlers dynamically using the dom function addeventlistener. you can use it for any element and event type. ...
...And 7 more matches
Templates - Archive of obsolete content
okmarks datasource. this datasource is provided by mozilla. to use your own datasource, specify the url of an rdf file for the datasources attribute, as indicated in the example below: <box datasources="chrome://zoo/content/animals.rdf" ref="http://www.some-fictitious-zoo.com/all-animals"> you can even specify multiple datasources at a time by separating them with a space in the attribute value. ...
...ox datasources="chrome://zoo/content/animals.rdf" ref="http://www.some-fictitious-zoo.com/all-animals"> you can even specify multiple datasources at a time by separating them with a space in the attribute value. this can be used to display data from multiple sources. the ref attribute indicates where in the datasource you would like to retrieve data from. in the case of the bookmarks, the value nc:bookmarksroot is used to indicate the root of the bookmarks hierarchy. other values that you can use will depend on the datasource you are using. if you are using your own rdf file as a datasource, the value will usually correspond to the value of an about attribute on an rdf bag, seq or alt element. inside the template by adding these two attributes to the box above, it allows the generatio...
...urce, the value will usually correspond to the value of an about attribute on an rdf bag, seq or alt element. inside the template by adding these two attributes to the box above, it allows the generation of elements using the template. however, the elements inside the template need to be declared differently. you may notice in the example above that the button has a uri attribute and an unusual value for the label attribute. an attribute value inside the template that begins with 'rdf:' indicates that the value should be taken from the datasource. in the example earlier, this is the case for the label attribute. the remainder of the value refers to the name property in the datasource. it is constructed by taking the namespace url used by the datasource and appending the property name. if you...
...And 7 more matches
XBL Example - Archive of obsolete content
<xul:button xbl:inherits="label=previoustext"/> <xul:label flex="1"/> <xul:button xbl:inherits="label=nexttext"/> </xul:hbox> </xul:vbox> </content> </binding> this binding creates the slideshow structure that we want. the flex attribute has been added to a number of elements so that it stretches in the right way. the label attributes on the two buttons inherit their values from the bound element. here, they inherit from two custom attributes, previoustext and nexttext. this makes it easy to change the labels on the buttons. the children of the element that the xbl is bound to will be placed inside the deck. the selectedindex is inherited by the deck, so we may set the initial page in the xul. the following xul file produces the result in the image. <box class="s...
...oduces the result in the image. <box class="slideshow" previoustext="previous" nexttext="next" flex="1"> <button label="button 1"/> <checkbox label="checkbox 2"/> <textbox/> </box> the style sheet used here is: .slideshow { -moz-binding: url("slideshow.xml#slideshow"); } the first button, button 1 has been used as the first page of the deck. the label widget has not appeared as no value has been specified for it. we could set a value, but instead it will calculated later. page property next, a property that holds the current page will be added. when getting this custom property, it will need to retrieve the value of the selectedindex attribute of the deck, which holds the number of the currently displayed page. similarly, when setting this property, it will need to change the ...
...similarly, when setting this property, it will need to change the selectedindex attribute of the deck. in addition, the text widget will need to be updated to display which page is the current one. <property name="page" onget="return parseint(document.getanonymousnodes(this)[0].childnodes[0].getattribute('selectedindex'));" onset="return this.setpage(val);"/> the page property gets its value by looking at the first element of the anonymous array. this returns the vertical box, so to get the deck, we need to get the first child node of the box. the anonymous array isn't used as the deck is not anonymous from the box. finally, the value of the selectedindex attribute is retrieved. to set the page, a method 'setpage' is called which will be defined later. an oncommand handler will need...
...And 7 more matches
Widget Cheatsheet - Archive of obsolete content
see the periodic table of xul for more examples. ...
... see the periodic table of xul for more examples. ...
... see the periodic table of xul for more examples. ...
...And 7 more matches
Accessibility/XUL Accessibility Reference - Archive of obsolete content
this table is designed to show how to expose text properly for various xul element types. sections in bold are to draw attention to pieces that are often overlooked for visual layouts. underlined text may be read by the screen reader. element enabled usage comments description <description value="<!-- text -->" /> <description><!--label text--></description> use for non-label text. although tutorials claim label and description have the same underlying implementation, description elements appear to not associate correctly with controls whereas labels do. label <label control="controlid" value="<!--label text-->" /> <label control="controlid"><!--label text--></label> either syntax is fine. button <bu...
...s labels do. label <label control="controlid" value="<!--label text-->" /> <label control="controlid"><!--label text--></label> either syntax is fine. ...
...="controlid" value="<!--label text-->" /> <label control="controlid"><!--label text--></label> either syntax is fine. button <button label="<!--button text-->" /> <button id="butwrap1"> <label control="butwrap1"> <!--wrapped label--> </label> </button> <button id='butwrap2'> <label control="butwrap2" value="<!--this-->" /> <label control="butwrap2" value="is" /> <label control="butwrap2" value="a" /> <label control="butwrap2" value="button" /> </button> <button image="images/img.xbm" tooltiptext="<!--button text-->"/> note that in the third example, only the first label is read browser jaws 7.10 issues to use a browser element with html, the type="content" attribute should be specified. however, this attribute caus...
...And 7 more matches
datepicker - Archive of obsolete content
te. three types are available, which can be specified using the type attribute. normal - a datepicker with three fields for entering the year, month and date. grid - a datepicker with a calendar grid for selecting a date. popup - a normal datepicker with three fields, but with an additional dropdown button to display a popup grid. there are several ways to set the selected day. in xul, the value attribute may be set to a value of the form yyyy-mm-dd to initialize the datepicker to a certain date. if not specified, the datepicker defaults to the current day. to change the selected date, the value property may be used to set a new value in the form yyyy-mm-dd. the datevalue property may be used to retrieve and set the date using a date object. in addition, the date, month and year propert...
...however, as described in mozilla bug #799219, a change event handler may encounter erratic behavior when the date is changed using the keyboard instead of the mouse. ...
...se. to avoid this, you can use the workaround described here, i.e., use window.settimeout(actual-event-handler-function, 0); to queue up your event handler to run after the rest of the picker's change event handlers. a monthchange event is fired for the grid and popup datepickers whenever a new month is navigated to or displayed. attributes disabled, firstdayofweek, readonly, type, tabindex, value properties date, dateleadingzero, datevalue, disabled, month, monthleadingzero, open, readonly, tabindex, value, year, yearleadingzero examples <datepicker type="grid" value="2007-03-26"/> attributes disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out te...
...And 7 more matches
tab - Archive of obsolete content
Archive › Mozilla › XUL › tab
elated ] a single tab which should be placed inside a tabs element. the user may click a tab to bring the associated page of the tabbox to the front. more information is available in the xul tutorial. attributes accesskey, afterselected, beforeselected, command, crop, disabled, first-tab, image, label, last-tab, linkedpanel, oncommand, pending, pinned, selected, tabindex, unread, validate, value properties accesskey, accessibletype, command, control, crop, disabled, image, label, linkedpanel, selected, tabindex, value examples (example needed) attributes accesskey type: character this should be set to a character that is used as a shortcut key. this should be one of the characters that appears in the label attribute for the element. afterselected type: ...
...appearance of the area around the selected tab. beforeselected type: boolean this is set to true if the tab is immediately before the currently selected tab. this is set automatically set when needed and you shouldn't adjust it manually. this is primarily useful for themes so that they can adjust the appearance of the area around the selected tab. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right sid...
...th the start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. ...
...And 7 more matches
where - Archive of obsolete content
Archive › Mozilla › XUL › where
« xul reference home [ examples | attributes | properties | methods | related ] indicate a condition that must match for a template result to be used. if the condition is true, the corresponding action body is generated; otherwise the result is ignored and no content is generated. for more information, see where elements. attributes ignorecase, multiple, negate, rel, subject, value examples (example needed) attributes ignorecase type: boolean set to true to indicate that the case does not matter when making comparisons. otherwise, the default value is false, to indicate that the value should match with the same case. multiple type: boolean set to true to indicate that the value contains multiple values separated by commas. any of the values may match. oth...
... needed) attributes ignorecase type: boolean set to true to indicate that the case does not matter when making comparisons. otherwise, the default value is false, to indicate that the value should match with the same case. multiple type: boolean set to true to indicate that the value contains multiple values separated by commas. any of the values may match. otherwise, the entire value string is compared. negate type: boolean set to true to indicate that the comparison should be reversed. the where clause matches if the condition is false, and does not match if the condition is true. ...
...e type: boolean set to true to indicate that the value contains multiple values separated by commas. any of the values may match. otherwise, the entire value string is compared. negate type: boolean set to true to indicate that the comparison should be reversed. the where clause matches if the condition is false, and does not match if the condition is true. rel type: one of the values below the type of comparison to perform. equals the subject and value must match exactly. ...
...And 7 more matches
NPAPI plugin reference - Archive of obsolete content
browser to repaint part of the window, and so forth. the names of all of these methods begin with npn_ to indicate that they are implemented by the browser and called by the plug-in. np_getmimedescription np_getmimedescription returns a supported mime type list for your plugin. it works on unix (linux) and macos. on windows you have to define supported mimetypes in the dll resource file. np_getvalue allows the browser to query the plug-in for information. np_initialize provides global initialization for a plug-in. np_port contains information required by the window field of an npwindow structure. np_shutdown provides global deinitialization for a plug-in. npanycallbackstruct contains information required during embedded mode printing. npapi plug-in side api this chapter describes ...
... npn_evaluate evaluates a script in the scope of the specified npobject. npn_forceredraw asks the plugin host to immediately (synchronously) repaint invalid areas. npn_getauthenticationinfo the function is called by plugins to get http authentication information from the browser. npn_getintidentifier returns an opaque identifier for the integer that is passed in. npn_getproperty gets the value of a property on the specified npobject. npn_getstringidentifier returns an opaque identifier for the string that is passed in. npn_getstringidentifiers returns an array of opaque identifiers for the names that are passed in. npn_geturl asks the browser to create a stream for the specified url. npn_geturlnotify requests creation of a new stream with the contents of the specified url; gets...
...ect. npn_getstringidentifier returns an opaque identifier for the string that is passed in. npn_getstringidentifiers returns an array of opaque identifiers for the names that are passed in. npn_geturl asks the browser to create a stream for the specified url. npn_geturlnotify requests creation of a new stream with the contents of the specified url; gets notification of the result. npn_getvalue allows the plug-in to query the browser for information. npn_getvalueforurl provides information to a plugin which is associated with a given url, for example the cookies or preferred proxy. npn_hasmethod determines whether or not the specified npobject has a particular method. npn_hasproperty determines whether or not the specified npobject has a particular property. npn_identifierisstri...
...And 7 more matches
-moz-border-bottom-colors - Archive of obsolete content
in mozilla applications like firefox, the -moz-border-bottom-colors css property sets a list of colors for the bottom border. /* single <color> value */ -moz-border-bottom-colors: #f0f0f0; /* multiple <color> values */ -moz-border-bottom-colors: #f0f0f0 #a0a0a0 #505050 #000000; /* global values */ -moz-border-bottom-colors: inherit; -moz-border-bottom-colors: initial; -moz-border-bottom-colors: unset; when an element has a border that is larger than a single css pixel, each line of pixels uses the next color specified in this property, from the outside in. this eliminates the need for nested boxes. ...
...er-bottom-colors: initial; -moz-border-bottom-colors: unset; when an element has a border that is larger than a single css pixel, each line of pixels uses the next color specified in this property, from the outside in. this eliminates the need for nested boxes. if the border is wider than the number of specified colors, the remaining part of the border is the innermost color specified. initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete it does not apply if border-style is dashed or dotted. to tables with border-collapse: collapse. syntax values accepts a white-space separated list of color values. <color> specifies the color of a line of pixels of the bottom border. transparent is valid. see <color> values for possible units. none...
...ies the color of a line of pixels of the bottom border. transparent is valid. see <color> values for possible units. none default, no colors are drawn or border-color is used, if specified. ...
...And 7 more matches
-moz-border-left-colors - Archive of obsolete content
in mozilla applications like firefox, the -moz-border-left-colors css property sets a list of colors for the left border. /* single <color> value */ -moz-border-left-colors: #f0f0f0; /* multiple <color> values */ -moz-border-left-colors: #f0f0f0 #a0a0a0 #505050 #000000; /* global values */ -moz-border-left-colors: inherit; -moz-border-left-colors: initial; -moz-border-left-colors: unset; when an element has a border that is larger than a single css pixel, each line of pixels uses the next color specified in this property, from the outside in. this eliminates the need for nested boxes. ...
...border-left-colors: initial; -moz-border-left-colors: unset; when an element has a border that is larger than a single css pixel, each line of pixels uses the next color specified in this property, from the outside in. this eliminates the need for nested boxes. if the border is wider than the number of specified colors, the remaining part of the border is the innermost color specified. initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete it does not apply if border-style is dashed or dotted. to tables with border-collapse: collapse. syntax values accepts a white-space separated list of color values. <color> specifies the color of a line of pixels of the left border. transparent is valid. see <color> values for possible units. none ...
...ifies the color of a line of pixels of the left border. transparent is valid. see <color> values for possible units. none default, no colors are drawn or border-color is used, if specified. ...
...And 7 more matches
-moz-border-right-colors - Archive of obsolete content
in mozilla applications like firefox, the -moz-border-right-colors css property sets a list of colors for the right border. /* single <color> value */ -moz-border-right-colors: #f0f0f0; /* multiple <color> values */ -moz-border-right-colors: #f0f0f0 #a0a0a0 #505050 #000000; /* global values */ -moz-border-right-colors: inherit; -moz-border-right-colors: initial; -moz-border-right-colors: unset; when an element has a border that is larger than a single css pixel, each line of pixels uses the next color specified in this property, from the outside in. this eliminates the need for nested boxes. ...
...rder-right-colors: initial; -moz-border-right-colors: unset; when an element has a border that is larger than a single css pixel, each line of pixels uses the next color specified in this property, from the outside in. this eliminates the need for nested boxes. if the border is wider than the number of specified colors, the remaining part of the border is the innermost color specified. initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete it does not apply if border-style is dashed or dotted. to tables with border-collapse: collapse. syntax values accepts a white-space separated list of color values. <color> specifies the color of a line of pixels of the right border. transparent is valid. see <color> values for possible units. none ...
...fies the color of a line of pixels of the right border. transparent is valid. see <color> values for possible units. none default, no colors are drawn or border-color is used, if specified. ...
...And 7 more matches
-moz-border-top-colors - Archive of obsolete content
in mozilla applications like firefox, the -moz-border-top-colors css property sets a list of colors for the top border. /* single <color> value */ -moz-border-top-colors: #f0f0f0; /* multiple <color> values */ -moz-border-top-colors: #f0f0f0 #a0a0a0 #505050 #000000; /* global values */ -moz-border-top-colors: inherit; -moz-border-top-colors: initial; -moz-border-top-colors: unset; when an element has a border that is larger than a single css pixel, each line of pixels uses the next color specified in this property, from the outside in. this eliminates the need for nested boxes. ...
...z-border-top-colors: initial; -moz-border-top-colors: unset; when an element has a border that is larger than a single css pixel, each line of pixels uses the next color specified in this property, from the outside in. this eliminates the need for nested boxes. if the border is wider than the number of specified colors, the remaining part of the border is the innermost color specified. initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete it does not apply if border-style is dashed or dotted. to tables with border-collapse: collapse. syntax values accepts a white-space separated list of color values. <color> specifies the color of a line of pixels of the top border. transparent is valid. see <color> values for possible units. none d...
...cifies the color of a line of pixels of the top border. transparent is valid. see <color> values for possible units. none default, no colors are drawn or border-color is used, if specified. ...
...And 7 more matches
WAI-ARIA basics - Learn web development
e or more hidden links at the top of the page to link to the navigation (or whatever else), for example: <a href="#hidden" class="hidden">skip to navigation</a> but this is still not very precise, and can only be used when the screenreader is reading from the top of the page. as another example, apps started to feature complex controls like date pickers for choosing dates, sliders for choosing values, etc. html5 provides special input types to render such controls: <input type="date"> <input type="range"> these are not well-supported across browsers, and it is also difficult to style them, making them not very useful for integrating with website designs. as a result, developers quite often rely on javascript libraries that generate such controls as a series of nested <div>s or table elemen...
...t applications) is a specification written by the w3c, defining a set of additional html attributes that can be applied to elements to provide additional semantics and improve accessibility wherever it is lacking. there are three main features defined in the spec: roles — these define what an element is or does. many of these are so-called landmark roles, which largely duplicate the semantic value of html5 structural elements e.g. role="navigation" (<nav>) or role="complementary" (<aside>), but there are also others that describe different pages structures, such as role="banner", role="search", role="tabgroup", role="tab", etc., which are commonly found in uis. properties — these define properties of elements, which can be used to give them extra meaning or semantics. as an example, ari...
...ts ui widgets as an important factor when making your choice. good examples are jquery ui (see about jquery ui: deep accessibility support), extjs, and dojo/dijit. when should you use wai-aria? we talked about some of the problems that prompted wai-aria to be created earlier on, but essentially, there are four main areas that wai-aria is useful in: signposts/landmarks: aria's role attribute values can act as landmarks that either replicate the semantics of html5 elements (e.g. <nav>), or go beyond html5 semantics to provide signposts to different functional areas, e.g search, tabgroup, tab, listbox, etc. dynamic content updates: screenreaders tend to have difficulty with reporting constantly changing content; with aria we can use aria-live to inform screenreader users when an area of con...
...And 7 more matches
Styling lists - Learn web development
ample, we've set the ordered list to use uppercase roman numerals, with: ol { list-style-type: upper-roman; } this gives us the following look: you can find a lot more options by checking out the list-style-type reference page. bullet position the list-style-position property sets whether the bullets appear inside the list items, or outside them before the start of each item. the default value is outside, which causes the bullets to sit outside the list items, as seen above. if you set the value to inside, the bullets will sit inside the lines: ol { list-style-type: upper-roman; list-style-position: inside; } using a custom bullet image the list-style-image property allows you to use a custom image for your bullet. the syntax is pretty simple: ul { list-style-image: url(st...
...er). we are using a size of 1.6rem (16px), which fits very nicely with the 20px padding we've allowed for the bullet to sit inside — 16px plus 4px of space between the bullet and the list item text works well. background-repeat: by default, background images repeat until they fill up the available background space. we only want one copy of the image inserted in each case, so we set this to a value of no-repeat. this gives us the following result: list-style shorthand the three properties mentioned above can all be set using a single shorthand property, list-style. for example, the following css: ul { list-style-type: square; list-style-image: url(example.png); list-style-position: inside; } could be replaced by this: ul { list-style: square url(example.png) inside; } ...
...o-repeat. this gives us the following result: list-style shorthand the three properties mentioned above can all be set using a single shorthand property, list-style. for example, the following css: ul { list-style-type: square; list-style-image: url(example.png); list-style-position: inside; } could be replaced by this: ul { list-style: square url(example.png) inside; } the values can be listed in any order, and you can use one, two or all three (the default values used for the properties that are not included are disc, none, and outside). if both a type and an image are specified, the type is used as a fallback if the image can't be loaded for some reason. controlling list counting sometimes you might want to count differently on an ordered list — e.g. starting from ...
...And 7 more matches
HTML forms in legacy browsers - Learn web development
ame time. when you build something for a modern browser, and you want to be sure it will work, one way or another, on legacy browsers, you are performing graceful degradation. let's see some examples related to html forms. html input types the input types added in html5 are all useable, even in ancient browsers, because the way they degrade is highly predictable. ...
...e it will work, one way or another, on legacy browsers, you are performing graceful degradation. let's see some examples related to html forms. html input types the input types added in html5 are all useable, even in ancient browsers, because the way they degrade is highly predictable. if a browser does not know the value of the type attribute of an <input> element, it will fall back as if the value were text. ...
...does not know the value of the type attribute of an <input> element, it will fall back as if the value were text. ...
...And 7 more matches
The Firefox codebase: CSS Guidelines
here are some basic tips that can optimize reviews if you are changing css: avoid !important but if you have to use it, make sure it's obvious why you're using it (ideally with a comment). the overriding css section contains more information about this. avoid magic numbers; prefer automatic sizing or alignment methods. some examples to avoid: absolutely positioned elements hardcoded values such as: vertical-align: -2px; . the reason you should avoid such "hardcoded" values is that, they don't necessarily work for all font-size configurations. avoid setting styles in javascript. it's generally better to set a class and then specify the styles in css. classlist is generally better than classname. there's less chance of overwriting an existing class. only use generic selector...
...ou are styling reuses some styles from another element, this allows the maintenance cost and the amount of code duplication to be reduced. formatting spacing & indentation 2 spaces indentation is preferred add a space after each comma, except within color functions: linear-gradient(to bottom, black 1px, rgba(255,255,255,0.2) 1px) always add a space before !important. omit units on 0 values do this: margin: 0; not this: margin: 0px; use expanded syntax it is often harder to understand what the shorthand is doing and the shorthand can also hide some unwanted default values. it is good to privilege expanded syntax to make your intentions explicit. do this: border-color: red; not this: border: red; put multiple selectors on different lines do this: h1, h2, ...
...[disabled]). however, never try to increase the selector of the rule you are adding as it can easily become hard to understand. finally, once you have checked all the things above, you can permit yourself to use !important along with a comment why it is needed. using css variables adding new variables before adding new css variables, please consider the following questions: is the variable value changed at runtime? (either from javascript or overriden by another css file) if the answer is no, consider using a preprocessor variable or simply inlining the value. is the variable value used multiple times? if the answer is no and the value isn't changed at runtime, then you likely don't need a css variable. is there an alternative to using the variable like inheriting o...
...And 7 more matches
Python binding for NSS
jects which are collections support the python iteration protocol. in other words they can be iterated over, indexed by position, or used as slices. nss/nspr objects whose collection elements can be referenced by name support associative indexing. nss/nspr objects which have "get" and "set" api function calls are exposed as python properties. ...
...examples of this are the various callbacks which can be set and their parameters. thus each thread gets it own set of callbacks. many methods/functions provide sane default (keyword) parameters freeing the python programmer from having to specify all parameters yet allowing them to be overriden when necessary. ...
... is converted into a python exception and raised. the exact error code, error description, and often contextual error information will be present in the exception object. enumerated constants used in the nss/nspr api's are available in the python module under the exact same name as they appear in the c header files of nss/nspr. convenience functions are provided to translate between the numeric value of an enumerated constant and it's string representation and visa versa. python-nss internally supports utf-8. strings may be python str objects or python unicode objects. if a python unicode object is passed to a nss/nspr function it will be encoded as utf-8 first before being passed to nss/nspr. python-nss tries to be flexible when generating a print representation of complex objects. for sim...
...And 7 more matches
NSS tools : certutil
litronic card) can store only one key pair. if you create a new key pair for such a card, the previous pair is overwritten. -h display a list of the options and arguments used by the certificate database tool. -k list the key id of keys in the key database. a key id is the modulus of the rsa key or the publicvalue of the dsa key. ids are displayed in hexadecimal ("0x" is not shown). -l list all the certificates, or display information about a named certificate, in a certificate database. use the -h tokenname argument to specify the certificate database on a particular hardware or software token. -m modify a certificate...
...s are displayed in hexadecimal ("0x" is not shown). -l list all the certificates, or display information about a named certificate, in a certificate database. use the -h tokenname argument to specify the certificate database on a particular hardware or software token. -m modify a certificate's trust attributes using the values of the -t argument. -n create new certificate and key databases. -o print the certificate chain. -r create a certificate request file that can be submitted to a certificate authority (ca) for processing into a finished certificate. output defaults to standard out unless you use -o output-file argument.
...ken is an internal slot. -i input_file pass an input file to the command. depending on the command option, an input file can be a specific certificate, a certificate request file, or a batch file of commands. -k rsa|dsa|ec|all specify the type of a key. the valid options are rsa, dsa, ecc, or all. the default value is rsa. specifying the type of key can avoid mistakes caused by duplicate nicknames. -k key-type-or-id specify the type or specific id of a key. the valid key type options are rsa, dsa, ec, or all. the default value is rsa. specifying the type of key can avoid mistakes caused by duplicate nicknames. giving a key type generates a new ...
...And 7 more matches
certutil
example, the litronic card) can store only one key pair. if you create a new key pair for such a card, the previous pair is overwritten. -h display a list of the options and arguments used by the certificate database tool. -k list the key id of keys in the key database. a key id is the modulus of the rsa key or the publicvalue of the dsa key. ids are displayed in hexadecimal ("0x" is not shown). -l list all the certificates, or display information about a named certificate, in a certificate database. use the -h tokenname argument to specify the certificate database on a particular hardware or software token. -m modify a certificate's trust attr...
...ids are displayed in hexadecimal ("0x" is not shown). -l list all the certificates, or display information about a named certificate, in a certificate database. use the -h tokenname argument to specify the certificate database on a particular hardware or software token. -m modify a certificate's trust attributes using the values of the -t argument. -n create new certificate and key databases. -o print the certificate chain. -r create a certificate request file that can be submitted to a certificate authority (ca) for processing into a finished certificate. output defaults to standard out unless you use -o output-file argument. us...
... 1 is used by cryptographic services. -i input_file pass an input file to the command. depending on the command option, an input file can be a specific certificate, a certificate request file, or a batch file of commands. -k rsa|dsa|ec|all specify the type of a key. the valid options are rsa, dsa, ecc, or all. the default value is rsa. specifying the type of key can avoid mistakes caused by duplicate nicknames. -k key-type-or-id specify the type or specific id of a key. giving a key type generates a new key pair; giving the id of an existing key reuses that key pair (which is required to renew certificates). -l display detailed information when validating ...
...And 7 more matches
SpiderMonkey Internals
this document is talking about partially obsolete things. design walk-through at heart, spidermonkey is a fast interpreter that runs an untyped bytecode and operates on values of type js::value—type-tagged values that represent the full range of javascript values. in addition to the interpreter, spidermonkey contains a just-in-time (jit) compiler, a garbage collector, code implementing the basic behavior of javascript values, a standard library implementing ecma 262-5.1 §15 with various extensions, and a few public apis. interpreter like many portable interpreters, spidermonkey's interpreter is mainly a single, tremendously long function that steps through the bytecode one instruction at a time, using a switch statement (or faster alternative, depending on the compiler) to jump to the...
...contains objects, including any functions defined in the source code, each of which has its own, nested script. the compiler consists of: a random-logic rather than table-driven lexical scanner, a recursive-descent parser that produces an ast, and a tree-walking code generator. semantic and lexical feedback are used to disambiguate hard cases such as missing semicolons, assignable expressions ("lvalues" in c parlance), and whether / is the division symbol or the start of a regular expression. the compiler attempts no error recovery; it bails out on the first error. the emitter does some constant folding and a few codegen optimizations; about the fanciest thing it does is to attach source notes to the script for the decompiler's benefit. the decompiler implements function.tosource(), which rec...
...matically only when maxbytes (as passed to js_newruntime) bytes of gc things have been allocated and another thing-allocation request is made. js api users should call js_gc or js_maybegc between script executions or from the operation callback, as often as necessary. because the gc is exact, c/c++ applications must ensure that all live objects, strings, and numbers are gc-reachable. ...
...And 7 more matches
JS::Call
this article covers features introduced in spidermonkey 17 call a specified js function. ...
... this article covers features introduced in spidermonkey 17 call a specified js function. ...
... this article covers features introduced in spidermonkey 17 call a specified js function. ...
...And 7 more matches
JS::CallArgs
this article covers features introduced in spidermonkey 17 helper class encapsulating access to the callee, this value, arguments, and argument count for a function call. syntax js::callargs js::callargsfromvp(unsigned argc, js::value *vp); name type description args unsigned number of argument. (2nd argument of jsnative) vp js::value * a pointer to the argument value array. (3nd argument of jsnative) methods methods of js::callargs method description bool requireatleast(jscontext *cx, const char *fnname, unsigned required) returns true if there are at least required arguments passed in. if false, it reports an error message on the context. methods inherited from js::callargsbase method ...
...thod description bool requireatleast(jscontext *cx, const char *fnname, unsigned required) returns true if there are at least required arguments passed in. if false, it reports an error message on the context. methods inherited from js::callargsbase method description unsigned length() const returns the number of arguments.. js::mutablehandlevalue operator[](unsigned i) const returns the i-th zero-indexed argument. js::handlevalue get(unsigned i) const returns the i-th zero-indexed argument, or undefined if there's no such argument. bool hasdefined(unsigned i) const returns true if the i-th zero-indexed argument is present and is not undefined. methods inherited from js::detail::callreceiverbase ...
...d if there's no such argument. bool hasdefined(unsigned i) const returns true if the i-th zero-indexed argument is present and is not undefined. methods inherited from js::detail::callreceiverbase method description jsobject &callee() const returns the function being called, as an object. ...
...And 7 more matches
Gecko object attributes
attributes used on dom element (i.e., any attribute prefixed by 'aria-') are exposed as object attributes; name is preserved except the 'aria-' prefix is cut. common attributes class the class name for an element from html, xul, svg, etc. this is useful for retrieving microformat semantics for an element. display similar with display css style. applied to: any visible accessible id any value, defined by ui/content developers. used to indicate a persistent identifier for any object; useful for scripting. applied to: any role which related dom node has id attribute tag the actual markup tag used to create this element (also used in xul). applied to: any role xml-roles if a dynamic content accessibility role string is used, it is exposed here. this may provide more information tha...
...mic content accessibility role string is used, it is exposed here. this may provide more information than the mapped role, which is best-fit. the role string may be a space-delimited list of roles. applied to: any role group attributes level for headings, the heading level. for outline items, the indentation level. for diagrams with levels, each item can have its level specified. the level value is 1-based. applied to: grid, heading, listitem, row, tablist exposed in aria: aria-level posinset if this item is in a group, what is the item number within the group, where the size is defined by the setsize attribute. the first item should have posinset="1", and the last item should have a posinset value equal to the setsize. applied to: listitem, option exposed in aria: aria-posinset s...
...d to: listitem, option exposed in aria: aria-setsize live region attribues atomic true when the entire region should be presented as a whole, when changes within it are considered important enough to automatically present. applied to: any role exposed via aria: aria-atomic live a hint as to whether changes within the current region or subtree should be automatically presented. possible values are "off" which is the same as not being set -- this means the region is not live. other possible values are "polite", "assertive", and "rude", which is a suggestion for the policy when interrupting the user for changes to this region. please see the aria states and properties module for more information. additional information may be provide by the object attributes atomic and relevant. applie...
...And 7 more matches
nsIAccessibleRetrieval
unsigned long astates, in unsigned long aextrastates); methods getaccessiblefor() return an nsiaccessible for a dom node in pres shell 0. create a new accessible of the appropriate type if necessary, or use one from the accessibility cache if it already exists. nsiaccessible getaccessiblefor( in nsidomnode anode ); parameters anode the dom node to get an accessible for. return value the nsiaccessible for the given dom node. getaccessibleinshell() return an nsiaccessible for a dom node in the given pres shell. create a new accessible of the appropriate type if necessary, or use one from the accessibility cache if it already exists. nsiaccessible getaccessibleinshell( in nsidomnode anode, in nsipresshell apresshell ); parameters anode the dom node to get an acces...
...n the given pres shell. create a new accessible of the appropriate type if necessary, or use one from the accessibility cache if it already exists. nsiaccessible getaccessibleinshell( in nsidomnode anode, in nsipresshell apresshell ); parameters anode the dom node to get an accessible for. apresshell the presentation shell which contains layout info for the dom node. return value the nsiaccessible for the given dom node. getaccessibleinweakshell() obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) return an nsiaccessible for a dom node in the given weak shell. create a new accessible of the appropriate type if necessary, or use one from the accessibility cache if it already exists. nsiaccessible getaccessibleinweakshell( in ...
...ven weak shell. create a new accessible of the appropriate type if necessary, or use one from the accessibility cache if it already exists. nsiaccessible getaccessibleinweakshell( in nsidomnode anode, in nsiweakreference apresshell ); parameters anode the dom node to get an accessible for. apresshell the presentation shell which contains layout info for the dom node. return value the nsiaccessible for the given dom node. getaccessibleinwindow() obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) return an nsiaccessible for a dom node in present shell for this dom window. create a new accessible of the appropriate type if necessary, or use one from the accessibility cache if it already exists. nsiaccessible getaccessibleinwindow...
...And 7 more matches
nsIAccessibleTable
w and column in the table. if both row and column index are valid then the corresponding accessible object is returned that represents the requested cell regardless of whether the cell is currently visible (on the screen). nsiaccessible getcellat( in long rowindex, in long columnindex ); parameters rowindex the row index of the cell. columnindex the column index of the cell. return value an nsiaccessible object. translate the given row and column indices into the corresponding cell index. long getcellindexat( in long rowindex, in long columnindex ); parameters rowindex the row index of the cell. columnindex the column index of the cell. return value a cell index. getcolumndescription() return the description text of the specified column in the table. astring ...
...x. long getcellindexat( in long rowindex, in long columnindex ); parameters rowindex the row index of the cell. columnindex the column index of the cell. return value a cell index. getcolumndescription() return the description text of the specified column in the table. astring getcolumndescription( in long columnindex ); parameters columnindex the column index. return value the column description. getcolumnextentat() return the number of columns occupied by the accessible cell at the specified row and column in the table. ...
... getrowandcolumnindicesat() translate the given cell index into the corresponding row and column indices. ...
...And 7 more matches
nsIAccessibleText
t); attributes attribute type description caretoffset long the current current caret offset. if set < 0 then caret will be placed at the end of the text. charactercount long read only. defaulttextattributes nsipersistentproperties return the text attributes that apply to the entire accessible. read only. selectioncount long read only. constants text offset constants constant value description text_offset_end_of_text -1 will be treated as the equal to the end of the text. text_offset_caret -2 will be treated as the caret position. text boundary constants constant value description boundary_char 0 boundary_word_start 1 boundary_word_end 2 boundary_sentence_start 3 do not use in new code. boundary_sentence_end 4 do not use in new code. boundary...
...art 3 do not use in new code. boundary_sentence_end 4 do not use in new code. boundary_line_start 5 boundary_line_end 6 boundary_attribute_range 7 coordinate type constants obsolete since gecko 1.9 (firefox 3)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. constant value description coord_type_screen 0 coord_type_window 1 methods addselection() void addselection( in long startoffset, in long endoffset ); parameters startoffset endoffset getattributerange() obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) get the accessible and start/end offsets around the given offset. this accessible get ret...
...efox 3.5 / thunderbird 3.0 / seamonkey 2.0) get the accessible and start/end offsets around the given offset. this accessible get return the dom node and layout frame with the uniform attributes for this range of text. nsiaccessible getattributerange( in long offset, out long rangestartoffset, out long rangeendoffset ); parameters offset rangestartoffset 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 re...
...And 7 more matches
nsIProtocolProxyService
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 fla...
...ing the http protocol handler, which also supports nsiproxiedprotocolhandler. nsiproxyinfo resolve( in nsiuri auri, in unsigned long aflags ); parameters auri the uri to test. aflags a bit-wise combination of the resolve_ flags defined above. pass 0 to specify the default behavior. any additional bits that do not correspond to a resolve_ flag are reserved for future use. return value an nsiproxyinfo object or null for a direct connection. note: if pac is configured, and the pac file has not yet been loaded, then this method will return a nsiproxyinfo instance with a type of "unknown" to indicate to the consumer that asyncresolve should be used to wait for the pac file to finish loading. otherwise, the consumer may choose to treat the result as type "direct" if desired. see ...
...iuri auri, in unsigned long aflags, in nsiprotocolproxycallback acallback ); parameters auri the uri to test. aflags a bit-wise combination of the resolve_ flags defined above. pass 0 to specify the default behavior. any additional bits that do not correspond to a resolve_ flag are reserved for future use. acallback the object to be notified when the result is available. return value an nsicancelableobject that can be used to cancel the asynchronous operation. if canceled, the cancellation status (areason) will be forwarded to the callback's nsiprotocolproxycallback.onproxyavailable() method via the astatus parameter. newproxyinfo() this method may be called to construct a nsiproxyinfo instance from the given parameters. this method may be useful in conjunction with nsisoc...
...And 7 more matches
nsITelemetry
nsisupports getloadedmodules(); jsval snapshotkeyedhistograms(in uint32_t adataset, in boolean asubsession, in boolean aclear); void sethistogramrecordingenabled(in acstring id, in boolean enabled); void asyncfetchtelemetrydata(in nsifetchtelemetrydatacallback acallback); double mssinceprocessstart(); void scalaradd(in acstring aname, in jsval avalue); void scalarset(in acstring aname, in jsval avalue); void scalarsetmaximum(in acstring aname, in jsval avalue); jsval snapshotscalars(in uint32_t adataset, [optional] in boolean aclear); void keyedscalaradd(in acstring aname, in astring akey, in jsval avalue); void keyedscalarset(in acstring aname, in astring akey, in jsval avalue); void keye...
... void scalarsetmaximum(in acstring aname, in jsval avalue); jsval snapshotscalars(in uint32_t adataset, [optional] in boolean aclear); void keyedscalaradd(in acstring aname, in astring akey, in jsval avalue); void keyedscalarset(in acstring aname, in astring akey, in jsval avalue); void keyedscalarsetmaximum(in acstring aname, in astring akey, in jsval avalue); jsval snapshotkeyedscalars(in uint32_t adataset, [optional] in boolean aclear); void clearscalars(); test only void flushbatchedchildtelemetry(); void recordevent(in acstring acategory, in acstring amethod, in acstring aobject, [optional] in jsval avalue, [optional] in jsval extra); void seteventrecordingenabled(in acstring acategory, in boolean aena...
...ther mechanisms. histogramsnapshots jsval an object containing a snapshot from all of the currently registered histograms. { name1: {data1}, name2:{data2}...} where data consists of the following properties: min - minimal bucket size max - maximum bucket size histogram_type - histogram_exponential or histogram_linear counts - an array representing the values of buckets in the histogram. ranges - an array with corresponding bucket sizes. sum - sum of the counts array. static - true for histograms defined in histograms.json, false for ones defined with newhistogram(). read only. constants histogram types constant value description histogram_exponential 0 buckets increase exponentially. ...
...And 7 more matches
nsIWritablePropertyBag2
xpcom/ds/nsiwritablepropertybag2.idlscriptable this interface extends nsipropertybag2 with methods for setting properties. ...
...idlscriptable this interface extends nsipropertybag2 with methods for setting properties. ...
... properties. ...
...And 7 more matches
Reference Manual
scomptr. an nscomptr is the exact same size and shape as a raw xpcom interface pointer. it can be used as a member variable without introducing bloat. most of the work of being an owning reference can be done in the constructor, destructor, and assignment operators of nscomptr. whenever you `point' the nscomptr at a different xpcom object (by assignment or initialization), it must release its old value, if any, and addref the new. at its own destructor time it must release as well. nscomptr only does exactly the work you would have done, if you always remembered to do the right thing. safety features type safeguards it is an invariant of nscomptr that it holds the xpcom-correct interface pointer for it's underlying type. for example, an nscomptr<nsifoo> will always hold the pointer that would b...
...compiled with the same setting of nscap_feature_debug_ptr_types, else some parts will be expecting a base class and others will not. the app will not link. unit tests the unit tests for nscomptr can be found in the file /xpcom/tests/testcomptr.cpp initialization and assignment built-in forms assignment into, or initialization of an nscomptr is easy to understand. ...
...ture_debug_ptr_types, else some parts will be expecting a base class and others will not. the app will not link. unit tests the unit tests for nscomptr can be found in the file /xpcom/tests/testcomptr.cpp initialization and assignment built-in forms assignment into, or initialization of an nscomptr is easy to understand. ...
...And 7 more matches
UInt64
as javascript doesn't currently include standard support for 64-bit integer values, js-ctypes offers the int64 and uint64 objects to let you work with c functions and data that need (or may need) to use data represented using a 64-bit data type. you use the uint64 object to create and manipulate 64-bit unsigned integers. note: it's important to note that the 64-bit integer objects created by uint64 are not uint64 objects; rather, they're opaque objects whose values you manipulate through the other methods on the uint64 object. see 64-bit integers for details. syntax creates and returns a new 64-bit unsigned integer. ...
... you use the uint64 object to create and manipulate 64-bit unsigned integers. note: it's important to note that the 64-bit integer objects created by uint64 are not uint64 objects; rather, they're opaque objects whose values you manipulate through the other methods on the uint64 object. see 64-bit integers for details. syntax creates and returns a new 64-bit unsigned integer. uint64 uint64( value ); parameters value the value to assign the new 64-bit unsigned integer object. this may be specified as an integer (if the value can be represented as a 32-bit value), another 64-bit integer object (either signed or unsigned), or as a string, which may consist of an optional minus sign, followed by either a decimal number or "0x" or "0x" followed by a hexadecimal number. the string is then...
...e new 64-bit unsigned integer object. this may be specified as an integer (if the value can be represented as a 32-bit value), another 64-bit integer object (either signed or unsigned), or as a string, which may consist of an optional minus sign, followed by either a decimal number or "0x" or "0x" followed by a hexadecimal number. the string is then converted into the corresponding 64-bit integer value. you can therefore use a string to represent a 64-bit value that is too large to represent as a 32-bit javascript number. return value a new object representing the specified value. exceptions thrown typeerror the specified value cannot be converted into a 64-bit integer. either it's not a number, string, or 64-bit integer object, or it's a string that is incorrectly formatted or contains...
...And 7 more matches
ctypes
similar to getlasterror under windows, available only for windows. cannot be set. constants abi constants these constants are used to specify the abi used to call a native function in the library. co...
...similar to getlasterror under windows, available only for windows. cannot be set. ...
...ion int8_t signed 8-bit integer. uint8_t unsigned 8-bit integer. int16_t signed 16-bit integer. uint16_t unsigned 16-bit integer. int32_t signed 32-bit integer. uint32_t unsigned 32-bit integer. int64_t signed 64-bit integer. uint64_t unsigned 64-bit integer. float32_t 32-bit floating-point value. float64_t 64-bit floating-point value. note: some 64-bit values are outside the range of numeric values supported by javascript. because of this, ctypes.int64 and ctypes.uint64 do not automatically convert to javascript numbers. instead, they convert to objects of the wrapper types ctypes.int64 and ctypes.uint64, which are javascript objects rather than cdata objects. see 64-b...
...And 7 more matches
Debugger.Memory - Firefox Developer Tools
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 debugger instance, then <i>dbg</i>.memory is a debugger.memory instance, which inherits the following accessor properties from its prototype: trackingallocationsites a boolean value indicating whether this debugger.memory instance is capturing the javascript execution stack when each object is allocated. this accessor property has both a getter and setter: assigning to it enables or disables the allocation site tracking. reading the accessor produces true if the debugger is capturing stacks for object allocations, and false otherwise. allocation site tracking is initially di...
...is 1, or logging every allocation. note that in the presence of multiple debugger instances observing the same allocations within a global’s scope, the maximum allocationsamplingprobability of all the debuggers is used. maxallocationsloglength the maximum number of allocation sites to accumulate in the allocations log at a time. this accessor can be both fetched and stored to. its default value is 5000. allocationslogoverflowed returns true if there have been more than [maxallocationsloglength][#max-alloc-log] allocations since the last time [drainallocationslog][#drain-alloc-log] was called and some data has been lost. returns false otherwise. debugger.memory handler functions similar to debugger’s handler functions, debugger.memory inherits accessor properties that store handle...
...t time [drainallocationslog][#drain-alloc-log] was called and some data has been lost. returns false otherwise. debugger.memory handler functions similar to debugger’s handler functions, debugger.memory inherits accessor properties that store handler functions for spidermonkey to call when given events occur in debuggee code. ...
...And 7 more matches
AudioBufferSourceNode.playbackRate - Web APIs
the playbackrate property of the audiobuffersourcenode interface is a k-rate audioparam that defines the speed at which the audio asset will be played. a value of 1.0 indicates it should play at the same speed as its sampling rate, values less than 1.0 cause the sound to play more slowly, while values greater than 1.0 result in audio playing faster than normal. the default value is 1.0. when set to another value, the audiobuffersourcenode resamples the audio before sending it to the output. syntax audiobuffersourcenode.playbackrate.value = playbackrateproportion; value an audioparam whose value is a floating-point value indicating the playback rate of the audio as a decimal proportion of the original sampling rate. consider a sound buffer containing audio sampled at 44.1 khz (44,100 s...
... a playbackrate of 0.5 plays the audio at half speed, or 22,050 hz. a playbackrate of 2.0 doubles the audio's playback rate to 88,200 hz. ...
...krate of 0.5 plays the audio at half speed, or 22,050 hz. a playbackrate of 2.0 doubles the audio's playback rate to 88,200 hz. example in this example, the audiocontext.decodeaudiodata() function is used to decode an audio track, and put it into an audiobuffersourcenode. ...
...And 7 more matches
AudioListener.forwardX - Web APIs
example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
... example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
... example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
...And 7 more matches
AudioListener.forwardY - Web APIs
example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
... example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
... example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
...And 7 more matches
AudioListener.forwardZ - Web APIs
example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
... example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
... example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
...And 7 more matches
AudioListener.upX - Web APIs
Web › API › AudioListener › upX
example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
... example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
... example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
...And 7 more matches
AudioListener.upY - Web APIs
Web › API › AudioListener › upY
example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
... example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
... example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
...And 7 more matches
AudioListener.upZ - Web APIs
Web › API › AudioListener › upZ
example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
... example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
... example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
...And 7 more matches
Background Tasks API - Web APIs
tarttime = date.now(); return settimeout(function() { handler({ didtimeout: false, timeremaining: function() { return math.max(0, 50.0 - (date.now() - starttime)); } }); }, 1); } if window.requestidlecallback is undefined, we create it here. the function begins by recording the time at which our implementation was called. we'll be using that to compute the value returned by our shim for timeremaining(). then we call settimeout(), passing into it a function which runs the callback passed into our implementation of requestidlecallback(). the callback is passed an object which conforms to idledeadline, with didtimeout set to false and a timeremaining() method which is implemented to give the callback 50 milliseconds of time to begin with. each time timerem...
... well as a second main box (with the id "logbox"), which is used to display textual output. <p> demonstration of using <a href="/docs/web/api/background_tasks_api"> cooperatively scheduled background tasks</a> using the <code>requestidlecallback()</code> method. ...
...0 }); } schedulestatusrefresh(); } enqueuetask() accepts as input two parameters: taskhandler is a function which will be called to handle the task. taskdata is an object which is passed into the task handler as an input parameter, to allow the task to receive custom data. to enqueue the task, we push an object onto the tasklist array; the object contains the taskhandler and taskdata values under the names handler and data, respectively, then increment totaltaskcount, which reflects the total number of tasks which have ever been enqueued (we don't decrement it when tasks are removed from the queue). next, we check to see if we already have an idle callback created; if taskhandle is 0, we know there isn't an idle callback yet, so we call requestidlecallback() to create one. it's co...
...And 7 more matches
BiquadFilterNode.Q - Web APIs
example the following example shows basic usage of an audiocontext to create a biquad filter node. ...
... example the following example shows basic usage of an audiocontext to create a biquad filter node. ...
... example the following example shows basic usage of an audiocontext to create a biquad filter node. ...
...And 7 more matches
Examples of web and XML development using the DOM - Web APIs
e html> <html lang="en"> <head> <title>modifying an image border</title> <script> function setborderwidth(width) { document.getelementbyid("img1").style.borderwidth = width + "px"; } </script> </head> <body> <p> <img id="img1" src="image1.gif" style="border: 5px solid green;" width="100" height="100" alt="border test"> </p> <form name="formname"> <input type="button" value="make border 20px-wide" onclick="setborderwidth(20);" /> <input type="button" value="make border 5px-wide" onclick="setborderwidth(5);" /> </form> </body> </html> example 3: manipulating styles in this simple example, some basic style properties of an html paragraph element are accessed using the style object on the element and that object's css style properties, which can be retrieved and...
...their rules to change styles for whole documents. <!doctype html> <html lang="en"> <head> <title>changing color and font-size example</title> <script> function changetext() { var p = document.getelementbyid("pid"); p.style.color = "blue" p.style.fontsize = "18pt" } </script> </head> <body> <p id="pid" onclick="window.location.href = 'http://www.cnn.com/';">linker</p> <form> <p><input value="rec" type="button" onclick="changetext();" /></p> </form> </body> </html> example 4: using 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 ...
... #lumpy { display: none; } this script outputs the following: body p #lumpy example 5: event propagation this example demonstrates how events fire and are handled in the dom in a very simple way. when the body of this html document loads, an event listener is registered with the top row of the table. the event listener handles the event by executing the function stopevent, which changes the value in the bottom cell of the table. however, stopevent also calls an event object method, event.stoppropagation, which keeps the event from bubbling any further up into the dom. note that the table itself has an onclick event handler that ought to display a message when the table is clicked. but the stopevent method has stopped propagation, and so after the data in the table is updated, the event p...
...And 7 more matches
Element: mousewheel event - Web APIs
s operated. the mousewheel event was never part of any standard, and while it was implemented by several browsers, it was never implemented by firefox. important: instead of this obsolete event, use the standard wheel event. bubbles yes cancelable yes interface mousewheelevent event handler property onmousewheel the detail property the value of the detail property is always zero, except in opera, which uses detail similarly to the firefox-only dommousescroll event's detail value, which indicates the scroll distance in terms of lines, with negative values indicating the scrolling movement is either toward the bottom or toward the right, and positive values indicating scrolling to the top or left. note: on macos, the scroll distance ...
...erty is always zero, except in opera, which uses detail similarly to the firefox-only dommousescroll event's detail value, which indicates the scroll distance in terms of lines, with negative values indicating the scrolling movement is either toward the bottom or toward the right, and positive values indicating scrolling to the top or left. note: on macos, the scroll distance (and therefore the value of detail) is computed based on the accelerated scroll distance. on linux, 2 or -2 is set per native wheel event. wheeldelta, wheeldeltax and wheeldeltay value the wheeldelta attribute value is an abstract value which indicates how far the wheel turned. ...
...l distance (and therefore the value of detail) is computed based on the accelerated scroll distance. on linux, 2 or -2 is set per native wheel event. wheeldelta, wheeldeltax and wheeldeltay value the wheeldelta attribute value is an abstract value which indicates how far the wheel turned. if the wheel has rotated away from the user, it's positive, otherwise negative. this means that the delta value sign is different from dom level 3 event's wheel. however, the meaning of the amount of these values is not the same between browsers. see following explanation for the detail. ie and opera (presto) only support wheeldelta attribute and do not support horizontal scroll. the wheeldeltax attribute value indicates the wheeldelta attribute value along the horizontal axis. when a user operates the d...
...And 7 more matches
HTMLFormElement - Web APIs
r 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. ...
...lement. 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. ...
...ecting the number of controls in the form. htmlformelement.name a domstring reflecting the value of the form's name html attribute, containing the name of the form. htmlformelement.method a domstring reflecting the value of the form's method html attribute, indicating the http method used to submit the form. only specified values can be set. htmlformelement.target a domstring reflecting the value of the form's target html attribute, indicating where to display the results received from submitting the form. htmlformelement.action a domstring reflecting the value of the form's action html attribute, containing the uri of a program that processes the information submitted by the form. ...
...And 7 more matches
HTMLInputElement.stepUp() - Web APIs
the htmlinputelement.stepup() method increments the value of a numeric type of <input> element by the value of the step attribute, or the default step value if the step attribute is not explicitly set. the method, when invoked, increments the value by (step * n), where n defaults to 1 if not specified, and step defaults to the default value for step if not specified. ...
...inputelement.stepup() method increments the value of a numeric type of <input> element by the value of the step attribute, or the default step value if the step attribute is not explicitly set. the method, when invoked, increments the value by (step * n), where n defaults to 1 if not specified, and step defaults to the default value for step if not specified. ...
..."time" min="09:00" step="900"> datetime-local 1 (day) same day of the week: <input type="datetime-local" min="019-12-25t19:30" step="7"> number 1 0.1 increments <input type="number" min="0" step="0.1" max="10"> range 1 increments by 2: <input type="range" min="0" step="2" max="10"> the method, when invoked, changes the form control's value by the value given in the step attribute, multiplied by the parameter, within the constraints set on the form control. the default value for the parameter, if no value is passed, is 1. the method will not cause the value to exceed the set max value, or defy the constraints set by the step attribute. if the value before invoking the stepup() method is invalid—for example, if it doesn't match th...
...And 7 more matches
Intersection Observer API - Web APIs
other element as the root, the api works the same way, executing a callback function you provide whenever the visibility of the target element changes so that it crosses desired amounts of intersection with the root. the degree of intersection between the target element and its root is the intersection ratio. this is a representation of the percentage of the target element which is visible as a value between 0.0 and 1.0. creating an intersection observer create the intersection observer by calling its constructor and passing it a callback function to be run whenever a threshold is crossed in one direction or the other: let options = { root: document.queryselector('#scrollarea'), rootmargin: '0px', threshold: 1.0 } let observer = new intersectionobserver(callback, options); a thres...
...ject passed into the intersectionobserver() constructor let you control the circumstances under which the observer's callback is invoked. it has the following fields: root the element that is used as the viewport for checking visibility of the target. must be the ancestor of the target. defaults to the browser viewport if not specified or if null. rootmargin margin around the root. can have values similar to the css margin property, e.g. "10px 20px 30px 40px" (top, right, bottom, left). the values can be percentages. this set of values serves to grow or shrink each side of the root element's bounding box before computing intersections. defaults to all zeros. threshold either a single number or an array of numbers which indicate at what percentage of the target's visibility the observer'...
...e percentages. this set of values serves to grow or shrink each side of the root element's bounding box before computing intersections. defaults to all zeros. threshold either a single number or an array of numbers which indicate at what percentage of the target's visibility the observer's callback should be executed. if you only want to detect when visibility passes the 50% mark, you can use a value of 0.5. if you want the callback to run every time visibility passes another 25%, you would specify the array [0, 0.25, 0.5, 0.75, 1]. the default is 0 (meaning as soon as even one pixel is visible, the callback will be run). a value of 1.0 means that the threshold isn't considered passed until every pixel is visible. targeting an element to be observed once you have created the observer, you ...
...And 7 more matches
Microdata DOM API - Web APIs
. if there are no tokens specified in the argument, then the method must return a nodelist containing all the top-level microdata items in the document. when the method is invoked on a document object again with the same argument, the user agent may return the same object as the object returned by the earlier call. in other cases, a new nodelist object must be returned. properties element . itemvalue [ = value ] returns the element's value. can be set, to change the element's value. setting the value when the element has no itemprop attribute or when the element's value is an item throws an invalidaccesserror exception. element . properties if the element has an itemscope attribute, returns an htmlpropertiescollection object with all the element's properties. otherwise, an empty htmlprope...
...tained, its properties can be extracted using the properties idl attribute. this attribute returns an htmlpropertiescollection, which can be enumerated to go through each element that adds one or more properties to the item. it can also be indexed by name, which will return an object with a list of the elements that add properties with that name. ...
...ed using the properties idl attribute. this attribute returns an htmlpropertiescollection, which can be enumerated to go through each element that adds one or more properties to the item. it can also be indexed by name, which will return an object with a list of the elements that add properties with that name. each element that adds a property also has an itemvalue idl attribute that returns its value. ...
...And 7 more matches
MutationObserverInit.attributes - Web APIs
if true, the callback specified when observe() was used to start observing the node or subtree will be called any time one or more attributes have changed on observed nodes. ...
... if true, the callback specified when observe() was used to start observing the node or subtree will be called any time one or more attributes have changed on observed nodes. ...
... if true, the callback specified when observe() was used to start observing the node or subtree will be called any time one or more attributes have changed on observed nodes. ...
...And 7 more matches
SubtleCrypto.deriveBits() - Web APIs
ms object. basekey is a cryptokey representing the input to the derivation algorithm. if algorithm is ecdh, this will be the ecdh private key. otherwise it will be the initial key material for the derivation function: for example, for pbkdf2 it might be a password, imported as a cryptokey using subtlecrypto.importkey(). length is a number representing the number of bits to derive. return value result is a promise that fulfills with an arraybuffer containing the derived bits. exceptions the promise is rejected when one of the following exceptions are encountered: invalidaccesserror raised when the base key is not a key for the requested derivation algorithm or if the cryptokey.usages value of that key doesn't contain derivekey. notsupported raised when trying to use an algor...
...ivate key and bob's public key to derive a shared secret. see the complete code on github. ...
...cret. see the complete code on github. ...
...And 7 more matches
WebGLRenderingContext.getParameter() - Web APIs
parameter names webgl 1 you can query the following pname parameters when using a webglrenderingcontext. ...
... parameter names webgl 1 you can query the following pname parameters when using a webglrenderingcontext. ...
... parameter names webgl 1 you can query the following pname parameters when using a webglrenderingcontext. ...
...And 7 more matches
WebGLRenderingContext.getUniformLocation() - Web APIs
f a given webglprogram. the uniform variable is returned as a webgluniformlocation object, which is an opaque identifier used to specify where in the gpu's memory that uniform variable is located. ...
...t, which is an opaque identifier used to specify where in the gpu's memory that uniform variable is located. once you have the uniform's location, you can access the uniform itself using one of the other uniform access methods, passing in the uniform location as one of the inputs: getuniform() returns the value of the uniform at the given location. uniform[1234][fi][v]() sets the uniform's value to the specified value, which may be a single floating point or integer number, or a 2-4 component vector specified either as a list of values or as a float32array or int32array. uniformmatrix[234][fv]() sets the uniform's value to the specified matrix, possibly with transposition. the value is represented as a sequence of glfloat values or as a float32array. the uniform itself is declared in...
...parameters program the webglprogram in which to locate the specified uniform variable. name a domstring specifying the name of the uniform variable whose location is to be returned. the name can't have any whitespace in it, and you can't use this function to get the location of any uniforms starting with the reserved string "gl_", since those are internal to the webgl layer. the possible values correspond to the uniform names returned by getactiveuniform; see that function for specifics on how declared uniforms map to uniform location names. additionally, for uniforms declared as arrays, the following names are also valid: the uniform name without the [0] suffix. e.g. the location returned for arrayuniform is equivalent to the one for arrayuniform[0]. the uniform name index...
...And 7 more matches
WebGL model view projection - Web APIs
and wokring with webgl code. for this section we will put our data into the clip space coordinate system directly. normally model data is used that is in some arbitrary coordinate system, and is then transformed using a matrix, converting the model coordinates into the clip space coordinate system. for this example, it's easiest to illustrate how clip space works by simply using model coordinate values ranging from (-1,-1,-1) to (1,1,1). the code below will create 2 triangles that will draw a square on the screen. the z depth in the squares determines what gets drawn on top when the squares share the same space. the smaller z values are rendered on top of the larger z values. webglbox example this example will create a custom webglbox object that will draw a 2d box on the screen. note: the...
...dinate is set to 1.0. the obvious question is "why the extra dimension?" it turns out that this addition allows for lots of nice techniques for manipulating 3d data. this added dimension introduces the notion of perspective into the coordinate system; with it in place, we can map 3d coordinates into 2d space—thereby allowing two parallel lines to intersect as they recede into the distance. the value of w is used as a divisor for the other components of the coordinate, so that the true values of x, y, and z are computed as x/w, y/w, and z/w (and w is then also w/w, becoming 1). a three dimensional point is defined in a typical cartesian coordinate system. the added fourth dimension changes this point into a homogeneous coordinate. it still represents a point in 3d space and it can easily be ...
...let y = point[1]; let z = point[2]; let w = point[3]; return [x/w, y/w, z/w]; } as previously mentioned and shown in the functions above, the w component divides the x, y, and z components. when the w component is a non-zero real number then homogeneous coordinate easily translates back into a normal point in cartesian space. now what happens if the w component is zero? in javascript the value returned would be as follows. homogeneoustocartesian([10, 4, 5, 0]); this evaluates to: [infinity, infinity, infinity]. this homogeneous coordinate represents some point at infinity. this is a handy way to represent a ray shooting off from the origin in a specific direction. in addition to a ray, it could also be thought of as a representation of a directional vector. if this homogeneous coor...
...And 7 more matches
Using the Web Audio API - Web APIs
nstructor of the node (e.g. new gainnode()). ...
...: the default value for gain is 1; this keeps the current volume the same. gain can be set to a minimum of about -3.4 and a max of about 3.4. here we'll allow the boombox to move the gain up to 2 (double the original volume) and down to 0 (this will effectively mute our sound). let's give the user control to do this — we'll use a range input: <input type="range" id="volume" min="0" max="2" value="1" step="0.01"> note: range inputs are a really handy input type for updating values on audio nodes. you can specify a range's values and use them directly with the audio node's parameters. ...
...nd down to 0 (this will effectively mute our sound). let's give the user control to do this — we'll use a range input: <input type="range" id="volume" min="0" max="2" value="1" step="0.01"> note: range inputs are a really handy input type for updating values on audio nodes. you can specify a range's values and use them directly with the audio node's parameters. so let's grab this input's value and update the gain value when the input node has its value changed by the user: const volumecontrol = document.queryselector('#volume'); volumecontrol.addeventlistener('input', function() { gainnode.gain.value = this.value; }, false); note: the values of node objects (e.g. gainnode.gain) are not simple values; they are actually objects of type audioparam — these called parameters. thi...
...And 7 more matches
Using the Web Storage API - Web APIs
the web storage api provides mechanisms by which browsers can securely store key/value pairs. this article provides a walkthrough of how to make use of this technology. basic concepts storage objects are simple key-value stores, similar to objects, but they stay intact through page loads. the keys and the values are always strings (note that, as with objects, integer keys will be automatically converted 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, ...
...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 browser is closed and reopened. these mechanisms are available via the w...
...this takes the key of the data item as an argument, and returns the data val...
...And 7 more matches
Window.devicePixelRatio - Web APIs
the devicepixelratio of window interface returns the ratio of the resolution in physical pixels to the resolution in css pixels for the current display device. this value could also be interpreted as the ratio of pixel sizes: the size of one css pixel to the size of one physical pixel. in simpler terms, this tells the browser how many of the screen's actual pixels should be used to draw a single css pixel. this is useful when dealing with the difference between rendering on a standard display versus a hidpi or retina display, which use more screen pixels to draw the same objects, resulting in a sharper image. ...
...one physical pixel. in simpler terms, this tells the browser how many of the screen's actual pixels should be used to draw a single css pixel. this is useful when dealing with the difference between rendering on a standard display versus a hidpi or retina display, which use more screen pixels to draw the same objects, resulting in a sharper image. ...
...ith the difference between rendering on a standard display versus a hidpi or retina display, which use more screen pixels to draw the same objects, resulting in a sharper image. you can use window.matchmedia() to check if the value of devicepixelratio changes (which can happen, for example, if the user drags the window to a display with a different pixel density). see the example below. ...
...And 7 more matches
ARIA live regions - Accessibility
onscreen information a website specializing in providing information about planets provides a dropdown box. when a planet is selected from the dropdown, a region on the page is updated with information about the selected planet. ...
...ing information about planets provides a dropdown box. when a planet is selected from the dropdown, a region on the page is updated with information about the selected planet. ...
...down box. when a planet is selected from the dropdown, a region on the page is updated with information about the selected planet. ...
...And 7 more matches
ARIA Test Cases - Accessibility
option is changed the new option should be spoken whether the list is open or closed. when the combo box is opened or closed, the new open/closed state should be spoken. markup used: notes: results: at firefox ie opera safari jaws 9 - - n/a n/a jaws 10 fail. label and current content as well as role are spoken, also when typing in a new value, that gets reflected. but when dropping down the lists of states in either example, after the second or so list item, jaws turns off forms mode, and the user has to turn off v cursor to be able to make selections or tab to anything useful. - - - voiceover (leopard) n/a n/a - fail window-eyes - - - - nvda - n/a - - zo...
...reader treats any progress updates. the live region markup should not affect how the progress updates are presented. (al) if the screen reader provides a keystroke to announce the current progress, this should work with an aria progressbar as well. jaws - jaws announces the level of progress at each time interval the user selects in jaws configuration. ...
...ny progress updates. the live region markup should not affect how the progress updates are presented. (al) if the screen reader provides a keystroke to announce the current progress, this should work with an aria progressbar as well. jaws - jaws announces the level of progress at each time interval the user selects in jaws configuration. ...
...And 7 more matches
ARIA: textbox role - Accessibility
el> <input type="text" placeholder="5-digit zipcode" id="txtbox"/> <!-- multi-line text area --> <label for="txtboxmultiline">enter the tags for the article</label> <textarea id="txtboxmultiline" required></textarea> where a text field is read-only, indicated this by setting aria-readonly="true" on the element. ...
...e element. associated aria properties aria-activedescendent attribute taking as it's value the id of is either a descendant of the element with dom focus or is a logical descendant as indicated by the aria-owns attribute, it indicates when that element has focus, when it is part of a composite widget such as a combobox. for example, in a combobox, focus may remain on the textbox while the value of aria-activedescendant on the textbox element refers to a descendant of a popup listbox that is controlled by the textbox.this attribute must be updated programmatically as the focus changes. ...
... none (default): predicted text is not offered. ...
...And 7 more matches
-moz-context-properties - CSS: Cascading Style Sheets
the -moz-context-properties property can be used within privileged contexts in firefox to share the values of specified properties of the element with a child svg image. if you reference an svg image in a webpage (such as with the <img> element or as a background image), the svg image can coordinate with the embedding element (its context) to have the image adopt property values set on the embedding element. ...
... element with a child svg image. if you reference an svg image in a webpage (such as with the <img> element or as a background image), the svg image can coordinate with the embedding element (its context) to have the image adopt property values set on the embedding element. to do this the embedding element needs to list the properties that are to be made available to the image by listing them as values of the -moz-context-properties property, and the image needs to opt in to using those properties by using values such as the context-fill value. ...
...e embedding element (its context) to have the image adopt property values set on the embedding element. to do this the embedding element needs to list the properties that are to be made available to the image by listing them as values of the -moz-context-properties property, and the image needs to opt in to using those properties by using values such as the context-fill value. syntax /* keyword values */ -moz-context-properties: fill; -moz-context-properties: fill, stroke; /* global values */ -moz-context-properties: inherit; -moz-context-properties: initial; -moz-context-properties: unset; values fill expose the fill value set on the image to the embedded svg. ...
...And 7 more matches
-webkit-text-stroke-color - CSS: Cascading Style Sheets
the -webkit-text-stroke-color css property specifies the stroke color of characters of text. if this property is not set, the value of the color property is used. /* <color> values */ -webkit-text-stroke-color: red; -webkit-text-stroke-color: #e08ab4; -webkit-text-stroke-color: rgb(200, 100, 0); /* global values */ -webkit-text-stroke-color: inherit; -webkit-text-stroke-color: initial; -webkit-text-stroke-color: unset; syntax values <color> the color of the stroke. ...
...y is not set, the value of the color property is used. /* <color> values */ -webkit-text-stroke-color: red; -webkit-text-stroke-color: #e08ab4; -webkit-text-stroke-color: rgb(200, 100, 0); /* global values */ -webkit-text-stroke-color: inherit; -webkit-text-stroke-color: initial; -webkit-text-stroke-color: unset; syntax values <color> the color of the stroke. ...
...color> values */ -webkit-text-stroke-color: red; -webkit-text-stroke-color: #e08ab4; -webkit-text-stroke-color: rgb(200, 100, 0); /* global values */ -webkit-text-stroke-color: inherit; -webkit-text-stroke-color: initial; -webkit-text-stroke-color: unset; syntax values <color> the color of the stroke. ...
...And 7 more matches
font-stretch - CSS: Cascading Style Sheets
the font-stretch css descriptor allows authors to specify a normal, condensed, or expanded face for the fonts specified in the @font-face rule. for a particular font family, authors can download various font faces which correspond to the different styles of the same font family, and then use the font-stretch descriptor to explicitly specify the font face's stretch. ...
...sed, or expanded face for the fonts specified in the @font-face rule. for a particular font family, authors can download various font faces which correspond to the different styles of the same font family, and then use the font-stretch descriptor to explicitly specify the font face's stretch. the values for the css descriptor is same as that of its corresponding font property. ...
...me as that of its corresponding font property. syntax /* single values */ font-stretch: ultra-condensed; font-stretch: extra-condensed; font-stretch: condensed; font-stretch: semi-condensed; font-stretch: normal; font-stretch: semi-expanded; font-stretch: expanded; font-stretch: extra-expanded; font-stretch: ultra-expanded; font-stretch: 50%; font-stretch: 100%; font-stretch: 200%; /* multiple values */ font-stretch: 75% 125%; font-stretch: condensed ultra-condensed;; the font-weight property is described using any one of the values listed below. values normal specifies a normal font face. semi-condensed, condensed, extra-condensed, ultra-condensed specifies a more condensed font face than normal, with ultra-condensed as the most condensed. semi-expanded, expanded, extra-expanded, ...
...And 7 more matches
font-weight - CSS: Cascading Style Sheets
nt weights for the fonts specified in the @font-face rule. the font-weight property can separately be used to set how thick or thin characters in text should be displayed. for a particular font family, authors can download various font faces which correspond to the different styles of the same font family, and then use the font-weight descriptor to explicitly specify the font face's weights. ...
... to explicitly specify the font face's weights. the values for the css descriptor is same as that of its corresponding font property. there are generally limited weights available for a particular font family. when a specified weight doesn't exist, a nearby weight is used. fonts lacking bold are often synthesized by the user agent. to prevent this, use font-synthesis property. syntax /* single values */ font-weight: normal; font-weight: bold; font-weight: 400; /* multiple values */ font-weight: normal bold; font-weight: 300 500; the font-weight property is described using any one of the values listed below. values normal normal font weight. same as 400. bold bold font weight. same as 700. <number> a <number> value between 1 and 1000, inclusive. higher numbers represent weights th...
...ple values */ font-weight: normal bold; font-weight: 300 500; the font-weight property is described using any one of the values listed below. values normal normal font weight. same as 400. bold bold font weight. same as 700. <number> a <number> value between 1 and 1000, inclusive. higher numbers represent weights that are bolder than (or as bold as) lower numbers. certain commonly used values correspond to common weight names, as described in the common weight name mapping section below. in earlier versions of the font-weight specification, the property accepts only keyword values and the numeric values 100, 200, 300, 400, 500, 600, 700, 800, and 900; non-variable fonts can only really make use of these set values, although fine-grained values (e.g. 451) will be translated to one o...
...And 7 more matches
Controlling Ratios of Flex Items Along the Main Axis - CSS: Cascading Style Sheets
f text. the first paragraph has a width of min-content. in a browser that supports this keyword you should be able to see that the text has taken all of the soft wrapping opportunities available to it, becoming as small as it can be without overflowing. this then, is the min-content size of that string. essentially, the longest word in the string is dictating the size. the second paragraph has a value of max-content and so it does the opposite. it gets as big as it possibly can be, taking no soft-wrapping opportunities. it would overflow the box it is in if that container was too narrow. if your browser does not yet support these keywords both paragraphs will be rendered as normal paragraphs in block flow; the below screenshots show the expected rendering. remember this behaviour and wha...
...you could equally try out each example with flex-direction: column. the main axis would then be the column, and you would then need to compare the height of the items and that of the container they are in to work out the positive and negative free space. the flex-basis property the flex-basis property specifies the initial size of the flex item before any space distribution happens. the initial value for this property is auto. if flex-basis is set to auto then to work out the initial size of the item the browser first checks if the main size of the item has an absolute size set. this would be the case if you had given your item a width of 200 pixels. in that case 200px would be the flex-basis for this item. if your item is instead auto-sized, then auto resolves to the size of its content. at...
...the flex-grow property specifies the flex grow factor, which determines how much the flex item will grow relative to the rest of the flex items in the flex container when the positive free space is distributed. if all of your items have the same flex-grow factor then space will be distributed evenly between all of them. if this is the situation that you want then typically you would use 1 as the value, however you 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 differi...
...And 7 more matches
Ordering Flex Items - CSS: Cascading Style Sheets
hods such as flexbox and grid bring with them the possibility of controlling the order of content. in this article we will take a look at ways in which you can change the visual order of your content when using flexbox. we will also consider the implications of reordering items from an accessibility point of view. reverse the display of the items the flex-direction property can take one of four values: row column row-reverse column-reverse the first two values ​​keep the items in the same order that they appear in the document source order and display them sequentially from the start line. the second two values ​​reverse the items by switching the start and end lines. remember that the start line relates to writing modes. the row-related examples above demonstrate ho...
...pulate the visual presentation while leaving the source order intact for non-css uas and for linear models such as speech and sequential navigation.” - ordering and orientation if your items were links or some other element that the user could tab to, then the tabbing order would be the order that these items appear in the document source — not your visual order. ...
...er would be the order that these items appear in the document source — not your visual order. if you are using a reverse value, or otherwise reordering your items, you should consider whether you actually need to change the logical order in the source. the specification continues with a warning not to use reordering to fix issues in your source: “authors must not use order or the *-reverse values of flex-flow/flex-direction as a substitute for correct source ordering, as that can ruin the accessibility of the document.” note: for some years firefox had a bug whereby it would attempt to follow the visual order and not the source order, making it behave differently to other browsers. this has now been fixed. you should always take the source order as the logical order of the document ...
...And 7 more matches
Logical properties for margins, borders and padding - CSS: Cascading Style Sheets
the logical properties and values specification defines flow-relative mappings for the various margin, border, and padding properties and their shorthands. in this guide we take a look at these. if you have looked at the main page for css logical properties and values you will see there are a huge number of properties listed. this is mostly due to the fact that there are four longhand values each for margin, border, and padding side, plus all the shorthand values. mappings for margins, borders, and padding the specification details mappings for each logical value to a physical counterpart. in the table below i have given these mapped values assuming that the writing-mode in use is horizontal-tb — with a left to right direction. the inline direction therefore runs horizontally — left to ...
...try changing the writing-mode from horizontal-tb to vertical-rl. again, notice how the margins stay in the same place for the first box, but switch around to follow the text direction in the second. margin shorthands as we can now target both sides of a box — either both inline sides or both block sides — there are new shorthands available, margin-inline and margin-block, which accept two values. the first value will apply to the start of that dimension, the second to the end. if you only use one value it is applied to both. in a horizontal writing mode this css would apply a 5px margin to the top of the box and a 10px margin to the bottom. .box { margin-block: 5px 10px; } note: the shorthand properties margin-inline and margin-block shipped in firefox 66. as these are new propert...
...e padding on the first box will stay in the same place, whereas the padding on the inline dimension of the second box will switch. you can also try changing the writing-mode from horizontal-tb to vertical-rl. again, notice how the padding stays in the same place for the first box, but switches around to follow the text direction in the second. padding shorthands as with margin, there are two-value shorthands for padding — padding-inline and padding-block — which allow you to set the padding of the two inline, and two block dimensions, respectively. in a horizontal writing-mode this css would apply 5px of padding to the top of the box and 10px of padding to the bottom: .box { padding-block: 5px 10px; } note: the shorthand properties padding-inline and padding-block shipped in fire...
...And 7 more matches
all - CSS: Cascading Style Sheets
Web › CSS › all
the all shorthand css property resets all of an element's properties except unicode-bidi, direction, and css custom properties. it can set properties to their initial or inherited values, or to the values specified in another stylesheet origin. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...irection, and css custom properties. it can set properties to their initial or inherited values, or to the values specified in another stylesheet origin. the source for this interactive example is stored in a github repository. if 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 /* global values */ all: initial; all: inherit; all: unset; /* css cascading and inheritance level 4 */ all: revert; the all property is specified as one of the css global keyword values. note that none of these values affect the unicode-bidi and direction properties. values initial specifies that all the element's properties should be changed to their initial values. inherit specifies that all the ele...
...scading and inheritance level 4 */ all: revert; the all property is specified as one of the css global keyword values. note that none of these values affect the unicode-bidi and direction properties. values initial specifies that all the element's properties should be changed to their initial values. inherit specifies that all the element's properties should be changed to their inherited values. unset specifies that all the element's properties should be changed to their inherited values if they inherit by default, or to their initial values if not. ...
...And 7 more matches
border-block-end - CSS: Cascading Style Sheets
the border-block-end css property is a shorthand property for setting the individual logical block-end border property values in a single place in the style sheet. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...oject, 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: border-block-end-color border-block-end-style border-block-end-width syntax border-block-end: 1px; border-block-end: 2px dotted; border-block-end: medium dashed blue; border-block-end can be used to set the values for one or more of border-block-end-width, border-block-end-style, and border-block-end-color. the physical border to which it maps depends on the element's writing mode, directionality, and text orientation. it corresponds to the border-top, border-right, border-bottom, or border-left property depending on the values defined for writing-mode, direction, and text-orientation. related properties...
...to which it maps depends on the element's writing mode, directionality, and text orientation. it corresponds to the border-top, border-right, border-bottom, or border-left property depending on the values defined for writing-mode, direction, and text-orientation. related properties are border-block-start, border-inline-start, and border-inline-end, which define the other borders of the element. values the border-block-end is specified with one or more of the following, in any order: <'border-width'> the width of the border. see border-width. <'border-style'> the line style of the border. ...
...And 7 more matches
border-block-start - CSS: Cascading Style Sheets
the border-block-start css property is a shorthand property for setting the individual logical block-start border property values in a single place in the style sheet. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...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: border-block-start-color border-block-start-style border-block-start-width syntax border-block-start: 1px; border-block-start: 2px dotted; border-block-start: medium dashed blue; border-block-start can be used to set the values for one or more of border-block-start-width, border-block-start-style, and border-block-start-color. the physical border to which it maps depends on the element's writing mode, directionality, and text orientation. it corresponds to the border-top, border-right, border-bottom, or border-left property depending on the values defined for writing-mode, direction, and text-orientation. related prop...
...r to which it maps depends on the element's writing mode, directionality, and text orientation. it corresponds to the border-top, border-right, border-bottom, or border-left property depending on the values defined for writing-mode, direction, and text-orientation. related properties are border-block-end, border-inline-start, and border-inline-end, which define the other borders of the element. values the border-block-start is specified with one or more of the following, in any order: <'border-width'> the width of the border. see border-width. <'border-style'> the line style of the border. ...
...And 7 more matches
border-color - CSS: Cascading Style Sheets
der-block-start-color, border-block-end-color, border-inline-start-color, and border-inline-end-color. you can find more information about border colors in borders in applying color to html elements using css. constituent properties this property is a shorthand for the following css properties: border-bottom-color border-left-color border-right-color border-top-color syntax /* <color> values */ border-color: red; /* horizontal | vertical */ border-color: red #f015ca; /* top | vertical | bottom */ border-color: red rgb(240,30,50,.7) green; /* top | right | bottom | left */ border-color: red yellow green blue; /* global values */ border-color: inherit; border-color: initial; border-color: unset; the border-color property may be specified using one, two, three, or four values. ...
...r-color: red; /* horizontal | vertical */ border-color: red #f015ca; /* top | vertical | bottom */ border-color: red rgb(240,30,50,.7) green; /* top | right | bottom | left */ border-color: red yellow green blue; /* global values */ border-color: inherit; border-color: initial; border-color: unset; the border-color property may be specified using one, two, three, or four values. when one value is specified, it applies the same color to all four sides. when two values are specified, the first color applies to the top and bottom, the second to the left and right. ...
...r: red yellow green blue; /* global values */ border-color: inherit; border-color: initial; border-color: unset; the border-color property may be specified using one, two, three, or four values. when one value is specified, it applies the same color to all four sides. when two values are specified, the first color applies to the top and bottom, the second to the left and right. when three values are specified, the first color applies to the top, the second to the left and right, the third to the bottom. when four values are specified, the colors apply to the top, right, bottom, and left in that order (clockwise). values <color> defines the color of the border. ...
...And 7 more matches
border-radius - CSS: Cascading Style Sheets
-radius:0 0 inherit inherit, which would partially override existing definitions. instead, the individual longhand properties have to be used. ...
...allows one to four values */ /* radius is set for all 4 sides */ border-radius: 10px; /* top-left-and-bottom-right | top-right-and-bottom-left */ border-radius: 10px 5%; /* top-left | top-right-and-bottom-left | bottom-right */ border-radius: 2px 4px 2px; /* top-left | top-right | bottom-right | bottom-left */ border-radius: 1px 0 3px 4px; /* the syntax of the second radius allows one to four values */ /* (first radius values) / radius */ border-radius: 10px / 20px; /* (first radius values) / top-left-and-bottom-right | top-right-and-bottom-left */ border-radius: 10px 5% / 20px 30px; /* (first radius values) / top-left | top-right-and-bottom-left | bottom-right */ border-radius: 10px 5px 2em / 20px 25px 30%; /* (first radius values) / top-left | top-right | bottom-right | bottom-left */ ...
...10px / 20px; /* (first radius values) / top-left-and-bottom-right | top-right-and-bottom-left */ border-radius: 10px 5% / 20px 30px; /* (first radius values) / top-left | top-right-and-bottom-left | bottom-right */ border-radius: 10px 5px 2em / 20px 25px 30%; /* (first radius values) / top-left | 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 corner...
...And 7 more matches
border-width - CSS: Cascading Style Sheets
r this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...te to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...> values */ border-width: 4px; border-width: 1.2rem; /* vertical | horizontal */ border-width: 2px 1.5em; /* top | horizontal | bottom */ border-width: 1px 2em 1.5cm; /* top | right | bottom | left */ border-width: 1px 2em 0 4rem; /* global keywords */ border-width: inherit; border-width: initial; border-width: unset; the border-width property may be specified using one, two, three, or four values. when one value is specified, it applies the 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. ...
...And 7 more matches
break-inside - CSS: Cascading Style Sheets
the break-inside css property sets how page, column, or region breaks should behave inside a generated box. if there is no generated box, the property is ignored. ...
... the break-inside css property sets how page, column, or region breaks should behave inside a generated box. if there is no generated box, the property is ignored. ...
...ere is no generated box, the property is ignored. /* keyword values */ break-inside: auto; break-inside: avoid; break-inside: avoid-page; break-inside: avoid-column; break-inside: avoid-region; /* global values */ break-inside: inherit; break-inside: initial; break-inside: unset; each possible break point (in other words, each element boundary) is affected by three properties: the break-after value of the previous element, the break-before value of the next element, and the break-inside value of the containing element. to determine if a break must be done, the following rules are applied: if any of the three concerned values is a forced break value (always, left, right, page, column, or region), it has precedence. ...
...And 7 more matches
caret-color - CSS: Cascading Style Sheets
“navigation caret,” which acts similarly to an insertion caret but can be moved around in non-editable text. on the other hand, the mouse cursor image shown when hovering over text where the cursor property is auto, or when hovering over an element where the cursor property is text or vertical-text, though it sometimes looks like a caret, is not a caret (it’s a cursor). syntax /* keyword values */ caret-color: auto; caret-color: transparent; caret-color: currentcolor; /* <color> values */ caret-color: red; caret-color: #5729e9; caret-color: rgb(0, 200, 0); caret-color: hsla(228, 4%, 24%, 0.8); values auto the user agent selects an appropriate color for the caret. this is generally currentcolor, but the user agent may choose a different color to ensure good visibility and contras...
...color: currentcolor; /* <color> values */ caret-color: red; caret-color: #5729e9; caret-color: rgb(0, 200, 0); caret-color: hsla(228, 4%, 24%, 0.8); values auto the user agent selects an appropriate color for the caret. this is generally currentcolor, but the user agent may choose a different color to ensure good visibility and contrast with the surrounding content, taking into account the value of currentcolor, the background, shadows, and other factors. note: while user agents may use currentcolor (which is usually animatable) for the auto value, auto is not interpolated in transitions and animations. <color> the color of the caret. ...
... a different color to ensure good visibility and contrast with the surrounding content, taking into account the value of currentcolor, the background, shadows, and other factors. note: while user agents may use currentcolor (which is usually animatable) for the auto value, auto is not interpolated in transitions and animations. <color> the color of the caret. ...
...And 7 more matches
<easing-function> - CSS: Cascading Style Sheets
the <easing-function> css data type denotes a mathematical function that describes how fast one-dimensional values change during animations. this lets you vary the animation's speed over the course of its duration. the easing functions in the cubic-bezier subset of easing functions are often called "smooth" easing functions, because they can be used to smooth down the start and end of the animation. they correlate a time ratio to an output ratio, both expressed as <number>s. for these values, 0.0 represents the initial state, and 1.0 represents the final state. depending on the specific function used, the calculated output can sometimes grow to be greater than 1.0 or smaller than 0.0 during the course of an animation. this causes the animation to go farther than the final state, and then r...
...0 during the course of an animation. this causes the animation to go farther than the final state, and then return. for some properties, such as left or right, this creates a kind of "bouncing" effect. however, certain properties will restrict the output if it goes outside an allowable range. for example, a color component greater than 255 or smaller than 0 will be clipped to the closest allowed value (255 and 0, respectively). some cubic-bezier() curves exhibit this property. syntax there are three types of easing function: linear, cubic bézier curves, and staircase functions. the value of an <easing-function> type describes the easing function using one of those three types. easing functions css supports three kinds of easing functions: linear, the subset of the cubic bézier curves tha...
...d as the coordinates are ratios (the abscissa the ratio of time, the ordinate the ratio of the output range). p0 is (0, 0) and represents the initial time and the initial state, p3 is (1, 1) and represents the final time and the final state. not all cubic bézier curves are suitable as easing functions as not all are mathematical functions; i.e., curves that for a given abscissa have zero or one value. with p0 and p3 fixed as defined by css, a cubic bézier curve is a function, and is therefore valid, if and only if the abscissas of p1 and p2 are both in the [0, 1] range. cubic bézier curves with the p1 or p2 ordinate outside the [0, 1] range may generate bouncing effects. when you specify an invalid cubic-bezier curve, css ignores the whole property. syntax cubic-bezier(x1, y1, x2, y2) ...
...And 7 more matches
grid-auto-columns - CSS: Cascading Style Sheets
, please clone https://github.com/mdn/interactive-examples and send us a pull request. if a grid item is positioned into a column that is not explicitly sized by grid-template-columns, implicit grid tracks are created to hold it. this can happen either by explicitly positioning into a column that is out of range, or by the auto-placement algorithm creating additional columns. ...
...oned 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. ...
...d 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. ...
...And 7 more matches
grid-auto-rows - CSS: Cascading Style Sheets
ples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. if a grid item is positioned into a row that is not explicitly sized by grid-template-rows, implicit grid tracks are created to hold it. this can happen either by explicitly positioning into a row that is out of range, or by the auto-placement algorithm creating additional rows. ...
...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. ...
...t 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. ...
...And 7 more matches
grid-row-start - CSS: Cascading Style Sheets
in the grid row by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the inline-start edge of its grid 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. ...
... nothing (automatic) to its grid placement, thereby specifying the inline-start edge of its grid 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. ...
...ne-start edge of its grid 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. ...
...And 7 more matches
grid-row - CSS: Cascading Style Sheets
Web › CSS › grid-row
by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the inline-start and inline-end edge of its grid 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. ...
...rid placement, thereby specifying the inline-start and inline-end edge of its grid 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. ...
...ge of its grid 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. if two <grid-line> values are specified, the grid-row-start longhand is set to the value before the slash, and the grid-row-end longhand is set to the value after the slash. ...
...And 7 more matches
grid-template-columns - CSS: Cascading Style Sheets
the grid-template-columns css property defines the line names and track sizing functions of the grid columns. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...plate-columns css property defines the line names and track sizing functions of the grid columns. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ntax /* keyword value */ grid-template-columns: none; /* <track-list> values */ grid-template-columns: 100px 1fr; grid-template-columns: [linename] 100px; grid-template-columns: [linename1] 100px [linename2 linename3]; grid-template-columns: minmax(100px, 1fr); grid-template-columns: fit-content(40%); grid-template-columns: repeat(3, 200px); grid-template-columns: subgrid; /* <auto-track-list> values */ grid-template-columns: 200px repeat(auto-fill, 100px) 300px; grid-template-columns: minmax(100px, max-content) repeat(auto-fill, 200px) 20%; grid-template-columns: [linename1] 100px [linename2] repeat(auto-fit, [linename3 linename4] 300px) 100px; grid-template-columns: [linename1 linename2] 100px repea...
...And 7 more matches
image-orientation - CSS: Cascading Style Sheets
orrection to the orientation of an image. it should not be used for any other orientation adjustments; instead, the transform property should be used with the rotate <transform-function>. warning: this property is deprecated in the specification. its functionality may be moved into properties on the <img> and/or <picture> elements, with the possible exception of from-image. the flip and <angle> values were made obsolete in firefox 63. /* keyword values */ image-orientation: none; image-orientation: from-image; /* use exif data from the image */ /* global values */ image-orientation: inherit; image-orientation: initial; image-orientation: unset; /* obsolete values. obsolete since gecko 63 */ image-orientation: 90deg; /* rotate 90deg */ image-orientation: 90deg flip; /* rotate 90deg, and fl...
... from-image the exif information contained in the image will be used to rotate the image appropriately. <angle> obsolete since gecko 63 the <angle> of rotation to apply to the image. ...
... from-image the exif information contained in the image will be used to rotate the image appropriately. <angle> obsolete since gecko 63 the <angle> of rotation to apply to the image. it is rounded to the nearest 90deg (0.25turn). ...
...And 7 more matches
justify-self - CSS: Cascading Style Sheets
ve examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the effect of this property is dependent of the layout mode we are in: in block-level layouts, it aligns an item inside its containing block on the inline axis. for absolutely-positioned elements, it aligns an item inside its containing block on the inline axis, accounting for the offset values of top, left, bottom, and right. in table cell layouts, this property is ignored (more about alignment in block, absolute positioned and table layout) in flexbox layouts, this property is ignored (more about alignment in flexbox) in grid layouts, it aligns an item inside its grid area on the inline axis (more about alignment in grid layouts) syntax /* basic keywords */ justify-self: auto; ...
... baseline alignment: the baseline keyword, plus optionally one of first or last. positional alignment: one of: center, start, end, flex-start, flex-end, self-start, self-end, left, or right. p...
...baseline alignment */ justify-self: baseline; justify-self: first baseline; justify-self: last baseline; /* overflow alignment (for positional alignment only) */ justify-self: safe center; justify-self: unsafe center; /* global values */ justify-self: inherit; justify-self: initial; justify-self: unset; this property can take one of three different forms: basic keywords: one of the keyword values normal, auto, or stretch. baseline alignment: the baseline keyword, plus optionally one of first or last. ...
...And 7 more matches
line-height - CSS: Cascading Style Sheets
the minimum height of line boxes within the element. on non-replaced inline elements, it specifies the height that is used to calculate line box height. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... element. on non-replaced inline elements, it specifies the height that is used to calculate line box height. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...e 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. ...
...And 7 more matches
min-width - CSS: Cascading Style Sheets
Web › CSS › min-width
the min-width css property sets the minimum width of an element. it prevents the used value of the width property from becoming 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. ...
...ler 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. auto...
...alculate and select a min-width for the specified element. none no limit on the size of the box. max-content the intrinsic preferred min-width. min-content the intrinsic minimum min-width. fit-content(<length-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 7 more matches
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. ...
... 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. ...
... 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. ...
...And 7 more matches
opacity - CSS: Cascading Style Sheets
Web › CSS › opacity
the opacity css property sets the opacity of an element. opacity is the degree to which content behind an element is hidden, and is the opposite of transparency. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax values <alpha-value> a <number> in the range 0.0 to 1.0, inclusive, or a <percentage> in the range 0% to 100%, inclusive, representing the opacity of the channel (that is, the value of its alpha channel). any value outside the interval, though valid, is clamped to the nearest limit in the range. value meaning 0 the element is fully transparent (that is, invisible). ...
...annel (that is, the value of its alpha channel). any value outside the interval, though valid, is clamped to the nearest limit in the range. value meaning 0 the element is fully transparent (that is, invisible). any <number> strictly between 0 and 1 the element is translucent (that is, content behind the element can be seen). 1 (default value) the element is fully opaque (visually solid). description opacity applies to the element as a whole, including its contents, even though the value is not inherited by child elements. thus, the element and its children all have the same opacity relative to the element's background, even if they have different opacities relative to one another. ...
... if you do not want to apply opacity to child elements, use the background property instead. ...
...And 7 more matches
outline-color - CSS: Cascading Style Sheets
the outline-color css property sets the color of an element's outline. the source for this interactive example is stored in a github repository. if 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 /* <color> values */ outline-color: #f92525; outline-color: rgb(30,222,121); outline-color: blue; /* keyword value */ outline-color: invert; /* global values */ outline-color: inherit; outline-color: initial; outline-color: unset; the outline-color property is specified as any one of the values listed below. values <color> the color of the outline, specified as a <color>. invert to ensure the outline is visible, performs a color inversion of the background. note that brows...
... description an outline is a line that is drawn around an element, outside the border. unlike the element's border, the outline is drawn outside the element's frame, and may overlap other content. ...
...es commonly involve making adjustments to the outline property. if the color of the outline is adjusted, it is important to ensure that the contrast ratio between it and the background the outline is placed over is high enough that people experiencing low vision conditions will be able to perceive it. color contrast ratio is determined by comparing the luminosity of the text and background color values. in order to meet current web content accessibility guidelines (wcag), a ratio of 4.5:1 is required for text content and 3:1 for larger text such as headings. large text is defined as 18.66px and bold or larger, or 24px or larger. webaim: color contrast checker mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.3 | w3c understanding wcag 2.0 formal def...
...And 7 more matches
scale - CSS: Cascading Style Sheets
Web › CSS › scale
the scale css property allows you to specify scale transforms individually and independently of the transform 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. ...
... the scale css property allows you to specify scale transforms individually and independently of the transform 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. ...
... the scale css property allows you to specify scale transforms individually and independently of the transform 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. ...
...And 7 more matches
text-align - CSS: Cascading Style Sheets
ss property sets the horizontal alignment of a block element or table-cell box. this means it works like vertical-align but in the horizontal direction. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...roject, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ntax /* keyword values */ text-align: left; text-align: right; text-align: center; text-align: justify; text-align: justify-all; text-align: start; text-align: end; text-align: match-parent; /* character-based alignment in a table column */ text-align: "."; text-align: "." center; /* block alignment values (non-standard syntax) */ text-align: -moz-center; text-align: -webkit-center; /* global values */ text-align: inherit; text-align: initial; text-align: unset; the text-align property is specified in one of the following ways: using the keyword values start, end, left, right, center, justify, justify-all, or match-parent. using a <string> value only, in which case the other value defaults to right. using both a keyword value and a <string> value. ...
...And 7 more matches
text-decoration-color - 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. ...
...m/mdn/interactive-examples and send us a pull request. css does not provide a direct mechanism for specifying a unique color for each line type. this effect can nevertheless be achieved by nesting elements, applying a different line type to each element (with the text-decoration-line property), and specifying the line color (with text-decoration-color) on a per-element basis. syntax /* <color> values */ text-decoration-color: currentcolor; text-decoration-color: red; text-decoration-color: #00ff00; text-decoration-color: rgba(255, 128, 128, 0.5); text-decoration-color: transparent; /* global values */ text-decoration-color: inherit; text-decoration-color: initial; text-decoration-color: unset; values <color> the color of the line decoration. accessibility concerns it is important t...
...he line decoration. accessibility concerns it is important to ensure that the contrast ratio between the color of the text, the background the text is placed over, and the text decoration line is high enough that people experiencing low vision conditions will be able to read the content of the page. color contrast ratio is determined by comparing the luminosity of the text and background color values. color alone should not be used to convey meaning. for example, change of text and text-decoration-color alone is not enough to indicate a link has focus. webaim: color contrast checker mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.3 | w3c understanding wcag 2.0 formal definition initial valuecurrentcolorapplies toall elements. it also applies to...
...And 7 more matches
translate - CSS: Cascading Style Sheets
Web › CSS › translate
the translate css property allows you to specify translation transforms individually and independently of the transform 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. ...
... the translate css property allows you to specify translation transforms individually and independently of the transform 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. ...
... the translate css property allows you to specify translation transforms individually and independently of the transform 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. ...
...And 7 more matches
HTML attribute: min - HTML: Hypertext Markup Language
Web › HTML › Attributes › min
the min attribute defines the minimum value that is acceptable and valid for the input containing the attribute. if the value of the element is less than this, the element fails constraint validation. this value must be less than or equal to the value of the max attribute. if a value is specified for min that isn't a valid number, the input has no minimum value. valid for the numeric input types, including the date, month, week, time, datetime-local, number and range types, and the <meter> element, the min attribute is a number that specifies the most negative value a form control to be considered valid. ...
...for example, if we have <input type="number" min="10" step="2"> any even integer, 10 or great, is valid. ...
...for the numeric input types, including the date, month, week, time, datetime-local, number and range types, and the <meter> element, the min attribute is a number that specifies the most negative value a form control to be considered valid. syntax if any is not explicity set, valid values for the number, date/time input types, and range input types are equal to the basis for stepping - the min value and increments of the step value, up to the max value, if specified. for example, if we have <input type="number" min="10" step="2"> any even integer, 10 or great, is valid. ...
...And 7 more matches
HTML attribute: readonly - HTML: Hypertext Markup Language
nd number<input> types and the <textarea> form control elements. if present on any of these input types and elements, the :read-only pseudo class will match. if the attribute is not included, the :read-write pseudo class will match. the attribute is not supported or relevant to <select> or input types that are already not mutable, such as checkbox and radio or cannot, by definition, start with a value, such as the file input type. range and color, as both have default values. it is also not supported on hidden as it can not be expected that a user to fill out a form that is hidden. nor is it supported on any of the button types, including image. note: only text controls can be made read-only, since for other controls (such as checkboxes and buttons) there is no useful distinction between be...
...don't have the attribute set match the :read-write pseudo-class. attribute interactions the difference between disabled and readonly is that read-only controls can still function and are still focusable, whereas disabled controls can not receive focus and are not submitted with the form and generally do not function as controls until they are enabled. because a read-only field cannot have it's value changed by a user interaction, required does not have any effect on inputs with the readonly attribute also specified. the only way to modify dynamically the value of the readonly attribute is through a script. note: the required attribute is not permitted on inputs with the readonly attribute specified. usability browsers display the readonly attribute... constraint validation if the ele...
...red does not have any effect on inputs with the readonly attribute also specified. the only way to modify dynamically the value of the readonly attribute is through a script. note: the required attribute is not permitted on inputs with the readonly attribute specified. usability browsers display the readonly attribute... constraint validation if the element is readonly, then the element's value can not be updated by the user, and does not participate in constraint validation. ...
...And 7 more matches
HTML attribute: step - HTML: Hypertext Markup Language
Web › HTML › Attributes › step
valid for the numeric input types, including the date, month, week, time, datetime-local, number and range types, the step attribute is a number that specifies the granularity that the value must adhere to or the keyword any. the step sets the stepping interval when clicking up and down spinner buttons, moving a slider left and right on a range, and validating the different date types. if not explicitly included, step defaults to 1 for number and range, and 1 unit type (minute, week, month, day) for the date/time input types. ...
... number that specifies the granularity that the value must adhere to or the keyword any. the step sets the stepping interval when clicking up and down spinner buttons, moving a slider left and right on a range, and validating the different date types. if not explicitly included, step defaults to 1 for number and range, and 1 unit type (minute, week, month, day) for the date/time input types. the value can must be a positive number - integer or float -- or the special value any, which means no stepping is implied, and any value is allowed (barring other constraints, such as min and max). the default stepping value for number inputs is 1, allowing only integers to be entered, unless the stepping base is not an integer. ...
...k, month, day) for the date/time input types. the value can must be a positive number - integer or float -- or the special value any, which means no stepping is implied, and any value is allowed (barring other constraints, such as min and max). the default stepping value for number inputs is 1, allowing only integers to be entered, unless the stepping base is not an integer. the default stepping value for time is 1 second, with 900 being equal to 15 minutes. ...
...And 7 more matches
<area> - HTML: Hypertext Markup Language
Web › HTML › Element › area
attributes this element's attributes include the global attributes. alt a text string alternative to display on browsers that do not display images. the text should be phrased so that it presents the user with the same kind of choice as the image would offer when displayed without the alternative text. this attribute is required only if the href attribute is used. ...
...xt string alternative to display on browsers that do not display images. the text should be phrased so that it presents the user with the same kind of choice as the image would offer when displayed without the alternative text. this attribute is required only if the href attribute is used. coords a set of values specifying the coordinates of the hot-spot region. the number and meaning of the values depend upon the value specified for the shape attribute. ...
...hrased so that it presents the user with the same kind of choice as the image would offer when displayed without the alternative text. this attribute is required only if the href attribute is used. coords a set of values specifying the coordinates of the hot-spot region. the number and meaning of the values depend upon the value specified for the shape attribute. rect or rectangle: the value is two x,y pairs: left, top, right, bottom. circle: the value is x,y,r where x,y is a pair specifying the center of the circle and r is a value for the radius. poly or polygon: the value is a set of x,y pairs for each point in the polygon: x1,y1,x2,y2,x3,y3, and so on. the values are numbers of css pixels. download this attribute, if present, indicates that the author intends the hyperli...
...And 7 more matches
<input type="file"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › file
files from their device storage. once chosen, the files can be uploaded to a server using form submission, or manipulated using javascript code and the file api. the source for this interactive example is stored in a github repository. if 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 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 path to the selected file. events change and input supported common attributes required additional attributes accept, capture, files, multiple idl attributes files and value dom interface htmlinputelement properties properties that apply only to elements of type file methods select() value a file input's value attribute contains a domstring that represents the path to the selected file(s). if the user selected multiple files, the value represents the first file in the list of files they selected. the other...
...this string is a comma-separated list of unique file type specifiers. because a given file type may be identified in more than one manner, it's useful to provide a thorough set of type specifiers when you need files of a given format. for instance, there are a number of ways microsoft word files can be identified, so a site th...
...And 7 more matches
Microformats - HTML: Hypertext Markup Language
ed μf) are standards used to embed semantics & structured data in html, and provide an api to be used by search engines, aggregators, and other tools. these minimal patterns of html are used for marking up entities that range from fundamental to domain-specific information, such as people, organizations, events, and locations. microformats use supporting vocabularies to describe objects and name-value pairs to assign values to their properties. the properties are carried in class attributes that can be added to any html element, while the data values re-use html element content and semantic attributes. microformats2 is an update to microformats that provides a simpler way of annotating html structured syntax & vocabularies than previous approaches of using rdfa and microdata which require lear...
... parser makes this data available via apis that can be used for different applications. as in this example, some markup patterns require only a single microformat root class name, which parsers use to find a few generic properties such as name, url, photo. microformats prefixes all microformats consist of a root, and a collection of properties. properties are all optional and potentially multivalued - applications needing a singular value may use the first instance of a property. hierarchical data is represented with nested microformats, typically as property values themselves. all microformats class names use prefixes. prefixes are syntax independent from vocabularies, which are developed separately. "h-*" for root class names, e.g. "h-card", "h-entry", "h-feed", and many more. these t...
...text in general. on certain html elements, use special attributes first, e.g. img/alt, abbr/title. "u-*" for url properties, e.g. "u-url", "u-photo", "u-logo" special parsing: element attributes a/href, img/src, object/data etc. attributes over element contents. "dt-*" for datetime properties, e.g. "dt-start", "dt-end", "dt-bday" special parsing: time element datetime attribute, value-class-pattern and separate date time value parsing for readability. "e-*" for element tree properties where the entire contained element hierarchy is the value, e.g. "e-content". the "e-" prefix can also be mnemonically remembered as "element tree", "embedded markup", or "encapsulated markup". some microformats examples h-card the h-card microformat represents a a person or organization.
...And 7 more matches
Closures - JavaScript
dy of the init() function. note that the displayname() function has no local variables of its own. however, since inner functions have access to the variables of outer functions, displayname() can access the variable name declared in the parent function, init(). run the code using this jsfiddle link and notice that the alert() statement within the displayname() function successfully displays the value of the name variable, which is declared in its parent function. this is an example of lexical scoping, which describes how a parser resolves variable names when functions are nested. the word lexical refers to the fact that lexical scoping uses the location where a variable is declared within the source code to determine where that variable is available. nested functions have access to variables ...
...add5 = makeadder(5); var add10 = makeadder(10); console.log(add5(2)); // 7 console.log(add10(2)); // 12 in this example, we have defined a function makeadder(x), that takes a single argument x, and returns a new function. the function it returns takes a single argument y, and returns the sum of x and y. in essence, makeadder is a function factory. it creates functions that can add a specific value to their argument. in the above example, the function factory creates two new functions—one that adds five to its argument, and one that adds 10. add5 and add10 are both closures. they share the same function body definition, but store different lexical environments. in add5's lexical environment, x is 5, while in the lexical environment for add10, x is 10. practical closures closures are us...
...ates how to use closures to define public functions that can access private functions and variables. note that these closures follow the module design pattern. var counter = (function() { var privatecounter = 0; function changeby(val) { privatecounter += val; } return { increment: function() { changeby(1); }, decrement: function() { changeby(-1); }, value: function() { return privatecounter; } }; })(); console.log(counter.value()); // 0. counter.increment(); counter.increment(); console.log(counter.value()); // 2. counter.decrement(); console.log(counter.value()); // 1. in previous examples, each closure had its own lexical environment. here though, there is a single lexical environment that is shared by the three functions: co...
...And 7 more matches
Keyed collections - JavaScript
« previousnext » this chapter introduces collections of data which are indexed by a key; map and set objects contain elements which are iterable in the order of insertion. maps map object ecmascript 2015 introduces a new data structure to map values to values. a map object is a simple key/value map and can iterate its elements in insertion order. the following code shows some basic operations with a map. see also the map reference page for more examples and the complete api. you can use a for...of loop to return an array of [key, value] for each iteration. let sayings = new map(); sayings.set('dog', 'woof'); sayings.set('cat', 'meow'); sayings.set('elephant', 'toot'); sayings.size; // 3 sayings.get('dog'); // woof sayings.get('fox'); // undefined sayings.has('bird'); // ...
...s and the complete api. you can use a for...of loop to return an array of [key, value] for each iteration. let sayings = new map(); sayings.set('dog', 'woof'); sayings.set('cat', 'meow'); sayings.set('elephant', 'toot'); sayings.size; // 3 sayings.get('dog'); // woof sayings.get('fox'); // undefined sayings.has('bird'); // false sayings.delete('dog'); sayings.has('dog'); // false for (let [key, value] of sayings) { console.log(key + ' goes ' + value); } // "cat goes meow" // "elephant goes toot" sayings.clear(); sayings.size; // 0 object and map compared traditionally, objects have been used to map strings to values. objects allow you to set keys to values, retrieve those values, delete keys, and detect whether something is stored at a key. map objects, however, have a few more advantag...
... you can get the size of a map easily, while you have to manually keep track of size for an object. the iteration of maps is in insertion order of the elements. an object has a prototype, so there are default keys in the map. ...
...And 7 more matches
Array.prototype.filter() - JavaScript
, thisarg]) parameters callback function is a predicate, to test each element of the array. return true to keep the element, false otherwise. it accepts three arguments: element the current element being processed in the array. indexoptional the index of the current element being processed in the array. arrayoptional the array filter was called upon. thisargoptional value to use as this when executing callback. return value a new array with the elements that pass the test. if no elements pass the test, an empty array will be returned. description filter() calls a provided callback function once for each element in an array, and constructs a new array of all the values for which callback returns a value that coerces to true. callback is invoked only for indexe...
...back. return value a new array with the elements that pass the test. if no elements pass the test, an empty array will be returned. description filter() calls a provided callback function once for each element in an array, and constructs a new array of all the values for which callback returns a value that coerces to true. callback is invoked only for indexes of the array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values. array elements which do not pass the callback test are simply skipped, and are not included in the new array. ...
...e values for which callback returns a value that coerces to true. callback is invoked only for indexes of the array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values. array elements which do not pass the callback test are simply skipped, and are not included in the new array. callback is invoked with three arguments: the value of the element the index of the element the array object being traversed if a thisarg parameter is provided to filter, it will be used as the callback's this value. otherwise, the value undefined will be used as its this value. the this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. filter() does not mutate the ...
...And 7 more matches
BigInt64Array - JavaScript
if control over byte order is needed, use dataview instead. the contents are initialized to 0n. once established, you can reference elements in the array using the object's methods, or by using standard array index syntax (that is, using bracket notation). constructor bigint64array() creates a new bigint64array object. static properties bigint64array.bytes_per_element returns a number value of the element size. 8 in the case of a bigint64array. bigint64array.name returns the string value of the constructor name. in the case of the bigint64array type, this is "bigint64array". static methods bigint64array.from() 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 ar...
... only. bigint64array.prototype.length returns the number of elements hold in the bigint64array. this is fixed at construction time and thus read only. instance methods bigint64array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). bigint64array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). bigint64array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). bigint64array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). bigint64array.prototype.
...see also array.prototype.find(). ...
...And 7 more matches
BigUint64Array - JavaScript
control over byte order is needed, use dataview instead. the contents are initialized to 0n. once established, you can reference elements in the array using the object's methods, or by using standard array index syntax (that is, using bracket notation). constructor biguint64array() creates a new biguint64array object. static properties biguint64array.bytes_per_element returns a number value of the element size. 8 in the case of a biguint64array. biguint64array.name returns the string value of the constructor name. in the case of the biguint64array type this is "biguint64array". static methods biguint64array.from() creates a new biguint64array from an array-like or iterable object. see also array.from(). biguint64array.of() creates a new biguint64array with a variable numbe...
...y. biguint64array.prototype.length returns the number of elements hold in the biguint64array. this is fixed at construction time and thus read only. instance methods biguint64array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). biguint64array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). biguint64array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). biguint64array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). biguint64array.prototy...
...see also array.prototype.find(). ...
...And 7 more matches
Float32Array - JavaScript
order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). constructor float32array() creates a new float32array object. static properties float32array.bytes_per_element returns a number value of the element size. 4 in the case of an float32array. float32array.name returns the string value of the constructor name. in the case of the float32array type: "float32array". static methods float32array.from() creates a new float32array from an array-like or iterable object. see also array.from(). float32array.of() creates a new float32array with a variable number of arguments. see al...
...nd thus read only. float32array.prototype.length returns the number of elements hold in the float32array. fixed at construction time and thus read only. instance methods float32array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). float32array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). float32array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). float32array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). float32array.prototype.fil...
...see also array.prototype.find(). ...
...And 7 more matches
Float64Array - JavaScript
order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). constructor float64array() creates a new float64array object. static properties float64array.bytes_per_element returns a number value of the element size. 8 in the case of an float64array. float64array.name returns the string value of the constructor name. in the case of the float64array type: "float64array". static methods float64array.from() creates a new float64array from an array-like or iterable object. see also array.from(). float64array.of() creates a new float64array with a variable number of arguments. see al...
...nd thus read only. float64array.prototype.length returns the number of elements hold in the float64array. fixed at construction time and thus read only. instance methods float64array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). float64array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). float64array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). float64array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). float64array.prototype.fil...
...see also array.prototype.find(). ...
...And 7 more matches
Generator.prototype.next() - JavaScript
the next() method returns an object with two properties done and value. you can also provide a parameter to the next method to send a value to the generator. syntax gen.next(value) parameters value the value to send to the generator. the value will be assigned as a result of a yield expression. for example, in variable = yield expression, the value passed to the .next() function will be assigned to variable. return value an object with two properties: done (boolean) has the value true if the iterator is past the end of the iterated sequence. in this case value optionally specifies the return value of the iterator. has the value false if the iterator was able to produce the next value in the sequence. ...
... be assigned to variable. return value an object with two properties: done (boolean) has the value true if the iterator is past the end of the iterated sequence. in this case value optionally specifies the return value of the iterator. has the value false if the iterator was able to produce the next value in the sequence. this is equivalent of not specifying the done property altogether. value any javascript value returned by the iterator. can be omitted when done is true. ...
...uence. this is equivalent of not specifying the done property altogether. value any javascript value returned by the iterator. can be omitted when done is true. ...
...And 7 more matches
Int16Array - JavaScript
m byte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). constructor int16array() creates a new int16array object. static properties int16array.bytes_per_element returns a number value of the element size. 2 in the case of an int16array. int16array.name returns the string value of the constructor name. in the case of the int16array type: "int16array". static methods int16array.from() creates a new int16array from an array-like or iterable object. see also array.from(). int16array.of() creates a new int16array with a variable number of arguments. see also array.of(). ...
...n time and thus read only. int16array.prototype.length returns the number of elements hold in the int16array. fixed at construction time and thus read only. instance methods int16array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). int16array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). int16array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). int16array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). int16array.prototype.filter() ...
...see also array.prototype.find(). ...
...And 7 more matches
Int32Array - JavaScript
m byte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). constructor int32array() creates a new int32array object. static properties int32array.bytes_per_element returns a number value of the element size. 4 in the case of an int32array. int32array.name returns the string value of the constructor name. in the case of the int32array type: "int32array". static methods int32array.from() creates a new int32array from an array-like or iterable object. see also array.from(). int32array.of() creates a new int32array with a variable number of arguments. see also array.of(). ...
...n time and thus read only. int32array.prototype.length returns the number of elements hold in the int32array. fixed at construction time and thus read only. instance methods int32array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). int32array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). int32array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). int32array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). int32array.prototype.filter() ...
...see also array.prototype.find(). ...
...And 7 more matches
Int8Array - JavaScript
ay typed array represents an array of twos-complement 8-bit signed integers. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). constructor int8array() creates a new int8array object. static properties int8array.bytes_per_element returns a number value of the element size. 1 in the case of an int8array. int8array.name returns the string value of the constructor name. in the case of the int8array type: "int8array". static methods int8array.from() creates a new int8array from an array-like or iterable object. see also array.from(). int8array.of() creates a new int8array with a variable number of arguments. see also array.of(). instanc...
...ction time and thus read only. int8array.prototype.length returns the number of elements hold in the int8array. fixed at construction time and thus read only. instance methods int8array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). int8array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). int8array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). int8array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). int8array.prototype.filter() cr...
...see also array.prototype.find(). ...
...And 7 more matches
NaN - JavaScript
in modern browsers, nan is a non-configurable, non-writable property. even when this is not the case, avoid overriding it. ...
... no configurable no the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. description nan is a property of the global object. in other words, it is a variable in global scope. the initial value of nan is not-a-number — the same as the value of number.nan. in modern browsers, nan is a non-configurable, non-writable property. even when this is not the case, avoid overriding it. it is rather rare to use nan in a program. there are five different types of operations that return nan: number cannot be parsed (e.g. parseint("blabla") or number(undefined)) math operation where the result...
... be parsed (e.g. parseint("blabla") or number(undefined)) math operation where the result is not a real number (e.g. math.sqrt(-1)) operand of an argument is nan (e.g. 7 ** nan) indeterminate form (e.g. 0 * infinity) any operation that involves a string and is not an addition operation (e.g. ...
...And 7 more matches
Object.defineProperties() - 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 object.defineproperties(obj, props) parameters obj the object on which to define or modify properties. props an object whose keys represent the names of properties to be defined or modified and whose values are objects describing those properties. each value in props must be either a data descriptor or an accessor descriptor; it cannot be both (see object.defineproperty() for more details). data descriptors and accessor descriptors may optionally contain the following keys: configurable true if and only if the type of this property descriptor may be changed and if the property may be delet...
...ing keys: configurable true if and only if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object. defaults to false. enumerable true if and only if this property shows up during enumeration of the properties on the corresponding object. defaults to false. a data descriptor also has the following optional keys: value the value associated with the property. can be any valid javascript value (number, object, function, etc). defaults to undefined. writable true if and only if the value associated with the property may be changed with an assignment operator. defaults to false. an accessor descriptor also has the following optional keys: get a function which serves as a getter for the property...
...javascript value (number, object, function, etc). defaults to undefined. writable true if and only if the value associated with the property may be changed with an assignment operator. defaults to false. an accessor descriptor also has the following optional keys: get a function which serves as a getter for the property, or undefined if there is no getter. the function's return value will be used as the value of the property. defaults to undefined. set a function which serves as a setter for the property, or undefined if there is no setter. the function will receive as its only argument the new value being assigned to the property. defaults to undefined. if a descriptor has neither of value, writable, get and set keys, it is treated as a data descriptor. if a desc...
...And 7 more matches
Object - JavaScript
object.setprototypeof). changes to the object prototype object are seen by all objects through prototype chaining, unless the properties and methods subject to those changes are overridden further along the prototype chain. this provides a very powerful although potentially dangerous mechanism to override or extend object behavior. the object constructor creates an object wrapper for the given value. if the value is null or undefined, it will create and return an empty object. otherwise, it will return an object of a type that corresponds to the given value. if the value is an object already, it will return the value. when called in a non-constructor context, object behaves identically to new object(). see also the object initializer / literal syntax. deleting a property from an obj...
...ed in a non-constructor context, object behaves identically to new object(). see also the object initializer / literal syntax. deleting a property from an object there isn't any method in an object itself to delete its own properties (such as map.prototype.delete()). to do so, one must use the delete operator. constructor object() creates a new object object. it is a wrapper for the given value. static methods object.assign() copies the values of all enumerable own properties from one or more source objects to a target object. object.create() creates a new object with the specified prototype object and properties. object.defineproperty() adds the named property described by a given descriptor to an object. object.defineproperties() adds the named properties described by the ...
...ne or more source objects to a target object. object.create() creates a new object with the specified prototype object and properties. object.defineproperty() adds the named property described by a given descriptor to an object. object.defineproperties() adds the named properties described by the given descriptors to an object. object.entries() returns an array containing all of the [key, value] pairs of a given object's own enumerable string properties. object.freeze() freezes an object. other code cannot delete or change its properties. object.fromentries() returns a new object from an iterable of [key, value] pairs. (this is the reverse of object.entries). object.getownpropertydescriptor() returns a property descriptor for a named property on an object. object.getownpropertyde...
...And 7 more matches
RangeError - JavaScript
constructor rangeerror() creates a new rangeerror object. instance properties rangeerror.prototype.message error message. ...
... constructor rangeerror() creates a new rangeerror object. instance properties rangeerror.prototype.message error message. ...
... constructor rangeerror() creates a new rangeerror object. instance properties rangeerror.prototype.message error message. ...
...And 7 more matches
Uint16Array - JavaScript
yte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). constructor uint16array() creates a new uint16array object. static properties uint16array.bytes_per_element returns a number value of the element size. 2 in the case of an uint16array. uint16array.name returns the string value of the constructor name. in the case of the uint16array type: "uint16array". static methods uint16array.from() creates a new uint16array from an array-like or iterable object. see also array.from(). uint16array.of() creates a new uint16array with a variable number of arguments. see also array...
...me and thus read only. uint16array.prototype.length returns the number of elements hold in the uint16array. fixed at construction time and thus read only. instance methods uint16array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). uint16array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). uint16array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). uint16array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). uint16array.prototype.filter...
...see also array.prototype.find(). ...
...And 7 more matches
Uint32Array - JavaScript
yte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). constructor uint32array() creates a new uint32array object. static properties uint32array.bytes_per_element returns a number value of the element size. 4 in the case of an uint32array. uint32array.name returns the string value of the constructor name. in the case of the uint32array type: "uint32array". static methods uint32array.from() creates a new uint32array from an array-like or iterable object. see also array.from(). uint32array.of() creates a new uint32array with a variable number of arguments. see also array...
...me and thus read only. uint32array.prototype.length returns the number of elements hold in the uint32array. fixed at construction time and thus read only. instance methods uint32array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). uint32array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). uint32array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). uint32array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). uint32array.prototype.filter...
...see also array.prototype.find(). ...
...And 7 more matches
Uint8Array - JavaScript
he uint8array typed array represents an array of 8-bit unsigned integers. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). constructor uint8array() creates a new uint8array object. static properties uint8array.bytes_per_element returns a number value of the element size. 1 in the case of an uint8array. uint8array.name returns the string value of the constructor name. in the case of the uint8array type: "uint8array". static methods uint8array.from() creates a new uint8array from an array-like or iterable object. see also array.from(). uint8array.of() creates a new uint8array with a variable number of arguments. see also array.of(). ...
...n time and thus read only. uint8array.prototype.length returns the number of elements held in the uint8array. fixed at construction time and thus read only. instance methods uint8array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). uint8array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). uint8array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). uint8array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). uint8array.prototype.filter() ...
...see also array.prototype.find(). ...
...And 7 more matches
Uint8ClampedArray - JavaScript
the uint8clampedarray typed array represents an array of 8-bit unsigned integers clamped to 0-255; if you specified a value 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). constructor uint8clampedarray() creates a new uint8clampedarray object. static properties uint8clampedarray.bytes_per_element returns a number value of the element size. 1 in the case of an uint8clampedarray. uint8clampedarray.name returns the string value of the constructor name. in the case of the uint8clampedarray type: "uint8clampedarray"...
...uint8clampedarray.prototype.length returns the number of elements hold in the uintclamped8array. fixed at construction time and thus read only. instance methods uint8clampedarray.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). uint8clampedarray.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). uint8clampedarray.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). uint8clampedarray.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). uint8clampedarra...
...see also array.prototype.find(). ...
...And 7 more matches
WeakMap - JavaScript
the weakmap object is a collection of key/value pairs in which the keys are weakly referenced. the keys must be objects and the values can be arbitrary values. you can learn more about weakmaps in the weakmap object guide (under keyed collections). description keys of weakmaps are of the type object only. primitive data types as keys are not allowed (e.g. a symbol can't be a weakmap key). why weakmap? ...
... the keys must be objects and the values can be arbitrary values. you can learn more about weakmaps in the weakmap object guide (under keyed collections). description keys of weakmaps are of the type object only. primitive data types as keys are not allowed (e.g. a symbol can't be a weakmap key). why weakmap? ...
...in the weakmap object guide (under keyed collections). description keys of weakmaps are of the type object only. primitive data types as keys are not allowed (e.g. a symbol can't be a weakmap key). why weakmap? a map api could be implemented in javascript with two arrays (one for keys, one for values) shared by the four api methods. setting elements on this map would involve pushing a key and value onto the end of each of those arrays simultaneously. as a result, the indices of the key and value would correspond to both arrays. getting values from the map would involve iterating through all keys to find a match, then using the index of this match to retrieve the corresponding value from the array of values. such an implementation would have two main inconveniences: the first one is an o...
...And 7 more matches
isNaN() - JavaScript
the isnan() function determines whether a value is nan or not. note, coercion inside the isnan function has interesting rules; you may alternatively want to use number.isnan(), as defined in ecmascript 2015. syntax isnan(value) parameters value the value to be tested. return value true if the given value is nan; otherwise, false. description the necessity of an isnan function unlike all other possible values in javascript, it is not possible to rely on the equality operators (== and ===) to determine whether a value is nan or not, because both nan == nan and nan === nan evaluate to false. hence, the necessity of an isnan function. ...
... tested. return value true if the given value is nan; otherwise, false. description the necessity of an isnan function unlike all other possible values in javascript, it is not possible to rely on the equality operators (== and ===) to determine whether a value is nan or not, because both nan == nan and nan === nan evaluate to false. hence, the necessity of an isnan function. origin of nan values nan values are generated when arithmetic operations result in undefined or unrepresentable values. such values do not necessarily represent overflow conditions. a nan also results from attempted coercion to numeric values of non-numeric values for which no primitive numeric value is available. for example, dividing zero by zero results in a nan — but dividing other numbers by zero does not. ...
...n-numeric values for which no primitive numeric value is available. for example, dividing zero by zero results in a nan — but dividing other numbers by zero does not. confusing special-case behavior since the very earliest versions of the isnan function specification, its behavior for non-numeric arguments has been confusing. when the argument to the isnan function is not of type number, the value is first coerced to a number. the resulting value is then tested to determine whether it is nan. ...
...And 7 more matches
Object initializer - JavaScript
objects can be initialized using new object(), object.create(), or using the literal notation (initializer notation). an object initializer is a comma-delimited list of zero or more pairs of property names and associated values of an object, enclosed in curly braces ({}). the source for this interactive example is stored in a github repository. if 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 let o = {} let o = {a: 'foo', b: 42, c: {}} let a = 'foo', b = 42, c = {} let o = {a: a, b: b, c: c} let o = { property: function (parameters) {}, get property() {}, set property(value) {} }; new notations in ecmascript 2015 please see the compatibility table for support for these notations. in non-supporting environments, these notations will lead to syntax errors. // shorthand property names (es2015) let a = 'foo', b = 42, c = {}; let o = {a, b, c} // shorthand method names (es2015) let o = { property(parameters) {} } // computed property names (es2015) let prop = 'fo...
...let a = 'foo', b = 42, c = {}; let o = {a, b, c} // shorthand method names (es2015) let o = { property(parameters) {} } // computed property names (es2015) let prop = 'foo' let o = { [prop]: 'hey', ['b' + 'ar']: 'there' } description an object initializer is an expression that describes the initialization of an object. objects consist of properties, which are used to describe an object. values of object properties can either contain primitive data types or other objects. object literal notation vs json the object literal notation is not the same as the javascript object notation (json). although they look similar, there are differences between them: json permits only property definition using "property": value syntax. the property name must be double-quoted, and the definition c...
...And 7 more matches
yield* - 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 yield* expression; expression the expression which returns an iterable object. description the yield* expression iterates over the operand and yields each value returned by it. the value of yield* expression itself is the value returned by that iterator when it's closed (i.e., when done is true). examples delegating to another generator in following code, values yielded by g1() are returned from next() calls just like those which are yielded by g2(). function* g1() { yield 2; yield 3; yield 4; } function* g2() { yield 1; yield* g1(); yi...
... returned by that iterator when it's closed (i.e., when done is true). examples delegating to another generator in following code, values yielded by g1() are returned from next() calls just like those which are yielded by g2(). ...
...one is true). examples delegating to another generator in following code, values yielded by g1() are returned from next() calls just like those which are yielded by g2(). function* g1() { yield 2; yield 3; yield 4; } function* g2() { yield 1; yield* g1(); yield 5; } const iterator = g2(); console.log(iterator.next()); // {value: 1, done: false} console.log(iterator.next()); // {value: 2, done: false} console.log(iterator.next()); // {value: 3, done: false} console.log(iterator.next()); // {value: 4, done: false} console.log(iterator.next()); // {value: 5, done: false} console.log(iterator.next()); // {value: undefined, done: true} other iterable objects besides generator objects, yield* can also yield other kinds of iterables (e.g., arrays, strings, or arguments objects). ...
...And 7 more matches
const - JavaScript
this can be any legal expression, including a function expression. ...
...this can be any legal expression, including a function expression. ...
...this can be any legal expression, including a function expression. description this declaration creates a constant whose scope can be either global or local to the block in which it is declared. ...
...And 7 more matches
throw - JavaScript
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. syntax throw expression; expression the expression to throw. description use the throw statement to throw an exception. ...
...oject, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax throw expression; expression the expression to throw. description use the throw statement to throw an exception. when you throw an exception, expression specifies the value of the exception. each of the following throws an exception: throw 'error2'; // generates an exception with a string value throw 42; // generates an exception with the value 42 throw true; // generates an exception with the value true throw new error('required'); // generates an error object with the message of required also note that the throw statement is affected by automatic semicolon insertion (asi) as no line terminator between the throw keyword and the expression is allowed. examples throw an ob...
... creates a zipcode object. * * accepted formats for a zip code are: * 12345 * 12345-6789 * 123456789 * 12345 6789 * * if the argument passed to the zipcode constructor does not * conform to one of these patterns, an exception is thrown. ...
...And 7 more matches
<mo> - MathML
Web › MathML › Element › mo
the mathml <mo> element represents an operator in a broad sense. besides operators in strict mathematical meaning, this element also includes "operators" like parentheses, separators like comma and semicolon, or "absolute value" bars. attributes accent if the operator is used as an under- or overscript this attribute specifies whether the operator should be treated as an accent. allowed values are true or false. class, id, style provided for use with stylesheets. dir the text direction. possible values are either ltr (left to right) or rtl (right to left). fence there is no visual effect for this attribute, but it specifies whether the operator is a fence (such as parentheses). allowed values are true or false. form specifies the role of the operator in an enclosed expression, w...
...o left). fence there is no visual effect for this attribute, but it specifies whether the operator is a fence (such as parentheses). allowed values are true or false. form specifies the role of the operator in an enclosed expression, which affects spacing and other default properties. for ordinary operators (+, -, etc. ) you usually do not need to specify this attribute explicitly. possible values are: prefix, for opening fences. (it is the default value if the operator is the first argument in a <mrow> element with more than one argument.) infix, for separators. ...
...e operator in an enclosed expression, which affects spacing and other default properties. for ordinary operators (+, -, etc. ) you usually do not need to specify this attribute explicitly. possible values are: prefix, for opening fences. (it is the default value if the operator is the first argument in a <mrow> element with more than one argument.) infix, for separators. (it is the default value if the operator is not included in a <mrow> element.) 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. ...
...And 7 more matches
d - SVG: Scalable Vector Graphics
Web › SVG › Attribute › d
glyph>, and <missing-glyph> html,body,svg { height:100% } <svg viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <path fill="none" stroke="red" d="m 10,30 a 20,20 0,0,1 50,30 a 20,20 0,0,1 90,30 q 90,60 50,90 q 10,60 10,30 z" /> </svg> path for <path>, d is a string containing a series of path commands that define the path to be drawn. ...
...,body,svg { height:100% } <svg viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <path fill="none" stroke="red" d="m 10,30 a 20,20 0,0,1 50,30 a 20,20 0,0,1 90,30 q 90,60 50,90 q 10,60 10,30 z" /> </svg> path for <path>, d is a string containing a series of path commands that define the path to be drawn. ...
...however the <glyph> element has its origin in the bottom left corner of its letterbox. ...
...And 7 more matches
end - SVG: Scalable Vector Graphics
Web › SVG › Attribute › end
the end attribute defines an end value for the animation that can constrain the active duration. five elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, <animatetransform>, and <set> usage notes default value none value <end-value-list> animatable no the <end-value-list> is a semicolon-separated list of values. each value can be one of the following: <offset-value> this value defines a clock-value that represents a point in time relative to the beginning of the svg document (usually the load or domcontentloaded event). negative values are valid. <syncbase-value> this value defines a syncbase and an optional offset from that syncbase. the element's animation end time is defined relative to the begin or active end of...
...e> this value defines a clock-value that represents a point in time relative to the beginning of the svg document (usually the load or domcontentloaded event). negative values are valid. <syncbase-value> this value defines a syncbase and an optional offset from that syncbase. the element's animation end time is defined relative to the begin or active end of another animation. a valid syncbase-value consists of an id reference to another animation element followed by a dot and either begin or end to identify whether to synchronize with the beginning or active end of the referenced animation element. an optional offset value as defined in <offset-value> can be appended. ...
...nt's animation end time is defined relative to the begin or active end of another animation. a valid syncbase-value consists of an id reference to another animation element followed by a dot and either begin or end to identify whether to synchronize with the beginning or active end of the referenced animation element. an optional offset value as defined in <offset-value> can be appended. <event-value> this value defines an event and an optional offset that determines the time at which the element's animation should end. the animation end time is defined relative to the time that the specified event is fired. a valid event-value consists of an element id followed by a dot and one of the supported events for that element. all valid events (not necessarily supported by all elements) are define...
...And 7 more matches
stroke-linecap - SVG: Scalable Vector Graphics
resentation attribute stroke-linecap can be used as a css property. ...
...ement but it has effect only on the following eight elements: <altglyph>, <path>, <polyline>, <line>, <text>, <textpath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewbox="0 0 6 6" xmlns="http://www.w3.org/2000/svg"> <!-- effect of the (default) "butt" value --> <line x1="1" y1="1" x2="5" y2="1" stroke="black" stroke-linecap="butt" /> <!-- effect of the "round" value --> <line x1="1" y1="3" x2="5" y2="3" stroke="black" stroke-linecap="round" /> <!-- effect of the "square" value --> <line x1="1" y1="5" x2="5" y2="5" stroke="black" stroke-linecap="square" /> <!-- the 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> u...
...1="3" x2="5" y2="3" stroke="black" stroke-linecap="round" /> <!-- effect of the "square" value --> <line x1="1" y1="5" x2="5" y2="5" stroke="black" stroke-linecap="square" /> <!-- the 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. on a zero length subpath, the path will not be rendered at all. ...
...And 7 more matches
<a> - SVG: Scalable Vector Graphics
Web › SVG › Element › a
:hover, svg|a:active { outline: dotted 1px blue; } since this element shares its tag name with html's <a> element, selecting a with css or queryselector may apply to the wrong kind of element. try the @namespace rule to distinguish the two. attributes download instructs browsers to download a url instead of navigating to it, so the user will be prompted to save it as a local file. ...
...e: dotted 1px blue; } since this element shares its tag name with html's <a> element, selecting a with css or queryselector may apply to the wrong kind of element. try the @namespace rule to distinguish the two. attributes download instructs browsers to download a url instead of navigating to it, so the user will be prompted to save it as a local file. ...
...ment, selecting a with css or queryselector may apply to the wrong kind of element. try the @namespace rule to distinguish the two. attributes download instructs browsers to download a url instead of navigating to it, so the user will be prompted to save it as a local file. value type: <string> ; default value: none; animatable: no href the url or url fragment the hyperlink points to. value type: <url> ; default value: none; animatable: yes hreflang the human language of the url or url fragment that the hyperlink points to. value type: <string> ; default value: none; animatable: yes ping a space-separated list of urls to which, when the hyperlink is followed, post requests with the body ping will be sent by the browser (in the background). typically used for tracking. for a m...
...And 7 more matches
<line> - SVG: Scalable Vector Graphics
Web › SVG › Element › line
t is an svg basic 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. ...
...ing 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. ...
...p://www.w3.org/2000/svg"> <line x1="0" y1="80" x2="100" y2="20" stroke="black" /> <!-- if you do not specify the stroke color the line will not be visible --> </svg> attributes x1 defines the x-axis coordinate of the line starting point. value type: <length>|<percentage>|<number> ; default value: 0; animatable: yes x2 defines the x-axis coordinate of the line ending point. value type: <length>|<percentage>|<number> ; default value: 0; animatable: yes y1 defines the y-axis coordinate of the line starting point. ...
...And 7 more matches
<radialGradient> - SVG: Scalable Vector Graphics
ww.w3.org/1999/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 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. ...
...lor="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. 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. ...
...And 7 more matches
passwords - Archive of obsolete content
ion credentials add-on credential these are associated with your add-on rather than a particular web site. they contain the following properties: username the username. password the password. url for an add-on credential, this property is of the form: addon:<addon-id>, where <addon-id> is the add-on's program id. you don't supply this value when storing an add-on credential: it is automatically generated for you. however, you can use it to work out which stored credentials belong to your add-on by comparing it with the uri property of the self module. realm you can use this as a name for the credential, to distinguish it from any other credentials you've stored. the realm is displayed in firefox's password ...
...service uses html forms to authenticate its users, then the corresponding credential is an html form credential. it contains the following properties: username the username. password the password. url the url for the web service which requires the credential. you should omit anything after the hostname and (optional) port. formsubmiturl the value of the form's "action" attribute. you should omit anything after the hostname and (optional) port. if the form doesn't contain an "action" attribute, this property should match the url property. usernamefield the value of the "name" attribute for the form's username field. passwordfield the value of the "name" attribute for the form's password field. so: given a for...
...the value of the "name" attribute for the form's password field. so: given a form at http://www.example.com/login with the following html: <form action="http://login.example.com/foo/authenticate.cgi"> <div>please log in.</div> <label>username:</label> <input type="text" name="uname"> <label>password:</label> <input type="password" name="pword"> </form> the corresponding values for the credential (excluding username and password) should be: url: "http://www.example.com" formsubmiturl: "http://login.example.com" usernamefield: "uname" passwordfield: "pword" note that for both url and formsubmiturl, the portion of the url after the hostname is omitted. http authentication credential these are used to authenticate the user to a web site which uses http auth...
...And 6 more matches
ui/button/toggle - Archive of obsolete content
the button appears in the firefox toolbar: however, users can move it to the firefox menu panel: badged buttons new in firefox 36. you can add a "badge" to a button using its badge property. this can contain a number or a string, and you can update it at any time. ...
...button api handles this by defining a tree of potential states. at the root is the global state, then there's a state you can set for each window, then a state you can set for each tab. more-specific states override less-specific states. for example, suppose the browser has two windows (w1 and w2), and each window has two tabs. ...
...or the button. you can specify this in one of three ways: as a resource:// url pointing at an icon file in your add-on's "data" directory, typically constructed using self.data.url(iconfile) as a relative path: a string in the form "./iconfile", where "iconfile" is a relative path to the icon file beginning in your add-on's "data" directory as an object, or dictionary of key-value pairs. here you can specify a range of sizes for your button's icon. each key-value pair specifies an icon: each value specifies an image file as a resource:// url or relative path. each key must be a numeric string such as "16", or "32", which represents the size in pixels of the corresponding image. var { togglebutton } = require('sdk/ui/button/toggle...
...And 6 more matches
Adding windows and dialogs - Archive of obsolete content
avascript window.open function just like with html windows. window.open( "chrome://xulschoolhello/content/somewindow.xul", "xulschoolhello-some-window", "chrome,centerscreen"); the first argument is the url to open, the second is an id to identify the window, and the last is an optional comma-separated list of features, which describe the behavior and appearance of the window. if this value is null or empty, the default toolbars of the main window will be added to the new one, which is rarely what you want. the window.open page has a detailed description of the features you can use and their values. the following features are very important and you should always keep them in mind: chrome. this can only be used from the chrome, not from regular html javascript. it indicates that a...
...general, windows should not be resizable unless they display dynamically generated content from a datasource, such as lists or trees that may need resizing to have a better view of the content. to open a new dialog, use the function window.opendialog, an extension of the open function. it allows you to send a set of optional parameters that can be used to communicate with the dialog. ...
...ld not be resizable unless they display dynamically generated content from a datasource, such as lists or trees that may need resizing to have a better view of the content. to open a new dialog, use the function window.opendialog, an extension of the open function. it allows you to send a set of optional parameters that can be used to communicate with the dialog. ...
...And 6 more matches
XPCOM Objects - Archive of obsolete content
e xul planet is no longer with us. interfaces can be awkward to handle. if you want to call a method or use an attribute of interface x in a component, you first need to "cast" the component to interface x. this is done via the queryinterface method that is included in all xpcom components. ...
...these methods are in the nsiprefbranch interface. the getservice and createinstance methods allow you to get the component already set to an interface. in many cases you only need to use one interface, and you won't have to worry about queryinterface. ...
...tboolpref("somepreferencename"); this._prefservice.queryinterface(ci.nsiprefbranch2); this._prefservice.addobserver("somepreferencename", this, false); this._prefservice.queryinterface(ci.nsiprefbranch); this is a common piece of code you'll see when initializing components or jsm that rely on preferences. we use the preferences service to get and set preference values, such as the preference value we're getting on the fourth line of code. these methods are in the nsiprefbranch interface. the getservice and createinstance methods allow you to get the component already set to an interface. in many cases you only need to use one interface, and you won't have to worry about queryinterface. but in this case we need to change the interface to nsiprefbranch2, which is the one that includes the me...
...And 6 more matches
Session store API - Archive of obsolete content
r extensions to easily save and restore data across firefox sessions. there is a simple api that lets extensions access the session store feature. one key scenario in which supporting this feature can be crucial for an extension: firefox 2 lets users undo the closing of tabs. in order to properly restore your extension's state when a tab is restored, it needs to use the session store api's settabvalue() method to save any data it will need in order to restore its state, and then call gettabvalue() to retrieve the previous setting when the tab is restored. the session store api is implemented using the nsisessionstore interface. knowing when to restore each time firefox is about to restore a tab, an event of type sstabrestoring is sent. if your extension wants to be able to restore data when...
...ys sent for each tab being restored. you can determine which tab is being restored by looking at the event's originaltarget field. there's not really a way to determine when the last tab has been restored unless you determine how many tabs need to be restored then count the sstabrestored events. this section provides a few simple examples of how to make use of the session store api. ...
...which tab is being restored by looking at the event's originaltarget field. there's not really a way to determine when the last tab has been restored unless you determine how many tabs need to be restored then count the sstabrestored events. this section provides a few simple examples of how to make use of the session store api. ...
...And 6 more matches
Download Manager preferences - Archive of obsolete content
there are several preferences used by the download manager. this article provides a list of them. preference description browser.download.antivirus.dontclean note: in gecko 1.9.1. a boolean value that indicates whether the anti virus software should try to clean a downloaded file when a virus is detected. default value is false. browser.download.manager.addtorecentdocs a boolean value that indicates whether or not new downloads should be added to the recent documents list. default value is true. browser.download.manager.alertonexeopen a boolean value that indicates whether the ui should alert the user about the dangers of opening (executing) an exe. the user may check a "don't ask" box on the ui to toggle this. ...
...ger.addtorecentdocs a boolean value that indicates whether or not new downloads should be added to the recent documents list. default value is true. browser.download.manager.alertonexeopen a boolean value that indicates whether the ui should alert the user about the dangers of opening (executing) an exe. the user may check a "don't ask" box on the ui to toggle this. default value is true. browser.download.manager.closewhendone a boolean value indicating whether or not the downloads window should close automatically when downloads are completed. in thunderbird the default value is true. in other applications the default value is false. browser.download.manager.flashcount indicates the number of times the appropriate user interface element sh...
...ng whether or not the downloads window should close automatically when downloads are completed. in thunderbird the default value is true. in other applications the default value is false. browser.download.manager.flashcount indicates the number of times the appropriate user interface element should be "flashed" to get the user's attention when a download completes. default value is 2. browser.download.manager.focuswhenstarting a boolean value that indicates whether or not to focus the download manager window when a download begins. in firefox,thunderbird and seamonkey the default value is false. in other applications the default value is true. browser.download.manager.quitbehavior indicates what should happen to in-progress downloads if th...
...And 6 more matches
Editor Embedding Guide - Archive of obsolete content
no parameters note only available if txmgr.dll is present. cmd_redo redoes last executed command. getcommandstate "state_enabled"(boolean) docommand no parameters note only available if txmgr.dll is present. cmd_fontcolor acts upon the current selection to set the font color. getcommandstate "state_attribute" (cstring) docommand "state_attribute" (cstring) note for color values, use the cstring representation of rrggbb, e.g., red="#ff0000" and black="#000000". cmd_backgroundcolor sets the background color of the document. getcommandstate "state_attribute" (cstring) docommand "state_attribute" (cstring) note for color values, use the cstring representation of rrggbb, e.g., red="#ff0000" and black="#000000". cmd_fontface sets the font face for the current s...
...ate_enabled" (boolean) docommand no parameter note getcommandstate in these cases will return whether or not it is possible to call docommand. this will not really give you any concrete information on the state of the command. nsicommandparams creating how do you create an nsicommandparams? -saari writing once you have created an nsicommandparams you call the "set" methods. ...
...boolean) docommand no parameter note getcommandstate in these cases will return whether or not it is possible to call docommand. this will not really give you any concrete information on the state of the command. nsicommandparams creating how do you create an nsicommandparams? -saari writing once you have created an nsicommandparams you call the "set" methods. ...
...And 6 more matches
JavaScript Client API - Archive of obsolete content
which defines the basic record api. but, you want to use a derived class, cryptowrapper, which seamlessly encrypts and decrypts records on the client. this makes your synchronized data more secure and unreadable by the server operators. all you have to do is write an object that extends cryptowrapper and maintains a property called cleartext. cleartext must be a json-able object. put into it all values that you want to have encrypted, stored on the server, decrypted, and synced up. you may find it useful to write getters and setters for various properties of your record implementation. the skeleton of a sample record implementation: function foorecord(collection, id) { cryptowrapper.call(this, collection, id); } foorecord.prototype = { __proto__: cryptowrapper.prototype, _logname:...
...ou may find it useful to write getters and setters for various properties of your record implementation. ...
...ters and setters for various properties of your record implementation. ...
...And 6 more matches
Writing to Files - Archive of obsolete content
g this pages to use the supported api is very much welcome! other documentation on files and i/o not using the unavailable nsiscriptableio apis: code snippets: file i/o, open and save dialogs, reading textual data, writing textual data, list of file-related error codes. to write to a file, an output stream is used. an output stream is an object which can be used to write bytes, strings and other values to a file. to create an output stream, use nsiscriptableio.newoutputstream(). this method has a number of options to specify text or binary writing, the character set, and whether to append to an existing file or create a new one. to create an input stream, first get a reference to a nsifile, and then use nsiscriptableio.newoutputstream() to open a stream for writing to it. to learn more about f...
...list as the second argument to the newoutputstream method. in this example, the nocreate flag is used to prevent the creation of new files, and the append flag is used to append to an existing file. writing text files characters are written to a text input stream using a specified character encoding, which defaults to utf-8. this means that a single character will occupy several bytes if it has a value greater than 128. this encoding is done automatically as long as you specify the 'text' flag to nsiscriptableio.newoutputstream(). other character encodings are available; see writing other character encodings below for details about writing text in other encodings. there are several methods available to write to a stream. for text files, you will usually use the writestring method. var file = io...
...-8. as utf-8 can store all characters, you will usually always use this default. for a list of supported character encodings, see supported character sets. the files can be written using the writestring method whichever character encoding is used. the difference is handled internally so you don't need to write any other part of the code differently. writing binary data in addition to text, binary values may be written to a file either as bytes or as numbers. a number of methods are available which may be used for this. if you are going to write to a binary file instead of text, specify the 'binary' flag in place of the 'text' flag when creating the stream with nsiscriptableio.newoutputstream(). var stream = io.newoutputstream(file, "binary"); this line will create and open a binary stream for ...
...And 6 more matches
Additional Navigation - Archive of obsolete content
using a literal as the object of a triple is a common way to filter out specific items. for instance, if items were identified with a type, the data could be filtered to include only items of a particular type. ...
...using a literal as the object of a triple is a common way to filter out specific items. for instance, if items were identified with a type, the data could be filtered to include only items of a particular type. ...
...ere identified with a type, the data could be filtered to include only items of a particular type. here is an example triple that we could use in the photos example: <query> <content uri="?start"/> <member container="?start" child="?photo"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="canal"/> </query> this new triple has a static value for the object attribute instead of a variable reference. you might be able to guess that it will cause a match for only one of the photos, the canal photo. the others won't be able to match when evaluating the triple. to look closer, here is the data network after only the member has been evaluated: (?start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/imag...
...And 6 more matches
Attribute Substitution - Archive of obsolete content
« previousnext » so far, attribute replacement in an action body has been used to replace an entire attribute with the value of a variable. however, you may also replace only part of attribute's value, or use multiple variables in one attribute. for instance, to include a prefix before a variable value, you can use: <label value="my name is ?name"/> the effect will be that the ?name part of the attribute will be replaced by the value of the variable ?name. for instance, if the value of ?name is 'jake', then the attribute value will be 'my name is jake'. ...
...note that variable names must have a space after them as this is how the end of variable is determined. ...
...placement in the action body, except for the uri attribute since that wouldn't be meaningful. note that variable names must have a space after them as this is how the end of variable is determined. that is '?name?age' is considered to be a single variable with that name, not two variables together. to use two variables, place a space between them. ...
...And 6 more matches
Building Trees - Archive of obsolete content
s the cell attributes to determine what to display. the tree builder implements the nsitreeview interface, so it becomes the tree’s view—in other words, the tree’s view and the tree’s builder are the same object. when the tree is displayed, it asks the view for the contents of each cell. the builder looks at the label for the corresponding cell, translates any variables or predicates into values, and returns the value. in the example above, the first cell should display the title. the builder doesn’t compute any labels until the view asks for them. when the view requests a label for the first cell, the builder looks up the ‘http://purl.org/dc/elements/1.1/title’ predicate for the row in question and returns it. the content builder generates content in the template body and substit...
... label="?subject"/> <treecell label="?sender"/> <treecell label="?date"/> </treerow> </treeitem> </treechildren> </action> </template> </tree> features of the tree builder besides the label of a cell, there are several other cell properties you can set when using the tree builder. the supported properties are: label, mode, properties, src and value. ...
...he label of a cell, there are several other cell properties you can set when using the tree builder. the supported properties are: label, mode, properties, src and value. the label attribute is used to set the label for a cell. the mode is used for progress meter columns. it may be set to either “normal” for a normal progress meter or “undetermined” for an undetermined progress meter. the value attribute is used to set the current progress value for normal progress meters. the value attribute may also be used for checkbox columns by setting it to either true or false. ...
...And 6 more matches
Simple Query Syntax - Archive of obsolete content
ery> element is present, the full syntax is used instead. in the simple syntax, the builder will use the default query shown above, although the variable names are randomly generated. since the photos list iterates over the children of a container, we can use the simple syntax. here is what it might look like: <template> <vbox class="box-padded" uri="rdf:*"> <image src="rdf:*"/> <label value="rdf:http://purl.org/dc/elements/1.1/title"/> </vbox> </template> there is no <query> or <action> element used. instead, the builder uses a default query, and the action is placed directly inside the <template> element. you can see that this code is much simpler than the full syntax. to understand how this works, let's examine how the builder processes a simple query. first, it evaluates the d...
...t.com/ndeakin/images/t/obselisk.jpg) the numbers are used here for the variable names, but they are really just randomly generated so you can't refer to them in any way. the member data, or results, are held in the variable represented here by '?2'. three matches have been found so the content will be duplicated three times. ...
...have been found so the content will be duplicated three times. there are several attributes in the example xul content above that have values prefixed with 'rdf:'. since you can't declare variables in the simple syntax, a different way is used to grab rdf data. the 'rdf:' prefix means look up a predicate pointing out of the node for that result (the child or member node). for example, the label's value attribute has a value of rdf:http://purl.org/dc/elements/1.1/title'. this means look up the value of the predicate http://purl.org/dc/elements/1.1/title' pointing out of the current result. of course, it should be obvious that this causes the value attribute to be set to the photo's title. you can get other predicates in the same way, just by using the predicate uri and prefixing it with 'rdf:'. ...
...And 6 more matches
Advanced Rules - Archive of obsolete content
ee for each city. to do this, use the member element as in the following: <tree id="citiestree" datasources="weather.rdf" ref="http://www.xulplanet.com/rdf/weather/cities"> <template> <rule> <conditions> <content uri="?list"/> <member container="?list" child="?city"/> </conditions> <rule> <template> </tree> the template builder starts by grabbing the value of the ref attribute, which in this case is http://www.xulplanet.com/rdf/weather/cities. this resource will be placed in the 'list' variable as specified by the content tag. we can then get related resources to the root resource by using the 'list' variable. the template builder then sees the member element. it causes the builder to iterate over the children of an element. the parent is specified...
...be placed in the 'list' variable as specified by the content tag. we can then get related resources to the root resource by using the 'list' variable. the template builder then sees the member element. it causes the builder to iterate over the children of an element. the parent is specified by the container attribute and the children are specified by the child attribute. in the example above, the value of the container attribute is the variable 'list'. thus the parent will be the value of the list variable, which has been set to the root resource 'http://www.xulplanet.com/rdf/weather/cities'. the effect will be to iterate through the list of children of 'http://www.xulplanet.com/rdf/weather/cities'. if you look at the rdf above, the 'http://www.xulplanet.com/rdf/weather/cities' resource has fou...
...en set to the root resource 'http://www.xulplanet.com/rdf/weather/cities'. the effect will be to iterate through the list of children of 'http://www.xulplanet.com/rdf/weather/cities'. if you look at the rdf above, the 'http://www.xulplanet.com/rdf/weather/cities' resource has four children, one for each different city. the template builder iterates through each one, matching the child against the value of the child attribute. in this case, it is just set to the variable 'city'. so the builder will set the 'city' variable to the each child resource in turn. because there are no more conditions, the condition matches for each of those four resources and the builder will generate content for each of the four. of course, the example above doesn't have any content. we'll add that later. triple eleme...
...And 6 more matches
XUL Questions and Answers - Archive of obsolete content
?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="test-window" title="check list test" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul"> <listbox rows="4"> <listhead> <listheader label="multi-column"/> </listhead> <listcols> <listcol flex="1"/> </listcols> <listitem> <listcell type="checkbox" value="1" label="vghkvghk"/> </listitem> <listitem> <listcell type="checkbox" value="2" label="vghjkvk" checked="true"/> </listitem> <listitem> <listcell type="checkbox" value="3" label="hukfzgjcfj" disabled="true"/> </listitem> </listbox> <listbox rows="4"> <listhead> <listheader label="single-column"/> </listhead> <listitem type="checkbox" value="1" label="vghkvghk...
...if user wants checkbox support for multicolumn lists, then they will have to implement one. ...
...if user wants checkbox support for multicolumn lists, then they will have to implement one. ...
...And 6 more matches
notification - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] the notification is used to display an informative message. it will normally be used as part of a notificationbox. the box includes a button which the user can use to close the box. attributes image, label, priority, persistence, type, value properties accessibletype, control, image, label, priority, persistence, type, value methods close examples <notification label="this is a warning"/> attributes image type: uri the uri of the image to appear on the element. if this attribute is empty or left out, no image appears. the position of the image is determined by the dir and orient attributes. label type: string the label that will appear on the element. if...
...ion label="this is a warning"/> attributes image type: uri the uri of the image to appear on the element. if this attribute is empty or left out, no image appears. the position of the image is determined by the dir and orient attributes. 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. persistence type: integer the persistence may be set to a non-zero value so that the notificationbox's removetransientnotifications method does not remove them. this may be used to close a set of notifications as a group without affecting other notifications. priority type: integer ...
... info a notification that is of lesser importance. warning a normal warning notification. ...
...And 6 more matches
progressmeter - Archive of obsolete content
hich 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. more information is available in the xul tutorial. ...
...gthy 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. more information is available in the xul tutorial. ...
...s 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. more information is available in the xul tutorial. ...
...And 6 more matches
richlistitem - Archive of obsolete content
if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. ...
...if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. ...
... it may need to update additional state. searchlabel type: string text used for 'find-as-you-type' (fayt) searching. in situations where the search text is ambiguous or missing, searchlabel can be used to give context to fayt. if searchlabel is not present, fayt falls back to use the label property. selected type: boolean indicates whether the element is selected or not. ...
...And 6 more matches
tabs - Archive of obsolete content
Archive › Mozilla › XUL › tabs
d be placed inside a tabbox and should contain tab elements. nb: you can add some other elements to tabs such as button, but they will receive an index. activating them will not change the selectedindex. more information is available in the xul tutorial. ...
...o tabs such as button, but they will receive an index. activating them will not change the selectedindex. more information is available in the xul tutorial. attributes closebutton, disableclose, disabled, onclosetab, onnewtab, onselect, setfocus, selectedindex, tabbox, tabindex, tooltiptextnew, value, properties accessibletype, disabled, itemcount, selectedindex, selecteditem, tabindex, value, methods advanceselectedtab, appenditem, getindexofitem, getitematindex, insertitemat, removeitemat examples (example needed) attributes closebutton obsolete since gecko 1.9.2 type: boolean if this attribute is set to true, the tabs row will have a "new tab" button and "close" button on the ends. this feature is used by the tabbrowser to provide the facilities f...
...ment. the tab order is the order in which the focus is moved when the user presses the "tab" key. elements with a higher tabindex are later in the tab sequence. tooltiptextnew not in firefox type: string used to set the text which appears in the tooltip when the user moves the mouse over the new button in the tab row. properties accessibletype type: integer a value indicating the type of accessibility object for the element. disabled type: boolean gets and sets the value of the disabled attribute. itemcount type: integer read only property holding the number of child items. selectedindex type: integer returns the index of the currently selected item. you may select an item by assigning its index t...
...And 6 more matches
Type coercion - MDN Web Docs Glossary: Definitions of Web-related terms
javascript had a choice between a string or a number and decided to use a string. ...
...javascript had a choice between a string or a number and decided to use a string. ...
...javascript had a choice between a string or a number and decided to use a string. ...
...And 6 more matches
Adding vector graphics to the Web - Learn web development
pixellated as you zoom in because it contains information on where each pixel should be (and what color). when it is zoomed, each pixel is simply increased in size to fill multiple pixels on screen, so the image starts to look blocky. the vector image however continues to look nice and crisp, because no matter what size it is, the algorithms are used to work out the shapes in the image, with the values simply being scaled as it gets bigger. note: the images above are actually all pngs — with the left-hand star in each case representing a raster image, and the right-hand star representing a vector image. again, go to the vector-versus-raster.html demo for a real example! moreover, vector image files are much lighter than their raster equivalents, because they only need to hold a handf...
...h="100%" height="100%" fill="red" /> <circle cx="100%" cy="100%" r="150" fill="blue" stroke="black" /> <polygon points="120,0 240,225 0,225" fill="green"/> <text x="50" y="100" font-family="verdana" font-size="55" fill="white" stroke="black" stroke-width="2"> hello! ...
..."100%" cy="100%" r="150" fill="blue" stroke="black" /> <polygon points="120,0 240,225 0,225" fill="green"/> <text x="50" y="100" font-family="verdana" font-size="55" fill="white" stroke="black" stroke-width="2"> hello! ...
...And 6 more matches
React interactivity: Editing, filtering, conditional rendering - Learn web development
er should render all your tasks just like before. to see the editing template, you will have to change the default isediting state from false to true in your code for now; we will look at making the edit button toggle this in the next section! toggling the <todo /> templates at long last, we are ready to make our final core feature interactive. to start with, we want to call setediting() with a value of true when a user presses the "edit" button in our viewtemplate, so that we can switch templates. update the "edit" button in the viewtemplate like so: <button type="button" classname="btn" onclick={() => setediting(true)}> edit <span classname="visually-hidden">{props.name}</span> </button> now we'll add the same onclick handler to the "cancel" button in the editingtemplate, but this time...
...e our state with the new name of the task. we'll start by making a new hook for storing and setting the new name. ...
...for storing and setting the new name. ...
...And 6 more matches
Adding a new todo form: Vue events, methods, and models - Learn web development
modifiers: .stop: stops the event from propagating. equivalent to event.stoppropagation() in regular javascript events. .prevent: prevents the event's default behavior. equivalent to event.preventdefault(). .self: triggers the handler only if the event was dispatched from this exact element. {.key}: triggers the event handler only via the specified key. mdn has a list of valid key values; multi-word keys just need to be converted to kebab case (e.g. page-down). .native: listens for a native event on the root (outer-most wrapping) element on your component. .once: listens for the event until it's been triggered once, and then no more. .left: only triggers the handler via the left mouse button event. .right: only triggers the handler via the right mouse button event. ...
... browser’s default submit action. add .prevent to the @submit handler in your template like so: <form @submit.prevent="onsubmit"> if you try submitting the form now, you'll notice that the page doesn't reload. if you open the console, you can see the results of the console.log() we added inside our onsubmit() method. binding data to inputs with v-model next up, we need a way to get the value from the form's <input> so we can add the new to-do item to our todoitems data list. the first thing we need is a data property in our form to track the value of the to-do. add a data() method to our todoform component object that returns a label field. we can set the initial value of the label to an empty string. your component object should now look something like this: export defa...
...vue has a special directive for this: v-model. v-model binds to the data property you set on it and keeps it in sync with the <input>. v-model works across all the various input types, including check boxes, radios, and select inputs. ...
...And 6 more matches
Deferred
if the associated promise has already been resolved, either to...
... resolve(); else reject(); }); }); method overview void resolve([optional] avalue); void reject([optional] areason); properties attribute type description promise read only promise a newly created promise, initially in the pending state. methods resolve() fulfills the associated promise with the specified value, or propagates the state of an existing promise. if the associated promise has already been resolved, either to a value, a rejection, or another promise, this method does nothing. ...
...n the pending state. methods resolve() fulfills the associated promise with the specified value, or propagates the state of an existing promise. if the associated promise has already been resolved, either to a value, a rejection, or another promise, this method does nothing. note: this function is bound to its associated promise when promise.defer() is called, and can be called with any value of this. ...
...And 6 more matches
WebRequest.jsm
t. next, return an object from the listener that contains instructions for what the browser should do with this request. there are four things you can do with a request: cancel it redirect it modify request headers modify response headers. to perform one of these operations, include a property with the appropriate name in the object returned from the listener, and assign it the desired value, as detailed in the table below: operation available in return property cancel onbeforerequest cancel boolean value set to true. see some examples of canceling requests. redirect onbeforesendheaders redirecturl string set to the url to redirect the request to. see some examples of redirection. modify request he...
...ding to each event. it also documents two data structures that vary from one event to another: the opt_extrainfospec argument to addlistener() the properties of the argument passed to the listener. onbeforerequest this event is triggered when a request is about to be made, and before headers are available. this is a good place to listen if you want to cancel the request. opt_extrainfospec values name description "blocking" make the browser wait until the listener returns. use this if you want to cancel the request. see some examples of canceling requests. listener argument name type description url string target of the request. windowid number the id of the window making the request, as an outerwindowi...
... type string the resource type. browser object the xul browser into which the resource will be loaded, or null if the resource will not be loaded into a xul browser. onbeforesendheaders this event is triggered before sending any http data, but after all http headers are available. this is a good place to listen if you want to modify http headers. opt_extrainfospec values name description "blocking" make the browser wait until the listener returns. use this if you want to redirect the request or modify request headers. see examples of redirecting and modifying request headers. "requestheaders" include request headers in the argument passed to the listener. see modifying headers for an example using this. listener ar...
...And 6 more matches
pkfnc.html
n has the following parameters: nickname a pointer to the nickname in the certificate database or to the nickname in the token. wincx a pointer to application data for the password callback function. this pointer is set with ssl_setpkcs11pinarg during ssl configuration. to retrieve its current value, use ssl_revealpinarg. returns the function returns one of these values: if successful, a pointer to a certificate structure. if unsuccessful, null. description a nickname is an alias for a certificate subject. there may be multiple certificates with the same subject, and hence the same nickname. this function will return the newest certificate that matches the su...
...parameters this function has the following parameters: cert a pointer to a certificate structure in the certificate database. wincx a pointer to application data for the password callback function. this pointer is set with ssl_setpkcs11pinarg during ssl configuration. to retrieve its current value, use ssl_revealpinarg. returns the function returns one of these values: if successful, a pointer to a private key structure. if unsuccessful, null. description when you are finished with the private key structure returned by pk11_findkeybyanycert, you must free it by calling seckey_destroyprivatekey. the pk11_findkeybyanycert function calls the password callback...
...ordfunc and passes it the pointer specified by the wincx parameter. pk11_getslotname gets the name of a slot. syntax #include <pk11func.h> char *pk11_getslotname(pk11slotinfo *slot); parameters this function has the following parameter: slot a pointer to a slot info structure. returns the function returns one of these values: if successful, a pointer to the name of the slot (a string). if unsuccessful, null. description if the slot is freed, the string with the slot name may also be freed. if you want to preserve it, copy the string before freeing the slot. do not try to free the string yourself. pk11_gettokenname gets the name of the token. syntax #include <pk11func.h> char *pk11_gettokenname(p...
...And 6 more matches
sslcrt.html
cert a pointer to the certificate to be checked. checksig indicates whether certificate signatures are to be checked. pr_true means certificate signatures are to be checked. pr_false means certificate signatures will not be checked. ...
... if unsuccessful, secfailure. use pr_geterror to obtain the error code. description the cert_verifycertnow function must call one or more pk11 functions to obtain the services of a pkcs #11 module. some of the pk11 funct...
... certusageemailrecipient certusageobjectsigner certusageusercertimport certusageverifyca certusageprotectedobjectsigner wincx the pin argument value to pass to pk11 functions. see description below for more information. returns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. use pr_geterror to obtain the error code. ...
...And 6 more matches
sslerr.html
d in the current nss reference nss and ssl error codes chapter 8 nss and ssl error codes nss error codes are retrieved using the nspr function pr_geterror. in addition to the error codes defined by nspr, pr_geterror retrieves the error codes described in this chapter. ssl error codes sec error codes ssl error codes table 8.1 error codes defined in sslerr.h constant value description ssl_error_export_only_server -12288 "unable to communicate securely. peer does not support high-grade encryption." the local system was configured to support the cipher suites permitted for domestic use. the remote system was configured to support only the cipher suites permitted for export use. ssl_error_us_only_server -12287 "unable to ...
... such as having a certificate that is inappropriate for the key exchange algorithm selected. ...
... the key exchange algorithm selected. ...
...And 6 more matches
NSS tools : signtool
name signtool — digitally sign objects and files. synopsis signtool [-k keyname] -h -h -l -l -m -v -w -g nickname -s size -b basename [[-c compression level] ] [[-d cert-dir] ] [[-i installer script] ] [[-m metafile] ] [[-x name] ] [[-f filename] ] [[-t|--token tokenname] ] [[-e extension] ] [[-o] ] [[-z] ] [[-x] ] [[--outfile] ] [[--verbose value] ] [[--norecurse] ] [[--leavearc] ] [[-j directory] ] [[-z jarfile] ] [[-o] ] [[-p password] ] [directory-tree] [archive] description the signing tool, signtool, creates digital signatures and uses a java archive (jar) file to associate the signatures with files in a directory. electronic software distribution over any network involves potential security problems. to help address some of these proble...
...es the compression level for the -j or -z option. the symbol # represents a number from 0 to 9, where 0 means no compression and 9 means maximum compression. the higher the level of compression, the smaller the output but the longer the operation takes. if the -c# option is not used with either the -j or the -z option, the default compression value used by both the -j and -z options is 6. -d certdir specifies your certificate database directory; that is, the directory in which you placed your key3.db and cert7.db files. to specify the current directory, use "-d." (including the period). the unix version of signtool assumes ~/.netscape unless told otherwise. the nt versio...
...use -e".class" to sign only java class files. note that with netscape signing tool version 1.1 and later this option can appear multiple times on one command line, making it possible to specify multiple file types or classes to include. -f commandfile specifies a text file containing netscape signing tool options and arguments in keyword=value format. all options and arguments can be expressed through this file. for more information about the syntax used with this file, see "tips and techniques". -i scriptname specifies the name of an installer script for smartupdate. this script installs files from the jar archive in the local system after smartupdate has validated the digita...
...And 6 more matches
SpiderMonkey 1.8.7
lso means that objects will be finalized in a non-deterministic order in spidermonkey 1.8.5. this is not a bug, and, any embedding which depends upon deterministic finalization is fatally flawed. typed rooting api the rooting api has been changed from an error-prone void ** interface to an interface which accepts pointers to specific types. js_addroot has been replaced by js_addobjectroot, js_addvalueroot and js_addstringroot; similar changes were made for js_addnamedroot and js_removeroot. since jsdoubles are now stored in the jsval, instead of on the heap, we no longer need to define roots for them. compartments spidermonkey 1.8.5 introduces the concept of compartments. a compartment is a global object, a context, and a set of related objects with no outside references (crosscompartment wra...
...sscompartment wrappers excepted). the new garbage collector can perform per-container garbage collection, which can be a significant performance improvement for certain workloads. no compartment may execute js code or call into jsapi on two os threads at the same time. for more information, see spidermonkey compartments. type changes jsval the base data type, jsval, which represents all possible values in javascript, has changed from 32- to 64-bits wide, and the underlying representation has changed from a c integer type to a c struct. this change to a struct means that certain tricks, such as writing switch statements in c with jsval cases are no longer legal. additionally, because not all fields are used by all jsvals, it is no longer safe to compare jsvals as though they were c values. inst...
...e no longer legal. additionally, because not all fields are used by all jsvals, it is no longer safe to compare jsvals as though they were c values. instead, jsvals should be converted to their c equivalents with the appropriate jsval_to_* macro and then compared. jsapi no longer represents floating-point numbers (and integers more than 31 bits long) as pointers to jsdouble; instead, the jsdouble value is directly stored in the jsval. this affects macros like double_to_jsval and jsval_to_double, which now operate directly on jsdouble rather than jsdouble pointers. ...
...And 6 more matches
IAccessibleTableCell
dex([out] long rowindex ); [propget] hresult table([out] iunknown table ); methods columnextent() returns the number of columns occupied by this cell accessible. the result is greater than 1 if the specified cell spans multiple columns. [propget] hresult columnextent( [out] long ncolumnsspanned ); parameters ncolumnsspanned returns the 1 based column extent of the specified cell. return value s_ok. columnheadercells() returns the column headers as an array of cell accessibles. [propget] hresult columnheadercells( [out, size_is(, ncolumnheadercells,)] iunknown cellaccessibles, [out] long ncolumnheadercells ); parameters cellaccessibles pointer to an array of references to cell accessibles. the array is allocated by the server. free it with cotaskmemfree. ncolumnheadercells the nu...
...ell accessibles. [propget] hresult columnheadercells( [out, size_is(, ncolumnheadercells,)] iunknown cellaccessibles, [out] long ncolumnheadercells ); parameters cellaccessibles pointer to an array of references to cell accessibles. the array is allocated by the server. free it with cotaskmemfree. ncolumnheadercells the number of accessibles returned; the size of the returned array. ...
...adercells( [out, size_is(, ncolumnheadercells,)] iunknown cellaccessibles, [out] long ncolumnheadercells ); parameters cellaccessibles pointer to an array of references to cell accessibles. the array is allocated by the server. free it with cotaskmemfree. ncolumnheadercells the number of accessibles returned; the size of the returned array. return value s_false if there is no header, [out] values are null and 0 respectively. s_ok. ...
...And 6 more matches
nsICategoryManager
xpcom/components/nsicategorymanager.idlscriptable this interface provides access to a data structure that holds a list of name-value pairs, called categories, where each value is a list of strings. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) implemented by: @mozilla.org/categorymanager;1. ...
...t changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) implemented by: @mozilla.org/categorymanager;1. ...
...); void deletecategory(in string acategory); void deletecategoryentry(in string acategory, in string aentry, in boolean apersist); nsisimpleenumerator enumeratecategories(); nsisimpleenumerator enumeratecategory(in string acategory); string getcategoryentry(in string acategory, in string aentry); methods addcategoryentry() this method sets the value for the given entry on the given category. the category and/or entry are created if they do not exist. string addcategoryentry( in string acategory, in string aentry, in string avalue, in boolean apersist, in boolean areplace ); parameters acategory the name of the category being modified. ("protocol") aentry the name of the category entry being modified. ("http") avalue the ...
...And 6 more matches
nsIDOMSimpleGestureEvent
/ thunderbird 3.0 / seamonkey 2.0) the nsidomsimplegestureevent interface is the datatype for all mozilla-specific simple gesture events in the document object model. the following events are generated: mozswipegesture - generated when the user completes a swipe across across the input device. mozmagnifygesturestart - generated when the user begins the magnify ("pinch") gesture. the "delta" value represents the initial movement. mozmagnifygestureupdate - generated periodically while the user is continuing the magnify ("pinch") gesture. the "delta" value represents the movement since the last mozmagnifygesturestart or mozmagnifygestureupdate event. mozmagnifygesture - generated when the user has completed the magnify ("pinch") gesture. if you only want to receive a single event when the ...
...epresents the movement since the last mozmagnifygesturestart or mozmagnifygestureupdate event. mozmagnifygesture - generated when the user has completed the magnify ("pinch") gesture. if you only want to receive a single event when the magnify gesture is complete, you only need to hook this event and can safely ignore the mozmagnifygesturestart and the mozmagnifygestureupdate events. ...
...e magnify ("pinch") gesture. if you only want to receive a single event when the magnify gesture is complete, you only need to hook this event and can safely ignore the mozmagnifygesturestart and the mozmagnifygestureupdate events. the "delta" value is the cumulative amount represented by the user's gesture. mozrotategesturestart - generated when the user begins the rotation gesture. the "delta" value represents the initial rotation. mozrotategestureupdate - generated periodically while the user is continuing the rotation gesture. the "delta" value represents the rotation since the last mozrotategesturestart or mozrotategestureupdate event. mozrotategesture - generated when the user has completed the rotation gesture. if you only want to receive a single event when the rotation gesture is co...
...And 6 more matches
nsIDOMXULElement
dom/interfaces/xul/nsidomxulelement.idlscriptable represents a xul element within the dom. 66 introduced gecko 1.0 inherits from: nsidomelement last changed in gecko 1.9 (firefox 3) method overview void blur(); void click(); void docommand(); void focus(); nsidomnodelist getelementsbyattribute(in domstring name, in domstring value); nsidomnodelist getelementsbyattributens(in domstring namespaceuri, in domstring name, in domstring value); attributes attribute type description align domstring gets/sets the value of the element's align attribute. allowevents boolean true if the element's allowevents attribute is the string "true", otherwise false. removes the attribute if you set it to false. boxobject nsiboxobject read only. gets or creat...
...ect read only. gets or creates a box object for the element; browser, editor, iframe, listbox, menu, menupopup, scrollbox, tooltip and tree elements receive specialized box objects allowing access to additional properties not normally available from script. builder nsixultemplatebuilder read only. retrives the element's template builder, if it has a template. classname domstring gets/sets the value of the element's class attribute. collapsed boolean true if the element's collapsed attribute is the string "true", otherwise false. removes the attribute if you set it to false. contextmenu domstring gets/sets the value of the element's contextmenu attribute. controllers nsicontrollers read only. returns an nsicontrollers object that additional controllers may be appended to so as to provi...
...nu domstring gets/sets the value of the element's contextmenu attribute. controllers nsicontrollers read only. returns an nsicontrollers object that additional controllers may be appended to so as to provide focus-specific actions for commands. database nsirdfcompositedatasource read only. returns the template builder's database, if it is an rdf template. datasources domstring gets/sets the value of the element's datasources attribute. dir domstring gets/sets the value of the element's dir attribute. flex domstring gets/sets the value of the element's flex attribute. flexgroup domstring gets/sets the value of the element's flexgroup attribute. height domstring gets/sets the value of the element's height attribute. hidden boolean true if the element's hidden attribute is the stri...
...And 6 more matches
nsIFormHistory2
toolkit/components/satchel/public/nsiformhistory.idlscriptable a service which holds a set of name/value pairs. the names correspond to form field names, and the values correspond to values the user has submitted. so, several values may exist for a single name. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) note: this interface provides no means to access stored values. stored values are used by the formfillcontroller to generate autocomplete matches. ...
...es may exist for a single name. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) note: this interface provides no means to access stored values. stored values are used by the formfillcontroller to generate autocomplete matches. ...
...ntroduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) note: this interface provides no means to access stored values. stored values are used by the formfillcontroller to generate autocomplete matches. ...
...And 6 more matches
nsILoginManager
newlogindata); void removealllogins(); void removelogin(in nsilogininfo alogin); void searchlogins(out unsigned long count, in nsipropertybag matchdata, [retval, array, size_is(count)] out nsilogininfo logins); void setloginsavingenabled(in astring ahost, in boolean isenabled); methods addlogin() stores a new login in the login manager. note: default values for the nsiloginmetainfo properties are created if the specified login doesn't explicitly specify them. void addlogin( in nsilogininfo alogin ); parameters alogin the login to store. exceptions thrown an exception is thrown if the login information is already stored in the login manager. to change a login, you have to use modifylogin(). autocompletesearch() generates results ...
...vided for use only by the formfillcontroller, which calls it directly. it should not be used for any other purpose. nsiautocompleteresult autocompletesearch( in astring asearchstring, in nsiautocompleteresult apreviousresult, in nsidomhtmlinputelement aelement ); parameters asearchstring missing description apreviousresult missing description aelement missing description return value missing description countlogins() returns the number of logins matching the specified criteria. called when only the number of logins is needed, and not the actual logins (which avoids prompting the user for a master password, as the logins don't need to be decrypted). unsigned long countlogins( in astring ahostname, in astring aactionurl, in astring ahttprealm ); parameters ahostn...
...the actual logins (which avoids prompting the user for a master password, as the logins don't need to be decrypted). unsigned long countlogins( in astring ahostname, in astring aactionurl, in astring ahttprealm ); parameters ahostname the hostname to which to restrict searches, formatted as a url. for example, "http://www.bar.com". to match all hostnames, specify "" (empty string). a value of null will cause countlogins() to not match any logins. aactionurl for form logins, this parameter should specify the url to which the form will be submitted. to match any form login, specify "" (empty string). to not match any form logins (for example when interested in protocol logins only), specify null. ahttprealm for protocol logins, specify the http realm for which the login applies; ...
...And 6 more matches
nsIMicrosummaryService
eratoruri ); parameters generatoruri the uri of the resource providing the generator. createmicrosummary() create a microsummary for a given page uri and generator uri. nsimicrosummary createmicrosummary( in nsiuri pageuri, in nsiuri generatoruri ); parameters pageuri the uri of the page to be summarized. generatoruri the uri of the microsummary generator. return value returns an nsimicrosummary for the given page and generator uris. getbookmarks() get the set of bookmarks with microsummaries. in the old rdf-based bookmarks datastore, bookmark ids are nsirdfresource objects. in the new places-based datastore, they are nsiuri objects. nsisimpleenumerator getbookmarks(); parameters none. return value returns an nsisimpleenumerator enumeration of bookmark ids. ge...
...getmicrosummaries() get the set of microsummaries available for a given page. ...
... content of the selected microsummary immediately (rather than after the content is asynchronously loaded). nsimicrosummaryset getmicrosummaries( in nsiuri pageuri, in long long bookmarkid optional ); parameters pageuri the uri of the page for which to retrieve available microsummaries. bookmarkid optional the id of the bookmark for which this method is being called. ...
...And 6 more matches
nsIScreen
attributes attribute type description colordepth long the screen's color depth; this is the number of bits used to represent a color. read only. pixeldepth long the screen's pixel depth; this is the number of bits used to represent a pixel. read only. rotation unsigned long the screen's current rotation; you may set this to any of the values listed in screen rotation constants. this will only have an effect on platforms that support screen rotation. gecko 1.9.2 note starting in gecko 1.9.2, gecko running on microsoft windows reports 24 bits per pixel instead of 32 bits per pixel on 8-bits per color component displays, since this is typically what the caller is actually looking for. constants screen brightness constants ...
...tation constants. this will only have an effect on platforms that support screen rotation. gecko 1.9.2 note starting in gecko 1.9.2, gecko running on microsoft windows reports 24 bits per pixel instead of 32 bits per pixel on 8-bits per color component displays, since this is typically what the caller is actually looking for. ...
... rotation_90_deg 1 90° of rotation. rotation_180_deg 2 180° of rotation. rotation_270_deg 3 270° of rotation. ...
...And 6 more matches
nsISupportsArray
deleteelementat() void deleteelementat( in unsigned long aindex ); parameters aindex deletelastelement() void deletelastelement( in nsisupports aelement ); parameters aelement violates the xpcom interface guidelines elementat() nsisupports elementat( in unsigned long ...
...ntat(in nsisupports aelement, in unsigned long aindex); violates the xpcom interface guidelines boolean sizeto(in long asize); violates the xpcom interface guidelines methods violates the xpcom interface guidelines appendelements() boolean appendelements( in nsisupportsarray aelements ); parameters aelements return value clone() nsisupportsarray clone(); parameters none. return value compact() void compact(); parameters none. ...
...rameters none. return value compact() void compact(); parameters none. ...
...And 6 more matches
nsPIPromptService
other developers. inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) implemented by: the contract id isn't defined. this interface defines the meaning of each indexes of getint(), setint(), getstring() and setstring() of the nsidialogparamblock interface but they are defined on in c++. the indexes for getstring() and setstring() are: emsg the value is 0. this is the message text of the dialog. echeckboxmsg the value is 1. this is the label text of a checkbox on the dialog. eiconclass the value is 2. this is the class attribute value of the icon image. etitlemessage the value is 3. this is the heading of the message. eeditfield1msg the value is 4. this is the label text of the first text field on the dialog. eeditfield2msg the value is 5. th...
... 1. this is the label text of a checkbox on the dialog. eiconclass the value is 2. this is the class attribute value of the icon image. etitlemessage the value is 3. this is the heading of the message. eeditfield1msg the value is 4. this is the label text of the first text field on the dialog. eeditfield2msg the value is 5. this is the label text of the second text field on the dialog. eeditfield1value the value is 6. this is the default value of the first text field. this is also used for the result of the dialog. eeditfield2value the value is 7. this is the default value of the second text field. this is also used for the result of the dialog. ebutton0text the value is 8. this is the label of the first button on the dialog. ebutton1text the value is 9. this is the label of the second button o...
...this is the system sound name which should be played when the dialog is shown. see also nsisound.playsystemsound(). ...
...And 6 more matches
Xray vision
onents.utils.waivexrays(gbrowser.contentwindow).date.getfullyear(); // -> 1000 however, there are some situations in which privileged code will access javascript objects that are not themselves dom objects and are not properties of dom objects. for example: the detail property of a customevent fired by content could be a javascript object or date as well as a string or a primitive the return value of evalinsandbox() and any properties attached to the sandbox object may be pure javascript objects also, the webidl specifications are starting to use javascript types such as date and promise: since webidl definition is the basis of dom xrays, not having xrays for these javascript types starts to seem arbitrary. so, in gecko 31 and 32 we've added xray support for most javascript built-in obj...
...s have to be independently defined: they can't simply be defined as "the c++ representation". the aim of xray vision is to make most common operations simple and safe, avoiding the need to access the underlying object except in more involved cases. so the semantics defined for object and array xrays aim to make it easy for privileged code to treat untrusted objects like simple dictionaries. any value properties of the object are visible in the xray. if the object has properties which are themselves objects, and these objects are same-origin with the content, then their value properties are visible as well. there are two main sorts of restrictions: first, the chrome code might expect to rely on the prototype's integrity, so the object's prototype is protected: the xray has the standa...
...he code snippet, and the browser console to see the expected output. because code running in scratchpad's browser context has chrome privileges, any time you use it to run code, you need to understand exactly what the code is doing. that includes the code samples in this article. ...
...And 6 more matches
Int64
because javascript doesn't currently include standard support for 64-bit integer values, js-ctypes offers the int64 and uint64 objects to let you work with c functions and data that need (or may need) values represented using a 64-bit data type. you use the int64 object to create and manipulate 64-bit signed integers. note: it's important to note that the 64-bit integer objects created by int64 are not int64 objects; rather, they're opaque objects whose values you manipulate through the other methods on the int64 object. see 64-bit integers for details. syntax creates and returns a new 64-bit signed integer. int64 int64( value ); parameters value the value to assign the new 64-bit integer object. ...
...bit integer objects created by int64 are not int64 objects; rather, they're opaque objects whose values you manipulate through the other methods on the int64 object. see 64-bit integers for details. syntax creates and returns a new 64-bit signed integer. int64 int64( value ); parameters value the value to assign the new 64-bit integer object. this may be specified as an integer (if the value can be represented as a 32-bit value), another 64-bit integer object (either signed or unsigned), or as a string, which may consist of an optional minus sign, followed by either a decimal number or "0x" or "0x" followed by a hexadecimal number. ...
...assign the new 64-bit integer object. this may be specified as an integer (if the value can be represented as a 32-bit value), another 64-bit integer object (either signed or unsigned), or as a string, which may consist of an optional minus sign, followed by either a decimal number or "0x" or "0x" followed by a hexadecimal number. the string is then converted into the corresponding 64-bit integer value. you can therefore use a string to represent a 64-bit value that is too large to represent as a 32-bit javascript number. return value a new object representing the specified value. exceptions thrown typeerror the specified value cannot be converted into a 64-bit integer. either it's not a number, string, or 64-bit integer object, or it's a string that is incorrectly formatted or contains...
...And 6 more matches
AudioBufferSourceNode.AudioBufferSourceNode() - Web APIs
the audiobuffersourcenode() constructor creates a new audiobuffersourcenode object instance. syntax var audiobuffersourcenode = new audiobuffersourcenode(context, options) parameters inherits parameters from the audionodeoptions dictionary. context a reference to an audiocontext. options optional options are as follows: buffer: an instance of audiobuffer to be played. ...
...to an audiocontext. options optional options are as follows: buffer: an instance of audiobuffer to be played. detune: a value in cents to modulate the speed of audio stream rendering. its nominal range is (-∞ to +∞). the default is 0. loop: a boolean indicating whether the audio should play in a loop. the default is false. if the loop is dynamically modified during playback, the new value will take effect on the next processing block of audio. loopend: an optional value, in seconds, where looping should end if the loop attribute is true. the default is 0. its value is exclusive to the content of the loop. the sample frames, comprising the loop, run from the values loopstart to loopend-(1/samplerate). it's sensible to set this to a value between 0 and the duration of the buffer. ...
...if loopstart is less than 0, looping will begin at 0. ...
...And 6 more matches
AudioListener.speedOfSound - Web APIs
example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
... example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. ...
... example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. ...
...And 6 more matches
AudioParamDescriptor - Web APIs
array of objects based on this dictionary is used internally by audioworkletnode constructor to populate its parameters property accordingly. properties name the domstring which represents the name of the audioparam. ...
...tring which represents the name of the audioparam. under this name the audioparam will be available in the parameters property of the node, and under this name the audioworkletprocessor.process method will acquire the calculated values of this audioparam. automationrate optional either "a-rate", or "k-rate" string which represents an automation rate of this audioparam. defaults to "a-rate". minvalue optional a float which represents minimum value of the audioparam. defaults to -3.4028235e38. maxvalue optional a float which represents maximum value of the audioparam. defaults to 3.4028235e38. defaultvalue optional a float which represents initial value of the audioparam. defaults to 0. examples to demonstrate creation and usage of custom audioparams, we'll expand the example from audi...
...in a separate file. we expand the processor by adding a static parameterdescriptors getter. it will be used internally by the audioworkletnode constructor to populate its parameters with instantiated audioparam objects. ...
...And 6 more matches
AudioWorkletProcessor.parameterDescriptors (static getter) - Web APIs
rable of audioparamdescriptor-based objects. the property is not a part of the audioworkletprocessor interface, but, if defined, it is called internally by the audioworkletprocessor constructor to create a list of custom audioparam objects in the parameters property of the associated audioworkletnode. defining the getter is optional. syntax audioworkletprocessorsubclass.parameterdescriptors; value an iterable of audioparamdescriptor-based objects. the properties of these objects are as follows: name the domstring which represents the name of the audioparam. under this name the audioparam will be available in the parameters property of the node, and under this name the audioworkletprocessor.process method will acquire the calculated values of this audioparam. automationrate optional e...
...tring which represents the name of the audioparam. under this name the audioparam will be available in the parameters property of the node, and under this name the audioworkletprocessor.process method will acquire the calculated values of this audioparam. automationrate optional either "a-rate", or "k-rate" string which represents an automation rate of this audioparam. defaults to "a-rate". minvalue optional a float which represents minimum value of the audioparam. defaults to -3.4028235e38. maxvalue optional a float which represents maximum value of the audioparam. defaults to 3.4028235e38. defaultvalue optional a float which represents initial value of the audioparam. defaults to 0. examples to demonstrate creation and usage of custom audioparams, we'll expand the example from audi...
...in a separate file. we expand the processor by adding a static parameterdescriptors getter. it will be used internally by the audioworkletnode constructor to populate its parameters with instantiated audioparam objects. ...
...And 6 more matches
Using the CSS Painting API - Web APIs
e) { ctx.fillstyle = 'hsla(55, 90%, 60%, 1.0)'; ctx.fillrect( 0, size.height / 3, size.width * 0.4, size.height * 0.6 ); } }); this code example has two differences from our first example: we've included a second argument, which is the paint size. we've changed the dimensions and positioning of our rectangle to be relative to the size of the element box rather than absolute values. we can pass the second parameter into the paint() function to give us access to the width and the height of the element, via .width and .height properties. our header now has a highlight that changes according to it's size. css.paintworklet.addmodule('https://mdn.github.io/houdini-examples/csspaint/intro/02parttwo/header-highlight.js'); .fancy { background-image: paint(headerhighlight);...
...the inputproperties() method can return all properties affecting the element, not just custom properties. in our <script> we register the worklet: css.paintworklet.addmodule('https://mdn.github.io/houdini-examples/csspaint/intro/worklet/boxbg.js'); while you can't play ...
...pplied to it and then used those within our paint() function. the inputproperties() method can return all properties affecting the element, not just custom properties. in our <script> we register the worklet: css.paintworklet.addmodule('https://mdn.github.io/houdini-examples/csspaint/intro/worklet/boxbg.js'); while you can't play with the worklet's script, you can alter the custom property values to change the colors and width of the background image. adding complexity the above examples might not seem very exciting, as you could recreate them in a few different ways with existing css properties, e.g. by positioning some decorative generated content with ::before, or including background: linear-gradient(yellow, yellow) 0 15px / 200px 20px no-repeat; what makes the css painting api so ...
...And 6 more matches
CanvasRenderingContext2D.filter - Web APIs
the canvasrenderingcontext2d.filter property of the canvas 2d api provides filter effects such as blurring and grayscaling. it is similar to the css filter 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>. ...
...lter-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. ...
... 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% darkens the image, while a value over 100% brightens it. a value of 0% will create an image that is completely black, while a value of 100% leaves the input unchanged. contrast() a css <percentage>. adjusts the 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 effe...
...And 6 more matches
DynamicsCompressorNode.knee - Web APIs
example the below code demonstrates a simple usage of createdynamicscompressor() to add compression to an audio track. ...
... example the below code demonstrates a simple usage of createdynamicscompressor() to add compression to an audio track. ...
... example the below code demonstrates a simple usage of createdynamicscompressor() to add compression to an audio track. ...
...And 6 more matches
DynamicsCompressorNode.threshold - Web APIs
example the below code demonstrates a simple usage of createdynamicscompressor() to add compression to an audio track. ...
... example the below code demonstrates a simple usage of createdynamicscompressor() to add compression to an audio track. ...
... example the below code demonstrates a simple usage of createdynamicscompressor() to add compression to an audio track. ...
...And 6 more matches
Using Fetch - Web APIs
fetch('https://example.com', { credentials: 'include' }); if you only want to send credentials if the r...
...e, it is up to you to handle these complications. the following example shows one way to do this by creating a line iterator (for simplicity, it assumes the text is utf-8, and doesn't handle fetch errors). ...
...url); const reader = response.body.getreader(); let { value: chunk, done: readerdone } = await reader.read(); chunk = chunk ? utf8decoder.decode(chunk) : ''; const re = /\n|\r|\r\n/gm; let startindex = 0; let result; for (;;) { let result = re.exec(chunk); if (!result) { if (readerdone) { break; } let remainder = chunk.substr(startindex); ({ value: chunk, done: readerdone } = await reader.read()); chunk = remainder + (chunk ? utf8decoder.decode(chunk) : ''); startindex = re.lastindex = 0; continue; } yield chunk.substring(startindex, result.index); startindex = re.lastindex; } if (startindex < chunk.length) { // last line didn't end in a newline char yield chunk.substr(startindex); } } async fun...
...And 6 more matches
HTMLElement: change event - Web APIs
the change event is fired for <input>, <select>, and <textarea> elements when an alteration to the element's value is committed by the user. unlike the input event, the change event is not necessarily fired for each alteration to an element's value. ...
... the html specification lists the <input> types that should fire the c...
...nt is :checked (by clicking or using the keyboard) for <input type="radio"> and <input type="checkbox">; when the user commits the change explicitly (e.g., by selecting a value from a <select>'s dropdown with a mouse click, by selecting a date from a date picker for <input type="date">, by selecting a file in the file picker for <input type="file">, etc.); when the element loses focus after its value was changed, but not commited (e.g., after editing the value of <textarea> or <input type="text">). the html specification lists the <input> types that should fire the change event. ...
...And 6 more matches
HTMLImageElement - Web APIs
). properties inherits properties from its parent, htmlelement. htmlimageelement.alt a domstring that reflects the alt html attribute, thus indicating the alternate fallback content to be displayed if the image has not been loaded. htmlimageelement.complete read only returns a boolean that is true if the browser has finished fetching the image, whether successful or not. that means this value is also true if the image has no src value indicating an image to load. htmlimageelement.crossorigin a domstring specifying the cors setting for this image element. see cors settings attributes for further details. this may be null if cors is not used. htmlimageelement.currentsrc read only returns a usvstring representing the url from which the currently displayed image was loaded. this may ...
...ot used. htmlimageelement.currentsrc read only returns a usvstring representing the url from which the currently displayed image was loaded. this may change as the image is adjusted due to changing conditions, as directed by any media queries which are in place. htmlimageelement.decoding an optional domstring representing a hint given to the browser on how it should decode the image. ...
...usvstring representing the url from which the currently displayed image was loaded. this may change as the image is adjusted due to changing conditions, as directed by any media queries which are in place. htmlimageelement.decoding an optional domstring representing a hint given to the browser on how it should decode the image. if this value is provided, it must be one of the possible permitted values: sync to decode the image synchronously, async to decode it asynchronously, or auto to indicate no preference (which is the default). read the decoding page for details on the implications of this property's values. htmlimageelement.height an integer value that reflects the height html attribute, indicating the rendered height of the image in css pixels. htmlimageelement.ismap a boolean that...
...And 6 more matches
KeyframeEffect.setKeyframes() - Web APIs
ces the keyframes that make up the affected keyframeeffect with a new set of keyframes. syntax existingkeyframeeffect.setkeyframes(keyframes); parameters keyframes a keyframe object or null. if set to null, the keyframes are replaced with a sequence of empty keyframes. there are two different ways to format keyframes: an array of objects (keyframes) consisting of properties and values to iterate over. this is the canonical format returned by the getkeyframes() method. element.animate([ { // from opacity: 0, color: "#fff" }, { // to opacity: 1, ​ color: "#000" } ], 2000); offsets for each keyframe can be specified by providing an offset value. element.animate([ { opacity: 1 }, { opacity: 0.1, offset: 0.7 }, ...
...he getkeyframes() method. element.animate([ { // from opacity: 0, color: "#fff" }, { // to opacity: 1, ​ color: "#000" } ], 2000); offsets for each keyframe can be specified by providing an offset value. element.animate([ { opacity: 1 }, { opacity: 0.1, offset: 0.7 }, { opacity: 0 } ], 2000); note: offset values, if provided, must be between 0.0 and 1.0 (inclusive) and arranged in ascending order. it is not necessary to specify an offset for every keyframe. keyframes without a specified offset will be evenly spaced between adjacent keyframes. the easing to apply between keyframes can be specified by providing an easing value as illustrated below. element.animate([ { opacity: 1, easing: 'ease...
...ng to apply between keyframes can be specified by providing an easing value as illustrated below. element.animate([ { opacity: 1, easing: 'ease-out' }, { opacity: 0.1, easing: 'ease-in' }, { opacity: 0 } ], 2000); in this example, the specified easing only applies from the keyframe where it is specified until the next keyframe. any easing value specified on the options argument, however, applies across a single iteration of the animation — for the entire duration. an object containing key-value pairs consisting of the property to animate and an array of values to iterate over. element.animate({ opacity: [ 0, 1 ], // [ from, to ] color: [ "#fff", "#000" ] // [ from, to ] }, 2000); using this format, the numb...
...And 6 more matches
MediaStreamTrack - Web APIs
ies, constraints, and settings to learn how to correctly work with constrainable properties. not doing so correctly will result in your code being unreliable. mediastreamtrack.contenthint a string that may be used by the web application to provide a hint as to what type of content the track contains to guide how it should be treated by api consumers. mediastreamtrack.enabled a boolean whose value of true if the track is enabled, that is allowed to render the media source stream; or false if it is disabled, that is not rendering the media source stream but silence and blackness. if the track has been disconnected, this value can be changed but has no more effect. note: you can implement standard "mute" functionality by setting enabled to false. the muted property refers to a condition in ...
...t has no more effect. note: you can implement standard "mute" functionality by setting enabled to false. the muted property refers to a condition in which there's no media because of a technical issue. mediastreamtrack.id read only returns a domstring containing a unique identifier (guid) for the track; it is generated by the browser. mediastreamtrack.isolated read only returns a boolean value which is true if the track is isolated; that is, the track cannot be accessed by the document that owns the mediastreamtrack. this happens when the peeridentity property is set, or if the track comes from a cross-origin source. mediastreamtrack.kind read only returns a domstring set to "audio" if the track is an audio track and to "video", if it is a video track. it doesn't change if the track...
... deassociated from its source. mediastreamtrack.label read only returns a domstring containing a user agent-assigned label that identifies the track source, as in "internal microphone". the string may be left empty and is empty as long as no source has been connected. when the track is deassociated from its source, the label is not changed. ...
...And 6 more matches
Node.nodeName - Web APIs
Web › API › Node › nodeName
the nodename read-only property returns the name of the current node as a string. syntax var str = node.nodename; value a domstring. ...
... the nodename read-only property returns the name of the current node as a string. syntax var str = node.nodename; value a domstring. ...
... the nodename read-only property returns the name of the current node as a string. syntax var str = node.nodename; value a domstring. ...
...And 6 more matches
PannerNode.coneOuterAngle - Web APIs
example in this example, we'll demonstrate how changing the orientation parameters of a pannernode in combination with coneinnerangle and coneouterangle affects volume. ...
... example in this example, we'll demonstrate how changing the orientation parameters of a pannernode in combination with coneinnerangle and coneouterangle affects volume. ...
... example in this example, we'll demonstrate how changing the orientation parameters of a pannernode in combination with coneinnerangle and coneouterangle affects volume. ...
...And 6 more matches
RTCPeerConnection - Web APIs
also included is a list of...
...eturns a rtcsessiondescription describing the session (which includes configuration and media information) for the remote end of the connection. if this hasn't been set yet, this is null.sctp the read-only sctp property on the rtcpeerconnection interface returns an rtcsctptransport describing the sctp transport over which sctp data is being sent and received. if sctp hasn't been negotiated, this value is null.signalingstate read only the read-only signalingstate property on the rtcpeerconnection interface returns one of the string values specified by the rtcsignalingstate enum; these values describe the state of the signaling process on the local end of the connection while connecting or reconnecting to another peer. see signaling in lifetime of a webrtc session for more details about the sign...
...this lets you change the ice servers used by the connection and which transport policies to use.setidentityprovider() the rtcpeerconnection.setidentityprovider() method sets the identity provider (idp) to the triplet given in parameter: its name, the protocol used to communicate with it (optional) and an optional username. the idp will be used ...
...And 6 more matches
StylePropertyMapReadOnly - Web APIs
a css declaration block that is an alternative to cssstyledeclaration. retrieve an instance of this interface using element.computedstylemap(). properties stylepropertymapreadonly.size returns an unsinged long integer containing the size of the stylepropertymapreadonly object. methods stylepropertymapreadonly.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). stylepropertymapreadonly.foreach() executes a provided function once for each element of stylepropertymapreadonly. stylepropertymapreadonly.get() returns the value of the specified property. stylepropertymapreadonly.getall() returns an...
...me 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). stylepropertymapreadonly.foreach() executes a provided function once for each element of stylepropertymapreadonly. stylepropertymapreadonly.get() returns the value of the specified property. stylepropertymapreadonly.getall() returns an array of cssstylevalue objects containing the values for the provided property. ...
...ty. stylepropertymapreadonly.getall() returns an array of cssstylevalue objects containing the values for the provided property. stylepropertymapreadonly.has() indicates whether the specified property is in the stylepropertymapreadonly object. stylepropertymapreadonly.keys() returns a new array iterator containing the keys for each item in stylepropertymapreadonly. stylepropertymapreadonly.values() returns a new array iterator containing the values for each index in the stylepropertymapreadonly object. examples we have to have an element to observe: <p> this is a paragraph with some text. we can add some css, or not. the style map will include all the default and inherted css property values. </p> <dl id="output"></dl> we add a touch of css with a custom property to better de...
...And 6 more matches
UIEvent.layerX - Web APIs
Web › API › UIEvent › layerX
the uievent.layerx read-only property returns the horizontal coordinate of the event relative to the current layer. this property takes scrolling of the page into account and returns a value relative to the whole of the document unless the event occurs inside a positioned element, where the returned value is relative to the top left of the positioned element. syntax var xpos = event.layerx xpos is an integer value in pixels for the x-coordinate of the mouse pointer, when the mouse event fired. ...
...positioned element. syntax var xpos = event.layerx xpos is an integer value in pixels for the x-coordinate of the mouse pointer, when the mouse event fired. ...
...= event.layerx xpos is an integer value in pixels for the x-coordinate of the mouse pointer, when the mouse event fired. ...
...And 6 more matches
UIEvent.layerY - Web APIs
Web › API › UIEvent › layerY
the uievent.layery read-only property returns the vertical coordinate of the event relative to the current layer. this property takes scrolling of the page into account, and returns a value relative to the whole of the document, unless the event occurs inside a positioned element, where the returned value is relative to the top left of the positioned element. syntax var ypos = event.layery; ypos is an integer value in pixels for the y-coordinate of the mouse pointer, when the mouse event fired. ...
...ositioned element. syntax var ypos = event.layery; ypos is an integer value in pixels for the y-coordinate of the mouse pointer, when the mouse event fired. ...
... event.layery; ypos is an integer value in pixels for the y-coordinate of the mouse pointer, when the mouse event fired. ...
...And 6 more matches
UIEvent.pageY - Web APIs
Web › API › UIEvent › pageY
the uievent.pagey read-only property returns the vertical coordinate of the event relative to the whole document. syntax var pagey = event.pagey; pagey is an integer value in pixels for the y-coordinate of the mouse pointer, relative to the whole document, when the mouse event fired. this property takes into account any vertical scrolling of the page. ...
...y-coordinate of the mouse pointer, relative to the whole document, when the mouse event fired. this property takes into account any vertical scrolling of the page. ...
...ative to the whole document, when the mouse event fired. this property takes into account any vertical scrolling of the page. ...
...And 6 more matches
ValidityState - Web APIs
badinput read only a boolean that is true if the user has provided input that the browser is unable to convert. ...
... badinput read only a boolean that is true if the user has provided input that the browser is unable to convert. ...
...e represents the validity states that an element can be in, with respect to constraint validation. together, they help explain why an element's value fails to validate, if it's not valid. properties for each of these boolean properties, a value of true indicates that the specified reason validation may have failed is true, with the exception of the valid property, which is true if the element's value obeys all constraints. badinput read only a boolean that is true if the user has provided input that the browser is unable to convert. ...
...And 6 more matches
Web applications and ARIA FAQ - Accessibility
dijit jquery ui fluid infusion google closure google web toolkit bbc glow yahoo! user interface library (yui) for more information about javascript toolkit accessibility: steve faulkner's wai-aria implementation in javascript ui libraries can you show me an example of aria in action? sure. here's the markup for a progress bar widget: <div id="percent-loaded" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" /> this progress bar is built using a <div>, which is not very descriptive. unfortunately, there isn't a more semantic tag available to developers in html 4, so we need to include aria roles and properties. these are specified by adding attributes to the element. in this example, the role="progressbar" attribute informs the browser that this element ...
...s bar is built using a <div>, which is not very descriptive. unfortunately, there isn't a more semantic tag available to developers in html 4, so we need to include aria roles and properties. these are specified by adding attributes to the element. in this example, the role="progressbar" attribute informs the browser that this element is actually a javascript-powered progress bar widget. the aria-valuemin and aria-valuemax attributes specify the minimum and maximum values for the progress bar, and the aria-valuenow describes the current state of it. along with placing them directly in the markup, aria attributes can be added to the element and updated dynamically using javascript code like this: // find the progress bar <div> in the dom. var progressbar = document.getelementbyid("percent-load...
... in the markup, aria attributes can be added to the element and updated dynamically using javascript code like this: // find the progress bar <div> in the dom. var progressbar = document.getelementbyid("percent-loaded"); // set its aria roles and states, so that assistive technologies know what kind of widget it is. ...
...And 6 more matches
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
important] get_accchildcount: get the number of children of an iaccessible. [important] get_accchild: get the child of an iaccessible. [important] get_accname: get the "name" of the iaccessible, for example the name of a button, checkbox or menu item. try to use unique names for each item in a dialog so that voice dictation software doesn't have to deal with extra ambiguity.[important] get_accvalue: get the "value" of the iaccessible, for example a number in a slider, a url for a link, the text a user entered in a field. [important] get_accdescription: get a long description of the current iaccessible. this is not really too useful. get_accrole: get an enumerated value representing what this iaccessible is used for, for example. is it a link, static text, editable text, a checkbox, or a...
...of this iaccessible node. [important] accnavigate: navigate to the first/last child, previous/next sibling, up, down, left or right from this iaccessible. [important, but no need to implement up/down/left/right] acchittest: find out what iaccessible exists and a specific coordinate. accdodefaultaction: perform the action described by get_accdefaultaction. put_accname: change the name. put_accvalue: change the value. msaa events cheat sheet for information on what each event does, see the msdn event constants page. check with your assistive technology partners to find out what events you need to support. there's a very good chance they won't ask for more than the events marked [important]: event_system_sound event_system_alert [can be important, to have auto-speaking for ...
... check with your assistive technology partners to find out what states you need to support. there's a very good ch...
...And 6 more matches
-webkit-box-reflect - CSS: Cascading Style Sheets
the -webkit-box-reflect css property lets you reflect the content of an element in one specific direction. /* direction values */ -webkit-box-reflect: above; -webkit-box-reflect: below; -webkit-box-reflect: left; -webkit-box-reflect: right; /* offset value */ -webkit-box-reflect: below 10px; /* mask value */ -webkit-box-reflect: below 0 linear-gradient(transparent, 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. <length> indicates the size of the ...
...his 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. <length> indicates the size of the reflection. <image> describes the mask to be applied to the reflection. ...
.... 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. <length> indicates the size of the reflection. <image> describes the mask to be applied to the reflection. ...
...And 6 more matches
-webkit-text-stroke - CSS: Cascading Style Sheets
the -webkit-text-stroke css property specifies the width and color of strokes for text characters. this is a shorthand property for the longhand properties -webkit-text-stroke-width and -webkit-text-stroke-color. ...
... the -webkit-text-stroke css property specifies the width and color of strokes for text characters. this is a shorthand property for the longhand properties -webkit-text-stroke-width and -webkit-text-stroke-color. ...
.../* width and color values */ -webkit-text-stroke: 4px navy; text-stroke: 4px navy; /* global values */ -webkit-text-stroke: inherit; -webkit-text-stroke: initial; -webkit-text-stroke: unset; text-stroke: inherit; text-stroke: initial; text-stroke: unset; constituent properties this property is a shorthand for the following css properties: -webkit-stroke-color -webkit-stroke-width syntax values <length> the width of the stroke. <color> the color of the stroke. ...
...And 6 more matches
additive-symbols - CSS: Cascading Style Sheets
the additive-symbols descriptor lets you specify symbols when the value of a counter system descriptor is additive. the additive-symbols descriptor defines additive tuples, each of which is a pair containing a symbol and a non-negative integer weight. the additive system is used to construct sign-value numbering systems such as roman numerals. syntax additive-symbols: 3 "0"; additive-symbols: 3 "0", 2 "\2e\20"; additive-symbols: 3 "0", 2 url(symbol.png); when the system descriptor is cyclic, numeric, alphabetic, symbolic, or fixed, use the symbols descriptor instead of additive-symbols. ...
... additive system is used to construct sign-value numbering systems such as roman numerals. syntax additive-symbols: 3 "0"; additive-symbols: 3 "0", 2 "\2e\20"; additive-symbols: 3 "0", 2 url(symbol.png); when the system descriptor is cyclic, numeric, alphabetic, symbolic, or fixed, use the symbols descriptor instead of additive-symbols. ...
...is used to construct sign-value numbering systems such as roman numerals. syntax additive-symbols: 3 "0"; additive-symbols: 3 "0", 2 "\2e\20"; additive-symbols: 3 "0", 2 url(symbol.png); when the system descriptor is cyclic, numeric, alphabetic, symbolic, or fixed, use the symbols descriptor instead of additive-symbols. ...
...And 6 more matches
pad - CSS: Cascading Style Sheets
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. ...
...representations longer than the pad length are constructed as normal. pad descriptor takes the minimum marker length as an integer and a symbol to be used for padding as the second parameter. a common usage of the pad descriptor is when you need your list to start numbering from 01 and go through 02, 03 and so on, instead of just 1, 2, 3... ...
...nger than the pad length are constructed as normal. pad descriptor takes the minimum marker length as an integer and a symbol to be used for padding as the second parameter. a common usage of the pad descriptor is when you need your list to start numbering from 01 and go through 02, 03 and so on, instead of just 1, 2, 3... ...
...And 6 more matches
prefix - CSS: Cascading Style Sheets
the prefix descriptor of the @counter-style rule specifies content that will be prepended to the marker representation. if not specified, the default value will be "" (an empty string). syntax /* <symbol> values */ prefix: "»"; prefix: "page "; prefix: url(bullet.png); values <symbol> specifies a <symbol> that is prepended to the marker representation. it may be a <string>, <image>, or <custom-ident>. ...
...ill be prepended to the marker representation. if not specified, the default value will be "" (an empty string). syntax /* <symbol> values */ prefix: "»"; prefix: "page "; prefix: url(bullet.png); values <symbol> specifies a <symbol> that is prepended to the marker representation. it may be a <string>, <image>, or <custom-ident>. ...
...esentation. if not specified, the default value will be "" (an empty string). syntax /* <symbol> values */ prefix: "»"; prefix: "page "; prefix: url(bullet.png); values <symbol> specifies a <symbol> that is prepended to the marker representation. it may be a <string>, <image>, or <custom-ident>. ...
...And 6 more matches
Attribute selectors - CSS: Cascading Style Sheets
the css attribute selector matches elements based on the presence or value of a given attribute. /* <a> elements with a title attribute */ a[title] { color: purple; } /* <a> elements with an href matching "https://example.org" */ a[href="https://example.org"] { color: green; } /* <a> elements with an href containing "example" */ a[href*="example"] { font-size: 2em; } /* <a> elements with an href ending ".org" */ a[href$=".org"] { font-style: italic; } /* <a> elements whose class attribute contains the word "logo" */ a[class~="logo"] { padding: 2px; } syntax [attr] represents elements with an attribute name of attr. ...
...xample.org"] { color: green; } /* <a> elements with an href containing "example" */ a[href*="example"] { font-size: 2em; } /* <a> elements with an href ending ".org" */ a[href$=".org"] { font-style: italic; } /* <a> elements whose class attribute contains the word "logo" */ a[class~="logo"] { padding: 2px; } syntax [attr] represents elements with an attribute name of attr. ...
...ntaining "example" */ a[href*="example"] { font-size: 2em; } /* <a> elements with an href ending ".org" */ a[href$=".org"] { font-style: italic; } /* <a> elements whose class attribute contains the word "logo" */ a[class~="logo"] { padding: 2px; } syntax [attr] represents elements with an attribute name of attr. [attr=value] represents elements with an attribute name of attr whose value is exactly value. ...
...And 6 more matches
Logical properties for floating and positioning - CSS: Cascading Style Sheets
the logical properties and values specification contains logical mappings for the physical values of float and clear, and also for the positioning properties used with positioned layout. this guide takes a look at how to use these. mapped properties and values the table below details the properties and values discussed in this guide along with their physical mappings. they assume a horizontal writing-mode, with a left-to-right direction. ...
...for the physical values of float and clear, and also for the positioning properties used with positioned layout. this guide takes a look at how to use these. mapped properties and values the table below details the properties and values discussed in this guide along with their physical mappings. they assume a horizontal writing-mode, with a left-to-right direction. ...
...at and clear, and also for the positioning properties used with positioned layout. this guide takes a look at how to use these. mapped properties and values the table below details the properties and values discussed in this guide along with their physical mappings. they assume a horizontal writing-mode, with a left-to-right direction. ...
...And 6 more matches
Overview of CSS Shapes - CSS: Cascading Style Sheets
would then wrap round the line of the circle. there are a number of ways to create these shapes and in these guides we will find out how css shapes work, and consider some ways you might like to use them. what does the specification define? the specification defines three new properties: shape-outside — allows definition of basic shapes shape-image-threshold — sets an opacity threshold value. ...
...css shapes work, and consider some ways you might like to use them. what does the specification define? the specification defines three new properties: shape-outside — allows definition of basic shapes shape-image-threshold — sets an opacity threshold value. if an image is being used to define the shape, only the parts of the image that are the same opacity or greater than the threshold value are used in the shape. any other parts are ignored. shape-margin — sets a margin around the defined shape defining basic shapes the shape-outside property allows us to a define a shape. it takes a variety of values, all of which define different shapes, specified in the <basic-shape> datatype. we can start by looking at a very simple case. in the following example i have an image floated l...
...the result is that the content now curves around the circular shape rather than following the rectangle created by the box of the image. ...
...And 6 more matches
Introducing the CSS Cascade - CSS: Cascading Style Sheets
Web › CSS › Cascade
this means that at-rules containing entities other than declarations, such as a @font-face rule containing descriptors, don't participate in the cascade. in these cases, only the at-rule as a whole participates in the cascade: here, the @font-face identified by its font-family descriptor. ...
...this means that at-rules containing entities other than declarations, such as a @font-face rule containing descriptors, don't participate in the cascade. in these cases, only the at-rule as a whole participates in the cascade: here, the @font-face identified by its font-family descriptor. ...
...— participate in the cascade, declarations contained in @keyframes don't. as with @font-face, only the at-rule as a whole is selected via the cascade algorithm. finally, note that @import and @charset obey specific algorithms and aren't affected by the cascade algorithm. origin of css declarations the css cascade algorithm's job is to select css declarations in order to determine the correct values for css properties. css declarations originate from different origins: the user-agent stylesheets, the author stylesheets, and the user stylesheets. though style sheets come from these different origins, they overlap in scope; to make this work, the cascade algorithm defines how they interact. user-agent stylesheets the browser has a basic style sheet that gives a default style to any documen...
...And 6 more matches
background-repeat - CSS: Cascading Style Sheets
this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. by default, the repeated images are clipped to the size of the element, but they can be scaled to fit (using round) or evenly distributed from end to end (using space). ...
... send us a pull request. by default, the repeated images are clipped to the size of the element, but they can be scaled to fit (using round) or evenly distributed from end to end (using space). ...
...g space). ...
...And 6 more matches
border-block - CSS: Cascading Style Sheets
the border-block css property is a shorthand property for setting the individual logical block border property values in a single place in the style sheet. border-block: 1px; border-block: 2px dotted; border-block: medium dashed blue; border-block can be used to set the values for one or more of border-block-width, border-block-style, and border-block-color setting both the start and end in the block dimension at once. the physical borders to which it maps depends on the element's writing mode, directionality, and text orientation. it corresponds to the border-top and border-bottom or border-right, and border-left properties depending on the values defined for writing-mode, direction, and text-orientation. the borders in the other dimension can be set with border-inline, which se...
...ght, and border-left properties depending on the values defined for writing-mode, direction, and text-orientation. the borders in the other dimension can be set with border-inline, which sets border-inline-start, and border-inline-end. constituent properties this property is a shorthand for the following css properties: border-block-color border-block-style border-block-width syntax values the border-block is specified with one or more of the following, in any order: <'border-width'> the width of the border. see border-width. <'border-style'> the line style of the border. see border-style. <'color'> the color of the border. see color. ...
...the following css properties: border-block-color border-block-style border-block-width syntax values the border-block is specified with one or more of the following, in any order: <'border-width'> the width of the border. see border-width. <'border-style'> the line style of the border. see border-style. <'color'> the color of the border. see color. ...
...And 6 more matches
border-bottom - CSS: Cascading Style Sheets
the border-bottom shorthand css property sets an element's bottom border. it sets the values of border-bottom-width, border-bottom-style and border-bottom-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. as with all shorthand properties, border-bottom always sets the values of all of the properties that it can set, even if they are not specified. it sets those that are not specified to their default values. this means that ... border-bottom-style: dotted; border-bottom: thick green; ... is actually the same as ... ...
...t. as with all shorthand properties, border-bottom always sets the values of all of the properties that it can set, even if they are not specified. it sets those that are not specified to their default values. this means that ... border-bottom-style: dotted; border-bottom: thick green; ... is actually the same as ... border-bottom-style: dotted; border-bottom: none thick green; ... and the value of border-bottom-style given before border-bottom is ignored. since the default value of border-bottom-style is none, not specifying the border-style part results in no border. constituent properties this property is a shorthand for the following css properties: border-bottom-color border-bottom-style border-bottom-width syntax border-bottom: 1px; border-bottom: 2px dotted; border-botto...
...e border-bottom is ignored. since the default value of border-bottom-style is none, not specifying the border-style part results in no border. constituent properties this property is a shorthand for the following css properties: border-bottom-color border-bottom-style border-bottom-width syntax border-bottom: 1px; border-bottom: 2px dotted; border-bottom: medium dashed blue; the three values of the shorthand property can be specified in any order, and one or two of them may be omitted. values <br-width> see border-bottom-width. <br-style> see border-bottom-style. <color> see border-bottom-color. ...
...And 6 more matches
border-image-outset - CSS: Cascading Style Sheets
er 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. ...
...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. ...
...please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> value */ border-image-outset: 1rem; /* <number> value */ border-image-outset: 1.5; /* vertical | 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>. ...
...And 6 more matches
border-image-source - CSS: Cascading Style Sheets
r 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 border-image-slice property is used to divide the source image into regions, which are then dynamically applied to the final border image. syntax /* keyword value */ border-image-source: none; /* <image> values */ border-image-source: url(image.jpg); border-image-source: linear-gradient(to top, red, yellow); /* global values */ border-image-source: inherit; border-image-source: initial; border-image-source: unset; values none no border image is used. the appearance defined by border-style is displayed instead. <image> image reference to use for t...
...e> values */ border-image-source: url(image.jpg); border-image-source: linear-gradient(to top, red, yellow); /* global values */ border-image-source: inherit; border-image-source: initial; border-image-source: unset; values none no border image is used. the appearance defined by border-style is displayed instead. <image> image reference to use for the border. formal definition initial valuenoneapplies toall elements, except internal table elements when border-collapse is collapse. ...
...nherit; border-image-source: initial; border-image-source: unset; values none no border image is used. the appearance defined by border-style is displayed instead. <image> image reference to use for the border. formal definition initial valuenoneapplies toall elements, except internal table elements when border-collapse is collapse. ...
...And 6 more matches
border-inline-start - 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. ...
...order-inline-start-style border-inline-start-width syntax border-inline-start: 1px; border-inline-start: 2px dotted; border-inline-start: medium dashed green; the physical border to which border-inline-start maps depends on the element's writing mode, directionality, and text orientation. it corresponds to the border-top, border-right, border-bottom, or border-left property depending on the values defined for writing-mode, direction, and text-orientation. related properties are border-block-start, border-block-end, and border-inline-end, which define the other borders of the element. values the border-inline-start is specified with one or more of the following, in any order: <'border-width'> the width of the border. see border-width. <'border-style'> the line style of the border.
...k-start, border-block-end, and border-inline-end, which define the other borders of the element. values the border-inline-start is specified with one or more of the following, in any order: <'border-width'> the width of the border. see border-width. <'border-style'> the line style of the border. see border-style. <'color'> the color of the border. see color. ...
...And 6 more matches
border-left-color - CSS: Cascading Style Sheets
er-left-color css property sets the color of an element's left border. it can also be set with the shorthand css properties border-color or border-left. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...pository. if 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 /* <color> values */ border-left-color: red; border-left-color: #ffbb00; border-left-color: rgb(255, 0, 0); border-left-color: hsla(100%, 50%, 25%, 0.75); border-left-color: currentcolor; border-left-color: transparent; /* global values */ border-left-color: inherit; border-left-color: initial; border-left-color: unset; the border-left-color property is specified as a single value. values <color> the color of the left border. ...
...bb00; border-left-color: rgb(255, 0, 0); border-left-color: hsla(100%, 50%, 25%, 0.75); border-left-color: currentcolor; border-left-color: transparent; /* global values */ border-left-color: inherit; border-left-color: initial; border-left-color: unset; the border-left-color property is specified as a single value. values <color> the color of the left border. formal definition initial valuecurrentcolorapplies toall elements. ...
...And 6 more matches
border-right-color - CSS: Cascading Style Sheets
right-color css property sets the color of an element's right border. it can also be set with the shorthand css properties border-color or border-right. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ry. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <color> values */ border-right-color: red; border-right-color: #ffbb00; border-right-color: rgb(255, 0, 0); border-right-color: hsla(100%, 50%, 25%, 0.75); border-right-color: currentcolor; border-right-color: transparent; /* global values */ border-right-color: inherit; border-right-color: initial; border-right-color: unset; the border-right-color property is specified as a single value. values <color> the color of the right border. ...
...der-right-color: rgb(255, 0, 0); border-right-color: hsla(100%, 50%, 25%, 0.75); border-right-color: currentcolor; border-right-color: transparent; /* global values */ border-right-color: inherit; border-right-color: initial; border-right-color: unset; the border-right-color property is specified as a single value. values <color> the color of the right border. formal definition initial valuecurrentcolorapplies toall elements. ...
...And 6 more matches
border-top-color - CSS: Cascading Style Sheets
order-top-color css property sets the color of an element's top border. it can also be set with the shorthand css properties border-color or border-top. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...hub repository. if 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 /* <color> values */ border-top-color: red; border-top-color: #ffbb00; border-top-color: rgb(255, 0, 0); border-top-color: hsla(100%, 50%, 25%, 0.75); border-top-color: currentcolor; border-top-color: transparent; /* global values */ border-top-color: inherit; border-top-color: initial; border-top-color: unset; the border-top-color property is specified as a single value. values <color> the color of the top border. ...
...color: #ffbb00; border-top-color: rgb(255, 0, 0); border-top-color: hsla(100%, 50%, 25%, 0.75); border-top-color: currentcolor; border-top-color: transparent; /* global values */ border-top-color: inherit; border-top-color: initial; border-top-color: unset; the border-top-color property is specified as a single value. values <color> the color of the top border. formal definition initial valuecurrentcolorapplies toall elements. ...
...And 6 more matches
cursor - CSS: Cascading Style Sheets
Web › CSS › cursor
the cursor css property sets the type of mouse cursor, if any, to show when the mouse pointer is over 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 value */ cursor: pointer; cursor: auto; /* url, with a keyword fallback */ cursor: url(hand.cur), pointer; /* url and coordinates, with a keyword fallback */ cursor: url(cursor1.png) 4 12, auto; cursor: url(cursor2.png) 2 2, pointer; /* global values */ cursor: inherit; cursor: initial; cursor: unset; the cursor property is specified as zero or more <url> values, separated by commas, followed by a single mandatory keyword value. each ...
...rl(cursor2.png) 2 2, pointer; /* global values */ cursor: inherit; cursor: initial; cursor: unset; the cursor property is specified as zero or more <url> values, separated by commas, followed by a single mandatory keyword value. each <url> should point to an image file. the browser will try to load the first image specified, falling back to the next if it can't, and falling back to the keyword value if no images could be loaded (or if none were specified). each <url> may be optionally followed by a pair of space-separated numbers, which represent <x><y> coordinates. these will set the cursor's hotspot, relative to the top-left corner of the image. ...
... image specified, falling back to the next if it can't, and falling back to the keyword value if no images could be loaded (or if none were specified). each <url> may be optionally followed by a pair of space-separated numbers, which represent <x><y> coordinates. these will set the cursor's hotspot, relative to the top-left corner of the image. for example, this specifies two images using <url> values, providing <x><y> coordinates for the second one, and falling back to the progress keyword value if neither image can be loaded: cursor: url(one.svg), url(two.svg) 5 5, progress; values <url> a url(…) or a comma separated list url(…), url(…), …, pointing to an image file. more than one <url> may be provided as fallbacks, in case some cursor image types are not supported. a non-url ...
...And 6 more matches
<custom-ident> - CSS: Cascading Style Sheets
syntax the syntax of <custom-ident> is similar to css identifiers (such as property names), except that it is case-sensitive. ...
... escaped character (preceded by a backslash, \), a unicode character (in the format of a backslash, \, followed by one to six hexadecimal digits, representing its unicode code point) note that id1, id1, id1 and id1 are all different identifiers as they are case-sensitive. on the other hand, as there are several ways to escape a character, toto\? and toto\3f are the same identifiers. ...
...a character, toto\? ...
...And 6 more matches
font-stretch - CSS: Cascading Style Sheets
the font-stretch css property selects a normal, condensed, or expanded face from a font. /* keyword values */ font-stretch: ultra-condensed; font-stretch: extra-condensed; font-stretch: condensed; font-stretch: semi-condensed; font-stretch: normal; font-stretch: semi-expanded; font-stretch: expanded; font-stretch: extra-expanded; font-stretch: ultra-expanded; /* percentage values */ font-stretch: 50%; font-stretch: 100%; font-stretch: 200%; /* global values */ font-stretch: inherit; font-stretch: initial; font-stretch: unset; syntax this property may be specified as a single keyword value or a single <percentage> value. values normal specifies a normal font face. semi-condensed, condensed, extra-condensed, ultra-condensed specifies a more condensed font face than normal, with ultr...
...this enables variable fonts to offer something more like a continuum of character widths. ...
...rmal font face. semi-condensed, condensed, extra-condensed, ultra-condensed specifies a more condensed font face than normal, with ultra-condensed as the most condensed. semi-expanded, expanded, extra-expanded, ultra-expanded specifies a more expanded font face than normal, with ultra-expanded as the most expanded. <percentage> a <percentage> value between 50% and 200% (inclusive). negative values are not allowed for this property. in earlier versions of the font-stretch specification, the property accepts only the nine keyword values. css fonts level 4 extends the syntax to accept a <percentage> value as well. this enables variable fonts to offer something more like a continuum of character widths. for truetype or opentype variable fonts, the "wdth" variation is used to implement varyi...
...And 6 more matches
grid-area - CSS: Cascading Style Sheets
Web › CSS › grid-area
and location within a grid by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the edges of its grid 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. if four <grid-line> values are specified, grid-row-start is set to the first value, grid-column-start is set to the second value, grid-row-end is set to the third value, and grid-column-end is set to the fourth value. when grid-column-end is omitted, if grid-column-start is a <custom-ident>, grid-column-end is set to that <custom-ident>; otherwise, it is set to auto. when grid-row-end is omitted, if grid-row-start is a ...
...rid-column-end is omitted, if grid-column-start is a <custom-ident>, grid-column-end is set to that <custom-ident>; otherwise, it is set to auto. when grid-row-end is omitted, if grid-row-start is a <custom-ident>, grid-row-end is set to that <custom-ident>; otherwise, it is set to auto. when grid-column-start is omitted, if grid-row-start is a <custom-ident>, all four longhands are set to that value. ...
...t>, all four longhands are set to that value. otherwise, it is set to auto. the grid-area property can also be set to a <custom-ident> which acts as a name for the area, which can then be placed using grid-template-areas. ...
...And 6 more matches
grid - CSS: Cascading Style Sheets
Web › CSS › grid
ion. the source for this interactive example is stored in a github repository. if 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: you can only specify the explicit or the implicit grid properties in a single grid declaration. ...
...ion. the sub-properties you don’t specify are set to their initial value, as normal for shorthands. also, the gutter properties are not reset by this shorthand. ...
...grid-template-columns grid-template-rows syntax /* <'grid-template'> values */ grid: none; grid: "a" 100px "b" 1fr; grid: [linename1] "a" 100px [linename2]; grid: "a" 200px "b" min-content; grid: "a" minmax(100px, max-content) "b" 20%; grid: 100px / 200px; grid: minmax(400px, min-content) / repeat(auto-fill, 50px); /* <'grid-template-rows'> / [ auto-flow && dense? ] <'grid-auto-columns'>? values */ grid: 200px / auto-flow; grid: 30% / auto-flow dense; grid: repeat(3, [line1 line2 line3] 200px) / auto-flow 300px; grid: [line1] minmax(20em, max-content) / auto-flow dense 40%; /* [ auto-flow && dense? ] <'grid-auto-rows'>? ...
...And 6 more matches
left - CSS: Cascading Style Sheets
Web › CSS › left
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, th...
...uto is treated as a width based on the content; or if right is also auto, the element is positioned where it should horizontally be positioned if it were a static 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. ...
... the content; or if right is also auto, the element is positioned where it should horizontally be positioned if it were a static 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. ...
...And 6 more matches
<length> - CSS: Cascading Style Sheets
Web › CSS › length
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. ...
...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. ...
...ngth unit is optional after the number 0. note: some properties allow negative <length>s, while others do not. units relative length units relative lengths represent a measurement in terms of some other distance. depending on the unit, this can be the size of a specific character, the line height, or the size of the viewport. font-relative lengths font-relative lengths define the <length> value in terms of the size of a particular character or font attribute in the font currently in effect in an element or its parent. note: these units, especially em and rem, are often used to create scalable layouts, which maintain the vertical rhythm of the page even when the user changes the font size. cap represents the "cap height" (nominal height of capital letters) of the element’s fon...
...And 6 more matches
margin-inline-end - CSS: Cascading Style Sheets
the margin-inline-end css property defines the logical inline end margin of an element, which maps to a physical margin depending on the element's writing mode, directionality, and text orientation. in other words, it corresponds 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. ...
... 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. ...
...ub repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 6 more matches
margin-right - CSS: Cascading Style Sheets
the margin-right css property sets the margin area on the right side of an element. a positive value places 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. ...
...er 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. ...
... 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 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...
...And 6 more matches
mask-clip - CSS: Cascading Style Sheets
Web › CSS › mask-clip
the mask-clip css property determines the area which is affected by a mask. the painted content of an element must be restricted to this area. ...
... the mask-clip css property determines the area which is affected by a mask. the painted content of an element must be restricted to this area. ...
... the mask-clip css property determines the area which is affected by a mask. the painted content of an element must be restricted to this area. ...
...And 6 more matches
perspective-origin - CSS: Cascading Style Sheets
ub repository. if 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 perspective-origin and perspective properties are attached to the parent of a child transformed in 3-dimensional space, unlike the perspective() transform function which is placed on the element being transformed. ...
...ctive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the perspective-origin and perspective properties are attached to the parent of a child transformed in 3-dimensional space, unlike the perspective() transform function which is placed on the element being transformed. syntax /* one-value syntax */ perspective-origin: x-position; /* two-value syntax */ perspective-origin: 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...
...perspective-origin: 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 t...
...And 6 more matches
place-self - CSS: Cascading Style Sheets
the place-self css shorthand property allows you to align an individual item in both the block and inline directions at once (i.e. the align-self and justify-self properties) in a relevant layout system such as grid or flexbox. if the second value is not present, the first value is also used for it. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...he first value is also used for it. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... normal the effect of this keyword is dependent of the layout mode we are in: in absolutely-positioned layouts, the keyword behaves like start on replaced absolutely-positioned boxes, and as stretch on all other absolutely-positioned boxes. in static position of abs...
...And 6 more matches
revert - CSS: Cascading Style Sheets
Web › CSS › revert
the revert css keyword reverts the cascaded value of the property from its current value to the value the property would have had if no changes had been made by the current style origin to the current element. thus, it resets the property to its inherited value if it inherits from its parent or to the default value established by the user agent's stylesheet (or by user styles, if any exist). it can be applied to any css property, including the css shorthand all. this removes from the cascade all of the styles that have been overridden until the style being rolled back to is reached. ...
...rent or to the default value established by the user agent's stylesheet (or by user styles, if any exist). it can be applied to any css property, including the css shorthand all. this removes from the cascade all of the styles that have been overridden until the style being rolled back to is reached. if used by a site's own styles (the author origin), revert rolls back the property's cascaded value to the user's custom style, if one exists; otherwise, it rolls the style back to the user agent's default style. if used in a user's custom stylesheet, or if the style was applied by the user (the user origin), revert rolls back the cascaded value to the user agent's default style. if used within the user agent's default styles, this keyword is functionally equivalent to unset. the revert key...
... revert will not affect rules applied to children of an element you reset (but will remove effects of a parent rule on a child). ...
...And 6 more matches
right - CSS: Cascading Style Sheets
Web › CSS › right
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 ele...
...: auto is treated as a width based on the content; or if left is also auto, the element is positioned where it should horizontally be positioned if it were a static 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. ...
... on the content; or if left is also auto, the element is positioned where it should horizontally be positioned if it were a static 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. ...
...And 6 more matches
text-shadow - CSS: Cascading Style Sheets
syntax /* offset-x | offset-y | blur-radius | color */ text-shadow: 1px 1px 2px black; /* color | offset-x | offset-y | blur-radius */ text-shadow: #fc0 1px 0 10px; /* offset-x | 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 co...
...lowed 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 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...
... 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-radius> optional. ...
...And 6 more matches
Cross-browser audio basics - Developer guides
explore the different aspects of html5 audio in more detail. audio html attributes we can specify a number of attributes with the audio tag to further determine the way audio is initialized. autoplay specifying autoplay will cause the audio to start playing as soon as possible and without any user interaction — in short, the audio will autoplay. <audio autoplay> ... </audio> note: this value is often ignored on mobile platforms, and its use is not recommended unless really necessary. auto-playing audio (and video) is usually really annoying. plus browsers have policies that will block autoplay entirely in many situations. see the autoplay guide for media and web audio apis for details. loop the loop attribute will ensure that upon getting to the end of the audio clip, the audio cl...
... in many situations. see the autoplay guide for media and web audio apis for details. loop the loop attribute will ensure that upon getting to the end of the audio clip, the audio clip will loop back to the beginning and start playing again. <audio loop> ... </audio> muted if you want the audio to start muted (no volume), add the muted attribute. <audio muted> ... </audio> note: this value is often ignored on mobile platforms. preload the preload attribute allows you to specify a preference for how the browser 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: down...
...essed. 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 browser to provide us with its default playback controls. <audio controls> ... </audio> src as mentioned above, you can use the <source> element to specify one or more source audio files. alternatively, you can include the src attribute directly on th...
...And 6 more matches
HTML attribute: multiple - HTML: Hypertext Markup Language
depending on the type, the form control may have a different appearance if the multiple attribute is set. for the file input type, the native messaging the browser provides differs. in firefox, the file input reads "no files selected" when the attribute is present and "no file selected" when not, when no files are selected. ...
...the same, but will match the :invalid pseudo-class if more than one comma-separated email address is included if the attribute is not present. when multiple is set on the email input type, the user can inlclude zero (if not also required), one or more comma-separated email addresses. <input type="email" multiple name="emails" id="emails"> if and only if the multiple attribute is specified, the value can be a list of properly-formed comma-separated e-mail addresses. any trailing and leading whitespace is removed from each address in the list. when multiple is set on the file input type, the user can select one or more files. the user can choose multiple files from the file picker in any way that their chosen platform allows (e.g. by holding down shift or control, and then clicking). <input ...
...ption>sneezy</option> <option>dopey</option> <option>doc</option> </select> when multiple is specified, most browsers will show a scrolling list box instead of a single line dropdown. ...
...And 6 more matches
Date and time formats used in HTML - HTML: Hypertext Markup Language
certain html elements use date and/or time values. the formats of the strings that specify these values are described in this article. elements that use such formats include certain forms of the <input> element that let the user choose or specify a date, time, or both, as well as the <ins> and <del> elements, whose datetime attribute specifies the date or date and time at which the insertion or deletion of content occurred. ...
...ues. the formats of the strings that specify these values are described in this article. elements that use such formats include certain forms of the <input> element that let the user choose or specify a date, time, or both, as well as the <ins> and <del> elements, whose datetime attribute specifies the date or date and time at which the insertion or deletion of content occurred. for <input>, the values of type that return a value which contains a string representing a date and/or time are: date datetime datetime-local month time week examples before getting into the intricacies of how date and time strings are written and parsed in html, here are some examples that should give you a good idea what the more commonly-used date and time string formats look like. example html dat...
...ime strings are expected to look. character set dates and times in html are always strings which use the ascii character set. year numbers in order to simplify the basic format used for date strings in html, the specification requires that all years be given using the modern (or proleptic) gregorian calendar. while user interfaces may allow entry of dates using other calendars, the underlying value always uses the gregorian calendar. while the gregorian calendar wasn't created until the year 1582 (replacing the similar julian calendar), for html's purposes, the gregorian calendar is extended back to the year 1 c.e. make sure any older dates account for this. for the purposes of html dates, years are always at least four digits long; years prior to the year 1000 are padded with leading zer...
...And 6 more matches
<input type="hidden"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › hidden
for example, the id of the content that is currently being ordered or edited, or a unique security token. hidden inputs are completely invisible in the rendered page, and there is no way to make it visible in the page's content. note: there is a live example below the following line of code — if it is working correctly, you should see nothing! <input id="prodid" name="prodid" type="hidden" value="xm234jq"> value a domstring representing the value of the hidden data you want to pass back to the server. events none. supported common attributes autocomplete idl attributes value methods none. note: the input and change events do not apply to this input type. hidden inputs cannot be focused even using javascript (e.g. hid...
... value a domstring representing the value of the hidden data you want to pass back to the server. events none. supported common attributes autocomplete idl attributes value methods none. note: the input and change events do not apply to this input type. hidden inputs cannot be focused even using javascript (e.g. hiddeninput.focus()). value the <input> element's value attribute holds a domstring that contains the hidden data you want to include when the form is submitted to the server. this specifically can't be edited or seen by the user via the user interface, although you could edit the value via browser developer tools. ...
...do not rely on hidden inputs as a form of security. ...
...And 6 more matches
<video>: The Video Embed element - HTML: Hypertext Markup Language
Web › HTML › Element › video
is attribute is present, the browser will offer controls to allow the user to control video playback, including volume, seeking, and pause/resume playback. controlslist the controlslist attribute, when specified, helps the browser select what controls to show on the media element whenever the browser shows its own set of controls (e.g. when the controls attribute is specified). ...
...in other words, it sends the origin: http header without a cookie, x.509 certificate, or performing http basic authentication. ...
...s usage restricted. when not present, the resource is fetched without a cors request (i.e. without sending the origin: http header), preventing its non-tainted used in <canvas> elements. if invalid, it is handled as if the enumerated keyword anonymous was used. see cors settings attributes for additional information. currenttime reading currenttime returns a double-precision floating-point value indicating the current playback position of the media specified in seconds. if the media has not started playing yet, the time offset at which it will begin is returned. setting currenttime sets the current playback position to the given time and seeks the media to that position if the media is currently loaded. if the media is being streamed, it's possible that the user agent may not be able t...
...And 6 more matches
Set-Cookie2 - HTTP
the obsolete set-cookie2 http response header used to send cookies from the server to the user agent, but has been deprecated by the specification. use set-cookie instead. ...
... the obsolete set-cookie2 http response header used to send cookies from the server to the user agent, but has been deprecated by the specification. use set-cookie instead. ...
... the obsolete set-cookie2 http response header used to send cookies from the server to the user agent, but has been deprecated by the specification. use set-cookie instead. ...
...And 6 more matches
HTTP headers - HTTP
Web › HTTP › Headers
custom proprietary headers have historically been used with an x- prefix, but this convention was deprecated in june 2012 because of the inconveniences it caused when nonstandard fields became standard in rfc 6648; others are listed in an iana registry, whose original content was defined in rfc 4229. iana also maintains a registry of proposed new http headers. ...
...2 of [cssval]) of the layout viewport (section 9.1.1 of [css2]) on the device. device-memory technically a part of device memory api, this header represents an approximate amount of ram client has. save-data a boolean that indicates the user agent's preference for reduced data usage. viewport-width a number that indicates the layout viewport width in css pixels. ...
...ice. device-memory technically a part of device memory api, this header represents an approximate amount of ram client has. save-data a boolean that indicates the user agent's preference for reduced data usage. viewport-width a number that indicates the layout viewport width in css pixels. the provided pixel value is a number rounded to the smallest following integer (i.e. ceiling value). if viewport-width occurs in a message more than once, the last value overrides all previous occurrences. width the width request header field is a number that indicates the desired resource width in physical pixels (i.e. intrinsic size of an image). the provided pixel value is a number rounded to the smallest following integer (i.e. ceiling value). if the desired resourc...
...And 6 more matches
Memory Management - JavaScript
ng language, the memory life cycle is pretty much always the same: allocate the memory you need use the allocated memory (read, write) release the allocated memory when it is not needed anymore the second part is explicit in all languages. the first and last parts are explicit in low-level languages but are mostly implicit in high-level languages like javascript. ...
...d, write) release the allocated memory when it is not needed anymore the second part is explicit in all languages. the first and last parts are explicit in low-level languages but are mostly implicit in high-level languages like javascript. allocation in javascript value initialization in order to not bother the programmer with allocations, javascript will automatically allocate memory when values are initially declared. ...
...h-level languages like javascript. allocation in javascript value initialization in order to not bother the programmer with allocations, javascript will automatically allocate memory when values are initially declared. ...
...And 6 more matches
Array.prototype.forEach() - JavaScript
the foreach() method executes a provided function once for each array 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 arr.foreach(callback(currentvalue [, index [, array]])[, thisarg]) parameters callback function to execute on each element. it accepts between one and three arguments: currentvalue the current element being processed in the array. index optional the index currentvalue in the array. array optional the array foreach() was called upon. thisarg optional value to use as this when executing callback. return value undefined. description foreach() calls a provi...
...was called upon. thisarg optional value to use as this when executing callback. return value undefined. description foreach() calls a provided callback function once for each element in an array in ascending order. it is not invoked for index properties that have been deleted or are uninitialized. (for sparse arrays, see example below.) callback is invoked with three arguments: the value of the element the index of the element the array object being traversed if a thisarg parameter is provided to foreach(), it will be used as callback's this value. the thisarg value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. the range of elements processed by foreach() is set before the first invocation of callbac...
...if elements that are already visited are removed (e.g. using shift()) during the iteration, later elements will be skipped. ...
...And 6 more matches
Object.entries() - JavaScript
(the only important difference is that a for...in loop enumerates properties in the prototype chain as well). the order of the array returned by object.entries() does not depend on how an object is defined. if there is a need for certain ordering, then the array should be sorted first, like object.entries(obj).sort((a, b) => b[0].localecompare(a[0]));. the source for this interactive example is stored in a github repository. ...
... object.entries(obj).sort((a, b) => b[0].localecompare(a[0]));. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ocalecompare(a[0]));. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.entries(obj) parameters obj the object whose own enumerable string-keyed property [key, value] pairs are to be returned. return value an array of the given object's own enumerable string-keyed property [key, value] pairs. description object.entries() returns an array whose elements are arrays corresponding to the enumerable string-keyed property [key, value] pairs found directly upon object. the ordering of the properties is the same as that given by looping over the property values of the object manually. polyfill to add ...
...And 6 more matches
Object.freeze() - JavaScript
the object.freeze() method freezes an object. a frozen object can no longer be changed; freezing an object prevents new properties from being added to it, existing properties from being removed, prevents changing the enumerability, configurability, or writability of existing properties, and prevents the values of existing properties from being changed. in addition, freezing an object also prevents its prototype from being changed. freeze() returns the same object that was passed in. ...
...events its prototype from being changed. freeze() returns the same object that was passed in. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.freeze(obj) parameters obj the object to freeze. ...
... object.freeze(obj) parameters obj the object to freeze. return value the object that was passed to the function. description nothing can be added to or removed from the properties set of a frozen object. any attempt to do so will fail, either silently or by throwing a typeerror exception (most commonly, but not exclusively, when in strict mode). for data properties of a frozen object, values cannot be changed, the writable and configurable attributes are set to false. accessor properties (getters and setters) work the same (and still give the illusion that you are changing the value). note that values that are objects can still be modified, unless they are also frozen. as an object, an array can be frozen; after doing so, its elements cannot be altered and no elements can be added t...
...And 6 more matches
handler.set() - JavaScript
receiver the object to which the assignment was originally directed. this is usually the proxy itself. ...
... receiver the object to which the assignment was originally directed. this is usually the proxy itself. ...
... receiver the object to which the assignment was originally directed. this is usually the proxy itself. ...
...And 6 more matches
String.prototype.indexOf() - JavaScript
the indexof() method returns the index within the calling string object of the first occurrence of the specified value, starting the search at fromindex. returns -1 if the value is not found. the source for this interactive example is stored in a github repository. if 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: for the array method, see array.prototype.indexof(). syntax str.indexof(searchvalue [, fromindex]) parameters searchvalue the string value to search for. if no string is explicitly provided, searchvalue will be coerced to "undefined", and this value will be searched for in str. so, for example: 'undefined'.indexof() will return 0, as undefined is found at positi...
...coerced to "undefined", and this value will 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. ...
... 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 index of the first occurrence of searchvalue, or -1 if not found. an empty string searchvalue produces strange results. ...
...And 6 more matches
switch - JavaScript
the switch statement evaluates an expression, matching the expression's value to a case clause, and executes statements associated with that case, as well as statements in cases that follow the matching case. the source for this interactive example is stored in a github repository. if 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 switch (expression) { case value1: //statements executed when the //result of expression matches value1 [break;] case value2: //statements executed when the //result of expression matches value2 [break;] ... ...
...ou'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax switch (expression) { case value1: //statements executed when the //result of expression matches value1 [break;] case value2: //statements executed when the //result of expression matches value2 [break;] ... case valuen: //statements executed when the //result of expression matches valuen [break;] [default: //statements executed when none of //the values match the value of the expression [break;]] } expression an expression whose result is matched against each case clause. case valuen optional a case clause used to match against expression. if the expression matches the specified...
... description a switch statement first evaluates its expression. ...
...And 6 more matches
Digital video concepts - Web media technologies
there are several color models, and video codec makes use of one or more of these to represent their pixels during the encoding process as well as after decoding the video frames. ...
...there are several color models, and video codec makes use of one or more of these to represent their pixels during the encoding process as well as after decoding the video frames. ...
...me. the final color image is created by the brain, which essentially layers the colors onto the greyscale pixels. yuv concepts yuv works by defining a color space with three components: luma (y') the brightness of the pixel. without the other two components, the luma of each pixel in the frame produces a greyscale representation of the image. ...
...And 6 more matches
flood-opacity - SVG: Scalable Vector Graphics
note: as a presentation attribute, flood-opacity can be used as a css property. ...
... a number of 0 or a percentage of 0% represents a fully transparent color, 1 or 100% represents a fully opaque color. specifications specification status comment fil...
... a number of 0 or a percentage of 0% represents a fully transparent color, 1 or 100% represents a fully opaque color. specifications specification status comment filter effects modu...
...And 6 more matches
gradientUnits - SVG: Scalable Vector Graphics
the gradientunits attribute defines the coordinate system used for attributes specified on the gradient elements. two elements are using this attribute: <lineargradient> and <radialgradient> lineargradient for <lineargradient>, gradientunits defines the coordinate system used for the attributes x1, y1, x2, and y2. ...
... the gradientunits attribute defines the coordinate system used for attributes specified on the gradient elements. two elements are using this attribute: <lineargradient> and <radialgradient> lineargradient for <lineargradient>, gradientunits defines the coordinate system used for the attributes x1, y1, x2, and y2. ...
...tes specified on the gradient elements. two elements are using this attribute: <lineargradient> and <radialgradient> lineargradient for <lineargradient>, gradientunits defines the coordinate system used for the attributes x1, y1, x2, and y2. value userspaceonuse | objectboundingbox default value objectboundingbox animatable yes userspaceonuse this value indicates that the attributes represent values in the coordinate system that results from taking the current user coordinate system in place at the time when the gradient element is referenced (i.e., the user coordinate system for the element referencing the gradient element via a fill or stroke property) and then applying the transform specified by attribute gradienttransform. percentages repre...
...And 6 more matches
kernelUnitLength - SVG: Scalable Vector Graphics
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>, kernelunitlength 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 kernelunitlength, the kernel becomes defined in a scalable, abstract coordinate system. if the attribute is not specified, the default value is one pixel in the offscreen bitmap, which is a pixel-based coordinate system, and thus potentially not scalable. if a negative ...
...itiveunits attribute) between successive columns and rows, respectively, in the kernelmatrix. by specifying value(s) for kernelunitlength, the kernel becomes defined in a scalable, abstract coordinate system. if the attribute is not specified, the default value is one pixel in the offscreen bitmap, which is a pixel-based coordinate system, and thus potentially not scalable. if a negative or zero value is specified the default value will be used instead. value <number-optional-number> default value pixel in offscreen bitmap animatable yes <number-optional-number> the first number is the x value. the second number is the y value. if the x value is not specified, it defaults to the same value as x. fediffuselighting for the <fediffuselighting>, ke...
... default value pixel in offscreen bitmap animatable yes <number-optional-number> the first number is the x value. the second number is the y value. if the x value is not specified, it defaults to the same value as x. fediffuselighting for the <fediffuselighting>, kernelunitlength indicates the intended distance in current filter units (i.e., units as determined by the value of attribute primitiveunits) for the x and y coordinate, respectively, in the surface normal calculation formulas. the first number is the x value. the second number is the y value. if the y value is not specified, it defaults to the same value as x. by specifying value(s) for kernelunitlength, the kernel becomes defined in a scalable, abstract coordinate system. if the attribute is not specifie...
...And 6 more matches
<altGlyph> - SVG: Scalable Vector Graphics
Web › SVG › Element › altGlyph
the <altglyph> svg element allows sophisticated selection of the glyphs used to render its child character data. usage context categoriestext content element, text content child elementpermitted contentany elements or character data attributes x this attribute defines the corresponding absolute x-coordinates for rendering the element. ...
... the <altglyph> svg element allows sophisticated selection of the glyphs used to render its child character data. usage context categoriestext content element, text content child elementpermitted contentany elements or character data attributes x this attribute defines the corresponding absolute x-coordinates for rendering the element. ...
...text content child elementpermitted contentany elements or character data attributes x this attribute defines the corresponding absolute x-coordinates for rendering the element. value type: <list-of-coordinates> ; default value: absolute x-coordinate of ancestor <text> or <tspan>; animatable: yes y this attribute defines the corresponding absolute y-coordinates for rendering the element. value type: <list-of-coordinates> ; default value: absolute y-coordinate of ancestor <text> or <tspan>; animatable: yes dx this attribute indicates a shift along the x-axis on the position of the element. ...
...And 6 more matches
<text> - SVG: Scalable Vector Graphics
Web › SVG › Element › text
* fill property, 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. ...
...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. ...
...="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. 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. ...
...And 6 more matches
<textPath> - SVG: Scalable Vector Graphics
Web › SVG › Element › textPath
"mypath" fill="none" stroke="red" d="m10,90 q90,90 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. ...
..."red" d="m10,90 q90,90 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. ...
...ox 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. ...
...And 6 more matches
<tspan> - SVG: Scalable Vector Graphics
Web › SVG › Element › tspan
d. html,body,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. ...
...iewbox="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. ...
... serif; } tspan { font: bold 10px sans-serif; fill: red; } </style> <text x="10" y="30" class="small"> you are <tspan>not</tspan> a banana! ...
...And 6 more matches
page-worker - Archive of obsolete content
scripts for help on setting this property. contentscript string,array a string or an array of strings containing the texts of content scripts to load. content scripts specified by this option are loaded after those specified by the contentscriptfile option. contentscriptwhen string when to load the content scripts. ...
... has been loaded "ready": load content scripts once dom content has been loaded, corresponding to the domcontentloaded event "end": load content scripts once all the content (dom, js, css, images) for the page has been loaded, at the time the window.onload event fires this property is optional and defaults to "end". contentscriptoptions object read-only value exposed to content scripts under self.options property. any kind of jsonable value (object, array, string, etc.) can be used here. optional. onmessage function use this to add a listener to the page worker's message event. page a page object loads the page specified by its contenturl option and executes any content scripts that have been supplied to it in ...
.... the page worker is loaded as soon as the page object is created and stays loaded until its destroy method is called or the add-on is unloaded. methods destroy() unloads the page worker. after you destroy a page worker, its memory is freed and you must create a new instance if you need to load another page. postmessage(message) sends a message to the content scripts. parameters message : value the message to send. must be json-able. on(type, listener) registers an event listener with the page worker. see working with events for help with events. parameters type : string the type of event to listen for. listener : function the listener function that handles the event. removelistener(type, listener) unregisters an event listener from the page worker. parameters type : string ...
...And 5 more matches
simple-storage - Archive of obsolete content
lets an add-on store data so that it's retained across firefox restarts. this module works similarly to dom storage on the web, except that it's only available for add-ons. usage the simple storage module exports an object called storage that is persistent and scoped to your add-on. it's a normal javascript object, and you can treat it as you would any other. to store a value, just assign it to a property on storage: var ss = require("sdk/simple-storage"); ss.storage.myarray = [1, 1, 2, 3, 5, 8, 13]; ss.storage.myboolean = true; ss.storage.mynull = null; ss.storage.mynumber = 3.1337; ss.storage.myobject = { a: "foo", b: { c: true }, d: null }; ss.storage.mystring = "o frabjous day!"; you can store array, boolean, number, object, null, and string values. if you'd like to store other type...
...erty on storage: var ss = require("sdk/simple-storage"); ss.storage.myarray = [1, 1, 2, 3, 5, 8, 13]; ss.storage.myboolean = true; ss.storage.mynull = null; ss.storage.mynumber = 3.1337; ss.storage.myobject = { a: "foo", b: { c: true }, d: null }; ss.storage.mystring = "o frabjous day!"; you can store array, boolean, number, object, null, and string values. if you'd like to store other types of values, you'll first have to convert them to strings or another one of these types. be careful to set properties on the storage object and not the module itself, as demonstrated below: // this is not good! var ss = require("sdk/simple-storage"); ss.foo = "i will not be saved! :("; simple storage and "jpm run" the simple storage module stores its data in your profile. because jpm run by default uses...
...ng to work, because it empties the array each time the add-on runs (for example, each time firefox is started). line 2 needs to be made conditional, so the array is only constructed if it does not already exist: if (!ss.storage.pages) ss.storage.pages = []; deleting data you can delete properties using the delete operator. ...
...And 5 more matches
lang/functional - Archive of obsolete content
will call the original function during the next event loop. this is similar to calling settimeout with no wait (i.e. settimeout(function () { ... }, 0)), except that the wrapped function may be reused and does not need to be repeated each time. this also enables you to use these functions as event listeners. let { defer } = require("sdk/lang/functional"); let fn = defer(function myevent (event, value) { console.log(event + " : " + value); }); fn("click", "#home"); console.log("done"); // this will print 'done' before 'click : #home' since // we deferred the execution of the wrapped `myevent` // function, making it non-blocking and executing on the // next event loop parameters fn : function the function to be deferred. returns function : the new, deferred function. remit() an alias...
...fore 'click : #home' since // we deferred the execution of the wrapped `myevent` // function, making it non-blocking and executing on the // next event loop parameters fn : function the function to be deferred. returns function : the new, deferred function. remit() an alias for defer. invoke(callee, params, self) invokes callee, passing params as an argument and self as this. returns the value that is returned by callee. let { invoke } = require("sdk/lang/functional"); invoke(sum, [1,2,3,4,5], null); // 15 function sum () { return array.slice(arguments).reduce(function (a, b) { return a + b; }); } parameters callee : function function to invoke. params : array parameters to be passed into callee. self : mixed object to be passed as the this context to callee. returns...
... let { invoke } = require("sdk/lang/functional"); invoke(sum, [1,2,3,4,5], null); // 15 function sum () { return array.slice(arguments).reduce(function (a, b) { return a + b; }); } parameters callee : function function to invoke. params : array parameters to be passed into callee. self : mixed object to be passed as the this context to callee. returns mixed : returns the return value of callee. partial(fn, arguments...) takes a function and bind values to one or more arguments, returning a new function of smaller arity. let { partial } = require("sdk/lang/functional"); let add = function add (x, y) { return x + y; } let addone = partial(add, 1); addone(5); // 6 addone(10); // 11 partial(add, addone(20))(2); // 23 parameters fn : function function on which partial appli...
...And 5 more matches
jpm - Archive of obsolete content
an id field is present in package.json, jpm prepends "@" to name and use the result as the id field in the add-on's install manifest. version description entry point (which maps to "main" in package.json) author engines (supported applications) license most of these fields have a default, which is shown in brackets after the question. if you just press enter, your add-on gets the default value. once you've supplied a value or accepted the default for these properties, you'll be shown the complete contents of "package.json" and asked to accept it. then jpm creates a skeleton add-on, as a starting point for your add-on development, with the following file structure: my-addon index.js package.json test test-index.js jpm run this command runs a n...
...guments, or arguments containing spaces, quote them: jpm run --binary-args '-url mzl.la -jsconsole' --debug run the add-on debugger attached to the add-on. -o --overload path rather than use the sdk modules built into firefox, use the modules found at path. if -o is specified and path is omitted, jpm looks for the jetpack_root environment variable and use its value as the path. see overloading the built-in modules for more information. -p --profile= profile by default, jpm uses a clean temporary firefox profile each time you call jpm run. use the --profile option to instruct jpm to launch firefox with an existing profile. the profile value may be a profile name or the path to the profile. see using profiles for more infor...
...m test --filter base64:btoa the above command only runs tests in files whose names contain "base64", and in those files only runs tests whose names contain "btoa". -o --overload path rather than use the sdk modules built into firefox, use the modules found at path. if -o is specified and path is omitted, jpm will look for the jetpack_root environment variable and use its value as the path. see overloading the built-in modules for more information. -p --profile profile by default, jpm uses a clean temporary firefox profile each time you call jpm run. use the --profile option to instruct jpm to launch firefox with an existing profile. the profile value may be a profile name or the path to the profile. see using profiles for more inform...
...And 5 more matches
Interaction between privileged and non-privileged pages - Archive of obsolete content
de which listens for a custom dom event. here we call the event myextensionevent. var myextension = { mylistener: function(evt) { alert("received from web page: " + evt.target.getattribute("attribute1") + "/" + evt.target.getattribute("attribute2")); } } document.addeventlistener("myextensionevent", function(e) { myextension.mylistener(e); }, false, true); // the last value is a mozilla-specific value to indicate untrusted content is allowed to trigger the event. the data from the web page (unprivileged code) will be the values of attribute1 and attribute2. to trigger the alert() in the listener and pass the data from the web page, write code such as this in the web page: var element = document.createelement("myextensiondataelement"); element.setattribute("attrib...
...extensiondataelement"); element.setattribute("attribute1", "foobar"); element.setattribute("attribute2", "hello world"); document.documentelement.appendchild(element); var evt = document.createevent("events"); evt.initevent("myextensionevent", true, false); element.dispatchevent(evt); this code creates an arbitrary element -- <myextensiondataelement/> -- and inserts it into the web page's dom. values are set for two arbitrary attributes on the element. these can also be named anything you like, but we've chosen attribute1 and attribute2. finally, the code creates and dispatches a custom event named myextensionevent -- similar to the standard dom click event you catch with onclick handlers. the event bubbles up from the web page and reaches the extension (privileged code) where your listener ...
...tes on the element. these can also be named anything you like, but we've chosen attribute1 and attribute2. finally, the code creates and dispatches a custom event named myextensionevent -- similar to the standard dom click event you catch with onclick handlers. the event bubbles up from the web page and reaches the extension (privileged code) where your listener catches it and reads the attribute values from the dom element where the event originated. (to better ensure others do not also implement the same event with a different meaning, one might either attach a namespace to <myextensiondataelement/> and check on the event handler for the correct namespaceuri property, or as per the dom specification, use initevent() with an event name that is itself namespaced (xml name characters only): "i...
...And 5 more matches
Custom XUL Elements with XBL - Archive of obsolete content
it makes sense to keep them together. as for the css file, it's usually good to have a single file declaring all bindings in your extension. content under the content tag you define the xul content that will be displayed for your element. ...
... file, it's usually good to have a single file declaring all bindings in your extension. content under the content tag you define the xul content that will be displayed for your element. <content> <xul:hbox> <xul:image class="xulshoolhello-person-image" xbl:inherits="src=image" /> <xul:vbox flex="1"> <xul:label xbl:inherits="value=name" /> <xul:description xbl:inherits="value=greeting" /> </xul:vbox> <xul:vbox> <xul:button label="&xulshoolhello.remove.label;" accesskey="&xulshoolhello.remove.accesskey;" oncommand="document.getbindingparent(this).remove(event);" /> </xul:vbox> </xul:hbox> </content> our element is very simple, displaying an image, a couple of text lines and a button. here are a couple of important things to notice...
...very simple, displaying an image, a couple of text lines and a button. here are a couple of important things to notice: the "xul:" namespace must be used for all xul tags you have in your content. the xbl:inherits attribute lets your inner xul use the attributes that are set on the node. so, if you have this: <xshelloperson name="pete" greeting="good morning" image="" />, then those attribute values are "inherited" to the content nodes that have this special attribute. the value attribute of the xul:label element would be "pete". the oncommand attribute of the button has some code you've probably never seen before: document.getbindingparent(this). this code gets the dom object that corresponds to the xshelloperson tag, allowing you access to its methods and properties. in this case we're c...
...And 5 more matches
Adding preferences to an extension - Archive of obsolete content
ll and reinstall your extension to enable the preferences button for your extension in the add-ons list. establish the defaults in order to set a default preference for the stock to monitor, we need to add a new folder to our extension's package, called "defaults", which in turn contains another folder called "preferences". inside that, we create a file, defaults.js, that describes the default value of our preferences: pref("extensions.stockwatcher2.symbol", "goog"); the standard for third-party preferences, such as those used in extensions, is to use the string "extensions", a period, the name of the extension, another period, then a preference name, as seen in the example above. the javascript code in order to monitor changes to our preferences, we need to install an observer using t...
... "nspref:changed") { return; } switch(data) { case "symbol": this.tickersymbol = this.prefs.getcharpref("symbol").touppercase(); this.refreshinformation(); break; } }, the topic parameter indicates what type of event occurred. ...
... once we've gotten the updated preference, we call refreshinformation() to immediately update the display with the new stock's information. ...
...And 5 more matches
Treehydra Manual - Archive of obsolete content
ee also treehydra.js, gcc_compat.js, gcc_util.js, and gcc_print.js in the treehydra libs directory, which have many ports of gcc macros and other functions for conveniently accessing gimple data in javascript. esp abstract interpretation library treehydra includes a library for creating abstract interpretation analyses based on esp. users only need to define their esp property variables, abstract values, and the flow semantics of gimple statements, and the library will do all of the substate tracking and fixed-point solving. the library is at unstable/esp.js. there is a sample application that checks for double-locking in a simple mutex api in test/esp_lock.js. abstract interpretation is a big topic, which is not yet fully documented here. for now, here is an explanation of some of the termino...
...tements, and the library will do all of the substate tracking and fixed-point solving. the library is at unstable/esp.js. there is a sample application that checks for double-locking in a simple mutex api in test/esp_lock.js. abstract interpretation is a big topic, which is not yet fully documented here. for now, here is an explanation of some of the terminology that is often confusing: concrete value. a value in the programming language being analyzed. e.g., (int) 3. abstract value. a value used in the analysis script that represents a set of concrete values. e.g., nonzero. in esp, these are user-defined. concrete state. a memory state in the programming language being analyzed. in other words, a mapping from program variables to concrete values. abstract state. conceptually, this is an obje...
...te states. in the esp library, these are esp.state objects. bottom. this is a special abstract state the represents the empty set of concrete states. if the state is bottom at a certain program point, that means that program point is unreachable. in esp, this is esp.not_reached. top. this is a special abstract state that represents all possible states. ...
...And 5 more matches
Sorting Results - Archive of obsolete content
his natural sorting will not work, because the sort service assumes that the starting ref resource is the container and the end results are the children. in this case, the natural order of the results will just be the order that the template builder generates the results. for ascending or descending sorts, this doesn't matter, since it will ignore whether results are containers and just sort by a value, alphabetically or numerically depending on the type of data. when using a tree, sorting may be performed on each column of the tree. for instance, if a list of photos was displayed in a two column tree showing the title and description, you could sort by either title or description. the user can change the sort column and direction by clicking the column headers, however, you can programmaticall...
...change to the date column. there are two additional attributes used for sorting, which you may set on a column to specify the initial sort. these attributes are modified when the user changes the sort. the sortdirection attribute may be used to specify the initial sort direction for a column. only one column should have this attribute set, as a tree may only be sorted by one column at a time. the value should be either 'ascending', 'descending' or 'natural'. this last value is the default if the attribute is not specified. the sortactive attribute may be set to true or false and specifies which column the tree is sorted by. only one column should have the sortactive attribute set to true at a time. the tree will change both attributes as necessary automatically when the column headers are click...
... attributes as necessary automatically when the column headers are clicked or the tree is sorted by other means. if you don't want to allow sorting by a certain column, you can leave out the sort attribute. only specify this attribute on columns that you wish to allow the user to sort by. here is a complete example of sorting a tree. the sort attribute should be set to the variable that holds the values to sort by. usually, this would be the same variable that is used to generate the label for the cells in that column, however this is not actually necessary. for instance, in the example the second column sorts by date, but if you were to use a different variable such as ?description, the tree would sort by the value of the description variable for each row. in almost all situations however, you...
...And 5 more matches
Document Object Model - Archive of obsolete content
other. retrieving elements the most common method to retrieve an element in a document is to give the element an id attribute and the use the document's getelementbyid() method. we've added the id attribute to a number of elements in the find file dialog. for example, we could get the state of a check box by using the code below: var state = document.getelementbyid('casecheck').checked; the value casecheck corresponds to the id of the case sensitive checkbox. once we have an indication of whether it is checked or not, we can use the state to perform the search. we could do something similar for the other check box, or any other element that has an id. we'll need to get the text in the input field for example. our find files example it doesn't make sense to have the progress bar and the...
...o that its initially hidden. also, we'll add an id attribute so that we can refer to it in a script to show and hide it. while we're at it, let's also hide the splitter and results tree as we only need to show them after a search is performed. <tree id="results" hidden="true" flex="1"> . . . <splitter id="splitbar" resizeafter="grow" hidden="true"/> <hbox> <progressmeter id="progmeter" value="50%" style="margin: 4px;" hidden="true"/> we've added the hidden attribute and set the value to true. this causes the element to be hidden when it first appears. next, let's add a function that is called when the find button is pressed. we'll put scripts in a separate file findfile.js. in the last section, we added the script element in the xul file. if you haven't done this, do that now,...
...the hidden state so that the element is visible again. finally, let's have an alert box pop up that displays what will be searched for. of course, we wouldn't want this in the final version but we'll add it to reassure us that something would happen. function dofind(){ var meter=document.getelementbyid('progmeter'); meter.hidden = false; var searchtext=document.getelementbyid('find-text').value; alert("searching for \"" + searchtext + "\""); } now, with that alert box in there, we know what should happen when we click the find button. we could add additional code to get the selections from the drop-down boxes too. xul element dom every xul element has a set of attributes, a set of properties and a set of children. the attributes are declared in the source, for example, flex="1...
...And 5 more matches
More Button Features - Archive of obsolete content
art. in general, it can be used on all xul elements. note that you really should put the style declarations in a separate style sheet. positioning the images by default, the image on a button will appear to the left of the text label. there are two attributes that can be used to control this position. the dir attribute controls the direction of the image and text. ...
... the style declarations in a separate style sheet. positioning the images by default, the image on a button will appear to the left of the text label. there are two attributes that can be used to control this position. the dir attribute controls the direction of the image and text. by setting this attribute to the value reverse, the image will be placed on the right side of the text. by using the value normal, or leaving the attribute out entirely, the image will be placed on the left side of the text. the orient attribute can be used to place the image above or below the text. the default value is horizontal which is used to place the image on the left or right. you can also use the value vertical to place the image above or below. in this case, the dir attribute controls the placement above o...
...g the attribute out entirely, the image will be placed on the left side of the text. the orient attribute can be used to place the image above or below the text. the default value is horizontal which is used to place the image on the left or right. you can also use the value vertical to place the image above or below. in this case, the dir attribute controls the placement above or below. the same values are used, where normal means place the image above the text, and reverse means place the image below the text. example 3 : source view <button label="left" image="happy.png"/> <button label="right" image="happy.png" dir="reverse"/> <button label="above" image="happy.png" orient="vertical"/> <button label="below" image="happy.png" orient="vertical" dir="reverse"/> the example here shows all...
...And 5 more matches
XBL Attribute Inheritance - Archive of obsolete content
m with this is that the label would be the same every time the binding was used. in this case, it would be preferable if the attribute could be specified on the searchbox instead. xbl provides an inherits attribute which can be used to inherit attributes from the bound element. it should be placed on the element that should inherit an attribute from the outer element, in this case the button. its value should be set to a comma-separated list of attribute names that are to be inherited. <xul:textbox xbl:inherits="flex"/> <xul:button xbl:inherits="label"/> when the content is generated, the textbox grabs the flex attribute from the searchbox and the button grabs the label attribute from the searchbox. this allows both the flexibility of the textbox and the label of the button to be different for...
...e names that are to be inherited. <xul:textbox xbl:inherits="flex"/> <xul:button xbl:inherits="label"/> when the content is generated, the textbox grabs the flex attribute from the searchbox and the button grabs the label attribute from the searchbox. this allows both the flexibility of the textbox and the label of the button to be different for each use of the binding. in addition, changing the value of the attributes on the searchbox with a script will update the textbox and button also. you can add the inherits attribute to as many elements as you wish, to inherit any number of attributes. note how the inherits attribute has been placed in the xbl namespace, by prefixing it with 'xbl:'. the namespace should be declared somewhere earlier, usually on the bindings element. the next example dem...
...nt. the next example demonstrates this. <bindings xmlns:xbl="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <xbl:binding id="buttonbinding"> <xbl:content> <xul:button label="ok" xbl:inherits="label"/> </xbl:content> </xbl:binding> in this example, the button inherits the label attribute, but this attribute is also given a value directly in the xbl. this technique is used to set the default value if the attribute is not present. this button will inherit its label attribute from the outer element. however, if no label is present, it will be given a default value of ok. there may be times where two generated elements need to inherit from an attribute that has the same name. for example, to create a labeled textbox (a textb...
...And 5 more matches
checkbox - Archive of obsolete content
pe: boolean indicates whether the element is checked or not. use hasattribute() to determine whether this attribute is set instead of getattribute(). for buttons, the type attribute must be set to checkbox or radio for this attribute to have any effect. command type: id set to the id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right sid...
...th the start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. ...
...if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. ...
...And 5 more matches
iframe - Archive of obsolete content
security issues. more information is available in the xul tutorial. ...
...utorial. ...
...rties accessibletype, contentdocument, contentwindow, docshell, webnavigation examples <iframe src="table.php" flex="2" id="browsertable" name="table_frame"/> selecting an url from a menu <menulist oncommand="donav(this);"> <menupopup> <menuitem label="mozilla" value="http://mozilla.org" /> <menuitem label="slashdot" value="http://slashdot.org"/> <menuitem label="sourceforge" value="http://sf.net" /> <menuitem label="freshmeat" value="http://freshmeat.net"/> </menupopup> </menulist> <iframe id="myframe" flex="1"/> <script> function donav(obj) { var url = obj.selecteditem.value; // note the firstchild is the menupopup element document.getelementbyid('myframe').setattribute('src', url); } </script> attributes showcaret type: boolean whether or not to ...
...And 5 more matches
label - Archive of obsolete content
Archive › Mozilla › XUL › label
« xul reference home [ examples | attributes | properties | methods | related ] this element is used to provide a label for a control element. if the user clicks the label, it will move the focus to the associated control, specified with the control attribute. more information is available in the xul tutorial. attributes accesskey, control, crop, disabled, href, value properties accesskey, accessibletype, control, crop, disabled, value style classes header, indent, monospace, plain, small-margin, text-link examples <label value="email address" control="email"/> <textbox id="email"/> attributes accesskey type: character this should be set to a character that is used as a shortcut key. this should be one of the characters that appear...
...: character this should be set to a character that is used as a shortcut key. this should be one of the characters that appears in the label attribute for the element. control type: id this attribute specifies the id of the element with which the label is associated. when the user clicks on the label, the associated element is given focus. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right sid...
...th the start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. ...
...And 5 more matches
treecol - Archive of obsolete content
src, type, width properties accessibletype style classes treecol-image examples this example shows a checkbox in the first column, requires the style below. <tree flex="1" editable="true"> <treecols> <treecol label="active" type="checkbox" editable="true"/> <treecol label="name" flex="1" /> </treecols> <treechildren> <treeitem> <treerow> <treecell value="true"/> <treecell label="alice"/> </treerow> </treeitem> <treeitem> <treerow> <treecell value="false"/> <treecell label="bob"/> </treerow> </treeitem> </treechildren> </tree> to make the checkbox visible on some platforms, the following styles need to be added to the stylesheet (see treecol.type). on firefox 2.x and 3.x, all operating sy...
...should specify a url to an image in your extension or elsewhere. */ list-style-image: url("chrome://global/skin/checkbox/cbox-check.gif"); } for example: create a css file. copy and paste the code above and link the css file to your xul file. reload the page to see the checkbox. if you want, you can also style the tree using css. attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right sid...
...th the start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. ...
...And 5 more matches
-ms-scrollbar-3dlight-color - Archive of obsolete content
the -ms-scrollbar-3dlight-color css property is a microsoft extension specifying the color of the top and left edges of the scroll box and scroll arrows of a scroll bar. initial valuedepends on user agentapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the top and left edges of the scroll box and scroll arrows of the scroll bar. ...
...s toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the top and left edges of the scroll box and scroll arrows of the scroll bar. ...
...as specifiedanimation typediscrete syntax values <color> the color of the top and left edges of the scroll box and scroll arrows of the scroll bar. ...
...And 5 more matches
-ms-scrollbar-arrow-color - Archive of obsolete content
the -ms-scrollbar-arrow-color css property is a microsoft extension that specifies the color of the arrow elements of a scroll arrow. initial valuebuttontextapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the scroll arrows of the scroll bar. ...
...oll arrow. initial valuebuttontextapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the scroll arrows of the scroll bar. ...
... toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the scroll arrows of the scroll bar. ...
...And 5 more matches
-ms-scrollbar-base-color - Archive of obsolete content
the -ms-scrollbar-base-color css property is a microsoft extension that specifies the base color of the main elements of a scroll bar. initial valuedepends on user agentapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the base color of the main elements of a scroll bar. ...
...itial valuedepends on user agentapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the base color of the main elements of a scroll bar. ...
...all elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the base color of the main elements of a scroll bar. ...
...And 5 more matches
-ms-scrollbar-darkshadow-color - Archive of obsolete content
the -ms-scrollbar-darkshadow-color css property is a microsoft extension that specifies the color of a scroll bar's gutter. initial valuethreeddarkshadowapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the scroll bar's gutter. ...
...ll bar's gutter. initial valuethreeddarkshadowapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the scroll bar's gutter. ...
...hadowapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the scroll bar's gutter. ...
...And 5 more matches
-ms-scrollbar-face-color - Archive of obsolete content
the -ms-scrollbar-face-color css property is a microsoft extension that specifies the color of the scroll box and scroll arrows of a scroll bar. initial valuethreedfaceapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the scroll box and scroll arrows. ...
...a scroll bar. initial valuethreedfaceapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the scroll box and scroll arrows. ...
...ies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the scroll box and scroll arrows. ...
...And 5 more matches
-ms-scrollbar-highlight-color - Archive of obsolete content
the -ms-scrollbar-highlight-color css property is a microsoft extension that specifies the color of the slider tray, the top and left edges of the scroll box, and the scroll arrows of a scroll bar. initial valuethreedhighlightapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the slider tray, the top and left edges of the scroll box, and the scroll arrows of a scroll bar. ...
...ritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the slider tray, the top and left edges of the scroll box, and the scroll arrows of a scroll bar. ...
...n typediscrete syntax values <color> the color of the slider tray, the top and left edges of the scroll box, and the scroll arrows of a scroll bar. ...
...And 5 more matches
-ms-scrollbar-shadow-color - Archive of obsolete content
the -ms-scrollbar-shadow-color css property is a microsoft extension that specifies the color of the bottom and right edges of the scroll box and scroll arrows of a scroll bar. initial valuethreeddarkshadowapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the bottom and right edges of the scroll box and scroll arrows of a scroll bar. ...
...toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the bottom and right edges of the scroll box and scroll arrows of a scroll bar. ...
... specifiedanimation typediscrete syntax values <color> the color of the bottom and right edges of the scroll box and scroll arrows of a scroll bar. ...
...And 5 more matches
-ms-scrollbar-track-color - Archive of obsolete content
the -ms-scrollbar-track-color css property is a microsoft extension that specifies the color of the track element of a scrollbar. initial valuescrollbarapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the track element. ...
...track element of a scrollbar. initial valuescrollbarapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the track element. ...
...uescrollbarapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the track element. ...
...And 5 more matches
XForms Custom Controls - Archive of obsolete content
controls into your environment may be just the solution you are looking for. for example, you might want to render images that are held inside an instance document or you would like to show a disabled trigger when its bound node becomes irrelevant rather than having it not display (the current default behavior). every xforms control's presentation has its own xbl binding. in many cases different values provided for the appearance or mediatype attributes will determine which xbl binding will be used for a particular xforms control on the form. as mentioned in the spec, the appearance attribute can be used to influence the look and feel of a control even when all other conditions remain constant. for example, in the mozilla xforms extension we will render a combobox widget when appearance='minim...
...ated according to the rules of xforms, the refresh method will be called by the processor. below is the structure of the interface. as always, please refer directly to the source code to be sure that you are using the latest, up-to-date version: extensions/xforms/nsixformsuiwidget.idl. ...
...t { /** * is called when control should be updated to reflect the value of the bound node. */ void refresh(); /** * is called when focus is advanced to the xforms element. */ boolean focus(); /** * is called when control should be disabled. * this really only applies to the submit element. */ void disable(in boolean disable); /** * is called to get current value of control. */ string getcurrentvalue(); } notes: getcurrentvalue() should return the current value of the control as seen by a user. the current value of a control could differ from the value of the bound node in cases where @incremental='false'. disable() is called by the xforms processor to indicate to a submit element that it needs to disable/enable due to the beginning/ending of the s...
...And 5 more matches
XForms Input Element - Archive of obsolete content
introduction this element is an important and oft-used xforms element to show and change the instance data to which this xforms control is bound (see the spec). attributes ui common appearance - the value of this attribute gives a hint to the xforms processor as to which type of widget(s) to use to represent this control accesskey - used to specify the keyboard shortcut for focusing this control single-node binding special inputmode - not supported for this control incremental - supported. the default value is 'false'. mozilla extensions labelposition - only for boolean types: show the label before or after the checkbox (see below) type restrictions the input element can be bound to a node containing simple content of any data type except xsd:base64binary, xsd:hexbinray or any data ...
...ng widgets for the spcified data types (or types derived from these data types): text field - the default widget when no type is specified or the data is of type xsd:string (xhtml/xul) checkbox - used for xsd:boolean instance data. (xhtml/xul) datepicker - used to represent data of type xsd:date (xhtml/xul) calendar - used to represent data of type xsd:date when appearance attribute also has the value 'full' (xhtml/xul) month list - used to represent data of type xsd:gmonth (xhtml only) days list - used to represent data of type xsd:gday (xhtml only) number field - used to represent data of numeric type (fx 3.0 only, xul only) more detail about each of these widgets follows below. text field displaying a text field is the default presentation. xforms inputs are most often used when a form aut...
...es incremental - if "true" or this attribute is omitted from this element, then the instance node will be updated when the user checks or un-checks the checkbox. if "false" then the instance node will be updated when the checkbox loses the focus. labelposition - a mozilla xforms extension in the namespace http://www.mozilla.org/projects/xfor...009/extensions. this attribute is optional, possible values are before and after. the default value if omitted is after. it controls the display of the label relative to the checkbox. before shows the label first, then the checkbox, after shows the checkbox, than the label. labelposition was introduced with mozilla xforms 0.8.8. before that, the default behavior was to display the label first, then the checkbox. since the introduction of labelposition, t...
...And 5 more matches
Parsing microformats in JavaScript - Archive of obsolete content
retrieves a date from a microformat node. after getting the text, it is normalized into an iso 8601 date. normalizeddate = microformats.parser.datetimegetter(propnode, parentnode); parameters propnode the dom node to check. parentnode the property's parent node. if it is a subproperty, this is the parent property node. otherwise this is the microformat node. return value a string containing the normalized date. defaultgetter() uses the microformat patterns to decide what the correct text for a given microformat property is. this includes looking at thing such as abbr, img and alt, area and alt, and value excerpting. propertyvalue = microformats.parser.defaultgetter(propnode, parentnode, datatype); parameters propnode the dom node to check. ...
...er.defaultgetter(propnode, parentnode, datatype); parameters propnode the dom node to check. parentnode the property's parent node. if it is a subproperty, this is the parent property node. otherwise this is the microformat node. datatype "html" if the search should be done using innerhtml(), or "text" to use innertext(). the default is "text". return value a string containing the property's value. emailgetter() specifically retrieves an email address from a microformat node. this removes the subject if one is specified, as well as the mailto: prefix. email = microformats.parser.emailgetter(propnode, parentnode); parameters propnode the dom node to check. parentnode the property's parent node. if it is a subproperty, th...
...an email address from a microformat node. this removes the subject if one is specified, as well as the mailto: prefix. email = microformats.parser.emailgetter(propnode, parentnode); parameters propnode the dom node to check. parentnode the property's parent node. if it is a subproperty, this is the parent property node. otherwise this is the microformat node. ...
...And 5 more matches
Plug-in Development Overview - Gecko Plugin API Reference
st be used. in this case to ensure the plug-in file will be loaded, it should have a name in the form of "np*.dll". also, the windows version information for the plug-in dll will be used to determines the mime types, file extensions, file open template, plug-in name, and description. ...
... and description. for this the version stamp of the embedded resource of the plug-in dll should contain the following set of string/value pairs: mimetype: for mime types fileextents: for file extensions fileopenname: for file open template productname: for plug-in name filedescription: for description language: for language in use in the mime types and file extensions strings, multiple values are separated by the "|" character, for example: video/quicktime|audio/aiff|image/jpeg the version stamp will be loaded only if it has been created with the language set to "us english" and the character set to "windows multilingual" in your development environment. the resource code for this language and character set combination is 040904e4. unix on unix, plug-ins are found according ...
...iption entry point. this exported c function should return a string containing the type, extension list, and type description separated by colons. each mime types should be separated by semicolons. for example: image/xbm:xbm:x bitmap or for 2 mime types: image/xbm:xbm:x bitmap;image/png:png:portable network graphics. this information will then appear in the navigator.mimetypes dom object. npp_getvalue is called after the plug-in is initialized to get the scripting interface while np_getvalue is called during initialization to retrieve the plug-in's name and description, which will appear in the navigator.plugins dom object which is used to populate about:plugins. caution: gecko caches the values returned by these functions and will only call it if the plug-in's timestamp has changed. see bug...
...And 5 more matches
Primitive - MDN Web Docs Glossary: Definitions of Web-related terms
in javascript, a primitive (primitive value, primitive data type) is data that is not an object and has no methods. there are 6 primitive data types: string, number, bigint, boolean, undefined, and symbol. there also is null, which is seemingly primitive, but indeed is a special case for every object: and any structured type is derived from null by the prototype chain. most of the time, a primitive value is represented directly at the lowest level of the language implementation. all primitives are immutable, i.e., they cannot be altered. it is important not to confuse a primitive itself with a variable assigned a primitive value. the variable may be reassigned a new value, but the existing value can not be changed in the ways that objects, arrays, and functions can be altered. exampl...
...of the language implementation. all primitives are immutable, i.e., they cannot be altered. it is important not to confuse a primitive itself with a variable assigned a primitive value. the variable may be reassigned a new value, but the existing value can not be changed in the ways that objects, arrays, and functions can be altered. example this example will help you understand that primitive values are immutable. javascript // using a string method doesn't mutate the string var bar = "baz"; console.log(bar); // baz bar.touppercase(); console.log(bar); // baz // using an array method mutates the array var foo = []; console.log(foo); // [] foo.push("plugh"); console.log(foo); // ["plugh"] // assignment gives the primitive a new (not...
...ble. ...
...And 5 more matches
Grids - Learn web development
wnload and open the starting point file in your text editor and browser (you can also see it live here). you will see an example with a container, which has some child items. by default these display in normal flow so the boxes display one below the other. we will be working with this file for the first part of this lesson, making changes to see how grid behaves. to define a grid we use the grid value of the display property. as with flexbox, this switches on grid layout, and all of the direct children of the container become grid items. add this to the css inside 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...
... grid rows and columns. 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 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 dis...
...iner { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-gap: 20px; gap: 20px; } repeating track listings you can repeat all, or a section of, your track listing using repeat notation. change your track listing to the following: .container { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 20px; } you will now get 3 1fr tracks just as before. the first value passed to the repeat function is how many times you want the listing to repeat, while the second value is a track listing, which may be one or more tracks that you want to repeat. the implicit and explicit grid we have only specified column tracks so far, and yet rows are being created to hold our content. this is an example of the explicit versus the implicit grid. the explicit grid is the one...
...And 5 more matches
How to structure a web form - Learn web development
es will use the <legend> element as if it is a part of the label of each control inside the corresponding <fieldset> element. for example, some screen readers such as jaws and nvda will speak the legend's content before speaking the label of each control. ...
...nt. for example, some screen readers such as jaws and nvda will speak the legend's content before speaking the label of each control. here is a little example: <form> <fieldset> <legend>fruit juice size</legend> <p> <input type="radio" name="size" id="size_1" value="small"> <label for="size_1">small</label> </p> <p> <input type="radio" name="size" id="size_2" value="medium"> <label for="size_2">medium</label> </p> <p> <input type="radio" name="size" id="size_3" value="large"> <label for="size_3">large</label> </p> </fieldset> </form> note: you can find this example in fieldset-legend.html (see it live also). when reading the above form, a screen reader will speak "fruit juice size small" for the first widget, "fruit juice...
...o focus it, but it is especially useful for radio buttons and checkboxes — the hit area of such a control can be very small, so it is useful to make it as easy to activate as possible. for example, clicking on the "i like cherry" label text in the example below will toggle the selected state of the taste_cherry checkbox: <form> <p> <input type="checkbox" id="taste_1" name="taste_cherry" value="cherry"> <label for="taste_1">i like cherry</label> </p> <p> <input type="checkbox" id="taste_2" name="taste_banana" value="banana"> <label for="taste_2">i like banana</label> </p> </form> note: you can find this example in checkbox-label.html (see it live also). multiple labels strictly speaking, you can put multiple labels on a single widget, but this is not a good idea ...
...And 5 more matches
Inheritance in JavaScript - Learn web development
r, interests, subject) { person.call(this, first, last, age, gender, interests); this.subject = subject; } this looks similar to the person constructor in many ways, but there is something strange here that we've not seen before — the call() function. this function basically allows you to call a function defined somewhere else, but in the current context. the first parameter specifies the value of this that you want to use when running the function, and the other parameters are those that should be passed to the function when it is invoked. we want the teacher() constructor to take the same parameters as the person() constructor it is inheriting from, so we specify them all as parameters in the call() invocation. the last line inside the constructor simply defines the new subject prop...
...this.age = age; this.gender = gender; this.interests = interests; this.subject = subject; } but this is just redefining the properties anew, not inheriting them from person(), so it defeats the point of what we are trying to do. it also takes more lines of code. inheriting from a constructor with no parameters note that if the constructor you are inheriting from doesn't take its property values from parameters, you don't need to specify them as additional arguments in call(). so, for example, if you had something really simple like this: function brick() { this.width = 10; this.height = 20; } you could inherit the width and height properties by doing this (as well as the other steps described below, of course): function blueglassbrick() { brick.call(this); this.opacity = 0.
...ts of person.prototype.greeting and teacher.prototype.greeting. we need to get teacher() to inherit the methods defined on person()'s prototype. so how do we do that? add the following line below your previous addition: teacher.prototype = object.create(person.prototype); here our friend create() comes to the rescue again. in this case we are using it to create a new object and make it the value of teacher.prototype. the new object has person.prototype as its prototype and will therefore inherit, if and when needed, all the methods available on person.prototype. we need to do one more thing before we move on. after adding the last line, teacher.prototype's constructor property is now equal to person(), because we just set teacher.prototype to reference an object that inherits its proper...
...And 5 more matches
Setting up your own test automation environment - Learn web development
to find an element by css — the by.css method allows you to select an element using a css selector enter the following at the bottom of your quick_test.js code now: const button = driver.findelement(by.css('button:nth-of-type(1)')); testing your element there are many ways to interact with your web documents and elements on them. you can see useful common examples starting at getting text values on the webdriver docs. if we wanted to get the text inside our button, we could do this: button.gettext().then(function(text) { console.log('button text is \'' + text + '\''); }); add this to quick_test.js now. making sure you are inside your project directory, try running the test: node quick_test.js you should see the button's text label reported inside the console. let's do something...
...try to interact with any of its elements, otherwise the test will likely fail. in our google_test.js test for example, we included this block: driver.sleep(2000).then(function() { driver.gettitle().then(function(title) { if(title === 'webdriver - google search') { console.log('test passed'); } else { console.log('test failed'); } }); }); the sleep() method accepts a value that specifies the time to wait in milliseconds — the method returns a promise that resolves at the end of that time, at which point the code inside the then() executes. in this case we get the title of the current page with the gettitle() method, then return a pass or fail message depending on what its value is. we could add a sleep() method to our quick_test.js test too — try wrapping your...
...ode inside the then() executes. in this case we get the title of the current page with the gettitle() method, then return a pass or fail message depending on what its value is. we could add a sleep() method to our quick_test.js test too — try wrapping your last line of code in a block like this: driver.sleep(2000).then(function() { input.sendkeys('filling in my form'); input.getattribute("value").then(function(value) { if(value !== '') { console.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 calle...
...And 5 more matches
IME handling guide
ate and dispatch widgetcompositionevent properly. this is also used by mozilla::textinputprocessor which can emulates (or implements) ime with chrome script. so, native ime handlers using this class means that the dispatching part is also tested by automated tests. mozilla::widgetcompositionevent internally, widgetcompositionevent represents native ime behavior. its message is one of following values: ecompositionstart this is dispatched at starting a composition. this represents a dom compositionstart event. the mdata value is a selected string at dispatching the dom event and it's automatically set by textcomposition. ecompositionupdate this is dispatched by textcomposition when an ecompoitionchange will change the composition string. this represents a dom compositionupdate event. eco...
...nally only. this is dispatched at modifying a composition string, committing a composition, changing caret position and/or changing ranges of clauses. this represents a dom text event which is not in any standards. mranges should not be empty only with this message. ecompositioncommitasis this is used internally only. this is dispatched when a composition is committed with the string. the mdata value should be always be an empty string. this causes a dom text event without clause information and a dom compositionend event. ecompositioncommit this is used internally only. this is dispatched when a composition is committed with specific string. the mdata value is the commit string. this causes a dom text event without clause information and a dom compositionend event. table of event messag...
...te process of "menu keyboard listener installed". then, tabchild calls imestatemanager::oninstalledmenukeyboardlistener() in the remote process. style of each clause the style of each ime selection is managed by lookandfeel class per platform. therefore, it can be overridden by prefs. background color, foreground color (text color) and underline color can be specified with following prefs. the values must be string of "#rrggbb" format. ui.imerawinputbackground ui.imerawinputforeground ui.imerawinputunderline ui.imeselectedrawtextbackground ui.imeselectedrawtextforeground ui.imeselectedrawtextunderline ui.imeconvertedtextbackground ui.imeconvertedtextforeground ui.imeconvertedtextunderline ui.imeselectedconvertedtextbackground ui.imeselectedconvertedtextforeground ui.imeselected...
...And 5 more matches
JNI.jsm
cdata getforthread(); cdata loadclass(cdata ajenv, string aclassfullyqualifiedname, [optional] object adeclares); cdata newstring(cdata ajenv, string astr); string readstring(cdata ajenv, cdata ajavastring); void unloadclasses(); methods getforthread() blah blah cdata getforthread(); parameters this function does not take any arguments. return value blah blah loadclass() blah blah cdata loadclass( ajenv, afullyqualifiedname, [optional] object adeclares ); parameters ajenv the return value of getforthread(). afullyqualifiedname a sig of a typed array or the name of the class that would be used in a signature, but without the surrounding l and ;. if it is the sig of a typed array such as '[i' then adeclares must not be decla...
...o/geckoappshell" and for geckointerface we would use "org/mozilla/gecko/geckoappshell$geckointerface". adeclares optional if this is omitted, then afullyqualifiedname must be an array type. if this is provided, then afullyqualifiedname must be a class name. a required object that contains up to five fields of key names: constructors, fields, static_fields, methods, and static_methods. return value blah blah newstring() blah blah cdata newstring( ajenv, astr ); parameters ajenv the return value of getforthread(). astr a javascript string, use any encoding desired. return value blah blah readstring() blah blah string readstring( ajenv, ajavastring ); parameters ajenv the return value of getforthread(). ajavastring a cdata object that is a java string. return v...
...r a javascript string, use any encoding desired. return value blah blah readstring() blah blah string readstring( ajenv, ajavastring ); parameters ajenv the return value of getforthread(). ajavastring a cdata object that is a java string. return value a javascript string. unloadclasses() blah blah void unloadclasses(); parameters this function takes no arguments. return value this function has no return value, if you try to store the return value in a variable, it will be undefined. ...
...And 5 more matches
PKCS11 Implement
hat can do des encryption. the nss creates certificates as token objects. it loads the token object only if the private key for that certificate exists on the token and was generated by nss. all the fields defined by pkcs #11 for certificates are set. the nss also sets the cka_id and cka_label attributes for the token. ...
...reates certificates as token objects. it loads the token object only if the private key for that certificate exists on the token and was generated by nss. all the fields defined by pkcs #11 for certificates are set. the nss also sets the cka_id and cka_label attributes for the token. currently, the cka_id attribute is set to the modulus for rsa or to the public value on dsa. the nss may hash this value in the future. in either case, nss does set the cka_id attribute and expects it to remain the same. if a certificate is loaded, the value of the certificate's cka_id attribute must match the value of the cka_id attribute for the corresponding private key, and the value of the certificate's cka_label attribute must also match the value of the cka_label attribute for the private key. for private ke...
...eys that don't include certificates, nss doesn't set the cka_label attribute, or sets it to null, until it receives the certificate. c_copyobject the nss rarely calls c_copyobject but may sometimes do so for non-token private keys. c_destroyobject the nss calls c_destroyobject to destroy certificates and keys on tokens. c_getobjectsize the nss never calls c_getobjectsize. c_getattributevalue the nss calls c_getattributevalue to get the value of attributes for both single objects and multiple objects. this is useful for extracting public keys, nonsecret bulk keys, and so on. c_setattributevalue the nss uses c_setattributevalue to change labels on private keys. c_findobjectsinit, c_findobjects, c_findfinal the nss calls these functions frequently to look up objects by cka_id or ...
...And 5 more matches
NSS tools : modutil
a complex string ...
... absolutepath{/usr/local/netscape/lib/fort.so} filepermissions{555} } xplat/instr.html { relativepath{%root%/docs/inst.html} absolutepath{/usr/local/netscape/docs/inst.html} filepermissions{555} } } } irix:6.2:mips { equivalentplatform { sunos:5.5.1:sparc } } } script grammar the script is basic java, allowing lists, key-value pairs, strings, and combinations of all of them. --> valuelist valuelist --> value valuelist <null> value ---> key_value_pair string key_value_pair --> key { valuelist } key --> string string --> simple_string "complex_string" simple_string --> [^ \t\n\""{""}"]+ complex_string --> ([^\"\\\r\n]|(\\\")|(\\\\))+ quotes and backslashes must be escaped with a backslash. a complex string must not include newlines or carriage returns.outside of comp...
...f platforms that are forward compatible. if the current platform cannot be found in the list of supported platforms, then the forwardcompatible list is checked for any platforms that have the same os and architecture in an earlier version. if one is found, its attributes are used for the current platform. platforms (required) gives a list of platforms. each entry in the list is itself a key-value pair: the key is the name of the platform and the value list contains various attributes of the platform. the platform string is in the format system name:os release:architecture. the installer obtains these values from nspr. os release is an empty string on non-unix operating systems. nspr supports these platforms: o aix (rs6000) o bsdi (x86) o freebsd (x86) o hpux (hppa1.1) o irix (mip...
...And 5 more matches
Hacking Tips
monkey unwinder is disabled by default, to enable it type: enable unwinder .* spidermonkey (gdb) b js::math_cos (gdb) run […] #0 js::math_cos (cx=0x14f2640, argc=1, vp=0x7fffffff6a88) at js/src/jsmath.cpp:338 338 callargs args = callargsfromvp(argc, vp); (gdb) enable unwinder .* spidermonkey (gdb) backtrace 10 #0 0x0000000000f89979 in js::math_cos(jscontext*, unsigned int, js::value*) (cx=0x14f2640, argc=1, vp=0x7fffffff6a88) at js/src/jsmath.cpp:338 #1 0x0000000000ca9c6e in js::calljsnative(jscontext*, bool (*)(jscontext*, unsigned int, js::value*), js::callargs const&) (cx=0x14f2640, native=0xf89960 , args=...) at js/src/jscntxtinlines.h:235 #2 0x0000000000c87625 in js::invoke(jscontext*, js::callargs const&, js::maybeconstruct) (cx=0x14f2640, args=..., construct=js::no_...
... js::callargs const&) (cx=0x14f2640, native=0xf89960 , args=...) at js/src/jscntxtinlines.h:235 #2 0x0000000000c87625 in js::invoke(jscontext*, js::callargs const&, js::maybeconstruct) (cx=0x14f2640, args=..., construct=js::no_construct) at js/src/vm/interpreter.cpp:476 #3 0x000000000069bdcf in js::jit::docallfallback(jscontext*, js::jit::baselineframe*, js::jit::iccall_fallback*, uint32_t, js::value*, js::mutablehandlevalue) (cx=0x14f2640, frame=0x7fffffff6ad8, stub_=0x1798838, argc=1, vp=0x7fffffff6a88, res=jsval_void) at js/src/jit/baselineic.cpp:6113 #4 0x00007ffff7f41395 in <<jitframe_exit>> () #5 0x00007ffff7f42223 in <<jitframe_baselinestub>> () #6 0x00007ffff7f4423d in <<jitframe_baselinejs>> () #7 0x00007ffff7f4222e in <<jitframe_baselinestub>> () #8 0x00007ffff7f4326a in <<jitf...
...ey frame. (gdb) x /64a $sp […] 0x7fffffff9838: 0x7ffff7fad2da 0x141 0x7fffffff9848: 0x7fffef134d40 0x2 […] (gdb) p (*(jsfunction**) 0x7fffffff9848)->u.i.script_->lineno $1 = 1 (gdb) p (*(jsfunction**) 0x7fffffff9848)->u.i.script_->filename $2 = 0xff92d1 "typein" the stack is order as defined in js/src/ion/ionframes-x86-shared.h, it is composed of the return address, a descriptor (a small value), the jsfunction (if it is even) or a jsscript (if the it is odd, remove it to dereference the pointer) and the frame ends with the number of actual arguments (a small value too). if you want to know at which lir the code is failing at, the js::ion::codegenerator::generatebody function can be intrumented to dump the lir id before each instruction. for (; iter != current->end(); iter++) { ion...
...And 5 more matches
How to embed the JavaScript engine
ious stack objects (jsautorequest, rootedobject), so they all go // out of scope before we js_destroycontext. ...
...orequest, rootedobject), so they all go // out of scope before we js_destroycontext. ...
...orequest, rootedobject), so they all go // out of scope before we js_destroycontext. ...
...And 5 more matches
Tracing JIT
cing jit follows: generic low level component: nanojit/* the files in the nanojit directory define the nanojit component. nanojit/lir.* the nanojit/lir.cpp and nanojit/lir.h files define the intermediate representation lir, which is used as input to nanojit. lir is a conventional three-address, linear ssa code. a single instruction of lir is called a lins, short for "lir instruction". lins values are depicted in blue in the schematic diagram. in contrast, a single native instruction is called a nins, and is depicted in red in the schematic diagram. the recorder in jstracer inserts lins values into a lir buffer held in a page, itself contained within a logical fragment, and the nanojit compilation pipeline and assembler transform the lins values into nins values. nanojit/fragmento.* th...
...to owns its associated fragments. a fragment represents a single linear code sequence, typically terminating in a jump to another fragment or back to the beginning of the fragment. a fragment's code is stored in a set of associated pages and guardrecords allocated from the fragment's owning fragmento. a fragment initially holds no pages. as the compilation pipeline inserts lir instructions (lins values) into the fragment, it allocates pages to store the lir code. later, when the fragment is assembled, it will allocate pages for the native code (nins values) produced by the assembler. when the fragment is destroyed, it returns its pages to the fragmento for reuse. nanojit/assembler.* the nanojit/assembler.cpp and nanojit/assembler.h files define the class assembler, which transforms lins valu...
...in other words, an assembler transforms lir code into native code. an assembler is also able to modify existing fragments of native code, by rewriting native jump instructions to jump to new locations. ...
...And 5 more matches
JS::Evaluate
this article covers features introduced in spidermonkey 17 compile and execute a script. ...
... 17 compile and execute a script. ...
... 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 spidermonkey 17 bool j...
...And 5 more matches
JSPropertyOp
jspropertyop and jsstrictpropertyop are the type of property getter and setter callbacks in the jsapi. they are also the types of the jsclass.addproperty, getproperty, and setproperty callbacks, which are called during object property accesses. syntax typedef bool (* jspropertyop)(jscontext *cx, js::handleobject obj, js::handleid id, js::mutablehandlevalue vp); typedef bool (* jsstrictpropertyop)(jscontext *cx, js::handleobject obj, js::handleid id, bool strict, js::mutablehandlevalue vp); // added in spidermonkey 1.9.3 name type description cx jscontext * the context in which the property access is taking place. provides request. in js_threadsafe builds, the javascript engine calls this callback only from ...
... obj js::handleobject the object whose properties are being accessed. id js::handleid the name or index of the property being accessed. this is either a string (unicode property identifier) or an integer (element index). strict bool (jsstrictpropertyop only) if strict is true, treating the assignment as strict mode code. vp js::mutablehandlevalue in/out parameter. points to a js::value variable. the meaning of this variable is different for each of the hooks; see below. description jspropertyop and jsstrictpropertyop callbacks are hooks that applications may install to be called at some point during property access. a jspropertyop may be installed on an individual property as a getter or setter; or it may be installed on a jscl...
...propagated to the caller. otherwise the callback must return true, and the property operation proceeds. getters and setters when a jsapi application creates a property on an object (for example, using js_defineproperty or js_defineproperties) it can specify getter and setter callbacks for the new property. getters. ...
...And 5 more matches
JS_ConvertArguments
obsolete since jsapi 38this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. converts a series of js values, passed in an argument array, to their corresponding js types. syntax bool js_convertarguments(jscontext *cx, const js::callargs &args, const char *format, ...); // added in spidermonkey 31 bool js_convertarguments(jscontext *cx, unsigned argc, jsval *argv, const char *format, ...); // obsolete since jsapi 30 name type description cx jscontext * the context in which to perform any necessary conversions. cx also affects the interpretation of format, if js_addargumentformatter has been called. r...
...olete since jsapi 30 this must be an argv pointer created by the js engine and passed to a jsnative or jsfastnative callback, not an array created by application code. in certain error cases, js_convertarguments calls js_argv_callee(argv), which accesses memory outside the range [argv .. argv+argc). js_convertarguments may modify argv in place by replacing an argument with the converted value. (the purpose is to ensure gc safety.) format const char * null-terminated string describing the types of the out parameters and how to convert the values in argv. ... void * out parameters. pointers to variables into which to store the converted values. there must be one pointer for each parameter described in format. variables for optional parameters ...
...al parameters must already be initialized, because if an optional parameter is not in argv, js_convertarguments does not modify the corresponding variable. the variables do not need to be rooted. ...
...And 5 more matches
JS_DefineElement
creates a numeric property on a specified object. ...
... creates a numeric property on a specified object. ...
... specified object. ...
...And 5 more matches
JS_GetProperty
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. ...
...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. ...
...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. ...
...And 5 more matches
JS_LookupProperty
obsolete since jsapi 37this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. determine if a specified property exists. ...
...aged since it could be removed at any time. try to avoid using it. determine if a specified property exists. ...
...property(jscontext *cx, js::handleobject obj, const char *name, js::mutablehandlevalue vp); bool js_lookupucproperty(jscontext *cx, js::handleobject obj, const char16_t *name, size_t namelen, js::mutablehandlevalue vp); bool js_lookuppropertybyid(jscontext *cx, js::handleobject obj, js::handleid id, js::mutablehandlevalue vp); // added in spidermonkey 1.8.1 bool js_lookupelement(jscontext *cx, js::handleobject obj, uint32_t index, js::mutablehandlevalue vp); // ---- obsolete since spidermonkey 31 ---- bool js_lookuppropertywithflags(jscontext *cx, js::handleobject obj, const char *name, unsigned flags, js::mutablehandlevalue vp); bool js_lookuppropertywithflagsbyid(j...
...And 5 more matches
SpiderMonkey 38
e jit is simply disabled; javascript code runs in an interpreter, as in previous versions. it's the same language, just not as fast. migrating to spidermonkey 38 .... xxx will need updating for actual new gc stuff at time! a major change to spidermonkey in 38 is that its apis support a moving garbage collector. this entailed changing the vast majority of the jsapi from raw types, such as js::value or js::value*, to js::handle and js::mutablehandle template types that encapsulate access to the provided value/string/object or its location. the js::handle<js::value> and js::mutablehandle<js::value> classes have been specialized to implement the same interface as js::value, for simplicity and to ease migration pain. changes to introduce handles to the jsapi are not individually documented, b...
... language features javascript 38 includes significant updates to language features, yo. new c++ apis jsapi is now a c++-only api. please note that spidermonkey reserves the js:: namespace for itself (and the js:: namespace for internal use). ...
... js::identifystandardconstructor (bug 976148) js::iscallable (bug 1065811) js::isconstructor (bug 1065811) js::mutablehandlesymbol (bug 645416) js::ordinarytoprimitive (bug 1103152) js::propertyspecnameequalsid (bug 1082672) js::propertyspecnameissymbol (bug 1082672) js::propertyspecnametopermanentid (bug 1082672) js::protokeytoid (bug 987669) js::rootedsymbol (bug 645416) js::truehandlevalue (bug 959787) jsconstintegerspec (bug 1066020) jsid_is_symbol (bug 645416) jsid_to_symbol (bug 645416) jsprop_define_late (bug 825199) jsprop_ignore_enumerate (bug 1037770) jsprop_ignore_permanent (bug 1037770) jsprop_ignore_readonly (bug 1037770) jsprop_ignore_value (bug 1037770) jsprop_propop_accessors (bug 1088002) jsprop_redefine_nonconfigurable (bug 1101123) js_addfinalizecallback ...
...And 5 more matches
Secure Development Guidelines
, escaping ' would suffice sql injection occurs when un-trusted input is mixed with a sql string sql is a language used to interact with databases code injection attack that is similar to xss but targeted at sql rather than html and javascript if input is mixed with sql, it could itself become an sql instruction and be used to: query data from the database (passwords) insert value into the database (a user account) change application logic based on results returned by the database sql injection: example snprintf(str, sizeof(str), "select * from account where name ='%s'", name); sqlite3_exec(db, str, null, null, null); sql injection: prevention use parameterized queries insert a marker for every piece of dynamic content so data does not get mixed ...
... sqlite3_stmt *stmt; char *str = "select * from account where name='?'"; sqlite3_prepare_v2(db, str, strlen(str), &stmt, null); sqlite3_bind_text(stmt, 1, name, strlen(name), sqlite_transient); sqlite3_step(stmt); sqlite3_finalize(p_stmt); writing secure code: arithmetic issues integer overflows/underflows overflows occur when an arithmetic operation attempts to create a numeric value that is larger than can be represented within the available storage space max + 1 will be 0 and 0 – 1 will be max! bits maximum value that can be represented data type 8 28-1 255 char 16 216-1 65535 short 32 232-1 4294967295 int 64 264-1 18446744073709551615 long long integer overflows/underflows ...
...ize your variables! ...
...And 5 more matches
extIPreferenceBranch
interface are relative to the root branch. extipreferencebranch is defined in toolkit/components/exthelper/extiapplication.idl. implemented via xpcom service for extiapplication: see the instructions on the fuel (firefox), steel (thunderbird) and smile (seamonkey) pages. method overview boolean has(in astring aname) extipreference get(in astring aname) nsivariant getvalue(in astring aname, in nsivariant adefaultvalue) void setvalue(in astring aname, in nsivariant avalue) void reset() attributes attribute type description root readonly attribute astring the name of the branch root. all readonly attribute nsivariant array of extipreference listing all preferences in this branch. events ...
... the name of the branch root. all readonly attribute nsivariant array of extipreference listing all preferences in this branch. events readonly attribute extievents the events object for the preferences supports: "change" methods has() check to see if a preference exists. ...
... the events object for the preferences supports: "change" methods has() check to see if a preference exists. boolean has(in astring aname) parameters aname the name of preference return value true if the preference exists, false if not get() gets an object representing a preference extipreference get(in astring aname) parameters aname the name of preference return value a preference object, or null if the preference does not exist getvalue() gets the value of a preference. returns a default value if the preference does not exist. nsivariant getvalue(in astring aname, in nsivariant adefaultvalue) parameters aname the name of a preference adefaultvalue the default value of a preference. this will be passed back to you without any processing and can be...
...And 5 more matches
IAccessibleEditableText
re specified as follows: if startoffset is less than endoffset, the substring starts with the character at startoffset and ends with the character just before endoffset. if endoffset is lower than startoffset, the result is the same as a call with the two arguments exchanged. the whole text can be defined by passing the indices zero and iaccessibletext.ncharacters(). if both indices have the same value, an empty string is defined. refer to the @ref _specialoffsets "special offsets for use in the iaccessibletext and iaccessibleeditabletext methods" for information about a special offset constant that can be used in iaccessibleeditabletext methods. method overview hresult copytext([in] long startoffset, [in] long endoffset ); hresult cuttext([in] long startoffset, [in] long endoffset ); hr...
...ies 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 ); parameters startoffset start index of the text to be deleted. the valid range is 0..length. endoffset end...
...t 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 deleted. the v...
...And 5 more matches
nsIAbCard
the address book code, most of the documentation below is out of date. properties aren't stored anymore on the card, except for a handful of them. complex properties are expected to be accessed through a call to getproperty. see //github.com/realityripple/uxp/blob/master//mailnews/addrbook/public/nsiabcard.idl for more details. ...
...ation below is out of date. properties aren't stored anymore on the card, except for a handful of them. complex properties are expected to be accessed through a call to getproperty. see //github.com/realityripple/uxp/blob/master//mailnews/addrbook/public/nsiabcard.idl for more details. ...
...s aren't stored anymore on the card, except for a handful of them. complex properties are expected to be accessed through a call to getproperty. see //github.com/realityripple/uxp/blob/master//mailnews/addrbook/public/nsiabcard.idl for more details. ...
...And 5 more matches
nsICommandLine
riginal command line of this instance or a command line provided remotely by another instance of the application. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) components may implement the nsicommandlinehandler interface to add custom command line handling behavior. definitions arguments any values found on the command line. switches flags. in normalized form, these are preceded by a single dash. some flags may take parameters; for example: "-url <param>" or "-install-xpi <param>". method overview long findflag(in astring aflag, in boolean acasesensitive); astring getargument(in long aindex); boolean handleflag(in astring aflag, in boolean acasesensitive); astring handleflagwithp...
... be targeted by this command line. in most cases, this will be null (xremote will sometimes set this attribute). read only. workingdirectory nsifile the working directory for this command line. use this property instead of the working directory for the current process, since a redirected command line may have had a different working directory. read only. constants state constants constant value description state_initial_launch 0 the first launch of the application instance. state_remote_auto 1 a remote command line automatically redirected to this instance. state_remote_explicit 2 a remote command line explicitly redirected to this instance using xremote/windde/appleevents. methods findflag() finds a command-line flag, returning its position on the command line. long findflag( ...
...2 a remote command line explicitly redirected to this instance using xremote/windde/appleevents. methods findflag() finds a command-line flag, returning its position on the command line. long findflag( in astring aflag, in boolean acasesensitive ); parameters aflag the flag name to locate. do not include the initial hyphen. acasesensitive whether to do case-sensitive comparisons. return value the position of the flag in the command line, or -1 if the flag is not found.getargument() gets the value an argument from the array of command-line arguments, given the index into the argument list. on windows, flags of the form /flag are normalized to -flag. /flag:param are normalized to -flag param. on unix/linux and mac os x, flags of the form --flag are normalized to -flag, and flags of the ...
...And 5 more matches
nsICryptoHash
void init(in unsigned long aalgorithm); void initwithstring(in acstring aalgorithm); void update([const, array, size_is(alen)] in octet adata, in unsigned long alen); void updatefromstream(in nsiinputstream astream, in unsigned long alen); constants hash algorithms these constants are used by the init() method to indicate which hashing function to use. ...
...ng aalgorithm); void initwithstring(in acstring aalgorithm); void update([const, array, size_is(alen)] in octet adata, in unsigned long alen); void updatefromstream(in nsiinputstream astream, in unsigned long alen); constants hash algorithms these constants are used by the init() method to indicate which hashing function to use. ...
... update([const, array, size_is(alen)] in octet adata, in unsigned long alen); void updatefromstream(in nsiinputstream astream, in unsigned long alen); constants hash algorithms these constants are used by the init() method to indicate which hashing function to use. the values map directly onto the values defined in mozilla/security/nss/lib/cryptohi/hasht.h. constant value description md2 1 message digest algorithm 2 md5 2 message-digest algorithm 5 sha1 3 secure hash algorithm 1 sha256 4 secure hash algorithm 256 sha384 5 secure hash algorithm 384 sha512 6 secure hash algorithm 512 methods finish() completes the hash object and produces the actual hash data. note...
...And 5 more matches
nsIDOMNSHTMLDocument
is interface defines methods and properties supported by gecko on the document object that are not part of dom level 2. ...
...ntenttype, in boolean areplace); boolean querycommandenabled(in domstring commandid); boolean querycommandindeterm(in domstring commandid); boolean querycommandstate(in domstring commandid); boolean querycommandsupported(in domstring commandid); domstring querycommandtext(in domstring commandid); obsolete since gecko 14.0 domstring querycommandvalue(in domstring commandid); void releaseevents(in long eventflags); void routeevent(in nsidomevent evt); void write(); obsolete since gecko 2.0 void writeln(); obsolete since gecko 2.0 attributes attribute type description alinkcolor domstring same as body.alink bgcolor domstring same as body.bgcolor comp...
...ut does not actually do anything. void captureevents( in long eventflags ); parameters eventflags clear() used to reset a document to blank, but deprecated since gecko 1.0 and provided for compatibility with netscape 4.x; use open() and close() instead. void clear(); parameters none. execcommand() boolean execcommand( in domstring commandid, in boolean doshowui, in domstring value ); parameters commandid the name of the command to execute. see rich-text editing in mozilla for a list of supported commands. doshowui this is not implemented in gecko. value some commands require an argument. you can pass null for those commands that do not need an argument. return value true if the command was recognized, false otherwise. execcommandshowhelp...
...And 5 more matches
nsIDOMXULSelectControlElement
dom/interfaces/xul/nsidomxulselectcntrlel.idlscriptable please add a summary to this article. ...
...nsidomxulcontrolelement last changed in gecko 1.9 (firefox 3) method overview nsidomxulselectcontrolitemelement appenditem(in domstring label, in domstring value); long getindexofitem(in nsidomxulselectcontrolitemelement item); nsidomxulselectcontrolitemelement getitematindex(in long index); nsidomxulselectcontrolitemelement insertitemat(in long index, in domstring label, in domstring value); nsidomxulselectcontrolitemelement removeitemat(in long index); attributes attribute type description itemcount unsigned long read only. ...
...); nsidomxulselectcontrolitemelement getitematindex(in long index); nsidomxulselectcontrolitemelement insertitemat(in long index, in domstring label, in domstring value); nsidomxulselectcontrolitemelement removeitemat(in long index); attributes attribute type description itemcount unsigned long read only. ...
...And 5 more matches
nsIFocusManager
ed. setting the focusedwindow changes the focused window and raises the toplevel window it is in. if the current focus within the new focusedwindow is a frame element, then the focusedwindow will actually be set to the child window and the current element within that set as the focused element. this process repeats downwards until a non-frame element is found. constants constant value description flag_raise 1 flag_noscroll 2 do not scroll the element to focus into view. flag_noswitchframe 4 if attempting to change focus in a window that is not focused, do not switch focus to that window. instead, just update the focus within that window and leave the application focus as is. this flag will have no effect if a child window is fo...
...orward to the previous frame document, used when pressing shift+f6. movefocus_first 5 move focus to the first focusable element. movefocus_last 6 move focus to the last focusable element. movefocus_root 7 move focus to the root element in the document. movefocus_caret 8 move focus to a link at the position of the caret. this is a special value used to focus links as the caret moves over them in caret browsing mode. methods clearfocus() clears the focused element within awindow. if the current focusedwindow is a descendant of awindow, sets the current focusedwindow to awindow. void clearfocus( in nsidomwindow awindow ); parameters awindow exceptions thrown ns_error_invalid_arg if awindow is null. native co...
...s except that the widget focus is not changed. updating the widget focus state is the responsibility of the caller. ...
...And 5 more matches
nsIIOService
cision to block the port. this gives the protocol handler ultimate control over its own security policy while ensuring reasonable, default protection. is similar to nsiprotocolhandler.allowport(). boolean allowport( in long aport, in string ascheme ); parameters aport the port to check ascheme the scheme for the protocol handler that could override the ioservice's decision. return value true if the port is allowed, false otherwise. extractscheme() utility to extract the scheme from a url string, consistently and according to spec (see rfc 3986). note: most url parsing is done via nsiuri, and in fact the scheme can also be extracted from a url string via nsiuri. this method is provided purely as an optimization. acstring extractscheme( in autf8string urlstring ); param...
...ract the scheme from a url string, consistently and according to spec (see rfc 3986). note: most url parsing is done via nsiuri, and in fact the scheme can also be extracted from a url string via nsiuri. this method is provided purely as an optimization. acstring extractscheme( in autf8string urlstring ); parameters urlstring the string for the url to extract the scheme from. ...
... the string for the url to extract the scheme from. return value a string corresponding to the scheme. exceptions thrown ns_error_malformed_uri if url string is not of the right form. getprotocolflags() returns the protocol flags for a given scheme. unsigned long getprotocolflags( in string ascheme ); parameters ascheme the scheme for which to get the protocol flags. return value the value of the protocolflags attribute for the corresponding nsiprotocolhandler. getprotocolhandler() returns a protocol handler for a given uri scheme. nsiprotocolhandler getprotocolhandler( in string ascheme ); parameters ascheme the uri scheme for which to get a protocol handler. return value an nsiprotocolhandler for the scheme. newchannel() obsolete since gecko 48 a short...
...And 5 more matches
nsINavHistoryService
should be enabled or not. this is much better than using browserhistory.count since that can be very slow if there is a lot of history (it must enumerate each item). this is pretty fast. historydisabled boolean true if history is disabled. currently, history is disabled if the browser.history_expire_days pref is "0". constants transition type constants constant value description transition_link 1 this transition type means the user followed a link and got a new toplevel window. transition_typed 2 this transition type is set when the user typed the url to get to the page. transition_bookmark 3 this transition type is set when the user followed a bookmark to get to the page. transition_embed 4 this ...
... this transition type is set when the transition is a download. transition_framed_link 8 this transition type is set when the user followed a link that loaded a page in a frame. methods getpagetitle() this method retrieves the original title of the page. astring getpagetitle( in nsiuri auri ); parameters auri the page whose title needs to be retrieved. return value returns the original title of the page. markpageasfollowedbookmark() this method is just like markpageastyped (in nsibrowserhistory, also implemented by the history service), but for bookmarks. it declares that the given uri is being opened as a result of following a bookmark. if this uri is loaded soon after this message has been received, that transition will be marked as following a bookmar...
...ether it will be or not. you don't have to worry about calling this, addpagetosession/adduri will always check before actually adding the page. this function is public because some components may want to check if this page would go in the history (that is for annotations). boolean canadduri( in nsiuri auri ); parameters auri the uri that needs to be added to the history system. return value returns true if this uri would be added to the history, otherwise returns false. addvisit() obsolete since gecko 22.0 (firefox 22.0 / thunderbird 22.0 / seamonkey 2.19) note: this method was removed in gecko 22.0. you should use the new async api moziasynchistory.updateplaces() instead. see this code for how a function to add visits and handle errors using the new ap...
...And 5 more matches
nsIPropertyBag2
note: accessing a property o...
...in nsiidref iid, [iid_is(iid), retval] out nsqiresult result); pruint32 getpropertyasuint32(in astring prop); pruint64 getpropertyasuint64(in astring prop); prbool haskey(in astring prop); methods get() this method returns null if the value does not exist, or exists but is null. nsivariant get( in astring prop ); parameters prop property to return the value of. return value the property value as an nsivariant. getpropertyasacstring() acstring getpropertyasacstring( in astring prop ); parameters prop property to return the value of. return value the property value as an acstring. note: accessing a property of a different type may attempt conversion to this type. getpropertyasastring() astring getpropertyasastring( in astring prop ); ...
...ariant. getpropertyasacstring() acstring getpropertyasacstring( in astring prop ); parameters prop property to return the value of. return value the property value as an acstring. note: accessing a property of a different type may attempt conversion to this type. getpropertyasastring() astring getpropertyasastring( in astring prop ); parameters prop property to return the value of. return value the property value as a string. note: accessing a property of a different type may attempt conversion to this type. getpropertyasautf8string() autf8string getpropertyasautf8string( in astring prop ); parameters prop property to return the value of. return value the property value as an autf8string. note: accessing a property of a different type may attempt conversio...
...And 5 more matches
nsISocketTransport
ent sink (if set). to create an instance, call nsisockettransportservice.createtransport() method overview prnetaddr getpeeraddr(); native code only! prnetaddr getselfaddr(); native code only! unsigned long gettimeout(in unsigned long atype); boolean isalive(); void settimeout(in unsigned long atype, in unsigned long avalue); attributes attribute type description connectionflags unsigned long a bitmask that can be used to modify underlying behavior of the socket connection. see connection flag constants for more details. host autf8string get the host for the underlying socket connection. read only. port ...
... security info object returned from the secure socket provider. this object supports nsisslsocketcontrol, nsitransportsecurityinfo, and possibly other interfaces. this attribute is only available once the socket is connected. read only. constants timeout type this constants are used by gettransport() and settransport() to specify socket timeouts constant value description timeout_connect 0 connecting timeout. timeout_read_write 1 read and write timeouts. nsitransporteventsink status codes note: although these constants look like xpcom error codes and are passed in an nsresult variable, they are not error codes. they do overlap with existing error codes in necko, these status co...
...read_write 1 read and write timeouts. nsitransporteventsink status codes note: although these constants look like xpcom error codes and are passed in an nsresult variable, they are not error codes. they do overlap with existing error codes in necko, these status codes are confined within a very limited context where no error codes may appear, so there is no ambiguity. ...
...And 5 more matches
nsIURI
ponents.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); return ioservice.newuri(aurl, aorigincharset, abaseuri); } components of a uri prepath path scheme userpass host port ref ftp :// username@password @ hostname : portnumber /pathname?query=value #ref method overview nsiuri clone(); nsiuri cloneignoringref(); boolean equals(in nsiuri other); boolean equalsexceptref(in nsiuri other); autf8string resolve(in autf8string relativepath); boolean schemeis(in string scheme); attributes attribute type description asciihost acstring the uri...
...s. hostport autf8string the "host:port" part of the uri (or simply the host, if port is -1). exceptions thrown ns_error_failure if hostport is not applicable to the uri scheme (e.g. about:blank) note: characters are not escaped. origincharset acstring the charset of the document from which this uri originated. an empty value implies utf-8. if this value is something other than utf-8 then the uri components (for example spec, prepath, username, and so on) are all fully url-escaped. otherwise, the uri components may contain unescaped multibyte utf-8 characters. read only. password autf8string the optional password, assuming the prehost consists of "username:password". exceptions thrown ...
...ons thrown ns_error_failure if password is not applicable to the uri scheme (e.g. about:blank) note: some characters may be escaped. path autf8string the path, typically including at least a leading '/' (but may also be empty, depending on the protocol). note: some characters may be escaped. port long the uri's port. a port value of -1 corresponds to the protocol's default port (for example -1 implies port 80 for http uris). exceptions thrown ns_error_failure if port is not applicable to the uri scheme (e.g. about:blank) prepath autf8string the prepath returns the string before the path (such as "scheme://user:password@host:port"). this is related to the web origin co...
...And 5 more matches
nsIWebBrowserChrome
ntloop(in nsresult astatus); boolean iswindowmodal(); void setstatus(in unsigned long statustype, in wstring status); void showasmodal(); void sizebrowserto(in long acx, in long acy); attributes attribute type description chromeflags unsigned long the chrome flags for this browser chrome. the implementation should reflect the value of this attribute by hiding or showing its chrome appropriately. webbrowser nsiwebbrowser the currently loaded webbrowser. the browser chrome may be told to set the webbrowser object to a new object by setting this attribute. in this case the implementer is responsible for taking the new webbrowser object and doing any necessary initialization or setup as if it had created the webb...
... the currently loaded webbrowser. the browser chrome may be told to set the webbrowser object to a new object by setting this attribute. in this case the implementer is responsible for taking the new webbrowser object and doing any necessary initialization or setup as if it had created the webbrowser itself. this includes positioning setting up listeners etc. constants constant value description status_script 1 flag for setstatus() status_script_default 2 flag for setstatus() status_link 3 flag for setstatus() chrome_default 1 value for the chromeflags attribute. chrome_window_borders 2 value for the chromeflags attribute. chrome_window_close 4 value for the chromeflags attribute. ...
...ipt 1 flag for setstatus() status_script_default 2 flag for setstatus() status_link 3 flag for setstatus() chrome_default 1 value for the chromeflags attribute. chrome_window_borders 2 value for the chromeflags attribute. chrome_window_close 4 value for the chromeflags attribute. chrome_window_resize 8 value for the chromeflags attribute. chrome_menubar 16 value for the chromeflags attribute. chrome_toolbar 32 value for the chromeflags attribute. chrome_locationbar 64 value for the chromeflags attribute. chrome_statusbar 128 value for the chromeflags attribute. chrome_personal_toolbar 256 value for the chromeflags attribute. ...
...And 5 more matches
nsIXSLTProcessor
void clearparameters(); parameters none. getparameter() ...
...lname); void reset(); void setparameter(in domstring namespaceuri, in domstring localname, in nsivariant value); nsidomdocument transformtodocument(in nsidomnode source); nsidomdocumentfragment transformtofragment(in nsidomnode source, in nsidomdocument output); methods clearparameters() removes all set parameters from this nsixsltprocessor. this will make the processor use the default-value for all parameters as specified in the stylesheet. void clearparameters(); parameters none. getparameter() gets a parameter if previously set by setparameter(). returns null otherwise. ...
...importstylesheet() imports the specified stylesheet into this xsltprocessor for transformations. void importstylesheet( in nsidomnode style ); parameters style the root-node of a xslt stylesheet. this can be either a document node or an element node. ...
...And 5 more matches
Type conversion
default_abi, ctypes.void_t, ctypes.char.ptr); somecfunction(buffer); // here ctypes.char.array(10)() is converted to ctypes.char.ptr type implicit conversion can be tested in the following way: var mystruct = ctypes.structtype("mystructtype", [ { "v": ctypes.bool } ])(); mystruct.v = 1; console.log(mystruct.v.tostring()); // 'true' boolean type target type source converted value ctypes.bool js boolean src js number (0 or 1) if src == 0: false if src == 1: true var mystruct = ctypes.structtype("mystructtype", [ { "v": ctypes.bool } ])(); mystruct.v = true; console.log(mystruct.v.tostring()); // 'true' mystruct.v = false; console.log(mystruct.v.tostring()); // 'false' mystruct.v = 1; console.log(mystruct.v.tostring()); // 'true'...
...ystruct.v = true; console.log(mystruct.v.tostring()); // 'true' mystruct.v = false; console.log(mystruct.v.tostring()); // 'false' mystruct.v = 1; console.log(mystruct.v.tostring()); // 'true' mystruct.v = 0; console.log(mystruct.v.tostring()); // '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 = t...
..._char ctypes.uint8_t ctypes.char16_t ctypes.uint8_t ctypes.uint16_t ctypes.unsigned_short var mystruct = ctypes.structtype("mystructtype", [ { "v": ctypes.int16_t } ])(); mystruct.v = ctypes.int8_t(10); console.log(mystruct.v.tostring()); // 10 mystruct.v = ctypes.int32_t(10); // throws error float types target type source converted value any float types js number (only if fits to the size) src pointer types target type source converted value any pointer types null nullptr ctypes.voidptr_t any pointer types src any array types src.addressofelement(0) ctypes.pointertype(t) ctypes.arraytype(t) src.addressofelement(0) ctypes.ar...
...And 5 more matches
CData
a cdata object represents a c value or function located in memory. method 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. ...
...d 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 pointer to the actual data of the c value represented by the cdata object. cdata address() parameters none. return value a cdata object of the pointer type ctypes.pointertype(dataobject.constructor) whose value points to the c object referred to by the object. tosource() returns the string "t(arg)", where t and...
...however, this only works if the object's type happens to be bound to an appropriate name in scope. ...
...And 5 more matches
Plug-in Development Overview - Plugins
st be used. in this case to ensure the plug-in file will be loaded, it should have a name in the form of "np*.dll". also, the windows version information for the plug-in dll will be used to determines the mime types, file extensions, file open template, plug-in name, and description. ...
... and description. for this the version stamp of the embedded resource of the plug-in dll should contain the following set of string/value pairs: mimetype: for mime types fileextents: for file extensions fileopenname: for file open template productname: for plug-in name filedescription: for description language: for language in use in the mime types and file extensions strings, multiple values are separated by the "|" character, for example: video/quicktime|audio/aiff|image/jpeg the version stamp will be loaded only if it has been created with the language set to "us english" and the character set to "windows multilingual" in your development environment. the resource code for this language and character set combination is 040904e4. unix on unix, plug-ins are found according ...
...iption entry point. this exported c function should return a string containing the type, extension list, and type description separated by colons. each mime types should be separated by semicolons. for example: image/xbm:xbm:x bitmap or for 2 mime types: image/xbm:xbm:x bitmap;image/png:png:portable network graphics. this information will then appear in the navigator.mimetypes dom object. npp_getvalue is called after the plug-in is initialized to get the scripting interface while np_getvalue is called during initialization to retrieve the plug-in's name and description, which will appear in the navigator.plugins dom object which is used to populate about:plugins. caution: gecko caches the values returned by these functions and will only call it if the plug-in's timestamp has changed. see bug...
...And 5 more matches
Edit Shape Paths in CSS - Firefox Developer Tools
one for shape-outside. clicking the icon will cause the editor to highlight the shape. ...
...one for shape-outside. clicking the icon will cause the editor to highlight the shape. to deactivate the shape path editor click on the icon again, or select another element or a different editor. ...
...shape that is wrapping the text. this is your shape. if the shape is clipped by the margin box then the margin box will make up part of this line. a dashed line demonstrates the outline of the shape which extends past the margin box reference; this is the area that will be clipped by the margin box. ...
...And 5 more matches
AudioBufferSourceNode.loopStart - Web APIs
example in this example, the audiocontext.decodeaudiodata() function is used to decode an audio track and put it into an audiobuffersourcenode. ...
... example in this example, the audiocontext.decodeaudiodata() function is used to decode an audio track and put it into an audiobuffersourcenode. ...
... example in this example, the audiocontext.decodeaudiodata() function is used to decode an audio track and put it into an audiobuffersourcenode. ...
...And 5 more matches
AudioListener.setOrientation() - Web APIs
the setorientation() method of the audiolistener interface defines the orientation of the listener. it consists of two direction vectors: the front vector, defined by the three unitless parameters x, y and z, describes the direction of the face of the listener, that is the direction the nose of the person is pointing towards. the front vector's default value is (0, 0, -1). the up vector, defined by three unitless parameters xup, yup and zup, describes the direction of the top of the listener's head. the up vector's default value is (0, 1, 0). the two vectors must be separated by an angle of 90° — in linear analysis terms, they must be perpendicular to each other. syntax var audioctx = new audiocontext(); var mylistener = audioctx.listener; mylistener.setorientation(0,0,-1,0,1,0...
...en update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer p...
...e panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); var zpos = 295; // define ...
...And 5 more matches
AudioNode.connect() - Web APIs
Web › API › AudioNode › connect
the connect() method of the audionode interface lets you connect one of the node's outputs to a target, which may be either another audionode (thereby directing the sound data to the specified node) or an audioparam, so that the node's output data is automatically used to change the value of that parameter over time. syntax var destinationnode = audionode.connect(destination, outputindex, inputindex); audionode.connect(destination, outputindex); parameters destination the audionode or audioparam to which to connect. outputindex optional an index specifying which output of the current audionode to connect to the destination. the index numbers are defined according to the number of output channels (see audio channels). while you can only connect a given output to a given input once ...
...an index specifying which output of the current audionode to connect to the destination. the index numbers are defined according to the number of output channels (see audio channels). while you can only connect a given output to a given input once (repeated attempts are ignored), you can connect an output to multiple inputs by calling connect() repeatedly. this makes fan-out possible. the default value is 0. inputindex optional an index describing which input of the destination you want to connect the current audionode to; the default is 0. the index numbers are defined according to the number of input channels (see audio channels). it is possible to connect an audionode to another audionode, which in turn connects back to the first audionode, creating a cycle. this is allowed only if there i...
...efined according to the number of input channels (see audio channels). it is possible to connect an audionode to another audionode, which in turn connects back to the first audionode, creating a cycle. this is allowed only if there is at least one delaynode in the cycle. otherwise, a notsupportederror exception is thrown. this parameter is not allowed if the destination is an audioparam. ...
...And 5 more matches
AudioParam.cancelAndHoldAtTime() - Web APIs
specifications specification status comment web audio apithe definition of 'cancelandholdattime()' in that specification. ...
... specifications specification status comment web audio apithe definition of 'cancelandholdattime()' in that specification. working draft initial definition. ...
...chromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcancelandholdattimechrome full support 57 full support 57 no support ? — 56alternate name alternate name uses the non-standard name: cancelvaluesandholdattime()edge full support ≤79firefox no support noie no support noopera full support 44 full support 44 no support ? — 43alternate name a...
...And 5 more matches
AudioWorkletNode.parameters - Web APIs
the read-only parameters property of the audioworkletnode interface returns the associated audioparammap — that is, a map-like collection of audioparam objects. they are instantiated during creation of the underlying audioworkletprocessor according to its parameterdescriptors static getter. syntax audioworkletnodeinstance.parameters value the audioparammap object containing audioparam instances. they can be automated in the same way as with default audionodes, and their calculated values can be used in the process method of your audioworkletprocessor. examples to demonstrate creation and usage of custom audioparams, we'll expand the example from audioworkletnode page. there we've created a simple node which outputs white noise. here, additionally, we'll create a custom gain parameter, ...
...in a separate file. we expand the processor by adding a static parameterdescriptors getter. it will be used internally by the audioworkletnode constructor to populate its parameters with instantiated audioparam objects. ...
... we expand the processor by adding a static parameterdescriptors getter. it will be used internally by the audioworkletnode constructor to populate its parameters with instantiated audioparam objects. ...
...And 5 more matches
BiquadFilterNode - Web APIs
number of outputs 1 channel count mode "max" channel count 2 (not used in the default count mode) channel interpretation "speakers" constructor biquadfilternode() creates a new instance of a biquadfilternode object. properties inherits properties from its parent, audionode. note: though the audioparam objects returned are read-only, the values they represent are not. biquadfilternode.frequency read only is an a-rate audioparam, a double representing a frequency in the current filtering algorithm measured in hertz (hz). biquadfilternode.detune read only is an a-rate audioparam representing detuning of the frequency in cents. biquadfilternode.q read only is an a-rate audioparam, a double representing a q factor, or quality fa...
...hertz (hz). biquadfilternode.detune read only is an a-rate audioparam representing detuning of the frequency in cents. biquadfilternode.q read only is an a-rate audioparam, a double representing a q factor, or quality factor. biquadfilternode.gain read only is an a-rate audioparam, a double representing the gain used in the current filtering algorithm. biquadfilternode.type is a string value defining the kind of filtering algorithm the node is implementing. the meaning of the different parameters depending of the type of the filter (detune has the same meaning regardless, so isn't listed below) type description frequency q gain lowpass standard second-order resonant lowpass filter with 12db/octave rolloff. frequencies below the ...
...s the same meaning regardless, so isn't listed below) type description frequency q gain lowpass standard second-order resonant lowpass filter with 12db/octave rolloff. frequencies below the cutoff pass through; frequencies above it are attenuated. the cutoff frequency. indicates how peaked the frequency is around the cutoff. the greater the value is, the greater is the peak. not used highpass standard second-order resonant highpass filter with 12db/octave rolloff. frequencies below the cutoff are attenuated; frequencies above it pass through. the cutoff frequency. indicates how peaked the frequency is around the cutoff. the greater the value, the greater the peak. not used bandpass standard ...
...And 5 more matches
CSS Object Model (CSSOM) - Web APIs
the css object model is a set of apis allowing the manipulation of css from javascript. it is much like the dom, but for the css rather than the html. it allows users to read and modify css style dynamically. ...
... the css object model is a set of apis allowing the manipulation of css from javascript. it is much like the dom, but for the css rather than the html. it allows users to read and modify css style dynamically. ...
...facesetloadevent geometryutils getstyleutils linkstyle medialist mediaquerylist mediaquerylistevent mediaquerylistlistener screen stylesheet stylesheetlist transitionevent several other interfaces are also extended by the cssom-related specifications: document, window, element, htmlelement, htmlimageelement, range, mouseevent, and svgelement. ...
...And 5 more matches
Drawing text - Web APIs
context('2d'); ctx.font = '48px serif'; ctx.stroketext('hello world', 10, 50); } <canvas id="canvas" width="300" height="100"></canvas> draw(); styling text in the examples above we are already making use of the font property to make the text a bit larger than the default size. there are some more properties which let you adjust the way the text gets displayed on the canvas: font = value the current text style being used when drawing text. this string uses the same syntax as the css font property. the default font is 10px sans-serif. textalign = value text alignment setting. possible values: start, end, left, right or center. the default value is start. textbaseline = value baseline alignment setting. possible values: top, hanging, middle, alphabetic, ideographic, bottom. th...
... these properties might be familiar to you, if you have worked with css before. ...
... these properties might be familiar to you, if you have worked with css before. the following diagram from the whatwg demonstrates the various baselines supported by the textbaseline property. ...
...And 5 more matches
ConstantSourceNode - Web APIs
the constantsourcenode interface—part of the web audio api—represents an audio source (based upon audioscheduledsourcenode) whose output is single unchanging value. this makes it useful for cases in which you need a constant value coming in from an audio source. in addition, it can be used like a constructible audioparam by automating the value of its offset or by connecting another node to it; see controlling multiple parameters with constantsourcenode. a constantsourcenode has no inputs and exactly one monaural (one-channel) output. the output's value is always the same as the value of the offset parameter. number of inputs 0 number of outputs 1 constructor constantsourcenode() creates and returns a new constantsourcenode instance, optionally specifyi...
...constantsourcenode. a constantsourcenode has no inputs and exactly one monaural (one-channel) output. the output's value is always the same as the value of the offset parameter. number of inputs 0 number of outputs 1 constructor constantsourcenode() creates and returns a new constantsourcenode instance, optionally specifying an object which establishes initial values for the object's properties. you can also create a constantsourcenode whose properties are initialized to their default values by calling audiocontext.createconstantsource(). properties inherits properties from its parent interface, audioscheduledsourcenode, and adds the following properties: offset an audioparam which specifies the value that this source continuously outputs. the default...
... event handlers inherits event handlers from its parent interface, audioscheduledsourcenode. some browsers' implementations of this event handler are part of the audioscheduledsourcenode interface. ...
...And 5 more matches
DOMMatrixReadOnly - Web APIs
errface—which is based upon dommatrixreadonly—adds mutability, allowing you to alter the matrix after creating it. a 4×4 matrix is suitable to describe any rotation and translation in 3d. this interface should be available inside web workers, though some implementations doesn't allow it yet. properties this interface doesn't inherit any properties. is2d read only a boolean flag whose value is true if the matrix was initialized as a 2d matrix. if false, the matrix is 3d. isidentity read only a boolean whose value is true if the matrix is the identity matrix. the identity matrix is one in which every value is 0 except those on the main diagonal from top-left to bottom-right corner (in other words, where the offsets in each direction are equal). m11, m12, m13, m14, m21, m22, m23, ...
...s 3d. isidentity read only a boolean whose value is true if the matrix is the identity matrix. the identity matrix is one in which every value is 0 except those on the main diagonal from top-left to bottom-right corner (in other words, where the offsets in each direction are equal). m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44 double-precision floating-point values representing each component of a 4×4 matrix, where m11 through m14 are the first column, m21 through m24 are the second column, and so forth. a, b, c, d, e, f double-precision floating-point values representing the components of a 4×4 matrix which are required in order to perform 2d rotations and translations. these are aliases for specific components of a 4×4 matrix, as shown below. ...
...al matrix is not altered. dommatrixreadonly.multiply() returns a new dommatrix created by computing the dot product of the source matrix and the specified matrix: a⋅b. if no matrix is specified as the multiplier, the matrix is multiplied by a matrix in which every element is 0 except the bottom-right corner and the element immediately above and to its left: m33 and m34. these have the default value of 1. the original matrix is not modified. dommatrixreadonly.rotateaxisangle() returns a new dommatrix created by rotating the source matrix by the given angle around the specified vector. the original matrix is not modified. dommatrixreadonly.rotate() returns a new dommatrix created by rotating the source matrix around each of its axes by the specified number of degrees. the original matrix ...
...And 5 more matches
DoubleRange - Web APIs
if no match can be found that is within the given range, an error will occur. ...
...if no match can be found that is within the given range, an error will occur. ...
...if no match can be found that is within the given range, an error will occur. ...
...And 5 more matches
DynamicsCompressorNode() - Web APIs
l, in order to help prevent clipping and distortion. that can occur when multiple sounds are played and multiplexed together at once. syntax var dynamicscompressornode = new dynamicscompressornode(context, options) parameters context a reference to an audiocontext. options optional options are as follows: attack: the amount of time (in seconds) to reduce the gain by 10db. its default value is 0.003. this parameter is k-rate. its nominal range is [0, 1]. knee: a decibel value representing the range above the threshold where the curve smoothly transitions to the "ratio" portion. its default value is 30. this parameter is k-rate. its nominal range is [0, 40]. ratio: the amount of db change in input for a 1 db change in output. its default value is 12. this parameter is k-rate. its...
...this parameter is k-rate. its nominal range is [-100, 0]. ...
...this parameter is k-rate. its nominal range is [-100, 0]. ...
...And 5 more matches
HTMLMediaElement - Web APIs
ls is a boolean that reflects the controls html attribute, indicating whether user interface items for controlling the resource should be displayed. htmlmediaelement.controlslist read only returns a domtokenlist that helps the user agent select what controls to show on the media element whenever the user agent shows its own set of controls. ...
...the time is specified relative to the media's timeline. ...
...ack. htmlmediaelement.crossorigin a domstring indicating the cors setting for this media element. htmlmediaelement.currentsrc read only returns a domstring with the absolute url of the chosen media resource. htmlmediaelement.currenttime a double-precision floating-point value indicating the current playback time in seconds; if the media has not started to play and has not been seeked, this value is the media's initial playback time. setting this value seeks the media to the new time. the time is specified relative to the media's timeline. htmlmediaelement.defaultmuted a boolean that reflects the muted html attribute, which indicates whether the media element's audio output should be muted by default. htmlmediaelement.defaultplaybackrate a double indicating the default playback rate f...
...And 5 more matches
Option() - Web APIs
the option() constructor creates a new htmloptionelement. syntax var optionelementreference = new option(text, value, defaultselected, selected); parameters text optional a domstring representing the content of the element, i.e. the displayed text. if this is not specified, a default value of "" (empty string) is used. value optional a domstring representing the value of the htmloptionelement, i.e. the value attribute of the equivalent <option>. if this is not specified, the value of text is used as the value, e.g. for the associated <select> element's value when the form is submitted to the server. ...
... selected optional a boolean that sets the option's selected state; the default is false (not selected). ...
... selected optional a boolean that sets the option's selected state; the default is false (not selected). ...
...And 5 more matches
IDBIndexSync - Web APIs
version of the indexeddb api was originally intended for use only with web workers, and was eventually removed from the spec because its need was questionable. it may however be reintroduced in the future if there is enough demand from web developers. the idbindexsync interface of the indexeddb api provides synchronous access to an index in a database. ...
...if this attribute is null, this index is not auto-populated. name readonly domstring the name of this index. storename ...
...utes attribute type description keypath readonly domstring the key path of this index. if this attribute is null, this index is not auto-populated. name readonly domstring the name of this index. storename readonly domstring this index's referenced object store. ...
...And 5 more matches
MediaTrackSupportedConstraints - Web APIs
lently ignoring a constraint and a constraint being accepted. an actual constraint set is described using an object based on the mediatrackconstraints dictionary. to learn more about how constraints work, see capabilities, constraints, and settings. properties some combination—but not necessarily all—of the following properties will exist on the object. ...
...an object based on the mediatrackconstraints dictionary. to learn more about how constraints work, see capabilities, constraints, and settings. properties some combination—but not necessarily all—of the following properties will exist on the object. autogaincontrol a boolean whose value is true if the autogaincontrol constraint is supported in the current environment. width a boolean value whose value is true if the width constraint is supported in the current environment. ...
...lities, constraints, and settings. properties some combination—but not necessarily all—of the following properties will exist on the object. autogaincontrol a boolean whose value is true if the autogaincontrol constraint is supported in the current environment. width a boolean value whose value is true if the width constraint is supported in the current environment. height a boolean value whose value is true if the height constraint is supported in the current environment. aspectratio a boolean value whose value is true if the aspectratio constraint is supported in the current environment. ...
...And 5 more matches
PannerNode.coneInnerAngle - Web APIs
example in this example, we'll demonstrate how changing the orientation parameters of a pannernode in combination with coneinnerangle and coneouterangle affects volume. ...
... example in this example, we'll demonstrate how changing the orientation parameters of a pannernode in combination with coneinnerangle and coneouterangle affects volume. ...
... example in this example, we'll demonstrate how changing the orientation parameters of a pannernode in combination with coneinnerangle and coneouterangle affects volume. ...
...And 5 more matches
PannerNode.distanceModel - Web APIs
the distancemodel property of the pannernode interface is an enumerated value determining which algorithm to use to reduce the volume of the audio source as it moves away from the listener. the possible values are: linear: a linear distance model calculating the gain induced by the distance according to: 1 - rollofffactor * (distance - refdistance) / (maxdistance - refdistance) inverse: an inverse distance model calculating the gain induced by the distance according to: refdistance / (refdistance + rollofffactor * (math.max(distance, refdistance) - refdistance)) exponential: an exponential distance model calculating the gain induced by the distance according to: pow((math.max(distance, refdistance) / refdistance, -rollofffactor). inverse is the default value of distancemodel. ...
...ffactor * (math.max(distance, refdistance) - refdistance)) exponential: an exponential distance model calculating the gain induced by the distance according to: pow((math.max(distance, refdistance) / refdistance, -rollofffactor). inverse is the default value of distancemodel. syntax var audioctx = new audiocontext(); var panner = audioctx.createpanner(); panner.distancemodel = 'inverse'; value a enum — see distancemodeltype. example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used.
...en update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer p...
...And 5 more matches
PannerNode.setOrientation() - Web APIs
d is very directional — controlled by the three cone-related attributes pannernode.coneinnerangle, pannernode.coneouterangle, and pannernode.coneoutergain. in such a case, a sound pointing away from the listener can be very quiet or even silent. the three parameters x, y and z are unitless and describe a direction vector in 3d space using the right-hand cartesian coordinate system. the default value of the direction vector is (1, 0, 0). syntax var audioctx = new audiocontext(); var panner = audioctx.createpanner(); panner.setorientation(1,0,0); returns void. example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. generally you will define the position in 3d space that your a...
...en update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer p...
...e panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); var zpos = 295; // define ...
...And 5 more matches
PannerNode.setVelocity() - Web APIs
his method was removed from the specification because of gaps in its design and implementation problems. the velocity relative to the listener is used to control the pitch change needed to conform with the doppler effect due to the relative speed. as the vector controls both the direction of travel and its velocity, the three parameters x, y and z are expressed in meters per second. the default value of the velocity vector is (0, 0, 0). syntax var audioctx = new audiocontext(); var panner = audioctx.createpanner(); panner.setvelocity(0,0,17); returns void. example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio...
...en update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer p...
...e panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); var zpos = 295; // define ...
...And 5 more matches
Selection.setBaseAndExtent() - Web APIs
selection to be a range including all or parts of two specified dom nodes, and any content located between them. syntax sel.setbaseandextent(anchornode,anchoroffset,focusnode,focusoffset) parameters anchornode the node at the start of the selection. anchoroffset the number of child nodes from the start of the anchor node that should be excluded from the selection. so for example, if the value is 0 the whole node is included. if the value is 1, the whole node minus the first child node is included. and so on. focusnode the node at the end of the selection. focusoffset the number of child nodes from the start of the focus node that should be included in the selection. so for example, if the value is 0 the whole node is excluded. if the value is 1, the first child node is included. a...
...e is included. and so on. note: if the focus position appears before the anchor position in the document, the direction of the selection is reversed — the caret is placed at the beginning of the text rather the end, which matters for any keyboard command that might follow. for example, shift + ➡︎ would cause the selection to narrow from the beginning rather than grow at the end. return value void. exceptions if anchoroffset is larger than the number of child nodes inside anchornode, or if focusoffset is larger than the number of child nodes inside focusnode, an indexsizeerror exception is thrown. examples in this example, we have two paragraphs containing spans, each one containing a single word. the first one is set as the anchornode and the second is set as the focusnode. we a...
...zeerror exception is thrown. examples in this example, we have two paragraphs containing spans, each one containing a single word. the first one is set as the anchornode and the second is set as the focusnode. we also have an additional paragraph that sits in between the two nodes. next, we have two form inputs that allow you to set the anchoroffset and focusoffset — they both have a default value of 0. we also have a button that when pressed invokes a function that runs the setbaseandextent() method with the specified offsets, and copies the selection into the output paragraph at the very bottom of the html. <h1>setbaseandextent example</h1> <div> <p class="one"><span>fish</span><span>dog</span><span>cat</span><span>bird</span></p> <p>middle</p> <p class="two"><span>car</span><spa...
...And 5 more matches
SubtleCrypto.encrypt() - Web APIs
extra parameters if required: to use rsa-oaep, pass an rsaoaepparams object. to use aes-ctr, pass an aesctrparams object. to use aes-cbc, pass an aescbcparams object. to use aes-gcm, pass an aesgcmparams object. key is a cryptokey containing the key to be used for encryption. data is a buffersource containing the data to be encrypted (also known as the plaintext). return value result is a promise that fulfills with an arraybuffer containing the "ciphertext". exceptions the promise is rejected when the following exceptions are encountered: invalidaccesserror raised when the requested operation is not valid for the provided key (e.g. invalid encryption algorithm, or invalid key for the specified encryption algorithm). operationerror raised when the operati...
...he ciphertext has not been modified by an attacker. examples note: you can try the working examples out on github. rsa-oaep this code fetches the contents of a text box, encodes it for encryption, and encrypts it with using rsa-oaep. see the complete code on github. function getmessageencoding() { const messagebox = document.queryselector(".rsa-oaep #message"); let message = messagebox.value; let enc = new textencoder(); return enc.encode(message); } function encryptmessage(publickey) { let encoded = getmessageencoding(); return window.crypto.subtle.encrypt( { name: "rsa-oaep" }, publickey, encoded ); } aes-ctr this code fetches the contents of a text box, encodes it for encryption, and encrypts it using aes in ctr mode. see the complete code on git...
...coding(); return window.crypto.subtle.encrypt( { name: "rsa-oaep" }, publickey, encoded ); } aes-ctr this code fetches the contents of a text box, encodes it for encryption, and encrypts it using aes in ctr mode. see the complete code on github. ...
...And 5 more matches
TouchEvent - Web APIs
" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">touchevent</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constructor touchevent() creates a touchevent object. properties this interface inherits properties from its parent, uievent and event. touchevent.altkey read only a boolean value indicating whether or not the alt key was down when the touch event was fired. touchevent.changedtouches read only a touchlist of all the touch objects representing individual points of contact whose states changed between the previous touch event and this one. touchevent.ctrlkey read only a boolean value indicating whether or not the control key was down when the touch event was fired. to...
...was down when the touch event was fired. touchevent.changedtouches read only a touchlist of all the touch objects representing individual points of contact whose states changed between the previous touch event and this one. touchevent.ctrlkey read only a boolean value indicating whether or not the control key was down when the touch event was fired. touchevent.metakey read only a boolean value indicating whether or not the meta key was down when the touch event was fired. touchevent.shiftkey read only a boolean value indicating whether or not the shift key was down when the touch event was fired. touchevent.targettouchesread only a touchlist of all the touch objects that are both currently in contact with the touch surface and were also started on the same element that is the tar...
... both currently in contact with the touch surface and were also started on the same element that is the target of the event. touchevent.touches read only a touchlist of all the touch objects representing all current points of contact with the surface, regardless of target or changed status. touchevent.rotation read only change in rotation (in degrees) since the event's beginning. ...
...And 5 more matches
ULongRange - Web APIs
if no match can be found that is within the given range, an error will occur. ...
...if no match can be found that is within the given range, an error will occur. ...
...if no match can be found that is within the given range, an error will occur. ...
...And 5 more matches
URLSearchParams - Web APIs
the urlsearchparams interface defines utility methods to work with the query string of a url. an object implementing urlsearchparams can directly be used in a for...of structure, for example the following two lines are equivalent: for (const [key, value] of mysearchparams) {} for (const [key, value] of mysearchparams.entries()) {} note: this feature is available in web workers. constructor urlsearchparams() returns a urlsearchparams object instance. ...
...chparams can directly be used in a for...of structure, for example the following two lines are equivalent: for (const [key, value] of mysearchparams) {} for (const [key, value] of mysearchparams.entries()) {} note: this feature is available in web workers. constructor urlsearchparams() returns a urlsearchparams object instance. methods urlsearchparams.append() appends a specified key/value pair as a new search parameter. urlsearchparams.delete() deletes the given search parameter, and its associated value, from the list of all search parameters. urlsearchparams.entries() returns an iterator allowing iteration through all key/value pairs contained in this object. urlsearchparams.foreach() allows iteration through all values contained in this object via a callback function. ur...
...archparams.delete() deletes the given search parameter, and its associated value, from the list of all search parameters. urlsearchparams.entries() returns an iterator allowing iteration through all key/value pairs contained in this object. urlsearchparams.foreach() allows iteration through all values contained in this object via a callback function. urlsearchparams.get() returns the first value associated with the given search parameter. urlsearchparams.getall() returns all the values associated with a given search parameter. urlsearchparams.has() returns a boolean indicating if such a given parameter exists. ...
...And 5 more matches
ValidityState.typeMismatch - Web APIs
the read-only typemismatch property of a validitystate object indicates if the value of an <input>, after having been edited by the user, does not conform to the constraints set by the element's type attribute. if the type attribute expects specific strings, such as the email and url types and the value don't doesn't conform to the constraints set by the type, the typemismatch property will be true. the email input type expects one or more valid email addresses, depending on whether the multiple attribute is present. a valid email address includes an email prefix and a domain, with or without a top level domain. ...
... the url input type expects one or more valid email urls, depending on whether the multiple attribute is present. ...
...tring, a single valid e-mail address, or one or more comma separated email address if the multiple attribute is present, there is a typemismatch. the url input type expects one or more valid email urls, depending on whether the multiple attribute is present. a valid url includes a protocol, optionally with an ip address, or an optional subdomain, domain, and top level domain combination. ...
...And 5 more matches
WebGLRenderingContext.stencilOp() - Web APIs
the webglrenderingcontext.stencilop() method of the webgl api sets both the front and back-facing stencil test actions. syntax void gl.stencilop(fail, zfail, zpass); parameters all three parameters accept all constants listed below. fail a glenum specifying the function to use when the stencil test fails. the default value is gl.keep. zfail a glenum specifying the function to use when the stencil test passes, but the depth test fails. the default value is gl.keep. zpass a glenum specifying the function to use when both the stencil test and the depth test pass, or when the stencil test passes and there is no depth buffer or depth testing is disabled. the default value is gl.keep. return value none. constants gl.keep keeps the current value. gl.zero sets the stencil buffer...
...encil test passes, but the depth test fails. the default value is gl.keep. zpass a glenum specifying the function to use when both the stencil test and the depth test pass, or when the stencil test passes and there is no depth buffer or depth testing is disabled. the default value is gl.keep. return value none. constants gl.keep keeps the current value. gl.zero sets the stencil buffer value to 0. gl.replace sets the stencil buffer value to the reference value as specified by webglrenderingcontext.stencilfunc(). gl.incr increments the current stencil buffer value. clamps to the maximum representable unsigned value. gl.incr_wrap increments the current stencil buffer value. wraps stencil buffer value to zero when incrementing the maximum representable unsigned value. gl.decr de...
... examples the stencil testing is disabled by default. ...
...And 5 more matches
WebGLRenderingContext.texImage2D() - Web APIs
lformat, width, height, border, format, type, imagebitmap source); void gl.teximage2d(target, level, internalformat, width, height, border, format, type, imagedata source); void gl.teximage2d(target, level, internalformat, width, height, border, format, type, arraybufferview srcdata, srcoffset); parameters target a glenum specifying the binding point (target) of the active texture. possible values: gl.texture_2d: a two-dimensional texture. gl.texture_cube_map_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-mapped texture. gl.texture_cube_map_negative_y: negative y face for a cube-mapped texture. gl.texture_cube_map_positive_z: positive ...
...ace for a cube-mapped texture. gl.texture_cube_map_positive_z: positive z face for a cube-mapped texture. gl.texture_cube_map_negative_z: negative z face for a cube-mapped 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. internalformat a glenum specifying the color components in the texture. ...
... 4 rgb unsigned_byte 3 3 rgba unsigned_short_4_4_4_4 4 2 rgba unsigned_short_5_5_5_1 4 2 rgb unsigned_short_5_6_5 3 2 luminance_alpha unsigned_byte 2 2 luminance unsigned_byte 1 1 alpha unsigned_byte 1 1 other possible values in webgl2 for the versions of teximage2d that take an arraybufferview or a glintptr offset sized format base format r bits g bits b bits a bits shared bits color renderable texture filterable r8 red 8 ● ● r8_snorm red s8 ● rg8 r...
...And 5 more matches
WebGLRenderingContext.uniform[1234][fi][v]() - Web APIs
the webglrenderingcontext.uniform[1234][fi][v]() methods of the webgl api specify values of uniform variables. all active uniform variables defined in a program object are initialized to 0 when the program object is linked successfully. they retain the values assigned to them by a call to this method until the next successful link operation occurs on the program object, when they are once again initialized to 0. many of the functions described here have expanded webgl 2 interfaces, which can be found under webgl2renderingcontext.uniform[1234][uif][v](). ...
...y. they retain the values assigned to them by a call to this method until the next successful link operation occurs on the program object, when they are once again initialized to 0. many of the functions described here have expanded webgl 2 interfaces, which can be found under webgl2renderingcontext.uniform[1234][uif][v](). ...
...til the next successful link operation occurs on the program object, when they are once again initialized to 0. many of the functions described here have expanded webgl 2 interfaces, which can be found under webgl2renderingcontext.uniform[1234][uif][v](). ...
...And 5 more matches
Geometry and reference spaces in WebXR - Web APIs
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 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 desig...
...djust 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 angles. const radians_per_degree = math.pi / 180.0; let degreestoradians = (deg) => deg * radians_per_degree; let radianstodegrees = (rad) => rad / radians_per_degree; times and durations note that for securit...
...radianstodegrees = (rad) => rad / radians_per_degree; times and durations note that for security reasons, domhighrestimestamp usually introduces a small amount of imprecision to the clock in order to prevent it from being used in fingerprinting and timing-based attacks. all times and durations in webxr are measured using the domhighrestimestamp type, which is a double-precision floating-point value specifying the time in milliseconds relative to the starting time. since the value is a floating-point number, it may be accurate to well better than the millisecond level, depending on the platform and hardware. time is primarily used to determine the amount of time that's elapsed since the scene's previous animation frame was drawn. as such the time is typically in alignment with the refresh r...
...And 5 more matches
Using IIR filters - Web APIs
rovides a play/pause button that starts and pauses audio play, and a toggle that turns an iir filter on and off, altering the tone of the sound. it also provides a canvas on which is drawn the frequency response of the audio, so you can see what effect the iir filter has. you can check out the full demo here on codepen. also see the source code on github. it includes some different coefficient values for different lowpass frequencies — you can change the value of the filternumber constant to a value between 0 and 3 to check out the different available effects. browser support iir filters are supported well across modern browsers, although they have been implemented more recently than some of the more longstanding web audio api features, like biquad filters. the iirfilternode the web au...
...filter node is useful — you can create your own if none of the alaready available settings is right for what you want. as well as this, if your audio graph needed a highpass and a bandpass filter within it, you could just use one iir filter node in place of the two biquad filter nodes you would otherwise need for this. with the iirfilter node it's up to you to set what feedforward and feedback values the filter needs — this determines the characteristics of the filter. the downside is that this involves some complex maths. if you are looking to learn more there's some information about the maths behind iir filters here. this enters the realms of signal processing theory — don't worry if you look at it and feel like it's not for you. if you want to play with the iir filter node and need...
...filter needs — this determines the characteristics of the filter. the downside is that this involves some complex maths. if you are looking to learn more there's some information about the maths behind iir filters here. this enters the realms of signal processing theory — don't worry if you look at it and feel like it's not for you. if you want to play with the iir filter node and need some values to help along the way, there's a table of already calculated values here; on pages 4 & 5 of the linked pdf the an values refer to the feedforward values and the bn values refer to the feedback. musicdsp.org is also a great resource if you want to read more about different filters and how they are implemented digitally. with that all in mind, let's take a look at the code to create an iir filter...
...And 5 more matches
Window.getComputedStyle() - Web APIs
syntax var style = window.getcomputedstyle(element [, pseudoelt]); element the element for which to get the computed style. pseudoeltoptional a string specifying the pseudo-element to match. omitted (or null) for real elements. the returned style is a live cssstyledeclaration object, which updates automatically when the element's styles are changed. ...
...e(), and print them into the text content of the <p>. html <p>hello</p> css p { width: 400px; margin: 0 auto; padding: 20px; font: 2rem/2 sans-serif; text-align: center; background: purple; color: white; } javascript let para = document.queryselector('p'); let compstyles = window.getcomputedstyle(para); para.textcontent = 'my computed font-size is ' + compstyles.getpropertyvalue('font-size') + ',\nand my computed line-height is ' + compstyles.getpropertyvalue('line-height') + '.'; result description the returned object is the same cssstyledeclaration type as the object returned from the element's style property. however, the two objects have different purposes: the object from getcomputedstyle is read-only, and should be used to inspect the element's ...
...rker, ::line-marker — see the pseudo-element spec). ...
...And 5 more matches
window.postMessage() - Web APIs
ive the message. methods for obtaining such a reference include: window.open (to spawn a new window and then reference it), window.opener (to reference the window that spawned this one), htmliframeelement.contentwindow (to reference an embedded <iframe> from its parent window), window.parent (to reference the parent window from within an embedded <iframe>), or window.frames + an index value (named or numeric). message data to be sent to the other window. the data is serialized using the structured clone algorithm. this means you can pass a broad variety of data objects safely to the destination window without having to serialize them yourself. [1] targetorigin specifies what the origin of targetwindow must be for the event to be dispatched, either as the literal string "*" (...
...site can change the location of the window without your knowledge, and therefore it can intercept the data sent using postmessage. secure shared memory messaging if postmessage() throws when used with sharedarraybuffer objects, you might need to make sure you cross-site isolated your site properly. ...
...pt the data sent using postmessage. secure shared memory messaging if postmessage() throws when used with sharedarraybuffer objects, you might need to make sure you cross-site isolated your site properly. ...
...And 5 more matches
XRWebGLLayerInit - Web APIs
ons when creating a new xrwebgllayer object with the xrwebgllayer() constructor. the constructor's optional layerinit parameter takes an object which must conform to this dictionary. properties alpha optional the frame buffer's color buffer will be established with an alpha channel if the alpha boolean property is true. otherwise, the color buffer will not have an alpha channel. ...
...th the xrwebgllayer() constructor. the constructor's optional layerinit parameter takes an object which must conform to this dictionary. properties alpha optional the frame buffer's color buffer will be established with an alpha channel if the alpha boolean property is true. otherwise, the color buffer will not have an alpha channel. the default value is true. antialias optional a boolean value which is true if anti-aliasing is to be used when rendering in the context; otherwise false. the browser selects the anti-aliasing method to use; there is no support for requesting a specific mode yet. the default value is true. depth optional a boolean value which, if true, requests that the new layer have a depth buffer; otherwise, no depth layer is allocated. the default is true. framebuff...
...used when rendering in the context; otherwise false. the browser selects the anti-aliasing method to use; there is no support for requesting a specific mode yet. the default value is true. depth optional a boolean value which, if true, requests that the new layer have a depth buffer; otherwise, no depth layer is allocated. the default is true. framebufferscalefactor optional a floating-point value which is used to scale the image during compositing, with a value of 1.0 represents the default pixel size for the frame buffer. ...
...And 5 more matches
Web Accessibility: Understanding Colors and Luminance - Accessibility
important to get right. for example, "saturation" is known as "chroma" in some circles. in others, "chroma" and "saturation" are two different concepts. the "l" in the hsl color space is sometimes referred to as "luminosity," other times as "lightness." even something seemingly simple like naming common colors can be open to debate. for example, the color "crimson red" may be described in hex values as #990000 by some and #dc143c by others. for the purposes of this document, we'll use terminlogy as it is defined in the w3c, in the css color module level 3 when working with color, it's important to know which "color space" you are working in, as different color spaces map to different measurement systems. currently, the rgb color space predominates as the space web developers work in. hex...
...werful presence today. this is evolving, and new methods for measuring color involve measurements using other color spaces, but color measurements in the rgb color space still predominates, and this includes video production. the rgb color model is extended to include “alpha” -- rgba -- to allow specification of the opacity of a color. there's movement towards adopting the use of hsl color values rather than rgb values is css color module 3 (see section 4.2.4), the rationale being that rgb is hardware-oriented, reflecting the use of crts, and that rgb is non-intuitive. that said, hsl colors incorporate lightness, not luminance, and this is a significant consideration. note that in that same section of the css color module 3, there are algorigthms available to translate the hsl to rgb. ...
... color space. for example, variations of the rgb color space include rgb, srgb, adobe rgb, adobe wide gamut rgb, and rgba, among others and, one color within the same color space may be expressed in different ways. looking at how the rgb color space is used to describe a color "red", you can see that the same color may be expressed in a shorthand, three-digit hex number that converts to a rgb value, as a full six-digit hex number that also converts to the same rgb value, or as a rgba value, expressed in percentages. em { color: #f00; } /* #rgb */ em { color: #ff0000; } /* #rrggbb */ em { color: #ff0000ff; } /* #rrggbbaa */ em { color: rgb(255, 0, 0); } em { color: rgb(100%, 0%, 0%); } em { color: rgb(255, 0, 0, 1); } em { color: rgba(100%, 0%, 0%, 100%); } ...
...And 5 more matches
-webkit-tap-highlight-color - CSS: Cascading Style Sheets
ebkit-tap-highlight-color is a non-standard css property that sets the color of the highlight that appears over a link while it's being tapped. the highlighting indicates to the user that their tap is being successfully recognized, and indicates which element they're tapping on. ...
...ht-color is a non-standard css property that sets the color of the highlight that appears over a link while it's being tapped. the highlighting indicates to the user that their tap is being successfully recognized, and indicates which element they're tapping on. -webkit-tap-highlight-color: red; -webkit-tap-highlight-color: transparent; /* for removing the highlight */ syntax values a <color value>. ...
...rty that sets the color of the highlight that appears over a link while it's being tapped. the highlighting indicates to the user that their tap is being successfully recognized, and indicates which element they're tapping on. -webkit-tap-highlight-color: red; -webkit-tap-highlight-color: transparent; /* for removing the highlight */ syntax values a <color value>. ...
...And 5 more matches
-webkit-text-fill-color - CSS: Cascading Style Sheets
the -webkit-text-fill-color css property specifies the fill color of characters of text. if this property is not set, the value of the color property is used. /* <color> values */ -webkit-text-fill-color: red; -webkit-text-fill-color: #000000; -webkit-text-fill-color: rgb(100, 200, 0); /* global values */ -webkit-text-fill-color: inherit; -webkit-text-fill-color: initial; -webkit-text-fill-color: unset; syntax values <color> the foreground fill color of the element's text content. ...
...lue of the color property is used. /* <color> values */ -webkit-text-fill-color: red; -webkit-text-fill-color: #000000; -webkit-text-fill-color: rgb(100, 200, 0); /* global values */ -webkit-text-fill-color: inherit; -webkit-text-fill-color: initial; -webkit-text-fill-color: unset; syntax values <color> the foreground fill color of the element's text content. ...
...bkit-text-fill-color: red; -webkit-text-fill-color: #000000; -webkit-text-fill-color: rgb(100, 200, 0); /* global values */ -webkit-text-fill-color: inherit; -webkit-text-fill-color: initial; -webkit-text-fill-color: unset; syntax values <color> the foreground fill color of the element's text content. ...
...And 5 more matches
range - CSS: Cascading Style Sheets
when defining custom counter styles, the range descriptor lets the author specify a range of counter values over which the style is applied. if a counter value is outside the specified range, then the fallback style will be used to construct the representation of that marker. syntax /* keyword value */ range: auto; /* range values */ range: 2 5; range: infinite 10; range: 6 infinite; range: infinite infinite; /* multiple range values */ range: 2 5, 8 10; range: infinite 6, 10 infinite; values auto the range depends on the counter system: for cyclic, numeric, and fixed systems, the range is negative infinity to positive infinity. for alphabetic and symbolic systems, the range is 1 to positive infinity. for additive systems, the range is 0 to positive infinity. for extends sy...
...positive infinity. for additive systems, the range is 0 to positive infinity. for extends systems, the range is whatever auto would produce for the extended system; if extending a complex predefined style (§7 complex predefined counter styles), the range is the style’s defined range. [ [ | infinite ]{2} ]# defines a comma-separated list of ranges. for each individual range, the first value is the lower bound and the second value is the upper bound. a range is inclusive, that means it always contains both, the lower and upper bound numbers. if infinite is used as the first value in a range, it represents negative infinity; if it is used as the second value, it represents positive infinity. the range of the counter style is the union of all the ranges defined in the list. if the low...
...for alphabetic and symbolic systems, range will be from 1 to positive infinity. ...
...And 5 more matches
suffix - CSS: Cascading Style Sheets
the suffix descriptor of the@counter-style rule specifies content that will be appended to the marker representation. syntax /* <symbol> values */ suffix: ""; suffix: ") "; suffix: url(bullet.png); values <symbol> specifies a <symbol> that is appended to the marker representation. it may be a <string>, <image>, or <custom-ident>. formal definition related at-rule@counter-styleinitial value". ...
...specifies content that will be appended to the marker representation. syntax /* <symbol> values */ suffix: ""; suffix: ") "; suffix: url(bullet.png); values <symbol> specifies a <symbol> that is appended to the marker representation. it may be a <string>, <image>, or <custom-ident>. formal definition related at-rule@counter-styleinitial value". ...
...[ <image-src>? , <color>? ...
...And 5 more matches
Grid template areas - CSS: Cascading Style Sheets
he grid which you can use alone or in combination with line-based placement. this method involves placing our items using named template areas, and we will find out exactly how this method works. you will see very quickly why we sometimes call this the ascii-art method of grid layout! naming a grid area you have already encountered the grid-area property. this is the property that can take as a value all four of the lines used to position a grid area. .box1 { grid-area: 1 / 1 / 4 / 2; } what we are doing here when defining all four lines, is defining the area by specifying the lines that enclose that area. we can also define an area by giving it a name and then specify the location of that area in the value of the grid-template-areas property. you can choose what you would like to na...
... padding: 1em; color: #d9480f; } <div class="wrapper"> <div class="header">header</div> <div class="sidebar">sidebar</div> <div class="content">content</div> <div class="footer">footer</div> </div> using this method we do not need to specify anything at all on the individual grid items, everything happens on our grid container. we can see the layout described as the value of the grid-template-areas property. leaving a grid cell empty we have completely filled our grid with areas in this example, leaving no white space. however you can leave grid cells empty with this method of layout. to leave a cell empty use the full stop character, '.'. if i want to only display the footer directly under the main content i would need to leave the three cells underneath the si...
...ving the rows and columns neatly aligned. it means that you can actually see, right there in the css, what this layout looks like. spanning multiple cells in our example each of the areas spans multiple grid cells and we achieve this by repeating the name of that grid area multiple times with white space between. you can add extra white space in order to keep your columns neatly lined up in the value of grid-template-areas. you can see that i have done this in order that the hd and ft line up with main. the area that you create by chaining the area names must be rectangular, at this point there is no way to create an l-shaped area. the specification does note that a future level might provide this functionality. you can however span rows just as easily as columns. for example we could make o...
...And 5 more matches
Using CSS gradients - CSS: Cascading Style Sheets
paced-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 being ...
... colors share a color stop at the 50% mark, halfway through the gradient: <div class="striped"></div> div { width: 120px; height: 120px; } .striped { background: linear-gradient(to bottom left, cyan 50%, palegoldenrod 50%); } gradient hints by default, the gradient transitions evenly from one color to the next. you can include a color-hint to move the midpoint of the transition value to a certain point along the gradient. in this example, we've moved the midpoint of the transition from the 50% mark to the 10% mark. <div class="color-hint"></div> <div class="simple-linear"></div> div { width: 120px; height: 120px; float: left; margin-right: 10px; } .color-hint { background: linear-gradient(blue, 10%, pink); } .simple-linear { background: linear-gradient(blue, pink...
...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 the midpoint between lime and cyan 20% of the way through the gradient rather than 50% of the way through. the second example does not contain the hint to hilight the difference the color hint can make: <div class="colorhint-gradient"></div> <div cla...
...And 5 more matches
Using CSS counters - CSS: Cascading Style Sheets
css counters let you adjust the appearance of content based on its location in a document. for example, you can use counters to automatically number the headings in a webpage. counters are, in essence, variables maintained by css whose values may be incremented by css rules to track how many times they're used. using counters manipulating a counter's value to use a css counter, it must first be initialized to a value with the counter-reset property (0 by default). the same property can also be used to change its value to any specific number. ...
...ers are, in essence, variables maintained by css whose values may be incremented by css rules to track how many times they're used. using counters manipulating a counter's value to use a css counter, it must first be initialized to a value with the counter-reset property (0 by default). the same property can also be used to change its value to any specific number. once initialized, a counter's value can be increased or decreased with counter-increment. the counter's name must not be "none", "inherit", or "initial"; otherwise the declaration is ignored. displaying a counter the value of a counter can be displayed using either the counter() or counters() function in a content property. the counter() function has two forms: 'counter(name)' or 'counter(name, style)'. the generated text is the...
...can be increased or decreased with counter-increment. the counter's name must not be "none", "inherit", or "initial"; otherwise the declaration is ignored. displaying a counter the value of a counter can be displayed using either the counter() or counters() function in a content property. the counter() function has two forms: 'counter(name)' or 'counter(name, style)'. the generated text is the value of the innermost counter of the given name in scope at the given pseudo-element.the counter is rendered in the specified style (decimal by default). ...
...And 5 more matches
The stacking context - CSS: Cascading Style Sheets
ng context is a three-dimensional conceptualization of html elements along an imaginary z-axis relative to the user, who is assumed to be facing the viewport or the webpage. html elements occupy this space in priority order based on element attributes. the stacking context in the previous part of this article, using z-index, the rendering order of certain elements is influenced by their z-index value. ...
... the previous part of this article, using z-index, the rendering order of certain elements is influenced by their z-index value. this occurs because these elements have special properties which cause them to form a stacking context. a stacking context is formed, anywhere in the document, by any element in the following scenarios: root element of the document (<html>). element with a position value absolute or relative and z-index value other than auto. element with a position value fixed or sticky (sticky for all mobile browsers, but not older desktop). element that is a child of a flex (flexbox) container, with z-index value other than auto. ...
...enarios: root element of the document (<html>). element with a position value absolute or relative and z-index value other than auto. element with a position value fixed or sticky (sticky for all mobile browsers, but not older desktop). element that is a child of a flex (flexbox) container, with z-index value other than auto. element that is a child of a grid (grid) container, with z-index value other than auto. element with a opacity value less than 1 (see the specification for opacity). element with a mix-blend-mode value other than normal. element with any of the following properties with value other than none: transform filter perspective clip-path mask / mask-image / mask-border element with a isolation value isolate. element with a -webkit-overflow-scrol...
...And 5 more matches
Using CSS transitions - CSS: Cascading Style Sheets
the end). which css properties can be transitioned? the web author can define which property has to be animated and in which way. this allows the creation of complex transitions. as it doesn't make sense to animate some properties, the list of animatable properties is limited to a finite set. note: the set of properties that can be animated is changing as the specification develops. the auto value is often a very complex case. the specification recommends not animating from and to auto. some user agents, like those based on gecko, implement this requirement and others, like those based on webkit, are less strict. using animations with auto may lead to unpredictable results, depending on the browser and its version, and should be avoided. defining transitions css transitions are controlle...
...y specifies the name or names of the css properties to which transitions should be applied. only properties listed here are animated during transitions; changes to all other properties occur instantaneously as usual. transition-duration specifies the duration over which transitions should occur. you can specify a single duration that applies to all properties during the transition, or multiple values to allow each property to transition over a different period of time. transition-duration: 0.5s <div class="parent"> <div class="box">lorem</div> </div> .parent { width: 250px; height:125px;} .box { width: 100px; height: 100px; background-color: red; font-size: 20px; left: 0px; top: 0px; position:absolute; -webkit-transition-property: width height...
...most timing functions can be specified by providing the graph of the corresponding function, as defined by four points defining a cubic bezier. you can also choose easing from easing functions cheat sheet. transition-timing-function: ease <div class="parent"> <div class="...
...And 5 more matches
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" maxlength=6 id="x1" value="0.79" class='field'> <label for="y1">y1 = </label><input onchange="updatecanvas();return true;" type="text" maxlength=6 id="y1" value="0.33" class='field'> <label for="x2">x2 = </label><input onchange="updatecanvas();return true;" type="text" maxlength=6 id="x2" value="0.14" class='field'> <label for="y2">y2 = </label><input onchange="updatecanvas();return true;" type="text" maxlength=6 id="y2" value="0.53" class='field'> <br> <output id="output">log</output> </form> </html> .field { width: 40px; } function updatecanvas() { var x1 = ...
...turn true;" type="text" maxlength=6 id="x2" value="0.14" class='field'> <label for="y2">y2 = </label><input onchange="updatecanvas();return true;" type="text" maxlength=6 id="y2" value="0.53" class='field'> <br> <output id="output">log</output> </form> </html> .field { width: 40px; } function updatecanvas() { var x1 = document.getelementbyid('x1').value; var y1 = document.getelementbyid('y1').value; var x2 = document.getelementbyid('x2').value; var y2 = document.getelementbyid('y2').value; drawbeziercurve(x1, y1, x2, y2); } const radius = 4; // place needed to draw the rulers const rulers = 30.5; const margin = 10.5; const basic_scale_size = 5; // size of 0.1 tick on the rulers var scaling; //limitation: scaling is computed onc...
... * basic_scale_size + cx(0), cy(i) + 4); // limitation the constant 4 should be font size dependant } ctx.lineto(cx(0), ly(i)); } ctx.stroke(); ctx.closepath(); ctx.beginpath(); // draw the y axis label ctx.save(); ctx.rotate(-math.pi / 2); ctx.textalign = "left"; ctx.filltext("output (value ratio)", -cy(0), -3 * basic_scale_size + cx(0)); ctx.restore(); // draw the x axis ctx.moveto(cx(0), cy(0)); ctx.lineto(cx(0), cy(1)); ctx.textalign = "center"; for (i = 0.1; i <= 1; i = i + 0.1) { ctx.moveto(lx(i), basic_scale_size + cy(0)); if ((i == 0.5) || (i > 0.9)) { ctx.moveto(lx(i), 2 * basic_scale_si...
...And 5 more matches
animation - CSS: Cascading Style Sheets
Web › CSS › animation
and for the following css properties: animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function syntax the animation property is specified as one or more single animations, separated by commas. ...
...commas. each individual animation is specified as: zero or one occurrences of the following values: <single-transition-timing-function> <single-animation-iteration-count> <single-animation-direction> <single-animation-fill-mode> <single-animation-play-state> an optional name for the animation, which may be none, a <custom-ident>, or a <string> zero, one, or two <time> values the order of values within each animation definition is important: the first value that can be parsed as a <time> is assigned to the animation-duration, and the second one is assigned to animation-delay. the order within each animation definition is also important for distinguishing animation-name values from other keywords. when parsed, keywords that are valid for properties other than anima...
...es within each animation definition is important: the first value that can be parsed as a <time> is assigned to the animation-duration, and the second one is assigned to animation-delay. the order within each animation definition is also important for distinguishing animation-name values from other keywords. when parsed, keywords that are valid for properties other than animation-name, and whose values were not found earlier in the shorthand, must be accepted for those properties rather than for animation-name. furthermore, when serialized, default values of other properties must be output in at least the cases necessary to distinguish an animation-name that could be a value of another property, and may be output in additional cases. ...
...And 5 more matches
backdrop-filter - CSS: Cascading Style Sheets
the backdrop-filter css property lets you apply graphical effects such as blurring or color shifting to the area behind an element. because it applies to everything behind the element, to see the effect you must make the element or its background at least partially transparent. ...
...r css property lets you apply graphical effects such as blurring or color shifting to the area behind an element. because it applies to everything behind the element, to see the effect you must make the element or its background at least partially transparent. ...
...filter: brightness(60%); backdrop-filter: contrast(40%); backdrop-filter: drop-shadow(4px 4px 10px blue); backdrop-filter: grayscale(30%); backdrop-filter: hue-rotate(120deg); backdrop-filter: invert(70%); backdrop-filter: opacity(20%); backdrop-filter: sepia(90%); backdrop-filter: saturate(80%); /* multiple filters */ backdrop-filter: url(filters.svg#filter) blur(4px) saturate(150%); /* global values */ backdrop-filter: inherit; backdrop-filter: initial; backdrop-filter: unset; syntax values none no filter is applied to the backdrop. <filter-function-list> a space-separated list of <filter-function>s or an svg filter that will be applied to the backdrop. formal definition initial valuenoneapplies toall elements; in svg, it applies to container elements excluding the defs element ...
...And 5 more matches
border-image-slice - CSS: Cascading Style Sheets
set properties determine how these regions are used to form the final border image. syntax /* all sides */ border-image-slice: 30%; /* vertical | horizontal */ border-image-slice: 10% 30%; /* top | horizontal | bottom */ border-image-slice: 30 30% 45; /* top | right | bottom | left */ border-image-slice: 7 12 14 5; /* using the `fill` keyword */ border-image-slice: 10% fill 7 12; /* global values */ border-image-slice: inherit; border-image-slice: initial; border-image-slice: unset; the border-image-slice property may be specified using one to four <number-percentage> values to represent the position of each image slice. negative values are invalid; values greater than their corresponding dimension are clamped to 100%. when one position is specified, it creates all four slices at th...
... the border-image-slice property may be specified using one to four <number-percentage> values to represent the position of each image slice. negative values are invalid; values greater than their corresponding dimension are clamped to 100%. when one position is specified, it creates all four slices at the same distance from their respective sides. when two positions are specified, the first value creates slices measured from the top and bottom, the second creates slices measured from the left and right. when three positions are specified, the first value creates a slice measured from the top, the second creates slices measured from the left and right, the third creates a slice measured from the bottom. when four positions are specified, they create slices measured from the top, right, b...
...eates slices measured from the left and right. when three positions are specified, the first value creates a slice measured from the top, the second creates slices measured from the left and right, the third creates a slice measured from the bottom. when four positions are specified, they create slices measured from the top, right, bottom, and left in that order (clockwise). the optional fill value, if used, can be placed anywhere in the declaration. values <number> represents an edge offset in pixels for raster images and coordinates for vector images. for vector images, the number is relative to the element's size, not the size of the source image, so percentages are generally preferable in these cases. <percentage> represents an edge offset as a percentage of the source image's si...
...And 5 more matches
border-image - CSS: Cascading Style Sheets
see border-image-slice. <'border-image-wi...
...e | repeat */ border-image: url("/images/border.png") 27 space; /* source | slice | width */ border-image: linear-gradient(red, blue) 27 / 35px; /* source | slice | width | outset | repeat */ border-image: url("/images/border.png") 27 23 / 50px 30px / 1rem round space; the border-image property may be specified with anywhere from one to five of the values listed below. note: if the computed value of border-image-source is none, or if the image cannot be displayed, the border-style will be displayed instead. values <'border-image-source'> the source image. see border-image-source. <'border-image-slice'> the dimensions for slicing the source image into regions. up to four values may be specified. see border-image-slice. <'border-image-width'> the width of the border image. up to f...
...border-image-source is none, or if the image cannot be displayed, the border-style will be displayed instead. values <'border-image-source'> the source image. see border-image-source. <'border-image-slice'> the dimensions for slicing the source image into regions. up to four values may be specified. see border-image-slice. <'border-image-width'> the width of the border image. up to four values may be specified. see border-image-width. <'border-image-outset'> the distance of the border image from the element's outside edge. up to four values may be specified. see border-image-outset. <'border-image-repeat'> defines how the edge regions of the source image are adjusted to fit the dimensions of the border image. up to two values may be specified. see border-image-repeat. accessibil...
...And 5 more matches
border-left - CSS: Cascading Style Sheets
the border-left shorthand css property set an element's left border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. as with all shorthand properties, border-left always sets the values of all of the properties that it can set, even if they are not specified. ...
...teractive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. as with all shorthand properties, border-left always sets the values of all of the properties that it can set, even if they are not specified. it sets those that are not specified to their default values. this means that ... border-left-style: dotted; border-left: thick green; ... is actually the same as ... border-left-style: dotted; border-left: none thick green; ... and the value of border-left-style given before border-left is ignored. since the default value of border-left-style is none, not specifying the border-style part results in no border. constituent properties this property ...
...yle given before border-left is ignored. since the default value of border-left-style is none, not specifying the border-style part results in no border. constituent properties this property is a shorthand for the following css properties: border-left-color border-left-style border-left-width syntax border-left: 1px; border-left: 2px dotted; border-left: medium dashed green; the three values of the shorthand property can be specified in any order, and one or two of them may be omitted. values <br-width> see border-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. it also...
...And 5 more matches
border-right - CSS: Cascading Style Sheets
the border-right shorthand css property sets the properties of an element's right border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...eractive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. as with all shorthand properties, border-right always sets the values of all of the properties that it can set, even if they are not specified. it sets those that are not specified to their default values. this means that ... border-right-style: dotted; border-right: thick green; ... is actually the same as ... border-right-style: dotted; border-right: none thick green; ... and the value of border-right-style given before border-right is ignored. since the default value of border-right-style is none, not specifying the border-style part results in no border. constituent properties this pr...
...n before border-right is ignored. since the default value of border-right-style is none, not specifying the border-style part results in no border. constituent properties this property is a shorthand for the following css properties: border-right-color border-right-style border-right-width syntax border-right: 1px; border-right: 2px dotted; border-right: medium dashed green; the three values of the shorthand property can be specified in any order, and one or two of them may be omitted. values <br-width> see border-right-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. i...
...And 5 more matches
border-top - CSS: Cascading Style Sheets
the border-top shorthand css property sets all the properties of an element's top border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...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. as with all shorthand properties, border-top always sets the values of all of the properties that it can set, even if they are not specified. it sets those that are not specified to their default values. this means that ... border-top-style: dotted; border-top: thick green; ... is actually the same as ... border-top-style: dotted; border-top: none thick green; ... and the value of border-top-style given before border-top is ignored. since the default value of border-top-style is none, not specifying the border-style part results in no border. constituent properties this property is a sh...
...r-top-style given before border-top is ignored. since the default value of border-top-style is none, not specifying the border-style part results in no border. constituent properties this property is a shorthand for the following css properties: border-top-color border-top-style border-top-width syntax border-top: 1px; border-top: 2px dotted; border-top: medium dashed green; the three values of the shorthand property can be specified in any order, and one or two of them may be omitted. values <br-width> 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. it also appli...
...And 5 more matches
box-lines - CSS: Cascading Style Sheets
Web › CSS › box-lines
this is a property of the original css flexible box layout module draft, and has been replaced by a newer standard. see flexbox for information about the current standard. the box-lines css property determines whether the box may have a single or multiple lines (rows for horizontally oriented boxes, columns for vertically oriented boxes). ...
...ty of the original css flexible box layout module draft, and has been replaced by a newer standard. see flexbox for information about the current standard. the box-lines css property determines whether the box may have a single or multiple lines (rows for horizontally oriented boxes, columns for vertically oriented boxes). ...
...ed boxes, columns for vertically oriented boxes). /* keyword values */ box-lines: single; box-lines: multiple; /* global values */ box-lines: inherit; box-lines: initial; box-lines: unset; by default a horizontal box will lay out its children in a single row, and a vertical box will lay out its children in a single column. this behavior can be changed using the box-lines property. the default value is single, which means that all elements will be placed in a single row or column, and any elements that don't fit will simply be considered overflow. if a value of multiple is specified, however, then the box is allowed to expand to multiple lines (that is, multiple rows or columns) in order to accommodate all of its children. the box must attempt to fit its children on as few lines as possible...
...And 5 more matches
calc() - CSS: Cascading Style Sheets
Web › CSS › calc
the calc() css function lets you perform calculations when specifying css property values. it can be used anywhere a <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> is allowed. the source for this interactive example is stored in a github repository. if 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. the expression can be any simple expression combining the following operators, using standard operator precedence rules: + addition. - subtraction. * multiplication. at least one of ...
...you may also use parentheses to establish computation order when needed. notes the + and - operators must be surrounded by whitespace. ...
...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. ...
...And 5 more matches
<filter-function> - CSS: Cascading Style Sheets
invert() inverts the colors of the image. opacity() makes the image transparent. saturate() super-saturates or desaturates the input image. sepia() converts the image to sepia. examples filter function comparison this example provides a simple graphic, along with a select menu to allow you to choose between the different types of filter function, and a slider to allow you to vary the values used inside the filter function. updating the controls updates the filter effect in real time, allowing you to investigate the effects of different filters. html <div></div> <ul> <li> <label for="filter-select">choose a filter function:</label> <select id="filter-select"> <option selected>blur</option> <option>brightness</option> <option>contrast</option> <opt...
.../option> <option>brightness</option> <option>contrast</option> <option>drop-shadow</option> <option>grayscale</option> <option>hue-rotate</option> <option>invert</option> <option>opacity</option> <option>saturate</option> <option>sepia</option> </select> </li> <li> <input type="range"><output></output> </li> <li> <p>current value: <code></code></p> </li> </ul> css div { width: 300px; height: 300px; background: url(https://media.prod.mdn.mozit.cloud/attachments/2020/07/29/17350/3b4892b7e820122ac6dd7678891d4507/firefox.png) no-repeat center; } li { display: flex; align-items: center; justify-content: center; margin-bottom: 20px; } input { width: 60% } output { width: 5%; text-align: center; } sel...
...ms: center; justify-content: center; margin-bottom: 20px; } input { width: 60% } output { width: 5%; text-align: center; } select { width: 40%; margin-left: 2px; } javascript const selectelem = document.queryselector('select'); const divelem = document.queryselector('div'); const slider = document.queryselector('input'); const output = document.queryselector('output'); const curvalue = document.queryselector('p code'); selectelem.addeventlistener('change', () => { setslider(selectelem.value); setdiv(selectelem.value); }); slider.addeventlistener('input', () => { setdiv(selectelem.value); }); function setslider(filter) { if(filter === 'blur') { slider.value = 0; slider.min = 0; slider.max = 30; slider.step = 1; slider.setattribute('data-unit', 'p...
...And 5 more matches
float - CSS: Cascading Style Sheets
Web › CSS › float
is removed from the normal flow of the page, though still remaining a part of the flow (in contrast to absolute positioning). the source for this interactive example is stored in a github repository. if 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 absolute positioning). the source for this interactive example is stored in a github repository. if 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 floating element is one where the computed value of float is not none. ...
...ing). the source for this interactive example is stored in a github repository. if 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 floating element is one where the computed value of float is not none. ...
...And 5 more matches
grid-column-end - CSS: Cascading Style Sheets
in the grid column by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the block-end edge of its grid 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. ...
...or nothing (automatic) to its grid placement, thereby specifying the block-end edge of its grid 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. ...
...ck-end edge of its grid 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. ...
...And 5 more matches
grid-column - CSS: Cascading Style Sheets
r this interactive example is stored in a github repository. if 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 stored in a github repository. if 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: grid-column-end grid-column-start syntax this property is specified as one or two <grid-line> values. ...
...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: grid-column-end grid-column-start syntax this property is specified as one or two <grid-line> values. if two <grid-line> values are given they are separated by "/". the grid-column-start longhand is set to the value before the slash, and the grid-column-end longhand is set to the value after the slash. ...
...And 5 more matches
grid-row-end - CSS: Cascading Style Sheets
thin the grid row by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the inline-end edge of its grid 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. ...
..., or nothing (automatic) to its grid placement, thereby specifying the inline-end edge of its grid 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. ...
...e inline-end edge of its grid 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. ...
...And 5 more matches
grid-template - 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. ...
... you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ns grid-template-rows syntax /* keyword value */ grid-template: none; /* grid-template-rows / grid-template-columns values */ grid-template: 100px 1fr / 50px 1fr; grid-template: auto 1fr / auto 1fr auto; grid-template: [linename] 100px / [columnname1] 30% [columnname2] 70%; grid-template: fit-content(100px) / fit-content(40%); /* grid-template-areas grid-template-rows / grid-template-column values */ grid-template: "a a a" "b b b"; grid-template: "a a a" 20% "b b b" auto; grid-template: [header-top] "a a a" [header-bottom] [main-top] "b b b" 1fr [main-bottom] / auto 1fr auto; /* global values */ grid-template: inherit; grid-template: initial; grid-template: unset; values none is a keyword that sets all t...
...And 5 more matches
image() - CSS: Cascading Style Sheets
f the specified images are able to be rendered. disambiguation: image(), the htmlimageelement constructor. ...
...ered. disambiguation: image(), the htmlimageelement constructor. ...
...eelement constructor. ...
...And 5 more matches
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. ...
... 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. ...
...ical 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. ...
...And 5 more matches
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 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. ...
...fsets 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. ...
...And 5 more matches
margin-inline-start - CSS: Cascading Style Sheets
the margin-inline-start css property defines the logical inline start margin of an element, which maps to a physical margin depending on the element's writing mode, directionality, and text orientation. it corresponds 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. ...
...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. ...
...repository. if 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. ...
...And 5 more matches
min-block-size - CSS: Cascading Style Sheets
the min-block-size css property defines the minimum horizontal or vertical size of 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. ...
...ment'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. ...
...he 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. ...
...And 5 more matches
min-inline-size - CSS: Cascading Style Sheets
the min-inline-size css property defines the horizontal or vertical minimal size of 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. ...
...ment'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. ...
... 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. ...
...And 5 more matches
min() - CSS: Cascading Style Sheets
Web › CSS › min
the min() css function lets you set the smallest (most negative) value from a list of comma-separated expressions as the value of a css property value. the min() function can be used anywhere a <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> is allowed. the source for this interactive example is stored in a github repository. if 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 the first above example, the width will be at most 200px, but will be smaller if the viewport is less than 400px wide (in which case 1vw would be 4px, so 50vw would be 200px). in other words, the maximum width is 200px. ...
...itory. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. in the first above example, the width will be at most 200px, but will be smaller if the viewport is less than 400px wide (in which case 1vw would be 4px, so 50vw would be 200px). in other words, the maximum width is 200px. ...
...ute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. in the first above example, the width will be at most 200px, but will be smaller if the viewport is less than 400px wide (in which case 1vw would be 4px, so 50vw would be 200px). in other words, the maximum width is 200px. think of the min() 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...
...And 5 more matches
overflow - CSS: Cascading Style Sheets
Web › CSS › overflow
tting context — in both directions. the source for this interactive example is stored in a github repository. if 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: overflow-x overflow-y syntax /* keyword values */ overflow: visible; overflow: hidden; overflow: clip; overflow: scroll; overflow: auto; overflow: hidden visible; /* global values */ overflow: inherit; overflow: initial; overflow: unset; the overflow property is specified as one or two keywords chosen from the list of values below. if two keywords are specified, the first applies to overflow-x and the second to overflow-y. otherwise, both...
...low: clip; overflow: scroll; overflow: auto; overflow: hidden visible; /* global values */ overflow: inherit; overflow: initial; overflow: unset; the overflow property is specified as one or two keywords chosen from the list of values below. if two keywords are specified, the first applies to overflow-x and the second to overflow-y. otherwise, both overflow-x and overflow-y are set to the same value. values visible content is not clipped and may be rendered outside the padding box. hidden content is clipped if necessary to fit the padding box. no scrollbars are provided, and no support for allowing the user to scroll (such as by dragging or using a scroll wheel) is allowed. ...
... clip like for hidden, the content is clipped to the element's padding box. the difference between clip and hidden is that the clip keyword also forbids all scrolling, including programmatic scrolling. the box is not a scroll container, and does not start a new formatting context. ...
...And 5 more matches
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. ...
...-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. ...
...rty 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. ...
...And 5 more matches
text-emphasis-color - CSS: Cascading Style Sheets
the text-emphasis-color css property sets the color of emphasis marks. this value can also be set using the text-emphasis shorthand. /* initial value */ text-emphasis-color: currentcolor; /* <color> */ text-emphasis-color: #555; text-emphasis-color: blue; text-emphasis-color: rgba(90, 200, 160, 0.8); text-emphasis-color: transparent; /* global values */ text-emphasis-color: inherit; text-emphasis-color: initial; text-emphasis-color: unset; syntax values <color> defines the color of the emphasis marks. if no color is present, it defaults to currentcolor. ...
...> */ text-emphasis-color: #555; text-emphasis-color: blue; text-emphasis-color: rgba(90, 200, 160, 0.8); text-emphasis-color: transparent; /* global values */ text-emphasis-color: inherit; text-emphasis-color: initial; text-emphasis-color: unset; syntax values <color> defines the color of the emphasis marks. if no color is present, it defaults to currentcolor. ...
...text-emphasis-color: rgba(90, 200, 160, 0.8); text-emphasis-color: transparent; /* global values */ text-emphasis-color: inherit; text-emphasis-color: initial; text-emphasis-color: unset; syntax values <color> defines the color of the emphasis marks. if no color is present, it defaults to currentcolor. ...
...And 5 more matches
top - CSS: Cascading Style Sheets
Web › CSS › top
pecifying the vertical 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. the effect of top depends on how the element is positioned (i.e., the value of the position property): when position is set to absolute or fixed, the top property specifies the distance between the element's top edge and the top edge of its containing block. when position is set to relative, the top property specifies the distance the element's top edge is moved below its normal position. when position is set to sticky, the top property is used to compute the sticky...
...tatic, 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 elements, t...
...uto is treated as a height based on the content; or if bottom is also auto, the element is positioned where it should vertically be positioned if it were a static 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. ...
...And 5 more matches
HTML attribute: max - HTML: Hypertext Markup Language
Web › HTML › Attributes › max
the max attribute defines the maximum value that is acceptable and valid for the input containing the attribute. if the value of the element is greater than this, the 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. ...
...e is applied. if the max attribute is valid and a non-empty value is greater than the maximum allowed by the max attribute, constraint validation will prevent form submission. valid for the numeric input types, including the date, month, week, time, datetime-local, number and range types, and both the <progress> and <meter> elements, the max attribute is a number that specifies the most positive value a form control to be considered valid. if the value exceeds the max value allowed, the validitystate.rangeoverflow will be true, and the the control will be matched by the :out-of-range and :invalid pseudo-classes. ...
...e, datetime-local, number and range types, and both the <progress> and <meter> elements, the max attribute is a number that specifies the most positive value a form control to be considered valid. if the value exceeds the max value allowed, the validitystate.rangeoverflow will be true, and the the control will be matched by the :out-of-range and :invalid pseudo-classes. ...
...And 5 more matches
<button>: The Button element - HTML: Hypertext Markup Language
Web › HTML › Element › button
bles this feature; see bug 654072. disabled this boolean attribute prevents the user from interacting with the button: it cannot be pressed or focused. firefox, unlike other browsers, persists the dynamic disabled state of a <button> across page loads. use the autocomplete attribute to control this feature. form html5 the <form> element to associate the button with (its form owner). the value of this attribute must be the id of a <form> in the same document. (if this attribute is not set, the <button> is associated with its ancestor <form> element, if any.) this attribute lets you associate <button> elements to <form>s anywhere in the document, not just inside a <form>. it can also override an ancestor <form> element. formaction html5 the url that processes the information submitte...
...an ancestor <form> element. formaction html5 the url that processes the information submitted by the button. overrides the action attribute of the button's form owner. does nothing if there is no form owner. formenctype html5 if the button is a submit button (it's inside/associated with a <form> and doesn't have type="button"), specifies how to encode the form data that is submitted. possible values: application/x-www-form-urlencoded: the default if the attribute is not used. multipart/form-data: use to submit <input> elements with their type attributes set to file. text/plain: specified as a debugging aid; shouldn’t be used for real form submission. if this attribute is specified, it overrides the enctype attribute of the button's form owner. formmethod html5 if the butto...
...t to file. text/plain: specified as a debugging aid; shouldn’t be used for real form submission. if this attribute is specified, it overrides the enctype attribute of the button's form owner. formmethod html5 if the button is a submit button (it's inside/associated with a <form> and doesn't have type="button"), this attribute specifies the http method used to submit the form. possible values: post: the data from the form are included in the body of the http request when sent to the server. use when the form contains information that shouldn’t be public, like login credentials. get: the form data are appended to the form's action url, with a ? as a separator, and the resulting url is sent to the server. use this method when the form has no side effects, like search forms. ...
...And 5 more matches
<input type="reset"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › reset
<input> elements of type "reset" are rendered as buttons, with a default click event handler that resets all of the inputs in the form to their initial values. the source for this interactive example is stored in a github repository. if 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 should usually avoid including reset buttons in your forms. they're rarely useful, and are instead more likely to frustrate users who click them by mistake (often while trying to click the submit button). ...
...red in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. you should usually avoid including reset buttons in your forms. they're rarely useful, and are instead more likely to frustrate users who click them by mistake (often while trying to click the submit button). ...
...om/mdn/interactive-examples and send us a pull request. you should usually avoid including reset buttons in your forms. they're rarely useful, and are instead more likely to frustrate users who click them by mistake (often while trying to click the submit button). ...
...And 5 more matches
Standard metadata names - HTML: Hypertext Markup Language
Web › HTML › Element › meta › name
standard metadata names defined in the html specification the html specification defines the following set of standard metadata names: application-name: the name of the application running in the web page. note: browsers may use this to identify the application. it is different from the <title> element, which usually contain the application name, but may also contain information like the document name or a status. simple web pages shouldn't define an application-name. ...
...r. description: a short and accurate summary of the content of the page. several browsers, like firefox and opera, use this as the default description of bookmarked pages. generator: the identifier of the software that generated the page. keywords: words relevant to the page's content separated by commas. referrer: controls the http referer header for to requests sent from the document: values for the content attribute of <meta name="referrer"> no-referrer do not send a http referer header. origin send the origin of the document. no-referrer-when-downgrade send the full url when the destination is at least as secure as the current page (http(s)→https), but send no referrer when it's less secure (https→http). this is the de...
...chemes with which the document is compatible. the browser will use this information in tandem with the user's browser or device settings to determine what colors to use for everything from background and foregrounds to form controls and scrollbars. the primary use for <meta name="color-scheme"> is to indicate compatibility with—and order of preference for—light and dark color modes. the value of the content property for color-scheme may be one of the following: normal the document is unaware of color schemes and should simply be rendered using the default color palette. [light | dark]+ one or more color schemes supported by the document. specifying the same color scheme more than once has the same effect as specifying it only once. indicating multiple color schemes ind...
...And 5 more matches
Meta programming - JavaScript
xplanations and examples. handler / trap interceptions invariants handler.getprototypeof() object.getprototypeof() reflect.getprototypeof() __proto__ object.prototype.isprototypeof() instanceof getprototypeof method must return an object or null. ...
...sprototypeof() instanceof getprototypeof method must return an object or null. if target is not extensible, object.getprototypeof(proxy) method must return the same value as object.getprototypeof(target). handler.setprototypeof() object.setprototypeof() reflect.setprototypeof() if target is not extensible, the prototype parameter must be the same value as object.getprototypeof(target). handler.isextensible() object.isextensible() reflect.isextensible() object.isextensible(proxy) must return the same value as object.isextensible(target). handler.preventextensions() object.preventextensions() reflect.preventextensions() object.preventextensions(proxy) only returns true if object.isextensible(proxy) is false. ...
...cannot be added as (or modified to be) non-configurable if it does not exist as a non-configurable own property of target. a property may not be non-configurable if a corresponding configurable property of target exists. if a property has a corresponding target object property, then object.defineproperty(target, prop, descriptor) will not throw an exception. in strict mode, a false value returned from the defineproperty handler will throw a typeerror exception. handler.has() property query foo in proxy inherited property query foo in object.create(proxy) reflect.has() a property cannot be reported as non-existent, if it exists as a non-configurable own property of target. a property cannot be reported...
...And 5 more matches
getter - JavaScript
nd us a pull request. syntax {get prop() { ... } } {get [expression]() { ... } } parameters prop the name of the property to bind to the given function. expression starting with ecmascript 2015, you can also use expressions for a computed property name to bind to the given function. ...
...cription sometimes it is desirable to allow access to a property that returns a dynamically computed value, or you may want to reflect the status of an internal variable without requiring the use of explicit method calls. in javascript, this can be accomplished with the use of a getter. it is not possible to simultaneously have a getter bound to a property and have that property actually hold a value, although it is possible to use a getter and a setter in conjunction to create a type of pseudo-property. note the following when working with the get syntax: it can have an identifier which is either a number or a string; it must have exactly zero parameters (see incompatible es5 change: literal getter and setter functions must now have exactly zero or one arguments for more information); ...
... 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 object later at any time, use object.defineproperty(). const o = {a: 0}; object.defineproperty(o, 'b', { get: function() { return this.a + 1; } });...
...And 5 more matches
Atomics - JavaScript
ule. unlike the other global objects, atomics is not a constructor. you cannot use it with a new operator or invoke the atomics object as a function. all properties and methods of atomics are static (as is the case with the math object, for example). atomic operations when memory is shared, multiple threads can read and write the same data in memory. atomic operations make sure that predictable values are written and read, that operations are finished before the next operation starts and that operations are not interrupted. wait and notify the wait() and notify() methods are modeled on linux futexes ("fast user-space mutex") and provide ways for waiting until a certain condition becomes true and are typically used as blocking constructs. static methods atomics.add() adds the provided v...
...d, that operations are finished before the next operation starts and that operations are not interrupted. wait and notify the wait() and notify() methods are modeled on linux futexes ("fast user-space mutex") and provide ways for waiting until a certain condition becomes true and are typically used as blocking constructs. ...
...tarts and that operations are not interrupted. wait and notify the wait() and notify() methods are modeled on linux futexes ("fast user-space mutex") and provide ways for waiting until a certain condition becomes true and are typically used as blocking constructs. static methods atomics.add() adds the provided value to the existing value at the specified index of the array. returns the old value at that index. atomics.and() computes a bitwise and on the value at the specified index of the array with the provided value. returns the old value at that index. atomics.compareexchange() stores a value at the specified index of the array, if it equals a value. returns the old value. atomics.exchange() stores a value at the specified index of the array. returns the old value. atomics.islo...
...And 5 more matches
Date() constructor - JavaScript
a single moment in time in a platform-independent format. date objects contain a number that represents milliseconds since 1 january 1970 utc. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax new date() new date(value) new date(datestring) new date(year, monthindex [, day [, hours [, minutes [, seconds [, milliseconds]]]]]) note: the only correct way to instantiate a new date object is by using the new operator. if you simply call the date object directly, such as now = date(), the returned value is a string rather than a date object. parameters there are four basic forms for the date() constructor: ...
...e object is by using the new operator. if you simply call the date object directly, such as now = date(), the returned value is a string rather than a date object. parameters there are four basic forms for the date() constructor: no parameters when no parameters are provided, the newly-created date object represents the current date and time as of the time of instantiation. time value or timestamp number value an integer value representing the number of milliseconds since january 1, 1970, 00:00:00 utc (the ecmascript epoch, equivalent to the unix epoch), with leap seconds ignored. ...
...(these formats are ietf-compliant rfc 2822 timestamps, and also strings in a version of iso8601.) note: parsing of date strings with the date constructor (and date.parse(), which works the same way) is strongly discouraged due to browser differences and inconsistencies. ...
...And 5 more matches
Date.prototype.setHours() - JavaScript
ocal time, and returns the number of milliseconds since january 1, 1970 00:00:00 utc until the time represented by the updated date instance. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...returns the number of milliseconds since january 1, 1970 00:00:00 utc until the time represented by the updated date instance. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ber of milliseconds since january 1, 1970 00:00:00 utc until the time represented by the updated date instance. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 5 more matches
Function.prototype.call() - JavaScript
the call() method calls a function with a given this value and arguments provided individually. the source for this interactive example is stored in a github repository. if 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 func.call([thisarg[, arg1, arg2, ...argn]]) parameters thisarg optional the value to use as this when calling func. caution: in certain cases, thisarg may not be the actual value seen by the method. if the method is a function in non-strict mode, null and undefined will be replaced with the global object, and primitive values will be converted to objects. ...
... parameters thisarg optional the value to use as this when calling func. caution: in certain cases, thisarg may not be the actual value seen by the method. if the method is a function in non-strict mode, null and undefined will be replaced with the global object, and primitive values will be converted to objects. arg1, arg2, ...argn optional arguments for the function. return value the result of calling the function with the specified this value and arguments. description the call() allows for a function/method belonging to one object to be assigned and called for a different object. call() provides a new value of this to the function/method. with call(), you can write a method once and then inherit it in another object, without having to rewrite the method for the new ...
...e = new food('feta', 5); const fun = new toy('robot', 40); using call to invoke an anonymous function in this example, we create an anonymous function and use call to invoke it on every object 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 c...
...And 5 more matches
Promise.resolve() - JavaScript
the promise.resolve() method returns a promise object that is resolved with a given value. if the value is a promise, that promise is returned; if the value is a thenable (i.e. has a "then" method), the returned promise will "follow" that thenable, adopting its eventual state; otherwise the returned promise will be fulfilled with the value. this function flattens nested layers of promise-like objects (e.g. a promise that resolves to a promise that resolves to something) into a single layer. syntax promise.resolve(value); parameters value argument to be resolved by this promise. can also be a promise or a thenable to resolve. return value a promise that is resolved with the given value, or the promise passed as value, if the value was a promise object. description the static promis...
...argument to be resolved by this promise. can also be a promise or a thenable to resolve. return value a promise that is resolved with the given value, or the promise passed as value, if the value was a promise object. description the static promise.resolve function returns a promise that is resolved. ...
... by this promise. can also be a promise or a thenable to resolve. return value a promise that is resolved with the given value, or the promise passed as value, if the value was a promise object. description the static promise.resolve function returns a promise that is resolved. ...
...And 5 more matches
TypedArray.prototype.reduce() - JavaScript
the reduce() method applies a function against an accumulator and each value of the typed array (from left-to-right) has to reduce it to a single value. this method has the same algorithm as array.prototype.reduce(). 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. ...
... index the index of the current element being processed in the typed array. ...
...ototype.reduce(). 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. ...
...And 5 more matches
WebAssembly.Global - JavaScript
creates a new global object. global instances all global instances inherit from the global() constructor's prototype object — this can be modified to affect all global instances. instance properties global.prototype.constructor returns the function that created this object's instance. by default this is the webassembly.global() constructor. global.prototype[@@tostringtag] the initial value of the @@tostringtag property is the string value "webassembly.global". global.prototype.value the value contained inside the global variable — this can be used to directly set and get the global's value. instance methods global.prototype.valueof() old-style method that returns the value contained inside the global variable. examples creating a new global instance the following exam...
...able — this can be used to directly set and get the global's value. instance methods global.prototype.valueof() old-style method that returns the value contained inside the global variable. examples creating a new global instance the following example shows a new global instance being created using the webassembly.global() constructor. it is being defined as a mutable i32 type, with a value of 0. the value of the global is then changed, first to 42 using the global.value property, and then to 43 using the incglobal() function exported out of the global.wasm module (this adds 1 to whatever value is given to it and then returns the new value). const output = document.getelementbyid('output'); function asserteq(msg, got, expected) { output.innerhtml += `testing ${msg}: `; if...
...lementbyid('output'); function asserteq(msg, got, expected) { output.innerhtml += `testing ${msg}: `; if (got !== expected) output.innerhtml += `fail!<br>got: ${got}<br>expected: ${expected}<br>`; else output.innerhtml += `success! ...
...And 5 more matches
Optional chaining (?.) - JavaScript
when used with function calls, it returns undefined if the given function does not exist. this results in shorter and simpler expressions when accessing chained properties when the possibility exists that a reference may be missing. ...
...when used with function calls, it returns undefined if the given function does not exist. this results in shorter and simpler expressions when accessing chained properties when the possibility exists that a reference may be missing. ...
...o which properties are required. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 5 more matches
<mtable> - MathML
Web › MathML › Element › mtable
<mtd> elements may appear. these elements are similar to <table> , <tr> and <td> elements of html. note: the <mtable> element resets the displaystyle attribute to false. if you want to use this element as an inline-block, you might want to set <mtable displaystyle="true">...</mtable>. attributes align specifies the vertical alignment of the table with respect to its environment. ...
...ent. possible values are: axis (default): the vertical center of the table aligns on the environment's axis (typically the minus sign). baseline: the vertical center of the table aligns on the environment's baseline. bottom: the bottom of the table aligns on the environments baseline. center: see baseline. top: the top of the table aligns on the environments baseline. in addition, values of the align attribute can end with a rownumber (e.g. align="center 3"). this allows you to align the specified row of the table rather than the whole table. a negative integer value counts rows from the bottom of the table. starting with gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) the interpretation of negative values has been corrected (bug 601436). in gecko 17.0 (firefox 17.0 / ...
...firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) the interpretation of negative values has been corrected (bug 601436). in gecko 17.0 (firefox 17.0 / thunderbird 17.0 / seamonkey 2.14) the parsing has been updated to treat whitespace correctly. alignmentscope unimplemented class, id, style provided for use with stylesheets. columnalign specifies the horizontal alignment of the cells. multiple values separated by space are allowed and apply to the corresponding columns (e.g. columnalign="left right center"). possible values are: left, center (default) and right. columnlines specifies column borders. multiple values separated by space are allowed and apply to the corresponding columns (e.g. columnlines="none none solid"). possible values are: none (default), solid and dashed. columnspacing...
...And 5 more matches
keyPoints - SVG: Scalable Vector Graphics
the distance is calculated along the path specified by the p...
...x="10" cy="110" r="3" fill="lightgrey"/> <circle cx="110" cy="10" r="3" fill="lightgrey"/> <circle r="5" fill="red"> <animatemotion dur="3s" repeatcount="indefinite" keypoints="0;0.5;1" keytimes="0;0.15;1" calcmode="linear"> <mpath xlink:href="#motionpath"/> </animatemotion> </circle> </svg> usage notes value <number> [; <number>]* ;? ...
... if a list of key points is sp...
...And 5 more matches
pathLength - SVG: Scalable Vector Graphics
the pathlength 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 pathlength/(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 pathlength 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://ww...
...th d="m 0,30 h100" pathlength="50"/> <!-- compute everything like if the path length was 30 user units long --> <path d="m 0,40 h100" pathlength="30"/> <!-- compute everything like if the path length was 10 user units long --> <path d="m 0,50 h100" pathlength="10"/> </svg> circle for <circle>, pathlength lets authors specify a total length for the circle, in user units. ...
...> <!-- compute everything like if the path length was 30 user units long --> <path d="m 0,40 h100" pathlength="30"/> <!-- compute everything like if the path length was 10 user units long --> <path d="m 0,50 h100" pathlength="10"/> </svg> circle for <circle>, pathlength lets authors specify a total length for the circle, in user units. ...
...And 5 more matches
textLength - SVG: Scalable Vector Graphics
tions 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" textlength="6em">small text length</text> <text y="40" textlength="120%">big text length</text> </svg> usage notes value <length-percentage> | <number> default value none animatable yes <length-percentage> this value specifies the width of the space the text will be adjusted to occupy as absolute length or percentage. <number> a numeric value outlines a length referring to the units of the current coordinate system. example let's create a simple example that presents text y...
...only two displayed elements contained inside a grouping <div>: <div class="controls"> <input type="range" id="widthslider" min="80" max="978"> <span id="widthdisplay"></span> </div> the <input> element, of type "range", is used to create the slider control the user will manipulate to change the width of the text. a <span> element of id "widthdisplay" is provided to display the current width value. javascript finally, let's have a look at the javascript code. it starts by stashing references to the elements it will need to access, using document.getelementbyid(): const widthslider = document.getelementbyid("widthslider"); const widthdisplay = document.getelementbyid("widthdisplay"); const textelement = document.getelementbyid("hello"); const baselength = math.floor(textelement.textlengt...
...ipt finally, let's have a look at the javascript code. ...
...And 5 more matches
viewBox - SVG: Scalable Vector Graphics
Web › SVG › Attribute › viewBox
the numbers separated by whitespace and/or a comma, which specify a rectangle in user space which is mapped to the bounds of the viewport established for the associated svg element (not the browser viewport). ...
... five elements are using this attribute: <marker>, <...
... <rect x="0" y="0" width="100%" height="100%"/> <!-- with the point of coordinate 0,0 in the center of the viewport the value 50% is resolve to 5 which means the center of the circle is in the bottom/right corner of the viewport. --> <circle cx="50%" cy="50%" r="4" fill="white"/> </svg> the exact effect of this attribute is influenced by the preserveaspectratio attribute. note: values for width or height lower or equal to 0 disable rendering of the element. five elements are using this attribute: <marker>, <pattern>, <svg>, <symbol>, and <view>. marker for <marker>, viewbox defines the position and dimension for the content of the <marker> element. ...
...And 5 more matches
<foreignObject> - SVG: Scalable Vector Graphics
in the 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. ...
... --> <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. ...
...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. 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. ...
...And 5 more matches
<path> - SVG: Scalable Vector Graphics
Web › SVG › Element › path
eneric element to define a shape. all the basic shapes can be created 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. ...
...e. all the basic shapes can be created 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. ...
...mlns="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 pathlength this attribute lets authors specify the total length for the path, in user units. ...
...And 5 more matches
<polygon> - SVG: Scalable Vector Graphics
Web › SVG › Element › polygon
!-- example of a polygon with the default fill --> <polygon points="0,100 50,25 50,75 100,0" /> <!-- example of the same polygon shape with stroke and no fill --> <polygon points="100,100 150,25 150,75 200,0" fill="none" stroke="black" /> </svg> attributes points this attribute defines the list of points (pairs of x,y absolute coordinates) required to draw the polygon. ...
...e default fill --> <polygon points="0,100 50,25 50,75 100,0" /> <!-- example of the same polygon shape with stroke and no fill --> <polygon points="100,100 150,25 150,75 200,0" fill="none" stroke="black" /> </svg> attributes points this attribute defines the list of points (pairs of x,y absolute coordinates) required to draw the polygon. ...
...roke 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 pathlength this attribute lets specify the total length for the path, in user units. ...
...And 5 more matches
<rect> - SVG: Scalable Vector Graphics
Web › SVG › Element › rect
ined by their 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. ...
...he 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. 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. defau...
...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 specified. value type: auto|<length>|<percentage> ; default value: auto; animatable: yes pathlength the total length of the rectangle's perimeter, in user units. ...
...And 5 more matches
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
ngth() 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 implementation status unknown auto value for width and height in <image> implementation status unknown referencing entire document with <use> implementation status unknown lang attribute on <desc> and <title> implemented (bug 721920) css transforms on outermost <svg> not affecting svgsvgelement.currentscale or svgsvgelement.currenttranslate implementation status unknown rootelement attribu...
...cale or svgsvgelement.currenttranslate implementation status unknown rootelement attribute deprecated implementation status unknown svgelementinstance and svgelementinstancelist and corresponding attributes on svguseelement removed implementation status unknown <use> event flow following shadow dom spec. ...
... attribute removed implementation status unknown linkstyle on svgstyleelement implemented (bug 1239128 (firefox 46.0 / thunderbird 46.0 / seamonkey 2.43)) inner <svg>s and <foreignobjects>s not overflow: hidden; in ua style sheet implementation status unknown overflow: hidden; on <hatch> in ua style sheet implementation status unknown 0 0 as default value of transform-origin except root <svg> and <svg> children of <foreign> implementation status unknown use of white-space instead of deprecated xml:space attribute in ua style sheet implementation status unknown @font-face, ::first-letter and ::first-line on <text> implementation status unknown svg and html style sheets in html document with inline svg applying to...
...And 5 more matches
Interacting with page scripts - Archive of obsolete content
instead, you need to use the global cloneinto() function to clone the object into the page script's scope. cloneinto() creates a structured clone of the object in the target context, and returns a reference to the clone. you can then assign that to a property of the target window, and the page script can access it. here's an example. the "main.js" opens th...
...entscriptobject = cloneinto(contentscriptobject, unsafewindow); unsafewindow.assignedcontentscriptobject = contentscriptobject; the "page.html" file adds two buttons and assigns an event listener to each: one listener displays a property of the cloned object, and the other listener displays a property of the assigned object: <html> <head> </head> <body> <input id="works" type="button" value="i will work"/> <input id="fails" type="button" value="i will not work"/> <script> var works = document.getelementbyid("works"); works.addeventlistener("click", function() { alert(clonedcontentscriptobject.greeting); }, false); var fails = document.getelementbyid("fails"); fails.addeventlistener("click", function() { alert(assignedcontentscr...
...clicking "i will not work" fails, and the following message is logged: permission denied to access property 'greeting' expose functions to page scripts the structured clone algorithm is a bit more powerful than simple json serialization, but not much: in particular, functions aren't cloned. this means that you can't expose a function to a page script using cloneinto(...
...And 4 more matches
ui/button/action - Archive of obsolete content
toolbar: however, users can move it to the firefox menu panel using the toolbar customization feature: badged buttons new in firefox 36. you can add a "badge" to a button using its badge property. this can be a number or a string, and you can update it at any time. ...
...or the button. you can specify this in one of three ways: as a resource:// url pointing at an icon file in your add-on's "data" directory, typically constructed using self.data.url(iconfile) as a relative path: a string in the form "./iconfile", where "iconfile" is a relative path to the icon file beginning in your add-on's "data" directory as an object, or dictionary of key-value pairs. here you can specify a range of sizes for your button's icon. each key-value pair specifies an icon: each value specifies an image file as a resource:// url or relative path. each key must be a numeric string such as "16", or "32", which represents the size in pixels of the corresponding image. var { actionbutton } = require('sdk/ui/button/action...
...led in the ui, and do not respond to clicks. defaults to false. onclick function click handler for the button. badge number or string new in firefox 36. badge to attach to the button. the badge can contain as many characters (or digits) as you like, but only the first four will be displayed. badgecolor css <color> value new in firefox 36. color for the badge. if badgecolor is omitted and badge is specified, then the badge is red. actionbutton methods click() click the button. this will cause the button to generate the click event: var { actionbutton } = require('sdk/ui/button/action'); var button = actionbutton({ id: "my-button", label: "my button", icon: { "16": ...
...And 4 more matches
Dialogs and Prompts - Archive of obsolete content
ontent --> </dialog> you can even get the element object for any of predefined buttons with gdialog.getbutton(dlgtype);, where gdialog is the <dialog> element and dlgtype is one of the six button types listed above. explicit if you are not satisfied with the layout of predefined buttons in dialog, you can put explicit button elements in your xul file and add a dlgtype attribute to them. valid values for dlgtype are the six button types listed above. be sure to use ondialog* attributes on dialog element instead of putting oncommand on the button with dlgtype, because button's oncommand is executed only when the button is pressed, and ondialog* handlers are executed for keyboard and other events too. example: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/cs...
...the button with dlgtype, because button's oncommand is executed only when the button is pressed, and ondialog* handlers are executed for keyboard and other events too. ...
... using <dialogheader> you can use the dialogheader element to add "headers" to windows. ...
...And 4 more matches
Inline options - Archive of obsolete content
a container, it isn't merged into the main window. if you need script support, see the display notifications section. ...
...the title attribute is used as a label for the controls. ...
...the title attribute is used as a label for the controls. to set a description, either use the desc attribute, or a text node as a child of the <setting> tag. ...
...And 4 more matches
Installing plugins to Gecko embedding browsers on Windows - Archive of obsolete content
te the mozilla subkey. here you will find keys on a per-product basis. you can enumerate the application subkeys, e.g. hkey_local_machine\software\mozilla\productx.y\. the keys "product x.y" contain application keys for the given mozilla based browser. example: netscape 6 6.1\ look at the extensions subkey, e.g. ...
...illa subkey. here you will find keys on a per-product basis. you can enumerate the application subkeys, e.g. hkey_local_machine\software\mozilla\productx.y\. the keys "product x.y" contain application keys for the given mozilla based browser. example: netscape 6 6.1\ look at the extensions subkey, e.g. ...
.... hkey_local_machine\software\mozilla\productx.y\. the keys "product x.y" contain application keys for the given mozilla based browser. example: netscape 6 6.1\ look at the extensions subkey, e.g. hkey_local_machine\software\mozilla\netscape 6 6.1\extensions\ access the plugins value and value-data pair, e.g: plugins = c:\program files\netscape\netscape 6\plugins. you also have the components value and value-data pair; this is for xpcom components. in addition, if you have made your plugin scriptable and accessible from javascript, you ought to put the associated xpt file in the components directory. you can access the components value and value-data pair (telling you where the components directory is) in a similar manner, e.g.: components=c:\program files\netscape\netscape 6\components. fu...
...And 4 more matches
Supporting private browsing mode - Archive of obsolete content
ons that may record potentially private information may wish to hook into the private browsing service so that they can avoid saving personal information when private browsing mode is enabled. doing this is quite easy, using the nsiprivatebrowsingservice interface. detecting private browsing mode determining whether or not the user is currently in private browsing mode is simple. just check the value of the privatebrowsingenabled attribute on the nsiprivatebrowsingservice service. var pbs = components.classes["@mozilla.org/privatebrowsing;1"] .getservice(components.interfaces.nsiprivatebrowsingservice); var inprivatebrowsingmode = pbs.privatebrowsingenabled; if (!inprivatebrowsingmode) { /* save private information */ } in the above example, we only save the user's priv...
...etecting whether private browsing mode is permanent requires gecko 2.0(firefox 4 / thunderbird 3.3 / seamonkey 2.1) firefox 4 added support for having private browsing mode permanently enabled. the theme looks different in this scenario. to determine whether or not the browser is permanently in private browsing mode, you can look at the privatebrowsingmode attribute on the document root. its value is "permanent" if private browsing is permanently enabled for the session, "temporary" if private browsing is temporarily enabled, or not defined at all if private browsing mode isn't active. let docroot = document.documentelement; if (docroot.hasattribute("privatebrowsingmode")) { // private browsing mode is enabled } if (docroot.getattribute("privatebrowsingmode") == "temporary") { // pri...
...var pbs = components.classes["@mozilla.org/privatebrowsing;1"] .getservice(components.interfaces.nsiprivatebrowsingservice); var oldprivatemode = pbs.privatebrowsingmode; pbs.privatebrowsingenabled = true; /* this is all private */ pbs.privatebrowsingenabled = oldprivatemode; in this example, we save the current state of the private...
...And 4 more matches
XUL Events - Archive of obsolete content
pupshowingthe popupshowing event is executed when a <menupopup>, <panel> or <tooltip> is about to become visible. the default action of the event can be prevented to prevent the popup to appear.popupshownthe popupshown event is executed when a <menupopup>, <panel> or <tooltip> has become visible.radiostatechangethe radiostatechange event is executed when the state of a <radio> element has changed.valuechangethe valuechange event is executed when the value of an element, <progress> for example, has changed. inherited dom events event description blur the opposite of the focus event, the blur event is passed after an element loses the focus. attribute: onb...
...dom events event description blur the opposite of the focus event, the blur event is passed after an element loses the focus. attribute: onblur change this event is sent when the value of the textbox is changed. the event is not sent until the focus is moved to another element. attribute: onchange click this event is sent when a mouse button is pressed and released. you can determine which mouse button was clicked by retrieving the button property of the event object. this event is...
... mutation dom events event description domattrmodified this event is sent to an element when one of its attributes is modified. in the event handler, you can retrieve the attribute that was modified using the event's attrname property, and you can retrieve the old and new values of the attribute using the event's prevvalue and newvalue properties. domnodeinserted this event is sent when a node is added as a child of a element. if you capture this event at the document level, you can be notified of document changes. domnoderemoved ...
...And 4 more matches
Reading from Files - Archive of obsolete content
come! other documentation on files and i/o not using the unavailable nsiscriptableio apis: code snippets: file i/o, open and save dialogs, reading textual data, writing textual data, list of file-related error codes. reading data from a file involves getting a reference to a file and then creating an input stream to read from it. an input stream provides a means of reading bytes, strings or other values from the file. while there is only one method to create an input stream, it provides a number of options to control exactly how reading is performed. for instance, there are options to read a file as if it were text or a binary file. using the former will cause characters in the stream to be interpreted with a particular character encoding. in addition, lines may be read by reading the file up u...
...xt files characters are interpreted from a text input stream using a specified character encoding. this means that if a character within the file occupies several bytes, it will converted into a single character when read. this is done automatically as long as you specify the 'text' flag to nsiscriptableio.newinputstream(). the default character encoding is utf-8 which means that characters below value 128 will occupy a single byte whereas characters above value 128 will occupy multiple bytes, depending on their value. however, a number of other character encodings are available; see reading other character encodings below for details about reading text in other encodings. there are several methods available to read from an input stream. the two most common for text files are the readstring and...
...e, "text", "utf-16"); this third argument is not needed if the file is stored in utf-8. for a list of supported character encodings, see supported character sets. the files can be read in the same manner using the readstring and readline methods. the difference is handled internally so you don't need to write any other part of the code differently. reading binary data in addition to text, binary values may be read from a file either as bytes, or interpreted as numbers. a number of methods are available which may be used for this. if you are expecting to read from a binary file instead of text, specify the 'binary' flag when creating the stream with nsiscriptableio.newinputstream(). var stream = io.newinputstream(file, "binary"); this line will create and open a binary stream for a file. once ...
...And 4 more matches
How to implement a custom XUL query processor component - Archive of obsolete content
an empty string would be ok too. the querytype is importa...
...an empty string would be ok too. the querytype is important. it is used to create an instance of our...
...an empty string would be ok too. the querytype is important. it is used to create an instance of our xpcom object. the contract id of our xpco...
...And 4 more matches
Using Recursive Templates - Archive of obsolete content
e="laura secord"/> </group> </people> we could display this data in a flat list by using the right query: <query expr="group/person/"> or, we could display one level for the two groups, and use another level for each person. <groupbox type="menu" datasources="people.xml" ref="*" querytype="xml"> <template> <query expr="*"/> <action> <vbox uri="?" class="indent"> <label value="?name"/> </vbox> </action> </template> </groupbox> in this simplified example, the xpath expression just gets the list of child elements of the reference node. for the outermost iteration, a vbox is created with a child label. since the initial reference node is the root of the xml source document, the results are two elements, one for each group element. however, a further step is ...
...s again generated for each result, but instead of being inserted inside the outermost groupbox, this new content is inserted inside the content generated from the previous iteration. the content is always inserted directly inside the element with the uri attribute. the result is output like the following: <groupbox> ... ...
...nserted inside the outermost groupbox, this new content is inserted inside the content generated from the previous iteration. the content is always inserted directly inside the element with the uri attribute. the result is output like the following: <groupbox> ... ...
...And 4 more matches
Adding Event Handlers to XBL-defined Elements - Archive of obsolete content
hecked property of the check box is changed when the space bar is pressed. <handlers> <handler event="keypress" key=" " action="this.checked=!checked"/> </handlers> you can also use the keycode attribute to check for non-printable keys. the section on keyboard shortcuts provides more information. the modifier keys can be checked by adding a modifiers attribute. this should be set to one of the values set below: alt the user must press the alt key. control the user must press the control key. meta the user must press the meta key. shift the user must press the shift key. accel the user must press the special modifier key that is usually used for keyboard shortcuts on their platform. if set, the handler is only cal...
...a ...
...a field clipboard has been added to it to sto...
...And 4 more matches
Box Objects - Archive of obsolete content
n retrieve the position and size of the xul element as displayed, and second, you can determine the order of the elements in the box as displayed, instead of their order as they are stored in the dom. retrieving position and size the box object provides six read only properties, x, y, screenx, screeny, width and height, for determining the currently displayed position and size of an element. all values returned are in pixels. x, y the x and y coordinates are referenced from the top left corner of the document in the window (that portion which excludes the window border and title bar) and refer to the top left corner of the element, including css padding. css margins and borders* are excluded. the top left corner of the document is that which is obtained from screen.mozinnerscreenx, screen.mo...
..., height the width and height properties are also measured in pixels and return the width and height of the element, including css padding and borders. css margins are excluded. *note that x, y refers to the portion of the element that is just inside any borders, which is inconsistent with the other four boxobject position and size references, which include borders as part of the element. the values are always the position and sizes as currently displayed, so the values will be different if the element is moved or resized. for example, a flexible element will change in size and the box object dimensions will update accordingly. the following example shows this. example 1 : source view <button label="click me" oncommand="alert('the width is ' + this.boxobject.width);"/> you can use ...
...example, a flexible element will change in size and the box object dimensions will update accordingly. the following example shows this. example 1 : source view <button label="click me" oncommand="alert('the width is ' + this.boxobject.width);"/> you can use the width and height attributes of the element to specify the element's width and height, respectively. note that retrieving these values will return the size only if it was explicitly specified. these properties will return an empty string if the width or height attributes or properties were not set already. that is, you cannot get the current size with these properties; instead you must use the box object properties. this may be a bit confusing, but, the key is to remember that the width and height properties on an element retur...
...And 4 more matches
Skinning XUL Files by Hand - Archive of obsolete content
css for guidelines on how to make your skins friendly to the global skin, to xul, and to mozilla. stylesheet syntax to familiarize yourself with the global skin, open up the text file called global.css in the chrome/classic.jar!/skin/classic/global directory of the mozilla application. ...
...o make your skins friendly to the global skin, to xul, and to mozilla. stylesheet syntax to familiarize yourself with the global skin, open up the text file called global.css in the chrome/classic.jar!/skin/classic/global directory of the mozilla application. ...
...to the global skin, to xul, and to mozilla. stylesheet syntax to familiarize yourself with the global skin, open up the text file called global.css in the chrome/classic.jar!/skin/classic/global directory of the mozilla application. ...
...And 4 more matches
Tree View Details - Archive of obsolete content
have children and also which rows are open and closed. nesting level every row in the tree has a nesting level. the topmost rows are at level 0, the children of those rows are at level 1, their children at level 2 and so on. the tree will query the view for each row by calling its getlevel method to find out the level of that row. the view will need to return 0 for the outermost rows and higher values for inner rows. the tree will use this information to determine the hierarchical structure of the rows. in addition to the getlevel method, there is a hasnextsibling function which, given a row, should return true if there is another row afterwards at the same level. this function is used, specifically, to draw the nesting lines along the side of the tree. the getparentindex method is expected...
...re of the rows. in addition to the getlevel method, there is a hasnextsibling function which, given a row, should return true if there is another row afterwards at the same level. this function is used, specifically, to draw the nesting lines along the side of the tree. the getparentindex method is expected to return the parent row of a given row, that is, the row before it with a lower nesting value. all of these methods must be implemented by the view for children to be handled properly. containers there are also three functions, iscontainer, iscontainerempty and iscontaineropen that are used to handle a parent item in the tree. the iscontainer method should return true if a row is a container and might contain children. the iscontainerempty method should return true if a row is an em...
... instance, a directory with no files in it. the iscontaineropen method is used to determine which items are opened and closed. the view is required to keep track of this. the tree will call this method to determine which containers are open and which are closed. note that the tree will call neither iscontainerempty nor iscontaineropen for rows that are not containers as indicated by the return value of the iscontainer method. a container may be rendered differently than a non-container. for instance, a container may have a folder icon beside it. a style sheet may be used to style items based on various properties such as whether a row is open. this is described in a later section. a non-empty container will be displayed with a twisty next to it so that the user may open and close the row to...
...And 4 more matches
Using Spacers - Archive of obsolete content
he spacer and the button. the spacer has received half of the free space and the button has received the other half. the reason we're seeing this effect is that both the spacer and the find button have a flex attribute. because both are flexible, both the button and the spacer resize equally. what if you want to set one element to grow twice as large an another? you can use a higher number as the value of the flex attribute. the values of the flex element are a ratio. if one element has a flex of 1 and the next one has a flex of 2, the second one will grow at twice the rate of the first one. in effect, a flex of 2 says that this element has a flex that is two times the elements that have a flex of one. the flex attribute isn't used to specify an actual size. instead, it specifies how empty spac...
...te of the first one. in effect, a flex of 2 says that this element has a flex that is two times the elements that have a flex of one. the flex attribute isn't used to specify an actual size. instead, it specifies how empty space it divided among the children of a container box. we'll look at boxes in the next section. once the default sizes of the children of a box are determined, the flexibility values are used to divide up the remaining empty space in the box. for example, if a box is 200 pixels wide and contains two flexible buttons, the first 50 pixels and the other 90 pixels, there will be 60 pixels of space left over. if both buttons have a flex value of 1, the space will be divided evenly with 30 extra pixels of width going to each button. if the second button's flexibility was increased...
...lace" flex="2"/> </html:div> example 6: <button label="find" flex="145"/> <button label="replace" flex="145"/> example 1 in this case the flexibility is divided up evenly between both buttons. both buttons will change size evenly. ...
...And 4 more matches
notificationbox - Archive of obsolete content
name (they are different) of global object gbrowser: notifybox = gbrowser.getnotificationbox() examples <notificationbox flex="1"> <browser src="http://www.mozilla.org"/> </notificationbox> there is a more complex code available in the code snippets area. ...
...if another notification is already present with a higher priority, the new notification will be added behind it. label - label to appear on the notification. this should be either a string, or, from gecko 37 onwards, you can pass a documentfragment with rich content as well. keep in ...
...ion is already present with a higher priority, the new notification will be added behind it. label - label to appear on the notification. this should be either a string, or, from gecko 37 onwards, you can pass a documentfragment with rich content as well. keep in mind that this is all xul so using html elements for styling might still need additional css in order to work as you might expect. value - value used to identify the notification image - url of image to appear on the notification. if "" then an icon appropriate for the priority level is used. priority - notification priority; see priority levels. buttons - array of button descriptions to appear on the notification. eventcallback optional - a javascript function to call to notify you of interesting things that happen with the ...
...And 4 more matches
Developing cross-browser and cross-platform pages - Archive of obsolete content
author to make assumptions about what will happen with future browsers or to decide to provide future browsers a safe fallback service. it assumes that web authors are able to correctly identify browsers and browser versions in the first place... which is far from being a reliable and easy task to achieve. the browser identification approach relies on functions that check the browser type string value and browser version string value and that search for certains characters or sub-strings in the navigator.useragent property string. once "detected", the web author then uses different functions (aka code branching) or points the user to different pages (aka site branching) or web content. site branching can be particularly dangerous as people may enter a page through a link, bookmark, search engi...
...nd to make the appropriate switches. another major problem with this approach is that the browser identity can be "spoofed" because, in many modern browsers, the navigator.appversion and navigator.useragent string properties are user configurable strings. for example, firefox 1.x users and users of any/all mozilla-based browsers can customize the "general.useragent.*" string properties to any value. opera 6+ allows users to set the browser identification string via a menu internet explorer uses the windows registry safari, konqueror and icab browsers can mask their browser identity under internet explorer or netscape labels a user or browser distributor can put what they want in the navigator.useragent string and this may trick your code into executing a "wrong" block of code. moreover...
...se object/feature support detection, you only implement those features whose support you have first tested and verified on the visiting browser. this method has the advantage of not requiring you to test for anything except whether the particular features you code are supported in the visiting browser. let's see a basic, simple object support detection example. ...
...And 4 more matches
Old Proxy API - Archive of obsolete content
s(proxy) getpropertynames: function() -> strings array this function doesn't exist in ecmascript 5. like getownpropertynames, but should also return non-overridden inherited properties. object.defineproperty(proxy,name,pd) defineproperty: function(name, propertydescriptor) -> any define a new property whose attributes are determined by the given propertydescriptor. the return value of this method is ignored. delete proxy.name delete: function(name) -> boolean delete the named property from the proxy. the boolean return value of this method should indicate whether or not the name property was successfully deleted. object.freeze(proxy) object.seal(proxy) object.preventextensions(proxy) fix: function() -> propertydescriptor map (in...
...successfully deleted. object.freeze(proxy) object.seal(proxy) object.preventextensions(proxy) fix: function() -> propertydescriptor map (indexed on property names) | undefined should return an object that maps property names to property descriptors. after a call to fix(), the proxy becomes a regular (non-proxy) object with the properties listed in the return value. the handler is no longer used. moreover, the respective method (freeze(), seal(), or preventextension()) is immediately called on the fixed object. note: the fixed object has the same object identity as the proxy object. if fix() returns undefined, the call throws a typeerror exception. derived traps default implementation refers to the code that is called for that trap when the...
...ntation description name in proxy has: function(name) -> boolean function(name) { return !!this.getpropertydescriptor(name); } object.prototype.hasownproperty.call(proxy, name) hasown: function(name) -> boolean function(name) { return !!this.getownpropertydescriptor(name); } proxy.name (in the context of "getting the value") receiver.name (if receiver inherits from a proxy and does not override name) get: function(receiver, name) -> any function(receiver, name) { var desc = this.getpropertydescriptor(name); if (desc === undefined) { return undefined; } if ('value' in desc) { return desc.value; } else { if (desc.get === undefined) { return undefined; } return ...
...And 4 more matches
Implementation Status - Archive of obsolete content
rtial see section 11.2 for more details 4.3.10 xforms-submit-serialize supported 4.4 notification events supported 4.4.1 xforms-insert supported 4.4.2 xforms-delete supported 4.4.3 xforms-value-changed supported 4.4.4 xforms-valid supported 4.4.5 xforms-invalid supported 4.4.6 xforms-readonly supported 4.4.7 xforms-readwrite supported 4.4.8 xforms-required supporte...
... 4.6.2 for output controls supported 4.6.3 for select or select1 controls partial 4.6.4 for trigger controls supported 4.6.5 for submit controls supported 4.6.6 sequence: selection without value change supported 4.6.7 sequence: value change with focus change supported 4.6.8 sequence: activating a trigger supported 4.6.9 sequence: submission supported 4.7 resolving id references in xforms unsupported ...
... 8.1.9 submit supported 8.1.10 select partial @selection does not work, select inside repeat may not work correctly, select that mixes itemsets with items may show them in the wrong order 282840; 371595; 372127; 8.1.11 select1 partial there are some resize issues, select/deselect/valuechange firing in wrong order. getting a few issues with in/out of range notifications. 282840; 303351; 333464; 333529; 352398; 8.2.1 choices supported 8.2.2 item supported 8.2.3 value supported 8.3.1 filename supported ...
...And 4 more matches
Mozilla XForms User Interface - Archive of obsolete content
ntrol is bound to as a clue when making a rendering decision. the form author can also use the 'appearance' attribute on the form control to give us another clue. for example, a xforms input control may appear as a text field or as a datepicker depending on whether it is bound to a xsd:string type or a xsd:date type. when a xf:output binds to a node that has a type of xsd:date, we output the date value as plain text. an output bound to a date and also having @appearance='full' will display as a calendar. this article uses several notations. if you see fx 3.0 only, that means that the control will only be available for firefox 3.0 (gecko 1.9). there are several possible reasons for this restriction. the first is that the changes required for such controls could not be safely made to firefox 1.5 ...
...ol is available only in that host language. attribute sets this section describes attributes that are often used on xforms elements. these attributes are combined into following logical groups. ui common the ui common attribute set (see the spec) contains the attributes that are available for the xforms elements that are used to build the user interface presentation in a form. appearance - the value provided by the form author gives a hint to the processor as to which widget to use to represent the xforms control. three possible values are available to the author: minimal, compact and full. generally speaking, the main purpose for these values is to reflect how much space (screen real estate) the displayed widget will take. tabindex - defines the keyboard navigation sequence between contro...
...resented by a string (see the spec). it can have the following representations: text field - default representation. used for most data types, especially text data. checkbox - used for boolean instance data datepicker - default representation for date data types. similar to a combobox. consists of a text field for direct input and a dropdown calendar that can also be used to input the date value. calendar - used for date data types when appearance = 'full'. days list - used when the data has a data type of day. months list - used when the data has a data type of month. number field - used for numerical data types. secret used for inputting passwords. each character typed by the user is represented by an asterisk on the screen (see the spec). textarea serves to show/change multil...
...And 4 more matches
Windows Media in Netscape - Archive of obsolete content
control if you are running netscape 7.1 and later or ie, and have installed windows media player 7 or above, the snippet of code below should produce a windows media control and play a song. this is the example: needs to be embedded in wiki page (can it just be put here?) <object id="playerex2" classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" height="200" width="200"> <param name="uimode" value="full"> <param name="autostart" value="true"> <param name="url" value="media/preludesteel.wma"> your browser does not support the activex windows media player </object> the same markup (used above and shown below) will work in both ie and netscape 7.1. <object id="playerex2" classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" height="200" width="200"> <param name="uimode" v...
..."true"> <param name="url" value="media/preludesteel.wma"> your browser does not support the activex windows media player </object> the same markup (used above and shown below) will work in both ie and netscape 7.1. <object id="playerex2" classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" height="200" width="200"> <param name="uimode" value="full" /> <param name="autostart" value="true" /> <param name="url" value="preludesteel.wma" /> your browser does not support the activex windows media player </object> the classid attribute references the clsid of windows media player 7 and above -- windows media player versions before 7 used a different clsid. examples in this article all assume that the user is running windows media player 7 and later, although netscape 7.1 s...
...base attribute isn't supported for such retrieval. therefore detecting whether the component was successfully instantiated can help provide users with the right component if a failed instantiation is detected. the code listing below provides a mechanism to to this. ...
...And 4 more matches
Building up a basic demo with the PlayCanvas engine - Game development
era, light or sound source. then it adds a camera component to it with the light gray clearcolor — the color will be visible as the background. next, the camera object is added to the root of our application and positioned to be 7 units away from the center of the scene on the z axis. this allows us to make some space to visualize the objects that we will create later on. note: the distance values (e.g. for the camera z position) are unitless, and can basically be anything you deem suitable for your scene — milimeters, meters, feet, or miles — it's up to you. try saving the file and loading it in your browser. you should now see a gray window. congratulations! geometry now the scene is properly rendering we can start adding 3d shapes to it. to speed up development playcanvas provi...
...vas material is called phongmaterial — add the following lines below the previous code. var boxmaterial = new pc.phongmaterial(); boxmaterial.diffuse.set(0, 0.58, 0.86); boxmaterial.update(); box.model.model.meshinstances[0].material = boxmaterial; by diffusing the light on the object we can give it it's own color —we'll choose a nice familiar blue. note: in playcanvas, the color channel values are provided as floats in the range 0-1, instead of integers of 0-255 as you might be used to using on the web. after the material is created and its color is set, it has to be updated so our changes are going to be applied. then all we need to do is set the box's material to the newly created boxmaterial. congratulations, you've created your first object in a 3d environment using playcanvas!
... it is a bit boring. in a game something is usually happening — we can see animations and such — so let's try to breathe a little life into those shapes by animating them. animation we already used translate or rotate to adjust the position of the shapes; we could also change their positions directly with setposition, or scale them. to show actual animation, we need to make changes to these values inside the rendering loop, so they are updated on every frame. there's a special update event that we can use for that — add the following code just below the previous additions: var timer = 0; app.on("update", function (deltatime) { timer += deltatime; // code executed on every frame }); the callback takes the deltatime as the parameter, so we have the relative time that has passed...
...And 4 more matches
Implementing controls using the Gamepad API - Game development
the states of buttons and axes being the most important: id: a string containing information about the controller. index: a unique indentifier for the connected device. connected: a boolean variable, true if the device is connected. mapping: the layout type of the buttons; standard is the only available option for now. axes: the state of each axis, represented by an array of floating-point values. buttons : the state of each button, represented by an array of gamepadbutton objects containing pressed and value properties. the index variable is useful if we're connecting more than one controller and want to identify them to act accordingly — for example when we have a two-player game requiring two devices to be connected. querying the gamepad object beside connect() and disconnect()...
...uttons 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; // return buttons for debugging purposes return pressed; }, on every frame, update() saves buttons pressed during the previous frame to the buttonscache arr...
... detecting button presses the buttonpressed() method is also placed in the main game loop 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 4 more matches
Handling different text directions - Learn web development
we create borders on the top, right, bottom, and left of a box, for example. these physical dimensions map very neatly to content that is viewed horizontally, and by default the web tends to support left-to-right languages (e.g. english or french) better than right-to-left languages (such as arabic). ...
... which uses a vertical writing mode to want to do this — you could also change the writing mode of parts of your layout for creative purposes. in the example below we have a heading displayed using writing-mode: vertical-rl. the text now runs vertically. vertical text is common in graphic design, and can be a way to add a more interesting look and feel to your web design. the three possible values for the writing-mode property are: horizontal-tb: top-to-bottom block flow direction. sentences run horizontally. vertical-rl: right-to-left block flow direction. sentences run vertically. vertical-lr: left-to-right block flow direction. sentences run vertically. so the writing-mode property is in reality setting the direction in which block-level elements are displayed on the page — ei...
... writing mode and direction of text can change, newer css layout methods do not refer to left and right, and top and bottom. instead they will talk about start and end along with this idea of inline and block. don't worry too much about that right now, but keep these ideas in mind as you start to look at layout; you will find it really helpful in your understanding of css. logical properties and values the reason to talk about writing modes and direction at this point in your learning however, is because of the fact we have already looked at a lot of properties which are tied to the physical dimensions of the screen, and make most sense when in a horizontal writing mode. let's take a look at our two boxes again — one with a horizontal-tb writing mode and one with vertical-rl. i have given ...
...And 4 more matches
Pseudo-classes and pseudo-elements - Learn web development
ide an <article> element. article p:first-child::first-line { font-size: 120%; font-weight: bold; } generating content with ::before and ::after there are a couple of special pseudo-elements, which are used along with the content property to insert content into your document using css. you could use these to insert a string of text, such as in the live example below. try changing the text value of the content property and see it change in the output. you could also change the ::before pseudo-element to ::after and see the text inserted at the end of the element instead of the beginning. inserting strings of text from css isn't really something we do very often on the web however, as that text is inaccessible to some screen readers and might be hard for someone to find and edit in the...
...ks to their reference pages on mdn. use this as a reference to see the kind of things that are available for you to target. pseudo-classes selector description :active matches when the user activates (for example clicks on) an element. :any-link matches both the :link and :visited states of a link. ...
... :disabled matches user interface elements that are in an disabled state. :empty matches an element that has no children except optionally white space. :enabled matches user interface elements that are in an enabled state. :first in paged media, matches the first page. ...
...And 4 more matches
Positioning - Learn web development
previous overview: css layout next positioning allows you to take elements out of the normal document layout flow, and make them behave differently; for example sitting on top of one another, or always remaining in the same place inside the browser viewport. this article explains the different position values, and how to use them. prerequisites: html basics (study introduction to html), and an idea of how css works (study introduction to css.) objective: to learn how css positioning works. we'd like you to follow along with the exercises on your local computer, if possible — grab a copy of 0_basic-flow.html from our github repo (source code here) and use that as a starting point. introducing positioning the whole idea of positioning is to allow us t...
...ment's position? you need to use the top, bottom, left, and right properties, which we'll explain in the next section. introducing top, bottom, left, and right top, bottom, left, and right are used alongside position to specify exactly where to move the positioned element to. to try this out, add the following declarations to the .positioned rule in your css: top: 30px; left: 30px; note: the values of these properties can take any units you'd logically expect — pixels, mm, rems, %, etc. if you now save and refresh, you'll get a result something like this: <h1>relative positioning</h1> <p>i am a basic block level element. my adjacent block level elements sit on new lines below me.</p> <p class="positioned">by default we span 100% of the width of our parent element, and we are as tal...
...itioning for things like background images and drop shadow offsets. (0,0) is at the top left of the page (or element), and the x- and y-axes run across to the right and down the page (for left to right languages, anyway.) web pages also have a z-axis: an imaginary line that runs from the surface of your screen, towards your face (or whatever else you like to have in front of the screen). z-index values affect where positioned elements sit on that axis; positive values move them higher up the stack, and negative values move them lower down the stack. by default, positioned elements all have a z-index of auto, which is effectively 0. to change the stacking order, try adding the following declaration to your p:nth-of-type(1) rule: z-index: 1; you should now see the finished example, with the l...
...And 4 more matches
Getting started with Svelte - Learn web development
ch means it becomes accessible to consumers of the component (e.g. other components). this is one example of svelte extending javascript syntax to make it more useful, while keeping it familiar. the markup section in the markup section you can insert any html you like, and in addition you can insert valid javascript expression inside single curly brackets ({}). in this case we are embedding the value of the name prop right after the hello text. <main> <h1>hello {name}!</h1> <p>visit the <a href="https://svelte.dev/tutorial">svelte tutorial</a> to learn how to build svelte apps.</p> </main> svelte also supports tags like {#if...}, {#each...}, and {#await...} — these examples allow you to conditionally render a portion of the markup, iterate through a list of elements, and work with asy...
... the name prop right after the hello text. <main> <h1>hello {name}!</h1> <p>visit the <a href="https://svelte.dev/tutorial">svelte tutorial</a> to learn how to build svelte apps.</p> </main> svelte also supports tags like {#if...}, {#each...}, and {#await...} — these examples allow you to conditionally render a portion of the markup, iterate through a list of elements, and work with async values, respectively. the <style> section if you have experience working with css, the following snippet should make sense: <style> main { text-align: center; padding: 1em; max-width: 240px; margin: 0 auto; } h1 { color: #ff3e00; text-transform: uppercase; font-size: 4em; font-weight: 100; } @media (min-width: 640px) { main { max-width: none; ...
... so that it reads like this: <h1>hello {name} from mdn!</h1> just save your changes and the app running at localhost:5000 will be automatically updated. a first look at svelte reactivity in the context of a ui framework, reactivity means that the framework can automatically update the dom when the state of any component is changed. in svelte, reactivity is triggered simply by assigning a new value to any top level variable in a component. for example, we could include a togglename() function in our app component, and a button to run it. try updating your <script> and markup sections like so: <script> export let name; function togglename() { if (name === 'world') { name = 'svelte' } else { name = 'world' } } </script> <main> <h1>hello {name}!</h1> <butt...
...And 4 more matches
Handling common JavaScript problems - Learn web development
problems that you will want to be mindful of, such as: basic syntax and logic problems (again, check out troubleshooting javascript). making sure variables, etc. are defined in the correct scope, and you are not running into conflicts between items declared in different places (see function scope and conflicts). confusion about this, in terms of what scope it applies to, and therefore if its value is what you intended. you can read what is "this"? for a light introduction; you should also study examples like this one, which shows a typical pattern of saving a this scope to a separate variable, then using that variable in nested functions so you can be sure you are applying functionality to the correct this scope. incorrectly using functions inside loops — for example, in bad-for-loop.ht...
... then using that variable in nested functions so you can be sure you are applying functionality to the correct this scope. incorrectly using functions inside loops — for example, in bad-for-loop.html (see source code), we loop through 10 iterations, each time creating a paragraph and adding an onclick event handler to it. when clicked, each one should alert a message containing its number (the value of i at the time it was created), however each one reports i as 11, because for loops do all their iterating before nested functions are invoked. if you want this to work correctly, you need to define a function to add the handler separately, calling it on each iteration and passing it the current value of para and i each time (or something similar). see good-for-loop.html (see the source code al...
...for example, this ajax example checks to make sure the request is complete and the response has been returned before trying to use the response for anything. ...
...And 4 more matches
Accessibility API cross-reference
<main> a type of live region where non-essential information changes frequently. marquee the main menu bar below the app's title bar menubar menu_bar menu_bar menubar a menu item menuitem menu_item menu_item menuitem a menuitem with a checkable state whose possible values are true, false, or mixed. menuitemcheckbox a checkable menuitem in a set of elements with the same role, only one of which can be checked at a time. menuitemradio any menu other than the menu bar java: menu is for pull-downs, popup_menu for all others menupopup popup_menu, menu popup_menu, menu m...
...hbutton push_button push_button button <button> only one radio button in a group is selectable. aria requires the parent to have role radiogroup radiobutton radio_button radio_button radio <input type=radio> a container for a a group of radio buttons radiogroup expressed by giving each radio button the same value name attribute represents the an row in a table row n/a n/a row <tr> a structure containing one or more row elements in a tabular container. n/a n/a rowgroup n/a a table row header rowheader row_header row_header, table_row_header rowheader <th scope=row> vertical or horiz...
...nhead (abstract role) a form widget that allows the user to make selections from a set of choices. ...
...And 4 more matches
Cookies Preferences in Mozilla
these preferences apply to most mozilla products (including firefox and seamonkey), however they are application-specific, so not all of them may apply to you. the default values given are for firefox 3. ...
... these preferences apply to most mozilla products (including firefox and seamonkey), however they are application-specific, so not all of them may apply to you. the default values given are for firefox 3. ...
...or firefox 3. network.cookie.cookiebehavior default value: 0 0 = accept all cookies by default 1 = only accept from the originating site (block third party cookies) 2 = block all cookies by default 3 = use p3p settings (note: this is only applicable to older mozilla suite and seamonkey versions.) 4 = storage access policy: block cookies from trackers network.cookie.lifetimepolicy default value: 0 0 = accept cookies normally 1 = prompt for each cookie (prompting was removed in firefox 44) 2 = accept for current session only 3 = accept for n days network.cookie.lifetime.days default value: 90 only used if network.cookie.lifetimepolicy is set to 3 sets the number of days that the lifetime of cookies should be limited to. ...
...And 4 more matches
Error codes returned by Mozilla APIs
is caused by methods which are not implemented. this could occur because the implementation has not yet been written, or because the component intentionally does not support the desired feature. ns_error_no_interface (0x80004002) an attempt was made to call queryinterface to retrieve an interface which an object does not support. ns_error_null_pointer (0x80004003) an error occurred because a value was set to null when this was not expected. ns_error_abort (0x80004004) this error indicates that an operation failed and the caller should abort whatever action is being performed. this typically will occur if an operation could not complete properly. ns_error_failure (0x80004005) this is the most general of all the errors and occurs for all errors for which a more specific error code does n...
...ors for which a more specific error code does not apply. ns_error_unexpected (0x8000ffff) an operation did not complete due to a condition which was not expected. this error occurred rather than continuing. ns_error_out_of_memory (0x8007000e) this error occurs when there is not enough memory available to carry out an operation, or an error occurred trying to allocate memory. ns_error_illegal_value (0x80070057) an argument supplied to a method was not valid, for instance a null value was supplied as an argument which does not allow null values, or a value was out of range. ns_error_no_aggregation (0x80040110) ns_error_not_available (0x80040111) an operation could not be completed because some other necessary component or resource was not available. ns_error_factory_not_registered (0...
...stead. see nsistringbundle. ns_base_stream_would_block (0x80470007) this error occurs when an attempt is made to read from a non blocking stream yet there is not enough data available to read without waiting for more. document and node errors the following errors can occur when using documents, nodes and elements. ns_error_dom_index_size_err (0x80530001) an attempt was made to adjust the value of a text node using an index that was out of range. ns_error_dom_domstring_size_err (0x80530002) an attempt was made to create a string larger than is supported. ns_error_dom_hierarchy_request_err (0x80530003) a node was inserted into a location where it cannot go. for instance, a node cannot be inserted into a descendant of itself. ns_error_dom_wrong_document_err (0x80530004) an operation...
...And 4 more matches
Using the Browser API
Mozilla › Gecko › Chrome › API › Browser API › Using
t>. when you tap the url bar, you can enter a url using the built-in firefox os keyboard (although note that we haven't implemented anything sophisticated in this app, like autofilling the http://, etc.). when you press the keyboard's return button, the 'submit' event is fired, which we handle like this: urlform.addeventlistener('submit',function(e) { e.preventdefault(); browser.src = urlbar.value; urlbar.blur(); }); we first call preventdefault() to stop the form just submitting and reloading the page — which is really not what we want. we then set the browser iframe's src attribute to equal the value of the url bar, which causes the new url to be loaded in the iframe. finally, we call blur() on the url bar to stop focusing it, so the keyboard moves off the screen, allowing us to get...
...wser iframe's src attribute to equal the value of the url bar, which causes the new url to be loaded in the iframe. finally, we call blur() on the url bar to stop focusing it, so the keyboard moves off the screen, allowing us to get our full screen view back. there's another event listener added later on in the code that listens for the mozbrowserlocationchange event. when this fires, we set the value inside the url bar input to be equal to the event object detail property — this is so that the url displayed continues to match the website being shown when the user navigates back and forth through the history. ...
...this takes a single method — a zoom factor — which dictates the percentage to zoom in or out by. ...
...And 4 more matches
AddonManager
ew version of the application has been detected. update_when_new_app_installed an update check performed after a new version of the application has been installed. update_when_periodic_update an update check performed automatically in the background. update_when_addon_installed an update check performed when a new add-on has been installed. update status values constant description update_status_no_error no error was encountered. update_status_timeout the update check timed out. update_status_download_error there was an error while downloading the update information. update_status_parse_error the update information was malformed in some way. update_status_unknown_format the upd...
... update_status_download_error there was an error while downloading the update information. update_status_parse_error the update information was malformed in some way. update_status_unknown_format the update was not in any known format. update_status_security_error the update information was not correctly signed or there was an ssl error. auto update values constant description autoupdate_disable indicates that the add-on should not update automatically. autoupdate_default indicates that the add-on should update automatically only if that's the global default. autoupdate_enable indicates that the add-on should update automatically. pending operations constant description ...
...require a restart. op_needs_restart_enable enabling the add-on will require a restart. op_needs_restart_disable disabling the add-on will require a restart. op_needs_restart_uninstall uninstalling the add-on will require a restart. op_needs_restart_install installing the add-on will require a restart. installation scopes constant value description scope_all 15 a combination of all the installation scopes. scope_application 4 this add-on is a part of the current application (installed and owned by firefox). scope_profile 1 this add-on is installed in the current profile directory. scope_system 8 this add-on is installed somewhere global to the system (installed for a...
...And 4 more matches
L20n Javascript API
compiled) and use ctx.getsync and ctx.getentitysync to get translations synchronously. alternatively, you can register callbacks to execute when the context is ready (or when globals change and translations need to be updated) with ctx.localize. ctx.localize(['hello', 'new'], function(l10n) { var node = document.queryselector('[data-l10n-id=hello]'); node.textcontent = l10n.entities.hello.value; node.classlist.remove('hidden'); }); ctx.registerlocales(defaultlocale: string?, availablelocales: array<string>?) register the default locale of the context instance, as well as all other locales available to the context instance before the language negotiation. locales are referenced by their bcp 47 language codes. ctx.registerlocales('en-us', ['ar', 'es-ar', 'es-es', 'en-us', 'fr', 'p...
... - all locales available to the context instance, requested - locales preferred by the user, deflocale - the default locale to be used as the ultimate fallback, callback - the function to call when the negotiation completes (useful for asynchronous negotiators). it must return an array which is the final fallback chain of locales, or if the negotiation is asynchronous, it must return a falsy value and call the callback argument upon completion. ctx.registerlocalenegotiator(function(available, requested, deflocale, callback) { yourapp.getallavailablelanguages(function(allavailable) { var fallbackchain = yourapp.intersect(allavailable, requested); cb(fallbackchain); }); }); ctx.requestlocales(...requestedlocales: string?) specify the user's preferred locales for the context i...
... ctx.removeeventlistener(event: string, callback: function) remove an event listener previously registered with addeventlistener. ctx.updatedata(ctxdata: object) update the context data which will be available to all entities in the context. the ctxdata is an ...
...And 4 more matches
PKCS11 FAQ
Mozilla › Projects › NSS › PKCS11 › FAQ
keys. by looking up all certificates. certificates may be looked up by label. by convention, all certificates making up a single personality should have the same label (that is, a pair of certificates, one for signing and one for key exchange, should have the same label). s/mime-capable certificates are also looked up by issuer/serial number. certificates may be looked up by their der value. certificates may also be looked up by subject. more than one certificate can match, but each certificate with the same subject should be part of the same personality. nss may enumerate all the permanment certificates in a token (cka_token set to true). private keys must have the same cka_id value as their corresponding certificate, and this value must be unique on the token. orphaned...
...tificate can match, but each certificate with the same subject should be part of the same personality. nss may enumerate all the permanment certificates in a token (cka_token set to true). private keys must have the same cka_id value as their corresponding certificate, and this value must be unique on the token. orphaned keys have a cka_id generated from some part of the public key. this value is set when the key is generated, so that nss will be able to find the key when the certificate for that key is loaded. this case is interesting only for read/write tokens. what labels does nss use to identify certificates? nss can use the cka_label attribute to identify user certificates (see previous question) and presents this label to the user. therefore, each user certificate must ha...
...icates (see previous question) and presents this label to the user. therefore, each user certificate must have some label associated with it. the label for a token certificate is presented to the user as follows:token label :certificate label . this implies that eachtoken label should be unique and meaningful to the user, and that eachcertificate label should be unique to the token. nss gets the value of the cka_label attribute from the token. labels should not have any trailing blank characters. will nss use the random number generation features of pkcs #11? only if you identify your token as the default random number generator. if you do, your token must be able to generate random numbers even when it is not logged in. nss uses installed random number generators if pkcs11_mech_random_flag ...
...And 4 more matches
NSS Tools certutil
tabase, by using -d. some smart cards (for example, the litronic card) do not let you remove a public key you have generated. in such a case, only the private key is deleted from the key pair. you can display the public key with the command certutil -k -htokenname . -k list the keyid of keys in the key database. a keyid is the modulus of the rsa key or the publicvalue of the dsa key. ids are displayed in hexadecimal ("0x" is not shown). -a add an existing certificate to a certificate database. the certificate database should already exist; if one is not present, this option will initialize one by default. -d delete a certificate from the certificate database. -l list all ...
... list all the certificates, or display information about a named certificate, in a certificate database. use the -htokenname argument to specify the certificate database on a particular hardware or software token. -v check the validity of a certificate and its attributes. -m modify a certificate's trust attributes using the values of the -t argument. -h display a list of the options and arguments used by the certificate database tool. -w change the password to a key database. -u list all available modules or print a single named module. arguments -a use ascii format or allow the use...
... a virtual slot maintained in software, rather than a hardware device. internal slot 2 is used by key and certificate services. internal slot 1 is used by cryptographic services. -i cert|cert-request-file specify a specific certificate, or a certificate-request file. -k rsa|dsa|all specify the type of a key: rsa, dsa or both. the default value is rsa. by specifying the type of key you can avoid mistakes caused by duplicate nicknames. -l display detailed information when validating a certificate with the -v option. -m serial-number assign a unique serial number to a certificate being created. this operation should be performed by a ca. the default serial number is 0 (zero). ser...
...And 4 more matches
NSS tools : modutil
Mozilla › Projects › NSS › tools › modutil
rt.so} filepermissions{555} } xplat/instr.html { relativepath{%root%/docs/inst.html} absolutepath{/usr/local/netscape/docs/inst.html} filepermissions{555} } } } irix:6.2:mips { equivalentplatform { sunos:5.5.1:sparc } } } script grammar the script is basic java, allowing lists, key-value pairs, strings, and combinations of all of them. --> valuelist valuelist --> value valuelist <null> value ---> key_value_pair string key_value_pair --> key { valuelist } key --> string string --> simple_string "complex_string" simple_string --> [^ \t\n\""{""}"]+ complex_string --> ([^\"\\\r\n]|(\\\")|(\\\\))+ quotes and backslashes ...
...hat are forward compatible. if the current platform cannot be found in the list of supported platforms, then the forwardcompatible list is checked for any platforms that have the same os and architecture in an earlier version. if one is found, its attributes are used for the current platform. platforms (required) gives a list of platforms. each entry in the list is itself a key-value pair: the key is the name of the platform and the value list contains various attributes of the platform. the platform string is in the format system name:os release:architecture. the installer obtains these values from nspr. os release is an empty string on non-unix operating systems. nspr supports these platforms: o aix (rs6000) o bsdi (x86) o freebsd (x86) o...
...win95 (x86) o winnt (x86) for example: irix:6.2:mips sunos:5.5.1:sparc linux:2.0.32:x86 win95::x86 the module information is defined independently for each platform in the modulename, modulefile, and files attributes. these attributes must be given unless an equivalentplatform attribute is specified. per-platform keys per-platform keys have meaning only within the value list of an entry in the platforms list. modulename (required) gives the common name for the module. this name is used to reference the module by servers and by the modutil tool. modulefile (required) names the pkcs #11 module file for this platform. the name is given as the relative path of the file within the jar archive. files (required) lists the files that need to be inst...
...And 4 more matches
JS_Add*Root
olete since jsapi 31this 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. register a variable as a member of the garbage collector's root set, to protect anything the root points at from garbage collection. these functions are obsoleted, use js::persistentrooted instead. ...
...bage collector's root set, to protect anything the root points at from garbage collection. these functions are obsoleted, use js::persistentrooted instead. syntax jsbool js_addvalueroot(jscontext *cx, jsval *vp); jsbool js_addstringroot(jscontext *cx, jsstring **spp); jsbool js_addobjectroot(jscontext *cx, jsobject **opp); jsbool js_addgcthingroot(jscontext *cx, void **rp); jsbool js_addnamedvalueroot(jscontext *cx, jsval *vp, const char *name); jsbool js_addnamedstringroot(jscontext *cx, jsstring **spp, const char *name); jsbool js_addnamedobjectroot(jscontext *cx, jsobject **opp, const char *name); jsbool js_addnamedgcthingroot(jscontext *cx, void **rp, const char *name); name type description cx jscontext * the context in which to add the new root. requir...
...e); jsbool js_addnamedobjectroot(jscontext *cx, jsobject **opp, const char *name); jsbool js_addnamedgcthingroot(jscontext *cx, void **rp, const char *name); name type description cx jscontext * the context in which to add the new root. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
...And 4 more matches
JS_ExecuteScript
execute a compiled script. ...
... execute a compiled script. ...
...cx, js::autoobjectvector &scopechain, js::handlescript script, js::mutablehandlevalue rval); // added in spidermonkey 36 bool js_executescript(jscontext *cx, js::autoobjectvector &scopechain, js::handlescript script); // added in spidermonkey 36 bool js_executescript(jscontext *cx, js::handleobject obj, js::handlescript script, js::mutablehandlevalue rval); // obsolete since jsapi 39 bool js_executescript(jscontext *cx, js::handleobject obj, js::handlescript script); // obsolete since jsapi 39 bool js::cloneandexecutescript(jscontext *cx, js::handle<jsscript*> script); // added in spidermonkey 45 bool js::cloneandexecutescript(jscontext *cx, js::handle<jsobject*> obj, js::handle<jsscript*> script); // added in spi...
...And 4 more matches
JS_SetProperty
assign a value to a property of an object. syntax bool js_setproperty(jscontext *cx, js::handleobject obj, const char *name, js::handlevalue v); bool js_setucproperty(jscontext *cx, js::handleobject obj, const char16_t *name, size_t namelen, js::handlevalue v); bool js_setpropertybyid(jscontext *cx, js::handleobject obj, js::handleid id, js::handlevalue v); // added in spidermonkey 1.8.1 name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handlevalue object to which the property to set belongs. name or id const ...
...d, 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 behaves like the javascript expression obj[name] = v. js_setucproperty is the unicode version of the ...
... obj inherits such a property from a non-native object, then a new own property is added to obj, as described below. the new property is jsprop_enumerate. otherwise, if the lookup found a read-only property or obj non-extensible, nothing happens, but this is not an error. in strict mode, a warning is issued. otherwise, if obj has an own property with the given name, then the existing property's value is set as described below. creation of new properties one of the cases above involves creating a new own property on obj. the name of the new property is given by name or id. the initial stored value of the new property is undefined. its getter and setter are the jsclass.getproperty and setproperty hooks of obj's class, and its property attributes are exactly jsprop_enumerate. after the new pr...
...And 4 more matches
Property attributes
an application can set property attributes when creating a property. ...
...ttributes when creating a property. see js_defineproperty, js_fs, and js_fn flag description jsprop_enumerate the property is visible to javascript for...in and for each ... in loops, as well as to js_enumerate. this is the inverse of the ecma standard dontenum attribute. mxr id search for jsprop_enumerate jsprop_readonly the property's value cannot be set. in javascript 1.2 and lower, it is an error to attempt to assign a value to a read-only property. in javascript 1.3 and higher, as in ecmascript, attempts to set a value on a read-only property are ignored. this is the ecma standard readonly attribute. mxr id search for jsprop_readonly jsprop_permanent the property cannot be deleted. in javascript 1.2...
..._setter the property's setter is a javascript function, not a c/c++ function. see js_defineproperty for details. mxr id search for jsprop_setter jsprop_shared the property is shared. this is usually the right thing for properties that have getters or setters. this has three effects: the javascript engine does not set aside any memory for the property's value. the value is determined entirely by the getter. (the property has no stored value.) assignment via the prototype chain is affected. assigning to obj.x, where obj inherits a non-shared property from its prototype, creates a new own data property on obj; the prototype's .x is not shared with its children. if the inherited property is shared, the setter is called instead. if the property ...
...And 4 more matches
SpiderMonkey 31
s completed, the corresponding js_shutdown method (currently non-mandatory, but highly recommended as it may become mandatory in the future) uninitializes spidermonkey, cleaning up memory and allocations performed by js_init. a major change to spidermonkey in 31 is that its apis support a moving garbage collector. this entailed changing the vast majority of the jsapi from raw types, such as js::value or js::value*, to js::handle and js::mutablehandle template types that encapsulate access to the provided value/string/object or its location. the js::handle<js::value> and js::mutablehandle<js::value> classes have been specialized to implement the same interface as js::value, for simplicity and to ease migration pain. changes to introduce handles to the jsapi are not individually documented, b...
...are easy to detect and updating the code is a fairly straightforward job. here is a list of the most significant changes: many of the garbage collector changes require type signature changes to jsapi methods: specifically introducing js::rooted, js::handle, and js::mutablehandle types. these types, with the appropriate parametrizations, can roughly be substituted for plain types of gc things (values, string/object pointers, etc.). the jsbool type has been removed, along with the corresponding js_true and js_false constants. they have been replaced by bool, true, and false respectively. many jsclass and js::class instances are now explicitly const, and several apis have been updated to use const jsclass * and const js::class * pointers. all references to shortid/tinyid have been removed.
...internationalization library. this is unlikely to be of interest to embedders unless you are doing detailed memory profiling. it must be called before js_init is called. ...
...And 4 more matches
XForms Accessibility
. if you use xhtml1.x use tabindex. if you use xhtml2 use nextfocus. therefore since mozilla xforms works in xhtml (1.x) or xul documents only then we use tabindex instead. note, we support -moz-user-focus style neither for xhtml or xul. at api accessible properties this section describes common rules how accessibility properties are formed for forms control elements. name it is formed from value of child xforms label element if the element doesn't have labelledby attribute. description it is formed from value of child xforms hint element if the element doesn't have describedby attribute. state it is formed as well from model item properties (mips) of instance node that xforms element is bound to as from valid/invalid or in-range/out-of-range states of instance node. instance node sta...
...nd to as from valid/invalid or in-range/out-of-range states of instance node. instance node states are mapped to accessibility state constants declared in nsiaccessiblestates interface like it shown below: relevant - state_unavailable readonly - state_readonly required - state_required invalid - state_invalid out of range - state_invalid attributes redefines datatype aria attribute. its value is xml schema builit-in datatype of instance node that xforms element is bound to. children mozilla xforms implementation allows form control elements to have child elements. therefore accessible children are formed from any accessible child elements of form control element and from elements that are introduced by its presentation. forms controls module some of form control elements may be re...
...cs). this element is represented by multiline text field. output serves to show instance data that the element is bound to (see the spec, the docs). it can have the following presentations: text - see the docs. calendar - see the docs. upload provides a means for the user to select a file (see the spec, the docs). this element is represented by upload. range allows the user to choose a value from within a specific range of values (see the spec, the docs). currently it is represented by a slider only. trigger allows the user to initiate actions (see the spec, the docs). this element is represented by button. submit invokes the submission of the selected instance data to its target destination (see the spec, the docs). this element is represented by button. select allows the user...
...And 4 more matches
XUL Accessibility
shows how xul control elements are mapped to accessibility api. it is much in progress. at api general rules this section holds some rules applied to generating accessible name and description. ...
...this section holds some rules applied to generating accessible name and description. ...
...on. ...
...And 4 more matches
IAccessibleAction
esult name([in] long actionindex, [out] bstr name ); methods description() returns a description of the specified action of the object. [propget] hresult description( [in] long actionindex, [out] bstr description ); parameters actionindex 0 based index specifying which action's description to return. if it lies outside the valid range an empty string is returned. description the returned value is a localized string of the specified action. return value e_invalidarg if bad [in] passed, [out] value is null. s_false if there is nothing to return, [out] value is null. s_ok. doaction() performs the specified action on the object. hresult doaction( [in] long actionindex ); parameters actionindex 0 based index specifying the action to perform. if it lies outside the valid range no action...
...s_ok. keybinding() returns an array of bstrs describing one or more key bindings, if there are any, associated with the specified action. the returned strings are the localized human readable key sequences to be used to activate each action, e.g. "ctrl+shift+d". ...
...sed index specifying which action's key bindings should be returned. nmaxbindings this parameter is ignored. refer to @ref _arrayconsideration "special consideration when using arrays" for more details. keybindings an array of bstrs, allocated by the server, one for each key binding. free it with cotaskmemfree. nbindings the number of key bindings returned; the size of the returned array. return value e_invalidarg if bad [in] passed, [out] values are null and 0 respectively. s_false if there are no relations, [out] values are null and 0 respectively. s_ok. localizedname() returns the localized name of specified action. [propget] hresult localizedname( [in] long actionindex, [out] bstr localizedname ); parameters actionindex 0 based index specifying which action's localized name should be...
...And 4 more matches
IAccessibleHyperlink
this interface represents a hyperlink associated with a single substring of text or single non-text object. non-text objects can have either a single link or a collection of links such as when the non-text object is an image map. linked objects and anchors are implementation dependent. this interface is derived from iaccessibleaction. iaccessibleaction.nactions() is one greater than the maximum value for the indices used with the methods of this interface. furthermore, the object that implements this interface has to be connected implicitly or explicitly with an object that implements iaccessibletext. startindex() and endindex() are indices with respect to the text exposed by iaccessibletext. this interface provides access to a single object which can have multiple actions. an example is an i...
...link anchor, as appropriate for the link at the specified index. [propget] hresult anchor( [in] long index, [out] variant anchor ); parameters index a 0 based index identifies the anchor when, as in the case of an image map, there is more than one link represented by this object. the valid maximal index is indicated by iaccessibleaction.nactions(). anchor this is an implementation dependent value. for example, for a text link this method could return the substring of the containing string where the substring is overridden with link behavior, and for an image link this method could return an iunknown variant for iaccessibleimage. see the section about. return value e_invalidarg if bad [in] passed, [out] value is null. s_false if there is nothing to return, [out] value is null. s_ok. ancho...
...propriate for the link at the specified index. [propget] hresult anchortarget( [in] long index, [out] variant anchortarget ); parameters index a 0 based index identifies the anchor when, as in the case of an image map, there is more than one link represented by this object. the valid maximal index is indicated by iaccessibleaction.nactions(). anchortarget this is an implementation dependent value. for example this method could return a bstr variant of the uri. alternatively this method could return an iunknown variant of a com interface representing a target object to be activated when the link is activated. see the section about. return value e_invalidarg if bad [in] passed, [out] value is null. s_false if there is nothing to return, [out] value is null. s_ok. endindex() [propget] hresu...
...And 4 more matches
nsIAccessNode
monkey 2.1) the nsiaccessnode implementations are instantiated lazily. the nsiaccessnode tree for a given dom window has a one to one relationship to the dom tree. if the dom node for this access node is "accessible", then a queryinterface to nsiaccessible will succeed. ...
...ssnode implementations are instantiated lazily. the nsiaccessnode tree for a given dom window has a one to one relationship to the dom tree. if the dom node for this access node is "accessible", then a queryinterface to nsiaccessible will succeed. ...
...has a one to one relationship to the dom tree. if the dom node for this access node is "accessible", then a queryinterface to nsiaccessible will succeed. method overview nsiaccessnode getchildnodeat(in long childnum); obsolete since gecko 2.0 nsidomcssprimitivevalue getcomputedstylecssvalue(in domstring pseudoelt, in domstring propertyname); domstring getcomputedstylevalue(in domstring pseudoelt, in domstring propertyname); void scrollto(in unsigned long ascrolltype); void scrolltopoint(in unsigned long acoordinatetype, in long ax, in long ay); attributes note: attempting to access the attributes of a node that is unattached from the accessible tree will result in an exception - ns_error_failure. attribute type descriptio...
...And 4 more matches
nsIComponentRegistrar
ed or a directory containing component files to be unregistered. if aspec is null, then the application component's directory as defined by ns_xpcom_component_dir will be unregistered. see nsdirectoryservice. cidtocontractid() this method returns the contractid corresponding to a given classid. string cidtocontractid( in nscidref aclass ); parameters aclass the classid to be queried. return value the contractid corresponding to aclassid if one exists and is registered. contractidtocid() returns the classid for a given contractid, if one exists and is registered. nscidptr contractidtocid( in string acontractid ); parameters acontractid the contractid to be queried. return value the classid corresponding to acontractid if one exists and is registered. enumeratecids() this method return...
...elements of the enumerator implement nsisupportsid. enumeratecontractids() this method returns an enumerator over the list of registered contractids. elements of the enumeration can be queryinterfaced for the nsisupportscstring interface. ...
...lasses. elements of the enumerator implement nsisupportsid. enumeratecontractids() this method returns an enumerator over the list of registered contractids. elements of the enumeration can be queryinterfaced for the nsisupportscstring interface. from the nsisupportscstring interface, you can obtain the actual contractid string. nsisimpleenumerator enumeratecontractids(); parameters none. return value an nsisimpleenumerator over the list of registered classes. elements of the enumerator implement nsisupportscstring. iscidregistered() this method is used to test for the existence of a specific classid. boolean iscidregistered( in nscidref aclass ); parameters aclass the classid to be queried. return value true if a factory is registered for the classid, false otherwise. iscontractidregiste...
...And 4 more matches
nsICookieManager2
nderbird 3.1 / fennec 1.0) inherits from: nsicookiemanager this interface is included in the services.jsm javascript code module. ...
...igned long acountfromhost); obsolete since gecko 1.9 nsisimpleenumerator getcookiesfromhost(in autf8string ahost); void importcookies(in nsifile acookiefile); methods add() adds a cookie. nsicookieservice is the normal way to do this. this method is something of a back door. void add( in autf8string ahost, in autf8string apath, in acstring aname, in acstring avalue, in boolean aissecure, in boolean aishttponly, in boolean aissession, in print64 aexpiry ); parameters ahost the host or domain for which the cookie is set. presence of a leading dot indicates a domain cookie; otherwise, the cookie is treated as a non-domain cookie. see rfc2109 for details. the host string will be normalized to ascii or ace; any trailing dot will be stripped. to be ...
.... see rfc2109 for details. the host string will be normalized to ascii or ace; any trailing dot will be stripped. to be a domain cookie, the host must have at least two subdomain parts (e.g. '.foo.com', not '.com'), otherwise an exception will be thrown. an empty string is acceptable (e.g. file:// uri's). apath the path within the domain for which the cookie is valid. aname the cookie name. avalue the cookie data. aissecure true if the cookie should only be sent over a secure connection. aishttponly true if the cookie should only be sent to, and can only be modified by, an http connection. aissession true if the cookie should exist for the current session only. aexpiry holds the expiration date, in seconds since the epoch. only relevant if aissession is false. cookieexists() re...
...And 4 more matches
nsICookiePermission
these may be relocated somewhere else if we ever consider f...
...these may be relocated somewhere else if we ever consider freezing this interface. methods canaccess() tests whether or not t...
...these may be relocated somewhere else if we ever consider freezing this interface. methods canaccess() tests whether or not the given uri/channel may access the cookie database, ...
...And 4 more matches
nsIDOMEvent
void settarget(in nsidomeventtarget atarget); native code only! void settrusted(in boolean atrusted); native code only! void stopimmediatepropagation(); void stoppropagation(); attributes attribute type description bubbles boolean used to indicate whether or not an event is a bubbling event. if the event can bubble the value is true, else the value is false. read only. cancelable boolean used to indicate whether or not an event can have its default action prevented. if the default action can be prevented the value is true, else the value is false. read only. currenttarget nsidomeventtarget used to indicate the eventtarget whose eventlisteners are currently being processed. this is partic...
...ginal target of the event, before any retargetings. read only. target nsidomeventtarget used to indicate the eventtarget to which the event was originally dispatched. read only. timestamp domtimestamp used to specify the time (in milliseconds relative to the epoch) at which the event was created. ...
...t nsidomeventtarget used to indicate the eventtarget to which the event was originally dispatched. read only. timestamp domtimestamp used to specify the time (in milliseconds relative to the epoch) at which the event was created. due to the fact that some systems may not provide this information the value of timestamp may be not available for all events. when not available, a value of 0 will be returned. examples of epoch time are the time of the system start or 0:0:0 utc 1st january 1970. read only. type domstring the name of the event (case-insensitive). the name must be an xml name. read only. constants constant value description none 0 the event is not being dispatched. capturing_phase 1 the current ev...
...And 4 more matches
getFile
ng for a given standard path location. the individual platform implementation of nsidirectoryserviceprovider maps the symbolic path location passed to this function and returns the appropriate nsifile. nsifile getfile( in string aname, out boolean apersistent ); parameters aname [in] the symbolic name for a file or directory location. see symbolic names below for a list of accepted values. xpcom file system aliases apersistent [out] this output parameter indicates to the caller whether or not the returned location is persistent. if true, this lets the directory service cache results to improve the performance of directory lookups. if false, then the directory service will not cache the results of this method. symbolic names the list of symbolic names is subject to chan...
...symbolic names the list of symbolic names is subject to change, so be sure to take a look at the xpcom/io/nsdirectoryservicedefs.h file for the version of gecko you're working with for the latest list. available on all platforms these symbolic names are available on all platforms (although, of course, they may refer to different physical paths on the storage device). c constant string value notes ns_os_home_dir "home" ns_os_temp_dir "tmpd" ns_os_current_working_dir "curworkd" ns_os_desktop_dir "desk" otherwise same as home ns_os_current_process_dir "curprocd" ns_xpcom_current_process_dir "xcurprocd" can be overriden by passing a "bin directory" to ns_initxpcom2(). ns_xpc...
...his change, firefox would not work on any mac os x newer than 10.9.4. ns_gre_component_dir "grecomsd" platform-specific locations some symbolic names represent platform-specific locations. the following sections cover these. available on both mac and unix these locations are available on both mac os x and unix implementations of gecko. ...
...And 4 more matches
nsIINIParser
inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) typically, you'll create an nsiiniparser object by calling nsiiniparserfactory.createiniparser(). also, if you need to write to an ini file, use nsiiniparserwriter. ...
...ringenumerator getsections(); autf8string getstring(in autf8string asection, in autf8string akey); methods getkeys() returns an nsiutf8stringenumerator providing the keys available within the specified section of the ini file. nsiutf8stringenumerator getkeys( in autf8string asection ); parameters asection the name of the section whose keys you wish to enumerate. ...
...r getkeys( in autf8string asection ); parameters asection the name of the section whose keys you wish to enumerate. return value an nsiutf8stringenumerator object that can be used to access the section's keys. getsections() returns an nsiutf8stringenumerator providing a list of the sections available within the ini file. nsiutf8stringenumerator getsections(); parameters none. return value an nsiutf8stringenumerator object that can be used to access the sections in the ini file. getstring() returns the string value for the specified key within a particular section of the ini file. autf8string getstring( in autf8string asection, in autf8string akey ); parameters asection the section containing the key whose value is to be returned. akey the key for which the va...
...And 4 more matches
nsIInstallLocation
s install location in loading. read only. restricted boolean whether or not this install location is on an area of the file system that could be restricted on a restricted-access account, regardless of whether or not the location is restricted with the current user privileges. read only. constants constants representing priority of some default install locations. ...
... restricted boolean whether or not this install location is on an area of the file system that could be restricted on a restricted-access account, regardless of whether or not the location is restricted with the current user privileges. read only. constants constants representing priority of some default install locations. ...
...the location is restricted with the current user privileges. read only. constants constants representing priority of some default install locations. you should not use the exact values here, you should offset from these values each time you create a new install location. offsetting can be brittle but you should know what install locations are being defined for your own application. constant value description priority_app_profile 0 priority_app_system_user 10 priority_xre_system_user 100 priority_app_system_global 1000 priority_xre_system_global 10000 methods getidforlocation() retrieves the guid for an item at the specified location. note: this function makes no promises about whether or not this path is actually maintained by this install location. astring getidfor...
...And 4 more matches
nsILocalFile
calfile fromfile, in acstring relativedesc); attributes attribute type description diskspaceavailable print64 the number of bytes available to non-superuser on the disk volume containing the nsilocalfile. read only. followlinks prbool determines whether or not the nsilocalfile will automatically resolve symbolic links. by default, this value is false on all non-unix systems. as of mozilla 1.7, this attribute is ignored on unix systems. persistentdescriptor acstring on some platforms, the value of nsifile.path may be insufficient to uniquely identify the file on the local file system. the persistent descriptor is intended to be used whenever a nsilocalfile needs to be serialized to disk and later recovered. this st...
... attribute is ignored on unix systems. persistentdescriptor acstring on some platforms, the value of nsifile.path may be insufficient to uniquely identify the file on the local file system. the persistent descriptor is intended to be used whenever a nsilocalfile needs to be serialized to disk and later recovered. this string is not intended for display to users. note: the value of the followlinks attribute is not encoded in the persistent descriptor. constants constant value description delete_on_close 0x80000000 optional parameter used by opennsprfiledesc(). methods native code only! appendrelativenativepath appends a relative, native character encoding, path to the current path of the nsilocalfile object. void ...
...th a path separator character or otherwise contains invalid characters. getrelativedescriptor() returns a relative file path in an opaque, cross platform format. it is therefore not a native path. acstring getrelativedescriptor( in nsilocalfile fromfile ); parameters fromfile the file from which the descriptor is relative. there is no defined result if this parameter is null. return value an opaque string value with undefined character encoding. this string is not intended for display to users. the result returned from this method may be used with setrelativedescriptor() to initialize a nsilocalfile instance. initwithfile() initializes this object with another file. void initwithfile( in nsilocalfile afile ); parameters afile the file this becomes equivalent to. ini...
...And 4 more matches
nsIMessenger
onmanager nsitransactionmanager readonly: the transaction manager for this nsimessenger instance. sendingunsentmsgs boolean indicates if sending messages is in progress. lastdisplayedmessageuri acstring readonly: the url of the last displayed message. navigatepos long the current index in the navigation history. constants name value description eunknown 0 unknown transaction type. edeletemsg 1 delete transaction type. emovemsg 2 move transaction type. ecopymsg 3 copy transaction type. methods setdisplaycharset() sets the character set for the displayed message. void setdisplaycharset(in acstring acharset); parameters acharset the character set to...
... in acstring aurl); parameters awin a window. as far as i can tell this isn't used or checked. aurl the url to open. launchexternalurl() launches the nsiexternalprotocolservice and sends it the url. void launchexternalurl(in acstring aurl); parameters aurl the url to open. canundo() queries if there are any undo items in the transaction manager. boolean canundo(); return value boolean representing whether undo is available. canredo() queries if there are any redo items in the transaction manager. boolean canredo(); return value boolean representing whether redo is available. getundotransactiontype() gets the type of the next undo transaction. unsigned long getundotransactiontype(); return value a long representing the type of the transaction. see...
...see #constants for available types. undo() performs the next undo transaction. void undo(in nsimsgwindow msgwindow); parameters msgwindow the nsimsgwindow to perform the undo transaction on. ...
...And 4 more matches
nsINavBookmarkObserver
arent, in print32 index); obsolete since gecko 1.9 void onitemadded(in long long aitemid, in long long aparentid, in long aindex, in unsigned short aitemtype, in nsiuri auri, in autf8string atitle, in prtime adateadded, in acstring aguid, in acstring aparentguid); void onitemchanged(in long long aitemid, in acstring aproperty, in boolean aisannotationproperty, in autf8string anewvalue, in prtime alastmodified, in unsigned short aitemtype, in long long aparentid, in acstring aguid, in acstring aparentguid); void onitemmoved(in long long aitemid, in long long aoldparentid, in long aoldindex, in long long anewparentid, in long anewindex, in unsigned short aitemtype, in acstring aguid, in acstring aoldparentguid, in acstring anewparentguid); void onitemremoved(i...
... id of the folder to which the item was added. aindex the item's index in the folder. aitemtype the type of the item that was added. this should be one of the nsinavbookmarksservice.type constants. auri the uri of the item that was added when aitemtype is type_bookmark, null otherwise. atitle the title of the added item. adateadded the stored date added value, in microseconds from the epoch. aguid the unique id associated with the item. aparentguid the unique id associated with the item's parent. onitemchanged() this method notifies this observer that an item's information has changed. it is called whenever any attributes like "title" are changed. void onitemchanged( in long long aitemid, in acstring aproperty, in boolean aisa...
...uid the unique id associated with the item. aparentguid the unique id associated with the item's parent. onitemchanged() this method notifies this observer that an item's information has changed. it is called whenever any attributes like "title" are changed. void onitemchanged( in long long aitemid, in acstring aproperty, in boolean aisannotationproperty, in autf8string anewvalue, in prtime alastmodified, in unsigned short aitemtype, in long long aparentid, in acstring aguid, in acstring aparentguid ); parameters aitemid the id of the item that was changed. aproperty the property which changed. if this string is empty, all properties have been deleted. in this situation, you should not attempt to get any properties, since this will result in th...
...And 4 more matches
nsINavHistoryQuery
annotation autf8string the annotation name. annotationisnot boolean test for existance or non-existance of a given annotation. we don't currently support >1 annotation name per query. if annotationisnot...
... annotation autf8string the annotation name. ...
...mark folders -- use the bookmark service's getfolderuri) as well as anything else that may have been tagged with an annotation. this will only work for results_as_uri since there will be no visits for these items. begintime prtime begin time range for results (inclusive). begintimereference long one of the constants time_relative_* which indicates how to interpret the corresponding begin time value. domain autf8string this is the host or domain name (controlled by domainishost). when domainishost, domain only does exact matching on host names. otherwise, it will return anything whose host name ends in domain. this one is a little different than most. setting it to an empty string is a real query and will match any uri that has no host name (local files and such). set this to null (in c++ ...
...And 4 more matches
nsINavHistoryQueryOptions
e sorting (as opposed to letting the database do it for us). instead, we get the result ordered by date, pick the maxresult most recent ones, and then sort by title. querytype short the type of search to use when querying the db; this attribute is only honored by query nodes. it is silently ignored for simple folder queries. see query type constants for possible values. redirectsmode unsigned short specifies how to handle redirects; see redirects mode constants for details. the default value is redirects_mode_all. note: this option is only used on query_type_history. resolvenullbookmarktitles boolean if a bookmark title is null (note, not empty), attempt to use the hist...
...he default value is redirects_mode_all. note: this option is only used on query_type_history. resolvenullbookmarktitles boolean if a bookmark title is null (note, not empty), attempt to use the history title. it is set to false by default. resulttype short sets the result type. see result type constants for possible values. showsessions boolean separate/group history items based on session information. only matters when sorting by date. sortingannotation autf8string the annotation to use in sort_by_annotation_* sorting modes. sortingmode short the sorting annotation to use; see sorting methods for possible values. constant...
... sort_by_title_ascending 1 sort by the ascending title order. ...
...And 4 more matches
nsINavHistoryResultNode
tional query, so for performance reasons that information isn't given by default). read only. bookmarkindex long when this item is in a bookmark folder (its parent is of type folder), this is the index into that folder at which this node resides. these indices start at 0 and increase in the order at which the nodes appear in the bookmark folder. for items that are not in a bookmark folder, this value is -1. read only. dateadded prtime if the node is an item (bookmark, folder, or separator), this value is the time at which the item was created. for other nodes, this value is 0. read only. icon autf8string this uri can be used as an image source uri and will give you the favicon for the page. it is not the actual uri of the favicon, but, rather, is something that will resolve to the actual ...
...avicon service. if the entry doesn't have a favicon, this is the chrome uri of the default favicon. if the favicon originally lived in chrome, this will be the original chrome uri of the icon. read only. note: prior to gecko 1.9.2, this was an nsiuri. indentlevel long this is the number of levels between this node and the top of the hierarchy. the members of result.children have an indentlevel value of zero, their children have an indentlevel of 1, and so forth. the indent level of the root node is set to -1. read only. itemid long long if the node is an item (bookmark, folder, or separator), this value is the row id of that bookmark in the database. for other nodes, this value is set to -1. read only. lastmodified prtime if the node is an item (bookmark, folder, or separator), this val...
...read only. ...
...And 4 more matches
nsIPrincipal
s congruent with htmldocument.domain, and may be null. setting this has no effect on the uri. native code only! fingerprint autf8string the fingerprint id of this principal's certificate. throws if there is no certificate associated with this principal. read only. hascertificate boolean whether this principal is associated with a certificate. read only. hashvalue unsigned long returns a hash value for the principal. read only. native code only! origin string the origin of this principal's codebase uri. an origin is defined as: scheme + host + port. read only. prettyname autf8string the pretty name for the certificate. this sort of (but not really) identifies the subject of the certificate (the entity that stands be...
...together with some information on what they mean in between). throws if there is no certificate associated with this principal. read only. uri nsiuri the codebase uri to which this principal pertains. this is generally the document uri. read only. note: this wasn't accessible by scripts prior to gecko 2.0. ...
...he codebase uri to which this principal pertains. this is generally the document uri. read only. note: this wasn't accessible by scripts prior to gecko 2.0. constants principal capability constants these values indicate the capabilities of a principal. the order is significant; if an operation is performed on a set of capabilities, the minimum is computed. ...
...And 4 more matches
nsIRequest
pending, the request is a member of the load group. it is the responsibility of the request to implement this policy. name autf8string the name of the request. often this is the uri of the request. read only. status nsresult the error status associated with the request. read only. constants various load flags which may be or'd together. ...
...it does not, however, prevent cached content from being used to satisfy this request. inhibit_persistent_caching 1 << 8 this flag prevents caching on disk (or other persistent media), which may be needed to preserve privacy. ...
...is request. inhibit_persistent_caching 1 << 8 this flag prevents caching on disk (or other persistent media), which may be needed to preserve privacy. for https, this flag is set automatically. the following flags control what happens when the cache contains data that could perhaps satisfy this request. they are listed in descending order of precedence. constant value description load_bypass_cache 1 << 9 force an end-to-end download of content data from the origin server. this flag is used for a shift-reload. load_from_cache 1 << 10 load from the cache, bypassing protocol specific validation logic. this flag is used when browsing via history. it is not recommended for normal browsing as it may likely violate reasonable assumpti...
...And 4 more matches
nsISHEntry
. docshellid unsigned long long the history id of the docshell. document nsidomdocument dom document. obsolete since gecko 1.8 expirationstatus boolean indicates whether the page is already expired in cache. id unsigned long an id to help identify this entry from others during subframe navigation. layouthistorystate nsilayouthistorystate layouthistorystate for scroll position and form values. loadtype unsigned long the loadtype for this entry. this is typically loadhistory except when reload is pressed, it has the appropriate reload flag. owner nsisupports get the owner, if any, that was associated with the channel that the document that was loaded to create this history entry came from. pageidentifier unsigned long an integer that should be the same for two entries attached ...
...shells are restored as children of the parent docshell, in this order, when the parent docshell restores a saved presentation. append a child shell to the end of our list. void addchildshell( in nsidocshelltreeitem shell ); parameters shell childshellat() nsidocshelltreeitem childshellat( in long index ); parameters index the child shell at index; null if index is out of bounds. return value clearchildshells() clear the child shell list. void clearchildshells(); parameters none. clone() nsishentry clone(); parameters none. return value native code only!create additional ways to create an entry. void create( in nsiuri uri, in astring title, in nsiinputstream inputstream, in nsilayouthistorystate layouthistorystate, in nsisupports cachekey, in acstring contenttype, in...
...tion ); parameters uri title inputstream layouthistorystate cachekey contenttype owner docshellid dynamiccreation violates the xpcom interface guidelines forgeteditordata() gets the owning pointer to the editor data assosicated with this shistory entry. this forgets its pointer, so free it when you're done. nsdocshelleditordataptr forgeteditordata(); parameters none. ...
...And 4 more matches
nsISearchEngine
netwerk/base/public/nsibrowsersearchservice.idlscriptable please add a summary to this article. last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) inherits from: nsisupports method overview void addparam(in astring name, in astring value, in astring responsetype); nsisearchsubmission getsubmission(in astring data, [optional] in astring responsetype, [optional] in astring purpose); boolean supportsresponsetype(in astring responsetype); attributes attribute type description alias astring an optional shortcut alias for the engine. when non-null, this is a unique identifier. description astring a text description describing the e...
...be null. read only. name astring the display name of the search engine. this is a unique identifier. read only. searchform astring a url string pointing to the engine's search form. read only. type long the search engine type. read only. constants search engine type constants constant value description type_mozsearch 1 type_sherlock 2 type_opensearch 3 search engine data type constants constant value description data_xml 1 data type is xml data_text 2 data type is text. methods addparam() ...
...must not be null. ...
...And 4 more matches
nsIXULTemplateResult
query. the result may optionally be identified by an rdf resource. generally, the result and its id will be able to uniquely identify a node in the source data, such as an rdf or xml node. in other contexts, such as a database query, a result would represent a particular record. a result is expected to only be created by a query processor. each result also contains a set of variable bindings. the value for a particular variable may be retrieved using the getbindingfor() and getbindingobjectfor() methods. method overview astring getbindingfor(in nsiatom avar); nsisupports getbindingobjectfor(in nsiatom avar); void hasbeenremoved(); void rulematched(in nsisupports aquery, in nsidomnode arulenode); attributes at...
... nsisupports getbindingobjectfor(in nsiatom avar); void hasbeenremoved(); void rulematched(in nsisupports aquery, in nsidomnode arulenode); attributes attribute type description id astring id of the result. the dom element created for this result, if any, will have its id attribute set to this value. the id must be unique for a query. iscontainer boolean true if the result represents a container. read only. isempty boolean true if the result represents an empty container. read only. mayprocesschildren boolean true if the template builder may use this result as the reference point for additional recursive proc...
...e, child content is not processed. this property identifies only the default handling and may be overridden by syntax used in the template. read only. resource nsirdfresource resource for the result, which may be null. if set, the resource uri must be the same as the id property. read only. type astring the type of the object. the predefined value 'separator' may be used for separators. other values may be used for application specific purposes. read only. methods getbindingfor() get the string representation of the value of a variable for this result. this string will be used in the action body from a template as the replacement text. for instance, if the text ?name appears in an attribute within the action body, it will be repla...
...And 4 more matches
nsMsgSearchOp
defined in comm-central/ mailnews/ base/ search/ public/ nsmsgsearchcore.idl typedef long nsmsgsearchopvalue; [scriptable, uuid(9160b196-6fcb-4eba-aaaf-6c806c4ee420)] interface nsmsgsearchop { const nsmsgsearchopvalue contains = 0; /* for text attributes */ const nsmsgsearchopvalue doesntcontain = 1; const nsmsgsearchopvalue is = 2; /* is and isn't also apply to some non-text attrs */ const nsmsgsearchopvalue isnt = 3; const nsmsgsearchopvalue isempty = 4; const nsmsgsearchopvalue isbefore = 5; /* for date attributes */ const nsmsgsearchopvalue isafter = 6; const nsmsgsearchopvalue ishigherthan = 7; /* for priority. is also applies */ const nsmsgsearchopvalue islowerthan = 8; const nsmsgsearchopvalue beginswit...
...earchopvalue isnt = 3; const nsmsgsearchopvalue isempty = 4; const nsmsgsearchopvalue isbefore = 5; /* for date attributes */ const nsmsgsearchopvalue isafter = 6; const nsmsgsearchopvalue ishigherthan = 7; /* for priority. ...
...value isempty = 4; const nsmsgsearchopvalue isbefore = 5; /* for date attributes */ const nsmsgsearchopvalue isafter = 6; const nsmsgsearchopvalue ishigherthan = 7; /* for priority. ...
...And 4 more matches
XPCOM string functions
xpcom provides these low-level string functions to let you work with strings; however, it's often better to use one of the string classes rather than directly using these functions. ns_cstringappenddatathe ns_cstringappenddata function appends data to the existing value of a nsacstring instance. this is a low-level api.ns_cstringclonedatathe ns_cstringclonedata function returns a null-terminated, heap allocated copy of the string's internal buffer.ns_cstringcontainerfinishthe ns_cstringcontainerfinish function releases any memory allocated by a nscstringcontainer instance.ns_cstringcontainerinitthe ns_cstringcontainerinit function initializes a nscstringcontainer instance for use as a nsacstring.ns_cstringcontainerinit2the ns_cstringcontainerinit2 function initializes a nscstringco...
...this is a low-level api.ns_cstringcutdatathe ns_cstringcutdata function removes a section of the string's internal buffer. this is a low-level api.ns_cstringgetdatathe ns_cstringgetdata function gives the caller read access to the string's internal buffer.ns_cstringgetmutabledatathe ns_cstringgetmutabledata function gives the caller write access to the str...
...function removes a section of the string's internal buffer. ...
...And 4 more matches
Working with windows in chrome code
watcher's methods. var ww = components.classes["@mozilla.org/embedcomp/window-watcher;1"] .getservice(components.interfaces.nsiwindowwatcher); var win = ww.openwindow(null, "chrome://myextension/content/about.xul", "aboutmyextension", "chrome,centerscreen", null); window object note the win variable in the above section, which is assigned the return value of window.open. it can be used to access the opened window. the return value of window.open (and similar methods) is a window object (usually chromewindow) – the same type as the window variable. technically speaking, it implements a number of interfaces, including nsidomjswindow and nsidomwindow, but it also contains the user-defined properties for global variables and functions of the window...
...n you open a window using window.opendialog or nsiwindowwatcher.openwindow, you can pass an arbitrary number of arguments to that window. arguments are simple javascript objects, accessible through window.arguments property in the opened window. in this example, we're using window.opendialog to open a progress dialog. we pass in the current status text as well as the maximum and current progress values. note that using nsiwindowwatcher.openwindow is a bit less trivial . todo: link to how to pass an xpcom object to a new window when it has a more useful example opener code: window.opendialog("chrome://test/content/progress.xul", "myprogress", "chrome,centerscreen", {status: "reading remote data", maxprogress: 50, progress: 10} ); progress.xul: <?xml versi...
... 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="progressmeter" mode="determined" /> <button label="cancel" oncommand="close();" /> </hbox> </window> example 2: interacting with the opener sometimes an opened window needs to i...
...And 4 more matches
Debugger.Environment - Firefox Developer Tools
t a debugger.environment instance inherits the following accessor properties from its prototype: inspectable true if this environment is a debuggee environment, and can therefore be inspected. false otherwise. all other properties and methods of debugger.environment instances throw if applied to a non-inspectable environment. type the type of this environment object, one of the following values: “declarative”, indicating that the environment is a declarative environment record. function calls, calls to eval, let blocks, catch blocks, and the like create declarative environment records. “object”, indicating that the environment’s bindings are the properties of an object. the global object and dom elements appear in the chain of environments via object environ...
...eerror (since declarative environment records have no such object). both "object" and "with" environments have object properties that provide the object whose properties they reflect as variable bindings. callee if this environment represents the variable environment (the top-level environment within the function, which receives var definitions) for a call to a functionf, then this property’s value is a debugger.object instance referring tof. otherwise, this property’s value is null. optimizedout true if this environment is optimized out. false otherwise. for example, functions whose locals are never aliased may present optimized-out environments. when true, getvariable returns an ordinary javascript object whose optimizedout property is true on all bindings, and setvariable throws a re...
...d out. false otherwise. for example, functions whose locals are never aliased may present optimized-out environments. when true, getvariable returns an ordinary javascript object whose optimizedout property is true on all bindings, and setvariable throws a referenceerror. ...
...And 4 more matches
Debugger.Source - Firefox Developer Tools
ebassembly code, its properties provide the serialized text as a string. currently only entire modules evaluated via new webassembly.module are represented. spidermonkey constructs exactly one debugger.source for each underlying webassembly module per debugger instance. please note at the time of this writing, support for webassembly is very preliminary. many properties below return placeholder values. convention for descriptions of properties and methods below, if the behavior of the property or method differs between the instance referring to javascript source or to a block of webassembly code, the text will be split into two sections, headed by “if the instance refers to javascript source” and “if the instance refers to webassembly code”, respectively. if the behavior does not di...
...e” and “if the instance refers to webassembly code”, respectively. if the behavior does not differ, no such emphasized headings will appear. accessor properties of the debugger.source prototype object a debugger.source instance inherits the following accessor properties from its prototype: text if the instance refers to javascript source, the javascript source code, as a string. the value satisfies the program, functiondeclaration, or functionexpression productions in the ecmascript standard. if the instance refers to webassembly code, the serialized text representation. the format is yet to be specified in the webassembly standard. currently, the text is an s-expression based syntax. the text generation is disabled if the debugger has the allowwasmbinarysource property set, the...
... the program, functiondeclaration, or functionexpression productions in the ecmascript standard. if the instance refers to webassembly code, the serialized text representation. the format is yet to be specified in the webassembly standard. currently, the text is an s-expression based syntax. the text generation is disabled if the debugger has the allowwasmbinarysource property set, the "[wasm]" value will be returned in this case. binary if the instance refers to webassembly code and the debugger has the allowwasmbinarysource property set, a uint8array that contains the webassembly bytecode. url if the instance refers to javascript source, the filename or url from which this script’s code was loaded. for scripts created by eval or the function constructor, this may be a synthesized ...
...And 4 more matches
Network request list - Firefox Developer Tools
ation you are looking for easier to view. the mouse pointer changes to a resize icon when you move it over the border of a column. you can drag to manually set the size of column. starting in firefox 76 you can double-click a column divider to resize the column to the left of it to fit its contents. the reset columns command on the context menu also resets the width of the columns to the default values. clicking the column header label sorts the request list by that column. you can reset the sort to the default by selecting "reset sorting" from the context menu. here is a list of all available columns: status: the http status code returned. the numeric code is displayed on a colored background, to help unusual ones stand out. if there was no response, this column is empty. or you migh...
...number of request cookies associated to the request. this column is hidden by default. this is new in firefox 55. set-cookies: the number of response cookies associated to the request. this column is hidden by default. this is new in firefox 55. transferred: the number of bytes that were actually transferred to load the resource, or a message about why the resource was not transferred. a number value is less than size if the resource was compressed. if the resource was fetched from a service worker cache, then this cell displays "service worker". cached resources may be fetched from the cache and the network simultaneously, which may improve load time for slow caches. starting with firefox 68, the transferred column lists either "cached (raced)" or "[size] (raced)" depending on the f...
... for example, the query "-google.com" will show all requests that don't have "google.com" in the url. request properties use the search box in the toolbar. see next section. filtering by properties the search box recognizes specific keywords, which can be used to filter the requests by specific request properties. those keywords are followed by a colon and a related filter value. the filter values are matched case insensitive. prepending a minus (-) negates the filter. you can combine different filters together by separating them with a space. keyword meaning examples status-code shows resources that have the specific http status code. status-code:304 method shows resources that have were requested via the specific http request ...
...And 4 more matches
Web Console remoting - Firefox Developer Tools
ences packet: { "to": "conn0.console9", "type": "setpreferences", "preferences": { "networkmonitor.saverequestandresponsebodies": false } } reply: { "updated": [ "networkmonitor.saverequestandresponsebodies" ], "from": "conn0.console10" } for convenience you can use webconsoleclient.setpreferences(prefs, onresponse). the prefs argument is an object like { prefname: prefvalue, ... }. in firefox 25 we added the getpreferences request packet: { "to": "conn0.console34", "type": "getpreferences", "preferences": [ "networkmonitor.saverequestandresponsebodies" ] } reply packet: { "preferences": { "networkmonitor.saverequestandresponsebodies": false }, "from": "conn0.console34" } you can also use the webconsoleclient.getpreferences(prefs, onrespo...
...to": "conn0.console34", "type": "getpreferences", "preferences": [ "networkmonitor.saverequestandresponsebodies" ] } reply packet: { "preferences": { "networkmonitor.saverequestandresponsebodies": false }, "from": "conn0.console34" } you can also use the webconsoleclient.getpreferences(prefs, onresponse). the prefs argument is an array of preferences you want to get their values for, by name. private browsing the browser console can be used while the user has private windows open. each page error, console api message and network request is annotated with a private flag. private messages are cleared whenever the last private window is closed. the console actor provides the lastprivatecontextexited notification: { "from": "conn0.console19", "type": "lastprivatecont...
...le actor, it does not make sense for tab console actors. this notification has been introduced in firefox 24. send http requests starting with firefox 25 you can send an http request using the console actor: { "to": "conn0.console9", "type": "sendhttprequest", "request": { "url": "http://localhost", "method": "get", "headers": [ { name: "header-name", value: "header value", }, // ... ], }, } the response packet is a network event actor grip: { "to": "conn0.console9", "eventactor": { "actor": "conn0.netevent14", "starteddatetime": "2013-08-26t19:50:03.699z", "url": "http://localhost", "method": "get" "isxhr": true, "private": false } } you can also use the webconsoleclient.sendhttprequest(request, ...
...And 4 more matches
AudioListener.positionX - Web APIs
the positionx read-only property of the audiolistener interface is an audioparam representing the x position of the listener in 3d cartesian space. note: the parameter is a-rate when used with a pannernode whose pannernode is set to equalpower, or k-rate otherwise. syntax var audioctx = new audiocontext(); var mylistener = audioctx.listener; mylistener.positionx.value = 1; value an audioparam. its default value is 0, and it can range between positive and negative infinity. example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of on...
...en update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer p...
...e panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); var zpos = 295; // define ...
...And 4 more matches
AudioListener.positionY - Web APIs
the positiony read-only property of the audiolistener interface is an audioparam representing the y position of the listener in 3d cartesian space. note: the parameter is a-rate when used with a pannernode whose pannernode is set to equalpower, or k-rate otherwise. syntax var audioctx = new audiocontext(); var mylistener = audioctx.listener; mylistener.positiony.value = 1; value an audioparam. its default value is 0, and it can range between positive and negative infinity. example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of on...
...en update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer p...
...e panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); var zpos = 295; // define ...
...And 4 more matches
AudioListener.positionZ - Web APIs
the positionz read-only property of the audiolistener interface is an audioparam representing the z position of the listener in 3d cartesian space. note: the parameter is a-rate when used with a pannernode whose pannernode is set to equalpower, or k-rate otherwise. syntax var audioctx = new audiocontext(); var mylistener = audioctx.listener; mylistener.positionz.value = 1; value an audioparam. its default value is 0, and it can range between positive and negative infinity. example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of on...
...en update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer p...
...e panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); var zpos = 295; // define ...
...And 4 more matches
AudioListener.setPosition() - Web APIs
the setposition() method of the audiolistener interface defines the position of the listener. the three parameters x, y and z are unitless and describe the listener's position in 3d space according to the right-hand cartesian coordinate system. pannernode objects use this position relative to individual audio sources for spatialisation. the default value of the position vector is (0, 0, 0). syntax var audioctx = new audiocontext(); var mylistener = audioctx.listener; mylistener.setposition(1,1,1); returns void. example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initia...
...en update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer p...
...e panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); var zpos = 295; // define ...
...And 4 more matches
AudioParam.setTargetAtTime() - Web APIs
the settargetattime() method of the audioparam interface schedules the start of a gradual change to the audioparam value. this is useful for decay or release portions of adsr envelopes. syntax var paramref = param.settargetattime(target, starttime, timeconstant); parameters target the value the parameter will start to transition towards at the given start time. starttime the time that the exponential transition will begin, in the same time coordinate system as audiocontext.currenttime. if it is less than or equal to audiocontext.currenttime, the parameter will start changing immediately. timeconstant the time-constant value, given in seconds, of an exponential approach to the target value. the larger this value is, the slower the transition will be. returns a reference to this au...
... immediately. timeconstant the time-constant value, given in seconds, of an exponential approach to the target value. the larger this value is, the slower the transition will be. returns 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 w...
...econstant 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 method does not work if the current value or the target value is 0. choosing a good timeconstant as mentioned above, the value changes exponentially, with each timeconstant bringing you another 63.2% toward the target value. ...
...And 4 more matches
BiquadFilterNode.getFrequencyResponse() - Web APIs
the getfrequencyresponse() method of the biquadfilternode interface takes the current filtering algorithm's settings and calculates the frequency response for frequencies specified in a specified array of frequencies. the two output arrays, magresponseoutput and phaseresponseoutput, must be created before calling this method; they must be the same size as the array of input frequency values (frequencyarray). syntax biquadfilternode.getfrequencyresponse(frequencyarray, magresponseoutput, phaseresponseoutput); parameters frequencyarray a float32array containing an array of frequencies, specified in hertz, which you want to filter. magresponseoutput a float32array to receive the computed magnitudes of the freqency response for each frequency value in the frequencyarray. for any frequ...
...ternode.getfrequencyresponse(frequencyarray, magresponseoutput, phaseresponseoutput); parameters frequencyarray a float32array containing an array of frequencies, specified in hertz, which you want to filter. magresponseoutput a float32array to receive the computed magnitudes of the freqency response for each frequency value in the frequencyarray. ...
...t32array containing an array of frequencies, specified in hertz, which you want to filter. magresponseoutput a float32array to receive the computed magnitudes of the freqency response for each frequency value in the frequencyarray. 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. these are unitless values. phaseresponseoutput a float32array to receive the computed 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...
...And 4 more matches
BluetoothRemoteGATTDescriptor - Web APIs
the bluetoothremotegattdescriptor interface of the web bluetooth api provides a gatt descriptor, which provides further information about a characteristic’s value. interface interface bluetoothremotegattdescriptor { readonly attribute bluetoothgattcharacteristic characteristic; readonly attribute uuid uuid; readonly attribute arraybuffer? value; promise<arraybuffer> readvalue(); promise<void> writevalue(buffersource value); }; properties bluetoothremotegattdescriptor.characteristicread only returns the bluetoothremotegattcharacteristic this descriptor belongs to. bluetoothremotegattdescriptor.uuidread only returns the uuid of the characteristic descriptor, for example '00002902-0000-1000-8000-00805f9b34fb' for theclient characteristic configuration descriptor. ...
...ersource value); }; properties bluetoothremotegattdescriptor.characteristicread only returns the bluetoothremotegattcharacteristic this descriptor belongs to. bluetoothremotegattdescriptor.uuidread only returns the uuid of the characteristic descriptor, for example '00002902-0000-1000-8000-00805f9b34fb' for theclient characteristic configuration descriptor. bluetoothremotegattdescriptor.valueread only returns the currently cached descriptor value. this value gets updated when the value of the descriptor is read. methods bluetoothremotegattdescriptor.readvalue() returns a promise that resolves to an arraybuffer holding a duplicate of the value property if it is available and supported. otherwise it throws an error. ...
... specifications specification status comment web bluetooththe definition of 'bluetoothremotegattdescriptor' in that specification. draft initial definition. ...
...And 4 more matches
CanvasRenderingContext2D.globalAlpha - Web APIs
examples drawing translucent shapes this example uses the globalalpha property to draw two semi-transparent rectangles. ...
... examples drawing translucent shapes this example uses the globalalpha property to draw two semi-transparent rectangles. ...
... examples drawing translucent shapes this example uses the globalalpha property to draw two semi-transparent rectangles. ...
...And 4 more matches
ConstantSourceNode.offset - Web APIs
the read-only offset property of the constantsourcenode interface returns a audioparam object indicating the numeric a-rate value which is always returned by the source when asked for the next sample. while the audioparam named offset is read-only, the value property within is not. so you can change the value of offset by setting the value of constantsourcenode.offset.value: myconstantsourcenode.offset.value = newvalue; syntax let offsetparameter = constantaudionode.offset; let offset = constantsourcenode.offset.value; constantsourcenode.offset.value = newvalue; value an audioparam object indicating the a-rate value returned for every sample by this node. ...
... example this example shows how to set up a constantsourcenode so its offset is used as the input to a pair of gainnodes; this snippet is derived from the complete example you can find in controlling multiple parameters with constantsourcenode. ...
... example this example shows how to set up a constantsourcenode so its offset is used as the input to a pair of gainnodes; this snippet is derived from the complete example you can find in controlling multiple parameters with constantsourcenode. ...
...And 4 more matches
DOMPointReadOnly.w - Web APIs
the default is 1.0. ...
...the default is 1.0. ...
...the default is 1.0. ...
...And 4 more matches
Document - Web APIs
Web › API › Document
document.embedsread only returns a list of the embedded <embed> elements within the current document. document.fonts returns the fontfaceset interface of the current document. document.formsread only returns a list of the <form> elements within the current document. document.headread only returns the <head> element of the current document. ...
... document.linksread only returns a list of all the hyperlinks in the document. document.mozsyntheticdocument returns a boolean that is true only if this document is synthetic, such as a standalone image, video, audio file, or the like. ...
...ng if the page is considered hidden or not. document.imagesread only returns a list of the images in the current document. document.implementationread only returns the dom implementation associated with the current document. document.laststylesheetsetread only returns the name of the style sheet set that was last enabled. has the value null until the style sheet is changed by setting the value of selectedstylesheetset. document.linksread only returns a list of all the hyperlinks in the document. document.mozsyntheticdocument returns a boolean that is true only if this document is synthetic, such as a standalone image, video, audio file, or the like. document.pluginsread only returns a list of the available plugins. document.featurepolicy read only returns the featurepolic...
...And 4 more matches
Traversing an HTML table with JavaScript and DOM Interfaces - Web APIs
ern browser, including all versions of firefox and ie 5+. the dom methods presented here are part of the document object model (core) level 1 specification. dom level 1 includes both methods for generic document access and manipulation (dom 1 core) as well as methods specific to html documents (dom 1 html). ...
...l for the structures you are planning to create; this will make it easier to write the necessary code. in the <table> tree of figure 1 the element <table> has one child: the element <tbody>. <tbody> has two children. each <tbody>'s child (<tr>) has two children (<td>). finally, each <td> has one child: a text node. ...
...ach <td> has one child: a text node. example: setting the background color of a paragraph getelementsbytagname(tagnamevalue) is a method available in any dom element or the root document element. when called, it returns an array with all of the element's descendants matching the tag name. the first element of the list is located at position [0] in the array. ...
...And 4 more matches
HTMLDialogElement.close() - Web APIs
examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the showmodal() method. ...
... examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the showmodal() method. ...
... examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the showmodal() method. ...
...And 4 more matches
IDBCursor - Web APIs
Web › API › IDBCursor
the idbcursor interface of the indexeddb api represents a cursor for traversing or iterating over multiple records in a database. the cursor has a source that indicates which index or object store it is iterating over. it has a position within the range, and moves in a direction that is increasing or decreasing in the order of record keys. the cursor enables an application to asynchronously process all the records in the cursor's range. you can have an unlimited number of cursors at the same time. you always get the same idbcursor object representing a given cursor. ...
...der of record keys. the cursor enables an application to asynchronously process all the records in the cursor's range. you can have an unlimited number of cursors at the same time. you always get the same idbcursor object representing a given cursor. operations are performed on the underlying index or object store. note: this feature is available in web workers. properties note: idbcursorwithvalue is an idbcursor interface with an additional value property. idbcursor.source read only returns the idbobjectstore or idbindex that the cursor is iterating. this function never returns null or throws an exception, even if the cursor is currently being iterated, has iterated past its end, or its transaction is not active. idbcursor.direction read only returns the direction of traversal of...
... idbcursor.key read only returns the key for the record at the cursor's position. if the cursor is outside its range, this is set to undefined. the cursor's key can be any data type. idbcursor.primarykey read only returns the cursor's current effective primary key. if the cursor is currently being iterated or has iterated outside its range, this is set to undefined. ...
...And 4 more matches
IDBKeyRange.bound() - Web APIs
Web › API › IDBKeyRange › bound
the bound() method of the idbkeyrange interface creates a new key range with the specified upper and lower bounds. the bounds can be open (that is, the bounds exclude the endpoint values) or closed (that is, the bounds include the endpoint values). by default, the bounds are closed. note: this feature is available in web workers. syntax var myidbkeyrange = idbkeyrange.bound(lower, upper); var myidbkeyrange = idbkeyrange.bound(lower, upper, loweropen); var myidbkeyrange = idbkeyrange.bound(lower, upper, loweropen, upperopen); parameters lower specifies the lower bound of the new key range. upper specifies the upper bound of the new key range. loweropen optional indicates whether the lower bound excludes the endpoint value. the default is false. upperopen optional indicates ...
...oweropen); var myidbkeyrange = idbkeyrange.bound(lower, upper, loweropen, upperopen); parameters lower specifies the lower bound of the new key range. upper specifies the upper bound of the new key range. loweropen optional indicates whether the lower bound excludes the endpoint value. the default is false. upperopen optional indicates whether the upper bound excludes the endpoint value. the default is false. return value idbkeyrange: the newly created key range. exceptions this method may raise a domexception of the following type: exception description dataerror the following conditions raise an exception: the lower or upper parameters were not passed a valid key. the lower key is greater than the upper key. the lowe...
...description dataerror the following conditions raise an exception: the lower or upper parameters were not passed a valid key. the lower key is greater than the upper key. the lower key and upper key match and either of the bounds are open. example the following example illustrates how you'd use a bound key range. ...
...And 4 more matches
IDBObjectStoreSync - Web APIs
e indexeddb api was originally intended for use only with web workers, and was eventually removed from the spec because its need was questionable. it may however be reintroduced in the future if there is enough demand from web developers. the idbobjectstoresync interface of the indexeddb api provides synchronous access to an object store of a database. ...
... keypath readonl...
...dexnames readonly domstringlist a list of the names of the indexes on this object store. keypath readonly domstring the key path of this object store. if this attribute is set to null, then the application must provide a key for each modification operation. mode readonly unsigned short the mode for isolating access to the data in this object store. for possible values, see constants. name readonly domstring the name of this object store. constants mode constants constant value description read_only 1 modification operations are not allowed on this object store. read_write 0 modification operations are allowed on this object store. snapshot_read 2 any read operations must ...
...And 4 more matches
KeyboardEvent - Web APIs
ents: all;} constructor keyboardevent() creates a new keyboardevent object. constants the keyboardevent interface defines the following constants. keyboard locations the following constants identify which part of the keyboard the key event originates from. they are accessed as keyboardevent.dom_key_location_standard and so forth. keyboard location identifiers constant value description dom_key_location_standard 0x00 the key described by the event is not identified as being located in a particular area of the keyboard; it is not located on the numeric keypad (unless it's the numlock key), and for keys that are duplicated on the left and right sides of the keyboard, the key is, for whatever reason, not to be associated with that location. ...
...the numeric keypad, the keypad's enter key, and the decimal point on the keypad. properties this interface also inherits properties of its parents, uievent and event. keyboardevent.altkey read only returns a boolean that is true if the alt ( option or ⌥ on os x) key was active when the key event was generated. keyboardevent.code read only returns a domstring with the code value of the physical key represented by the event. warning: this ignores the user's keyboard layout, so that if the user presses the key at the "y" position in a qwerty keyboard layout (near the middle of the row above the home row), this will always return "keyy", even if the user has a qwertz keyboard (which would mean the user expects a "z" and all the other properties would indicate a "z") or a d...
...ard layout (where the user would expect an "f"). keyboardevent.ctrlkey read only returns a boolean that is true if the ctrl key was active when the key event was generated. keyboardevent.iscomposing read only returns a boolean that is true if the event is fired between after compositionstart and before compositionend. keyboardevent.key read only returns a domstring representing the key value of the key represented by the event. keyboardevent.locale read only returns a domstring representing a locale string indicating the locale the keyboard is configured for. this may be the empty string if the browser or device doesn't know the keyboard's locale. note: this does not describe the locale of the data being entered. a user may be using one keyboard layout while typing text in a diff...
...And 4 more matches
PannerNode.maxDistance - Web APIs
the maxdistance property of the pannernode interface is a double value representing the maximum distance between the audio source and the listener, after which the volume is not reduced any further. this value is used only by the linear distance model. the maxdistance property's default value is 10000. syntax var audioctx = new audiocontext(); var panner = audioctx.createpanner(); panner.maxdistance = 10000; value a double. the default is 10000, and non-positive values are not allowed. exceptions rangeerror the property has been given a value that is outside the accepted range. example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. generally you will define the positi...
...en update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer p...
...e panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); var zpos = 295; // define ...
...And 4 more matches
PannerNode.panningModel - Web APIs
the panningmodel property of the pannernode interface is an enumerated value determining which spatialisation algorithm to use to position the audio in 3d space. the possible values are: equalpower: represents the equal-power panning algorithm, generally regarded as simple and efficient. equalpower is the default value. hrtf: renders a stereo output of higher quality than equalpower — it uses a convolution with measured impulse responses from human subjects. syntax var audioctx = new audiocontext(); var panner = audioctx.createpanner(); panner.panningmodel = 'hrtf'; value a enum — see panningmodeltype. example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. generall...
...en update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer p...
...e panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); var zpos = 295; // define ...
...And 4 more matches
PannerNode.setPosition() - Web APIs
the setposition() method of the pannernode interface defines the position of the audio source relative to the listener (represented by an audiolistener object stored in the audiocontext.listener attribute.) the three parameters x, y and z are unitless and describe the source's position in 3d space using the right-hand cartesian coordinate system. the setposition() method's default value of the position is (0, 0, 0). syntax var audioctx = new audiocontext(); var panner = audioctx.createpanner(); panner.setposition(0,0,0); returns void. example in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner...
...en update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer p...
...e panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); var zpos = 295; // define ...
...And 4 more matches
PaymentRequest.show() - Web APIs
= paymentrequest.show(detailspromise); parameters detailspromise optional an optional promise that you can provide if your architecture requires that the payment request's details need to be updated between instantiating the payment interface and the user beginning to interact with it. the promise should resolve with a paymentdetailsupdate object containing the updated information. return value a promise that eventually resolves with a paymentresponse. the promise is resolved when the user accepts the payment request (such as by clicking a "pay" button in the browser's payment sheet). exceptions aborterror the returned promise rejects with an aborterror if the user agent is already showing a payment panel. only one payment panel may be visible at a time across all documents load...
...paymentdetailsupdate object or a promise to return one; this object contains the fields in the paymentresponse which have been or need to be changed. the validateresponse() method, below, is called once show() returns, in order to look at the returned response and either submit the payment or reject the payment as failed: async function validateresponse(response) { try { if (await checkallvalues(response)) { await response.complete("success"); } else { await response.complete("fail"); } } catch(err) { await response.complete("fail"); } } here, a custom function called checkallvalues() looks at each value in the response and ensures that they're valid, returning true if every field is valid or false if any are not. if and only if every field is valid, the co...
...m function called checkallvalues() looks at each value in the response and ensures that they're valid, returning true if every field is valid or false if any are not. if and only if every field is valid, the complete() method is called on the response with the string "success", which indicates that everything is valid and that the payment can complete accordingly. if any fields have unacceptable values, or if an exception is thrown by the previous code, complete() is called with the string "fail", which indicates that the payment process is complete and failed. instead of immediately failing, you could choose to call retry() on the response object to ask the user agent to try to process the payment again; this should usually only be done after the user has made any needed corrections to the o...
...And 4 more matches
PerformanceEntry - Web APIs
are also created in indirect ways such as loading a resource (such as an image). performanceentry instances will always be one of the following subtypes: performancemark performancemeasure performanceframetiming performancenavigationtiming performanceresourcetiming performancepainttiming note: this feature is available in web workers. properties performanceentry.name read only a value that further specifies the value returned by the performanceentry.entrytype property. the value of both depends on the subtype. see property page for valid values. performanceentry.entrytype read only a domstring representing the type of performance metric such as, for example, "mark". see property page for valid values. performanceentry.starttime read only a domhighrestimestamp representin...
...e property page for valid values. performanceentry.entrytype read only a domstring representing the type of performance metric such as, for example, "mark". see property page for valid values. performanceentry.starttime read only a domhighrestimestamp representing the starting time for the performance metric. performanceentry.duration read only a domhighrestimestamp representing the time value of the duration of the performance event. methods performanceentry.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. function print_performanceentries() { // use getentries() to get a list of all performance entries...
..." + properties[i] + " is not supported"); } } } specifications specification status comment resource timing level 3 editor's draft resource timing level 2 working draft resource timing level 1 candidate rec...
...And 4 more matches
Pointer events - Web APIs
vents (client coordinates, target element, button states, etc.) in addition to new properties for other forms of input: pressure, contact geometry, tilt, etc. in fact, the pointerevent interface inherits all of the mouseevent properties, thus facilitating the migration of content from mouse events to pointer events. terminology active buttons state the condition when a pointer has a non-zero value for the buttons property. for example, in the case of a pen, when the pen has physical contact with the digitizer, or at least one button is depressed while hovering. active pointer any pointer input device that can produce events. a pointer is considered active if it can still produce further events. for example, a pen that is a down state is considered active because it can produce additional...
... range of -90 to 90) between the y–z plane and the plane containing both the pointer (e.g. pen stylus) axis and the y axis. tilty the plane angle (in degrees, in the range of -90 to 90) between the x–z plane and the plane containing both the pointer (e.g. pen stylus) axis and the x axis. twist the clockwise rotation of the pointer (e.g. pen stylus) around its major axis in degrees, with a value in the range 0 to 359. pointertype indicates the device type that caused the event (mouse, pen, touch, etc.) isprimary indicates if the pointer represents the primary pointer of this pointer type. event types and global event handlers pointer events have ten event types, seven of which have similar semantics to their mouse event counterparts (down, up, move, over, out, enter, and leave). ...
... pointer devices, such as mouse and pen, support multiple buttons and the button presses can be chorded i.e. depressing an additional button while another button on the pointer device is already depressed. to determine the state of button presses, pointer events uses the button and buttons properties of the mouseevent interface (that pointerevent inherits from). the following table provides the values of button and buttons for the various device button states. device button state button buttons neither buttons nor touch/pen contact changed since last event -1 — mouse move with no buttons pressed, pen moved while hovering with no buttons pressed — 0 left mouse, touch contact, pen contact 0 1 middle mouse 1 4 ...
...And 4 more matches
RTCInboundRtpStreamStats - Web APIs
the webrtc api's rtcinboundrtpstreamstats dictionary, based upon rtcreceivedrtpstreamstats and rtcstats, contains statistics related to the receiving end of an rtp stream on the local end of the rtcpeerconnection. properties the rtcinboundrtpstreamstats dictionary is based on the rtcreceivedrtpstreamstats dictionary, whose properties are also available. ...
...mstats dictionary is based on the rtcreceivedrtpstreamstats dictionary, whose properties are also available. averagertcpinterval a floating-point value indicating the average rtcp interval between two consecutive compound rtcp packets. bytesreceived a 64-bit integer which indicats the total numer of bytes that have been received so far for this media source. fecpacketsdiscarded an integer value indicating the number of rtp forward error correction (fec) packets which have been received for this source, for which the error correction payload was discarded. fecpacketsreceived an integer value indicating the total number of rtp fec packets received for this source. this counter may also be incremented when fec packets arrive in-band along with media content; this can happen with opus, fo...
...ward error correction (fec) packets which have been received for this source, for which the error correction payload was discarded. fecpacketsreceived an integer value indicating the total number of rtp fec packets received for this source. this counter may also be incremented when fec packets arrive in-band along with media content; this can happen with opus, for example. fircount an integer value which indicates the total number of full intra request (fir) packets which this receiver has sent to the sender. this is an indicator of how often the stream has lagged, requiring frames to be skipped in order to catch up. ...
...And 4 more matches
RTCPeerConnection.addIceCandidate() - Web APIs
cpeerconnection receives a new ice candidate from the remote peer over its signaling channel, it delivers the newly-received candidate to the browser's ice agent by calling rtcpeerconnection.addicecandidate(). this adds this new remote candidate to the rtcpeerconnection's remote description, which describes the state of the remote end of the connection. ...
...owser's ice agent by calling rtcpeerconnection.addicecandidate(). this adds this new remote candidate to the rtcpeerconnection's remote description, which describes the state of the remote end of the connection. if the candidate parameter is missing or a value of null is given when calling addicecandidate(), the added ice candidate is an "end-of-candidates" indicator. the same is the case if the value of the specified object's candidate is either missing or an empty string (""), it signals that all remote candidates have been delivered. the end-of-candidates notification is transmitted to the remote peer using a candidate with an a-line value of end-of-candidates. during negotiation, your app will likely receive many candidates which you'll deliver to the ice agent in this way, allowing it t...
...callback, failurecallback); parameters candidate optional an object conforming to the rtcicecandidateinit dictionary, or an rtcicecandidate object; the contents of the object should be constructed from a message received over the signaling channel, describing a newly received ice candidate that's ready to be delivered to the local ice agent. if no candidate object is specified, or its value is null, an end-of-candidates signal is sent to the remote peer using the end-of-candidates a-line, formatted simply like this: a=end-of-candidates deprecated parameters in older code and documentation, you may see a callback-based version of this function. this has been deprecated and its use is strongly discouraged. you should update any existing code to use the promise-based version of ...
...And 4 more matches
RTCPeerConnection.createOffer() - Web APIs
nnection to a remote peer. the sdp offer includes information about any mediastreamtracks already attached to the webrtc session, codec, and options supported by the browser, and any candidates already gathered by the ice agent, for the purpose of being sent over the signaling channel to a potential peer to request a connection or to update the configuration of an existing connection. the return value is a promise which, when the offer has been created, is resolved with a rtcsessiondescription object containing the newly-created offer. syntax apromise = mypeerconnection.createoffer([options]); mypeerconnection.createoffer(successcallback, failurecallback, [options]) parameters options optional an rtcofferoptions dictionary providing options requested for the offer. rtcofferoptions...
...eturned offer to have different credentials than those already in place. if you then apply the returned offer, ice will restart. specify false to keep the same credentials and therefore not restart ice. the default is false. offertoreceiveaudio optional (legacy) a legacy boolean option which used to control whether or not to offer to the remote peer the opportunity to try to send audio. if this value is false, the remote peer will not be offered to send audio data, even if the local side will be sending audio data. if this value is true, the remote peer will be offered to send audio data, even if the local side will not be sending audio data. the default behavior is to offer to receive audio only if the local side is sending audio, not otherwise. to emulate this behavior in modern implementa...
...ered to send audio data, even if the local side will be sending audio data. if this value is true, the remote peer will be offered to send audio data, even if the local side will not be sending audio data. the default behavior is to offer to receive audio only if the local side is sending audio, not otherwise. to emulate this behavior in modern implementations, the presence of this member with a value false, will set the direction of all existing audio transceivers to exclude reception (i.e. set to either "sendonly" or "inactive"). in modern implementations, the presence of this member with a value true, will ensure there is at least one transceiver set to receive audio that has not been stopped, and if there isn't one, one will be created. note: you shouldn't use this legacy property. ins...
...And 4 more matches
RTCRtpSendParameters.encodings - Web APIs
the rtcrtpsendparameters dictionary's encodings property is an rtcrtpencodingparameters object providing configuration settings for the encoder being used for the rtcrtpsender's track. syntax sendparameters.encodings = encodingparameterlist; encodingparameterlist = sendparameters.encodings; value an array of objects conforming to the rtcrtpencodingparameters dictionary, each of which contains properties which provide settings and parameters that describe and configure a single codec that could be used to encode the track. each object's properties are: active if true, the described encoding is currently actively being used. that is, for rtp senders, the encoding is currently being used to send data, while for receivers, the encoding is being used to decode received data. the default v...
...escribed encoding is currently actively being used. that is, for rtp senders, the encoding is currently being used to send data, while for receivers, the encoding is being used to decode received data. the default value is true. codecpayloadtype when describing a codec for an rtcrtpsender, codecpayloadtype is a single 8-bit byte (or octet) specifying the codec to use for sending the stream; the value matches one from the owning rtcrtpparameters object's codecs parameter. this value can only be set when creating the transceiver; after that, this value is read only. dtx only used for an rtcrtpsender whose kind is audio, this property indicates whether or not to use discontinuous transmission (a feature by which a phone is turned off or the microphone muted automatically in the absence of voic...
... the owning rtcrtpparameters object's codecs parameter. this value can only be set when creating the transceiver; after that, this value is read only. dtx only used for an rtcrtpsender whose kind is audio, this property indicates whether or not to use discontinuous transmission (a feature by which a phone is turned off or the microphone muted automatically in the absence of voice activity). the value is taken from the enumerated string type rtcdtxstatus. maxbitrate an unsigned long integer indicating the maximum number of bits per second to allow for this encoding. other parameters may further constrain the bit rate, such as the value of maxframerate or transport or physical network limitations. ...
...And 4 more matches
RTCRtpStreamStats - Web APIs
ic browsers. properties the rtcrtpstreamstats dictionary is based on rtcstats, and inherits its properties. in addition, some or all of the following properties are available. standard fields included for all media types codecid a domstring which uniquely identifies the object which was inspected to produce the rtccodecstats object associated with this rtp stream. ...
...in addition, some or all of the following properties are available. standard fields included for all media types codecid a domstring which uniquely identifies the object which was inspected to produce the rtccodecstats object associated with this rtp stream. kind a domstring whose value is "audio" if the associated mediastreamtrack is audio-only or "video" if the track contains video. this value will match that of the media type indicated by rtccodecstats.codec, as well as the track's kind property. previously called mediatype. ssrc the 32-bit integer which identifies the source of the rtp packets this rtcrtpstreamstats object covers. this value is generated per the rfc 3550 specification. trackid a domstring which uniquely identifies the rtcmediastreamtrackstats object representing ...
... transportid a domstring uniquely identifying the object which was inspected to produce the rtctransportstats object associated with this rtp stream. ...
...And 4 more matches
ReadableStream.getReader() - Web APIs
the getreader() method of the readablestream interface creates a reader and locks the stream to it. while the stream is locked, no other reader can be acquired until this one is released. syntax var reader = readablestream.getreader({mode}); parameters {mode} optional an object containing a property mode, which takes as its value a domstring specifying the type of reader to create. ...
... the getreader() method of the readablestream interface creates a reader and locks the stream to it. while the stream is locked, no other reader can be acquired until this one is released. syntax var reader = readablestream.getreader({mode}); parameters {mode} optional an object containing a property mode, which takes as its value a domstring specifying the type of reader to create. ...
... typeerror the stream you are trying to create a reader for is not a readablestream. ...
...And 4 more matches
SVGPreserveAspectRatio - Web APIs
svg_preserveaspectratio_xminymi...
..._xminymax = 8 svg_preserveaspectratio_xmidymax = 9 svg_preserveaspectratio_xmaxymax = 10 svg_meetorslice_unknown = 0 svg_meetorslice_meet = 1 svg_meetorslice_slice = 2 normative document svg 1.1 (2nd edition) constants name value description svg_preserveaspectratio_unknown 0 the enumeration was set to a value that is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_preserveaspectratio_none 1 corresponds to value none for attribute preserveaspectratio. svg_preserveaspectratio_xminymin 2 corresponds to value xminymin for attribute preserveaspectratio. svg_preserveasp...
...is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_preserveaspectratio_none 1 corresponds to value none for attribute preserveaspectratio. svg_preserveaspectratio_xminymin 2 corresponds to value xminymin for attribute preserveaspectratio. svg_preserveaspectratio_xmidymin 3 corresponds to value xmidymin for attribute preserveaspectratio. svg_preserveaspectratio_xmaxymin 4 corresponds to value xmaxymin for attribute preserveaspectratio. svg_preserveaspectratio_xminymid 5 corresponds to value xminymid for attribute preserveaspectratio. svg_preserveaspectratio_xmidymid 6 corresponds to value xmidymid for attribute preserveaspectratio. s...
...And 4 more matches
Storage - Web APIs
Web › API › Storage
nstorage is made; whereas for local storage the call is made to window.localstorage. properties storage.length read only returns an integer representing the number of data items stored in the storage object. methods storage.key() when passed a number n, this method will return the name of the nth key in the storage. storage.getitem() when passed a key name, will return that key's value. storage.setitem() when passed a key name and value, will add that key to the storage, or update that key's value if it already exists. storage.removeitem() when passed a key name, will remove that key from the storage. storage.clear() when invoked, will empty all keys out of the storage. examples here we access a storage object by calling localstorage. we first test whether the local st...
...name, will remove that key from the storage. storage.clear() when invoked, will empty all keys out of the storage. examples here we access a storage object by calling localstorage. we first test whether the local storage contains data items using !localstorage.getitem('bgcolor'). ...
...we access a storage object by calling localstorage. we first test whether the local storage contains data items using !localstorage.getitem('bgcolor'). if it does, we run a function called setstyles() that grabs the data items using storage.getitem() and uses those values to update page styles. if it doesn't, we run another function, populatestorage(), which uses storage.setitem() to set the item values, then runs setstyles(). ...
...And 4 more matches
URL API - Web APIs
Web › API › URL API
the url api is a component of the url standard, which defines what constitutes a valid uniform resource locator and the api that accesses and manipulates urls. the url standard also defines concepts such as domains, hosts, and ip addresses, and also attempts to describe in a standard way the legacy application/x-www-form-urlencoded mime type used to submit web forms' contents as a set of key/value pairs. url concepts and usage the majority of the url standard is taken up by the definition of a url and how it is structured and parsed. also covered are definitions of various terms related to addressing of computers on a network, and the algorithms for parsing ip addresses and dom addresses are specified. more interesting to most developers is the api itself. accessing url components creating...
... let addr = new url("/docs/web/api/url_api"); let host = addr.host; let path = addr.pathname; the snippet above creates a url object for the article you're reading right now, then fetches the host and pathname properties. in this case, those strings are developer.mozilla.org and /docs/web/api/url_api, respectively. ...
...is case, those strings are developer.mozilla.org and /docs/web/api/url_api, respectively. changing the url most of the properties of url are settable; you can write new values to them to alter the url represented by the object. for example, to create a url and set its username: let myusername = "someguy"; let addr = new url("https://mysite.com/login"); addr.username = myusername; setting the value of username not only sets that property's value, but it updates the overall url. after executing the code snippet above, the value returned by addr.href is https://someguy@mysite.com/login. this is true for any of the writable properties. queries the search property on a url contains the query string portion of the url. for example, if the url is https://mysite.com/login?user=someguy&page=news,...
...And 4 more matches
WebGLRenderingContext.clearStencil() - Web APIs
recommendation initial definition. ...
... recommendation initial definition. ...
... recommendation initial definition. ...
...And 4 more matches
WebGLRenderingContext - Web APIs
gcontext.blendequationseparate() sets the rgb blend equation and alpha blend equation separately. webglrenderingcontext.blendfunc() defines which function is used for blending pixel arithmetic. webglrenderingcontext.blendfuncseparate() defines which function is used for blending pixel arithmetic for rgb and alpha components separately. webglrenderingcontext.clearcolor() specifies the color values used when clearing color buffers. webglrenderingcontext.cleardepth() specifies the depth value used when clearing the depth buffer. webglrenderingcontext.clearstencil() specifies the stencil value used when clearing the stencil buffer. webglrenderingcontext.colormask() sets which color components to enable or to disable when drawing or rendering to a webglframebuffer. webglrenderingcontex...
...hen clearing the stencil buffer. webglrenderingcontext.colormask() sets which color components to enable or to disable when drawing or rendering to a webglframebuffer. webglrenderingcontext.cullface() specifies whether or not front- and/or back-facing polygons can be culled. webglrenderingcontext.depthfunc() specifies a function that compares incoming pixel depth to the current depth buffer value. webglrenderingcontext.depthmask() sets whether writing into the depth buffer is enabled or disabled. webglrenderingcontext.depthrange() specifies the depth range mapping from normalized device coordinates to window or viewport coordinates. webglrenderingcontext.disable() disables specific webgl capabilities for this context. webglrenderingcontext.enable() enables specific webgl capabilit...
...vice coordinates to window or viewport coordinates. webglrenderingcontext.disable() disables specific webgl capabilities for this context. webglrenderingcontext.enable() enables specific webgl capabilities for this context. webglrenderingcontext.frontface() specifies whether polygons are front- or back-facing by setting a winding orientation. webglrenderingcontext.getparameter() returns a value for the passed parameter name. webglrenderingcontext.geterror() returns error information. webglrenderingcontext.hint() specifies hints for certain behaviors. the interpretation of these hints depend on the implementation. webglrenderingcontext.isenabled() tests whether a specific webgl capability is enabled or not for this context. webglrenderingcontext.linewidth() sets the line width of...
...And 4 more matches
Lighting in WebGL - Web APIs
matrix); mat4.transpose(normalmatrix, normalmatrix); ... gl.uniformmatrix4fv( programinfo.uniformlocations.normalmatrix, false, normalmatrix); update the shaders now that all the data the shaders need is available to them, we need to update the code in the shaders themselves. the vertex shader the first thing to do is update the vertex shader so it generates a shading value for each vertex based on the ambient lighting as well as the directional lighting. let's take a look at the code: const vssource = ` attribute vec4 avertexposition; attribute vec3 avertexnormal; attribute vec2 atexturecoord; uniform mat4 unormalmatrix; uniform mat4 umodelviewmatrix; uniform mat4 uprojectionmatrix; varying highp vec2 vtexturecoord; varying high...
...ertex. the first thing we do is transform the normal based on the current orientation of the cube, by multiplying the vertex's normal by the normal matrix. we can then compute the amount of directional lighting that needs to be applied to the vertex by calculating the dot product of the transformed normal and the directional vector (that is, the direction from which the light is coming). ...
...m the normal based on the current orientation of the cube, by multiplying the vertex's normal by the normal matrix. we can then compute the amount of directional lighting that needs to be applied to the vertex by calculating the dot product of the transformed normal and the directional vector (that is, the direction from which the light is coming). ...
...And 4 more matches
Keyframe Formats - Web APIs
element.animate(), keyframeeffect.keyframeeffect(), and keyframeeffect.setkeyframes() all accept objects formatted to represent a set of keyframes. there are several options to this format, which are explained below. syntax there are two different ways to format keyframes: an array of objects (keyframes) consisting of properties and values to iterate over. this is the canonical format returned by the getkeyframes() method. element.animate([ { // from opacity: 0, color: "#fff" }, { // to opacity: 1, ​ color: "#000" } ], 2000); offsets for each keyframe can be specified by providing an offset value. element.animate([ { opacity: 1 }, { opacity: 0.1, offset: 0.7 }, { opacity: 0 } ], 2000); note:...
...he getkeyframes() method. element.animate([ { // from opacity: 0, color: "#fff" }, { // to opacity: 1, ​ color: "#000" } ], 2000); offsets for each keyframe can be specified by providing an offset value. element.animate([ { opacity: 1 }, { opacity: 0.1, offset: 0.7 }, { opacity: 0 } ], 2000); note: offset values, if provided, must be between 0.0 and 1.0 (inclusive) and arranged in ascending order. it is not necessary to specify an offset for every keyframe. keyframes without a specified offset will be evenly spaced between adjacent keyframes. the easing to apply between keyframes can be specified by providing an easing value as illustrated below. element.animate([ { opacity: 1, easing: 'ease...
...ng to apply between keyframes can be specified by providing an easing value as illustrated below. element.animate([ { opacity: 1, easing: 'ease-out' }, { opacity: 0.1, easing: 'ease-in' }, { opacity: 0 } ], 2000); in this example, the specified easing only applies from the keyframe where it is specified until the next keyframe. any easing value specified on the options argument, however, applies across a single iteration of the animation — for the entire duration. an object containing key-value pairs consisting of the property to animate and an array of values to iterate over. element.animate({ opacity: [ 0, 1 ], // [ from, to ] color: [ "#fff", "#000" ] // [ from, to ] }, 2000); using this format, the numb...
...And 4 more matches
Window.prompt() - Web APIs
Web › API › Window › prompt
the window.prompt() displays a dialog with an optional message prompting the user to input some text. syntax result = window.prompt(message, default); parameters message optional a string of text to display to the user. can be omitted if there is nothing to show in the prompt window. default optional a string containing the default value displayed in the text input field. note that in internet explorer 7 and 8, if you do not provide this parameter, the string "undefined" is the default value. return value a string containing the text entered by the user, or null. example let sign = prompt("what's your sign?"); if (sign.tolowercase() == "scorpio") { alert("wow! i'm a scorpio too!"); } // there are many ways to use the prompt feature sign = window.prompt(); // open the blank p...
...if the user clicks ok without entering any text, an empty string is returned. if the user clicks the cancel button, this function returns null. the above prompt appears as follows (in chrome on os x): notes a prompt dialog contains a single-line textbox, a cancel button, and an ok button, and returns the...
...ollowing text is shared between this article, dom:window.confirm and dom:window.alert dialog boxes are modal windows; they prevent the user from accessing the rest of the program's interface until the dialog box is closed. for this reason, you should not overuse any function that creates a dialog box (or modal window). please note that result is a string. that means you should sometimes cast the value given by the user. for example, if their answer should be a number, you should cast the value to number. const anumber = number(window.prompt("type a number", "")); specification specification status comment html living standardthe definition of 'prompt()' in that specification. living standard browser compatibility the compatibility table in this page is...
...And 4 more matches
Basic form hints - Accessibility
orm controls. without a direct association between the control and its label, the screen reader has no way of knowing which label is the correct one. the example below shows a simple form with labels. note that each <input> element has an id, and each <label> element has a for attribute, indicating the id of the associated <input>. ...
... correct one. the example below shows a simple form with labels. note that each <input> element has an id, and each <label> element has a for attribute, indicating the id of the associated <input>. ...
...ment has a for attribute, indicating the id of the associated <input>. ...
...And 4 more matches
-moz-outline-radius - CSS: Cascading Style Sheets
in mozilla applications like firefox, the -moz-outline-radius css shorthand property can be used to give an element's outline rounded corners. /* one value */ -moz-outline-radius: 25px; /* two values */ -moz-outline-radius: 25px 1em; /* three values */ -moz-outline-radius: 25px 1em 12%; /* four values */ -moz-outline-radius: 25px 1em 12% 4mm; /* global values */ -moz-outline-radius: inherit; -moz-outline-radius: initial; -moz-outline-radius: unset; 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, th...
...itial; -moz-outline-radius: unset; 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. ...
...mleft -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. ...
...And 4 more matches
-webkit-mask-repeat-y - CSS: Cascading Style Sheets
no-repeat the mask image is not repeated vertically; only one copy of the mask image is drawn in vertical direction. ...
... no-repeat the mask image is not repeated vertically; only one copy of the mask image is drawn in vertical direction. ...
... no-repeat the mask image is not repeated vertically; only one copy of the mask image is drawn in vertical direction. ...
...And 4 more matches
:in-range - CSS: Cascading Style Sheets
Web › CSS › :in-range
the :in-range css pseudo-class represents an <input> element whose current value is within the range limits specified by the min and max attributes. /* selects any <input>, but only when it has a range specified, and its value is inside that range */ input:in-range { background-color: rgba(0, 255, 0, 0.25); } this pseudo-class is useful for giving the user a visual indication that a field's current value is within the permitted limits. note: this pseudo-class only applies to elements that have (and can take) a range limitation. ...
...0.25); } this pseudo-class is useful for giving the user a visual indication that a field's current value is within the permitted limits. note: this pseudo-class only applies to elements that have (and can take) a range limitation. in the absence of such a limitation, the element can neither be "in-range" nor "out-of-range." syntax :in-range examples html <form action="" id="form1"> <ul>values between 1 and 10 are valid. ...
...isual indication that a field's current value is within the permitted limits. note: this pseudo-class only applies to elements that have (and can take) a range limitation. in the absence of such a limitation, the element can neither be "in-range" nor "out-of-range." syntax :in-range examples html <form action="" id="form1"> <ul>values between 1 and 10 are valid. ...
...And 4 more matches
:out-of-range - CSS: Cascading Style Sheets
the :out-of-range css pseudo-class represents an <input> element whose current value is outside the range limits specified by the min and max attributes. /* selects any <input>, but only when it has a range specified, and its value is outside that range */ input:out-of-range { background-color: rgba(255, 0, 0, 0.25); } this pseudo-class is useful for giving the user a visual indication that a field's current value is outside the permitted limits. note: this pseudo-class only applies to elements that have (and can take) a range limitation. ...
...5); } this pseudo-class is useful for giving the user a visual indication that a field's current value is outside the permitted limits. note: this pseudo-class only applies to elements that have (and can take) a range limitation. ...
...on that a field's current value is outside the permitted limits. note: this pseudo-class only applies to elements that have (and can take) a range limitation. ...
...And 4 more matches
@counter-style - CSS: Cascading Style Sheets
@counter-style thumbs { system: cyclic; symbols: "\1f44d"; suffix: " "; } ul { list-style: thumbs; } the initial version of css defined a set of useful counter styles. however, although more styles were added to this set of predefined styles over the years, this system proved too restrictive to fulfill the needs of worldwide typography. ...
...lfill the needs of worldwide typography. the @counter-style at-rule addresses this shortcoming in an open-ended manner, by allowing authors to define their own counter styles when the pre-defined styles aren't fitting their needs. syntax descriptors each @counter-style is identified by a name and has a set of descriptors. system specifies the algorithm to be used for converting the integer value of a counter to a string representation. negative lets the author specify symbols to be appended or prepended to the counter representation if the value is negative. prefix specifies a symbol that should be prepended to the marker representation. prefixes are added to the representation in the final stage, so in the final representation of the counter, it comes before the negative sign.
... a symbol that should be prepended to the marker representation. prefixes are added to the representation in the final stage, so in the final representation of the counter, it comes before the negative sign. suffix specifies, similar to the prefix descriptor, a symbol that is appended to the marker representation. suffixes come after the marker representation. range defines the range of values over which the counter style is applicable. if a counter style is used to represent a counter value outside of its ranges, the counter style will drop back to its fallback style. pad is used when you need the marker representations to be of a minimum length. for example if you want the counters to start at 01 and go through 02, 03, 04 etc, then the pad descriptor is to be used. for represen...
...And 4 more matches
aspect-ratio - CSS: Cascading Style Sheets
examples the example below is contained in an <iframe>, which creates its own viewport. resize the <iframe> to see aspect-ratio in action. html <div id='inner'> watch this element as you resize your viewport's width and height. ...
... examples the example below is contained in an <iframe>, which creates its own viewport. resize the <iframe> to see aspect-ratio in action. html <div id='inner'> watch this element as you resize your viewport's width and height. ...
... (max-aspect-ratio: 3/2) { div { background: #9ff; /* cyan */ } } /* exact aspect ratio, put it at the bottom to avoid override*/ @media (aspect-ratio: 1/1) { div { background: #f9a; /* red */ } } _example used iframe and dataurl to enable this iframe could resize html <label id="wf" for="w">width:165</label> <input id="w" name="w" type="range" min="100" max="250" step="5" value="165"> <label id="hf" for="w">height:165</label> <input id="h" name="h" type="range" min="100" max="250" step="5" value="165"> <iframe id="outer" src="data:text/html,<style> @media (min-aspect-ratio: 8/5) { div { background: %239af; } } @media (max-aspect-ratio: 3/2) { div { background: %239ff; } } @media (aspect-ratio: 1/1) { div { background: %23f9a; } }</style><div id='inner'> watch this elem...
...And 4 more matches
Layout and the containing block - CSS: Cascading Style Sheets
s the content area of its parent, but that isn't necessarily true. let's investigate the factors that determine what an element's containing block is. effects of the containing block before learning what determines the containing block of an element, it's useful to know why it matters in the first place. the size and position of an element are often impacted by its containing block. ...
...n element are often impacted by its containing block. percentage values that are applied to the width, height, padding, margin, and offset properties of an absolutely positioned element (i.e., which has its position set to absolute or fixed) are computed from the element's containing block. ...
...f the nearest ancestor element that is either a block container (such as an inline-block, block, or list-item element) or establishes a formatting context (such as a table container, flex container, grid container, or the block container itself). if the position property is absolute, the containing block is formed by the edge of the padding box of the nearest ancestor element that has a position value other than static (fixed, absolute, relative, or sticky). if the position property is fixed, the containing block is established by the viewport (in the case of continuous media) or the page area (in the case of paged media). if the position property is absolute or fixed, the containing block may also be formed by the edge of the padding box of the nearest ancestor element that has the followin...
...And 4 more matches
align-self - CSS: Cascading Style Sheets
the align-self css property overrides a grid or flex item's align-items value. in grid, it aligns the item inside the grid area. in flexbox, it aligns the item on the cross axis. the source for this interactive example is stored in a github repository. if 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 property doesn't apply to block-level boxes, or to table cells. if a flexbox item's cross-axis margin is auto, then align-self is ignored. ...
...ss axis. the source for this interactive example is stored in a github repository. if 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 property doesn't apply to block-level boxes, or to table cells. if a flexbox item's cross-axis margin is auto, then align-self is ignored. ...
...e interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the property doesn't apply to block-level boxes, or to table cells. if a flexbox item's cross-axis margin is auto, then align-self is ignored. ...
...And 4 more matches
<blend-mode> - CSS: Cascading Style Sheets
the effect is like two opaque pieces of paper overlapping. ...
... the effect is like two opaque pieces of paper overlapping. ...
...es printed on transparent film overlapping. <div id="div"></div> #div { width: 300px; height: 300px; background: url('https://mdn.mozillademos.org/files/8543/br.png'), url('https://mdn.mozillademos.org/files/8545/tr.png'); background-blend-mode: multiply; } screen the final color is the result of inverting the colors, multiplying them, and inverting that value. a black layer leads to no change, and a white layer leads to a white final layer. the effect is like two images shone onto a projection screen. <div id="div"></div> #div { width: 300px; height: 300px; background: url('https://mdn.mozillademos.org/files/8543/br.png'), url('https://mdn.mozillademos.org/files/8545/tr.png'); background-blend-mode: screen; } ...
...And 4 more matches
block-size - CSS: Cascading Style Sheets
the block-size css property defines the horizontal or vertical 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. ...
... 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. ...
...ds 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. syntax /* <length> values */ block-size: 300px; block-size: 25em; /* <percentage> values */ block-size: 75%; /* keyword values */ block-size: max-content; block-size: min-content; block-size: fit-content(20em); block-size: auto; /* global values */ block-size: inherit; block-size: initial; block-size: unset; 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 proper...
...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. ...
... 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. ...
...es 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. ...
...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. ...
... 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. ...
...ines 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. ...
...And 4 more matches
border-inline-end-color - CSS: Cascading Style Sheets
the border-inline-end-color css property defines the color of the logical inline-end border of an element, which maps to a physical border color depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-color, border-right-color, border-bottom-color, or border-left-color 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 border-inline-end-color: rebeccapurple; border-inline-end-color: #663399; related properties are border-block-start-color, border-block-end-color, a...
...f 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 border-inline-end-color: rebeccapurple; border-inline-end-color: #663399; related properties are border-block-start-color, border-block-end-color, and border-inline-start-color, which define the other border colors of the element. ...
...ect, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax border-inline-end-color: rebeccapurple; border-inline-end-color: #663399; related properties are border-block-start-color, border-block-end-color, and border-inline-start-color, which define the other border colors of the element. ...
...And 4 more matches
border-left-width - CSS: Cascading Style Sheets
the border-left-width css 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. ...
...ty 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. ...
..., 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. ...
...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. ...
... 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. ...
...ines 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. ...
...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. ...
... 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. ...
...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. ...
...And 4 more matches
border-top-width - CSS: Cascading Style Sheets
the border-top-width 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. ...
...operty 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. ...
...s 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. ...
...And 4 more matches
bottom - CSS: Cascading Style Sheets
Web › CSS › bottom
etting the vertical 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. the effect of bottom depends on how the element is positioned (i.e., the value of the position property): when position is set to absolute or fixed, the bottom property specifies the distance between the element's bottom edge and the bottom edge of its containing block. when position is set to relative, the bottom property specifies the distance the element's bottom edge is moved above its normal position. when position is set to sticky, the bottom property is used to ...
...ic, 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 relativel...
...height: auto is treated as a height based on the content; or if top is also auto, the element is positioned where it should vertically be positioned if it were 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. ...
...And 4 more matches
box-flex - CSS: Cascading Style Sheets
Web › CSS › box-flex
box layout module drafts for 'box-flex' (which were based on this property) or the behavior of '-webkit-box-flex' (which is based on those drafts). see flexbox for information about the current standard. the -moz-box-flex and -webkit-box-flex css properties specify how a -moz-box or -webkit-box grows to fill the box that contains it, in the direction of the containing box's layout. /* <number> values */ -moz-box-flex: 0; -moz-box-flex: 2; -moz-box-flex: 3.5; -webkit-box-flex: 0; -webkit-box-flex: 2; -webkit-box-flex: 3.5; /* global values */ -moz-box-flex: inherit; -moz-box-flex: initial; -moz-box-flex: unset; -webkit-box-flex: inherit; -webkit-box-flex: initial; -webkit-box-flex: unset; syntax the box-flex property is specified as a <number>. if the value is 0, the box does not grow. if...
...-moz-box-flex: initial; -moz-box-flex: unset; -webkit-box-flex: inherit; -webkit-box-flex: initial; -webkit-box-flex: unset; syntax the box-flex property is specified as a <number>. if the value is 0, the box does not grow. if it is greater than 0, the box grows to fill a proportion of the available space. notes the containing box allocates the available extra space in proportion to the flex value of each of the content elements. content elements that have zero flex do not grow. if only one content element has nonzero flex, then it grows to fill the available space. content elements that have the same flex grow by the same absolute amounts. if the flex value is set using the element's flex attribute, then the style is ignored. to make xul elements in a containing box the same size, se...
...s that have zero flex do not grow. if only one content element has nonzero flex, then it grows to fill the available space. content elements that have the same flex grow by the same absolute amounts. if the flex value is set using the element's flex attribute, then the style is ignored. to make xul elements in a containing box the same size, set the containing box's equalsize attribute to the value always. this attribute does not have a corresponding css property. a trick to make all content elements in a containing box the same size, is to give them all a fixed size (e.g. ...
...And 4 more matches
column-count - CSS: Cascading Style Sheets
the column-count css property breaks an element's content into the specified number of columns. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... the column-count css property breaks an element's content into the specified number of columns. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...operty breaks an element's content into the specified number of columns. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 4 more matches
column-rule - CSS: Cascading Style Sheets
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. it is a shorthand property that sets the individual column-rule-* properties in a single, convenient declaration: column-rule-width, column-rule-style, and column-rule-color. ...
...examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. it is a shorthand property that sets the individual column-rule-* properties in a single, convenient declaration: column-rule-width, column-rule-style, and column-rule-color. ...
...one https://github.com/mdn/interactive-examples and send us a pull request. it is a shorthand property that sets the individual column-rule-* properties in a single, convenient declaration: column-rule-width, column-rule-style, and column-rule-color. note: as with all shorthand properties, any individual value that is not specified is set to its corresponding initial value (possibly overriding values previously set using non-shorthand properties). ...
...And 4 more matches
column-width - CSS: Cascading Style Sheets
the column-width css property sets the ideal column width in a multi-column layout. the container will have as many columns as can fit without any of them having a width less than the column-width value. if the width of the container is narrower than the specified value, the single column's width will be smaller than the declared column 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. ...
...tive example is stored in a github repository. if 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. ...
...n/interactive-examples and send us 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. ...
...And 4 more matches
conic-gradient() - CSS: Cascading Style Sheets
<angular-color-stop> a color-stop's <color...
...rner */ conic-gradient(from 90deg at 0 0, blue, red); /* colorwheel */ background: conic-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. ...
...0%, 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 defining how the gradient ...
...And 4 more matches
contain - CSS: Cascading Style Sheets
Web › CSS › contain
er to recalculate layout, style, paint, size, or any combination of them for a limited area of the dom and not the entire page, leading to obvious performance benefits. this property is useful on pages that contain a lot of widgets that are all independent, as it can be used to prevent each widget's internals from having side effects outside of the widget's bounding-box. ...
...s that are all independent, as it can be used to prevent each widget's internals from having side effects outside of the widget's bounding-box. note: if applied (with value: paint, strict or content), this property creates: a new containing block (for the descendants whose position property is absolute or fixed). a new stacking context. a new block formatting context. syntax /* keyword values */ contain: none; contain: strict; contain: content; contain: size; contain: layout; contain: style; contain: paint; /* multiple keywords */ contain: size paint; contain: size layout paint; /* global values */ contain: inherit; contain: initial; contain: unset; the contain property is specified as either one of the following: using a single none, strict, or content keyword. using one or m...
... strict indicates that all containment rules except style are applied to the element. this is equivalent to contain: size layout paint. ...
...And 4 more matches
font-feature-settings - CSS: Cascading Style Sheets
font-feature-settings css property controls advanced typographic features in opentype fonts. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...o contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* use the default settings */ font-feature-settings: normal; /* set values for opentype feature tags */ font-feature-settings: "smcp"; font-feature-settings: "smcp" on; font-feature-settings: "swsh" 2; font-feature-settings: "smcp", "swsh" 2; /* global values */ font-feature-settings: inherit; font-feature-settings: initial; font-feature-settings: unset; whenever possible, web authors should instead use the font-variant shorthand property or an associated longhand property such as font-variant-ligatures, font-variant-caps, font-variant-east-asian, font-variant-alternates, font-variant-numeric or font-variant-position. these lead to more effective, ...
...-variant-east-asian, font-variant-alternates, font-variant-numeric or font-variant-position. these lead to more effective, predictable, understandable results than font-feature-settings, which is a low-level feature designed to handle special cases where no other way exists to enable or access an opentype font feature. in particular, font-feature-settings shouldn't be used to enable small caps. values normal text is laid out using default settings. <feature-tag-value> when rendering text, the list of opentype feature tag value is passed to the text layout engine to enable or disable font features. the tag is always a <string> of 4 ascii characters. if it has more or less characters, or if it contains characters outside the u+20 – u+7e codepoint range, the whole property is invalid. t...
...And 4 more matches
initial-letter-align - CSS: Cascading Style Sheets
western languages would default to alphabetic, cjk languages to ideographic, and some indic languages to hanging. ...
...western languages would default to alphabetic, cjk languages to ideographic, and some indic languages to hanging. ...
...western languages would default to alphabetic, cjk languages to ideographic, and some indic languages to hanging. ...
...And 4 more matches
inline-size - CSS: Cascading Style Sheets
the inline-size css property defines the horizontal or vertical 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. ...
...f 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. ...
...s 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. syntax /* <length> values */ inline-size: 300px; inline-size: 25em; /* <percentage> values */ inline-size: 75%; /* keyword values */ inline-size: max-content; inline-size: min-content; inline-size: fit-content(20em); inline-size: auto; /* global values */ inline-size: inherit; inline-size: initial; inline-size: unset; if the writing mode is vertically oriented, the value of inline-size relates to the height of the element; otherwise, it relates to the width of the element. a relat...
...And 4 more matches
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. ...
... 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. ...
...nset 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. ...
...And 4 more matches
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. ...
... 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. ...
...epending 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. ...
...And 4 more matches
inset - CSS: Cascading Style Sheets
Web › CSS › inset
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. ...
... 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. ...
...perty, 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. ...
...And 4 more matches
letter-spacing - CSS: Cascading Style Sheets
the letter-spacing css property sets the horizontal spacing behavior between text characters. this value is added to the natural spacing between characters while rendering the text. positive values of letter-spacing causes 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. ...
.... positive values of letter-spacing causes 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. syntax /* keyword value */ letter-spacing: normal; /* <length> values */ letter-spacing: 0.3em; letter-spacing: 3px; letter-spacing: .3px; /* global values */ letter-spacing: inherit; letter-spacing: initial; letter-spacing: unset; values normal the normal letter spacing for the current font. unlike a value of 0, this keyword allows the user agent to alter the space between characters in order to justify text. ...
...-spacing: .3px; /* global values */ letter-spacing: inherit; letter-spacing: initial; letter-spacing: unset; values normal the normal letter spacing for the current font. unlike a value of 0, this keyword allows the user agent to alter the space between characters in order to justify text. <length> specifies extra inter-character space in addition to the default space between characters. values may be negative, but there may be implementation-specific limits. user agents may not further increase or decrease the inter-character space in order to justify text. accessibility concerns a large positive or negative letter-spacing value will make the word(s) the styling is applied to unreadable. ...
...And 4 more matches
list-style-type - CSS: Cascading Style Sheets
a list item 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. the color of the marker will be the same as the computed color of the element it applies to. only a few elements (<li> and <summary>) have a default value of display: list-item. however, the list-style-type property may be applied to any element whose display value is set to list-item. moreover, because this property is inherited, it can be set on a parent element (commonly <ol> or <ul>) to make it apply to all list items. syntax /* partial list of types */ list-style-type: disc; list-style-type: circle; list-style-type: square; list-style-type: ...
...set to list-item. moreover, because this property is inherited, it can be set on a parent element (commonly <ol> or <ul>) to make it apply to all list items. syntax /* partial list of types */ list-style-type: disc; list-style-type: circle; list-style-type: square; list-style-type: decimal; list-style-type: georgian; list-style-type: trad-chinese-informal; list-style-type: kannada; /* <string> value */ list-style-type: '-'; /* identifier matching an @counter-style rule */ list-style-type: custom-counter-style; /* keyword value */ list-style-type: none; /* global values */ list-style-type: inherit; list-style-type: initial; list-style-type: unset; the list-style-type property may be defined as any one of: a <custom-ident> value a symbols() value a <string> value the keyword none. ...
... */ list-style-type: inherit; list-style-type: initial; list-style-type: unset; the list-style-type property may be defined as any one of: a <custom-ident> value a symbols() value a <string> value the keyword none. note that: some types require a suitable font installed to display as expected. the cjk-ideographic is identical to trad-chinese-informal; it exists for legacy reasons. values <custom-ident> a identifier matching the value of a @counter-style or one of the predefined styles: symbols() defines an anonymous style of the list. <string> the specified string will be used as the item's marker. ...
...And 4 more matches
margin-block-end - CSS: Cascading Style Sheets
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. ...
...a github repository. if 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-block-end: 10px; /* an absolute length */ margin-block-end: 1em; /* relative to the text size */ margin-block-end: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-block-end: auto; /* global values */ margin-block-end: inherit; margin-block-end: initial; margin-block-end: unset; it corresponds to the margin-top, margin-right, margin-bottom, or margin-left property depending on the values defined for writing-mode, direction, and text-orientation. it relates to margin-block-start, margin-inline-start, and margin-inline-end, which define the oth...
... /* global values */ margin-block-end: inherit; margin-block-end: initial; margin-block-end: unset; it corresponds to the margin-top, margin-right, margin-bottom, or margin-left property depending on the values defined for 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 4 more matches
margin-block-start - CSS: Cascading Style Sheets
ogical 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. ...
...ub repository. if 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-block-start: 10px; /* an absolute length */ margin-block-start: 1em; /* relative to the text size */ margin-block-start: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-block-start: auto; /* global values */ margin-block-start: inherit; margin-block-start: initial; margin-block-start: unset; it corresponds to the margin-top, margin-right, margin-bottom, or margin-left property depending on the values defined for writing-mode, direction, and text-orientation. it relates to margin-block-end, margin-inline-start, and margin-inline-end, which define t...
... global values */ margin-block-start: inherit; margin-block-start: initial; margin-block-start: unset; it corresponds to the margin-top, margin-right, margin-bottom, or margin-left property depending on the values defined for 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 4 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. ...
...rgins of an element, which maps to physical margins depending on the element's writing mode, directionality, and text orientation. /* <length> values */ margin-inline: 10px 20px; /* an absolute length */ margin-inline: 1em 2em; /* relative to the text size */ margin-inline: 5% 2%; /* relative to the nearest block container's width */ margin-inline: 10px; /* sets both start and end values */ /* keyword values */ margin-inline: auto; /* global values */ margin-inline: inherit; margin-inline: initial; margin-inline: unset; this property corresponds to the margin-top and margin-bottom, or margin-right, and margin-left properties, depending on the values defined for writing-mode, direction, and text-orientation. constituent properties this property is a shorthand for the follow...
...gin-inline: inherit; margin-inline: initial; margin-inline: unset; this property corresponds to the margin-top and margin-bottom, or margin-right, and margin-left properties, depending on the values defined for writing-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 4 more matches
mask-composite - CSS: Cascading Style Sheets
add the source is placed over the destination. ...
... add the source is placed over the destination. ...
... add the source is placed over the destination. ...
...And 4 more matches
mask-origin - CSS: Cascading Style Sheets
the mask-origin css property sets the origin of a mask. /* keyword values */ mask-origin: content-box; mask-origin: padding-box; mask-origin: border-box; mask-origin: margin-box; mask-origin: fill-box; mask-origin: stroke-box; mask-origin: view-box; /* multiple values */ mask-origin: padding-box, content-box; mask-origin: view-box, fill-box, border-box; /* non-standard keyword values */ -webkit-mask-origin: content; -webkit-mask-origin: padding; -webkit-mask-origin: border; /* global values */ mask-origin: inherit; mask-origin: initial; mask-origin: unset; for elements rendered as a single box, this property specifies the mask positioning area. in other words, this property specifies the origin position of an image specified by the mask-image css property. for elements rendered as multip...
...operty specifies the mask positioning area. in other words, this property specifies the origin position of an image specified by the mask-image css property. for elements rendered as multiple boxes, such as inline boxes on several lines or boxes on several pages, it specifies which boxes box-decoration-break operates upon to determine the mask positioning area. syntax one or more of the keyword values listed below, separated by commas. values content-box the position is relative to the content box. padding-box the position is relative to the padding box. for single boxes 0 0 is the upper left corner of the padding edge, 100% 100% is the lower right corner. border-box the position is relative to the border box. margin-box the position is relative to the margin box. fill-box the po...
...ect bounding box. stroke-box the position is relative to the stroke bounding box. view-box uses the nearest svg viewport as reference box. ...
...And 4 more matches
max() - CSS: Cascading Style Sheets
Web › CSS › max
the max() css function lets you set the largest (most positive) value from a list of comma-separated expressions as the value of a css property value. the max() function can be used anywhere a <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> is allowed. the source for this interactive example is stored in a github repository. if 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 the first above example, the width will be at least 400px, but will be wider if the the viewport is more than 2000px wide (in which case 1vw would be 20px, so 20vw would be 400px). think of the max() value as providing the minimum value a property can have. syntax the max() function takes...
.... in the first above example, the width will be at least 400px, but will be wider if the the viewport is more than 2000px wide (in which case 1vw would be 20px, so 20vw would be 400px). think of the max() value as providing the minimum 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 orde...
...our 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 had been specified. it is permitted to nest min() and other max() functions as expression values. the expressions are full math expressions, 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 ...
...And 4 more matches
page-break-after - CSS: Cascading Style Sheets
this property has been replaced by the break-after property. the page-break-after css property adjusts page breaks after the current element. /* keyword values */ page-break-after: auto; page-break-after: always; page-break-after: avoid; page-break-after: left; page-break-after: right; page-break-after: recto; page-break-after: verso; /* global values */ page-break-after: inherit; page-break-after: initial; page-break-after: unset; this property applies to block elements that generate a box. it won't apply on an empty <div> that won't generate a box. syntax values auto initial value. automatic page breaks (neither forced nor forbidden). always always force page breaks after the element. avoid avoid page breaks after the element. left force page breaks after the element so tha...
...ss left-to-right, then this acts like left. if pages progress right-to-left, then this acts like right. page break aliases the page-break-after property is now a legacy property, replaced by break-after. for compatibility reasons, page-break-after should be treated by browsers as an alias of break-after. this ensures that sites using page-break-after continue to work as designed. a subset of values should be aliased as follows: page-break-after break-after auto auto left left right right avoid avoid always page formal definition initial valueautoapplies toblock-level elements in the normal flow of the root element. user agents may also apply it to other elements like table-row elements.inheritednocomputed ...
...s should be aliased as follows: page-break-after break-after auto auto left left right right avoid avoid always page formal definition initial valueautoapplies toblock-level elements in the normal flow of the root element. ...
...And 4 more matches
page-break-before - CSS: Cascading Style Sheets
this property has been replaced by the break-before property. the page-break-before css property adjusts page breaks before the current element. this property applies to block elements that generate a box. it won't apply on an empty <div> that won't generate a box. /* keyword values */ page-break-before: auto; page-break-before: always; page-break-before: avoid; page-break-before: left; page-break-before: right; page-break-before: recto; page-break-before: verso; /* global values */ page-break-before: inherit; page-break-before: initial; page-break-before: unset; syntax values auto initial value. automatic page breaks (neither forced nor forbidden). always always force page breaks before the element. avoid avoid page breaks before the element. left force page breaks before th...
...eft-to-right, then this acts like left. if pages progress right-to-left, then this acts like right. page break aliases the page-break-before property is now a legacy property, replaced by break-before. for compatibility reasons, page-break-before should be treated by browsers as an alias of break-before. this ensures that sites using page-break-before continue to work as designed. a subset of values should be aliased as follows: page-break-before break-before auto auto left left right right avoid avoid always page formal definition initial valueautoapplies toblock-level elements in the normal flow of the root element. user agents may also apply it to other elements like table-row elements.inheritednocompute...
...should be aliased as follows: page-break-before break-before auto auto left left right right avoid avoid always page formal definition initial valueautoapplies toblock-level elements in the normal flow of the root element. ...
...And 4 more matches
perspective - CSS: Cascading Style Sheets
the perspective css property 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 va...
...ransform is to be applied. <length> a <length> giving the distance from the user to the z=0 plane. it is used to apply a perspective transform to the element and its content. if the value is 0 or a negative number, no perspective transform is applied. description each 3d element with z>0 becomes larger; each 3d-element with z<0 becomes smaller. the strength of the effect is determined by the value of this property. the parts of the 3d elements that are behind the user — i.e. their z-axis coordinates are greater than the value of the perspective css property — are not drawn. ...
...th of the effect is determined by the value of this property. the parts of the 3d elements that are behind the user — i.e. their z-axis coordinates are greater than the value of the perspective css property — are not drawn. the vanishing point is by default placed at the center 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. ...
...And 4 more matches
scroll-margin - CSS: Cascading Style Sheets
the scroll-margin shorthand property sets all of the scroll margins of an element at once, assigning values much like the margin property does for margins 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. ...
...s interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ntribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 4 more matches
touch-action - CSS: Cascading Style Sheets
the touch-action css property sets how an element's region can be manipulated by a touchscreen user (for example, by zooming features built into the browser). /* keyword values */ touch-action: auto; touch-action: none; touch-action: pan-x; touch-action: pan-left; touch-action: pan-right; touch-action: pan-y; touch-action: pan-up; touch-action: pan-down; touch-action: pinch-zoom; touch-action: manipulation; /* global values */ touch-action: inherit; touch-action: initial; touch-action: unset; by default, panning (scrolling) and pinching gestures are handled exclusively by the browser. an application using pointer events will receive a pointercancel event when the browser starts handling a touch gesture. by explicitly specifying which gestures should be handled by the browser, an applicatio...
...n supply its own behavior in pointermove and pointerup listeners for the remaining gestures. applications using touch events disable the browser handling of gestures by calling preventdefault(), but should also use touch-action to ensure the browser knows the intent of the application before any event listeners have been invoked. when a gesture is started, the browser intersects the touch-action values of the touched element and its ancestors, up to the one that implements the gesture (in other words, the first containing scrolling element). this means that in practice, touch-action is typically applied only to top-level elements which have some custom behavior, without needing to specify touch-action explicitly on any of that element's descendants. after a gesture starts, changes to touch-a...
...at element's descendants. after a gesture starts, changes to touch-action will not have any impact on the behavior of the current gesture. syntax the touch-action property may be specified as either: one of the keywords auto, none, manipulation, or one of the keywords pan-x, pan-left, pan-right, and/or one of the keywords pan-y, pan-up, pan-down, plus optionally the keyword pinch-zoom. values auto enable browser handling of all panning and zooming gestures. none disable browser handling of all panning and zooming gestures. pan-x enable single-finger horizontal panning gestures. may be combined with pan-y, pan-up, pan-down and/or pinch-zoom. pan-y enable single-finger vertical panning gestures. may be combined with pan-x, pan-left, pan-right and/or pinch-zoom. manipulation ...
...And 4 more matches
transform-box - CSS: Cascading Style Sheets
the reference box of a <table> is the border box of its table wrapper box, not its table box. ...
...the reference box of a <table> is the border box of its table wrapper box, not its table box. ...
...the reference box of a <table> is the border box of its table wrapper box, not its table box. border-box the border box is used as the reference box. ...
...And 4 more matches
transform - CSS: Cascading Style Sheets
Web › CSS › transform
he transform css property lets you rotate, scale, skew, or translate an element. it modifies the coordinate space of the css visual formatting model. the source for this interactive example is stored in a github repository. if 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 property has a value different than none, a stacking context will be created. in that case, the element will act as a containing block for any position: fixed; or position: absolute; elements that it contains. only transformable elements can be transformed. that is, all elements whose layout is governed by the css box model except for: non-replaced inline boxes, table-column boxes, and table-column-group boxes. s...
...ne, a stacking context will be created. in that case, the element will act as a containing block for any position: fixed; or position: absolute; elements that it contains. only transformable elements can be transformed. that is, all elements whose layout is governed by the css box model except for: non-replaced inline boxes, table-column boxes, and table-column-group boxes. ...
...in that case, the element will act as a containing block for any position: fixed; or position: absolute; elements that it contains. only transformable elements can be transformed. that is, all elements whose layout is governed by the css box model except for: non-replaced inline boxes, table-column boxes, and table-column-group boxes. ...
...And 4 more matches
transition-delay - CSS: Cascading Style Sheets
the transition-delay css property specifies the duration to wait before starting a property's transition effect when its value changes. the source for this interactive example is stored in a github repository. if 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 multip...
..., 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-property property, which acts as a master list. ...
.... 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-property property, which acts as a master list. if there are fewer delays specified than in the master list, the list of delay values will be repeated until there are enough. if there are more delays, the list of delay values will be truncated to match the number of properties. ...
...And 4 more matches
unicode-bidi - CSS: Cascading Style Sheets
decide how to display the text. the unicode-bidi property overrides this algorithm and allows the developer to control the text embedding. the unicode-bidi and direction properties are the only properties that are not affected by the all shorthand. note: this property is intended for document type definition (dtd) designers. web designers and similar authors should not override it. /* keyword values */ unicode-bidi: normal; unicode-bidi: embed; unicode-bidi: isolate; unicode-bidi: bidi-override; unicode-bidi: isolate-override; unicode-bidi: plaintext; /* global values */ unicode-bidi: inherit; unicode-bidi: initial; unicode-bidi: unset; syntax values normal the element does not offer an additional level of embedding with respect to the bidirectional algorithm. for inline elements, imp...
...the direction of this embedding level is given by the direction property. bidi-override for inline elements this creates an override. ...
...ats it as one or several u+fffc object replacement character, i.e. like an image. isolate-override this keyword applies the isolation behavior of the isolate keyword to the surrounding content and the override behavior of the bidi-override keyword to the inner content. ...
...And 4 more matches
visibility - CSS: Cascading Style Sheets
or columns in a <table>. the source for this interactive example is stored in a github repository. if 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 both hide an element and remove it from the document layout, set the display property to none instead of using visibility. syntax /* keyword values */ visibility: visible; visibility: hidden; visibility: collapse; /* global values */ visibility: inherit; visibility: initial; visibility: unset; the visibility property is specified as one of the keyword values listed below. values visible the element box is visible. hidden the element box is invisible (not drawn), but still affects layout as normal. descendants of the element will b...
...hen navigating through tab indexes). collapse for <table> rows, columns, column groups, and row groups, the row(s) or column(s) are hidden and the space they would have occupied is removed (as if display: none were applied to the column/row of the table). however, the size of other rows and columns is still calculated as though the cells in the collapsed row(s) or column(s) are present. this value allows for the fast removal of a row or column from a table without forcing the recalculation of widths and heights for the entire table. collapsed flex items are hidden, and the space they would have occupied is removed. for xul elements, the computed size of the element is always zero, regardless of other styles that would normally affect the size, although margins still take effect. for oth...
...widths and heights for the entire table. collapsed flex items are hidden, and the space they would have occupied is removed. for xul elements, the computed size of the element is always zero, regardless of other styles that would normally affect the size, although margins still take effect. for other elements, collapse is treated the same as hidden. ...
...And 4 more matches
Audio and video manipulation - Developer guides
e new forms. having native audio and video in the browser means we can use these data streams with technologies such as <canvas>, webgl or web audio api to modify audio and video directly, for example adding reverb/compression effects to audio, or grayscale/sepia filters to video. this article provides a reference to explain what you need to do. video manipulation the ability to read the pixel values from each frame of a video can be very useful. video and canvas the <canvas> element provides a surface for drawing graphics onto web pages; it is very powerful and can be coupled tightly with video. the general technique is to: write a frame from the <video> element to an intermediary <canvas> element. read the data from the intermediary <canvas> element and manipulate it. write the man...
...= document.getelementbyid('my-video'); myvideo.playbackrate = 2; playable code <video id="my-video" controls="true" width="480" height="270"> <source src="https://udn.realityripple.com/samples/5b/8cd6da9c65.webm" type="video/webm"> <source src="https://udn.realityripple.com/samples/6f/08625b424a.m4v" type="video/mp4"> </video> <div class="playable-buttons"> <input id="edit" type="button" value="edit" /> <input id="reset" type="button" value="reset" /> </div> <textarea id="code" class="playable-code"> var myvideo = document.getelementbyid('my-video'); myvideo.playbackrate = 2;</textarea> var textarea = document.getelementbyid('code'); var reset = document.getelementbyid('reset'); var edit = document.getelementbyid('edit'); var code = textarea.value; function setplaybackrate() { e...
...<input id="reset" type="button" value="reset" /> </div> <textarea id="code" class="playable-code"> var myvideo = document.getelementbyid('my-video'); myvideo.playbackrate = 2;</textarea> var textarea = document.getelementbyid('code'); var reset = document.getelementbyid('reset'); var edit = document.getelementbyid('edit'); var code = textarea.value; function setplaybackrate() { eval(textarea.value); } reset.addeventlistener('click', function() { textarea.value = code; setplaybackrate(); }); edit.addeventlistener('click', function() { textarea.focus(); }) textarea.addeventlistener('input', setplaybackrate); window.addeventlistener('load', setplaybackrate); note: try the playbackrate example live. audio manipulation playbackrate aside, to manipulate audio you'll typically u...
...And 4 more matches
Rich-Text Editing in Mozilla - Developer guides
byid('editorwindow').contentwindow.focus() } example: a simple but complete rich text editor <!doctype html> <html> <head> <title>rich text editor</title> <script type="text/javascript"> var odoc, sdeftxt; function initdoc() { odoc = document.getelementbyid("textbox"); sdeftxt = odoc.innerhtml; if (document.compform.switchmode.checked) { setdocmode(true); } } function formatdoc(scmd, svalue) { if (validatemode()) { document.execcommand(scmd, false, svalue); odoc.focus(); } } function validatemode() { if (!document.compform.switchmode.checked) { return true ; } alert("uncheck \"show html\"."); odoc.focus(); return false; } function setdocmode(btosource) { var ocontent; if (btosource) { ocontent = document.createtextnode(odoc.innerhtml); odoc.innerhtml = ""; ...
...font-size:10px; } #textbox { width: 540px; height: 200px; border: 1px #000000 solid; padding: 12px; overflow: scroll; } #textbox #sourcetext { padding: 0; margin: 0; min-width: 498px; min-height: 200px; } #editmode label { cursor: pointer; } </style> </head> <body onload="initdoc();"> <form name="compform" method="post" action="sample.php" onsubmit="if(validatemode()){this.mydoc.value=odoc.innerhtml;return true;}return false;"> <input type="hidden" name="mydoc"> <div id="toolbar1"> <select onchange="formatdoc('formatblock',this[this.selectedindex].value);this.selectedindex=0;"> <option selected>- formatting -</option> <option value="h1">title 1 &lt;h1&gt;</option> <option value="h2">title 2 &lt;h2&gt;</option> <option value="h3">title 3 &lt;h3&gt;</option> <option value="h4">t...
... false;"> <input type="hidden" name="mydoc"> <div id="toolbar1"> <select onchange="formatdoc('formatblock',this[this.selectedindex].value);this.selectedindex=0;"> <option selected>- formatting -</option> <option value="h1">title 1 &lt;h1&gt;</option> <option value="h2">title 2 &lt;h2&gt;</option> <option value="h3">title 3 &lt;h3&gt;</option> <option value="h4">title 4 &lt;h4&gt;</option> <option value="h5">title 5 &lt;h5&gt;</option> <option value="h6">subtitle &lt;h6&gt;</option> <option value="p">paragraph &lt;p&gt;</option> <option value="pre">preformatted &lt;pre&gt;</option> </select> <select onchange="formatdoc('fontname',this[this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- font -</option> <option>arial</option> <option>arial black</option> <option>c...
...And 4 more matches
Making content editable - Developer guides
allowclipboard.clipboard.paste", "allaccess"); example: a simple but complete rich text editor <!doctype html> <html> <head> <title>rich text editor</title> <script type="text/javascript"> var odoc, sdeftxt; function initdoc() { odoc = document.getelementbyid("textbox"); sdeftxt = odoc.innerhtml; if (document.compform.switchmode.checked) { setdocmode(true); } } function formatdoc(scmd, svalue) { if (validatemode()) { document.execcommand(scmd, false, svalue); odoc.focus(); } } function validatemode() { if (!document.compform.switchmode.checked) { return true ; } alert("uncheck \"show html\"."); odoc.focus(); return false; } function setdocmode(btosource) { var ocontent; if (btosource) { ocontent = document.createtextnode(odoc.innerhtml); odoc.innerhtml = ""; ...
...font-size:10px; } #textbox { width: 540px; height: 200px; border: 1px #000000 solid; padding: 12px; overflow: scroll; } #textbox #sourcetext { padding: 0; margin: 0; min-width: 498px; min-height: 200px; } #editmode label { cursor: pointer; } </style> </head> <body onload="initdoc();"> <form name="compform" method="post" action="sample.php" onsubmit="if(validatemode()){this.mydoc.value=odoc.innerhtml;return true;}return false;"> <input type="hidden" name="mydoc"> <div id="toolbar1"> <select onchange="formatdoc('formatblock',this[this.selectedindex].value);this.selectedindex=0;"> <option selected>- formatting -</option> <option value="h1">title 1 &lt;h1&gt;</option> <option value="h2">title 2 &lt;h2&gt;</option> <option value="h3">title 3 &lt;h3&gt;</option> <option value="h4">t...
... false;"> <input type="hidden" name="mydoc"> <div id="toolbar1"> <select onchange="formatdoc('formatblock',this[this.selectedindex].value);this.selectedindex=0;"> <option selected>- formatting -</option> <option value="h1">title 1 &lt;h1&gt;</option> <option value="h2">title 2 &lt;h2&gt;</option> <option value="h3">title 3 &lt;h3&gt;</option> <option value="h4">title 4 &lt;h4&gt;</option> <option value="h5">title 5 &lt;h5&gt;</option> <option value="h6">subtitle &lt;h6&gt;</option> <option value="p">paragraph &lt;p&gt;</option> <option value="pre">preformatted &lt;pre&gt;</option> </select> <select onchange="formatdoc('fontname',this[this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- font -</option> <option>arial</option> <option>arial black</option> <option>c...
...And 4 more matches
disabled - HTML: Hypertext Markup Language
ge loads. use the autocomplete attribute to control this feature. attribute interactions the difference between disabled and readonly is that read-only controls can still function and are still focusable, whereas disabled controls can not receive focus and are not submitted with the form and generally do not function as controls until they are enabled. because a disabled field cannot have it's value changed, required does not have any effect on inputs with the disabled attribute also specified. additionally, since the elements become immutable, most other attributes, such as pattern, have no effect, until the control is enabled. note: the required attribute is not permitted on inputs with the disabled attribute specified. usability browsers display disabled form controls greyed as disab...
...orm. if present on a supporting elements, the :disabled pseudo class will match. if the attribute is not included, the :enabled pseudo class will match. if the element doesn't support the disabled attribute, the attribute will have no effect, including not leading to being matched by the :disabled and :enabled pseudo classes. constraint validation if the element is disabled, then the element's value can not receive focus and cannot be updated by the user, and does not participate in constraint validation. examples when form controls are disabled, many browsers will display them in a lighter, greyed-out color by default. here are examples of a disabled checkbox, radio button, <option> and <optgroup>, as well as some form controls that are disabled via the disabled attribute set on the ances...
...and <optgroup>, as well as some form controls that are disabled via the disabled attribute set on the ancestor <fieldset> element. the <option>s are disabled, but the <select> itself is not. we could have disable the entire <select> by adding the attribute to that element rather than it's descendants. ...
...And 4 more matches
HTML attribute: pattern - HTML: Hypertext Markup Language
the pattern attribute specifies a regular expression the form control's value should match. if a non-null value doesn't conform to the constraints set by the pattern value, the validitystate object's read-only patternmismatch property will be true. the pattern attribute is an attribute of the text, tel, email, url, password, and search input types. the pattern attribute, when specified, is a regular expression which the input's value must match in order for the value to pass constraint validation. it must be a valid javascript regular expression, as used by the regexp type, and as documented in our guide on regular expressions; the 'u' flag is specified when compiling the regular expression, so that the pattern is treated as a sequence of unicode code points, instead of as ascii. n...
... or is invalid, no regular expression is applied and this attribute is ignored. tip: use the title attribute to specify text that most browsers will display as a tooltip to explain what the requirements are to match the pattern. you should also include other explanatory text nearby. some of the input types supporting the pattern attribute, notably the email and url input types, have expected value syntaxes that must be matched. if the pattern attribute isn't present, and the value doesn't match the expected syntax for that value type, the validitystate object's read-only typemismatch property will be true. usability when including a pattern, provide a description of the pattern in visible text near the control. additionally, include a title attribute which gives a description of the pat...
...attern. user agents may use the title contents during constraint validation to tell the user that the pattern is not matched. some browsers show a tooltip with title contents, improving usability for sighted users. additionally, assistive technology may read the title aloud when the control gains focus, but this should not be relied upon for accessibility. ...
...And 4 more matches
<form> - HTML: Hypertext Markup Language
Web › HTML › Element › form
attributes this element includes the global attributes. accept comma-separated content types the server accepts. this attribute was removed in html5 and should not be used. instead, use the accept attribute on <input type=file> elements. accept-charset space-separated character encodings the server accepts. the browser uses them in the order in which they are listed. the default value means the same encoding as the page. (in previous versions of html, character encodings could also be delimited by commas.) autocapitalize a nonstandard attribute used by ios safari that controls how textual form elements should be automatically capitalized. autocapitalize attributes on a form elements override it on <form>. possible values: none: no automatic capitalization. sentences...
... capitalized. autocapitalize attributes on a form elements override it on <form>. possible values: none: no automatic capitalization. sentences (default): capitalize the first letter of each sentence. words: capitalize the first letter of each word. characters: capitalize all characters — that is, uppercase. autocomplete indicates whether input elements can by default have their values automatically completed by the browser. autocomplete attributes on form elements override it on <form>. possible values: off: the browser may not automatically complete entries. (browsers tend to ignore this for suspected login forms; see the autocomplete attribute and login fields.) on: the browser may automatically complete entries. name the name of the form. deprecated as of html...
...ly complete entries. (browsers tend to ignore this for suspected login forms; see the autocomplete attribute and login fields.) on: the browser may automatically complete entries. name the name of the form. deprecated as of html 4 (use id instead). it must be unique among the forms in a document and not an empty string as of html5. ...
...And 4 more matches
<iframe>: The Inline Frame element - HTML: Hypertext Markup Language
Web › HTML › Element › iframe
be allowed to invoke the payment request api. this attribute is considered a legacy attribute and redefined as allow="payment". csp a content security policy enforced for the embedded resource. see htmliframeelement.csp for details. height the height of the frame in css pixels. default is 150. importance the download priority of the resource in the <iframe>'s src attribute. allowed values: auto (default) no preference. the browser uses its own heuristics to decide the priority of the resource. high the resource should be downloaded before other lower-priority page resources. low the resource should be downloaded after other higher-priority page resources. loading indicates how the browser should load the iframe: eager: load the iframe immediately, regard...
...heuristics to decide the priority of the resource. high the resource should be downloaded before other lower-priority page resources. low the resource should be downloaded after other higher-priority page resources. loading indicates how the browser should load the iframe: eager: load the iframe immediately, regardless if it is outside the visible viewport (this is the default value). lazy: defer loading of the iframe until it reaches a calculated distance from the viewport, as defined by the browser. name a targetable name for the embedded browsing context. this can be used in the target attribute of the <a>, <form>, or <base> elements; the formtarget attribute of the <input> or <button> elements; or the windowname parameter in the window.open() method. referrerpol...
...o a less secure destination (https→http). strict-origin-when-cross-origin: send a full url when performing a same-origin request, only send the origin when the protocol security level stays the same (https→https), and send no header to a less secure destination (https→http). unsafe-url: the referrer will include the origin and the path (but not the fragment, password, or username). ...
...And 4 more matches
<script>: The Script element - HTML: Hypertext Markup Language
Web › HTML › Element › script
, therefore they will get fetched in parallel to parsing and evaluated as soon as they are available. this attribute allows the elimination of parser-blocking javascript where the browser would have to load and evaluate scripts before continuing to parse. defer has a similar effect in this case. this is a boolean attribute: the presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value. see browser compatibility for notes on browser support. see also async scripts for asm.js. crossorigin normal script elements pass minimal information to the window.onerror for scripts which do not pass the standard cors checks. to allow error logging for sites which use a separate domain for static media, use this attribute. see...
...odule this boolean attribute is set to indicate that the script should not be executed in browsers that support es2015 modules — in effect, this can be used to serve fallback scripts to older browsers that do not support modular javascript code. nonce a cryptographic nonce (number used once) to whitelist scripts in a script-src content-security-policy. the server must generate a unique nonce value each time it transmits a policy. it is critical to provide a nonce that cannot be guessed as bypassing a resource's policy is otherwise trivial. referrerpolicy indicates which referrer to send when fetching the script, or resources fetched by the script: no-referrer: the referer header will not be sent. no-referrer-when-downgrade (default): the referer header will not be sent to origins w...
...stination (e.g. https→http). strict-origin-when-cross-origin: send a full url when performing a same-origin request, but only send the origin when the protocol security level stays the same (e.g.https→https), and send no header to a less secure destination (e.g. https→http). unsafe-url: the referrer will include the origin and the path (but not the fragment, password, or username). this value is unsafe, because it leaks origins and paths from tls-protected resources to insecure origins. note: an empty string value ("") is both the default value, and a fallback value if referrerpolicy is not supported. if referrerpolicy is not explicitly specified on the <script> element, it will adopt a higher-level referrer policy, i.e. one set on the whole document or domain. if a higher-level...
...And 4 more matches
<table>: The Table element - HTML: Hypertext Markup Language
Web › HTML › Element › table
ermitted parents any element that accepts flow content implicit aria role table permitted aria roles any dom interface htmltableelement attributes this element includes the global attributes. deprecated attributes align this enumerated attribute indicates how the table must be aligned inside the containing document. it may have the following values: left: the table is displayed on the left side of the document; center: the table is displayed in the center of the document; right: the table is displayed on the right side of the document. set margin-left and margin-right to auto or margin to 0 auto to achieve an effect that is similar to the align attribute. bgcolor the background color of the table. it is a 6-digit hexad...
...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 <table> element, with its value set to collapse, and the padding property to the <td> elements. cellspacing this attribute defines the size of the sp...
...the attribute is applied both horizontally and vertically, to the space between the top of the table and the cells of the first row, the left of the table and the first column, the right of the table and the last column and the bottom of the table and the last row. ...
...And 4 more matches
<tr>: The Table Row element - HTML: Hypertext Markup Language
Web › HTML › Element › tr
llowing attributes may still be implemented in browsers but are no longer part of the html specification and may be missing or may not work as expected. they should be avoided. alignobsolete since html5 a domstring which specifies how the cell's context should be aligned horizontally within the cells in the row; this is shorthand for using align on every cell in the row individually. possible values are: left align the content of each cell at its left edge. center center the contents of each cell between their left and right edges. right align the content of each cell at its right edge. justify widen whitespaces within the text of each cell so that the text fills the full width of each cell (full justification). char align each cell in the row on a specific character (...
... the row on a specific character (such that each row in the column that is configured this way will horizontally align its cells on that character). this uses the char and charoff to establish the alignment character (typically "." or "," when aligning numerical data) and the number of characters that should follow the alignment character. this alignment type was never widely supported. if no value is expressly set for align, the parent node's value is inherited. instead of using the obsolete align attribute, you should instead use the css text-align property to establish left, center, right, or justify alignment for the row's cells. to apply character-based alignment, set the css text-align property to the alignment character (such as "." or ","). bgcolorobsolete since html5 ...
...se the css text-align property to establish left, center, right, or justify alignment for the row's cells. to apply character-based alignment, set the css text-align property to the alignment character (such as "." or ","). bgcolorobsolete since html5 a domstring specifying a color to apply to the backgrounds of each of the row's cells. this can be either an hexadecimal #rrggbb or #rgb value or a color keyword. omitting the attribute or setting it to null in javascript causes the row's cells to inherit the row's parent element's background color. the <tr> element should be styled using css. to give a similar effect as the bgcolor attribute, use the css property background-color. charobsolete since html5 a domstring which sets the character to align the cells in each of...
...And 4 more matches
tabindex - HTML: Hypertext Markup Language
icates that its element can be focused, and where it participates in sequential keyboard navigation (usually with the tab key, hence the name). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...icipates in sequential keyboard navigation (usually with the tab key, hence the name). the source for this interactive example is stored in a github repository. if 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 accepts an integer as a value, with different results depending on the integer's value: a negative value (usually tabindex="-1") means that the element is not reachable via sequential keyboard navigation, but could be focused with javascript or visually by clicking with the mouse. it's mostly useful to create accessible widgets with javascript. a negative value is useful when you have off-screen content that appears on a specific event. the user won't be able to focus any ...
...ssible widgets with javascript. a negative value is useful when you have off-screen content that appears on a specific event. the user won't be able to focus any element with a negative tabindex using the keyboard, but a script can do so by calling the focus() method. tabindex="0" means that the element should be focusable in sequential keyboard navigation, after any positive tabindex values and its order is defined by the document's source order. a positive value means the element should be focusable in sequential keyboard navigation, with its order defined by the value of the number. that is, tabindex="4" is focused before tabindex="5" and tabindex="0", but after tabindex="3". ...
...And 4 more matches
MIME types (IANA media types) - HTTP
ed type the mime type represents. for example, for the mime type text, the subtype might be plain (plain text), html (html source code), or calendar (for icalendar/.ics) files. each type has its own set of possible subtypes, and a mime type always has both a type and a subtype, never just one or the other. an optional parameter can be added to provide additional details: type/subtype;parameter=value for example, for any mime type whose main type is text, the optional charset parameter can be used to specify the character set used for the characters in the data. if no charset is specified, the default is ascii (us-ascii) unless overridden by the user agent's settings. to specify a utf-8 text file, the mime type text/plain;charset=utf-8 is used. mime types are case-insensitive but are tradit...
...optional charset parameter can be used to specify the character set used for the characters in the data. if no charset is specified, the default is ascii (us-ascii) unless overridden by the user agent's settings. to specify a utf-8 text file, the mime type text/plain;charset=utf-8 is used. mime types are case-insensitive but are traditionally written in lowercase, with the exception of parameter values, whose case may or may not have specific meaning. types there are two classes of type: discrete and multipart. discrete types are types which represent a single file or medium, such as a single text or music file, or a single video. a multipart type is one which represents a document that's comprised of multiple component parts, each of which may have its own individual mime type; or, a multip...
...itmap and vector still images as well as animated versions of still image formats such as animated gif or apng. common examples are image/jpeg, image/png, and image/svg+xml. model list at iana model data for a 3d object or scene. examples include model/3mf and model/vml. text list at iana text-only data including any human-readable content, source code, or textual data such as comma-separated value (csv) formatted data. examples include text/plain, text/csv, and text/html. video list at iana video data or files, such as mp4 movies (video/mp4). for text documents without a specific subtype, text/plain should be used. similarly, for binary documents without a specific or known subtype, application/octet-stream should be used. multipart types multipart types indicate a category of docume...
...And 4 more matches
Content-Disposition - HTTP
part of a multipart body to give information about the field it applies to. the subpart is delimited by the boundary defined in the content-type header. used on the body itself, content-disposition has no effect. the content-disposition header is defined in the larger context of mime messages for e-mail, but only a subset of the possible parameters apply to http forms and post requests. ...
...ost requests. only the value form-data, as well as the optional directive name and filename, can be used in the http context. header type response header (for the main body) general header (for a subpart of a multipart body) forbidden header name no syntax as a response header for the main body the first parameter in the http context is either inline (default value, indicating it can be displayed inside the web page, or as the web page) or attachment (indicating it should be downloaded; most browsers presenting a 'save as' dialog, prefilled with the value of the filename parameters if present). content-disposition: inline content-disposition: attachment content-disposition: attachment; filename="filename.jpg" as a header for a multipart body the first pa...
...ntent-disposition: form-data; name="fieldname"; filename="filename.jpg" directives name is followed by a string containing the name of the html field in the form that the content of this subpart refers to. when dealing with multiple files in the same field (for example, the multiple attribute of an <input type="file"> element), there can be several subparts with the same name. a name with a value of '_charset_' indicates that the part is not an html field, but the default charset to use for parts without explicit charset information. filename is followed by a string containing the original name of the file transmitted. the filename is always optional and must not be used blindly by the application: path information should be stripped, and conversion to the server file system rules shoul...
...And 4 more matches
ETag - HTTP
Web › HTTP › Headers › ETag
the etag http response header is an identifier for a specific version of a resource. it lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed. additionally, etags help prevent simultaneous updates of a resource from overwriting each other ("mid-air collisions"). ...
...value must be generated. a comparison of them can determine whether two representations of a resource are the same. etags are therefore similar to fingerprints, and might also be used for tracking purposes by some servers. they might also be set to persist indefinitely by a tracking server. header type response header forbidden header name no syntax etag: w/"<etag_value>" etag: "<etag_value>" directives w/ optional 'w/' (case-sensitive) indicates that a weak validator is used. weak etags are easy to generate, but are far less useful for comparisons. strong validators are ideal for comparisons but can be very difficult to generate efficiently. ...
... header type response header forbidden header name no syntax etag: w/"<etag_value>" etag: "<etag_value>" directives w/ optional 'w/' (case-sensitive) indicates that a weak validator is used. weak etags are easy to generate, but are far less useful for comparisons. strong validators are ideal for comparisons but can be very difficult to generate efficiently. weak etag values of two representations of the same resources might be semantically equivalent, but not byte-for-byte identical. this means weak etags prevent caching when byte range requests are used, but strong etags mean range requests can still be cached. "<etag_value>" entity tag uniquely representing the requested resource. they are a string of ascii characters placed between double quotes, like "675af34...
...And 4 more matches
Text formatting - JavaScript
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. ...
...tring.prototype.codepointat(). '\u{2f804}' // the same with simple unicode escapes '\ud87e\udc04' string objects the string object is a wrapper around the string primitive data 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';...
...onverts 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. ...
...And 4 more matches
SyntaxError: a declaration in the head of a for-of loop can't have an initializer - JavaScript
or: for-of loop head declarations cannot have an initializer (edge) syntaxerror: a declaration in the head of a for-of loop can't have an initializer (firefox) syntaxerror: for-of loop variable declaration may not have an initializer. (chrome) error type syntaxerror what went wrong? the head of a for...of loop contains an initializer expression. ...
...on may not have an initializer. (chrome) error type syntaxerror what went wrong? ...
... error type syntaxerror what went wrong? ...
...And 4 more matches
The arguments object - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. description 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. ...
...nts inside that function by using its arguments object. it has entries for each argument the function 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 ...
...etermined by indexing arguments: console.log(typeof arguments[0]); // returns the type of the first argument properties arguments.callee reference to the currently executing function that the arguments belong to. forbidden in strict mode. arguments.length the number of arguments that were passed to the function. arguments[@@iterator] returns a new array iterator object that contains the values for each index in arguments. examples defining a function that concatenates several strings this example defines a function that concatenates several strings. the function's only formal argument is a string containing the characters that separate the items to concatenate. function myconcat(separator) { let args = array.prototype.slice.call(arguments, 1); return args.join(separator); } ...
...And 4 more matches
Array.prototype.findIndex() - JavaScript
the array that satisfies the provided testing function. otherwise, it returns -1, indicating that no element passed the test. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. see also the find() method, which returns the value of an array element, instead of its index. syntax arr.findindex(callback( element[, index[, array]] )[, thisarg]) parameters callback a function to execute on each value in the array until the function returns true, indicating that the satisfying element was found. it takes three arguments: element the current element being processed in the array. index optional the index o...
...l the function returns true, indicating that the satisfying element was found. it takes three arguments: element the current element being processed in the array. index optional the index of the current element being processed in the array. array optional the array findindex() was called upon. thisarg optional optional object to use as this when executing callback. ...
...e array. array optional the array findindex() was called upon. thisarg optional optional object to use as this when executing callback. 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. ...
...And 4 more matches
Boolean - JavaScript
the boolean object is an object wrapper for a boolean value. description the value passed as the first parameter is converted to a boolean value, if necessary. if the value is omitted or is 0, -0, null, false, nan, undefined, or the empty string (""), the object has an initial value of false. all other values, including any object, an empty array ([]), or the string "false", create an object with an initial value of true. do not confuse the primitive boolean values true and false with the true and false values of the boolean object. any object of which the value is not undefined or null, including a boolean object whose value is false, evaluates to true when passed to a conditional statement. for example, the condition in the following if statement evaluates to true: var x = new boolean(f...
...l statement. for example, the condition in the following if statement evaluates to true: var x = new boolean(false); if (x) { // this code is executed } this behavior does not apply to boolean primitives. ...
...ample, the condition in the following if statement evaluates to true: var x = new boolean(false); if (x) { // this code is executed } this behavior does not apply to boolean primitives. for example, the condition in the following if statement evaluates to false: var x = false; if (x) { // this code is not executed } do not use a boolean object to convert a non-boolean value to a boolean value. to perform this task, instead, use boolean as a function, or a double not operator: var x = boolean(expression); // use this... var x = !!(expression); // ...or this var x = new boolean(expression); // don't use this! if you specify any object, including a boolean object whose value is false, as the initial value of a boolean object, the new boolean object has a value of true. v...
...And 4 more matches
DataView - JavaScript
sors provide explicit control of how data is accessed, regardless of the executing computer's endianness. var littleendian = (function() { var buffer = new arraybuffer(2); new dataview(buffer).setint16(0, 256, true /* littleendian */); // int16array uses the platform's endianness. return new int16array(buffer)[0] === 256; })(); console.log(littleendian); // true or false 64-bit integer values because javascript does not currently include standard support for 64-bit integer values, dataview does not offer native 64-bit operations. as a workaround, you could implement your own getuint64() function to obtain a value with precision up to number.max_safe_integer, which could suffice for certain cases. function getuint64(dataview, byteoffset, littleendian) { // split 64-bit number into...
...precision may be lost'); return combined; } alternatively, if you need full 64-bit range, you can create a bigint. ...
...ble size. const bigint = window.bigint, bigthirtytwo = bigint(32), bigzero = bigint(0); function getuint64bigint(dataview, byteoffset, littleendian) { // split 64-bit number into two 32-bit (4-byte) parts const left = bigint(dataview.getuint32(byteoffset|0, !!littleendian)>>>0); const right = bigint(dataview.getuint32((byteoffset|0) + 4|0, !!littleendian)>>>0); // combine the two 32-bit values and return return littleendian ? (right<<bigthirtytwo)|left : (left<<bigthirtytwo)|right; } constructor dataview() creates a new dataview object. instance properties dataview.prototype.buffer the arraybuffer referenced by this view. fixed at construction time and thus read only. dataview.prototype.bytelength the length (in bytes) of this view from the start of its arraybuffer. fix...
...And 4 more matches
Date.prototype.setMinutes() - JavaScript
the setminutes() method sets the minutes for a specified date according to local time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... the setminutes() method sets the minutes for a specified date according to local time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... the setminutes() method sets the minutes for a specified date according to local time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 4 more matches
Date.prototype.setUTCFullYear() - JavaScript
the setutcfullyear() method sets the full year for a specified date according to universal time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... the setutcfullyear() method sets the full year for a specified date according to universal time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... the setutcfullyear() method sets the full year for a specified date according to universal time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 4 more matches
Function.prototype.apply() - JavaScript
this argument is required. ...
...this argument is required. ...
...y-like 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 func.apply(thisarg, [ argsarray]) parameters thisarg the value of this provided for the call to func. note that this may not be the actual value seen by the method: if the method is a function in non-strict mode code, null and undefined will be replaced with the global object, and primitive values will be boxed. this argument is required. argsarray optional an array-like object, specifying the arguments with which func should be called, or null or undefined if no arguments should be provided to the function. starting with ecmascri...
...And 4 more matches
Intl.Collator() constructor - JavaScript
om/mdn/interactive-examples and send us a pull request. syntax new intl.collator([locales[, options]]) parameters locales optional. a string with a bcp 47 language tag, or an array of such strings. for the general form and interpretation of the locales argument, see the intl page. the following unicode extension keys are allowed: co variant collations for certain locales. possible values include: "big5han", "dict", "direct", "ducet", "gb2312", "phonebk", "phonetic", "pinyin", "reformed", "searchjl", "stroke", "trad", "unihan". the "standard" and "search" values are ignored; they are replaced by the options property usage (see below). kn whether numeric collation should be used, such that "1" < "2" < "10". possible values are "true" and "false". this option can be set through...
...ored; they are replaced by the options property usage (see below). kn whether numeric collation should be used, such that "1" < "2" < "10". possible values are "true" and "false". this option can be set through an options property or through a unicode extension key; if both are provided, the options property takes precedence. kf whether upper case or lower case should sort first. possible values are "upper", "lower", or "false" (use the locale's default). this option can be set through an options property or through a unicode extension key; if both are provided, the options property takes precedence. options optional. ...
... case should sort first. possible values are "upper", "lower", or "false" (use the locale's default). this option can be set through an options property or through a unicode extension key; if both are provided, the options property takes precedence. options optional. an object with some or all of the following properties: localematcher the locale matching algorithm to use. possible values are "lookup" and "best fit"; the default is "best fit". for information about this option, see the intl page. usage whether the comparison is for sorting or for searching for matching strings. possible values are "sort" and "search"; the default is "sort". sensitivity which differences in the strings should lead to non-zero result values. ...
...And 4 more matches
Math.min() - JavaScript
if any one or more of the parameters cannot be converted into a number, nan is returned. the result is infinity if no parameters are provided. ...
...if any one or more of the parameters cannot be converted into a number, nan is returned. the result is infinity if no parameters are provided. ...
...if any one or more of the parameters cannot be converted into a number, nan is returned. the result is infinity if no parameters are provided. ...
...And 4 more matches
Number.NEGATIVE_INFINITY - JavaScript
the number.negative_infinity property represents the negative infinity value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of number.negative_infinity writable no enumerable no configurable no description the value of number.negative_infinity is the same as the negative value of the global object's infinity property. this value behaves slightly differently than mathematical infinity: any positive value, including positive_infinity, multiplied by negative_infinity is negative_infinity. any nega...
... enumerable no configurable no description the value of number.negative_infinity is the same as the negative value of the global object's infinity property. this value behaves slightly differently than mathematical infinity: any positive value, including positive_infinity, multiplied by negative_infinity is negative_infinity. any negative value, including negative_infinity, multiplied by negative_infinity is positive_infinity. any positive value divided by negative_infinity is negative zero. any negative value divided by negative_infinity is positive zero. zero multiplied by negative_infinity is nan. ...
... negative_infinity, divided by either negative_infinity or positive_infinity, is nan. ...
...And 4 more matches
Object.assign() - JavaScript
ntribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.assign(target, ...sources) parameters target the target object — what to apply the sources’ properties to, which is returned after it is modified. sources the source object(s) — objects containing the properties you want to apply. return value the target object. description properties in the target object are overwritten by properties in the sources if they have the same key. later sources' properties overwrite earlier ones. the object.assign() method only copies enumerable and own properties from a source object to a target object. it uses [[get]] on the source and [[set]] on the target, so it will invoke getters and setters. ther...
...ject is changed if any properties are added before the error is raised. note: object.assign() does not throw on null or undefined sources. ...
... function test() { 'use strict'; let obj1 = { a: 0 , b: { c: 0}}; let obj2 = object.assign({}, obj1); console.log(json.stringify(obj2)); // { "a": 0, "b": { "c": 0}} obj1.a = 1; console.log(json.stringify(obj1)); // { "a": 1, "b": { "c": 0}} console.log(json.stringify(obj2)); // { "a": 0, "b": ...
...And 4 more matches
Promise.any() - JavaScript
promise.any() takes an iterable of promise objects and, as soon as one of the promises in the iterable fulfils, returns a single promise that resolves with the value from that promise. if no promises in the iterable fulfil (if all of the given promises are rejected), then the returned promise is rejected with an aggregateerror, a new subclass of error that groups together individual errors. essentially, this method is the opposite of promise.all(). warning! the promise.any() method is experimental and not fully supported by all browsers and platforms. it is currently in stage 4 of the tc39 process. syntax promise.any(iterable); parameters iterable an iterable object, such as an array. return value an already resolved promise if the iterable passed is empty. an asynchronously ...
...synchronously (as soon as the stack is empty) when any of the promises in the given iterable resolve, or if all the promises have rejected. description this method is useful for returning the first promise that fulfils. it short-circuits after a promise fulfils, so it does not wait for the other promises to complete once it finds one. unlike promise.all(), which returns an array of fulfillment values, we only get one fulfillment value (assuming at least one promise fulfills). this can be beneficial if we need only one promise to fulfil but we do not care which one does. also, unlike promise.race(), which returns the first settled value (either fulfillment or rejection), this method returns the first fulfilled value. this method will ignore all rejected promises up until the first promise tha...
... if an empty iterable is passed, then this method returns (synchronously) an already resolved promise. ...
...And 4 more matches
Promise.prototype.catch() - JavaScript
the catch() method returns a promise and deals with rejected cases only. it behaves the same as calling promise.prototype.then(undefined, onrejected) (in fact, calling obj.catch(onrejected) internally calls obj.then(undefined, onrejected)). this means that you have to provide an onrejected function even if you want to fall back to an undefined result value - for example obj.catch(() => {}). the source for this interactive example is stored in a github repository. if 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 p.catch(onrejected); p.catch(function(reason) { // rejection }); parameters onrejected a function called when the promise is rejected. this function has one argumen...
...us a pull request. syntax p.catch(onrejected); p.catch(function(reason) { // rejection }); parameters onrejected a function called when the promise is rejected. this function has one argument: reason the rejection reason. the promise returned by catch() is rejected if onrejected throws an error or returns a promise which is itself rejected; otherwise, it is resolved. return value internally calls promise.prototype.then on the object upon which it was called, passing the parameters undefined and the received onrejected handler. returns the value of that call, which is a promise. note the examples below are throwing instances of error. this is considered good practice in contrast to throwing strings; otherwise, the part doing the catching would have to perform checks to ...
...d .then on promise{} with arguments: arguments{2} [0: undefined, 1: function xxx()] description the catch method is used for error handling in promise composition. since it returns a promise, it can be chained in the same way as its sister method, then(). ...
...And 4 more matches
Promise.race() - JavaScript
the promise.race() method returns a promise that fulfills or rejects as soon as one of the promises in an iterable fulfills or rejects, with the value or reason from that promise. the source for this interactive demo is stored in a github repository. if you'd like to contribute to the interactive demo project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax promise.race(iterable); parameters iterable an iterable object, such as an array. see iterable. return value a pending promise that asynchronously yields the value of the first promise in the given iterable to fulfill or reject. ...
...m/mdn/interactive-examples and send us a pull request. syntax promise.race(iterable); parameters iterable an iterable object, such as an array. see iterable. return value a pending promise that asynchronously yields the value of the first promise in the given iterable to fulfill or reject. description the race function returns a promise that is settled the same way (and takes the same value) as the first promise that settles amongst the promises of the iterable passed as an argument. if the iterable passed is empty, the promise returned will be forever pending. if the iterable contains one or more non-promise value and/or an already settled promise, then promise.race will resolve to the first of these values found in the iterable. examples asynchronicity of promise.race this fo...
...the iterable. ...
...And 4 more matches
Symbol.toPrimitive - JavaScript
the hint argument can be one of "number", "string", and "default". ...
...the hint argument can be one of "number", "string", and "default". ...
...the hint argument can be one of "number", "string", and "default". ...
...And 4 more matches
TypedArray.prototype.map() - 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 typedarray.map(mapfn[, thisarg]) parameters mapfn a callback function that produces an element of the new typed array, taking three arguments: currentvalue the current element being processed in the typed array. index optional the index of the current element being processed in the typed array. array optional the typed array map() was called upon. thisarg optional value to use as this when executing mapfn. return value a new typed array. description the map() method calls a provided callback function (mapfn) once for each elemen...
...optional the typed array map() was called upon. thisarg optional value to use as this when executing mapfn. return value a new typed array. description the map() method calls a provided callback function (mapfn) once for each element in a typed array, in order, and constructs a new typed array from the results. mapfn is invoked only for indexes of the typed array which have assigned values; it is not invoked for indexes that are undefined, those which have been deleted, or which have never been assigned values. mapfn is invoked with three arguments: the value of the element, the index of the element, and the typed array object being traversed. ...
... map() does not mutate the typed array on which it is called (although mapfn, if invoked, may do so). ...
...And 4 more matches
TypedArray.prototype.some() - JavaScript
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.some(callback[, thisarg]) parameters callback function to test for each element, taking three arguments: currentvalue the current element being processed in the typed array. index the index of the current element being processed in the typed array. array the typed array some was called upon. thisarg optional. value to use as this when executing callback. return value true if the callback function returns a truthy value for any array element; otherwise, false. description the some method exec...
...typed array. array the typed array some was called upon. thisarg optional. value to use as this when executing callback. return value true if the callback function returns a truthy value for any array element; otherwise, false. description the some method executes the callback function once for each element present in the typed array until it finds one where callback returns a true value. if such an element is found, some immediately returns true. otherwise, some returns false. callback is invoked with three arguments: the value of the element, the index of the element, and the array object being traversed. ...
... some does not mutate the typed array on which it is called. ...
...And 4 more matches
WebAssembly.Global() constructor - JavaScript
a webassembly.global() constructor creates a new global object representing a global variable instance, accessible from both javascript and importable/exportable across one or more webassembly.module instances. this allows dynamic linking of multiple modules. syntax new webassembly.global(descriptor, value); parameters descriptor a globaldescriptor dictionary object, which contains two properties: value: a usvstring representing the data type of the global. ...
...nd importable/exportable across one or more webassembly.module instances. this allows dynamic linking of multiple modules. syntax new webassembly.global(descriptor, value); parameters descriptor a globaldescriptor dictionary object, which contains two properties: value: a usvstring representing the data type of the global. this can be one of i32, i64, f32, and f64. mutable: a boolean value that determines whether the global is mutable or not. by default, this is false. value the value the variable contains. this can be any value, as long as its type matches the variable's data type. if no value is specified, a typed 0 value is used, as specified by the defaultvalue algorithm. examples creating a new global instance the following example shows a new global instance be...
...e variable contains. this can be any value, as long as its type matches the variable's data type. if no value is specified, a typed 0 value is used, as specified by the defaultvalue algorithm. examples creating a new global instance the following example shows a new global instance being created using the webassembly.global() constructor. it is being defined as a mutable i32 type, with a value of 0. the value of the global is then changed, first to 42 using the global.value property, and then to 43 using the incglobal() function exported out of the global.wasm module (this adds 1 to whatever value is given to it and then returns the new value). const output = document.getelementbyid('output'); function asserteq(msg, got, expected) { output.innerhtml += `testing ${msg}: `; if...
...And 4 more matches
eval() - JavaScript
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. syntax eval(string) parameters string a string representing a javascript expression, statement, or sequence of statements. the expression can include variables and properties of existing objects. return value the completion value of evaluating the given code. if the completion value is empty, undefined is returned. description eval() is a function property of the global object. the argument of the eval() function is a string. if the string represents an expression, eval() evaluates the expression. if the argument represents one or more javascript statements, eval() evaluates the statements. do not...
...script statements, eval() evaluates the statements. do not call eval() to evaluate an arithmetic expression; javascript evaluates arithmetic expressions automatically. if you construct an arithmetic expression as a string, you can use eval() to evaluate it at a later time. for example, suppose you have a variable x. you can postpone evaluation of an expression involving x by assigning the string value of the expression, say "3 * x + 2", to a variable, and then calling eval() at a later point in your script. if the argument of eval() is not a string, eval() returns the argument unchanged. in the following example, the string constructor is specified and eval() returns a string object rather than evaluating the string. eval(new string('2 + 2')); // returns a string object containing "2 + 2" ev...
...he javascript interpreter, while many other constructs are optimized by modern js engines. additionally, modern javascript interpreters convert javascript to machine code. this means that any concept of variable naming gets obliterated. thus, any use of eval() will force the browser to do long expensive variable name lookups to figure out where the variable exists in the machine code and set its value. additonally, new things can be introduced to that variable through eval() such as changing the type of that variable, forcing the browser to re-evaluate all of the generated machine code to compensate. fortunately, there's a very good alternative to eval(): simply using window.function(). see this example of how to convert code using a dangerous eval() to using function(), see below. bad code ...
...And 4 more matches
Logical OR (||) - JavaScript
the logical or (||) operator (logical disjunction) for a set of operands is true if and only if one or more of its operands is true. it is typically used with boolean (logical) values. when it is, it returns a boolean value. however, the || operator actually returns the value of one of the specified operands, so if this operator is used with non-boolean values, it will return a non-boolean value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... non-boolean values, it will return a non-boolean value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax expr1 || expr2 description if expr1 can be converted to true, returns expr1; else, returns expr2. if a value can be converted to true, the value is so-called truthy. if a value can be converted to false, the value is so-called falsy. examples of expressions that can be converted to false are: null; nan; 0; empty string ("" or '' or ``); undefined. ...
...can be converted to true, returns expr1; else, returns expr2. if a value can be converted to true, the value is so-called truthy. if a value can be converted to false, the value is so-called falsy. examples of expressions that can be converted to false are: null; nan; 0; empty string ("" or '' or ``); undefined. even though the || operator can be used with operands that are not boolean values, it can still be considered a boolean operator since its return value can always be converted to a boolean primitive. to explicitly convert its return value (or any expression in general) to the corresponding boolean value, use a double not operator or the boolean constructor. short-circuit evaluation the logical or expression is evaluated left to right, it is tested for possible "short-circui...
...And 4 more matches
Property accessors - JavaScript
ap, dictionary, hash, lookup table). the keys in this array are the names of the object's properties. it's typical when speaking of an object's properties to make a distinction between properties and methods. however, the property/method distinction is little more than a convention. a method is simply a property that can be called (for example, if it has a reference to a function instance as its value). there are two ways to access properties: dot notation and bracket notation. dot notation in the object.property syntax, the property must be a valid javascript identifier. (in the ecmascript standard, the names of properties are technically "identifiernames", not "identifiers", so reserved words can be used but are not recommended). for example, object.$1 is valid, while object.1 is not. co...
... bracket notation. dot notation in the object.property syntax, the property must be a valid javascript identifier. (in the ecmascript standard, the names of properties are technically "identifiernames", not "identifiers", so reserved words can be used but are not recommended). for example, object.$1 is valid, while object.1 is not. const variable = object.property_name; object.property_name = value; const object = {}; object.$1 = 'foo'; console.log(object.$1); // 'foo' object.1 = 'bar'; // syntaxerror console.log(object.1); // syntaxerror here, the method named createelement is retrieved from document and is called. document.createelement('pre') if you use a method for a numeric literal, and the numeric literal has no exponent and no decimal point, you should leave white-...
...xponential() // or 77 .toexponential() // or ;(77).toexponential() // or 77..toexponential() // or 77.0.toexponential() // because 77. === 77.0, no ambiguity bracket notation in the object[property_name] syntax, the property_name is just a string or symbol. so, it can be any string, including '1foo', '!bar!', or even ' ' (a space). ...
...And 4 more matches
async function - JavaScript
eractive demo project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax async function name([param[, param[, ...param]]]) { statements } parameters name the function’s name. param the name of an argument to be passed to the function. statements the statements comprising the body of the function. the await mechanism may be used. return value a promise which will be resolved with the value returned by the async function, or rejected with an exception thrown from, or uncaught within, the async function. description async functions can contain zero or more await expressions. await expressions suspend progress through an async function, yielding control and subsequently resuming progress only when an awaited promise-based asynchronous...
...d by the async function, or rejected with an exception thrown from, or uncaught within, the async function. description async functions can contain zero or more await expressions. await expressions suspend progress through an async function, yielding control and subsequently resuming progress only when an awaited promise-based asynchronous operation is either fulfilled or rejected. the resolved value of the promise is treated as the return value of the await expression. use of async / await enables the use of ordinary try / catch blocks around asynchronous code. the await keyword is only valid inside async functions. if you use it outside of an async function's body, you will get a syntaxerror. the purpose of async/await is to simplify the syntax necessary to consume promise-based apis. ...
...locks around asynchronous code. the await keyword is only valid inside async functions. if you use it outside of an async function's body, you will get a syntaxerror. the purpose of async/await is to simplify the syntax necessary to consume promise-based apis. the behavior of async/await is similar to combining generators and promises. async functions always return a promise. if the return value of an async function is not explicitly a promise, it will be implicitly wrapped in a promise. for example, the following: async function foo() { return 1 } ...is equivalent to: function foo() { return promise.resolve(1) } the body of an async function can be thought of as being split by zero or more await expressions. top-level code, up to and including the first await expression (if...
...And 4 more matches
Strict mode - JavaScript
(assignment to a non-writable global or property, assignment to a getter-only property, assignment to a new property on a non-extensible object) will throw in strict mode: 'use strict'; // assignment to a non-writable global var undefined = 5; // throws a typeerror var infinity = 5; // throws a typeerror // assignment to a non-writable property var obj1 = {}; object.defineproperty(obj1, 'x', { value: 42, writable: false }); obj1.x = 9; // throws a typeerror // assignment to a getter-only property var obj2 = { get x() { return 17; } }; obj2.x = 5; // throws a typeerror // assignment to a new property on a non-extensible object var fixed = {}; object.preventextensions(fixed); fixed.newprop = 'ohai'; // throws a typeerror third, strict mode makes attempts to delete undeletable properties th...
...ypeerror third, strict mode makes attempts to delete undeletable properties throw (where before the attempt would simply have no effect): 'use strict'; delete object.prototype; // throws a typeerror fourth, strict mode prior to gecko 34 requires that all properties named in an object literal be unique. the normal code may duplicate property names, with the last one determining the property's value. but since only the last one does anything, the duplication is simply a vector for bugs, if the code is modified to change the property value other than by changing the last instance. duplicate property names are a syntax error in strict mode: this is no longer the case in ecmascript 2015 (bug 1041128). 'use strict'; var o = { p: 1, p: 2 }; // !!! syntax error fifth, strict mode requires th...
...without strict mode, setting properties is simply ignored (no-op), with strict mode, however, a typeerror is thrown. (function() { 'use strict'; false.true = ''; // typeerror (14).sailing = 'home'; // typeerror 'with'.you = 'far away'; // typeerror })(); simplifying variable uses strict mode simplifies how variable names map to particular variable definitions in the code. many co...
...And 4 more matches
Template literals (Template strings) - JavaScript
icon-expander' : 'icon-collapser') }`; in es2015 with nested template literals: const classes = `header ${ islargescreen() ? '' : `icon-${item.iscollapsed ? 'expander' : 'collapser'}` }`; tagged templates a more advanced form of template literals are tagged templates. tags allow you to parse template literals with a function. the first argument of a tag function contains an array of string values. the remaining arguments are related to the expressions. the tag function can then perform whatever operations on these arguments you wish, and return the manipulated string. (alternatively, it can return something completely different, as described in one of the following examples.) the name of the function used for the tag can be whatever you want. let person = 'mike'; let age = 28; functi...
... agestr = 'centenarian'; } else { 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! ...
...n'; } else { 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! ...
...And 4 more matches
JavaScript typed arrays - JavaScript
javascript typed arrays are array-like objects that provide a mechanism for reading and writing raw binary data in memory buffers. as you may already know, array objects grow and shrink dynamically and can have any javascript value. javascript engines perform optimizations so that these arrays are fast. ...
...ever, as web applications become more and more powerful, adding features such as audio and video manipulation, access to raw data using websockets, and so forth, it has become clear that there are times when it would be helpful for javascript code to be able to quickly and easily manipulate raw binary data. this is where typed arrays come in. each entry in a javascript typed array is a raw binary value in one of a number of supported formats, from 8-bit integers to 64-bit floating-point numbers. however, typed arrays are not to be confused with normal arrays, as calling array.isarray() on a typed array returns false. moreover, not all methods available for normal arrays are supported by typed arrays (e.g. push and pop). buffers and views: typed array architecture to achieve maximum flexibili...
...fer; 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. there is one special typed array view, the uint8clampedarray. ...
...And 4 more matches
Navigation and resource timings - Web Performance
navigation timings. to view and capture our app's timing we enter: let time = window.performance.timing we can then use the results to measure how well our app is performing. the order is: performance timings details navigationstart when the prompt for unload terminates on the previous document in the same browsing context. if there is no previous document, this value will be the same as performancetiming.fetchstart. secureconnectionstart when the secure connection handshake starts. if no such connection is requested, it returns 0. redirectstart when the first http redirect starts. if there is no redirect, or if one of the redirects is not of the same origin, the value returned is 0. redirectend when the last http redir...
... returns 0. redirectstart when the first http redirect starts. if there is no redirect, or if one of the redirects is not of the same origin, the value returned is 0. redirectend when the last http redirect is completed, that is when the last byte of the http response has been received. if there is no redirect, or if one of the redirects is not of the same origin, the value returned is 0. connectend when the connection is opened network. if the transport layer reports an error and the connection establishment is started again, the last connection establishment end time is given. if a persistent connection is used, the value will be the same as performancetiming.fetchstart. a connection is considered as opened when all secure connection handshake, or ...
...fetchstart. a connection is considered as opened when all secure connection handshake, or socks authentication, is terminated. connectstart when the request to open a connection is sent to the network. if the transport layer reports an error and the connection establishment is started again, the last connection establishment start time is given. if a persistent connection is used, the value will be the same as performancetiming.fetchstart. domainlookupend when the domain lookup is finished. if a persistent connection is used, or the information is stored in a cache or a local resource, the value will be the same as performancetiming.fetchstart. domainlookupstart when the domain lookup starts. if a persistent connection is used, or the information is stored in...
...And 4 more matches
keyTimes - SVG: Scalable Vector Graphics
the keytimes attribute represents a list of time values used to control the pacing of the animation. each time in the list corresponds to a value in the values attribute list, and defines when the value is used in the animation. each time value in the keytimes list is specified as a floating point value between 0 and 1 (inclusive), representing a proportional offset into the duration of the animation element. ...
... representing a proportional offset into the duration of the animation element. ...
..., <animatemotion>, and <animatetransform> html, body, svg { height: 100%; } <svg viewbox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"> <circle cx="60" cy="10" r="10"> <animate attributename="cx" dur="4s" repeatcount="indefinite" values="60 ; 110 ; 60 ; 10 ; 60" keytimes="0 ; 0.25 ; 0.5 ; 0.75 ; 1"/> <animate attributename="cy" dur="4s" repeatcount="indefinite" values="10 ; 60 ; 110 ; 60 ; 10" keytimes="0 ; 0.25 ; 0.5 ; 0.75 ; 1"/> </circle> </svg> usage notes value <number> [ ; <number> ]* ;? default value none animatable no the value of the keytimes attribute is a semicolon-separated list of values. there must be exactly as many values in the keytimes list as in the values list. each successive time value ...
...And 4 more matches
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 exp...
...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 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. ...
...property may be specified using one, two, 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. ...
...And 4 more matches
<circle> - SVG: Scalable Vector Graphics
Web › SVG › Element › circle
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. ...
...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. ...
...wbox="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 pathlength the total length for the circle's circumference, in user units. value type: <number> ; default value: none; animatable: yes note: starting with svg2, cx, cy, and r are geometry properties, meaning those attributes can also be used as css properties for that element. ...
...And 4 more matches
<feConvolveMatrix> - SVG: Scalable Vector Graphics
ies a matrix convolution filter effect. a convolution combines pixels in the input image with neighboring pixels to produce a resulting image. a wide variety of imaging operations can be achieved through convolutions, including blurring, edge detection, sharpening, embossing and beveling. ...
...ixels in the input image with neighboring pixels to produce a resulting image. a wide variety of imaging operations can be achieved through convolutions, including blurring, edge detection, sharpening, embossing and beveling. a matrix convolution is based on an n-by-m matrix (the convolution kernel) which describes how a given pixel value in the input image is combined with its neighboring pixel values to produce a resulting pixel value. ...
... matrix convolution is based on an n-by-m matrix (the convolution kernel) which describes how a given pixel value in the input image is combined with its neighboring pixel values to produce a resulting pixel value. each result pixel is determined by applying the kernel matrix to the corresponding source pixel and its neighboring pixels. ...
...And 4 more matches
<linearGradient> - SVG: Scalable Vector Graphics
<lineargradient id="mygradient" gradienttransform="rotate(90)"> <stop offset="5%" stop-color="gold" /> <stop offset="95%" stop-color="red" /> </lineargradient> </defs> <!-- using my linear gradient --> <circle cx="5" cy="5" r="4" fill="url('#mygradient')" /> </svg> attributes gradientunits this attribute defines the coordinate system for attributes x1, x2, y1, y2 value type: userspaceonuse|objectboundingbox ; default value: objectboundingbox; animatable: yes gradienttransform this attribute provides additional transformation to the gradient coordinate system. value type: <transform-list> ; default value: identity transform; animatable: yes href this attribute defines a reference to another <lineargradient> element that will be used as a template. value ty...
...e|objectboundingbox ; default value: objectboundingbox; animatable: yes gradienttransform this attribute provides additional transformation to the gradient coordinate system. value type: <transform-list> ; default value: identity transform; animatable: yes href this attribute defines a reference to another <lineargradient> element that will be used as a template. value type: <url> ; 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. ...
...lue type: <url> ; 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. ...
...And 4 more matches
<script> - SVG: Scalable Vector Graphics
Web › SVG › Element › script
nst b = math.round(math.random() * 255).tostring(16).padstart(2,'0') return `#${r}${g}${b}` } document.queryselector('circle').addeventlistener('click', (e) => { e.target.style.fill = getcolor() }) }) // ]]> </script> <circle cx="5" cy="5" r="4" /> </svg> attributes crossorigin this attribute defines cors settings as define for the html <script> element. ...
...() * 255).tostring(16).padstart(2,'0') return `#${r}${g}${b}` } document.queryselector('circle').addeventlistener('click', (e) => { e.target.style.fill = getcolor() }) }) // ]]> </script> <circle cx="5" cy="5" r="4" /> </svg> attributes crossorigin this attribute defines cors settings as define for the html <script> element. ...
...}` } document.queryselector('circle').addeventlistener('click', (e) => { e.target.style.fill = getcolor() }) }) // ]]> </script> <circle cx="5" cy="5" r="4" /> </svg> attributes crossorigin this attribute defines cors settings as define for the html <script> element. value type: <string>; default value: ?; animatable: yes href the url to the script to load. ...
...And 4 more matches
<use> - SVG: Scalable Vector Graphics
Web › SVG › Element › use
x="5" cy="5" r="4" stroke="blue"/> <use href="#mycircle" x="10" fill="blue"/> <use href="#mycircle" x="20" fill="white" stroke="red"/> <!-- stroke="red" will be ignored here, as stroke was already set on mycircle. most attributes (except for x, y, width, height and (xlink:)href) do not override those set in the ancestor. that's why the circles have different x positions, but the same stroke value. --> </svg> the effect is the same as if the nodes were deeply cloned into a non-exposed dom, then pasted where the use element is, much like cloned template elements in html5. most attributes on use do not override those already on the element referenced by use. (this differs from how css style attributes override those set 'earlier' in the cascade). only the attributes x, y, width, hei...
...here is currently no defined way to set a cross-origin policy for use elements. since svg 2, the xlink:href attribute is deprecated in favor of href. see xlink:href page for more information. however, xlink:href can still be required in practice for cross-browser compatibility (see the compatibility table below). attributes href the url to an element/fragment that needs to be duplicated. ...
... way to set a cross-origin policy for use elements. since svg 2, the xlink:href attribute is deprecated in favor of href. see xlink:href page for more information. however, xlink:href can still be required in practice for cross-browser compatibility (see the compatibility table below). attributes href the url to an element/fragment that needs to be duplicated. ...
...And 4 more matches
Classes and Inheritance - Archive of obsolete content
data members are properties that allow each instance to have their own state, whereas member functions are properties that allow instances to have behavior. inheritance allows classes to inherit state and behavior from an existing classes, known as the base class. unlike languages like c++ and java, javascript does not have native support for classical inheritance. ...
...ape: let shape = new shape(2, 3); shape instanceof shape; // => true shape.x; // => 2 shape.y; // => 3 the keyword new tells javascript that we are performing a constructor call. constructor calls differ from ordinary function calls in that javascript automatically creates a new object and binds it to the keyword this for the duration of the call. ...
...nceof shape; // => true shape.x; // => 2 shape.y; // => 3 the keyword new tells javascript that we are performing a constructor call. constructor calls differ from ordinary function calls in that javascript automatically creates a new object and binds it to the keyword this for the duration of the call. moreover, if the constructor does not return a value, the result of the call defaults to the value of this. ...
...And 3 more matches
page-mod - Archive of obsolete content
refox hidden windows. to stop a page-mod from making any more modifications, call its destroy() method. the pagemod constructor takes a number of other options to control its behavior: contentstyle lists stylesheets to attach, supplied as strings. contentstylefile lists stylesheets to attach, supplied in separate files. contentscriptoptions defines read-only values accessible to content scripts. attachto controls whether to attach scripts to tabs that were already open when the page-mod was created, and whether to attach scripts to iframes as well as the topmost document. contentscriptwhen controls the point during document load at which content scripts are attached. exclude has the same syntax as include, but speci...
...s makes your code easier to maintain, secure, debug and review. name: contentscriptwhen type: string by default, content scripts are attached after all the content (dom, js, css, images) for the document has been loaded, at the time the window.onload event fires. using this option you can customize this behavior. ...
...ow.alert("matched!");', contentscriptwhen: "start" }); if you specify "start" for contentscriptwhen, your scripts will not be able to interact with the document's dom right away (although they could listen for window.onload or domcontentloaded themselves). this property defaults to "end". name: contentscriptoptions type: object you can use this option to define some read-only values for your content scripts. the option consists of an object literal listing name:value pairs for the values you want to provide to the content script. for example: var data = require("sdk/self").data; var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "*", contentscriptfile: data.url("show.js"), contentscriptoptions: { showoptions: true, numbers: [1, 2], greetin...
...And 3 more matches
Boxes - Archive of obsolete content
x) by default. however, you can easily add this capability with a style change. ...
... you can easily add this capability with a style change. ...
...s capability with a style change. ...
...And 3 more matches
How to convert an overlay extension to restartless - Archive of obsolete content
switch (branch.getpreftype(prefname)) { default: case 0: return undefined; // pref_invalid case 32: return getucharpref(prefname,branch); // pref_string case 64: return branch.getintpref(prefname); // pref_int case 128: return branch.getboolpref(prefname); // pref_bool } } function setgenericpref(branch,prefname,prefvalue) { switch (typeof prefvalue) { case "string": setucharpref(prefname,prefvalue,branch); return; case "number": branch.setintpref(prefname,prefvalue); return; case "boolean": branch.setboolpref(prefname,prefvalue); return; } } function setdefaultpref(prefname,prefvalue) { var defaultbranch = services.prefs...
...setucharpref(prefname,prefvalue,branch); return; case "number": branch.setintpref(prefname,prefvalue); return; case "boolean": branch.setboolpref(prefname,prefvalue); return; } } function setdefaultpref(prefname,prefvalue) { var defaultbranch = services.prefs.getdefaultbranch(null); setgenericpref(defaultbranch,prefname,prefvalue); } function getucharpref(prefname,branch) // unicode getcharpref { branch = branch ? ...
... case "boolean": branch.setboolpref(prefname,prefvalue); return; } } function setdefaultpref(prefname,prefvalue) { var defaultbranch = services.prefs.getdefaultbranch(null); setgenericpref(defaultbranch,prefname,prefvalue); } function getucharpref(prefname,branch) // unicode getcharpref { branch = branch ? branch : services.prefs; return branch.getcomplexvalue(prefname, components.interfaces.nsisupportsstring).data; } function setucharpref(prefname,text,branch) // unicode setcharpref { var string = components.classes["@mozilla.org/supports-string;1"] .createinstance(components.interfaces.nsisupportsstring); string.data = text; branch = branch ? ...
...And 3 more matches
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
ow one thing that nsiwindowmediator is often used for is to get the active window. listing 4 shows how to get the active browser window and the number of open tabs. passing the name of the window type as the parameter of the nsiwindowmediator.getmostrecentwindow() method returns the most recently active window from among the root element's windows with that type set for the windowtype attribute value. setting the parameter to null returns the active window from among 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.get...
...mp.txt'); if (file.exists()) file.remove(false); file.create(file.normal_file_type, 0666); the first parameter of the nsilocalfile.create() method gives the type of file to create. this is defined using constant properties—to create a normal file, use normal_file_type, to create a folder use directory_type. the second parameter gives the access privileges to that file using unix-style octal values. note: windows ignores the privileges parameter; other platforms may do so as well. the nsilocalfile object includes methods that return virtual state values for the current file, as shown in table 1. table 1: methods for checking file states method name description nsilocalfile.exists() determines whether or not the file exists. nsilocalfile.iswriteable() ...
...here, the character string to be written, 変換テスト, is hard-c...
...And 3 more matches
Appendix E: DOM Building and Insertion (HTML & XUL) - Archive of obsolete content
}, ["a", { href: href, key: "link", onclick: function (event) { alert(event.target.href); } }, text], ["span", { class: "stuff" }, "stuff"]]], document, nodes)); alert(nodes.link); function addentrytopopup(menupopup, doc, chromewindow) { var newitem = doc.createelement("menuitem"); newitem.setattribute("value", "testvalue"); newitem.setattribute("label", "another popup menu item"); menupopup.appendchild(newitem); }; var jsontemplatebtn = ["xul:toolbarbutton", { id: "mytestbutton", class: "toolbarbutton-1", type: "menu", label: "test button label", tooltiptext: "test button tooltip", removable: true, ...
...em a 'key' attribute; for example: " + capturednodes.mytestbutton123); another example this here is another example of using jsontodom but in the html scope, a complex form is created with ease. ...
...orm is created with ease. ...
...And 3 more matches
The Box Model - Archive of obsolete content
s to a vbox, but in the other direction. unlike most style attributes, the flex attribute is considered acceptable to use in xul code. this is because this attribute is used much too often, and it would require a great deal of css code to avoid using it. at any rate, it can always be overriden using css, so your extension won't lose skinability because of it. flexibility is defined as a numeric value. the default value for most elements is 0, which means that the element will not stretch in the direction of its orientation, and its size in that dimension will be determined by its contents and padding. if you want an element to be flexible, you should set its flexibility to 1. this makes the element stretch to occupy as much available space there is in the direction of its orientation. if we a...
... a flexibility of 1, the available space is distributed evenly among the two. note that this is not always the case. if one of the buttons has a very long label that restricts its minimum size, then it could be the label determining its size, while the other button would flex taking the rest of the room. now, if you want a different size distribution in flexible elements, you can use flexibility values higher than 1. in this case, the "cat" button has a flex value of 3, while the "parrot" button still has a flex value of 1. the "cat" button is now larger in a 3 to 1 proportion. note that, again, this can depend on the contents of the elements, in this case, the labels and paddings in the buttons. if the label of the "parrot" button was something much longer, the size ratio would not be kept...
... define spacing between elements and inside of elements. the margin determines the space between an element and the elements surrounding it, while the padding determines the space between the borders of a container element and its child nodes, kind of like an inner margin. sometimes you also need to define flexible spaces between elements. in this case you should use a spacer element with a flex value. a spacer element is completely invisible and doesn't do more than take space. you should only use it when you need flexible space. if you need fix-sized space it's best to use margins and paddings and avoid adding unnecessary nodes to your xul document. alignment xul, unlike html, provides an easy way to align elements both horizontally and vertically. you can either use the align and pack att...
...And 3 more matches
The Essentials of an Extension - Archive of obsolete content
rome.manifest file tells firefox where to look for chrome files. the text is spaced to look like a table, but that is not necessary. the parser ignores repeated spaces. the first word in a line tells firefox what it is that is being declared (content, skin, locale, or others mentioned later on). the second is the package name, which we will explain shortly. skin and locale packages have a third value to specify what locale or what skin they are extending. there can be multiple skin and locale entries relating to different skins and locales. the most common case is having one skin entry for the global skin, classic/1.0, and multiple locale entries, one for each translation. finally, the location is specified. there are some additional options that can be included in the entries of a chrome.ma...
... the menu at the bottom of the dev tools section, above its end separator. we'll discuss more about menus later on in the tutorial. now let's look at the actual code: oncommand="xulschoolchrome.browseroverlay.sayhello(event);" this attribute defines an event handler. the command event is the most frequently used in firefox, since it corresponds to the main action for most ui elements. the value of the attribute is javascript code that invokes a function. this function is defined in the js file that was included with the script tag. the js function will be called once the user clicks on the menu item in the hello world menu. all event handlers define a special object named event, which is usually good to pass as an argument to the function. event handlers are explained in greater depth f...
... menu for people with accessibility problems, such as partial or total blindness, or physical disabilities that make using a mouse very difficult or impossible. you can easily recognize the access keys on windows because the letter that corresponds to the access key is underlined, as in the following image: most user interface controls have the accesskey attribute, and you should use it. the value of the access key is localized because it should match a letter in the label text. you should also be careful to avoid access key repetition. for example, within a menu or submenu, access keys should not be repeated. in a window you have to be more careful picking access keys because there are usually more controls there. you have to be specially careful when picking access keys on an overlay. in...
...And 3 more matches
Creating a Microsummary - Archive of obsolete content
xpath is a language for identifying nodes in html/xml documents. it also contains basic functions for manipulating those nodes and their content. the easiest way to get an xpath expression that points to the node in question is to use the xpath checker extension. install...
...tallation) then go to the spread firefox home page, find the firefox download count (a large number at the bottom of the right-hand column), context click on the number, and select view xpath from the context menu. xpath checker will open a new window. the new window will include an xpath field that contains this xpath expression pointing to the download count node: id('download-count'). ...
... add a <text> element to the xslt template with the content fx downloads: <?xml version="1.0" encoding="utf-8"?> <genera...
...And 3 more matches
Dehydra Object Reference - Archive of obsolete content
lags when they are true. for example, a pointer type will have .ispointer == true, but a class type will not have an .ispointer property. common properties property type description .loc location object source location of a type or declaration. .attributes array of objects attributes of the type or declaration. each member of the array has the following properties: { name: string, value: string or number, if applicable } see an example on enforcing final classes. code can be annotated with arbitrary user attributes: __attribute__((user("customstring"))). variable objects dehydra presents ast nodes as variables. these types are used to represent variables, functions, assignments, etc. the following properties are usually available: property type description .name strin...
...ly available: property type description .name string the function or variable name. .type type object the type of this function or variable. .isstatic boolean flag .isreturn boolean flag the variable is being returned. .isdecl boolean flag the variable is being declared (local variables only). .assign array of variable objects this variable is the lhs of an assignment. the value is an array of values that were assigned. .isfcall boolean flag the variable is being used as a function call. .arguments array of variable objects arguments used to make a function call. .parameters array of variable objects a function definition's parameter names and types .memberof aggregate type object indicates the aggregate type(class/struct) in the type system that this variabl...
...he aggregate type(class/struct) in the type system that this variable is a member of. .fieldof variable object provides the object being dereferenced, in the ast system. applicable when accessing member variables or nonstatic member functions of aggregate types, e.g. the "foo" variable would be a .fieldof membervar/fn in foo->membervar or foo->memberfn(). note that when constructing the return value of a function (e.g. return t();), no container variable is available; in this case, .isreturn will be true (see function variable). variables can identified by their dehydradecl() prototype. function variable function objects are an extension of variable objects. the following additional properties are available on functions: property type description .isvirtual true or "pure" true for...
...And 3 more matches
generateCRMFRequest() - Archive of obsolete content
, the method takes some javascript code that is invoked when the crmf request is ready. finally, there are 1 or more sets of key generation arguments. each key generation will be associated with its own request. all the requests will have the same dn. argument description "requesteddn" an rfc 1485 formatted dn to include in the certificate request. ...
... ready. finally, there are 1 or more sets of key generation arguments. each key generation will be associated with its own request. all the requests will have the same dn. argument description "requesteddn" an rfc 1485 formatted dn to include in the certificate request. "regtoken" a value used to authenticate the user to the ra/ca. "authenticator" a value that the user can authenticate with in the future when their private key is not available. can be used for key recovery or revocation requests. "escrowauthoritycert" if this value is null, then no key escrow will be performed. this value specifies which kra certificate should be used to wrap the private key being escrowed. the user will be prompted for confirmation whenever a key will...
...r revocation requests. "escrowauthoritycert" if this value is null, then no key escrow will be performed. this value specifies which kra certificate should be used to wrap the private key being escrowed. the user will be prompted for confirmation whenever a key will be escrowed. only key exchange keys will be escrowed. if a dual use key is being generated, it will not be escrowed. the value of this argument is a base-64 encoded certificate. "crmf generation done code" this parameter is javascript to execute when the crmf generation is complete. keysizen the size in bits of the nth key to generate "keyparamsn" this string is an optional algorithm dependent parameter value. for diffie-hellman it is used to specify p and g parameters. for dsa, it wil...
...And 3 more matches
DOM Interfaces - Archive of obsolete content
nsidomdocumentxbl interface contains methods for manipulating xbl bindings. the interface is implemented by all dom documents. ...
... in domstring attrname, in domstring attrvalue); element getbindingparent(in node node); void loadbindingdocument(in domstring documenturl); }; methods getanonymousnodes the getanonymousnodes method retrieves the anonymous children of the specified element. parameters elt - the element to retrieve anonymous children for. return value nodelist - the return value of getanonymousnodes is a nodelist that represents the children of an element after insertion points from its own binding have been applied. this means that, depending on the details regarding the insertion points of the binding, it's possible that some non-anonymous nodes appear in the list. see "not so anonymous nodes" on mozilla.dev.platform for some discussio...
...have been applied. this means that, depending on the details regarding the insertion points of the binding, it's possible that some non-anonymous nodes appear in the list. see "not so anonymous nodes" on mozilla.dev.platform for some discussion about this. getanonymouselementbyattribute the getanonymouselementbyattribute methods retrieves an anonymous descendant with a specified attribute value. ...
...And 3 more matches
label - Archive of obsolete content
« xul reference home 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. ...
... « xul reference home 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. ...
... 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. ...
...And 3 more matches
Getting File Information - Archive of obsolete content
f a file in bytes. if the file does not exist, a 'file not found' exception will occur. you can catch this exception with a try-catch block, but it is better to use nsifile.exists() to check first. this example will check if a file on the desktop exists and set the variable 'filesize' to the size of the file. ...
...in this case, the new part of the file will be filled with empty data. ...
...ble will not be changed from the default value of 0. var filesize = 0; var file = io.getfile("desktop", "saved file"); if (file.exists()) filesize = file.filesize; 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. ...
...And 3 more matches
findbar - Archive of obsolete content
ommand, open, startfind, togglehighlight example <browser type="content-primary" flex="1" id="content" src="about:blank"/> <findbar id="findtoolbar" browserid="content"/> attributes browserid type: string the id of the browser element to which the findbar is attached. this attribute is only used when the findbar is constructed. you should use the browser property to get and set this value from a script. findnextaccesskey type: string the access key for the "find next" toolbar button in the findbar. findpreviousaccesskey type: string the access key for the "find previous" toolbar button in the findbar. highlightaccesskey type: string the access key for the "highlight" toolbar button in the findbar. matchcaseaccesskey type: string the access key for the...
..., height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width browser type: browser element lets you set and get the browser in which the findbar is located. findmode type: integer read only. the find mode in use. ...
... if you don't pass a mode, the last-used mode for the same findbar is used. if the findbar hasn't been used before, find_normal is the default. ...
...And 3 more matches
Introduction to XUL - Archive of obsolete content
application/javascript"> // dialog initialization code function initwindow() { var checkbox = document.getelementbyid("remember"); if (checkbox) checkbox.checked = true; } </html:script> javascript can be referenced as in html documents: as onclick handlers and the like. see individual widget documentation referenced at the index for a list of attributes accepting javascript values. javascript is most safely kept in a separate file and included in the xul file <html:script language="javascript" src="our.js"/> or relegated to the contents of a cdata section, to prevent the xml parser from choking on javascript which may look like xml content (a < character, for instance.) <html:script type="application/javascript"> <![cdata[ function lesser(a,b) { return a ...
... though the code is of course the most accurate place to look for this information. these interfaces can be found in the directory mozilla/rdf/content/public/idl. ...
.../idl. xuldocument xuldocument extends document in a fashion similar to htmldocument's extension interface xuldocument : document { element getelementbyid(in domstring id); nodelist getelementsbyattribute(in domstring name, in domstring value); }; getelementbyid works like html's getelementbyid. getelementsbyattribute returns a list of elements for which the named attribute has the given value. a value of "*" is a wildcard signifying all elements with the attribute. xulelement xulelement extends element. ...
...And 3 more matches
Panels - Archive of obsolete content
mple, the following panel displays a textbox for entering a name. note that the panel is not placed in a separate file and is instead placed inside another window. <?xml-stylesheet href="chrome://global/skin" type="text/css"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <button label="details" type="panel"> <panel id="search-panel"> <label control="name" value="name:"/> <textbox id="name"/> </panel> </button> </window> many panels will be associated with a button, as in this example. when the button is pressed, the panel is opened. clicking outside the panel or pressing escape will close the panel. you can also place a close button in the panel which will close the panel with a script if desired. when you want to associate a panel with a butto...
... example. when the button is pressed, the panel is opened. clicking outside the panel or pressing escape will close the panel. you can also place a close button in the panel which will close the panel with a script if desired. when you want to associate a panel with a button, place the <panel> element directly inside the button element. you also need to set the type attribute on the button to the value panel, or the button will look and behave like a regular button. the popup panel will, by default, appear with its topleft corner just underneath the bottom edge of the button, much as a menu does. the position can, however, be changed. for more information about positioning the popup, see positioning popups. only buttons (and toolbarbuttons) have this automatic behaviour which opens the popup ...
...opleft corner just underneath the bottom edge of the button, much as a menu does. the position can, however, be changed. for more information about positioning the popup, see positioning popups. only buttons (and toolbarbuttons) have this automatic behaviour which opens the popup when pressed. for other types of elements, you need to use a different technique as in the following example. <label value="search" popup="search-panel"/> <panel id="search-panel"> <label control="search" value="terms:"/> <textbox id="search"/> </panel> to attach a panel to an non-button element, for instance to have a panel open when a label is clicked, use the popup attribute. the popup attribute should be set to the id of a panel within the same document. when the left mouse button is pressed on the eleme...
...And 3 more matches
RDF Query Syntax - Archive of obsolete content
y one content tag can be used. the seed result will be created like this: (?start = http://www.xulplanet.com/rdf/a) the variable ?start is determined from the tag's 'uri' attribute. you can use any variable you want; it's common to use the variable ?uri. however, all rules must use the same starting point variable. so if a second rule were used, it would also need to use the ?start variable. the value of ?start is set to 'http://www.xulplanet.com/rdf/a'. you'll notice that this is the value of the ref attribute which is the desired starting node in the rdf graph. thus, the ?start variable becomes the container or reference variable. actually, in the current template implementation, the above description isn't quite correct. the seed is actually an internal variable set to the container, in thi...
...r follow the arrows in a forward or backward direction, but only one direction per statement. it determines which direction to use by examining which data is known and which data is not known yet. recall the data in the potential results set: (?start = http://www.xulplanet.com/rdf/a) this was the seed data created by the content statement. you might be able to guess that the builder fills in the value of the ?start variable as the triple's subject, giving something like this: <triple subject="http://www.xulplanet.com/rdf/a" predicate="http://www.xulplanet.com/rdf/relateditem" object="?relateditem"/> the builder doesn't actually change the triple, but this might clarify how the builder is working. the builder looks at both the subject and object of the triple and tries to resol...
...his: <triple subject="http://www.xulplanet.com/rdf/a" predicate="http://www.xulplanet.com/rdf/relateditem" object="?relateditem"/> the builder doesn't actually change the triple, but this might clarify how the builder is working. the builder looks at both the subject and object of the triple and tries to resolve any of the variables using the known data. the ?start variable has a value 'http://www.xulplanet.com/rdf/a', so that is filled in. the ?relateditem variable doesn't have any known value, so it will be left as is. once the variables are filled in, the builder can query the rdf graph. the query will look for all arrows that start at the node 'http://www.xulplanet.com/rdf/a' with the predicate (or arrow label) 'http://www.xulplanet.com/rdf/relateditem'. since ?relateditem ...
...And 3 more matches
Tree Widget Changes - Archive of obsolete content
lumns property. from there you can get specific columns, the current sort column, and position and size info about the columns. for the most part these objects are readonly; you can modify the columns by just adjusting the treecol attributes directly. the tree and view methods no longer take ids as arguments when columns are used. instead, they use nsitreecolumns. for example, nsitreeview.getcellvalue() takes a row index and a nsitreecolumn as arguments, whereas before it took a row index and a column id. to get a column in javascript: tree.columns.getcolumnfor(treecolelement); tree.columns.getnamedcolumn(treecolid); tree.columns.getcolumnat(index); you can also just use array syntax to get a column: tree.columns["lastname"]; tree.columns[5]; once you have a column, you can get various ...
...eeboxobject.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 the column object. ...
...treeview.progress_undetermined (2) nsitreeview.progressnode -> nsitreeview.progress_none (3) as well, the drag and drop methods candropon and candropbeforeafter have been replaced with a single method candrop(idx,orientation) which handles both. it should return true if a drop is allowed on a row. checkbox columns tree columns now implement the checkbox type. previously the value existed but was not implemented. now it is. you can create a checkbox column by setting the type attribute of a column to checkbox. <treecol type="checkbox"> you can then set or clear the checkbox for a particular cell in that column by setting the value attribute to true, or leaving out the attribute. note that it's the value attribute you use, not the label attribute. <treecell/> <treecell ...
...And 3 more matches
Element Positioning - Archive of obsolete content
as a number followed by a unit. flexible elements the sizes are fairly easy to calculate for non-flexible elements. they simply obey their specified widths and heights, and if the size wasn't specified, the element's default size is just large enough to fit the contents. for flexible elements, the calculation is slightly trickier. flexible elements are those that have a flex attribute set to a value greater than 0. recall that flexible elements grow and shrink to fit the available space. their default size is still calculated the same as for inflexible elements. the following example demonstrates this: example 2 : source view <window orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <hbox> <button label="yes" flex="1"/> <button label="n...
...larger than a certain size. or, you may want to set a minimum size. you can set this by using four attributes: minwidth; this specifies the minimum width that the element can be. minheight this specifies the minimum height that the element can be. maxwidth this specifies the maximum width that the element can be. maxheight this specifies the maximum height that the element can be. the values are always measured in pixels. you can also use the corresponding css properties, min-width, min-height, max-width and max-height. these properties are only useful for flexible elements. by setting a maximum height, for example, a stretchy button will only grow to a certain maximum height. you will still be able to resize the window beyond that point but the button will stop growing in size. th...
... box, but that gets messy when you have to do it numerous times. a better way is to use an additional attribute pack on the box. this attribute indicates how to pack the child elements inside the box. for horizontally oriented boxes, it controls the horizonal positioning of the children. for vertically oriented boxes, it controls the vertical positioning of the children. you can use the following values: start this positions elements at the left edge for horizontal boxes and at the top edge for vertical boxes. this is the default value. center this centers the child elements in the box. end this positions elements at the right edge for horizontal boxes and at the bottom edge for vertical boxes. the pack attribute is applied to the box containing the elements to be packed, not to the e...
...And 3 more matches
List Controls - Archive of obsolete content
the listbox element for the box itself, and the listitem element for each item. for example, this list box will have four rows, one for each item. example 1 : source view <listbox> <listitem label="butter pecan" /> <listitem label="chocolate chip" /> <listitem label="raspberry ripple" /> <listitem label="squash swirl" /> </listbox> like with the html option element, you can assign a value for each item using the value attribute. you can then use the value in a script. the list box will default to a suitable size, but you can control the size with the rows attribute. set it to the number of rows to display in the list box. a scroll bar will appear that the user can use to display the additional rows. the following example demonstrates these additional features: example 2 : source v...
...list boxes have some additional features, which will be described later. ...
... a suitable size, but you can control the size with the rows attribute. set it to the number of rows to display in the list box. a scroll bar will appear that the user can use to display the additional rows. the following example demonstrates these additional features: example 2 : source view <listbox rows="3"> <listitem label="butter pecan" value="bpecan" /> <listitem label="chocolate chip" value="chocchip" /> <listitem label="raspberry ripple" value="raspripple" /> <listitem label="squash swirl" value="squash" /> </listbox> the example has been changed to display only 3 rows at a time. values have also been added to each item in the list. list boxes have some additional features, which will be described later. multi-column list boxes the listbox also supports multiple columns. eac...
...And 3 more matches
Modifying a XUL Interface - Archive of obsolete content
nction named "addbutton()" this script first gets a reference to the box with getelementbyid(), which is the container to add a new button to. the function getelementbyid() does not know that the box it is looking for happens to be containing the tag that has the oncommand attribute that referenced it. getelementbyid() only knows the box it is looking to find has an id with the value "abox". this is a subtle dependency between the function and the xul element to which you should pay attention. addbutton() the calls the createelement() function to create a new button. note this button is not visible, nor is it attached to anything yet. addbutton() then assigns the label 'a new button' to the button using the setattribute() function. finally the ap...
...should use instead when you can. these are described in the next section. manipulating basic elements the main xul elements such as buttons, checkboxes and radio buttons may be manipulated using a number of script properties. the properties available are listed in the element reference as those available are different for each element. common properties that you will manipulate include the label, value, checked and disabled properties. they set or clear the corresponding attribute as necessary. label and value properties examples here is a simple example which changes the label on a button: example 3 : source view <button label="hello" oncommand="this.label = 'goodbye';"/> when the button is pressed, the label is changed. this technique will work for a variety of different elements that have l...
...rresponding attribute as necessary. label and value properties examples here is a simple example which changes the label on a button: example 3 : source view <button label="hello" oncommand="this.label = 'goodbye';"/> when the button is pressed, the label is changed. this technique will work for a variety of different elements that have labels. for a textbox, you can do something similar for the value property. example 4 : source view <button label="add" oncommand="this.nextsibling.value += '1';"/> <textbox/> this example adds a '1' to the textbox each time the button is pressed. the nextsibling property navigates from the button (this) to the next element, the textbox. the += operator is used to add to the current value so a 1 will be added onto the end of the existing text. note that you ca...
...And 3 more matches
splitter - Archive of obsolete content
ebefore, state, substate style classes tree-splitter examples <!-- this bar has some styling associated with it. the vbox is used to hold the .png image that a user clicks on to resize the search bar.--> <splitter tooltiptext="resize the search box" oncommand="alert('the splitter was dragged')"> <vbox id="example_vbox" /> </splitter> attributes collapse type: one of the values below determines which side of the splitter is collapsed when its grippy is clicked. if this attribute is not specified, the splitter will not cause a collapse. you should put a grippy element inside the splitter when it is used for collapsing. none no collapsing occurs. before when the grippy is clicked, the element immediately before the splitter in the same parent is collapsed so...
...en the grippy is clicked, the element immediately after the splitter in the same parent is collapsed so that its width or height is 0. both either the element immediately before the splitter, or the element immediately after the splitter can be collapsed, if the size of that element would fall below the minimum size due to the position of the splitter. resizeafter type: one of the values below this attribute indicates which element to the right or below the splitter should be resized when the splitter is repositioned. closest the element immediately to the right or below the splitter resizes. farthest the element that is the farthest away from the splitter to the right or below the splitter resizes. grow the elements to the right or below the splitter do not cha...
...litter resizes. farthest the element that is the farthest away from the splitter to the right or below the splitter resizes. grow the elements to the right or below the splitter do not change size (unless they are flexible) when the splitter is dragged, but instead the entire container changes size. flex the closest flexible element resizes. resizebefore type: one of the values below this attribute indicates which element to the left or above the splitter should be resized when the splitter is repositioned. closest the element immediately to the left or above the splitter resizes. farthest the element that is the farthest away from the splitter to the left or above the splitter resizes. flex the closest flexible element resizes. state type:...
...And 3 more matches
treecell - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] a single cell in a tree. this element should be placed inside a treerow. you can set the text for the cell using the label attribute. more information is available in the xul tutorial. attributes editable, label, mode, properties, ref, src, value attributes editable type: boolean allows the contents of individual cells in the column to be changed, especially useful when <treecol type="checkbox">. also useful for disabling editing of individual treecells. when the user double-clicks an editable cell, a text field appears in which the user can edit the contents of the cell. the tree and treecol must also be marked as editable in order for this to work. the tree must be a conten...
... double-clicks an editable cell, a text field appears in which the user can edit the contents of the cell. the tree and treecol must also be marked as editable in order for this to work. the tree must be a content tree for this to work on treecells. label type: string the label that will appear on the element. if this is left out, no text appears. ...
...ars in which the user can edit the contents of the cell. the tree and treecol must also be marked as editable in order for this to work. the tree must be a content tree for this to work on treecells. 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. mode type: one of the values below for columns that are progress meters, this determines the type of progress meter to use. none no progress meter is displayed. the cell text is displayed instead. normal the cell uses its value attribute to determine the amount of the bar that is filled in. undetermined the progressmeter is ...
...And 3 more matches
window - Archive of obsolete content
ul document. it is by default a horizontally oriented box. as it is a box, all box attributes can be used. by default, the window will have a platform-specific frame around it. to set an icon for the window, create a platform-specific icon file <windowid>.ico and/or <windowid>.xpm and place or install these files into the <mozilla-directory>/chrome/icons/default/ directory. the <windowid> is the value of the id attribute on the window. this allows you to have a different icon for each window. without including the css file at "chrome://global/skin/", the window will not be stylized and will be invisible and glitchy when opened as a dialog. note: starting in gecko 1.9.2, you can detect when a window is activated or deactivated by watching for the "activate" and "deactivate" events. see windo...
..."rootwnd" title="register online!" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <vbox> <hbox> <image src="application_form.png"/> <description>register online!</description> </hbox> <groupbox align="start"> <caption label="your information"/> <radiogroup> <vbox> <hbox> <label control="your-fname" value="enter first name:"/> <textbox id="your-fname" value="johan"/> </hbox> <hbox> <label control="your-lname" value="enter last name:"/> <textbox id="your-lname" value="hernandez"/> </hbox> <hbox> <button oncommand="alert('save!')"> <description>save</description> </button> </hb...
...nd). moreover this hides separator between titlebar and window contents. this only affects mac os x. chromemargin type: margin string controls the amount of chrome that should be visible on each side of the window. the specified string should contain four numbers, separated by commas, indicating the margin in pixels for the top, right, bottom, and left edges of the window, respectively. this value may be -1 to use the default margin for that side on the current platform, 0 to have no system border (that is, to extend the client area to the edge of the window), or a value greater than zero to indicate how much less than the default default width you wish the margin on that side to be. if this value turns out to be less than 0, 0 is used. disablechrome type: boolean set this attribute t...
...And 3 more matches
wizard - Archive of obsolete content
a1, extra2, getbutton, getpagebyid, goto, rewind examples <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <wizard id="thewizard" title="secret code wizard" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> function checkcode(){ document.getelementbyid('thewizard').canadvance = (document.getelementbyid('secretcode').value == "cabbage"); } </script> <wizardpage onpageshow="checkcode();"> <label value="enter the secret code:"/> <textbox id="secretcode" onkeyup="checkcode();"/> </wizardpage> <wizardpage> <label value="that is the correct secret code."/> </wizardpage> </wizard> attributes activetitlebarcolor type: color string specify background color of the window's titlebar when ...
... the current page. title type: string the text to appear in the title bar of the window. windowtype type: string set to a string which can be used to identify the type of window. this might be used, for example, to distinguish between a browser window and an editor window. some of mozilla's window handling functions use this attribute to group windows of the same type together. ...
...f this property is false, the user cannot navigate to the previous page. set this property to true to indicate that the user can go back a page. set to false to disallow moving to the previous page. this has the effect of enabling or disabling the back button. currentpage type: wizardpage element this property returns the wizardpage element that is currently displayed. you can modify this value to change the current page. onfirstpage type: boolean this property is set to true if the user is on the first page, which may or may not be the first index. onlastpage type: boolean this property is set to true if the user is on the last page of the wizard. pagecount type: integer this property holds the number of pages in the wizard. pageindex type: integer this ...
...And 3 more matches
NPVariant - Archive of obsolete content
« gecko plugin api reference « scripting plugins summary npvariant is a struct that holds a value and the type of that value. the value is held in a union, and the type is one of types defined in the npvarianttype enumeration. syntax typedef struct _npvariant { npvarianttype type; union { bool boolvalue; int32_t intvalue; double_t doublevalue; npstring stringvalue; npobject *objectvalue; } value; } npvariant; fields the data structure has the following fields: type a member of the npvarianttype enumeration specifying the data type contained in the npvariant. value the value contained in the npvariant structure. it may be a boolean, integer, double, string, or object, depending on the variant type. javascript type to npvarianttype enumera...
...ber of the npvarianttype enumeration specifying the data type contained in the npvariant. value the value contained in the npvariant structure. it may be a boolean, integer, double, string, or object, depending on the variant type. ...
...ipt type npvarianttype undefined npvarianttype_void null npvarianttype_null boolean npvarianttype_bool number npvarianttype_int32 or npvarianttype_double string npvarianttype_string all other types npvarianttype_object functions npn_releasevariantvalue() npn_getstringidentifier() npn_getstringidentifiers() npn_getintidentifier() npn_identifierisstring() npn_utf8fromidentifier() npn_intfromidentifier() macros plugin developers are not expected to directly manipulate or access the members of the npvariant instance, instead, the function npn_releasevariantvalue(), and the following macros are provided: npvariant_is_void() evalu...
...And 3 more matches
The First Install Problem - Archive of obsolete content
rivileges. thus, some installers may need to write to the hkey_current_user key; this doesn't require administrator privileges. traditionally, hkey_current_user is a copy of everything in hkey_local_machine. at present plugins registered using the hkey_current_user\software\mozillaplugins\ tree are ignored by firefox (bug 293062) but this is fixed in trunk builds (bug 293062). add the following values to the newly created key -- some are string values (reg_sz), and some are actually subkeys. string values take the form stringvalue=valuedata, and subkeys contain their own string values and value data. "path" -- string value -- this would be the absolute path to the plugin module. this is the path to the actual dll. (note that the file name must still begin with "np", just as it must...
...e the absolute path to the plugin module. this is the path to the actual dll. (note that the file name must still begin with "np", just as it must when the file is loaded from the .\plugins directory.) example: [hkey_local_machine\software\mozillaplugins\@mycompany.com/myapplication,version=5.01] path=c:\mycompany\myapplication\netscape\npmyapp.dll "xptpath" -- string value -- absolute path to xpt module required for scripting plug-in, if applicable example: [hkey_local_machine\software\mozillaplugins\@mycompany.com/myapplication,version=5.01] xptpath=c:\mycompany\myapplication\netscape\npmyapp.xpt "geckoversion" -- this is the optional mention of the minimal gecko version that the browser is compatible with. example: [hk...
... is compatible with. example: [hkey_local_machine\software\mozillaplugins\@mycompany.com/myapplication,version=5.01] geckoversion=0.9.4.2 suggesting compliance with compuserve's deployment of a build of gecko known as 0.9.4.2. note that this means that at a minimum, the plugin vendor is ensuring compatibility with 0.9.4.2 browsers. "productname" -- this is the string value name of the actual product. example: [hkey_local_machine\software\mozillaplugins\@mycompany.com/myapplication,version=5.01] productname=myapplication player 5 "version" -- this is the versioning scheme of the above product. example: [hkey_local_machine\software\mozillaplugins\@mycompany.com/myapplication,version=5.01] version=5.01 mimetype...
...And 3 more matches
XEmbed Extension for Mozilla Plugins - Archive of obsolete content
hosted as well as the apis. key differences all of the interfaces that you would normally expect to exist in the plugins will still exist when using xembed plugins. there are only two key differences: in the npp_setwindow call, the window parameter will be the xid of the hosting xembed window. as an implementation note, this is really the xid of a gtksocket window. in your plugin instance npp_getvalue call you need to make sure that you support the new nppvpluginneedsxembed value. more information is included on this below. hosting using gtk2.x included below are a couple of code snippits that should help you get started as well as some hints on building a successful plugin. please use the following diagram as a reference: as you can see from the diagram above, it's pretty easy to set up a p...
...npnetscapefuncs* nstable, nppluginfuncs* pluginfuncs) { nperror err = nperr_no_error; prbool supportsxembed = pr_false; npntoolkittype toolkit = 0; [ code that copies all of the function tables and does ] [ other standard checks ] /* * make sure that the browser supports functionality we care * about. ...
...pluginfuncs* pluginfuncs) { nperror err = nperr_no_error; prbool supportsxembed = pr_false; npntoolkittype toolkit = 0; [ code that copies all of the function tables and does ] [ other standard checks ] /* * make sure that the browser supports functionality we care * about. ...
...And 3 more matches
-ms-filter - Archive of obsolete content
refer to the filters and transitions reference for details. examples the following example shows how to use the -ms-filter attribute in internet explorer 8. code example: http://samples.msdn.microsoft.com/workshop/samples/autho...
...refer to the filters and transitions reference for details. examples the following example shows how to use the -ms-filter attribute in internet explorer 8. code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/filter_8.htm -ms-filter: 'progid:dximagetransform.microsoft.motionbl...
...lor> <startcolorstr> = 'startcolorstr=' <color> enabled default: true set to false to disable. endcolor the end color, supports only opaque colors in the #rrggbb notation. endcolorstr the end color, supports both opaque colors (#rrggbb) and colors with alpha opacity using the #aarrggbb notation. gradienttype default: 0 (equivalent to linear-gradient(to bottom, …)) set to a non-zero value to make the gradient horizontal (equivalent to linear-gradient(to right, …)) startcolor the end color, supports only opaque colors in the #rrggbb notation. startcolorstr the end color, supports both opaque colors (#rrggbb) and colors with alpha opacity using the #aarrggbb notation. html <div class="gradient horizontal"></div> <div class="gradient vertical"></div> css html, body { o...
...And 3 more matches
-ms-scroll-limit-x-min - Archive of obsolete content
formal syntax <length> specifications not part of any specification. remarks this property has no effect on non-scrollable elements. ...
... formal syntax <length> specifications not part of any specification. remarks this property has no effect on non-scrollable elements. ...
... formal syntax <length> specifications not part of any specification. remarks this property has no effect on non-scrollable elements. ...
...And 3 more matches
-ms-scroll-limit-y-min - Archive of obsolete content
formal syntax <length> specifications not part of any specification. remarks this property has no effect on non-scrollable elements. ...
... formal syntax <length> specifications not part of any specification. remarks this property has no effect on non-scrollable elements. ...
... formal syntax <length> specifications not part of any specification. remarks this property has no effect on non-scrollable elements. ...
...And 3 more matches
XForms Range Element - Archive of obsolete content
introduction allows the user to choose a value from within a specific range of values (see the spec). attributes ui common appearance - isn't supported. accesskey - used to specify the keyboard shortcut for focusing this control. single-node binding special incremental - supported, default value is false start - lower bound of possible values end - upper bound of possible values step - is used for incrementing/decrementing values start/end/step attributes if the value of the bound instance node is outside the range of values specified by the start and end attributes, then the range element receives a xforms-out-of-range event. if the bound value then becomes in range, the range element receives a xforms-in-range event. ...
...ues step - is used for incrementing/decrementing values start/end/step attributes if the value of the bound instance node is outside the range of values specified by the start and end attributes, then the range element receives a xforms-out-of-range event. if the bound value then becomes in range, the range element receives a xforms-in-range event. start specifies the lower bound of possible values, i.e. values can't be less than the value of this attribute. if this attribute is omitted, then it is assumed to be 0. end specifies the upper bound of possible values, i.e. values can't be greater than the value of this attribute. if this attribute is omitted, then it is assumed to be the value of start + 20. step specifies the step of incrementing/decrementing values. this determines how much ...
... type restrictions the range element can be bound to a node of type xsd:duration, xsd:date, xsd:time, xsd:datetime, xsd:gyearmonth, xsd:gyear, xsd:gmonthday, xsd:gday, xsd:gmonth, xsd:float, xsd:decimal or xsd:double or any type derived from one of these. ...
...And 3 more matches
Obsolete: XPCOM-based scripting for NPAPI plugins - Archive of obsolete content
low to make existing 4.x plugins scriptable with only minor modifications in their code. the present document describes the steps of what should be done to the plugin code to turn it scriptable again. what's in the mozilla code? a couple of lines have been added to the dom code asking a plugin to return a scriptable iid and a pointer to a scriptable instance object. the old plugin api call npp_getvalue is used to retrieve this information from the plugin. so the plugin project should be aware of two new additions to nppvariable enumeration type which are now defined in npapi.h as: nppvpluginscriptableinstance = 10, nppvpluginscriptableiid = 11 and two analogous additions to nsplugininstancevariable type in nsplugindefs.h as: nsplugininstancevariable_scriptableinstance = 10, nsplugininstan...
...e instance object should be implemented in the plugin. this class will contain native methods callable from javascript. this class should also inherit from nsiclassinfo and implement its methods to be able to request all necessary privileges from the mozilla security manager (see example 2). two new cases for the above mentioned new variables should be added to the plugin implementation of npp_getvalue (see example 3). how to call plugin native methods the following html code will do the job:</p> this should be changed, we shouldn't advocate embed <embed type="application/plugin-mimetype"> <script language="javascript"> var embed = document.embeds[0]; embed.nativemethod(); </script> how to build and install having the built mozilla tree is probably not necessary, but building the plugin with ...
...itestplugin }; nsscriptablepeer::nsscriptablepeer() { ns_init_isupports(); } nsscriptablepeer::~nsscriptablepeer() { } // notice that we expose our claim to implement nsiclassinfo. ns_impl_isupports2(nsscriptablepeer, nsitestplugin, nsiclassinfo) // the following method will be callable from javascript ns_imethodimp nsscriptablepeer::nativemethod() { return ns_ok; } example 3. ...
...And 3 more matches
XUL Parser in Python - Archive of obsolete content
ogether this little python script that parses your local xul and builds a list of all the xul elements and their attributes in an html page. with new widgets and attributes landing all the time, i wanted to get some quicker way of looking at the xul--at particular builds, at particular widgets, at which elements had which attributes, etc. the script writes out all the attributes and none of the values, but the parser itself is seeing the elements, their attributes, and the values of those attributes, and you just have to ask for them if you want them. for example, you could easily adapt this to: return the id values of all the elements take elements on the command line and only spell them out build new chrome subdirectories (i.e. new "packages") on the fly using search and replace. as ...
... open them. how the script works as i said before, there isn't too much to explain in this script, particularly if you have used python's xmllib parser before. at the middle of it is a subclass of the xmllib parser that overrides that parser's unknown_starttag method and asks it to do all the work. the unknown_starttag handler is fed the tag name, the attributes of that tag, and the attributes' values, so all you have to do as you hit each xul element is build up a nested dictionary of elements and their associated attributes. after all the xul files in the specified directory and its subdirectories are fed to the parser and parsed (using the win32 system's <tt>dir /s /b *.xul</tt> command), the dictionary of dictionaries is sorted and written into an html table. the xml namespace support in...
... the xml namespace support in xmllib was resolving the xul and html namespaces in a very annoying way, so i have an additional function, strip(), that takes off the whole namespace that xmllib is trying to tack onto the front of each item it finds in the xml. some modifications to this script may suggest other uses. ...
...And 3 more matches
Building up a basic demo with PlayCanvas editor - Game development
d entity' — that's exactly what we want to do. an entity is any object used in the scene — it cna be an object like a box, cylinder or cone, but it can also be a camera, light or sound source. after clicking the button you'll see a dropdown list containing a lot of various entities to choose from. go ahead and click box — it will be added to the scene. the box is created with the default values — width, height and depth are set to 1, and it is placed in the middle of the scene. you can drag it around or apply new values in the right panel. to add some colors to the scene we need a new material that will be used on the newly created box. click on the plus button in the assets tab, and click on the material option in the dropdown list that appears to create a new material. click ...
...it a unique name (we've chosen boxmaterial). a unique name will help us remember what this material is for — we will add more later! to change its color we'll use the diffuse option in the entity inspector. click diffuse, then select the colored box next to the color label — it will open a color wheel. from here you can click your desired color or enter it in the bottom text field as a hex value. we've chosen a blue color with a hex value of 0095dd — enter this code in the text field and press return for it to be accepted. note: yes, you read that right — you need to enter the hex value without the hash/pound symbol. now we can apply the colored material to the shape by clicking and dragging its icon from the bottom part of the screen (the little dot on the left hand side of th...
...clicking and dragging its icon from the bottom part of the screen (the little dot on the left hand side of the material's name — it can be a bit fiddly to select; just persevere) onto the box on the scene. so, at this point we've created a blue box. click on the box to bring up its entity sidebar — you'll see options for changing its position, rotation, and scale. try applying the rotation values x: 10 and y: 20. now click on the play arrow in the top right corner of the scene to launch and render the scene — it will be opened in a separate browser tab. this looks great! let's add more shapes to the scene to make it look more interesting. adding more shapes to make way for more shapes, move the box to the left to make some room for the next shape. you can do this by giving it...
...And 3 more matches
Advanced styling effects - Learn web development
nder has reached a critical level.</p> </article> now the css: p { margin: 0; } article { max-width: 500px; padding: 10px; background-color: red; background-image: linear-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 appl...
... 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 shadows you can also specify multiple box shadows in a single box-shadow declaration, by separating them with commas: <article class="multiple"> <p><strong>warning</strong>: the thermostat on the cosmic transcender has reached a critical level.</p> </...
... shadow set on it 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...
...And 3 more matches
Overflowing content - Learn web development
nage it. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to understand overflow and how to manage it. what is overflow? everything in css is a box. you can constrain the size of these boxes by assigning values of width and height (or inline-size and block-size). overflow happens when there is too much content to fit in a box. css provides various tools to manage overflow. as you go further with css layout and writing css, you will encounter more overflow situations. css tries to avoid "data loss" let's consider two examples that demonstrate the default behavior of css when there is overflow. the fi...
...eased their font size) the next two lessons explain different approaches to control sizing in ways that are less prone to overflow. however, if you need a fixed size, you can also control how the overflow behaves. let's read on! the overflow property the overflow property is how you take control of an element's overflow. it is the way you instruct the browser how it should behave. the default value of overflow is visible. with this default, we can see content when it overflows. to crop content when it overflows, you can set overflow: hidden. this does exactly what it says: it hides overflow. beware that this can make some content invisible. you should only do this if hiding content won't cause problems. instead, perhaps you would like to add scrollbars when content overflows? using over...
...ng the word-break or overflow-wrap properties. in addition, some of the methods discussed in sizing items in css may help you create boxes that scale better with varying amounts of content. as with scroll, you get a scrollbar in the scrolling dimension whether or not there is enough content to cause a scrollbar. note: you can specify x and y scrolling using the overflow property, passing two values. if two keywords are specified, the first applies to overflow-x and the second applies to overflow-y. otherwise, both overflow-x and overflow-y are set to the same value. for example, overflow: scroll hidden would set overflow-x to scroll and overflow-y to hidden. if you only want scrollbars to appear when there is more content than can fit in the box, use overflow: auto. this allows the brows...
...And 3 more matches
Legacy layout methods - Learn web development
your css: .col { float: left; margin-left: 20px; width: 60px; background: rgb(255, 150, 150); } the top row of single columns will now lay out neatly as a grid. note: we've also given each column a light red color so you can see exactly how much space each one takes up. layout containers that we want to span more than one column need to be given special classes to adjust their width values to the required number of columns (plus gutters in between). we need to create an additional class to allow containers to span 2 to 12 columns. each width is the result of adding up the column width of that number of columns plus the gutter widths, which will always number one less than the number of columns. add the following at the bottom of your css: /* two column widths (120px) plus one gu...
... should see the column widths adjust nicely to suit. note: if you are having trouble getting the above example to work, try comparing it against our finished version on github (see it running live also). easier calculations using the calc() function you could use the calc() function to do the math right inside your css — this allows you to insert simple mathematical equations into your css values, to calculate what a value should be. it is especially useful when there is complex math to be done, and you can even compute a calculation that uses different units, for example "i want this element's height to always be 100% of its parent's height, minus 50px". see this example from a mediarecorder api tutorial. anyway, back to our grids! any column that spans more than one column of our grid...
...nus 50px". see this example from a mediarecorder api tutorial. anyway, back to our grids! any column that spans more than one column of our grid has a total width of 6.25% multiplied by the number of columns spanned plus 2.08333333% multiplied by the number of gutters (which will always be the number of columns minus 1). ...
...And 3 more matches
Advanced form styling - Learn web development
re consistent in behavior; interestingly enough, both chromium-based browsers (chrome, opera, edge), safari, and firefox all support the -webkit- prefixed version (-webkit-appearance). firefox settled on this because web developers mostly seemed to be using the -webkit- prefixed version, so it was better for compatibility. if you look at the reference page you'll see a lot of different possible values listed for -webkit-appearance, however by far the most helpful value, and probably the only one you'll use, is none. this stops any control you apply it to from using system-level styling, as much as possible, and lets you build up the styles yourself using css. for example, let's take the following controls: <form> <p> <label for="search">search: </label> <input id="search" name="se...
... input { -webkit-appearance: none; appearance: none; } note: it is a good idea to always include both declarations — prefixed and unprefixed — when using a prefixed property. prefixed usually means "work in progress", so in the future browser vendors may ...
... input { -webkit-appearance: none; appearance: none; } note: it is a good idea to always include both declarations — prefixed and unprefixed — when using a prefixed property. prefixed usually means "work in progress", so in the future browser vendors may come to a consensus to drop the prefix. the ab...
...And 3 more matches
Example 1 - Learn web development
this is the first example of code that explains how to build a custom form widget. ...
... -moz-box-sizing : border-box; box-sizing : border-box; padding : 0.1em 2.5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #f0f0f0; background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "▼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : ce...
...em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { padding: .2em .3em; } .select .highlight { background: #000; color: #ffffff; } result for basic state active state html <div class="select active"> <span class="value">cherry</span> <ul class="optlist hidden"> <li class="option">cherry</li> <li class="option">lemon</li> <li class="option">banana</li> <li class="option">strawberry</li> <li class="option">apple</li> </ul> </div> css /* --------------- */ /* required styles */ /* --------------- */ .select { position: relative; display : inline-block; } .select.active, .select:focu...
...And 3 more matches
Sending forms through JavaScript - Learn web development
ml". how is it different? the xmlhttprequest (xhr) dom object can build http requests, send them, and retrieve their results. historically, xmlhttprequest was designed to fetch and send xml as an exchange format, which has since been superceded by json. but neither xml nor json fit into form data request encoding. form data (application/x-www-form-urlencoded) is made of url-encoded lists of key/value pairs. for transmitting binary data, the http request is reshaped into multipart/form-data. note: the fetch api is often used in place of xhr these days — it is a modern, updated version of xhr, which works in a similar fashion but has some advantages. most of the xhr code you'll see in this article could be swapped out for fetch. if you control the front-end (the code that's executed in th...
...obey the specifics of form data requests. let's look at an example: <button>click me!</button> and now the javascript: const btn = document.queryselector('button'); function senddata( data ) { console.log( 'sending data' ); const xhr = new xmlhttprequest(); let urlencodeddata = "", urlencodeddatapairs = [], name; // turn the data object into an array of url-encoded key/value pairs. for( name in data ) { urlencodeddatapairs.push( encodeuricomponent( name ) + '=' + encodeuricomponent( data[name] ) ); } // combine the pairs into a single string and replace all %-encoded spaces to // the '+' character; matches the behaviour of browser form submissions. urlencodeddata = urlencodeddatapairs.join( '&' ).replace( /%20/g, '+' ); // define what happens on suc...
...addeventlistener( 'click', function() { senddata( {test:'ok'} ); } ) here's the live result: using formdata bound to a form element you can also bind a formdata object to an <form> element. this creates a formdata object that represents the data contained in the form. ...
...And 3 more matches
Introduction to events - Learn web development
255) + ')'; document.body.style.backgroundcolor = rndcol; } btn.onclick = bgchange; there are many different event handler properties available. let's experiment. first, make a local copy of random-color-eventhandlerproperty.html, and open it in your browser. it's just a copy of the simple random color example we've played with already. now try changing btn.onclick to the following different values in turn, and observing the results in the example: btn.onfocus and btn.onblur — the color changes when the button is focused and unfocused; try pressing the tab to focus on the button and press the tab again to focus away from the button. these are often used to display information about filling in form fields when they are focused, or displaying an error message if a form field is filled w...
...serving the results in the example: btn.onfocus and btn.onblur — the color changes when the button is focused and unfocused; try pressing the tab to focus on the button and press the tab again to focus away from the button. these are often used to display information about filling in form fields when they are focused, or displaying an error message if a form field is filled with an incorrect value. btn.ondblclick — the color changes only when the button is double-clicked. window.onkeypress, window.onkeydown, window.onkeyup — the color changes when a key is pressed on the keyboard. the keypress event refers to a general press (button down and then up), while keydown and keyup refer to just the key down and key up parts of the keystroke, respectively. note: it doesn't work if you try t...
...dcol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; document.body.style.backgroundcolor = rndcol; } note: you can find the full source code for this example on github (also see it running live). the earliest method of registering event handlers found on the web involved event handler html attributes (or inline event handlers) like the one shown above — the attribute value is literally the javascript code you want to run when the event occurs. the above example invokes a function defined inside a <script> element on the same page, but you could also insert javascript directly inside the attribute, for example: <button onclick="alert('hello, this is my old-fashioned event handler!');">press me</button> you can find html attribute equivalents for many of the event ...
...And 3 more matches
Fetching data from the server - Learn web development
rse4.txt — in a new directory on your computer. in this example, we will load a different verse of the poem (which you may well recognize) via xhr when it's selected in the drop-down menu. just inside the <script> element, add the following code. this stores a reference to the <select> and <pre> elements in constants and defines an onchange event handler function so that when the select's value is changed, its value is passed to an invoked function updatedisplay() as a parameter. const versechoose = document.queryselector('select'); const poemdisplay = document.queryselector('pre'); versechoose.onchange = function() { const verse = versechoose.value; updatedisplay(verse); }; let's define our updatedisplay() function. first of all, put the following beneath your previous co...
...se); }; let's define our updatedisplay() function. first of all, put the following beneath your previous code block — this is the empty shell of the function. note: steps 4 - 9 will all be performed within this function. function updatedisplay(verse) { } we'll start our function by constructing a relative url pointing to the text file we want to load, as we'll need it later. the value of the <select> element at any time is the same as the text inside the selected <option> (unless you specify a different value in a value attribute) — so for example "verse 1". the corresponding verse text file is "verse1.txt", and is in the same directory as the html file, therefore just the file name will do. however, web servers tend to be case sensitive, and the file name doesn't have a ...
...dle this using its onload event handler — this is run when the load event fires (when the response has returned). when this has occurred, the response data will be available in the response property of the xhr request object. add the following below your last addition. you'll see that inside the onload event handler we are setting the textcontent of the poemdisplay (the <pre> element) to the value of the request.response property. request.onload = function() { poemdisplay.textcontent = request.response; }; the above is all set up for the xhr request — it won't actually run until we tell it to, which is done using the send() method. add the following below your previous addition to complete the function. this line should rest just above the closing curly brace of your updatedis...
...And 3 more matches
Manipulating documents - Learn web development
yselector('a'); now we have the element reference stored in a variable, we can start to manipulate it using properties and methods available to it (these are defined on interfaces like htmlanchorelement in the case of <a> element, its more general parent interface htmlelement, and node — which represents all nodes in a dom). first of all, let's change the text inside the link by updating the value of the node.textcontent property. add the following line below the previous one: link.textcontent = 'mozilla developer network'; we should also change the url the link is pointing to, so that it doesn't go to the wrong place when it is clicked on. add the following line, again at the bottom: link.href = 'https://developer.mozilla.org'; note that, as with many things in javascript, the...
...ou wanted to match and do things to multiple elements, you could use document.queryselectorall(), which matches every element in the document that matches the selector, and stores references to them in an array-like object called a nodelist. there are older methods available for grabbing element references, such as: document.getelementbyid(), which selects an element with a given id attribute value, e.g. <p id="myid">my paragraph</p>. the id is passed to the function as a parameter, i.e. const elementref = document.getelementbyid('myid'). document.getelementsbytagname(), which returns an array-like object containing all the elements on the page of a given type, for example <p>s, <a>s, etc. the element type is passed to the function as a parameter, i.e. const elementrefarray = document.gete...
... five lines you added to the javascript. add the following inside your html <head>: <style> .highlight { color: white; background-color: black; padding: 10px; width: 250px; text-align: center; } </style> now we'll turn to a very useful method for general html manipulation — element.setattribute() — this takes two arguments, the attribute you want to set on the element, and the value you want to set it to. in this case we will set a class name of highlight on our paragraph: para.setattribute('class', 'highlight'); refresh your page, and you'll see no change — the css is still applied to the paragraph, but this time by giving it a class that is selected by our css rule, not as inline css styles. which method you choose is up to you; both have their advantages and disa...
...And 3 more matches
Solve common problems in your JavaScript code - Learn web development
a number of things that can go wrong with functions. one of the most common errors is to declare the function, but not call it anywhere. for example: function myfunction() { alert('this is my function.'); }; this code won't do anything unless you call it with the following statement: myfunction(); function scope remember that functions have their own scope — you can't access a variable value set inside a function from outside the function, unless you declared the variable globally (i.e. not inside any functions), or return the value from the function. running code after a return statement remember also that when you return from a function, the javascript interpreter exits the function — no code after the return statement will run. in fact, some browsers (like firefox) will give ...
... after a return statement. firefox gives you "unreachable code after return statement". object notation versus normal assignment when you assign something normally in javascript, you use a single equals sign, e.g.: const mynumber = 0; with objects, however, you need to take care to use the correct syntax. the object must be surrounded by curly braces, member names must be separated from their values using colons, and members must be separated by commas. for example: const myobject = { name: 'chris', age: 38 } basic definitions what is javascript? what is a variable? what are strings? what is an array? what is a loop? what is a function? what is an event? what is an object? what is json? what is a web api? what is the dom? basic use cases general how do yo...
... what is a variable? what are strings? what is an array? what is a loop? what is a function? what is an event? what is an object? what is json? what is a web api? what is the dom? basic use cases general how do you add javascript to your page? how do you add comments to javascript code? variables how do you declare a variable? how do you initialize a variable with a value? how do you update a variable's value? (also see assignment operators) what data types can values have in javascript? what does 'loosely typed' mean? math what types of number do you have to deal with in web development? how do you do basic math in javascript? what is operator precedence, and how is it handled in javascript? how do you increment and decrement values in javascript? how...
...And 3 more matches
Handling common HTML and CSS problems - Learn web development
e properly closed and nested, you are using a doctype, and you are using tags for their correct purpose. a good strategy is to validate your code regularly. one service that can do this is the w3c markup validation service, which allows you to point to your code, and returns a list of errors: css has a similar story — you need to check that your property names are spelled correctly, property values are spelled correctly and are valid for the properties they are used on, you are not missing any curly braces, and so on. the w3c has a css validator available too, for this purpose. linters another good option to choose is a so-called linter application, which not only points out errors, but can also flag up warnings about bad practices in your css, and other points besides. linters can gener...
... install the linter-csslint plugin for linting css, and the linter-tidy plugin for linting html. after the packages have finished installing, try loading up an html file and a css file: you'll see any issues highlighted with green (for warnings) and red (for errors) circles next to the line numbers, and a separate panel at the bottom provides line numbers, error messages, and sometimes suggested values or other fixes. other popular editors have similar linting packages available. for example, see: sublimelinter for sublime text notepad++ linter vscode linters browser developer tools the developer tools built into most browsers also feature useful tools for hunting down errors, mainly for css. note: html errors don't tend to show up so easily in dev tools, as the browser will try ...
...u will be using, it is a good idea to research what browsers they are supported in, and what related techniques are useful. see finding help below. html fallback behaviour some problems can be solved by just taking advantage of the natural way in which html/css work. unrecognised html elements are treated by the browser as anonymous inline elements (effectively inline elements with no semantic value, similar to <span> elements). you can still refer to them by their names, and style them with css, for example — you just need to make sure they are behaving as you want them to, for example setting display: block; on all of the new semantic elements (such as <article>, <aside>, etc.), but only in old versions of ie that don't recognise them (so, ie 8 and lower). this way new browsers can just ...
...And 3 more matches
Listening to events on all tabs
nsiuri alocation [optional] in unsigned long aflags ); parameters abrowser the browser representing the tab whose location changed. awebprogress the progress instance responsible for handling the events. arequest the nsirequest object representing the associated request. alocation an nsiuri object indicating the tab's new uri. aflags optional: this is a value which explains the situation or the reason why the location has changed. optional from gecko 10 onprogresschange called when updated progress information for the download of a document is available. void onprogresschange( nsidomxulelement abrowser, nsiwebprogress awebprogress, nsirequest arequest, print32 acurselfprogress, print32 amaxselfprogress, print32 acurtotalprogress, print3...
...ameters abrowser the browser representing the tab for which updated progress information is being provided. awebprogress the progress instance responsible for handling the events. arequest the nsirequest object representing the associated request. acurselfprogress the current progress for the request indicated by the request parameter. amaxselfprogress the value representing 100% complete for the request indicated by the request parameter. acurtotalprogress the current progress for all requests associated with webprogress. amaxtotalprogress the total progress for all requests associated with webprogress. onsecuritychange notification called for security progress. this method will be called on security transitions (eg http -> https, https...
...ccur if a security package is installed. void onsecuritychange( nsidomxulelement abrowser, nsiwebprogress awebprogress, nsirequest arequest, unsigned long astate ); parameters abrowser the browser that fired the notification. awebprogress the nsiwebprogress instance that fired the notification. arequest the nsirequest that has new security state. astate a value composed of the security state flags and the security strength flags described in the documentation for nsiwebprogresslistener. onstatechange notification indicating the state has changed for one of the requests associated with awebprogress. void onstatechange( nsidomxulelement abrowser, nsiwebprogress awebprogress, nsirequest arequest, unsigned long astateflags, nsresult astatus ); p...
...And 3 more matches
FileUtils.jsm
openfileoutputstream(nsifile file, int modeflags); nsifileoutputstream openatomicfileoutputstream(nsifile file, int modeflags); nsifileoutputstream opensafefileoutputstream(nsifile file, int modeflags); void closeatomicfileoutputstream(nsifileoutputstream stream); void closesafefileoutputstream(nsifileoutputstream stream); constants constant value description mode_rdonly 0x01 corresponds to the pr_rdonly parameter to pr_open mode_wronly 0x02 corresponds to the pr_wronly parameter to pr_open mode_create 0x08 corresponds to the pr_create_file parameter to pr_open mode_append 0x10 corresponds to the pr_append parameter to pr_open mode_truncate 0x20 corresponds to th...
...file( string key, array patharray, bool followlinks ); parameters key the nsidirectoryservice key to start from (see getting special files for more info) patharray an array of path components to locate beneath the directory specified by key. the last item in this array must be the leaf name of a file. followlinks optional true if links should be followed, false otherwise. return value returns a nsifile object for the file specified. the file is not created if it does not exist, however all required directories along the way are. getdir() gets a directory at the specified hierarchy under a nsidirectoryservice key. nsifile getdir( string key, array patharray, bool shouldcreate, bool followlinks ); parameters key the nsidirectoryservice key to start from (see ge...
...toryservice key to start from (see getting special files for more info) patharray an array of path components to locate beneath the directory specified by key. shouldcreate optional true if the directory hierarchy specified in patharray should be created if it does not exist, false otherwise. followlinks optional true if links should be followed, false otherwise location specified. return value returns a nsifile object for the location specified. if the directory requested does not exist, it is created, along with any parent directories that need to be created. note: if you want to use the full path to get to the directory you cannot use getdir. instead use the file constructor, so simply: var dir = new fileutils.file('c:\\blah\\blah'); if (dir.exists()) { //yes directory exists }...
...And 3 more matches
Promise.jsm
ludes helper functions that are specific to the add-on sdk. while you may still import this module from the above paths, the recommended way for loading it is through the add-on sdk loader. introduction for an introduction to promises, you may start from the add-on sdk documentation, keeping in mind that only the core subset is implemented in this module. a promise is an object representing a value that may not be available yet. internally, a promise can be in one of three states: pending, when the final value is not available yet. this is the only state that may transition to one of the other two states. fulfilled, when and if the final value becomes available. a fulfillment value becomes permanently associated with the promise. this may be any value, including undefined. rejected, if...
.... internally, a promise can be in one of three states: pending, when the final value is not available yet. this is the only state that may transition to one of the other two states. fulfilled, when and if the final value becomes available. a fulfillment value becomes permanently associated with the promise. this may be any value, including undefined. rejected, if an error prevented the final value from being determined. a rejection reason becomes permanently associated with the promise. this may be any value, including undefined, though it is generally an error object, like in exception handling. a reference to an existing promise may be received by different means, for example as the return value of a call into an asynchronous api. in this case, the state of the promise can be observed ...
...se and on the behavior of the callbacks. for example, unhandled exceptions in the callbacks cause the new promise to be rejected, even if the original promise is fulfilled. see the documentation of the then method for details. promises may also be created using the new promise() constructor. method overview deferred defer(); obsolete since gecko 30 promise resolve([optional] avalue); promise reject([optional] areason); methods defer() creates a new pending promise and provides methods to resolve or reject it. deferred defer(); obsolete since gecko 30 parameters none. return value a new object, containing the new promise in the promise property, and the methods to change its state in the resolve and reject properties. see the deferred documentation fo...
...And 3 more matches
Mozilla DOM Hacking Guide
in javascript, a client tries to access a dom object or a dom method on a dom object, the js engine asks xpconnect to search for the relevant c++ method to call. for example, when we ask for |document.getelementbyid("myid");|, xpconnect will find that |document| is a property of the window object, so it will look on the interface nsidomwindow, and it will find the getdocument() method. the return value of getdocument() is a nsidomdocument. so xpconnect will then try to find a method named getelementbyid() on the nsidomdocument interface. and indeed it will find it, and thus call it. this is the schema used most of the time when using w3c dom objects and methods. it is however different for some dom level 0 objects and methods. i'll take two very different examples. the first one is the window.
...section 1.5. static nsresult registerclassname(print32 adomclassinfoid): help me! static nsresult registerclassprotos(print32 adomclassinfoid): help me! static nsresult registerexternalclasses();: help me! nsresult resolveconstructor(jscontext *cx, jsobject *obj, jsobject **objp);: help me! static print32 getarrayindexfromid(jscontext *cx, jsval id, prbool *aisnumber = nsnull): if the js value is an integer, then *aisnumber is true, and the integer is returned. else, *aisnumber is false and -1 is returned. static inline prbool isreadonlyreplaceable(jsval id) { ... }: help me! static inline prbool iswritablereplaceable(jsval id) { ... }: help me! nsresult docheckpropertyaccess(...): help me! (bug 90757) static jsclass sdomconstructorprotoclass: xpconnect fu to expose the dom objects...
...od creates a wrapper for the location object on the // window object. ...
...And 3 more matches
A brief guide to Mozilla preferences
this article is intended for mozilla power users and system administrators. it provides a general overview of mozilla preferences, including where preferences are stored, a file-by-file analysis of preference loading sequence, and information on editing preferences. what is a preference? a preference is any value or defined behavior that can be set (presumably, one setting is preferable to another). preference changes via user interface usually take effect immediately. the values are saved to the user profile (in prefs.js), for both firefox and thunderbird. a preference is read from a file, and can call up to four methods: pref(), user_pref(), sticky_pref() and lockpref(). all preferences files may call pref(), user_pref() and sticky_pref(), while the config file in addition may c...
... do not edit prefs.js directly. note the application never changes user.js, so on launch user.js overrides conflicting preferences from the previous application session. when prefs.js is written, it only saves user preferences which are different from the default. the exception to this is a preference read using sticky_pref() - these preference will be written whenever the preference has a user value even when it is the same as the default. modifying preferences advanced users can set named preferences via the advanced preferences editor, by typing about:config in the location bar. this ui is not recommended for most users. programmatic changes to preferences can be made using the preferences.jsm module from js code, or the mozilla::preferences static class methods from c++ code. changin...
...ference loading process. the administrator may alternatively put a user.js file in app_dir/defaults/profile/ ; this will put a copy of the user.js in all new profiles. this method has the advantage of resetting preferences back to administrator defaults at every start-up. note that, because a user typically has access privilege to his or her profile directory, he or she can change the default values if he or she knows how. another disadvantage is that existing profiles will not be affected. this method is considered user-hostile. any use of this technique by software such as firefox extension to override normal user preference will result in being added to the firefox blocklist or the preferences being forcibly removed. note: because of abuse of user.js preferences, support for user.js...
...And 3 more matches
Encrypt Decrypt MAC Keys As Session Objects
const char *encryptedfilename, const char *noisefilename, secupwdata *pwdata, prbool ascii) { /* * the db is open for read/write and we have authenticated to it. * generate a symmetric aes key as a token object. * generate a second key to use for macing, also a token object. * get their cka_ids * generate a random value to use as iv for aes cbc * open an input file and an output file, * write a header to the output that identifies the two keys by * their cka_ids, may include original file name and length. * loop until eof(input) * read a buffer of plaintext from input file, * mac it, append the mac to the plaintext * encrypt it using cbc, using previously created iv, ...
...key cka_id.\n"); goto cleanup; } if (noisefilename) { rv = seedfromnoisefile(noisefilename); if (rv != secsuccess) { port_seterror(pr_end_of_file_error); return secfailure; } rv = pk11_generaterandom(iv, blocksize); if (rv != secsuccess) { goto cleanup; } } else { /* generate a random value to use as iv for aes cbc */ generaterandom(iv, blocksize); } headerfile = pr_open(headerfilename, pr_create_file | pr_truncate | pr_rdwr, 00660); if (!headerfile) { pr_fprintf(pr_stderr, "unable to open \"%s\" for writing.\n", headerfilename); return secfailure; } encfile = pr_open(encrypte...
... strrchr(argv[0], '/'); progname = progname ? ...
...And 3 more matches
Encrypt and decrypt MAC using token
const char *encryptedfilename, const char *noisefilename, secupwdata *pwdata, prbool ascii) { /* * the db is open for read/write and we have authenticated to it. * generate a symmetric aes key as a token object. * generate a second key to use for macing, also a token object. * get their cka_ids * generate a random value to use as iv for aes cbc * open an input file and an output file, * write a header to the output that identifies the two keys by * their cka_ids, may include original file name and length. * loop until eof(input) * read a buffer of plaintext from input file, * mac it, append the mac to the plaintext * encrypt it using cbc, using previously created iv, ...
...key cka_id.\n"); goto cleanup; } if (noisefilename) { rv = seedfromnoisefile(noisefilename); if (rv != secsuccess) { port_seterror(pr_end_of_file_error); return secfailure; } rv = pk11_generaterandom(iv, blocksize); if (rv != secsuccess) { goto cleanup; } } else { /* generate a random value to use as iv for aes cbc */ generaterandom(iv, blocksize); } headerfile = pr_open(headerfilename, pr_create_file | pr_truncate | pr_rdwr, 00660); if (!headerfile) { pr_fprintf(pr_stderr, "unable to open \"%s\" for writing.\n", headerfilename); return secfailure; } encfile = pr_open(encrypte...
... strrchr(argv[0], '/'); progname = progname ? ...
...And 3 more matches
Encrypt Decrypt_MAC_Using Token
const char *encryptedfilename, const char *noisefilename, secupwdata *pwdata, prbool ascii) { /* * the db is open for read/write and we have authenticated to it. * generate a symmetric aes key as a token object. * generate a second key to use for macing, also a token object. * get their cka_ids * generate a random value to use as iv for aes cbc * open an input file and an output file, * write a header to the output that identifies the two keys by * their cka_ids, may include original file name and length. * loop until eof(input) * read a buffer of plaintext from input file, * mac it, append the mac to the plaintext * encrypt it using cbc, using previously created iv, ...
...*/ generaterandom(iv, blocksize); } headerfile = pr_open(headerfilename, pr_create_file | pr_truncate | pr_rdwr, 00660); if (!headerfile) { pr_fprintf(pr_stderr, "unable to open \"%s\" for writing.\n", headerfilename); return secfailure; } encfile = pr_open(encrypt...
... strrchr(argv[0], '/'); progname = progname ? ...
...And 3 more matches
NSS Sample Code Sample_3_Basic Encryption and MACing
st char *headerfilename, const char *encryptedfilename, const char *noisefilename, secupwdata *pwdata, prbool ascii) { /* * the db is open for read/write and we have authenticated to it. * generate a symmetric aes key as a token object. * generate a second key to use for macing, also a token object. * get their cka_ids * generate a random value to use as iv for aes cbc * open an input file and an output file, * write a header to the output that identifies the two keys by * their cka_ids, may include original file name and length. * loop until eof(input) * read a buffer of plaintext from input file * mac it, append the mac to the plaintext * encrypt it using cbc, using previously created iv ...
...key cka_id.\n"); goto cleanup; } if (noisefilename) { rv = seedfromnoisefile(noisefilename); if (rv != secsuccess) { port_seterror(pr_end_of_file_error); return secfailure; } rv = pk11_generaterandom(iv, blocksize); if (rv != secsuccess) { goto cleanup; } } else { /* generate a random value to use as iv for aes cbc */ generaterandom(iv, blocksize); } headerfile = pr_open(headerfilename, pr_create_file | pr_truncate | pr_rdwr, 00660); if (!headerfile) { pr_fprintf(pr_stderr, "unable to open \"%s\" for writing.\n", headerfilename); return secfailure; } encfile = pr_open(encrypte...
... strrchr(argv[0], '/'); progname = progname ? ...
...And 3 more matches
NSS_3.12.3_release_notes.html
o its previous behavior through the use of environment variables. here is a table of the new environment variables introduced in nss 3.12.3 and information about how they affect these new behaviors. ...
...this was allowed by default before nss 3.12.3. nss_hash_alg_support string specifies algorithms allowed to be used in certain applications, such as in signatures on certificates and crls. see documentation at this link. ...
... allowed by default before nss 3.12.3. nss_hash_alg_support string specifies algorithms allowed to be used in certain applications, such as in signatures on certificates and crls. see documentation at this link. nss_strict_nofork string ("1", "disabled", or any other non-empty value) it is an error to try to use a pkcs#11 crypto module in a process before it has been initialized in that process, even if the module was initialized in the parent process. beginning in nss 3.12.3, softoken will detect this error. this environment variable controls softoken's response to that error. if set to to "1" or unset, softoken will trigger an assertion...
...And 3 more matches
64-bit Compatibility
h 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. ...
...the best way to fix this is to make types explicit, such as: const uintptr_t pointer_tagbits = 3 or by using a cast inside the macro. ...
...ant that bits 63-48 must be sign-extended from bit 47. if you use these bits to squirrel away a payload, they must be adjusted before attempting to dereference the pointer. for more information and platform specific details on virtual address widths, see this article on wikipedia. builtins and calls when passing arguments to lirwriter::inscall(), there are four types: argsize_f - floating point value argsize_i - 32-bit integer argsize_q - 64-bit integer argsize_p - 32-bit integer on 32-bit platforms, 64-bit integer on 64-bit platforms. remember to use argsize_p where appropriate - on pointers or natively sized integers (including jsvals). similarly, when adding types to jsbuiltins.h, remember to use _js_ptr for pointer-width values. lir safety it is not immediately clear from reading lir ...
...And 3 more matches
Property cache
t is crucial that jit and interpreter get the same answer; possible pitfalls include native getters and resolve hooks. so the lookup must happen only once. the jit ensures this by using the property cache to forward its work to the interpreter.) for speed, the cache is a fixed-size hash table with no chaining. collisions simply cause old entries to be overwritten. the hash table entries are key-value pairs. the keys describe the context in which a property lookup occurs. the values consist of two word-sized members. entry->vcap 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::sha...
...rred; then at time t1 y's own property p is the same method property. (the existence of this property is guaranteed by the basic layout guarantee above.) (informally: two objects with the same shape have the same method properties.) branded object guarantee — if at time t0 the object x has shape s; and x is branded (x->branded()); and x has an own property p, which is a writable, function-valued data property with the stub getter and setter and a slot; and at time t1 an object y has shape s; and no shape-regenerating gc occurred; then y is x, and at time t1 x's own property p has the same function value it had at time t0. (the existence of this property is guaranteed by the basic layout guarantee above.) (informally: branded objects have unique shapes, and if x is branded, changing any ...
...e are probably similar bugs to do with, for example, xml objects' custom getproperty op.) dense arrays are shapeless. the shape of an object does not cover: anything about the object's prototype other than its identity; anything about the object's parent; obj->freeslot, which can be different for same-shaped objects if they have a jsclass.reserveslots hook (bug 535416); anything about the values of the object's own properties, beyond what the method guarantee and the branded object guarantee say about functions. in particular shape does not cover the types of property values; typically {a: "x"} and {a: 12} have the same shape. both jsobject::objshape and jsshape::shape are shape-ids. jsobject::objshape tells an object's shape. the jsshape::shape field is there so that when a property ...
...And 3 more matches
JIT Optimization Strategies
applies to property accesses on objects which are global-like in that there is only one instance of them per program. this includes global objects, object literals defined at the top-level of a script, and top-level function objects. this optimization makes the assumption that a property that has not changed after it was first assigned, is likely a constant property. it then directly inlines the value of the property into hot code that accesses it. for example, in the following code: var constants = {}; constants.n = 100; function testarray(array) { for (var i = 0; i < array.length; i++) { if (array[i] > constants.n) return true; } return false; } will have the loop compiled into the following when testarray gets hot. for (var i = 0; i < array.length; i++) { if (array[i]...
...), this optimization cannot succeed. furthermore, even if the object type is monomorphic, the optimization will fail if the property being accessed is not a definite slot as described above. getprop_unboxed similar to getprop_definiteslot. unboxed property reads are possible on properties which satisfy all the characteristics of a definite slot, and additionally have been observed to only store values of one kind of value. consider the following constructor: function point(x, y) { this.x = x; this.y = y; } if only integers are ever stored in the x and y properties, then the instances of point will be represented in an "unboxed" mode - with the property values stored as raw 4-byte values within the object. objects which have the unboxed optimization are more compact. getprop_comm...
...), this optimization cannot succeed. furthermore, even if the object type is monomorphic, the optimization will fail if the property being written is not a definite slot as described above. setprop_unboxed similar to setprop_definiteslot. unboxed property writes are possible on properties which satisfy all the characteristics of a definite slot, and additionally have been observed to only store values of one kind of value. consider the following constructor: function point(x, y) { this.x = x; this.y = y; } if only integers are ever stored in the x and y properties, then the instances of point will be represented in an "unboxed" mode - with the property values stored as raw 4-byte values within the object. objects which have the unboxed optimization are more compact. setprop_inli...
...And 3 more matches
JS::Handle
syntax bool somefunction(jscontext *cx, js::handle<t> var) { ... } methods here, ptr represents the private member of js::handle<t>, typed with t. method description const t *address() const returns a pointer to ptr. const t &get() const returns ptr. ...
...onst t *address() const returns a pointer to ptr. const t &get() const returns ptr. operator const t&() const t operator->() const bool operator!=(const t &other) const compares ptr and other. bool operator==(const t &other) const description js::handle<t> is a const reference to a js::rooted&lt;t&gt;. ...
... if you want to add additional methods to js::handle for a specific specialization, define a js::handlebase<t> specialization containing them. ...
...And 3 more matches
JS::Remove*Root
te. 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 31 unregister a pointer to a gc thing so that it is no longer a member of the garbage collector's root set. this enables any pointed-at gc thing to be garbage collected as needed. ...
... 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 31 unregister a pointer to a gc thing so that it is no longer a member of the garbage collector's root set. this enables any pointed-at gc thing to be garbage collected as needed. ...
...er a member of the garbage collector's root set. this enables any pointed-at gc thing to be garbage collected as needed. syntax void removevalueroot(jscontext *cx, js::heap<js::value> *vp); void removestringroot(jscontext *cx, js::heap<jsstring *> *rp); void removeobjectroot(jscontext *cx, js::heap<jsobject *> *rp); void removescriptroot(jscontext *cx, js::heap<jsscript *> *rp); void removevaluerootrt(jsruntime *rt, js::heap<js::value> *vp); void removestringrootrt(jsruntime *rt, js::heap<jsstring *> *rp); void removeobjectrootrt(jsruntime *rt, js::heap<jsobject *> *rp); void removescriptrootrt(jsruntime *rt, js::heap<jsscript *> *rp); name type description cx jscontext * the context from which to remove the root. requires request. in a js_threadsafe bu...
...And 3 more matches
JS::Rooted
methods here, ptr represents the private member of js::rooted<t>, typed with t. ...
...r(cx); js::rooted<t> var(cx, initial); js::rooted<t> var(rt); js::rooted<t> var(rt, initial); name type description cx jscontext * the context in which to add the root. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. rt jsruntime * the runtime in which to add the root. ...
...an initial value for the rooted variable. methods here, ptr represents the private member of js::rooted<t>, typed with t. method description t &get() returns ptr. const t &get() const operator const t&() const t operator->() const t *address() returns a pointer to ptr. const t *address() const t &operator=(t value) sets the value of ptr to value. t &operator=(const rooted &value) void set(t value) bool operator!=(const t &other) const compares ptr and other. bool operator==(const t &other) const description js::rooted<t> declares a local variable of type t whose value is always rooted. ...
...And 3 more matches
JS::ToPrimitive
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to convert. hint jstype the hint to pass to the toprimitive and @@toprimitive method when converting the object. ...
...s::handleobject the object to convert. hint jstype the hint to pass to the toprimitive and @@toprimitive method when converting the object. hint must be jstype_string or jstype_number to pass the corresponding type as a hint, or jstype_void to pass no hint. do not pass any other type. vp js::mutablehandleobject out parameter. on success, *vp receives the converted value. ...
...toprimitive and @@toprimitive method when converting the object. hint must be jstype_string or jstype_number to pass the corresponding type as a hint, or jstype_void to pass no hint. do not pass any other type. vp js::mutablehandleobject out parameter. on success, *vp receives the converted value. description js::toprimitive converts a javascript object, obj, to a primitive value using ecmascript 6 toprimitive. ...
...And 3 more matches
JSType
jstype_symbol symbols. ...
... jstype_symbol symbols. ...
... jstype_symbol symbols. ...
...And 3 more matches
JS_LooselyEqual
equal bool * out parameter. receives the comparison result. ...
... equal bool * out parameter. receives the comparison result. ...
... equal bool * out parameter. receives the comparison result. ...
...And 3 more matches
Parser API
ht be incomplete. visit estree spec for a community ast standard that includes latest ecmascript features and is backward-compatible with spidermonkey format. ...
... type: "thisexpression"; } a this expression. interface arrayexpression <: expression { type: "arrayexpression"; elements: [ expression | null ]; } an array expression. interface objectexpression <: expression { type: "objectexpression"; properties: [ property ]; } an object expression. interface property <: node { type: "property"; key: literal | identifier; value: expression; kind: "init" | "get" | "set"; } a literal property in an object expression can have either a string or number as its value. ordinary property initializers have a kind value "init"; getters and setters have the kind values "get" and "set", respectively. interface functionexpression <: function, expression { type: "functionexpression"; id: identifier | null; params: [...
... side of an assignment can in general be any expression, in an assignment context, a pattern can be any expression. in binding positions (such as function parameters, variable declarations, and catch headers), patterns can only be identifiers in the base case, not arbitrary expressions. interface objectpattern <: pattern { type: "objectpattern"; properties: [ { key: literal | identifier, value: pattern } ]; } an object-destructuring pattern. a literal property in an object pattern can have either a string or number as its value. interface arraypattern <: pattern { type: "arraypattern"; elements: [ pattern | null ]; } an array-destructuring pattern. clauses interface switchcase <: node { type: "switchcase"; test: expression | null; consequent: [ statement ]; }...
...And 3 more matches
imgIEncoder
post-multipli...
...post-multiplied alpha us used (for example 50% transparent red is 0xff000080) input_format_hostargb 2 input is...
... png: ---- transparency=[yes|no|none] -- default: "yes" overrides default from input format. "no" and "none" are equivalent. apng: ----- the following options can be used with startimageencode(): transparency=[yes|no|none] -- default: "yes" overrides default from input format. "no" and "none" are equivalent. skipfirstframe...
...And 3 more matches
nsIAuthInformation
able a object that holds authentication information. 1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) the caller of nsiauthprompt2.promptusernameandpassword() or nsiauthprompt2.promptpasswordasync() provides an object implementing this interface; the prompt implementation can then read the values here to prefill the dialog. after the user entered the authentication information, it should set the attributes of this object to indicate to the caller what was entered by the user. attributes attribute type description authenticationscheme autf8string the authentication scheme used for this request, if applicable. if the protocol for this authentication does not support schemes, this will...
...ntered by the user. attributes attribute type description authenticationscheme autf8string the authentication scheme used for this request, if applicable. if the protocol for this authentication does not support schemes, this will be the empty string. otherwise, this will be a string such as "basic" or "digest". this string will always be in lowercase. read only. domain astring the initial value should be used to prefill the dialog or be shown in some other way to the user. on return, this parameter should contain the domain entered by the user. this attribute is only used if flags include #need_domain. flags unsigned long flags describing this dialog. a bitwise or of the constants. it is possible that neither #auth_host nor #auth_proxy are set. auth prompts should ignore flags they d...
...d by the user. this attribute is only used if flags include #need_domain. flags unsigned long flags describing this dialog. a bitwise or of the constants. it is possible that neither #auth_host nor #auth_proxy are set. auth prompts should ignore flags they do not understand; especially, they should not throw an exception because of an unsupported flag. read only. password astring the initial value should be used to prefill the dialog or be shown in some other way to the user. the password should not be shown in clear. on return, this parameter should contain the password entered by the user. realm astring the server-supplied realm of the authentication as defined in rfc 2617. can be the empty string if the protocol does not support realms. otherwise, this is a human-readable string like ...
...And 3 more matches
nsIBinaryInputStream
retval] out pruint8 abytes); void readbytes(in pruint32 alength, [size_is(alength), 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(); parameters none. return value an 8-bit integer read from the stream. read16() reads from the stream. pruint16 read16(); parameters none. return value a 16-bit integer read from the stream. read32() reads from the stream. pruint32 read32(); parameters none. return value a 32-bit integer read from the stream. read64() reads from the stream. warning: this method is available from javascript; however javascrip...
... read16(); parameters none. return value a 16-bit integer read from the stream. read32() reads from the stream. pruint32 read32(); parameters none. return value a 32-bit integer 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 alength, in jsval aarraybuffer); parameters alength the number of bytes that should be read. aarraybuffer the arraybuffer in which to store the results. ...
... readbytearray() reads an opaque byte array from the stream, storing the results as an array of pruint8s. ...
...And 3 more matches
nsIChannel
; attributes attribute type description contentcharset 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. ...
...pplicable. 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. contentlength 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. contenttype acstring the mime type of the channel's conten...
...e mime type is. the channel may ignore this hint in deciding on the actual mime type that it will report. setting contenttype after onstartrequest has been fired or after open() is called will override the type determined by the channel. setting contenttype between the time that asyncopen() is called and the time when onstartrequest is fired has undefined behavior at this time. the value of the contenttype attribute is a lowercase string. a value assigned to this attribute will be parsed and normalized as follows: any parameters (delimited with a ';') will be stripped. if a charset parameter is given, then its value will replace the the contentcharset attribute of the channel. the stripped contenttype will be lowercased. any implementation of nsichannel must ...
...And 3 more matches
nsIClassInfo
ut pruint32 count, [array, size_is(count), retval] out nsiidptr array); attributes attribute type description classdescription string a human readable string naming the class, or null. read only. classid nscidptr a classid through which an instance of this class can be created, or null. ...
... created, or null. if the flags attribute has the singleton bit set, then the value of this attribute specifies a classid through which this class can be accessed as a service using nsiservicemanager.getservice(). read only. classidnoalloc nscid a classid through which an instance of this class can be created, or null. if the flags attribute has the singleton bit set, then the value of this attribute specifies a classid through which this class can be accessed as a service using nsiservicemanager.getservice(). this attribute is similar to the classid attribute; however, this attribute exists so that c++ callers can avoid allocating and freeing a nscid object, as would happen if they used classid. read only. violates the xpcom interface guidelines exceptions thrown ...
...ting and freeing a nscid object, as would happen if they used classid. read only. violates the xpcom interface guidelines exceptions thrown ns_error_not_available if the class does not have a classid contractid string a contractid through which an instance of this class can be created, or null. if the flags attribute has the singleton bit set, then the value of this attribute specifies a contractid through which this class may be accessed as a service using nsiservicemanager.getservicebycontractid(). read only. flags pruint32 specifies various binary properties of this class. possible values for this attribute include a bit-wise combination of the constants read only. implementationlanguage obsolete since gecko 40 pruint32 ...
...And 3 more matches
nsICryptoHMAC
n gecko 1.9 (firefox 3) method overview acstring finish(in prbool aascii); void init(in unsigned long aalgorithm, in nsikeyobject akeyobject); void reset(); void update([const, array, size_is(alen)] in octet adata, in unsigned long alen); void updatefromstream(in nsiinputstream astream, in unsigned long alen); constants hashing algorithms. ...
... void init(in unsigned long aalgorithm, in nsikeyobject akeyobject); void reset(); void update([const, array, size_is(alen)] in octet adata, in unsigned long alen); void updatefromstream(in nsiinputstream astream, in unsigned long alen); constants hashing algorithms. these values are to be used by the init() method to indicate which hashing function to use. ...
...ned long aalgorithm, in nsikeyobject akeyobject); void reset(); void update([const, array, size_is(alen)] in octet adata, in unsigned long alen); void updatefromstream(in nsiinputstream astream, in unsigned long alen); constants hashing algorithms. these values are to be used by the init() method to indicate which hashing function to use. these values map onto the values defined in mozilla/security/nss/lib/softoken/pkcs11t.h and are switched to ckm_*_hmac constant. ...
...And 3 more matches
nsIDOMMozNetworkStatsManager
ed. to know in advance which kind of origin is available, the moznetworkstatsmanager.getavailablenetworks method returns an array of interfaces. start a date object representing the beginning of data measurement. end a date object representing the end of data measurement. options optional filtering options. networkstatsgetoptions is a dictionary object providing filtering options. return value an nsidomdomrequest object. if successful, the request result is an nsidommoznetworkstats object describing the network statistics. if network stats are not available for some dates, then rxbytes and txbytes are undefined for those dates. if the filtering start date is greater than the end date, an exception is thrown. exceptions thrown ns_error_invalid_arg the filtering start date is great...
...y wifi, mobile, or null. if null, data measurement from both origins are merged. to know in advance which kind of origin is available, the moznetworkstatsmanager.getavailablenetworks method returns an array of interfaces. threshold the total data usage threshold in bytes. options optional filtering options. networkstatsalarmoptions is a dictionary object providing filtering options. return value an nsidomdomrequest object. if successful, the result field of the domrequest keeps the alarm id. exceptions thrown invalidnetwork the network must be in the return of getavailablenetworks. getallalarms() obtain all alarms for those networks returned by getavailablenetworks. if a network is provided, only retrieves the alarms for that network. nsidomdomrequest getallalarms([optional] in...
...es the alarms for that network. nsidomdomrequest getallalarms([optional] in nsisupports network); parameters network optional the origin of the data. it can specify wifi, mobile, or null. if null, data measurement from both origins are merged. to know in advance which kind of origin is available, the moznetworkstatsmanager.getavailablenetworks method returns an array of interfaces. return value an alarm object with the same fields as that in the system message; alarmid, network, threshold, and data. exceptions thrown invalidnetwork the network must be in the return of getavailablenetworks. removealarms() remove all network alarms. if an alarmid is provided, then only that alarm is removed. nsidomdomrequest removealarms([optional] in long alarmid); parameters alarmid id of...
...And 3 more matches
nsIDOMNode
in nsidomnode oldchild) attributes attribute type description attributes nsidomnamednodemap read only. childnodes nsidomnodelist read only. firstchild nsidomnode read only. lastchild nsidomnode read only. localname domstring read only. namespaceuri domstring read only. nextsibling nsidomnode read only. nodename domstring read only. nodetype unsigned short read only. ...
...nly. lastchild nsidomnode read only. localname domstring read only. namespaceuri domstring read only. nextsibling nsidomnode read only. nodename domstring read only. nodetype unsigned short read only. nodevalue domstring ownerdocument nsidomdocument read only. parentnode nsidomnode read only. prefix domstring previoussibling nsidomnode read only. ...
...ue description element_node 1 attribute_node 2 text_node 3 cdata_section_node 4 entity_reference_node 5 entity_node 6 processing_instruction_node 7 comment_node 8 document_node 9 document_type_node 10 document_fragment_node 11 notation_node 12 methods appendchild() nsidomnode appendchild( in nsidomnode newchild ); parameters newchild return value clonenode() nsidomnode clonenode( in boolean deep ); parameters deep return value hasattributes() boolean hasattributes(); parameters none. return value haschildnodes() boolean haschildnodes(); parameters none. return value insertbefore() nsidomnode insertbefore( in nsidomnode newchild, in nsidomnode refchild ); parameters newchild refchild return value issupported() boolean...
...And 3 more matches
nsIDictionary
extensions/xml-rpc/idl/nsidictionary.idlscriptable a simple mutable table of objects, maintained as key/value pairs. objects can be located and managed by referencing them by key. 66 introduced gecko 1.0 obsolete gecko 1.9.1 inherits from: nsisummary last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) note: this interface was removed in firefox 3.5; use dict.jsm instead. see bug 668424 for further information. ...
...9.1 inherits from: nsisummary last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) note: this interface was removed in firefox 3.5; use dict.jsm instead. see bug 668424 for further information. method overview boolean haskey(in string key); void getkeys(out pruint32 count, [retval, array, size_is(count)] out string keys); nsisupports getvalue(in string key); void setvalue(in string key, in nsisupports value); nsisupports deletevalue(in string key); void clear(); methods haskey() check if a given key is present in the dictionary. boolean haskey( in string key ); parameters key key to check for. return value true if present, false if absent. getkeys() retrieve all keys in the dictiona...
...in string key); void clear(); methods haskey() check if a given key is present in the dictionary. boolean haskey( in string key ); parameters key key to check for. return value true if present, false if absent. getkeys() retrieve all keys in the dictionary. void getkeys( out pruint32 count, [retval, array, size_is(count)] out string keys ); return value array of all keys, unsorted. getvalue() find the value indicated by the key. nsisupports getvalue( in string key ); parameters key the lookup key indicating the value. ...
...And 3 more matches
nsIEditorSpellCheck
ellchecker(); void updatecurrentdictionary(); methods addwordtodictionary() adds the specified word to the current personal dictionary. void addwordtodictionary( in wstring word ); parameters word the word to add to the current personal dictionary. canspellcheck() determines whether or not spell checking can be enabled. boolean canspellcheck(); parameters none. return value returns true if spell checking can be enabled. if there are no available dictionaries, the return value is false. checkcurrentdictionary() call this after any change in installed dictionaries to ensure that the spell checker is not using a current dictionary which is no longer available. if the current dictionary is no longer available, pick another dictionary. void checkcurrentdictionary(); par...
...dictionary(); parameters none. checkcurrentword() checks a given word. in spite of the name, this function checks the word you give it, returning true if the word is misspelled. if the word is misspelled, it will compute the suggestions which you can get from getsuggestedword(). boolean checkcurrentword( in wstring suggestedword ); parameters suggestedword missing description return value true if the specified word is misspelled; otherwise false. checkcurrentwordnosuggest() like checkcurrentword(), checks the word you give it, returning true if it is misspelled. this is faster than checkcurrentword() because it does not compute any suggestions. note: this does not clear any suggestions left over from previous calls to checkcurrentword(), so there may be suggestions, but they wil...
... returning true if it is misspelled. this is faster than checkcurrentword() because it does not compute any suggestions. note: this does not clear any suggestions left over from previous calls to checkcurrentword(), so there may be suggestions, but they will be invalid. boolean checkcurrentwordnosuggest( in wstring suggestedword ); parameters suggestedword the word to check. return value true if the word is misspelled; otherwise false. getcurrentdictionary() returns the name of the dictionary currently in use. astring getcurrentdictionary(); parameters none. return value the name of the dictionary currently in use. typically, this is an iso language code, such as "en-us". getdictionarylist() retrieves a list of the currently available dictionaries. the strings will typically be ...
...And 3 more matches
nsIEnvironment
sienvironment.idlscriptable scriptable access to the current process environment. inherits from: nsisupports last changed in gecko 1.7 implemented by: @mozilla.org/process/environment;1 as a service: var env = components.classes["@mozilla.org/process/environment;1"]. getservice(components.interfaces.nsienvironment); method overview void set(in astring aname, in astring avalue); astring get(in astring aname); boolean exists(in astring aname); methods set() set the value of an environment variable. void set( in astring aname, in astring avalue ); parameters aname the variable name to set. avalue the value to set. get() get the value of an environment variable. astring get( in astring aname ); parameters ana...
...exists() check the existence of an environment variable. ...
...exists() check the existence of an environment variable. ...
...And 3 more matches
nsIMsgCustomColumnHandler
er("newcolumn"); method overview astring getsortstringforrow(in nsimsgdbhdr ahdr); unsigned long getsortlongforrow(in nsimsgdbhdr ahdr); boolean isstring(); methods getsortstringforrow() if the column displays a string, this will return the string that the column should be sorted by. astring getsortstringforrow(in nsimsgdbhdr ahdr); parameters ahdr the message's nsimsgdbhdr. ...
... method overview astring getsortstringforrow(in nsimsgdbhdr ahdr); unsigned long getsortlongforrow(in nsimsgdbhdr ahdr); boolean isstring(); methods getsortstringforrow() if the column displays a string, this will return the string that the column should be sorted by. astring getsortstringforrow(in nsimsgdbhdr ahdr); parameters ahdr the message's nsimsgdbhdr. ...
...false otherwise. ...
...And 3 more matches
nsIMsgMessageService
ndow, out nsiuri aurl); parameters asrcuri the string url of the message to copy. acopylistener an nsistreamlistener to be notified of copy events. amovemessage set to true if you want the message to be moved. false leaves it as just a copy. aurllistener a nsiurllistener to be notified of url events. amsgwindow nsimsgwindow for progress and status feedback return values aurl the new nsiuri of the message. copymessages() copy multiple messages at a time. see copymessage [noscript] void copymessages(in nsmsgkeyarrayptr keys, in nsimsgfolder srcfolder, in nsistreamlistener acopylistener, in boolean amovemessage, in nsiurllistener aurllis...
...amsgwindow, out nsiuri aurl); parameters keys an array of message keys to be copied. srcfolder acopylistener an nsistreamlistener to be notified of copy events. amovemessage set to true if you want the message to be moved. false leaves it as just a copy. aurllistener an nsiurllistener amsgwindow nsimsgwindow for progress and status feedback return values aurl the new nsiuri of the message. (?) displaymessage() when you want a message displayed.... void displaymessage(in string amessageuri, in nsisupports adisplayconsumer, in nsimsgwindow amsgwindow, in nsiurllistener aurllistener, in string acharsetoverride, out nsiuri aurl); param...
...tring acharsetoverride, out nsiuri aurl); parameters amessageuri a uri representing the message to display. adisplayconsumer is (for now) an nsidocshell which the message is loaded into. amsgwindow nsimsgwindow for progress and status feedback aurllistener an nsiurllistener acharsetoverride (optional) character set over ride to force the message to use. return values aurl the new nsiuri of the message. openattachment() downloads and opens an attachment. void openattachment(in string acontenttype, in string afilename, in string aurl, in string amessageuri, in nsisupports adisplayconsumer, in nsimsgwindow amsgwindow, in nsiurll...
...And 3 more matches
nsIMsgSearchCustomTerm
readonly attribute boolean needsbody; methods getenabled /** * is this custom term enabled? * * @param scope search scope (nsmsgsearchscope) * @param op search operator (nsmsgsearchop). if null, determine * if term is available for any operator. * * @return true if enabled */ boolean getenabled(in nsmsgsearchscopevalue scope, in nsmsgsearchopvalue op); getavailable /** * is this custom term available? * * @param scope search scope (nsmsgsearchscope) * @param op search operator (nsmsgsearchop). if null, determine * if term is available for any operator. * * @return true if available */ boolean getavailab...
... in nsmsgsearchopvalue op); getavailable /** * is this custom term available? ...
... /** * is this custom term available? * * @param scope search scope (nsmsgsearchscope) * @param op search operator (nsmsgsearchop). if null, determine * if term is available for any operator. ...
...And 3 more matches
nsINavHistoryResultObserver
ince gecko 11.0 void containerstatechanged(in nsinavhistorycontainerresultnode acontainernode, in unsigned long aoldstate, in unsigned long anewstate); void invalidatecontainer(in nsinavhistorycontainerresultnode acontainernode); void nodeannotationchanged(in nsinavhistoryresultnode anode, in autf8string aannoname); void nodedateaddedchanged(in nsinavhistoryresultnode anode, in prtime anewvalue); void nodehistorydetailschanged(in nsinavhistoryresultnode anode, in prtime anewvisitdate, in unsigned long anewaccesscount); void nodeiconchanged(in nsinavhistoryresultnode anode); void nodeinserted(in nsinavhistorycontainerresultnode aparent, in nsinavhistoryresultnode anode, in unsigned long anewindex); void nodekeywordchanged(in nsinavhistoryresultnode anode, in autf8string anewkeywo...
...visitdate, in unsigned long anewaccesscount); void nodeiconchanged(in nsinavhistoryresultnode anode); void nodeinserted(in nsinavhistorycontainerresultnode aparent, in nsinavhistoryresultnode anode, in unsigned long anewindex); void nodekeywordchanged(in nsinavhistoryresultnode anode, in autf8string anewkeyword); void nodelastmodifiedchanged(in nsinavhistoryresultnode anode, in prtime anewvalue); void nodemoved(in nsinavhistoryresultnode anode, in nsinavhistorycontainerresultnode aoldparent, in unsigned long aoldindex, in nsinavhistorycontainerresultnode anewparent, in unsigned long anewindex); void noderemoved(in nsinavhistorycontainerresultnode aparent, in nsinavhistoryresultnode aitem, in unsigned long aoldindex); void nodereplaced(in nsinavhistorycontainerresultnode aparentnod...
... changed, set, or unset. void nodeannotationchanged( in nsinavhistoryresultnode anode, in autf8string aannoname ); parameters anode the node whose title has changed. aannoname the name of the annotation that changed. nodedateaddedchanged() called right after the dateadded property property of a node has changed. void nodedateaddedchanged( in nsinavhistoryresultnode anode, in prtime anewvalue ); parameters anode the node whose dateadded property has changed. anewvalue the new value of the dateadded property. nodehistorydetailschanged() called right after a node's time property or accesscount property, or both, have changed. void nodehistorydetailschanged( in nsinavhistoryresultnode anode, in prtime anewvisitdate, in unsigned long anewaccesscount ); parameters anode the node...
...And 3 more matches
nsINavHistoryResultViewer
sinavhistorycontainerresultnode acontainernode); void containeropened(in nsinavhistorycontainerresultnode acontainernode); void invalidatecontainer(in nsinavhistorycontainerresultnode acontainernode); void nodeannotationchanged(in nsinavhistoryresultnode anode, in autf8string aannoname); void nodedateaddedchanged(in nsinavhistoryresultnode anode, in prtime anewvalue); void nodelastaddedchanged(in nsinavhistoryresultnode anode, in prtime anewvalue); void nodehistorydetailschanged(in nsinavhistoryresultnode anode, in prtime anewvisitdate, in unsigned long anewaccesscount); void nodeiconchanged(in nsinavhistoryresultnode anode); void nodekeywordchanged(in nsinavhistoryresultnode anode, in autf8string anewkeyword); ...
...s changed, set, or unset. void nodeannotationchanged( in nsinavhistoryresultnode anode, in autf8string aannoname ); parameters anode the node whose title has changed. aannoname the name of the annotation that hanged. nodedateaddedchanged() called right after the date added property of a node has changed. ...
...ryresultnode anode, in autf8string aannoname ); parameters anode the node whose title has changed. aannoname the name of the annotation that hanged. nodedateaddedchanged() called right after the date added property of a node has changed. void nodekeywordchanged( in nsinavhistoryresultnode anode, in prtime anewvalue ); parameters anode the node whose title has changed. anewvalue the new value for the node's date added property. nodelastmodifiedchanged() called right after the last modified date property of a node has changed. void nodekeywordchanged( in nsinavhistoryresultnode anode, in prtime anewvalue ); parameters anode the node whose title has changed. anewvalue the new value for the node's last modified property. nodehistorydetailschanged() calle...
...And 3 more matches
nsIPermissionManager
32 testpermission(in nsiuri uri, in string type); pruint32 testpermissionfromprincipal(in nsiprincipal principal, in string type); attributes attribute type description enumerator nsisimpleenumerator enumerates all stored permissions. allows access to nsipermission objects. read only. ...
... expire_session 1 permission expires at end of session. expire_time 2 permission expires at a specified time. methods add() add permission information and permission type for a given uri. if the permission already exists for a given type, it will be modified. ...
...rmission information for all uris. void removeall(); parameters none. testexactpermission() checks if a uri is permitted to perform an action. this requires an exact hostname match, subdomains are not a match. pruint32 testexactpermission( in nsiuri uri, in string type ); parameters uri the uri to be tested. type a case-sensitive ascii string, identifying the consumer. return value a pruint32 representing the permission, or unknown_action if no permission exists. testexactpermissionfromprincipal() checks if a principal is permitted to perform an action. see testexactpermission(). pruint32 testexactpermissionfromprincipal( in nsiprincipal principal, in string type ); parameters principal the principal to be tested. type a case-sensitive ascii string, identify...
...And 3 more matches
nsITransferable
nsferable was created. native code only! requestingnode nsidomnode the source dom node this transferable was created from. native code only! note: currently, this can only be used on windows (in order to support network principal information in drag operations). constants kflavorhasdataprovider (that title needs to be better) constant value description kflavorhasdataprovider 0 a description is needed here. common mime types some of these need better descriptions, especially the mozilla-specific ones. constant value description ktextmime text/plain plain text. kunicodemime text/unicode unicode text. kmoztextinternal text/x-moz-text-internal tex...
...lavor( in string adataflavor ); parameters adataflavor a string defining a new data flavor that the transferable supports. flavorstransferablecanexport() returns a list of flavors (mime types as nsisupportscstring) that the transferable can export, either through intrinsic knowledge or output data converters. nsisupportsarray flavorstransferablecanexport(); parameters none. ...
...t data converters. nsisupportsarray flavorstransferablecanexport(); parameters none. return value missing description flavorstransferablecanimport() computes a list of flavors (mime types as nsisupportscstring) that the transferable can accept into it, either through intrinsic knowledge or input data converters. nsisupportsarray flavorstransferablecanimport(); parameters none. return value missing description getanytransferdata() returns the best flavor in the transferable, given those that have been added to it with adddataflavor(). void getanytransferdata( out string aflavor, out nsisupports adata, out unsigned long adatalen ); parameters aflavor on return, contains the flavor of data that was retrieved. adata on return, this is the data itself, which is an inst...
...And 3 more matches
ArrayType
e 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 property type description elementtype ...
..., this is simply the string that was passed to the constructor. for other function, pointer, and array types, this should be a valid c type expression. ptr ctype returns a ctype representing the data type "pointer to this type". this is the result of calling ctypes.pointertype(the_type). read only. size number the size of the type, in bytes. this is the same value as the c sizeof. read only. note: ctypes.void_t.size is undefined. method overview methods inherited from ctype ctype array([n]) string tosource() string tostring() arraytype cdata syntax cdata sized_arraytype(); cdata unsized_arraytype(length); sized_arraytype and unsized_arraytype are arraytype ctype. parameters length the number of en...
...ethod overview methods inherited from ctype ctype array([n]) string tosource() string tostring() arraytype cdata syntax cdata sized_arraytype(); cdata unsized_arraytype(length); sized_arraytype and unsized_arraytype are arraytype ctype. parameters length the number of entries the array type should be able to contain. only for unsized arraytype. return value a cdata representing the newly allocated array. exceptions thrown typeerror length is not provided for unsized array, or is provided for sized array. arraytype cdata properties property type description length number the length of the array. read only. in addition, each element in the array can be referenced by index using standard bracket notation, s...
...And 3 more matches
StructType
structtype represents c structures. syntax returns a ctype object describing a new structure data type. this data type provides the ability to define and manipulate values of the c struct type. note: at this time, there isn't a way to denote a packed structure (that is, one created in c using #pragma pack). ctype structtype( name[, fields] ); parameters name the name of the structure. must be a string. fields optional an array of field descriptors, describing all the entries in the structure. if this isn't specified, the structure is considered opaque and you can't access its contents directly. ...
...e name of the structure. must be a string. fields optional an array of field descriptors, describing all the entries in the structure. if this isn't specified, the structure is considered opaque and you can't access its contents directly. you can call the resulting type's define() method to assign it a non-opaque type later. see opaque structures for further explanation and an example. return value a ctype object describing the newly created struct data type. exceptions thrown typeerror the name is not a string, or one or more of the fields does not have a defined size. rangeerror the size of the structure, in bytes, cannot be represented both as a size_t and as a javascript number. describing fields the fields array is comprised of field descriptors, one for each field in the st...
..., this is simply the string that was passed to the constructor. for other function, pointer, and array types, this should be a valid c type expression. ptr ctype returns a ctype representing the data type "pointer to this type". this is the result of calling ctypes.pointertype(the_type). read only. size number the size of the type, in bytes. this is the same value as the c sizeof. read only. note: ctypes.void_t.size is undefined. method overview define(fields) methods inherited from ctype ctype array([n]) string tosource() string tostring() methods define() defines a previously declared opaque type's fields. this lets you convert an opaque structure type into a defined structure type. d...
...And 3 more matches
Index - Firefox Developer Tools
this chart lists colors and css variables as implemented in the dark theme and light theme for developer tools. 31 eyedropper firefox, tools, web development:tools the eyedropper tool enables you to select colors in the current page. it works like a magnifying glass over the page, enabling you to select with pixel precision. underneath the magnifying glass it shows the color value for the current pixel using whichever scheme you've selected in settings > inspector > default color unit: 34 index tools found 158 pages: 35 json viewer firefox includes a json viewer. if you open a json file in the browser, or view a remote url with the content-type set to application/json, it is parsed and given syntax highlighting. arrays and objects...
...this guide walks you through all of the available options. 60 edit fonts fonts, guide, inspector, tools, variable fonts this article provides a tour of the font tools available in the firefox devtools. this tool contains several useful features for viewing and manipulating fonts applied to any document loaded in the browser including inspection of all fonts applied to the p...
...le options. 60 edit fonts fonts, guide, inspector, tools, variable fonts this article provides a tour of the font tools available in the firefox devtools. this tool contains several useful features for viewing and manipulating fonts applied to any document loaded in the browser including inspection of all fonts applied to the page, and precise adjustment of variable font axis values. 61 examine event listeners guide, inspector, tools the inspector shows the word "event" next to elements in the html pane, that have event listeners bound to them: 62 examine and edit css guide, inspector, tools you can examine and edit css in the inspector's css pane. 63 examine and edit html debugging, firefox, guide, inspector, mozilla...
...And 3 more matches
AnalyserNode - Web APIs
nt-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">analysernode</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constructor analysernode() creates a new instance of an analysernode object. properties inherits properties from its parent, audionode. ...
... #0095dd; pointer-events: all;} constructor analysernode() creates a new instance of an analysernode object. properties inherits properties from its parent, audionode. analysernode.fftsize is an unsigned long value representing the size of the fft (fast fourier transform) to be used to determine the frequency domain. analysernode.frequencybincount read only is an unsigned long value half that of the fft size. this generally equates to the number of data values you will have to play with for the visualization. ...
...onode. analysernode.fftsize is an unsigned long value representing the size of the fft (fast fourier transform) to be used to determine the frequency domain. analysernode.frequencybincount read only is an unsigned long value half that of the fft size. this generally equates to the number of data values you will have to play with for the visualization. analysernode.mindecibels is a double value representing the minimum power value in the scaling range for the fft analysis data, for conversion to unsigned byte values — basically, this specifies the minimum value for the range of results when using getbytefrequencydata(). ...
...And 3 more matches
Attr - Web APIs
Web › API › Attr
he property. gecko outputs a deprecation note starting from gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4). this note was removed again in gecko 49.0 (firefox 49.0 / thunderbird 49.0 / seamonkey 2.46). specified read only this property always returns true. originally, it returned true if the attribute was explicitly specified in the source code or by a script, and false if its value came from the default one defined in the document's dtd. value the attribute's value. note: dom level 3 defined namespaceuri, localname and prefix on the node interface. in dom4 they were moved to attr. this change is implemented in chrome since version 46.0 and firefox since version 48.0. deprecated properties and methods the following properties have been deprecated. where available, t...
...eprecated. where available, the appropriate replacement is noted. attributes this property now always returns null. childnodes obsolete since gecko 14 this property now always returns an empty nodelist. firstchild obsolete since gecko 14 this property now always returns null. isid read only indicates whether the attribute is an "id attribute". an "id attribute" being an attribute which value is expected to be unique across a dom document. in html dom, "id" is the only id attribute, but xml documents could define others. whether or not an attribute is unique is often determined by a dtd or other schema description. lastchild obsolete since gecko 14 this property now always returns null. nextsibling this property now always returns null. nodename use attr.name instead. nodetype ...
...m, "id" is the only id attribute, but xml documents could define others. whether or not an attribute is unique is often determined by a dtd or other schema description. lastchild obsolete since gecko 14 this property now always returns null. nextsibling this property now always returns null. nodename use attr.name instead. nodetype this property now always returns 2 (attribute_node). nodevalue use attr.value instead. ownerdocument you shouldn't have been using this in the first place, so you probably don't care that this is going away. parentnode this property now always returns null. previoussibling this property now always returns null. schematypeinfo read only the type information associated with this attribute. while the type information contained in this attribute is g...
...And 3 more matches
AudioContext() - Web APIs
presented by an audionode. syntax var audioctx = new audiocontext(); var audioctx = new audiocontext(options); parameters options optional an object based on the audiocontextoptions dictionary that contains zero or more optional properties to configure the new context. available properties are as follows: latencyhint optional the type of playback that the context will be used for, as a value from the audiocontextlatencycategory enum or a double-precision floating-point value indicating the preferred maximum latency of the context in seconds. the user agent may or may not choose to meet this request; check the value of audiocontext.baselatency to determine the true latency after creating the context. samplerate optional the samplerate to be used by the audiocontext, specified in sam...
... exceptions notsupportederror the specified samplerate isn't supported by the context. ...
... exceptions notsupportederror the specified samplerate isn't supported by the context. ...
...And 3 more matches
BaseAudioContext.createPanner() - Web APIs
en update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer p...
...e panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); var zpos = 295; // define ...
...window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); var panner = audioctx.createpanner(); panner.panningmodel = 'hrtf'; panner.distancemodel = 'inverse'; panner.refdistance = 1; panner.maxdistance = 10000; panner.rollofffactor = 1; panner.coneinnerangle = 360; panner.coneouterangle = 0; panner.coneoutergain = 0; if(panner.orientationx) { panner.orientationx.setvalueattime(1, audioctx.currenttime); panner.orientationy.setvalueattime(0, audioctx.currenttime); panner.orientationz.setvalueattime(0, audioctx.currenttime); } else { panner.setorientation(1,0,0); } var listener = audioctx.listener; if(listener.forwardx) { listener.forwardx.setvalueattime(0, audioctx.currenttime); listener.forwardy.setvalueattime(0, audioctx.currenttime); listener.forwa...
...And 3 more matches
BiquadFilterNode.detune - Web APIs
example the following example shows basic usage of an audiocontext to create a biquad filter node. ...
... example the following example shows basic usage of an audiocontext to create a biquad filter node. ...
... example the following example shows basic usage of an audiocontext to create a biquad filter node. ...
...And 3 more matches
BiquadFilterNode.type - Web APIs
the type property of the biquadfilternode interface is a string (enum) value defining the kind of filtering algorithm the node is implementing. syntax var audioctx = new audiocontext(); var biquadfilter = audioctx.createbiquadfilter(); biquadfilter.type = 'lowpass'; value a string (enum) representing a biquadfiltertype. type values and their meaning type description frequency q gain lowpass standard second-order resonant lowpass filter with 12db/octave rolloff. frequencies below the cutoff pass through; frequencies above it are attenuated. the cutoff frequency. indicates how peaked the frequency is around the cutoff. the greater the value is, the greater is the peak. not used highpass standard second-order resonant highpass filter w...
.... indicates how peaked the frequency is around the cutoff. the greater the value is, the greater is the peak. not used highpass standard second-order resonant highpass filter with 12db/octave rolloff. frequencies below the cutoff are attenuated; frequencies above it pass through. the cutoff frequency. indicates how peaked the frequency is around the cutoff. the greater the value, the greater the peak. not used bandpass standard second-order bandpass filter. frequencies outside the given range of frequencies are attenuated; the frequencies inside it pass through. the center of the range of frequencies. controls the width of the frequency band. the greater the q value, the larger the frequency band. not used lowshelf standard second-orde...
...imit of the frequencies getting a boost or an attenuation. not used the boost, in db, to be applied; if negative, it will be an attenuation. peaking frequencies inside the range get a boost or an attenuation; frequencies outside it are unchanged. the middle of the frequency range getting a boost or an attenuation. controls the width of the frequency band. the greater the q value, the larger the frequency band. the boost, in db, to be applied; if negative, it will be an attenuation. notch standard notch filter, also called a band-stop or band-rejection filter. it is the opposite of a bandpass filter: frequencies outside the give range of frequencies pass through; frequencies inside it are attenuated. the center of the range of frequencies. controls th...
...And 3 more matches
BluetoothCharacteristicProperties - Web APIs
the bluetoothcharacteristicproperties interface of the the web bluetooth api provides the operations that are valid on the given bluetoothremotegattcharacteristic. this interface is returned by calling bluetoothremotegattcharacteristic.properties. properties authenticatedsignedwritesread only returns a boolean that is true if signed writing to the characteristic value is permitted. ...
...es the operations that are valid on the given bluetoothremotegattcharacteristic. this interface is returned by calling bluetoothremotegattcharacteristic.properties. properties authenticatedsignedwritesread only returns a boolean that is true if signed writing to the characteristic value is permitted. broadcastread only returns a boolean that is true if the broadcast of the characteristic value is permitted using the server characteristic configuration descriptor. indicateread only returns a boolean that is true if indications of the characteristic value with acknowledgement is permitted. notifyread only returns a boolean that is true if notifications of the characteristic value without acknowledgement is permitted. readread only returns a boolean that is true if the reading of...
... reliablewriteread only returns a boolean that is true if reliable writes to the characteristic is permitted. writableauxiliariesread only returns a boolean that is true if reliable writes to the characteristic descriptor is permitted. ...
...And 3 more matches
BluetoothRemoteGATTCharacteristic - Web APIs
of the web bluetooth api represents a gatt characteristic, which is a basic data element that provides further information about a peripheral’s service. ...
... blue...
... bluetoothremotegattcharacteristic.
...And 3 more matches
CSSMathSum - Web APIs
the cssmathsum interface of the css typed object model api represents the result obtained by calling add(), sub(), or tosum() on cssnumericvalue. a cssmathsum is the object type returned when the stylepropertymapreadonly.get() method is used on a css property whosevalue is created with a calc() function. constructor cssmathsum.cssmathsum() creates a new cssmathsum object. properties cssmathsum.values returns a cssnumericarray object which contains one or more cssnumericvalue objects. event handlers no methods none. examples we create an element with a width determined using a calc() function, then console.log() the operator and values, and dig into the values a bit. <div>has width</div> we assign a width div { width: calc(30% - 20px); } we add the javascript cons...
...ne. examples we create an element with a width determined using a calc() function, then console.log() the operator and values, and dig into the values a bit. ...
... the values a bit. ...
...And 3 more matches
Pixel manipulation with canvas - Web APIs
w to save images from your canvas. the imagedata object the imagedata object represents the underlying pixel data of an area of a canvas object. it contains the following read-only attributes: width the width of the image in pixels. height the height of the image in pixels. data a uint8clampedarray representing a one-dimensional array containing the data in the rgba order, with integer values between 0 and 255 (included). the data property returns a uint8clampedarray which can be accessed to look at the raw pixel data; each pixel is represented by four one-byte values (red, green, blue, and alpha, in that order; that is, "rgba" format). each color component is represented by an integer between 0 and 255. each component is assigned a consecutive index within the array, with the top ...
...at order; that is, "rgba" format). each color component is represented by an integer between 0 and 255. each component is assigned a consecutive index within the array, with the top left pixel's red component being at index 0 within the array. pixels then proceed from left to right, then downward, throughout the array. ...
...en 0 and 255. each component is assigned a consecutive index within the array, with the top left pixel's red component being at index 0 within the array. pixels then proceed from left to right, then downward, throughout the array. the uint8clampedarray contains height × width × 4 bytes of data, with index values ranging from 0 to (height×width×4)-1. ...
...And 3 more matches
DOMPoint.w - Web APIs
Web › API › DOMPoint › w
the default is 1.0. ...
...the default is 1.0. ...
...the default is 1.0. ...
...And 3 more matches
Element.getAttributeNS() - Web APIs
if the attribute doesn't exist, the result is null. ...
...if the attribute doesn't exist, the result is null. ...
...if the attribute doesn't exist, the result is null. note: earlier versions of the dom specification had this method described as returning an empty string for non-existent attributes, but it was not typically implemented this way since null makes more sense. ...
...And 3 more matches
Element.scrollTop - Web APIs
Web › API › Element › scrollTop
syntax // get the number of pixels scrolled. ...
... syntax // get the number of pixels scrolled. ...
...lue is a measurement of the distance from the element's top to its topmost visible content. when an element's content does not generate a vertical scrollbar, then its scrolltop value is 0. when scrolltop is used on the root element (the <html> element), the scrolly of the window is returned. this is a special case of scrolltop. on systems using display scaling, scrolltop may give you a decimal value. syntax // get the number of pixels scrolled. ...
...And 3 more matches
ElementCSSInlineStyle.style - Web APIs
see the css properties reference for a list of the css properties accessible via style. the style property has the same (and highest) priority in the css cascade as an inline style declaration set via the style attribute. ...
...he same (and highest) priority in the css cascade as an inline style declaration set via the style attribute. setting styles styles should not be set by assigning a string directly to the style property (as in elt.style = "color: blue;"), since it is considered read-only, as the style attribute returns a cssstyledeclaration object which is also read-only. instead, styles can be set by assigning values to the properties of style. for adding specific styles to an element without altering other style values, it is preferred to use the individual properties of style (as in elt.style.color = '...') as using elt.style.csstext = '...' or elt.setattribute('style', '...') sets the complete inline style for the element by overriding the existing inline styles. note that the property names are in camel-...
...r an empty string, e.g., elt.style.color = null. internet explorer requires setting it to an empty string, and does not do anything when setting it to null. ...
...And 3 more matches
EventTarget.removeEventListener() - Web APIs
stered listener before being dispatched to any eventtarget beneath it in the dom tree. mozsystemgroup: available only in code running in xbl or in firefox' chrome, it is a boolean defining if the listener is added to the system group. usecapture optional specifies whether the eventlistener to be removed is registered as a capturing listener or not. ...
...usecapture optional specifies whether the eventlistener to be removed is registered as a capturing listener or not. if this parameter is absent, a default value of false is assumed. if a listener is registered twice, one with capture and one without, remove each one separately. removal of a capturing listener does not affect a non-capturing version of the same listener, and vice versa. return value undefined matching event listeners for removal given an event listener previously added by calling addeventlistener(), you may eventually come to a point at which you need to remove it. obviously, you need to specify the same type and listener parameters to removeeventlistener(). but what about the options or usecapture parameters? while addeventlistener() will let you add the same listener m...
...ome to a point at which you need to remove it. obviously, you need to specify the same type and listener parameters to removeeventlistener(). but what about the options or usecapture parameters? while addeventlistener() will let you add the same listener more than once for the same type if the options are different, the only option removeeventlistener() checks is the capture/usecapture flag. its value must match for removeeventlistener() to match, but the other values don't. for example, consider this call to addeventlistener(): element.addeventlistener("mousedown", handlemousedown, true); now consider each of these two calls to removeeventlistener(): element.removeeventlistener("mousedown", handlemousedown, false); // fails element.removeeventlistener("mousedown", handlemousedown, tru...
...And 3 more matches
Gamepad.buttons - Web APIs
Web › API › Gamepad › buttons
the gamepad.buttons property of the gamepad interface returns an array of gamepadbutton objects representing the buttons present on the device. each entry in the array is 0 if the button is not pressed, and non-zero (typically 1.0) if the button is pressed. each gamepadbutton object has two properties: pressed and value: the pressed property is a boolean indicating whether the button is currently pressed (true) or unpressed (false). the value property is a floating point value used to enable representing analog buttons, such as the triggers on many modern gamepads. the values are normalized to the range 0.0 – 1.0, with 0.0 representing a button that is not pressed, and 1.0 representing a button that is fully pressed. syntax readonly attribute gamepadbutton[] buttons; example ...
... 1.0, with 0.0 representing a button that is not pressed, and 1.0 representing a button that is fully pressed. syntax readonly attribute gamepadbutton[] buttons; example the following code is taken from my gamepad api button demo (you can view the demo live, and find the source code on github.) note the code fork — in chrome navigator.getgamepads needs a webkit prefix and the button values are stores as an array of double values, whereas in firefox navigator.getgamepads doesn't need a prefix, and the button values are stored as an array of gamepadbutton objects; it is the gamepadbutton.value or gamepadbutton.pressed properties of these we need to access, depending on what type of buttons they are. in this simple example i've just allowed either. function gameloop() { if(navigat...
...ample i've just allowed either. ...
...And 3 more matches
HTMLElement - Web APIs
d implements those from documentandelementeventhandlers, elementcssinlinestyle, globaleventhandlers, htmlorforeignelement and toucheventhandlers. htmlelement.accesskey is a domstring representing the access key assigned to the element. htmlelement.accesskeylabel read only returns a domstring containing the element's assigned access key. htmlelement.contenteditable is a domstring, where a value of true means the element is editable and a value of false means it isn't. htmlelement.iscontenteditable read only returns a boolean that indicates whether or not the content of the element can be edited. htmlelement.contextmenu is a htmlmenuelement representing the contextual menu associated with the element. it may be null. htmlorforeignelement.dataset read only returns a domstringmap...
...element.contextmenu is a htmlmenuelement representing the contextual menu associated with the element. it may be null. htmlorforeignelement.dataset read only returns a domstringmap with which script can read and write the element's custom data attributes (data-*) . htmlelement.dir is a domstring, reflecting the dir global attribute, representing the directionality of the element. possible values are "ltr", "rtl", and "auto". htmlelement.draggable is a boolean indicating if the element can be dragged. htmlelement.dropzone read only returns a domsettabletokenlist reflecting the dropzone global attribute and describing the behavior of the element regarding a drop operation. htmlelement.hidden is a boolean indicating if the element is hidden or not. htmlelement.inert is a boolean i...
... cursor and then copied it to the clipboard. htmlelement.itemscope is a boolean representing the item scope. htmlelement.itemtype read only returns a domsettabletokenlist… htmlelement.itemid is a domstring representing the item id. htmlelement.itemref read only returns a domsettabletokenlist… htmlelement.itemprop read only returns a domsettabletokenlist… htmlelement.itemvalue returns a object representing the item value. htmlelement.lang is a domstring representing the language of an element's attributes, text, and element contents. htmlelement.nomodule is a boolean indicating whether an import script can be executed in user agents that support module scripts. htmlorforeignelement.nonce returns the cryptographic number used once that is used by content securi...
...And 3 more matches
HTMLOptionElement - Web APIs
/><text x="406" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmloptionelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmloptionelement.defaultselected is a boolean that contains the initial value of the selected html attribute, indicating whether the option is selected by default or not. htmloptionelement.disabled is a boolean representing the value of the disabled html attribute, which indicates that the option is unavailable to be selected. an option can also be disabled if it is a child of an <optgroup> element that is disabled. htmloptionelement.form read only is a htmlformelem...
...ibute, indicating whether the option is selected by default or not. htmloptionelement.disabled is a boolean representing the value of the disabled html attribute, which indicates that the option is unavailable to be selected. an option can also be disabled if it is a child of an <optgroup> element that is disabled. htmloptionelement.form read only is a htmlformelement representing the same value as the form of the corresponding <select> element, if the option is a descendant of a <select> element, or null if none is found. htmloptionelement.index read only is a long representing the position of the option within the list of options it belongs to, in tree-order. if the option is not part of a list of options, like when it is part of the <datalist> element, the value is 0. htmloptio...
...ption is a descendant of a <select> element, or null if none is found. htmloptionelement.index read only is a long representing the position of the option within the list of options it belongs to, in tree-order. if the option is not part of a list of options, like when it is part of the <datalist> element, the value is 0. htmloptionelement.label read only is a domstring that reflects the value of the label html attribute, which provides a label for the option. ...
...And 3 more matches
HTMLTableCellElement - Web APIs
mlelement. htmltablecellelement.abbr a domstring which can be used on <th> elements (not on <td>), specifying an alternative label for the header cell.. this alternate label can be used in other contexts, such as when describing the headers that apply to a data cell. this is used to offer a shorter term for use by screen readers in particular, and is a valuable accessibility tool. usually the value of abbr is an abbreviation or acronym, but can be any text that's appropriate contextually. htmltablecellelement.cellindex read only a long integer representing the cell's position in the cells collection of the <tr> the cell is contained within. if the cell doesn't belong to a <tr>, it returns -1. htmltablecellelement.colspan an unsigned long integer indicating the number of columns this ce...
... a cell occupy space across multiple rows of the table. it reflects the rowspan attribute. htmltablecellelement.scope a domstring indicating the scope of a <th> cell. header cells can be configured, using the scope property, the apply to a specified row or column, or to the not-yet-scoped cells within the current row group (that is, the same ancestor <thead>, <tbody>, or <tfoot> element). if no value is specified for scope, the header is not associated directly with cells in this way. permitted values for scope are: col the header cell applies to the following cells in the same column (or columns, if colspan is used as well), until either the end of the column or another <th> in the column establishes a new scope. colgroup the header cell applies to all cells in the current column g...
...ly with cells in this way. permitted values for scope are: col the header cell applies to the following cells in the same column (or columns, if colspan is used as well), until either the end of the column or another <th> in the column establishes a new scope. colgroup the header cell applies to all cells in the current column group that do not already have a scope applied to them. this value is only allowed if the cell is in a column group. row the header cell applies to the following cells in the same row (or rows, if rowspan is used as well), until either the end of the row or another <th> in the same row establishes a new scope. ...
...And 3 more matches
IDBIndex - Web APIs
Web › API › IDBIndex
e indexeddb api provides asynchronous access to an index in a database. an index is a kind of object store for looking up records in another object store, called the referenced object store. you use this interface to retrieve data. you can retrieve records in an object store through the primary key or by using an index. an index lets you look up records in an object store using properties of the values in the object stores records other than the primary key the index is a persistent key-value storage where the value part of its records is the key part of a record in the referenced object store. the records in an index are automatically populated whenever records in the referenced object store are inserted, updated, or deleted. each record in an index can point to only one record in its refere...
...ore, but several indexes can reference the same object store. when the object store changes, all indexes that refers to the object store are automatically updated. you can grab a set of keys within a range. to learn more, see idbkeyrange. note: this feature is available in web workers. properties idbindex.isautolocale read only returns a boolean indicating whether the index had a locale value of auto specified upon its creation (see createindex()'s optionalparameters.) idbindex.locale read only returns the locale of the index (for example en-us, or pl) if it had a locale value specified upon its creation (see createindex()'s optionalparameters.) idbindex.name the name of this index. idbindex.objectstore read only the name of the object store referenced by this index. idbind...
...s index. if null, this index is not auto-populated. idbindex.multientry read only affects how the index behaves when the result of evaluating the index's key path yields an array. if true, there is one record in the index for each item in an array of keys. if false, then there is one record for each key that is an array. idbindex.unique read only if true, this index does not allow duplicate values for a key. methods inherits from: eventtarget idbindex.count() returns an idbrequest object, and in a separate thread, returns the number of records within a key range. idbindex.get() returns an idbrequest object, and, in a separate thread, finds either the value in the referenced object store that corresponds to the given key or the first corresponding value, if key is an idbkeyrange. ...
...And 3 more matches
IDBKeyRange.lowerBound() - Web APIs
the lowerbound() method of the idbkeyrange interface creates a new key range with only a lower bound. by default, it includes the lower endpoint value and is closed. note: this feature is available in web workers. syntax var myidbkeyrange = idbkeyrange.lowerbound(lower); var myidbkeyrange = idbkeyrange.lowerbound(lower, open); parameters lower specifies the lower bound of the new key range. open optional indicates whether the lower bound excludes the endpoint value. the default is false. return value idbkeyrange: the newly created key range. exceptions this method may raise a domexception of the following type: exception description dataerror the value parameter passed was not a valid key. example the following example i...
... value. the default is false. return value idbkeyrange: the newly created key range. exceptions this method may raise a domexception of the following type: exception description dataerror the value parameter passed was not a valid key. example the following example illustrates how you'd use a lower bound key range. here we declare keyrangevalue = idbkeyrange.lowerbound("f", false); — a range that includes the value "f" and everthing after it. we open a transaction (using idbtransaction) and an object store, and open a cursor with idbobjectstore.opencursor, declaring keyrangevalue as its optional key range value. this means that the cursor will only retrieve the record with the key value "f" and all that come after it. if we used idbke...
... and everthing after it. we open a transaction (using idbtransaction) and an object store, and open a cursor with idbobjectstore.opencursor, declaring keyrangevalue as its optional key range value. this means that the cursor will only retrieve the record with the key value "f" and all that come after it. if we used idbkeyrange.lowerbound("f", true);, then the range would not include "f"; only the values after it. ...
...And 3 more matches
KeyboardEvent.code - Web APIs
the keyboardevent.code property represents a physical key on the keyboard (as opposed to the character generated by pressing the key). in other words, this property returns a value that isn't altered by keyboard layout or the state of the modifier keys. if the input device isn't a physical keyboard, but is instead a virtual keyboard or accessibility device, the returned value will be set by the browser to match as closely as possible to what would happen with a physical keyboard, to maximize compatibility between physical and virtual input devices. this property is useful when you want to handle keys based on their physical positions on the input device rather than the characters associated with those keys; this is especially common when writing code to handle input for games that simulate a...
...mpatibility between physical and virtual input devices. this property is useful when you want to handle keys based on their physical positions on the input device rather than the characters associated with those keys; this is especially common when writing code to handle input for games that simulate a gamepad-like environment using keys on the keyboard. ...
...the keyboard. be aware, however, that you can't use the value reported by keyboardevent.code to determine the character generated by the keystroke, because the keycode's name may not match the actual character that's printed on the key or that's generated by the computer when the key is pressed. for example, the code returned is "keyq" for the q key on a qwerty layout keyboard, but the same code value also represents the ' key on dvorak keyboards and the a key on azerty keyboards. that makes it impossible to use the value of code to determine what the name of the key is to users if they're not using an anticipated keyboard layout. to determine what character corresponds with the key event, use the keyboardevent.key property instead. ...
...And 3 more matches
MediaStream.ended - Web APIs
Web › API › MediaStream › ended
specifications no longer part of any specification. ...
... specifications no longer part of any specification. ...
... specifications no longer part of any specification. ...
...And 3 more matches
MediaTrackSettings.noiseSuppression - Web APIs
noise suppression automatically filters the audio to remove background noise, hum caused by equipment, and the like from the sound before delivering it to your code. ...
... noise suppression automatically filters the audio to remove background noise, hum caused by equipment, and the like from the sound before delivering it to your code. ...
... noise suppression automatically filters the audio to remove background noise, hum caused by equipment, and the like from the sound before delivering it to your code. ...
...And 3 more matches
Using the Media Capabilities API - Web APIs
method takes as a parameter a media decoding configuration. there are very specific ways to go about creating the configuration defined by the mediadecodingconfiguration dictionary. in our example, we are testing the decoding capabilities of a video configuration. the configuration requires the type of media being tested — e.g. a plain file or mediasource — and a videoconfiguration including values for the contenttype, width, height, bitrate, and framerate: the contenttype must be a string specifying a valid video mime type. the width and height are the horizontal and vertical dimensions of the video; these are also used to determine the aspect ratio. the bitrate is the number of bits used to encode one second of video. the framerate is the number of frames which are played per secon...
...d power efficient. var promise = navigator.mediacapabilities.decodinginfo(videoconfiguration); the decodinginfo() and encodinginfo() methods both return promises. once the promises state is fulfilled, you can access the mediacapabilitiesinfo interface's supported, smooth, and powerefficient properties. ...
...t.powerefficient ? '' : 'not ') + 'power efficient.') }); the response provided is defined by the mediacapabilitiesinfo interface. handling errors in our video decoding example, a typeerror would be raised if the media configuration passed to the decodinginfo() method was invalid. there are a few reasons why an error might occur, including: the specified type isn't one of the two permtited values: file or media-source the contenttype given is the error can be due to the type not being one of the two possible values, the contenttype not being a valid codec mime type, or invalid or omitted definitions required in the videoconfiguration. navigator.mediacapabilities.decodinginfo(videoconfiguration).then( console.log('it worked') ).catch(error => console.log('it failed: ' + error) ); ...
...And 3 more matches
MouseEvent() - Web APIs
the mouseevent() constructor creates a new mouseevent. syntax event = new mouseevent(typearg, mouseeventinit); values typearg is a domstring representing the name of the event. mouseeventinit optional is a mouseeventinit dictionary, having the following fields: "screenx", optional and defaulting to 0, of type long, that is the horizontal position of the mouse event on the user's screen; setting this value doesn't move the mouse pointer. "screeny", optional and defaulting to 0, of type long, that is the vertical position of the mouse event on the user's screen; setting this value doesn't move the mouse pointer. "clientx", optional and defaulting to 0, of type long, that is the horizontal position of the mouse event on the client window of user's screen; setting th...
... "ctrlkey", optional and defaulting to false, of type boolean, that indicates if the ctrl key was simultaneously pressed. ...
... "ctrlkey", optional and defaulting to false, of type boolean, that indicates if the ctrl key was simultaneously pressed. "shiftkey", optional and defaulting to false, of type boolean, that indicates if the shift key was simultaneously pressed. ...
...And 3 more matches
Node - Web APIs
Web › API › Node
a domstring containing the name of the node. the structure of the name will differ with the node type. e.g. an htmlelement will contain the name of the corresponding tag, like 'audio' for an htmlaudioelement, a text node will have the '#text' string, or a document node will have the '#document' string. node.nodetyperead only returns an unsigned short representing the type of the node. ...
... the node. the structure of the name will differ with the node type. e.g. an htmlelement will contain the name of the corresponding tag, like 'audio' for an htmlaudioelement, a text node will have the '#text' string, or a document node will have the '#document' string. node.nodetyperead only returns an unsigned short representing the type of the node. ...
... node.ownerdocumentread only returns the document that this node belongs to. if the node is itself a document, returns null. node.parentnoderead only returns a node that is the parent of this node. if there is no such node, like if this node is the top of the tree or if doesn't participate in a tree, this property returns null. node.parenteleme...
...And 3 more matches
PannerNode.coneOuterGain - Web APIs
the coneoutergain property of the pannernode interface is a double value, describing the amount of volume reduction outside the cone, defined by the coneouterangle attribute. the coneoutergain property's default value is 0, meaning that no sound can be heard outside the cone. syntax var audioctx = new audiocontext(); var panner = audioctx.createpanner(); panner.coneoutergain = 0; value a double. the default is 0, and its value can be in the range 0–1. exceptions invalidstateerror the property has been given a value outside the accepted range (0–1). example in this example, we'll demonstrate how changing the orientation parameters of a pannernode in combination with coneinnerangle and coneouterangle affects volume. to help us visualise how the orientation vector affects, we c...
...ectly at the listener at 0° rotation. // this utility converts amount of rotation around the y axis // (i.e. rotation in the 'horizontal plane') to an orientation vector const yrotationtovector = degrees => { // convert degrees to radians and offset the angle so 0 points towards the listener const radians = (degrees - 90) * (math.pi / 180); // using cosine and sine here ensures the output values are always normalised // i.e. they range between -1 and 1 const x = math.cos(radians); const z = math.sin(radians); // we hard-code the y component to 0, as y is the axis of rotation return [x, 0, z]; }; now we can create our audiocontext, an oscillator and a pannernode: const context = new audiocontext(); const osc = new oscillatornode(context); osc.type = 'sawtooth'; const pann...
...y is the axis of rotation return [x, 0, z]; }; now we can create our audiocontext, an oscillator and a pannernode: const context = new audiocontext(); const osc = new oscillatornode(context); osc.type = 'sawtooth'; const panner = new pannernode(context); panner.panningmodel = 'hrtf'; next, we set up the cone of our spatialised sound, determining the area in which it can be heard: // this value determines the size of the area in which the sound volume is constant // if coneinnerangle == 30, it means that when the sound is rotated // by at most 15 (30/2) degrees either direction, the volume won't change panner.coneinnerangle = 30; // this value determines the size of the area in which the sound volume decreases gradually // if coneouterangle == 45 and coneinnerangle == 30, it means that ...
...And 3 more matches
PannerNode.orientationX - Web APIs
the sound (as specified using the attributes coneinnerangle, coneouterangle, and coneoutergain), the orientation of the sound may alter the perceived volume of the sound as it's being played. if the sound is pointing toward the listener, it will be louder than if the sound is pointed away from the listener. the audioparam contained by this property is read only; however, you can still change the value of the parameter by assigning a new value to its audioparam.value property. syntax var orientationx = pannernode.orientationx; pannernode.orientationx.value = neworientationx; value an audioparam whose value is the x component of the direction in which the audio source is facing, in 3d cartesian coordinate space. example in this example, we'll demonstrate how changing the orientation par...
...ectly at the listener at 0° rotation. // this utility converts amount of rotation around the y axis // (i.e. rotation in the 'horizontal plane') to an orientation vector const yrotationtovector = degrees => { // convert degrees to radians and offset the angle so 0 points towards the listener const radians = (degrees - 90) * (math.pi / 180); // using cosine and sine here ensures the output values are always normalised // i.e. they range between -1 and 1 const x = math.cos(radians); const z = math.sin(radians); // we hard-code the y component to 0, as y is the axis of rotation return [x, 0, z]; }; now we can create our audiocontext, an oscillator and a pannernode: const context = new audiocontext(); const osc = new oscillatornode(context); osc.type = 'sawtooth'; const pann...
...y is the axis of rotation return [x, 0, z]; }; now we can create our audiocontext, an oscillator and a pannernode: const context = new audiocontext(); const osc = new oscillatornode(context); osc.type = 'sawtooth'; const panner = new pannernode(context); panner.panningmodel = 'hrtf'; next, we set up the cone of our spatialised sound, determining the area in which it can be heard: // this value determines the size of the area in which the sound volume is constant // if coneinnerangle == 30, it means that when the sound is rotated // by at most 15 (30/2) degrees either direction, the volume won't change panner.coneinnerangle = 30; // this value determines the size of the area in which the sound volume decreases gradually // if coneouterangle == 45 and coneinnerangle == 30, it means that ...
...And 3 more matches
PannerNode.orientationY - Web APIs
the sound (as specified using the attributes coneinnerangle, coneouterangle, and codeoutergain), the orientation of the sound may alter the perceived volume of the sound as it's being played. if the sound is pointing toward the listener, it will be louder than if the sound is pointed away from the listener. the audioparam contained by this property is read only; however, you can still change the value of the parameter by assigning a new value to its audioparam.value property. syntax var orientationy = pannernode.orientationy; pannernode.orientationy.value = neworientationy; value an audioparam whose value is the y component of the direction the audio source is facing, in 3d cartesian coordinate space. example in this example, we'll demonstrate how changing the orientation parameters o...
...ectly at the listener at 0° rotation. // this utility converts amount of rotation around the y axis // (i.e. rotation in the 'horizontal plane') to an orientation vector const yrotationtovector = degrees => { // convert degrees to radians and offset the angle so 0 points towards the listener const radians = (degrees - 90) * (math.pi / 180); // using cosine and sine here ensures the output values are always normalised // i.e. they range between -1 and 1 const x = math.cos(radians); const z = math.sin(radians); // we hard-code the y component to 0, as y is the axis of rotation return [x, 0, z]; }; now we can create our audiocontext, an oscillator and a pannernode: const context = new audiocontext(); const osc = new oscillatornode(context); osc.type = 'sawtooth'; const pann...
...y is the axis of rotation return [x, 0, z]; }; now we can create our audiocontext, an oscillator and a pannernode: const context = new audiocontext(); const osc = new oscillatornode(context); osc.type = 'sawtooth'; const panner = new pannernode(context); panner.panningmodel = 'hrtf'; next, we set up the cone of our spatialised sound, determining the area in which it can be heard: // this value determines the size of the area in which the sound volume is constant // if coneinnerangle == 30, it means that when the sound is rotated // by at most 15 (30/2) degrees either direction, the volume won't change panner.coneinnerangle = 30; // this value determines the size of the area in which the sound volume decreases gradually // if coneouterangle == 45 and coneinnerangle == 30, it means that ...
...And 3 more matches
PannerNode.orientationZ - Web APIs
the sound (as specified using the attributes coneinnerangle, coneouterangle, and codeoutergain), the orientation of the sound may alter the perceived volume of the sound as it's being played. if the sound is pointing toward the listener, it will be louder than if the sound is pointed away from the listener. the audioparam contained by this property is read only; however, you can still change the value of the parameter by assigning a new value to its audioparam.value property. syntax var orientationz = pannernode.orientationz; pannernode.orientationz.value = neworientationz; value an audioparam whose value is the z component of the direction the audio source is facing, in 3d cartesian coordinate space. example in this example, we'll demonstrate how changing the orientation parameters o...
...ectly at the listener at 0° rotation. // this utility converts amount of rotation around the y axis // (i.e. rotation in the 'horizontal plane') to an orientation vector const yrotationtovector = degrees => { // convert degrees to radians and offset the angle so 0 points towards the listener const radians = (degrees - 90) * (math.pi / 180); // using cosine and sine here ensures the output values are always normalised // i.e. they range between -1 and 1 const x = math.cos(radians); const z = math.sin(radians); // we hard-code the y component to 0, as y is the axis of rotation return [x, 0, z]; }; now we can create our audiocontext, an oscillator and a pannernode: const context = new audiocontext(); const osc = new oscillatornode(context); osc.type = 'sawtooth'; const pann...
...y is the axis of rotation return [x, 0, z]; }; now we can create our audiocontext, an oscillator and a pannernode: const context = new audiocontext(); const osc = new oscillatornode(context); osc.type = 'sawtooth'; const panner = new pannernode(context); panner.panningmodel = 'hrtf'; next, we set up the cone of our spatialised sound, determining the area in which it can be heard: // this value determines the size of the area in which the sound volume is constant // if coneinnerangle == 30, it means that when the sound is rotated // by at most 15 (30/2) degrees either direction, the volume won't change panner.coneinnerangle = 30; // this value determines the size of the area in which the sound volume decreases gradually // if coneouterangle == 45 and coneinnerangle == 30, it means that ...
...And 3 more matches
PerformanceNavigationTiming - Web APIs
pointer-events: all;} properties this interface extends the following performanceentry properties for navigation performance entry types by qualifying and constraining them as follows: performanceentry.entrytype read only returns "navigation". performanceentry.name read only returns the document's address. performanceentry.starttime read only returns a domhighrestimestamp with a value of "0". performanceentry.duration read only returns a timestamp that is the difference between the performancenavigationtiming.loadeventend and performanceentry.starttime properties. this interface also extends following performanceresourcetiming properties for navigation performance entry types by qualifying and constraining them as follows: performanceresourcetiming.initiatortyperead on...
...rties. this interface also extends following performanceresourcetiming properties for navigation performance entry types by qualifying and constraining them as follows: performanceresourcetiming.initiatortyperead only returns "navigation". the interface also supports the following properties: performancenavigationtiming.domcomplete read only a domhighrestimestamp representing a time value equal to the time immediately before the browser sets the current document readiness of the current document to complete. performancenavigationtiming.domcontentloadedeventend read only a domhighrestimestamp representing the time value equal to the time immediately after the current document's domcontentloaded event completes. performancenavigationtiming.domcontentloadedeventstart read only ...
...owser sets the current document readiness of the current document to complete. performancenavigationtiming.domcontentloadedeventend read only a domhighrestimestamp representing the time value equal to the time immediately after the current document's domcontentloaded event completes. performancenavigationtiming.domcontentloadedeventstart read only a domhighrestimestamp representing the time value equal to the time immediately before the user agent fires the domcontentloaded event at the current document. performancenavigationtiming.dominteractive read only a domhighrestimestamp representing a timestamp representing the time value equal to the time immediately before the user agent sets the current document readiness of the current document to interactive. performancenavigationtiming.l...
...And 3 more matches
RTCIceTransport - Web APIs
access to information about the ice transport layer over which the data is being sent and received. this is particularly useful if you need to access state information about the connection. properties the rtcicetransport interface inherits properties from its parent, eventtarget. it also offers the following properties: component read only the ice component being used by the transport. ...
...erties the rtcicetransport interface inherits properties from its parent, eventtarget. it also offers the following properties: component read only the ice component being used by the transport. the value is one of the strings from the rtcicetransport enumerated type: "rtp" or "rtsp". gatheringstate read only a domstring indicating which gathering state the ice agent is currently in. the value is one of those included in the rtcicegathererstate enumerated type: "new", "gathering", or "complete". role read only returns a domstring whose value is one of the members of the rtcicerole enumerated type: "controlling" or "controlled"; this indicates whether the ice agent is the one that makes the final decision as to the candidate pair to use or not. state read only a domstring indicati...
...e enumerated type: "new", "gathering", or "complete". role read only returns a domstring whose value is one of the members of the rtcicerole enumerated type: "controlling" or "controlled"; this indicates whether the ice agent is the one that makes the final decision as to the candidate pair to use or not. state read only a domstring indicating what the current state of the ice agent is. the value of state can be used to determine whether the ice agent has made an initial connection using a viable candidate pair ("connected"), made its final selection of candidate pairs ("completed"), or in an error state ("failed"), among other states. see the rtcicetransportstate enumerated type for a complete list of states. methods also includes methods from eventtarget, the parent interface. get...
...And 3 more matches
RTCInboundRtpStreamStats.qpSum - Web APIs
the qpsum property of the rtcinboundrtpstreamstats dictionary is a value generated by adding the quantization parameter (qp) values for every frame sent or received to date on the video track corresponding to this rtcinboundrtpstreamstats object. in general, the higher this number is, the more heavily compressed the video data is. syntax var qpsum = rtcinboundrtpstreamstats.qpsum; value an unsigned 64-bit integer value which indicates the sum of the quantization parameter (qp) value for every frame sent or received so far on the track described by the rtcinboundrtpstreamstats object. ...
... to this rtcinboundrtpstreamstats object. in general, the higher this number is, the more heavily compressed the video data is. syntax var qpsum = rtcinboundrtpstreamstats.qpsum; value an unsigned 64-bit integer value which indicates the sum of the quantization parameter (qp) value for every frame sent or received so far on the track described by the rtcinboundrtpstreamstats object. since the value of qp is typically larger to indicate higher compression factors, the larger this sum is, the more heavily compressed the stream generally has been. note: this value is only available for video media. ...
... frame sent or received so far on the track described by the rtcinboundrtpstreamstats object. since the value of qp is typically larger to indicate higher compression factors, the larger this sum is, the more heavily compressed the stream generally has been. note: this value is only available for video media. usage notes quantization is the process of applying lossy compression to a range of values, resulting in a single quantum value. this value takes the place of the range of values, thereby reducing the number of different values that appear in the overall data set, making the data more compressible. ...
...And 3 more matches
RTCOutboundRtpStreamStats - Web APIs
the rtcoutboundrtpstreamstats dictionary is the rtcstats-based object which provides metrics and statistics related to an outbound rtp stream being sent by an rtcrtpsender. properties the rtcoutboundrtpstreamstats dictionary includes the following properties in addition to those it inherits from rtcsentrtpstreamstats, rtcrtpstreamstats, and rtcstats. averagertcpinterval a floating-point value indicating the average rtcp interval between two consecutive compound rtcp packets. fircount an integer value which indicates the total number of full intra request (fir) packets which this rtcrtpsender has sent to the remote rtcrtpreceiver. this is an indicator of how often the stream has lagged, requiring frames to be skipped in order to catch up. valid only for video streams. framesencoded th...
...esencoded the number of frames that have been successfully encoded so far for sending on this rtp stream. only valid for video streams. lastpacketsenttimestamp a domhighrestimestamp indicating the time at which the last packet was sent for this ssrc. the timestamp property, on the other hand, indicates the time at which the rtcoutboundrtpstreamstats object was generated. nackcount an integer value indicating the total number of negative acknolwedgement (nack) packets this rtcrtpsender has received from the remote rtcrtpreceiver. perdscppacketssent a record of key-value pairs with strings as the keys mapped to 32-bit integer values, each indicating the total number of packets this rtcrtpsender has transmitted for this source for each differentiated services code point (dscp). plicount a...
...al number of packets this rtcrtpsender has transmitted for this source for each differentiated services code point (dscp). plicount an integer specifying the number of times the remote receiver has notified this rtcrtpsender that some amount of encoded video data for one or more frames has been lost, using picture loss indication (pli) packets. only available for video streams. qpsum a 64-bit value containing the sum of the qp values for every frame encoded by this rtcrtpsender. valid only for video streams. qualitylimitationdurations a record mapping each of the quality limitation reasons in the rtcremoteinboundrtpstreamstats enumeration to a floating-point value indicating the number of seconds the stream has spent with its quality limited for that reason. qualitylimitationreason a va...
...And 3 more matches
RTCRemoteOutboundRtpStreamStats.localId - Web APIs
the rtcremoteoutboundrtpstreamstats dictionary's localid property is a string which can be used to identify the rtcinboundrtpstreamstats object whose remoteid matches this value. together, these two objects provide statistics about the inbound and outbound sides of the same synchronization source (ssrc). syntax let localid = rtcremoteoutboundrtpstreamstats.localid; value a domstring which can be compared to the value of an rtcinboundrtpstreamstats object's remoteid property to see if the two represent statistics for each of the two sides of the same set of data received by the local peer. usage notes you can think of the local and remote views of the same rtp stream as pairs, each of which has a reference back to the other one. thus, if an rtcstatsreport includes an remote-outbound-rtp ...
...rts together to determine several... xxx ... finding paired statistics each statistics record of type remote-outbound-rtp (describing a remote peer's statistics about sending data to the local peer) has a corresponding record of type inbound-rtp which describes the local peer's perspective on the same data being moved between the two peers. let's create a utility function to help us look up the value of a key in the paired statistics object. the findreportentry() function shown below examines an rtcstatsreport, returning the rtcstats-based statistics record which contains the specified key — and for which the key has the specified value. if no match is found (or the statistics report has no record corresponding to the statistics category indicated by key. function findreportentry(report, ...
... key in the paired statistics object. the findreportentry() function shown below examines an rtcstatsreport, returning the rtcstats-based statistics record which contains the specified key — and for which the key has the specified value. if no match is found (or the statistics report has no record corresponding to the statistics category indicated by key. function findreportentry(report, key, value) { for (const stats of report.values()) { if (stats[key] === value) { return stats; } } return null; } since the rtcstatsreport is a javascript map, we can iterate over the map's values() to examine each of the rtcstats-based statistics records in the report until we find one that has the key property with the specified value. when a match is found, the statistics object is r...
...And 3 more matches
RTCRtpEncodingParameters - Web APIs
ibing the configuration of an rtp sender's encodings; rtcrtpdecodingparameters is used to describe the configuration of an rtp receiver's encodings. properties active if true, the described encoding is currently actively being used. that is, for rtp senders, the encoding is currently being used to send data, while for receivers, the encoding is being used to decode received data. the default value is true. codecpayloadtype when describing a codec for an rtcrtpsender, codecpayloadtype is a single 8-bit byte (or octet) specifying the codec to use for sending the stream; the value matches one from the owning rtcrtpparameters object's codecs parameter. this value can only be set when creating the transceiver; after that, this value is read only. dtx only used for an rtcrtpsender whose kind...
... the owning rtcrtpparameters object's codecs parameter. this value can only be set when creating the transceiver; after that, this value is read only. dtx only used for an rtcrtpsender whose kind is audio, this property indicates whether or not to use discontinuous transmission (a feature by which a phone is turned off or the microphone muted automatically in the absence of voice activity). the value is taken from the enumerated string type rtcdtxstatus. maxbitrate an unsigned long integer indicating the maximum number of bits per second to allow for this encoding. other parameters may further constrain the bit rate, such as the value of maxframerate or transport or physical network limitations. ...
...this is typically only relevant for audio encodings. the user agent will try to match this as well as it can, but there is no guarantee. ...
...And 3 more matches
ReadableStreamDefaultReader.read() - Web APIs
the read() method of the readablestreamdefaultreader interface returns a promise providing access to the next chunk in the stream's internal queue. syntax var promise = readablestreamdefaultreader.read(); parameters none. return value a promise, which fulfills/rejects with a result depending on the state of the stream. the different possibilities are as follows: if a chunk is available, the promise will be fulfilled with an object of the form { value: thechunk, 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 readablestreamdefaultreader, or the stream has no ow...
...e for the full code). each chunk is read sequentially and output to the ui as an array of utf-8 bytes, until the stream has finished being read, at which point we return out of the recursive function and print the entire stream to another part of the ui. ...
... as an array of utf-8 bytes, until the stream has finished being read, at which point we return out of the recursive function and print the entire stream to another part of the ui. ...
...And 3 more matches
SVGComponentTransferFunctionElement - Web APIs
ect x="131" y="65" width="350" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="306" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgcomponenttransferfunctionelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constants name value description svg_fecomponenttransfer_type_unknown 0 the type is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_fecomponenttransfer_type_identity 1 corresponds to the value identity. svg_fecomponenttransfer_type_table 2 corresponds to the value table.
... properties this interface also inherits properties from its parent interface, svgelement. ...
... properties this interface also inherits properties from its parent interface, svgelement. svgcomponenttransferfunctionelement.type read only an svganimatedenumeration corresponding to the type attribute of the given element. ...
...And 3 more matches
Selection.modify() - Web APIs
Web › API › Selection › modify
ick the button below to expand the selection. watch what happens!</p> <p>et harum quidem rerum facilis est et expedita distinctio. ...
...atch what happens!</p> <p>et harum quidem rerum facilis est et expedita distinctio. ...
...idem rerum facilis est et expedita distinctio. ...
...And 3 more matches
StereoPannerNode.pan - Web APIs
the pan property of the stereopannernode interface is an a-rate audioparam representing the amount of panning to apply. the value can range between -1 (full left pan) and 1 (full right pan). syntax var audioctx = new audiocontext(); var pannode = audioctx.createstereopanner(); pannode.pan.value = -0.5; returned value an a-rate audioparam containing the panning to apply. note: though the audioparam returned is read-only, the value it represents is not. example in our stereopannernode example (see source code) html we have a simple <audio> element along with a slider <input> to increase and decrease pan value. in the javascript we create a mediaelementaudiosourcenode and a stereopannernode, and connect the two together using the connect() method. we then use an oninput event handler ...
... moving the slider left and right while the music is playing pans the music across to the left and right speakers of the output, respectively. ...
...r stereopannernode example (see source code) html we have a simple <audio> element along with a slider <input> to increase and decrease pan value. in the javascript we create a mediaelementaudiosourcenode and a stereopannernode, and connect the two together using the connect() method. we then use an oninput event handler to change the value of the stereopannernode.pan parameter and update the pan value display when the slider is moved. moving the slider left and right while the music is playing pans the music across to the left and right speakers of the output, respectively. ...
...And 3 more matches
StylePropertyMapReadOnly.get() - Web APIs
the get() method of the stylepropertymapreadonly interface returns a cssstylevalue object for the first value of the specified property. syntax var declarationblock = stylepropertymapreadonly.get(property) parameters property the name of the property to retrieve the value of. return value a cssstylevalue object. examples let's get just a few properties and values. let's start by creating a link inside a paragraph in our html, and adding a definition list which we will populate with javascript: <p> <a href="https://example.com">link</a> </p> <dl id="regurgitation"></dl> we add a bit of css, including a custom property and an inhertable property: p { font-weight: bold; } a { --colour: red; color: var(--colour); } we use the element's computedstylemap() to return a st...
...>link</a> </p> <dl id="regurgitation"></dl> we add a bit of css, including a custom property and an inhertable property: p { font-weight: bold; } a { --colour: red; color: var(--colour); } we use the element's computedstylemap() to return a stylepropertymapreadonly object. we create an array of properties of interest and use the stylepropertymapreadonly's get() method to get only those values. // get the element const myelement = document.queryselector('a'); // 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']; // it...
... working draft initial definition. ...
...And 3 more matches
SubtleCrypto.wrapKey() - Web APIs
pecifying the algorithm to be used to encrypt the exported key, and any required extra parameters: to use rsa-oaep, pass an rsaoaepparams object. to use aes-ctr, pass an aesctrparams object. to use aes-cbc, pass an aescbcparams object. to use aes-gcm, pass an aesgcmparams object. to use aes-kw, pass the string "aes-kw", or an object of the form { "name": "aes-kw }. return value result is a promise that fulfills with an arraybuffer containing the encrypted exported key. exceptions the promise is rejected when one of the following exceptions is encountered: invalidaccesserror raised when the wrapping key is not a key for the requested wrap algorithm. notsupported raised when trying to use an algorithm that is either unknown or isn't suitable for encryption or ...
...rivekey( { "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, "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 wrapcrypt...
...ivekey( { "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.subtle.wrapkey( "pkcs8", keytowrap, wrappingkey, { name: "aes-gcm", iv: iv } ); } /* generate a sign/verify key pair, then wrap the private key. */ window.crypto.subtle.generatekey( { name: "rsa-pss...
...And 3 more matches
URLSearchParams.append() - Web APIs
examples let url = new url('https://example.com?foo=1&bar=2'); let params = new urlsearchparams(url.search.slice(1)); //add a second foo parameter. ...
... examples let url = new url('https://example.com?foo=1&bar=2'); let params = new urlsearchparams(url.search.slice(1)); //add a second foo parameter. ...
... examples let url = new url('https://example.com?foo=1&bar=2'); let params = new urlsearchparams(url.search.slice(1)); //add a second foo parameter. ...
...And 3 more matches
URLSearchParams.set() - Web APIs
examples let's start with a simple example: let url = new url('https://example.com?foo=1&bar=2'); let params = new urlsearchparams(url.search.slice(1)); //add a third parameter. ...
... examples let's start with a simple example: let url = new url('https://example.com?foo=1&bar=2'); let params = new urlsearchparams(url.search.slice(1)); //add a third parameter. ...
... examples let's start with a simple example: let url = new url('https://example.com?foo=1&bar=2'); let params = new urlsearchparams(url.search.slice(1)); //add a third parameter. ...
...And 3 more matches
WebGLRenderingContext.depthFunc() - Web APIs
the webglrenderingcontext.depthfunc() method of the webgl api specifies a function that compares incoming pixel depth to the current depth buffer value. syntax void gl.depthfunc(func); parameters func a glenum specifying the depth comparison function, which sets the conditions under which the pixel will be drawn. the default value is gl.less. ...
... the webglrenderingcontext.depthfunc() method of the webgl api specifies a function that compares incoming pixel depth to the current depth buffer value. syntax void gl.depthfunc(func); parameters func a glenum specifying the depth comparison function, which sets the conditions under which the pixel will be drawn. the default value is gl.less. ...
...unc() method of the webgl api specifies a function that compares incoming pixel depth to the current depth buffer value. syntax void gl.depthfunc(func); parameters func a glenum specifying the depth comparison function, which sets the conditions under which the pixel will be drawn. the default value is gl.less. ...
...And 3 more matches
WebGLRenderingContext.getActiveUniform() - Web APIs
ribute. it is generally used when querying unknown uniforms either for debugging or generic library creation. syntax webglactiveinfo webglrenderingcontext.getactiveuniform(program, index); parameters program a webglprogram specifying the webgl shader program from which to obtain the uniform variable's information. index a gluint specifying the index of the uniform attribute to get. ...
...on. syntax webglactiveinfo webglrenderingcontext.getactiveuniform(program, index); parameters program a webglprogram specifying the webgl shader program from which to obtain the uniform variable's information. index a gluint specifying the index of the uniform attribute to get. this value is an index 0 to n - 1 as returned by gl.getprogramparameter(program, gl.active_uniforms). return value a webglactiveinfo object describing the uniform. ...
...ameters program a webglprogram specifying the webgl shader program from which to obtain the uniform variable's information. index a gluint specifying the index of the uniform attribute to get. this value is an index 0 to n - 1 as returned by gl.getprogramparameter(program, gl.active_uniforms). return value a webglactiveinfo object describing the uniform. ...
...And 3 more matches
WebGLRenderingContext.getFramebufferAttachmentParameter() - Web APIs
the webglrenderingcontext.getframebufferattachmentparameter() method of the webgl api returns information about a framebuffer's attachment. syntax any gl.getframebufferattachmentparameter(target, attachment, pname); parameters target a glenum specifying the binding point (target). possible values: gl.framebuffer: collection buffer data storage of color, alpha, depth and stencil buffers used to render an image. when using a webgl 2 context, the following values are available additionally: gl.draw_framebuffer: equivalent to gl.framebuffer. used as a destination for drawing, rendering, clearing, and writing operations. gl.read_framebuffer: used as a source for reading operations. attachment a glenum specifying the attachment point for the texture. possible v...
...ture. possible values: gl.color_attachment0: texture attachment for the framebuffer's color buffer. gl.depth_attachment: texture attachment for the framebuffer's depth buffer. gl.stencil_attachment: texture attachment for the framebuffer's stencil buffer. gl.depth_stencil_attachment: texture attachment for both, the depth and stencil buffer. ...
...xt.color_attachment6_webgl ext.color_attachment7_webgl ext.color_attachment8_webgl ext.color_attachment9_webgl ext.color_attachment10_webgl ext.color_attachment11_webgl ext.color_attachment12_webgl ext.color_attachment13_webgl ext.color_attachment14_webgl ext.color_attachment15_webgl pname a glenum specifying information to query. possible values: gl.framebuffer_attachment_object_type: the type which contains the attached image. gl.framebuffer_attachment_object_name: the texture or renderbuffer of the attached image (webglrenderbuffer or webgltexture). gl.framebuffer_attachment_texture_level: mipmap level. default value: 0. gl.framebuffer_attachment_texture_cube_map_face: the name of cube-map face of the texture. when using t...
...And 3 more matches
WebGLRenderingContext.getTexParameter() - Web APIs
the webglrenderingcontext.gettexparameter() method of the webgl api returns information about the given texture. syntax any gl.gettexparameter(target, pname); parameters target a glenum specifying the binding point (target). possible values: gl.texture_2d: a two-dimensional texture. gl.texture_cube_map: a cube-mapped texture. when using a webgl 2 context, the following values are available additionally: gl.texture_3d: a three-dimensional texture. gl.texture_2d_array: a two-dimensional array texture. ...
...e binding point (target). possible values: gl.texture_2d: a two-dimensional texture. gl.texture_cube_map: a cube-mapped texture. when using a webgl 2 context, the following values are available additionally: gl.texture_3d: a three-dimensional texture. gl.texture_2d_array: a two-dimensional array texture. pname a glenum specifying the information to query. possible values: pname return type description possible return values available in a webgl 1 context gl.texture_mag_filter glenum texture magnification filter gl.linear (default value), gl.nearest. gl.texture_min_filter glenum texture minification filter gl.linear, gl.nearest, gl.nearest_mipmap_nearest, gl.linear_mipmap_n...
...description possible return values available in a webgl 1 context gl.texture_mag_filter glenum texture magnification filter gl.linear (default value), gl.nearest. gl.texture_min_filter glenum texture minification filter gl.linear, gl.nearest, gl.nearest_mipmap_nearest, gl.linear_mipmap_nearest, gl.nearest_mipmap_linear (default value), gl.linear_mipmap_linear. gl.texture_wrap_s glenum wrapping function for texture coordinate s gl.repeat (default value), gl.clamp_to_edge, gl.mirrored_repeat. gl.texture_wrap_t glenum wrapping function for texture coordinate t gl.repeat (default value), gl.clamp_to_edge, gl.mirrored_repeat. additionally available when using the ext_text...
...And 3 more matches
WebGLRenderingContext.polygonOffset() - Web APIs
examples the polygon offset fill is disabled by default. ...
... examples the polygon offset fill is disabled by default. ...
... examples the polygon offset fill is disabled by default. ...
...And 3 more matches
Web Video Text Tracks Format (WebVTT) - Web APIs
layed over the video. this includes whether the text is displayed horizontally or vertically. there can be zero or more of them, and they can be used in any order so long as each setting is used no more than once. the cue settings are added to the right of the cue timings. there must be one or more spaces between the cue timing and the first setting and between each setting. ...
... or more spaces between the cue timing and the first setting and between each setting. a setting's name and value are separated by a colon. the settings are case sensitive so use lower case as shown. there are five cue settings: vertical indicates that the text will be displayed vertically rather than horizontally, such as in some asian languages. table 1 - vertical values vertical:rl writing direction is right to left vertical:lr writing direction is left to right line specifies where text appears vertically. if vertical is set, line specifies where text appears horizontally. value can be a line number. the line height is the height of the first line of the cue as it appears on the ...
... must be an integer (i.e., no decimals) between 0 and 100 inclusive. must be followed by a percent sign (%). ...
...And 3 more matches
Rendering and the WebXR frame animation callback - Web APIs
ropped frame isn't usually particularly noticeable, but if it starts to happen a lot—especially if several frames are dropped in a very short span of time—it can become jarring or even leave your display unusable. fortunately, you can easily compute how much time you're allowed to use between frames as 1/refreshrate seconds. that is, by dividing 1 by the display's refresh rate. the resulting value is the amount of time available for each frame to be rendered in order to not drop the frame. for example, a 60 hz display has 1/60th of a second to render a single frame, or 0.0166667 seconds. and if the device's refresh rate is 120 hz, you only have 0.00883333 seconds to render each frame if you want to avoid dropping frames. even if the hardware is actually 120 hz, though, you can get by with...
...rrefspace); if (viewerpose) { let gllayer = session.renderstate.baselayer; gl.bindframebuffer(gl.framebuffer, gllayer.framebuffer); // start by erasing the color and depth framebuffers. gl.clearcolor(0, 0, 0, 1.0); gl.cleardepth(1.0); gl.clear(gl.color_buffer_bit | gl.depth_buffer_bit); // compute the time elapsed since the last frame was rendered. // use this value to ensure your animation runs at the exact // rate you intend. const deltatime = currentframetime - lastframetime; lastframetime = time; // now call the scene rendering code once for each of // the session's views. for (let view of viewerpose.views) { let viewport = gllayer.getviewport(view); gl.viewport(viewport.x, viewport.y, viewport.width, viewport.heigh...
...ramebuffer, we only need to clear a single framebuffer rather than cleaning it for each eye (or other viewpoints, if any) individually. next, the time elapsed since the previous frame was rendered is calculated by subtracting from the current time as specified by the currentframetime parameter the saved time at which the last frame was rendered, lastframetime. ...
...And 3 more matches
Using the Web Animations API - Web APIs
oercion, or window.requestanimationframe(). with the web animations api, we can move interactive animations from stylesheets to javascript, separating presentation from behavior. we no longer need to rely on dom-heavy techniques such as writing css properties and scoping classes onto elements to control playback direction. and unlike pure, declarative css, javascript also lets us dynamically set values from properties to durations. for building custom animation libraries and creating interactive animations, the web animations api might be the perfect tool for the job. let's see what it can do! browser support the basic web animations api features discussed in this article are available by default in firefox 48+ and chrome 36+. safari supports web animations in its technology preview version ...
......
...other thing you’ll notice is that it’s iterations, not iteration-count. there are a number of small differences between the terminology used in css animations and the terminology used in web animations. for instance, web animations doesn't use the string "infinite", but instead uses the javascript keyword infinity. and instead of timing-function we use easing. we aren’t listing an easing value here because, unlike css animations where the default animation-timing-function is ease, in the web animations api the default easing is linear — which is what we want here. bring the pieces together now it’s time to bring them both together with the element.animate() method: document.getelementbyid("alice").animate( alicetumbling, alicetiming ) and boom: the animation starts playing...
...And 3 more matches
Using Web Workers - Web APIs
he uri of a script to execute in the worker thread (main.js): var myworker = new worker('worker.js'); sending messages to and from a dedicated worker the magic of workers happens via the postmessage() method and the onmessage event handler. ...
...cript to execute in the worker thread (main.js): var myworker = new worker('worker.js'); sending messages to and from a dedicated worker the magic of workers happens via the postmessage() method and the onmessage event handler. ...
...d from a dedicated worker the magic of workers happens via the postmessage() method and the onmessage event handler. when you want to send a message to the worker, you post messages to it like this (main.js): first.onchange = function() { myworker.postmessage([first.value,second.value]); console.log('message posted to worker'); } second.onchange = function() { myworker.postmessage([first.value,second.value]); console.log('message posted to worker'); } so here we have two <input> elements represented by the variables first and second; when the value of either is changed, myworker.postmessage([first.value,second.value]) is used to send the value inside both to the worker, as an array. you can send pretty much anything you like in the message. in the worker, we can respond when the me...
...And 3 more matches
Window.pageYOffset - Web APIs
the read-only window property pageyoffset is an alias for scrolly; as such, it returns the number of pixels the document is currently scrolled along the vertical axis (that is, up or down) with a value of 0.0, indicating that the top edge of the document is currently aligned with the top edge of the window's content area. there is slightly better support for pageyoffset than for scrolly in older browsers, but if you're not concerned about browsers more than a handful of years old, you can use either one. ...
...w's content area. there is slightly better support for pageyoffset than for scrolly in older browsers, but if you're not concerned about browsers more than a handful of years old, you can use either one. the corresponding pagexoffset property, which returns the number of pixels scrolled along the horizontal axis (left and right), is an alias for scrollx. syntax yoffset = window.pageyoffset; value a floating-point number specifying the number of pixels the document is scrolled vertically within its containing window. this number is subpixel precise, so it may not be an integer. a value of 0.0 indicates that the window is not scrolled vertically, and that the top of the document is located at the top edge of the window's content area. since this property is an alias for window.scrolly, se...
... example var contenthtml = ` <h2 id="introduction">introduction</h2> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. aenean volutpat vitae felis non dictum. ut auctor eros tortor, vel elementum arcu rhoncus nec. ...
...And 3 more matches
Generating HTML - Web APIs
ns="http://devedge.netscape.com/2002/de"> <xsl:output method="html"/> ... </xsl:stylesheet version="1.0"> a template matching the root node of the xml document is created and used to create the basic structure of the html page. figure 4 : creating the basic html document xsl stylesheet (example2.xsl): ... ...
...tylesheet (example2.xsl): ... <xsl:template match="/"> <html> <head> <title> <xsl:value-of select="/myns:article/myns:title"/> </title> <style type="text/css"> .mybox {margin:10px 155px 0 50px; border: 1px dotted #639ace; padding:0 5px 0 5px;} </style> </head> <body> <p class="mybox"> <span class="title"> <xsl:value-of select="/myns:article/myns:title"/> </span> </br> authors: <br /> <xsl:apply-templates select="/myns:article/myns:authors/myns:author"/> </p> <p class="mybox"> <xsl:apply-templates select="//myns:body"/> </p> </body> </html> </xsl:template> ... three more xsl:template's are needed to complete the example. the first xsl:templ...
... the body node. the third template has a general matching rule which will match any node and any attribute. it is needed in order to preserve the html elements in the xml document, since it matches all of them and copies them out into the html document the transformation creates. figure 5 : final 3 templates xsl stylesheet(example2.xsl): ... ...
...And 3 more matches
ARIA: switch role - Accessibility
a-checked="true" id="speakerpower" class="switch"> <span>off</span> <span>on</span> </button> <label for="speakerpower" class="switch">speaker power</label> description the aria switch role is identical to the checkbox role, except instead of being "checked" or "unchecked", it is either "on" and "off." like the checkbox role, the aria-checked attribute is required. the two possible values are true and false. unlike a <checkbox> or role="checkbox", there is no indeterminate or mixed state. the switch role does not support the value mixed for the aria-checked attribute; assigning a value of mixed to a switch instead sets the value to false. assistive technologies may choose to represent switch widgets with a specialized presentation to reflect the notion of an on/off switch. sinc...
...stead sets the value to false. assistive technologies may choose to represent switch widgets with a specialized presentation to reflect the notion of an on/off switch. since a switch is an interactive control, it must be focusable and keyboard accessible. if the role is applied to a non-focusable element, use the tabindex attribute to change this. the expected keyboard shortcut for toggling the value of a switch is the space key. the developer is required to change the value of the aria-checked attribute dynamically when the switch is toggled. associated aria roles, states, and properties aria-checked attribute the aria-checked attribute is required when using the switch role, as it represents the current state of the widget that the switch role is applied to. ...
...ut for toggling the value of a switch is the space key. the developer is required to change the value of the aria-checked attribute dynamically when the switch is toggled. associated aria roles, states, and properties aria-checked attribute the aria-checked attribute is required when using the switch role, as it represents the current state of the widget that the switch role is applied to. a value of true represents the "on" state; false represents the "off" state; a value of mixed is not supported by the switch role, and is treated as false. the default value is false. aria-readonly attribute the aria-readonly attribute is supported by the switch role. it indicates whether the widget's state is editable by the user. ...
...And 3 more matches
ARIA: listbox role - Accessibility
highly recommended to use the html select element, or a group of radio buttons if only one item can be selected, or a group of checkboxes if multiple items can be selected, because there is a lot of keyboard interactivity to manage focus for all the descendants, and native html elements provide this functionality for you for free. elements with the role listbox have an implicit aria-orientation value of vertical. when a list is tabbed to, the first item in the list will be selected if nothing else already is. up/down arrows navigate the list, and pressing shift + up/down arrows will move and extend the selection. typing one or more letters will navigate the list items (same letter goes to each item starting with that, different letters go to the first item starting with that entire string). ...
...cted set to false. if an option is not selectable, omit the aria-selected. list a section containing listitem elements states and properties aria-activedescendant holds the id string of the currently active element within the listbox. if that's an option element, then that would be the id of the most recently interacted with option, regardless of whether that option has an aria-selected value of true or not. takes the value of only one id, even in a multiselectable listbox. if the id does not refer to a dom descendant of the listbox, then that id must be included among the ids in the aria-owns attrubute. aria-owns this is a space-separated list of element ids which are not dom child elements of the listbox. ids listed here cannot also be listed in aria-owns attributes of any other...
... option should have an aria-selected attribute included and set to true or false. options which are not selectable should not have the aria-selected attribute. if false or omitted, only the currently selected option, if any option is selected, needs the aria-selected attribute, and it must be set to true. aria-required a boolean attribute which indicates that an option with a non-empty string value must be selected. aria-readonly the user cannot change which options are selected or unselected, but the listbox is otherwise operable. aria-label a human-readable string value which identifies the listbox. if there's a visible label, then aria-labelledby should be used instead to refer to that label. aria-labelledby identifies the visible element or elements in a space-separated list of e...
...And 3 more matches
HTML To MSAA - Accessibility
remarks the table below shows how gecko maps html elements to msaa. this table reflects mapping rules for specific elements only, it doesn't reflect any general rules applicable to all elements. for example, if name column has n/a value then it means specific elements doesn't provide own rules to calculate name but name can be computed from aria markup or @title attribute. ...
...s the table below shows how gecko maps html elements to msaa. this table reflects mapping rules for specific elements only, it doesn't reflect any general rules applicable to all elements. for example, if name column has n/a value then it means specific elements doesn't provide own rules to calculate name but name can be computed from aria markup or @title attribute. ...
...le reflects mapping rules for specific elements only, it doesn't reflect any general rules applicable to all elements. for example, if name column has n/a value then it means specific elements doesn't provide own rules to calculate name but name can be computed from aria markup or @title attribute. ...
...And 3 more matches
-webkit-mask-composite - CSS: Cascading Style Sheets
the -webkit-mask-composite property specifies the manner in which multiple mask images applied to the same element are composited with one another. mask images are composited in the opposite order that they are declared with the -webkit-mask-image property. ...
... copy the source mask image replaces the destination mask im...
... copy the source mask image replaces the destination mask image. ...
...And 3 more matches
-webkit-mask-repeat-x - CSS: Cascading Style Sheets
no-repeat the mask image is not repeated; only one copy of the mask image is drawn. ...
... no-repeat the mask image is not repeated; only one copy of the mask image is drawn. ...
... no-repeat the mask image is not repeated; only one copy of the mask image is drawn. ...
...And 3 more matches
src - CSS: Cascading Style Sheets
Web › CSS › @font-face › src
the src css descriptor of the @font-face rule specifies the resource containing font data. it is required for the @font-face rule to be valid. ...
... specifies an external reference consisting of a ...
...ont.svg#example); /* fragment identifying font */ /* <font-face-name> values */ src: local(font); /* unquoted name */ src: local(some font); /* name containing space */ src: local("font"); /* quoted name */ /* multiple items */ src: local(font), url(path/to/font.svg) format("svg"), url(path/to/font.woff) format("woff"), url(path/to/font.otf) format("opentype"); values <url> [ format( <string># ) ]? specifies an external reference consisting of a <url>, followed by an optional hint using the format() function to describe the format of the font resource referenced by that url. the format hint contains a comma-separated list of format strings that denote well-known font formats. if a user agent doesn't support the specified formats, it skips downloading the ...
...And 3 more matches
max-zoom - CSS: Cascading Style Sheets
the max-zoom css descriptor sets the maximum zoom factor of a document defined by the @viewport at-rule. the browser will not zoom in any further than this, whether automatically or at the user's request. a zoom factor of 1.0 or 100% corresponds to no zooming. larger values are zoomed in. smaller values are zoomed out. ...
... the max-zoom css descriptor sets the maximum zoom factor of a document defined by the @viewport at-rule. the browser will not zoom in any further than this, whether automatically or at the user's request. a zoom factor of 1.0 or 100% corresponds to no zooming. larger values are zoomed in. smaller values are zoomed out. ...
... the max-zoom css descriptor sets the maximum zoom factor of a document defined by the @viewport at-rule. the browser will not zoom in any further than this, whether automatically or at the user's request. a zoom factor of 1.0 or 100% corresponds to no zooming. larger values are zoomed in. smaller values are zoomed out. ...
...And 3 more matches
min-zoom - CSS: Cascading Style Sheets
the min-zoom css descriptor sets the minimum zoom factor of a document defined by the @viewport at-rule. the browser will not zoom out any further than this, whether automatically or at the user's request. a zoom factor of 1.0 or 100% corresponds to no zooming. larger values are zoomed in. smaller values are zoomed out. ...
... the min-zoom css descriptor sets the minimum zoom factor of a document defined by the @viewport at-rule. the browser will not zoom out any further than this, whether automatically or at the user's request. a zoom factor of 1.0 or 100% corresponds to no zooming. larger values are zoomed in. smaller values are zoomed out. ...
... the min-zoom css descriptor sets the minimum zoom factor of a document defined by the @viewport at-rule. the browser will not zoom out any further than this, whether automatically or at the user's request. a zoom factor of 1.0 or 100% corresponds to no zooming. larger values are zoomed in. smaller values are zoomed out. ...
...And 3 more matches
Using CSS animations - CSS: Cascading Style Sheets
the beginning of the animation sequence. animation-iteration-count configures the number of times the animation should repeat; you can specify infinite to repeat the animation indefinitely. animation-direction configures whether or not the animation should alternate direction on each run through the sequence or reset to the start point and repeat itself. animation-fill-mode configures what values are applied by the animation before and after it is executing. animation-play-state lets you pause and resume the animation sequence. defining the animation sequence using keyframes once you’ve configured the animation’s timing, you need to define the appearance of the animation. this is done by establishing two or more keyframes using the @keyframes at-rule. each keyframe describes how...
...tage> to indicate the time during the animation sequence at which they take place. 0% indicates the first moment of the animation sequence, while 100% indicates the final state of the animation. because these two times are so important, they have special aliases: from and to. both are optional. if from/0% or to/100% is not specified, the browser starts or finishes the animation using the computed values of all attributes. you can optionally include additional keyframes that describe intermediate steps between the start and end of the animation. examples note: some older browsers (pre-2017) may need prefixes; the live examples you can click to see in your browser include the -webkit prefixed syntax. making text slide across the browser window this simple example styles the <p> element so th...
...for saving space. as an example, the rule we’ve been using through this article: p { animation-duration: 3s; animation-name: slidein; animation-iteration-count: infinite; animation-direction: alternate; } could be replaced by p { animation: 3s infinite alternate slidein; } note: you can find more details out at the animation reference page: setting multiple animation property values the css animation longhand values can accept multiple values, separated by commas — this feature can be used when you want to apply multiple animations in a single rule, and set separate durations, iteration counts, etc. for the different animations. let’s look at some quick examples to explain the different permutations: in this first example, we have three animation names set, but only o...
...And 3 more matches
Relationship of flexbox to other layout methods - CSS: Cascading Style Sheets
e: while the alignment properties are defined in css box alignment [css-align-3], flexible box layout reproduces the definitions of the relevant ones here so as to not create a normative dependency that may slow down advancement of the spec. these properties apply only to flex layout until css box alignment level 3 is finished and defines their effect for other layout modes. additionally, any new values defined in the box alignment module will apply to flexible box layout; in otherwords, the box alignment module, once completed, will supercede the definitions here." in a later article in this series — aligning items in a flex container — we will take a thorough look at how the box alignment properties apply to flex items. the gap properties a recent addition to the box alignment specifi...
... methods. it is worth noting that we might want to change the writing mode of our document for reasons other than publishing content in a language that uses a different writing mode. see this article for a full description of writing modes and ways to use them, both for content in other languages and for creative reasons. the writing modes the writing modes specification defines the following values of the writing-mode property, which serve to change the direction that blocks are laid out on the page, to match the direction that blocks lay out when content is formatted in that particular writing mode. you can change the live example below to these modes in order to see what happens to the flex layout. horizontal-tb vertical-rl vertical-lr sideways-rl sideways-lr note that sidewa...
...rid and flexbox see the article relationship of grid layout to other layout methods. this article details many of the ways that grid layout differs from flex layout, and demonstrates some of the extra functionality you get when using grid layout such as layering of items on the grid. this may also help in your decision as to which layout method to use. ...
...And 3 more matches
Flow Layout and Writing Modes - CSS: Cascading Style Sheets
you can set writing-mode: vertical-lr on the element and this will change the direction of the blocks and therefore the inline direction as well. while certain languages will use a particular writing mode or text direction, we can also use these properties for creative effect, such as running a heading vertically. the writing-mode property and block flow the writing-mode property accepts the values horizontal-tb, vertical-rl and vertical-lr. these values control the direction that blocks flow on the page. the initial value is horizontal-tb, which is a top to bottom block flow direction with a horizontal inline direction. left to right languages, such as english, and right to left languages. such as arabic, are all horizontal-tb. the following example shows blocks using horizontal-tb. t...
...this gives you a left-to-right block flow direction and a vertical inline direction. ...
...this gives you a left-to-right block flow direction and a vertical inline direction. ...
...And 3 more matches
Line-based placement with CSS Grid - CSS: Cascading Style Sheets
row: 1 / 4; } .box2 { grid-column: 3 / 4; grid-row: 1 / 3; } .box3 { grid-column: 2 / 3; grid-row: 1 / 2; } .box4 { grid-column: 2 / 4; grid-row: 3 / 4; } default spans in the above examples i specified every end row and column line, in order to demonstrate the properties, however in practice if an item only spans one track you can omit the grid-column-end or grid-row-end value. grid defaults to spanning one track. this means that our initial, long-hand, example would look like this: * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 100px); } .wrapper > div { border: 2px solid #ffa94d; bor...
... * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 100px); } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; ...
...ass="box3">three</div> <div class="box4">four</div> </div> .box1 { grid-column: 1 ; grid-row: 1 / 4; } .box2 { grid-column: 3 ; grid-row: 1 / 3; } .box3 { grid-column: 2 ; grid-row: 1 ; } .box4 { grid-column: 2 / 4; grid-row: 3 ; } the grid-area property we can take things a step further and define each area with a single property – grid-area. the order of the values for grid-area are as follows. grid-row-start grid-column-start grid-row-end grid-column-end * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 100px); } .wrapper > div { border: 2px solid #ffa94d; border-radiu...
...And 3 more matches
Subgrid - CSS: Cascading Style Sheets
this guide details what subgrid does, and gives some use cases and design patterns that are solved by the feature. important: this feature is shipped in firefox 71, which is currently the only browser to implement subgrid. introduction to subgrid when you add display: grid to a grid container, only the direct children become grid items and can then be placed on the grid that you have created. the children of these items display in normal flow. you can "nest" grids by making a grid item a grid container. ...
...n then be placed on the grid that you have created. the children of these items display in normal flow. you can "nest" grids by making a grid item a grid container. these grids however are independent of the parent grid and of each other, meaning that they do not take their track sizing from the parent grid. this makes it difficult to line nested grid items up with the main grid. if you set the value subgrid on grid-template-columns, grid-template-rows or both, instead of creating a new track listing the nested grid uses the tracks defined on the parent. for example, if you use grid-template-columns: subgrid and the nested grid spans three column tracks of the parent, the nested grid will have three column tracks of the same size as the parent grid. gaps are inherited but can also be overrid...
...-columns, grid-template-rows or both, instead of creating a new track listing the nested grid uses the tracks defined on the parent. for example, if you use grid-template-columns: subgrid and the nested grid spans three column tracks of the parent, the nested grid will have three column tracks of the same size as the parent grid. gaps are inherited but can also be overridden with a different gap value. line names can be passed from the parent into the subgrid, and the subgrid can also declare its own line names. subgrid for columns in the example below i have a grid layout with nine 1fr column tracks and four rows that are a minimum of 100px tall. i place .item from column line 2 to 7, and row 2 to 4. i then make this grid item into a grid, giving it column tracks that are a subgrid and def...
...And 3 more matches
animation-delay - CSS: Cascading Style Sheets
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. ...
...e. syntax /* single animation */ animation-delay: 3s; animation-delay: 0s; animation-delay: -1500ms; /* multiple animations */ animation-delay: 2.1s, 480ms; values <time> the time offset, from the moment at which the animation is applied to the element, at which the animation should begin. this may be specified in either seconds (s) or milliseconds (ms). the unit is required. a positive value indicates that the animation should begin after the specified amount of time has elapsed. a value of 0s, which is the default, indicates that the animation should begin as soon as it's applied. a negative value causes the animation to begin immediately, but partway through its cycle. for example, if you specify -1s as the animation delay time, the animation will begin immediately but will star...
...unt of time has elapsed. a value of 0s, which is the default, indicates that the animation should begin as soon as it's applied. a negative value causes the animation to begin immediately, but partway through its cycle. for example, if you specify -1s as the animation delay time, the animation will begin immediately but will start 1 second into the animation sequence. if you specify a negative value for the animation delay, but the starting value is implicit, the starting value is taken from the moment the animation is applied to the element. note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are. for more information, see setting...
...And 3 more matches
animation-fill-mode - CSS: Cascading Style Sheets
xamples and send us a pull request. it is often convenient to use the shorthand property animation to set all animation properties at once. ...
...none; animation-fill-mode: forwards; animation-fill-mode: backwards; animation-fill-mode: both; /* multiple animations */ animation-fill-mode: none, backwards; animation-fill-mode: both, forwards, none; values none the animation will not apply any styles to the target when it's not executing. the element will instead be displayed using any other css rules applied to it. this is the default value. forwards the target will retain the computed values set by the last keyframe encountered during execution. ...
... backwards; animation-fill-mode: both, forwards, none; values none the animation will not apply any styles to the target when it's not executing. the element will instead be displayed using any other css rules applied to it. this is the default value. forwards the target will retain the computed values set by the last keyframe encountered during execution. ...
...And 3 more matches
aspect-ratio - CSS: Cascading Style Sheets
the aspect-ratio css property sets a preferred aspect ratio for the box, which will be used in the calculation of auto sizes and some other layout functions. this property is not yet implemented in browsers, however some browsers are implementing this internally in order to provide the aspect ratio mapping described below. syntax aspect-ratio: 1 / 1; /* global values */ aspect-ratio: inherit; aspect-ratio: initial; aspect-ratio: unset; values <auto> replaced elements with an intrinsic aspect ratio use that aspect ratio, otherwise the box has no preferred aspect ratio. size calculations involving intrinsic aspect ratio always work with the content box dimensions. <ratio> the box’s preferred aspect ratio is the specified ratio of width / height. size calculations involving pref...
...tio use that aspect ratio, otherwise the box has no preferred aspect ratio. size calculations involving intrinsic aspect ratio always work with the content box dimensions. <ratio> the box’s preferred aspect ratio is the specified ratio of width / height. size calculations involving preferred aspect ratio work with the dimensions of the box specified by box-sizing. ...
...intrinsic aspect ratio always work with the content box dimensions. <ratio> the box’s preferred aspect ratio is the specified ratio of width / height. size calculations involving preferred aspect ratio work with the dimensions of the box specified by box-sizing. formal definition initial valueautoapplies toall elements except inline boxes and internal ruby or table boxesinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | <ratio> examples mapping width and height to aspect-ratio firefox has added an internal aspect-ratio property (in version 69 onwards) that applies to replaced elements and other related elements that accept width and height attributes. this appears in the browser's internal ua stylesheet. chrome is also shipping this feature. in firefo...
...And 3 more matches
background-clip - CSS: Cascading Style Sheets
der has transparent regions or partially opaque regions (due to border-style or border-image); otherwise, the border masks the difference. note: because the root element has a different background painting area, the background-clip property has no effect when specified on it. ...
...te: because the root element has a different background painting area, the background-clip property has no effect when specified on it. see "the backgrounds of special elements." note: for documents whose root element is an html element: if the computed value of background-image on the root element is none and its background-color is transparent, user agents must instead propagate the computed values of the background properties from that element’s first html <body> child element. the used values of that <body> element’s background properties are their initial values, and the propagated values are treated as if they were specified on the root element. it is recommended that authors of html documents specify the canvas background for the <body> element rather than the html element. synt...
...ound properties from that element’s first html <body> child element. the used values of that <body> element’s background properties are their initial values, and the propagated values are treated as if they were specified on the root element. it is recommended that authors of html documents specify the canvas background for the <body> element rather than the html element. syntax /* keyword values */ background-clip: border-box; background-clip: padding-box; background-clip: content-box; background-clip: text; /* global values */ background-clip: inherit; background-clip: initial; background-clip: unset; values border-box the background extends to the outside edge of the border (but underneath the border in z-ordering). padding-box the background extends to the outside edge of th...
...And 3 more matches
border-block-start-width - CSS: Cascading Style Sheets
the border-block-start-width css property defines the width of the logical block-start border of an element, which maps to a physical border width depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-width, border-right-width, border-bottom-width, or border-left-width property depending on the values defined for writing-mode, direction, and text-orientation. ...
...ht-width, border-bottom-width, or border-left-width 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 /* <'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. ...
...tribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send 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. 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. ...
...And 3 more matches
border-block-width - CSS: Cascading Style Sheets
the border-block-width css property defines the width of the logical block borders of an element, which maps to a physical border width depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-width and border-bottom-width, or border-left-width, and border-right-width property depending on the values defined for writing-mode, direction, and text-orientation. ...
...efines the width of the logical block borders of an element, which maps to a physical border width depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-width and border-bottom-width, or border-left-width, and border-right-width property depending on the values defined for writing-mode, direction, and text-orientation. ...
...and border-bottom-width, or border-left-width, and border-right-width property depending on the values defined for writing-mode, direction, and text-orientation. /* <'border-width'> values */ border-block-width: 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. ...
...And 3 more matches
border-bottom-left-radius - CSS: Cascading Style Sheets
ius (or the radius of the semi-major and semi-minor axes) of the ellipse defining the curvature of the corner. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...e to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the rounding can be a circle or an ellipse, or if one of the value is 0 no rounding is done and the corner is square. a background, being an image or a color, is clipped at the border, even a rounded one; the exact location of the clipping is defined by the value of the background-clip property. note: if the value of this property is not set in a border-radius shorthand property that is applied to the element after the border-bottom-left-radius 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-bottom-left-radius: radius */ border-bottom-left-radius: 3px; ...
...und-clip property. note: if the value of this property is not set in a border-radius shorthand property that is applied to the element after the border-bottom-left-radius css property, the value of this property is then reset to its initial value by the shorthand property. ...
...And 3 more matches
border-bottom-right-radius - CSS: Cascading Style Sheets
ius (or the radius of the semi-major and semi-minor axes) of the ellipse defining the curvature of the corner. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...e to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the rounding can be a circle or an ellipse, or if one of the value is 0 no rounding is done and the corner is square. a background, being an image or a color, is clipped at the border, even a rounded one; the exact location of the clipping is defined by the value of the background-clip property. note: if the value of this property is not set in a border-radius shorthand property that is applied to the element after the border-bottom-right-radius 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-bottom-right-radius: radius */ border-bottom-right-radius: 3p...
...-clip property. note: if the value of this property is not set in a border-radius shorthand property that is applied to the element after the border-bottom-right-radius css property, the value of this property is then reset to its initial value by the shorthand property. ...
...And 3 more matches
border-image-repeat - CSS: Cascading Style Sheets
the border-image-repeat css property defines how the edge regions of a source image are adjusted to fit the dimensions of an element's border 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. ...
...tored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword value */ border-image-repeat: stretch; border-image-repeat: repeat; border-image-repeat: round; border-image-repeat: space; /* vertical | horizontal */ border-image-repeat: round stretch; /* global values */ border-image-repeat: inherit; border-image-repeat: initial; border-image-repeat: unset; the border-image-repeat property may be specified using one or two values chosen from the list of values below. when one value is specified, it applies the same behavior on all four sides. when two values are specified, the first applies to the top and bottom, the second to the left and right. valu...
... tiles may be clipped to achieve the proper fit. round the source image's edge regions are tiled (repeated) to fill the gap between each border. tiles may be stretched to achieve the proper fit. space the source image's edge regions are tiled (repeated) to fill the gap between each border. extra space will be distributed in between tiles to achieve the proper fit. ...
...And 3 more matches
border-inline-end-width - CSS: Cascading Style Sheets
the border-inline-end-width css property defines the width of the logical inline-end border of an element, which maps to a physical border width depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-width, border-right-width, border-bottom-width, or border-left-width property depending on the values defined for writing-mode, direction, and text-orientation. ...
...ht-width, border-bottom-width, or border-left-width 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 /* <'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. ...
...ntribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send 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. 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. ...
...And 3 more matches
border-inline-start-style - CSS: Cascading Style Sheets
the border-inline-start-style css property defines the style of the logical inline start border of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-style, border-right-style, border-bottom-style, or border-left-style property depending on the values defined for writing-mode, direction, and text-orientation. ...
...ht-style, border-bottom-style, or border-left-style 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 /* <'border-style'> values */ border-inline-start-style: dashed; border-inline-start-style: dotted; border-inline-start-style: groove; related properties are border-block-start-style, border-block-end-style, and border-inline-end-style, which define the other border styles of the element. ...
...ect, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <'border-style'> values */ border-inline-start-style: dashed; border-inline-start-style: dotted; border-inline-start-style: groove; related properties are border-block-start-style, border-block-end-style, and border-inline-end-style, which define the other border styles of the element. initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete values <'border-style'> the line style of the border. see border-style. ...
...And 3 more matches
border-inline-style - CSS: Cascading Style Sheets
the border-inline-style css property defines the style of the logical inline borders of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-style and border-bottom-style, or border-left-style and border-right-style properties depending on the values defined for writing-mode, direction, and text-orientation. ...
...ines the style of the logical inline borders of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-style and border-bottom-style, or border-left-style and border-right-style properties depending on the values defined for writing-mode, direction, and text-orientation. ...
...r-left-style and border-right-style properties depending on the values defined for writing-mode, direction, and text-orientation. /* <'border-style'> values */ border-inline-style: dashed; border-inline-style: dotted; border-inline-style: groove; the border style in the other dimension can be set with border-block-style, which sets border-block-start-style, and border-block-end-style. syntax values <'border-style'> the line style of the border. see border-style. ...
...And 3 more matches
border-inline-width - CSS: Cascading Style Sheets
the border-inline-width css property defines the width of the logical inline borders of an element, which maps to a physical border width depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-width and border-bottom-width, or border-left-width, and border-right-width property depending on the values defined for writing-mode, direction, and text-orientation. ...
...fines the width of the logical inline borders of an element, which maps to a physical border width depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-width and border-bottom-width, or border-left-width, and border-right-width property depending on the values defined for writing-mode, direction, and text-orientation. ...
...rder-left-width, and border-right-width property depending on the values defined for writing-mode, direction, and text-orientation. /* <'border-width'> values */ border-inline-width: 5px 10px; border-inline-width: 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. ...
...And 3 more matches
border-spacing - CSS: Cascading Style Sheets
order-spacing css property sets the distance between the borders of adjacent <table> cells. this property applies only when border-collapse is separate. the source for this interactive example is stored in a github repository. if 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 border-spacing value is also used along the outside edge of the table, where the distance between the table's border and the 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 ...
...ong the outside edge of the table, where the distance between the table's border and the 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. ...
...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. syntax /* <length> */ border-spacing: 2px; /* horizontal <length> | vertical <length> */ border-spacing: 1cm 2em; /* global values */ border-spacing: inherit; border-spacing: initial; border-spacing: unset; the border-spacing property may be specified as either one or two values. ...
...And 3 more matches
border-top-left-radius - CSS: Cascading Style Sheets
ius (or the radius of the semi-major and semi-minor axes) of the ellipse defining the curvature of the corner. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...e to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the rounding can be a circle or an ellipse, or if one of the value is 0,no rounding is done and the corner is square. a background, being an image or a color, is clipped at the border, even a rounded one; the exact location of the clipping is defined by the value of the background-clip property. note: if the value of this property is not set in a border-radius shorthand property that is applied to the element after the border-top-left-radius 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 c...
...ter the border-top-left-radius 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. ...
...And 3 more matches
border-top-right-radius - CSS: Cascading Style Sheets
ius (or the radius of the semi-major and semi-minor axes) of the ellipse defining the curvature of the corner. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...e to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the rounding can be a circle or an ellipse, or if one of the value is 0 no rounding is done and the corner is square. a background, being an image or a color, is clipped at the border, even a rounded one; the exact location of the clipping is defined by the value of the background-clip property. note: if the value of this property is not set in a border-radius shorthand property that is applied to the element after the border-top-right-radius 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; /* th...
...e border-top-right-radius 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. ...
...And 3 more matches
box-decoration-break - CSS: Cascading Style Sheets
the box-decoration-break css property specifies how an element's fragments should be rendered when broken across multiple lines, columns, or pages. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...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 specified value will impact the appearance of the following properties: background border border-image box-shadow clip-path margin padding syntax /* keyword values */ box-decoration-break: slice; box-decoration-break: clone; /* global values */ box-decoration-break: initial; box-decoration-break: inherit; box-decoration-break: unset; the box-decoration-break property is specified as one of the keyword values listed below. values slice the element is initially rendered as if its box were not fragmented, after which the rendering for this hypothetical box is sliced into pieces for each line/column/page. note that the hypothetic...
...And 3 more matches
box-pack - CSS: Cascading Style Sheets
Web › CSS › box-pack
this is a property of the original css flexible box layout module draft, and has been replaced by a newer standard. see flexbox for information about the current standard. the -moz-box-pack and -webkit-box-pack css properties specify how a -moz-box or -webkit-box packs its contents in the direction of its layout. the effect of this is only visible if there is extra space in the box. ...
...aced by a newer standard. see flexbox for information about the current standard. the -moz-box-pack and -webkit-box-pack css properties specify how a -moz-box or -webkit-box packs its contents in the direction of its layout. the effect of this is only visible if there is extra space in the box. /* keyword values */ box-pack: start; box-pack: center; box-pack: end; box-pack: justify; /* global values */ box-pack: inherit; box-pack: initial; box-pack: unset; the direction of layout depends on the element's orientation: horizontal or vertical. syntax the box-pack property is specified as one of the keyword values listed below. values start the box packs contents at the start, leaving any extra space at the end. center the box packs contents in the center, dividing any extra space eq...
...ny extra space at the end. center the box packs contents in the center, dividing any extra space equally between the start and the end. end the box packs contents at the end, leaving any extra space at the start. justify the space is divided evenly in-between each child, with none of the extra space placed before the first child or after the last child. if there is only one child, treat the value as if it were start. notes the edge of the box designated the start for packing purposes depends on the box's orientation and direction: normal reverse horizontal left right vertical top bottom the edge opposite to the start is designated the end. if the packing is set using the element's pack attribute, then the style is ignored. formal ...
...And 3 more matches
counter-increment - CSS: Cascading Style Sheets
the counter-increment css property increases or decreases the value of a css counter by a given value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: the counter's value can be reset to an arbitrary number using the counter-reset css property. ...
...g the counter-reset css property. ...
...ement: none; /* global values */ counter-increment: inherit; counter-increment: initial; counter-increment: unset; the counter-increment property is specified as either one of the following: a <custom-ident> naming the counter, followed optionally by an <integer>. you may specify as many counters to increment as you want, with each name or name-number pair separated by a space. the keyword value none. values <custom-ident> the name of the counter to increment. <integer> the value to add to the counter. defaults to 1 if not specified. none no counter must be incremented. this is used as the default value, or to cancel an increment in more specific rules. ...
...And 3 more matches
counter-set - CSS: Cascading Style Sheets
the counter-set css property sets a css counter to a given value. it manipulates the value of existing counters, and will only create new counters if there isn't already a counter of the given name on the element. note: the counter's value can be incremented or decremented using the counter-increment css property. ...
...ounter's value can be incremented or decremented using the counter-increment css property. syntax /* set "my-counter" to 0 */ counter-set: my-counter; /* set "my-counter" to -1 */ counter-set: my-counter -1; /* set "counter1" to 1, and "counter2" to 4 */ counter-set: counter1 1 counter2 4; /* cancel any counter that could have been set in less specific rules */ counter-set: none; /* global values */ counter-set: inherit; counter-set: initial; counter-set: unset; the counter-set property is specified as either one of the following: a <custom-ident> naming the counter, followed optionally by an <integer>. you may specify as many counters to reset as you want, with each name or name-number pair separated by a space. the keyword value none. ...
...ules */ counter-set: none; /* global values */ counter-set: inherit; counter-set: initial; counter-set: unset; the counter-set property is specified as either one of the following: a <custom-ident> naming the counter, followed optionally by an <integer>. you may specify as many counters to reset as you want, with each name or name-number pair separated by a space. the keyword value none. values <custom-ident> the name of the counter to set. <integer> the value to set the counter to on each occurrence of the element. defaults to 0 if not specified. ...
...And 3 more matches
font-style - CSS: Cascading Style Sheets
their unstyled counterparts, while oblique faces are usually just sloped versions of the regular face. when the specified style is not available, both italic and oblique faces are simulated by artificially sloping the glyphs of the regular face (use font-synthesis to control this behavior). syntax font-style: normal; font-style: italic; font-style: oblique; font-style: oblique 10deg; /* global values */ font-style: inherit; font-style: initial; font-style: unset; the font-style property is specified as a single keyword chosen from the list of values below, which can optionally include an angle if the keyword is oblique. values normal selects a font that is classified as normal within a font-family. italic selects a font that is classified as italic. if no italic version of the face ...
...que <angle> selects a font classified as oblique, and additionally specifies an angle for the slant of the text. if one or more oblique faces are available in the chosen font family, the one that most closely matches the specified angle is chosen. if no oblique faces are available, the browser will synthesize an oblique version of the font by slanting a normal face by the specified amount. valid values are degree values of -90deg to 90deg inclusive. if an angle is not specified, an angle of 14 degrees is used. positive values are slanted to the end of the line, while negative values are slanted towards the beginning. in general, for a requested angle of 14 degrees or greater, larger angles are prefered; otherwise, smaller angles are preferred (see the spec's font matching section for the pr...
... (see the spec's font matching section for the precise algorithm). variable fonts variable fonts can offer a fine control over the degree to which an oblique face is slanted. you can select this using the <angle> modifier for the oblique keyword. for truetype or opentype variable fonts, the "slnt" variation is used to implement varying slant angles for oblique, and the "ital" variation with a value of 1 is used to implement italic values. see font-variation-settings. for the example below to work, you'll need a browser that supports the css fonts level 4 syntax in which font-style: oblique can accept an <angle>. html <header> <input type="range" id="slant" name="slant" min="-90" max="90" /> <label for="slant">slant</label> </header> <div class="container"> <p class="sample...
...And 3 more matches
gap (grid-gap) - CSS: Cascading Style Sheets
Web › CSS › gap
mples 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. ...
... 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. ...
...ially 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 <'colum...
...And 3 more matches
grid-auto-flow - CSS: Cascading Style Sheets
the grid-auto-flow css property controls how the auto-placement algorithm works, specifying exactly how auto-placed items get flowed into the grid. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... grid. the source for this interactive example is stored in a github repository. if 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 */ grid-auto-flow: row; grid-auto-flow: column; grid-auto-flow: dense; grid-auto-flow: row dense; grid-auto-flow: column dense; /* global values */ grid-auto-flow: inherit; grid-auto-flow: initial; grid-auto-flow: unset; this property may take one of two forms: a single keyword: one of row, column, or dense. two keywords: row dense or column dense. values row items are placed by filling each row in turn, adding new rows as necessary. if neither row nor column is provided, row is assumed. column items are placed by filling e...
...er, when doing so would fill in holes left by larger items. if it is omitted, a "sparse" algorithm is used, where the placement algorithm only ever moves "forward" in the grid when placing items, never backtracking to fill holes. this ensures that all of the auto-placed items appear "in order", even if this leaves holes that could have been filled by later items. ...
...And 3 more matches
ime-mode - CSS: Cascading Style Sheets
Web › CSS › ime-mode
it was introduced by microsoft with internet explorer 5 as a proprietary extension: -ms-ime-mode attribute | imemode property. note: in general, it's not appropriate for a public web site to change the ime mode. ...
...it was introduced by microsoft with internet explorer 5 as a proprietary extension: -ms-ime-mode attribute | imemode property. note: in general, it's not appropriate for a public web site to change the ime mode. ...
...duced by microsoft with internet explorer 5 as a proprietary extension: -ms-ime-mode attribute | imemode property. note: in general, it's not appropriate for a public web site to change the ime mode. this property should only be used for private web applications or to undo the property if it was previously set by legacy code. syntax the ime-mode property is specified using one of the keyword values listed below. values auto no change is made to the current input method editor state. this is the default. normal the ime state should be normal; this value can be used in a user style sheet to override the page's setting. this value is not supported by internet explorer. active the input method editor is initially active; text entry is performed through it unless the user specifically ...
...And 3 more matches
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. ...
... 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. ...
...l 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. ...
...And 3 more matches
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. ...
... 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. ...
...t 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. ...
...And 3 more matches
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. const...
...es */ 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. 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. ...
...-top and margin-bottom, or margin-right, and margin-left property depending on the values defined for writing-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. ...
...And 3 more matches
margin - CSS: Cascading Style Sheets
Web › CSS › margin
aced inline elements, such as <span> or <code>. note: margins create extra space around an element. in contrast, padding creates extra space within an element. ...
...s extra space within an element. 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. ...
... 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 to the right and left, the third to the bottom. when ...
...And 3 more matches
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. ...
...-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, the first width applies to the top and bottom, the second to the left and right. ...
...r-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, 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 horizont...
...And 3 more matches
mask-border - CSS: Cascading Style Sheets
see mask-border-width. <'mask-border-outset'> the distance of the border mask from the element's...
...l('border-mask.png') 25 space; /* source | slice | width */ mask-border: url('border-mask.png') 25 / 35px; /* source | slice | width | outset | repeat | mode */ mask-border: url('border-mask.png') 25 / 35px / 12px space alpha; values <'mask-border-source'> the source image. see mask-border-source. <'mask-border-slice'> the dimensions for slicing the source image into regions. up to four values may be specified. see mask-border-slice. <'mask-border-width'> the width of the border mask. up to four values may be specified. see mask-border-width. <'mask-border-outset'> the distance of the border mask from the element's outside edge. up to four values may be specified. see mask-border-outset. <'mask-border-repeat'> defines how the edge regions of the source image are adjusted to fit ...
...'mask-border-width'> the width of the border mask. up to four values may be specified. see mask-border-width. <'mask-border-outset'> the distance of the border mask from the element's outside edge. up to four values may be specified. see mask-border-outset. <'mask-border-repeat'> defines how the edge regions of the source image are adjusted to fit the dimensions of the border mask. up to two values may be specified. see mask-border-repeat. <'mask-border-mode'> defines whether the source image is treated as a luminance mask or alpha mask. see mask-border-mode. ...
...And 3 more matches
max-height - CSS: Cascading Style Sheets
the max-height css property sets the maximum height of an element. it prevents the used 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. ...
...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 the con...
...by the specified argument, i.e. 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. ...
...And 3 more matches
offset-path - CSS: Cascading Style Sheets
the offset-path css property specifies a motion path for an element to follow and defines the element's positioning within the parent container or svg coordinate system. ...
...path: ray(45deg closest-side contain); /* url */ offset-path: url(#path); /* shapes */ offset-path: circle(50% at 25% 25%); offset-path: inset(50% 50% 50% 50%); offset-path: polygon(30% 0%, 70% 0%, 100% 50%, 30% 100%, 0% 70%, 0% 30%); offset-path: path('m 0,200 q 200,200 260,80 q 290,20 400,0 q 300,100 400,200'); /* geometry boxes */ offset-path: margin-box; offset-path: stroke-box; /* global values */ offset-path: inherit; offset-path: initial; offset-path: unset; values ray() taking up to three values, defines a path that is a line segment starting from the position of the box and proceeds in the direction defined by the specified angle similar to the css gradient angle where 0deg is up, with positive angles increasing in the clockwise direction, with the size value being similar to...
... url() references the id of an svg shape -- circle, ellipse, line, path, polygon, polyline, or rect -- using the shape's geometry as the path. <basic-shape> specifies a css shape including circle(), ellipse(), inset(), polygon(), or path(). ...
...And 3 more matches
outline - CSS: Cascading Style Sheets
Web › CSS › outline
ne https://github.com/mdn/interactive-examples and send us a pull request. constituent properties this property is a shorthand for the following css properties: outline-color outline-style outline-width syntax /* style */ outline: solid; /* color | style */ outline: #f66 dashed; /* style | width */ outline: inset thick; /* color | style | width */ outline: green solid 3px; /* global values */ outline: inherit; outline: initial; outline: unset; the outline property may be specified using one, two, or three of the values listed below. the order of the values does not matter. note: the outline will be invisible for many elements if its style is not defined. this is because the style defaults to none. a notable exception is input elements, which are given default styling by browse...
...defaults to currentcolor if absent. see outline-color. <'outline-style'> sets the style of the outline. defaults to none if absent. see outline-style. <'outline-width'> sets the thickness of the outline. ...
... outline. defaults to medium if absent. see outline-width. description borders and outlines are very similar. however, outlines differ from borders in the following ways: outlines never take up space, as they are drawn outside of an element's content. according to the spec, outlines don't have to be rectangular, although they usually are. as with all shorthand properties, any omitted sub-values will be set to their initial value. accessibility concerns assigning outline a value of 0 or none will remove the browser's default focus style. if an element can be interacted with it must have a visible focus indicator. provide obvious focus styling if the default focus style is removed. how to design useful and usable focus indicators wcag 2.1: understanding success criterion 2.4.7: ...
...And 3 more matches
padding-block-end - CSS: Cascading Style Sheets
ogical 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. ...
... the source for this interactive example is stored in a github repository. if 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 this property corresponds to the padding-top, padding-right, padding-bottom, or padding-left propert...
...nd: 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 this property corresponds to the padding-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-inline-start, and padding-inline-end, which define the other paddings of the element. ...
...And 3 more matches
padding-block-start - CSS: Cascading Style Sheets
ical 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. ...
...e source for this interactive example is stored in a github repository. if 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. description this property corresponds to the padding-top, padding-right, padding-bottom, or padding-le...
... /* 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. description this property corresponds to the padding-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-end, padding-inline-start, and padding-inline-end, which define the other paddings of the element. ...
...And 3 more matches
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. ...
...dding-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. /* <length> values */ padding-block: 10px 20px; /* an absolute length */ padding-block: 1em 2em; /* relative to the text size */ padding-block: 10px; /* sets both start and end values */ /* <percentage> values */ padding-block: 5% 2%; /* relative to the nearest block container's width */ /* global values */ padding-block: inherit; padding-block: initial; padding-block: unset; these values corresponds 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. constit...
...ding-block: inherit; padding-block: initial; padding-block: unset; these values corresponds 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. 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. ...
...And 3 more matches
padding-inline-end - CSS: Cascading Style Sheets
gical 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. ...
...n. the source for this interactive example is stored in a github repository. if 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 this property corresponds to the padding-top, padding-right, padding-bottom, or padding-left prope...
...d: 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 this property corresponds to the padding-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-start, which define the other paddings of the element. ...
...And 3 more matches
padding-inline-start - CSS: Cascading Style Sheets
cal 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. ...
... the source for this interactive example is stored in a github repository. if 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. description this property corresponds to the padding-top, padding-right, padding-bottom, or padding...
... /* 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. description this property corresponds to the padding-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. ...
...And 3 more matches
padding - CSS: Cascading Style Sheets
Web › CSS › padding
space around an element. ...
... padding-left padding-right 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. ...
...m; /* 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. ...
...And 3 more matches
paint-order - CSS: Cascading Style Sheets
the paint-order css property lets you control the order in which the fill and stroke (and painting markers) of text content and shapes are drawn. ...
... the paint-order css property lets you control the order in which the fill and stroke (and painting markers) of text content and shapes are drawn. ...
...tax /* normal */ paint-order: normal; /* single values */ paint-order: stroke; /* draw the stroke first, then fill and markers */ paint-order: markers; /* draw the markers first, then fill and stroke */ /* multiple values */ paint-order: stroke fill; /* draw the stroke first, then the fill, then the markers */ paint-order: markers stroke fill; /* draw markers, then stroke, then fill */ if no value is specified, the default paint order is fill, stroke, markers. when one value is specified, that one is painted first, followed by the other two in their default order relative to one another. when two values are specified, they will be painted in the order they are specified in, followed by the unspecified one. note: in the case of this property, markers are only appropriate when drawing svg...
...And 3 more matches
rotate - CSS: Cascading Style Sheets
Web › CSS › rotate
the rotate css property allows you to specify rotation transforms individually and independently of the transform 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 property. ...
... the rotate css property allows you to specify rotation transforms individually and independently of the transform 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 property. ...
...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 property. syntax /* keyword values */ rotate: none; /* angle value */ rotate: 90deg; rotate: 0.25turn; rotate: 1.57rad; /* x, y, or z axis name plus angle */ rotate: x 90deg; rotate: y 0.25turn; rotate: z 1.57rad; /* vector plus angle value */ rotate: 1 1 1 90deg; values angle value an <angle> specifying the angle to rotate the affected element through, around the z axis. equivalent to a rotate() (2d rotation) function. x, y, or z axis name plus angle value the name of the axis you want to rotate the affected element around ("x", "y", or "z"), plus an <angle> specifying the angle to rotate the element through. equivalent to a...
...And 3 more matches
row-gap (grid-row-gap) - CSS: Cascading Style Sheets
Web › CSS › row-gap
t, 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. ...
... 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. ...
...d 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. ...
...And 3 more matches
ruby-position - CSS: Cascading Style Sheets
the ruby-position css property defines the position of a ruby element relatives to its base element. it can be position over the element (over), under it (under), or between the characters, on their right side (inter-character). /* keyword values */ ruby-position: over; ruby-position: under; ruby-position: inter-character; /* global values */ ruby-position: inherit; ruby-position: initial; ruby-position: unset; syntax values over is a keyword indicating that the ruby has to be placed over the main text for horizontal scripts and right to it for vertical scripts. under is a keyword indicating that the ruby has to be placed under the main text for horizontal scripts and left to it for vertical scripts. inter-character is a keyword indicating that the ruby has to be placed...
...ndicating that the ruby has to be placed over the main text for horizontal scripts and right to it for vertical scripts. under is a keyword indicating that the ruby has to be placed under the main text for horizontal scripts and left to it for vertical scripts. inter-character is a keyword indicating that the ruby has to be placed between the different characters. ...
...izontal scripts and right to it for vertical scripts. under is a keyword indicating that the ruby has to be placed under the main text for horizontal scripts and left to it for vertical scripts. inter-character is a keyword indicating that the ruby has to be placed between the different characters. ...
...And 3 more matches
shape-margin - CSS: Cascading Style Sheets
e 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. ...
...xample is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the margin lets you adjust the distance between the edges of the shape (the float element) and the surrounding content. ...
.... if 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. ...
...And 3 more matches
text-emphasis-style - CSS: Cascading Style Sheets
the text-emphasis-style css property sets the appearance of emphasis marks. it can also be set, and reset, using the text-emphasis shorthand. /* initial value */ text-emphasis-style: none; /* no emphasis marks */ /* <string> values */ text-emphasis-style: 'x'; text-emphasis-style: '点'; text-emphasis-style: '\25b2'; text-emphasis-style: '*'; text-emphasis-style: 'foo'; /* should not be used. ...
... emphasis marks. it can also be set, and reset, using the text-emphasis shorthand. /* initial value */ text-emphasis-style: none; /* no emphasis marks */ /* <string> values */ text-emphasis-style: 'x'; text-emphasis-style: '点'; text-emphasis-style: '\25b2'; text-emphasis-style: '*'; text-emphasis-style: 'foo'; /* should not be used. ...
... filled the shape is filled with solid color. if neither filled nor open is present, this is the default. ...
...And 3 more matches
text-orientation - CSS: Cascading Style Sheets
-mode is not horizontal-tb). it is useful for controlling the display of languages that use vertical script, and also for making vertical table headers. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ text-orientation: mixed; text-orientation: upright; text-orientation: sideways-right; text-orientation: sideways; text-orientation: use-glyph-orientation; /* global values */ text-orientation: inherit; text-orientation: initial; text-orientation: unset; the text-orientation property is specified as a single keyword from the list below. values mixed rotates the characters of horizontal scripts 90° clockwise. lays out the characters of vertical scripts naturally. default value. upright lays out the characters of horizontal scripts naturally (upright), as w...
...as a single keyword from the list below. values mixed rotates the characters of horizontal scripts 90° clockwise. lays out the characters of vertical scripts naturally. default value. upright lays out the characters of horizontal scripts naturally (upright), as well as the glyphs for vertical scripts. note that this keyword causes all characters to be considered as left-to-right: the used value of direction is forced to be ltr. sideways causes characters to be laid out as they would be horizontally, but with the whole line rotated 90° clockwise. sideways-right an alias to sideways that is kept for compatibility purposes. ...
...And 3 more matches
text-rendering - CSS: Cascading Style Sheets
the text-rendering css property provides information to the rendering engine about what to optimize for when rendering text. the browser makes trade-offs among speed, legibility, and geometric precision. /* keyword values */ text-rendering: auto; text-rendering: optimizespeed; text-rendering: optimizelegibility; text-rendering: geometricprecision; /* global values */ text-rendering: inherit; text-rendering: initial; text-rendering: unset; note: the text-rendering property is an svg property that is not defined in any css standard. however, gecko and webkit browsers let you apply this property to html and xml content on windows, macos, and linux. one very visible effect is optimizelegibility, which enables ligatures (ff, fi, fl, etc.) in text smaller than 20px for some fonts (for exampl...
...rty that is not defined in any css standard. however, gecko and webkit browsers let you apply this property to html and xml content on windows, macos, and linux. one very visible effect is optimizelegibility, which enables ligatures (ff, fi, fl, etc.) in text smaller than 20px for some fonts (for example, microsoft's calibri, candara, constantia, and corbel, or the dejavu font family). syntax values auto the browser makes educated guesses about when to optimize for speed, legibility, and geometric precision while drawing text. for differences in how this value is interpreted by the browser, see the compatibility table. optimizespeed the browser emphasizes rendering speed over legibility and geometric precision when drawing text. it disables kerning and ligatures. optimizelegibility ...
...ometric precision when drawing text. it disables kerning and ligatures. optimizelegibility the browser emphasizes legibility over rendering speed and geometric precision. this enables kerning and optional ligatures. geometricprecision the browser emphasizes geometric precision over rendering speed and legibility. certain aspects of fonts — such as kerning — don't scale linearly. so this value can make text using those fonts look good. in svg, when text is scaled up or down, browsers calculate the final size of the text (which is determined by the specified font size and the applied scale) and request a font of that computed size from the platform's font system. but if you request a font size of, say, 9 with a scale of 140%, the resulting font size of 12.6 doesn't explicitly exist in...
...And 3 more matches
text-size-adjust - CSS: Cascading Style Sheets
the text-size-adjust css property controls the text inflation algorithm used on some smartphones and tablets. other browsers will ignore this property. /* keyword values */ text-size-adjust: none; text-size-adjust: auto; /* <percentage> value */ text-size-adjust: 80%; /* global values */ text-size-adjust: inherit; text-size-adjust: initial; text-size-adjust: unset; because many websites have not been developed with small devices in mind, mobile browsers differ from desktop browsers in the way they render web pages. instead of laying out pages at the width of the device screen, they lay them out using a viewport that is much wider, usually 800 or 1000 pixels. to map the extra-wide layout back to the original device size, they either show only part of the whole render or scale the...
...o make it more readable. when an element containing text uses 100% of the screen's width, the algorithm increases its text size, but without modifying the layout. the text-size-adjust property allows web authors to disable or modify this behavior, as web pages designed with small screens in mind do not need it. syntax the text-size-adjust property is specified as none, auto, or a <percentage>. ...
...ts text size, but without modifying the layout. the text-size-adjust property allows web authors to disable or modify this behavior, as web pages designed with small screens in mind do not need it. syntax the text-size-adjust property is specified as none, auto, or a <percentage>. values none disables the browser's inflation algorithm. auto enables the browser's inflation algorithm. this value is used to cancel a none value previously set with css. ...
...And 3 more matches
var() - CSS: Cascading Style Sheets
Web › CSS › var
the var() css function can be used to insert the value of a custom property (sometimes called a "css variable") instead of any part of a value of another property. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the var() function cannot be used in property names, selectors or anything else besides property values. (doing so usually produces invalid syntax, or else a value whose meaning has no connection to the variable.) syntax the first argument to the function is the name of the custom property to be substituted. an optional second argument to the function serves as a fallback value. if the custom property refer...
...esides property values. (doing so usually produces invalid syntax, or else a value whose meaning has no connection to the variable.) syntax the first argument to the function is the name of the custom property to be substituted. an optional second argument to the function serves as a fallback value. if the custom property referenced by the first argument is invalid, the function uses the second value. var( <custom-property-name> , <declaration-value>? ...
...e custom property referenced by the first argument is invalid, the function uses the second value. var( <custom-property-name> , <declaration-value>? ...
...And 3 more matches
will-change - CSS: Cascading Style Sheets
set up optimizations before an element is actually changed. these kinds of optimizations can increase the responsiveness of a page by doing potentially expensive work before they are actually required. important: will-change is intended to be used as a last resort, in order to try to deal with existing performance problems. it should not be used to anticipate performance problems. ...
...the browser already tries as hard as it can to optimize everything. ...
...ptimizations required for the property change before the property change actually happens. so it is important to give the browser some time to actually do the optimizations. find some way to predict at least slightly ahead of time that something will change, and set will-change then. ...
...And 3 more matches
Event reference
successful. loadend progress has stopped (after "error", "abort", or "load" have been dispatched). loadstart progress has begun. progress in progress. timeout progression is terminated due to preset time expiring. storage events change (see non-standard events) storage update events checking downloading error noupdate obsolete updateready value change events broadcast checkboxstatechange hashchange input radiostatechange readystatechange valuechange uncategorized events invalid message message open show less common and non-standard events abortable fetch events event name fired when abort a dom request is aborted, i.e. using abortcontroller.abort(). svg events svgabort svgerror svgload svgresize...
...oaded to play the media up to its end without having to stop for further buffering of content. canplaythrough event html5 media the user agent can play the media up to its end without having to stop for further buffering of content. change event dom l2, html5 the change event is fired for <input>, <select>, and <textarea> elements when a change to the element's value is committed by the user. chargingchange event battery status the battery begins or stops charging. chargingtimechange event battery status the chargingtime attribute has been updated. click mouseevent dom l3 a pointing device button has been pressed and released on an element. close event websocket a websocket connection has...
...nt battery status the dischargingtime attribute has been updated. domactivate uievent dom l3 a button, link, or state changing element is activated (use click instead). domattributenamechanged mutationnameevent dom l3 removed the name of an attribute changed (use mutation observers instead). domattrmodified mutationevent dom l3 the value of an attribute has been modified (use mutation observers instead). domcharacterdatamodified mutationevent dom l3 a text or another characterdata has changed (use mutation observers instead). domcontentloaded event html5 the document has finished loading (but not its dependent resources). domelementnamechanged mutationnameevent dom l3 removed...
...And 3 more matches
The HTML autocomplete attribute - HTML: Hypertext Markup Language
the html autocomplete attribute is available on <input> elements that take a text or numeric value as input, <textarea> elements, <select> elements, and <form> elements. autocomplete lets web developers specify what if any permission the user agent has to provide automated assistance in filling out form field values, as well as guidance to the browser as to the type of information expected in the field. the source of the suggested values is generally up to the browser; typically values come from past values entered by the user, but they may also come from pre-configured values. for instance, a browser might let the user save their name, address, phone number, and email addresses for autocomplete purposes. perhaps the browser offers the ability to save encrypted credit card information, for au...
...m> element that the element is a descendant of, or the <form> whose id is specified by the form attribute of the element. for more information, see the autocomplete attribute in <form>. in order to provide autocompletion, user-agents might require <input>/<select>/<textarea> elements to: have a name and/or id attribute be descendants of a <form> element the form to have a submit button values "off" the browser is not permitted to automatically enter or select a value for this field. it is possible that the document or application provides its own autocomplete feature, or that security concerns require that the field's value not be automatically entered. note: in most modern browsers, setting autocomplete to "off" will not prevent a password manager from asking the user if they w...
...ield. it is possible that the document or application provides its own autocomplete feature, or that security concerns require that the field's value not be automatically entered. note: in most modern browsers, setting autocomplete to "off" will not prevent a password manager from asking the user if they would like to save username and password information, or from automatically filling in those values in a site's login form. see the autocomplete attribute and login fields. "on" the browser is allowed to automatically complete the input. no guidance is provided as to the type of data expected in the field, so the browser may use its own judgement. "name" the field expects the value to be a person's full name. using "name" rather than breaking the name down into its components is generall...
...And 3 more matches
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
Web › HTML › Element › audio
to properly use autoplay. controls if this attribute is present, the browser will offer controls to allow the user to control audio playback, including volume, seeking, and pause/resume playback. crossorigin this enumerated attribute indicates whether to use cors to fetch the related audio file. cors-enabled resources can be reused in the <canvas> element without being tainted. the allowed values are: anonymous sends a cross-origin request without a credential. in other words, it sends the origin: http header without a cookie, x.509 certificate, or performing http basic authentication. if the server does not give credentials to the origin site (by not setting the access-control-allow-origin: http header), the image will be tainted, and its usage restricted. use-credentials send...
...s usage restricted. when not present, the resource is fetched without a cors request (i.e. without sending the origin: http header), preventing its non-tainted used in <canvas> elements. if invalid, it is handled as if the enumerated keyword anonymous was used. see cors settings attributes for additional information. currenttime reading currenttime returns a double-precision floating-point value indicating the current playback position, in seconds, of the audio. if the audio's metadata isn't available yet—thereby preventing you from knowing the media's start time or duration—currenttime instead indicates, and can be used to change, the time at which playback will begin. otherwise, setting currenttime sets the current playback position to the given time and seeks the media to that pos...
... 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). 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 play...
...And 3 more matches
<col> - HTML: Hypertext Markup Language
Web › HTML › Element › col
up> must not have a span attribute. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmltablecolelement attributes this element includes the global attributes. span this attribute contains a positive integer indicating the number of consecutive columns the <col> element spans. ...
...secutive columns the <col> element spans. if not present, its default value is 1. deprecated attributes the following attributes are deprecated and should not be used. they are documented below for reference when updating existing code and for historical interest only. align this enumerated attribute specifies how horizontal alignment of each column cell content will be handled. possible values are: left, aligning the content to the left of the cell center, centering the content in the cell right, aligning the content to the right of the cell justify, inserting spaces into the textual content so that the content is justified in the cell if this attribute is not set, its value is inherited from the align of the <colgroup> element this <col> element belongs too. if there ar...
...aligning the content to the left of the cell center, centering the content in the cell right, aligning the content to the right of the cell justify, inserting spaces into the textual content so that the content is justified in the cell if this attribute is not set, its value is inherited from the align of the <colgroup> element this <col> element belongs too. if there are none, the left value is assumed. note: to achieve the same effect as the left, center, right or justify values: do not try to set the text-align property on a selector giving a <col> element. because <td> elements are not descendant of the <col> element, they won't inherit it. if the table doesn't use a colspan attribute, use the td:nth-child(an+b) css selector. set a to zero and b to the positio...
...And 3 more matches
<meta>: The Document-level Metadata element - HTML: Hypertext Markup Language
Web › HTML › Element › meta
ovides user-defined metadata. attributes this element includes the global attributes. note: the attribute name has a specific meaning for the <meta> element, and the itemprop attribute must not be set on the same <meta> element that has any existing name, http-equiv or charset attributes. charset this attribute declares the document's character encoding. ...
...te name has a specific meaning for the <meta> element, and the itemprop attribute must not be set on the same <meta> element that has any existing name, http-equiv or charset attributes. charset this attribute declares the document's character encoding. if the attribute is present, its value must be an ascii case-insensitive match for the string "utf-8". content this attribute contains the value for the http-equiv or name attribute, depending on which is used. http-equiv defines a pragma directive. the attribute is named http-equiv(alent) because all the allowed values are names of particular http headers: content-security-policy allows page authors to define a content policy for the current page. content policies mostly specify allowed server origins and script endpoints wh...
...is named http-equiv(alent) because all the allowed values are names of particular http headers: content-security-policy allows page authors to define a content policy for the current page. content policies mostly specify allowed server origins and script endpoints which help guard against cross-site scripting attacks. content-type if specified, the content attribute must have the value "text/html; charset=utf-8". note: can only be used in documents served with a text/html mime type — not in documents served with an xml mime type. default-style sets the name of the default css style sheet set. x-ua-compatible if specified, the content attribute must have the value "ie=edge". user agents are required to ignore this pragma. refresh this instruction speci...
...And 3 more matches
Server-Timing - HTTP
nd server timing metrics (e.g. database read/write, cpu time, file system access, etc.) in the developer tools in the user's browser or in the performanceservertiming interface. ...
...trics (e.g. database read/write, cpu time, file system access, etc.) in the developer tools in the user's browser or in the performanceservertiming interface. ...
... response header forbidden header name no syntax the syntax of the server-timing header allows you to communicate metrics in different ways: server metric name only, metric with value, metric with value and description, and metric with description. the specification advices that names and descriptions should be kept as short as possible (use abbreviations and omit optional values where possible) to minimize the http overhead. ...
...And 3 more matches
Proxy Auto-Configuration (PAC) file - HTTP
is network.proxy.autoconfig_url.include_path. host the hostname extracted from the url. this is only for convenience; it is the same string as between :// and the first : or / after that. the port number is not included in this parameter. it can be extracted from the url when necessary. description returns a string describing the configuration. ...
..._url.include_path. host the hostname extracted from the url. this is only for convenience; it is the same string as between :// and the first : or / after that. the port number is not included in this parameter. it can be extracted from the url when necessary. description returns a string describing the configuration. the format of this string is defined in return value format below. ...
... http host:port the specified proxy should be used https host:port the specified https proxy should be used socks4 host:port socks5 host:port the specified socks server (with the specified sock version) should be used if there are multiple semicolon-separated settings, the left-most setting will be used, until firefox fails to establish the connection to the proxy. in that case, the next value will be used, etc. the browser will automatically retry a previously unresponsive proxy after 30 minutes. additional attempts will continue beginning at one hour, always adding 30 minutes to the elapsed time between attempts. if all proxies are down, and there was no direct option specified, the browser will ask if proxies should be temporarily ignored, and direct connections attempted. after 2...
...And 3 more matches
Arrow function expressions - JavaScript
ents } singleparam => { statements } // the parameter list for a function with no parameters should be written with a pair of parentheses. () => { statements } advanced syntax // parenthesize the body of a function to return an object literal expression: params => ({foo: bar}) // rest parameters and default parameters are supported (param1, param2, ...rest) => { statements } (param1 = defaultvalue1, param2, …, paramn = defaultvaluen) => { statements } // destructuring within the parameter list is also supported var f = ([a, b] = [1, 2], {x: c} = {x: a + b}) => a + b + c; f(); // 6 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. ...
...s to the property we want to get whereas the // obviously non-special `lengthfoobarx` is just the name of a variable which can be changed // to any valid variable name you want elements.map(({ length: lengthfoobarx }) => lengthfoobarx); // [8, 6, 7, 9] // this destructuring parameter assignment can also be written as seen below. however, note that in // this example we are not assigning `length` value to the made up property. instead, the literal name // itself of the variable `length` is used as the property we want to retrieve from the object. elements.map(({ length }) => length); // [8, 6, 7, 9] no separate this before arrow functions, every new function defined its own this value based on how the function was called: a new object in the case of a constructor. undefined in strict mod...
...f itself. this.age = 0; setinterval(function growup() { // in non-strict mode, the growup() function defines `this` // as the global object (because it's where growup() is executed.), // which is different from the `this` // defined by the person() constructor. ...
...And 3 more matches
Array.prototype.includes() - JavaScript
the includes() method determines whether an array includes a certain value among its entries, 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 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. ...
...n/interactive-examples and send us a pull request. syntax arr.includes(valuetofind[, fromindex]) parameters valuetofind the value to search for. note: when comparing strings and characters, includes() is case-sensitive. fromindex optional the position in this array at which to begin searching for valuetofind. the first element to be searched is found at fromindex for positive values of fromindex, or at arr.length + fromindex for negative values of fromindex (using the absolute value of fromindex as the number of elements from the end of the array at which to start the search). defaults to 0. ...
...ve. fromindex optional the position in this array at which to begin searching for valuetofind. the first element to be searched is found at fromindex for positive values of fromindex, or at arr.length + fromindex for negative values of fromindex (using the absolute value of fromindex as the number of elements from the end of the array at which to start the search). defaults to 0. return value a boolean which is true if the value valuetofind is found within the array (or the part of the array indicated by the index fromindex, if specified). values of zero are all considered to be equal, regardless of sign. ...
...And 3 more matches
Date.prototype.setFullYear() - JavaScript
the setfullyear() method sets the full year for a specified date according to local time. returns new timestamp. the source for this interactive example is stored in a github repository. if 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 setfullyear() method sets the full year for a specified date according to local time. returns new timestamp. the source for this interactive example is stored in a github repository. if 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 setfullyear() method sets the full year for a specified date according to local time. returns new timestamp. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 3 more matches
Date.prototype.setUTCMinutes() - JavaScript
the setutcminutes() method sets the minutes for a specified date according to universal time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... the setutcminutes() method sets the minutes for a specified date according to universal time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... the setutcminutes() method sets the minutes for a specified date according to universal time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 3 more matches
Intl.ListFormat - JavaScript
those of the provided locales that are supported without having to fall back to the runtime's default locale. instance methods intl.listformat.prototype.format() returns a language-specific formatted string representing the elements of the list. intl.listformat.prototype.formattoparts() returns an array of objects representing the different components that can be used to format a list of values in a locale-aware fashion. 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 intl.listformat('en-gb', { style: 'long', type: 'conjunction' }).format(list)); // > motorcycle, bus and car console.log(new intl.listformat('en-gb', { style: 'short', type: 'disjunction' }).for...
... ...
... ...
...And 3 more matches
Intl.RelativeTimeFormat.prototype.format() - JavaScript
the intl.relativetimeformat.prototype.format() method formats a value and unit according to the locale and formatting options of this relativetimeformat object. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax relativetimeformat.format(value, unit) parameters value numeric value to use in the internationalized relative time message. unit unit to use in the relative time internationalized message. possible values are: "year", "quarter", "month", "week", "day", "hour", "minute", "second". plural forms are also permitted. ...
...yntax relativetimeformat.format(value, unit) parameters value numeric value to use in the internationalized relative time message. unit unit to use in the relative time internationalized message. possible values are: "year", "quarter", "month", "week", "day", "hour", "minute", "second". plural forms are also permitted. description the function returned by the format getter formats a value and a unit into a string according to the locale and formatting options of this intl.relativetimeformat object. examples basic format usage the following example shows how to create a relative time formatter using the english language. // create a relative time formatter in your locale // with default values explicitly passed in. const rtf = new intl.relativetimeformat("en", { localematch...
... according to the locale and formatting options of this intl.relativetimeformat object. examples basic format usage the following example shows how to create a relative time formatter using the english language. // create a relative time formatter in your locale // with default values explicitly passed in. const rtf = new intl.relativetimeformat("en", { localematcher: "best fit", // other values: "lookup" numeric: "always", // other values: "auto" style: "long", // other values: "short" or "narrow" }); // format relative time using negative value (-1). rtf.format(-1, "day"); // > "1 day ago" // format relative time using positive value (1). rtf.format(1, "day"); // > "in 1 day" using the auto option if numeric:auto option is passed, it will produce the string yesterday or t...
...And 3 more matches
JSON - JavaScript
it can't be called or constructed, and aside from its two method properties, it has no interesting functionality of its own. description javascript and json differences json is a syntax for serializing objects, arrays, numbers, strings, booleans, and null. it is based upon javascript syntax but is distinct from it: some javascript is not json. objects and arrays property names must be double-quoted strings; trailing commas are forbidden. numbers leading zeros are prohibited. a decimal point must be followed by at least one digit. nan and infinity are unsupported. ...
...s must contain no whitespace) or jsonstring (where it is interpreted as the corresponding character in the string, or would cause an error). the tab character (u+0009), carriage return (u+000d), line feed (u+000a), and space (u+0020) characters are the only valid whitespace characters. ...
...ng (where it is interpreted as the corresponding character in the string, or would cause an error). the tab character (u+0009), carriage return (u+000d), line feed (u+000a), and space (u+0020) characters are the only valid whitespace characters. static methods json.parse(text[, reviver]) parse the string text as json, optionally transform the produced value and its properties, and return the value. ...
...And 3 more matches
Map.prototype[@@iterator]() - JavaScript
the initial value of the @@iterator property is the same function object as the initial value of the entries method. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax mymap[symbol.iterator] return value the map iterator function, which is the entries() function by default. ...
...oject, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax mymap[symbol.iterator] return value the map iterator function, which is the entries() function by default. ...
...tive-examples and send us a pull request. syntax mymap[symbol.iterator] return value the map iterator function, which is the entries() function by default. ...
...And 3 more matches
Math.random() - JavaScript
ver that range — which you can then scale to your desired range. the implementation selects the initial seed to the random number generation algorithm; it cannot be chosen or reset by the user. math.random() does not provide cryptographically secure random numbers. do not use them for anything related to security. use the web crypto api instead, and more precisely the window.crypto.getrandomvalues() method. syntax math.random() return value a floating-point, pseudo-random number between 0 (inclusive) and 1 (exclusive). examples note that as numbers in javascript are ieee 754 floating point numbers with round-to-nearest-even behavior, the ranges claimed for the functions below (excluding the one for math.random() itself) aren't exact. if extremely large bounds are chosen (253 or hig...
...vior, the ranges claimed for the functions below (excluding the one for math.random() itself) aren't exact. if extremely large bounds are chosen (253 or higher), it's possible in extremely rare cases to calculate the usually-excluded upper bound. ...
... for math.random() itself) aren't exact. if extremely large bounds are chosen (253 or higher), it's possible in extremely rare cases to calculate the usually-excluded upper bound. getting a random number between 0 (inclusive) and 1 (exclusive) function getrandom() { return math.random(); } getting a random number between two values this example returns a random number between the specified values. ...
...And 3 more matches
Math.random() - JavaScript
ver that range — which you can then scale to your desired range. the implementation selects the initial seed to the random number generation algorithm; it cannot be chosen or reset by the user. math.random() does not provide cryptographically secure random numbers. do not use them for anything related to security. use the web crypto api instead, and more precisely the window.crypto.getrandomvalues() method. syntax math.random() return value a floating-point, pseudo-random number between 0 (inclusive) and 1 (exclusive). examples note that as numbers in javascript are ieee 754 floating point numbers with round-to-nearest-even behavior, the ranges claimed for the functions below (excluding the one for math.random() itself) aren't exact. if extremely large bounds are chosen (253 or hig...
...vior, the ranges claimed for the functions below (excluding the one for math.random() itself) aren't exact. if extremely large bounds are chosen (253 or higher), it's possible in extremely rare cases to calculate the usually-excluded upper bound. ...
... for math.random() itself) aren't exact. if extremely large bounds are chosen (253 or higher), it's possible in extremely rare cases to calculate the usually-excluded upper bound. getting a random number between 0 (inclusive) and 1 (exclusive) function getrandom() { return math.random(); } getting a random number between two values this example returns a random number between the specified values. ...
...And 3 more matches
Number.isInteger() - JavaScript
the number.isinteger() method determines whether the passed value is an integer. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax number.isinteger(value) parameters value the value to be tested for being an integer. return value a boolean indicating whether or not the given value is an integer. description if the target value is an integer, return true, otherwise return false. if the value is nan or infinity, return false. the method will also return true for floating point numbers that can be represented as integer. ...
...ested for being an integer. return value a boolean indicating whether or not the given value is an integer. description if the target value is an integer, return true, otherwise return false. if the value is nan or infinity, return false. the method will also return true for floating point numbers that can be represented as integer. ...
...r. return value a boolean indicating whether or not the given value is an integer. description if the target value is an integer, return true, otherwise return false. if the value is nan or infinity, return false. the method will also return true for floating point numbers that can be represented as integer. ...
...And 3 more matches
Number.isSafeInteger() - 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. a safe integer is an integer that can be exactly represented as an ieee-754 double precision number, and whose ieee-754 representation cannot be the result of rounding any other integer to fit the ieee-754 representation. for example, 253 - 1 is a safe integer: it can be exactly represented, and no other integer rounds to it under any ieee-754 rounding mode. ...
...ieee-754 rounding mode. in contrast, 253 is not a safe integer: it can be exactly represented in ieee-754, but the integer 253 + 1 can't be directly represented in ieee-754 but instead rounds to 253 under round-to-nearest and round-to-zero rounding. the safe integers consist of all integers from -(253 - 1) inclusive to 253 - 1 inclusive (± 9007199254740991 or ± 9,007,199,254,740,991). ...
...254740991 or ± 9,007,199,254,740,991). handling values larger or smaller than ~9 quadrillion with full precision requires using an arbitrary precision arithmetic library. see what every programmer needs to know about floating point arithmetic for more information on floating point representations of numbers. for larger integers, consider using the bigint type. syntax number.issafeinteger(testvalue) parameters testvalue the value to be tested for being a safe integer. return value a boolean indicating whether or not the given value is a number that is a safe integer. ...
...And 3 more matches
Promise() constructor - JavaScript
c, rejectionfunc){ // typically, some asynchronous operation. } at the time when the constructor generates the new promiseobj, it also generates a corresponding pair of functions for resolutionfunc and rejectionfunc; these are "tethered" to the promiseobj. therefore, the code within the executor has the opportunity to perform some operation and then reflect the operation's outcome(if the value is not another promise object) as either "fulfilled" or "rejected" by terminating with an invocation of either the resolutionfunc or the rejectionfunc, respectively. the executor has no meaningful return value. it communicates via the side-effect caused by resolutionfunc or rejectionfunc. the side-effect is that the promiseobj becomes "resolved." typically, it works like this: the operation ...
... the executor might also include a try{} catch() block that invokes rejectionfunc upon error. ...
...tes via the side-effect caused by resolutionfunc or rejectionfunc. the side-effect is that the promiseobj becomes "resolved." typically, it works like this: the operation within executor is asynchronous and provides a callback. the callback is defined within the executor code. the callback terminates by invoking resolutionfunc. the invocation of resolutionfunc includes a value parameter. the value is passed back to the tethered promiseobj. the promiseobj (asynchronously) invokes any .then() associated with it. the value received by promiseobj.then() is passed to the invocation of handlefulfilled as an input parameter (see "chained promises" section). the executor might also include a try{} catch() block that invokes rejectionfunc upon error. the signatures of these two functions are sim...
...And 3 more matches
Proxy() constructor - JavaScript
handler functions you can define. handler functions are sometimes called traps, because they trap calls to the underlying target object. handler.apply() a trap for a function call. handler.construct() a trap for the new operator. handler.defineproperty() a trap for object.defineproperty. handler.deleteproperty() a trap for the delete operator. handler.get() a trap for getting property values. handler.getownpropertydescriptor() a trap for object.getownpropertydescriptor. handler.getprototypeof() a trap for object.getprototypeof. handler.has() a trap for the in operator. handler.isextensible() a trap for object.isextensible. handler.ownkeys() a trap for object.getownpropertynames and object.getownpropertysymbols. handler.preventextensions() a trap for object.preventextensi...
...r object.getownpropertydescriptor. handler.getprototypeof() a trap for object.getprototypeof. handler.has() a trap for the in operator. handler.isextensible() a trap for object.isextensible. handler.ownkeys() a trap for object.getownpropertynames and object.getownpropertysymbols. handler.preventextensions() a trap for object.preventextensions. ...
...getownpropertynames and object.getownpropertysymbols. handler.preventextensions() a trap for object.preventextensions. handler.set() a trap for setting property values. handler.setprototypeof() a trap for object.setprototypeof. examples selectively proxy property accessors in this example the target has two properties, notproxied and proxied. we define a handler that returns a different value for proxied, and lets any other accesses through to the target. ...
...And 3 more matches
Set.prototype.forEach() - JavaScript
the foreach() method executes a provided function once for each value in the set object, in insertion order. the source for this interactive example is stored in a github repository. if 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 myset.foreach(callback[, thisarg]) parameters callback function to execute for each element, taking three arguments: currentvalue, currentkey the current element being processed in the set. as there are no keys in set, the value is passed for both arguments. set the set object which foreach() was called upon. thisarg value to use as this when executing callback. return value undefined. description the foreach() method executes ...
...t, taking three arguments: currentvalue, currentkey the current element being processed in the set. as there are no keys in set, the value is passed for both arguments. set the set object which foreach() was called upon. thisarg value to use as this when executing callback. return value undefined. description the foreach() method executes the provided callback once for each value which actually exists in the set object. it is not invoked for values which have been deleted. however, it is executed for values which are present but have the value undefined. ...
...arg value to use as this when executing callback. return value undefined. description the foreach() method executes the provided callback once for each value which actually exists in the set object. it is not invoked for values which have been deleted. however, it is executed for values which are present but have the value undefined. callback is invoked with three arguments: the element value the element key the set object being traversed there are no keys in set objects, however, so the first two arguments are both values contained in the set. this is to make it consistent with other foreach() methods for map and array. if a thisarg parameter is provided to foreach(), it will be passed to callback when invoked, for use as its this value. ...
...And 3 more matches
String.prototype.localeCompare() - JavaScript
ese arguments customize the behavior of the function and let applications specify the language whose formatting conventions should be used. in implementations which ignore the locales and options arguments, the locale used and the form of the string returned are entirely implementation-dependent. see the intl.collator() constructor for details on these parameters and how to use them. return value a negative number if referencestr occurs before comparestring; positive if the referencestr occurs after comparestring; 0 if they are equivalent. description returns an integer indicating whether the referencestr comes before, after or is equivalent to the comparestring. negative when the referencestr occurs before comparestring positive when the referencestr occurs after comparestring re...
...g; positive if the referencestr occurs after comparestring; 0 if they are equivalent. description returns an integer indicating whether the referencestr comes before, after or is equivalent to the comparestring. negative when the referencestr occurs before comparestring positive when the referencestr occurs after comparestring returns 0 if they are equivalent do not rely on exact return values of -1 or 1! negative and positive integer results vary between browsers (as well as between browser versions) because the w3c specification only mandates negative and positive values. some browsers may return -2 or 2, or even some other negative or positive value. performance when comparing large numbers of strings, such as in sorting large arrays, it is better to create an intl.collator o...
... mandates negative and positive values. some browsers may return -2 or 2, or even some other negative or positive value. performance when comparing large numbers of strings, such as in sorting large arrays, it is better to create an intl.collator object and use the function provided by its compare property. examples using localecompare() // the letter "a" is before "c" yielding a negative value 'a'.localecompare('c'); // -2 or -1 (or some other negative value) // alphabetically the word "check" comes after "against" yielding a positive value 'check'.localecompare('against'); // 2 or 1 (or some other positive value) // "a" and "a" are equivalent yielding a neutral value of zero 'a'.localecompare('a'); // 0 sort an array localecompare() enables case-insensitive sorting for an array. ...
...And 3 more matches
TypedArray.prototype.every() - JavaScript
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.every(callback[, thisarg]) parameters callback function to test for each element, taking three arguments: currentvalue the current element being processed in the typed array. index the index of the current element being processed in the typed array. array the typed array every was called upon. thisarg optional. value to use as this when executing callback. return value true if the callback function returns a truthy value for every array element; otherwise, false. description the every method ...
... array the typed array every was called upon. thisarg optional. value to use as this when executing callback. return value true if the callback function returns a truthy value for every array element; otherwise, false. description the every method executes the provided callback function once for each element present in the typed array until it finds one where callback returns a falsy value (a value that becomes false when converted to a boolean). if such an element is found, the every method immediately returns false. otherwise, if callback returned a true value for all elements, every will return true. callback is invoked with three arguments: the value of the element, the index of the element, and the array object being traversed. if a thisarg parameter is provided to every, it...
... every does not mutate the typed array on which it is called. ...
...And 3 more matches
TypedArray.prototype.filter() - JavaScript
ory. if 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.filter(callback[, thisarg]) parameters callback function to test each element of the typed array. invoked with arguments (element, index, typedarray). return true to keep the element, false otherwise. ...
...mples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.filter(callback[, thisarg]) parameters callback function to test each element of the typed array. invoked with arguments (element, index, typedarray). return true to keep the element, false otherwise. thisarg optional value to use as this when executing callback. ...
...array. invoked with arguments (element, index, typedarray). return true to keep the element, false otherwise. thisarg optional value to use as this when executing callback. return value a new typed array with the elements that pass the test. description the filter() method calls a provided callback function once for each element in a typed array, and constructs a new typed array of all the values for which callback returns a true value. callback is invoked only for indexes of the typed array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values. typed array elements which do not pass the callback test are simply skipped, and are not included in the new typed array. callback is invoked with three arguments: the valu...
...And 3 more matches
TypedArray.prototype.reduceRight() - JavaScript
the reduceright() method applies a function against an accumulator and each value of the typed array (from right-to-left) has to reduce it to a single value. this method has the same algorithm as array.prototype.reduceright(). typedarray is one of the typed array types here. syntax typedarray.reduceright(callback[, initialvalue]) parameters callback function to execute on each value in the typed array, taking four arguments: previousvalue the value previously returned in the last invocation of the callback, or initialvalue, if supplied (see below). currentvalue the current element being processed in the typed array. index the index of the current element being processed in the typed array. array the typed array reduce was called upon. initialvalue optional. objec...
...turned in the last invocation of the callback, or initialvalue, if supplied (see below). currentvalue the current element being processed in the typed array. index the index of the current element being processed in the typed array. array the typed array reduce was called upon. initialvalue optional. object to use as the first argument to the first call of the callback. return value the value that results from the reduction. description the reduceright method executes the callback function once for each element present in the typed array, excluding holes in the typed array, receiving four arguments: the initial value (or value from the previous callback call), the value of the current element, the current index, and the typed array over which iteration is occurring. the ...
...nction once for each element present in the typed array, excluding holes in the typed array, receiving four arguments: the initial value (or value from the previous callback call), the value of the current element, the current index, and the typed array over which iteration is occurring. the call to the reduceright callback would look something like this: typedarray.reduceright(function(previousvalue, currentvalue, index, typedarray) { // ... }); the first time the function is called, the previousvalue and currentvalue can be one of two values. ...
...And 3 more matches
delete operator - JavaScript
e to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax delete expression where expression should evaluate to a property reference, e.g.: delete object.property delete object['property'] parameters object the name of an object, or an expression evaluating to an object. property the property to delete. return value true for all cases except when the property is an own non-configurable property, in which case, false is returned in non-strict mode. exceptions throws typeerror in strict mode if the property is an own non-configurable property. description unlike what common belief suggests (perhaps due to other programming languages like delete in c++), the delete operator has nothing to do with directly ...
... typeerror. var employee = {}; object.defineproperty(employee, 'name', {configurable: false}); console.log(delete employee.name); // returns false var, let, and const create non-configurable properties that cannot be deleted with the delete operator: var nameother = 'xyz'; // we can access this global property using: object.getownpropertydescriptor(window, 'nameother'); // output: object {value: "xyz", // writable: true, // enumerable: true, // configurable: false} // since "nameother" is added using with the // var keyword, it is marked as "non-configurable" delete nameother; // return false in strict mode, this would have raised an exception. strict vs. non-strict mode when in strict mode, if delete is used on a direct referenc...
...ave raised an exception. strict vs. non-strict mode when in strict mode, if delete is used on a direct reference to a variable, a function argument or a function name, it will throw a syntaxerror. therefore, to avoid syntax errors in strict mode, you must use the delete operator in the form of delete object.property or delete object['property']. object.defineproperty(globalthis, 'variable1', { value: 10, configurable: true, }); object.defineproperty(globalthis, 'variable2', { value: 10, configurable: false, }); // syntaxerror in strict mode. console.log(delete variable1); // true // syntaxerror in strict mode. console.log(delete variable2); // false function func(param) { // syntaxerror in strict mode. console.log(delete param); // false } // syntaxerror in strict mode. console.log(...
...And 3 more matches
new operator - JavaScript
the new operator lets developers create an instance of a user-defined object type or of one of the built-in object types that has a constructor function. syntax new constructor[([arguments])] parameters constructor a class or function that specifies the type of the object instance. arguments a list of values that the constructor will be called with. description the new keyword does the following things: creates a blank, plain javascript object; links (sets the constructor of) this object to another object; passes the newly created object from step 1 as the this context; returns this if the function doesn't return an object. creating a user-defined object requires two steps: define the object type by writing a function. create an instance of the object with new. t...
...oo is equivalent to new foo(), i.e. if no argument list is specified, foo is called without arguments. the object (not null, false, 3.1415 or other primitive types) returned by the constructor function becomes the result of the whole new expression. if the constructor function doesn't explicitly return an object, the object created in step 1 is used instead. (normally constructors don't return a value, but they can choose to do so if they want to override the normal object creation process.) you can always add a property to a previously defined object. for example, the statement car1.color = "black" adds a property color to car1, and assigns it a value of "black". however, this does not affect any other objects. to add the new property to all objects of the same type, you must add the proper...
...property to all objects of the same type, you must add the property to the definition of the car object type. you can add a shared property to a previously defined object type by using the function.prototype property. this defines a property that is shared by all objects created with that function, rather than by just one instance of the object type. the following code adds a color property with value "original color" to all objects of type car, and then overwrites that value with the string "black" only in the instance object car1. for more information, see prototype. function car() {} car1 = new car(); car2 = new car(); console.log(car1.color); // undefined car.prototype.color = 'original color'; console.log(car1.color); // 'original color' car1.color = 'black'; console.log(car1.co...
...And 3 more matches
Transitioning to strict mode - JavaScript
re good, because they reveal plain errors or bad practices. they occur before the code is running. new runtime errors javascript used to silently fail in contexts where what was done was an error. strict mode throws in such cases. if your code base contains such cases, testing will be necessary to be sure nothing is broken. once again, it can happen at the function granularity level. ...
...ilently fail in contexts where what was done was an error. strict mode throws in such cases. if your code base contains such cases, testing will be necessary to be sure nothing is broken. once again, it can happen at the function granularity level. setting a value to an undeclared variable function f(x) { 'use strict'; var a = 12; b = a + x * 35; // error! } f(42); this used to change a value on the global object which is rarely the expected effect. ...
... if your code base contains such cases, testing will be necessary to be sure nothing is broken. once again, it can happen at the function granularity level. setting a value to an undeclared variable function f(x) { 'use strict'; var a = 12; b = a + x * 35; // error! } f(42); this used to change a value on the global object which is rarely the expected effect. ...
...And 3 more matches
<ms> - MathML
Web › MathML › Element › ms
and rquote attributes, you can set custom characters to display. note that quotation marks should not be specified unless they are part of the string literal. the content of an <ms> element is not an ascii string per se, but rather a sequence of characters and <mglyph> and <malignmark> elements. attributes class, id, style provided for use with stylesheets. dir the text direction. possible values are either ltr (left to right) or rtl (right to left). lquote the opening quote character (depends on dir) to enclose the content. the default value is "&quot;". 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 ...
...these will be removed in the future. mathvariant this attribute specifies the logical class of the identifier, which varies in typography. ...
...these will be removed in the future. mathvariant this attribute specifies the logical class of the identifier, which varies in typography. ...
...And 3 more matches
Autoplay guide for media and Web Audio APIs - Web media technologies
want to be able to tell when it autoplay didn't begin. unfortunately, in the case of the autoplay attribute, recognizing whether or not autoplay successfully began is tricky. there's not an event triggered when autoplay fails. nor is there an exception thrown or a callback you can set up or even a flag on the media element that tells you if autoplay worked. all you can really do is examine a few values and make an educated guess as to whether or not autoplay worked. a better approach, if you're able to adjust the direction you look at things from, is to instead rely on knowing that playback of the media has successfully started, instead of when it fails to start. you can do this easily, by listening for the play event to be fired on the media element. the play event is sent both when the med...
... you need to do only after playback // has begun. }).catch(error => { if (error.name === "notallowederror") { showplaybutton(videoelem); } else { // handle a load or playback error } }); } the first thing we do with the result of play() is make sure it's not undefined. we check for this because in earlier versions of the html specification, play() didn't return a value. returning a promise to allow you to determine success or failure of the operation was added more recently. checking for undefined prevents this code from failing with an error on older versions of web browsers. if the promise returned by play() is resolved without error, the then() clause is run and can begin whatever needs to be done when autoplay has begun. we then add a catch() handler to t...
...e origins are separated by space characters. note: the specified feature policy applies to the document and every <iframe> nested within it, unless those frames include an allow, which sets a new feature policy for that frame and all frames nested within it. when using the allow attribute on an <iframe> to specify a feature policy for that frame and its nested frames, you can also specify the value 'src' to allow autoplay of media only from the same domain as that specified by the frame's src attribute. example: allowing autoplay only from the document's domain to use the feature-policy header to only allow media to autoplay from the document's origin: feature-policy: autoplay 'self' to do the same for an <iframe>: <iframe src="mediaplayer.html" allow="autoplay 'src'"> </iframe...
...And 3 more matches
SVG Core Attributes - SVG: Scalable Vector Graphics
Web › SVG › Attribute › Core
the svg core attributes are all the common attributes that can be specified on any svg element. id lang tabindex xml:base xml:lang xml:space attributes id defines a unique identifier (id) which must be unique in the whole document. its purpose is to identify the element when linking (using a fragment identifier), scripting, or styling (with css). value: any valid id string; animatable: no lang participates in defining the language of the element, the language that non-editable elements are written in or the language that editable elements should be written in. the tag contains one single entry value in the format defined in the tags for identifying languages (bcp47) ietf document. svg 2 introduce the new lang attributes. if both lang and xml:lang attribute are u...
...ing the language of the element, the language that non-editable elements are written in or the language that editable elements should be written in. the tag contains one single entry value in the format defined in the tags for identifying languages (bcp47) ietf document. svg 2 introduce the new lang attributes. if both lang and xml:lang attribute are used, xml:lang has priority over lang. ...
...g languages (bcp47) ietf document. svg 2 introduce the new lang attributes. if both lang and xml:lang attribute are used, xml:lang has priority over lang. value: any valid language id; animatable: no tabindex the tabindex svg attribute allows you to control whether an element is focusable and to define the relative order of the element for the purposes of sequential focus navigation. value type: <integer>; animatable: no xml:base specifies a base iri other than the base iri of the document. value type: <iri>; animatable: no xml:lang it is a universal attribute allowed in all xml dialects to mark up the natural human language that an element contains. it's almost identical in usage to html's lang, but in conforming xml 1.0 documents, it does not allow the use of a null attrib...
...And 3 more matches
edgeMode - SVG: Scalable Vector Graphics
the edgemode attribute determines how to extend the input image as necessary with color values so that the matrix operations can be applied when the kernel is positioned at or near the edge of the input image. two elements are using this attribute: <feconvolvematrix> and <fegaussianblur> feconvolvematrix for <feconvolvematrix>, edgemode determines how to extend the input image as necessary with color values so that the matrix operations can be applied when the kernel is positioned at or near the edge of the input image. ...
... when the kernel is positioned at or near the edge of the input image. two elements are using this attribute: <feconvolvematrix> and <fegaussianblur> feconvolvematrix for <feconvolvematrix>, edgemode determines how to extend the input image as necessary with color values so that the matrix operations can be applied when the kernel is positioned at or near the edge of the input image. value duplicate | wrap | none default value duplicate animatable yes duplicate this value indicates that the input image is extended along each of its borders as necessary by duplicating the color values at the given edge of the input image. wrap this value indicates that the input image is extended by taking the color values from the opposite edge of the image. ...
...te | wrap | none default value duplicate animatable yes duplicate this value indicates that the input image is extended along each of its borders as necessary by duplicating the color values at the given edge of the input image. wrap this value indicates that the input image is extended by taking the color values from the opposite edge of the image. none this value indicates that the input image is extended with pixel values of zero for r, g, b and a. fegaussianblur for <fegaussianblur>, edgemode determines how to extend the input image as necessary with color values so that the matrix operations can be applied when the kernel is positioned at or near the edge of the input image. ...
...And 3 more matches
in2 - SVG: Scalable Vector Graphics
Web › SVG › Attribute › in2
the in2 attribute identifies the second input for the given filter primitive. it works exactly like the in attribute. three elements use this attribute: <feblend>, <fecomposite> and <fedisplacementmap>. feblend for <feblend>, in2 defines the second input image to the blending operation. ...
...r the given filter primitive. it works exactly like the in attribute. three elements use this attribute: <feblend>, <fecomposite> and <fedisplacementmap>. feblend for <feblend>, in2 defines the second input image to the blending operation. ...
...ion. value sourcegraphic | sourcealpha | backgroundimage | backgroundalpha | fillpaint | strokepaint | <filter-primitive-reference> default value sourcegraphic for first filter primitive, otherwise result of previous filter primitive animatable yes fecomposite for <fecomposite>, in2 defines the second input image to the compositing operation. ...
...And 3 more matches
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. ...
... note: as a presentation attribute, letter-spacing can be used as a css property. see the css letter-spacing property for more information. ...
...And 3 more matches
orient - SVG: Scalable Vector Graphics
Web › SVG › Attribute › orient
auto-start-reverse if placed by marker-start, the marker is oriented 180° different from the o...
... auto-start-reverse if placed by marker-start, the marker is oriented 180° different from the orientation that would be used if auto where specified. for all other mark...
... auto-start-reverse if placed by marker-start, the marker is oriented 180° different from the orientation that would be used if auto where specified. for all other markers, auto-start-reverse means the same as auto. note: this allows a sin...
...And 3 more matches
rendering-intent - SVG: Scalable Vector Graphics
bute permits the specification of a color profile rendering intent other than the default. rendering-intent is applicable primarily to color profiles corresponding to cmyk color spaces. the different options cause different methods to be used for translating colors to the color gamut of the target rendering device. ...
...ent is applicable primarily to color profiles corresponding to cmyk color spaces. the different options cause different methods to be used for translating colors to the color gamut of the target rendering device. ...
...o cmyk color spaces. the different options cause different methods to be used for translating colors to the color gamut of the target rendering device. only one element is using this attribute: <color-profile> usage notes value auto | perceptual | relative-colorimetric | saturation | absolute-colorimetric default value auto animatable yes auto this value allows the user agent to determine the best intent based on the content type. perceptual this value preserves the relationship between colors. ...
...And 3 more matches
to - SVG: Scalable Vector Graphics
Web › SVG › Attribute › to
the to attribute indicates the final value of the attribute that will be modified during the animation. the value of the attribute will change between the from attribute value and this value. five elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, <animatetransform>, and <set> html, body, svg { height: 100%; } <svg viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" width="100" height="100"> <animate attributetype="xml" attributename="width" fill="freeze" from="100" to="150" dur="3s"/> </rect> </svg> animate, animatecolor, animatemotion, animatetransform for <animate>, <animatecolor>, <animatemotion>, and <animatetransform>, to specifies the ending value of the animation. ...
... xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" width="100" height="100"> <animate attributetype="xml" attributename="width" fill="freeze" from="100" to="150" dur="3s"/> </rect> </svg> animate, animatecolor, animatemotion, animatetransform for <animate>, <animatecolor>, <animatemotion>, and <animatetransform>, to specifies the ending value of the animation. ...
...tp://www.w3.org/2000/svg"> <rect x="10" y="10" width="100" height="100"> <animate attributetype="xml" attributename="width" fill="freeze" from="100" to="150" dur="3s"/> </rect> </svg> animate, animatecolor, animatemotion, animatetransform for <animate>, <animatecolor>, <animatemotion>, and <animatetransform>, to specifies the ending value of the animation. ...
...And 3 more matches
type - SVG: Scalable Vector Graphics
Web › SVG › Attribute › type
the other keywords represent convenience shortcuts to allow commonly used color operations to be performed without specifying a complete matrix. ...
...the other keywords represent convenience shortcuts to allow commonly used color operations to be performed without specifying a complete matrix. ...
...>, <fefuncg>, <fefuncb>, and <fefunca> elements, it indicates the type of component transfer function. for the <feturbulence> element, it indicates whether the filter primitive should perform a noise or turbulence function. for the <style> and <script> elements, it defines the content type of the element. ...
...And 3 more matches
vector-effect - SVG: Scalable Vector Graphics
ing operations, i.e. filters, masks and clips. note: as a presentation attribute, vector-effect can be used as a css property. as a presentation attribute, it can be applied to any element but it has effect only on the following ten elements: <circle>, <ellipse>, <foreignobject>, <image>, <line>, <path>, <polygon>, <polyline>, <rect>, <text>, <textpath> <tspan>, and <use> usage notes value none | non-scaling-stroke | non-scaling-size | non-rotation | fixed-position default value none animatable yes none this value specifies that no vector effect shall be applied, i.e. the default rendering behaviour is used which is to first fill the geometry of a shape with a specified paint, then stroke the outline with a specified paint. non-scaling-stroke ...
...one | non-scaling-stroke | non-scaling-size | non-rotation | fixed-position default value none animatable yes none this value specifies that no vector effect shall be applied, i.e. the default rendering behaviour is used which is to first fill the geometry of a shape with a specified paint, then stroke the outline with a specified paint. non-scaling-stroke this value modifies the way an object is stroked. normally stroking involves calculating stroke outline of the shapeʼs path in current user coordinate system and filling that outline with the stroke paint (color or gradient). ...
...ch is to first fill the geometry of a shape with a specified paint, then stroke the outline with a specified paint. non-scaling-stroke this value modifies the way an object is stroked. normally stroking involves calculating stroke outline of the shapeʼs path in current user coordinate system and filling that outline with the stroke paint (color or gradient). the resulting visual effect of this value is that the stroke width is not dependant on the transformations of the element (including non-uniform scaling and shear transformations) and zoom level. non-scaling-size this value specifies a special user coordinate system used by the element and its descendants. the scale of that user coordinate system does not change in spite of any transformation changes from a host coordinate space. howev...
...And 3 more matches
<feDropShadow> - SVG: Scalable Vector Graphics
ood-color="pink" flood-opacity="0.5"/> </filter> </defs> <circle cx="5" cy="50%" r="4" style="fill:pink; filter:url(#shadow);"/> <circle cx="15" cy="50%" r="4" style="fill:pink; filter:url(#shadow2);"/> <circle cx="25" cy="50%" r="4" style="fill:pink; filter:url(#shadow3);"/> </svg> attributes dx this attribute defines the x offset of the drop shadow. ...
...="0.5"/> </filter> </defs> <circle cx="5" cy="50%" r="4" style="fill:pink; filter:url(#shadow);"/> <circle cx="15" cy="50%" r="4" style="fill:pink; filter:url(#shadow2);"/> <circle cx="25" cy="50%" r="4" style="fill:pink; filter:url(#shadow3);"/> </svg> attributes dx this attribute defines the x offset of the drop shadow. ...
...; filter:url(#shadow);"/> <circle cx="15" cy="50%" r="4" style="fill:pink; filter:url(#shadow2);"/> <circle cx="25" cy="50%" r="4" style="fill:pink; filter:url(#shadow3);"/> </svg> attributes dx this attribute defines the x offset of the drop shadow. value type: <number>; default value: 2; animatable: yes dy this attribute defines the y offset of the drop shadow. ...
...And 3 more matches
<mask> - SVG: Scalable Vector Graphics
Web › SVG › Element › mask
<path d="m10,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. ...
...0,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. ...
...ill="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 ; default value: objectboundingbox; animatable: yes x this attribute defines the x-axis coordinate of the top-left corner of the masking area. v...
...And 3 more matches
<set> - SVG: Scalable Vector Graphics
Web › SVG › Element › set
for attributes that can be reasonably be interpolated, the <animate> is usualy prefered. note: the <set> element is non-additive. the additive and accumulate attributes are not allowed, and will be ignored if specified. ...
...for attributes that can be reasonably be interpolated, the <animate> is usualy prefered. note: the <set> element is non-additive. the additive and accumulate attributes are not allowed, and will be ignored if specified. ...
...ed if specified. ...
...And 3 more matches
<style> - SVG: Scalable Vector Graphics
Web › SVG › Element › style
l's <style> element). html,body,svg { height:100%; margin: 0; padding: 0; } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <style> circle { fill: gold; stroke: maroon; stroke-width: 2px; } </style> <circle cx="5" cy="5" r="4" /> </svg> attributes type this attribute defines type of the style sheet language to use as a media type string. ...
...body,svg { height:100%; margin: 0; padding: 0; } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <style> circle { fill: gold; stroke: maroon; stroke-width: 2px; } </style> <circle cx="5" cy="5" r="4" /> </svg> attributes type this attribute defines type of the style sheet language to use as a media type string. ...
...rg/2000/svg"> <style> circle { fill: gold; stroke: maroon; stroke-width: 2px; } </style> <circle cx="5" cy="5" r="4" /> </svg> attributes type this attribute defines type of the style sheet language to use as a media type string. value type: <string>; default value: text/css; animatable: no media this attribute defines to which media the style applies. ...
...And 3 more matches
Types of attacks - Web security
kies are still valid (and there is no other validation), you will transfer money as soon as you load the html that contains this image. ...
...tion), you will transfer money as soon as you load the html that contains this image. ...
...the html that contains this image. for endpoints that require a post request, it's possible to programmatically trigger a <form> submit (perhaps in an invisible <iframe>) when the page is loaded: <form action="https://bank.example.com/withdraw" method="post"> <input type="hidden" name="account" value="bob"> <input type="hidden" name="amount" value="1000000"> <input type="hidden" name="for" value="mallory"> </form> <script>window.addeventlistener('domcontentloaded', (e) => { document.queryselector('form').submit(); }</script> there are a few techniques that should be used to prevent this from happening: get endpoints should be idempotent—actions that enact a change and do not simply retrieve data should require sending a post (or other http method) request. post endpoints should n...
...And 3 more matches
PI Parameters - XSLT: Extensible Stylesheet Language Transformations
used to be no way to provide parameters. to solve this two new pis are implemented in firefox 2 (see supported versions below for details), <?xslt-param?> and <?xslt-param-namespace?>. both pis can contain "pseudo attributes" the same way that the xml-stylesheet pi does. the following document passes the two parameters "color" and "size" to the stylesheet "style.xsl". <?xslt-param name="color" value="blue"?> <?xslt-param name="size" select="2"?> <?xml-stylesheet type="text/xsl" href="style.xsl"?> note that these pis have no effect when transformation is done using the xsltprocessor object in javascript. processing instructions the attributes in the xslt-param and xslt-param-namespace pis are parsed using the rules defined in xml-stylesheet. any unrecognized attributes must be ignored. pa...
...ml-stylesheet xslt pis are not supported in firefox currently. xslt-param the xslt-param pi supports 4 attributes: name the local-name part of the parameter name. no syntax checking is done on the attribute, however if it is not a valid ncname it will never match any parameter in the stylesheet. namespace the namespace of the parameter name. no syntax checking is done on the attribute. value contains the string value for the parameter. the value of the attribute is used as value for the parameter. the datatype will always bestring. select an xpath expression for the parameter. the value of the attribute is parsed as an xpath expression. the result of evaluating the expression is used as value for the parameter. if the name attribute is missing or empty the pi is ignored. if t...
...an xpath expression. the result of evaluating the expression is used as value for the parameter. if the name attribute is missing or empty the pi is ignored. if the namespace attribute is missing or empty the null namespace is used. it is not an error to specify a parameter name that does not exist in the stylesheet (or that is a variable in the stylesheet). the pi is simply ignored. if both value and select are present or if neither value nor select are present the pi is ignored. note that value="..." is not strictly equal to select="'...'" since the value can contain both apostrophe and quote characters. ...
...And 3 more matches
tabs - Archive of obsolete content
by setting the url property you can load a new page in the tab: var tabs = require("sdk/tabs"); tabs.on('activate', function(tab) { tab.url = "http://www.example.com"; }); run scripts in a tab you can attach a content script to the page hosted in a tab, and use that to access and manipulate the page's content (see the modifying the page hosted by a ...
...d before those specified by the contentscript option. optional. contentscript string,array a string or an array of strings of code to be evaluated in the context. content scripts specified by this option are loaded after those specified by the contentscriptfile option. optional. contentscriptoptions object you can use this option to define read-only values for your content scripts. the option consists of an object literal listing name:value pairs for the values you want to provide to the content script. for example: // main.js const tabs = require("sdk/tabs"); tabs.open({ url: "./page.html", onready: function(tab) { tab.attach({ contentscriptfile: "./content-script.js", contentscriptoptions: { a: "blah" ...
...listeners are passed a single argument, the message posted from the content script. optional. ...
...And 2 more matches
content/symbiont - Archive of obsolete content
nstructors symbiont(options) creates a content symbiont. parameters options : object optional options: name type frame object the host application frame in which the page is loaded. if frame is not provided hidden one will be created. contentscriptwhen string when to load the content scripts. ...
... has been loaded "ready": load content scripts once dom content has been loaded, corresponding to the domcontentloaded event "end": load content scripts once all the content (dom, js, css, images) for the page has been loaded, at the time the window.onload event fires this property is optional and defaults to "end". contentscriptoptions object read-only value exposed to content scripts under self.options property. any kind of jsonable value (object, array, string, etc.) can be used here. optional. allow object permissions for the content, with the following keys: script boolean whether or not to execute script in the content. defaults to true. optional. optional. symbiont symbiont is com...
...file urls of content scripts to load. content scripts specified by this property are loaded before those specified by the contentscript property. contentscript the texts of content scripts to load. content scripts specified by this property are loaded after those specified by the contentscriptfile property. contentscriptwhen when to load the content scripts. ...
...And 2 more matches
cfx - Archive of obsolete content
t updates. at the updateurl you host a file in the update rdf format: among other things, this includes another url called updatelink which points to the updated xpi itself. the --update-link and --update-url options simplify this process. both options take a url as an argument. the --update-link option builds an update rdf alongside the xpi, and embeds the supplied url in the update rdf as the value of updatelink. the --update-url option embeds the supplied url in the xpi file, as the value of updateurl. note that as the add-on documentation explains, you should make sure the update procedure for your add-on is secure, and this usually involves using https for the links. so if we run the following command: cfx xpi --update-link https://example.com/addon/latest/pluginname.xpi --update-u...
...date procedure for your add-on is secure, and this usually involves using https for the links. so if we run the following command: cfx xpi --update-link https://example.com/addon/latest/pluginname.xpi --update-url https://example.com/addon/update_rdf/pluginname.update.rdf cfx will create two files: an xpi file which embeds https://example.com/addon/update_rdf/pluginname.update.rdf as the value of updateurl an rdf file which embeds https://example.com/addon/latest/pluginname.xpi as the value of updatelink. supported options as with cfx run you can point cfx at a different package.json file using the --pkgdir option. you can also embed arguments in the xpi using the --static-args option: if you do this the arguments will be passed to your add-on whenever it is run. --extra-...
...rectories for package search. --pkgdir=pkgdir use an add-on located in pkgdir. pkgdir may be specified as a full path or as a path relative to the current directory. --static-args=static_args pass arguments to your add-on, in json format. ...
...And 2 more matches
Localization - Archive of obsolete content
ch has the data-l10n-id attribute set. any previously existing content is just replaced. the string is inserted as text, so you can't insert html using a statement like: # does not work. html tags are inserted as text. ...
...hello!</blink> localizing element attributes this feature is new in firefox 39 you can localize certain attributes of elements with an l10n-id by setting its value with l10n-id.attributename in the properties file like: hello_id.accesskey= h the following attributes are supported: accesskey alt label title placeholder further the localization of the aria attributes aria-label, aria-valuetext and aria-moz-hint are supported with the same aliases as on firefox os: arialabel ariavaluetext ariamozhint using localized strings in javascript to reference localized strings from your main add-on code, you do this: var _ = require("sdk/l10n").get; console.log(_("hello_id")); assigning to "_" in particular is not required, but is a convention from the gettext tools and will make i...
...efox's add-ons manager. preferences have mandatory title and optional description fields. these are strings which appear alongside the preference in the add-ons manager, to help explain to the user what the preference means. to provide the localized form of the preference title, include an entry in your "properties" file whose identifier is the preference name followed by _title, and whose value is the localized title. to provide the localized form of the preference description, include an entry in your "properties" file whose identifier is the preference name followed by _description, and whose value is the localized description. for example, suppose your "package.json" defines a single preference: { "preferences": [ { "type": "string", "na...
...And 2 more matches
File I/O - Archive of obsolete content
%installation%/defaults/profile - the profile defaults of the "default" installed locale. second choice when profdef is not available. profld f local settings on windows; where the network cache and fastload files are stored. progs d user start menu programs directory (for example, c:\documents and settings\username\start menu\programs). this is a windows-specific value. tmpd d the operating system's temporary files directory (for example, /tmp on mac os x and linux). uchrm f the user chrome directory in their profile: %profile%/chrome. resource:app d the application directory in an xulrunner application. look in the source for other strings available: xpcom/io/nsappdirectoryservicedefs.h, xpcom/io/nsdirecto...
...refs. storing nsifile in preferences the following two snippets show the right way to store a file path in user preferences (more about preferences in mozilla): absolute path (nsifile) to store an arbitrary path in user preferences, use this code: // |file| is nsilocalfile. uses services.jsm. // 1. write path to prefs var prefs = services.prefs.getbranch("extensions.myext."); prefs.setcomplexvalue("filename", components.interfaces.nsifile, file); // 2. read path from prefs var file = prefs.getcomplexvalue("filename", components.interfaces.nsilocalfile); relative path (nsirelativefilepref) to store paths relative to one of the predefined folders listed above, for example file relative to profile folder, use the following code: // 1. write to prefs var relfile = components.classes["@moz...
...folders listed above, for example file relative to profile folder, use the following code: // 1. write to prefs var relfile = components.classes["@mozilla.org/pref-relativefile;1"]. createinstance(components.interfaces.nsirelativefilepref); relfile.relativetokey = "profd"; // or any other string listed above relfile.file = file; // |file| is nsilocalfile prefs.setcomplexvalue("filename", components.interfaces.nsirelativefilepref, relfile); // 2. read from prefs var value = prefs.getcomplexvalue("filename", components.interfaces.nsirelativefilepref); // |value.file| is the file. navigating with nsifile get a file in given directory let us assume an nsifile file is pointing to some directory (for example a user profile directory). then you may use file.ap...
...And 2 more matches
Enhanced Extension Installation - Archive of obsolete content
s // the rdf/xml datasource for the items at the // profile install location _globalextensions // the rdf/xml datasource for the items at the // global install location. }; tracking install locations since there are only two locations, the installed location of an extension is expressed throughout the code using a boolean value, often referred to as isprofile - true if the item is installed in the profile directory's extensions folder. this boolean relationship itself is not stored directly in the datasource. rather, if the system needs to know where an item is located, it checks to see if the item is a member of the the appropriate type container (urn:mozilla:extension:root or urn:mozilla:theme:root) in each of the two...
...tion knows about and maintains three install locations: app-profile a directory-based install location for items living in the application profile extensions directory. app-global a directory-based install location for items living in the application global extensions directory. app-registry a registry-key based install location for items living at locations specified by a guid-to-path value set within the registry at a predefined location. to implement this, we create an interface that the extension manager can ask for information about the location, such as what its name is, where its located on disk (if anywhere, in the case of registry based locations which have no root directory), for a list of item directories, for a directory of a particular item, for a subdirectory or file ...
... metadata the following files are now used to hold metadata: <profile>/extensions.ini -active items this file contains a list of active extension directories (i.e. directories to extensions that are enabled only), to be used by the xredirprovider during startup to locate components, preferences and chrome manifests. the format here is similar to firefox 1.0 except there is no longer a count value that needs to be kept in sync with the number of lines... the file is written simply as extension#=<absolute path to item> and is read until there are no more numbers. the other difference is that since there is now only a single instance of this file in the profile location, the file paths are now absolute. <profile>/extensions.rdf -visible items this file contains non-startup and compatibili...
...And 2 more matches
Extension Versioning, Update and Compatibility - Archive of obsolete content
patibility updates during the automatic update checks, applications look for both new versions and updated compatibility information about the currently installed version of an add-on. this means that if your update manifest contains an entry for the currently installed version of the add-on, and the entry's targetapplication entry specifies a larger maxversion then the application will use this value instead of that specified in the add-on's install.rdf. this can cause add-ons that are disabled for being incompatible to become enabled and add-ons that would normally not install to be installed. update rdf format if you host your add-on's updateurl yourself then you will need to return the add-on version information in an rdf format. below is an example update manifest. it lists information ...
...the supported hashing algorithms (sha1, sha256, sha384 and sha512). in firefox 3 if the updatelink is not https then the hash must be made using one of the sha family of algorithms. the hashing algorithm used is put at the start of the string and separated from the hash by a :. <em:updatehash>sha256:78fc1d2887eda35b4ad2e3a0b60120ca271ce6e64ad2e3a0b60120ca271ce6e6</em:updatehash> note: the value of updatehash, must start with the string of hashing algorithm, it is a common error to delete this prefix, when setting new value to updatehash:sha256:78fc1d2887eda35b4ad2e3a0b60120ca271ce6e64ad2e3a0b60120ca271ce6e6 when a hash is specified the downloaded file is compared with the hash and an error shown if it does not match. there are quite a few tools you may use to generate hashes: vario...
...sider hashtab for interactive (non-build-script) use. there are also gnu ports for win (besides usual suspects like cygwin), which are good for non-interactive use: sha256sum file there is also md5deep, which is cross platform: sha256deep file openssl also generates hashes for you: openssl sha256 file if you're on windows, hashtab is a shell extension... simple right-click gives you hash values for any file. there is also an enhancement bug about adding automatic hash generation of xpi files to mccoy. and all popular (scripting) languages offer support, for examples: python, perl: cpan digest, php signing update manifests if you wish to serve your update rdf over regular http, gecko 1.9 based applications will require that you digitally sign the update manifest to ensure that it'...
...And 2 more matches
Index of archived content - Archive of obsolete content
installversion object methods properties return codes winprofile object methods winreg object methods winregvalue xpjs components proposal xre xtech 2005 presentations directions of the mozilla rdf engine extending gecko with xbl and xtf mozilla e4x rich web svg and canvas in mozilla ...
... npnvariable npn_createobject npn_destroystream npn_enumerate npn_evaluate npn_forceredraw npn_getauthenticationinfo npn_getintidentifier npn_getproperty npn_getstringidentifier npn_getstringidentifiers npn_geturl npn_geturlnotify npn_getvalue npn_getvalueforurl npn_hasmethod npn_hasproperty npn_identifierisstring npn_intfromidentifier npn_invalidaterect npn_invalidateregion npn_invoke npn_invokedefault npn_memalloc npn_memflush npn_memfree npn_pluginthreadasynccall npn_...
...npn_identifierisstring npn_intfromidentifier npn_invalidaterect npn_invalidateregion npn_invoke npn_invokedefault npn_memalloc npn_memflush npn_memfree npn_pluginthreadasynccall npn_posturl npn_posturlnotify npn_releaseobject npn_releasevariantvalue npn_reloadplugins npn_removeproperty npn_requestread npn_retainobject npn_setexception npn_setproperty npn_setvalue npn_setvalueforurl npn_status npn_utf8fromidentifier npn_useragent npn_version npn_write npobject npp ...
...And 2 more matches
Repackaging Firefox - Archive of obsolete content
d not need to edit this file. defaults/preferences/partner.js default preferences for this dex. install.rdf meta-information about your extension, such as the creator (your organization), a unique id, and which versions of firefox are supported. locale/*/partner.properties for preferences which need to be localized, there needs to be an entry in each of the properties files with the desired value for that locale. if the value is the same for *all* locales, it can be set in the partner.js file itself, see the section "preferences" for more information. partner-bookmarks.xml default bookmarks are set here. and that's all you need! take a moment and browse through the files, and don't forget to check mdc for reference material. locales there is a difference between the locales you plan...
...e (for example, simply adding the locale to a url, like http://<locale>.example.com/). but it's something to keep in mind when planning your locale support. preferences preferences are one of the two main things you will want to set in your extension (the other is bookmarks). ...
... something to keep in mind when planning your locale support. preferences preferences are one of the two main things you will want to set in your extension (the other is bookmarks). there are two kinds of preferences in firefox, both set in the partner.js file: localizable preferences, which have a value of a chrome:// uri pointing to the properties file where firefox can fetch the localized value from. non-localizable preferences, which simply have the value in partner.js directly. it is possible to set a value for localizable preferences directly in the partner.js file, like this: pref("localizable.preference.name", "data:text/plain,localizable.preference.name=some value."); then, a properties file is not used (or needed at all) for that preference. therefore, if *all* of your pref...
...And 2 more matches
Style System Overview - Archive of obsolete content
n implementations are for css, but we have other implementations in c++ that: do what css can't do do things faster than css would css style sheets at basic level, sheet is collection of rules other special things: @import, @media, @namespace, etc. a rule is a selector and a declaration block. a declaration block is a group of declarations. a declaration is a property and a value. p { color: green; font-size: 12em; } selector { property: value; property: value; } css style rules what do style rules mean? selector matches elements in the document. rule applies to matched elements. “cascaded” value for property + element: if 0 rules matching the element have the property: some properties inherit and some properties use initial value. ...
...hat do style rules mean? ...
...itle { display: block; font-size: 3em; } para { display: block; } [class="emph"] { font-style: italic; } css style rule representation each declaration block is represented by an nscssdeclaration an cssstyleruleimpl contains each selector associated with that declaration, and the declaration, and is the most important implementation of nsistylerule. the declarations (properties & values) are stored in data structs (nscss*). the data format of the structs and selectors is mostly clear from the code and not worth going into (although the implementation of :not() is confusing). css style rule representation h1, h2 { color: green; text-align: right; text-indent: 0; } cssstyleruleimpl cssstyleruleimpl ↓ ↓ ↓ ↓...
...And 2 more matches
Using microformats - Archive of obsolete content
. if provided, this is a javascript object that contains zero or more of the following flags: recurseexternalframes if true, child frames are included in the search. the default is true. showhidden if true, hidden microformats are added; otherwise they're left out. the default is false. debug specify true if debug mode is in use; otherwise, specify false. the default is false. return value an integer value indicating the number of microformats that match the specified criteria. debug() returns a string that describes a microformat object. note: you can simply call debug() on a microformat object: microformatobject.debug() instead of using this method if you prefer. var dumpstring = debug(microformatobject) parameters microformatobject the microformat object to dump. re...
... get() returns an array of microformat objects corresponding to the microformats found that match specified criteria. var microformatsarray = microformats.get(name, rootelement, options, targetarray); parameters name the name of the microformat to find. rootelement required. ...
...ference external content are included in the search. the default is true. showhidden if true, hidden microformats are added; otherwise they're left out. the default is false. debug specify true if debug mode is in use; otherwise, specify false. the default is false. targetarray optional. if provided, this is an array of microformat objects to which the search results are added. return value a new array of microformat objects matching the search criteria, or the array specified by microformats with the newly found microformat objects added. getnamesfromnode() returns a space-delineated list of microformat names that correspond to the specified microformat node. var namelist = microformats.getnamesfromnode(node); parameters node the node for which to retrieve a list of micro...
...And 2 more matches
Microsummary topics - Archive of obsolete content
createinstance(components.interfaces.nsidomparser); var genera...
...ice); var generator = microsummaryservice.installgenerator(generatordoc); the service installs the generator by serializing its xml to a file in the user's profile directory and adding the generator to the service's in-memory generator cache. when programmatically installing generators, you should specify a unique identifier for the generator in the uri attribute of the <generator> element. the value of the attribute must be a valid uri, but you can specify an arbitrary identifier using a urn, for example: urn:{835daeb3-6760-47fa-8f4f-8e4fdea1fb16} to guarantee uniqueness, use urns containing uuids generated by the nsuuidgenerator component. see generating a uuid in the nsiuuidgenerator documentation. you may also use another form appropriate to your extension. note: when web sites install g...
...ary generator add-on, it automatically downloads the html content of the page being summarized. it does not generally download related content like embedded images and javascript scripts referenced by the page. however, because of a technical limitation (bug 340746), it does download css stylesheets referenced by the page. firefox includes the x-moz request header with these requests. ...
...And 2 more matches
Reading textual data - Archive of obsolete content
nt nsiunicharstreamlistener (gecko 1.8) xxx: also document nsistreamlistener here? determining the character encoding of data if you have a network channel (nsichannel), you can try the contentcharset property of it. note that not all channels know the character encoding of the data. you can fallback to the default character encoding stored in preferences (intl.charset.default, a localized pref value) when reading from a file, the question is harder to answer. using the system character encoding may work (xxx insert text how to get it), or again the default character encoding from preferences. converting read data if you read data from nsiscriptableinputstream as described on the file i/o code snippets page, you can convert it to utf-8 // sstream is nsiscriptableinputstream var str = sstr...
...not doing so can cause problems if you try to rename or delete the file at a later time on some platforms. note that you may get less characters than you asked for, especially (but...
... .createinstance(components.interfaces.nsiconverterinputstream); is.init(fis, charset, 1024, replacementchar); now you can read string from is: var str = {}; var numchars = is.readstring(4096, str); if (numchars != 0 /* eof */) var read_string = str.value; to read the entire stream and do something with the data: var str = {}; while (is.readstring(4096, str) != 0) { processdata(str.value); } don't forget to close the stream when you're done with it (is.close()). not doing so can cause problems if you try to rename or delete the file at a later time on some platforms. note that you may get less characters than you asked for, especially (but not only) at the end of the file (stream). unsupported byte sequences you can specify what should happen with byte sequences that do not ...
...And 2 more matches
Anonymous Content - Archive of obsolete content
so set or removed. on any anonymous content element in a template, an inherits attribute can be used to specify a comma-separated list of attributes that should be inherited. attributes with namespaces can be defined using a namespace prefix and the attribute name separate by a colon. ...
...f attributes that should be inherited. attributes with namespaces can be defined using a namespace prefix and the attribute name separate by a colon. for example, on the html file upload control, the anonymous textfield can be set up to automatically inherit the value attribute from the bound element. <xbl:binding id="fileuploadcontrol"> <xbl:content> <html:input type="text" xbl:inherits="value"/> <html:input type="button" value="browse..."/> </xbl:content> </xbl:binding> each entry in the inherits list can either simply list an attribute (such as value in the example above), or it can specify an = separated pair consisting of the attribute on the anonymous content that should be tied to the attribute on the bound element. the anonymous content attribute is listed first. the sp...
...when specified on the left-hand side of the pair it indicates that the attribute on the right-hand side should be stored as text nodes underneath the anonymous element. ...
...And 2 more matches
Windows Install - Archive of obsolete content
omment(" required : " + spacerequired + " k"); logcomment(" available: " + spaceavailable + " k"); return(false); } return(true); } function updatewinreg4ren8dot3() { var fprogram = getfolder("program"); var ftemp = getfolder("temporary"); //notes: // can't use a double backslash before subkey // - windows already puts it in. // subkeys have to exist before values can be put in. var subkey; // the name of the subkey you are poking around in var valname; // the name of the value you want to look at var value; // the data in the value you want to look at. var winreg = getwinregistry() ; if(winreg != null) { // here, we get the current version. winreg.setrootkey(winreg.hkey_current_user) ;// current_user subkey = "software\\...
...of the value you want to look at var value; // the data in the value you want to look at. var winreg = getwinregistry() ; if(winreg != null) { // here, we get the current version. ...
...look at. var winreg = getwinregistry() ; if(winreg != null) { // here, we get the current version. ...
...And 2 more matches
confirm - Archive of obsolete content
to be displayed in the confirmation dialog. this string is typically in the form of a prompt for the user (e.g., "are you sure you want to delete the selected file(s)?"). adialogtitle the string to be used as the dialog title. defaults to "confirm" (or the localized equivalent). abuttonflags a set of flags defining the buttons that should appear in the dialog. the value is calculated by multiplying the corresponding button position constant with a button title constant for each button, then adding the results and any additional options (see other constants). button position constants button_pos_0: the first logical button button_pos_1: the second logical button button_pos_2: the third logical button button title c...
...ent - the underlying implementation can freely decide where each of the three buttons is placed. the following examples show the result of calling confirm() with three buttons 0='a', 1='b' and 2='c'. ...
...erever possible, and to keep in mind that button 1 has the same return value as "window closed" (see below). abutton0title custom title for button 0. abutton1title custom title for button 1. abutton2title custom title for button 2. acheckmsg a string to display as a checkbox label. acheckstate an object with a boolean value property representing the state of the checkbox: when the dialog box is shown, its checkbox will be checked when this object's value is true. after the user presses a button (or closes the window), the value property is updated according to the checkbox. ...
...And 2 more matches
ContextMenus - Archive of obsolete content
e to open a context menu, the context is the element that was clicked. when using the keyboard, the context is the element in the window that is currently focused. although there are several ways to open a context menu, a single event may be used to listen for any of these situations; the 'contextmenu' event is fired in any case. <hbox id="container" align="center" oncontextmenu="..."> <label value="name:"/> <textbox id="name"/> </hbox> in this example, an attempt to open a context menu anywhere inside the hbox will call the event listener attached using the oncontextmenu attribute. as textboxes have a context menu built in, the event will fire before an attempt to open the context menu. however, the event will also fire when the label is right-clicked for instance, so the event handler...
...g the preventdefault method. this has the effect of disabling the context menu. the event listener is attached using the addeventlistener method within the 'init' function. this might be called while initializing a window during a load event for example. attaching context menus a context menu may be attached to an element using the context attribute, which may be applied to any xul element. the value of the context attribute should be the id of a context menu within the same document. in the example, a context menu is attached to a grid. <window id="main-window"> <popupset> <menupopup id="ins-del-menu"> <menuitem label="insert"/> <menuitem label="delete"/> </menupopup> </popupset> </window> <grid context="ins-del-menu"> <columns> <column/> <column flex="...
...e document. in the example, a context menu is attached to a grid. <window id="main-window"> <popupset> <menupopup id="ins-del-menu"> <menuitem label="insert"/> <menuitem label="delete"/> </menupopup> </popupset> </window> <grid context="ins-del-menu"> <columns> <column/> <column flex="1"/> </columns> <rows id="rows"> <row align="center"> <label value="name:"/> <textbox/> </row> </rows> </grid> the same context menu can be attached to multiple elements. just set the context attribute on those elements you want the context menu to apply to. one technique is to attach a context menu to an entire document area. for instance, the firefox browser applies a single context menu to the browser area which displays web pages. for example,...
...And 2 more matches
OpenClose - Archive of obsolete content
ext to a button, pass a reference to this button as the first argument to the openpopup method. in this next example, the popup is opened relative to the document element. somepopup.openpopup(document.documentelement, "end_before", 0, 0, false, false); the second argument to openpopup is the anchor position, which specifies which side of the anchor the popup is positioned on. for instance, the value 'end_before' as used in the above example, indicates to place the left edge of the popup along the right edge of the the anchor element, aligned along the top edge of both. this may be confusing to understand, so see positioning a popup which describes this process in more detail and provides images which show the possible values and how a popup would be aligned for each value. the third and fou...
... aligned along the top edge of both. this may be confusing to understand, so see positioning a popup which describes this process in more detail and provides images which show the possible values and how a popup would be aligned for each value. the third and fourth arguments to openpopup are x and y offsets. after the popup is positioned, you can further position the popup by specifying non-zero values for these offsets. this allows the position of the popup to be precisely controlled while still being anchored to a specific element. you can use positive values to adjust the popup to the right or downwards and negative values to adjust the popup to the left or upwards. in the following example, the popup is anchored below an element, yet is offset by 10 pixels to the right and 2 pixels upward...
...h indicates whether a popup is being opened as a context menu. pass true if so, or false if not. it should be obvious from how you are calling openpopup what to set this argument to. note that the same menu can be opened in either manner so this flag doesn't affect how the popup appears. what it does do is affect how the focus and highlighting of the menu is handled. as long as you pass the right value depending on the situation, it isn't too important to know the specifics of the difference between both cases. however, you can see the effect of the flag when using the firefox bookmarks. try opening a submenu of a bookmark (a bookmark folder) and note how the highlighting still changes as the mouse is moved over other menus, and the submenu is closed when the mouse is moved away. now try openi...
...And 2 more matches
Tooltips - Archive of obsolete content
ional details about a user interface without cluttering up the main interface. note that tooltips can only be activated using the mouse, so they should never contain important information that isn't available elsewhere. the tooltiptext attribute in most cases, the tooltip will display only a single label. for this, the tooltiptext attribute may be used, which is valid for all xul elements. the value of this attribute should be the text to appear in the tooltip. <toolbarbutton label="back" tooltiptext="go back one page"/> in this example, a back button on a toolbar is given additional text to appear on a tooltip. this could also be useful if the toolbar is configured such that labels do not appear. if an element does not have a tooltiptext attribute, yet a parent element does, the parent ...
... default tooltip is created automatically, so you don't normally need to use a tooltip element. however, it is possible to use another tooltip element that looks differently, or which supports other elements besides a single text label. the tooltip can be created using the tooltip element, the contents of which appear inside the tooltip. <tooltip id="iconic"> <image src="help.png"/> <label value="save a file to a remote site"/> </tooltip> <button label="save" tooltip="iconic"/> in this example, a tooltip with the id 'iconic' contains an image and a label. a button is associated with the tooltip using the tooltip attribute. the value of the tooltip attribute should be set to the id of a tooltip element, in this case, 'iconic'. this will cause the tooltip to appear as the tooltip for th...
...d on what the tooltip applies to, so you may need to set the content in a tooltip if you wish to use the same tooltip for several elements. this can be accomplished by using a popupshowing event listener and adjusting the tooltip as needed. the popupshowing event will be fired on the tooltip element just before the tooltip appears. for example: <tooltip id="iconic" onpopupshowing="this.lastchild.value = document.tooltipnode.label;"/> the document.tooltipnode property of the document holds the element that the mouse is hovering over. in this example, this property is examined to retrieve the label of the element that the mouse is over. this label is then set as the value of the last child of the tooltip. in the earlier example, the last child of the tooltip is a label. the effect is that the ...
...And 2 more matches
Actions - Archive of obsolete content
tp://www.xulplanet.com/rdf/b) (?start = http://www.xulplanet.com/rdf/a, ?relateditem = http://www.xulplanet.com/rdf/c) (?start = http://www.xulplanet.com/rdf/a, ?relateditem = http://www.xulplanet.com/rdf/d) the builder will start with the first result. the button element will be copied and inserted into the document after the template. the id attribute of the new element will be set to the same value of the member variable, ?relateditem. you could think of this as changing the uri attribute to the id attribute, and replacing the variable. since the first result has a value of 'http://www.xulplanet.com/rdf/b' for the ?relateditem variable, the id will be set to this value. then, the remaining attributes on the element are examined and any variables are replaced in place. that is, the text ?rel...
...processing is now complete for the first result, so the builder moves on to the next result. ...
...www.xulplanet.com/rdf/d"/> </vbox> since the template tag is hidden, the effect will be like in the image, three buttons with the labels of the data in the datasource. additional content the previous example generated only a set of buttons, but the action body may contain additional content. for instance, you might want to add a label to each item. <action> <hbox uri="?relateditem"> <label value="related item:"/> <button label="?relateditem"/> </hbox> </action> in this example, the hbox will be generated for each result, assigned an id of the value of the ?relateditem, and the label and button will be added inside it. the button's label will be the value of the ?relateditem variable. you would only use the uri attribute on a single element since only one of the generated elements ...
...And 2 more matches
Simple Example - Archive of obsolete content
rting variable is used in this example, but you can of course use any variable you wish. (?start = http://www.xulplanet.com/rdf/myphotos) the member element is used to iterate over the children of a container (or the reverse). first, any known variables are filled into the member statement for the current result. there's only one result so far; the member element's container attribute is set to value of the ?start variable of this result. this will result in the following: <member container="http://www.xulplanet.com/rdf/myphotos" child="?photo"/> as with processing a triple, the builder will now try to find as many values for the ?photo variable as possible and create potential results using them. the container attribute specifies the container and the child attribute specifies the children...
...if that node had no children or wasn't a container, there would be no possible results. ...
...= http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/canal.jpg) (?start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/obselisk.jpg) the triple is evaluated next, and it will be examined for each potential result found so far. the builder will first fill in as many variables as it can. ...
...And 2 more matches
Special Condition Tests - Archive of obsolete content
tribute from the previous iteration. here is a previous example, rewritten to use the parent matching syntax: <vbox datasources="people.xml" ref="*" querytype="xml"> <template> <query expr="*"/> <rule parent="vbox"> <action> <groupbox uri="?"> <caption label="?name"/> </groupbox> </action> </rule> <rule> <action> <label uri="?" value="?name"/> </action> </rule> </template> </vbox> previously, an assign element was used to assign the tagname of the result to a variable, which was then compared in a rule condition. the code above accomplishes the same effect except that it using the parent matching mechanism. note the parent attribute on the rule element, set to the value vbox. this causes the rule to match only co...
...nt attribute on the rule, set to the tag to match. for instance, we might use the following: <vbox datasources="template-guide-streets.rdf" ref="http://www.xulplanet.com/rdf/myneighbourhood"> <template> <rule parent="vbox"> <groupbox uri="rdf:*"> <caption label="rdf:http://purl.org/dc/elements/1.1/title"/> </groupbox> </rule> <rule> <label uri="rdf:*" value="rdf:http://www.xulplanet.com/rdf/address"/> </rule> </template> </vbox> on the first pass, the container where generated content would be inserted is a <vbox>, so the first rule will match and a captioned <groupbox> will be created. on the next pass, the parent container will be the element with the uri attribute from the previous pass, in this case, the <groupbox> the first rule will not...
...the first of these tests can be used to test if an element is a container or not. to use this test, place an iscontainer attribute on a <rule>. the iscontainer attribute should be set to true if...
...And 2 more matches
XML Templates - Archive of obsolete content
« previousnext » mozilla also supports the use of xml datasources. an xml document will be loaded and xpath expressions may be used to take portions of the xml document and generate content from these. when an xml source is desired, specify a querytype attribute on the root node of the template to the value xml. this indicates to the template builder that an xml source is being used as that the queries use syntax that is specific to xml. the datasources attribute should be set to the url of an xml document, either a local file or a remote web site. the ref attribute isn't currently used for xml sources, as the root of the document is always the starting point for xml queries; you should just set the ref attribute to a dummy value, for example '*' which is typically used. an...
...th the uri attribute and its children will be copied once for each result. any elements between the action element and this element are only copied once. this is useful when recursive generation or multiple rules are used, and we'll see examples of why this is useful later. for an rdf query, the uri attribute specifies the member variable; for an xml query the member variable is always '?' so the value of the uri attribute for xml templates should always be the single question mark character as in this example. the label attribute has been set to a special value ?name. when a question mark character followed by a string appears in an attribute value, the label value is not directly, but instead the value of an attribute for the source xml is used. for each node generated by the xpath expressio...
...you can see the name attributes in the original xml data above. this substitution occurs for any attribute within the action body, so you can also set other attributes with this technique. ...
...And 2 more matches
Localization - Archive of obsolete content
to the string table. xml provides entities which can be used for a similar purpose. you should already be familiar with entities if you have written html. the codes &lt; and &gt; are examples of entities which can be used to place less than and greater than signs into the text. xml has a syntax which allows you to declare custom entities. you can use these so that the entity is replaced with its value, which can be a string of text. entities may be used whenever text occurs, including the values of attributes. the example below demonstrates the use of an entity in a button. <button label="&findlabel;"/> the text that will appear on the label will be the value that the entity &findlabel; has. a file is created which contains the entity declarations for each supported language. in english, th...
...lared that we want to use the findfile.dtd dtd file. this line is typically placed just before the window element. ...
...and the value "find". this means that wherever the text "&findlabel;" appears in the xul file, it will be replaced with the text "find". note that entity declarations do not have a trailing slash at the end of them. in the dtd file for a different language, the text for that language will be used instead. for japanese: <!entity findlabel "検索"> for example, the following text: <description value="&findlabel;"/> is translated as: english version: <description value="find"/> japanese version: <description value="検索"/> you would declare an entity for each label or string of text that you use in your interface. you should not have any directly displayed text in the xul file at all. ...
...And 2 more matches
Manipulating Lists - Archive of obsolete content
s a string label, and you do not have to worry about where to add it in the list structure. here is an example: example 1 : source view <script> function additem(){ document.getelementbyid('thelist').appenditem("thursday", "thu"); } </script> <listbox id="thelist"/> <button label="add" oncommand="additem();"/> the appenditem() takes two arguments, the label, in this case 'thursday', and a value 'thu'. the two arguments correspond to the label attribute and the value attribute on the listitem element. the value is used only as an extra optional value associated with an item which you might wish to use in a script. similarly, there is also an insertitemat() and a removeitemat() function which inserts a new item and removes an existing item respectively. the syntax is as follows: list.in...
...instead. it also has a selectedindex function which will return the index of the selected tab. however, to get the selected item, use the tabbox's selectedtab property instead. or, use the selectedpanel property to get the selected panel, that is, return the content associated with the tab. changing the selection all of the selection related properties described above may also be assigned a new value to change the selection. in the next example, the selectedindex property of a radiogroup element is changed based on the value entered in a textbox. this code isn't foolproof though; for example it doesn't check if the value entered is out of range. you will want to make sure that you add this kind of error checking. example 3 : source view <script> function doselect(){ var val = document.get...
...on. in the next example, the selectedindex property of a radiogroup element is changed based on the value entered in a textbox. this code isn't foolproof though; for example it doesn't check if the value entered is out of range. you will want to make sure that you add this kind of error checking. ...
...And 2 more matches
Popup Menus - Archive of obsolete content
certain area of a window. typically, this will be a specific button or a box. to associate the popup with an element, you add one of three attributes to the element. the attribute you add depends on which type of popup you want to create. for plain popups, add a popup attribute to the element. for context popups, add a context attribute. finally, for tooltip popups, add a tooltip attribute. the value of the attribute must be set to the id of the menupopup that you want to have appear. this is why you must put the id on the popup. that way it's easy to have multiple menupopups in one file. in the example above, we want to make the popup a context menu. that means that we need to use the context attribute and add it to the element which we want to have the popup associated with. the sample bel...
...text menu. that means that we need to use the context attribute and add it to the element which we want to have the popup associated with. the sample below shows how we might do this: example 1 : source view <popupset> <menupopup id="clipmenu"> <menuitem label="cut"/> <menuitem label="copy"/> <menuitem label="paste"/> </menupopup> </popupset> <box context="clipmenu"> <label value="context click for menu"/> </box> here, the menupopup has been associated with a box. whenever you context-click (right-click) anywhere inside the box, the popup menu will appear. the popup will also appear even if you click on the children of the box, so it will work if you click on the label element also. the context attribute has been used to associate the box with a menupopup with the same ...
... a tooltip. this requires you to have a separate block of content for each tooltip or to have a script which sets the content. however, it does allow you to use any content besides text in a tooltip. example 2 : source view <button label="save" tooltiptext="click here to save your stuff"/> <popupset> <tooltip id="moretip" orient="vertical" style="background-color: #33dd00;"> <description value="click here to see more information"/> <description value="really!" style="color: red;"/> </tooltip> </popupset> <button label="more" tooltip="moretip"/> these two buttons each have a tooltip. the first uses the default tooltip style. the second uses a custom tooltip that has a different background color and styled text. the tooltip is associated with the more button using the tooltip at...
...And 2 more matches
RDF Datasources - Archive of obsolete content
similarly to the bookmarks, although the fields will be different in each case. the history list the history datasource provides access to the user's history list which is the list of urls the user has visited recently. the resource can be referred to using rdf:history as the datasource. the table below shows the resources (or fields) that you can retrieve from the history datasource. put the url values below where you want the value of the resource to be used. date http://home.netscape.com/nc-rdf#date date of last visit name http://home.netscape.com/nc-rdf#name title of the page page http://home.netscape.com/nc-rdf#page page name referrer http://home.netscape.com/nc-rdf#referrer refer...
... referrer http://home.netscape.com/nc-rdf#referrer referrer of the page url http://home.netscape.com/nc-rdf#url url of the page visit count http://home.netscape.com/nc-rdf#visitcount number of page visits a typical history list will display a tree with a selection of these fields. to use them, just put the url values above in the label attributes of the buttons or treecells. you can use nc:historyroot as the value of the ref attribute. you can also use the value nc:historybydate to get the history sorted into days. using the history list example let's see an example of displaying the history list. we'll display the history in a tree with three columns, the name, the url and the date. example 1 : source <tree...
...ous-zoo.com/rdf#species"/> </treerow> </treeitem> </treechildren> </rule> </template> </tree> here, the data has been generated from the file. the ref attribute has been set to the root element in the rdf file, which is the top-level seq. this will give us a complete list of animals. if we wanted to, we could set the ref attribute to any of the other about attribute values to limit the set of data that is returned. for example, to display only the reptiles, use a value of http://www.some-fictitious-zoo.com/reptiles. setting the ref attribute example the example below shows how to display a particular piece of an rdf datasource by setting the ref attribute. example 3 : source view <window id="example-window" title="history list" xmlns:animals="http://www.some...
...And 2 more matches
Scroll Bars - Archive of obsolete content
« previousnext » now, let's find out to add scroll bars to a window. adding scroll bars a scroll bar is typically used so that a user can move around in a large document. you can also use it when you need to ask for a value that falls within a certain range. scroll bars can be created in a number of ways. in xul, one can be created using the scrollbar tag. some elements, such as text boxes, will also add scroll bars as necessary when the content inside is too large. in this section, we'll discuss creating a stand-alone scroll bar. the user will set the value by adjusting the scroll bar. you probably won't use this too often. a scroll bar is made up of several parts: the slider, which is the main part of the scroll bar with the adjustable box, and the two arrow buttons on the en...
...r of the scroll bar orient this specifies the direction of the scroll bar. the default is horizontal, which creates a scroll bar that extends from left to right. you can also specify vertical which creates a scroll bar that extends from top to bottom. curpos this indicates the current position of the scroll bar thumb (the box that you can slide back and forth.) the value ranges from 0 to the value of maxpos. this value does not need a unit. the default value is 0. maxpos this indicates the maximum position of the scroll bar thumb. the is a numeric value and does not have a unit. the default value is 100. increment the value here specifies how much the value of curpos changes by when the user clicks on one of the scroll bar arrows. ...
... 0 to the value of maxpos. this value does not need a unit. the default value is 0. maxpos this indicates the maximum position of the scroll bar thumb. the is a numeric value and does not have a unit. the default value is 100. increment the value here specifies how much the value of curpos changes by when the user clicks on one of the scroll bar arrows. the default value is 1. pageincrement the value here specifies how much the value of curpos changes by when the user clicks pages through the scroll bar, which can be done by clicking on the tray between the box and the arrows. the default value is 10. the example given in the syntax above will create a scroll bar that can range from a value of 0 to 100. ...
...And 2 more matches
Splitters - Archive of obsolete content
se when clicked. resizebefore when the splitter is dragged, the elements to the left (or above) resize. this attribute indicates which element should resize. set this to closest to have the element immediately to the left of the splitter resize. set this to farthest to have the element that is the farthest away from the splitter to the left resize. (the first element in the box). the default value is closest. resizeafter when the splitter is dragged, the elements to the right (or below) resize. this attribute indicates which element should resize. set this to closest to have the element immediately to the right of the splitter resize. set this to farthest to have the element that is the farthest away from the splitter to the right resize. (the last element in the box). this attribute ...
...ave the element immediately to the right of the splitter resize. set this to farthest to have the element that is the farthest away from the splitter to the right resize. (the last element in the box). this attribute can also be set to grow, in which case the elements to the right of the splitter do not change size when the splitter is dragged, but instead the entire box changes size. the default value is closest. if you set the collapse attribute, you should also add a grippy element inside the splitter which the user can use to collapse the element. the width and height attributes of the elements next the splitter are adjusted when the splitter is dragged. the exact element depends on the resizebefore and resizeafter attributes. splitter example an example would be helpful here: example...
...before" resizeafter="farthest"> <grippy/> </splitter> <iframe id="content-2" width="60" height="20" src="w2.html"/> <iframe id="content-3" width="60" height="20" src="w3.html"/> <iframe id="content-4" width="60" height="20" src="w4.html"/> </hbox> here, four iframes have been created and a splitter has been placed in-between the first and second one. the collapse has been set to a value of before, meaning that if the splitter grippy is clicked on, the first frame would disappear and the splitter and the remaining frames would shuffle to the left. the splitter grippy is drawn centered inside the splitter. the splitter has been given a resizeafter value of farthest. this means that when the splitter is dragged, the farthest element after it will change size. in this case, frame 4...
...And 2 more matches
XUL Template Primer - Bindings - Archive of obsolete content
guide for up to date documentation. overview this document expands on the xul template primer by introducing the <bindings> element in the extended xul template syntax. the <bindings> element is used to create additional,optional variable bindings, in addition to those that are specified in a rule's <conditions>. this is different from the variables specified in the rule's conditions, where a value must be found for each variable for the rule to match. if a <binding> can't be matched, the rule will still fire. example to illustrate how <bindings> work, we'll examine this xul document, which builds a simple content model an rdf/xml file. <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin" type="text/css"?> <window xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://ww...
... we'll use a the following data model to illustrate how bindings work. see the rdf/xml file friends.rdf, below, a simple database with name and address informati...
... we'll use a the following data model to illustrate how bindings work. see the rdf/xml file friends.rdf, below, a simple database with name and address information for some of my good friends. <?
...And 2 more matches
arrowscrollbox - Archive of obsolete content
scrollboxobject type: nsiscrollboxobject the scroll box object implements the nsiscrollboxobject interface, which may be used to retrieve and adjust the scroll position of the list box. scrollincrement type: integer a read only property that lets you retrieve the number of pixels by which scrolling will occur when the arrowscrollbox is clicked. ...
... smoothscroll type: boolean can be set to enable or disable smooth scrolling for the corresponding arrowscrollbox. if not set explicitly, it will fall back to the smoothscroll attribute and then to the toolkit.scrollbox.smoothscroll preference. currently, smooth scrolling supports horizontal arrowscrollboxes only. ...
...corresponding arrowscrollbox. if not set explicitly, it will fall back to the smoothscroll attribute and then to the toolkit.scrollbox.smoothscroll preference. currently, smooth scrolling supports horizontal arrowscrollboxes only. tabindex type: integer gets and sets the value of the tabindex attribute. ...
...And 2 more matches
box - Archive of obsolete content
Archive › Mozilla › XUL › box
box has an orient attribute that is set to horizontal, the child elements are laid out from left to right in the order that they appear in the box. if orient is set to vertical, the child elements are laid out from top to bottom. child elements do not overlap. the default orientation is horizontal. more information is available in the xul tutorial. ...
...l, the child elements are laid out from left to right in the order that they appear in the box. if orient is set to vertical, the child elements are laid out from top to bottom. child elements do not overlap. the default orientation is horizontal. more information is available in the xul tutorial. ...
... laid out from left to right in the order that they appear in the box. if orient is set to vertical, the child elements are laid out from top to bottom. child elements do not overlap. the default orientation is horizontal. more information is available in the xul tutorial. ...
...And 2 more matches
caption - Archive of obsolete content
x> <caption label="my groupbox"/> </groupbox> <groupbox flex="1"> <caption> <checkbox label="a checked groupbox"/> </caption> </groupbox> attributes accesskey type: character this should be set to a character that is used as a shortcut key. this should be one of the characters that appears in the label attribute for the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right sid...
...th the start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. ...
...if this attribute is empty or left out, no image appears. ...
...And 2 more matches
colorpicker - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] a palette of colors from which a user may select by clicking on one of the grid cells. attributes disabled, color, onchange, preference, tabindex, type properties accessibletype, color, disabled, open, tabindex, value examples <colorpicker/> attributes disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. if the element is disabled, it does not respond to user actions, it cannot be focused, and the command event will not fire. in the case of form elements, it will not be submitted. do not set the attribute to true, as this will suggest you can s...
... change. a change event is fired in different ways for different xul input elements as listed below: onchange type: script code textbox when enter key is pressed radio/check box when the state is changed select list when the selected item is changed what is accessible the script context at this point can only access the following things: global values/functions i.e. window, document, or any of the functions/objects/variables bound to the window object event object example <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findfile-window" title="find files" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="text/javascri...
...elements with a higher tabindex are later in the tab sequence. type type: string if this attribute is not present, the colorpicker is displayed inside the window. if this is set to the text button, the colorpicker is displayed as a button. when the user clicks the button, a popup appears for the user to select a color. properties accessibletype type: integer a value indicating the type of accessibility object for the element. color type: color string the currently selected color. this is modified when the user selects a color. you can assign a string of the form #rrggbb to this property to change the selected color. disabled type: boolean gets and sets the value of the disabled attribute. open type: boo...
...And 2 more matches
editor - Archive of obsolete content
mozilla provides two types of editors, the html editor and the plaintext editor. the editor does not provide any editing user interface; you would supply that yourself. however, text editing, image resizing, and table row and cell editing capabilities are provided. if you do not set the editortype attribute on an editor, you must enable editing using the makeeditable method. ...
...ent-primary"/> once editable, the document can have special formatting and other html pieces added to it using the document.execcommand method: var editor = document.getelementbyid("myeditor"); // toggle bold for the current selection editor.contentdocument.execcommand("bold", false, null); see the midas overview for more command strings. attributes editortype type: one of the values below the type of editor to use. this value will be overridden depending on the content type of the document in the editor. html an html editor. text a plaintext editor. src type: uri the uri of the content to appear in the element. type type: string if set to the string content-primary, this editor becomes the primary content for the page. the...
...text a plaintext editor. src type: uri the uri of the content to appear in the element. type type: string if set to the string content-primary, this editor becomes the primary content for the page. the window for the primary content can be retrieved more conveniently using window.content. properties accessibletype type: integer a value indicating the type of accessibility object for the element. commandmanager type: nsicommandmanager the command manager handles operations on the editor. contentdocument type: document this read-only property contains the document object in the element. contentwindow type: todo use the contentwindow.wrappedjsobject to obtain a dom(html) window obje...
...And 2 more matches
prefpane - Archive of obsolete content
e help viewer when the help button is pressed. image type: uri the uri of the image to appear on the element. if this attribute is empty or left out, no image appears. the position of the image is determined by the dir and orient attributes. 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. onpaneload type: script code code defined here is called when the pane has been loaded, much like the load event for a window. selected type: boolean this attribute will be set to true for the currently selected prefpane. to change the selected pane, ...
... to change the selected pane, use the prefwindow's showpane method. src type: uri the uri of the overlay contents of preference pane. if this is not specified, the contents of the prefpane element is used. properties contentheight (readonly) the height (in pixels) of current pane's content. image type: image url gets and sets the value of the image attribute. label type: string gets and sets the value of the label attribute. loaded indicates whether the pane is fully loaded. preferenceelements type: dom nodelist holds a list of the ui elements in the pane that are attached to preferences. preferences type: dom nodelist holds a list of the pref...
...of the label attribute. loaded indicates whether the pane is fully loaded. preferenceelements type: dom nodelist holds a list of the ui elements in the pane that are attached to preferences. preferences type: dom nodelist holds a list of the preference elements in the pane. selected type: boolean this property's value is true if this element is selected, or false if it is not. this property is read only. this property is available for menuitem and menuseparator elements in firefox 3. src type: url gets and sets the value of the src attribute. methods domelement getpreferenceelement(in domelement startelement) preferenceforelement( uielement ) return type: preference ele...
...And 2 more matches
scrollbox - Archive of obsolete content
e='overflow: auto;'. this may also be used with any other container element. examples the following shows the xul for a bunch of labels. they come out in a box. if their container doesn't give enough room to hold them (geometrically) what happens depends on the enclosing elements; often the content is just clipped off on the bottom or right (depending on what's too big to fit). ...
...her container element. examples the following shows the xul for a bunch of labels. they come out in a box. if their container doesn't give enough room to hold them (geometrically) what happens depends on the enclosing elements; often the content is just clipped off on the bottom or right (depending on what's too big to fit). ...
...s the xul for a bunch of labels. they come out in a box. if their container doesn't give enough room to hold them (geometrically) what happens depends on the enclosing elements; often the content is just clipped off on the bottom or right (depending on what's too big to fit). ...
...And 2 more matches
Theme changes in Firefox 4 - Archive of obsolete content
toolkit/skin contains toolkit skin files. note: when extracting omni.jar, you may incorrectly get false warnings from some virus protection software. in addition, due to the way the archive is optiimized, some zip utilities don't work with it. controlling the actual icon size used by add-on toolbar buttons the iconsize attribute of the browser's toolbar elements now has a different default value on each toolbar independently. the value does not necessarily reflect the user preference in the toolbar customization palette anymore. the theme can now override the value by setting a special css property on the toolbar. the iconsize attribute of the toolbox element in the main browser window (#navigator-toolbox) still reflects the user preference in the toolbar customization palette. use of ...
...ecial css property on the toolbar. the iconsize attribute of the toolbox element in the main browser window (#navigator-toolbox) still reflects the user preference in the toolbar customization palette. use of the iconsize attribute on toolbar elements add-ons use the iconsize attribute to determine which icon they should display when a button is placed in a specific toolbar. iconsize value actual add-on toolbar button icon dimensions (assuming correct stylesheet and images) small 16x16 pixels large 24x24 pixels note: for stock buttons, the theme is free to use icons of any size. however, the theme should be designed in such a way that the above add-on button icon sizes fit correctly. note: add-ons always use a 24x24 pixels icon when the button ...
...rrect stylesheet and images) small 16x16 pixels large 24x24 pixels note: for stock buttons, the theme is free to use icons of any size. however, the theme should be designed in such a way that the above add-on button icon sizes fit correctly. note: add-ons always use a 24x24 pixels icon when the button is displayed in the toolbar customization palette. default values of the iconsize attribute on browser toolbars if the theme doesn't override the value of the iconsize attribute, the following defaults are used: toolbar element id default iconsize value menu bar #toolbar-menubar small navigation bar #nav-bar small or large depending on user preference. bookmarks toolbar #personaltoolbar small ...
...And 2 more matches
-ms-content-zoom-limit - Archive of obsolete content
the -ms-content-zoom-limit css shorthand property is a microsoft extension that specifies values for the -ms-content-zoom-limit-min and -ms-content-zoom-limit-max properties. initial valueas each of the properties of the shorthand:-ms-content-zoom-limit-max: 400%-ms-content-zoom-limit-min: 100%applies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednopercentagesas each of the properties of the shorthand:-ms-content-zoom-limit-max: the largest allowed zoom factor. a zoom factor of 100% corresponds to no zooming. larger values zoom in. smaller values zoom out.-ms-content-zoom-limit-min: the smallest allowed zoom factor. ...
... block-level elements and non-replaced inline-block elementsinheritednopercentagesas each of the properties of the shorthand:-ms-content-zoom-limit-max: the largest allowed zoom factor. a zoom factor of 100% corresponds to no zooming. larger values zoom in. smaller values zoom out.-ms-content-zoom-limit-min: the smallest allowed zoom factor. a zoom factor of 100% corresponds to no zooming. larger values zoom in. ...
...d non-replaced inline-block elementsinheritednopercentagesas each of the properties of the shorthand:-ms-content-zoom-limit-max: the largest allowed zoom factor. a zoom factor of 100% corresponds to no zooming. larger values zoom in. smaller values zoom out.-ms-content-zoom-limit-min: the smallest allowed zoom factor. a zoom factor of 100% corresponds to no zooming. larger values zoom in. ...
...And 2 more matches
-ms-content-zoom-snap-points - Archive of obsolete content
the first percentage specifies where the first snap-point will be placed. the second percentage specifies the distance between subsequent snap-points, both zoomed in and zoomed out from the initial snap-point. ...
... the first percentage specifies where the first snap-point will be placed. the second percentage specifies the distance between subsequent snap-points, both zoomed in and zoomed out from the initial snap-point. ...
... the first percentage specifies where the first snap-point will be placed. the second percentage specifies the distance between subsequent snap-points, both zoomed in and zoomed out from the initial snap-point. ...
...And 2 more matches
-ms-content-zooming - Archive of obsolete content
the element is zoomable. formal syntax none | zoom specifications not part of any specification. ...
...the element is zoomable. formal syntax none | zoom specifications not part of any specification. ...
...the element is zoomable. formal syntax none | zoom specifications not part of any specification. ...
...And 2 more matches
-ms-scroll-chaining - Archive of obsolete content
the nearest scrollable parent element begins scrolling when the user hits a scroll limit during any manipulation. no bounce effect is shown. none a bounce effect is shown when the user hits a scroll limit during any manipulation. ...
...the nearest scrollable parent element begins scrolling when the user hits a scroll limit during any manipulation. no bounce effect is shown. none a bounce effect is shown when the user hits a scroll limit during any manipulation. ...
...the nearest scrollable parent element begins scrolling when the user hits a scroll limit during any manipulation. no bounce effect is shown. none a bounce effect is shown when the user hits a scroll limit during any manipulation. ...
...And 2 more matches
-ms-scroll-limit-x-max - Archive of obsolete content
formal syntax auto | <length> specifications not part of any specification. remarks this property has no effect on non-scrollable elements. ...
... formal syntax auto | <length> specifications not part of any specification. remarks this property has no effect on non-scrollable elements. ...
... formal syntax auto | <length> specifications not part of any specification. remarks this property has no effect on non-scrollable elements. ...
...And 2 more matches
-ms-scroll-limit-y-max - Archive of obsolete content
formal syntax auto | <length> specifications not part of any specification. remarks this property has no effect on non-scrollable elements. ...
... formal syntax auto | <length> specifications not part of any specification. remarks this property has no effect on non-scrollable elements. ...
... formal syntax auto | <length> specifications not part of any specification. remarks this property has no effect on non-scrollable elements. ...
...And 2 more matches
-ms-scroll-rails - Archive of obsolete content
panning locks to the primary axis of motion. formal syntax none | railed specifications not part of any specification. remarks this property has no effect on non-scrollable elements. ...
...panning locks to the primary axis of motion. formal syntax none | railed specifications not part of any specification. remarks this property has no effect on non-scrollable elements. ...
...panning locks to the primary axis of motion. formal syntax none | railed specifications not part of any specification. remarks this property has no effect on non-scrollable elements. ...
...And 2 more matches
2D maze game with device orientation - Game development
thods to speed up a lot of things like image manipulation or assets management, which would be a lot harder to do manually. note: you can read the building monster wants candy article for the in-depth introduction to the basic phaser-specific functions and methods. back to game states: the line below is adding a new state called boot to the game: game.state.add('boot', ball.boot); the first value is the name of the state and the second one is the object we want to assign to it. the start method is starting the given state and making it active. let's see what the states are actually. managing game states the states in phaser are separate parts of the game logic; in our case we’re loading them from independent javascript files for better maintainability. the basic states used in this ga...
...me harder and more interesting we will add some obstacles between the ball and the exit. we could use a level editor, but for the sake of this tutorial let's create something on our own. to hold the block information we'll use a level data array: for each block we'll store the top and left absolute positions in pixels (x and y) and the type of the block — horizontal or vertical (t with the 'w' value meaning width and 'h' meaning height). then, to load the level we'll parse the data and show the blocks specific for that level. in the initlevels function we have: this.leveldata = [ [ { x: 96, y: 224, t: 'w' } ], [ { x: 72, y: 320, t: 'w' }, { x: 200, y: 320, t: 'h' }, { x: 72, y: 150, t: 'w' } ], // ... ]; every array element holds a collec...
...to load the level we'll parse the data and show the blocks specific for that level. in the initlevels function we have: this.leveldata = [ [ { x: 96, y: 224, t: 'w' } ], [ { x: 72, y: 320, t: 'w' }, { x: 200, y: 320, t: 'h' }, { x: 72, y: 150, t: 'w' } ], // ... ]; every array element holds a collection of blocks with 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 = t...
...And 2 more matches
Symbol - MDN Web Docs Glossary: Definitions of Web-related terms
in javascript, symbol is a primitive value. a value having the data type symbol can be referred to as a "symbol value". in a javascript runtime environment, a symbol value is created by invoking the function symbol, which dynamically produces an anonymous, unique value. a symbol may be used as an object property. symbol can have an optional description, but for debugging purposes only. a symbol value represents a unique identifier. for example: // here are two symbols with the same description: let sym1 = symbol("sym") let sym2 = symbol("sym") console.log(sym1 === sym2) // returns "false" // symbols are guaranteed to be unique. // even if we create many symbols with the same description, // they are different values. note: if you are familiar with ruby's (or another language) t...
...es. note: if you are familiar with ruby's (or another language) that also has a feature called "symbols", please don’t be misguided. javascript symbols are different. symbol type is a new feature in ecmascript 2015. there is no ecmascript 5 equivalent for symbol. ...
...ymbols", please don’t be misguided. javascript symbols are different. symbol type is a new feature in ecmascript 2015. there is no ecmascript 5 equivalent for symbol. in some programming languages, the symbol data type is referred to as an "atom." symbols don't "auto-convert" to strings most values in javascript support implicit conversion to a string. for instance, we can alert almost any value, and it will work. symbols are special. they don’t auto-convert. for example: let sym = symbol("sym") alert(sym) // typeerror: cannot convert a symbol value to a string that’s a "language guard" against messing up, because strings and symbols are fundamentally different, and should not occasionally convert one into another. if you really want to show a symbol, we need to call .tostring(...
...And 2 more matches
undefined - MDN Web Docs Glossary: Definitions of Web-related terms
undefined is a primitive value automatically assigned to variables that have just been declared, or to formal arguments for which there are no actual arguments. ...
... undefined is a primitive value automatically assigned to variables that have just been declared, or to formal arguments for which there are no actual arguments. ...
... undefined is a primitive value automatically assigned to variables that have just been declared, or to formal arguments for which there are no actual arguments. ...
...And 2 more matches
HTML: A good basis for accessibility - Learn web development
instead of just being tabbed through in their default source order. this is nearly always a bad idea, as it can cause major confusion. use it only if you really need to, for example, if the layout shows things in a very different visual order to the source code, and you want to make things work more logically. there are two other options for tabindex: tabindex="0" — as indicated above, this value allows elements that are not normally tabbable to become tabbable. this is the most useful value of tabindex. tabindex="-1" — this allows not normally tabbable elements to receive focus programmatically, e.g., via javascript, or as the target of links. whilst the above addition allows us to tab to the buttons, it does not allow us to activate them via the enter/return key. to do that, we ha...
... and what it conveys visually. any personal knowledge or extra description shouldn't be included here, as it is not useful for people who have not come across the image before. one thing to consider is whether your images have meaning inside your content, or whether they are purely for visual decoration, and thus have no meaning. if they are decorational, it is better to write an empty text as a value for alt attribute (see empty alt attributes) or to just include them in the page as css background images. note: read images in html and responsive images for a lot more information about image implementation and best practices. if you do want to provide extra contextual information, you should put it in the text surrounding the image, or inside a title attribute, as shown above. in this case...
...to describe the image (instead they'd just say "image", or similar). the reason to use an empty alt instead of not including it is because many screen readers announce the whole image url if no alt is provided. in the above example, the image is acting as a visual decoration to the heading it's associated with. in cases like this, and in cases where an image is only decoration and has no content value, you should include an empty alt in your img elements. another alternative is to use the aria role attribute role="presentation" as this also stops screen readers from reading out alternative text. note: if possible you should use css to display images that are only decorative. more on links links ( the <a> element with an href attribute ), depending on how they are used, can help or harm ac...
...And 2 more matches
HTML: A good basis for accessibility - Learn web development
instead of just being tabbed through in their default source order. this is nearly always a bad idea, as it can cause major confusion. use it only if you really need to, for example, if the layout shows things in a very different visual order to the source code, and you want to make things work more logically. there are two other options for tabindex: tabindex="0" — as indicated above, this value allows elements that are not normally tabbable to become tabbable. this is the most useful value of tabindex. tabindex="-1" — this allows not normally tabbable elements to receive focus programmatically, e.g., via javascript, or as the target of links. whilst the above addition allows us to tab to the buttons, it does not allow us to activate them via the enter/return key. to do that, we ha...
... and what it conveys visually. any personal knowledge or extra description shouldn't be included here, as it is not useful for people who have not come across the image before. one thing to consider is whether your images have meaning inside your content, or whether they are purely for visual decoration, and thus have no meaning. if they are decorational, it is better to write an empty text as a value for alt attribute (see empty alt attributes) or to just include them in the page as css background images. note: read images in html and responsive images for a lot more information about image implementation and best practices. if you do want to provide extra contextual information, you should put it in the text surrounding the image, or inside a title attribute, as shown above. in this case...
...to describe the image (instead they'd just say "image", or similar). the reason to use an empty alt instead of not including it is because many screen readers announce the whole image url if no alt is provided. in the above example, the image is acting as a visual decoration to the heading it's associated with. in cases like this, and in cases where an image is only decoration and has no content value, you should include an empty alt in your img elements. another alternative is to use the aria role attribute role="presentation" as this also stops screen readers from reading out alternative text. note: if possible you should use css to display images that are only decorative. more on links links ( the <a> element with an href attribute ), depending on how they are used, can help or harm ac...
...And 2 more matches
Sizing items in CSS - Learn web development
ontent. again, this is the intrinsic size of the element — its size is defined by its content. setting a specific size we can of course give elements in our design a specific size. when a size is given to an element (and the content of which then needs to fit into that size) we refer to it as an extrinsic size. take 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 per...
...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 percentage width it will be a percentage of the width of the parent container. this is because percentages resolve against the size of the containing block. with no percentage applied...
.... the padding and margin on the top and bottom of the box are the same size as the margin on the left and right. you might expect for example the percentage top and bottom margins to be a percentage of the element's height, and the percentage left and right margins to be a percentage of the element's width. however, this is not the case! when you use margin and padding set in percentages, the value is calculated from the inline size — therefore the width when working in a horizontal language. in our example, all of the margins and padding are 10% of the width. this means you can have equal-sized margins and padding all around the box. this is a fact worth remembering if you do use percentages in this way. min- and max- sizes in addition to giving things a fixed size, we can ask css to g...
...And 2 more matches
Styling tables - Learn web development
normally, table columns tend to be sized according to how much content they contain, which produces some strange results. with table-layout: fixed, you can size your columns according to the width of their headings, and then deal with their content as appropriate. this is why we...
...s the width of its heading, making for a nice way to size your table columns. chris coyier discusses this technique in more detail in fixed table layouts. we've coupled this with a width of 100%, meaning that the table will fill any container it is put in, and be nicely responsive (although it would still need some more work to get it looking good on narrow screen widths). a border-collapse value of collapse is a standard best practice for any table styling effort. by default, when you set borders on table elements, they will all have spacing between them, as the below image illustrates: this doesn't look very nice (although it might be the look you want, who knows?) with border-collapse: collapse; set, the borders collapse down into one, which looks much better: we've put a border aro...
...hoice. we've also set our custom font on the headings inside the <thead> and <tfoot> elements, for a nice grungy, punky look. we've set some letter-spacing on the headings and cells, as we feel it aids readability. again, mostly a stylistic choice. we've center-aligned the text in the table cells inside the <tbody> so that they line up with the headings. by default, cells are given a text-align value of left, and headings are given a value of center, but generally it looks better to have the alignments set the same for both. the default bold weight on the heading fonts is enough to differentiate their look. we've right-aligned the heading inside the <tfoot> so that it is visually associated better with its data point. the result looks a bit neater: graphics and colors now onto graphics...
...And 2 more matches
Styling links - Learn web development
rs, plus an underline to make the link stand out even more. two points to note here are: the underline has been created using border-bottom, not text-decoration — some people prefer this because the former has better styling options than the latter, and is drawn a bit lower, so doesn't cut across the descenders of the word being underlined (e.g. the tails on g and y). the border-bottom value has been set as 1px solid, with no color specified. doing this makes the border adopt the same color as the element's text, which is useful in cases like this where the text is a different color in each case. finally, a:active is used to give the links an inverted color scheme while they are being activated, to make it clear something important is happening! active learning: style your ow...
...css input</h2> <textarea id="code" class="css-input" style="width: 90%;height: 10em;padding: 10px;border: 1px solid #0095dd;">a { } a:link { } a:visited { } a:focus { } a:hover { } a:active { }</textarea> <h2>output</h2> <div class="output" style="width: 90%;height: 10em;padding: 10px;border: 1px solid #0095dd;"></div> <div class="controls"> <input id="reset" type="button" value="reset" style="margin: 10px 10px 0 0;"> <input id="solution" type="button" value="show solution" style="margin: 10px 0 0 10px;"> </div> </div> var htmlinput = document.queryselector(".html-input"); var cssinput = document.queryselector(".css-input"); var reset = document.getelementbyid("reset"); var htmlcode = htmlinput.value; var csscode = cssinput.value; var output = document.queryselec...
...ut"); var reset = document.getelementbyid("reset"); var htmlcode = htmlinput.value; var csscode = cssinput.value; var output = document.queryselector(".output"); var solution = document.getelementbyid("solution"); var styleelem = document.createelement('style'); var headelem = document.queryselector('head'); headelem.appendchild(styleelem); function drawoutput() { output.innerhtml = htmlinput.value; styleelem.textcontent = cssinput.value; } reset.addeventlistener("click", function() { htmlinput.value = htmlcode; cssinput.value = csscode; drawoutput(); }); solution.addeventlistener("click", function() { htmlinput.value = htmlcode; cssinput.value = 'p {\n font-size: 1.2rem;\n font-family: sans-serif;\n line-height: 1.4;\n}\n\na {\n outline: none;\n text-decoration: none;\n ...
...And 2 more matches
What are browser developer tools? - Learn web development
ied to the currently selected element: these features are especially handy: the rules applied to the current element are shown in order of most-to-least-specific. click the checkboxes next to each declaration to see what would happen if you removed the declaration. click the little arrow next to each shorthand property to show the property's longhand equivalents. click a property name or value to bring up a text box, where you can key in a new value to get a live preview of a style change. next to each rule is the file name and line number the rule is defined in. clicking that rule causes the dev tools to jump to show it in its own view, where it can generally be edited and saved. you can also click the closing curly brace of any rule to bring up a text box on a new line, where you c...
...ow it in its own view, where it can generally be edited and saved. you can also click the closing curly brace of any rule to bring up a text box on a new line, where you can write a completely new declaration for your page. you'll notice a number of clickable tabs at the top of the css viewer: computed: this shows the computed styles for the currently selected element (the final, normalized values that the browser applies). layout: in firefox, this area includes two sections: box model: represents visually the current element's box model, so you can see at a glance what padding, border and margin is applied to it, and how big its content is. grid: if the page you are inspecting uses css grid, this section allows you to view the grid details. fonts: in firefox, the fonts ta...
... grid details. fonts: in firefox, the fonts tab shows the fonts applied to the current element. find out more find more out about the inspector in different browsers: firefox page inspector ie dom explorer chrome dom inspector (opera's inspector works the same as this) safari dom inspector and style explorer the javascript debugger the javascript debugger allows you to watch the value of variables and set breakpoints, places in your code that you want to pause execution and identify the problems that prevent your code from executing properly. to get to the debugger: firefox: select ➤ web developer ➤ debugger or press ctrl + shift + s to open the javascript debugger. if the tools are already displayed, click on the debugger tab. chrome: open the developer tools and th...
...And 2 more matches
Example 4 - Learn web development
this is the fourth example that explain how to build custom form widgets. ...
....5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #f0f0f0; background : -webkit-linear-gradient(90deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "▼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : ce...
...sslist.add('active'); }; function toggleoptlist(select, show) { var optlist = select.queryselector('.optlist'); optlist.classlist.toggle('hidden'); } function highlightoption(select, option) { var optionlist = select.queryselectorall('.option'); optionlist.foreach(function (other) { other.classlist.remove('highlight'); }); option.classlist.add('highlight'); }; function updatevalue(select, index) { var nativewidget = select.previouselementsibling; var value = select.queryselector('.value'); var optionlist = select.queryselectorall('.option'); nativewidget.selectedindex = index; value.innerhtml = optionlist[index].innerhtml; highlightoption(select, optionlist[index]); }; function getindex(select) { var nativewidget = select.previouselementsibling; return n...
...And 2 more matches
Example 5 - Learn web development
this is the last example that explain how to build custom form widgets. ...
....5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #f0f0f0; background : -webkit-linear-gradient(90deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "▼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : ce...
...sslist.add('active'); }; function toggleoptlist(select, show) { var optlist = select.queryselector('.optlist'); optlist.classlist.toggle('hidden'); } function highlightoption(select, option) { var optionlist = select.queryselectorall('.option'); optionlist.foreach(function (other) { other.classlist.remove('highlight'); }); option.classlist.add('highlight'); }; function updatevalue(select, index) { var nativewidget = select.previouselementsibling; var value = select.queryselector('.value'); var optionlist = select.queryselectorall('.option'); optionlist.foreach(function (other) { other.setattribute('aria-selected', 'false'); }); optionlist[index].setattribute('aria-selected', 'true'); nativewidget.selectedindex = index; value.innerhtml = optionlist[in...
...And 2 more matches
HTML table basics - Learn web development
Learn › HTML › Tables › Basics
n multiple columns and rows, and how to group together all the cells in a column for styling purposes. prerequisites: the basics of html (see introduction to html). objective: to gain basic familiarity with html tables. what is a table ? a table is a structured set of data made up of rows and columns (tabular data). a table allows you to quickly and easily look up values that indicate some kind of connection between different types of data, for example a person and their age, or a day of the week, or the timetable for a local swimming pool. tables are very commonly used in human society, and have been for a long time, as evidenced by this us census document from 1800: it is therefore no wonder that the creators of html provided a means by which to struct...
... horse mare stallion crocodile chicken hen rooster we need a way to get "animals", "hippopotamus", and "crocodile" to span across two columns, and "horse" and "chicken" to span downwards over two rows. fortunately, table headers and cells have the colspan and rowspan attributes, which allow us to do just those things. both accept a unitless number value, which equals the number of rows or columns you want spanned. for example, colspan="2" makes a cell span two columns. let's use colspan and rowspan to improve this table. first, make a local copy of our animals-table.html and minimal-table.css files in a new directory on your local machine. the html contains the same animals example as you saw above. next, use colspan to make "animals", "hip...
... we still have to include a blank <col> element — if we didn't, the styling would just be applied to the first column. if we wanted to apply the styling information to both columns, we could just include one <col> element with a span attribute on it, like this: <colgroup> <col style="background-color: yellow" span="2"> </colgroup> just like colspan and rowspan, span takes a unitless number value that specifies the number of columns you want the styling to apply to. active learning: colgroup and col now it's time to have a go yourself. below you can see the timetable of a languages teacher. on friday she has a new class teaching dutch all day, but she also teaches german for a few periods on tuesday and thursdays. she wants to highlight the columns containing the days she is teaching. ...
...And 2 more matches
Making asynchronous programming easier with async and await - Learn web development
y typing the following lines into your browser's js console: function hello() { return "hello" }; hello(); the function returns "hello" — nothing special, right? but what if we turn this into an async function? try the following: async function hello() { return "hello" }; hello(); ah. invoking the function now returns a promise. ...
... now returns a promise. this is one of the traits of async functions — their return values are guaranteed to be converted to promises. you can also create an async function expression, like so: let hello = async function() { return "hello" }; hello(); and you can use arrow functions: let hello = async () => { return "hello" }; these all do basically the same thing. to actually consume the value returned when the promise fulfills, since it is returning a promise, we could use a .then() block: hello().then((value) => console.log(value)) or even just shorthand such as hello().then(console.log) like we saw in the last article. so the async keyword is added to functions to tell them to return a promise rather than directly returning the value. in addition, this lets synchronous function...
... declared async, the javascript engine can optimize your program for you. sweet! the await keyword the real advantage of async functions becomes apparent when you combine it with the await keyword — in fact, await only works inside async functions. this can be put in front of any async promise-based function to pause your code on that line until the promise fulfills, then return the resulting value. in the meantime, other code that may be waiting for a chance to execute gets to do so. you can use await when calling any function that returns a promise, including web api functions. here is a trivial example: async function hello() { return greeting = await promise.resolve("hello"); }; hello().then(alert); of course, the above example is not very useful, although it does serve to illust...
...And 2 more matches
Image gallery - Learn web development
oved again. to give you more of an idea, have a look at the finished example (no peeking at the source code!) steps to complete the following sections describe what you need to do. looping through the images we've already provided you with lines that store a reference to the thumb-bar <div> inside a constant called thumbbar, create a new <img> element, set its src attribute to a placeholder value xxx, and append this new <img> element inside thumbbar. you need to: put the section of code below the "looping through images" comment inside a loop that loops through all 5 images — you just need to loop through five numbers, one representing each image. in each loop iteration, replace the xxx placeholder value with a string that will equal the path to the image in each case. we are sett...
...d append this new <img> element inside thumbbar. you need to: put the section of code below the "looping through images" comment inside a loop that loops through all 5 images — you just need to loop through five numbers, one representing each image. in each loop iteration, replace the xxx placeholder value with a string that will equal the path to the image in each case. we are setting the value of the src attribute to this value in each case. bear in mind that in each case, the image is inside the images directory and its name is pic1.jpg, pic2.jpg, etc. adding an onclick handler to each thumbnail image in each loop iteration, you need to add an onclick handler to the current newimage — this handler should find the value of the src attribute of the current image. set the src attrib...
... alternatively, you can add one event listener to the thumb bar. writing a handler that runs the darken/lighten button that just leaves our darken/lighten <button> — we've already provided a line that stores a reference to the <button> in a constant called btn. ...
...And 2 more matches
Introduction to web APIs - Learn web development
s (see the notifications api) or vibration hardware (see the vibration api). client-side storage apis are becoming a lot more widespread in web browsers — the ability to store data on the client-side is very useful if you want to create an app that will save its state between page loads, and perhaps even work when the device is offline. there are a number of options available, e.g. simple name/value storage with the web storage api, and more complex tabular data storage with the indexeddb api. common third-party apis third-party apis come in a large variety; some of the more popular ones that you are likely to make use of sooner or later are: the twitter api, which allows you to do things like displaying your latest tweets on your website. map apis like mapquest and the google maps ap...
...s the destination of the audio, i.e. the device on your computer that will actually output it — usually your speakers or headphones. so how do these objects interact? if you look at our simple web audio example (see it live also), you'll first see the following html: <audio src="outfoxing.mp3"></audio> <button class="paused">play</button> <br> <input type="range" min="0" max="1" step="0.01" value="1" class="volume"> we, first of all, include an <audio> element with which we embed an mp3 into the page. we don't include any default browser controls. next, we include a <button> that we'll use to play and stop the music, and an <input> element of type range, which we'll use to adjust the volume of the track while it's playing. next, let's look at the javascript for this example. we start b...
...u may notice that the play() and pause() methods being used to play and pause the track are not part of the web audio api; they are part of the htmlmediaelement api, which is different but closely-related. ...
...And 2 more matches
What went wrong? Troubleshooting JavaScript - Learn web development
note: see our typeerror: "x" is not a function reference page for more details about this error. syntax errors round two save your page and refresh, and you should see the error has gone. now if you try to enter a guess and press the submit guess button, you'll see ... another error! this time the error being reported is "typeerror: loworhi is null", on line 78. note: null is a special value that means "nothing", or "no value". so loworhi has been declared and initialised, but not with any meaningful value — it has no type or value. note: this error didn't come up as soon as the page was loaded because this error occurred inside a function (inside the checkguess() { ... } block). as you'll learn in more detail in our later functions article, code inside functions runs in a separ...
...rking because loworhi does not contain what it's supposed to. let's see why this is — try searching for other instances of loworhi in the code. the earliest instance you'll find in the javascript is on line 48: const loworhi = document.queryselector('loworhi'); at this point we are trying to make the variable contain a reference to an element in the document's html. let's check whether the value is null after this line has been run. add the following code on line 49: console.log(loworhi); note: console.log() is a really useful debugging function that prints a value to the console. so it will print the value of loworhi to the console as soon as we have tried to set it in line 48. save and refesh, and you should now see the console.log() result in your console. sure enough, ...
... let's think about what the problem could be. ...
...And 2 more matches
Object prototypes - Learn web development
, 'smith', 32, 'male', ['music', 'skiing']); if you type "person1." into your javascript console, you should see the browser try to auto-complete this with the member names available on this object: in this list, you will see the members defined on person1's constructor — person() — name, age, gender, interests, bio, and greeting. ...
...the members defined on person1's constructor — person() — name, age, gender, interests, bio, and greeting. you will however also see some other members — tostring, valueof, etc — these are defined on person1's prototype object's prototype object, which is object.prototype. what happens if you call a method on person1, which is actually defined on object.prototype? for example: person1.valueof() valueof() returns the value of the object it is called on. in this case, what happens is: the browser initially checks to see if the person1 object has a valueof() method available on it, as defined on its constructor, person(), and it doesn't. so the browser checks to see if the person1's prototype object has a valueof() method available on it. it doesn't, then the browser checks person...
...hods — many more than the number of inherited members we saw available on the person1 object. some are inherited, and some aren't — why is this? as mentioned above, the inherited ones are the ones defined on the prototype property (you could call it a sub-namespace) — that is, the ones that begin with object.prototype., and not the ones that begin with just object. the prototype property's value is an object, which is basically a bucket for storing properties and methods that we want to be inherited by objects further down the prototype chain. so object.prototype.tostring(), object.prototype.valueof(), etc., are available to any object types that inherit from object.prototype, including new object instances created from the person() constructor. object.is(), object.keys(), and other me...
...And 2 more matches
Ember interactivity: Events, classes and state - Learn web development
mponent from '@glimmer/component'; export default class headercomponent extends component { } inside this file we will implement the event handler code. ...
...mponent'; export default class headercomponent extends component { } inside this file we will implement the event handler code. update the content to the following: import component from '@glimmer/component'; import { action } from '@ember/object'; export default class headercomponent extends component { @action onkeydown({ target, key }) { let text = target.value.trim(); let hasvalue = boolean(text); if (key === 'enter' && hasvalue) { alert(text); target.value = '' } } } the @action decorator is the only ember-specific code here (aside from extending from the component superclass, and the ember-specific items we are importing using javascript module syntax) — the rest of the file is vanilla javascript, and would work in any application. the @action ...
...urred in the template. @action also binds the this of the function to the class instance. note: a decorator is basically a wrapper function, which wraps and calls other functions or properties, providing additional functionality along the way. for example, the @tracked decorator (see slightly later on) runs code it is applied to, but additionally tracks it and automatically updates the app when values change. read javascript decorators: what they are and when to use them for more general information on decorators. coming back to our browser tab with the app running, we can type whatever we want, and when we hit enter we'll be greeted with an alert message telling us exactly what we typed. with the interactivity of the header input out of the way, we need a place to store todos so that ot...
...And 2 more matches
Ember resources and troubleshooting - Learn web development
mut was not covered in this tutorial and is really baggage from a transitional time when ember was moving from two-way bound data to the more common and easier-to-reason-about one-way bound data flow. it could be thought of as a build-time transform that wraps its argument with a setter function. ...
...however, mut has unnatural semantics and has caused much confusion over the term of its existence. ...
...however, mut has unnatural semantics and has caused much confusion over the term of its existence. there have been a coupleof new ideas put together into the form of addons that use the public apis...
...And 2 more matches
Componentizing our React app - Learn web development
definition so that it takes props as a parameter. you can console.log() your props as we did before, if you'd like to check that they are being received by the component correctly. once you're confident that your component is getting its props, you can replace every occurrence of eat with your name prop. remember: when you're in the middle of a jsx expression, you use curly braces to inject the value of a variable. putting all that together, your todo() function should read like this: export default function todo(props) { return ( <li classname="todo stack-small"> <div classname="c-cb"> <input id="todo-0" type="checkbox" defaultchecked={true} /> <label classname="todo-label" htmlfor="todo-0"> {props.name} </label> </div> <div classna...
...uld show three unique tasks. another problem remains though: they're all still checked by default. is it completed? in our original static list, only eat was checked. once again, we want to reuse most of the ui that makes up a <todo /> component, but change one thing. that's a good job for another prop! give each <todo /> call in app.js a new prop of completed. the first (eat) should have a value of true; the rest should be false: <todo name="eat" completed={true} /> <todo name="sleep" completed={false} /> <todo name="repeat" completed={false} /> as before, we must go back to todo.js to actually use these props. change the defaultchecked attribute on the <input /> so that its value is equal to the completed prop. once you’re done, the todo component's <input /> element will read like ...
..., your browser will check or uncheck the equivalent rendered checkboxes accordingly. gimme some id, please right now, our <todo /> component gives every task an id attribute of todo-0. this is bad html because id attributes must be unique (they are used as unique identifiers for document fragments, by css, javascript, etc.). this means we should give our component an id prop that takes a unique value for each todo. to follow the same pattern we had initially, let's give each instance of the <todo /> component an id in the format of todo-i, where i gets larger by one every time: <todo name="eat" completed={true} id="todo-0" /> <todo name="sleep" completed={false} id="todo-1" /> <todo name="repeat" completed={false} id="todo-2" /> now go back to todo.js and make use of the id prop. it needs ...
...And 2 more matches
Getting started with React - Learn web development
https://reactjs.org" target="_blank" rel="noopener noreferrer" > learn react </a> </header> </div> ); } the app function returns a jsx expression. this expression defines what your browser ultimately renders to the dom. some elements in the expression have attributes, which are written just like in html, following a pattern of attribute="value". on line 3, the opening <div> tag has a classname attribute. this is the same as the class attribute in html, but because jsx is javascript, we can't use the word class — it's reserved, meaning javascript already uses it for a specific purpose and it would cause problems here in our code. a few other html attributes are written differently in jsx than they are in html too, for the same kind of...
...to get a bit more comfortable editing components and working with data in react. we'll talk about how variables are used inside jsx, and introduce props, which are a way of passing data into a component (which can then be accessed using variables). variables in jsx back in app.js, let’s focus on line 9: <img src={logo} classname="app-logo" alt="logo" /> here, the <img /> tag's src attribute value is in curly braces. this is how jsx recognizes variables. react will see {logo}, know you are referring to the logo import on line 2 of our app, then retrieve the logo file and render it. let's try making a variable of our own. before the return statement of app, add const subject = 'react';. your app component should now look like this: function app() { const subject = "react"; return ( ...
...er> </div> ); } when you save, your browser should display "hello, react!" instead of "hello, world!" variables are convenient, but the one we've just set doesn’t make great use of react's features. that's where props come in. component props a prop is any data passed into a react component. props are written inside component calls, and use the same syntax as html attributes — prop="value". let’s open index.js and give our <app/> call its first prop. add a prop of subject to the <app/> component call, with a value of clarice. when you are done, your code should look something like this: reactdom.render(<app subject="clarice" />, document.getelementbyid('root')); back in app.js, let's revisit the app function itself, which reads like this (with the return statement shortened f...
...And 2 more matches
Implementing feature detection - Learn web development
ocation" in navigator) { ... } property on element create an element in memory using document.createelement() and then check if a property exists on it. the example shown is a way of detecting html5 canvas support. function supports_canvas() { return !!document.createelement('canvas').getcontext; } if(supports_canvas()) { ... } method on element return value create an element in memory using document.createelement() and then check if a method exists on it. if it does, check what value it returns. see dive into html5 video formats detection test. property on element retains value create an element in memory using document.createelement(), set a property to a certain value, then check to see if the value is retained. see dive into ...
... the dive into html5 detecting html5 features page has a lot more useful feature detection tests besides the ones listed above, and you can generally find a feature detection test for most things by searching for "detect support for your-feature-here" in your favorite search engine. ...
...ive into html5 video formats detection test. property on element retains value create an element in memory using document.createelement(), set a property to a certain value, then check to see if the value is retained. see dive into html5 <input> types detection test. note: the double not in the above example (!!) is a way to force a return value to become a "proper" boolean value, rather than a truthy/falsy value that may skew the results. the dive into html5 detecting html5 features page has a lot more useful feature detection tests besides the ones listed above, and you can generally find a feature detection test for most things by searching for "detect support for your-feature-here" in your favorite search engine. bear in mind though that some features, however, are ...
...And 2 more matches
Chrome Worker Modules
implements a minimal commonjs require(). loading modules loading a module is simple. start by importing the module loader. you only need to do it once for each worker, from within the chrome worker itself: importscripts("resource://gre/modules/workers/require.js"); note: although you only need to do this once for each worker, it doesn't hurt if you do it more than once. this defines a global value require(), that you may now use as follows: // import the module // (here, we import the core of os.file) let core = require("resource://gre/modules/osfile/osfile_shared_allthreads.jsm"); // we may now use module core. core.declareffi(...) note that, for the moment, require() only accepts absolute uris. if the your module uri ends with “.js”, you can omit the extension. creating modules crea...
...d_allthreads.jsm"); // we may now use module core. core.declareffi(...) note that, for the moment, require() only accepts absolute uris. if the your module uri ends with “.js”, you can omit the extension. creating modules creating a module is just as simple. a module is a file, whose filename generally ends with either “.js” or “.jsm”, and designed to be opened through require(). ...
...fi(...) note that, for the moment, require() only accepts absolute uris. if the your module uri ends with “.js”, you can omit the extension. creating modules creating a module is just as simple. a module is a file, whose filename generally ends with either “.js” or “.jsm”, and designed to be opened through require(). any value you define in that file is private by default. ...
...And 2 more matches
Embedding API for Accessibility
loading the document over the network. ...
...bug builds, this can cause a great number of assertions (bug 71598) to use prefs in embedding, use something like the following code: #include "nsipref.h"; nsresult rv; nscomptr<nsipref> prefs(do_getservice(ns_pref_contractid, &rv)); prefs->setboolpref("bool.pref.name", pr_true /* or pr_false */); prefs->setintpref("int.pref.name", newvalue); prefs->setcharpref("string.pref.name", newcharstarvalue); to manually add a pref to your settings, add a line like the following to your prefs.js: user_pref("accessibility.browsewithcaret", true); accessibility prefs reference the following is a description of what accessibility prefs give us (or will give us), for accessibility: functionality implementation works as of i...
...fonts", whichfonts); /* whichfonts: 0=no, 1=yes */ moz 0.8 fonts from operating system? ...
...And 2 more matches
Debugging Frame Reflow
ext vp viewport once the problem is reduced to a single frame level, placing a breakpoint at displayreflowenterprint in nsframe.cpp is a very efficient way to step through the reflow tree. ...
...point at displayreflowenterprint in nsframe.cpp is a very efficient way to step through the reflow tree. other reflow debug options gecko_display_reflow_flag_pixel_errors setting this option via set gecko_display_reflow_flag_pixel_errors = 1 enables a verification for each coordinate value that the coordinates are aligned at pixel boundaries. ...
...os2 is very vulnerable to pixel alignment errors as text is drawn on pixel boundaries. ...
...And 2 more matches
Debugging on Windows
++ 6.0: go to project > settings..., debug tab and select "additional dlls" from the drop down list. check "locate additional dlls" option. for each dll, click the "new" button which creates a new entry and then hit the "..." buttons which lets you browse to the dll. you will only be able to add one dll at a time. vc++ 7.0 automatically finds additional dlls. customizing the debugger's variable value view you can customize how visual c++ displays classes in the variable view. by default vc++ displays "{...}" and you need to click the small + icon to expand the members. you can change this behaviour, and make visual c++ display whatever data member you want in whatever order, formatter however you like instead of just "{...}". you need to locate a file called "autoexp.dat" in your visual c++...
...h=<width,d>; height=<height,d> nsstaticatomwrapper=<mstaticatom->mstring,s> 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. ...
...re are some wildcards you can use (tested with vc 8): nscomptr.*\:\:.*=nostepinto (nsg|g)etter_*addrefs.*=nostepinto ns_convertutf.* ; might be too broad: (ns|promise)[^\:]*[ss]tring.* ...add common functions to this list should probably make a .reg file for easy importing obtaining stdout and other file handles running the following command in the command window in visual studio returns the value of stdout, which can be used with various debugging methods (such as nsgenericelement::list) that take a file* param: debug.evaluatestatement {,,msvcr80d}(&__iob_func()[1]) (alternatively you can evaluate {,,msvcr80d}(&__iob_func()[1]) in the quickwatch window) similarly, you can open a file on the disk using fopen: >debug.evaluatestatement {,,msvcr80d}fopen("c:\\123", "w") 0x10311dc0 { ..sn...
...And 2 more matches
SVG Guidelines
. these rules are based on some real examples seen in mozilla's code. ...
...his path: <path d=" m5,5 l1,1z "> can be cut down to this: <path d="m5,5 l1,1z"> similarly, this polygon: <polygon points=" 0,0 4,4 4,0 "/> can be cut down to this: <polygon points="0,0 4,4 4,0"/> line breaks you should only use line breaks for logical separation or if they help make the file readable. you should avoid line breaks between every single element or within attribute values. it's recommended to put the attributes on the same line as their tag names, if possible. you should also put the shortest attributes first, so they are easier to spot. unused tags and attributes editor metadata vector editors (inkscape, adobe illustrator, sketch) usually add a bunch of metadata in svg files while saving them. metadata can mean many things, including: the typical "created...
...in addition to non-standard editor metadata, standard compliant metadata also exists. typical examples of this are <title> and <desc> tags. although this kind of data is supported by the browser, it can only be displayed when the svg is opened in a new tab. plus, in most of the cases, the filename is quite descriptive so it's recommended to remove that kind of metadata since it doesn't bring much value. you shouldn't include doctypes in your svgs either; they are a source of many issues, and the svg wg recommends not to include them. see svg authoring guidelines. avoid the use of cdata sections cdata sections are used to avoid parsing some text as html. most of time, cdata isn't needed, for example, the content in <style> tags doesn't need to be wrapped in a cdata section as the content insi...
...And 2 more matches
Displaying Places information using views
ur extension or application, you may want to use the built-in places views, which are generic and will save you a lot of time writing basic functionality so that you can focus on building your extension or application. places provides the following built-in views: tree menu toolbar instantiating the three built-in views are simply standard xul elements with a special type attribute whose value is "places". every xul document containing a built-in view must import the stylesheet browser/components/places/content/places.css and overlay the file browser/components/places/content/placesoverlay.xul: <?xml-stylesheet href="chrome://browser/content/places/places.css" ?> <?xul-overlay href="chrome://browser/content/places/placesoverlay.xul" ?> it's this stylesheet that binds elements with t...
...mands, which you may want to take advantage of in your own uses of the views. connecting a view to its data to hook up a built-in view to its data, use the view's special place attribute. note: starting in gecko 2.0, you can't use the place attribute with menus. see menu view for details. you may specify the attribute directly in the xul or set its corresponding property via javascript. its value is the uri of a query, and the data shown in the view are the results of this query. for simple queries whose uris do not change over the life of the view, you might specify the place attribute directly in the xul. for more complicated queries or queries whose uris you plan on changing, you will want to set the view's place property dynamically using javascript. note that in the latter case it is...
...to the built-in tree view: <?xml-stylesheet href="chrome://browser/skin/places/places.css" ?> for examples of instantiating a tree view from javascript rather than xul, see programmatic generation of the built-in tree view. column binding the built-in tree view makes it easy to hook up specific columns of your tree to specific properties of the result. ...
...And 2 more matches
Communicating with frame scripts
an xpcom component), you can access the window of the browser that sent the message with message.target.ownerdocument.defaultview. ...
...sage, the frame script uses the global sendsyncmessage() function: // frame script sendsyncmessage("my-addon@me.org:my-e10s-extension-message"); when a chrome script receives a synchronous message, it should return a value from its message listener: // chrome script messagemanager.addmessagelistener("my-addon@me.org:my-e10s-extension-message", listener); function listener(message) { return "value from chrome"; } this value is then presented to the frame script in the return value of sendsyncmessage(). ...
...ssage, it should return a value from its message listener: // chrome script messagemanager.addmessagelistener("my-addon@me.org:my-e10s-extension-message", listener); function listener(message) { return "value from chrome"; } this value is then presented to the frame script in the return value of sendsyncmessage(). ...
...And 2 more matches
HTMLIFrameElement.executeScript()
of the htmliframeelement interface allows a specified script to be executed against a page loaded in the browser <iframe>. note: use of the browser api requires a privileged app, and browser and/or embed-apps permissions, depending on what you want to do. see using the browser api for more details. syntax var mydomrequest = instanceofhtmliframeelement.executescript(script, options); return value a domrequest object that returns an onsuccess handler if the script is successfully executed against the loaded content, or an onerror handler if not. parameters script the script to be executed. options optional optionally, you can provide an origin or url for the script to be executed against. it's recommended that you include an origin or url, in order to ensure that the script is bein...
... specifications not part of any specification. ...
... specifications not part of any specification. ...
...And 2 more matches
Download
stopped property becomes true. contenttype string the mime type of the download, for example "text/plain", or null if the mime type is not available. this property may be populated or changed while the download is in progress, using the mime type provided by the server. currentbytes read only number number of bytes currently transferred. this value starts at zero, and may be updated regardless of the value of hasprogress. note: you shouldn't rely on this property being equal to totalbytes to determine whether the download is completed. you should use the individual state properties instead, since this value may not be updated after the last piece of data is transferred. error read only downloaderror when the downlo...
...been completed successfully, this property is not relevant anymore. whether partial data can actually be retained depends on the saver and the download source, and may not be known before the download is started. hasprogress read only boolean indicates whether this download's progress property is able to report partial progress while the download proceeds, and whether the value in totalbytes is relevant. this depends on the saver and the download source. launchwhensucceeded boolean if this property is true when the download finishes successfully, the target file will be opened or executed automatically. launcherpath string local file path of the application to be used to launch the target file, or null if the file should be launched with th...
...lt application associated with the contenttype property or the extension of the target file. onchange function this can be set to a function that is called after other properties change. warning: this property cannot be used if the download is part of a downloadlist. progress read only number progress percent, from 0 to 100. intermediate values are reported only if hasprogress is true. note: you shouldn't rely on this property being equal to 100 to determine whether the download is completed. you should use the individual state properties (for example, the succeeded property) instead. saver read only downloadsaver saver object associated with this download. source read only downloadsource source...
...And 2 more matches
PerfMeasurement.jsm
linux, but it is planned to add support for windows (bug 583322) and osx (bug 583323) as well, and we welcome patches for other operating systems. method overview static bool canmeasuresomething(); void reset(); void start(); void stop(); member fields recorded data variables these variables provide access to the recorded data. any measurable event that was not being recorded has a value of -1 (that is, 0xffffffffffffffff). note: these values are all zeroed (or set to -1, for events not being measured) when you initialize the perfmeasurement object, then they are not zeroed again unless you explicitly call the reset() method. this lets you accumulate measurements over multiple passes through code that you want to analyze. variable type description cpu_cycles uint64 the numb...
...e recorded. variable type description eventsmeasured eventmask a bit mask of the event types recorded; this can differ from the events requested if the platform doesn't support all of the event types you specified when creating the perfmeasurement object. constants event mask constants these constants are used to construct the mask indicating which events you want to monitor. constant value description cpu_cycles 0x00000001 measure cpu cycles elapsed. instructions 0x00000002 measure the number of instructions executed. cache_references 0x00000004 measure the number of cache references. cache_misses 0x00000008 measure the number of cache misses. branch_instructions 0x00000010 measure the number of branch instructions executed. branch_misses 0x00000020 measure the number o...
...asure the number of major page faults that occurred. context_switches 0x00000200 measure the number of context switches that occurred. cpu_migrations 0x00000400 measure the number of context switches that occurred. all 0x000007ff measure all available events. number of available event types the num_measurable_events constant tells you how many types of events can be measured. constant value description num_measurable_events 11 the number of types of events that can be measured. constructor creates a new perfmeasurement object, configured to record the specified event types. perfmeasurement( eventmask tomeasure ); parameters tomeasure a mask of all of the event types you want to record; see event mask constants for a list of values. or together all the event types you want t...
...And 2 more matches
PopupNotifications.jsm
); parameters none. getnotification() retrieve a notification object associated with the browser/id pair. notification getnotification( string id xulelement browser ); parameters id the notification id to search for. browser the xul <xul:browser> element whose notifications should be searched. if null, the currently selected <xul:browser>'s notifications will be searched. return value the corresponding notification object, or null if no such notification exists. remove() removes the specified notification. void remove( notification notification ); parameters notification the notification object representing the notification to remove. show() adds a new popup notification, displaying it to the user. notification show( browser, id, message, anchorid, ma...
...l containing fields that define the button to draw in the notification panel. see notification actions below for details. secondaryactions an array of notification action objects; these are used to populate the drop-down menu on the notification panel's button. options a javascript object containing optional properties for the notification. see notification options below for details. return value returns the notification object corresponding to the added notification. notification actions notification action objects describe the user interface for actions associated with the notification. the main action is used to describe the button presented in the notification panel, while secondary actions are displayed in the drop-down menu associated with the button. a notification action objec...
...bel a text label describing the action. accesskey a string indicating the keystroke that will trigger the action. callback a javascript function to be invoked when the action is selected by the user. notification options the notification options object lets you further customize the notification panel. ...
...And 2 more matches
Examples
you don't have file.txt in your temporary directory."); } }); // unexpected errors should always be reported at the end of a promise chain. let lastpromise = newpromise.then(null, components.utils.reporterror); in this case, if the file existence check succeeds, the onfulfill callback is invoked. when the callback finishes execution, newpromise will be fulfilled with an undefined fulfillment value, because the callback does not return any value. when newpromise is fulfilled, nothing happens, because no fulfillment callback is specified and the return value of the last then method is ignored. if the file existence check fails, for example because access is denied, promise is rejected with an os.file.error instance. this state will propagate to newpomise, and components.utils.reporterror wi...
...ules/devtools/dbg-client.jsm -> resource://gre/modules/devtools/server/transport.js:279:11 makeinfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/devtoolsutils.js:84:7 */ intermediate of user defined promise function 1 components.utils.import("resource://gre/modules/promise.jsm"); // this function creates and returns a new promise. ...
...lient.jsm -> resource://gre/modules/devtools/server/transport.js:279:11 makeinfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/devtoolsutils.js:84:7 */ intermediate of user defined promise function 1 components.utils.import("resource://gre/modules/promise.jsm"); // this function creates and returns a new promise. ...
...And 2 more matches
Deferred
a deferred object is returned by the promiseutils.defer() method to provide a new promise along with methods to change its state. method overview void resolve([optional] avalue); void reject([optional] areason); properties attribute type description promise read only promise a newly created promise, initially in the pending state. methods resolve() fulfills the associated promise with the specified value, or propagates the state of an existing promise. if the associated promise has already been resolved, either to a value, a rejection, or another promise, this method does nothing. note: this function is exactly same as promise constructor's resolve argument, and can be called with any value of this. note: calling this method...
...ciated promise with the specified value, or propagates the state of an existing promise. if the associated promise has already been resolved, either to a value, a rejection, or another promise, this method does nothing. note: this function is exactly same as promise constructor's resolve argument, and can be called with any value of this. note: calling this method with a pending promise as the avalue argument, and then calling it again with another value before the promise is resolved or rejected, will have no effect the second time, as the associated promise is already resolved to the pending promise value as its resolution. ...
...me as promise constructor's resolve argument, and can be called with any value of this. note: calling this method with a pending promise as the avalue argument, and then calling it again with another value before the promise is resolved or rejected, will have no effect the second time, as the associated promise is already resolved to the pending promise value as its resolution. void resolve( avalue ); parameters avalue optional if this value is not a promise, including undefined, it becomes the fulfillment value of the associated promise. if this value is a promise, then the associated promise will be resolved to the passed promise, and follow the state as the provided promise (including any future transitions). reject() rejects the associated promise with the specified reason. if ...
...And 2 more matches
PromiseWorker.jsm
ecified by making the argument an instance of basepromiseworker.meta or by using the atransferlist argument. by convention, the last argument may be an object options with some of the following fields: outexecutionduration {number|null} a parameter to be filled with the duration of the off main thread execution for this call. aclosure optional an object holding strong references to value that should not be garbage-collected before the reply has been received. atransferlist optional an optional array of transferable objects to transfer ownership of. if the ownership of an object is transferred, it becomes unusable (neutered) in the context it was sent from, and it becomes available only to the worker it was sent to. only messageport and arraybuffer objects can be transferred. t...
...e sent back as a response to a request from the main thread, it is not possible for a worker to send data to the main thread otherwise, this is a key difference between promiseworker worker file and all other types of workers. resolving the promise to resolve the promise from the worker, simply return anything from the worker scope, and the main thread promise will be resolved with the returned value. function func(buffer) { // do something with buffer... return 1; // 1 is sent back to main thread, as a resolved promise. } transferring special data from worker to main thread just as it was possible to transfer special data from main thread to worker, it is possible to transfer data from the worker to the main thread. transferring is possible only when resolving the promise from the w...
...om the main thread, transferring from worker does not require each piece of data that you want transferred to be wrapped in its own meta object. instead, the whole return should be wrapped. also unlike sending/transferring from the main thread, when sending/transferring from worker there are no alternative syntaxes, it must be wrapped in a meta object. this example shows how to transfer a single value, which is an arraybuffer. return new promiseworker.meta(abuf, {transfers: [abuf]}); if you want to return an object or an array and transfer only certain parts of this data, it would all have to be return wrapped in this meta object like so: return new promiseworker.meta({ thebuf: abuf, othernontrans: 'this string is not transfered but copied' }, {transfers: [abuf]}); a simple demo sh...
...And 2 more matches
openLocationLastURL.jsm
ort the code module into your javascript scope: components.utils.import("resource:///modules/openlocationlasturl.jsm"); once you've imported the module, you can then use the openlocationlasturl object it exports. this object lets you fetch and change the url that is placed in the "open location" dialog box when it opens. ...
...imported the module, you can then use the openlocationlasturl object it exports. this object lets you fetch and change the url that is placed in the "open location" dialog box when it opens. if the user is not in private browsing mode, this automatically updates the value of the general.open_location.last_url preference. note: this module automatically handles private browsing mode for you. the value preserved across accesses is not preserved when the user exits private browsing mode. ...
...e "open location" dialog box when it opens. if the user is not in private browsing mode, this automatically updates the value of the general.open_location.last_url preference. note: this module automatically handles private browsing mode for you. the value preserved across accesses is not preserved when the user exits private browsing mode. ...
...And 2 more matches
Mozilla Web Developer FAQ
ink> and <style> elements should be inside the <head> element. does the css style sheet pass the syntax check? the css error handling rules require erroneous parts to be ignored rather than fixed by guessing. lengths other than zero should be followed by a proper unit without a space between the number and the unit (eg. 1.2em). the character to use between the property name and the value is the colon—not the equal sign. html markup, such as <style>, does not belong in .css files. font-face is not a real css property. the property is font-family and @font-face is an at-rule. if @import is used, it should be the first thing in a css file. css parsing errors are reported to the javascript console. is the server sending the proper content-type header for css style...
...og of xml documents. also, they only work in xml documents—not in documents served as text/html. width and height do not apply to non-replaced inline elements such as (by default) <span>. text-align: center; centers inline content within a block. it does not (and should not) center the block box itself. a block is centered by setting its margin-left and margin-right to auto and its width to a value that makes the block narrower than its containing block. it is also possible, although not very likely, that you are seeing a bug. javascript doesn’t work! why? some proprietary document objects such as document.all and document.layers are not part of the w3c dom and are not supported in mozilla. (there is partial undetectable support for document.all, though, in newer versions of mozilla. ...
... example, the existence of document.getelementbyid() can be checked as follows: if(document.getelementbyid) { /* code that uses document.getelementbyid() */ } why doesn’t mozilla display my alt tooltips? contrary to a popular belief stemming from the behavior of a couple browsers running on the windows platform, alt isn’t an abbreviation for ‘tooltip’ but for ‘alternative’. the value of the alt attribute is a textual replacement for the image and is displayed when the image isn’t. mozilla doesn’t display the alt attribute as a tooltip, because it has been observed that doing so encourages authors to misuse the attribute. when the alternative text is shown in a tooltip, some authors write bad alt texts, because they intend the text as auxiliary tooltip text and not as ...
...And 2 more matches
Mozilla Style System
the style system is the module of mozilla's code responsible for the loading and parsing of css style sheets, and the computation of computed values for all css properties. the handling of those computed values is the responsibility of other parts of the code. architecture the style system is split in half rather neatly. in one half (the backend) are the sources of specified style data, and in the other half (the frontend) is the code that turns the specified values into computed values. the barrier between these two halves consists of three abstract interfaces, plus some smaller structures associated with some methods on each: nsistylesheet nsistylesheet represents what one would think of as a style sheet: the in-memory representation of a css file or other source of style data.
...ss style sheets. there is also a style rule processor for style attributes (which contain css declarations) and one for presentational attributes in html. the methods on nsistyleruleprocessor allow the front end to ask the back ends for the style data that applies to a given element or pseudo-element, in the form of style rules. nsistylerule an nsistylerule is animmutable set of css property-value pairs. for css style sheets, they correspond to css's concept of rules. however, they also exist for the other types of rule processors. when script dynamically changes the data represented by a css style rule, we create a new nsistylerule object; keeping the old one around briefly helps to determine what changed and how we need to handle that change. computed style (front end) the interface t...
...consists of a single nsstyleset object and many nsstylecontext objects, each of which holds the computed style for an element, pseudo-element, or text node. the style set provides the api managing the rule processors and for creating style contexts. the style contexts then provide the api for computed style data by allowing retrieval of a set of style structs, each of which contains the computed values of a set of css properties. style structs the style structs are a set of structs, each of which holds computed values a group of properties. they all have names beginning with nsstyle*, and they should not be confused with the css structs (nscss*), which hold specified values. the grouping of properties into structs follows two rules: any properties in the same style struct must also be in...
...And 2 more matches
DMD
originally, this was the only mode that dmd had, which explains dmd's name. this is the default mode. "live" mode. ...
...ks refer to a particular block. dmd.py --clamp-contents needs to be run on the log first. see this other page for an overview of how to use heap scan mode to fix a leak involving refcounted objects. options runtime when you run mach run --dmd you can specify additional options to control how dmd runs. run mach help run for documentation on these. the most interesting one is --mode. acceptable values are dark-matter (the default), live, cumulative, and scan. another interesting one is --stacks. acceptable values are partial (the default) and full. in the former case most blocks will not have an allocation stack trace recorded. however, because larger blocks are more likely to have one recorded, most allocated bytes should have an allocation stack trace even though most allocated blocks do n...
...race even though most allocated blocks do not. use --stacks=full if you want complete information, but note that dmd will run substantially slower in that case. the options may also be put in the environment variable dmd, or set dmd to 1 to enable dmd with default options (dark-matter and partial stacks). the moz_dmd_shutdown_log environment variable, if set, triggers a dmd run at shutdown; its value must be a directory where the logs will be placed. which processes get logged is controlled by the moz_dmd_log_process environment variable, which can take the following values. unset: log all processes. "default": log the parent process only. "tab": log content processes only. for example, if you have moz_dmd_shutdown_log=~/dmdlogs/ moz_dmd_log_process=tab then dmd logs for content proc...
...And 2 more matches
JS::PerfMeasurement
y are a little vague in their specification; for instance, we can't tell you exactly which level of cache you get misses for if you measure cache_misses. we also can't guarantee that all platforms will support all event types, once we have more than one back end for this interface. ...
...o can't guarantee that all platforms will support all event types, once we have more than one back end for this interface. here is the complete c++-level api: perfmeasurement::eventmask this is an enumeration defining all of the bit mask values in the above table. you bitwise-or the ones you want together and pass them to the constructor. perfmeasurement::all in a constructor call, this special value means "measure everything that can possibly be measured." perfmeasurement::num_measurable_events this constant equals the total number of events defined by the api - not necessarily the total number of events that a particular os allows you to measure. (at time of writing, linux allows all the above events to be measured, and we don't have back ends for any other operating system. static bool pe...
...te. eventmask eventsmeasured instances of perfmeasurement expose this constant. it will not have any more bits set than were set in the mask passed to the constructor, but if the os cannot or will not measure all of the requested events, then only those events that will actually be measured have their bits set. ...
...And 2 more matches
NSPR Poll Method
od is print16 poll_method(prfiledesc *fd, print16 in_flags, print16 *out_flags); the purpose of the poll method is to allow a layer to modify that flags that will ultimately be used in the call to the underlying network transport's select (or equivalent) function, and to indicate that a layer is already able to make progress in the manner suggested by the polling flags. the arguments and return value of the poll method are described below. in_flags [input argument] the in_flags argument specifies the events at the top layer of the i/o layer stack that the caller is interested in. for pr_recv, you should pass pr_poll_read as the in_flags argument to the poll method for pr_send, you should pass pr_poll_write as the in_flags argument to the poll method out_flags [output argument] if an ...
... underlying network transport. the current implementation of pr_poll (the primary user of the poll method) requires that the events in *out_flags reflect the caller's view. this requirement may be relaxed in a future nspr release. to remain compatible with this potential semantic change, nspr clients should only use *out_flags as described in the how to use the poll method section below. ...
...implementation of pr_poll (the primary user of the poll method) requires that the events in *out_flags reflect the caller's view. this requirement may be relaxed in a future nspr release. to remain compatible with this potential semantic change, nspr clients should only use *out_flags as described in the how to use the poll method section below. ...
...And 2 more matches
NSPR Types
this chapter describes the most common nspr types. other chapters describe more specialized types when describing the functions that use them. calling convention types are used for externally visible functions and globals. algebraic types of various lengths are used for integer algebra. 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. calling convention types these types are used to support cross-platform declarations of prototypes and implementations: pr_extern is used for declarations of external functions or variables. pr_implement is used for definitions of external functions or variables. pr_callback is used for d...
...using two 32-bit numeric fields bound in a structure. since the types (long long versus struct longlong) are not type compatible, nspr defines macros to manipulate 64-bit numeric fields. these macros are defined in prlong.h. conscientious use of these macros ensures portability of code to all the platforms supported by nspr and still provides optimal behavior on those systems that treat long long values directly. print64 pruint64 floating-point number type the nspr floating-point type is always 64 bits. prfloat64 native os integer types these types are most appropriate for automatic variables. they are guaranteed to be at least 16 bits, though various architectures may define them to be wider (for example, 32 or even 64 bits). these types are never valid for fields of a structure. ...
...at64 native os integer types these types are most appropriate for automatic variables. they are guaranteed to be at least 16 bits, though various architectures may define them to be wider (for example, 32 or even 64 bits). these types are never valid for fields of a structure. ...
...And 2 more matches
PR_WaitSemaphore
the "test and decrement" operation is performed atomically. ...
... the "test and decrement" operation is performed atomically. ...
... the "test and decrement" operation is performed atomically. ...
...And 2 more matches
NSS 3.12.6 release notes
on indication extension for tls renegotiation but allows simple ssl/tls connections (without renegotiation) with peers that don't support the tls renegotiation indication extension. the behavior of nss for renegotiation can be changed through api function calls, or with the following environment variables: nss_ssl_enable_renegotiation values: [0|n|n]: ssl_renegotiate_never never allow renegotiation - that was the default for 3.12.5 release. [1|u|u]: ssl_renegotiate_unrestricted server and client are allowed to renegotiate without any restrictions. this setting was the default prio...
... only allows renegotiation if the peer's hello bears the tls renegotiation_info extension. this is the safe renegotiation. [3|t|t]: ssl_renegotiate_transitional disallows unsafe renegotiation in server sockets only, but allows clients to continue to renegotiate with vulnerable servers. ...
... disallows unsafe renegotiation in server sockets only, but allows clients to continue to renegotiate with vulnerable servers. this value should only be used during the transition period when few servers have been upgraded. nss_ssl_require_safe_negotiation values: 1: requiresafenegotiation = true unset: requiresafenegotiation = false controls whether safe renegotiation indication is required for initial handshake. if true, a connection will be dropped at initial handshake if the peer server or client does not support safe renegotiation. the default setting for this option is f...
...And 2 more matches
Enc Dec MAC Output Public Key as CSR
filename, const char *noisefilename, secupwdata *pwdata, prbool ascii) { /* * the db is open for read/write and we have authenticated to it. * read public key from certificate request * generate a symmetric aes key as a session object. * generate a second key to use for macing, also a session object. ...
...ing mac key\n"); goto cleanup; } if (noisefilename) { rv = seedfromnoisefile(noisefilename); if (rv != secsuccess) { port_seterror(pr_end_of_file_error); return secfailure; } rv = pk11_generaterandom(iv, blocksize); if (rv != secsuccess) { goto cleanup; } } else { /* generate a random value to use as iv for aes cbc */ generaterandom(iv, blocksize); } headerfile = pr_open(headerfilename, pr_create_file | pr_truncate | pr_rdwr, 00660); if (!headerfile) { pr_fprintf(pr_stderr, "unable to open \"%s\" for writing.\n", headerfilename); return secfailure; } encfile = pr_open(encrypte...
...argv[0], '/'); progname = progname ? ...
...And 2 more matches
NSS Sample Code Sample1
its rsa public key to the primary host as // part of a request for a particular key, or to be added to a list // of secondary hosts. // 4. the administrator of the primary host verifies that the rsa key // that was received belongs to a valid secondary host. the adminstrator // may do this by checking that the key was received in a signed email // message, or by checking a digest value with the adminstrator of the // secondary host. [need support for digest check values] // 5. the primary host exports (wraps) the symmetric key using the // secondary host's rsa key. the wrapped value is sent back to // the secondary host. // 6. the administrator of the secondary host verifies that the wrapped // key data came from the primary host. the same methods outlined // i...
...ack to // the secondary host. // 6. the administrator of the secondary host verifies that the wrapped // key data came from the primary host. the same methods outlined // in step 4 may be used here. // 7. the secondary host unwraps the the key using its own rsa private key. // note: currently nss does not support permanent symmetric keys. // the secondary host may store the wrapped value that was received // from the primary in a file, and unwrap it each time the key is required // (such as at server startup). // nss actually has some support for permanent symmetric keys. however this // example will need to be modified somewhat in order to demonstrate it. // utility function to print hex data static void printbuffer(unsigned char *digest, unsigned int len) { int i; ...
...(s != secsuccess) { rv = 1; goto done; } *ret = data; data = 0; done: if (data) secitem_freeitem(data, pr_true); return rv; } // example of how to do a raw export (no wrapping of a key) // this should not be used. use the rsa-based wrapping // methods instead. int server::rawexportkey(pk11symkey *key, secitem **res) { int rv = 0; secitem *data; secstatus s; s = pk11_extractkeyvalue(key); if (s != secsuccess) { rv = 1; goto done; } data = pk11_getkeydata(key); *res = secitem_dupitem(data); if (!*res) { rv = 1; goto done; } done: return rv; } // initialize the nss library. normally this // would be done as part of each server's startup. // however, this example uses the same databases // to store keys for server in the "cluster" so // it is done once. int initns...
...And 2 more matches
EncDecMAC using token object - sample 3
tinfo *slot, const char *dbdir, const char *infilename, const char *headerfilename, const char *encryptedfilename, const char *noisefilename, secupwdata *pwdata, prbool ascii) { /* * the db is open for read/write and we have authenticated to it. * generate a symmetric aes key as a token object. * generate a second key to use for macing, also a token object. * get their cka_ids * generate a random value to use as iv for aes cbc * open an input file and an output file, * write a header to the output that identifies the two keys by * their cka_ids, may include original file name and length. * loop until eof(input) * read a buffer of plaintext from input file, * mac it, append the mac to the plaintext * encrypt it using cbc, using previously created iv, * store the last block of ciphertext as the n...
... cka_id */ rv = gathercka_id(mackey, &macckaid); if (rv != secsuccess) { pr_fprintf(pr_stderr, "can't get the mac key cka_id.\n"); goto cleanup; } if (noisefilename) { rv = seedfromnoisefile(noisefilename); if (rv != secsuccess) { port_seterror(pr_end_of_file_error); return secfailure; } rv = pk11_generaterandom(iv, blocksize); if (rv != secsuccess) { goto cleanup; } } else { /* generate a random value to use as iv for aes cbc */ generaterandom(iv, blocksize); } headerfile = pr_open(headerfilename, pr_create_file | pr_truncate | pr_rdwr, 00660); if (!headerfile) { pr_fprintf(pr_stderr, "unable to open \"%s\" for writing.\n", headerfilename); return secfailure; } encfile = pr_open(encryptedfilename, pr_create_file | pr_truncate | pr_rdwr, 00660); if (!encfile) { pr_fprintf(pr_stderr, "unable to ...
... *noisefilename = null; secupwdata pwdata = { pw_none, 0 }; char * progname = strrchr(argv[0], '/'); progname = progname ? ...
...And 2 more matches
nss tech note5
secparam, &wrappedkey, null);</big> <big><big>transport/store or do whatever with the wrapped key (wrappedkey.data, wrappedkey.len)</big></big> <big><big>unwrapping.</big></big> prepare the args for the unwrap function. ...
... null);</big> <big><big>transport/store or do whatever with the wrapped key (wrappedkey.data, wrappedkey.len)</big></big> <big><big>unwrapping.</big></big> prepare the args for the unwrap function. ...
... numattribs = 4; } else if(keytype == ckk_dsa) { attribs[0] = cka_sign; numattribs = 1; } <big>do the unwrap</big> seckeyprivatekey *unwrappedpvtkey = pk11_unwrapprivkey(slot, wrappingsymkey, wrapmech, secparam, &wrappedkey, &label, pubvalue, token, pr_true /* sensitive */ keytype, attribs, numattribs, null /*wincx*/); clean up pk11_freesymkey(wrappingsymkey); <big>if (secparam) secitem_freeitem(secparam, pr_true);</big> <big>secitem_freeitem(&wrappedkey, pr_true);</big> if (pubvalue) secitem_freeitem(pubvalue, pr_true); if (un...
...And 2 more matches
NSS tools : crlutil
first symbol of a line * set "this update" or "next update" crl fields: update=yyyymmddhhmmssz nextupdate=yyyymmddhhmmssz field "next update" is optional. time should be in generalizedtime format (yyyymmddhhmmssz). ...
... extension-name: string value of a name of known extensions. critical/non-critical: is 1 when extension is critical and 0 otherwise. arg1, arg2: specific to extension type extension parameters addext uses the range that was set earlier by addcert and will install an extension to every cert entries within the range. * add certificate entries(s) to crl: addcert range date range: two integer values separated by dash: range of certificates that will be added by this command. dash is used as a delimiter. only one cert will be added if there is no delimiter. date: revocation date of a cert. date should be represented in generalizedtime format (yyyymmddhhmmssz). ...
...l: addcert range date range: two integer values separated by dash: range of certificates that will be added by this command. dash is used as a delimiter. only one cert will be added if there is no delimiter. date: revocation date of a cert. date should be represented in generalizedtime format (yyyymmddhhmmssz). * remove certificate entry(s) from crl rmcert range where: range: two integer values separated by dash: range of certificates that will be added by this command. dash is used as a delimiter. only one cert will be added if there is no delimiter. * change range of certificate entry(s) in crl range new-range where: new-range: two integer values separated by dash: range of certificates that will be added by this command. dash is used as a delimiter. only one cert will be add...
...And 2 more matches
NSS Tools crlutil
te" crl fields: update=yyyymmddhhmmssz nextupdate=yyyymmddhhmmssz field "next update" is optional. time should be in generalizedtime format (yyyymmddhhmmssz). for example: 20050204153000z add an extension to a crl or a crl certificate entry: addext extension-name critical/non-critical [arg1[arg2 ...]] where: extension-name: string value of a name of known extensions. critical/non-critical: is 1 when extension is critical and 0 otherwise. arg1, arg2: specific to extension type extension parameters addext uses the range that was set earlier by addcert and will install an extension to every cert entries within the range. see "implemented extensions" for more information regarding extensions and theirs para...
... specific to extension type extension parameters addext uses the range that was set earlier by addcert and will install an extension to every cert entries within the range. see "implemented extensions" for more information regarding extensions and theirs parameters. ...
...r values separated by dash: range of certificates that will be added by this command. dash is used as a delimiter. only one cert will be added if there is no delimiter. date: revocation date of a cert. date should be represented in generalizedtime format (yyyymmddhhmmssz). remove certificate entry(s) from crl rmcert range where: range: two integer values separated by dash: range of certificates that will be added by this command. dash is used as a delimiter. only one cert will be added if there is no delimiter. change range of certificate entry(s) in crl range new-range where: new-range: two integer values separated by dash: range of certificates that will be added by this command. dash is used as a de...
...And 2 more matches
NSS tools : crlutil
Mozilla › Projects › NSS › tools › crlutil
* set "this update" or "next update" crl fields: update=yyyymmddhhmmssz nextupdate=yyyymmddhhmmssz field "next update" is optional. time should be in generalizedtime format (yyyymmddhhmmssz). ...
...string value of a name of known extensions. critical/non-critical: is 1 when extension is critical and 0 otherwise. arg1, arg2: specific to extension type extension parameters addext uses the range that was set earlier by addcert and will install an extension to every cert entries within the range. * add certificate entries(s) to crl: addcert range date range: two integer values separated by dash: range of certificates that will be added by this command. dash is used as a delimiter. only one cert will be added if there is no delimiter. date: revocation date of a cert. date should be represented in generalizedtime format (yyyymmddhhmmssz). ...
...e range: two integer values separated by dash: range of certificates that will be added by this command. dash is used as a delimiter. only one cert will be added if there is no delimiter. date: revocation date of a cert. date should be represented in generalizedtime format (yyyymmddhhmmssz). * remove certificate entry(s) from crl rmcert range where: range: two integer values separated by dash: range of certificates that will be added by this command. dash is used as a delimiter. only one cert will be added if there is no delimiter. * change range of certificate entry(s) in crl range new-range where: new-range: two integer values separated by dash: range of certificates that will be added by this command. dash is used as a delimiter. only one...
...And 2 more matches
Tutorial: Embedding Rhino
s, "<cmd>", 1, null); uses the context cx to evaluate a string. evaluation of the script looks up variables in scope, and errors will be reported with the filename <cmd> and line number 1. printing the result the code system.out.println(cx.tostring(result)); prints the result of evaluating the script (contained in the variable result). result could be a string, javascript object, or other values. the tostring method converts any javascript value to a string. exiting the context the code } finally { context.exit(); } exits the context. this removes the association between the context and the current thread and is an essential cleanup action. there should be a call to exit for every call to enter. to make sure that it is called even if an exception is thrown, it is put into the f...
...both x and f are expected to be defined by the evaluated script. for example, $ java runscript3 "x = 7" x = 7 f is undefined or not a function. $ java runscript3 "function f(a) { return a; }" x is not defined. f("my...
...global variable out that is a javascript reflection of the system.out variable: $ java runscript2 "out.println(42)" 42.0 undefined using javascript objects from java after evaluating a script it's possible to query the scope for variables and functions, extracting values and calling javascript functions. this is illustrated in the runscript3 example. this example adds the ability to print the value of variable x and the result of calling function f. both x and f are expected to be defined by the evaluated script. ...
...And 2 more matches
The JavaScript Runtime
on to java bytecodes for improved performance, rhino may compile javascript scripts to java bytecodes. the generated bytecodes in turn depend upon runtime support routines. each javascript script or function is compiled to a separate class. compilation of javascript source to class files is supported. it is possible to specify the class files as well as the packages to generate into. ...
... bytecodes in turn depend upon runtime support routines. each javascript script or function is compiled to a separate class. compilation of javascript source to class files is supported. it is possible to specify the class files as well as the packages to generate into. types and values there are six fundamental types in javascript. these types are implemented with the following java types and values: javascript fundamental type java type undefined a singleton object defined by context.getundefinedtype() null null boolean java.lang.boolean number java.lang.number, that is, any of java.lang.byte, java.lang.short, java.lang.integer, java.lang.float, or java.lang.double. not java.lang.long, since a double representation of a long ...
...ion. string java.lang.charsequence (java.lang.string or org.mozilla.javascript.consstring) object org.mozilla.javascript.scriptable in addition, ecma refers to objects that implement [[call]] as functions. these object types are represented by implementing the function interface. ...
...And 2 more matches
Exact Stack Rooting
an extra reserved slot, or even just putting a new property on the object. class fooclass = { "fooprototype", /* name */ jsclass_has_private | jsclass_has_reserved_slots(1), /* flags */ js_propertystub, /* addproperty */ js_propertystub, /* delproperty */ ... etc ... }; rootedobject obj(cx, newobject(cx, &fooclass, nullptr(), nullptr(), &obj)); rootedvalue v(cx, object_to_value(othergcthing)); jsobject::setreservedslot(obj, 0, v); storing a gcpointer on the cheap todo: tracing and heapptr storing a gcpointer on the cstack gcpointers stored on the cstack are special. unlike other gcpointers, they are not traced as part of the gc. instead, every pointer on the cstack should be considered part of the rootset. to that end, we have a special "rooti...
... it is highly recommended that this rooting mechanism only be used on the cstack. js::rooted<t> typedef js::rooted<t> rootedt; -> rootedobject, rootedstring, rootedscript, etc. because of the lifo restriction, using this interface manually is extremely cumbersome. instead, spidermonkey has a convenient suite of c++ raii classes to do this for you, called js::rootedt: rootedstring str1(cx, js_valuetostring(cx, val)); rootedstring str2(rt, js_valuetostring(cx, val)); note 1: c++ insists that an initializing assignment (e.g., the default constructor followed by operator=) must have a copy constructor available, even if it is not used. since it is never correct to implicitly copy a js::rootedt (more on this in a second) we have deleted the copy constructor from these classes. therefore, we ...
...n out-param, &handle would convert correctly to js::handlet*, but &local is a compile error. even though js::handlet is indirect, it implicitly behaves like the thing it is pointing to. this makes js::handlet and js::rootedt behave the same, allowing us to seamlessly weave js::handlets into the js api. the problem 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 getlengthfoo(jscontext *cx) { rootedstring s(cx); if (returnfoo(cx, &s)) ret...
...And 2 more matches
INT_TO_JSVAL
syntax jsval int_to_jsval(int32_t i); name type description i any integer type c integer to convert to a jsval. description int_to_jsval converts a c integer, i, to a jsval. ...
... syntax jsval int_to_jsval(int32_t i); name type description i any integer type c integer to convert to a jsval. description int_to_jsval converts a c integer, i, to a jsval. ...
... syntax jsval int_to_jsval(int32_t i); name type description i any integer type c integer to convert to a jsval. description int_to_jsval converts a c integer, i, to a jsval. ...
...And 2 more matches
JS::CompileOptions
in the following cases: source belongs to a <script> element if it is the element's text content (that is, it is written out as the body of the <script> element in the markup text), or is the source document referenced by its src attribute. source belongs to a dom element if it is an event handler content attribute (that is, if it is written out in the markup text as an attribute value). source belongs to a dom element if it was assigned to one of the element's event handler idl attributes as a string. (note that one may assign both strings and functions to dom elements' event handler idl attributes. if one assigns a function, that function's script's source does not belong to the dom element; the function's definition must appear elsewhere.) ...
...(1-origin). column unsigned column number of the first line of the source code (0-origin). compileandgo bool true if the code is going to be evaluated soon after the compile (e.g., false for function constructor and event handler). foreval bool true if the code is for eval(). noscriptrval bool false means that the caller needs the return value of the script. selfhostingmode bool true iff the code is self-hosted. canlazilyparse bool true if the source code can be parsed lazily (check only syntax for first time, and fully parse when it's really needed). strictoption bool true if the code is strict mode ("use strict"). extrawarningsoption bool show extra warning. werroro...
...e number in the source code which introduces this source code. introductionoffset uint32_t bytecode offset in the code which introduces this source code. hasintroductioninfo bool true if setintroductioninfo is called. description in the most common use case, a compileoptions instance is allocated on the stack, and holds non-owning references to non-pod option values: strings; principals; objects; and so on. the code declaring the instance guarantees that such option values will outlive the compileoptions itself: objects are otherwise rooted; principals have had their reference counts bumped; strings will not be freed until the compileoptions goes out of scope. in this situation, compileoptions only refers to things others own, so it can be lightweight. in ...
...And 2 more matches
JS_CheckAccess
in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * the object that has the property being accessed. id jsid the name or index of the property being accessed. mode jsaccessmode the type of access requested (read, write, etc.) vp jsval * out parameter. on success, *vp receives the property's stored value. ...
...(this is redundant with passing the string id "__proto__" as id.) jsacc_parent check for permission to read obj's parent. ...
...(this is redundant with passing the string id "__proto__" as id.) jsacc_parent check for permission to read obj's parent. (this is redundant with passing the string id "__parent__" as id.) jsacc_import check for permission to import the property. ...
...And 2 more matches
JS_ForwardGetPropertyTo
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. ...
...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. ...
...And 2 more matches
JS_PropertyStub
default implementations of the required callbacks in jsclass. ...
... default implementations of the required callbacks in jsclass. ...
...andleobject obj, js::handleid id, js::mutablehandlevalue vp); bool js_strictpropertystub(jscontext *cx, js::handleobject obj, js::handleid id, js::mutablehandlevalue vp, js::objectopresult &result); // added in spidermonkey 45 bool js_strictpropertystub(jscontext *cx, js::handleobject obj, js::handleid id, bool strict, js::mutablehandlevalue vp); // obsolete since jsapi 39 bool js_resolvestub(jscontext *cx, js::handleobject obj, js::handleid id, bool *resolvedp); // obsolete since jsapi 37 bool js_deletepropertystub(jscontext *cx, js::handleobject obj, js::handleid id, bool *succeeded); // obsolete since jsapi 37 bool js_enumeratestub(jscontext *cx, js::handleobject obj); // obsolete since jsap...
...And 2 more matches
JS_SetElement
assign a value to a numeric property of an object. ...
... assign a value to a numeric property of an object. ...
...x, js::handleobject obj, uint32_t index, int32_t v); bool js_setelement(jscontext *cx, js::handleobject obj, uint32_t index, uint32_t v); bool js_setelement(jscontext *cx, js::handleobject obj, uint32_t index, double v); /* obsolete since jsapi 29 */ bool js_setelement(jscontext *cx, js::handleobject obj, uint32_t index, js::mutablehandlevalue vp); name type description cx jscontext * the context in which to set the element. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to modify, commonly an array object. index uint32_t index number of the element to set. v js::handlevalue or js:...
...And 2 more matches
Animated PNG graphics
Mozilla › Tech › APNG
contains: byte offset field name field type description 0 num_frames unsigned int the number of frames in the apng. 4 num_plays unsigned int the number of times to loop this apng. 0 indicates infinite looping. num_frames indicates the total number of frames in the animation. this must equal the number of 'fctl' chunks. 0 is not a valid value. 1 is a valid value for a single-frame apng. if this value does not equal the actual number of frames it should be treated as an error. num_plays indicates the number of times that this animation should play; if it is 0, the animation should play indefinitely. if nonzero, the animation should come to rest on the final frame at the end of the last play. 'fctl': the frame control chunk the 'fctl...
...me regions: x_offset >= 0 y_offset >= 0 width > 0 height > 0 x_offset + width <= 'ihdr' width y_offset + height <= 'ihdr' height the delay_num and delay_den parameters together specify a fraction indicating the time to display the current frame, in seconds. if the denominator is 0, it is to be treated as if it were 100 (that is, delay_num then specifies 1/100ths of a second). if the the value of the numerator is 0 the decoder should render the next frame as quickly as possible, though viewers may impose a reasonable lower bound. frame timings should be independent of the time required for decoding and display of each frame, so that animations will run at the same rate regardless of the performance of the decoder implementation. dispose_op specifies how the output buffer should be ch...
...ly as possible, though viewers may impose a reasonable lower bound. frame timings should be independent of the time required for decoding and display of each frame, so that animations will run at the same rate regardless of the performance of the decoder implementation. dispose_op specifies how the output buffer should be changed at the end of the delay (before rendering the next frame). valid values for dispose_op are: value constant description 0 apng_dispose_op_none no disposal is done on this frame before rendering the next; the contents of the output buffer are left as is. 1 apng_dispose_op_background the frame's region of the output buffer is to be cleared to fully transparent black before rendering the next frame. 2 apng_dispos...
...And 2 more matches
Places utilities for JavaScript
t my hastily written (and probably incorrect) example up above. ...
...y written (and probably incorrect) example up above. ...
... array object getannotationsforitem(aitemid) parameters aitemid the identifier of the itme for which annotations are to be retrieved. ...
...And 2 more matches
Using XPCOM Utilities to Make Things Easier
plement the nsastring abstract class and the nsacstring abstract classes, respectively. this first example shows an nsembedcstring being used to pass an nsacstring to a method that's not expected to modify the string. // in idl: method(in acstring thing); char* str = "how now brown cow?"; nsembedcstring data(str); rv = object->method(data); in this next example, the method is going to set the value of the string - as it might need to do when it returns the name of the current user or the last viewed url. // in idl: attribute acstring data; nsembedcstring data; method->getdata(data); // now to extract the data from the url class: const char* astringurl = url.get(); note that the memory pointed to by astringurl after the call to url.get() is owned by the url string object. if you need ...
...ct. if you need to keep this string data around past the lifetime of the string object, you must make a copy. string size the examples above illustrate the use of the single byte string class, nsembedcstring. the double byte version, nsembedstring, has the same functionality but the constructor takes nsastring and the .get() method returns the type prunichar*. note that prunichar is a two byte value. in the coming chapters, you'll see examples that use this version in the weblock component. smart pointers all of the interfaces that you've seen so far are reference counted. leaking a reference by not releasing an object, as the code below demonstrates, can be a major problem. { nsisupports* value = nsnull; object->method(&value); if (!value) return; // ... if (ns_failed(error)...
...mples that use this version in the weblock component. smart pointers all of the interfaces that you've seen so far are reference counted. leaking a reference by not releasing an object, as the code below demonstrates, can be a major problem. { nsisupports* value = nsnull; object->method(&value); if (!value) return; // ... if (ns_failed(error)) return; // <------------ leaks |value| //... ns_release(value); // release our reference } a method returns an nsisupports interface pointer that has been reference counted before it is returned (assuming it wasn't nsnull). if you handle an error condition by returning prematurely, whatever value points at will leak-it will never be deleted. this is a trivial fix in this example, but in real code, this can easily happen in go...
...And 2 more matches
Observer Notifications
d seamonkey 2.0 applications application shutdown these are the topics that you can observe on shutdown, in order of appearance. topic description quit-application-requested something has requested that the application be shutdown. you can cancel the shutdown from here by setting asubject.data to true (asubject is the first parameter to your observer, the data value is an nsisupportsprbool). quit-application-granted all observers have agreed to the shutdown. quit-application the application is about to quit. this can be in response to a normal shutdown, or a restart. note: the data value for this notification is either 'shutdown' or 'restart'. profile-change-net-teardown the network connection is going offline at t...
... quit-application-granted all observers have agreed to the shutdown. quit-application the application is about to quit. this can be in response to a normal shutdown, or a restart. note: the data value for this notification is either 'shutdown' or 'restart'. profile-change-net-teardown the network connection is going offline at this point. note: the data value for this notification is always 'shutdown-persist'. profile-change-teardown part of the shutdown, profile data is still available at this point. note: the data value for this notification is always 'shutdown-persist'. profile-before-change called just before the profile is lost. note: the data value for this notification is always 'shutdown-persist'. ...
...and stop accepting new events. browser these topics indicate interesting things that happen that the browser alerts you to. topic description browser:purge-session-history sent when the sanitizer runs to purge all history and other information. browser:purge-domain-data sent after domain-specific history and other information have been purged. the data value is a string form of the domain. browser-lastwindow-close-requested sent when the browser wishes to close the last open browser window. when this is sent, it is possible that other windows may still be open, such as the download manager or preferences. the data value is an nsisupportsprbool. recipients may set this to true to abort the close. browser-lastwindow-close-granted ...
...And 2 more matches
jsdIStackFrame
dd a summary to this article. inherits from: jsdiephemeral last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) strict mode is on. warnings reported as errors. makes eval() use the last object on its 'obj' param's scope chain as the ecma 'variables object'. private data for this object is an nsisupports object. attempting to alter this bit will result in an ns_error_illegal_value. opt_* values above, or'd together. last version set on this context. scripts typically select this with the "language" attribute. see the version_* consts on jsdidebuggerservice. unique tag among all valid jsdicontext objects, useful as a hash key. private data for this context, if it is an nsisupports, |null| otherwise. retrieve the underlying context wrapped by this jsdicontext. top of the sco...
...k which gave it to you. after you return from that handler the bottom frame, and any frame you found attached through it, are invalidated via the jsdiephemeral interface. once a jsdistackframe has been invalidated all method and property accesses will throw a ns_error_not_available exception. method overview boolean eval(in astring bytes, in autf8string filename, in unsigned long line, out jsdivalue result); attributes attribute type description callee jsdivalue function object running in this stack frame. read only. callingframe jsdistackframe link to the caller's stack frame. read only. executioncontext jsdicontext executon context. read only. functionname autf8string function name executing in this stack frame. read only. isconstructing boolean true if stack frame is const...
...sdcontext internal use only. read only. native code only! jsdstackframeinfo jsdstackframeinfo internal use only. read only. native code only! jsdthreadstate jsdthreadstate internal use only. read only. native code only! line unsigned long current line number (using the script's pc to line map.) read only. pc unsigned long current program counter in this stack frame. read only. ...
...And 2 more matches
mozIStorageService
in astring abackupfilename, in nsifile abackupparentdirectory optional ); parameters adbfile the database file to back up. abackupfilename the filename to give to the new backup file. abackupparentdirectory optional the directory to put the backup into. if this is not specified, the backup is placed in the same directory as the original file. return value an nsifile object representing the newly-created backup file. opendatabase() opens a database connection to the specified file. the specified file is created if it does not already exist. if this method throws ns_error_file_corrupted, it's recommended that you call mozistorageservice.backupdatabasefile() to back up the database so that user data is not lost (although we have no way of recovering ...
.... the specified file is created if it does not already exist. if this method throws ns_error_file_corrupted, it's recommended that you call mozistorageservice.backupdatabasefile() to back up the database so that user data is not lost (although we have no way of recovering this data yet). consumers should check mozistorageconnection.connectionready to ensure that they can use the database. if this value is false, it is strongly recommended that the database be backed up with mozistorageconnection.backupdb() so user data is not lost. and then the database can be opened again with the mozistorageservice.opendatabase() method. warning: if you have more than one connection to a file, you must use the exact same name for the file each time, including case. the sqlite code uses a simple string co...
...se containing virtual tables, it will think the database is corrupted and throw ns_error_file_corrupted. note: the connection object returned by this function is not threadsafe. you must use it only from the thread you created it from. mozistorageconnection opendatabase( in nsifile adatabasefile ); parameters adatabasefile an nsifile indicating the database file to open. return value a mozistorageconnection representing the connection to the opened database file. exceptions thrown ns_error_failure an error occurred attempting to open the database. ns_error_file_corrupted the database file is corrupted, or contains virtual tables and is not compatible with this method. ns_error_out_of_memory allocating a new storage object failed. op...
...And 2 more matches
nsIAccessibleHyperLink
isible output of the html:a tag. with an image map, reflects the actual areas within the map. read only. note: renamed from anchors in gecko 1.9 exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. endindex long the end offset of the hyperlink accessible within the parent accessible. the returned value is related to the nsiaccessiblehyperlink interface of the object that owns this hyperlink. read only. note: the link itself is represented by one embedded character within the parent text, so the endindex should be startindex + 1. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. selected boolean ...
...e: aria links can only be focused if they have the tabindex attribute set. also, state_focused should then be set on the accessible for this link. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. startindex long the offset of the hyperlink accessible within the parent accessible. the returned value is related to the nsiaccessiblehyperlink interface of the object that owns this hyperlink. read only. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. valid boolean determines whether the hyperlink is valid, for example points to a valid url. read only. note: currently only used with ari...
... methods returns a reference to the object at the given index. note: aria hyperlinks do not have an anchor accessible to point to, since clicks are processed via javascript. note: in the case of an image map there is more than one link represented by this accessible. nsiaccessible getanchor( in long index ); parameters index the 0-based index whose object is to be returned. ...
...And 2 more matches
nsIAuthPrompt
inherits from: nsisupports last changed in gecko 1.9 (firefox 3) this interface is implemented by @mozilla.org/login-manager/prompter;1. ...
... save_password_for_session 1 saves the password for the session. save_password_permanently 2 saves the password permanently. methods prompt() this method puts up a text input dialog with ok and cancel buttons. boolean prompt( in wstring dialogtitle, in wstring text, in wstrin...
...ng result ); parameters dialogtitle the title of the dialog. text the text of the prompt message dialog box. passwordrealm the password realm. for example, ldap://localhost/dc=test. savepassword saving password option. one of the save_password_* constants defaulttext the default text for the text input dialog box. result the result of the dialog box, ok or cancel buttons. return value true for ok, false for cancel. promptpassword() this method puts up a password dialog with ok and cancel buttons. note: if a username is specified, the username should be escaped. boolean promptpassword( in wstring dialogtitle, in wstring text, in wstring passwordrealm, in pruint32 savepassword, inout wstring pwd ); parameters dialogtitle the title of the dialog. text the t...
...And 2 more matches
nsICacheEntryDescriptor
see nsicache for the definitions of the access modes and a thorough description of their corresponding meanings. read only. cacheelement nsisupports get or set the cache data element. this will fail if the cache entr...
...oom the cache entry and choose to fail pending requests. this means that pending requests will not get a cache descriptor. this is meant as a tool for clients that wish to instruct pending requests to skip the cache. void doomandfailpendingrequests( in nsresult status ); parameters status the access status. getmetadataelement() this method retrieves the meta data. meta data is a table of key/value string pairs. the strings do not have to conform to any particular charset, but they must be null terminated. string getmetadataelement( in string key ); parameters key the key for retrieving the meta data. return value returns the string value containing the meta data for the provided key. markvalid() this method means that a writer must validate this cache object before any readers are giv...
... fail if the cache entry is not stream based. use the stream transport service to asynchronously read this stream on a background thread. the returned stream may implement nsiseekablestream. nsiinputstream openinputstream( in unsigned long offset ); parameters offset read starting from this offset into the cached data. an offset beyond the end of the stream has undefined consequences. return value returns blocking, unbuffered input stream. openoutputstream() this method opens blocking output stream to cache data. this will fail if the cache entry is not stream based. use the stream transport service to asynchronously write to this stream on a background thread. the returned stream may implement nsiseekablestream. if opening an output stream to existing cached data, the data will be truncat...
...And 2 more matches
nsICachingChannel
rm submission. a channel may optionally implement this interface to allow clients to affect its behavior with respect to how it uses the cache service. method overview boolean isfromcache(); obsolete since gecko 2.0 attributes attribute type description cacheasfile boolean specifies whether or not the data should be cached to a file. this may fail if the disk cache is not present. the value of this attribute is usually only settable during the processing of a channel's onstartrequest. the default value of this attribute depends on the particular implementation of nsicachingchannel. cachefile nsifile get the "file" where the cached data can be found. this is valid for as long as a reference to the cache token is held. this may return an error if cacheasfile is false. read only. c...
... cachefile nsifile get the "file" where the cached data can be found. this is valid for as long as a reference to the cache token is held. this may return an error if cacheasfile is false. read only. cacheforofflineuse boolean specifies whether or not the data should be placed in the offline cache, in addition to normal memory/disk caching. this may fail if the offline cache is not present. the value of this attribute should be set before opening the channel. cachekey nsisupports uniquely identifies the data in the cache for this channel. holding a reference to this key does not prevent the cached data from being removed. a cache key retrieved from a particular instance of nsicachingchannel could be set on another instance of nsicachingchannel provided the underlying implementations are c...
...ta from being removed. a cache key retrieved from a particular instance of nsicachingchannel could be set on another instance of nsicachingchannel provided the underlying implementations are compatible and provided the new channel instance was created with the same uri. the implementation of nsicachingchannel would be expected to use the cache entry identified by the cache token. depending on the value of nsirequest.loadflags(), the cache entry may be validated, overwritten, or simply read. the cache key may be null indicating that the uri of the channel is sufficient to locate the same cache entry. setting a null cache key is likewise valid. cachetoken nsisupports uniquely identifies the data in the cache. holding a reference to this token prevents the cached data from being removed. a cach...
...And 2 more matches
nsIClipboardDragDropHooks
s such as prevent a drag from starting, adding or removing data and flavors, or preventing the drop. inherits from: nsisupports last changed in gecko 1.7 embedders who want to have these hooks made available should implement nsiclipboarddragdrophooks and use the command manager to send the appropriate commands with these parameters/settings: command: cmd_clipboarddragdrophook params value type possible values "addhook" isupports nsiclipboarddragdrophooks as nsisupports "removehook" isupports nsiclipboarddragdrophooks as nsisupports note: overrides/hooks need to be added to each window (as appropriate). adding them to the first window does not enable them for every window. if more than one implementation is set for a window, the hooks will be called in the order they...
...itransferable trans); boolean onpasteordrop(in nsidomevent event, in nsitransferable trans); methods allowdrop() tells gecko whether a drop is allowed on this content area. boolean allowdrop( in nsidomevent event, in nsidragsession session ); parameters event the dom event (drag gesture). session the drag session from which client can get the flavors present or the actual data. ...
...otherwise, false to show the drag is canceled (does not go to operating system). oncopyordrag() alters the flavors or data presented to the os. used for drag and copy actions. because this can be called many times, it is highly recommended that the implementation be very efficient so user feedback is not negatively impacted. ...
...And 2 more matches
nsIContentSecurityPolicy
shouldprocess(in unsigned long acontenttype, in nsiuri acontentlocation, in nsiuri arequestorigin, in nsisupports acontext, in acstring amimetype, in nsisupports aextra); attributes attribute type description allowseval boolean whether this policy allows eval and eval-like functions such as settimeout("code string", time). calls to this may trigger violation reports when queried, so this value should not be cached. read only. allowsinlinescript boolean whether this policy allows in-page script. calls to this may trigger violation reports when queried, so this value should not be cached. read only. isinitialized boolean set to true when the content security policy has been read in and parsed and is ready to enforce. this is a barrier for the nsdocument so it doesn't load any sub-co...
... used. policy astring a read-only string version of the policy for debugging. read only. reportonlymode boolean when set to true, content load-blocking and fail-closed are disabled: content security policy will only send reports, and not modify behavior. methods permitsancestry() verifies ancestry as permitted by the policy. calls to this may trigger violation reports when queried, so this value should not be cached. boolean permitsancestry( in nsidocshell docshell ); parameters docshell containing the protected resource. return value true if the frame's ancestors are all permitted by policy. refinepolicy() updates the policy currently stored in the content security policy to be "refined" or tightened by the one specified in the string policystring. void refinepolicy( in astring p...
...ateddirective ); parameters blockeduri the uri that violated the policy. violateddirective the directive that was violated. shouldload() delegate method called by the service when sub-elements of the protected document are being loaded. given a bit of information about the request, decides whether or not the policy is satisfied. ...
...And 2 more matches
nsIContentViewer
) will be called, and no further destruction will happen. destroy() void destroy(); parameters none. findcontainerview() finds the view to use as the container view for makewindow. note: prior to gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey 2.7), this attribute was part of nsidocumentviewer. [noscript,notxpcom,nostdcall] nsiviewptr findcontainerview(); parameters none. return value the container view, or null if this content viewer is the root of a view manager hierarchy. note: if this container is the root of a view manager hierarchy (that is, this method returns null), and mparentwidget is also null, then this document should not even be displayed. native code only!getbounds void getbounds( in nsintrectref abounds ); parameters abounds missing description g...
... (that is, this method returns null), and mparentwidget is also null, then this document should not even be displayed. native code only!getbounds void getbounds( in nsintrectref abounds ); parameters abounds missing description getdocument() returns the dom document object (as an nsidocument without addrefing. [noscript,notxpcom] nsidocumentptr getdocument(); parameters none. return value the dom document object. hide() void hide(); parameters none. native code only!init initializes the content viewer. void init( in nsiwidgetptr aparentwidget, [const] in nsintrectref abounds ); parameters aparentwidget missing description abounds missing description loadcomplete() void loadcomplete( in unsigned long astatus ); parameters astatus missing descript...
...ther or not the document wants to prevent unloading by firing beforeunload on the document, and if it does, prompts the user. the result is returned. boolean permitunload( in boolean acallercloseswindow optional ); parameters acallercloseswindow optional indicates that the current caller will close() the window. if the method returns true, all subsequent calls will be ignored. ...
...And 2 more matches
nsIControllers
to the end of the list. void appendcontroller( in nsicontroller controller ); parameters controller a controller to be added to the list of controllers. exceptions thrown ns_error_out_of_memory getcontrollerat() returns the controller instance at the given position. nsicontroller getcontrollerat( in unsigned long index ); parameters index the position of the wanted controller. ...
...e position of the wanted controller. return value the controller at the given position. exceptions thrown ns_error_failure the given index is out of range. getcontrollerbyid() returns a controller given by its order, rather than position, of insertion. nsicontroller getcontrollerbyid( in unsigned long controllerid ); parameters controllerid the id (insertion order) of a controller. return value the controller element that was inserted with that id. exceptions thrown ns_error_failure the id is greater than the number of controllers that have been inserted, or the controller has since been removed. getcontrollercount() returns the current number of controllers. unsigned long getcontrollercount(); parameters none. ...
...ntrollerid the id (insertion order) of a controller. return value the controller element that was inserted with that id. exceptions thrown ns_error_failure the id is greater than the number of controllers that have been inserted, or the controller has since been removed. getcontrollercount() returns the current number of controllers. unsigned long getcontrollercount(); parameters none. return value the number of controllers currently in the list of controllers. getcontrollerforcommand() searches for a controller that supports the given command. nsicontroller getcontrollerforcommand( in string command ); parameters command the name of a command, e.g. cmd_copy return value the first controller in the list that supports the given command. getcontrollerid() returns the order of insertion o...
...And 2 more matches
nsICookieService
vice); notifications this service broadcasts the following notifications when the cookie list is changed, or a cookie is rejected: topic subject data cookie-changed broadcast whenever the cookie list changes in some way. there are four possible data strings for this notification; one notification will be broadcast for each change. depending on the data value, either an nsicookie2 interface pointer representing the cookie object that changed, or an nsiarray of nsicookie2 objects. a keyword indicating what was done to the affected cookie. deleted a cookie was deleted. the subject is the deleted cookie. added a cookie was added. the subject is the added cookie. changed a cookie was changed. the subject is the change...
...ind a better home for it. methods getcookiestring() get the complete cookie string associated with the uri. string getcookiestring( in nsiuri auri, in nsichannel achannel ); parameters auri the uri of the document for which cookies are being queried. achannel the channel used to load the document. this parameter may be null, but it is strongly recommended that a non-null value be provided to ensure that the cookie privacy preferences are honored. return value returns the resulting cookie string. getcookiestringfromhttp() get the complete cookie string associated with the uri. note: this function is redundant and will most likely be removed in a future revision of this interface. getcookiestring() will query the documenturi property off of nsihttpchannelinternal i...
...nsiuri auri, in nsiuri afirsturi, in nsichannel achannel ); parameters auri the uri of the document for which cookies are being queried. afirsturi the uri that the user originally typed in or clicked on to initiate the load of the document referenced by auri. achannel the channel used to load the document. this parameter may be null, but it is strongly recommended that a non-null value be provided to ensure that the cookie privacy preferences are honored. return value returns the resulting cookie string. setcookiestring() set the cookie string associated with the uri. note: should be able to allow null aprompt, since nsiprompt can be queried from achannel. void setcookiestring( in nsiuri auri, in nsiprompt aprompt, in string acookie, in nsichannel achannel ...
...And 2 more matches
nsIDOMXPathResult
read only. resulttype unsigned short the type of ...
...his interface describes an xpath result returned by nsidomxpathevaluator or document.evaluate inherits from: nsisupports last changed in gecko 1.7 method overview nsidomnode iteratenext(); nsidomnode snapshotitem(in unsigned long index); attributes attribute type description booleanvalue boolean if resulttype is boolean_type, the boolean value. read only. invaliditeratorstate boolean true if the iterator state has become invalid. for example, modifying a node invalidates the iterator. read only. numbervalue double if resulttype is number_type, the numeric value of the xpath value. read only. resulttype unsigned short the type of result; can be any of the type constants except any_type. read ...
...aliditeratorstate boolean true if the iterator state has become invalid. for example, modifying a node invalidates the iterator. read only. numbervalue double if resulttype is number_type, the numeric value of the xpath value. read only. resulttype unsigned short the type of result; can be any of the type constants except any_type. read only. singlenodevalue nsidomnode if resulttype is any_unordered_node_type or first_ordered_node_type, a single dom node. read only. snapshotlength unsigned 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 typ...
...And 2 more matches
nsIEffectiveTLDService
g ahost); methods getbasedomain() returns the base domain of a uri; that is, the public suffix with a given number of additional domain name parts. acstring getbasedomain( in nsiuri auri, [optional] in pruint32 aadditionalparts ); parameters auri the uri to be analyzed. aadditionalparts the number of domain name parts to be returned in addition to the public suffix. return value an acstring containing the base domain (public suffix plus the requested number of additional parts). exceptions thrown ns_error_invalid_arg this exception is thrown if the hostname in auri is empty. ns_error_insufficient_domain_levels this exception is thrown if there were insufficient subdomain levels in the hostname to satisfy the requested aadditionalparts value. ns_error_host_is_ip_...
...gly recommended that you use getbasedomain() if a suitable nsiuri is available. only use this method if this is not the case. acstring getbasedomainfromhost( in autf8string ahost, in pruint32 aadditionalparts optional ); parameters ahost the host string to be analyzed. aadditionalparts optional the number of domain name parts to be returned in addition to the public suffix. return value an acstring containing the base domain (public suffix plus the requested number of additional parts). exceptions thrown ns_error_invalid_arg this exception is thrown if ahost is empty. ns_error_unexpected this exception originates in the normalize() method in nsiidnservice and is thrown when ahost contains characters disallowed in uris. ns_error_insufficient_domain_levels this exception...
...ns thrown ns_error_invalid_arg this exception is thrown if ahost is empty. ns_error_unexpected this exception originates in the normalize() method in nsiidnservice and is thrown when ahost contains characters disallowed in uris. ns_error_insufficient_domain_levels this exception is thrown if there were insufficient subdomain levels in the hostname to satisfy the requested aadditionalparts value. ns_error_host_is_ip_address this exception is thrown if ahost is a numeric ipv4 or ipv6 address. remarks note: prior to gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1), this method worked if you passed host strings starting with a period ("."). that is no longer the case, since these are not valid host names. you should strip leading periods off host names before passing them to th...
...And 2 more matches
nsIExternalProtocolService
handlers in either the nsihandlerservice datastore or registered with the os. boolean externalprotocolhandlerexists( in string aprotocolscheme ); parameters aprotocolscheme the scheme from a url: http, ftp, mailto, and so on. note: aprotocolscheme should not include a trailing colon, which is part of the uri syntax, not part of the scheme itself. that is, pass "mailto" not "mailto:". return value true if we have a handler and false otherwise. getapplicationdescription() gets a human-readable description for the application responsible for handling a specific protocol. astring getapplicationdescription( in autf8string ascheme ); parameters ascheme the scheme to look up. for example, "mms". return value this code makes little sense and needs to be cleaned up. -nickolay <pre> // first c...
...ct this method returns will represent a default handler for unknown content. note: aprotocolscheme should not include a trailing colon, which is part of the uri syntax, not part of the scheme itself (that is pass "mailto" not "mailto:"). nsihandlerinfo getprotocolhandlerinfo( in acstring aprotocolscheme ); parameters aprotocolscheme the scheme from a url: http, ftp, mailto, and so on. return value the handler, if any; otherwise a default handler. getprotocolhandlerinfofromos() given a scheme, looks up the protocol info from the os. this should be overridden by each os's implementation. nsihandlerinfo getprotocolhandlerinfofromos( in acstring aprotocolscheme, out boolean afound ); parameters aprotocolscheme the scheme from a url: http, ftp, mailto, and so on. afound was an os default ...
...lt handler. getprotocolhandlerinfofromos() given a scheme, looks up the protocol info from the os. this should be overridden by each os's implementation. nsihandlerinfo getprotocolhandlerinfofromos( in acstring aprotocolscheme, out boolean afound ); parameters aprotocolscheme the scheme from a url: http, ftp, mailto, and so on. afound was an os default handler for this scheme found? return value an nsihanderinfo for the protocol. isexposedprotocol() check whether a handler for a specific protocol is "exposed" as a visible feature of the current application. an exposed protocol handler is one that can be used in all contexts. a non-exposed protocol handler is one that can only be used internally by the application. for example, a non-exposed protocol would not be loaded by the application...
...And 2 more matches
nsIFaviconService
ew async api moziasyncfavicons.getfavicondataforpage() instead. this method retrieves the given favicon data, returning it as a data url throws an exception if we don't have data. if there is no data but we have an entry for this favicon, returns null. astring getfavicondataasdataurl( in nsiuri afaviconuri ); parameters afaviconuri uri of the favicon whose data is being read. return value a data url containing the data for the favicon. this is null if there is no data but there is an entry for the favicon. exceptions thrown ns_error_not_available thrown when we have never heard of this favicon url. getfaviconforpage() obsolete since gecko 22.0 (firefox 22.0 / thunderbird 22.0 / seamonkey 2.19) note: this method was removed in gecko 22.0. you s...
...ce gecko 22.0 (firefox 22.0 / thunderbird 22.0 / seamonkey 2.19) note: this method was removed in gecko 22.0. you should use the new async api moziasyncfavicons.getfaviconurlforpage() instead. this method retrieves the uri of the favicon for the given page. nsiuri getfaviconforpage( in nsiuri apageuri ); parameters apageuri uri of the page whose favicon is desired. return value returns the uri of the favicon associated with that page. returning a uri here does not mean that we have data for this favicon, only that we know what the favicon should be. exceptions thrown ns_error_not_available when the page is not found or it has no favicon. getfaviconimageforpage() obsolete since gecko 22.0 (firefox 22.0 / thunderbird 22.0 / seamonkey 2.19) ...
...heard of the page or its favicon: the default one will be returned in this case. when compared to getfaviconlinkforicon() method, this method only adds the extra level of indirection, looking up the favicon based on the page uri and using the default if not found. nsiuri getfaviconimageforpage( in nsiuri apageuri ); parameters apageuri uri of the page whose favicon is desired. return value returns a uri that will give you the icon image. this is not the uri of the icon as set on the page, but a uri that will give you the data out of the favicon service. for a normal page with a favicon we've stored, this will be an annotation uri which will then cause the corresponding favicon data to be loaded from this service. for pages where we don't have a favicon, this will be a chrome uri of...
...And 2 more matches
nsIFilePicker
the uri of the currently selected file or directory. read only. filterindex long the (0-based) index of the filter which is currently selected in the file picker dialog. set this to choose a particular filter to be selected by default. constants mode constants these constants are used to specify the type of file picker to create when calling init(). ...
...to be selected by default. constants mode constants these constants are used to specify the type of file picker to create when calling init(). constant value description modeopen 0 load a file. modesave 1 save a file. modegetfolder 2 select a folder/directory. modeopenmultiple 3 load multiple files. return value constants these values are returned by show() or passed as an argument to open()'s callback, indicating the result of the file picker activity. ...
... value description modeopen 0 load a file. modesave 1 save a file. modegetfolder 2 select a folder/directory. modeopenmultiple 3 load multiple files. return value constants these values are returned by show() or passed as an argument to open()'s callback, indicating the result of the file picker activity. ...
...And 2 more matches
nsIFileProtocolHandler
mfile(in nsifile file); nsiuri newfileuri(in nsifile afile); nsiuri readurlfile(in nsifile file); methods getfilefromurlspec() converts the url string into the corresponding nsifile if possible. a local file will be created if the url string begins with file://. nsifile getfilefromurlspec( in autf8string url ); parameters url the url string to convert. return value a reference to a new nsifile object. geturlspecfromactualfile() converts the nsifile to the corresponding url string. should only be called on files which are not directories. otherwise identical to geturlspecfromfile(), but is usually more efficient. warning: this restriction may not be enforced at runtime! autf8string geturlspecfromactualfile( in nsifile file ); parameters file t...
...bject. geturlspecfromactualfile() converts the nsifile to the corresponding url string. should only be called on files which are not directories. otherwise identical to geturlspecfromfile(), but is usually more efficient. warning: this restriction may not be enforced at runtime! autf8string geturlspecfromactualfile( in nsifile file ); parameters file the nsifile to convert. return value corresponding url string. the resulting string may contain url-escaped characters. geturlspecfromdir() converts the nsifile to the corresponding url string. should only be called on files which are directories. otherwise identical to geturlspecfromfile(), but is usually more efficient. warning: this restriction may not be enforced at runtime! autf8string geturlspecfromdir( in nsifile file ); p...
...ain url-escaped characters. geturlspecfromdir() converts the nsifile to the corresponding url string. should only be called on files which are directories. otherwise identical to geturlspecfromfile(), but is usually more efficient. warning: this restriction may not be enforced at runtime! autf8string geturlspecfromdir( in nsifile file ); parameters file the nsifile to convert. return value corresponding url string. the resulting string may contain url-escaped characters. geturlspecfromfile() converts the nsifile to the corresponding url string. if the nsifile is a local file, then the result will be a file:// url string. the resulting string may contain url-escaped characters. note: under some platforms this is a lossy conversion. note: callers should use geturlspecfromactualfile...
...And 2 more matches
nsIINIParserWriter
ko 1.9.2 inherits from: nsisupports last changed in gecko 13.0 (firefox 13.0 / thunderbird 13.0 / seamonkey 2.10) this interface provides methods that allow writing to ini-format configuration files. ini files contain zero or more sections, denoted by a name in square brackets, followed by zero or more lines of text with a property name on the left, then an equals sign ("="), then the value of the property. to create an nsiiniparserwriter object, you use the nsiiniparserfactory interface to create a parser, then nsisupports.queryinterface() that to get an nsiiniparserwriter, like this: let writer = components.classes["@mozilla.org/xpcom/ini-processor-factory;1"]. .getservice(components.interfaces.nsiiniparserfactory) .createiniparser(s...
...mponents.interfaces.nsiiniparserfactory) .createiniparser(somelocalfile) .queryinterface(components.interfaces.nsiiniparserwriter); here, somelocalfile is an nsifile based object, such as an nsilocalfile. this indicates the file into which the ini data will be written. once the writer object is created, you can use the setstring() method to set the value of a property within a given section; the section is created if it hasn't been yet. the sections are built in memory before the text of the ini file is generated, so you can add properties to the file in any order, regardless of section. when you're done and ready to write the ini file to disk, call the writefile() method. method overview void setstring(in autf8string asection, in au...
...ction; the section is created if it hasn't been yet. the sections are built in memory before the text of the ini file is generated, so you can add properties to the file in any order, regardless of section. when you're done and ready to write the ini file to disk, call the writefile() method. method overview void setstring(in autf8string asection, in autf8string akey, in autf8string avalue); void writefile([optional] in nsifile ainifile, [optional] in unsigned long aflags); constants file writing constants these constants are specified when calling writefile(), in order to change its behavior. constant value description write_utf16 0x1 windows and the nsis installer code sometimes expect ini files to be in utf-16 encoding. on windows...
...And 2 more matches
nsILivemarkService
in long long folder, in astring name, in nsiuri siteuri, in nsiuri feeduri, in long index ); parameters folder the id of the parent folder. name the name to show when displaying the livemark. siteuri the uri of the site from which the livemark was created. feeduri the uri of the actual rss feed. index the index to insert at, or -1 to append to the end of the list. return value the id of the folder for the livemark. createlivemarkfolderonly() this method also creates a new livemark but use this method during startup to avoid http traffic. long long createlivemarkfolderonly( in long long folder, in astring name, in nsiuri siteuri, in nsiuri feeduri, in long index ); parameters folder the id of the parent folder. name the name to show when displaying...
... in long long folder, in astring name, in nsiuri siteuri, in nsiuri feeduri, in long index ); parameters folder the id of the parent folder. name the name to show when displaying the livemark. siteuri the uri of the site from which the livemark was created. feeduri the uri of the actual rss feed. index the index to insert at, or -1 to append to the end of the list. ...
...i the uri of the actual rss feed. index the index to insert at, or -1 to append to the end of the list. return value returns the id of the folder for the livemark. getfeeduri() this method retrieves the uri of the syndication feed associated with a livemark container. nsiuri getfeeduri( in long long container ); parameters container the folder id of a livemark container. return value a nsiuri representing the uri of the feed; if the livemark container doesn't have a valid feed uri, null will be returned or the nsiuri object returned will be the empty string. exceptions thrown ns_error_invalid_arg if the folder id isn't known or identifies a folder that isn't a livemark container. ns_error_malformed_uri if the site uri annotation has somehow been corrupted (and can't b...
...And 2 more matches
nsILocaleService
in nsilocaledefinition localedefinition); obsolete since gecko 1.9 methods getapplicationlocale() gets the user preference for locale from the operating system. note: this has nothing to do with the locale used for localization of the application (ui text strings and so on.). this method returns something similar to getsystemlocale. nsilocale getapplicationlocale(); parameters none. ...
...getapplicationlocale(); parameters none. return value the user's os setting for preferred locale. getlocalecomponentforuseragent() gets the user preference for locale from the operating system. note: this has nothing to do with any http user-agent. this method returns the same as getsystemlocale.getcategory("nsilocale_messages"). astring getlocalecomponentforuseragent(); parameters none. return value the user's os setting for preferred locale in the format described in nsilocale. getlocalefromacceptlanguage() gets the most preferred locale from a list of locale preferences. ...
...newlocale() create a new nsilocale from a locale string. ...
...And 2 more matches
nsILoginManagerStorage
ned long count, in nsipropertybag matchdata, [retval, array, size_is(count)] out nsilogininfo logins); void setloginsavingenabled(in astring ahost, in boolean isenabled); attributes attribute type description uibusy boolean true when a master password prompt is being shown. read only. methods addlogin() called by the login manager to store a new login. gecko 1.9.1 note default values for the nsiloginmetainfo properties are created if the specified login doesn't explicitly specify them. void addlogin( in nsilogininfo alogin ); parameters alogin the login to add to the login storage. countlogins() implement this method to return the number of logins matching the specified criteria. this method is called, for example, to check to see if there is a login that will match th...
...tch all hosts. passing null should not match any logins, and should return 0. aactionurl the url of the form to which the login will be submitted. to match any form login, specify an empty string. to not match to any form login, specify null. ahttprealm the http realm for which the login applies. to match logins for any realm, specify an empty string. to not match any realm, specify null. return value the number of logins that match the specified criteria. findlogins() implement this method to search the login store for logins matching the specified criteria. this method is called by the login manager when looking for saved logins that might apply to a form or authentication request. void findlogins( out unsigned long count, in astring ahostname, in astring aactionurl, in astring ahttp...
...gin store, it must be an empty array, not null. getloginsavingenabled() implement to report whether or not login saving has been disabled for a specific host. boolean getloginsavingenabled( in astring ahost ); parameters ahost the hostname whose login saving status should be returned. this string will be in the origin url format, without a pathname. for example, "http://mozilla.com". return value return true if login saving is enabled for the specified host; otherwise, return false. init() implement this method to initialize the component. this is not called automatically; you must call it yourself if needed. void init(); parameters none. initwithfile() implement this method to initialize the component, overriding the default filename locations with those specified. this method is primar...
...And 2 more matches
nsIMIMEInputStream
tent-length header. inherits from: nsiinputstream last changed in gecko 1.3 implemented by: @mozilla.org/network/mime-input-stream;1. ...
...-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 addcontentlength 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. ...
... setdata() sets data-stream. may not be called once the stream has been started to be read. the cursor of the new stream should be located at the beginning of the stream if the implementation of the nsimimeinputstream also is used as an nsiseekablestream. ...
...And 2 more matches
nsIMemoryReporter
ger.registerreporter(). once that has been done, the reporter will be found by any client accessing the enumerator returned by nsimemoryreportermanager.enumeratereporters(). this includes the about:memory page. note: this interface is undergoing heavy development, and is subject to rapid changes. attributes attribute type description amount print64 the numeric value reported by the memory reporter, specified in the units indicated by the units attribute. read only. note: this attribute was called memoryused prior to gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4), and its type was long long. description autf8string a human-readable description of this memory usage report. read only. kind print32 the memor...
...hould be reported under. paths are delimited with '/' characters to allow a hierarchy of memory to be displayed in about:memory. as of gecko 6.0, the path should start with "explicit/" if the memory report accounts for all memory reported under sub-paths. read only. process acstring the name of the process containing this reporter. each reporter starts with an empty string for this value, indicating that it applies to the current process; this is true even for reporters in a child process. when a reporter from a child process is copied into the main process, the copy's process field is set appropriately. read only. units print32 the units used by the amount attribute; this will be one of the unit type constants. read only. constants memory reporter kind con...
...rocess is copied into the main process, the copy's process field is set appropriately. read only. units print32 the units used by the amount attribute; this will be one of the unit type constants. read only. constants memory reporter kind constants these allocation kind constants describe the types of memory allocation described by memory use reporters. constant value description kind_mapped 0 this is deprecated synonym for kind_nonheap. deprecated since gecko 8.0 kind_nonheap 0 allocated directly by os calls e.g. mmap, virtualalloc, vm_allocate etc. kind_heap 1 allocated by the heap allocator, e.g. malloc, new etc. kind_other 2 an allocation that does not fit into another kind category. ...
...And 2 more matches
nsIMsgFilter
defined in comm-central/ mailnews/ base/ search/ public/ nsimsgfilter.idl attributes type attribute nsmsgruleactiontype type; priority // target priority.. throws an exception if the action is not priority attribute nsmsgpriorityvalue priority; targetfolderuri // target folder.. throws an exception if the action is not move to folder attribute acstring targetfolderuri; label // target label. ...
... attributes type attribute nsmsgruleactiontype type; priority // target priority.. throws an exception if the action is not priority attribute nsmsgpriorityvalue priority; targetfolderuri // target folder.. throws an exception if the action is not move to folder attribute acstring targetfolderuri; label // target label. ...
...priority // target priority.. throws an exception if the action is not priority attribute nsmsgpriorityvalue priority; targetfolderuri // target folder.. throws an exception if the action is not move to folder attribute acstring targetfolderuri; label // target label. ...
...And 2 more matches
nsIMsgFilterCustomAction
y attribute acstring id; /* action name to display in action list. this should be localized. */ readonly attribute astring name; /** * is this custom action valid for a particular filter type? * * @param type the filter type * @param scope the search scope * * @return true if valid */ boolean isvalidfortype(in nsmsgfiltertypetype type, in nsmsgsearchscopevalue scope); /** * after the user inputs a particular action value for the action, determine * if that value is valid. * * @param actionvalue the value entered. * @param actionfolder folder in the filter list * @param filtertype filter type (manual, offlinemail, etc.) * * @return errormessage a localized message to display if invalid * ...
...ular action value for the action, determine * if that value is valid. * * @param actionvalue the value entered. * @param actionfolder folder in the filter list * @param filtertype filter type (manual, offlinemail, etc.) * * @return errormessage a localized message to display if invalid * set to null if the actionvalue is valid */ autf8string validateactionvalue(in autf8string actionvalue, in nsimsgfolder actionfolder, in nsmsgfiltertypetype filtertype); /* allow duplicate actions in the same filter list? default no. */ attribute boolean allowduplicates; /* * the custom action itself * * generally for the apply method, fol...
... correct * results and are preferred if available. otherwise, be careful * that the action does correct notifications to maintain counts, and correct * manipulations of both imap and local non-database storage of message * metadata. ...
...And 2 more matches
nsIMsgFilterList
st::setfilterat ( in unsigned long filterindex, in nsimsgfilter filter ) removefilter() void nsimsgfilterlist::removefilter (in nsimsgfilter filter) removefilterat() void nsimsgfilterlist::removefilterat (in unsigned long filterindex) movefilterat() void nsimsgfilterlist::movefilterat ( in unsigned long filterindex, in nsmsgfiltermotionvalue motion ) insertfilterat() void nsimsgfilterlist::insertfilterat ( in unsigned long filterindex, in nsimsgfilter filter ) movefilter() void nsimsgfilterlist::movefilter ( in nsimsgfilter filter, in nsmsgfiltermotionvalue motion ) createfilter() nsimsgfilter nsimsgfilterlist::createfilter ( in astring name ) savetofile() void nsimsgfilterlist::sa...
...simsgdbhdr msghdr, in nsimsgfolder folder, in nsimsgdatabase db, in string headers, in unsigned long headersize, in nsimsgfilterhitnotify listener, in nsimsgwindow msgwindow, in nsilocalfile amessagefile ) writeinattr() void nsimsgfilterlist::writeintattr ( in nsmsgfilterfileattribvalue attrib, in long value, in nsioutputstream stream ) writestrattr() void nsimsgfilterlist::writestrattr ( in nsmsgfilterfileattribvalue attrib, in string value, in nsioutputstream stream ) writewstrattr() void nsimsgfilterlist::writewstrattr ( in nsmsgfilterfileattribvalue attrib, in stri...
... value, in nsioutputstream stream ) writestrattr() void nsimsgfilterlist::writestrattr ( in nsmsgfilterfileattribvalue attrib, in string value, in nsioutputstream stream ) writewstrattr() void nsimsgfilterlist::writewstrattr ( in nsmsgfilterfileattribvalue attrib, in string value, in nsioutputstream stream ) matchorchangefiltertarget() boolean nsimsgfilterlist::matchorchangefiltertarget ( in acstring olduri, in acstring newuri, in boolean caseinsensitive ) clearlog() void nsimsgfilterlist::clearlog () ensurelogfile() void nsimsgfilterlist::ensurelogfile () flushlogifnecessary () void nsimsgfilterlist::flushlo...
...And 2 more matches
nsIPluginHost
tingagentstring); native code only! attributes attribute type description plugincount unsigned long read only. native code only! methods native code only!createtempfiletopost to create temp file with content len header in, it will use by http post. nsifile createtempfiletopost( in string apostdataurl ); parameters apostdataurl return value native code only!createtmpfiletopost obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. to create temp file with content len header in, it will use by http post. void createtmpfiletopost( in string apostdataurl, ...
...use socks mixed. for example "proxy 111.111.111.111;proxy 112.112.112.112", "proxy 111.111.111.111;socks 112.112.112.112".... which proxy/socks to use is determined by the plugin. void findproxyforurl( in string aurl, out string aresult ); parameters aurl aresult native code only!getplugin nsiplugin getplugin( in string amimetype ); parameters amimetype return value getplugincount() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) void getplugincount( out unsigned long aplugincount ); parameters aplugincount native code only!getpluginfactory obsolete since gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0)this feature is obsolete. although it may still work in some browsers, its use i...
...ncount ); parameters aplugincount native code only!getpluginfactory obsolete since gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. ...
...And 2 more matches
nsISHistoryListener
ean onhistorypurge(in long anumentries); boolean onhistoryreload(in nsiuri areloaduri, in unsigned long areloadflags); methods onhistorygoback() called when navigating to a previous session history entry, for example due to an nsiwebnavigation.goback() call. boolean onhistorygoback( in nsiuri abackuri ); parameters abackuri the uri of the session history entry being navigated to. ...
...onhistorygotoindex() called when navigating to a session history entry by index, for example, when nsiwebnavigation.gotoindex() is called. ...
...rd operation to proceed or false to cancel it. onhistorygotoindex() called when navigating to a session history entry by index, for example, when nsiwebnavigation.gotoindex() is called. boolean onhistorygotoindex( in long aindex, in nsiuri agotouri ); parameters aindex the index in session history of the entry to be loaded. agotouri the uri of the session history entry to be loaded. return value true to allow the operation to proceed or false to cancel it. onhistorynewentry() called when a new document is added to session history. new documents are added to session history by the docshell when new pages are loaded in a frame or content area; for example by calling nsiwebnavigation.loaduri(). note: you can't cancel this operation. void onhistorynewentry( in nsiuri anewuri ); parameters...
...And 2 more matches
nsIScriptableIO
mpty filename string if you wish to get a reference to the directory itself. nsifile getfile( in astring alocation, in astring afilename ); parameters alocation a location key identifying a known standard directory. the afilename parameter is treated as being local to this directory. afilename the relative path of the file to generate a reference for. return value returns an nsifile object referencing the specified file location. exceptions thrown ns_error_invalid_arg alocation was null. getfilewithpath() returns a file reference using an absolute file path to locate the file. note: you should avoid using this method, since file paths are platform-dependent and non-portable. instead, you should use getfile() and construct the path from the ...
... file reference using an absolute file path to locate the file. note: you should avoid using this method, since file paths are platform-dependent and non-portable. instead, you should use getfile() and construct the path from the base location manually. nsifile getfilewithpath( in astring afilepath ); parameters afilepath the absolute pathname of the file to reference, or the value of a file's persistentdescriptor. return value returns an nsifile object referencing the specified file location. exceptions thrown ns_error_invalid_arg afilepath was null. newuri() creates a uri object that implements the nsiuri interface. nsiuri newuri( in nsivariant auri ); parameters auri the file for which to create a new nsiuri object. this parameter ma...
...ect referencing the specified file location. exceptions thrown ns_error_invalid_arg afilepath was null. newuri() creates a uri object that implements the nsiuri interface. nsiuri newuri( in nsivariant auri ); parameters auri the file for which to create a new nsiuri object. this parameter may be specified either as a url string or as an nsifile object. return value returns an nsiuri object corresponding to the specified string or file. exceptions thrown ns_error_invalid_arg auri was null. newinputstream() retrieves a stream from which data can be read. nsisupports newinputstream( in nsivariant abase, in astring amode, [optional] in astring acharset, [optional] in astring areplacechar, [optional] in unsigned long abuffersize ...
...And 2 more matches
nsIScrollable
n, in long scrollbarpref); void setscrollrange(in long scrollorientation, in long minpos, in long maxpos); obsolete since gecko 29.0 void setscrollrangeex(in long minhorizontalpos, in long maxhorizontalpos, in long minverticalpos, in long maxverticalpos); obsolete since gecko 29.0 constants scroll orientations scroll orientations a scrollbar can be in. constant value description scrollorientation_x 1 horizontal scrolling. when passing this in to a method you are requesting or setting data for the horizontal scrollbar. scrollorientation_y 2 vertical scrolling. when passing this in to a method you are requesting or setting data for the vertical scrollbar. scrollbar states visibility states of a scrollbar. constant...
...description scrollorientation_x 1 horizontal scrolling. when passing this in to a method you are requesting or setting data for the horizontal scrollbar. scrollorientation_y 2 vertical scrolling. when passing this in to a method you are requesting or setting data for the vertical scrollbar. scrollbar states visibility states of a scrollbar. constant value description scrollbar_auto 1 scrollbars visible only when needed. scrollbar_never 2 scrollbars never visible, even when scrolling is still possible. scrollbar_always 3 scrollbars always visible, even when scrolling is not possible. methods getcurscrollpos() obsolete since gecko 29.0 (firefox 29.0 / thunderbird 29.0 / seamonkey...
...possible. scrollbar_always 3 scrollbars always visible, even when scrolling is not possible. methods getcurscrollpos() obsolete since gecko 29.0 (firefox 29.0 / thunderbird 29.0 / seamonkey 2.26) long getcurscrollpos( in long scrollorientation ); parameters scrollorientation an integer representing the orientation of the scrollbar. return value getdefaultscrollbarpreferences() long getdefaultscrollbarpreferences( in long scrollorientation ); parameters scrollorientation an integer representing the orientation of the scrollbar. return value an integer representing the state of the scrollbar. getscrollbarvisibility() void getscrollbarvisibility( out boolean verticalvisible, out boolean horizontalvisible ); parameters ...
...And 2 more matches
nsISelectionController
2 num_selection_regions 2 3 selection_off 0 selection_hidden 1 hidden displays selection. selection_on 2 selection_disabled 3 selection_attention 4 scroll constants constant value description scroll_synchronous 1<<1 if set scrolls the selection into view before returning. if not set, posts a request which is processed at some point after the method returns. scroll_first_ancestor_only 1<<2 if set, only the first ancestor will be scrolled into view. scroll_center_vertically 1<<4 if se...
...checkvisibility() checks if textnode and offsets are actually rendered in the current precontext. boolean checkvisibility( in nsidomnode node, in short startoffset, in short endoffset ); parameters node nsidomnode to test. startoffset offset in dom to first char of textnode to test. endoffset offset in dom to last char of textnode to test. return value true if visible, false if not. completemove() will move page view to the top or bottom of the document this will also have the effect of collapsing the selection if the extend = pr_false the "point" of selection that is extended is considered the "focus" point, or the last point adjusted by the selection. void completemove( in boolean forward, in boolean extend ); parameters forward ...
...alse. extend should it collapse the selection or extend it? completescroll() will move page view to the top or bottom of the document. void completescroll( in boolean forward ); parameters forward forward or backward if pr_false. getcaretenabled() gets the current state of the caret, as set by setcaretenabled(). boolean getcaretenabled(); parameters none. return value if aoutenabled==null, returns ns_error_invalid_arg else ns_ok. getdisplayselection() will get the display mode for the selection. short getdisplayselection(); parameters none. return value off, on, disabled. getselection() will return the selection that the presentation shell may implement. nsiselection getselection( in short type ); parameters type will hold the type of select...
...And 2 more matches
nsISyncJPAKE
acstring apeerid, in acstring apin, in acstring agx3, in acstring agv3, in acstring ar3, in acstring agx4, in acstring agv4, in acstring ar4, out acstring aa, out acstring agva, out acstring ara); methods final() perform the final step of the jpake exchange. this will compute the key and expand the key to two keys, an aes256 encryption key and a 256 bit hmac key. ...
... jpake exchange. this will compute the key and expand the key to two keys, an aes256 encryption key and a 256 bit hmac key. it returns a key confirmation value (sha256d of the key) and the encryption and hmac keys. void final( in acstring ab, in acstring agvb, in acstring arb, in acstring ahkdfinfo, out acstring aaes256key, out acstring ahmac256key ); parameters ab schnorr signature value b, in hex representation. agvb schnorr signature value g^vb (vb is a random value), in hex representation. arb schnorr signature value rb = vb - xb * h, in hex representation. ahkdfinfo missing description aaes256key the aes 256 encryption key, in base64 representation. ahmac256key the 256 bit hmac key, in base64 representation. round1() perform first round of the jpake exchange. void round1( ...
...256 encryption key, in base64 representation. ahmac256key the 256 bit hmac key, in base64 representation. round1() perform first round of the jpake exchange. void round1( in acstring asignerid, out acstring agx1, out acstring agv1, out acstring ar1, out acstring agx2, out acstring agv2, out acstring ar2 ); parameters asignerid string identifying the signer. agx1 schnorr signature value g^x1, in hex representation. agv1 schnorr signature value g^v1 (v1 is a random value), in hex representation. ar1 schnorr signature value r1 = v1 - x1 * h, in hex representation. agx2 schnorr signature value g^x2, in hex representation. agv2 schnorr signature value g^v2 (v2 is a random value), in hex representation. ar2 schnorr signature value r2 = v2 - x2 * h, in hex representation. round2() pe...
...And 2 more matches
nsITaskbarPreviewController
eringcontext2d ctx); boolean drawthumbnail(in nsidomcanvasrenderingcontext2d ctx, in unsigned long width, in unsigned long height); boolean onactivate(); void onclick(in nsitaskbarpreviewbutton button); void onclose(); attributes attribute type description height unsigned long the height in pixels of the preview image. ...
...ew image. this value may change at any time. see drawpreview() for more information. read only. thumbnailaspectratio float the thumbnail's aspect ratio. this doesn't need to match the preview's aspect ratio, and is allowed to be changed at any time. see drawthumbnail() for more information. read only. width unsigned long the width in pixels of the preview image. this value may change at any time. see drawpreview() for more information. read only. note: although these attributes are read only, that indicates that the previews controlled by an nsitaskbarpreviewcontroller cannot alter these values. the controller and its supporting code, however, may change this values at any time. methods drawpreview() invoked by nsitaskbarpreview when it needs to render th...
...e attributes are read only, that indicates that the previews controlled by an nsitaskbarpreviewcontroller cannot alter these values. the controller and its supporting code, however, may change this values at any time. methods drawpreview() invoked by nsitaskbarpreview when it needs to render the preview. the specified context is attached to a surface with the controller's width and height, the values of which are obtained immediately prior to calling this method. boolean drawpreview( in nsidomcanvasrenderingcontext2d ctx ); parameters ctx an nsidomcanvasrenderingcontext2d object representing the drawing context into which the preview is to be rendered. ...
...And 2 more matches
nsITransactionListener
esult ); parameters amanager the nsitransactionmanager undoing the transaction. atransaction the transaction being undone. aundoresult the nsresult returned after undoing the transaction. willbeginbatch() called before a nsitransactionmanager begins a batch. boolean willbeginbatch( in nsitransactionmanager amanager ); parameters amanager the nsitransactionmanager beginning a batch. return value willdo() called before a nsitransactionmanager calls a transaction's nsitransaction.dotransaction() method. boolean willdo( in nsitransactionmanager amanager, in nsitransaction atransaction ); parameters amanager the nsitransactionmanager doing the transaction. atransaction the transaction being executed. return value willendbatch() called before a nsitransactionmanager ends a batch. boo...
... nsitransactionmanager amanager, in nsitransaction atransaction ); parameters amanager the nsitransactionmanager doing the transaction. atransaction the transaction being executed. return value willendbatch() called before a nsitransactionmanager ends a batch. boolean willendbatch( in nsitransactionmanager amanager ); parameters amanager the nsitransactionmanager ending a batch. return value willmerge() called before a nsitransactionmanager tries to merge a transaction, that was just executed, with the transaction at the top of the undo stack. boolean willmerge( in nsitransactionmanager amanager, in nsitransaction atoptransaction, in nsitransaction atransactiontomerge ); parameters amanager the nsitransactionmanager ending a batch. atoptransaction the transaction at the top ...
...saction, that was just executed, with the transaction at the top of the undo stack. boolean willmerge( in nsitransactionmanager amanager, in nsitransaction atoptransaction, in nsitransaction atransactiontomerge ); parameters amanager the nsitransactionmanager ending a batch. atoptransaction the transaction at the top of the undo stack. atransactiontomerge the transaction to merge. ...
...And 2 more matches
nsITransactionManager
tion peekredostack(); nsitransaction peekundostack(); void redotransaction(); void removelistener(in nsitransactionlistener alistener); void undotransaction(); attributes attribute type description maxtransactioncount long sets the maximum number of transaction items the transaction manager will maintain at any time. this is commonly referred to as the number of levels of undo. a value of -1 means no limit. a value of zero means the transaction manager will execute each transaction, then immediately release all references it has to the transaction without pushing it on the undo stack. a value greater than zero indicates the max number of transactions that can exist at any time on both the undo and redo stacks. this method will prune the necessary number of transactions on the u...
... numberofredoitems long the number of items on the redo stack. read only. ...
...ction the nsitransaction to do. endbatch() turns off the transaction manager's batch mode. void endbatch(); parameters none. getredolist() returns the list of nsitransaction on the redo stack. note that the transaction at the top of the redo stack will actually be at the index n-1 in the list, where n is the number of items in the list. nsitransactionlist getredolist(); parameters none. return value a list of nsitransaction on the redo stack. getundolist() returns the list of nsitransaction on the undo stack. note that the transaction at the top of the undo stack will actually be at the index n-1 in the list, where n is the number of items in the list. nsitransactionlist getundolist(); parameters none. return value a list of nsitransaction on the undo stack. peekredostack() returns an addre...
...And 2 more matches
nsITreeBoxObject
oid endupdatebatch(); void clearstyleandimagecaches(); attributes attribute type description columns nsitreecolumns readonly: obtain the columns. view nsitreeview the view that backs the tree and that supplies it with its data. it is dynamically settable, either using a view attribute on the tree tag or by setting this attribute to a new value. focused boolean whether or not we are currently focused. treebody nsidomelement readonly: obtain the treebody content node. this is a node that corresponds to the treechildren tag. rowheight long readonly: obtain the height of a row. rowwidth long readonly: obtain the width of a row. horizontalposition long readonly: get...
...x of the row to check col the nsitreecolumn to check scrolltorow() scrolls such that the row at index is at the top of the visible view. void scrolltorow(in long index); parameters index the index of the row scrollbylines() scroll the tree up or down by numlines lines. void scrollbylines(in long numlines); parameters numlines the number of lines to scroll. positive values move down in the tree. prevents scrolling off the end of the tree. scrollbypages() scroll the tree up or down by numpages pages. a page is considered to be the amount displayed by the tree. this method prevents scrolling off the end of the tree. void scrollbypages(in long numpages); parameters numpages the number of pages to scroll. positive values move down in the tree. scrolltocel...
...coordinate system for the document this boxobject lives in, and the units are css pixels. void getcellat(in long x, in long y, out long row, out nsitreecolumn col, out acstring childelt); parameters x the x coordinate y the y coordinate returns row the row index at the coordinates col the nsitreecolumn hit. childelt the pseudoelement hit: this can have values of "cell", "twisty", "image", and "text". getcoordsforcellitem() find the coordinates of an element within a specific cell. void getcoordsforcellitem(in long row, in nsitreecolumn col, in acstring element, out long x, out long y, out long width, out long height); parameters row the index of the row col the nsitreecolumn element the pseudoel...
...And 2 more matches
nsIWindowWatcher
window. nsiwindowwatcher keeps a list of all top-level dom windows currently open, along with their corresponding chrome interfaces. since dom windows lack a (public) means of retrieving their corresponding chrome, this method will do that. nsiwebbrowserchrome getchromeforwindow( in nsidomwindow awindow ); parameters awindow the nsidomwindow whose chrome window the caller needs. return value an nsiwebbrowserchrome object for the corresponding chrome window getnewauthprompter() return a newly created nsiauthprompt implementation. nsiauthprompt getnewauthprompter( in nsidomwindow aparent ); parameters aparent the parent window used for posing alerts. can be null. return value a new nsiauthprompt object. getnewprompter() return a newly created nsiprompt implementation. ...
... getwindowbyname() retrieve an existing window (or frame). note: this method will search all open windows for any window or frame with the given window name. ...
...he given window name. make sure you understand the security implications of this before using this method! nsidomwindow getwindowbyname( in wstring atargetname, in nsidomwindow acurrentwindow ); parameters atargetname the window name. acurrentwindow the nsidomwindow starting point in the window hierarchy to begin the search. if null, each top level window will be searched. ...
...And 2 more matches
nsIWindowsShellService
browser/components/shell/public/nsiwindowsshellservice.idlscriptable please add a summary to this article. ...
...obsolete since gecko 1.8 hkcc 1 hkey_current_config. obsolete since gecko 1.8 hkcu 2 hkey_current_user. ...
...obsolete since gecko 1.8 hkcc 1 hkey_current_config. obsolete since gecko 1.8 hkcu 2 hkey_current_user. obsolete since gecko 1.8 hklm 3 hkey_local_machine. ...
...And 2 more matches
nsIZipReader
character that must be escaped inside the brackets is ]. ^ and - must never appear in the first and second positions within the brackets, respectively. (in the former case, the behavior specified for '[^az]' will happen.) [a-z] matches any character between a and z. the characters a and z must either both be letters or both be numbers, with the character represented by 'a' having a lower ascii value than the character represented by 'z'. [^az] matches any character except a or z. if ] is to appear inside the brackets as a character to not match, it must be escaped. pat~pat2 returns matches to the pattern 'pat' which do not also match the pattern 'pat2'. this may be used to perform filtering upon the results of one pattern to remove all matches which also match another pattern. for exampl...
...foo|bar) will match either the pattern foo or the pattern bar. neither of the patterns foo or bar may use the 'pat~pat2' syntax described immediately above. \ will escape a special character. escaping is required for all special characters unless otherwise specified. all other characters match case-sensitively. an apattern not conforming to this syntax has undefined behavior. return value the nsiutf8stringenumerator containing the matching entry names. exceptions thrown ns_error_illegal_value on many but not all invalid apattern values. getcertificateprincipal() returns an object describing the entity which signed an entry. parsemanifest must be called first. if aentryname is an entry in the jar, getinputstream() must be called after parsemanifest. if aentryname is an ext...
...anifest must be called first. if aentryname is an entry in the jar, getinputstream() must be called after parsemanifest. if aentryname is an external file which has meta-information stored in the jar, verifyexternalfile (not yet implemented) must be called before getprincipal. nsiprincipal getcertificateprincipal( in string aentryname ); parameters aentryname missing description return value an nsiprincipal. example demonstrating this function: list contents of xpi and read file contents getentry() returns a nsizipentry describing a specified zip entry. nsizipentry getentry( in autf8string zipentry ); parameters zipentry the zip entry. return value the nsizipentry for the given zip entry. example demonstrating this function: list contents of xpi and read file cont...
...And 2 more matches
XPCOM Interface Reference
this is a reference to the xpcom interfaces provided by the mozilla platform. ...
...oragebindingparamsmozistoragebindingparamsarraymozistoragecompletioncallbackmozistorageconnectionmozistorageerrormozistoragefunctionmozistoragependingstatementmozistorageprogresshandlermozistorageresultsetmozistoragerowmozistorageservicemozistoragestatementmozistoragestatementcallbackmozistoragestatementparamsmozistoragestatementrowmozistoragestatementwrappermozistoragevacuumparticipantmozistoragevaluearraymozitxttohtmlconvmozithirdpartyutilmozivisitinfomozivisitinfocallbackmozivisitstatuscallbacknsiabcardnsiaboutmodulensiabstractworkernsiaccelerometerupdatensiaccessnodensiaccessibilityservicensiaccessiblensiaccessiblecaretmoveeventnsiaccessiblecoordinatetypensiaccessibledocumentnsiaccessibleeditabletextnsiaccessibleeventnsiaccessiblehyperlinknsiaccessiblehypertextnsiaccessibleimagensiaccessibl...
...ccessibleeventnsiaccessiblehyperlinknsiaccessiblehypertextnsiaccessibleimagensiaccessibleprovidernsiaccessiblerelationnsiaccessibleretrievalnsiaccessiblerolensiaccessiblescrolltypensiaccessibleselectablensiaccessiblestatechangeeventnsiaccessiblestatesnsiaccessibletablensiaccessibletablecellnsiaccessibletablechangeeventnsiaccessibletextnsiaccessibletextchangeeventnsiaccessibletreecachensiaccessiblevaluensiaccessiblewin32objectnsialertsservicensiannotationobservernsiannotationservicensiappshellnsiappshellservicensiappstartupnsiappstartup_mozilla_2_0nsiapplicationcachensiapplicationcachechannelnsiapplicationcachecontainernsiapplicationcachenamespacensiapplicationcacheservicensiapplicationupdateservicensiarraynsiasyncinputstreamnsiasyncoutputstreamnsiasyncstreamcopiernsiasyncverifyredirectcallbackn...
...And 2 more matches
XPCOM reference
acronsgetmoduleprocthis function prototype provides the xpcom entry-point into a module.nsiabcard/thunderbird3the nsiabcard interface is used to represent and manipulate cards in the address book. in a big change from the original nsiabcard, properties are now stored in a hash table instead of as attributes on the interface, allowing it to be more flexible.nsicookie2 mozilla 1 8 branchnsimsgsearchvaluedefined in comm-central/ mailnews/ base/ search/ public/ nsimsgsearchvalue.idl nsmsgmessageflagsthe nsmsgmessageflags interface describes possible flags for messages. equivalent flags are also defined in nsmsgmessageflags.h. nsmsgnavigationtypethe nsmsgnavigationtype interface contains constants used for message navigation in thunderbird. for example to move forward a message, you would call:n...
...omm-central/ mailnews/ base/ search/ public/ nsimsgsearchvalue.idl nsmsgmessageflagsthe nsmsgmessageflags interface describes possible flags for messages. equivalent flags are also defined in nsmsgmessageflags.h. nsmsgnavigationtypethe nsmsgnavigationtype interface contains constants used for message navigation in thunderbird. for example to move forward a message, you would call:nsmsgsearchopvaluedefined in comm-central/ mailnews/ base/ search/ public/ nsmsgsearchcore.idl nsmsgviewcommandcheckstatethe nsmsgviewcommandcheckstate interface contains constants used for command status in thunderbird. it is (as far as i can tell) not currently used anywhere in thunderbird.nsmsgviewcommandtypethe nsmsgviewcommandtype interface contains constants used for commands in thunderbird. for example to ma...
...view flags in thunderbird. this interface isn't ever implemented. it is only used to store constants. for example, the 'unread only' view would use the flag:nsmsgviewsortorderthe nsmsgviewsortorder interface contains constants used for sort direction in thunderbird. this interface isn't ever implemented. it is only used to store constants. for example to sort by date you would pass a function the value:nsmsgviewsorttypethe nsmsgviewsorttype interface contains constants used for sorting the thunderbird threadpane. this interface isn't ever implemented. it is only used to store constants. for example to sort by date you would pass a function the value:nsmsgviewtypethe nsmsgviewtype interface contains constants used for views in thunderbird. this interface isn't ever implemented. it is only used t...
...And 2 more matches
PointerType
exceptions thrown typeerror thrown if the parameter isn't a ctype. ...
..., this is simply the string that was passed to the constructor. for other function, pointer, and array types, this should be a valid c type expression. ptr ctype returns a ctype representing the data type "pointer to this type". this is the result of calling ctypes.pointertype(the_type). read only. size number the size of the type, in bytes. this is the same value as the c sizeof. read only. note: ctypes.void_t.size is undefined. method overview methods inherited from ctype ctype array([n]) string tosource() string tostring() pointertype cdata syntax cdata pointertype(); pointertype is pointertype ctype. return value a cdata representing the newly allocated pointer. pointertype cdata properties ...
...if converting the data fails, a typeerror exception is thrown. ...
...And 2 more matches
URLs - Plugins
ee the reference entry for npn_geturl. the npn_geturlnotify method acts like npn_geturl. both request the creation of a new stream with the contents of the specified url, and, in addition, npn_geturlnotify notifies the plug-in of the successful or unsuccessful completion of the request. the browser notifies the plug-in by calling the plug-in's npp_urlnotify function and passing it the notifydata value, which may be used to track multiple requests. npn_geturlnotify handles the url request asynchronously. it returns immediately and only later handles the request and calls npp_urlnotify. without this notification, the plug-in cannot tell whether a request with a null target failed or a request with a non-null target was completed. nperror npn_geturlnotify(npp instance, const char* url, ...
...non-null target was completed. nperror npn_geturlnotify(npp instance, const char* url, const char* target, void* notifydata); the instance, url, and target parameters have the same definitions as those of npn_geturl. the notifydata parameter contains private plug-in data that can be used to associate the request with the subsequent npp_urlnotify call (which returns this value) and/or to pass a pointer to some request-related payload. if a request is not completed successfully (for example, because the url is invalid or an http server is down), the browser should call npp_urlnotify as soon as possible. if a request completes successfully, and the target is non-null, the browser calls npp_urlnotify after it has finished loading the url. if the target is null, it calls ...
...est completes successfully, and the target is non-null, the browser calls npp_urlnotify after it has finished loading the url. if the target is null, it calls npp_urlnotify after calling npp_destroystream to close the stream. both the npn_geturlnotify and npn_posturlnotify functions call the npp_urlnotify method to notify the plug-in of the result of a request. both functions pass the notifydata value to npp_urlnotify, which tells the plug-in that the url request was completed and the reason for completion. void npp_urlnotify(npp instance, const char* url, npreason reason, void* notifydata); the instance and url parameters have the same definitions as those of npn_geturl. the notifydata parameter contains the private plug-in data passed to the corresponding call to npn_ge...
...And 2 more matches
All keyboard shortcuts - Firefox Developer Tools
tab tab tab css pane these shortcuts work when you're in the inspector's css pane. ...
... the inspector's css pane. ...
...s on the search box in the css pane ctrl + f cmd + f ctrl + f clear search box content (only when the search box is focused, and content has been entered) esc esc esc step forward through properties and values tab tab tab step backward through properties and values shift + tab shift + tab shift + tab start editing property or value (rules view only, when a property or value is selected, but not already being edited) enter or space return or space enter or space cycle up and down through auto-complete suggestions (rules view only, when a property or value is being edited) up arrow , down arrow up arrow , down arrow up arrow , down arrow choose current auto-complete suggestion (rules view o...
...And 2 more matches
Page inspector keyboard shortcuts - Firefox Developer Tools
tab tab tab css pane these shortcuts work when you're in the inspector's css pane. ...
... the inspector's css pane. ...
...s on the search box in the css pane ctrl + f cmd + f ctrl + f clear search box content (only when the search box is focused, and content has been entered) esc esc esc step forward through properties and values tab tab tab step backward through properties and values shift + tab shift + tab shift + tab start editing property or value (rules view only, when a property or value is selected, but not already being edited) enter or space return or space enter or space cycle up and down through auto-complete suggestions (rules view only, when a property or value is being edited) up arrow , down arrow up arrow , down arrow up arrow , down arrow choose current auto-complete suggestion (rules view o...
...And 2 more matches
Web Audio Editor - Firefox Developer Tools
firefox 34. connections between nodes are displayed as solid lines. if, instead, you've connected a node to an audioparam in another node, then the connection is shown as a dashed line between the nodes, and is labeled with the name of the audioparam: inspecting and modifying audionodes if you click on a node, it's highlighted and you get a node inspector on the right hand side. ...
... bypassing nodes new in firefox 38. ...
... bypassing nodes new in firefox 38. in the pane that shows you the node's details, there's an on/off button: click it, and the graph will be modified to bypass this node, so it will no longer have any effect. ...
...And 2 more matches
AudioBufferSourceNode.loop - Web APIs
when looping is enabled, the sound begins playing at the time specified as the start point when start() is called. ...
... when looping is enabled, the sound begins playing at the time specified as the start point when start() is called. ...
... when looping is enabled, the sound begins playing at the time specified as the start point when start() is called. ...
...And 2 more matches
AudioBufferSourceNode.loopEnd - Web APIs
nd property of the audiobuffersourcenode interface specifies is a floating point number specifying, in seconds, at what offset into playing the audiobuffer playback should loop back to the time indicated by the loopstart property. this is only used if the loop property is true. syntax audiobuffersourcenode.loopend = endoffsetinseconds; var endoffsetinseconds = audiobuffersourcenode.loopend; value a floating-point number indicating the offset, in seconds, into the audio buffer at which each loop will loop return to the beginning of the loop (that is, the current play time gets reset to audiobuffersourcenode.loopstart). this property is only used if the loop property is true. the default value is 0. example in this example, the audiocontext.decodeaudiodata() function is used to decode a...
...unction is used to decode an audio track and put it into an audiobuffersourcenode. buttons are provided to play and stop the audio playback, and slider controls are used to change the playbackrate, loopstart and loopend properties on the fly. when the audio is played to the end, it loops, but you can control how long the loops last by altering loopstart and loopend. for example, if you set their values to 20 and 25, respectively, then begin playback, the sound will play normally until it reaches the 25 second mark. then the current play position will loop back to the 20 second mark and continue playing until the 25 second mark, ad infinitum (or at least until stop() is called). for a full working example, see this code running live, or view the source. function getdata() { source = audio...
... loopstartcontrol.oninput = function() { source.loopst...
...And 2 more matches
BaseAudioContext.createScriptProcessor() - Web APIs
august 29 2014 web audio api spec publication, this feature has been marked as deprecated, and was replaced by audioworklet (see audioworkletnode). syntax var scriptprocessor = audioctx.createscriptprocessor(buffersize, numberofinputchannels, numberofoutputchannels); parameters buffersize the buffer size in units of sample-frames. ...
...precated, and was replaced by audioworklet (see audioworkletnode). syntax var scriptprocessor = audioctx.createscriptprocessor(buffersize, numberofinputchannels, numberofoutputchannels); parameters buffersize the buffer size in units of sample-frames. if specified, the buffersize must be one of the following values: 256, 512, 1024, 2048, 4096, 8192, 16384. ...
...tputchannels); parameters buffersize the buffer size in units of sample-frames. if specified, the buffersize must be one of the following values: 256, 512, 1024, 2048, 4096, 8192, 16384. if it's not passed in, or if the value is 0, then the implementation will choose the best buffer size for the given environment, which will be a constant power of 2 throughout the lifetime of the node. this value controls how frequently the audioprocess event is dispatched and how many sample-frames need to be processed each call. lower values for buffersize will result in a lower (better) latency. higher values will be necessary to avoid audio breakup and glitches. it is recommended for authors to not specify this buffer size and allow the implementation to pick a good buffer size to balance between late...
...And 2 more matches
BlobBuilder - Web APIs
void append(in arraybuffer data); void append(in blob data); void append(in string data, [optional] in string endings); blob getblob([optional] in domstring contenttype); file getfile(in domstring name, [optional] in domstring contenttype); methods append() appends the contents of the specified javascript object to the blob being built. if the value you specify isn't a blob, arraybuffer, or string, the value is coerced to a string before being appended to the blob. void append( in arraybuffer data ); void append( in blob data ); void append( in string data, [optional] in string endings ); parameters data the data to append to the blob being constructed. endings specifies how strings containing \n are to be written out. th...
...ppend( in arraybuffer data ); void append( in blob data ); void append( in string data, [optional] in string endings ); parameters data the data to append to the blob being constructed. endings specifies how strings containing \n are to be written out. this can be "transparent" (endings unchanged) or "native" (endings changed to match host os filesystem convention). ...
...this also resets the blobbuilder so that the next call to append() is starting a new, empty blob. getfile() returns a file object. ...
...And 2 more matches
CSS.registerProperty() - Web APIs
the css.registerproperty() method registers custom properties, allowing for property type checking, default values, and properties that do or do not inherit their value. registering a custom property allows you to tell the browser how the custom property should behave; what are allowed types, whether the custom property inherits its value, and what the default value of the custom property is. syntax css.registerproperty(propertydefinition); parameters a propertydefinition dictionary object, which can contain the following members: name a domstring indicating the name of the property being defined. ...
... exceptions invalidmodificationerror the given name has already been registered. ...
...ters a propertydefinition dictionary object, which can contain the following members: name a domstring indicating the name of the property being defined. syntax optional a domstring representing the expected syntax of the defined property. defaults to "*". inherits a boolean value defining whether the defined property should be inherited (true), or not (false). defaults to false. initialvalue optional a domstring representing the initial value of the defined property. return value undefined. exceptions invalidmodificationerror the given name has already been registered. syntaxerror the given name isn't a valid custom property name (starts with two dashes, e.g. --foo). typeerror the required name and/or inherits dictionary members were not provided. examples the foll...
...And 2 more matches
CSSRule - Web APIs
Web › API › CSSRule
rule types are specified in the more specialized interfaces for those rules' respective types. references to a cssrule may be obtained by looking at a cssstylesheet's cssrules list. properties common to all cssrule instances cssrule.csstext represents the textual representation of the rule, e.g. "h1,h2 { font-size: 16pt }" or "@import 'url'". to access or modify parts of the rule (e.g. the value of "font-size" in the example) use the properties on the specialized interface for the rule's type. cssrule.parentrule read only returns the containing rule, otherwise null. e.g. if this rule is a style rule inside an @media block, the parent rule would be that cssmediarule. cssrule.parentstylesheet read only returns the cssstylesheet object for the style sheet that contains this rule cssr...
...ule cssrule.type read only one of the type constants indicating the type of css rule. constants type constants the cssrule interface specifies integer constants that can be used in conjunction with a cssrule's type property to discern the rule type (and therefore, which specialized interface it implements). the relationships between these constants and the interfaces are: type value rule-specific interface comments and examples cssrule.style_rule 1 cssstylerule the most common kind of rule: selector { prop1: val1; prop2: val2; } cssrule.import_rule 3 cssimportrule an @import rule. (until the documentation is completed, see the interface definition in the mozilla source code: nsidomcssimportrule.) cssrule.media_rule 4 ...
...amerule reserved for future use 9 should be used to define color profiles in the future cssrule.namespace_rule 10 cssnamespacerule cssrule.counter_style_rule 11 csscounterstylerule cssrule.supports_rule 12 csssupportsrule cssrule.document_rule 13 cssdocumentrule cssrule.font_feature_values_rule 14 cssfontfeaturevaluesrule cssrule.viewport_rule 15 cssviewportrule cssrule.region_style_rule 16 cssregionstylerule cssrule.unknown_rule 0 cssunknownrule cssrule.charset_rule 2 csscharsetrule (removed in most browsers.) an up-to-date informal list of constants can be found on the csswg wiki.
...And 2 more matches
CustomEvent - Web APIs
workers. constructor customevent() creates a customevent. properties customevent.detail read only any data passed when initializing the event. this interface inherits properties from its parent, event: event.bubbles read only a boolean indicating whether or not the event bubbles up through the dom. event.cancelbubble a historical alias to event.stoppropagation(). setting its value to true before returning from an event handler prevents propagation of the event. event.cancelable read only a boolean indicating whether the event is cancelable. event.composed read only a boolean indicating whether or not the event can bubble across the boundary between the shadow dom and the regular dom. event.currenttarget read only a reference to the currently registered target for ...
...cates whether or not the call to event.preventdefault() canceled the event. event.eventphase read only indicates which phase of the event flow is being processed. event.explicitoriginaltarget read only the explicit original target of the event (mozilla-specific.) event.originaltarget read only the original target of the event, before any retargetings. (mozilla-specific.) event.returnvalue a historical property introduced by internet explorer and eventually adopted into the dom specification in order to ensure existing sites continue to work. ideally, you should try to use event.preventdefault() and event.defaultprevented instead, but you can use returnvalue if you choose to do so. event.srcelement a non-standard alias (from old versions of microsoft internet explorer) for eve...
... event.srcelement a non-standard alias (from old versions of microsoft internet explorer) for event.target. some other browsers are starting to support it for web compatibility purposes. event.target read only a reference to the target to which the event was originally dispatched. event.timestamp read only the time at which the event was created (in milliseconds). by specification, this value is time since epoch—but in reality, browsers' definitions vary. in addition, work is underway to change this to be a domhighrestimestamp instead. event.type read only the name of the event. case-insensitive. event.istrusted read only indicates whether or not the event was initiated by the browser (after a user click, for instance) or by a script (using an event creation method, like event...
...And 2 more matches
DOMHighResTimeStamp - Web APIs
the domhighrestimestamp type is a double and is used to store a time value in milliseconds. this type can be used to describe a discrete point in time or a time interval (the difference in time between two discrete points in time). the time, given in milliseconds, should be accurate to 5 µs (microseconds), with the fractional part of the number indicating fractions of a millisecond. however, if the browser is unable to provide a time value accurate to 5 µs (due, for example, to hardware or software constraints), the browser can represent the value as a time in milliseconds accurate to a millisecond. also note the section below on reduced time precision controlled by browser preferences to avoid timing attacks and fingerprinting. further, if the device or operating system the user agent is ...
...irefox 59; in 60 it will be 2ms. // reduced time precision (2ms) in firefox 60 event.timestamp // 1519211809934 // 1519211810362 // 1519211811670 // ... // reduced time precision with `privacy.resistfingerprinting` enabled event.timestamp; // 1519129853500 // 1519129858900 // 1519129864400 // ... ...
...ision with `privacy.resistfingerprinting` enabled event.timestamp; // 1519129853500 // 1519129858900 // 1519129864400 // ... in firefox, you can also enable privacy.resistfingerprinting, the precision will be 100ms or the value of privacy.resistfingerprinting.reducetimerprecision.microseconds, whichever is larger. properties this type has no properties. it is a double-precision floating-point value. value the value of a domhighrestimestamp is a double-precision floating-point number which describes the number of milliseconds (accurate to within 5 microseconds if the device supports it) elapsed between two points in time. the starting time can be either a specific time determined by the script for a site or app, or the time origin. the time origin the time origin is a standard time which...
...And 2 more matches
DOMMatrix - Web APIs
Web › API › DOMMatrix
table version of the dommatrixreadonly interface. this interface should be available inside web workers, though some implementations don't allow it yet. constructor dommatrix() creates and returns a new dommatrix object. properties this interface inherits properties from dommatrixreadonly, though some of these properties are altered to be mutable. is2d read only a boolean flag whose value is true if the matrix was initialized as a 2d matrix. if false, the matrix is 3d. isidentity read only a boolean whose value is true if the matrix is the identity matrix. the identity matrix is one in which every value is 0 except those on the main diagonal from top-left to bottom-right corner (in other words, where the offsets in each direction are equal). m11, m12, m13, m14, m21, m22, m23, ...
...s 3d. isidentity read only a boolean whose value is true if the matrix is the identity matrix. the identity matrix is one in which every value is 0 except those on the main diagonal from top-left to bottom-right corner (in other words, where the offsets in each direction are equal). m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44 double-precision floating-point values representing each component of a 4×4 matrix, where m11 through m14 are the first column, m21 through m24 are the second column, and so forth. a, b, c, d, e, f double-precision floating-point values representing the components of a 4×4 matrix which are required in order to perform 2d rotations and translations. these are aliases for specific components of a 4×4 matrix, as shown below. ...
...odifies the matrix by rotating itself around each axis by the specified number of degrees. returns itself. dommatrix.rotateaxisangleself() modifies the matrix by rotating it by the specified angle around the given vector. returns itself. dommatrix.rotatefromvectorself() modifies the matrix by rotating it by the angle between the specified vector and (1, 0). returns itself. dommatrix.setmatrixvalue() replaces the contents of the matrix with the matrix described by the specified transform or transforms. returns itself. dommatrix.skewxself() modifies the matrix by applying the specified skew transformation along the x-axis. returns itself. dommatrix.skewyself() modifies the matrix by applying the specified skew transformation along the y-axis. returns itself. static methods this inter...
...And 2 more matches
DOMPointReadOnly() - Web APIs
the dompointreadonly() constructor returns a new dompointreadonly object representing a point in 2d or 3d space, optionally with perspective, whose values cannot be altered by script code. syntax point = new dompointreadonly(x, y, z, w); parameters x optional the value of the horizontal coordinate, x, as a floating point number. the default value is 0. y optional the value of the vertical coordinate, y, as a floating point number. the default value is 0. z optional the value of the depth coordinate, z, as a floating point number. the default value is 0. w optional the value of the perspective, w, as a floating point number. ...
... examples the following code demonstrates creating both 2d and 3d points. ...
... examples the following code demonstrates creating both 2d and 3d points. ...
...And 2 more matches
DOMTokenList.forEach() - Web APIs
the foreach() method of the domtokenlist interface calls the callback given in parameter once for each value pair in the list, in insertion order. syntax tokenlist.foreach(callback [, thisarg]); parameters callback function to execute for each element, eventually taking three arguments: currentvalue the current element being processed in the array. currentindex the index of the current element being processed in the array. listobj the array that foreach() is being applied to. thisarg optional value to use as this when executing callback. return value undefined. ...
...ex the index of the current element being processed in the array. listobj the array that foreach() is being applied to. thisarg optional value to use as this when executing callback. return value undefined. example in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist. we when retrieve an iterator containing the values using foreach(), writing each one to the <span>'s node.textcontent inside the foreach() inner function. ...
...e we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist. we when retrieve an iterator containing the values using foreach(), writing each one to the <span>'s node.textcontent inside the foreach() inner function. ...
...And 2 more matches
DelayNode() - Web APIs
inherits parameters from the audionodeoptions dictionary. context a reference to an audiocontext or offlineaudiocontext. options optional an object specifying the delay node options. can contain the following members: delaytime: the initial delay time for the node, in seconds. the default is 0. maxdelaytime: the maximum delay time for the node, in seconds. defaults to 1. return value a new delaynode object instance. example const audioctx = new audiocontext(); const delaynode = new delaynode(audioctx, { delaytime: 0.5, maxdelaytime: 2, }); specifications specification status comment web audio apithe definition of 'delaynode()' in that specification. working draft initial definition. browser compatibility the compatibility table ...
...er-compat-data and send us a pull request. ...
... full support 53ie no support noopera full support 42safari ? ...
...And 2 more matches
Detecting device orientation - Web APIs
devices. this is useful for overcoming some of the differences in device support for device orientation. window.addeventlistener("deviceorientation", handleorientation, true); after registering your event listener (in this case, a javascript function called handleorientation()), your listener function periodically gets called with updated orientation data. ...
...deviceorientationevent.absolute deviceorientationevent.alpha deviceorientationevent.beta deviceorientationevent.gamma the event handler function can look something like this: function handleorientation(event) { var absolute = event.absolute; var alpha = event.alpha; var beta = event.beta; var gamma = event.gamma; // do stuff with the new orientation data } orientation values explained the value reported for each axis indicates the amount of rotation around a given axis in reference to a standard coordinate frame. these are described in greater detail in the orientation and motion data explained article which is summarized below. the deviceorientationevent.alpha value represents the motion of the device around the z axis, represented in degrees with values rangin...
...cates the amount of rotation around a given axis in reference to a standard coordinate frame. these are described in greater detail in the orientation and motion data explained article which is summarized below. the deviceorientationevent.alpha value represents the motion of the device around the z axis, represented in degrees with values ranging from 0 to 360. the deviceorientationevent.beta value represents the motion of the device around the x axis, represented in degrees with values ranging from -180 to 180. this represents a front to back motion of the device. the deviceorientationevent.gamma value represents the motion of the device around the y axis, represented in degrees with values ranging from -90 to 90. this represents a left to right motion of the device. orientation example...
...And 2 more matches
Introduction to the DOM - Web APIs
ce necessary to call those functions from the browser. you can use this test page or create a similar one to test the dom interfaces you are interested in and see how they work on the browser platform. you can update the contents of the test() function as needed, create more buttons, or add elements as necessary. ...
...you can use this test page or create a similar one to test the dom interfaces you are interested in and see how they work on the browser platform. you can update the contents of the test() function as needed, create more buttons, or add elements as necessary. ...
...ary. ...
...And 2 more matches
DynamicsCompressorNode.attack - Web APIs
the attack property of the dynamicscompressornode interface is a k-rate audioparam representing the amount of time, in seconds, required to reduce the gain by 10 db. it defines how quickly the signal is adapted when its volume is increased. the attack property's default value is 0.003 and it can be set between 0 and 1. syntax var audioctx = new audiocontext(); var compressor = audioctx.createdynamicscompressor(); compressor.attack.value = 0; value an audioparam. note: though the audioparam returned is read-only, the value it represents is not. example the below code demonstrates a simple usage of createdynamicscompressor() to add compression to an audio track. for a more complete example, have a look at our basic compressor example (view the source code). // create a mediaelement...
...tedynamicscompressor() to add compression to an audio track. for a more complete example, have a look at our basic compressor example (view the source code). ...
.... for a more complete example, have a look at our basic compressor example (view the source code). ...
...And 2 more matches
DynamicsCompressorNode.ratio - Web APIs
the ratio property of the dynamicscompressornode interface is a k-rate audioparam representing the amount of change, in db, needed in the input for a 1 db change in the output. the ratio property's default value is 12 and it can be set between 1 and 20. syntax var audioctx = new audiocontext(); var compressor = audioctx.createdynamicscompressor(); compressor.ratio.value = 12; value an audioparam. note: though the audioparam returned is read-only, the value it represents is not. example the below code demonstrates a simple usage of createdynamicscompressor() to add compression to an audio track. for a more complete example, have a look at our basic compressor example (view the source code). // create a mediaelementaudiosourcenode // feed the htmlmediaelement into it var source =...
...tedynamicscompressor() to add compression to an audio track. for a more complete example, have a look at our basic compressor example (view the source code). ...
.... for a more complete example, have a look at our basic compressor example (view the source code). ...
...And 2 more matches
DynamicsCompressorNode.release - Web APIs
the release property of the dynamicscompressornode interface is a k-rate audioparam representing the amount of time, in seconds, required to increase the gain by 10 db. it defines how quick the signal is adapted when its volume is reduced. the release property's default value is 0.25 and it can be set between 0 and 1. syntax var audioctx = new audiocontext(); var compressor = audioctx.createdynamicscompressor(); compressor.release.value = 0.25; value an audioparam. note: though the audioparam returned is read-only, the value it represents is not. example the below code demonstrates a simple usage of createdynamicscompressor() to add compression to an audio track. for a more complete example, have a look at our basic compressor example (view the source code). // create a mediaelem...
...tedynamicscompressor() to add compression to an audio track. for a more complete example, have a look at our basic compressor example (view the source code). ...
.... for a more complete example, have a look at our basic compressor example (view the source code). ...
...And 2 more matches
DynamicsCompressorNode - Web APIs
f outputs 1 channel count mode "clamped-max" channel count 2 channel interpretation "speakers" constructor dynamicscompressornode() creates a new instance of an dynamicscompressornode object. properties inherits properties from its parent, audionode. dynamicscompressornode.threshold read only is a k-rate audioparam representing the decibel value above which the compression will start taking effect. dynamicscompressornode.knee read only is a k-rate audioparam containing a decibel value representing the range above the threshold where the curve smoothly transitions to the compressed portion. dynamicscompressornode.ratio read only is a k-rate audioparam representing the amount of change, in db, needed in the input for a 1 db change in...
...tedynamicscompressor() to add compression to an audio track. for a more complete example, have a look at our basic compressor example (view the source code). ...
.... for a more complete example, have a look at our basic compressor example (view the source code). ...
...And 2 more matches
Element.animate() - Web APIs
Web › API › Element › animate
ys the animation. it returns the created animation object instance. elements can have multiple animations applied to them. you can get a list of the animations that affect an element by calling element.getanimations(). syntax var animation = element.animate(keyframes, options); parameters keyframes either an array of keyframe objects, or a keyframe object whose property are arrays of values to iterate over. see keyframe formats for more details. options either an integer representing the animation's duration (in milliseconds), or an object containing one or more timing properties: id optional a property unique to animate(): a domstring with which to reference the animation. delay optional the number of milliseconds to delay the start of the animation. defaults to...
...ards (normal), backwards (reverse), switches direction after each iteration (alternate), or runs backwards and switches direction after each iteration (alternate-reverse). defaults to "normal". duration optional the number of milliseconds each iteration of the animation takes to complete. defaults to 0. although this is technically optional, keep in mind that your animation will not run if this value is 0. easing optional the rate of the animation's change over time. accepts the pre-defined values "linear", "ease", "ease-in", "ease-out", and "ease-in-out", or a custom "cubic-bezier" value like "cubic-bezier(0.42, 0, 0.58, 1)". defaults to "linear". enddelay optional the number of milliseconds to delay after the end of an animation. this is primarily of use when sequencing animations based...
...ptional dictates whether the animation's effects should be reflected by the element(s) prior to playing ("backwards"), retained after the animation has completed playing ("forwards"), or both. defaults to "none". iterationstart optional describes at what point in the iteration the animation should start. 0.5 would indicate starting halfway through the first iteration for example, and with this value set, an animation with 2 iterations would end halfway through a third iteration. defaults to 0.0. iterations optional the number of times the animation should repeat. defaults to 1, and can also take a value of infinity to make it repeat for as long as the element exists. you can also include a composite operation or iteration composite operation in your options list: composite optional ...
...And 2 more matches
Element.msZoomTo() - Web APIs
Web › API › Element › msZoomTo
th animation. zoomed elements can expose their zoom level through mscontentzoom (ie. scrolltop/left). the zoom level can be reset with mszoomto. this proprietary method is specific to internet explorer and microsoft edge. syntax element.mszoomto(arguments); parameters args[in] type: mszoomtooptions contentx[in]: the x-coordinate of the content that is the target of the scroll/zoom. if no value is specified, defaults to the current centerpoint of visible content, horizontally. contenty[in]: the y-coordinate of the content that is the target of the scroll/zoom. if no value is specified, defaults to the current centerpoint of visible content, vertically. viewportx[in]: the alignment point of the viewport. the scroll/zoom operation attempts to align this point with the contentx point. ...
...tenty[in]: the y-coordinate of the content that is the target of the scroll/zoom. if no value is specified, defaults to the current centerpoint of visible content, vertically. viewportx[in]: the alignment point of the viewport. the scroll/zoom operation attempts to align this point with the contentx point. center: default. aligns the horizontal center of the viewport to the element's contentx value. left: aligns the left-most point of the viewport to the element's contentx value. right: aligns the right-most point of the viewport to the element's contentx value. integer: aligns the specified x-coordinate of the viewport to the element's contentx value. viewporty[in]: the alignment point of the viewport. the scroll/zoom operation attempts to align this point with the contenty point. ...
...ght: aligns the right-most point of the viewport to the element's contentx value. integer: aligns the specified x-coordinate of the viewport to the element's contentx value. viewporty[in]: the alignment point of the viewport. the scroll/zoom operation attempts to align this point with the contenty point. middle: default. aligns the vertical center of the viewport to the element's contenty value. top: aligns the top-most point of the viewport to the element's contenty value. bottom: aligns the bottom-most point of the viewport to the element's contenty value. integer: aligns the specified y-coordinate of the viewport to the element's contenty value. scalefactor[in]: floating-point. ...
...And 2 more matches
Element.setAttribute() - Web APIs
sets the value of an attribute on the specified element. if the attribute already exists, the value is updated; otherwise a new attribute is added with the specified name and value. to get the current value of an attribute, use getattribute(); to remove an attribute, call removeattribute(). syntax element.setattribute(name, value); parameters name a domstring specifying the name of the attribute whose value is to be set. the attribute name is automatically converted to all lower-case when setattribute() is called on an html element in an html document. value a domstring containing the value to assign to the attribute. any non-string value specified is converted automatically into a string. boolean attributes are considered to be true if they're present on the element at all, regar...
...be set. the attribute name is automatically converted to all lower-case when setattribute() is called on an html element in an html document. value a domstring containing the value to assign to the attribute. any non-string value specified is converted automatically into a string. boolean attributes are considered to be true if they're present on the element at all, regardless of their actual value; as a rule, you should specify the empty string ("") in value (some people use the attribute's name; this works but is non-standard). see the example below for a practical demonstration. ...
... non-string value specified is converted automatically into a string. boolean attributes are considered to be true if they're present on the element at all, regardless of their actual value; as a rule, you should specify the empty string ("") in value (some people use the attribute's name; this works but is non-standard). see the example below for a practical demonstration. since the specified value gets converted into a string, specifying null doesn't necessarily do what you expect. instead of removing the attribute or setting its value to be null, it instead sets the attribute's value to the string "null". if you wish to remove an attribute, call removeattribute(). return value undefined. exceptions invalidcharactererror the specified attribute name contains one or more characters w...
...And 2 more matches
FileSystemFlags - Web APIs
note that these option flags currently don't have any useful meaning when used in the scope of web content, where security precautions prevent the creation of new files or the replacement of existing ones. ...
... note that these option flags currently don't have any useful meaning when used in the scope of web content, where security precautions prevent the creation of new files or the replacement of existing ones. ...
...reate optional if this property is true, and the requested file or directory doesn't exist, the user agent should create it. the default is false. the parent directory must already exist. exclusive optional if true, and the create option is also true, the file must not exist prior to issuing the call. instead, it must be possible for it to be created newly at call time. the default is false. ...
...And 2 more matches
GainNode() - Web APIs
Web › API › GainNode › GainNode
ll audiocontext.creategain() to create a gain node. syntax var gainnode = new gainnode(context, options) parameters inherits parameters from the audionodeoptions dictionary. context a reference to an audiocontext. options optional options are as follows: gain: the amount of gain to apply. this parameter is a-rate and it's nominal range is (-∞,+∞). the default is 1. return value a new gainnode object instance. specifications specification status comment web audio apithe definition of 'gainnode()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/brows...
...wser-compat-data and send us a pull request. ...
... full support 53ie no support noopera full support 42safari ? ...
...And 2 more matches
GamepadButton - Web APIs
the gamepadbutton interface defines an individual button of a gamepad or other controller, allowing access to the current state of different types of buttons available on the control device. a gamepadbutton object is returned by querying any value of the array returned by the buttons property of the gamepad interface. note: this is the case in firefox gecko 28 and later; chrome and earlier firefox versions still return an array of double values when this property is accessed. properties gamepadbutton.value read only a double value used to represent the current state of analog buttons, such as the triggers on many modern gamepads. the values are normalized to the range 0.0 —1.0, with 0.0 representing a button that is not pressed, and 1.0 representing a button that is fully pressed. ...
...es when this property is accessed. properties gamepadbutton.value read only a double value used to represent the current state of analog buttons, such as the triggers on many modern gamepads. the values are normalized to the range 0.0 —1.0, with 0.0 representing a button that is not pressed, and 1.0 representing a button that is fully pressed. gamepadbutton.pressed read only a boolean value indicating whether the button is currently pressed (true) or unpressed (false). ...
...senting a button that is fully pressed. gamepadbutton.pressed read only a boolean value indicating whether the button is currently pressed (true) or unpressed (false). example the following code is taken from my gamepad api button demo (you can view the demo live, and find the source code on github.) note the code fork — in chrome navigator.getgamepads needs a webkit prefix and the button values are stored as an array of double values, whereas in firefox navigator.getgamepads doesn't need a prefix, and the button values are stored as an array of gamepadbutton objects; it is the gamepadbutton.value or gamepadbutton.pressed properties of these we need to access, depending on what type of buttons they are. in this simple example i've just allowed either. function gameloop() { if(navigat...
...And 2 more matches
HTMLElement: input event - Web APIs
bubbles yes cancelable no interface inputevent event handler property globaleventhandlers.oninput the event also applies to elements with contenteditable enabled, and to any element when designmode is turned on. in the case of contenteditable and designmode, the event target is the editing host. if these properties apply to multiple elements, the editing host is the nearest ancestor element whose parent isn't editable. for <input> elements with type=checkbox or type=radio, the input event should fire whenever a user toggles the control, per the html5 specification. ...
...t is the nearest ancestor element whose parent isn't editable. for <input> elements with type=checkbox or type=radio, the input event should fire whenever a user toggles the control, per the html5 specification. however, historically this has not always been the case. check compatibility, or use the change event instead for elements of these types. ...
... type=checkbox or type=radio, the input event should fire whenever a user toggles the control, per the html5 specification. however, historically this has not always been the case. check compatibility, or use the change event instead for elements of these types. note: the input event is fired every time the value of the element changes. ...
...And 2 more matches
HTMLImageElement.sizes - Web APIs
each of a list of media conditions. this provides the ability to automatically select among different images—even images of different orientations or aspect ratios—as the document state changes to match different media conditions. each condition is specified using the same conditional format used by media queries. syntax let sizes = htmlimageelement.sizes; htmlimageelement.sizes = sizes; value a usvstring containing a comma-separated list of source size descriptors followed by an optional fallback size. each source size descriptor is comprised of a media condition, then at least one whitespace character, then the source size value to use for the image when the media condition evaluates to true. media conditions each source size descriptor consists of a media condition as defined by ...
...each source size descriptor consists of a media condition as defined by the media queries standard. because a source size descriptor is used to specify the width to use for the image during layout of the page, the media condition is typically (but not necessarily) based entirely on width information. see syntax in using media queries for details on how to construct a media condition. ...
...tor consists of a media condition as defined by the media queries standard. because a source size descriptor is used to specify the width to use for the image during layout of the page, the media condition is typically (but not necessarily) based entirely on 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. ...
...And 2 more matches
HTMLImageElement.x - Web APIs
the read-only htmlimageelement property x indicates the x-coordinate of the <img> element's left border edge relative to the root element's origin. the x and y properties are only valid for an image if its display property has the computed value table-column or table-column-group. in other words: it has either of those values set explicitly on it, or it has inherited it from a containing element, or by being located within a column described by either <col> or <colgroup>. syntax let imagex = htmlimageelement.x; value an integer value indicating the distance in pixels from the left edge of the element's nearest root element and the left edge of the <img> element's border box. the nearest root element is the outermost <html> element that contains the image. if the image is in an <iframe>, ...
... integer value indicating the distance in pixels from the left edge of the element's nearest root element and the left edge of the <img> element's border box. the nearest root element is the outermost <html> element that contains the image. if the image is in an <iframe>, its x is relative to that frame. in the diagram below, the left border edge is the left edge of the blue padding area. so the value returned by x would be the distance from that point to the left edge of the content area. ...
...er box. the nearest root element is the outermost <html> element that contains the image. if the image is in an <iframe>, its x is relative to that frame. in the diagram below, the left border edge is the left edge of the blue padding area. so the value returned by x would be the distance from that point to the left edge of the content area. note: the x property is only valid if the computed value of the image's display property is either table-column or table-column-group; in other words, either of those are set directly on the <img> or they're inherited from a containing element or by being located within a column described by either <col> or <colgroup>. example the example below demonstrates the use of the htmlimageelement properties x and y. html in this example, we see a table sh...
...And 2 more matches
HTMLImageElement.y - Web APIs
the read-only htmlimageelement property y indicates the y-coordinate of the <img> element's top border edge relative to the root element's origin. the x and y properties are only valid for an image if its display property has the computed value table-column or table-column-group. in other words: it has either of those values set explicitly on it, or it has inherited it from a containing element, or by being located within a column described by either <col> or <colgroup>. syntax let imagey = htmlimageelement.y; value an integer value indicating the distance in pixels from the top edge of the element's nearest root element to the top edge of the <img> element's border box. the nearest root element is the outermost <html> element that contains the image. if the image is in an <iframe>, its y...
...e an integer value indicating the distance in pixels from the top edge of the element's nearest root element to the top edge of the <img> element's border box. the nearest root element is the outermost <html> element that contains the image. if the image is in an <iframe>, its y is relative to that frame. in the diagram below, the top border edge is the top edge of the blue padding area. so the value returned by y would be the distance from that point to the top edge of the content area. ...
...order box. the nearest root element is the outermost <html> element that contains the image. if the image is in an <iframe>, its y is relative to that frame. in the diagram below, the top border edge is the top edge of the blue padding area. so the value returned by y would be the distance from that point to the top edge of the content area. note: the y property is only valid if the computed value of the image's display property is either table-column or table-column-group; in other words, either of those are set directly on the <img> or they're inherited from a containing element or by being located within a column described by either <col> or <colgroup>. example the example below demonstrates the use of the htmlimageelement properties x and y. html in this example, we see a table sh...
...And 2 more matches
HTMLOutputElement - Web APIs
="#d4dde4" stroke-width="2px" /><text x="406" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmloutputelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent, htmlelement. htmloutputelement.defaultvalue a domstring representing the default value of the element, initially the empty string. htmloutputelement.formread only an htmlformelement indicating the form associated with the control, reflecting the form html attribute if it is defined. htmloutputelement.htmlforread only a domtokenlist reflecting the for html attribute, containing a list of ids of other elements in the same document tha...
...lement, initially the empty string. htmloutputelement.formread only an htmlformelement indicating the form associated with the control, reflecting the form html attribute if it is defined. htmloutputelement.htmlforread only a domtokenlist reflecting the for html attribute, containing a list of ids of other elements in the same document that contribute to (or otherwise affect) the calculated value. htmloutputelement.labelsread only a nodelist of <label> elements associated with the element. htmloutputelement.name a domstring reflecting the name html attribute, containing the name for the control that is submitted with form data. htmloutputelement.typeread only the domstring "output". htmloutputelement.validationmessageread only a domstring representing a localized message that d...
...tring representing 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 constraint validation (willvalidate is false), or it satisfies its constraints. htmloutputelement.validityread only a validitystate representing the validity states that this element is in. htmloutputelement.value a domstring representing the value of the contents of the elements. behaves like the node.textcontent property. htmloutputelement.willvalidateread only a boolean indicating whether the element is a candidate for constraint validation. methods this interface also inherits methods from its parent, htmlelement. htmloutputelement.checkvalidity() checks the validity of the element and retur...
...And 2 more matches
HTMLSelectElement.remove() - Web APIs
is select element. syntax collection.remove(index); parameters index is a long for the index of the htmloptionelement to remove from the collection. if the index is not found the method has no effect. ...
... syntax collection.remove(index); parameters index is a long for the index of the htmloptionelement to remove from the collection. if the index is not found the method has no effect. ...
...ndex); parameters index is a long for the index of the htmloptionelement to remove from the collection. if the index is not found the method has no effect. ...
...And 2 more matches
Recommended Drag Types - Web APIs
ontains two links and a comment: http://www.mozilla.org #a second link http://www.example.com when retrieving a dropped link, ensure you handle when multiple links are dragged, including any comments. for convenience, the special type url may be used to refer to the first valid link within data for the text/uri-list type. do not add data with the url type — attempting to do so will set the value of the text/uri-list type instead. var url = event.datatransfer.getdata("url"); you may also see data with the mozilla-specific type text/x-moz-url. if it appears, it should appear before the text/uri-list type. it holds the urls of links followed by their titles, separated by a linebreak. for example: http://www.mozilla.org mozilla http://www.example.com example dragging html and xml htm...
...it appears, it should appear before the text/uri-list type. it holds the urls of links followed by their titles, separated by a linebreak. for example: http://www.mozilla.org mozilla http://www.example.com example dragging html and xml html content may use the text/html type. the data for this type should be serialized html source code. for example, it would be suitable to set its data to the value of the innerhtml property of an element. xml content may use the text/xml type, but ensure that the data is well-formed xml. you may also include a plain text representation of the html or xml data using the text/plain type. the data should be just the text without any of the source tags or attributes. for instance: var dt = event.datatransfer; dt.setdata("text/html", "hello there, <strong>str...
... representation of the html or xml data using the text/plain type. the data should be just the text without any of the source tags or attributes. for instance: var dt = event.datatransfer; dt.setdata("text/html", "hello there, <strong>stranger</strong>"); dt.setdata("text/plain", "hello there, stranger"); dragging files a local file is dragged using the application/x-moz-file type with a data value that is an nsifile object. non-privileged web pages canot retrieve or modify data of this type. because a file is not a string, you must use the mozsetdataat() method to assign the data. similarly, when retrieving the data, you must use the mozgetdataat() method. event.datatransfer.mozsetdataat("application/x-moz-file", file, 0); if possible, include the file url of the file using both the te...
...And 2 more matches
Headers.get() - Web APIs
Web › API › Headers › get
the get() method of the headers interface returns a byte string of all the values of a header within a headers object with a given name. if the requested header doesn't exist in the headers object, it returns null. for security reasons, some headers can only be controlled by the user agent. these headers include the forbidden header names and forbidden response header names. syntax myheaders.get(name); parameters name the name of the http header whose values you want to retrieve from the headers object. if the given name is not the name of an http header, this method throws a typeerror. the name is case-insensitive. returns a bytestring sequence representing the values of the retrieved header or null if this header is not set. example creating an empty headers object is simple: v...
...or null if this header is not set. ...
...the latest spec has removed getall(), and updated get() t...
...And 2 more matches
IDBCursor.direction - Web APIs
the direction read-only property of the idbcursor interface is a domstring that returns the direction of traversal of the cursor (set using idbobjectstore.opencursor for example). see the values section below for possible values. note: this feature is available in web workers. syntax var direction = cursor.direction; value a string (defined by the idbcursordirection enum) indicating the direction in which the cursor is traversing the data. possible values are: value description next this direction causes the cursor to be opened at the start of the source. nextunique this direction causes the cursor to be opened at the start of the source. for every key with duplicate values, only the first record is yielded. prev this direction causes...
... example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store. ...
...ge the direction of travel of the cursor using the direction property, as it is read-only. we specify the direction of travel using the 2nd argument of idbobjectstore.opencursor. the cursor does not require us to select the data based on a key; we can just grab all of it. also note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo. for a complete working example, see our idbcursor example (view example live.) function backwards() { list.innerhtml = ''; var transaction = db.transaction(['rushalbumlist'], 'readonly'); var objectstore = transaction.objectstore('rushalbumlist'); objectstore.opencursor(null,'prev').onsuccess = function(event) { var cursor = event.target.result; if(cursor) { var l...
...And 2 more matches
IDBCursor.key - Web APIs
Web › API › IDBCursor › key
example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store. ...
... example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store. ...
...h all the records in the object store. within each iteration we log the key of the cursor to the console, something like this (its the album title in each case, which is our key). the cursor does not require us to select the data based on a key; we can just grab all of it. also note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo. for a complete working example, see our idbcursor example (view example live.) function displaydata() { var transaction = db.transaction(['rushalbumlist'], "readonly"); var objectstore = transaction.objectstore('rushalbumlist'); objectstore.opencursor().onsuccess = function(event) { var cursor = event.target.result; if(cursor) { var listitem = document.createelement('li...
...And 2 more matches
IDBCursor.update() - Web APIs
Web › API › IDBCursor › update
the update() method of the idbcursor interface returns an idbrequest object, and, in a separate thread, updates the value at the current position of the cursor in the object store. if the cursor points to a record that has just been deleted, a new record is created. be aware that you can't call update() (or idbcursor.delete()) on cursors obtained from idbindex.openkeycursor(). for such needs, you have to use idbindex.opencursor() instead. note: this feature is available in web workers. syntax var anidbrequest = myidbcursor.update(value); parameters value the new value to be stored at the current position. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: ...
...n description transactioninactiveerror this idbcursor's transaction is inactive. readonlyerror the transaction mode is read only. invalidstateerror the cursor was created using idbindex.openkeycursor, is currently being iterated, or has iterated past its end. dataerror the underlying object store uses in-line keys and the property in the value at the object store's key path does not match the key in this cursor's position. datacloneerror the data being stored could not be cloned by the internal structured cloning algorithm. example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store. if the albumtitle of the current c...
...ell to kings", we update year the album was released using var request = cursor.update();. note that you cannot change primary keys using cursor.update(), hence us not changing the album title; this would ruin the integrity of the data. in such a situation, you would have to delete the record altogether and then add a new one using idbobjectstore.add. note also that you can't directly put cursor.value into an update call, hence the below example using an intermediary updatedata variable. the cursor does not require us to select the data based on a key; we can just grab all of it. also note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo. for a complete working example, see our idbcursor example (view example live.) ...
...And 2 more matches
IDBIndex.locale - Web APIs
Web › API › IDBIndex › locale
example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database. ...
... example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database. ...
...ample in the following example we open a transaction and an object store, then get the index lname from a simple contacts database. we then open a basic cursor on the index using idbindex.opencursor — this works the same as opening a cursor directly on an objectstore using idbobjectstore.opencursor except that the returned records are sorted based on the index, not the primary key. the locale value is logged to the console. function displaydatabyindex() { tableentry.innerhtml = ''; var transaction = db.transaction(['contactslist'], 'readonly'); var objectstore = transaction.objectstore('contactslist'); var myindex = objectstore.index('lname'); console.log(myindex.locale); myindex.opencursor().onsuccess = function(event) { var cursor = event.target.result; if(cursor) {...
...And 2 more matches
IDBIndex.multiEntry - Web APIs
false there is one record for each key that is an array. ...
... false there is one record for each key that is an array. example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database. ...
...w the index behaves when the result of evaluating the index's key path yields an array. this is decided when the index is created, using the idbobjectstore.createindex method. this method takes an optional options parameter whose multientry property is set to true/false. note: this feature is available in web workers. syntax var ismultientry = myindex.multientry; value a boolean: value effect true there is one record in the index for each item in an array of keys. false there is one record for each key that is an array. example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database. we then open a basic cursor on the index using idbindex.opencursor — this works the same as...
...And 2 more matches
IDBKeyRange.lower - Web APIs
Web › API › IDBKeyRange › lower
the lower read-only property of the idbkeyrange interface returns the lower bound of the key range. note: this feature is available in web workers. syntax var lower = mykeyrange.lower value the lower bound of the key range (can be any type.) example the following example illustrates how you'd use a key range. here we declare keyrangevalue = idbkeyrange.upperbound("f", "w", true, true); — a range that includes everything between "f" and "w" but not including them — since both the upper and lower bounds have been declared as open (true). ...
...tes how you'd use a key range. here we declare keyrangevalue = idbkeyrange.upperbound("f", "w", true, true); — a range that includes everything between "f" and "w" but not including them — since both the upper and lower bounds have been declared as open (true). we open a transaction (using idbtransaction) and an object store, and open a cursor with idbobjectstore.opencursor, declaring keyrangevalue as its optional key range value. after declaring the key range, we log its lower property value to the console, which should appear as "f". ...
... a cursor with idbobjectstore.opencursor, declaring keyrangevalue as its optional key range value. after declaring the key range, we log its lower property value to the console, which should appear as "f". ...
...And 2 more matches
IDBKeyRange.lowerOpen - Web APIs
the loweropen read-only property of the idbkeyrange interface returns a boolean indicating whether the lower-bound value is included in the key range. note: this feature is available in web workers. syntax var loweropen = mykeyrange.loweropen value a boolean: value indication true the lower-bound value is not included in the key range. false the lower-bound value is included in the key range. example the following example illustrates how you'd use a key range. here we declare keyrangevalue = idbkeyrange.upperbound("f", "w", true, true); — a range that includes everything between "f" and "w" but not including them — since both the upper and lower bounds have been declared as open (true). we open a transaction (using idbtransactio...
...tes how you'd use a key range. here we declare keyrangevalue = idbkeyrange.upperbound("f", "w", true, true); — a range that includes everything between "f" and "w" but not including them — since both the upper and lower bounds have been declared as open (true). we open a transaction (using idbtransaction) and an object store, and open a cursor with idbobjectstore.opencursor, declaring keyrangevalue as its optional key range value. after declaring the key range, we log its loweropen property value to the console, which should appear as "true": the lower bound is open, so won't be included in the range. note: for a more complete example allowing you to experiment with key range, have a look at our idbkeyrange-example repo (view the example live too.) function displaydata() { var keyran...
...s its optional key range value. after declaring the key range, we log its loweropen property value to the console, which should appear as "true": the lower bound is open, so won't be included in the range. ...
...And 2 more matches
IDBKeyRange.only() - Web APIs
Web › API › IDBKeyRange › only
the only() method of the idbkeyrange interface creates a new key range containing a single value. note: this feature is available in web workers. syntax var myidbkeyrange = idbkeyrange.only(value); parameters value is the value for the new key range. return value idbkeyrange: the newly created key range. exceptions this method may raise a domexception of the following types: exception description dataerror the value parameter passed was not a valid key. example the following example illustrates how you'd use an only key range. here we declare a keyrangevalue = idbkeyrange.only("a"); — a range that only includes the value "a". we open a transaction (using idbtransaction) and an object store, and open a cursor with idbobjectstore.
... dataerror the value parameter passed was not a valid key. example the following example illustrates how you'd use an only key range. here we declare a keyrangevalue = idbkeyrange.only("a"); — a range that only includes the value "a". we open a transaction (using idbtransaction) and an object store, and open a cursor with idbobjectstore.opencursor, declaring keyrangevalue as its optional key range value. this means that the cursor will only retrieve the record with the key value "a". ...
...tion) and an object store, and open a cursor with idbobjectstore.opencursor, declaring keyrangevalue as its optional key range value. this means that the cursor will only retrieve the record with the key value "a". ...
...And 2 more matches
IDBKeyRange.upper - Web APIs
Web › API › IDBKeyRange › upper
the upper read-only property of the idbkeyrange interface returns the upper bound of the key range. note: this feature is available in web workers. syntax var upper = mykeyrange.upper value the upper bound of the key range (can be any type.) example the following example illustrates how you'd use a key range. here we declare keyrangevalue = idbkeyrange.upperbound("f", "w", true, true); — a range that includes everything between "f" and "w" but not including them — since both the upper and lower bounds have been declared as open (true). ...
...tes how you'd use a key range. here we declare keyrangevalue = idbkeyrange.upperbound("f", "w", true, true); — a range that includes everything between "f" and "w" but not including them — since both the upper and lower bounds have been declared as open (true). we open a transaction (using idbtransaction) and an object store, and open a cursor with idbobjectstore.opencursor, declaring keyrangevalue as its optional key range value. after declaring the key range, we log its upper property value to the console, which should appear as "w". ...
... a cursor with idbobjectstore.opencursor, declaring keyrangevalue as its optional key range value. after declaring the key range, we log its upper property value to the console, which should appear as "w". ...
...And 2 more matches
IDBKeyRange.upperBound() - Web APIs
the upperbound() method of the idbkeyrange interface creates a new upper-bound key range. by default, it includes the upper endpoint value and is closed. note: this feature is available in web workers. syntax var myidbkeyrange = idbkeyrange.upperbound(upper[, open=false]) parameters bound specifies the upper bound of the new key range. open indicates whether the upper bound excludes the endpoint value. the default is false. optional return value idbkeyrange: the newly created key range. exceptions this method may raise a domexception of the following type: exception description dataerror the value parameter passed was not a valid key. example the following example illustrates how you'd use an upper bound key range. here we declare ke...
...alue. the default is false. optional return value idbkeyrange: the newly created key range. exceptions this method may raise a domexception of the following type: exception description dataerror the value parameter passed was not a valid key. example the following example illustrates how you'd use an upper bound key range. here we declare keyrangevalue = idbkeyrange.upperbound("f"); — a range that includes the value "f" and everything before it. we open a transaction (using idbtransaction) and an object store, and open a cursor with idbobjectstore.opencursor, declaring keyrangevalue as its optional key range value. if we used idbkeyrange.upperbound("f", true);, then the range excludes "f"; and instead only includes the values before it. n...
...objectstore.opencursor, declaring keyrangevalue as its optional key range value. if we used idbkeyrange.upperbound("f", true);, then the range excludes "f"; and instead only includes the values before it. ...
...And 2 more matches
IDBKeyRange.upperOpen - Web APIs
the upperopen read-only property of the idbkeyrange interface returns a boolean indicating whether the upper-bound value is included in the key range. note: this feature is available in web workers. syntax var upperopen = mykeyrange.upperopen value a boolean: value indication true the upper-bound value is not included in the key range. false the upper-bound value is included in the key range. example the following example illustrates how you'd use a key range. here we declare keyrangevalue = idbkeyrange.upperbound("f", "w", true, true); — a range that includes everything between "f" and "w" but not including them — since both the upper and lower bounds have been declared as open (true). we open a transaction (using idbtransactio...
...tes how you'd use a key range. here we declare keyrangevalue = idbkeyrange.upperbound("f", "w", true, true); — a range that includes everything between "f" and "w" but not including them — since both the upper and lower bounds have been declared as open (true). we open a transaction (using idbtransaction) and an object store, and open a cursor with idbobjectstore.opencursor, declaring keyrangevalue as its optional key range value. after declaring the key range, we log its upperopen property value to the console, which should appear as "true": the upper bound is open, so won't be included in the range. note: for a more complete example allowing you to experiment with key range, have a look at our idbkeyrange-example repo (view the example live too.) function displaydata() { var keyran...
...s its optional key range value. after declaring the key range, we log its upperopen property value to the console, which should appear as "true": the upper bound is open, so won't be included in the range. ...
...And 2 more matches
IDBLocaleAwareKeyRange - Web APIs
methods this interface inherits all the methods of its parent interface, idbkeyrange. ...
... case. with locale-aware indexes, the meaning of < depends on the locale, so for example in lithuanian y is sorted between i and k. the only difference between idbkeyrange and idblocaleawarekeyrange is that the latter doesn’t do the aforementioned check. developers should always use idblocaleawarekeyrange when dealing with locale-aware indexes. ...
...mentioned check. developers should always use idblocaleawarekeyrange when dealing with locale-aware indexes. ...
...And 2 more matches
IDBObjectStore.put() - Web APIs
this is for adding new records, or updating existing records in an object store when the transaction's mode is readwrite. ...
...this is for adding new records, or updating existing records in an object store when the transaction's mode is readwrite. ...
...update (or insert). key optional the primary key of the record you want to update (e.g. from idbcursor.primarykey). this is only needed for object stores that have an autoincrement primary key, therefore the key is not in a field on the record object. in such cases, calling put(item) will always insert a new record, because it doesn't know what existing record you might want to modify. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description readonlyerror the transaction associated with this operation is in read-only mode. transactioninactiveerror this idbobjectstore's transaction is inactive. datae...
...And 2 more matches
IIRFilterNode() - Web APIs
ns) parameters inherits parameters from the audionodeoptions dictionary. context a reference to an audiocontext. options options are as follows: feedforward: a sequence of feedforward coefficients. feedback: a sequence of feedback coefficients. unlike other nodes in the web audio api, the options passed into the iir filter upon creation are not optional. the filter needs these values to work and with the vast range of filters available, there is no default. return value a new iirfilternode object instance. examples let feedforward = [0.00020298, 0.0004059599, 0.00020298]; let feedbackward = [1.0126964558, -1.9991880801, 0.9873035442]; const audiocontext = window.audiocontext || window.webkitaudiocontext; const audioctx = new audiocontext(); const iirfilter = new iirfil...
...ompat-data and send us a pull request. ...
... full support 53ie no support noopera full support 42safari ? ...
...And 2 more matches
KeyframeEffectOptions - Web APIs
keyframeeffect() to describe timing properties for animation effects. these properties are all optional, although without setting a duration the animation will not play. simply put, these properties describe how the user agent should go about making the transition from keyframe to keyframe, and how to behave when the animation begins and ends. properties composite optional determines how values are combined between this animation and other, separate animations that do not specify their own specific composite operation. defaults to replace. add dictates an additive effect, where each successive iteration builds on the last. for instance with transform, a translatex(-200px) would not override an earlier rotate(20deg) value but result in translatex(-200px) rotate(20deg). accumulate ...
...can be set to accumulate or replace (see above). ...
...can be set to accumulate or replace (see above). defaults to replace. pseudoelement optional the selector of the pseudo-element to be targeted, if any. defaults to null. ...
...And 2 more matches
MediaSessionActionDetails - Web APIs
t parameter into the callback which is executed when a media session action occurs. it specifies the type of action which needs to be performed as well as the data needed to perform the action. properties action a media session action type string taken from the mediasessionaction enumerated type, indicating which type of action needs to be performed. see media action types below for possible values. fastseek optional an seekto action may optionally include this property, which is a boolean value indicating whether or not to perform a "fast" seek. a "fast" seek is a seek being performed in a rapid sequence, such as when fast-forwarding or reversing through the media, rapidly skipping through it. this property can be used to indicate that you should use the shortest possible method to seek...
...when fast-forwarding or reversing through the media, rapidly skipping through it. this property can be used to indicate that you should use the shortest possible method to seek the media. fastseek is not included on the final action in the seek sequence in this situation. ...
...ckward and this property is present, it is a floating point value which indicates the number of seconds to move the play position forward or backward. if this property isn't present, those actions should choose a reasonable default distance to skip forward or backward (such as 7 or 10 seconds). seektime optional if the action is seekto, this property must be present and must be a floating-point value indicating the absolute time within the media to move the playback position to, where 0 indicates the beginning of the media. this property is not present for other action types. media action types a media session action's type is specified using a string from the mediasessionaction enumerated type. values each of the actions is a common media session control request. implement support for e...
...And 2 more matches
MediaStreamAudioSourceNode - Web APIs
s apis. this media could be from a microphone (through getusermedia()) or from a remote peer on a webrtc call (using the rtcpeerconnection's audio tracks). a mediastreamaudiosourcenode has no inputs and exactly one output, and is created using the audiocontext.createmediastreamsource() method. the mediastreamaudiosourcenode takes the audio from the first mediastreamtrack whose kind attribute's value is audio. see track ordering for more information about the order of tracks. the number of channels output by the node matches the number of tracks found in the selected audio track. number of inputs 0 number of outputs 1 channel count defined by the first audio mediastreamtrack passed to the audiocontext.createmediastreamsource() method that created it. ...
...ode, which has better-defined rules for how it chooses the track to output. if you do chooose to use mediastreamaudiosourcenode, you should keep the following in mind. track ordering for the purposes of the mediastreamtrackaudiosourcenode interface, the order of the audio tracks on the stream is determined by taking the tracks whose kind is audio, then sorting the tracks by their id property's values, in unicode code point order (essentially, in alphabetical or lexicographical order, for ids which are simple alphanumeric strings). the first track, then, is the track whose id comes first when the tracks' ids are all sorted by unicode code point. however, it's important to note that the rule establishing this ordering was added long after this interface was first introduced into the web audi...
...tusermedia, feed the media into a <video> element to play then mute the audio, but then also feed the audio into a mediastreamaudiosourcenode. next, we feed this source audio into a low pass biquadfilternode (which effectively serves as a bass booster), then a audiodestinationnode. the range slider below the <video> element controls the amount of gain given to the lowpass filter — increase the value of the slider to make the audio sound more bass heavy! note: you can see this example running live, or view the source. var pre = document.queryselector('pre'); var video = document.queryselector('video'); var myscript = document.queryselector('script'); var range = document.queryselector('input'); // getusermedia block - grab stream // put it into a mediastreamaudiosourcenode // also output...
...And 2 more matches
MediaStreamConstraints.audio - Web APIs
the mediastreamconstraints dictionary's audio property is used to indicate what kind of audio track, if any, should be included in the mediastream returned by a call to getusermedia(). to learn more about how constraints work, see capabilities, constraints, and settings. syntax var audioconstraints = true | false | mediatrackconstraints; value the value of the audio property can be specified as either of two types: boolean if a boolean value is specified, it simply indicates whether or not an audio track should be included in the returned stream; if it's true, an audio track is included; if no audio source is available or if permission is not given to use the audio source, the call to getusermedia() will fail. if false, no audio track is included. mediatrackconstraints a constra...
... specified, it simply indicates whether or not an audio track should be included in the returned stream; if it's true, an audio track is included; if no audio source is available or if permission is not given to use the audio source, the call to getusermedia() will fail. if false, no audio track is included. ...
...y indicates whether or not an audio track should be included in the returned stream; if it's true, an audio track is included; if no audio source is available or if permission is not given to use the audio source, the call to getusermedia() will fail. if false, no audio track is included. ...
...And 2 more matches
Using the MediaStream Recording API - Web APIs
tup section. keeping the interface constrained to the viewport, regardless of device height, with calc() the calc() function is one of those useful little utility features that's cropped up in css that doesn't look like much initially, but soon starts to make you think "wow, why didn't we have this before? why was css2 layout so awkward?" it allows you do a calculation to determine the computed value of a css unit, mixing different units in the process. for example, in web dictaphone we have three main ui areas, stacked vertically. we wanted to give the first two (the header and the controls) fixed heights: header { height: 70px; } .main-controls { padding-bottom: 0.7rem; height: 170px; } however, we wanted to make the third area (which contains the recorded samples you can play bac...
...we then use the mediarecorder api to record the stream, and output each recorded snippet into the source of a generated <audio> element so it can be played back. we'll declare some variables for the ...
...e events. first of all, mediarecorder.start() is used to start recording the stream once the record button is pressed: record.onclick = function() { mediarecorder.start(); console.log(mediarecorder.state); console.log("recorder started"); record.style.background = "red"; record.style.color = "black"; } when the mediarecorder is recording, the mediarecorder.state property will return a value of "recording". as recording progresses, we need to collect the audio data. we register an event handler to do this using mediarecorder.ondataavailable: let chunks = []; mediarecorder.ondataavailable = function(e) { chunks.push(e.data); } note: the browser will fire dataavailable events as needed, but if you want to intervene you can also include a timeslice when invoking the start() metho...
...And 2 more matches
MediaTrackConstraints.frameRate - Web APIs
the mediatrackconstraints dictionary's framerate property is a constraindouble describing the requested or mandatory constraints placed upon the value of the framerate constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.framerate as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...rmine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.framerate as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { framerate: constraint }; constraintsobject.framerate = constraint; value a constraindouble describing the acceptable or required value(s) for a video track's frame rate, in frames per second. if this value is a number, the user agent will attempt to obtain media whose frame rate is as close as possible to this number given the capabilities of the hardware and the other constraints specified. ...
... example see example: constraint exerciser in capabilities, constraints, and settings for an example. ...
...And 2 more matches
MediaTrackSettings.autoGainControl - Web APIs
automatic gain control is a feature in which a sound source automatically manages changes in the volume of its source media to maintain a steady overall volume level. this feature is typically used on microphones, although it can be provided by other input sources as well. ...
... automatic gain control is a feature in which a sound source automatically manages changes in the volume of its source media to maintain a steady overall volume level. this feature is typically used on microphones, although it can be provided by other input sources as well. ...
...diastreamtrack.applyconstraints(). automatic gain control is a feature in which a sound source automatically manages changes in the volume of its source media to maintain a steady overall volume level. this feature is typically used on microphones, although it can be provided by other input sources as well. ...
...And 2 more matches
MouseEvent.initMouseEvent() - Web APIs
events initialized in this way must have been created with the document.createevent() method. this method must be called to set the event before it is dispatched, using eventtarget.dispatchevent(). once dispatched, it doesn't do anything anymore. do not use this method anymore as it is deprecated. instead use specific event constructors, like mouseevent(). the page on creating and triggering events gives more information about the way to use these. ...
...celable, view, detail, screenx, screeny, clientx, clienty, ctrlkey, altkey, shiftkey, metakey, button, relatedtarget); parameters type the string to set the event's type to. possible types for mouse events include: click, mousedown, mouseup, mouseover, mousemove, mouseout. canbubble whether or not the event can bubble. sets the value of event.bubbles. cancelable whether or not the event's default action can be prevented. sets the value of event.cancelable. view the event's abstractview. you should pass the window object here. sets the value of uievent.view. detail the event's mouse click count. sets the value of uievent.detail. screenx the event's screen x coordinate. sets the value of mouseevent.screenx. screeny th...
...or not the event's default action can be prevented. sets the value of event.cancelable. view the event's abstractview. you should pass the window object here. sets the value of uievent.view. detail the event's mouse click count. sets the value of uievent.detail. screenx the event's screen x coordinate. sets the value of mouseevent.screenx. screeny the event's screen y coordinate. sets the value of mouseevent.screeny. clientx the event's client x coordinate. sets the value of mouseevent.clientx. clienty the event's client y coordinate. sets the value of mouseevent.clienty. ctrlkey whether or not control key was depressed during the event. sets the value of mouseevent.ctrlkey. altkey whether or not alt key was depressed during the event. sets the value of mouseevent.altkey. shift...
...And 2 more matches
MutationObserverInit.attributeFilter - Web APIs
the mutationobserverinit dictionary's optional attributefilter property is an array of strings specifying the names of the attributes whose values are to be monitored for changes. if this property is specified, there's no need to also set attributes to true, as it's implied. if the attributes permission is true but no attributefilter is included in the options object, all attributes' values are watched for changes. syntax var options = { attributefilter: [ "list", "of", "attribute", "names" ] } value an array of domstring objects, each specifying the name of one attribute whose value is to be monitored for changes. there is no default value. if this property exists on the options object when the mutationobserver() constructor is used to create a new mutationobserver, attribute monitor...
...ay from keyboard (afk) or offline. ...
...on.target.status); break; case "username": usernamechanged(mutation.oldvalue, mutation.target.username); break; } break; } }); } var userlistelement = document.queryselector("#userlist"); var observer = new mutationobserver(callback); observer.observe(userlistelement, { attributefilter: [ "status", "username" ], attributeoldvalue: true, subtree: true }); the callback() function—which will be passed into the observe() method when starting the observer, looks at each item in the list of mutationrecord objects. ...
...And 2 more matches
MutationObserverInit.characterData - Web APIs
on any text node, including nodes based on the text, processinginstruction, and comment interfaces. note that this doesn't monitor content of an htmlelement, even if it only contains text inside, as it only monitors text nodes themselves. so either pass directly a text node to the observe() method or you need to also set subtree: true. ...
... including nodes based on the text, processinginstruction, and comment interfaces. note that this doesn't monitor content of an htmlelement, even if it only contains text inside, as it only monitors text nodes themselves. so either pass directly a text node to the observe() method or you need to also set subtree: true. ...
...t this doesn't monitor content of an htmlelement, even if it only contains text inside, as it only monitors text nodes themselves. so either pass directly a text node to the observe() method or you need to also set subtree: true. syntax var options = { characterdata: true | false } value a boolean value indicating whether or not to call the observer's callback function when textual nodes' values change. ...
...And 2 more matches
OfflineAudioCompletionEvent.OfflineAudioCompletionEvent() - Web APIs
lly. offlineaudiocompletionevents are despatched to offlineaudiocontext instances for legacy reasons. syntax var offlineaudiocompletionevent = new offlineaudiocompletionevent(type, init) parameters type optional a domstring representing the type of object to create. init optional options are as follows: renderedbuffer: the rendered audiobuffer containing the audio data. return value a new offlineaudiocompletionevent object instance. specifications specification status comment web audio apithe definition of 'offlineaudiocompletionevent()' 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 ...
...d send us a pull request. ...
... full support 53ie no support noopera full support 42safari ? ...
...And 2 more matches
OscillatorNode.detune - Web APIs
example the following example shows basic usage of an audiocontext to create an oscillator node. for applied examples/information, check out our violent theremin demo (see app.js for relevant code). ...
... example the following example shows basic usage of an audiocontext to create an oscillator node. for applied examples/information, check out our violent theremin demo (see app.js for relevant code). ...
... example the following example shows basic usage of an audiocontext to create an oscillator node. for applied examples/information, check out our violent theremin demo (see app.js for relevant code). ...
...And 2 more matches
OscillatorNode.frequency - Web APIs
example the following example shows basic usage of an audiocontext to create an oscillator node. for an applied example, check out our violent theremin demo (see app.js for relevant code). ...
... example the following example shows basic usage of an audiocontext to create an oscillator node. for an applied example, check out our violent theremin demo (see app.js for relevant code). ...
... example the following example shows basic usage of an audiocontext to create an oscillator node. for an applied example, check out our violent theremin demo (see app.js for relevant code). ...
...And 2 more matches
PaymentRequest.PaymentRequest() - Web APIs
e type expected by the payment handler indicated by supportedmethods. for basic credit card services, this structure should match the basiccardrequest dictionary. details provides information about the requested transaction. this parameter contains the following fields: total the total amount of the payment request. id optional a free-form identifier for this payment request. if a value is not supplied, the browser will construct one. displayitems an array of optional line items for the payment request that the user agent may display, such as product details, tax, and shipping. shippingoptions the shipping options the user may choose from. if this sequence is blank, it indicates the merchant cannot ship to the current shipping address. the default shipping option may be ...
...operty is commonly used to add a discount or surcharge line item indicating the different amount in details.modifiers.total. data a json-serializable object that provides optional information that might be needed by the supported payment methods. this has to conform to the structure defined in the basiccardrequest dictionary. total a total amount for the payment request that overrides value in details.total. this is typically used when details.modifiers.additionalitems adds a discount or a surchase to the request. options optional lets you set options that control the behavior of the user agent. this parameter contains the following fields: requestpayername a boolean indicating whether the user agent should collect the payer's name and submit it with the payment ...
...r's shipping address and submit it with the payment request. if you set this type to true, you should select an appropriate shippingtype. the default is false. shippingtype lets you specify how the user interface refers to shipping when the word 'shipping' isn't appropriate for your use case. for example, in english speaking countries you would say "pizza delivery" not "pizza shipping". valid values are "shipping", "delivery", and "pickup". quotation marks must be included. the default value is "shipping". return value a new paymentrequest object, configured for use as configured by the input parameters. examples the following example shows minimal functionality and focuses instead on showing the complete context of instantiating a paymentrequest object. var supportedinstruments =...
...And 2 more matches
PerformanceTiming - Web APIs
t took place. each time is provided as an unsigned long long representing the moment, in milliseconds since the unix epoch these properties are listed in the order in which they occur during the navigation process. performancetiming.navigationstart read only when the prompt for unload terminates on the previous document in the same browsing context. if there is no previous document, this value will be the same as performancetiming.fetchstart. performancetiming.unloadeventstart read only when the unload event has been thrown, indicating the time at which the previous document in the window began to unload. if there is no previous document, or if the previous document or one of the needed redirects is not of the same origin, the value returned is 0. performancetiming.unloadevent...
...document in the window began to unload. if there is no previous document, or if the previous document or one of the needed redirects is not of the same origin, the value returned is 0. performancetiming.unloadeventend read only when the unload event handler finishes. if there is no previous document, or if the previous document, or one of the needed redirects, is not of the same origin, the value returned is 0. performancetiming.redirectstart read only when the first http redirect starts. if there is no redirect, or if one of the redirects is not of the same origin, the value returned is 0. performancetiming.redirectend read only when the last http redirect is completed, that is when the last byte of the http response has been received. if there is no redirect, or if one of th...
...ectstart read only when the first http redirect starts. if there is no redirect, or if one of the redirects is not of the same origin, the value returned is 0. performancetiming.redirectend read only when the last http redirect is completed, that is when the last byte of the http response has been received. if there is no redirect, or if one of the redirects is not of the same origin, the value returned is 0. performancetiming.fetchstart read only when the browser is ready to fetch the document using an http request. this moment is before the check to any application cache. ...
...And 2 more matches
RTCConfiguration - Web APIs
nd rtcpeerconnection.setconfiguration() methods, which allow inspecting and changing the configuration while a connection is established. the options include ice server and transport settings and identity information. properties bundlepolicy optional specifies how to handle negotiation of candidates when the remote peer is not compatible with the sdp bundle standard. this must be one of the values from the enum rtcbundlepolicy. if this value isn't included in the dictionary, "balanced" is assumed. certificates optional an array of objects of type rtccertificate which are used by the connection for authentication. if this property isn't specified, a set of certificates is generated automatically for each rtcpeerconnection instance. although only one certificate is used by a given connect...
...ltiple algorithms may improve the odds of successfully connecting in some circumstances. see using certificates below for additional information. this configuration option cannot be changed after it is first specified; once the certificates have been set, this property is ignored in future calls to rtcpeerconnection.setconfiguration(). icecandidatepoolsize optional an unsigned 16-bit integer value which specifies the size of the prefetched ice candidate pool. the default value is 0 (meaning no candidate prefetching will occur). you may find in some cases that connections can be established more quickly by allowing the ice agent to start fetching ice candidates before you start trying to connect, so that they're already available for inspection when rtcpeerconnection.setlocaldescription() i...
... iceservers optional an array of rtciceserver objects, each describing one server which may be used by the ice agent; these are typically stun and/or turn servers. if this isn't specified, the connection attempt will be made with no stun or turn server available, which limits the connection to local peers. ...
...And 2 more matches
RTCIceCandidate.tcpType - Web APIs
"active" the transport will try to open an outbound connection but won't receive inoming connection requests. ...
... "active" the transport will try to open an outbound connection but won't receive inoming connection requests. ...
... "active" the transport will try to open an outbound connection but won't receive inoming connection requests. ...
...And 2 more matches
RTCOutboundRtpStreamStats.qpSum - Web APIs
the qpsum property of the rtcoutboundrtpstreamstats dictionary is a value generated by adding the quantization parameter (qp) values for every frame this sender has produced to date on the video track corresponding to this rtcoutboundrtpstreamstats object. in general, the higher this number is, the more heavily compressed the video data is. syntax var qpsum = rtcoutboundrtpstreamstats.qpsum; value an unsigned 64-bit integer value which indicates the sum of the quantization parameter (qp) value for every frame sent so far on the track described by the rtcoutboundrtpstreamstats object. ...
...esponding to this rtcoutboundrtpstreamstats object. in general, the higher this number is, the more heavily compressed the video data is. syntax var qpsum = rtcoutboundrtpstreamstats.qpsum; value an unsigned 64-bit integer value which indicates the sum of the quantization parameter (qp) value for every frame sent so far on the track described by the rtcoutboundrtpstreamstats object. since the value of qp is typically larger to indicate higher compression factors, the larger this sum is, the more heavily compressed the stream generally has been. note: this value is only available for video media. ...
...e for every frame sent so far on the track described by the rtcoutboundrtpstreamstats object. since the value of qp is typically larger to indicate higher compression factors, the larger this sum is, the more heavily compressed the stream generally has been. note: this value is only available for video media. usage notes quantization is the process of applying lossy compression to a range of values, resulting in a single quantum value. this value takes the place of the range of values, thereby reducing the number of different values that appear in the overall data set, making the data more compressible. ...
...And 2 more matches
RTCPeerConnection.signalingState - Web APIs
see signaling in lifetime of a webrtc session for more details about the signaling process. because the signaling process is a state machine, being able to verify that your code is in the expected state when messages arrive can help avoid unexpected and avoidable failures. ...
...ilures. for example, if you receive an answer while the signalingstate isn't "have-local-offer", you know that something is wrong, since you should only receive answers after creating an offer but before an answer has been received and passed into rtcpeerconnection.setlocaldescription(). your code will be more reliable if you watch for mismatched states like this and handle them gracefully. ...
...ave-local-offer", you know that something is wrong, since you should only receive answers after creating an offer but before an answer has been received and passed into rtcpeerconnection.setlocaldescription(). your code will be more reliable if you watch for mismatched states like this and handle them gracefully. this value may also be useful during debugging, for example. ...
...And 2 more matches
RTCRtpStreamStats.qpSum - Web APIs
the qpsum property of the rtcrtpstreamstats dictionary is a value generated by adding the quantization parameter (qp) values for every frame sent or received to date on the video track corresponding to this rtcrtpstreamstats object. in general, the higher this number is, the more heavily compressed the video data is. syntax var qpsum = rtcrtpstreamstats.qpsum; value an unsigned 64-bit integer value which indicates the sum of the quantization parameter (qp) value for every frame sent or received so far on the track described by the rtcrtpstreamstats object. since the value of qp is typically larger to indicate higher compression factors, the larger this sum is, the more heavily compressed the stream generally has been. note: this value is only available for video media. usage notes qua...
...r every frame sent or received so far on the track described by the rtcrtpstreamstats object. since the value of qp is typically larger to indicate higher compression factors, the larger this sum is, the more heavily compressed the stream generally has been. note: this value is only available for video media. usage notes quantization is the process of applying lossy compression to a range of values, resulting in a single quantum value. this value takes the place of the range of values, thereby reducing the number of different values that appear in the overall data set, making the data more compressible. ...
...pplying lossy compression to a range of values, resulting in a single quantum value. this value takes the place of the range of values, thereby reducing the number of different values that appear in the overall data set, making the data more compressible. the quantization process and the amount of compression can be controlled using one or more parameters. it's important to keep in mind that the value of qp can change periodically—even every frame—so it's difficult to know for certain how substantial the compression is. the best you can do is make an estimate. ...
...And 2 more matches
RTCRtpTransceiver.direction - Web APIs
the rtcrtptransceiver property direction is a string which indicates the transceiver's preferred directionality. its value must be one of the strings defined by the rtcrtptransceiverdirection enumeration. the transceiver's current direction is indicated by the currentdirection property. syntax var direction = rtcrtptransceiver.direction value a domstring whose value is one of the strings which are a member of the rtcrtptransceiverdirection enumerated type, indicating the transceiver's preferred direction. the rtcrtptransceiverdirection type is an enumeration of string values. ...
... offers to receive rtp data, and does so if the other peer accepts. ...
...d will not do so. does not offer to receive rtp data and will not do so. [1] to determine if a sender has at least one active encoding, the user agent gets its parameters using rtcrtpsender.getparameters(), then looks at the parameters' encodings property; if any of the listed encodings has its active property set to true, the sender has an active encoding. ...
...And 2 more matches
RTCSessionDescription.toJSON() - Web APIs
"sdp", containing a domstring, or null, with the sdp message corresponding to rtcsessiondescription.sdp property. ...
... "sdp", containing a domstring, or null, with the sdp message corresponding to rtcsessiondescription.sdp property. ...
... "sdp", containing a domstring, or null, with the sdp message corresponding to rtcsessiondescription.sdp property. ...
...And 2 more matches
ReadableStream.ReadableStream() - Web APIs
ts of this method are defined by the developer, and should aim to get access to the stream source, and do anything else required to set up the stream fuctionality. if this process is to be done asynchronously, it can return a promise to signal success or failure. the controller parameter passed to this method is a readablestreamdefaultcontroller or a readablebytestreamcontroller, depending on the value of the type property. this can be used by the developer to control the stream during set up. pull(controller) optional this method, also defined by the developer, will be called repeatedly when the stream's internal queue of chunks is not full, up until it reaches its high water mark. if pull() returns a promise, then it won't be called again until that promise fulfills; if the promise reject...
...l be called repeatedly when the stream's internal queue of chunks is not full, up until it reaches its high water mark. if pull() returns a promise, then it won't be called again until that promise fulfills; if the promise rejects, the stream will become errored. the controller parameter passed to this method is a readablestreamdefaultcontroller or a readablebytestreamcontroller, depending on the value of the type property. this can be used by the developer to control the stream as more chunks are fetched. cancel(reason) optional this method, also defined by the developer, will be called if the app signals that the stream is to be cancelled (e.g. if readablestream.cancel() is called). the contents should do whatever is necessary to release access to the stream source. if this process is asy...
...estream.cancel() is called). the contents should do whatever is necessary to release access to the stream source. if this process is asynchronous, it can return a promise to signal success or failure. the reason parameter contains a domstring describing why the stream was cancelled. type optional this property controls what type of readable stream is being dealt with. ...
...And 2 more matches
Request.cache - Web APIs
Web › API › Request › cache
if there is a match and it is fresh, it will be returned from the cache. if there is a match but it is stale, the browser will make a conditional request to the remote server. ...
... if there is a match and it is fresh, it will be returned from the cache. if there is a match but it is stale, the browser will make a conditional request to the remote server. ...
... if there is a match and it is fresh, it will be returned from the cache. if there is a match but it is stale, the browser will make a conditional request to the remote server. ...
...And 2 more matches
Using the Resource Timing API - Web APIs
ailable on github, as is 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 ...
... the payload body, before removing any applied content-codings. decodedbodysize returns the size (in octets) received from the fetch (http or cache) of the message body, after removing any applied content-codings. the following example demonstrates using these three properties. ...
...decodedbodysize[" + i + "] = " + list[i].decodedbodysize); else console.log("... ...
...And 2 more matches
SVGFECompositeElement - Web APIs
svg_fecomposite_...
...-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgfecompositeelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constants name value description svg_fecomposite_operator_unknown 0 the type is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_fecomposite_operator_over 1 corresponds to the over value. svg_fecomposite_operator_in 2 corresponds to the in value. svg_fecomposite_operator_out 3 corresponds to out value. svg_fecomposite_operator_atop 4 corresponds to atop value. svg_fecomposite_operato...
... properties this interface also inherits properties from its parent interface, svgelement, and also implements properties of svgfilterprimitivestandardattributes. svgfecompositeelement.in1 read only an svganimatedstring corresponding to the in attribute of the given element. ...
...And 2 more matches
SVGRenderingIntent - Web APIs
the svgrenderingintent interface defines the enumerated list of possible values for rendering-intent attributes or descriptors. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/svgrenderingintent" target="_top"><rect x="1" y="1" width="180" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="91" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgrenderingintent</text></a></svg></div> a:hover t...
...#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="91" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgrenderingintent</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} warning: this interface was removed in the svg 2 specification. constants name value description rendering_intent_unknown 0 the type is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. rendering_intent_auto 1 corresponds to the value auto. rendering_intent_perceptual 2 corresponds to the value perceptual. rendering_intent_relativ...
... properties this interface doesn't implement any specific properties. ...
...And 2 more matches
SVGTransform - Web APIs
svg_transform_matrix 1 a matrix(…) transformation svg_transform_translate 2 a translate(…) transformation svg_transform_scale 3 a...
... svg_transform_translate = 2 svg_transform_scale = 3 svg_transform_rotate = 4 svg_transform_skewx = 5 svg_transform_skewy = 6 normative document svg 1.1 (2nd edition) constants name value description svg_transform_unknown 0 the unit type is not one of predefined unit types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_transform_matrix 1 a matrix(…) transformation svg_transform_translate 2 a translate(…) transformation svg_transform_scale 3 a scale(…) transformation svg_transform_rotate 4 a rotate(…) transformation svg_transform_skewx 5 a skewx(…) transfor...
... angle float a convenience attribute for svg_transform_rotate, svg_transform_skewx and svg_transform_skewy. it holds the angle that was specified. for svg_transform_matrix, svg_transform_translate and svg_transform_scale, angle will be zero. matrix svgmatrix the matrix that r...
...And 2 more matches
SharedWorker() - Web APIs
rigin policy. name optional a domstring specifying an identifying name for the sharedworkerglobalscope representing the scope of the worker, which is mainly useful for debugging purposes. options optional an object containing option properties that can set when creating the object instance. available properties are as follows: type: a domstring specifying the type of worker to create. the value can be classic or module. if not specified, the default used is classic. credentials: a domstring specifying the type of credentials to use for the worker. the value can be omit, same-origin, or include. if not specified, or if type is classic, the default used is omit (no credentials required). name: a domstring specifying an identifying name for the sharedworkerglobalscope representing the ...
... exceptions a securityerror is raised if the document is not allowed to start workers, for example if the url has an invalid syntax or if the same-origin policy is violated. a networkerror is raised if the mime type of the worker script is incorrect. it should always be text/javascript. ...
...r script is incorrect. it should always be text/javascript. a syntaxerror is raised if aurl cannot be parsed. ...
...And 2 more matches
SpeechSynthesis - Web APIs
ext <input>, set the utterance's voice to the voice selected in the <select> element, and start the utterance speaking via the speechsynthesis.speak() method. ...
...to the voice selected in the <select> element, and start the utterance speaking via the speechsynthesis.speak() method. ...
...utterance speaking via the speechsynthesis.speak() method. ...
...And 2 more matches
StereoPannerNode - Web APIs
the stereopannernode interface of the web audio api represents a simple stereo panner node that can be used to pan an audio stream left or right. it is an audionode audio-processing module that positions an incoming audio stream in a stereo image using a low-cost equal-power panning algorithm. the pan property takes a unitless value between -1 (full left pan) and 1 (full right pan). this interface was introduced as a much simpler way to apply a simple panning effect than having to use a full pannernode. number of inputs 1 number of outputs 1 channel count mode "clamped-max" channel count 2 channel interpretation "speakers" constructor stereopannernode() creates a new instance of a stereopannernode object. properties...
.... properties inherits properties from its parent, audionode. stereopannernode.pan read only is an a-rate audioparam representing the amount of panning to apply. methods no specific method; inherits methods from its parent, audionode. example in our stereopannernode example (see source code) html we have a simple <audio> element along with a slider <input> to increase and decrease pan value. in the javascript we create a mediaelementaudiosourcenode and a stereopannernode, and connect the two together using the connect() method. we then use an oninput event handler to change the value of the stereopannernode.pan parameter and update the pan value display when the slider is moved. moving the slider left and right while the music is playing pans the music across to the left and right ...
...rameter and update the pan value display when the slider is moved. moving the slider left and right while the music is playing pans the music across to the left and right speakers of the output, respectively. ...
...And 2 more matches
Storage.setItem() - Web APIs
Web › API › Storage › setItem
exceptions setitem() may throw an exception if the storage is full. particularly, in mobile safari (since ios 5) it always throws when the user enters private mode. ...
... exceptions setitem() may throw an exception if the storage is full. particularly, in mobile safari (since ios 5) it always throws when the user enters private mode. ...
... exceptions setitem() may throw an exception if the storage is full. particularly, in mobile safari (since ios 5) it always throws when the user enters private mode. ...
...And 2 more matches
SubtleCrypto.sign() - Web APIs
Web › API › SubtleCrypto › sign
s an rsapssparams object. to use ecdsa, pass an ecdsaparams object. to use hmac, pass the string "hmac" or an object of the form { "name": "hmac" }. key is a cryptokey object containing the key to be used for signing. if algorithm identifies a public-key cryptosystem, this is the private key. data is an arraybuffer or arraybufferview object containing the data to be signed. return value signature is a promise that fulfills with an arraybuffer containing the signature. exceptions the promise is rejected when the following exception is encountered: invalidaccesserror raised when the signing key is not a key for the request signing algorithm or when trying to use an algorithm that is either unknown or isn't suitable for signing. supported algorithms the web crypto api ...
...ssa-pkcs1-v1_5 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(".rsassa-pkcs1 #message"); let message = messagebox.value; let enc = new textencoder(); return enc.encode(message); } let encoded = getmessageencoding(); let signature = await window.crypto.subtle.sign( "rsassa-pkcs1-v1_5", privatekey, encoded ); rsa-pss 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" textb...
...ncoded ); rsa-pss 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(".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", saltlength: 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 conten...
...And 2 more matches
SubtleCrypto.unwrapKey() - Web APIs
for aes-ctr, aes-cbc, aes-gcm, or aes-kw: pass the string identifying the algorithm or an object of the form { "name": algorithm }, where algorithm is the name of the algorithm. extractable is a boolean indicating whether it will be possible to export the key using subtlecrypto.exportkey() or subtlecrypto.wrapkey(). keyusages is an array indicating what can be done with the key. possible values of the array are: encrypt: the key may be used to encrypt messages. decrypt: the key may be used to decrypt messages. sign: the key may be used to sign messages. verify: the key may be used to verify signatures. derivekey: the key may be used in deriving a new key. derivebits: the key may be used in deriving bits. wrapkey: the key may be used to wrap a key. unwrapkey: ...
...used to encrypt messages. decrypt: the key may be used to decrypt messages. sign: the key may be used to sign messages. verify: the key may be used to verify signatures. derivekey: the key may be used in deriving a new key. derivebits: the key may be used in deriving bits. wrapkey: the key may be used to wrap a key. unwrapkey: the key may be used to unwrap a key return value result is a promise that fulfills with the unwrapped key as a cryptokey object. exceptions the promise is rejected when one of the following exceptions is encountered: invalidaccesserror raised when the unwrapping key is not a key for the requested unwrap algorithm or if the cryptokey.usages value of that key doesn't contain unwrap. notsupported raised when trying to use an algorithm ...
...e aes-kw unwrapping key. the salt needs to be the same as the salt that was used to derive the original aes-kw key wrapping key. once we have the unwrapping key we pass it into unwrapkey() with the wrapped key and other parameters. see the complete code on github. /* salt that is to be used in derivation of the key-wrapping key, alongside the password the user supplies. this must match the salt value that was originally used to derive the key. */ const saltbytes = [89,113,135,234,168,204,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. */ f...
...And 2 more matches
TextDecoder.prototype.decode() - Web APIs
code. options optional is a textdecodeoptions dictionary with the property: stream a boolean flag indicating that additional data will follow in subsequent calls to decode(). set to true if processing the data in chunks, and false for the final chunk or if the data is not chunked. it defaults to false. example this example encodes and decodes the euro symbol, €. ...
...is a textdecodeoptions dictionary with the property: stream a boolean flag indicating that additional data will follow in subsequent calls to decode(). set to true if processing the data in chunks, and false for the final chunk or if the data is not chunked. it defaults to false. example this example encodes and decodes the euro symbol, €. ...
...ary with the property: stream a boolean flag indicating that additional data will follow in subsequent calls to decode(). set to true if processing the data in chunks, and false for the final chunk or if the data is not chunked. it defaults to false. example this example encodes and decodes the euro symbol, €. ...
...And 2 more matches
TextTrack - Web APIs
Web › API › TextTrack
tive if the current playback position of the media is between the cues' start and end times. thus, for displayed cues such as captions or subtitles, the active cues are currently being displayed. texttrack.cues read only a texttrackcuelist which contains all of the track's cues. texttrack.id read only a domstring which identifies the track, if it has one. ...
... texttrack.label read only a human-readable domstring which contains the text track's label, if one is present; otherwise, this is an empty string (""), in which case a custom label may need to be generated by your code using other attributes of the track, if the track's label needs to be exposed to the user. ...
...ble domstring which contains the text track's label, if one is present; otherwise, this is an empty string (""), in which case a custom label may need to be generated by your code using other attributes of the track, if the track's label needs to be exposed to the user. texttrack.language read only a domstring which specifies the text language in which the text track's contents is written. ...
...And 2 more matches
ValidityState.rangeOverflow - Web APIs
when true, the element matches the :invalid and :out-of-range css pseudo-classes. ...
...when true, the element matches the :invalid and :out-of-range css pseudo-classes. ...
...when true, the element matches the :invalid and :out-of-range css pseudo-classes. ...
...And 2 more matches
ValidityState.rangeUnderflow - Web APIs
when true, the element matches the :invalid and :out-of-range css pseudo-classes. ...
...when true, the element matches the :invalid and :out-of-range css pseudo-classes. ...
...when true, the element matches the :invalid and :out-of-range css pseudo-classes. ...
...And 2 more matches
Vibration API - Web APIs
s 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(). ...
...e 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(). ...
...pattern of vibrations and pauses. vibration is controlled with a single method: navigator.vibrate(). a single vibration you may pulse the vibration hardware one time by specifying either a single value or an array consisting of only one value: window.navigator.vibrate(200); window.navigator.vibrate([200]); both of these examples vibrate the device for 200 ms. vibration patterns an array of values describes alternating periods in which the device is vibrating and not vibrating. each value in the array is converted to an integer, then interpreted alternately as the number of milliseconds the device should vibrate and the number of milliseconds it should not be vibrating. for example: window.navigator.vibrate([200, 100, 200]); this vibrates the device for 200 ms, then pauses for 100 ms b...
...And 2 more matches
WaveShaperNode.WaveShaperNode() - Web APIs
t, options) parameters inherits parameters from the audionodeoptions dictionary. context a reference to an audiocontext. options optional options are as follows: curve: the shaping curve used for the waveshaping effect. the input signal is nominally within the range [-1;1]. oversample: specifies what type of oversampling (if any) should be used when applying the shaping curve. valid values are 'none', '2x', or '4x'. the default is 'none'. return value a new waveshapernode object instance. specifications specification status comment web audio apithe definition of 'waveshapernode()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if y...
...ompat-data and send us a pull request. ...
... full support 53ie no support noopera full support 42safari ? ...
...And 2 more matches
WebGLRenderingContext.checkFramebufferStatus() - Web APIs
the webglrenderingcontext.checkframebufferstatus() method of the webgl api returns the completeness status of the webglframebuffer object. syntax glenum gl.checkframebufferstatus(target); parameters target a glenum specifying the binding point (target). possible values: gl.framebuffer: collection buffer data storage of color, alpha, depth and stencil buffers used to render an image. when using a webgl 2 context, the following values are available additionally: gl.draw_framebuffer: equivalent to gl.framebuffer. used as a destination for drawing, rendering, clearing, and writing operations. gl.read_framebuffer: used as a source for reading operations. return value a glenum indicating the completeness status of the framebuffer or 0 if an error occurs. possi...
... gl.framebuffer_incomplete_attachment: the attachment types are mismatched or not all framebuffer attachment points are framebuffer attachment complete. gl.framebuffer_incomplete_missing_attachment: there is no attachment. ...
...hment points are framebuffer attachment complete. gl.framebuffer_incomplete_missing_attachment: there is no attachment. gl.framebuffer_incomplete_dimensions: height and width of the attachment are not the same. gl.framebuffer_unsupported: the format of the attachment is not supported or if depth and stencil attachments are not the same renderbuffer. ...
...And 2 more matches
WebGLRenderingContext.compressedTexImage[23]D() - Web APIs
mage3d(target, level, internalformat, width, height, depth, border, glsizei imagesize, glintptr offset); void gl.compressedteximage3d(target, level, internalformat, width, height, depth, border, arraybufferview srcdata, optional srcoffset, optional srclengthoverride); parameters target a glenum specifying the binding point (target) of the active texture. 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. gl.texture_cube_map_positive_y: positive y face for a cube-mapped texture. gl.texture_cube_map_negative_y: negative y face for a cube-mapped texture. gl.texture_cube_...
...e. 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-mapped texture. gl.texture_cube_map_negative_y: negative y face for a cube-mapped texture. gl.texture_cube_map_positive_z: positive z face for a cube-mapped texture. gl.texture_cube_map_negative_z: negative z face for a cube-mapped texture. ...
...or a cube-mapped texture. possible values for compressedteximage3d: gl.texture_2d_array gl.texture_3d level a glint specifying the level of detail. level 0 is the base image level and level n is the nth mipmap reduction level. internalformat a glenum specifying the compressed image format. compressed image formats must be enabled by webgl extensions before using this method. all values are possible for compressedteximage2d. see compressed texture formats for which are valid for compressedteximage3d. ...
...And 2 more matches
WebGLRenderingContext.stencilFunc() - Web APIs
gl.less: pass if (ref & mask) < (stencil & mask). gl.equal: pass if (ref & mask) = (stencil & mask). gl.lequal: pass if (ref & mask) <= (stencil & mask). ...
... gl.less: pass if (ref & mask) < (stencil & mask). gl.equal: pass if (ref & mask) = (stencil & mask). gl.lequal: pass if (ref & mask) <= (stencil & mask). gl.greater: pass if (ref & mask) > (stencil & mask). ...
...(ref & mask) < (stencil & mask). gl.equal: pass if (ref & mask) = (stencil & mask). gl.lequal: pass if (ref & mask) <= (stencil & mask). gl.greater: pass if (ref & mask) > (stencil & mask). gl.notequal: pass if (ref & mask) != (stencil & mask). gl.gequal: pass if (ref & mask) >= (stencil & mask). gl.always: always pass. ref a glint specifying the reference value for the stencil test. this value is clamped to the range 0 to 2n -1 where n is the number of bitplanes in the stencil buffer. the default value is 0. mask a gluint specifying a bit-wise mask that is used to and the reference value and the stored stencil value when the test is done. the default value is all 1. return value none. examples the stencil testing is disabled by default. to enable...
...And 2 more matches
WebGLRenderingContext.texParameter[fi]() - Web APIs
the webglrenderingcontext.texparameter[fi]() methods of the webgl api set texture parameters. syntax void gl.texparameterf(glenum target, glenum pname, glfloat param); void gl.texparameteri(glenum target, glenum pname, glint param); parameters target a glenum specifying the binding point (target). possible values: gl.texture_2d: a two-dimensional texture. gl.texture_cube_map: a cube-mapped texture. when using a webgl 2 context, the following values are available additionally: gl.texture_3d: a three-dimensional texture. gl.texture_2d_array: a two-dimensional array texture. the pname parameter is a glenum specifying the texture parameter to set. the param parameter is a glfloat or glint specifying the value for the specified parameter pname. pna...
... gl.texture_2d_array: a two-dimensional array texture. the pname parameter is a glenum specifying the texture parameter to set. the param parameter is a glfloat or glint specifying the value for the specified parameter pname. pname description param available in webgl 1 gl.texture_mag_filter texture magnification filter gl.linear (default value), gl.nearest. gl.texture_min_filter texture minification filter gl.linear, gl.nearest, gl.nearest_mipmap_nearest, gl.linear_mipmap_nearest, gl.nearest_mipmap_linear (default value), gl.linear_mipmap_linear. gl.texture_wrap_s wrapping function for texture coordinate s gl.repeat (default value),gl.clamp_to_edge, gl.mirrored_repeat. gl.texture_wrap_t wrappin...
...inification filter gl.linear, gl.nearest, gl.nearest_mipmap_nearest, gl.linear_mipmap_nearest, gl.nearest_mipmap_linear (default value), gl.linear_mipmap_linear. gl.texture_wrap_s wrapping function for texture coordinate s gl.repeat (default value),gl.clamp_to_edge, gl.mirrored_repeat. gl.texture_wrap_t wrapping function for texture coordinate t gl.repeat (default value),gl.clamp_to_edge, gl.mirrored_repeat. additionally available when using the ext_texture_filter_anisotropic extension ext.texture_max_anisotropy_ext maximum anisotropy for a texture a glfloat value. additionally available when using a webgl 2 context gl.texture_base_level texture mipmap level any int values. gl.texture_compare_func textu...
...And 2 more matches
WebGLRenderingContext.texSubImage2D() - Web APIs
vel, xoffset, yoffset, width, height, format, type, imagebitmap source); void gl.texsubimage2d(target, level, xoffset, yoffset, width, height, format, type, imagedata source); void gl.texsubimage2d(target, level, xoffset, yoffset, width, height, format, type, arraybufferview srcdata, srcoffset); parameters target a glenum specifying the binding point (target) of the active texture. possible values: gl.texture_2d: a two-dimensional texture. gl.texture_cube_map_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-mapped texture. gl.texture_cube_map_negative_y: negative y face for a cube-mapped texture. gl.texture_cube_map_positive_z: positive ...
...e by height-wide rectangular subregion of the texture array. yoffset a glint specifying the lower left texel y coordinate of a width-wide by height-wide rectangular subregion of the texture array.. width a glsizei specifying the width of the texture in texels. height a glsizei specifying the height of the texture in texels. format a glenum specifying the format of the texel data. possible values: gl.alpha: discards the red, green and blue components and reads the alpha component. gl.rgb: discards the alpha components and reads the red, green and blue components. gl.rgba: red, green, blue and alpha components are read from the color buffer. gl.luminance: each color component is a luminance component, alpha is 1.0. gl.luminance_alpha: each component is a luminance/alpha compon...
...ds the red, green and blue components. gl.rgba: red, green, blue and alpha components are read from the color buffer. gl.luminance: each color component is a luminance component, alpha is 1.0. gl.luminance_alpha: each component is a luminance/alpha component. when using the ext_srgb extension: ext.srgb_ext ext.srgb_alpha_ext when using a webgl 2 context, the following values are available additionally: gl.red gl.rg gl.red_integer gl.rg_integer gl.rgb_integer gl.rgba_integer type a glenum specifying the data type of the texel data. possible values: gl.unsigned_byte: 8 bits per channel for gl.rgba gl.unsigned_short_5_6_5: 5 red bits, 6 green bits, 5 blue bits. gl.unsigned_short_4_4_4_4: 4 red bits, 4 green bits, 4 blue ...
...And 2 more matches
WebGLRenderingContext.uniformMatrix[234]fv() - Web APIs
the webglrenderingcontext.uniformmatrix[234]fv() methods of the webgl api specify matrix values for uniform variables. the three versions of this method (uniformmatrix2fv(), uniformmatrix3fv(), and uniformmatrix4fv()) take as the input value 2-component, 3-component, and 4-component square matrices, respectively. they are expected to have 4, 9 or 16 floats. syntax webglrenderingcontext.uniformmatrix2fv(location, transpose, value); webglrenderingcontext.uniformmatrix3fv(location, transpose, value); webglrenderingcontext.uniformmatrix4fv(location, transpose, value); parameters location a webgluniformlocation object containing the location of the uniform attribute to modify. the location is obtained using getuniformlocation(). transpose a glboolean specifying whether to transpose the ...
... recommendation initial definition. ...
... recommendation initial definition. ...
...And 2 more matches
Adding 2D content to a WebGL context - Web APIs
on. the vertex shader can, as needed, also do things like determine the coordinates within the face's texture of the texel to apply to the vertex, apply the normals to determine the lighting factor to apply to the vertex, and so on. this information can then be stored in varyings or attributes as appropriate to be shared with the fragment shader. our vertex shader below receives vertex position values from an attribute we define called avertexposition. that position is then multiplied by two 4x4 matrices we provide called uprojectionmatrix and umodelviewmatrix; gl_position is set to the result. for more info on projection and other matrixes you might find this article useful. // vertex shader program const vssource = ` attribute vec4 avertexposition; uniform mat4 umodelviewmatr...
...and the source code, then creates and compiles the shader as follows: a new shader is created by calling gl.createshader(). the shader's source code is sent to the shader by calling gl.shadersource(). once the shader has the source code, it's compiled using gl.compileshader(). to check to be sure the shader successfully compiled, the shader parameter gl.compile_status is checked. to get its value, we call gl.getshaderparameter(), specifying the shader and the name of the parameter we want to check (gl.compile_status). if that's false, we know the shader failed to compile, so show an alert with log information obtained from the compiler using gl.getshaderinfolog(), then delete the shader and return null to indicate a failure to load the shader. if the shader was loaded and successfully co...
... the shader. if the shader was loaded and successfully compiled, the compiled shader is returned to the caller. to use this code we call it like this const shaderprogram = initshaderprogram(gl, vssource, fssource); after we've created a shader program we need to look up the locations that webgl assigned to our inputs. in this case we have one attribute and two uniforms. attributes receive values from buffers. each iteration of the vertex shader receives the next value from the buffer assigned to that attribute. uniforms are similar to javascript global variables. they stay the same value for all iterations of a shader. since the attribute and uniform locations are specific to a single shader program we'll store them together to make them easy to pass around const programinfo = { ...
...And 2 more matches
Inputs and input sources - Web APIs
s as (x, y, -z); z is negative since the grip space is farther away along the z axis, and is thus in the negative direction. ...
...ve since the grip space is farther away along the z axis, and is thus in the negative direction. if the controller were instead positioned to the left of and closer to the user than the world space origin (or possibly behind the user, if the user is located at the origin, although that's an uncomfortable way to hold a controller), the coordinates would have a negative value for x, but a positive value for z. the value of y would still be positive unless the controller was moved below the world space origin. this is shown in the diagram below, in which the controller is located down and to the left of the world space's origin, with the controller also moved to be closer to us than the origin. as a result, the values of x and y are both negative, while z is positive. mapping a grip space to ...
...rmation describing that input source and how it can be used. those names are found in the input source's profiles property, and the official registry of these profile strings is maintained in the webxr input profiles registry on github. for example, the generic-trigger-squeeze-touchpad profile name can be used to locate the following json profile data by locating the profileid field that has the value generic-trigger-squeeze-touchpad. { "profileid": "generic-trigger-squeeze-touchpad", "fallbackprofileids": [], "layouts" : { "left-right-none" : { "selectcomponentid": "xr-standard-trigger", "components": { "xr-standard-trigger": { "type": "trigger" }, "xr-standard-squeeze": { "type": "squeeze" }, "xr-sta...
...And 2 more matches
Starting up and shutting down a WebXR session - Web APIs
rdware and drivers available on the user's equipment. there is a global xrsystem object available for use by your document through the the navigator property xr, which returns the xrsystem object if suitable xr hardware is available for your use given the hardware available and your document's environment. thus the simplest code that fetches the xrsystem object is: const xr = navigator.xr; the value of xr will be null or undefined if webxr isn't available. webxr availability as a new and still in development api, webxr support is limited to specific devices and browsers; and even on those, it may not be enabled by default. there may be options available to allow you to experiment with webxr even if you don't have a compatible system, however. webxr polyfill the team designing the webxr s...
...u can be advised when the set of available immersive devices changes. obtain a webgl context for the canvas into which you intend to render your frames by calling the htmlcanvaselement method getcontext() on the target context. set up your webgl data and models and prepare to render the scene. set the webgl context as the source for the xr system by creating an xrwebgllayer and passing set the value of the session's renderstate property baselayer. perform calculations for the initial position and scale of your objects as needed. begin the frame rendering cycle. in basic form, code to do this final setup might look something like this: async function runsession(session) { let worlddata; session.addeventlistener("end", onsessionend); let canvas = document.queryselector("canvas"); ...
...your player's viewpoint starts in the exact center of the world. but most likely, that's not the case at all. if that's so, you call getoffsetreferencespace() on the initial reference space to create a new reference space which offsets the coordinate system so that (0, 0, 0) is located at the position of the viewer, with the orientation likewise shifted to face in the desired direction. the input value into getoffsetreferencespace() is an xrrigidtransform encapsulating the player's position and orientation as specified in the default world coordinates. with the new reference space in hand and stored into the worlddata object for safe-keeping, we call the session's requestanimationframe() method to schedule a callback to be executed when it's time to render the next frame of animation for the w...
...And 2 more matches
Visualizations with Web Audio API - Web APIs
distortion.connect(audioctx.destination); note: you don't need to connect the analyser's output to another node for it to work, as long as the input is connected to the source, either directly or via another node. the analyser node will then capture audio data using a fast fourier transform (fft) in a certain frequency domain, depending on what you specify as the analysernode.fftsize property value (if no value is specified, the default is 2048.) note: you can also specify a minimum and maximum power value for the fft data scaling range, using analysernode.mindecibels and analysernode.maxdecibels, and different data averaging constants using analysernode.smoothingtimeconstant. read those pages to get more information on how to use them. to capture data, you need to use the methods analy...
...e the data before invoking one. the first one produces 32-bit floating point numbers, and the second and third ones produce 8-bit unsigned integers, therefore a standard javascript array won't do — you need to use a float32array or uint8array array, depending on what data you are handling. so for example, say we are dealing with an fft size of 2048. we return the analysernode.frequencybincount value, which is half the fft, then call uint8array() with the frequencybincount as its length argument — this is how many data points we will be collecting, for that fft size. analyser.fftsize = 2048; var bufferlength = analyser.frequencybincount; var dataarray = new uint8array(bufferlength); to actually retrieve the data and copy it into our array, we then call the data collection method we want, ...
... canvas width by the array length (equal to the frequencybincount, as defined earlier on), then define an x variable to define the position to move to for drawing each segment of the line. ...
...And 2 more matches
Web Audio API - Web APIs
ediastreamaudiosourcenode). in fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave. outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. a common modification is multiplying the samples by a value to make them louder or quieter (as is the case with gainnode). once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (audiocontext.destination), which sends the sound to the speakers or headphones. this last connection is only necessary if the user is supposed to hear the audio. a simple, typical workflow for web audio would look s...
...context. audionode the audionode interface represents an audio-processing module like an audio source (e.g. an html <audio> or <video> element), audio destination, intermediate processing module (e.g. a filter like biquadfilternode, or volume control like gainnode). audioparam the audioparam interface represents an audio-related parameter, like one of an audionode. it can be set to a specific value or a change in value, and can be scheduled to happen at a specific time and following a specific pattern. audioparammap provides a maplike interface to a group of audioparam interfaces, which means it provides the methods foreach(), get(), has(), keys(), and values(), as well as a size property. baseaudiocontext the baseaudiocontext interface acts as a base definition for online and offline a...
...the keyboard allows you to switch among the standard waveforms as well as one custom waveform, and you can control the master gain using a volume slider beneath the ...
...And 2 more matches
Window - Web APIs
Web › API › Window
ore data that may only be accessed by the origin that created it. window.menubar read only returns the menubar object, whose visibility can be toggled in the window. window.messagemanager returns the message manager object for this window. window.mozinnerscreenx read only returns the horizontal (x) coordinate of the top-left corner of the window's viewport, in screen coordinates. this value is reported in css pixels. see mozscreenpixelspercsspixel in nsidomwindowutils for a conversion factor to adapt to screen pixels if needed. window.mozinnerscreeny read only returns the vertical (y) coordinate of the top-left corner of the window's viewport, in screen coordinates. this value is reported in css pixels. see mozscreenpixelspercsspixel for a conversion factor to adapt to screen p...
...returns the number of times the current document has been rendered to the screen in this window. this can be used to compute rendering performance. window.orientation read only returns the orientation in degrees (in 90 degree increments) of the viewport relative to the device's natural orientation. window.pkcs11 formerly provided access to install and remove pkcs11 modules. window.returnvalue the return value to be returned to the function that called window.showmodaldialog() to display the window as a modal dialog. methods this interface inherits methods from the eventtarget interface and implements methods from windoworworkerglobalscope and eventtarget. window.alert() displays an alert dialog. window.blur() sets focus away from the window. window.cancelanimationframe() ...
...ndow.close() closes the current window. window.confirm() displays a dialog with a message that the user needs to respond to. window.dump() writes a message to the console. window.find() searches for a given string in a window. window.focus() sets focus on the current window. window.getcomputedstyle() gets computed style for the specified element. computed style indicates the computed values of all css properties of the element. window.getdefaultcomputedstyle() gets default computed style for the specified element, ignoring author stylesheets. window.getselection() returns the selection object representing the selected item(s). window.matchmedia() returns a mediaquerylist object representing the specified media query string. window.maximize() fixme: needscontents window.m...
...And 2 more matches
XMLHttpRequest.getAllResponseHeaders() - Web APIs
eaders() returns all the response headers, separated by crlf, as a string, or returns null if no response has been received. if a network error happened, an empty string is returned. note: for multipart requests, this returns the headers from the current part of the request, not from the original channel. syntax var headers = xmlhttprequest.getallresponseheaders(); parameters none. return value a bytestring representing all of the response's headers (except those whose field name is set-cookie or set-cookie2) separated by crlf, or null if no response has been received. if a network error happened, an empty string is returned. an example of what a raw header string looks like: date: fri, 08 dec 2017 21:04:30 gmt\r\n content-encoding: gzip\r\n x-content-type-options: nosniff\r\n server...
...s, 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, xmlhttprequest.onreadystatechange. the code shows how to obtain the raw header string, as well as how to convert it into an array of individual headers and then how to take that array and create a mapping of header names to their values. var request = new xmlhttprequest(); request.open("get", "foo.txt", true); request.send(); request.onreadystatechange = function() { if(this.readystate == this.headers_received) { // get the raw header string var headers = request.getallresponseheaders(); // convert the header string into an array // of individual headers var arr = headers.trim().split(/[\r\n]+/); ...
... specifications ...
...And 2 more matches
XMLHttpRequest.getResponseHeader() - Web APIs
the xmlhttprequest method getresponseheader() returns the string containing the text of a particular header's value. if there are multiple response headers with the same name, then their values are returned as a single concatenated string, where each value is separated from the previous one by a pair of comma and space. the getresponseheader() method returns the value as a utf byte sequence. note: the search for the header name is case-insensitive. if you need to get the raw string of all of the headers, use the getallresponseheaders() method, which returns the entire raw header string. ...
... as a utf byte sequence. note: the search for the header name is case-insensitive. if you need to get the raw string of all of the headers, use the getallresponseheaders() method, which returns the entire raw header string. ...
...ence. note: the search for the header name is case-insensitive. if you need to get the raw string of all of the headers, use the getallresponseheaders() method, which returns the entire raw header string. syntax var myheader = xmlhttprequest.getresponseheader(headername); parameters headername a bytestring indicating the name of the header you want to return the text value of. ...
...And 2 more matches
XMLHttpRequest.responseType - Web APIs
the xmlhttprequest property responsetype is an enumerated string value specifying the type of data contained in the response. it also lets the author change the response type. if an empty string is set as the value of responsetype, the default value of text is used. syntax var type = xmlhttprequest.responsetype; xmlhttprequest.responsetype = type; value a string taken from the xmlhttprequestresponsetype enum which specifies what type of data the response contains. when setting responsetype to a particular value, the author should make sure that the server is actually sending a response compatible with that format. ...
... arraybuffer the response is a javascript arraybuffer containing binary data. blob the response is a blob object containing the binary data. ...
... arraybuffer the response is a javascript arraybuffer containing binary data. ...
...And 2 more matches
XRReferenceSpace.getOffsetReferenceSpace() - Web APIs
s is demonstrated in the example implementing rotation based on non-xr inputs, which demonstrates a way to use this method to let the user use their mouse to pitch and yaw their viewing angle. syntax offsetreferencespace = xrreferencespace.getoffsetreferencespace(originoffset); parameters originoffset an xrrigidtransform specifying the offset to the origin of the new reference space. ...
...gle. syntax offsetreferencespace = xrreferencespace.getoffsetreferencespace(originoffset); parameters originoffset an xrrigidtransform specifying the offset to the origin of the new reference space. these values are added to the position and orientation of the current reference space and then the result is used as the position and orientation of the newly created xrreferencespace. return value a new xrreferencespace object describing a reference space with the same native origin as the reference space on which the method was called, but with an origin offset indicating the distance from the object to the point given by originoffset. if the object on which you call this method is an xrboundedreferencespace, the returned object is one as well. the boundsgeometry of the new reference sp...
...nts the right-clicks from causing the context menu from appearing in the browser. canvas.oncontextmenu = (event) => { event.preventdefault(); }; canvas.addeventlistener("mousemove", (event) => { if (event.buttons & 2) { rotateviewby(event.movementx, event.movementy); } }); next, the rotateviewby() function, which updates the mouse look direction's yaw and pitch based on the mouse delta values from the mousemove event. the pitch is restricted so that you can't look beyond straight up and straight down. each time this is called, the new offsets are used to update the current values of mousepitch and mouseyaw. let mouseyaw = 0.0; let mousepitch = 0.0; const inverseorientation = quat.create(); const mouse_speed = 0.003; function rotateviewby(dx, dy) { mouseyaw += dx * mouse_speed; ...
...And 2 more matches
XRSession.environmentBlendMode - Web APIs
the xrsession interface's read-only environmentblendmode property identifies if—and to what degree—the computer-generated imagery is overlaid atop the real world. this is used to differentiate between fully-immersive vr sessions and ar sessions which render over a pass-through image of the real world, possibly partially transparently. the value is a domstring which contains one of the values defined by the xrenvironmentblendmode enumerated type. ...
... image of the real world, possibly partially transparently. the value is a domstring which contains one of the values defined by the xrenvironmentblendmode enumerated type. important: environmentblendmode is part of the webxr augmented reality module, which has not yet reached a stable state. you should use caution when using its features. syntax blendmode = xrsession.environmentblendmode; value a domstring whose value is one of the strings found in the enumerated type xrenvironmentblendmode, defining if—and if so, how—virtual, rendered content is overlaid atop the image of the real world. permitted values are: opaque the rendered image is drawn without allowing any pass-through imagery. this is primarily used by fully-immersive vr headsets, which totally obscure the surroundin...
...environmentblendmode, defining if—and if so, how—virtual, rendered content is overlaid atop the image of the real world. permitted values are: opaque the rendered image is drawn without allowing any pass-through imagery. this is primarily used by fully-immersive vr headsets, which totally obscure the surrounding environment, with none of the real world shown to the user at all. the alpha values specified in the xrsession's renderstate property's baselayer field are ignored since the alpha values for the rendered imagery are all treated as being 1.0 (fully opaque). additive primarily used by ar devices with transparent lenses which directly allow reality to pass through to the user's eyes, the additive blending mode is designed to be used in a situation in which the device has no cont...
...And 2 more matches
XRWebGLLayer() - Web APIs
r the specified webxr session. layerinit optional an object conforming to the xrwebgllayerinit dictionary, providing configuration options for the new xrwebgllayer. the options available are: alpha optional the frame buffer's color buffer will be established with an alpha channel if the alpha boolean property is true. otherwise, the color buffer will not have an alpha channel. ...
...onal an object conforming to the xrwebgllayerinit dictionary, providing configuration options for the new xrwebgllayer. the options available are: alpha optional the frame buffer's color buffer will be established with an alpha channel if the alpha boolean property is true. otherwise, the color buffer will not have an alpha channel. the default value is true. antialias optional a boolean value which is true if anti-aliasing is to be used when rendering in the context; otherwise false. the browser selects the anti-aliasing method to use; there is no support for requesting a specific mode yet. the default value is true. depth optional a boolean value which, if true, requests that the new layer have a depth buffer; otherwise, no depth layer is allocated. the default is true. framebuff...
...used when rendering in the context; otherwise false. the browser selects the anti-aliasing method to use; there is no support for requesting a specific mode yet. the default value is true. depth optional a boolean value which, if true, requests that the new layer have a depth buffer; otherwise, no depth layer is allocated. the default is true. framebufferscalefactor optional a floating-point value which is used to scale the image during compositing, with a value of 1.0 represents the default pixel size for the frame buffer. ...
...And 2 more matches
XSLTProcessor - Web APIs
syntax the constructor has no parameters. new xsltprocessor() methods [throws] void xsltprocessor.importstylesheet(node stylesheet) imports the xslt stylesheet. ...
...function. the resultant object depends on the output method of the stylesheet: output method result type html htmldocument xml xmldocument text xmldocument with a single root element <transformiix:result> with the text as a child [throws] void xsltprocessor.setparameter(string namespaceuri, string localname, any value) sets a parameter in the xslt stylesheet that was imported. (sets the value of an <xsl:param>.) a null value for namespaceuri is treated the same as an empty string. [throws] any xsltprocessor.getparameter(string namespaceuri, string localname) gets the value of a parameter from the xslt stylesheet. a null value for namespaceuri is treated the same as an empty string. [throws] void xsltproces...
... void xsltprocessor.clearparameters() removes all set parameters from the xsltprocessor. the xsltprocessor will then use the defaults specified in the xslt stylesheet. ...
...And 2 more matches
Using the aria-invalid attribute - Accessibility
description this technique demonstrates how to use the aria-invalid attribute. the aria-invalid attribute is used to indicate that the value entered into an input field does not conform to the format expected by the application.this may include formats such as email addresses or telephone numbers. aria-invalid can also be used to indicate that a required field has not been filled in.the attribute should be programmatically set as a result of a validation process. this attribute can be used with any typical html form element; it is not limited to elements that have an aria role assigned. values vocabulary: false (default) no errors detected grammar a grammatical error has been detected. spelling a spelling error has been detected. true the value has failed validation. ...
... possible effects on user agents and assistive technology user agents should inform the user when a field is invalid. ...
...ent a form from being submitted. note: opinions may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples example 1: simple form validation the following snippet shows a simplified version of two form fields with a validation function attached to the blur event. note that since the default value for aria-required is false, it is not strictly necessary to add the attribute to input. <input name="name" id="name" aria-required="true" aria-invalid="false" onblur="checkvalidity('name', ' ', 'invalid name entered (requires both first and last name)');"/> <br /> <input name="email" id="email" aria-required="true" aria-invalid="false" onblur="checkvalidity('email', '@', 'inv...
...And 2 more matches
ARIA: checkbox role - Accessibility
ole="checkbox" can expose three states through the aria-checked attribute: true, false, or mixed. since a checkbox is an interactive control, it must be focusable and keyboard accessible. if the role is applied to a non-focusable element, use the tabindex attribute to change this. the expected keyboard shortcut for activating a checkbox is the space key. ...
...cusable and keyboard accessible. if the role is applied to a non-focusable element, use the tabindex attribute to change this. the expected keyboard shortcut for activating a checkbox is the space key. the developer is required to change the value of the aria-checked attribute dynamically when the checkbox is activated. associated wai-aria roles, states, and properties aria-checked the value of aria-checked defines the state of a checkbox. this attribute has one of three possible values: true the checkbox is checked false the checkbox is not checked mixed the checkbox is partially checked, or indeterminate tabindex="0" used to make it focusable so the assistive technology user can tab to it and start reading right away. keyboard interactions ke...
...eckbox is partially checked, or indeterminate tabindex="0" used to make it focusable so the assistive technology user can tab to it and start reading right away. ...
...And 2 more matches
Alerts - Accessibility
each field has a set of criteria which must be met in order to pass validation. in order to simplify this example, we’ll check whether the e-mail address contai...
...each field has a set of criteria which must be met in order to pass validation. in order to simplify this example, we’ll check whether the e-mail address contains the “@” symbol, and if the name entry contains at le...
...eral steps: checking if the e-mail address or entered name are valid. each field has a set of criteria which must be met in order to pass validation. in order to simplify this example, we’ll check whether the e-mail address contains the “@” symbol, and if the name entry contains at least 1 character. if the above criteria is not met, the field’s aria-invalid attribute will be given a value of “true”. if the criteria was not met, the user will be notified via an alert. instead of using the javascript ‘alert’ function, we’ll use a simple wai-aria widget for notification. this notifies the user of the error, but allows for them continue modifying the form without losing focus (caused by the “onblur” handler in javascript's default ‘alert’ function). below is examp...
...And 2 more matches
Keyboard - Accessibility
to this rule is if the element has role="document" applied to it, inside an interactive context (such as role="application"). in such a case, focusing the nested document is the only way of returning assistive technology to a non-interactive state (often called "browse mode"). most interactive elements are focusable by default; you can make an element focusable by adding a tabindex=0 attribute value to it. however, you should only add tabindex if you have also made the element interactive, for example, by defining appropriate event handlers keyboard events. see also tabindex global html attribute global event handlers: onkeydown global event handlers: onkeyup avoid using tabindex attribute greater than zero the tabindex attribute indicates that an element is focusable using the keyb...
...however, you should only add tabindex if you have also made the element interactive, for example, by defining appropriate event handlers keyboard events. see also tabindex global html attribute global event handlers: onkeydown global event handlers: onkeyup avoid using tabindex attribute greater than zero the tabindex attribute indicates that an element is focusable using the keyboard. a value of zero indicates that the element is part of the default focus order, which is based on the ordering of elements in the html document. a positive value puts the element ahead of those in the default ordering; elements with positive values are focused in the order of their tabindex values (1, then 2, then 3, etc.). this creates confusion for keyboard-only users when the focus order differs from ...
...e default ordering; elements with positive values are focused in the order of their tabindex values (1, then 2, then 3, etc.). this creates confusion for keyboard-only users when the focus order differs from the logical order of the page. a better strategy is to structure the html document so that focusable elements are in a logical order, without the need to re-order them with positive tabindex values. see also tabindex global html attribute understanding focus order don't use tabindex greater than 0 clickable elements must be focusable and should have interactive semantics if an element can be clicked with a pointing device, such as a mouse, then it should also be focusable using the keyboard, and the user should be able to do something by interacting with it. an element is clickab...
...And 2 more matches
-moz-image-rect - CSS: Cascading Style Sheets
top the top edge, specified as an <integer> or <percentage>, of the sub-image within the specified image. right the right edge, specified as an <integer> or <percentage>, of the sub-image within the specified image. bottom the bottom edge, specified as an <integer> or <percentage>, of the sub-image within the specified image. left the left edge, specified as an <integer> or <percentage>, of the sub-image within the specified image. ...
...ent parts of one larger image as backgrounds in different parts of your content. this works very similarly to the -moz-image-region property, which is used with the list-style-image property to use parts of an image as the bullets in lists. however, this can be used for any css background. the syntax for the rectangle is similar to the rect() function generating a <<shape>()> css type. all four values are relative to the upper left corner of the image. examples this example loads an image and uses it in four segments to draw the firefox logo in four <div> blocks. clicking on their container causes the four segments to rotate around by swapping the background-image property values among the four <div> blocks. css the css defines one container style, then the styles for the four boxes that ...
...mage in a two-by-two box grid. these four segments are all contained within a larger <div> block whose primary purpose is to receive click events and dispatch them to our javascript code. the javascript code this code handles the click event when the container receives a mouse click. ...
...And 2 more matches
-webkit-mask-box-image - CSS: Cascading Style Sheets
<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. ...
... <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. ...
...'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. ...
...And 2 more matches
speak-as - CSS: Cascading Style Sheets
the speak-as descriptor specifies how a counter symbol constructed with a given @counter-style will be represented in the spoken form. for example, an author can specify a counter symbol to be either spoken as its numerical value or just represented with an audio cue. syntax /* keyword values */ speak-as: auto; speak-as: bullets; speak-as: numbers; speak-as: words; speak-as: spell-out; /* @counter-style name value */ speak-as: <counter-style-name>; values auto if the value of speak-as is specified as auto, then the effective value of speak-as will be determined based on the value of the system descriptor: if the value of system is alphabetic, the effective value of speak-as will be spell-out. if system is cyclic, the effective value of speak-as will be bullets. if system is ex...
...value */ speak-as: <counter-style-name>; values auto if the value of speak-as is specified as auto, then the effective value of speak-as will be determined based on the value of the system descriptor: if the value of system is alphabetic, the effective value of speak-as will be spell-out. if system is cyclic, the effective value of speak-as will be bullets. if system is extends, the value of speak-as will be the same as if speak-as: auto is specified on the extended style. for all other cases, specifying auto has the same effect as specifying speak-as: numbers. bullets a phrase or an audio cue defined by the user agent for representing an unordered list item will be read out. numbers the numerical value of the counter will be read out in the document language. words th...
...peak-as: auto is specified on the extended style. for all other cases, specifying auto has the same effect as specifying speak-as: numbers. bullets a phrase or an audio cue defined by the user agent for representing an unordered list item will be read out. numbers the numerical value of the counter will be read out in the document language. words the user agent will generate a counter value as normal and read it out as a word in the document language. spell-out the user agent will generate a counter representation as normal and would read it out letter by letter. if the user agent doesn't know how to read out a partiular counter symbol, the user agent might read it out as if the value of speak-as was numbers. <counter-style-name> the name of another counter style, specified as a...
...And 2 more matches
font-style - CSS: Cascading Style Sheets
the font-style css descriptor allows authors to specify font styles for the fonts specified in the @font-face rule. for a particular font family, authors can download various font faces which correspond to the different styles of the same font family, and then use the font-style descriptor to explicitly specify the font face's style. the values for the css descriptor is same as that of its corresponding font property. syntax font-style: normal; font-style: italic; font-style: oblique; font-style: oblique 30deg; font-style: oblique 30deg 50deg; values normal selects the normal version of the font-family. italic specifies that font-face is an italicized version of the normal font. oblique specifies that the font-face is an artificially sloped version of the normal font. oblique ...
...the normal font. oblique with angle selects a font classified as oblique, and additionally specifies an angle for the slant of the text. oblique with angle range selects a font classified as oblique, and additionally specifies a range of allowable angle for the slant of the text. ...
...lique, and additionally specifies an angle for the slant of the text. oblique with angle range selects a font classified as oblique, and additionally specifies a range of allowable angle for the slant of the text. note that a range is only supported when the font-style is oblique; for font-style: normal or italic, no second value is allowed. ...
...And 2 more matches
@font-face - CSS: Cascading Style Sheets
own computer. syntax @font-face { font-family: "open sans"; src: url("/fonts/opensans-regular-webfont.woff2") format("woff2"), url("/fonts/opensans-regular-webfont.woff") format("woff"); } descriptors font-display determines how a font face is displayed based on whether and when it is downloaded and ready to use. ...
... sans"; src: url("/fonts/opensans-regular-webfont.woff2") format("woff2"), url("/fonts/opensans-regular-webfont.woff") format("woff"); } descriptors font-display determines how a font face is displayed based on whether and when it is downloaded and ready to use. font-family specifies a name that will be used as the font face value for font properties. font-stretch a font-stretch value. ...
... url("/fonts/opensans-regular-webfont.woff") format("woff"); } descriptors font-display determines how a font face is displayed based on whether and when it is downloaded and ready to use. font-family specifies a name that will be used as the font face value for font properties. font-stretch a font-stretch value. since firefox 61 (and in other modern browsers) this also accepts two values to specify a range that is supported by a font-face, for example font-stretch: 50% 200%; font-style a font-style value. since firefox 61 (and in other modern browsers) this also accepts two values to specify a range that is supported by a font-face, for example font-style: oblique 20deg 50deg; font-weight a font-weight value. since firefox 61 (and in other modern browsers) this also accepts ...
...And 2 more matches
color - CSS: Cascading Style Sheets
Web › CSS › @media › color
note: if the various color components are represented by different numbers of bits, the smallest number is used. ...
... note: if the various color components are represented by different numbers of bits, the smallest number is used. ...
... note: if the various color components are represented by different numbers of bits, the smallest number is used. for example, if a display uses 5 bits for blue and red and 6 bits for green, then the device is considered to use 5 bits per color component. ...
...And 2 more matches
height - CSS: Cascading Style Sheets
Web › CSS › @viewport › height
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 ...
.../ 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 definition related at-rule@viewportinitial valueas each of the properties of the shorthand:min-height: automax-height: nonepercentagesas each of the properties of the shorthand:min-height: the percentage 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 percent...
...ach of the properties of the shorthand:min-height: automax-height: nonepercentagesas each of the properties of the shorthand:min-height: the percentage is calculated with respect to the height of the generated box's containing block. ...
...And 2 more matches
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. ...
...ial 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. ...
... 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. ...
...And 2 more matches
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. ...
... 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. ...
... 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. ...
...And 2 more matches
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. ...
...ial 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. ...
... 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. ...
...And 2 more matches
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. ...
...e 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. ...
...lue */ 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. ...
...And 2 more matches
Coordinate systems - CSS: Cascading Style Sheets
the number of pixels offset from the origin along each dimension of the context. this guide describes the standard coordinate systems used by the css object model. these are generally only different in terms of where their origin is located. dimensions in the coordinate systems used by web technologies, convention dictates that the horizontal offset is called the x-coordinate, where a negative value indicates a position to the left of the origin and a positive value is to the right of the origin. the y-coordinate specifies the vertical offset, with a negative value being above the origin and a positive value being below the origin. on the web, the default origin is the top-left corner of a given context (with positive y-coordinate values being below the origin). note that this is unlike mos...
... when drawing 3d graphics, or using a third dimension to layer objects from front to back, the z-coordinate is also used. this specifies the distance away from the viewer if positive and toward the viewer if negative. ...
...t will show the coordinate information is fetched into log. the setcoords() function is designed to accept as input a mouseevent and the name of the origin to use when obtaining the coordinates. the implementation is then quite simple. the variables idx and idy are set to strings with the names of the properties corresponding to the coordinates in the given coordinate system. for example, if the value of type is "page", then idx is "pagex" and idy is "pagey". handling the mouse events setcoords() is called by the event handler for the various mouse events, named update(); this is shown below. function update(e) { setcoords(e, "offset"); setcoords(e, "client"); setcoords(e, "page"); setcoords(e, "screen"); } inner.addeventlistener("mouseenter", update, false); inner.addeventlistener...
...And 2 more matches
Spanning and Balancing Columns - CSS: Cascading Style Sheets
w to make elements span across columns inside the multicol container and how to control how the columns are filled. note the spanning and balancing functionality covered in this guide is not as well supported across browsers as the functionality covered in the previous two sections in this guide. spanning the columns to cause an item to span across columns use the property column-span with a value of all. this will cause the element to span all of the columns. any descendant element of the multicol container may become a spanner including both direct and indirect children. for example, a heading nested directly inside the container could become a spanner, as could a heading nested inside a section nested inside the multicol container. in the example below, the h2 element is set to column...
...is second example, the heading is inside an <article> element, yet still spans the content as expected. when a spanner is introduced, it breaks the flow of columns and columns restart after the spanner, effectively creating a new set of column boxes. the content does not jump over a spanning element. limitations of column-span in the current level 1 specification there are only two allowable values for column-span. the value none is the initial value and means the item does not span, remaining within a column. the value all means the item spans all of the columns. you cannot cause an item to span two out of three columns for example. things to watch out for if the spanning element is inside another element which has margins, padding and a border or a background color, it is possible to e...
...r. use spanning carefully and test at various breakpoints to make sure you get the intended effect. column filling and balancing a balanced set of columns is where all columns have approximately the same amount of content. filling and balancing comes into play when the amount of content does not match the amount of space provided, such as when a height is declared on the container. ...
...And 2 more matches
CSS Containment - CSS: Cascading Style Sheets
any webpages contain a number of sections which are independent of each other. for example a listing of article headlines and content, as in the mark-up below. <h1>my blog</h1> <article> <h2>heading of a nice article</h2> <p>content here.</p> </article> <article> <h2>another heading of another article</h2> <p>more content here.</p> </article> each article has the contain property with a value of content applied in the css. article { contain: content; } each article is independent of the other articles on the page, and so they have been given contain: content in order to indicate to the browser that this is the case. the browser can then use this information to make decisions about how to render the content. for example, it might not render articles that are outside the viewable ar...
...nt; } each article is independent of the other articles on the page, and so they have been given contain: content in order to indicate to the browser that this is the case. the browser can then use this information to make decisions about how to render the content. for example, it might not render articles that are outside the viewable area. if we give each <article> the contain property with a value of content, when new elements are inserted the browser understands it does not need to relayout or repaint any area outside of the containing element's subtree, although if the <article> is styled such that its size depends on its contents (e.g. with height: auto), then the browser may need to account for its size changing). we have told it by way of the contain property that each article is ind...
...lements are inserted the browser understands it does not need to relayout or repaint any area outside of the containing element's subtree, although if the <article> is styled such that its size depends on its contents (e.g. with height: auto), then the browser may need to account for its size changing). we have told it by way of the contain property that each article is independent. the content value is shorthand for contain: layout paint. it tells the browser that the internal layout of the element is totally separate from the rest of the page, and that everything about the element is painted inside its bounds. nothing can visibly overflow. this information is something that is usually known, and in fact quite obvious, to the web developer creating the page. however browsers cannot guess at...
...And 2 more matches
Flow Layout and Overflow - CSS: Cascading Style Sheets
iving an element a fixed height and width, then adding significant content to the box, creates a basic overflow example: the content goes into the box. once it fills the box, it continues to overflow in a visible way, displaying content outside the box, potentially displaying under subsequent content. the property that controls how overflow behaves is the overflow property which has an initial value of visible. this is why we can see the overflow content. controlling overflow there are other values that control how overflow content behaves. to hide overflowing content use a value of hidden. this may cause some of your content to not be visible. using a value of scroll contains the content in its box and add scrollbars to enable viewing it. scrollbars will be added even if the content fi...
...if it doesn’t fit then scrollbars will be added. comparing the next example with the example for overflow: scroll you should see overflow scroll has horizontal and vertical scrollbars when it only needs vertical scrolling. ...
...rollbars if the content fits inside the box. if it doesn’t fit then scrollbars will be added. comparing the next example with the example for overflow: scroll you should see overflow scroll has horizontal and vertical scrollbars when it only needs vertical scrolling. the auto example below only adds the scrollbar in the direct we need to scroll. as we have already learned, using any of these values, other than the default of visible, will create a new block formatting context. note: in the working draft of overflow level 3, there is an additional value overflow: clip. this will act like overflow: hidden however it does not allow for programmatic scrolling, the box becomes non-scrollable. in addition it does not create a block formatting context. the overflow property is in reality a shor...
...And 2 more matches
OpenType font features guide - CSS: Cascading Style Sheets
ld be noted that if letter-spacing is also set on your text, that is applied after kerning. alternates (font-variant-alternates) fonts can supply a number of different alternatives for various glyphs, such as different styles of lower case 'a' or more or less elaborate swashes in a script typeface. this property can activate an entire set of alternates or just a specific one, depending on the values supplied.the example below is showing several different aspects of working with alternate characters. fonts with alternate glyphs can make them available across the board or individually in separate stylistic sets, or even individual characters. in this example you can see two different typefaces, and the introduction of the @font-feature-values at-rule. this is used to define shortcuts or named...
...o various alternate forms of glyphs within a font. the example below shows a string of glyphs with only the opentype set 'jis78' enabled. uncheck the box below and you'll see more characters displayed. note: these glyphs were copied out of a font sample and are not intended as prose. font variant shorthand (font-variant) this is the shorthand syntax for defining all of the above. ...
...example below shows a string of glyphs with only the opentype set 'jis78' enabled. uncheck the box below and you'll see more characters displayed. note: these glyphs were copied out of a font sample and are not intended as prose. font variant shorthand (font-variant) this is the shorthand syntax for defining all of the above. setting a value of normal resets all properties to their initial value. setting a value of none sets font-variant-ligatures to none and all other properties to their initial value. (meaning that if kerning is on by default, it will still be on even with a value of none being supplied here.) font feature settings font-feature-settings is the 'low level syntax' that allows explicit access to every named available opentype feature. this gives a lot of control, but ...
...And 2 more matches
CSS Grid Layout and Progressive Enhancement - CSS: Cascading Style Sheets
that many of us are going to see the majority of users having grid layout support very quickly, there are also old or non-supporting browsers to contend with. in this guide we will walk through a variety of strategies for support. the supporting browsers other than in internet explorer, css grid layout is unprefixed in safari, chrome, opera, firefox and edge. support for all the properties and values detailed in these guides is interoperable across browsers. this means that if you write some grid layout code in firefox, it should work in the same way in chrome. this is no longer an experimental specification, and you are safe to use it in production. the internet explorer and edge situation it should be remembered that the original implementation of css grid layout happened in internet exp...
...if you write some grid layout code in firefox, it should work in the same way in chrome. this is no longer an experimental specification, and you are safe to use it in production. the internet explorer and edge situation it should be remembered that the original implementation of css grid layout happened in internet explorer 10. this early specification did not contain all of the properties and values that the up-to-date specification has. there are also substantial differences between what shipped in ie10 and the current specification, even where the properties and values appear the same. this early implementation is also the version of grid layout implemented in edge up to version 15. the ie/edge (≤15) version of the specification is prefixed with an -ms prefix and the properties impleme...
...eed to be able to define the width for older browsers, and remove the width for grid supporting browsers. thanks to css feature queries i can do this, right in my css. feature queries will look very familiar if you have ever used a media query to create a responsive layout. rather than checking a viewport width, or some feature of the browser or device, we check for support of a css property and value pair using an @supports rule. inside the feature query, we can then write any css we need to apply our modern layout, and remove anything required for the older layout. @supports (display: grid) { .wrapper { /* do anything for grid supporting browsers here. */ } } feature queries have excellent browser support, and all of the browsers that support the updated grid specification...
...And 2 more matches
Relationship of grid layout to other layout methods - CSS: Cascading Style Sheets
owever, and if you have already learned how to use flexbox, the similarities should help you get to grips with grid. one-dimensional vs. two-dimensional layout a simple example can demonstrate the difference between one- and two-dimensional layouts. in this first example, i am using flexbox to lay out a set of boxes. i have five child items in my container, and i have given the flex properties values so that they can grow and shrink from a flex-basis of 150 pixels. i have also set the flex-wrap property to wrap, so that if the space in the container becomes too narrow to maintain the flex basis, items will wrap onto a new row. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ff...
...acts with absolutely positioned elements, which can be useful if you want to position an item inside a grid or grid area. the specification defines the behavior when a grid container is a containing block and a parent of the absolutely positioned item. a grid container as containing block to make the grid container a containing block you need to add the position property to the container with a value of relative, just as you would make a containing block for any other absolutely positioned items. once you have done this, if you give a grid item position: absolute it will take as its containing block the grid container or, if the item also has a grid position, the area of the grid it is placed into. in the below example i have a wrapper containing four child items. item three is absolutely po...
...und-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div class="box1">one</div> <div class="box2">two</div> <div class="box3"> this block is absolutely positioned. in this example the grid container is the containing block and so the absolute positioning offset values are calculated in from the outer edges of the area it has been placed into. </div> <div class="box4">four</div> </div> .wrapper { display: grid; grid-template-columns: repeat(4,1fr); grid-auto-rows: 200px; grid-gap: 20px; position: relative; } .box3 { grid-column-start: 2; grid-column-end: 4; grid-row-start: 1; grid-row-end: 3; position: absolute; top: 40px; left: 4...
...And 2 more matches
Shapes From Images - CSS: Cascading Style Sheets
in this guide we will take a look at how we can create a shape from an image file with an alpha channel or even from a css gradient. this is a very flexible way to create shapes. rather than drawing a path with a complex polygon in css, you can create the shape in a graphics program and then use the path created by the pixels less opaque than a threshold value. a simple shape from an image to use an image for the shape the image needs to have an alpha channel, an area that is not fully opaque. the shape-image-threshold property is used to set a threshold for this opacity. pixels that are more opaque than this value will be used to calculate the area of the shape. as a simple example, i have an image of a star with a solid red area and an area which is fully transparent. i use the path to th...
...the content now wraps around the star shape. i can use shape-margin to move the text away from the shape, giving a margin around the created shape and the text. ...
...hrome the console will alert you to cors problems. in firefox if you inspect the property you will be alerted to the fact that the image could not be loaded. this should alert you to the fact that your image cannot be used as the source of a shape due to cors. setting a threshold the shape-image-threshold property enables the creation of shapes from areas which are not fully transparent. if the value of shape-image-threshold is 0.0 (which is the initial value) then the area must be fully transparent. if the value is 1.0 then it is fully opaque. values in between mean that you can set a semi-transparent area as the defining area. in the example below i am using a similar image to the initial example, however in this image the background of the star is not fully transparent, it has a 20% opaci...
...And 2 more matches
Syntax - CSS: Cascading Style Sheets
Web › CSS › Syntax
the basic goal of the cascading stylesheet (css) language is to allow a browser engine to paint elements of the page with specific features, like colors, positioning, or decorations. the css syntax reflects this goal and its basic building blocks are: the property which is an identifier, that is a human-readable name, that defines which feature is considered. ...
... browser engine to paint elements of the page with specific features, like colors, positioning, or decorations. the css syntax reflects this goal and its basic building blocks are: the property which is an identifier, that is a human-readable name, that defines which feature is considered. the value which describe how the feature must be handled by the engine. each property has a set of valid values, defined by a formal grammar, as well as a semantic meaning, implemented by the browser engine. css declarations setting css properties to specific values is the core function of the css language. a property and value pair is called a declaration, and any css engine calculates which declarations apply to every single element of a page in order to appropriately lay it out, and to style it. bo...
...rmal grammar, as well as a semantic meaning, implemented by the browser engine. css declarations setting css properties to specific values is the core function of the css language. a property and value pair is called a declaration, and any css engine calculates which declarations apply to every single element of a page in order to appropriately lay it out, and to style it. both properties and values are case-insensitive by default in css. the pair is separated by a colon, ':' (u+003a colon), and white spaces before, between, and after properties and values, but not necessarily inside, are ignored. ...
...And 2 more matches
Visual formatting model - CSS: Cascading Style Sheets
ion — vertically in a horizontal, top-to-bottom language. however, you might design something that requires scrolling in the inline dimension too. box generation box generation is the part of the css visual formatting model that creates boxes from the document's elements. generated boxes are of different types, which affect their visual formatting. the type of the box generated depends on the value of the css display property. initially defined in css2, the display property is extended in the css display module level 3. in addition, some of the terminologies around the display have been updated and clarified in the years since css2. css takes your source document and renders it onto a canvas. to do this, it generates an intermediary structure, the box tree, which represents the formatting...
...ee, which represents the formatting structure of the rendered document. each box in the box tree represents its corresponding element (or pseudo-element) in space and/or time on the canvas, while each text run in the box tree likewise represents the contents of its corresponding text nodes. then, for each element, css generates zero or more boxes as specified by that element’s display property value. note: boxes are often referred to by their display type — e.g. a box generated by an element with display: block is called a "block box" or just a "block". note however that block boxes, block-level boxes and box containers are all subtly different; see the block boxes section below for more details. the principal box when an element generates one or more boxes, one of them is the princip...
...ement generates one or more boxes, one of them is the principal box, which contains its descendant boxes and generated content in the box tree, and is also the box involved in any positioning scheme. some elements may generate additional boxes in addition to the principal box, for example display: list-item generates more than one box (e.g. a principal block box and a child marker box). and some values (such as none or contents) cause the element and/or its descendants to not generate any boxes at all. anonymous boxes an anonymous box is created when there is not an html element to use for the box. this situation happens when, for example, you declare display: flex on a parent element, and directly inside there is a run of text not contained in another element. in order to fix the box tree, ...
...And 2 more matches
border-block-color - CSS: Cascading Style Sheets
the border-block-color css property defines the color of the logical block borders of an element, which maps to a physical border color depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-color and border-bottom-color, or border-right-color and border-left-color property depending on the values defined for writing-mode, direction, and text-orientation. ...
...ds to the border-top-color and border-bottom-color, or border-right-color and border-left-color property depending on the values defined for writing-mode, direction, and text-orientation. border-block-color: yellow; border-block-color: #f5f6f7; the border color in the other dimension can be set with border-inline-color which sets border-inline-start-color, and border-inline-end-color. syntax values <'color'> the color of the border. see color. ...
...eft-color property depending on the values defined for writing-mode, direction, and text-orientation. border-block-color: yellow; border-block-color: #f5f6f7; the border color in the other dimension can be set with border-inline-color which sets border-inline-start-color, and border-inline-end-color. syntax values <'color'> the color of the border. see color. ...
...And 2 more matches
border-block-end-color - CSS: Cascading Style Sheets
the border-block-end-color css property defines the color of the logical block-end border of an element, which maps to a physical border color depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-color, border-right-color, border-bottom-color, or border-left-color 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 border-block-end-color: yellow; border-block-end-color: #f5f6f7; related properties are border-block-start-color, border-inline-start-color,...
...ub repository. if 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 border-block-end-color: yellow; border-block-end-color: #f5f6f7; related properties are border-block-start-color, border-inline-start-color, and border-inline-end-color, which define the other border colors of the element. ...
... clone https://github.com/mdn/interactive-examples and send us a pull request. syntax border-block-end-color: yellow; border-block-end-color: #f5f6f7; related properties are border-block-start-color, border-inline-start-color, and border-inline-end-color, which define the other border colors of the element. values <'color'> the color of the border. see color. ...
...And 2 more matches
border-block-end-style - CSS: Cascading Style Sheets
the border-block-end-style css property defines the style of the logical block-end border of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-style, border-right-style, border-bottom-style, or border-left-style property depending on the values defined for writing-mode, direction, and text-orientation. ...
...ht-style, border-bottom-style, or border-left-style 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 /* <'border-style'> values */ border-block-end-style: dashed; border-block-end-style: dotted; border-block-end-style: groove; related properties are border-block-start-style, border-inline-start-style, and border-inline-end-style, which define the other border styles of the element. values <'border-style'> the line style of the border. ...
...syntax /* <'border-style'> values */ border-block-end-style: dashed; border-block-end-style: dotted; border-block-end-style: groove; related properties are border-block-start-style, border-inline-start-style, and border-inline-end-style, which define the other border styles of the element. values <'border-style'> the line style of the border. see border-style. ...
...And 2 more matches
border-block-end-width - CSS: Cascading Style Sheets
the border-block-end-width css property defines the width of the logical block-end border of an element, which maps to a physical border width depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-width, border-right-width, border-bottom-width, or border-left-width property depending on the values defined for writing-mode, direction, and text-orientation. ...
...ht-width, border-bottom-width, or border-left-width 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 /* <'border-width'> values */ border-block-end-width: 5px; border-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. ...
...ve-examples and send us a pull request. syntax /* <'border-width'> values */ border-block-end-width: 5px; border-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. ...
...And 2 more matches
border-block-start-color - CSS: Cascading Style Sheets
the border-block-start-color css property defines the color of the logical block-start border of an element, which maps to a physical border color depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-color, border-right-color, border-bottom-color, or border-left-color 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 border-block-start-color: blue; border-block-start-color: #4c5d21; related properties are border-block-end-color, border-inline-start-co...
...ub repository. if 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 border-block-start-color: blue; border-block-start-color: #4c5d21; related properties are border-block-end-color, border-inline-start-color, and border-inline-end-color, which define the other border colors of the element. ...
...les project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax border-block-start-color: blue; border-block-start-color: #4c5d21; related properties are border-block-end-color, border-inline-start-color, and border-inline-end-color, which define the other border colors of the element. ...
...And 2 more matches
border-block-start-style - CSS: Cascading Style Sheets
the border-block-start-style css property defines the style of the logical block start border of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-style, border-right-style, border-bottom-style, or border-left-style property depending on the values defined for writing-mode, direction, and text-orientation. ...
...ht-style, border-bottom-style, or border-left-style 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 /* <'border-style'> values */ border-block-start-style: dashed; border-block-start-style: dotted; border-block-start-style: groove; related properties are border-block-end-style, border-inline-start-style, and border-inline-end-style, which define the other border styles of the element. values <'border-style'> the line style of the border. ...
...ax /* <'border-style'> values */ border-block-start-style: dashed; border-block-start-style: dotted; border-block-start-style: groove; related properties are border-block-end-style, border-inline-start-style, and border-inline-end-style, which define the other border styles of the element. values <'border-style'> the line style of the border. see border-style. ...
...And 2 more matches
border-bottom-width - CSS: Cascading Style Sheets
the border-bottom-width css property 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 fol...
......
...in 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-specific. ...
...And 2 more matches
border-inline-color - CSS: Cascading Style Sheets
the border-inline-color css property defines the color of the logical inline borders of an element, which maps to a physical border color depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-color and border-bottom-color, or border-right-color and border-left-color property depending on the values defined for writing-mode, direction, and text-orientation. ...
...nds to the border-top-color and border-bottom-color, or border-right-color and border-left-color property depending on the values defined for writing-mode, direction, and text-orientation. border-inline-color: yellow; border-inline-color: #f5f6f7; the border color in the other dimension can be set with border-block-color which sets border-block-start-color, and border-block-end-color. syntax values <'color'> the color of the border. see color. ...
...left-color property depending on the values defined for writing-mode, direction, and text-orientation. border-inline-color: yellow; border-inline-color: #f5f6f7; the border color in the other dimension can be set with border-block-color which sets border-block-start-color, and border-block-end-color. syntax values <'color'> the color of the border. see color. ...
...And 2 more matches
border-inline-end-style - CSS: Cascading Style Sheets
the border-inline-end-style css property defines the style of the logical inline end border of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-style, border-right-style, border-bottom-style, or border-left-style property depending on the values defined for writing-mode, direction, and text-orientation. ...
...ht-style, border-bottom-style, or border-left-style 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 /* <'border-style'> values */ border-inline-end-style: dashed; border-inline-end-style: dotted; border-inline-end-style: groove; related properties are border-block-start-style, border-block-end-style, and border-inline-start-style, which define the other border styles of the element. values <'border-style'> the line style of the border. ...
...ntax /* <'border-style'> values */ border-inline-end-style: dashed; border-inline-end-style: dotted; border-inline-end-style: groove; related properties are border-block-start-style, border-block-end-style, and border-inline-start-style, which define the other border styles of the element. values <'border-style'> the line style of the border. see border-style. ...
...And 2 more matches
border-inline-start-color - CSS: Cascading Style Sheets
the border-inline-start-color css property defines the color of the logical inline start border of an element, which maps to a physical border color depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-color, border-right-color, border-bottom-color, or border-left-color 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 border-inline-start-color: red; border-inline-start-color: #ee4141; related properties are border-block-start-color, border-block-end-...
...ub repository. if 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 border-inline-start-color: red; border-inline-start-color: #ee4141; related properties are border-block-start-color, border-block-end-color, and border-inline-end-color, which define the other border colors of the element. ...
... clone https://github.com/mdn/interactive-examples and send us a pull request. syntax border-inline-start-color: red; border-inline-start-color: #ee4141; related properties are border-block-start-color, border-block-end-color, and border-inline-end-color, which define the other border colors of the element. values <'color'> the color of the border. see color. ...
...And 2 more matches
border-inline-start-width - CSS: Cascading Style Sheets
the border-inline-start-width css property defines the width of the logical inline-start border of an element, which maps to a physical border width depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-width, border-right-width, border-bottom-width, or border-left-width property depending on the values defined for writing-mode, direction, and text-orientation. ...
...ht-width, border-bottom-width, or border-left-width 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 /* <'border-width'> values */ border-inline-start-width: 5px; border-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. ...
...examples and send us a pull request. syntax /* <'border-width'> values */ border-inline-start-width: 5px; border-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. ...
...And 2 more matches
box-align - CSS: Cascading Style Sheets
Web › CSS › box-align
warning: this is a property of the original css flexible box layout module draft, and has been replaced by a newer standard. the box-align css property specifies how an element aligns its contents across its layout in a perpendicular direction. the effect of the property is only visible if there is extra space in the box. see flexbox for information about the current standard. ...
...ewer standard. the box-align css property specifies how an element aligns its contents across its layout in a perpendicular direction. the effect of the property is only visible if there is extra space in the box. see flexbox for information about the current standard. /* keyword values */ box-align: start; box-align: center; box-align: end; box-align: baseline; box-align: stretch; /* global values */ box-lines: inherit; box-lines: initial; box-lines: unset; the direction of layout depends on the element's orientation: horizontal or vertical. syntax the box-align property is specified as one of the keyword values listed below. values start the box aligns contents at the start, leaving any extra space at the end. center the box aligns contents in the center, dividing any extra sp...
...hes the contents so that there is no extra space in the box. notes the edge of the box designated the start for alignment purposes depends on the box's orientation: horizontal top vertical left the edge opposite to the start is designated the end. if the alignment is set using the element's align attribute, then the style is ignored. ...
...And 2 more matches
clear - CSS: Cascading Style Sheets
Web › CSS › clear
ement contains only floated elements, its height collapses to nothing. if you want it to always be able to resize, so that it contains floating elements inside it, you need to self-clear its children. this is called clearfix, and one way to do it is to add clear to a replaced ::after pseudo-element on it. #container::after { content: ""; display: block; clear: both; } syntax /* keyword values */ clear: none; clear: left; clear: right; clear: both; clear: inline-start; clear: inline-end; /* global values */ clear: inherit; clear: initial; clear: unset; values none is a keyword indicating that the element is not moved down to clear past floating elements. left is a keyword indicating that the element is moved down to clear past left floats. right is a keyword indicating that...
... indicating that the element is moved down to clear floats on start side of its containing block, that is the left floats on ltr scripts and the right floats on rtl scripts. inline-end is a keyword indicating that the element is moved down to clear floats on end side of its containing block, that is the right floats on ltr scripts and the left floats on rtl scripts. formal definition initial valuenoneapplies toblock-level elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax none | left | right | both | inline-start | inline-end examples clear: left html <div class="wrapper"> <p class="black">lorem ipsum dolor sit amet, consectetuer adipiscing elit. phasellus sit amet diam. duis mattis varius dui. suspendisse eget dolor.</p> <p class="red">lorem ipsum ...
... recommendation no significant changes, though details are clarified. css level 1the definition of 'clear' in that specification. recommendation initial definition ...
...And 2 more matches
clip - CSS: Cascading Style Sheets
Web › CSS › clip
the clip css property defines a visible portion of an element. the clip property applies only to absolutely positioned elements — that is, elements with position:absolute or position:fixed. /* keyword value */ clip: auto; /* <shape> values */ clip: rect(1px 10em 3rem 2ch); clip: rect(1px, 10em, 3rem, 2ch); /* global values */ clip: inherit; clip: initial; clip: unset; syntax note: where possible, authors are encouraged to use the newer clip-path 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>, <rig...
... to use the newer clip-path 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. ...
...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. ...
...And 2 more matches
counter-reset - CSS: Cascading Style Sheets
the counter-reset css property resets a css counter to a given value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: the counter's value can be increased or decreased using the counter-increment css property. ...
...nter's value can be increased or decreased using the counter-increment css property. syntax /* set "my-counter" to 0 */ counter-reset: my-counter; /* set "my-counter" to -1 */ counter-reset: my-counter -1; /* set "counter1" to 1, and "counter2" to 4 */ counter-reset: counter1 1 counter2 4; /* cancel any reset that could have been set in less specific rules */ counter-reset: none; /* global values */ counter-reset: inherit; counter-reset: initial; counter-reset: unset; the counter-reset property is specified as either one of the following: a <custom-ident> naming the counter, followed optionally by an <integer>. you may specify as many counters to reset as you want, with each name or name-number pair separated by a space. the keyword value none. ...
...unter-reset: none; /* global values */ counter-reset: inherit; counter-reset: initial; counter-reset: unset; the counter-reset property is specified as either one of the following: a <custom-ident> naming the counter, followed optionally by an <integer>. you may specify as many counters to reset as you want, with each name or name-number pair separated by a space. the keyword value none. values <custom-ident> the name of the counter to reset. <integer> the value to reset the counter to on each occurrence of the element. defaults to 0 if not specified. none no counter reset is to be performed. this can be used to override a counter-reset defined in a less specific rule. ...
...And 2 more matches
counters() - CSS: Cascading Style Sheets
Web › CSS › counters
the counters are rendered in the style indicated, defaulting to decimal if no style is specified. ...
...the counters are rendered in the style indicated, defaulting to decimal if no style is specified. ...
...the counters are rendered in the style indicated, defaulting to decimal if no style is specified. ...
...And 2 more matches
empty-cells - CSS: Cascading Style Sheets
d backgrounds appear around <table> cells that have no visible content. the source for this interactive example is stored in a github repository. if 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 an effect only when the border-collapse property is separate. ...
...ble content. the source for this interactive example is stored in a github repository. if 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 an effect only when the border-collapse property is separate. ...
... examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this property has an effect only when the border-collapse property is separate. syntax /* keyword values */ empty-cells: show; empty-cells: hide; /* global values */ empty-cells: inherit; empty-cells: initial; empty-cells: unset; the empty-cells property is specified as one of the keyword values listed below. values show borders and backgrounds are drawn like in normal cells. hide no borders or backgrounds are drawn. ...
...And 2 more matches
flex-direction - CSS: Cascading Style Sheets
the flex-direction css property sets how flex items are placed in the flex container defining the main axis and the direction (normal or reversed). the source for this interactive example is stored in a github repository. if 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 the values row and row-reverse are affected by the directionality of the flex container. if its dir attribute is ltr, row represents the horizontal axis oriented from the left to the right, and row-reverse from the right to the left; if the dir attribute is rtl, row represents the axis oriented from the right to the left, and row-reverse from the left to the right. syntax /* the direction text is laid out in a li...
...ow represents the axis oriented from the right to the left, and row-reverse from the left to the right. syntax /* the direction text is laid out in a line */ flex-direction: row; /* like <row>, but reversed */ flex-direction: row-reverse; /* the direction in which lines of text are stacked */ flex-direction: column; /* like <column>, but reversed */ flex-direction: column-reverse; /* global values */ flex-direction: inherit; flex-direction: initial; flex-direction: unset; values the following values are accepted: row the flex container's main-axis is defined to be the same as the text direction. the main-start and main-end points are the same as the content direction. row-reverse behaves the same as row but the main-start and main-end points are permuted. column the flex contai...
...aves the same as row but the main-start and main-end points are permuted. column the flex container's main-axis is the same as the block-axis. the main-start and main-end points are the same as the before and after points of the writing-mode. column-reverse behaves the same as column but the main-start and main-end are permuted. accessibility concerns using the flex-direction property with values of row-reverse or column-reverse will create a disconnect between the visual presentation of content and dom order. this will adversely affect users experiencing low vision navigating with the aid of assistive technology such as a screen reader. if the visual (css) order is important, then screen reader users will not have access to the correct reading order. flexbox & the keyboard navigation...
...And 2 more matches
flex-wrap - CSS: Cascading Style Sheets
Web › CSS › flex-wrap
wrapping is allowed, it sets the direction that lines are stacked. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. see using css flexible boxes for more properties and information. syntax flex-wrap: nowrap; /* default value */ flex-wrap: wrap; flex-wrap: wrap-reverse; /* global values */ flex-wrap: inherit; flex-wrap: initial; flex-wrap: unset; the flex-wrap property is specified as a single keyword chosen from the list of values below. values the following values are accepted: nowrap the flex items are laid out in a single line which may cause the flex container to overflow. the cross-start is either equiv...
...values */ flex-wrap: inherit; flex-wrap: initial; flex-wrap: unset; the flex-wrap property is specified as a single keyword chosen from the list of values below. values the following values are accepted: nowrap the flex items are laid out in a single line which may cause the flex container to overflow. the cross-start is either equivalent to start or before depending on the flex-direction value. this is the default value. wrap the flex items break into multiple lines. the cross-start is either equivalent to start or before depending flex-direction value and the cross-end is the opposite of the specified cross-start. wrap-reverse behaves the same as wrap but cross-start and cross-end are permuted. ...
...t to start or before depending on the flex-direction value. this is the default value. wrap the flex items break into multiple lines. the cross-start is either equivalent to start or before depending flex-direction value and the cross-end is the opposite of the specified cross-start. wrap-reverse behaves the same as wrap but cross-start and cross-end are permuted. ...
...And 2 more matches
font-size-adjust - CSS: Cascading Style Sheets
the font-size-adjust css property sets the size of lower-case letters relative to the current font size (which defines the size of upper-case letters). /* use the specified font size */ font-size-adjust: none; /* use a font size that makes lowercase letters half the specified font size */ font-size-adjust: 0.5; /* global values */ font-size-adjust: inherit; font-size-adjust: initial; font-size-adjust: unset; the property is useful since the legibility of fonts, especially at small sizes, is determined more by the size of lowercase letters than by the size of capital letters. legibility can become an issue when the first-choice font-family is unavailable and its replacement has a significantly different aspect ratio (the ratio of the size of lowercase letters to the size of the f...
...bility can become an issue when the first-choice font-family is unavailable and its replacement has a significantly different aspect ratio (the ratio of the size of lowercase letters to the size of the font). to use this property in a way that is compatible with browsers that do not support font-size-adjust, it is specified as a number that the font-size property is multiplied by. this means the value specified for the property should generally be the aspect ratio of the first choice font. for example, a style sheet that specifies: font-size: 14px; font-size-adjust: 0.5; ... is really specifying that the lowercase letters of the font should be 7px high (0.5 × 14px). this will still produce reasonable results in browsers that do not support font-size-adjust, where a 14px font will be used.
...for the property should generally be the aspect ratio of the first choice font. for example, a style sheet that specifies: font-size: 14px; font-size-adjust: 0.5; ... is really specifying that the lowercase letters of the font should be 7px high (0.5 × 14px). this will still produce reasonable results in browsers that do not support font-size-adjust, where a 14px font will be used. syntax values none choose the size of the font based only on the font-size property. <number> choose the size of the font so that its lowercase letters (as determined by the x-height of the font) are the specified number times the font-size. the number specified should generally be the aspect ratio (ratio of x-height to font size) of the first choice font-family. this means that the first-choice fon...
...And 2 more matches
font-variant-caps - CSS: Cascading Style Sheets
(one with the dot, one without) and two case pairings: i/İ and ı/i. in german (de), the ß may become ẞ (u+1e9e) in uppercase. in greek (el), vowels lose their accent when the whole word is in uppercase (ά/Α), except for the disjunctive eta (ή/Ή). also, diphthongs with an accent on the first vowel lose the accent and gain a diacritic on the second vowel (άι/ΑΪ). ...
...e eta (ή/Ή). also, diphthongs with an accent on the first vowel lose the accent and gain a diacritic on the second vowel (άι/ΑΪ). syntax /* keyword values */ font-variant-caps: normal; font-variant-caps: small-caps; font-variant-caps: all-small-caps; font-variant-caps: petite-caps; font-variant-caps: all-petite-caps; font-variant-caps: unicase; font-variant-caps: titling-caps; /* global values */ font-variant-caps: inherit; font-variant-caps: initial; font-variant-caps: unset; the font-variant-caps property is specified using a single keyword value from the list below. in each case, if the font doesn't support the opentype value, then it synthesizes the glyphs. values normal deactivates of the use of alternate glyphs. small-caps enables display of small capitals (opentype fea...
...case letters (opentype feature: unic). titling-caps enables display of titling capitals (opentype feature: titl). uppercase letter glyphs are often designed for use with lowercase letters. when used in all uppercase titling sequences they can appear too strong. titling capitals are designed specifically for this situation. ...
...And 2 more matches
font-variation-settings - CSS: Cascading Style Sheets
the font-variation-settings css property provides low-level control over variable font characteristics, by specifying the four letter axis names of the characteristics you want to vary, along with their values. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...he four letter axis names of the characteristics you want to vary, along with their values. the source for this interactive example is stored in a github repository. if 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 /* use the default settings */ font-variation-settings: normal; /* set values for variable font axis names */ font-variation-settings: "xhgt" 0.7; /* global values */ font-variation-settings: inherit; font-variation-settings: initial; font-variation-settings: unset; values this property's value can take one of two forms: normal text is laid out using default settings. <string> <number> when rendering text, the list of variable font axis names is passed to the te...
... unset; values this property's value can take one of two forms: normal text is laid out using default settings. <string> <number> when rendering text, the list of variable font axis names is passed to the text layout engine to enable or disable font features. each setting is always one or more pairs consisting of a <string> of 4 ascii characters followed by a <number> indicating the axis value to set. if the <string> has more or fewer characters or contains characters outside the u+20 - u+7e codepoint range, the whole property is invalid. the <number> can be fractional or negative, depending on the value range available in your font, as defined by the font designer. description this property is a low-level mechanism designed to set variable font features where no other way to enable...
...And 2 more matches
hanging-punctuation - CSS: Cascading Style Sheets
the hanging-punctuation css property specifies whether a punctuation mark should hang at the start or end of a line of text. hanging punctuation may be placed outside the line box. ...
...uation: last; hanging-punctuation: force-end; hanging-punctuation: allow-end; /* two keywords */ hanging-punctuation: first force-end; hanging-punctuation: first allow-end; hanging-punctuation: first last; hanging-punctuation: last force-end; hanging-punctuation: last allow-end; /* three keywords */ hanging-punctuation: first force-end last; hanging-punctuation: first allow-end last; /* global values */ hanging-punctuation: inherit; hanging-punctuation: initial; hanging-punctuation: unset; syntax the hanging-punctuation property may be specified with one, two, or three values. one-value syntax uses any one of the keyword values in the list below. two-value syntax uses one of the following: first together with any one of last, allow-end, or force-end last together with any on...
... first an opening bracket or quote at the start of the first formatted line of an element hangs. ...
...And 2 more matches
Inheritance - CSS: Cascading Style Sheets
in css, inheritance controls what happens when no value is specified for a property on an element. css properties can be categorized in two types: inherited properties, which by default are set to the computed value of the parent element non-inherited properties, which by default are set to initial value of the property refer to any css property definition to see whether a specific property inherits by default ("inherited: yes") or not ("inherited: no"). inherited properties when no value for an inherited property has been specified on an element, the element gets the computed value of that property on its parent element. only the root element of the document gets the initial value given in the property's summary. a typical example of an inherited property is the color property. give...
... on its parent element. only the root element of the document gets the initial value given in the property's summary. a typical example of an inherited property is the color property. given the style rules: p { color: green; } ... and the markup: <p>this paragraph has <em>emphasized text</em> in it.</p> ... the words "emphasized text" will appear green, since the em element has inherited the value of the color property from the p element. it does not get the initial value of the property (which is the color that is used for the root element when the page specifies no color). non-inherited properties when no value for a non-inherited property has been specified on an element, the element gets the initial value of that property (as specified in the property's summary). a typical example o...
...specified on an element, the element gets the initial value of that property (as specified in the property's summary). a typical example of a non-inherited property is the border property. given the style rules: p { border: medium solid; } ... and the markup: <p>this paragraph has <em>emphasized text</em> in it.</p> ... the words "emphasized text" will not have a border (since the initial value of border-style is none). notes the inherit keyword allows authors to explicitly specify inheritance. it works on both inherited and non-inherited properties. you can control inheritance for all properties at once using the all shorthand property, which applies its value to all properties. for example: font { all: revert; font-size: 200%; font-weight: bold; } this reverts the style of ...
...And 2 more matches
list-style - CSS: Cascading Style Sheets
list-style-image see list-style-ima...
... list-style-image see list-style-image. list-style-position see list-sty...
...osition */ list-style: lower-roman url('../img/shape.png') outside; /* keyword value */ list-style: none; /* global values */ list-style: inherit; list-style: initial; list-style: unset; the list-style property is specified as one, two, or three keywords in any order. if list-style-type and list-style-image are both set, then list-style-type is used as a fallback if the image is unavailable. values list-style-type see list-style-type. list-style-image see list-style-image. list-style-position see list-style-position. none no list style is used. accessibility concerns safari has an issue whereby unordered lists with a list-style value of none applied to them will not be recognized as a list in the accessibility tree. to address this, add a zero-width space as pseudo-content bef...
...And 2 more matches
margin-bottom - CSS: Cascading Style Sheets
the margin-bottom css property sets the margin area on the bottom of an element. a positive value places 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>. ...
... 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>. ...
...ect, 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 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 o...
...And 2 more matches
margin-top - CSS: Cascading Style Sheets
the margin-top css property sets the margin area on the top of an element. a positive value places 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>. ...
...er 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>. ...
...amples 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 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 containin...
...And 2 more matches
mask-border-slice - CSS: Cascading Style Sheets
into regions. these regions are used to form the components of an element's mask border. syntax /* all sides */ mask-border-slice: 30%; /* vertical | horizontal */ mask-border-slice: 10% 30%; /* top | horizontal | bottom */ mask-border-slice: 30 30% 45; /* top | right | bottom | left */ mask-border-slice: 7 12 14 5; /* using the `fill` keyword */ mask-border-slice: 10% fill 7 12; /* global values */ mask-border-slice: inherit; mask-border-slice: initial; mask-border-slice: unset; the mask-border-slice property may be specified using one to four <number-percentage> values to represent the position of each image slice. negative values are invalid; values greater than their corresponding dimension are clamped to 100%. when one position is specified, it creates all four slices at the sa...
... the mask-border-slice property may be specified using one to four <number-percentage> values to represent the position of each image slice. negative values are invalid; values greater than their corresponding dimension are clamped to 100%. when one position is specified, it creates all four slices at the same distance from their respective sides. when two positions are specified, the first value creates slices measured from the top and bottom, the second creates slices measured from the left and right. when three positions are specified, the first value creates a slice measured from the top, the second creates slices measured from the left and right, the third creates a slice measured from the bottom. when four positions are specified, they create slices measured from the top, right, b...
...eates slices measured from the left and right. when three positions are specified, the first value creates a slice measured from the top, the second creates slices measured from the left and right, the third creates a slice measured from the bottom. when four positions are specified, they create slices measured from the top, right, bottom, and left in that order (clockwise). the optional fill value, if used, can be placed anywhere in the declaration. values <number> represents an edge offset in pixels for raster images and coordinates for vector images. for vector images, the number is relative to the element's size, not the size of the source image, so percentages are generally preferable in these cases. <percentage> represents an edge offset as a percentage of the source image's si...
...And 2 more matches
mask-mode - CSS: Cascading Style Sheets
Web › CSS › mask-mode
the mask-mode css property sets whether the mask reference defined by mask-image is treated as a luminance or alpha mask. /* keyword values */ mask-mode: alpha; mask-mode: luminance; mask-mode: match-source; /* multiple values */ mask-mode: alpha, match-source; /* global values */ mask-mode: inherit; mask-mode: initial; mask-mode: unset; syntax the mask-mode property is specified as one or more of the keyword values listed below, separated by commas. values alpha this keyword indicates that the transparency (alpha channel) values of the mask layer image should be used as the mask values. luminance this keyword indicates that the luminance values of the mask layer image should be used as the mask values. match-source if the mask-image property is of type <mask-source>, the lum...
... keyword values listed below, separated by commas. values alpha this keyword indicates that the transparency (alpha channel) values of the mask layer image should be used as the mask values. luminance this keyword indicates that the luminance values of the mask layer image should be used as the mask values. match-source if the mask-image property is of type <mask-source>, the luminance values of the mask layer image should be used as the mask values. if it is of type <image>, the alpha values of the mask layer image should be used as the mask values. ...
...inance this keyword indicates that the luminance values of the mask layer image should be used as the mask values. match-source if the mask-image property is of type <mask-source>, the luminance values of the mask layer image should be used as the mask values. if it is of type <image>, the alpha values of the mask layer image should be used as the mask values. ...
...And 2 more matches
mask-position - CSS: Cascading Style Sheets
the mask-position css property sets the initial position, relative to the mask position layer set by mask-origin, for each defined mask image. /* keyword values */ mask-position: top; mask-position: bottom; mask-position: left; mask-position: right; mask-position: center; /* <position> values */ mask-position: 25% 75%; mask-position: 0px 0px; mask-position: 10% 8em; /* multiple values */ mask-position: top right; mask-position: 1rem 1rem, center; /* global values */ mask-position: inherit; mask-position: initial; mask-position: unset; syntax one or more <position> values, separated by commas. values <position> one to four values representing a 2d position regarding the edges of the element's box. relative or absolute offsets can be given. note that the position can be set outside ...
.../* global values */ mask-position: inherit; mask-position: initial; mask-position: unset; syntax one or more <position> values, separated by commas. values <position> one to four values representing a 2d position regarding the edges of the element's box. relative or absolute offsets can be given. note that the position can be set outside of the element's box. ...
...relative or absolute offsets can be given. note that the position can be set outside of the element's box. ...
...And 2 more matches
max-inline-size - CSS: Cascading Style Sheets
the max-inline-size css property defines the horizontal or vertical maximum size of an element's block depending on its writing mode. it corresponds to the max-width or the max-height property depending on the value defined for writing-mode. if the writing mode is vertically oriented, the value of max-inline-size relates to the maximal height 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. ...
... 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. ...
... 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. syntax /* <length> values */ max-inline-size: 300px; max-inline-size: 25em; /* <percentage> values */ max-inline-size: 75%; /* keyword values */ max-inline-size: auto; max-inline-size: max-content; max-inline-size: min-content; max-inline-size: fit-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. formal definition initial va...
...And 2 more matches
min-height - CSS: Cascading Style Sheets
the min-height css property sets the minimum height of an element. it prevents the used value of the height property from becoming smaller 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. ...
...an 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 block's he...
...ulate and select a min-height for the specified element. none no limit on the size of the box. max-content the intrinsic preferred min-height. min-content the intrinsic minimum min-height. fit-content(<length-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-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> ...
...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 <position>. 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). for more explanation of these value types, see background-position. formal...
... 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). for more explanation of these value types, see background-position. ...
...And 2 more matches
repeat() - CSS: Cascading Style Sheets
Web › CSS › repeat
the repeat() css function represents a repeated fragment of the track list, allowing a large number of columns or rows that exhibit a recurring pattern to be written in a more compact form. this function can be used in the css grid properties grid-template-columns and grid-template-rows. ...
...art] 1fr [col-end]) repeat(4, [col-start] min-content [col-end]) repeat(4, [col-start] max-content [col-end]) repeat(4, [col-start] auto [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] auto [col-end]) repeat(4, [col-start] min-content [col-middle] max-content [col-end]) /* <auto-repeat> values */ repeat(auto-fill, 250px) repeat(auto-fit, 250px) repeat(auto-fill, [col-start] 250px [col-end]) repeat(auto-fit, [col-start] 250px [col-end]) repeat(auto-fill, [col-start] minmax(100px, 1fr) [col-end]) repeat(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]) re...
... <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. ...
...And 2 more matches
repeating-conic-gradient() - CSS: Cascading Style Sheets
ractive-examples and send us a pull request. syntax /* starburst: a a blue on blue starburst: the gradient is a starburst of lighter and darker blue, centered 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...
...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. ...
...(red 0 8%, yellow 8% 16%, blue 16% 24%); conic-gradient(red 120deg, yellow 120deg 240deg, blue 240deg); radial-gradient(red 33%, yellow 33% 66%, blue 66%); for a repeating gradient to repeat we define the first and last color stops. like in non-repeating gradients, the first and last color stops are assumed to be 0 and either 100% or 360deg if not explicitly declared. when defaulting to these values, the repeating arc is 360 degrees, and therefore doesn't repeat. like the non-repeating conic gradient, the color-stops are placed around a gradient arc -- the circumference of a circle, rather than on the gradient line emerging from the center of the gradient. the colors transition as as if spun around the center of a circle, starting at the top if no from <angle> is declared, and going clockw...
...And 2 more matches
repeating-radial-gradient() - CSS: Cascading Style Sheets
e interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. with each repetition, the positions of the color stops are shifted by a multiple of the dimensions of the basic radial gradient (the distance between the last color stop and the first). thus, the position of each ending color stop coincides with a starting color stop; if the color values are different, this will result in a sharp visual transition, which can be mitigated by repeating the first color as the last color. as with any gradient, a repeating 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 the element it applies to. because <gradient>s belong to the <image> data typ...
...if unspecified, it defaults to ellipse. <extent-keyw...
...ive times between the center and the bottom right corner, and only once between the center and the top left corner */ repeating-radial-gradient(farthest-corner at 20% 20%, red 0, green, red 20%); values <position> the position of the gradient, interpreted in the same way as background-position or transform-origin. if unspecified, it defaults to center. <shape> the gradient's shape. the value can be circle (meaning that the gradient's shape is a circle with constant radius) or ellipse (meaning that the shape is an axis-aligned ellipse). if unspecified, it defaults to ellipse. ...
...And 2 more matches
resize - CSS: Cascading Style Sheets
Web › CSS › resize
the resize css property sets whether an element is resizable, and if so, in which directions. the source for this interactive example is stored in a github repository. if 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 */ resize: none; resize: both; resize: horizontal; resize: vertical; resize: block; resize: inline; /* global values */ resize: inherit; resize: initial; resize: unset; the resize property is specified as a single keyword value from the list below. values none the element offers no user-controllable method for resizing it. both the element displays a mechanism for allowing the user to resize it, which may be resized both horizontally and ver...
...y. horizontal the element displays a mechanism for allowing the user to resize it in the horizontal direction. vertical the element displays a mechanism for allowing the user to resize it in the vertical direction. ...
... in the vertical direction. block the element displays a mechanism for allowing the user to resize it in the block direction (either horizontally or vertically, depending on the writing-mode and direction value). inline the element displays a mechanism for allowing the user to resize it in the inline direction (either horizontally or vertically, depending on the writing-mode and direction value). ...
...And 2 more matches
scroll-margin-inline-end - CSS: Cascading Style Sheets
formed 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. ...
...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. ...
...tored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. 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. ...
...And 2 more matches
scroll-margin-inline-start - CSS: Cascading Style Sheets
formed 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. ...
...ainer’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. ...
... github repository. if 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. ...
...And 2 more matches
scroll-padding-block-end - CSS: Cascading Style Sheets
ntent (such as fixed-positioned toolbars 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. ...
...r 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 user agent...
...* 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 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. ...
...And 2 more matches
scroll-padding-block-start - CSS: Cascading Style Sheets
ntent (such as fixed-positioned toolbars 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. ...
...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 determind by ...
... 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 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. ...
...And 2 more matches
scroll-padding-inline-end - CSS: Cascading Style Sheets
ntent (such as fixed-positioned toolbars 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. ...
... 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 the use...
...obal 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 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. ...
...And 2 more matches
scroll-padding-inline-start - CSS: Cascading Style Sheets
ntent (such as fixed-positioned toolbars 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. ...
...imply 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 determ...
...ues */ 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 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. ...
...And 2 more matches
scroll-snap-points-x - CSS: Cascading Style Sheets
elements within the scroll container may still define snap points on behalf of the scroll container. ...
...elements within the scroll container may still define snap points on behalf of the scroll container. ...
...elements within the scroll container may still define snap points on behalf of the scroll container. ...
...And 2 more matches
scroll-snap-points-y - CSS: Cascading Style Sheets
elements within the scroll container may still define snap points on behalf of the scroll container. ...
...elements within the scroll container may still define snap points on behalf of the scroll container. ...
...elements within the scroll container may still define snap points on behalf of the scroll container. ...
...And 2 more matches
shape-image-threshold - CSS: Cascading Style Sheets
the shape-image-threshold css property sets the alpha channel threshold used to extract the shape using an image as the value for 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. any pixels whose alpha component's value is greater than the threshold are considered to be part of the shape for the purposes of determining its boundaries. for example, a value of 0.5 means that the shape will enclose all the pixels that are more than 50% opaque. ...
... the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. any pixels whose alpha component's value is greater than the threshold are considered to be part of the shape for the purposes of determining its boundaries. for example, a value of 0.5 means that the shape will enclose all the pixels that are more than 50% opaque. /* <number> value */ shape-image-threshold: 0.7; /* global values */ shape-image-threshold: inherit; shape-image-threshold: initial; shape-image-threshold: unset; syntax values <alpha-value> sets the threshold used for extracting a shape from an image. ...
...lue of 0.5 means that the shape will enclose all the pixels that are more than 50% opaque. /* <number> value */ shape-image-threshold: 0.7; /* global values */ shape-image-threshold: inherit; shape-image-threshold: initial; shape-image-threshold: unset; syntax values <alpha-value> sets the threshold used for extracting a shape from an image. the shape is defined by the pixels whose alpha value is greater than the threshold. values outside the range 0.0 (fully transparent) to 1.0 (fully opaque) are clamped to this range. ...
...And 2 more matches
text-combine-upright - CSS: Cascading Style Sheets
ce of a single character. if the combined text is wider than 1em, the user agent must fit the contents within 1em. the resulting composition is treated as a single upright glyph for layout and decoration. this property only has an effect in vertical writing modes. this is used to produce an effect that is known as tate-chū-yoko (縦中横) in japanese, or as 直書橫向 in chinese. ...
...gent must fit the contents within 1em. the resulting composition is treated as a single upright glyph for layout and decoration. this property only has an effect in vertical writing modes. this is used to produce an effect that is known as tate-chū-yoko (縦中横) in japanese, or as 直書橫向 in chinese. /* keyword values */ text-combine-upright: none; text-combine-upright: all; /* digits values */ text-combine-upright: digits; /* fits 2 consecutive digits horizontally inside vertical text */ text-combine-upright: digits 4; /* fits up to 4 consecutive digits horizontally inside vertical text */ /* global values */ text-combine-upright: inherit; text-combine-upright: initial; text-combine-upright: unset; syntax values none there is no special processing. all attempts to t...
...in the vertical line of the box. digits <integer>? attempts to display a sequence of consecutive ascii digits (u+0030–u+0039) that has as many or fewer characters than the specified integer, such that it takes up the space of a single character within the vertical line box. if the integer is omitted, it computes to 2. integers outside the range of 2-4 are invalid. formal definition initial valuenoneapplies tonon-replaced inline elementsinheritedyescomputed valuespecified keyword, plus integer if 'digits'animation typediscrete formal syntax none | all | [ digits <integer>? ] examples digits the digits value requires less markup than the all value when digits are being combined, but it is currently not very widely supported by browsers. html <p lang="ja" class="exampletext">平成20...
...And 2 more matches
text-decoration-skip - CSS: Cascading Style Sheets
the text-decoration-skip css property sets what parts of an element’s content any text decoration affecting the element must skip over. it controls all text decoration lines drawn by the element and also any text decoration lines drawn by its ancestors. note: most other browsers are converging on supporting the simpler text-decoration-skip-ink property. ...
...thus, text decoration is drawn for all text content and across atomic inline-level boxes. ...
...p: objects; text-decoration-skip: spaces; text-decoration-skip: edges; text-decoration-skip: box-decoration; /* multiple keywords */ text-decoration-skip: objects spaces; text-decoration-skip: leading-spaces trailing-spaces; text-decoration-skip: objects edges box-decoration; /* global values */ text-decoration-skip: inherit; text-decoration-skip: initial; text-decoration-skip: unset; syntax values none nothing is skipped. thus, text decoration is drawn for all text content and across atomic inline-level boxes. objects the entire margin box of the element is skipped if it is an atomic inline such as an image or inline-block. spaces all spacing is skipped: all unicode white space characters and all word separators, plus any adjacent letter-spacing or word-spacing. leading-spaces t...
...And 2 more matches
text-decoration - CSS: Cascading Style Sheets
derlined. however, the rule em { text-decoration: overline; } would cause a second decoration to appear on "some emphasized words". constituent properties this property is a shorthand for the following css properties: text-decoration-color text-decoration-line text-decoration-style text-decoration-thickness syntax the text-decoration property is specified as one or more space-separated values representing the various longhand text-decoration properties. values text-decoration-line sets the kind of decoration used, such as underline or line-through. text-decoration-color sets the color of the decoration. text-decoration-style sets the style of the line used for the decoration, such as solid, wavy, or dashed. text-decoration-thickness sets the thickness of the line used for ...
...ration properties. values text-decoration-line sets the kind of decoration used, such as underline or line-through. text-decoration-color sets the color of the decoration. text-decoration-style sets the style of the line used for the decoration, such as solid, wavy, or dashed. text-decoration-thickness sets the thickness of the line used for the decoration. formal definition initial valueas each of the properties of the shorthand:text-decoration-color: currentcolortext-decoration-style: solidtext-decoration-line: noneapplies toall elements. ...
...ed for the decoration, such as solid, wavy, or dashed. text-decoration-thickness sets the thickness of the line used for the decoration. formal definition initial valueas each of the properties of the shorthand:text-decoration-color: currentcolortext-decoration-style: solidtext-decoration-line: noneapplies toall elements. ...
...And 2 more matches
text-emphasis - CSS: Cascading Style Sheets
nherit, and the decoration specified is applied across the whole element. however, text-emphasis does inherit, which means it is possible to change emphasis marks for descendents. the size of the emphasis symbol, like ruby symbols, is about 50% of the size of the font, and text-emphasis may affect line height when the current leading is not enough for the marks. ...
...value of text-emphasis-position. this is because if the style and the color of emphasis marks may vary in a text, it is extremely unlikely that their position will. in the very rare cases when this is needed, the property text-emphasis-position. constituent properties this property is a shorthand for the following css properties: text-emphasis-color text-emphasis-style syntax /* initial value */ text-emphasis: none; /* no emphasis marks */ /* <string> value */ text-emphasis: 'x'; text-emphasis: '点'; text-emphasis: '\25b2'; text-emphasis: '*' #555; text-emphasis: 'foo'; /* should not use. ...
... this property is a shorthand for the following css properties: text-emphasis-color text-emphasis-style syntax /* initial value */ text-emphasis: none; /* no emphasis marks */ /* <string> value */ text-emphasis: 'x'; text-emphasis: '点'; text-emphasis: '\25b2'; text-emphasis: '*' #555; text-emphasis: 'foo'; /* should not use. it may be computed to or rendered as 'f' only */ /* keywords value */ text-emphasis: filled; text-emphasis: open; text-emphasis: filled sesame; text-emphasis: open sesame; /* keywords value combined with a color */ text-emphasis: filled sesame #555; /* global values */ text-emphasis: inherit; text-emphasis: initial; text-emphasis: unset; values none no emphasis marks. filled the shape is filled with solid color. if neither filled nor open is present, t...
...And 2 more matches
text-indent - CSS: Cascading Style Sheets
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. syntax /* <length> values */ text-indent: 3mm; text-indent: 40px; /* <percentage> value relative to the containing block width */ text-indent: 15%; /* keyword values */ text-indent: 5em each-line; text-indent: 5em hanging; text-indent: 5em hanging each-line; /* global values */ text-indent: inherit; text-indent: initial; text-indent: unset; values <length> indentation is specified as an absolute <length>. neg...
... <percentage> indentation is a <percentage> of the containing block's width. each-line indentation affects the first line of the block container as well as each line after a forced line break, but does not affect lines after a soft wrap break. ...
... <percentage> indentation is a <percentage> of the containing block's width. each-line indentation affects the first line of the block container as well as each line after a forced line break, but does not affect lines after a soft wrap break. hanging inverts which lines are indented. all lines except the first line will be indented. ...
...And 2 more matches
text-underline-position - CSS: Cascading Style Sheets
the text-underline-position css property specifies the position of the underline which is set using the text-decoration property's underline value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* single keyword */ text-underline-position: auto; text-underline-position: under; text-underline-position: left; text-underline-position: right; /* multiple keywords */ text-underline-position: under left; text-underline-position: right under; /* global values */ text-underline-position: inherit; text-underline-position: initial; text-underline-position: unset; syntax values auto the user agent uses its own algorithm to place the line at or under the alphabetic baseline. from-font if the font file includes information about a preferred position, use that value. if the font file doesn't include this information, behave as if auto was set, with...
...writing-modes, it is a synonym of under. auto-pos a synonym of auto, which should be used instead. above forces the line to be above the text. when used with east-asian text, using the auto keyword will lead to a similar effect. below forces the line to be below the text. when used with alphabetic text, using the auto keyword will lead to a similar effect. formal definition initial valueautoapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax auto | from-font | [ under | [ left | right ] ] examples a simple example let's take a couple of simple example paragraphs: <p class="horizontal">lorem ipsum dolor sit amet, consectetur adipiscing elit. nullam consectetur ac turpis vel laoreet. nullam volutpat pharetra lorem, sit amet feugiat...
...And 2 more matches
transition-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. 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. ...
...urations; 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. if there are more durations, the list is simply truncated to the right size. in both case the css declaration stays valid. syntax /* <time> values */ transition-duration: 6s; transition-duration: 120ms; transition-duration: 1s, 15s; transition-duration: 10s, 30s, 230ms; /* global values */ transition-duration: inherit; transition-duration: initial; transition-duration: unset; values <time> is a <time> denoting the amount of time the transition from the old value of a property to the new value should take. a time of 0s indicates that...
...ion: 10s, 30s, 230ms; /* global values */ transition-duration: inherit; transition-duration: initial; transition-duration: unset; values <time> is a <time> denoting the amount of time the transition from the old value of a property to the new value should take. a time of 0s indicates that no transition will happen, that is the switch between the two states will be instantaneous. a negative value for the time renders the declaration invalid. ...
...And 2 more matches
transition - CSS: Cascading Style Sheets
ame | duration | delay */ transition: margin-right 4s 1s; /* property name | duration | timing function */ transition: margin-right 4s ease-in-out; /* property name | duration | timing function | delay */ transition: margin-right 4s ease-in-out 1s; /* apply to 2 properties */ transition: margin-right 4s, color 1s; /* apply to all changed properties */ transition: all 0.5s ease-out; /* global values */ transition: inherit; transition: initial; transition: unset; the transition property is specified as one or more single-property transitions, separated by commas. each single-property transition describes the transition that should be applied to a single property (or the special values all and none). it includes: zero or one value representing the property to which the transition should...
...each single-property transition describes the transition that should be applied to a single property (or the special values all and none). it includes: zero or one value representing the property to which the transition should apply. this may be any one of: the keyword none the keyword all a <custom-ident> 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 ac...
...me> 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. ...
...And 2 more matches
url() - CSS: Cascading Style Sheets
Web › CSS › url()
the url() css function is used to include a file. the parameter is an absolute url, a relative url, or a data uri. the url() function can be passed as a parameter of another css functions, like the attr() function. depending on the property for which it is a value, the resource sought can be an image, font, or a stylesheet. the url() functional notation is the value for the <url> data type. /* simple usage */ url(https://example.com/images/myimg.jpg); url(data:image/png;base64,irxvb0…); url(myfont.woff); url(#idofsvgpath); /* associated properties */ background-image: url("https://mdn.mozillademos.org/files/16761/star.gif"); list-style-image: url('../images/bullet.jpg'); content: url("pdficon.jpg"); cursor: url(mycursor.cur); border-image-source: url(/media/diamonds.png); src: url('fantast...
...url('https://mdn.mozillademos.org/files/16761/star.gif') bottom right repeat-x blue; border-image: url("/media/diamonds.png") 30 fill / 30px / 30px space; /* as a parameter in another css function */ background-image: cross-fade(20% url(first.png), url(second.png)); mask-image: image(url(mask.png), skyblue, linear-gradient(rgba(0, 0, 0, 1.0), transparent); /* as part of a non-shorthand multiple value */ content: url(star.svg) url(star.svg) url(star.svg) url(star.svg) url(star.svg); /* at-rules */ @document url("https://www.example.com/") { ... } @import url("https://www.example.com/style.css"); @namespace url(http://www.w3.org/1999/xhtml); relative urls, if used, are relative to the url of the stylesheet (not to the url of the web page). the url() function can be included as a value for...
...on can be included as a value for background, background-image, list-style, list-style-image, content, cursor, border, border-image, border-image-source, mask, mask-image, src as part of a @font-face block, and @counter-style/symbol in css level 1, the url() functional notation described only true urls. in css level 2, the definition of url() was extended to describe any uri, including urns. css values and units level 3 returned to the narrower, initial definition. now, url() denotes only true <url>s. syntax values <string> <url> a url, which is a relative or absolute address, or pointer, to the web resource to be included, or a data uri, optionally in single or double quotes. quotes are required if the url includes parentheses, whitespace, or quotes, unless these characters are e...
...And 2 more matches
width - CSS: Cascading Style Sheets
Web › CSS › width
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>. ...
... <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. ...
... <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. ...
...And 2 more matches
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> s...
...rinsic inter-word spacing defined by the font. <percentage> specifies extra spacing as a percentage of the affected character’s advance width. examples html <div id="mozdiv1">here are many words...</div> <div id="mozdiv2">...and many more!</div> css #mozdiv1 { word-spacing: 15px; } #mozdiv2 { word-spacing: 5em; } accessibility concerns a large positive or negative word-spacing value will make the sentences the styling is applied to unreadable. for text styled with a very large positive value, the words will be so far apart that it will no longer appear to be a sentence. for text styled with a large negative value, the words will overlap each other to the point where the the beginning and end of each word is unrecognizable. legible word-spacing must be determined on a case-b...
... large positive value, the words will be so far apart that it will no longer appear to be a sentence. for text styled with a large negative value, the words will overlap each other to the point where the the beginning and end of each word is unrecognizable. legible word-spacing must be determined on a case-by-case basis, as different font families have different character widths. there is no one value that can ensure all font families automatically maintain their legibility. mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.8 | w3c understanding wcag 2.0 formal definition initial valuenormalapplies toall elements. ...
...And 2 more matches
Audio and Video Delivery - Developer guides
ack using flash. using flashmediaelement.swf is one way. <audio controls> <source src="audiofile.mp3" type="audio/mpeg"> <source src="audiofile.ogg" type="audio/ogg"> <!-- fallback for non supporting browsers goes here --> <a href="audiofile.mp3">download audio</a> <object width="320" height="30" type="application/x-shockwave-flash" data="flashmediaelement.swf"> <param name="movie" value="flashmediaelement.swf" /> <param name="flashvars" value="controls=true&isvideo=false&file=audiofile.mp3" /> </object> </audio> the process is very similar with video — just remember to set isvideo=true in the flashvars value parameters. more options for fallbacks. javascript audio var myaudio = document.createelement('audio'); if (myaudio.canplaytype('audio/mpeg')) { myaudio.set...
...ia streams for playback. allowing javascript to generate streams facilitates a variety of use cases like adaptive streaming and time shifting live streams. encrypted media extensions (eme) encrypted media extensions is a w3c proposal to extend htmlmediaelement, providing apis to control playback of protected content. the api supports use cases ranging from simple clear key decryption to high value video (given an appropriate user agent implementation). license/key exchange is controlled by the application, facilitating the development of robust playback applications supporting a range of content decryption and protection technologies. one of the principle uses of eme is to allow browsers to implement drm (digital rights management), which helps to prevent web-based content (especially v...
...ribute to an empty string will actually cause the browser to treat it as though you're setting a video source to a relative path. this causes the browser to attempt another download to something that is unlikely to be a valid video. seeking through media media elements provide support for moving the current playback position to specific points in the media's content. this is done by setting the value of the currenttime property on the element; see htmlmediaelement for further details on the element's properties. simply set the value to the time, in seconds, at which you want playback to continue. you can use the element's seekable property to determine the ranges of the media that are currently available for seeking to. this returns a timeranges object listing the ranges of times that you ca...
...And 2 more matches
Block formatting context - Developer guides
(elements with display: table-caption, which is the default for html table captions). anonymous table cells implicitly created by the elements with display: table, table-row, table-row-group, table-header-group, table-footer-group (which is the default for html tables, table rows, table bodies, table headers, and table footers, respectively), or inline-table. block elements where overflow has a value other than visible. display: flow-root. elements with contain: layout, content, or paint. flex items (direct children of the element with display: flex or inline-flex) if they are neither flex nor grid nor table containers themselves. grid items (direct children of the element with display: grid or inline-grid) if they are neither flex nor grid nor table containers themselves. multicol conta...
...ed alongside the floated element. as the content of the float is taller than the content alongside it, the border of the <div> now runs through the float. as explained in the guide to in-flow and out of flow elements, the float has been taken out of flow so the background and border of the <div> only contain the content and not the float. using overflow: auto setting overflow: auto or set other values than the initial value of overflow: visible created a new bfc containing the float. our <div> now becomes a mini-layout inside our layout. any child element will be contained inside it. the problem with using overflow to create a new bfc is that the overflow property is meant for telling the browser how you want to deal with overflowing content. there are some occasions in which you will find y...
...ing content. there are some occasions in which you will find you get unwanted scrollbars or clipped shadows when you use this property purely to create a bfc. in addition, it is potentially not readable for a future developer, as it might not be obvious why you used overflow for this purpose. if you use overflow, it is a good idea to comment the code to explain. ...
...And 2 more matches
DOM onevent handlers - Developer guides
e events, like window, document, xmlhttprequest, and others. for example, for the progress event on instances of xmlhttprequest: const xhr = new xmlhttprequest(); xhr.onprogress = function() { … }; html onevent attributes html elements have attributes named onevent which can be used to register a handler for an event directly within the html code. when the element is built from the html, the value of its onevent attributes are copied to the dom object that represents the element, so that accessing the attributes' values using javascript will get the value set in the html. further changes to the html attribute value can be done via the setattribute method; making changes to the javascript property will have no effect. html given this html document: <p>demonstrating quirks of <code>on<em...
... in the html. further changes to the html attribute value can be done via the setattribute method; making changes to the javascript property will have no effect. html given this html document: <p>demonstrating quirks of <code>on<em>event</em></code> html attributes on <a onclick="log('click!')">these three words</a>. </p> <div></div> javascript then this javascript demonstrates that the value of the html attribute is unaffected by changes to the javascript object's property. let logelement = document.queryselector('div'); let el = document.queryselector("a"); function log(msg) { logelement.innerhtml += `${msg}<br>` }; function anchoronclick(event) { log("changed onclick handler") }; // original handler log(`element's onclick as a javascript property: <code> ${el.onclick.tostring()}...
...log(`now even the html attribute has changed: <code> ${el.getattribute("onclick")} </code><br>`); result for historical reasons, some attributes/properties on the <body> and <frameset> elements instead set event handlers on their parent window object. (the html specification names these: onblur, onerror, onfocus, onload, and onscroll.) event handler's parameters, this binding, and the return value when the event handler is specified as an html attribute, the specified code is wrapped into a function with the following parameters: event — for all event handlers except onerror. event, source, lineno, colno, and error for the onerror event handler. note that the event parameter actually contains the error message as a string. when the event handler is invoked, the this keyword inside...
...And 2 more matches
Mouse gesture events - Developer guides
" gesture, by using two fingers as the corners of a rectangle and moving them either closer together or farther apart. this is typically used to zoom in and out on content (this is the default behavior in firefox, for example). mozmagnifygestureupdate the mozmagnifygestureupdate event is sent periodically while processing a magnify gesture, to provide updated status information. the event's delta value represents the amount by which the gesture has moved since the mozmagnifygesturestart or mozmagnifygestureupdate event. note: this event is sent whenever the movement of the user's fingers exceeds the number of pixels indicated by the browser.gesture.pinch.threshold preference. mozmagnifygesture the mozmagnifygesture event is sent when the user completes a "pinch" gesture. if you only care abou...
...ture.pinch.threshold preference. mozmagnifygesture the mozmagnifygesture event is sent when the user completes a "pinch" gesture. if you only care about the end results of the pinch gesture, you can simply watch for this event; however, if you want to provide feedback during the handling of the gesture, you should also watch the mozmagnifygesturestart and mozmagnifygestureupdate events. the delta value is the cumulative change over the course of handling the entire sequence of magnify gesture events. mozrotategesturestart the mozrotategesturestart event is sent when the user begins performing a rotate gesture, by placing two fingers on the trackpad and rotating them around the center of the trackpad. firefox uses this gesture to move backward and forward through the tabs in the current window. ...
...he user begins performing a rotate gesture, by placing two fingers on the trackpad and rotating them around the center of the trackpad. firefox uses this gesture to move backward and forward through the tabs in the current window. mozrotategestureupdate the mozrotategestureupdate event is sent periodically while processing a rotate gesture, to provide updated status information. the event's delta value represents the amount by which the gesture has moved since the mozrotategesturestart or mozrotategestureupdate event. note: this event is sent whenever the movement of the user's fingers exceeds the number of pixels indicated by the browser.gesture.pinch.threshold preference. mozrotategesture the mozrotategesture event is sent when the user completes a rotate gesture. if you only care about the...
...And 2 more matches
Using device orientation with 3D transforms - Developer guides
this article provides tips on how to use device orientation information in tandem with css 3d transforms. using orientation to rotate an element the easiest way to convert orientation data to a 3d transform is basically to use the alpha, gamma, and beta values as rotatez, rotatex and rotatey values. ...
... this article provides tips on how to use device orientation information in tandem with css 3d transforms. using orientation to rotate an element the easiest way to convert orientation data to a 3d transform is basically to use the alpha, gamma, and beta values as rotatez, rotatex and rotatey values. ...
... this article provides tips on how to use device orientation information in tandem with css 3d transforms. using orientation to rotate an element the easiest way to convert orientation data to a 3d transform is basically to use the alpha, gamma, and beta values as rotatez, rotatex and rotatey values. ...
...And 2 more matches
<colgroup> - HTML: Hypertext Markup Language
Web › HTML › Element › colgroup
nd <tr> element. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmltablecolelement attributes this element's attributes include the global attributes. span this attribute contains a positive integer indicating the number of consecutive columns the <colgroup> element spans. if not present, its default value is 1. note: this attribute is applied on the attributes of the column group, it has no effect on the css styling rules associated with it or, even more, to the cells of the column's members of the group. the span attribute is not permitted if there are one or more <col> elements within the <colgroup>. deprecated attributes the following attributes are deprecated and should not be us...
...ot permitted if there are one or more <col> elements within the <colgroup>. deprecated attributes the following attributes are deprecated and should not be used. they are documented below for reference when updating existing code and for historical interest only. align this enumerated attribute specifies how horizontal alignment of each column cell content will be handled. possible values are: left, aligning the content to the left of the cell center, centering the content in the cell right, aligning the content to the right of the cell justify, inserting spaces into the textual content so that the content is justified in the cell char, aligning the textual content on a special character with a minimal offset, defined by the char and charoff attributes. if this at...
... content to the left of the cell center, centering the content in the cell right, aligning the content to the right of the cell justify, inserting spaces into the textual content so that the content is justified in the cell char, aligning the textual content on a special character with a minimal offset, defined by the char and charoff attributes. if this attribute is not set, the left value is assumed. the descendant <col> elements may override this value using their own align attribute. note: do not try to set the text-align property on a selector giving a <colgroup> element. because <td> elements are not descendant of the <colgroup> element, they won't inherit it. if the table doesn't use a colspan attribute, use one td:nth-child(an+b) css selector per column, where a is...
...And 2 more matches
<fieldset>: The Field Set element - HTML: Hypertext Markup Language
Web › HTML › Element › fieldset
ute is set, all form controls that are descendants of the <fieldset>, are disabled, meaning they are not editable and won't be submitted along with the <form>. they won't receive any browsing events, like mouse clicks or focus-related events. by default browsers display such controls grayed out. note that form elements inside the <legend> element won't be disabled. ...
...by default there is a 2px groove border surrounding the contents, and a small amount of default padding. ...
...en if it is not inside the form. name the name associated with the group. note: the caption for the fieldset is given by the first <legend> element nested inside it. styling with css there are several special styling considerations for <fieldset>. its display value is block by default, and it establishes a block formatting context. if the <fieldset> is styled with an inline-level display value, it will behave as inline-block, otherwise it will behave as block. ...
...And 2 more matches
<keygen> - HTML: Hypertext Markup Language
Web › HTML › Element › keygen
rol. only one form element in a document can have the autofocus attribute, which is a boolean. challenge a challenge string that is submitted along with the public key. defaults to an empty string if not specified. disabled this boolean attribute indicates that the form control is not available for interaction. form the form element that this element is associated with (its form owner). the value of the attribute must be an id of a <form> element in the same document. if this attribute is not specified, this element must be a descendant of a <form> element. this attribute enables you to place <keygen> elements anywhere within a document, not just as descendants of their form elements. keytype the type of key generated. the default value is rsa. name the name of the control, which is s...
...the name and challenge attributes are required in all cases. the keytype attribute is optional for rsa key generation and required for dsa and ec key generation. ...
... keyparams="pqg-params" or pqg="pqg-params". for rsa keys, the keyparams parameter is not used (ignored if present). the user may be given a choice of rsa key strengths. currently, the user is given a choice between "high" strength (2048 bits) and "medium" strength (1024 bits). for dsa keys, the keyparams parameter specifies the dsa pqg parameters which are to be used in the keygen process. the value of the pqg parameter is the the base64 encoded, der encoded dss-parms as specified in ietf rfc 3279. the user may be given a choice of dsa key sizes, allowing the user to choose one of the sizes defined in the dsa standard. for ec keys, the keyparams parameter specifies the name of the elliptic curve on which the key will be generated. it is normally a string from the table in nskeygenhandler.cp...
...And 2 more matches
<tbody>: The Table Body element - HTML: Hypertext Markup Language
Web › HTML › Element › tbody
an be added after a <caption>, <colgroup>, and a <thead> element. implicit aria role rowgroup permitted aria roles any dom interface htmltablesectionelement attributes this element includes the global attributes. deprecated attributes align this enumerated attribute specifies how horizontal alignment of each cell content will be handled. possible values are: left, aligning the content to the left of the cell center, centering the content in the cell right, aligning the content to the right of the cell justify, inserting spaces into the textual content so that the content is justified in the cell char, aligning the textual content on a special character with a minimal offset, defined by the char and charoff attributes. if this at...
... content to the left of the cell center, centering the content in the cell right, aligning the content to the right of the cell justify, inserting spaces into the textual content so that the content is justified in the cell char, aligning the textual content on a special character with a minimal offset, defined by the char and charoff attributes. if this attribute is not set, the left value is assumed. as this attribute is deprecated, use the css text-align property instead. note: the equivalent text-align property for the align="char" is not implemented in any browsers yet. see the text-align's browser compatibility section for the <string> value. bgcolor the background color of the table. it is a 6-digit hexadecimal rgb code, prefixed by a '#'. one of the predefined co...
...if align is not set to char, this attribute is ignored. charoff this attribute is used to indicate the number of characters to offset the column data from the alignment characters specified by the char attribute. ...
...And 2 more matches
<time> - HTML: Hypertext Markup Language
Web › HTML › Element › time
the element and must be in one of the formats described below. usage notes this element is for presenting dates and times in a machine readable format. for example, this can help a user agent offer to add an event to a user's calendar. this element should not be used for dates prior to the introduction of the gregorian calendar (due to complications in calculating those dates). ...
...one of the formats described below. usage notes this element is for presenting dates and times in a machine readable format. for example, this can help a user agent offer to add an event to a user's calendar. this element should not be used for dates prior to the introduction of the gregorian calendar (due to complications in calculating those dates). ...
...elow. usage notes this element is for presenting dates and times in a machine readable format. for example, this can help a user agent offer to add an event to a user's calendar. this element should not be used for dates prior to the introduction of the gregorian calendar (due to complications in calculating those dates). ...
...And 2 more matches
dir - HTML: Hypertext Markup Language
the dir global attribute is an enumerated attribute that indicates the directionality of the element's text. the source for this interactive example is stored in a github repository. if 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 can have the following values: ltr, which means left to right and is to be used for languages that are written from the left to the right (like english); rtl, which means right to left and is to be used for languages that are written from the right to the left (like arabic); auto, which lets the user agent decide. it uses a basic algorithm as it parses the characters inside the element until it finds a character with a strong directionality, then applies...
...h lets the user agent decide. it uses a basic algorithm as it parses the characters inside the element until it finds a character with a strong directionality, then applies that directionality to the whole element. usage notes: this attribute is mandatory for the <bdo> element where it has a different semantic meaning. this attribute is not inherited by the <bdi> element. if not set, its value is auto. this attribute can be overridden by the css properties direction and unicode-bidi, if a css page is active and the element supports these properties. as the directionality of the text is semantically related to its content and not to its presentation, it is recommended that web developers use this attribute instead of the related css properties when possible. that way, the te...
... is active and the element supports these properties. as the directionality of the text is semantically related to its content and not to its presentation, it is recommended that web developers use this attribute instead of the related css properties when possible. that way, the text will display correctly even on a browser that doesn't support css or has the css deactivated. the auto value should be used for data with an unknown directionality, like data coming from user input, eventually stored in a database. browsers might allow users to change the directionality of <input> and <textarea>s in order to assist with authoring content. chrome and safari provide a directionality option in the contextual menu of input fields while internet explorer and edge use the key combinatio...
...And 2 more matches
Using HTTP cookies - HTTP
Web › HTTP › Cookies
er sent. additional restrictions to a specific domain and path can be set, limiting where the cookie is sent. for details about the header attributes mentioned below, refer to the set-cookie reference article. the set-cookie and cookie headers the set-cookie http response header sends cookies from the server to the user agent. a simple cookie is set like this: set-cookie: <cookie-name>=<cookie-value> this shows the server sending headers to tell the client to store a pair of cookies: http/2.0 200 ok content-type: text/html set-cookie: yummy_cookie=choco set-cookie: tasty_cookie=strawberry [page content] then, with every subsequent request to the server, the browser sends back all previously stored cookies to the server using the cookie header. get /sample_page.html http/2.0 host: www.ex...
...rectories match as well. for example, if path=/docs is set, these paths match: /docs /docs/web/ /docs/web/http samesite attribute the samesite attribute lets servers require that a cookie shouldn't be sent with cross-origin requests (where site is defined by the registrable domain), which provides some protection against cross-site request forgery attacks (csrf). ...
... browsers are migrating to have cookies default to samesite=lax. if a cookie is needed to be sent cross-origin, opt out of the samesite restriction by using the none directive. the none directive requires that the secure attribute also be used. ...
...And 2 more matches
CSP: base-uri - HTTP
csp version 2 directive type document directive default-src fallback no. not setting this allows any url. ...
... csp version 2 directive type document directive default-src fallback no. not setting this allows any url. ...
... the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content sour...
...And 2 more matches
Regular expression syntax cheatsheet - JavaScript
matches a nul character. do not follow this with another digit. \cx matches a control character using caret notation, where "x" is a letter from a–z (corresponding to codepoints u+0001–u+001f). for example, /\cm/ matches "\r" in "\r\n". \xhh matches the character with the code hh (two hexadecimal digits). \uhhhh matches a utf-16 code-unit with the value hhhh (four hexadecimal digits). \u{hhhh} or \u{hhhhh} (only when the u flag is set.) matches the character with the unicode value u+hhhh or u+hhhhh (hexadecimal digits). \ indicates that the following character should be treated specially, or "escaped". it behaves one of two ways. for characters that are usually treated literally, indicates that the next ch...
...the quantifier "non-greedy": meaning that it will stop as soon as it finds a match. for example, given a string like "some <foo> <bar> new </bar> </foo> thing": /<.*>/ will match "<foo> <bar> new </bar> </foo>" /<.*?>/ will match "<foo>" unicode property escapes if you are looking to contribute to this document, please also edit the original article // non-binary values \p{unicodepropertyvalue} \p{unicodepropertyname=unicodepropertyvalue} // binary and non-binary values \p{unicodebinarypropertyname} // negation: \p is negated \p \p{unicodepropertyvalue} \p{unicodebinarypropertyname} unicodebinarypropertyname the name of a binary property. e.g.: ascii, alpha, math, diacritic, emoji, hex_digit, math, white_space, etc. see unicode data proplist.txt for more...
...p is negated \p \p{unicodepropertyvalue} \p{unicodebinarypropertyname} unicodebinarypropertyname the name of a binary property. e.g.: ascii, alpha, math, diacritic, emoji, hex_digit, math, white_space, etc. see unicode data proplist.txt for more info. unicodepropertyname the name of a non-binary property: general_category (gc) script (sc) script_extensions (scx) see also propertyvaluealiases.txt unicodepropertyvalue one of the tokens listed in the values section, below. many values have aliases or shorthand (e.g. the value decimal_number for the general_category property may be written nd, digit, or decimal_number). for most values, the unicodepropertyname part and equals sign may be omitted. ...
...And 2 more matches
Classes - JavaScript
this behavior will be the same even if the "use strict" directive isn't present, because code within the class body's syntactic boundary is always executed in strict mode. class animal { speak() { return this; } static eat() { return this; } } let obj ...
... return math.hypot(dx, dy); } } const p1 = new point(5, 5); const p2 = new point(10, 10); p1.distance; //undefined p2.distance; //undefined console.log(point.distance(p1, p2)); // 7.0710678118654755 binding this with prototype and static methods when a static or prototype method is called without a value for this, such as by assigning a variable to the method and then calling it, the this value will be undefined inside the method. this behavior will be the same even if the "use strict" directive isn't present, because code within the class body's syntactic boundary is always executed in strict mode. class animal { speak() { return this; } static eat() { return this; } } let obj = new animal(); obj.speak(); // the animal object let speak = obj.speak; speak(); // undefin...
... function animal() { } animal.prototype.speak = function() { return this; } animal.eat = function() { return this; } let obj = new animal(); let speak = obj.speak; speak(); // global object (in non–strict mode) let eat = animal.eat; eat(); // global object (in non-st...
...And 2 more matches
SyntaxError: missing : after property id - JavaScript
the javascript exception "missing : after property id" occurs when objects are created using the object initializer syntax. a colon (:) separates keys and values for the object's properties. somehow, this colon is missing or misplaced. message syntaxerror: expected ':' (edge) syntaxerror: missing : after property id (firefox) error type syntaxerror what went wrong? ...
...en objects are created using the object initializer syntax. a colon (:) separates keys and values for the object's properties. somehow, this colon is missing or misplaced. message syntaxerror: expected ':' (edge) syntaxerror: missing : after property id (firefox) error type syntaxerror what went wrong? ...
...olon (:) separates keys and values for the object's properties. somehow, this colon is missing or misplaced. message syntaxerror: expected ':' (edge) syntaxerror: missing : after property id (firefox) error type syntaxerror what went wrong? ...
...And 2 more matches
TypeError: 'x' is not iterable - JavaScript
an iterable can be a built-in iterable type such as array, string or map, a generator result, or an object implementing the iterable protocol. ...
... an iterable can be a built-in iterable type such as array, string or map, a generator result, or an object implementing the iterable protocol. ...
... an iterable can be a built-in iterable type such as array, string or map, a generator result, or an object implementing the iterable protocol. ...
...And 2 more matches
Array.prototype.indexOf() - JavaScript
ject, 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 element in the array; -1 if not found. description indexof() compares searchelement to e...
...indexof() was added to the ecma-262 standard in the 5th edition; as such it may not be present in all browsers. you can work around this by utilizing the following code at the beginning of your scripts. this will allow you to use indexof() when there is still no native support. this algorithm matches the one specified in ecma-262, 5th edition, assuming typeerror and math.abs() have their original values. // this version tries to optimize by only checking for "in" when looking for undefined and // skipping the definitely fruitless nan search. other parts are merely 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) { ...
...urn -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 // all else for (; i !== len; ++i) if (that[i] === member) return i return -1 // if the value was not found, then return -1 } })(object, math.max, math.min) however, if you are more interested in all the little technical bits defined by the ecma standard, and are less concerned about performance or conciseness, then you may find this more descriptive polyfill to be more useful. // production steps of ecma-262, edition 5, 15.4.4.14 // reference: http://es5.github.io/#x15.4.4.14 if...
...And 2 more matches
Atomics.and() - JavaScript
the static atomics.and() method computes a bitwise and with a given value at a given position in the array, and returns the old value at that position. this atomic operation guarantees that no other write happens until the modified value is written back. the source for this interactive example is stored in a github repository. if 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 atomics.and(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. ...
... exceptions throws a typeerror, if typedarray is not one of the allowed integer types. ...
... exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. description the bitwise and operation only yields 1, if both a and b are 1. ...
...And 2 more matches
Atomics.or() - JavaScript
the static atomics.or() method computes a bitwise or with a given value at a given position in the array, and returns the old value at that position. this atomic operation guarantees that no other write happens until the modified value is written back. the source for this interactive example is stored in a github repository. if 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 atomics.or(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. ...
... exceptions throws a typeerror, if typedarray is not one of the allowed integer types. ...
... exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. description the bitwise or operation yields 1, if either a or b are 1. ...
...And 2 more matches
Atomics.xor() - JavaScript
the static atomics.xor() method computes a bitwise xor with a given value at a given position in the array, and returns the old value at that position. this atomic operation guarantees that no other write happens until the modified value is written back. the source for this interactive example is stored in a github repository. if 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 atomics.xor(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. ...
... exceptions throws a typeerror, if typedarray is not one of the allowed integer types. ...
... exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. description the bitwise xor operation yields 1, if a and b are different. ...
...And 2 more matches
Date - JavaScript
on the igalia blog and fill out the survey. it needs real-world feedback from web developers, but is not yet ready for production use! description the ecmascript epoch and timestamps a javascript date is fundamentally specified as the number of milliseconds that have elapsed since midnight on january 1, 1970, utc. ...
.... it needs real-world feedback from web developers, but is not yet ready for production use! description the ecmascript epoch and timestamps a javascript date is fundamentally specified as the number of milliseconds that have elapsed since midnight on january 1, 1970, utc. this date and time is the same as the unix epoch, which is the predominant base value for computer-recorded date and time values. note: it's important to keep in mind that while the time value at the heart of a date object is utc, the basic methods to fetch the date and time or its components all work in the local (i.e. host system) time zone and offset. it should be noted that the maximum date is not of the same value as the maximum safe integer (number.max_safe_integer is 9,007,199,254,740,991). instead, it is defined...
... device provides the local time. in addition to methods to read and alter individual components of the local date and time (such as getday() and sethours()), there are also versions of the same methods that read and manipulate the date and time using utc (such as getutcday() and setutchours()). constructor date() creates a new date object. static methods date.now() returns the numeric value corresponding to the current time—the number of milliseconds elapsed since january 1, 1970 00:00:00 utc, with leap seconds ignored. date.parse() parses a string representation of a date and returns the number of milliseconds since 1 january, 1970, 00:00:00 utc, with leap seconds ignored. note: parsing of strings with date.parse is strongly discouraged due to browser differences and inconsi...
...And 2 more matches
FinalizationRegistry.prototype.register() - JavaScript
the register() method registers an object with a finalizationregistry instance so that if the object is garbage-collected, the registry's callback may get called. syntax registry.register(target, heldvalue, [unregistertoken]); parameters target the target object to register. heldvalue the value to pass to the finalizer for this object. this cannot be the target object. unregistertoken optional a token that may be used with the unregister method later to unregister the target object. if provided (and not undefined), this must be an object. if not provided, the target cannot be unregistered. return value undefined. notes see the avoid where possible and notes on cleanup callbacks sections of the finalizationregistry page for important caveats. examples using register the foll...
... the target object. if provided (and not undefined), this must be an object. if not provided, the target cannot be unregistered. return value undefined. notes see the avoid where possible and notes on cleanup callbacks sections of the finalizationregistry page for important caveats. ...
...object. if provided (and not undefined), this must be an object. if not provided, the target cannot be unregistered. return value undefined. notes see the avoid where possible and notes on cleanup callbacks sections of the finalizationregistry page for important caveats. ...
...And 2 more matches
FinalizationRegistry.prototype.unregister() - JavaScript
the unregister unregisters a target object from a finalizationregistry instance. syntax registry.unregister(unregistertoken); parameters unregistertoken the token used with the register method when registering the target object. return value undefined. notes when a target object has been reclaimed, it is no longer registered in the registry. there is no need to all unregister in your cleanup callback. only call unregister if you haven't received a cleanup callback and no longer need to receive one. ...
... need to all unregister in your cleanup callback. only call unregister if you haven't received a cleanup callback and no longer need to receive one. examples using unregister this example shows registering a target object using that same object as the unregister token, then later unregistering it via unregister: class thingy { #cleanup = label => { // ^^^^^−−−−− held value console.error( `the \`release\` method was never called for the object with the label "${label}"` ); }; #registry = new finalizationregistry(this.#cleanup); /** * constructs a `thingy` instance. be sure to call `release` when you're done with it. * * @param label a label for the `thingy`. */ constructor(label) { // ...
... method was never called for the object with the label "${label}"` ); }; #registry = new finalizationregistry(this.#cleanup); /** * constructs a `thingy` instance. be sure to call `release` when you're done with it. * * @param label a label for the `thingy`. */ constructor(label) { // vvvvv−−−−− held value this.#registry.register(this, label, this); // target −−−−−^^^^ ^^^^−−−−− unregister token } /** * releases resources held by this `thingy` instance. */ release() { this.#registry.unregister(this); // ^^^^−−−−− unregister token } } this example shows registering a tar...
...And 2 more matches
FinalizationRegistry - JavaScript
at a cleanup callback get called at some point when an object registered with the registry has been reclaimed (garbage-collected). (cleanup callbacks are sometimes called finalizers.) note: cleanup callbacks should not be used for essential program logic. see notes on cleanup callbacks for details. you create the registry passing in the callback: const registry = new finalizationregistry(heldvalue => { // .... }); then you register any objects you want a cleanup callback for by calling the `register` method, passing in the object and a *held value* for it: registry.register(theobject, "some value"); the registry does not keep a strong reference to the object, as that would defeat the purpose (if the registry held it strongly, the object would never be reclaimed). if theobject is re...
...llback for by calling the `register` method, passing in the object and a *held value* for it: registry.register(theobject, "some value"); the registry does not keep a strong reference to the object, as that would defeat the purpose (if the registry held it strongly, the object would never be reclaimed). if theobject is reclaimed, your cleanup callback may be called at some point with the held value you provided for it ("some value" in the above). the held value can be any value you like: a primitive or an object, even undefined. if the held value is an object, the registry keeps a strong reference to it (so it can pass it to your cleanup callback later). ...
..., your cleanup callback may be called at some point with the held value you provided for it ("some value" in the above). the held value can be any value you like: a primitive or an object, even undefined. if the held value is an object, the registry keeps a strong reference to it (so it can pass it to your cleanup callback later). if you might want to unregister an object later, you pass a third value, which is the unregistration token you'll use later when calling the registry's unregister function to unregister the object. the registry only keeps a weak reference to the unregister token. ...
...And 2 more matches
Intl.Locale.prototype.numeric - JavaScript
the intl.locale.prototype.numeric property is an accessor property that returns whether the locale has special collation handling for numeric characters. description like intl.locale.casefirst, numeric represents a modification to the collation rules utilized by the locale. numeric is a boolean value, which means that it can be either true or false. if numeric is set to false, there will be no special handling of numeric values in strings. ...
... if numeric is set to false, there will be no special handling of numeric values in strings. if numeric is set to true, then the locale will take numeric characters into account when collating strings. this special numeric handling means that sequences of decimal digits will be compared as numbers. for example, the string "a-21" will be considered less than "a-123". examples setting the numeric value via the locale string in the unicode locale string spec, the values that numeric represents correspond to the key kn. kn is considered a locale string "extension subtag". these subtags add additional data about the locale, and are added to locale identifiers by using the -u extension key. ...
...e string "a-21" will be considered less than "a-123". examples setting the numeric value via the locale string in the unicode locale string spec, the values that numeric represents correspond to the key kn. kn is considered a locale string "extension subtag". these subtags add additional data about the locale, and are added to locale identifiers by using the -u extension key. thus, the numeric value can be added to the inital locale identifier string that is passed into the locale constructor. to set the numeric value, first add the -u extension key to the string. next, add the -kn extension key to indicate that you are adding a value for numeric. finally, add the numeric value to the string. ...
...And 2 more matches
Intl.NumberFormat.prototype.resolvedOptions() - JavaScript
h properties reflecting the locale and number formatting options computed during initialization of this numberformat object. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ve-examples and send us a pull request. syntax numberformat.resolvedoptions() return value a new object with properties reflecting the locale and number formatting options computed during the initialization of the given numberformat 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. ...
...ialization of the given numberformat 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. numberingsystem the value provided for this properties in the options argument, if present, or the value requested using the unicode extension key "nu" or filled in as a default. notation the value provided for this property in the options argument, if present, or "standard filled in as a default. compactdisplay the value provided for this property in the options argument, or "short" filled in as a default. this pro...
...And 2 more matches
Intl.RelativeTimeFormat() constructor - JavaScript
bjects. syntax new intl.relativetimeformat([locales[, options]]) parameters locales optional. a string with a bcp 47 language tag, or an array of such strings. for the general form and interpretation of the locales argument, see the intl page. options optional. an object with some or all of the following properties: localematcher the locale matching algorithm to use. possible values are "lookup" and "best fit"; the default is "best fit". for information about this option, see 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 val...
...le 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 formatter in your locale // with default values explicitly passed in. const rtf = new intl.relativetimeformat("en", { localematcher: "best fit", // other values: "lookup" numeric: "always", // other values: "auto" style: "long", // other values: "short" or "narrow" }); // format relative time using negative value (-1). rtf.format(-1, "day"); // > "1 day ago" // format relative time using positive value (1). rtf.format(1, "day")...
...rtf.format(-1, "day"); // > "yesterday" // format relative time using positive day unit (1). ...
...And 2 more matches
Map.prototype.forEach() - JavaScript
the foreach() method executes a provided function once per each key/value pair in the map object, in insertion order. the source for this interactive example is stored in a github repository. if 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 mymap.foreach(callback([value][,key][,map])[, thisarg]) parameters callback function to execute for each entry of mymap. it takes the following arguments: value optional value of each iteration. key optional key of each iteration. map optional the map being iterated (mymap in the above syntax box). thisarg optional value to use as this when executing callback. return value undefined. description the foreach method...
...y optional key of each iteration. map optional the map being iterated (mymap in the above syntax box). thisarg optional value to use as this when executing callback. return value undefined. description the foreach method executes the provided callback once for each key of the map which actually exist. it is not invoked for keys which have been deleted. however, it is executed for values which are present but have the value undefined. ...
... thisarg optional value to use as this when executing callback. return value undefined. description the foreach method executes the provided callback once for each key of the map which actually exist. it is not invoked for keys which have been deleted. however, it is executed for values which are present but have the value undefined. callback is invoked with three arguments: the entry's value the entry's key the map object being traversed if a thisarg parameter is provided to foreach, it will be passed to callback when invoked, for use as its this value. otherwise, the value undefined will be passed for use as its this value. the this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. ...
...And 2 more matches
Number.POSITIVE_INFINITY - JavaScript
the number.positive_infinity property represents the positive infinity value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of number.positive_infinity writable no enumerable no configurable no description the value of number.positive_infinity is the same as the value of the global object's infinity property. this value behaves slightly differently than mathematical infinity: any positive value, including positive_infinity, multiplied by positive_infinity is positive_infinity. any negative valu...
... positive_infinity, divided by either negative_infinity or positive_infinity, is nan. ...
...infinity is negative_infinity. any positive number divided by positive_infinity is positive zero. any negative number divided by positive_infinity is negative zero. zero multiplied by positive_infinity is nan. nan multiplied by positive_infinity is nan. positive_infinity, divided by any negative value except negative_infinity, is negative_infinity. positive_infinity, divided by any positive value except positive_infinity, is positive_infinity. positive_infinity, divided by either negative_infinity or positive_infinity, is nan. you might use the number.positive_infinity property to indicate an error condition that returns a finite number in case of success. note, however, that isfinite would be more appropriate in such a case. because positive_infinity is a static property of number, y...
...And 2 more matches
Object.getOwnPropertyDescriptor() - JavaScript
example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.getownpropertydescriptor(obj, prop) parameters obj the object in which to look for the property. prop the name or symbol of the property whose description is to be retrieved. return value a property descriptor of the given property if it exists on the object, undefined otherwise. description this method permits examination of the precise description of a property. a property in javascript consists of either a string-valued name or a symbol and a property descriptor. further information about property descriptor types and their attributes can be found in object.defineproperty().
...fined otherwise. description this method permits examination of the precise description of a property. a property in javascript consists of either a string-valued name or a symbol and a property descriptor. further information about property descriptor types and their attributes can be found in object.defineproperty(). a property descriptor is a record with some of the following attributes: value the value associated with the property (data descriptors only). writable true if and only if the value associated with the property may be changed (data descriptors only). get a function which serves as a getter for the property, or undefined if there is no getter (accessor descriptors only). set a function which serves as a setter for the property, or undefined if there is no setter (acce...
...ng object. ...
...And 2 more matches
Object.is() - JavaScript
the object.is() method determines whether two values are the same value. syntax object.is(value1, 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. ...
... the object.is() method determines whether two values are the same value. syntax object.is(value1, 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. ...
... this is also not the same as being equal according to the === operator. ...
...And 2 more matches
Object.prototype.__proto__ - JavaScript
ect.setprototypeof (though still, setting the [[prototype]] of an object is a slow operation that should be avoided if performance is a concern). the __proto__ property can also be used in an object literal definition to set the object [[prototype]] on creation, as an alternative to object.create(). see: object initializer / literal syntax. description the __proto__ getter function exposes the value of the internal [[prototype]] of an object. for objects created using an object literal, this value is object.prototype. for objects created using array literals, this value is array.prototype. for functions, this value is function.prototype. for objects created using new fun, where fun is one of the built-in constructor functions provided by javascript (array, boolean, date, number, object, stri...
...(that is, if the constructor didn't return an other object explicitly, or the fun.prototype has been reassigned since the instance was created.) the __proto__ setter allows the [[prototype]] of an object to be mutated. ...
...or functions, this value is function.prototype. for objects created using new fun, where fun is one of the built-in constructor functions provided by javascript (array, boolean, date, number, object, string, and so on — including new constructors added as javascript evolves), this value is always fun.prototype. for objects created using new fun, where fun is a function defined in a script, this value is the value of fun.prototype. (that is, if the constructor didn't return an other object explicitly, or the fun.prototype has been reassigned since the instance was created.) the __proto__ setter allows the [[prototype]] of an object to be mutated. the object must be extensible according to object.isextensible(): if it is not, a typeerror is thrown. ...
...And 2 more matches
Promise.allSettled() - JavaScript
essfully, or you'd always like to know the result of each promise. in comparison, the promise returned by promise.all() may be more appropriate if the tasks are dependent on each other / if you'd like to immediately reject upon any of them rejecting. syntax promise.allsettled(iterable); parameters iterable an iterable object, such as an array, in which each member is a promise. return value a pending promise that will be asynchronously fulfilled once every promise in the specified collection of promises has completed, either by successfully being fulfilled or by being rejected. at that time, the returned promise's handler is passed as input an array containing the outcome of each promise in the original set of promises. however, if and only if an empty iterable is passed as an arg...
... at that time, the returned promise's handler is passed as input an array containing the outcome of each promise in the original set of promises. however, if and only if an empty iterable is passed as an argument, promise.allsettled() returns a promise object that has already been resolved as an empty array. for each outcome object, a status string is present. ...
...ontaining the outcome of each promise in the original set of promises. however, if and only if an empty iterable is passed as an argument, promise.allsettled() returns a promise object that has already been resolved as an empty array. for each outcome object, a status string is present. if the status is fulfilled, then a value is present. if the status is rejected, then a reason is present. ...
...And 2 more matches
String.prototype.charCodeAt() - JavaScript
e is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the utf-16 code unit matches the unicode code point for code points which can be represented in a single utf-16 code unit. ...
...es and send us a pull request. the utf-16 code unit matches the unicode code point for code points which can be represented in a single utf-16 code unit. if the unicode code point cannot be represented in a single utf-16 code unit (because its value is greater than 0xffff) then the code unit returned will be the first part of a surrogate pair for the code point. if you want the entire code point value, use codepointat(). 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 ...
... value a number representing the utf-16 code unit value of the character at the given index. if index is out of range, charcodeat() returns nan. description unicode code points range from 0 to 1114111 (0x10ffff). the first 128 unicode code points are a direct match of the ascii character encoding. (for information on unicode, see the javascript guide.) note: charcodeat() will always return a value that is less than 65536. this is because the higher code points are represented by a pair of (lower valued) "surrogate" pseudo-characters which are used to comprise the real character. ...
...And 2 more matches
String.prototype.codePointAt() - JavaScript
if there is no element at pos, returns undefined. description if there is no element at the specified position, undefined is returned. ...
...if there is no element at pos, returns undefined. description if there is no element at the specified position, undefined is returned. if no utf-16 surrogate pair begins at pos, the code unit at pos is returned. ...
...if there is no element at pos, returns undefined. description if there is no element at the specified position, undefined is returned. if no utf-16 surrogate pair begins at pos, the code unit at pos is returned. ...
...And 2 more matches
String.fromCharCode() - JavaScript
ke to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax string.fromcharcode(num1[, ...[, numn]]) parameters num1, ..., numn a sequence of numbers that are utf-16 code units. the range is between 0 and 65535 (0xffff). numbers greater than 0xffff are truncated. no validity checks are performed. return value a string of length n consisting of the n specified utf-16 code units. description this method returns a string and not a string object. because fromcharcode() is a static method of string, you always use it as string.fromcharcode(), rather than as a method of a string object you created. returning supplementary characters in utf-16, the most common characters can be represented by a single...
...ng 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. a code unit). however, this set of characters, known as the base multilingual plane (bmp), is only 1/17th of the total addressable unicode code points. the remaining code points, in the range of 65536 (0x010000) to 1114111 (0x10ffff) are known as supplementary characters. in utf-16, supplementary characters are represented by two 16-bit code units, known as surrogates, that were reserved fo...
...de points, in the range of 65536 (0x010000) to 1114111 (0x10ffff) are known as supplementary characters. in utf-16, supplementary characters are represented by two 16-bit code units, known as surrogates, that were reserved for this purpose. a valid combination of two surrogates used to represent a supplementary character is known as a surrogate pair. ...
...And 2 more matches
String.prototype.replace() - JavaScript
or this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax const newstr = str.replace(regexp|substr, newsubstr|function) parameters regexp (pattern) a regexp object or literal. the match or matches are replaced with newsubstr or the value returned by the specified function. substr a string that is to be replaced by newsubstr. it is treated as a literal string and is not interpreted as a regular expression. only the first occurrence will be replaced. newsubstr (replacement) the string that replaces the substring specified by the specified regexp or substr parameter. a number of special replacement patterns are supported; see th...
...ubstr parameter. a number of special replacement patterns are supported; see the "specifying a string as a parameter" section below. function (replacement) a function to be invoked to create the new substring to be used to replace the matches to the given regexp or substr. the arguments supplied to this function are described in the "specifying a function as a parameter" section below. return value a new string, with some or all matches of a pattern replaced by a replacement. description this method does not change the calling string object. it simply returns a new string. to perform a global search and replace, include the g switch in the regular expression. specifying a string as a parameter the replacement string can include the following special replacement patterns: pat...
...ng group name. if the group is not in the regular expressions (or not in the match), this will resolve to the empty string. only available in browser versions supporting named capturing groups. specifying a function as a parameter you can specify a function as the second parameter. in this case, the function will be invoked after the match has been performed. ...
...And 2 more matches
String.prototype.replaceAll() - JavaScript
e-examples and send us a pull request. syntax const newstr = str.replaceall(regexp|substr, newsubstr|function) when using a `regexp` you must have to set the global ("g") flag; otherwise, it will throw a typeerror: "replaceall must be called with a global regexp". parameters regexp (pattern) a regexp object or literal with the global flag. the matches are replaced with newsubstr or the value returned by the specified function. a regexp without the global ("g") flag will throw a typeerror: "replaceall must be called with a global regexp". substr a string that is to be replaced by newsubstr. it is treated as a literal string and is not interpreted as a regular expression. newsubstr (replacement) the string that replaces the substring specified by the specified regexp or substr para...
...ubstr parameter. a number of special replacement patterns are supported; see the "specifying a string as a parameter" section below. function (replacement) a function to be invoked to create the new substring to be used to replace the matches to the given regexp or substr. the arguments supplied to this function are described in the "specifying a function as a parameter" section below. return value a new string, with all matches of a pattern replaced by a replacement. description this method does not change the calling string object. it simply returns a new string. specifying a string as a parameter the replacement string can include the following special replacement patterns: pattern inserts $$ inserts a "$". $& inserts the matched substring. ...
...bstring. $n where n is a positive integer less than 100, inserts the nth parenthesized submatch string, provided the first argument was a regexp object. note that this is 1-indexed. specifying a function as a parameter you can specify a function as the second parameter. in this case, the function will be invoked after the match has been performed. ...
...And 2 more matches
Symbol - JavaScript
the data type symbol is a primitive data type. the symbol() function returns a value of type symbol, has static properties that expose several members of built-in objects, has static methods that expose the global symbol registry, and resembles a built-in object class, but is incomplete as a constructor because it does not support the syntax "new symbol()". every symbol value returned from symbol() is unique. a symbol value may be used as an identifier for object properties; this is the data type's primary purpose, although other use-cases exist, such as enabling opaque data types, or serving as an implementation-supported unique identifier in general. some further explanation about purpose and usage can be found in the glossary entry for symbol. description to create a new primitive sy...
...') the above code creates three new symbols. note that symbol("foo") does not coerce the string "foo" into a symbol. it creates a new symbol each time: symbol('foo') === symbol('foo') // false the following syntax with the new operator will throw a typeerror: let sym = new symbol() // typeerror this prevents authors from creating an explicit symbol wrapper object instead of a new symbol value and might be surprising as creating explicit wrapper objects around primitive data types is generally possible (for example, new boolean, new string and new number). if you really want to create a symbol wrapper object, you can use the object() function: let sym = symbol('foo') typeof sym // "symbol" let symobj = object(sym) typeof symobj // "object" shared symbols in the global symbol...
...w symbol object. it is incomplete as a constructor because it does not support the syntax "new symbol()". static properties symbol.asynciterator a method that returns the default asynciterator for an object. used by for await...of. symbol.hasinstance a method determining if a constructor object recognizes an object as its instance. used by instanceof. symbol.isconcatspreadable a boolean value indicating if an object should be flattened to its array elements. used by array.prototype.concat(). symbol.iterator a method returning the default iterator for an object. used by for...of. symbol.match a method that matches against a string, also used to determine if an object may be used as a regular expression. used by string.prototype.match(). symbol.matchall a method that returns an it...
...And 2 more matches
TypedArray.prototype.findIndex() - JavaScript
the findindex() method returns an index in the typed array, if an element in the typed array satisfies the provided testing function. otherwise -1 is returned. see also the find() method, which returns the value of a found element in the typed array instead of its index. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.findindex(callback[, thisarg]) parameters callback function to execute on each value in the typed array, taking three arguments: element the current element being processed in the typed array. index the index of the current element being processed in the typed array. ...
...if such an element is found, findindex immediately returns the index of that element. ...
...ocessed in the typed array. array the typed array findindex was called upon. thisarg optional. object to use as this when executing callback. return value an index in the array if an element passes the test; otherwise, -1. description the findindex method executes the callback function once for each element present in the typed array until it finds one where callback returns a true value. if such an element is found, findindex immediately returns the index of that element. otherwise, findindex returns -1. ...
...And 2 more matches
isFinite() - JavaScript
description isfinite is a top-level function and is not associated with any object. you can use this function to determine whether a number is a finite number. ...
... description isfinite is a top-level function and is not associated with any object. you can use this function to determine whether a number is a finite number. ...
... description isfinite is a top-level function and is not associated with any object. you can use this function to determine whether a number is a finite number. ...
...And 2 more matches
undefined - JavaScript
the global undefined property represents the primitive value undefined. it is one of javascript's primitive types. property attributes of undefined writable no enumerable no configurable no the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax undefined description undefined is a property of the global object. that is, it is a variable in global scope. the initial value of undefined is the primitive value undefined. in modern browsers (javascript 1.8.5 / firefox 4+), undefined is a non-configurable, non-writable prop...
... be careful. ...
... be careful. while it is possible to use it as an identifier (variable name) in any scope other than the global scope (because undefined is not a reserved word), doing so is a very bad idea that will make your code difficult to maintain and debug. ...
...And 2 more matches
Equality (==) - JavaScript
e two operands. this can be roughly summarised as follows: if the operands are both objects, return true only if both operands reference the same object. if one operand is null and the other is undefined, return true. if the operands are of different types, try to convert them to the same type before comparing: when comparing a number to a string, try to convert the string to a numeric value. if one of the operands is boolean, convert the boolean operand to 1 if it is true and +0 if it is false. if one of the operands is an object and the other is a number or a string, try to convert the object to a primitive using the object's valueof() and tostring() methods. if the operands have the same type, they are compared as follows: string: return true only if both operand...
...if either operand is nan, return false. boolean: return true only if operands are both true or both false. ...
...if either operand is nan, return false. boolean: return true only if operands are both true or both false. the most notable difference between this operator and the strict equality (===) operator is that the strict equality operator does not attempt type conversion. ...
...And 2 more matches
Logical AND (&&) - JavaScript
the logical and (&&) operator (logical conjunction) for a set of operands is true if and only if all of its operands are true. it is typically used with boolean (logical) values. when it is, it returns a boolean value. however, the && operator actually returns the value of one of the specified operands, so if this operator is used with non-boolean values, it will return a non-boolean value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax expr1 && expr2 description if expr1 can be converted to true, returns expr2; else, returns expr1. if a value can be converted to true, the value is so-called truthy. if a...
...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. syntax expr1 && expr2 description if expr1 can be converted to true, returns expr2; else, returns expr1. if a value can be converted to true, the value is so-called truthy. if a value can be converted to false, the value is so-called falsy. examples of expressions that can be converted to false are: null; nan; 0; empty string ("" or '' or ``); undefined. even though the && operator can be used with operands that are not boolean values, it can still be considered a boolean operator since its return value can always be converted to a boolean primitive. to explicitly co...
... to false, the value is so-called falsy. examples of expressions that can be converted to false are: null; nan; 0; empty string ("" or '' or ``); undefined. even though the && operator can be used with operands that are not boolean values, it can still be considered a boolean operator since its return value can always be converted to a boolean primitive. to explicitly convert its return value (or any expression in general) to the corresponding boolean value, use a double not operator or the boolean constructor. short-circuit evaluation the logical and expression is evaluated left to right, it is tested for possible "short-circuit" evaluation using the following rule: (some falsy expression) && expr is short-circuit evaluated to the falsy expression; short circuit means that the ex...
...And 2 more matches
typeof - JavaScript
ke to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax the typeof operator is followed by its operand: typeof operand typeof(operand) parameters operand an expression representing the object or primitive whose type is to be returned. description the following table summarizes the possible return values of typeof. for more information about types and primitives, see also the javascript data structure page. type result undefined "undefined" null "object" (see below) boolean "boolean" number "number" bigint (new in ecmascript 2020) "bigint" string "string" symbol (new in ecmascript 2015) "symbol" ...
... the only known browser to have actually taken advantage of this is old internet explorer (see below). examples basic usage // numbers typeof 37 === 'number'; typeof 3.14 === 'number'; typeof(42) === 'number'; typeof math.ln2 === 'number'; typeof infinity === 'number'; typeof nan === 'number'; // despite being "not-a-number" typeof number('1') ===...
...is old internet explorer (see below). ...
...And 2 more matches
Expressions and operators - JavaScript
to another generator function or iterable object. async function the async function defines an async function expression. await pause and resume an async function and wait for the promise's resolution/rejection. [] array initializer/literal syntax. {} object initializer/literal syntax. /ab+c/i regular expression literal syntax. ( ) grouping operator. left-hand-side expressions left values are the destination of an assignment. property accessors member operators provide access to a property or method of an object (object.property and object["property"]). new the new operator creates an instance of a constructor. new.target in constructors, new.target refers to the constructor that was invoked by new. super the super keyword calls the parent constructor. ...obj spread ...
...t postfix/prefix increment and postfix/prefix decrement operators. a++ postfix increment operator. a-- postfix decrement operator. ++a prefix increment operator. --a prefix decrement operator. unary operators a unary operation is operation with only one operand. delete the delete operator deletes a property from an object. void the void operator discards an expression's return value. ...
.... void the void operator discards an expression's return value. typeof the typeof operator determines the type of a given object. + the unary plus operator converts its operand to number type. - the unary negation operator converts its operand to number type and then negates it. ~ bitwise not operator. ! logical not operator. arithmetic operators arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value. + addition operator. - subtraction operator. / division operator. * multiplication operator. % remainder operator. ** exponentiation operator. relational operators a comparison operator compares its operands and returns a boolean value based on whether the comparison is true. in the in oper...
...And 2 more matches
export - JavaScript
exported modules are in strict mode whether you declare them as such or not. the export statement cannot be used in embedded scripts. ...
... exported modules are in strict mode whether you declare them as such or not. the export statement cannot be used in embedded scripts. ...
...xport individual features (can export var, let, // const, function, class) export let myvariable = math.sqrt(2); export function myfunction() { ... }; default exports: // export feature declared earlier as default export { myfunction as default }; // export individual features as default export default function () { ... } export default class { .. } named exports are useful to export several values. during the import, it is mandatory to use the same name of the corresponding object. but a default export can be imported with any name for example: // file test.js let k; export default k = 12; // some other file import m from './test'; // note that we have the freedom to use import m instead of import k, because k was default export console.log(m); // will log 12 you can also ren...
...And 2 more matches
let - JavaScript
the let statement declares a block-scoped local variable, optionally initializing it to a value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax let var1 [= value1] [, var2 [= value2]] [, ..., varn [= valuen]; parameters var1, var2, …, varn the names of the variable or variables to declare. each must be a legal javascript identifier. value1, value2, …, valuen optional for each variable declared, you may optionally specify its initial value to any legal javascript expression. description let allows you to declare variables that are limited to the scope of a block statement, or expression on which...
... just like const the let does not create properties of the window object when declared globally (in the top-most scope). an explanation of why the name "let" was chosen can be found here. ...
...ion. break; } however, it's important to point out that a block nested inside a case clause will create a new block scoped lexical environment, which will not produce the redeclaration errors shown above. let x = 1; switch(x) { case 0: { let foo; break; } case 1: { let foo; break; } } temporal dead zone unlike variables declared with var, which will start with the value undefined, let variables are not initialized until their definition is evaluated. accessing the variable before the initialization results in a referenceerror. the variable is in a "temporal dead zone" from the start of the block until the initialization is processed. function do_something() { console.log(bar); // undefined console.log(foo); // referenceerror var bar = 1; let foo = 2; } ...
...And 2 more matches
cx - SVG: Scalable Vector Graphics
Web › SVG › Attribute › cx
nt cx="25%" 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. ...
..."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. ...
...rcle for <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. ...
...And 2 more matches
cy - SVG: Scalable Vector Graphics
Web › SVG › Attribute › cy
cy="25%" 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. ...
... 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. ...
... for <circle>, 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. ...
...And 2 more matches
display - SVG: Scalable Vector Graphics
Web › SVG › Attribute › display
the display attribute lets you control the rendering of graphical or container elements. a value of display="none" indicates that the given element and its children will not be rendered. any value other than none or inherit indicates that the given element will be rendered by the browser. when applied to a container element, setting display to none causes the container and all of its children to be invisible; thus, it acts on groups of elements as a group. this means that any child of an element with display="none" will never be rendered even if the child has a value for display other than none. when the display attribute is set to none, then the given element does not become part of the rendering tree. it has implications for the <tspan>, <tref>, and <altglyph> elements, event processing, ...
...ng of a given element, whereas it does not prevent elements from being referenced by other elements. for example, setting it to none on a <path> element will prevent that element from getting rendered directly onto the canvas, but the <path> element can still be referenced by a <textpath> element; furthermore, its geometry will be used in text-on-a-path processing even if the <path> has a display value of none. this attribute also affects direct rendering into offscreen canvases, such as occurs with masks or clip paths. thus, setting display="none" on a child of a <mask> will prevent the given child element from being rendered as part of the mask. similarly, setting display="none" on a child of a <clippath> element will prevent the given child element from contributing to the clipping path. n...
...&& [ flow | flow-root ]? && list-item<display-internal> = table-row-group | table-header-group | tabl...
...And 2 more matches
divisor - SVG: Scalable Vector Graphics
Web › SVG › Attribute › divisor
the divisor attribute specifies the value by which the resulting number of applying the kernelmatrix of a <feconvolvematrix> element to the input image color value is divided to yield the destination color value. a divisor that is the sum of all the matrix values tends to have an evening effect on the overall color intensity of the result. only one element is using this attribute: <feconvolvematrix> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="convolvematrix1" x="0" y="0" width="100%" height="100%"> <feconvolvematrix kernelmatrix="1 2 0 0 0 0 0 0 -1" divisor="1"/> </filter> <filter id="convolvematrix2" x="0" y="0" width="100%" height="100%"> <feconvolvematrix kernelmatrix="1 2 0 0 0 0 0 0 -1" divisor="8"/> ...
... specifications specification status comment filter effects module level 1the definition of 'divisor' in that specification. ...
... specifications specification status comment filter effects module level 1the definition of 'divisor' in that specification. working draft no change ...
...And 2 more matches
in - SVG: Scalable Vector Graphics
Web › SVG › Attribute › in
the in attribute identifies input for the given filter primitive. the value can be either one of the six keywords defined below, or a string which matches a previous result attribute value within the same <filter> element. if no value is provided and this is the first filter primitive, then this filter primitive will use sourcegraphic as its input. if no value is provided and this is a subsequent filter primitive, then this filter primitive will use the result from the previous filter primitive as its input. if the value for result appears multiple times within a given <filter> element, then a reference to that result will use the closest preceding filter primitive with the given value for attribute result. fourteen elements are using this attribute: <feblend>, <fecolormatrix>, <fecomponent...
...sult will use the closest preceding filter primitive with the given value for attribute result. fourteen elements are using this attribute: <feblend>, <fecolormatrix>, <fecomponenttransfer>, <fecomposite>, <feconvolvematrix>, <fediffuselighting>, <fedisplacementmap>, <fedropshadow>, <fegaussianblur>, <femergenode>, <femorphology>, <feoffset>, <fespecularlighting>, <fetile> usage notes value sourcegraphic | sourcealpha | backgroundimage | backgroundalpha | fillpaint | strokepaint | <filter-primitive-reference> default value sourcegraphic for first filter primitive, otherwise result of previous filter primitive animatable yes sourcegraphic this keyword represents the graphics elements that were the original input into the <filter> element. sourcea...
...to the <filter> element. sourcealpha has all of the same rules as sourcegraphic except that only the alpha channel is used. backgroundimage this keyword represents an image snapshot of the svg document under the filter region at the time that the <filter> element was invoked. backgroundalpha same as backgroundimage except only the alpha channel is used. fillpaint this keyword represents the value of the fill property on the target element for the filter effect. in many cases, the fillpaint is opaque everywhere, but that might not be the case if a shape is painted with a gradient or pattern which itself includes transparent or semi-transparent parts. strokepaint this keyword represents the value of the stroke property on the target element for the filter effect. in many cases, the stroke...
...And 2 more matches
keySplines - SVG: Scalable Vector Graphics
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 unless the calcmode attribute is set to spline. if there are any errors in the keysplines specification (bad values, too many or too few values), the animation will not occur. ...
...s, too many or too few values), the animation will not occur. ...
... <control-point...
...And 2 more matches
markerUnits - SVG: Scalable Vector Graphics
the markerunits attribute defines the coordinate system for the markerwidth and markerunits attributes and the contents of the <marker>. ...
... the markerunits attribute defines the coordinate system for the markerwidth and markerunits attributes and the contents of the <marker>. ...
... the markerunits attribute defines the coordinate system for the markerwidth and markerunits attributes and the contents of the <marker>. ...
...And 2 more matches
order - SVG: Scalable Vector Graphics
Web › SVG › Attribute › order
the first number, indicates the num...
...the first number, indicates the number of columns in the matrix. the second number, in...
..."3 0 0 0 0 0 0 0 -4" order="1 1 1"/> </filter> <rect x="0" y="0" width="200" height="200" style="filter:url(#emboss1);" /> <rect x="0" y="0" width="200" height="200" style="filter:url(#emboss2); transform: translatex(220px);" /> </svg> usage notes value <number-optional-number> default value 3 animatable yes <number-optional-number> this value indicates the number of cells in each dimension for the kernel matrix. the values provided must be <integer>s greater than zero. values that are not integers will be truncated, i.e. rounded to the closest integer value towards zero. the first number, indicates the number of columns in the matrix. the second number, indicates the number of rows in the matrix. if no second number is not provided, i...
...And 2 more matches
overflow - SVG: Scalable Vector Graphics
the overflow attribute sets what to do when an element's content is too big to fit in its block formatting context. it has the same parameter values and meaning as the css overflow property, however, the following additional points apply: if it has a value of visible, the attribute has no effect (i.e., a clipping rectangle is not created). if the overflow property has the value hidden or scroll, a clip of the exact size of the svg viewport is applied. when scroll is specified on an <svg> element, a scrollbar or panner is normally shown for the svg viewport whether or not any of its content is clipped. within svg content, the value auto implies that all rendered content for child elements must be visible, either through a scrolling mechanism, or by rendering with no clip. although the ...
...f the exact size of the svg viewport is applied. when scroll is specified on an <svg> element, a scrollbar or panner is normally shown for the svg viewport whether or not any of its content is clipped. within svg content, the value auto implies that all rendered content for child elements must be visible, either through a scrolling mechanism, or by rendering with no clip. although the initial value for overflow is auto, it is overwritten in the user agent style sheet for the <svg> element when it is not the root element of a stand-alone document, the <pattern> element, and the <marker> element to be hidden by default. note: as a presentation attribute, overflow can be used as a css property. see the css opacity property for more information. as a presentation attribute, it can be applied ...
... specifications specification status comment css level 2 (revision 1)the definition of 'overflow' in that specification. recommendation definition in css scalable vector graphics (...
...And 2 more matches
requiredFeatures - SVG: Scalable Vector Graphics
supported by the browser; if all of them are supported, the attribute evaluates to true end the element is rendered; otherwise, the attribute evaluates to false and the current element and its children are skipped and thus will not be rendered. this provides a way to design svg that gracefully falls back when features aren't available. if the attribute is not present, then its implicit evaluated value is true. if a null string or empty string value is given to attribute requiredfeatures, the attribute is evaluate to false. requiredfeatures is often used in conjunction with the <switch> element. if requiredfeatures is used in other situations, it represents a simple switch on the given element whether to render the element or not. to detect availability of an svg feature from script, there is...
... feature strings the following are the ...
... feature strings the following are the feature strings for the requiredfeatures attr...
...And 2 more matches
visibility - SVG: Scalable Vector Graphics
note: as a presentation attribute, visibility can be used as a css property. see the css visibility property for more information. ...
... note: as a presentation attribute, visibility can be used as a css property. see the css visibility property for more information. ...
...though it is still part of the rendering tree, i.e. it may receive pointer events depending on the pointer-events attribute, may receive focus depending on the tabind...
...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. ...
... prior to firefox 72 firefox ignored word-spacing and renders text without. specifications specification status comment css text module level 3the definition of 'word-spacing' in that specificati...
...And 2 more matches
<animateMotion> - SVG: Scalable Vector Graphics
r="10s" repeatcount="indefinite" path="m20,50 c20,-50 180,150 180,50 c180-50 20,150 20,50 z" /> </circle> </svg> usage context categoriesanimation elementpermitted contentany number of the following elements, in any order:descriptive elements<mpath> attributes keypoints this attribute indicate, in the range [0,1], how far is the object along the path for each keytimes associated values. value type: <number>*; default value: none; animatable: no path this attribute defines the path of the motion, using the same syntax as the d attribute. value type: <string>; default value: none; animatable: no rotate this attribute defines a rotation applied to the elment animated along a path, usually to make it pointing in the direction of the animation. value type: <number>|auto|auto...
...umber>*; default value: none; animatable: no path this attribute defines the path of the motion, using the same syntax as the d attribute. value type: <string>; default value: none; animatable: no rotate this attribute defines a rotation applied to the elment animated along a path, usually to make it pointing in the direction of the animation. ...
... defines the path of the motion, using the same syntax as the d attribute. value type: <string>; default value: none; animatable: no rotate this attribute defines a rotation applied to the elment animated along a path, usually to make it pointing in the direction of the animation. ...
...And 2 more matches
<feColorMatrix> - SVG: Scalable Vector Graphics
the <fecolormatrix> svg filter element changes colors based on a transformation matrix. every pixel's color value [r,g,b,a] is matrix multiplied by a 5 by 5 color matrix to create new color [r',g',b',a']. the prime symbol ' is used in mathematics indicate the result of a transformation. | r' | | r1 r2 r3 r4 r5 | | r | | g' | | g1 g2 g3 g4 g5 | | g | | b' | = | b1 b2 b3 b4 b5 | * | b | | a' | | a1 a2 a3 a4 a5 | | a | | 1 | | 0 0 0 0 1 | | 1 | in simplified terms, below is how each color channel in the new pixel is calculated. the last row is ignored because its values are constant. r' = r1*r + r2*g + r3*b + r4*a + r5 g' = g1*r + g2*g + g3*b + g4*a + g5 b' = b1*r + b2*g + b3*b + b4*a + b5 a' = a1*r + a2*g + a3*b + a4*a + a5 take the amount of red in the ne...
... r1 * old red ] + [ r2 * old green ] + [ r3 * old blue ] + [ r4 * old alpha ] + [ shift of r5 ] if, say, we want to make a completely black image redder, we can make the r5 a positive real number x, boosting the redness on every pixel of the new image by x. an identity matrix looks like this: r g b a w r' | 1 0 0 0 0 | g' | 0 1 0 0 0 | b' | 0 0 1 0 0 | a' | 0 0 0 1 0 | in it, every new value is exactly 1 times its old value, with nothing else added. it is recommended to start manipulating the matrix from here. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes ...
...y 1 times its old value, with nothing else added. it is recommended to start manipulating the matrix from here. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in type values dom interface this element implements the svgfecolormatrixelement interface. example svg <svg width="100%" height="100%" viewbox="0 0 150 500" preserveaspectratio="xmidymid meet" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- ref --> <defs> <g id="circles"> <circle cx="30" cy="30" r="20" fill="blue" fill-opacity="0.5" /> ...
...And 2 more matches
<stop> - SVG: Scalable Vector Graphics
Web › SVG › Element › stop
ineargradient id="mygradient" gradienttransform="rotate(90)"> <stop offset="5%" stop-color="gold" /> <stop offset="95%" stop-color="red" /> </lineargradient> </defs> <!-- using my linear gradient --> <circle cx="5" cy="5" r="4" fill="url('#mygradient')" /> </svg> attributes offset this attribute defines where the gradient stop is placed along the gradient vector. ...
...form="rotate(90)"> <stop offset="5%" stop-color="gold" /> <stop offset="95%" stop-color="red" /> </lineargradient> </defs> <!-- using my linear gradient --> <circle cx="5" cy="5" r="4" fill="url('#mygradient')" /> </svg> attributes offset this attribute defines where the gradient stop is placed along the gradient vector. ...
...t> </defs> <!-- using my linear gradient --> <circle cx="5" cy="5" r="4" fill="url('#mygradient')" /> </svg> attributes offset this attribute defines where the gradient stop is placed along the gradient vector. value type: <number>|<percentage>; default value: 0; animatable: yes stop-color this attribute defines the color of the gradient stop. it can be used as a css property. value type: currentcolor|<color>|<icccolor>; default value: black; animatable: yes stop-opacity this attribute defines the opacity of the gradient stop. ...
...And 2 more matches
Example - SVG: Scalable Vector Graphics
ascript'> <![cdata[ // foil spam bots var email = '@riovia.net'; email ='nick' + email; document.getelementbyid('emailme').href = 'mailto:'+email; ]]> </script> this software is free for you to use in any way whatsoever, and comes with no warranty at all. ...
...ick' + email; document.getelementbyid('emailme').href = 'mailto:'+email; ]]> </script> this software is free for you to use in any way whatsoever, and comes with no warranty at all. </div> <form action="" onsubmit="return false;"> <p> <label>number of motes:</label> <input id='num_motes' value='5'/> <br/> <label>max. velocity:</label> <input id='max_velocity' value='15'/> <br/> <label>attraction to cursor:</label> <input id='attract_cursor' value='6'/> <br/> <label>repulsion from peers:</label> <input id='repel_peer' value='5'/> <br/> </p> </form> <script type='text/javascript'> <![cdata[ // array of motes var motes; // get the display element. function display() { return document.getelementbyid('display');...
...function(pos, mag) { if( pos[0] > this.x ) this.vx += mag; else if( pos[0] < this.x ) this.vx -= mag; if( pos[1] > this.y ) this.vy += mag; else if( pos[1] < this.y ) this.vy -= mag; } // mote::capvelocity() -- apply an upper limit // on mote velocity. mote.prototype.capvelocity = function() { var max = parseint( document.getelementbyid('max_velocity').value ); if( max < this.vx ) this.vx = max; else if( -max > this.vx ) this.vx = -max; if( max < this.vy ) this.vy = max; else if( -max > this.vy ) this.vy = -max; } // mote::capposition() -- apply an upper/lower limit // on mote position. mote.prototype.capposition = function() { var dims = dimensions(); if( this.x < 0 ) this.x = 0; else if( this.x ...
...And 2 more matches
Fills and Strokes - SVG: Scalable Vector Graphics
advantages and disadvantages associated with each type. fill and stroke attributes painting basic coloring can be done by setting two attributes on the node: fill and stroke. using fill sets the color inside the object and stroke sets the color of the line drawn around the object. ...
...iated with each type. fill and stroke attributes painting basic coloring can be done by setting two attributes on the node: fill and stroke. using fill sets the color inside the object and stroke sets the color of the line drawn around the object. you can use the same css color naming schemes that you use in html, whether that's color names (that is red), rgb values (that is rgb(255,0,0)), hex values, rgba values, etc. <rect x="10" y="10" width="100" height="100" stroke="blue" fill="purple" fill-opacity="0.5" stroke-opacity="0.8"/> in addition, you can specify the opacity of either the fill or stroke separately in svg. these are controlled by the fill-opacity and stroke-opacity attributes. note: in firefox 3+, rgba values are also allowed, and will give the same effect. but for c...
...roke-opacity="0.8"/> in addition, you can specify the opacity of either the fill or stroke separately in svg. these are controlled by the fill-opacity and stroke-opacity attributes. note: in firefox 3+, rgba values are also allowed, and will give the same effect. but for compatibility with other viewers, it's often best to specify the fill/stroke opacity separately. if you specify both an rgba value and a fill/stroke opacity value, both will be applied. stroke in addition to its color properties, there are a few other attributes available to control the way a stroke is drawn on a line. <?xml version="1.0" standalone="no"?> <svg width="160" height="140" xmlns="http://www.w3.org/2000/svg" version="1.1"> <line x1="40" x2="120" y1="20" y2="20" stroke="black" stroke-width="20" stroke-linec...
...And 2 more matches
Subresource Integrity - Web security
s (from a cdn or anywhere) have been delivered without a third-party having injected any additional content into those files — and without any other changes of any kind at all having been made to those files. ...
...ed any additional content into those files — and without any other changes of any kind at all having been made to those files. using subresource integrity you use the subresource integrity feature by specifying a base64-encoded cryptographic hash of a resource (file) you’re telling the browser to fetch, in the value of the integrity attribute of any <script> or <link> element. an integrity value begins with at least one string, with each string including a prefix indicating a particular hash algorithm (currently the allowed prefixes are sha256, sha384, and sha512), followed by a dash, and ending with the actual base64-encoded hash. note: an integrity value may contain multiple hashes separated by whitespace. a resource will be loaded if it matches one of those hashes. example integri...
...tiple hashes separated by whitespace. a resource will be loaded if it matches one of those hashes. example integrity string with base64-encoded sha384 hash: sha384-oqvuafxrkap7fdgccy5uykm6+r9gqq8k/uxy9rx7hnqlgyl1kpzqho1wx4jwy8wc so oqvuafxrkap7fdgccy5uykm6+r9gqq8k/uxy9rx7hnqlgyl1kpzqho1wx4jwy8wc is the "hash" part, and the prefix sha384 indicates that it's a sha384 hash. note: an integrity value's "hash" part is, strictly speaking, a cryptographic digest formed by applying a particular hash function to some input (for example, a script or stylesheet file). but it’s common to use the shorthand "hash" to mean cryptographic digest, so that's what's used in this article. tools for generating sri hashes you can generate sri hashes from the command-line with openssl using a command invoca...
...And 2 more matches
<xsl:number> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › number
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:number> element counts things sequentially. it can also be used to quickly format a number. syntax <xsl:number count=expression level="single" | "multiple" | "any" from=expression value=expression format=format-string lang=xml:lang-code letter-value="alphabetic" | "traditional" grouping-separator=character grouping-size=number /> required attributes none. ...
...ng lang=xml:lang-code letter-value="alphabetic" | "traditional" grouping-separator=character grouping-size=number /> required attributes none. optional attributes count specifies what in the source tree should be numbered sequentially. it uses an xpath expression. level defines how levels of the source tree should be considered in generating sequential numbers. it has three valid values: single, multiple, and any. the default value is single: single numbers sibling nodes sequentially, as in the items in a list. the processor goes to the first node in the ancestor-or-self axis that matches the count attribute and then counts that node plus all its preceding siblings (stopping when it reaches a match to the from attribute, if there is one) that also match the count att...
...he current node and proceeds in reverse document order, stopping if it reaches a match to any from attribute. if no match to the count attribute is found, the sequence will be an empty list. this level is not supported at this time. from specifies where the numbering should start or start over. the sequence begins with the first descendant of the node that matches the from attribute. value applies a given format to a number. this is a quick way to format a user-supplied number (as opposed to a node sequence number) in any of the standard <xsl:number> formats. format defines the format of the generated number: format="1" 1 2 3 . . . (this is the only format supported at this time) format="01" 01 02 03 . . . 09 10 11 . . . format="a" a b...
...And 2 more matches
Index - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Index
ng between ascending and descending order. the javascript loads the .xsl file only on the first sort and sets the xslloaded variable to true once it has finished loading the file. using the xsltprocessor.getparameter() method, the code can figure whether to sort in ascending or descending order. it defaults to ascending if the parameter is empty (the first time the sorting happens, as there is no value for it in the xslt file). the sorting value is set using xsltprocessor.setparameter(). 7 basic example xslt the basic example will load an xml file and apply a xsl transformation on it. these are the same files used in the generating html example in the xslt in netscape gecko article. the xml file describes an article and the xsl file formats the information for display. ...
... <xsl:attribute-set> element, reference, xslt, attribute-set the <xsl:attribute-set> element creates a named set of attributes, which can then be applied as whole to the output document, in a manner similar to named styles in css. 23 <xsl:attribute> attribute, element, reference, xslt the <xsl:attribute> element creates an attribute in the output document, using any values that can be accessed from the stylesheet. the element must be defined before any other output document element inside the output document element for which it establishes attribute values. but it may be after or inside elements that won't be part of the output (like <xsl:choose> or <xsl:apply-templates> etc.). 24 <xsl:call-template> element, reference, xslt, call-template th...
...ement, reference, xslt, output the <xsl:output> element controls the characteristics of the output document. to function correctly in netscape, this element, with the method attribute, must be used. as of 7.0, method="text" works as expected. 42 <xsl:param> element, reference, xslt, param the <xsl:param> element establishes a parameter by name and, optionally, a default value for that parameter. when used as a top-level element, the parameter is global . when used inside an <xsl:template> element, the parameter is local to that template. in this case it must be the first child element of the template. 43 <xsl:preserve-space> element, reference, xslt, preserve-space the <xsl:preserve-space> element defines the elements in the source document for wh...
...And 2 more matches
port - Archive of obsolete content
the sdk module you've used to attach the content script, such as page-mod or page-worker. for an overview of content scripts, see the main article. port methods emit() the port.emit() function sends a message from one side to the other. it may be called with any number of parameters, but is most likely to be called with a name for the message and an optional payload. the payload can be any value that is serializable to json. from the content script to the main add-on code: // content-script.js var mymessagepayload = "some data"; self.port.emit("mymessage", mymessagepayload); from the main add-on code to the content script: // main.js var mymessagepayload = "some data"; worker.port.emit("mymessage", mymessagepayload); on() the port.on() function registers a function as a listener ...
...e first time the button is clicked. due to bug 816272 the page-mod's removelistener() function does not prevent the listener from receiving messages that are already queued. this means that if "main.js" sends the message twice in successive lines, and the listener stops listening as soon as it receives the first message, then the listener will still receive the second message. json-serializable values the payload for a message can be any json-serializable value. when messages are sent their payloads are automatically serialized, and when messages are received their payloads are automatically deserialized, so you don't need to worry about serialization. however, you do have to ensure that the payload can be serialized to json. this means that it needs to be a string, number, boolean, null, a...
...this means you can't send functions, and if the object contains methods they won't be encoded. you also can't include circular references. ...
...e. when messages are sent their payloads are automatically serialized, and when messages are received their payloads are automatically deserialized, so you don't need to worry about serialization. however, you do have to ensure that the payload can be serialized to json. this means that it needs to be a string, number, boolean, null, array of json-serializable values, or an object whose property values are themselves json-serializable. this means you can't send functions, and if the object contains methods they won't be encoded. you also can't include circular references. for example, to include an array of strings in the payload: // main.js var pagemods = require("sdk/page-mod"); var self = require("sdk/self"); var pagemod = pagemods.pagemod({ include: ['*'], contentscriptfile: self.d...
Communicating using "port" - Archive of obsolete content
e add-on, when the user clicks an element in the page warning sends a silly string back to the page-mod port.emit() the port.emit() function sends a message from the "main.js", or another add-on module, to a content script, or vice versa. it may be called with any number of parameters, but is most likely to be called with a name for the message and an optional payload. the payload can be any value that is serializable to json. from the content script to the main add-on code: var mymessagepayload = "some data"; self.port.emit("mymessage", mymessagepayload); from the main add-on code (in this case a panel instance) to the content script: var mymessagepayload = "some data"; panel.port.emit("mymessage", mymessagepayload); port.on() the port.on() function registers a function as a liste...
..., then stop listening. the port object offers a shortcut to do this: the once() method. this example rewrites the "listener.js" content script in the port.removelistener() example so that it uses once(): function getfirstparagraph() { var paras = document.getelementsbytagname('p'); console.log(paras[0].textcontent); } self.port.once("get-first-para", getfirstparagraph); json-serializable values the payload for an message can be any json-serializable value. when messages are sent their payloads are automatically serialized, and when messages are received their payloads are automatically deserialized, so you don't need to worry about serialization. however, you do have to ensure that the payload can be serialized to json. this means that it needs to be a string, number, boolean, null, ...
...this means you can't send functions, and if the object contains methods they won't be encoded. ...
...e. when messages are sent their payloads are automatically serialized, and when messages are received their payloads are automatically deserialized, so you don't need to worry about serialization. however, you do have to ensure that the payload can be serialized to json. this means that it needs to be a string, number, boolean, null, array of json-serializable values, or an object whose property values are themselves json-serializable. this means you can't send functions, and if the object contains methods they won't be encoded. for example, to include an array of strings in the payload: var pagemodscript = "self.port.emit('loaded'," + " [" + " document.location.tostring()," + " document.title" + " ]" + ...
querystring - Archive of obsolete content
utility functions for working with query strings. globals functions stringify(fields, separator, assignment) serializes an object containing name:value pairs into a query string: querystring.stringify({ foo: 'bar', baz: 4 }); // => 'foo=bar&baz=4' by default '&' and'=' are used as separator and assignment characters, but you can override this using additional optional parameters: querystring.stringify({ foo: 'bar', baz: 4 }, ';', ':'); // => 'foo:bar;baz:4' parameters fields : object the data to convert to a query string. separator : string the string to use as a separator between each name:value pair. by default this is "&". assignment : string the string to use between each name and its corresponding value. by default this is "=". returns string : the query string. parse(...
... object the data to convert to a query string. separator : string the string to use as a separator between each name:value pair. by default this is "&". assignment : string the string to use between each name and its corresponding value. by default this is "=". returns string : the query string. ...
... escape(query) the escape function used by stringify to encodes a string safely matching rfc 3986 for application/x-www-form-urlencoded. ...
...ignment arguments may be passed to override default '&' and '=' characters: querystring.parse('foo:bar|baz:bla', '|', ':') // => { foo: 'bar', baz: 'bla' } parameters querystring : string the query string. separator : string the string to use as a separator between each name:value pair. by default this is "&". assignment : string the string to use between each name and its corresponding value. by default this is "=". returns object : an object containing the components of the query string as name : value pairs. escape(query) the escape function used by stringify to encodes a string safely matching rfc 3986 for application/x-www-form-urlencoded. parameters query : string the query string to escape. returns string : the escaped query string. unescape(query) the unescape funct...
request - Archive of obsolete content
string,url this is the url to which the request will be made. can either be a string or an instance of the sdk's url. oncomplete function this function will be called when the request has received a response (or in terms of xhr, when readystate == 4). the function is passed a response object. headers object an unordered collection of name/value pairs representing headers to send with the request. content string,object the content to send to the server. if content is a string, it should be url-encoded (use encodeuricomponent). if content is an object, it should be a collection of name/value pairs. nested objects & arrays should encode safely. for get and head requests, the query string (content) will be appen...
... overridemimetype string use this string to override the mime type returned by the server in the response's content-type header. you can use this to treat the content as a different mime type, or to force text to be interpreted using a specific character. ...
...main restriction that requests made in web pages are subject to. with the exception of response, all of a request object's properties correspond with the options in the constructor. each can be set by simply performing an assignment. however, keep in mind that the same validation rules that apply to options in the constructor will apply during assignment. thus, each can throw if given an invalid value. the example below shows how to use request to get the most recent tweet from the @mozhacks account: var request = require("sdk/request").request; var latesttweetrequest = request({ url: "https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=mozhacks&count=1", oncomplete: function (response) { var tweet = response.json[0]; console.log("user: " + tweet.user.screen_name)...
... the response object contains the response to a network request issued using a request object. it is returned by the get(), head(), post(), put() or delete() method of a request object. all members of a response object are read-only. properties url the url of the response content. text the content of the response as plain text. json the content of the response as a javascript object. the value will be null if the document cannot be processed by json.parse. status the http response status code (e.g. 200). statustext the http response status line (e.g. ok). headers the http response headers represented as key/value pairs. to print all the headers you can do something like this: for (var headername in response.headers) { console.log(headername + " : " + response.headers[headerna...
/loader - Archive of obsolete content
solve: function(id, requirer) { let requirements = manifest[requirer].requirements; if (id in manifest) return requirements[id]; else throw error('module "' + requirer + '" has no authority to require ' + 'module "' + id + "') } }); thrown exceptions will propagate to the caller of require(). if the function assigned to resolve does not return a string value, an exception will still be thrown as the loader will be unable to resolve the required module's location. id add-on debugging requires knowing which objects belong to which add-on. when created with this option, loader will transparently mark all new global objects with the provided value. all together all of these options can be combined to configure the loader for a specific use case. don'...
...rce:///modules/` base uri. '': 'resource:///modules/', // reserve `toolkit/` prefix for generic, mozilla toolkit modules // and resolve them to `resource://gre/modules/commonjs/toolkit/` uri. 'toolkit/': 'resource://gre/modules/commonjs/toolkit/' }, // please note: both `globals` and `modules` are just for illustration // purposes we don't suggest populating them with these values. globals: { // provide developers with well known `console` object, hopefully // with a more advanced implementation. console: { log: dump.bind(dump, "log: "), info: dump.bind(dump, "info: "), warn: dump.bind(dump, "warn: "), error: dump.bind(dump, "error: ") } }, modules: { // expose legacy api via pseudo modules that eventually may be // re...
...on takes loader and loads the given module into it: let loader = loader(options); let module = module('foo/bar', 'resource:///modules/foo/bar.js'); load(loader, module); sandbox() the sandbox() function is a utility function for creating js sandboxes. it is used by the loader to create scopes into which modules are loaded. it takes the following set of configuration options: name: a string value which identifies the sandbox in about:memory. will throw exception if omitted. principal: string uri or nsiprincipal for the sandbox. if omitted defaults to system principal. prototype: object that the returned sandbox will inherit from. defaults to {}. wantxrays: a boolean value indicating whether code outside the sandbox wants x-ray vision with respect to objects inside the sandbox. defaults...
...x. defaults to true. let sandbox = sandbox({ name: 'resource:///modules/foo/bar.js', wantxrays: false, prototype: { console: { log: dump.bind(dump, 'log: '), info: dump.bind(dump, 'info: '), warn: dump.bind(dump, 'warn: '), error: dump.bind(dump, 'error: ') } } }); evaluate() evaluates code in the supplied sandbox. if options.source is provided then its value is evaluated, otherwise source is read from the supplied uri. either way, any exceptions will be reported as from the uri. optionally more options may be specified: options.encoding: source encoding, defaults to 'utf-8'. options.line: line number to start count from in stack traces. defaults to 1. options.version: version of js used, defaults to '1.8'. // load script from the given locati...
platform/xpcom - Archive of obsolete content
his new // component in the normal way var wrapper = cc[contractid].createinstance(ci.nsisupports); var helloworld = wrapper.wrappedjsobject; console.log(helloworld.hello()); using class id you can specify a class id for the factory by setting the id option in the factory's constructor. if you don't specify a class id, then the factory will generate one. either way, it will be accessible as the value of the factory's id property. xpcom users can look up the factory using the class id instead of the contract id. here's the example above, rewritten to use class id instead of contract id for lookup: var { class } = require('sdk/core/heritage'); var { unknown, factory } = require('sdk/platform/xpcom'); var { cc, ci, components } = require('chrome'); // define a component var helloworld = class...
... name type component constructor constructor for the component this factory creates. this will typically return a descendant of unknown, although it may return a custom object that satisfies the nsisupports interface. optional options: name type contract string a contract id. users of xpcom can use this value to retrieve the factory from components.classes: var factory = components.classes['@me.org/request'] var component = factory.createinstance(ci.nsirequest); this parameter is formally optional, but if you don't specify it, users won't be able to retrieve your factory using a contract id. if specified, the contract id is accessible as the value of the factory's contract property. ...
... = components.classes['@me.org/request'] var component = factory.createinstance(ci.nsirequest); this parameter is formally optional, but if you don't specify it, users won't be able to retrieve your factory using a contract id. if specified, the contract id is accessible as the value of the factory's contract property. id string a class id. users of xpcom can use this value to retrieve the factory using components.classesbyid: var factory = components.classesbyid[id]; var component = factory.createinstance(ci.nsirequest); this parameter is optional. if you don't supply it, the factory constructor will generate a fresh id. either way, it's accessible as the value of the factory's id property. register boolean by default, the factory ...
...'@me.org/mycomponent', component: mycomponent }); the component constructor typically returns a descendant of unknown, although it may return a custom object that satisfies the nsisupports interface. the contract id and/or class id may be used by xpcom clients to retrieve the factory. if a class id is not given, a new one will be generated. the contract id and class id are accessible as the values of the contract and id properties, respectively. by default, the factory is registered when it is created and unregistered when the add-on that created it is unloaded. to override this behavior, you can pass register and/or unregister options, set to false. if you do this, you can use the register() and unregister() functions to register and unregister. methods createinstance(outer, iid) cr...
Adding Events and Commands - Archive of obsolete content
nd commandset. ...
... let onlinebroadcaster = document.getelementbyid("xulschoolhello-online-broadcaster"); onlinebroadcaster.setattribute("label", "something"); you can also have finer-grained control to this behavior by adding the observes element as a child to your observer node. ...
...element, indicating that this element will observe all attribute changes that happen in the broadcaster. you can have as many elements as you want observing a broadcaster. with that set, all you need to do now is set or remove attributes in the broadcaster using javascript. all nodes observing it will automatically have those attribute values set or removed as well. you can override pre-existing values, such as the label attribute value in the example. let onlinebroadcaster = document.getelementbyid("xulschoolhello-online-broadcaster"); onlinebroadcaster.setattribute("label", "something"); you can also have finer-grained control to this behavior by adding the observes element as a child to your observer node. this allows you to choose which attributes you want it to observe. broadcasters ...
...ant it to observe. broadcasters allow you to easily maintain consistency among numerous elements without having to add much code. they also save you the trouble of having to know if a given element is present in the dom or not. for example, if you have a customizable toolbar, you can't be sure if a given button is present or not, so it's easier to use a broadcaster. this way you only need to set values to the broadcaster instead of having to check if the button is there or not. commands the command element is a specialized type of broadcaster, meant to be used with the oncommand event. this is the recommended way of centralizing common ui behavior in firefox and extensions. commands are heavily used in firefox, as a quick look into the dom inspector should show. their behavior is identical ...
Connecting to Remote Content - Archive of obsolete content
there are a couple of tools you can use to process these documents more efficiently: using xpath xpath stands for xml path language, ...
...there are a couple of tools you can use to process these documents more efficiently: using xpath xpath stands for xml path language, it uses a non-xml syntax that provides a flexible way of addressin...
...into xul. the xslt tutorial contains details for building these templates. ...
...g these templates. <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <xsl:template match="/data"> <xul:vbox> <xsl:for-each select="shops/name"> <xul:hbox> <xul:label value="name:" /> <xul:label> <xsl:value-of select="." /> </xul:label> </xul:hbox> </xsl:for-each> <xul:hbox> <xul:label value="total:" /> <xul:label> <xsl:value-of select="total" /> </xul:label> </xul:hbox> </xul:vbox> </xsl:template> </xsl:stylesheet> next you need to read the xslt stylesheet as a file stream and parse it into a document object. after that, ...
Promises - Archive of obsolete content
_path }); try { // start a transaction to insert the data. yield db.executetransaction(function* () { for (let node of nodes) // insert the node's data, using an automatically-cached, // pre-compiled statement, and parameter placeholders. yield db.executecached( "insert into nodes (id, owner, key, value) \ values (:id, :owner, :key, :value);", { params: { id: node.id, owner: node.owner.id, key: node.key, value: node.value }}); }); // perform a bulk update. yield db.execute( "update owners, nodes \ set owners.nam...
...y: node.key, value: node.value }}); }); // perform a bulk update. yield db.execute( "update owners, nodes \ set owners.name = nodes.name \ where owners.id = nodes.owner and nodes.key = 'name';"); // process some results. yield db.execute( "select owners.group as group, nodes.value as task \ from nodes \ inner join owners on owner.id = nodes.owner \ where nodes.key = 'task';", { onrow: row => { runtask(row.getresultbyname("task"), row.getresultbyname("group")); } }); // and quickly grab a single row value. let [row] ...
... inner join owners on owner.id = nodes.owner \ where nodes.key = 'task';", { onrow: row => { runtask(row.getresultbyname("task"), row.getresultbyname("group")); } }); // and quickly grab a single row value. let [row] = yield db.execute( "select value from nodes where key = 'timestamp' \ order by value desc limit 1"); latesttimestamp = row.getresultbyindex(0); } finally { // make sure to close the database when finished. // failure to do this will prevent firefox from shutting down // cleanly. yield db.close(); } }); promise wrappers and helpers the following are some example ...
...e(accept => this.addonmanager.getinstallforfile(url, accept, mimetype)); }, getallinstalls: function getallinstalls() { return new promise(accept => this.addonmanager.getallinstalls(accept)); }, _replacemethod: function replacemethod(method, callback) { object.defineproperty(this, method, { enumerable: true, configurable: true, value: key => { return new promise(accept => this.addonmanager[method](key, addon => accept(callback(addon)))); } }); }, }; for (let method of ["getaddonbyid", "getaddonbysyncguid"]) aom._replacemethod(method, addon => aom.addon(addon)); for (let method of ["getalladdons",...
XUL user interfaces - Archive of obsolete content
ste the content from here, making sure that you scroll to get all of it: <?xml version="1.0"?> <?xml-stylesheet type="text/css" href="style7.css"?> <!doctype window> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="css getting started - xul demonstration" onload="init();"> <script type="application/javascript" src="script7.js"/> <label class="head-1" value="xul demonstration"/> <vbox> <groupbox class="demo-group"> <caption label="day of week calculator"/> <grid> <columns> <column/> <column/> </columns> <rows> <row> <label class="text-prompt" value="date:" accesskey="d" control="date-text"/> <textbox id="date-text" type="timed" timeout="750" oncommand...
... <caption label="day of week calculator"/> <grid> <columns> <column/> <column/> </columns> <rows> <row> <label class="text-prompt" value="date:" accesskey="d" control="date-text"/> <textbox id="date-text" type="timed" timeout="750" oncommand="refresh();"/> </row> <row> <label value="day:"/> <hbox id="day-box"> <label class="day" value="sunday" disabled="true"/> <label class="day" value="monday" disabled="true"/> <label class="day" value="tuesday" disabled="true"/> <label class="day" value="wednesday" disabled="true"/> <label class="day" value="thursday" disabled="true"/> <label class="day" val...
...ass="day" value="sunday" disabled="true"/> <label class="day" value="monday" disabled="true"/> <label class="day" value="tuesday" disabled="true"/> <label class="day" value="wednesday" disabled="true"/> <label class="day" value="thursday" disabled="true"/> <label class="day" value="friday" disabled="true"/> <label class="day" value="saturday" disabled="true"/> </hbox> </row> </rows> </grid> <hbox class="buttons"> <button id="clear" label="clear" accesskey="c" oncommand="cleardate();"/> <button id="today" label="today" accesskey="t" oncommand="settoday();"/> </hbox> </groupbox> <statusbar> <statusbarpanel id="status"/> </statusbar> </vb...
...t from here, making sure that you scroll to get all of it: // xul demonstration var datebox, daybox, currentday, status; // elements // called by window onload function init() { datebox = document.getelementbyid("date-text") daybox = document.getelementbyid("day-box") status = document.getelementbyid("status") settoday(); } // called by clear button function cleardate() { datebox.value = "" refresh() } // called by today button function settoday() { var d = new date() datebox.value = (d.getmonth() + 1) + "/" + d.getdate() + "/" + d.getfullyear() refresh() } // called by date textbox function refresh() { var d = datebox.value var thedate = null showstatus(null) if (d != "") { try { var a = d.split("/") var thedate = new date(a[2], a...
Creating a dynamic status bar extension - Archive of obsolete content
our extension will refresh the stock information display when the user clicks the panel. write the javascript cod...
...t', fullurl, true); httprequest.onload = inforeceived; httprequest.send(null); } the httprequest variable will contain an xmlhttprequest object. this object is used to configure and run an http request on a web server, which we'll use to fetch the stock quote data. the fullurl variable is the complete url to use when requesting a stock quote. in this case, we're using yahoo's comma-separated values return to fetch easily-parsed stock quote data for google (ticker symbol goog). refreshinformation() embeds another function, inforeceived(), which we'll look at separately shortly. the first thing we do is create a new xmlhttprequest object to use for processing our request. we open the request, specifying that we wish to perform an http "get" command with the url fullurl. the true boolean valu...
...quest, our the inforeceived() function, which is embedded inside refreshinformation(), gets called automatically. we embed this function inside refreshinformation() so that its variable scope includes the variables used by that function. due to the way javascript works, if inforeceived() were outside refreshinformation(), it would not have access to the same variable scope. in fact, even the this value would not match, so we couldn't get at the same variables and functions that way. function inforeceived() { var samplepanel = document.getelementbyid('stockwatcher'); var output = httprequest.responsetext; if (output.length) { // remove whitespace from the end of the string; // this gets rid of the end-of-line characters output = output.replace(/\w*$/, ''); // build the...
...can make changes to the status bar panel itself. we then fetch the result returned by the web server into the variable output from the xmlhttprequest.responsetext property. the text we receive back from the server looks something like this: "goog",414.20,"5/1/2006","1:36pm",-3.74,417.85,419.44,412.19,4760215 we then parse the text. we use the split() string function to split the comma-separated value string into its individual parts, with each field in a separate element in the array fieldarray. at index 0 is the ticker symbol itself, which we don't need since we know which stock we're looking at. the status bar panel's label is set to indicate the current value of the stock, which is stored in fieldarray, by setting the samplepanel.label property. we then set the tooltip for the status bar p...
MozOrientation - Archive of obsolete content
warning: this experimental api was removed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3), when support for the standard deviceorientationevent was implemented. you should use that api instead. an event that is repeatedly fired on the window as accelerator data is provided to the browser. note: this below describes how these values worked for the now obsolete mozorientation. ...
...bird 6.0 / seamonkey 2.3), when support for the standard deviceorientationevent was implemented. you should use that api instead. an event that is repeatedly fired on the window as accelerator data is provided to the browser. note: this below describes how these values worked for the now obsolete mozorientation. the x axis represents the amount of right-to-left tilt. this value is 0 if the device is level along the x axis, and approaches 1 as the device is tilted toward the left, and -1 as the device is tilted toward the right. the y axis represents the amount of front-to-back tilt. the value is 0 if the device is level along the y axis, and approaches 1 as you tilt the device backward (away from you) and -1 as you tilt the device frontward (toward you). ...
...proaches 1 as the device is tilted toward the left, and -1 as the device is tilted toward the right. the y axis represents the amount of front-to-back tilt. the value is 0 if the device is level along the y axis, and approaches 1 as you tilt the device backward (away from you) and -1 as you tilt the device frontward (toward you). the z axis represents acceleration vertically. the value is -1 when the device is undergoing standard earth gravity (9.8m/sec2) but not moving. moving the device upward causes the value to increase. the value is 0 if the device is being thrust upward. ...
...ward (away from you) and -1 as you tilt the device frontward (toward you). the z axis represents acceleration vertically. the value is -1 when the device is undergoing standard earth gravity (9.8m/sec2) but not moving. moving the device upward causes the value to increase. the value is 0 if the device is being thrust upward. in free fall (weightless or falling as a result of a drop), the value remains -1. in weightlessness, all values would be zero when the device is not moving, regardless of orientation, and would only change when being accelerated. in firefox versions 3.6, 4, and 5 gecko utilized mozorientation which was also built to support orientation data but with different apis from the specified deviceorientationevent. to normalize between the two you ca...
Getting the page URL in NPAPI plugin - Archive of obsolete content
ialization. then you can just refuse to do anything, if you don't like the url, or you can compare it with the other url you want to contact. so, how do we get at that page url, i.e. the url of the html which embeds the plugin, i.e. which caused the plugin to load? there are at least 3 solutions (quoting newsgroup posts): via window location from robert platt: // get the dom window object. ...
...he url of the html which embeds the plugin, i.e. which caused the plugin to load? there are at least 3 solutions (quoting newsgroup posts): via window location from robert platt: // get the dom window object. npn_getvalue( m_pnpinstance, npnvwindownpobject, &swindowobj ); // create a "location" identifier. npidentifier identifier = npn_getstringidentifier( "location" ); // declare a local variant value. npvariant variantvalue; // get the location property from the window object (which is another object). bool b1 = npn_getproperty( m_pnpinstance, swindowobj, identifier, &variantvalue ); // get a pointer to the "location" object. npobject *locationobj = variantvalue.value.objectvalue; // create a "href" identifier. identifier = npn_getstringidentifier( "href" ); // get the location property from ...
...remember to release any references after using them. ...
...-friendly way to do that is to get it from the npstream that is passed to npp_newstream. tradeoffs: npapi only probably works in all browsers, all versions is sort of backwards (?) advantages / disadvantages ? via dom from benjamin smedberg: the npapi gives you the ability to get access to the nsidomwindow object which contains the current plugin via the npnvdomelement enum passed to npn_getvalue. this returns an addrefed nsidomelement interface pointer from which you can call .ownerdocument (on nsidomnode), queryinterface that object to nsidom3document, and call .documenturi. tradeoffs: is inherently incompatible with other non-mozilla browsers (i.e. does not work in opera, safari etc.) compatible with older versions of the mozilla (probably back to mozilla 1.0) requires c++ ...
Drag and Drop JavaScript Wrapper - Archive of obsolete content
ag will be called when a drag starts on the button. the first parameter is the event object, available in all event handlers. the second parameter to this function is the observer, which we'll create soon. in this case we only do anything special when the button drag is started. ...
...g>"; var plaintext = "cabbage"; transferdata.data = new transferdata(); transferdata.data.adddataforflavour("text/html",htmltext); transferdata.data.adddataforflavour("text/unicode",plaintext); } } here, an observer has been declared and stored in the variable textobserver. it has one property called ondragstart. (in javascript, properties can be declared with the syntax name : value). this property is a function which sets the data that is being dragged. once called, it starts a drag for the string data "cabbage". of course, you would want to calculate this value from the element that was clicked on. conveniently, this element is available from the event object's target property. the event object is passed as the first argument to ondragstart. we create a transferdata object...
...ed from the element's label attribute. in this case we only provide the data in one flavour. var textobserver = { ondragstart: function (event) { var txt = event.target.getattribute("label"); transferdata.data = new transferdata(); transferdata.data.adddataforflavour("text/unicode",txt); } } this might be useful when implementing drag and drop for cells in a tree. you can use the value of a cell, or some resource from an rdf file if the tree is built from a template, as the value of a drag. if you store it as a string, any object that accepts strings dragged onto it can grab the dragged data. if you want to send more then one data object, (for example multiple files) you must use an transferdataset as follows: var textobserver = { ondragstart: function (event) { var txt1 ...
...ime ondrop is called, the wrapper has called getsupportedflavours to determine the best flavour for the drop, so the transfer object only contains the data for the best matching flavour. the transfer object has two properties, data which holds the data and flavour which holds the flavour of the data. once you have the data, you can add it to the element is some way. for example, you might set the value of a textbox. var textobserver = { ondrop : function (event, transferdata, session) { event.target.setattribute("value",transferdata.data); } } the flavour system used allows multiple objects of various types to be dragged at once and also allows alternative forms of the data to be dragged. the following table describes some of the flavours you might use. you can also make up your own fl...
Microsummary XML grammar reference - Archive of obsolete content
ticle creating a microsummary. ...
...scriptive, human-readable name for the microsummary created by the generator. uri (optional) a valid uri uniquely identifying the generator. only relevant for generators dynamically created by firefox code and extensions. generators installed from the web via nssidebar::addmicrosummarygenerator are identified by the remote url from which they were downloaded, and firefox ignores the value of this attribute for them. child elements: <template> (required) defines how to transform pages into their microsummaries. <pages> (required) identifies the set of pages that the generator is able to summarize. <update> (optional) specifies how frequently firefox should update the microsummaries. the <template> element the <template> element contains ...
...attributes: interval (optional) an absolute interval of time, in minutes, that must elapse between updates. child elements: <condition> (optional) an xpath boolean expression along with a conditional interval of time, in minutes, that must elapse between updates if the expression evaluates to true. the interval attribute defines an absolute interval in minutes. its value must be a number greater than or equal to 1. fractional values (e.g. 5.5 minutes) are permitted, although they probably aren't useful. the <update> element may contain any number of <condition> child elements. firefox determines which interval to apply to a microsummary generated by a generator according to the following rules: firefox processes each <condition> child element in document order...
...ach one, firefox evaluates the element's xpath boolean expression against the page being summarized. if the expression evaluates to true, firefox applies that element's interval and stops processing child elements. thus, the first matching <condition> determines the update interval. if there are no <condition> child elements, or if none of their expressions evaluate to true, firefox applies the value of the <update> element's interval attribute. if the <update> element does not include an interval attribute, firefox applies the interval specified by the browser.microsummary.updateinterval preference. if that preference has not been set, firefox applies its default update interval, which is 30 minutes. notes: regardless of the absolute or conditional update interval specified by this e...
Monitoring downloads - Archive of obsolete content
te, adownload) { var statement; switch(adownload.state) { case components.interfaces.nsidownloadmanager.download_downloading: // add a new row for the download being started; each row includes the // source uri, size, and start time. the end time and download speed // are both set to 0 at first, since we don't know those yet. ...
...wnload being started; each row includes the // source uri, size, and start time. the end time and download speed // are both set to 0 at first, since we don't know those yet. // status is the same status value that came from the download manager. ...
...d in four states. if the download's state, indicated by the adownload.state field, is components.interfaces.nsidownloadmanager.download_downloading, the file has begun to download. the adownload object is an nsidownload object. in that case, we create a new row in our database for the new file by opening the database and building a replace into sqlite command. the first three rows are set to the values of the source uri, file size, and start time fields from the download object. the remaining rows are set to zeroes since that's not information we have at the moment. if the download's state indicates that the download is finished, canceled, or failed, we call our logtransfercompleted routine to update the log to indicate that state change. that code looks like this: logtransfercompleted: fun...
...ter that, the list row object is created, and each entry in the search result is fetched and inserted into the appropriate list cell. the interesting bits to take away from this: mozistoragestatement has several data getter routines for fetching search results, including getstring(), getdouble(), and getint64(). these methods take as a parameter the zero-based index number of the column whose value you wish to retrieve. note that the start time is being divided by 1000 before we create a javascript date object from it. that's to adjust the value from the granularity stored in the database to that expected by javascript. to right-justify the numeric columns, we set the appropriate cells' style attribute to text-align:right. exercises for the reader there are some obvious things that cou...
Table Cellmap - Archive of obsolete content
// and the data does not represent a span. if mspan is 1, then mbits is in 82 // effect and the data represents a span. 83 union { 84 nstablecellframe* morigcell; 85 long mbits; 86 }; the idea behind this construction is a entry in the cellmap can be either the origin of a row- or colspan (a cell cell without a defined row- or colspan attribute assumes 1 as a default value), or a entry which is only covered by a row- or colspan. entries which are a origin have a direct corresponding tablecellframe. entries which are only spanned don't have that direct relationship. they belong to a entry which has a direct relationship to a tablecellframe. now that union uses the fact all addresses of real tablecellframes are aligned at even boundaries, or in other words they cant ...
...set 0xfff80000 // the col offset to the data containing the original cell #define row_span_shift 3 // num bits to shift to get right justified row span #define col_span_shift 19 // num bits to shift to get right justified col span showing that there is a span, this span is a colspan and the colspan origin is one cell away. ...
...an #define col_span_shift 19 // num bits to shift to get right justified col span showing that there is a span, this span is a colspan and the colspan origin is one cell away. this shows that the maximum handled row- or colspan value for a cell is 0xfff8 >> 3 = 8191. there is a special attribute for rowspan="0" and colspan="0", because html 4.0 did introduce a special handling of the 0 value. rowspan = number [cn] this attribute specifies the number of rows spanned by the current cell. the default value of this attribute is one ("1"). the value zero ("0") means that the cell spans all rows from the current row to the last row of the table section (thead, tbody, or tfoot) in which the cell is defined. colspan = number [cn] this attribute specifies the number of columns spanned by...
... attribute specifies the number of rows spanned by the current cell. the default value of this attribute is one ("1"). the value zero ("0") means that the cell spans all rows from the current row to the last row of the table section (thead, tbody, or tfoot) in which the cell is defined. colspan = number [cn] this attribute specifies the number of columns spanned by the current cell. the default value of this attribute is one ("1"). the value zero ("0") means that the cell spans all columns from the current column to the last column of the column group (colgroup) in which the cell is defined. the handling of zero spans introduces overhead as one can not mark in advance the corresponding cells as spanned by the zero spans. the current solution is to use nscellmap::getdataat with a special argu...
Venkman Introduction - Archive of obsolete content
umn 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 variables view displays values for the current function. the scope object holds all arguments and local variables, and the this object holds the value of the this keyword. e enumerable property r read only property p permanent (cannot be deleted) a alias to another property a argument to a function v declared with var figure 8. property flags ...
...alias to another property a argument to a function v declared with var figure 8. property flags properties of both scope and this objects are listed alphabetically, grouped by data type. figure 9 shows which icons represent which data types. properties which are of the type object are displayed with the name of their constructor function in curly braces as their value. you can locate the source code of the constructor by selecting "find constructor" from the property's context menu. you can find the place where the object was instantiated with the "find creator" command. by default, properties of type function are not displayed, in order to conserve space in the view. if you would like to have functions displayed, check the "include functions" menu item in the...
...e the change. properties that show up in a bold grey font are defined on an object from the prototype chain, and not on the actual object you are inspecting. if you would like to inspect the object's prototype and parent chains, check the "include ecma properties" menu item in the view's context menu. if a property shows up in a bold red font, an exception occurred when venkman tried to read the value. the exception object will appear as the value of the property. icon data type icon data type void (undefined) value null value boolean value string value integer value double value object value function value figure 9. type icons the column picker for this view (the box on the top right)...
...dy had some experience using it, and they provide the basis for the more interesting and practical examples in the articles that follow this one. the best way to get to know venkman, of course, is to play around with it — to set it up in the way that makes the most sense to you, to try loading scripts and setting breakpoints, evaluating expressions in the interactive session view, watching the values of variables as they change when scripts are executed, getting profile data. debugging extensions although at first glance it might seem that venkman cannot debug extensions, doing so is in fact fully supported; it's just disabled by default. to debug your extension with venkman (xul files and their attached js files), you'll have to load browser and extension files into venkman by unchecking...
Using Breakpoints in Venkman - Archive of obsolete content
en set, along with the line number where the function begins whose code is being stopped. using breakpoints to debug when you set a breakpoint, you give venkman (or whatever debugger you're using) the opportunity to display information about the execution environment. one of the most important aspects of debugging a script or software program is the ability to examine variables—function return values, errors, counters, variable scopes—as they change over the course of the script execution. the onflipx function in figure 1, for example, uses the variable newsign to figure out what image to use for the fish. when you set a breakpoint at line 81, you can start animation on the web page in the browser window and see venkman stop execution as it enters the onflipx function. stopped there, venkm...
...ers, variable scopes—as they change over the course of the script execution. the onflipx function in figure 1, for example, uses the variable newsign to figure out what image to use for the fish. when you set a breakpoint at line 81, you can start animation on the web page in the browser window and see venkman stop execution as it enters the onflipx function. stopped there, venkman displays the value of the newsign variable as "1" in the local variables view. using breakpoints and the interactive view, you can change the values of the variables that venkman displays (only in the context of the debugging environment itself) and see how these changes affect the execution of the code. for more information about the sorts of actions you can take in venkman when you're at a breakpoint, see the d...
...result causes venkman to continue normal execution after running the breakpoint script. this can be useful to try out additional code, on the fly. stop regardless of result causes venkman to stop execution after executing the breakpoint script, allowing you to inspect program state. stop if result is true effectively makes this a conditional breakpoint. ...
...nal code, on the fly. stop regardless of result causes venkman to stop execution after executing the breakpoint script, allowing you to inspect program state. stop if result is true effectively makes this a conditional breakpoint. if the breakpoint script returns a true value (it doesn't have to strictly be a boolean true, any non-null, non-empty string, non-zero, non-undefined, and non-false value will do), execution will continue normally. if, on the other hand, the script returns a false value, venkman will stop execution at that point. early return from caller with result will cause the function that the breakpoint is set in to return the value of the breakpoint script as its result, immediatley after the breakpoint script completes. the pass exceptions to caller checkbox allows you...
Binding Implementations - Archive of obsolete content
element. the parameters specified are bound to their names in the method body. <method name="scrolltoindex"> <parameter name="index"/> <body> <![cdata[ if (index < 0) return; ... ]]> </body> </method> properties properties can also be defined on the bound element using property tags. there are two basic types of properties. the first type of property is a raw value that is set directly on the element itself. the second type of property is one that defines functions that are invoked when the property is either retrieved or set. these functions are called getters and setters in xbl. for properties with raw values, an initial value can be specified as a child of the property tag. the script is evaluated at the time of binding attachment and the resulting valu...
...ttached handler needs to be able to assume that all properties will be accessible on the binding. properties with getters and setters can define them using onget and onset attributes, or using the more verbose getter and setter elements. if both the attribute form and the element form are used to specify a getter or setter, then the element form is ignored. a getter contains script whose return value is handed back when the property is requested. a setter contains a script that is invoked when a new value is assigned to the property. in script, the word val is used to represent the new value. properties can be designated as constant using the readonly attribute. when set to true, the property's value cannot be altered. if a property is readonly and a setter is defined, then the setter is ign...
...ters that forward requests or assignments to an anonymous content element. the element attribute specifies the id of anonymous content underneath the bound element that should be used when obtained the property or setting the property. on the anonymous content element, the property can be obtained either from an attribute on the element or from a property on the element. the property attribute's value specifies the name of a property to use on the anonymous content element. the attribute attribute specifies the name of an attribute to use on the anonymous content element. if either of these attributes is specified on the property element, then any defined getters and setters are ignored. a raw initial value is also ignored. if both a property and attribute are specified, then the property take...
...ntation. method and property lookups are dynamic. without disambiguating, if two bindings define the same method or property, then the most derived binding's method or property will be used. because bindings extend dom elements, they can override any built-in methods or properties on the dom element. for example, a binding could override the setattribute method on element or the retrieval of the value property for an htmlinputelement. the following is currently not implemented in mozilla, it seems. see bug #373652 for some details. implementations can be named using a name attribute specified on the implementation element. when an implementation has a name, that name can be used to disambiguate the desired method or property. note: the following paragraphs suggest a syntax for how javascri...
Methods - Archive of obsolete content
of this api is now deprecated and as of gecko 1.9 no longer available. extension, theme, and plug-in developers must switch away from install.js based packages to the new packaging scheme with an install.rdf manifest. in particular plugin developers should see how to package a plugin as an extension. methods createkey adds a key. deletekey removes a key. ...
...cated and as of gecko 1.9 no longer available. extension, theme, and plug-in developers must switch away from install.js based packages to the new packaging scheme with an install.rdf manifest. in particular plugin developers should see how to package a plugin as an extension. methods createkey adds a key. deletekey removes a key. deletevalue removes the value of an arbitrary key. ...
...nstall.js based packages to the new packaging scheme with an install.rdf manifest. in particular plugin developers should see how to package a plugin as an extension. methods createkey adds a key. deletekey removes a key. deletevalue removes the value of an arbitrary key. enumkeys retrieves the registry subkeys for the given key. enumvaluenames retrieves the value of a given subkey. getvalue retrieves the value of an arbitrary key. getvaluenumber retrieves the value of a key, when that value is an integer. getvaluestring retrieves the value of a key, when that value is a string. iskeywritable returns whether the given key is writable. keyexists returns whe...
.... getvaluenumber retrieves the value of a key, when that value is an integer. getvaluestring retrieves the value of a key, when that value is a string. iskeywritable returns whether the given key is writable. keyexists returns whether the given key exists or is readable. setrootkey changes the root key being accessed. setvalue sets the value of an arbitrary key. setvaluenumber sets the value of a key, when that value is an integer. setvaluestring sets the value of a key, when that value is a string. valueexists returns whether the given value exists. the winregvalue constructor creates a winregvalue object. ...
A XUL Bestiary - Archive of obsolete content
like the following global skin processing instruction: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> specifies a chrome to be loaded by the gecko rendering engine. in the example above, the chrome is simply a skin file to be loaded into the xul file, but the chrome can also be used to load whole chromes, as when a <menuitem> in one window brings up a new chrome: <menuitem value="mozilla help" oncommand="window.opendialog('chrome://help/content/help.xul', '_blank', 'chrome,all,dialog=no')" /> in this example, the chrome url is being used to point to a chrome within the package hierarchy of the mozilla application. a help chrome defined in mozilla/bin/chrome/help/ is being invoked from the help menu. note t...
...reated out of the xptoolkit. a loosely analogous relationship might be that xul, xptoolkit, and xpfe are to one another what html, the actual html tags, and an html web page are to one another, respectively. xul parts people sometimes get confused about the syntax for describing the parts of a widget. for a widget like the menu that appears in the following example, menu is the element and both value and the id are attributes. <menu id="file" label="file"> <menupopup> <menuitem label="new" oncommand="createnewdoc()" /> <menuitem label="open" oncommand="opendoc()" /> <menuitem label="close" oncommand="closedoc()" /> </menupopup> </menu> element names the item, the widget, while attributes describes features of that element, such as its name, its style, and so on. in object-o...
..." /> <menuitem label="open" oncommand="opendoc()" /> <menuitem label="close" oncommand="closedoc()" /> </menupopup> </menu> element names the item, the widget, while attributes describes features of that element, such as its name, its style, and so on. in object-oriented parlance, the element is analogous to the object itself while the attribute is like a property. the attribute has a value associated with it (such as the string "file" for the id attribute in the example above). note that the menu element includes both the opening tag at the top and the closing tag at the bottom of the example. in a way, the menu element comprises the menu element itself and its children, the popup and menuitems. events events are also a source of confusion for many less-hardened developers. in fa...
...o this to happen. and the event listener attribute provides a very convenient place in which to write event handlers -- so convenient, in fact, that the term "event handler" is often used to describe both the event listener attribute and the event handler code you write within it. to create an event handler, simple place the code you want executed within the appropriate event listener: <menuitem value="click me" onclick="alert('event handled.')" /> it follows from the description above that event handlers can be written for events that are fired somewhere below them in the hierarchy. a menubar in xul, for instance, can contain event handlers for events fired by its child menuitems. mozilla xparchitecture mozilla is obviously a lot more than simply an interface. it's cross-platform, and sta...
appendNotification - Archive of obsolete content
« xul reference home appendnotification( label , value , image , priority , buttons, eventcallback ) return type: element create a new notification and display it. if another notification is already present with a higher priority, the new notification will be added behind it. label - label to appear on the notification. this should be either a string, or, from gecko 37 onwards, you can pass a documentfragment with rich content as well. keep in mind that this is all xul so using html elements for styling might still need additional css in order to work as you might expect. value - value used to identify the notification image - url of image to appear on the notification. if "" then an icon appropriate for the priority level is used. priority - notification priority; see prio...
...on is an object with the following properties: accesskey - the accesskey to appear on the button callback - function to be called when the button is activated. this function is passed three arguments: the <notification> the button is associated with the button description as passed to appendnotification. the element which was the target of the button press event. if the return value from this function is not true, then the notification is closed. the notification is also not closed if an error is thrown. label - the label to appear on the button popup - the id of a popup for the button. if null, the button is not a button popup (e.g. a menu). the type property must also be set to "menu", or "menu-button". isdefault - if true, this is the default button. there can be ...
...n. label - the label to appear on the button popup - the id of a popup for the button. if null, the button is not a button popup (e.g. a menu). the type property must also be set to "menu", or "menu-button". isdefault - if true, this is the default button. there can be only one default button. if no button has this set, the first button in the array is the default. type - a string. valid values are "menu-button" and "menu" which must be set if the button is to provide a popup via the popup property. notification box events requires gecko 9.0(firefox 9.0 / thunderbird 9.0 / seamonkey 2.6) if you specify the eventcallback parameter, it should be a javascript function that gets called when interesting things happen related to the notification box. this function receives as i...
... must be: "menu-button" or "menu". popup: null }; buttons.push(button1); let button2 = { isdefault: true, accesskey: "2", label: "button 2", callback: testnotificationbutton2callback, type: "", // if a popup, then must be: "menu-button" or "menu". ...
removeTransientNotifications - Archive of obsolete content
...
... ...
... ...
... ...
PopupEvents - Archive of obsolete content
nt, you can append to or modify the menu as needed before it is displayed. for examples of the use of the popupshowing event when used with context menus, see hiding and showing menu items based on context. however, this technique can be applied to any type of popup. in this example, a label within a panel is initialized with the current time. <panel id="time-panel" onpopupshowing="this.lastchild.value = (new date()).tolocaleformat('%t')"> <label value="time:"/> <label id="time"/> </panel> <toolbarbutton label="show time" popup="time-panel"/> you can prevent a menu or popup from appearing by calling the preventdefault method of the event from within a popupshowing listener. the default operation of the popupshowing event is to continue showing the popup. the preventdefault method will st...
...rom a menu, or if the user clicked outside the popup, or if the user pressed escape to cancel the menu. the popupshowing and popuphiding event will also be fired as the user rolls the mouse around on a menu bar, showing and hiding different menus and submenus. in this example, the contents of a textbox are cleared whenever a popup is hidden. ...
...otherwise, the user will be distracted with a popup that they cannot close. ...
...otherwise, the user will be distracted with a popup that they cannot close. you also cannot cancel the hiding of a menupopup when a user has made a selection from a menu, as it is already too late to do so. in this situation the command event has already been sent to the selected menuitem and the operation already carried out. ...
Property - Archive of obsolete content
etedefaultindex container contentdocument contentprincipal contenttitle contentview contentvieweredit contentviewerfile contentwindow contextmenu control controller controllers crop current currentindex currentitem currentnotification currentpage currentpane currentset currenturi customtoolbarcount database datasources date dateleadingzero datevalue decimalplaces decimalsymbol defaultbutton defaultvalue description dir disableautocomplete disableautocomplete disableautoselect disabled disablekeynavigation dlgtype docshell documentcharsetinfo editable editingcolumn editingrow editingsession editor editortype emptytext deprecated since gecko 2 enablecolumndrag eventnode firstordinalcolumn firs...
...complete disableautoselect disabled disablekeynavigation dlgtype docshell documentcharsetinfo editable editingcolumn editingrow editingsession editor editortype emptytext deprecated since gecko 2 enablecolumndrag eventnode firstordinalcolumn firstpermanentchild flex focused focuseditem forcecomplete group handlectrlpageupdown handlectrltab hasuservalue height hidden hideseconds highlightnonmatches homepage hour hourleadingzero id ignoreblurwhilesearching image increment inputfield inverted is24hourclock ispm issearching iswaiting itemcount label labelelement lastpermanentchild lastselected left linkedpanel listboxobject locked markupdocumentviewer max maxheight maxlength maxrows m...
... 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 textlength 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.childnodes dom:el...
...t.clientheight dom:element.clientleft dom:element.clienttop dom:element.clientwidth dom:element.clonenode dom:element.firstchild dom:element.firstelementchild dom:element.lastchild dom:element.lastelementchild dom:element.localname dom:element.namespaceuri dom:element.nextelementsibling dom:element.nextsibling dom:element.nodename dom:element.nodetype dom:element.nodevalue dom:element.ownerdocument dom:element.parentnode dom:element.prefix dom:element.previouselementsibling dom:element.previoussibling dom:element.scrollheight dom:element.scrollleft dom:element.scrolltop dom:element.scrollwidth dom:element.tagname dom:element.textcontent ...
Filtering - Archive of obsolete content
this can be done by modifying the dom nodes inside the query and rebuilding the template. for instance, to apply a filter, you might add a new <triple> element. to remove the filter, the <triple> should be removed again. let's assume that we've given an id of 'cond' to the query tag. ...
...for example, the resulting triple for the netherlands might be: <triple subject="?photo" predicate="http://www.xulplanet.com/rdf/country" object="http://www.daml.org/2001/09/countrie...
... cond.appendchild(triple); } else if (triple) { cond.removechild(triple); } document.getelementbyid("photoslist").builder.rebuild(); } the 'country' argument to the applyfilter function holds the value to filter by. if this is set, we add a filter, otherwise we remove it. the code is fairly straightforward. a new <triple> element is created and the object attribute is set to the value to filter by. for example, the resulting triple for the netherlands might be: <triple subject="?photo" predicate="http://www.xulplanet.com/rdf/country" object="http://www.daml.org/2001/09/countries/iso#nl"/> this triple is then appended to the query. the triple is given an id so that it can be found later if a different filter is applied. naturally, we only want to apply one fil...
...uitem> for each result. it will also need to include a <menupopup> around all of the items. since we only want to generate a single menupopup, it should go outside of the element with the uri attribute. only the contents at the element with the uri attribute and below are copied for each result. the elements above are not. <action> <menupopup> <menuitem uri="?country" label="?countrytitle" value="?country"/> </menupopup> </action> the result will be two generated menuitems, one for each country, inside a menupopup. the value attribute is assigned the ?country variable so that the applyfilter function can use this value easily for filtering. the complete example shows this working. note that due to a bug with template generation in menulists when the datasource hasn't loaded yet, you m...
Result Generation - Archive of obsolete content
result would be generated in this case. in xul template terminology, the starting point is called the container or reference point and the endpoint is called the member. it is so called because it is most common to gather the list of the members, or children, of a container. but this doesn't have to be the case. any starting point and ending points will do. nodes in rdf are identified by a string value. ...
... or reference point and the endpoint is called the member. it is so called because it is most common to gather the list of the members, or children, of a container. but this doesn't have to be the case. any starting point and ending points will do. nodes in rdf are identified by a string value. there are two types of nodes in rdf, resources which usually represent 'things', and literals which are values like the names, dates or sizes of those things, and so on. a literal's value is, for example, the name of the thing, such as 'fred'. a resource's value is a uri which for your own rdf data you can just make up (though if you plan to use your model with others, it should be unique, preferably a url for a site you own, so as to avoid future conflicts with mixing of other types). we'll use the uri ...
...ill cause content to be generated. so, to summarize: start out with a one possible result as the seed iterate over the results determined so far and augment them with additional data add any new possible results remove any rejected results repeat steps 2 to 4 for each query statement once done, all remaining results become matches each possible result is made up of a set of variable-value pairs. for instance, a result would look something like the following: (?name = fred, ?age = 5) this result has two variables, ?name with the value 'fred' and ?age with the value 5. variables begin with a question mark, and values are rdf resources or literals. here we will use strings for the values so they are easier to read. if we had two results, they might look like this: (?name = fred, ?ag...
...ght have a statement which removes all male results. so, our results after this might look like the following: (?name = mary, ?age = 12, ?gender = female) this statment has removed fred from the potential results and added the ?gender variable for mary. this is typical of how a query statement works, by adding additional variables to a result and filtering out those that don't match a particular value. if this were the last statement, mary would go on to become a match to be displayed. « previousnext » ...
Static Content - Archive of obsolete content
ead it will be what is called static content in a template. the static content is any content that is a sibling of the template element. this content is displayed as is without affecting the generated content from the template. ...
...the content will be displayed just like it would be as if the template wasn't present. that is, before the template is examined, the menulist would have one item in it, with the la...
...first item in the menu. static content example let's look at another example, involving radio buttons. actually, this example is similar, it just uses a radiogroup instead of a menulist to display the list of countries. ...
...the static 'all' radio button will be left as the first radio item. « previousnext » ...
Accesskey display rules - Archive of obsolete content
cesskey. for coherence of the labels on such localized builds, the accesskey text is always appended even if the labels have their accesskey characters. e.g., when an accesskey of "ok" is 'o' and an accesskey of "キャンセル" (means "cancel") is 'c', the labels will be "ok(o)" and "キャンセル(c)" on japanese localized build. xul elements check "intl.menuitems.alwaysappendaccesskeys" pref value whether they should append accesskey text always. if the value is "true" (string), the accesskey text will be appended always. don't change the pref value from your xul applications. and also note that there are no spaces between the original labels and accesskey text in the above japanese example. because typically, japanese language doesn't use spaces as word separator. this is controled by "in...
...don't include accesskey text in labels xul applications should use dtd for localizable ui resource. at that time, accesskeys are specified by independent entity from their label. be aware, this is very important thing. ...
...don't include accesskey text in labels xul applications should use dtd for localizable ui resource. at that time, accesskeys are specified by independent entity from their label. ...
...your xul applications. and also note that there are no spaces between the original labels and accesskey text in the above japanese example. because typically, japanese language doesn't use spaces as word separator. this is controled by "intl.menuitems.insertseparatorbeforeaccesskeys" pref value. if the value is "true" (string), a spece will be inserted before accesskey text. don't change the pref value from your xul applications too. don't include accesskey text in labels xul applications should use dtd for localizable ui resource. at that time, accesskeys are specified by independent entity from their label. be aware, this is very important thing. when you cannot use dtd, e.g., when you need to generate some uis dynamically, you can use .properties file or something. then, you should provide ...
Creating Dialogs - Archive of obsolete content
pears to the user. these differences will vary depending on the platform the application is running on. in addition, the opendialog() function can take additional arguments beyond the first three. these arguments are passed to the new dialog and placed in an array stored in the new window's arguments property. you can pass as many arguments as you wish. this is a convenient way to supply default values to the fields in the dialog. var somefile=document.getelementbyid('enterfile').value; window.opendialog("chrome://findfile/content/showdetails.xul","showmore", "chrome",somefile); in this example the dialog showdetails.xul is displayed. it's passed one argument, somefile, which was taken from the value of an element with the id enterfile. in a script used by the dialog, we ...
...","showmore", "chrome",somefile); in this example the dialog showdetails.xul is displayed. it's passed one argument, somefile, which was taken from the value of an element with the id enterfile. in a script used by the dialog, we can then refer to the argument using the window's arguments property. for example: var fl = window.arguments[0]; document.getelementbyid('thefile').value = fl; this is an effective way to pass values to the new window. you can pass values back from the opened window to the original window in one of two ways. first, you could use the window.opener property which holds the window that opened the dialog. second, you could pass a function or object as one of the arguments when creating the dialog, then call that function or modify the object in the ...
...id="donothing" title="dialog example" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" buttons="accept,cancel" ondialogaccept="return dook();" ondialogcancel="return docancel();"> <script> function dook(){ alert("you pressed ok!"); return true; } function docancel(){ alert("you pressed cancel!"); return true; } </script> <description value="select a button"/> </dialog> you may place any elements that you wish in a dialog. the dialog element has some additional attributes that windows do not have. the buttons attribute is used to specify which buttons should appear in the dialog. the following values may be used, seperated by commas: accept - an ok button cancel - a cancel button help - a help button disclosure - a disclosu...
...try the example above, you will find that the dook() function is called when the ok button is pressed and the docancel() function is called when the cancel button is pressed. the two functions dook() and docancel() both return true, which indicates that the dialog should be closed. if the dialog shouldn't be closed, false should be returned instead. this would be used, for example, if an invalid value was entered in a field in the dialog. amongst other useful attributes are buttonlabelaccept - label to appear on the accept button egsave buttonaccesskeyaccept - access key to use for the accept button egs defaultbutton - button is activated when the enter key is pressed note: the label attributes are required by remote sites and are probably missing in the above examples due to bug 2249...
Input Controls - Archive of obsolete content
n be used for text entry controls. xul has a similar element, textbox, used for text entry fields. without any attributes, the textbox element creates a box in which the user can enter text. textboxes accept many of the same attributes as html input controls. the following are some of them: id a unique identifier 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. maxlength the maximum number of characters that the textbox allows. note that while in htm...
...extbox that hides what it types. this is usually used for password entry fields. maxlength the maximum number of characters that the textbox allows. note that while in html, several different kinds of fields can be created with the input element, in xul there are separate elements for each type. the following example shows some textboxes: example 1 : source view <label control="some-text" value="enter some text"/> <textbox id="some-text"/> <label control="some-password" value="enter a password"/> <textbox id="some-password" type="password" maxlength="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 elemen...
...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 rows. ...
...if you open this window, you will see something much like that shown in the image. notice that the label and the text input field have now appeared in the window. ...
Keyboard Shortcuts - Archive of obsolete content
ated list of modifier keys, which are listed below. alt the user must press the alt key. on the macintosh, this is the option key. control the user must press the ctrl key. meta the user must press the meta key. this is the command key on the macintosh. shift the user must press the shift key. os the user must press the win key. this is the super key or the hyper key on linux. if this value is used, typically the key combination conflicts with system wide shortcut keys. so, you shouldn't use this value as far as possible. accel the user must press the special accelerator key. the key used for keyboard shortcuts on the user's platform. usually, this would be the value you would use. access the user must press the special access key. the key used for access keys on the user's pla...
...he clipboard. note that textboxes have the clipboard shortcuts built-in so you don't have to implement them yourself. assigning a keyboard shortcut on a menu the second way is: if you are assigning a keyboard shortcut that performs a command that also exists on a menu, you can associate the key element directly with the menu command. to do this, also add a key attribute on the menuitem. set its value to the id of the key that you want to use. the example below demonstrates this. example 2 : source view <keyset> <key id="paste-key" modifiers="accel" key="v" oncommand="alert('paste invoked')"/> </keyset> <menubar id="sample-menubar"> <menu id="edit-menu" label="edit" accesskey="e"> <menupopup id="edit-popup"> <menuitem id="paste-command" accesskey="p" key="...
...to the paste menu command to indicate that ctrl and the v key can be pressed to invoke the menu command. this is added for you based on the modifiers on the key element. keyboard shortcuts attached to menus will work even if the menu is not open. one additional feature of key definitions is that you can disable them easily. to do this add a disabled attribute to the key element and set it to the value true. this disables the keyboard shortcut so that it cannot be invoked. it is useful to change the disabled attribute using a script. our find files example let's add keyboard shortcuts to the find files dialog. we'll add four of them, one for each of the cut, copy, and paste commands and also one for the close command when the user presses esc. <?xml version="1.0" encoding="utf-8"?> <windo...
...h, if you want to respond to keys globally, you will use a keyboard shortcut as described earlier. the key event object has two properties which hold the key that was pressed. the keycode property holds the key code and may be compared to one of the constants from the key table earlier in this section. the charcode is used for printable characters and will hold the numeric unicode character code value for the key that was pressed. our find files example so far : source view next, we'll find out how to handle focus and the selection. « previousnext » ...
More Wizards - Archive of obsolete content
s no next attribute, so this will be the last page. a script will adjust the next attributes as necessary to go to the page with the page id color when needed. wizard functions the wizard works much like a tabbed panel, except that the tabs are not displayed and the user navigates between pages by using the buttons along the bottom. because all of the pages are part of the same file, all of the values of the fields on all pages will be remembered. thus, you do not have to load and save information between pages. however, you may want to do some validation of each field on each page. for this, use the handlers described in the previous section. if a field is invalid, you might display an alert. in some cases, it would be more convenient to disable the next button until valid input has been ent...
...r the next button should be enabled again. ...
...both properties are adjusted automatically as you switch pages. thus, the back button will be ...
...both properties are adjusted automatically as you switch pages. ...
The Box Model - Archive of obsolete content
ill be placed horizontally in a row. the vbox element is used to create a vertically oriented box. added elements will be placed underneath each other in a column. there is also a generic box element which defaults to horizontal orientation, meaning that it is equivalent to the hbox. however, you can use the orient attribute to control the orientation of the box. you can set this attribute to the value horizontal to create a horizontal box and vertical to create a vertical box. thus, the two lines below are equivalent: <vbox></vbox> <box orient="vertical"></box> the following example shows how to place three buttons vertically. example 1 : source view <vbox> <button id="yes" label="yes"/> <button id="no" label="no"/> <button id="maybe" label="maybe"/> </vbox> the three buttons here...
...e of a horizontal box, each additional element will be placed to the right of the previous one. the elements will not wrap at all so the more elements you add, the wider the window will be. similarly, each element added to a vertical box will be placed underneath the previous one. the example below shows a simple login prompt: example 2 : source view <vbox> <hbox> <label control="login" value="login:"/> <textbox id="login"/> </hbox> <hbox> <label control="pass" value="password:"/> <textbox id="pass"/> </hbox> <button id="ok" label="ok"/> <button id="cancel" label="cancel"/> </vbox> here four elements have been oriented vertically, two inner hbox tags and two button elements. notice that only the elements that are direct descendants of the box are oriented vertic...
...e image that each label and textbox is oriented horizontally. aligning textboxes if you look closely at the image of the login dialog, you can see that the two textboxes are not aligned with each other horizontally. it would probably be better if they were. in order to do this we need to add some additional boxes. example 3 : source view <vbox> <hbox> <vbox> <label control="login" value="login:"/> <label control="pass" value="password:"/> </vbox> <vbox> <textbox id="login"/> <textbox id="pass"/> </vbox> </hbox> <button id="ok" label="ok"/> <button id="cancel" label="cancel"/> </vbox> notice how the text boxes are now aligned with each other. to do this, we needed to add boxes inside of the main box. the two labels and textboxes are all placed...
...s add some boxes to the find files dialog. a vertical box will be added around all of the elements, and a horizontal box with be added around the textbox and the buttons. the result will be that the buttons will appear below the textbox. <vbox flex="1"> <description> enter your search criteria below and select the find button to begin the search. </description> <hbox> <label value="search for:" control="find-text"/> <textbox id="find-text"/> </hbox> <hbox> <spacer flex="1"/> <button id="find-button" label="find"/> <button id="cancel-button" label="cancel"/> </hbox> </vbox> the vertical box causes the main text, the box with the textbox and the box with the buttons to orient vertically. the inner boxes orient their elements horizontally. a...
Tree Selection - Archive of obsolete content
otherwise, the user may select multiple rows, which will not necessarily be contiguous. ...
...ion property. you can use the methods of the selection object to retrieve the set of selected items or modify the selection. because the selected items in a multiple selection tree are not necessarily contiguous, you can retrieve each block of contigous selections using the getrangecount() and getrangeat() functions. the first function returns the number of selection ranges there are. if only one value is selected, this value will be 1. you would then write a loop for the number of ranges, calling getrangeat() to get the actual indices of the start and end of the range. the getrangeat() function takes three arguments. the first is the range index. the second is an object which will be filled in by the function with the index of the first selected item. the third argument is an object whi...
...e filled in by the function with the index of the first selected item. the third argument is an object which will be filled in with the index of the last selected item. getrangeat example var start = new object(); var end = new object(); var numranges = tree.view.selection.getrangecount(); for (var t = 0; t < numranges; t++){ tree.view.selection.getrangeat(t,start,end); for (var v = start.value; v <= end.value; v++){ alert("item " + v + " is selected."); } } we create two objects called 'start' and 'end'. then, we iterate over the set of ranges, the number of which is returned by the getrangecount() function. the getrangeat() function is called passing the range index and the start and end objects. this function will fill in the start and end indicies by assigning them to the 'va...
...bjects called 'start' and 'end'. then, we iterate over the set of ranges, the number of which is returned by the getrangecount() function. the getrangeat() function is called passing the range index and the start and end objects. this function will fill in the start and end indicies by assigning them to the 'value' property. so if the first range is from the third item to the seventh item, 'start.value' will be 2 (remember that indices start with 0, so we subtract one.) and 'end.value' will be 6. an alert is displayed for each index. if you just want to find out if a specific row is selected, use can use the isselected() function. it takes a row index as an argument and returns true if that row is selected. alert(tree.view.selection.isselected(3)); modifying the tree selection the selection ob...
Trees and Templates - Archive of obsolete content
lowing example uses the history datasource: <tree datasources="rdf:history" ref="nc:historybydate" flags="dont-build-content"> as described in the previous section, the tree may use a tree builder for template generation instead of the normal content builder. this means that elements will not be created for every row in the tree, making it more efficient. the flags attribute set to the value dont-build-content, as used in the example above, indicates that the tree builder should be used. if you leave the attribute out, the content builder will be used. you can see the difference by using mozilla's dom inspector on a tree with and without the flag. if you do use a content builder instead, note that the content won't generally get built until it is needed. with hierarchical trees, the ...
... </template> </tree> here, a tree is created with two columns, for the name and date of a file. the tree should display a list of the files in the root directory. only one rule is used, but you may add others if needed. like with other templates, the uri attribute on an element indicates where to start generating content. the two cells grab the name and date from the datasource and place the values in the cell labels. this example shows why the uri attribute becomes useful. notice how it has been placed on the treeitem in the example, even though it is not a direct descendant of the rule element. we need to put this attribute on only those elements that we want repeated for each resource. because we don't want multiple treechildren elements, we don't put it there. instead we put the uri at...
...termine what to generate correctly. note in the image that additional child elements below the top-level elements have been added automatically. xul knows how to add child elements when the templates or rules contain tree elements or menu elements. it will generate tree elements as nested as necessary based on the available rdf data. an interesting part of rdf datasources is that the resource values are only determined when the data is needed. this means that values that are deeper in the resource hierarchy are not determined until the user navigates to that node in the tree. this becomes useful for certain datasources where the data is determined dynamically. sorting columns if you try the previous example, you might note that the list of files is not sorted. trees which generate their dat...
...he label of the cell in that column. if you set this on a column, the data will be sorted in that column. the user can change the sort direction by clicking the column header. if you do not set the sort attribute on a column, the data cannot be sorted by that column. the sortdirection attribute (note the mixed case) is used to set the direction in which the column will be sorted by default. three values are possible: ascending the data is displayed is ascending order. descending the data is displayed is descending order. natural the data is displayed in natural order, which means the order the data is stored in the rdf datasource. the final attribute, sortactive should be set to true for one column, the one that you would like to be sorted by defau...
XPCOM Examples - Archive of obsolete content
u can also get this component through the rdf service, which is another service that manages rdf datasources. the nsiwindowdatasource interface has a function getwindowforresource, which can be used to get the window given a resource. in the earlier example, we generated the list of windows and added it to a menu via a template. the template generates an id attribute on each menuitem element. the value of this attribute can be used as the resource. that means that in order to switch the window focus, we need to do the following: determine the element that the user clicked on. get the value of the id attribute from the element. pass this value to getwindowforresource() to get a window object. switch the focus to this window. the example below shows how we might do this: <toolbox> <men...
...; if (switchwindow){ switchwindow.focus(); } } </script> a command handler was added to the menu element which calls the function switchfocus() with a parameter of the element that was selected from the menu. the function switchfocus(): first gets a reference to a component which implements the window mediator interface. next, we get the id attribute for the element. we can use the value of the id attribute as the resource. the function getwindowforresource() takes the resource and returns a window that matches it. this window, stored in the switchwindow variable, is the same as the javascript window object. this means that you can call any of the functions provided by it, one of which is the focus() function. cookies next, we will get a list of cookies that have been saved ...
...the first two lines of getcookies() get the menulist and remove all of the existing items in the menu. this is done because getcookies() is called every time the men...
... will return true until we get to the last cookie. the getnext() method gets a cookie and moves the enumerator index to the next cookie. since an enumerator just returns a generic object, we need to queryinterface() it to an nsicookie before we can use it. in this case, we just use the instanceof operator to accomplish this. finally, an item is added to the menu for the cookie. the host, name and value properties of the cookie are used for this. menus have an appenditem() function which can be used to add an item to the menu, given a label and a value. see also more examples are available below. code snippets http://kb.mozillazine.org/category:xpcom_example_code next, we'll look at how to create trees. « previousnext » ...
XUL Event Propagation - Archive of obsolete content
he widget hierarchy. event handlers are written by you, the developer of the interface. very often, the event raised by the element is heard by the element itself and handled right there before it bubbles up any higher. this is the case in the example code in the diagram, where the onclick event listener for the button element handles the click event by displaying a simple alert dialog: <button value="click me" onclick="alert('thank you')" /> the opposite of event bubbling is event capturing. where event bubbling propagates an event from its target up higher into the node hiearchy, event capturing intercepts an event before it is received by other elements, even by the event target itself. the combination of basic these two basic event flow mechanisms, event bubbling and event capturing, m...
...r actually raised the event. ...
...tify the raising element and take the appropriate action, as in the following example, where a javascript function determines which menuitem was selected and responds appropriately: <script> function docmd(el) { v = el.getattribute("value"); if (v == "new") alert("new clicked"); else if (v == "open") alert("open clicked"); else alert("close clicked"); } </script> ... <menu class="menu" value="file" oncommand="docmd(event.target)"> <menupopup> <menuitem oncommand="alert('new item alert')" value="new" /> <menuitem value="open" /> <menuitem oncommand="alert('close handler')" value="close" /> </menupopup> </menu> ... the event handler in the menu finds out which menuitem was actually clicked and takes different actions accordingly. event capturing event ca...
...the root window element has used event capture to handle the event itself. in another example, an onload event handler for a xul window can register a box element to capture all the click events that are raised from its child elements: var bbox = document.getelementbyid("bigbox"); if (bbox) bbox.addeventlistener("click", function() { alert('captured'); }, true); ... <box id="bigbox"> <menu value="file"> <menupopup> <menuitem value="new" onclick="alert('not captured')" /> ... <menupopup> </menu> </box> adding an event listener in order to take advantage of event capturing (or event bubbling with elements that do not already have event listeners), you must add an event listener to the element that wants to capture events taking place below it. any xul element may...
listcell - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] a single cell of a listbox. by default it only contains text but iconic and checkbox listcells are also available. attributes crop, disabled, image, label, type properties disabled style classes listcell-iconic, examples (example needed) attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right sid...
...th the start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. ...
...if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. ...
...as it may need to update additional state. image type: uri the uri of the image to appear on the element. if this attribute is empty or left out, no image appears. the position of the image is determined by the dir and orient attributes. 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. type type: string this attribute is reserved for use by anonymous children of listitem; do not use. properties disabled type: boolean gets and sets the value of the disabled attribute. inherited properties align, , allowevents, , boxobject, builder, , , , cl...
param - Archive of obsolete content
Archive › Mozilla › XUL › param
« xul reference home [ examples | attributes | properties | methods | related ] for sql templates, used to bind values to parameters specified within an sql statement. the value to bind should be text as a child of the param element. for more information, see query_parameters. attributes index, name, type attributes index type: integer the index within the sql statement of the parameter. name type: string the name of a parameter within the sql statement. this name should appear within the query preceded by a colon. ...
...e to bind should be text as a child of the param element. for more information, see query_parameters. attributes index, name, type attributes index type: integer the index within the sql statement of the parameter. name type: string the name of a parameter within the sql statement. this name should appear within the query preceded by a colon. ...
... param element. for more information, see query_parameters. attributes index, name, type attributes index type: integer the index within the sql statement of the parameter. name type: string the name of a parameter within the sql statement. this name should appear within the query preceded by a colon. ...
...n the sql statement of the parameter. name type: string the name of a parameter within the sql statement. this name should appear within the query preceded by a colon. ...
<statusbarpanel> - Archive of obsolete content
en used with a short label or icon to indicate status, for instance whether the user is online or whether there are new messages. attributes crop, image, label properties image, label style classes statusbarpanel-iconic, statusbarpanel-iconic-text, statusbarpanel-menu-iconic examples <statusbar> <statusbarpanel label="left panel"/> <spacer flex="1"/> <progressmeter mode="determined" value="82"/> <statusbarpanel label="right panel"/> </statusbar> attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. ...
...th the start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. ...
...if this attribute is empty or left out, no image appears. ...
...tem, menupopup > menu { max-width: none; } image type: uri the uri of the image to appear on the element. if this attribute is empty or left out, no image appears. the position of the image is determined by the dir and orient attributes. 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. properties image type: image url gets and sets the value of the image attribute. label type: string gets and sets the value of the label attribute. inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collaps...
tabbox - Archive of obsolete content
if this attribute is not specified, events are listened to from the tabbox. thus, if this attribute is not used, the tabbox or an element inside it must have the focus for the keyboard navigation to apply. parent keyboard navigation is captured at the parent of the tabbox. window keyboard navigation is captured at the...
... in the document is focused. handlectrltab type: boolean if set to true or omitted, the tabbox will switch to the next tab when the control and tab keys are pressed. if the shift key is also held down, the previous tab will be displayed. if this attribute is set to false, these keys do not navigate between tabs. properties accessibletype type: integer a value indicating the type of accessibility object for the element. eventnode type: eventtarget indicates the node where keyboard navigation events listener is set up. the initial value for this property is determined by the value of the eventnode attribute. handlectrlpageupdown type: boolean gets and sets the value of the handlectrlpageupdown attribute. handlectrltab type: boolean ...
... selectedindex type: integer returns the index of the currently selected item. you may select an item by assigning its index to this property. ...
...attibute. selectedindex type: integer returns the index of the currently selected item. you may select an item by assigning its index to this property. by assigning -1 to this property, all items will be deselected. returns -1 if no items are selected selectedpanel type: element holds a reference to the currently selected panel within a <tabbox> element. assigning a value to this property will modify the selected panel. a select event will be sent when the selected panel is changed. selectedtab type: tab element a reference to the currently selected tab, which will always be one of the tab elements in the tabs element. assign a value to this property to modify the currently selected tab. tabs type: tabs element the tabs element contained within the t...
ant script to assemble an extension - Archive of obsolete content
this ant script helps to package an extension <?xml version="1.0"?> this build file was written by régis décamps <decamps@users.sf.net> <project name="blogmark" default="createxpi"> <property name="version" value="1.3-rc1"/> <property name="description" value="new context-menu item to add the current page in your blogmarks"/> xpi file is created after "chrome/blogmark.jar" is created, which is then stuffed into "blogmark.xpi" <target name="createxpi" depends="createjar" description="assemble the final build blogmark.xpi"> <zip destfile="blogmark-${version}.xpi"> <zipfileset dir="." includes="chrome/blogmark.jar" /> <zipfil...
... <target name="templates" description="generate files from templates."> <copy file="chrome/content/blogmark/contents.rdf.tpl.xml" tofile="chrome/content/blogmark/contents.rdf" overwrite="true"> <filterchain> <replacetokens> <token key="version" value="${version}"/> <token key="description" value="${description}"/> </replacetokens> </filterchain> </copy> <copy file="chrome/content/blogmark/about.xul.tpl.xml" tofile="chrome/content/blogmark/about.xul" overwrite="true"> ...
... </replacetokens> </filterchain> </copy> <copy file="chrome/content/blogmark/about.xul.tpl.xml" tofile="chrome/content/blogmark/about.xul" overwrite="true"> <filterchain> <replacetokens> <token key="version" value="${version}"/> </replacetokens> </filterchain> </copy> <copy file="install.rdf.tpl.xml" tofile="install.rdf" overwrite="true"> <filterchain> <replacetokens> <token key="version...
...${version}"/> </replacetokens> </filterchain> </copy> <copy file="install.rdf.tpl.xml" tofile="install.rdf" overwrite="true"> <filterchain> <replacetokens> <token key="version" value="${version}"/> <token key="description" value="${description}"/> </replacetokens> </filterchain> </copy> </target> </project> ...
Browser-side plug-in API - Archive of obsolete content
or an overview of how these two sides of the plug-in api interact, see the how plug-ins work and overview of plug-in structure sections in the introduction. warning: you must only call these from the main thread; calling them from other threads is not supported and may have unpredictable results. ...
... of how these two sides of the plug-in api interact, see the how plug-ins work and overview of plug-in structure sections in the introduction. warning: you must only call these from the main thread; calling them from other threads is not supported and may have unpredictable results. ...
...ictable results. ...
...s. ...
NPEvent - Archive of obsolete content
ng event types: wm_paint wm_lbuttondown wm_lbuttonup wm_lbuttondblclk wm_rbuttondown wm_rbuttonup wm_rbuttondblclk wm_mbuttondown wm_mbuttonup wm_mbuttondblclk wm_mousemove wm_keyup wm_keydown wm_setcursor wm_setfocus wm_killfocus for information about these events, see the microsoft windows developer documentation. ...
...buttonup wm_rbuttondblclk wm_mbuttondown wm_mbuttonup wm_mbuttondblclk wm_mousemove wm_keyup wm_keydown wm_setcursor wm_setfocus wm_killfocus for information about these events, see the microsoft windows developer documentation. wparam 32 bit field for the windows event parameter; parameter value depends upon event type. lparam 32 bit field for the windows event parameter; parameter value depends upon event type. ...
...message longint. ...
...nt structure is defined as xevent, the definition of the event type used by the xwindows platform. for information about the xevent structure and xwindows events, see the xwindows documentation. as the xevents sent to the plug-in are synthesized and there is not a native window corresponding to the plug-in rectangle, some of the members of the xevent structures are not set to their normal xserver values. e.g. key events don't have a position. mouse events have x and y coordinates relative to the top-left corner of the plugin rectangle. see also npp_handleevent() ...
NPN_PostURLNotify - Archive of obsolete content
const char* buf, npbool file, void* notifydata); parameters the function has the following parameters: instance current plug-in instance, specified by the plug-in. url url of the post request, specified by the plug-in. target target window, specified by the plug-in. ...
... 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 npp_urlnotify call, which returns this value (see description below). returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in...
... description npn_posturlnotify functions identically to npn_posturl, with these exceptions: npn_posturlnotify supports specifying headers when posting a memory buffer. ...
...s: npn_posturlnotify supports specifying headers when posting a memory buffer. npn_posturlnotify calls npp_urlnotify upon successful or unsuccessful completion of the request. for more information, see npn_posturl. npn_posturlnotify is typically asynchronous: it returns immediately and only later handles the request and calls npp_urlnotify. if this function is called with a target parameter value of _self or a parent to _self, this function should return an invalid_param nperror. this is the only way to notify the plug-in once it is deleted. see npn_geturl for information about this parameter. see also npn_geturl, npp_urlnotify, npn_posturl ...
-ms-accelerator - Archive of obsolete content
true the object is a keyboard shortcut. ...
... true the object is a keyboard shortcut. ...
... true the object is a keyboard shortcut. ...
...example uses the -ms-accelerator attribute in a <u> element to specify that the "n" in the <label> element is a keyboard shortcut. when the option to "hide keyboard navigation indicators until i use the alt key" is enabled in the user's display properties, the "n" is not underlined until the user presses the alt key. when alt + n is pressed, the <input> element that defines an accesskey attribute value of "n" receives the focus. <!doctype html> <html> <head> <title>accelerator</title> </head> <body> <label for="oname"><u style="-ms-accelerator: true; accelerator: true">n</u>ame: </label> <input type="text" id="oname" size="25" accesskey="n" value="your name here" /> </body> </html> specifications not part of any specification. remarks this prop...
-ms-content-zoom-chaining - Archive of obsolete content
a bounce effect is shown when the user hits a zoom limit during page manipulation. chained the nearest zoomable parent element begins zooming when the user hits a zoom limit during page manipulation. no bounce effect is shown. ...
...a bounce effect is shown when the user hits a zoom limit during page manipulation. chained the nearest zoomable parent element begins zooming when the user hits a zoom limit during page manipulation. no bounce effect is shown. ...
...a bounce effect is shown when the user hits a zoom limit during page manipulation. chained the nearest zoomable parent element begins zooming when the user hits a zoom limit during page manipulation. no bounce effect is shown. ...
...a bounce effect is shown when the user hits a zoom limit during page manipulation. chained the nearest zoomable parent element begins zooming when the user hits a zoom limit during page manipulation. no bounce effect is shown. ...
-ms-content-zoom-snap - Archive of obsolete content
the -ms-content-zoom-snap css shorthand property is a microsoft extension that specifies values for the -ms-content-zoom-snap-type and -ms-content-zoom-snap-points properties. ...
... the -ms-content-zoom-snap css shorthand property is a microsoft extension that specifies values for the -ms-content-zoom-snap-type and -ms-content-zoom-snap-points properties. ...
...m-snap css shorthand property is a microsoft extension that specifies values for the -ms-content-zoom-snap-type and -ms-content-zoom-snap-points properties. initial valueas each of the properties of the shorthand:-ms-content-zoom-snap-type: none-ms-content-zoom-snap-points: snapinterval(0%, 100%)applies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas each of the properties of the shorthand:-ms-content-zoom-snap-type: as specified-ms-content-zoom-snap-points: as specifiedanimation typediscrete syntax the -ms-content-zoom-snap shorthand property is specified as one or both of the following content zoom snap values, in order, separated by spaces. values -ms-content-zoom-snap-type value of the -ms-content-zoom-snap-type property. -ms-co...
...s of the shorthand:-ms-content-zoom-snap-type: as specified-ms-content-zoom-snap-points: as specifiedanimation typediscrete syntax the -ms-content-zoom-snap shorthand property is specified as one or both of the following content zoom snap values, in order, separated by spaces. values -ms-content-zoom-snap-type value of the -ms-content-zoom-snap-type property. -ms-content-zoom-snap-points value of the -ms-content-zoom-snap-points property. formal syntax <'-ms-content-zoom-snap-type'> | <'-ms-content-zoom-snap-points'> specifications not part of any specification. remarks this property has no effect on non-zoomable elements. see -ms-content-zooming for details on zoomable elements. starting with windows 8.1, this property is also supported for touchpad interaction. this prope...
-ms-flow-from - Archive of obsolete content
no container has been specified. <custom-ident> the name of the region container. ...
...no container has been specified. <custom-ident> the name of the region container. ...
...no container has been specified. <custom-ident> the name of the region container. ...
...no container has been specified. <custom-ident> the name of the region container. ...
-ms-flow-into - Archive of obsolete content
no container has been specified. <custom-ident> the name of the region container. ...
...no container has been specified. <custom-ident> the name of the region container. ...
...no container has been specified. <custom-ident> the name of the region container. ...
...no container has been specified. <custom-ident> the name of the region container. ...
-ms-high-contrast-adjust - Archive of obsolete content
none indicates the applicable css properties will not be adjusted when the system is in high contrast mode. formal syntax auto | none specifications not part of any specification. ...
... none indicates the applicable css properties will not be adjusted when the system is in high contrast mode. formal syntax auto | none specifications not part of any specification. ...
... none indicates the applicable css properties will not be adjusted when the system is in high contrast mode. formal syntax auto | none specifications not part of any specification. ...
... none indicates the applicable css properties will not be adjusted when the system is in high contrast mode. formal syntax auto | none specifications not part of any specification. ...
-ms-overflow-style - Archive of obsolete content
same as inherit. none scrollbars are never displayed, although the element can still be scrolled if the element's content overflows. scrollbar "traditional" scrollbars are displayed if the element's content overflows. ...
...same as inherit. none scrollbars are never displayed, although the element can still be scrolled if the element's content overflows. scrollbar "traditional" scrollbars are displayed if the element's content overflows. ...
...same as inherit. none scrollbars are never displayed, although the element can still be scrolled if the element's content overflows. scrollbar "traditional" scrollbars are displayed if the element's content overflows. ...
...same as inherit. none scrollbars are never displayed, although the element can still be scrolled if the element's content overflows. scrollbar "traditional" scrollbars are displayed if the element's content overflows. ...
-ms-scroll-limit - Archive of obsolete content
the -ms-scroll-limit css property is a microsoft extension that specifies values for the -ms-scroll-limit-x-min, -ms-scroll-limit-y-min, -ms-scroll-limit-x-max, and -ms-scroll-limit-y-max properties. ...
... the -ms-scroll-limit css property is a microsoft extension that specifies values for the -ms-scroll-limit-x-min, -ms-scroll-limit-y-min, -ms-scroll-limit-x-max, and -ms-scroll-limit-y-max properties. ...
...pecifies values for the -ms-scroll-limit-x-min, -ms-scroll-limit-y-min, -ms-scroll-limit-x-max, and -ms-scroll-limit-y-max properties. initial valueas each of the properties of the shorthand:-ms-scroll-limit-x-min: 0-ms-scroll-limit-y-min: 0-ms-scroll-limit-x-max: auto-ms-scroll-limit-y-max: autoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas each of the properties of the shorthand:-ms-scroll-limit-x-min: as specified-ms-scroll-limit-y-min: as specified-ms-scroll-limit-x-max: as specified-ms-scroll-limit-y-max: as specifiedanimation typediscrete syntax the -ms-scroll-limit property is specified as one or more of the following scroll limit values, in the order listed, separated by spaces. ...
...ne-block elementsinheritednocomputed valueas each of the properties of the shorthand:-ms-scroll-limit-x-min: as specified-ms-scroll-limit-y-min: as specified-ms-scroll-limit-x-max: as specified-ms-scroll-limit-y-max: as specifiedanimation typediscrete syntax the -ms-scroll-limit property is specified as one or more of the following scroll limit values, in the order listed, separated by spaces. values -ms-scroll-limit-x-min the value of the -ms-scroll-limit-x-min property. -ms-scroll-limit-y-min the value of the -ms-scroll-limit-y-min property. -ms-scroll-limit-x-max the value of the -ms-scroll-limit-x-max property. -ms-scroll-limit-y-max the value of the -ms-scroll-limit-y-max property. formal syntax <'-ms-scroll-limit-x-min'> <'-ms-scroll-limit-y-min'> <'-ms-s...
-ms-touch-select - Archive of obsolete content
none the grippers are always off and default touch selection functionality is not provided. formal syntax grippers | none specifications not part of any specification. ...
... none the grippers are always off and default touch selection functionality is not provided. formal syntax grippers | none specifications not part of any specification. ...
... none the grippers are always off and default touch selection functionality is not provided. formal syntax grippers | none specifications not part of any specification. ...
... none the grippers are always off and default touch selection functionality is not provided. formal syntax grippers | none specifications not part of any specification. remarks this property requires windows 8 or later. ...
::-ms-fill - Archive of obsolete content
he ::-ms-fill css pseudo-element is a microsoft extension that represents a progress bar displayed by <progress>. this pseudo-element is available only in internet explorer 10, internet explorer 11, and microsoft edge. all allowable properties except animation-name apply to a determinate progress bar. only animation-name applies to an indeterminate one. ...
... -ms-bar shows animated dots that flow in a bar pattern. -ms-ring shows animated dots that flow in a ring pattern. allowable properties only the following css properties can be used in a rule with ::-ms-fill in its selector. ...
... shows animated dots that flow in a ring pattern. allowable properties only the following css properties can be used in a rule with ::-ms-fill in its selector. other properties are ignored. ...
...nd-repeat, and background-size border border-radius box-shadow box-sizing color cursor display (values block, inline-block, none) font height margin -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color, outline-style, and outline-width padding transform and transform-origin visibility syntax ::-ms-fill example html <progress value="10" max="50"></progress> css progress::-ms-fill { background-color: orange; } result a progress bar using this style might look something like this: ...
display-outside - Archive of obsolete content
the display-outside css property specifies the outer display type of the box generated by an element, dictating how the element participates in its parent formatting context. ...
...other formatting contexts, such as flex formatting contexts, may also work with block-level elements. inline-level the element gen...
...oter-group; display-outside: table-row; display-outside: table-cell; display-outside: table-column-group; display-outside: table-column; display-outside: table-caption; display-outside: ruby-base; display-outside: ruby-text; display-outside: ruby-base-container; display-outside: ruby-text-container; /* global values */ display-outside: inherit; display-outside: initial; display-outside: unset; value not found in db! syntax one of the keyword values listed below. values block-level the element generates a block-level box, and participates in a block formatting context. other formatting contexts, such as flex formatting contexts, may also work with block-level elements. inline-level the element generates an inline-level box, and participates in an inline formatting context. run-in t...
...fic internal types. layout-specific internal types these display types require their parent and children to be of particular display types. for example, a table-row box requires its parent to be a table row group box and its children to be table-cell boxes. layout-specific leaf types these display types require their parent to be of a particular display type, but can accept any display-inside value. for example, a table-caption box must have a table parent, but can establish any kind of formatting context for its children. formal syntax syntax not found in db! specifications specification status comment css display module level 3the definition of 'display-outside' in that specification. candidate recommendation initial definition ...
Processing XML with E4X - Archive of obsolete content
create an element name (or to create content). var h = 'html'; var text = "here's some text"; var doc = <{h}><body>{text}</body></{h}>; alert(doc.toxmlstring()); // gives <html> <body>here's some text</body> </html> working with attributes xml literal syntax has a significant advantage over the xml constructor when you need to create markup dynamically. with e4x it is easy to embed dynamic values in markup. variables and expressions can be used to create attribute values by simply wrapping them with braces ({}) and omitting quotation marks that would normally go around an attribute value, as the following example illustrates: var a = 2; var b = <foo bar={a}>"hi"</foo>; upon execution the variable is evaluated and quotes are automatically added where appropriate. the preceding exampl...
...ntent, however (e.g., bar="a{var1}{var2}"). one must instead either calculate the variable with a javascript expression (e.g., bar={'a'+var1+var2}), define a new variable before the element literal which includes the full interpolation and then include that variable or retrieve the attribute after the literal to alter it (see below). while one can interpolate attribute names as well as attribute values: var a = 'att'; var b = <b {a}='value'/>; alert(b); // gives: <b att="value"/> ...one cannot interpolate a whole expression at once (e.g., <b {a}>.) after executing the above example, the variable languages references an xml object corresponding to the <languages> node in the xml document. this node has one attribute, type, which can be accessed and updated in a number of ways: alert(langu...
... xmllist does not support array methods such as foreach, and array generics such as array.foreach() are not compatible with xmllist objects. we can also use the for each...in statement introduced in javascript 1.6 as part of javascript's e4x support: for each (var lang in languages.lang) { alert(lang); } for each...in can also be used with regular javascript objects to iterate over the values (as opposed to the keys) contained in the object. as with for...in, using it with arrays is strongly discouraged. it is possible to create an xmllist using xml literal syntax without needing to create a well-formed xml document, using the following syntax: var xmllist = <> <lang>javascript</lang> <lang>python</lang> </>; the += operator can be used to append new elements to an xmllis...
...l = <html> <p id="p1">first paragraph</p> <p id="p2">second paragraph</p> </html>; alert(html.p.(@id == "p1")); // alerts "first paragraph" nodes matching the path before the expression (in this case the paragraph elements) are added to the scope chain before the expression is evaluated, as if they had been specified using the with statement. ...
Iterator - Archive of obsolete content
y-specific feature, and will be removed at some point. for future-facing usages, consider using for..of loops and the iterator protocol. the iterator function returns an object which implements legacy iterator protocol and iterates over enumerable properties of an object. syntax iterator(object, [keyonly]) parameters object object to iterate over properties. keyonly if keyonly is truthy value, iterator.prototype.next returns property_name only. description returns iterator instance that iterates over object. iterator instance returns [property_name, property_value] array for each iteration if keyonly is falsy, otherwise, if keyonly is truthy, it returns property_name for each iteration. if object is the iterator instance or generator instance, it returns object itself. propertie...
...alue] array for each iteration if keyonly is falsy, otherwise, if keyonly is truthy, it returns property_name for each iteration. if object is the iterator instance or generator instance, it returns object itself. properties iterator.prototype[@@iterator] returns a function that returns iterator object. methods iterator.prototype.next returns next item in the [property_name, property_value] format or property_name only. it throws stopiteration if there are no more items. examples iterating over properties of an object var a = { x: 10, y: 20, }; var iter = iterator(a); console.log(iter.next()); // ["x", 10] console.log(iter.next()); // ["y", 20] console.log(iter.next()); // throws stopiteration iterating over properties of an object with legacy destructuring for-in stateme...
...ion if there are no more items. ...
...terating over properties of an object var a = { x: 10, y: 20, }; var iter = iterator(a); console.log(iter.next()); // ["x", 10] console.log(iter.next()); // ["y", 20] console.log(iter.next()); // throws stopiteration iterating over properties of an object with legacy destructuring for-in statement var a = { x: 10, y: 20, }; for (var [name, value] in iterator(a)) { console.log(name, value); // x 10 // y 20 } iterating with for-of var a = { x: 10, y: 20, }; for (var [name, value] of iterator(a)) { // @@iterator is used console.log(name, value); // x 10 // y 20 } iterates over property name var a = { x: 10, y: 20, }; for (var name in iterator(a, true)) { console.log(name); // x ...
Generator comprehensions - Archive of obsolete content
d of braces— but instead of building an array they create a generator that can execute lazily. you can think of them as short hand syntax for creating generators. suppose we have an iterator it which iterates over a large sequence of integers. we want to create a new iterator that will iterate over their doubles. ...
...ating generators. suppose we have an iterator it which iterates over a large sequence of integers. we want to create a new iterator that will iterate over their doubles. ...
... create a new iterator that will iterate over their doubles. ...
...n array comprehension would create a full array in memory containing the doubled values: var doubles = [for (i in it) i * 2]; a generator comprehension on the other hand would create a new iterator which would create doubled values on demand as they were needed: var it2 = (for (i in it) i * 2); console.log(it2.next()); // the first value from it, doubled console.log(it2.next()); // the second value from it, doubled when a generator comprehension is used as the argument to a function, the parentheses used for the function call means that the outer parentheses can be omitted: var result = dosomething(for (i in it) i * 2); the significant difference between the two examples being that by using the generator comprehension, you would only have to loop over the 'obj' structure once, total, a...
Debug - Archive of obsolete content
n the visual studio output window at run time. to debug internet explorer scripts, you must have a script debugger installed and the script must run in debug mode. internet explorer 8 and later versions include the javascript debugger. if the script is not being debugged, the debug methods and properties have no effect. constants async callback status codes contant description value debug.ms_async_callback_status_assign_delegate the synchronous work item assigned a callback or continuation to be run by an asynchronous operation. 0 debug.ms_async_callback_status_join the synchronous work item satisfied part of a join asynchronous operation. 1 debug.ms_async_callback_status_chooseany the synchronous work item satisfied a choice asynchr...
...ync_callback_status_chooseany the synchronous work item satisfied a choice asynchronous operation. 2 debug.ms_async_callback_status_cancel the synchronous work item was canceled. 3 debug.ms_async_callback_status_error the synchronous work item caused an error in an asynchronous operation. 4 async operation status codes contant description value debug.ms_async_op_status_success the asynchronous operation was successful. 1 debug.ms_async_op_status_canceled the asynchronous operation was canceled. 2 debug.ms_async_op_status_error the asynchronous operation resulted in an error. 3 properties debug.debuggerenabled determines whether debugging is enabled for the script context. debugging...
...eted. debug.mstraceasyncoperationstarting initiates a trace for an asynchronous operation. debug.msupdateasynccallbackrelation updates the relationship status between a synchronous work item and the associated asynchronous operation. debug.write sends strings to the script debugger. debug.writeln sends strings to the script debugger, followed by a newline character. ...
...nchronous operation. debug.msupdateasynccallbackrelation updates the relationship status between a synchronous work item and the associated asynchronous operation. debug.write sends strings to the script debugger. debug.writeln sends strings to the script debugger, followed by a newline character. examples print the value of a variable this example uses the write function to display the value of the variable. var counter = 42; debug.write("the value of counter is " + counter); requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, internet explorer 10 standards, internet explorer 11 standards. also supported in store apps (windows 8 and windows phone ...
Object.observe() - Archive of obsolete content
he function called each time changes are made, with the following argument: changes an array of objects each representing a change. the properties of these change objects are: name: the name of the property which was changed. object: the changed object after the change was made. type: a string indicating the type of change taking place. one of "add", "update", or "delete". oldvalue: only for "update" and "delete" types. the value before the change. acceptlist the list of types of changes to be observed on the given object for the given callback. if omitted, the array ["add", "update", "delete", "reconfigure", "setprototype", "preventextensions"] will be used. return value the object to be observed. description callback is called each time a change is made t...
...callback is called each time a change is made to obj, with an array of all changes in the order in which they occurred. ...
...es in the order in which they occurred. ...
... object: <obj>, type: 'add'}] obj.foo = 'hello'; // [{name: 'foo', object: <obj>, type: 'update', oldvalue: 0}] delete obj.baz; // [{name: 'baz', object: <obj>, type: 'delete', oldvalue: 2}] object.defineproperty(obj, 'foo', {writable: false}); // [{name: 'foo', object: <obj>, type: 'reconfigure'}] object.setprototypeof(obj, {}); // [{name: '__proto__', object: <obj>, type: 'setprototype', oldvalue: <prototype>}] object.seal(obj); // [ // {name: 'foo', object: <obj>, type: 'reconfigure'}, // {name: 'bar', object: <obj>, type: 'reconfigure'}, // {object: <obj>, type: 'preventextensions'} // ] data binding // a user model var user = { id: 0, name: 'brendan eich', title: 'mr.' }; // create a greeting for the user function updategreeting() { user.greeting = 'hello, ' + user.t...
Unconventional controls - Game development
when those variables are up-to-date, we can use them in the draw() function to move the ship: function draw() { ctx.clearrect(0, 0, canvas.width, canvas.height); // ... if(horizontaldegree > degreethreshold) { playerx -= 5; } else if(horizontaldegree < -degreethreshold) { ...
... output.innerhtml = 'leap motion: <br />' + ' roll: ' + horizontaldegree + '° <br />' + ' pitch: ' + verticaldegree + '° <br />' + ' strength: ' + grabstrength + ''; } }); the code above is calculating and assigning the horizontaldegree, verticaldegree and grabstrength values that we will use later on, and outputting it in html so we can see the actual values. when those variables are up-to-date, we can use them in the draw() function to move the ship: function draw() { ctx.clearrect(0, 0, canvas.width, canvas.height); // ... if(horizontaldegree > degreethreshold) { playerx -= 5; } else if(horizontaldegree < -degreethreshold) { playerx += 5; } if(verticaldegree > degreethreshold) { playery += 5; ...
...-= 5; } else if(horizontaldegree < -degreethreshold) { playerx += 5; } if(verticaldegree > degreethreshold) { playery += 5; } else if(verticaldegree < -degreethreshold) { playery -= 5; } if(grabstrength == 1) { alert('boom!'); } ctx.drawimage(img, playerx, playery); requestanimationframe(draw); } if the horizontaldegree value is greater than our degreethreshold, which is 30 in this case, then the ship will be moved left 5 pixels on every frame. if its value is lower than the threshold's negative value, then the ship is moved right. up/down movement works in the same sort of way. the last value is grabstrength, which is a float between 0 and 1 — when reaching 1 (fist fully clenched), we show an alert for now (in a fu...
...r example a hand, is from the given sensor. it could work similar to the doppler effect in terms of manipulating the player's ship on the screen by moving your hand closer or further from the device. an event listener for device proximity would look like this: window.addeventlistener('deviceproximity', function(event) { var min = event.min; var max = event.max; var proximity = event.value; }); the min and max values are the minimum and the maximum distances respectively between which the sensor can detect the exact proximity value. all three are calculated in centimetres. note: see the deviceproximityevent reference page for more details. makey makey if you want to go completely bananas you can use makey makey, a board that can turn anything into a controller — it's all ab...
Move the ball - Game development
l be painting the ball on the screen, clearing it and then painting it again in a slightly different position every frame to make the impression of movement — just like how movement works with the movies. defining a drawing loop to keep constantly updating the canvas drawing on each frame, we need to define a drawing function that will run over and over again, with a different set of variable values each time to change sprite positions, etc. you can run a function over and over again using a javascript timing function such as setinterval() or requestanimationframe(). delete all the javascript you currently have inside your html file except for the first two lines, and add the following below them. the draw() function will be executed within setinterval every 10 miliseconds: function draw(...
...add the following below your x and y variable definitions: var dx = 2; var dy = -2; the last thing to do is to update x and y with our dx and dy variable on every frame, so the ball will be painted in the new position...
...nd y variables in the arc() method, as shown in the following highlighted line: function draw() { ctx.beginpath(); ctx.arc(x, y, 10, 0, math.pi*2); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); } now comes the important part: we want to add a small value to x and y after every frame has been drawn to make it appear that the ball is moving. let's define these small values as dx and dy and set their values to 2 and -2 respectively. add the following below your x and y variable definitions: var dx = 2; var dy = -2; the last thing to do is to update x and y with our dx and dy variable on every frame, so the ball will be painted in the new position on every update. add the following two new lines indicated below to your draw() function: function draw() { ctx.
...0, 0, canvas.width, canvas.height); ctx.beginpath(); ctx.arc(x, y, 10, 0, math.pi*2); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); x += dx; y += dy; } save your code and try again, and this time you'll see the ball move without a trail. every 10 milliseconds the canvas is cleared, the blue circle (our ball) will be drawn on a given position and the x and y values will be updated for the next frame. cleaning up our code we will be adding more and more commands to the draw() function in the next few articles, so it's good to keep it as simple and clean as possible. let's start by moving the ball drawing code to a separate function. replace the existing draw() function with the following two functions: function drawball() { ctx.beginpath(); ctx.
Visual typescript game engine - Game development
, scriptpath: "externals/hack-timer.js", }, { name: "dragging", enabled: true, scriptpath: "externals/drag.ts", }, ]; /** * @description this is main coordinary types of positions * can be "diametric-fullscreen" or "frame". * @property drawreference * @type string */ private drawreference: string = "frame"; /** * aspectratio default value, can be changed in run time. */ private aspectratio: number = 1.333; /** * domain is simple url address, * recommendent to use for local propose lan ip * like : 192.168.0.xxx if you wanna run ant test app with server. */ private domain: string = "maximumroulette.com"; /** * networkdeeplogs control of dev logs for webrtc context only. */ private networkdeeplogs: bo...
... "maximumroulette.com"; /** * networkdeeplogs control of dev logs for webrtc context only. */ private networkdeeplogs: boolean = false; /** * masterserverkey is channel access id used to connect * multimedia server channel. */ private masterserverkey: string = "multi-platformer-sever1.maximum"; /** * rtcserverport port used to connect multimedia server. ...
...use 'false' if you wanna make single player game. * in other way keep it 'true'. ...
...base physics based on : original source: matter.js https://github.com/liabru/matter-js matter.ts used because typescript orientation. https://www.npmjs.com/package/@types/matter-js crypto icons downloaded from https://www.behance.net/junikstudio todo list for 2019 i'm still far away from the project objective : make visual nodes for editor mode in gameplay. item's selling for crypto values. create examples demos in minimum 20 gameplay variants (table games, actions, platformers, basic demo throw the api doc etc.). implementing ar and webgl2. live demo platformer ...
JSON - MDN Web Docs Glossary: Definitions of Web-related terms
javascript object notation (json) is a data-interchange format. although not a strict subset, json closely resembles a subset of javascript syntax. though many programming languages support json, json is especially useful for javascript-based apps, including websites and browser extensions. ...
...cript object notation (json) is a data-interchange format. although not a strict subset, json closely resembles a subset of javascript syntax. though many programming languages support json, json is especially useful for javascript-based apps, including websites and browser extensions. ...
... data-interchange format. although not a strict subset, json closely resembles a subset of javascript syntax. though many programming languages support json, json is especially useful for javascript-based apps, including websites and browser extensions. json can represent numbers, booleans, strings, null, arrays (ordered sequences of values), and objects (string-value mappings) made up of these values (or of other arrays and objects). ...
... much like xml, json has the ability to store hierarchical data unlike the more traditional csv format. many tools provide translation between these formats such as this online json to csv converter or this alternative json to csv converter. ...
Floats - Learn web development
comes below the floated element in the normal layout flow will now wrap around it, filling up the space to the right-hand side of it as far up as the top of the floated element. there, it will stop. floating the content to the right has exactly the same effect, but in reverse — the floated element will stick to the right, and the content will wrap around it to the left. try changing the float value to right and replace margin-right with margin-left in the last ruleset to see what the result is. while we can add a margin to the float to push the text away, we can't add a margin to the text to move it away from the float. this is because a floated element is taken out of normal flow, and the boxes of the following items actually run behind the float. you can demonstrate this by making some c...
...left; margin: 15px; width: 150px; height: 150px; border-radius: 5px; background-color: rgb(207,232,220); padding: 1em; } .special { background-color: rgb(79,185,227); padding: 10px; color: #fff; } .cleared { clear: left; } you should see that the following paragraph clears the floated element and no longer comes up alongside it. the clear property accepts the following values: left: clear items floated to the left. right: clear items floated to the right. both: clear any floated items, left or right. clearing boxes wrapped around a float you now know how to clear something following a floated element, but let's see what happens if you have a tall float and a short paragraph, with a box wrapped around both elements. change your document so that the first parag...
... remove the clearfix css you added in the last section, and instead add overflow: auto to the rules for wrapper. once again, the box should clear. .wrapper { background-color: rgb(79,185,227); padding: 10px; color: #fff; overflow: auto; } float example 6 <h1>simple float example</h1> <div class="wrapper"> <div class="box">float</div> <p>lorem ipsum dolor sit ...
... a mini layout inside your page, inside which everything is contained, therefore our floated element is contained inside the bfc and the background runs behind both items. this will usually work, however, in certain cases you might find unwanted scrollbars or clipped shadows due to unintended consequences of using overflow. display: flow-root the modern way of solving this problem is to use the value flow-root of the display property. this exists only to create a bfc without using hacks — there will be no unintended consequences when you use it. remove overflow: auto from your .wrapper rule and add display: flow-root. assuming you have a supporting browser, the box will clear. .wrapper { background-color: rgb(79,185,227); padding: 10px; color: #fff; display: flow-root; } float e...
Multiple-column layout - Learn web development
xample of what the final code should look like. our starting point contains some very simple html; a wrapper with a class of container inside which is a heading and some paragraphs. the <div> with a class of container will become our multicol container. we switch on multicol by using one of two properties column-count or column-width. the column-count property will create as many columns as the value you give it, so if you add the following css to your stylesheet and reload the page, you will get three columns: .container { column-count: 3; } the columns that you create have flexible widths — the browser works out how much space to assign each column. column-count example body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.2 arial, helvetica, sans-serif; } ...
...text color of a single column. you have 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, 18...
.... spanning columns you can cause an element to span across all of the columns. in this case the content breaks when the spanning element is introduced and continues below creating a new set of column boxes. to cause an element to span all of the columns use the column-span property set to all. note that it isn't possible to cause an element to span some columns. the property can only have the value of none (which is the default) or all. spanning the columns body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.2 arial, helvetica, sans-serif; } .container { column-count: 3; column-gap: 20px; column-rule: 4px dotted rgb(79, 185, 227); } h2 { column-span: all; background-color: rgb(79, 185, 227); color: white; padding: .5em; } <div class="container"> <h1>s...
...0px; column-gap: 20px; } .card { background-color: rgb(207, 232, 220); border: 2px solid rgb(79, 185, 227); padding: 10px; margin: 0 0 1em 0; } to control this behavior we can use properties from the css fragmentation specification. this specification gives us properties to control breaking of content in multicol and in paged media. for example, add the property break-inside with a value of avoid to the rules for .card. this is the container of the heading and text, and therefore we do not want to fragment this box. at the present time it is also worth adding the older property page-break-inside: avoid for best browser support. .card { break-inside: avoid; page-break-inside: avoid; background-color: rgb(207,232,220); border: 2px solid rgb(79,185,227); padding: 10px; ...
Responsive design - Learn web development
ercentage width, and ensuring that across the layout the totals were not more than 100%. in his original piece on fluid grids, marcotte detailed a formula for taking a layout designed using pixels and converting it into percentages. target / context = result for example, if our target column size is 60 pixels, and the context (or container) it is in is 960 pixels, we divide 60 by 960 to get a value we can use in our css, after moving the decimal point two places to the right. .col { width: 6.25%; /* 60 / 960 = 0.0625 */ } this approach will be found in many places across the web today, and it is documented here in the layout section of our legacy layout methods article. it is likely that you will come across websites using this approach in your work, so it is worth understanding it, e...
...dth as will comfortably fit into the container, then share out the remaining space between all the columns. therefore the number of columns will change according to how much space there is. .container { column-width: 10em; } flexbox in flexbox, flex items will shrink and distribute space between the items according to the space in their container, as their initial behavior. by changing the values for flex-grow and flex-shrink you can indicate how you want the items to behave when they encounter more or less space around them. in the example below the flex items will each take an equal amount of space in the flex container, using the shorthand of flex: 1 as described in the layout topic flexbox: flexible sizing of flex items. .container { display: flex; } .item { flex: 1; } not...
... the flex items will each take an equal amount of space in the flex container, using the shorthand of flex: 1 as described in the layout topic flexbox: flexible sizing of flex items. .container { display: flex; } .item { flex: 1; } note: as an example, we have rebuilt the simple responsive layout above, this time using flexbox. you can see how we no longer need to use strange percentage values to calculate the size of the columns: example, source code. css grid in css grid layout the fr unit allows the distribution of available space across grid tracks. the next example creates a grid container with three tracks sized at 1fr. this will create three column tracks, each taking one part of the available space in the container. you can find out more about this approach to create a grid...
...using vw, it will always relate to the size of the viewport. h1 { font-size: 6vw; } the problem with doing the above is that the user loses the ability to zoom any text set using the vw unit, as that text is always related to the size of the viewport. therefore you should never set text using viewport units alone. there is a solution, and it involves using calc(). if you add the vw unit to a value set using a fixed size such as ems or rems then the text will still be zoomable. essentially, the vw unit adds on top of that zoomed value: h1 { font-size: calc(1.5rem + 3vw); } this means that we only need to specify the font size for the heading once, rather than set it up for mobile and redefine it in the media queries. the font then gradually increases as you increase the size of the view...
Getting started with CSS - Learn web development
the same folder as your html document and save it as styles.css. the .css extension shows that this is a css file. to link styles.css to index.html add the following line somewhere inside the <head> of the html document: <link rel="stylesheet" href="styles.css"> this <link> element tells the browser that we have a stylesheet, using the rel attribute, and the location of that stylesheet as the value of the href attribute. you can test that the css works by adding a rule to styles.css. using your code editor add the following to your css file: h1 { color: red; } save your html and css files and reload the page in a web browser. the level one heading at the top of the document should now be red. if that happens, congratulations — you have successfully applied some css to an html document...
...one by simply choosing the html element that you want to change, and using a css rule to change the way it looks. a good example is our <ul>, an unordered list. it has list bullets, and if i decide i don't want those bullets i can remove them like so: li { list-style-type: none; } try adding this to your css now. the list-style-type property is a good property to look at on mdn to see which values are supported. take a look at the page for list-style-type and you will find an interactive example at the top of the page to try some different values in, then all allowable values are detailed further down the page. looking at that page you will discover that in addition to removing the list bullets you can change them — try changing them to square bullets by using a value of square. addin...
...to target these different states — the css below styles unvisited links pink and visited links green. a:link { color: pink; } a:visited { color: green; } you can change the way the link looks when the user hovers over it, for example removing the underline, which is achieved by in the next rule: a:hover { text-decoration: none; } in the live example below, you can play with different values for the various states of a link. i have added the rules above to it, and now realise that the pink color is quite light and hard to read — why not change that to a better color? can you make the links bold? we have removed the underline on our link on hover. you could remove the underline from all states of a link. it is worth remembering however that in a real site, you want to ensure th...
...tart to get the hang of it as you write more css. wrapping up in this tutorial, we have taken a look at a number of ways in which you can style a document using css. we will be developing this knowledge as we move through the rest of the lessons. however you now already know enough to style text, apply css based on different ways of targeting elements in the document, and look up properties and values in the mdn documentation. in the next lesson we will be taking a look at how css is structured. previous overview: first steps next in this module what is css? getting started with css how css is structured how css works using your new knowledge ...
What is CSS? - Learn web development
ng code shows a very simple css rule that would achieve the styling described above: h1 { color: red; font-size: 5em; } the rule opens with a selector . this selects the html element that we are going to style. in this case we are styling level one headings (<h1>). we then have a set of curly braces { }. inside those will be one or more declarations, which take the form of property and value pairs. each pair specifies a property of the element(s) we are selecting, then a value that we'd like to give the property. before the colon, we have the property, and after the colon, the value. css properties have different allowable values, depending on which property is being specified. in our example, we have the color property, which can take various color values. we also have the font-siz...
... are selecting, then a value that we'd like to give the property. before the colon, we have the property, and after the colon, the value. css properties have different allowable values, depending on which property is being specified. in our example, we have the color property, which can take various color values. we also have the font-size property. this property can take various size units as a value. a css stylesheet will contain many such rules, written one after the other. h1 { color: red; font-size: 5em; } p { color: black; } you will find that you quickly learn some values, whereas others you will need to look up. ...
... note: you can find links to all the css property pages (along with other css features) listed on the mdn css reference. ...
... note: you can find links to all the css property pages (along with other css features) listed on the mdn css reference. ...
Build your own function - Learn web development
it later on: const html = document.queryselector('html'); the next section uses another dom api function called document.createelement() to create a <div> element and store a reference to it in a constant called panel. this element will be the outer container of our message box. we then use yet another dom api function called element.setattribute() to set a class attribute on our panel with a value of msgbox. this is to make it easier to style the element — if you look at the css on the page, you'll see that we are using a .msgbox class selector to style the message box and its contents. finally, we call a dom function called node.appendchild() on the html constant we stored earlier, which nests one element inside the other as a child of it. we specify the panel <div> as the child we wan...
...ill not very useful — we don't want to just show the same default message every time. let's improve our function by adding some parameters, allowing us to call it with some different options. first of all, update the first line of the function: function displaymessage() { to this: function displaymessage(msgtext, msgtype) { now when we call the function, we can provide two variable values inside the parentheses to specify the message to display in the message box, and the type of message it is. to make use of the first parameter, update the following line inside your function: msg.textcontent = 'this is a message box'; to msg.textcontent = msgtext; last but not least, you now need to update your function call to include some updated message text. change the following ...
...overed in the next article, so you might want to read those first before trying it. ...
...tion, which with a bit more work could be transplanted into a real project. in the next article we'll wrap up functions by explaining another essential related concept — return values. ...
Silly story generator - Learn web development
complete variable and function definitions" and paste it into the top of the main.js file. this gives you three variables that store references to the "enter custom name" text field (customname), the "generate random story" button (randomize), and the <p> element at the bottom of the html body that the story will be copied into (story), respectively. in addition you've got a function called randomvaluefromarray() that takes an array, and returns one of the items stored inside the array at random. now look at the second section of the raw text file — "2. raw text strings". this contains text strings that will act as input into our program. we'd like you to contain these inside variables inside main.js: store the first, big long, string of text inside a variable called storytext. stor...
...to the randomize variable so that when the button it represents is clicked, the result() function is run. adds a partially-completed result() function definiton to your code. for the remainder of the assessment, you'll be filling in lines inside this function to complete it and make it work properly. ...
... function: create a new variable called newstory, and set its value to equal storytext. this is needed so we can create a new random story each time the button is pressed and the function is run. if we made changes directly to storytext, we'd only be able to generate a new story once. create three new variables called xitem, yitem, and zitem, and make them equal to the result of calling randomvaluefromarray() on your three arrays (the result in each case will be a random item out of each array it is called on). for example you can call the function and get it to return one random string out of insertx by writing randomvaluefromarray(insertx). next we want to replace the three placeholders in the newstory string — :insertx:, :inserty:, and :insertz: — with the strings stored in xitem, y...
...hese placeholders are each replaced with a random silly string. as a further hint, the method in question only replaces the first instance of the substring it finds, so you might need to make one of the calls twice. inside the first if block, add another string replacement method call to replace the name 'bob' found in the newstory string with the name variable. in this block we are saying "if a value has been entered into the customname text input, replace bob in the story with that custom name." inside the second if block, we are checking to see if the uk radio button has been selected. if so, we want to convert the weight and temperature values in the story from pounds and fahrenheit into stones and centigrade. what you need to do is as follows: look up the formulae for converting po...
Handling text — strings in JavaScript - Learn web development
glance, but when you dig deeper you'll start to see some notable differences. let's start by entering some basic lines into the browser developer console to familiarize ourselves. creating a string to start with, enter the following lines: let string = 'the revolution will not be televised.'; string; just like we did with numbers, we are declaring a variable, initializing it with a string value, and then returning the value. the only difference here is that when writing a string, you need to surround the value with quotes. if you don't do this, or miss one of the quotes, you'll get an error. try entering the following lines: let badstring = this is a test; let badstring = 'this is a test; let badstring = this is a test'; these lines don't work because any text without quotes around...
...f the string, as indicated by the 2nd quote, it complains with an error (with "unterminated string literal"). if your program is raising such errors, then go back and check all your strings to make sure you have no missing quote marks. the following will work if you previously defined the variable string — try it now: let badstring = string; badstring; badstring is now set to have the same value as string. single quotes vs. double quotes in javascript, you can choose single quotes or double quotes to wrap your strings in. both of the following will work okay: let sgl = 'single quotes.'; let dbl = "double quotes"; sgl; dbl; there is very little difference between the two, and which you use is down to personal preference. you should choose one and stick to it, however; differentl...
... fancy programming word that means "join together". joining together strings in javascript uses the plus (+) operator, the same one we use to add numbers together, but in this context it does something different. let's try an example in our console. let one = 'hello, '; let two = 'how are you?'; let joined = one + two; joined; the result of this is a variable called joined, which contains the value "hello, how are you?". in the last instance, we joined only two strings, but you can join as many as you like, as long as you include a + between each pair. try this: let multiple = one + one + one + one + two; multiple; you can also use a mix of variables and actual strings. try this: let response = one + 'i am fine — ' + two; response; note: when you enter an actual string in you...
...nclude complex expressions inside template literals, for example: let examscore = 45; let examhighestscore = 70; examreport = `you scored ${ examscore }/${ examhighestscore } (${ math.round((examscore/examhighestscore*100)) }%). ${ examscore >= 49 ? 'well done, you passed!' : 'bad luck, you didn\'t pass this time.' }`; the first two placeholders here are pretty simple, only including a simple value in the string. the third one calculates a percentage result and rounds it to the nearest integer. the fourth one includes uses a ternary operator to check whether the score is above a certain mark and print a pass or fail message depending on the result. another point to note is that if you want to split a traditional string over multiple lines, you need to include a newline character, \n: o...
Server-side web frameworks - Learn web development
ecords). for example, the django web framework provides an orm, and refers to the object used to define the structure of a record as the model. the model specifies the field types to be stored, which may provide field-level validation on what information can be stored (e.g. an email field would only allow valid email addresses). the field definitions may also specify their maximum size, default values, selection list options, help text for documentation, label text for forms etc. the model doesn't state any information about the underlying database as that is a configuration setting that may be changed separately of our code. the first code snippet below shows a very simple django model for a team object. this stores the team name and team level as character fields and specifies a maximum nu...
...hat may be changed separately of our code. the first code snippet below shows a very simple django model for a team object. this stores the team name and team level as character fields and specifies a maximum number of characters to be stored for each record. the team_level is a choice field, so we also provide a mapping between choices to be displayed and data to be stored, along with a default value. #best/models.py from django.db import models class team(models.model): team_name = models.charfield(max_length=40) team_levels = ( ('u09', 'under 09s'), ('u10', 'under 10s'), ('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 quer...
...hen a page is generated. templates are often used to create html, but can also create other types of document. web frameworks often provide a mechanism to make it easy to generate other formats from stored data, including json and xml. for example, the django template system allows you to specify variables using a "double-handlebars" syntax (e.g. {{ variable_name }}), which will be replaced by values passed in from the view function when a page is rendered. the template system also provides support for expressions (with syntax: {% expression %}), which allow templates to perform simple operations like iterating list values passed into the template. note: many other templating systems use a similar syntax, e.g.: jinja2 (python), handlebars (javascript), moustache (javascript), etc. the co...
..., etc. the code snippet below shows how this works. continuing the "youngest team" example from the previous section, the html template is passed a list variable called youngest_teams by the view. inside the html skeleton we have an expression that first checks if the youngest_teams variable exists, and then iterates it in a for loop. on each iteration the template displays the team's team_name value in a list item. #best/templates/best/index.html <!doctype html> <html lang="en"> <body> {% if youngest_teams %} <ul> {% for team in youngest_teams %} <li>{{ team.team_name }}</li> {% endfor %} </ul> {% else %} <p>no teams are available.</p> {% endif %} </body> </html> how to select a web framework numerous web frameworks exist for almost every programming langu...
Ember app structure and componentization - Learn web development
> <div class="view"> <input aria-label="toggle the completion of this todo" class="toggle" type="checkbox" > <label>buy movie tickets</label> <button type="button" class="destroy" title="remove this todo" ></button> </div> <input autofocus class="edit" value="todo text"> </li> <li> <div class="view"> <input aria-label="toggle the completion of this todo" class="toggle" type="checkbox" > <label>go to movie</label> <button type="button" class="destroy" title="remove this todo" ></button> </div> ...
... <li> <div class="view"> <input aria-label="toggle the completion of this todo" class="toggle" type="checkbox" > <label>go to movie</label> <button type="button" class="destroy" title="remove this todo" ></button> </div> <input autofocus class="edit" value="todo text"> </li> </ul> </section> <footer class="footer"> <span class="todo-count"> <strong>0</strong> todos left </span> <ul class="filters"> <li> <a href="#">all</a> <a href="#">active</a> <a href="#">completed</a> </li> </ul> <button type="button" class="clear-completed"> clear completed </button> </fo...
... for reasons given below (yellow in the image) each todo is an individual component (green in the image) the footer (blue in the image) something odd to note is that the mark-all-complete checkbox (marked in yellow), while in the "main" section, is rendered next to the "new-todo" input. this is because the default css absolutely positions the checkbox + label with negative top and left values to move it next to the input, rather than it being inside the "main" section. using the cli to create our components for us so to represent our app, we want to create 4 components: header list individual todo footer to create a component, we use the ember generate component command, followed by the name of the component. let’s create the header component first. to do so: stop...
... as our application loads. ...
Framework main features - Learn web development
n react applications, but can be used to develop other applications — like vue apps, for instance. the following shows a simple jsx example: const subject = "world"; const header = ( <header> <h1>hello, {subject}!</h1> </header> ); this expression represents an html <header> element with a <h1> element inside. the curly braces around subject on line 4 tell the application to read the value of the subject constant and insert it into our <h1>. when used with react, the jsx from the previous snippet would be compiled into this: var subject = "world"; var header = react.createelement("header", null, react.createelement("h1", null, "hello, ", subject, "!") ); when ultimately rendered by the browser, the above snippet will produce html that looks like this: <header> <h1>hello, wo...
...s: <header> <h1>hello, world!</h1> </header> handlebars the handlebars templating language is not specific to ember applications, but it is heavily utilized in ember apps. handlebars code resembles html, but it has the option of pulling data in from elsewhere. this data can be used influence the html that an application ultimately builds. like jsx, handlebars uses curly braces to inject the value of a variable. handlebars uses a double-pair of curly braces, instead of a single pair. given this handlebars template: <header> <h1>hello, {{subject}}!</h1> </header> and this data: { subject: "world" } handlebars will build html like this: <header> <h1>hello, world!</h1> </header> typescript typescript is a superset of javascript, meaning it extends javascript — all javascript c...
...o affect how a component is rendered. as an example, consider a button that counts how many times it has been clicked. this component should be responsible for tracking its own count state, and could be written like this: function counterbutton() { const [count] = usestate(0); return ( <button>clicked {count} times</button> ); } usestate() is a react hook which, given an initial data value, will keep track of that value as it is updated. the code will be initially rendered like so in the browser: <button>clicked 0 times</button> the usestate() call keeps track of the count value in a robust way across the app, without you needing to write code to do that yourself. events in order to be interactive, components need ways to respond to browser events, so our applications can respo...
...erty, onclick. let’s update our counterbutton code from above to allow it to count clicks: function counterbutton() { const [count, setcount] = usestate(0); return ( <button onclick={() => setcount(count + 1)}>clicked {count} times</button> ); } in this version we are using additional usestate() functionality to create a special setcount() function, which we can invoke to update the value of count. we call this function on line 4, and set count to whatever its current value is, plus one. styling components each framework offers a way to define styles for your components — or for the application as a whole. although each framework’s approach to defining the styles of a component is slightly different, all of them give you multiple ways to do so. with the addition of some help...
Rendering a list of Vue components - Learn web development
inside of our template, repeating the rendering of a template feature for each item in an array. we'll use this to iterate through an array of to-do items and display them in our app in separate todoitem components. adding some data to render first we need to get an array of to-do items. to do that, we’ll add a data property to the app.vue component object, containing a todoitems field whose value is an array of todo items. while we'll eventually add a mechanism to add new todo items, we can start with some mock to do items. each to-do item will be represented by an object with a name and a done property. add a few sample to-do items, along the lines of those seen below. this way you have some data available for rendering using v-for. export default { name: 'app', components: { t...
.... to help vue optimize rendering the elements in the list, it tries to patch list elements so it's not recreating them every time the list changes. however, vue needs help. to make sure it is re-using list elements appropriately, it needs a unique "key" on the same element that you attach v-for to. to make sure that vue can accurately compare the key attributes, they need to be string or numeric values. while it would be great to use the name field, this field will eventually be controlled by user input, which means we can't guarantee that the names would be unique. we could use lodash.uniqueid(), however, like we did in the previous article. import lodash.uniqueid into your app component in the same way you did with your todoitem component, using import uniqueid from 'lodash.uniquei...
...input, which means we can't guarantee that the names would be unique. we could use lodash.uniqueid(), however, like we did in the previous article. import lodash.uniqueid into your app component in the same way you did with your todoitem component, using import uniqueid from 'lodash.uniqueid'; next, add an id field to each element in your todoitems array, and assign each of them a value of uniqueid('todo-'). your app.vue <script> element contents should now look like this: import todoitem from './components/todoitem.vue'; import uniqueid from 'lodash.uniqueid' export default { name: 'app', components: { todoitem }, data() { return { todoitems: [ { id: uniqueid('todo-'), label: 'learn vue', done: false }, { id: uniqueid('todo-'), label...
...this means we can pass the fields of our item objects to our todoitem component — just remember to use the v-bind syntax. this is really useful, as we want our todo items to display their label properties as their label, not a static label of "my todo item". in addition, we want their checked status to reflect their done properties, not always be s...
Accessible Toolkit Checklist
nt: get the parent of an iaccessible. get_accchildcount: get the number of children of an iaccessible. get_accchild: get the child of an iaccessible. get_accname: get the "name" of the iaccessible, for example the name of a button, checkbox or menu item. this is one reason why a label must be created together with each widget, rather than separately. get_accvalue: get the "value" of the iaccessible, for example a number in a slider, a url for a link, the text a user entered in a field. get_accrole: get an enumerated value representing what this iaccessible is used for, for example. is it a link, static text, editable text, a checkbox, or a table cell, etc. get_accstate: a 32 bit field representing possible on/off states, such as focuse...
... layout engine - drawing dark border dynamically when the currently focused widget does not need the enter key events - making keystrokes do the right thing msaa support (default state) links enter key activates link (thus default button no longer shows dark border when link is focused) msaa support, including linked and traversed states, and accessible value that holds destination url text fields - single and multiple line it's probably best to use native widgets for these, otherwise accessibility support will be quite difficult tab should always focus the next item, not insert a tab, unless there's a really good reason and another way to navigate always use system selection color, otherwise screen reader won't read t...
... and don't use the default system highlight color in the list itself unless it really has focus in autocomplete text fields, make sure that the delete or backspace key removes all auto completed selected text. ...
... msaa support, including accessible value that holds text, protected for password fields and readonly for read-only fields checkboxes space bar to toggle msaa support, including checkbox state and statechange event sliders keyboard support for moving slider: arrow keys, home, end, pgup, pgdn msaa support including role_slider, accessible value, value change events progress bars msaa support including accessible name, value, name and value change events grouped navigation widgets menus arrow keys, enter, escape alt alone enters main menu after leaving menus, focus is restored to where it was modified and unmodified mnemonics msaa support (including focus events, menu st...
Performance best practices for Firefox front-end engineers
the nsidomwindowutils.elementsrestyled attribute records a count of how many style calculations have occurred for a particular dom window. it should be possible to write a test that gets the nsidomwindowutils for a browser window, records the number of styleflushes, then synchronously calls the function that you want to test, and immediately after checks the styleflushes attribute again. if the value went up, your code caused synchronous style flushes to occur. note that your test and function must be called synchronously in order for this test to be accurate. if you ever go back to the event loop (by yielding, waiting for an event, etc), style flushes unrelated to your code are likely to run, and your test will give you a false positive. detecting and avoiding synchronous reflow this is ...
...t doesn't mean it doesn't cause reflow. for instance, at time of writing accessing event.rangeoffset triggers reflow in gecko, and does not occur in the earlier link. if you're unsure whether something causes reflow, check! note how abundant the properties in that first list are. this means that when enumerating properties on dom objects (e.g. elements/nodes, events, windows, etc.) accessing the value of each enumerated property will almost certainly (accidentally) cause uninterruptible reflow, because a lot of dom objects have one or even several properties that do so. if you require size or position information, you have a few options. bug 1434376 has recently landed a helper in the window binding to make it easier for priviledged code to queue up javascript to run when we know that the do...
...sh as above. }); }); this also implies that querying for size and position information in requestanimationframe() has a high probability of causing a synchronous reflow. other useful methods below you'll find some suggestions for other methods which may come in handy when you need to do things without incurring synchronous reflow. these methods generally return the most-recently-calculated value for the requested value, which means the value may no longer be current, but may still be "close enough" for your needs. unless you need precisely accurate information, they can be valuable tools in your performance toolbox. nsidomwindowutils.getboundswithoutflushing() getboundswithoutflushing() does exactly what its name suggests: it allows you to get the bounds rectangle for a dom node contai...
... in the process of being modified to expose things like markers (from window.performance.mark()). use the compositor for animations performing animations on the main thread should be treated as deprecated. avoid doing it. instead, animate using element.animate(). see the article animating like you just don't care for more information on how to do this. explicitly define start and end animation values some optimizations in the animation code of gecko are based on an expectation that the from (0%) and the to (100%) values will be explicitly defined in the @keyframes definition. even though these values may be inferred through the use of initial values or the cascade, the offscreen animation optimizations are dependent on the explicit definition. see this comment and a few previous comments on...
overflow-clip-box
production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the overflow-clip-box css property specifies relative to which box the clipping happens when there is an overflow. it is short hand for the overflow-clip-box-inline and overflow-clip-box-block properties. ...
...e large incompatibilities between implementations and the behavior may change in the future. the overflow-clip-box css property specifies relative to which box the clipping happens when there is an overflow. it is short hand for the overflow-clip-box-inline and overflow-clip-box-block properties. /* keyword values */ overflow-clip-box: padding-box; overflow-clip-box: content-box; /* two values */ overflow-clip-box: padding-box content-box; overflow-clip-box: content-box content-box; /* global values */ overflow-clip-box: inherit; overflow-clip-box: initial; overflow-clip-box: unset; note: on gecko, by default, padding-box is used everywhere, but <input type="text"> and similar use the value content-box. prior to firefox 29, this behavior was hardcoded; since then it uses this prop...
...overflow-clip-box: initial; overflow-clip-box: unset; note: on gecko, by default, padding-box is used everywhere, but <input type="text"> and similar use the value content-box. prior to firefox 29, this behavior was hardcoded; since then it uses this property that can be used elsewhere too. note that this property is activated by default only in the ua stylesheet and chrome contexts. initial valuepadding-boxapplies toall elementsinheritednomediavisualcomputed valueas specifiedanimation typediscretecanonical orderthe unique non-ambiguous order defined by the formal grammar syntax values padding-box this keyword makes the clipping be related to the padding box. content-box this keyword makes the clipping be related to the content box. formal syntax padding-box | content-box examp...
...lcomputed valueas specifiedanimation typediscretecanonical orderthe unique non-ambiguous order defined by the formal grammar syntax values padding-box this keyword makes the clipping be related to the padding box. content-box this keyword makes the clipping be related to the content box. ...
Embedding Tips
i save / upload a document / data to a web or ftp site? again, use the webbrowser persist object, but specify a remote location as the target uri. your web progress listener must also implement nsiauthprompt if you want to be able to upload to a password protected location (e.g. an ftp site). the nsiauthprompt interface allows the networking layer to pose a user / password prompt to obtain the values needed for authentication. your own implementation should pose this dialog, or fill in the values that are needed for the upload to succeed. how do i know when saving is done, monitor progress etc.? register your ownnsiwebprogresslistener object to listen for progress and state notifications. here is a simple example which demonstrates the principle. the simplepersist() function takes a strin...
...ew my_prop_name(); this was taken from weirdal's excellent "burning chrome" article. how do i specify alternate locations for profiles? specify a profile directory in your implementation of nsidirectoryserviceprovider passed to xre_initembedding. use xre_notifyprofile to make gecko actually use a profile location. how do i change the user agent string? the default useragent is set using the value from your application.ini/nsxreappdata. you can override this default using the "general.useragent.override" preference. how do i display my own message, alert and prompt boxes? you need to implement and register your own prompt service. how do i get the dom document from the web browser object? nscomptr<nsidomdocument> doc; nscomptr<nsidomwindow> window; webbrowser->getcontentdomwindow(gette...
...e contract id is defined here. for an example, see browserimpl.cpp in mfcembed and its simple cbrowsertooltip class implemented in mfc. how do i disable drag/drop support? when setting up your browser add a hook to the command manager which points to your nsiwebbrowserchrome implementation. this implementation should also implement nsiclipboarddragdrophooks. ...
...mplement nsiclipboarddragdrophooks. deny the drop by setting the return value of the allowdrop() function. ...
NetUtil.jsm
asource the input stream from which to read the source data. this must be an nsiinputstream based object. asink the output stream to which to copy the data. this must be an nsioutputstream based object. acallback an optional function that will be called when the copy operation is completed. the callback receives a single parameter: the nsresult status code for the copy operation. return value returns the nsiasyncstreamcopier object that is handling the copy. exceptions thrown this method throws an exception with the message "must have a source and a sink" if either asource or asink is null. example this example writes a string to a file; it comes from the test suite for the netutil module. var file = cc["@mozilla.org/file/directory_service;1"]. getservice(ci.nsiproper...
...ks note: if you specify an nsichannel as the input source, and its notification callbacks have already been set, callers are responsible for implementing nsibadcertlistener and nsisslerrorlistener. newchannel() creates a new channel for the specified uri string, nsiuri, or nsifile. nsichannel newchannel( awhattoload, [optional] aorigincharset, [optional] abaseuri ); parameters return value an nsichannel allowing access to the specified data source. awhattoload a string specifying a uri, or an nsiuri or nsifile object. the returned method will allow access to the specified data. aorigincharset the optional character set to use when interpreting awhattoload as a string; this is ignored if awhattoload is not a string. defaults to utf-8 if not provided. abaseuri the base uri f...
...t use a string to specify the uri. nsiuri newuri( atarget, [optional] aorigincharset, [optional] abaseuri ); parameters atarget specifies the target of the uri as either a uri string or (starting in gecko 2) as an nsifile. aorigincharset the optional character set for the uri. defaults to utf-8 if not provided. abaseuri the base uri for the spec, specified as an nsiuri. return value returns the nsiuri object representing the specified target. exceptions thrown this method throws an exception with the message "must have a non-null string spec or nsifile object" and result code ns_error_invalid_arg if aspec is null. readinputstreamtostring() reads a given number of bytes from an input stream, returning a string containing those bytes. this works even if some of those byte...
...put stream. if you don't provide this, the input won't be decoded at all and the raw bytes will be returned. replacement a character with which to replace any invalid byte sequences in the input stream. if you don't specify a replacement character, any invalid sequences will result in ns_error_illegal_input being thrown. this option only has effect if charset is as well. return value a string containing the bytes read from the input stream. exceptions thrown ns_error_invalid_arg the specified stream is not an nsiinputstream. ns_base_stream_would_block reading from the specified stream would block the calling thread, and the stream is in non-blocking mode. ns_error_failure there aren't at least acount bytes available to read from the stream. ns_error_illegal_input ...
OS.File for the main thread
refox/channel/toggler-beta.png?2013-06'; //do like this for images online img.src = path; example: append to file this example shows how to use open, write, and close to append to a file. if the file does not exist, it is created. at the time of this writing, write does not support encoding option so the text to be written has to be encoded with textencoder. this example also shows the resolve value of open (an instance of os.file, this is a file, so you can do any of the methods on it found here), write (a number indicating bytes written), and close (undefined, meaning there is no resolve value). var pth = os.path.join(os.constants.path.desktopdir, 'app.txt'); os.file.open(pth, {write: true, append: true}).then(valopen => { console.log('valopen:', valopen); var txttoappend = 'appen...
...-specific options for opening the file. for advanced users only. most users will never have need of these options. to specify options, pass an object that may contain some of the following flags: unixflags (ignored under non-unix platforms) if specified, file opening flags, as per libc function open. if unspecified, build these flags from the contents of mode. you can build these flags from values os.constants.libc.o_*. unixmode (ignored under non-unix platforms) if specified, file creation mode, as per libc function open. if unspecified, files are created with a default mode of 0600 (file is private to the user, the user can read and write). you can build this mode from values os.constants.libc.s_i*. winshare (ignored under non-windows platforms) if specified, a sharing policy, a...
... os.constants.win.file_share_*. winsecurity (ignored under non-windows platforms) if specified, a security policy, as per windows function createfile. if unspecified, no security attributes. winaccess (ignored under non-windows platforms) if specified, access mode, as per windows function createfile. this also requires option windisposition and this replaces argument mode. if unspecified, value is built from mode. windisposition (ignored under non-windows platforms) if specified, disposition mode, as per windows function createfile. this also requires option winaccess and this replaces argument mode. if unspecified, value is built from mode. promise resolves to an instance of os.file representing the expected file. note that the operating system limits the number of files t...
...s false, it will not fail due to pre-existence of directories, because the from option tells makedir to make the folders if not found. unixmode (ignored under non-unix platforms) if specified, file creation mode, as per libc function mkdir. if unspecified, directories are created with a default mode of 0600 (file is private to the user, the user can read and write). you can build this mode from values os.constants.libc.s_i*. winsecurity (ignored under non-windows platforms) if specified, a security policy, as per windows function createdirectory. if unspecified, no security attributes. from if specified, the call to makedir creates all the ancestors of path that are descendents of from. note that from and its existing descendents must be user-writeable and that path must be a descendent o...
Localization formats
ocalizer may cause accidental errors that can cause breakage (level of breakage depends on level of error) cannot use po editor, which most localizers know and love gettext (.po) gettext is a widely-used localization format that uses .po files. with this arrangement, content for localization is presented in the following manner: msgid "coming soon" msgstr "bientôt disponible" where the value in the "" of the msgid is the english content, and the value in the "" of the msgstr is the translation. msgstr can be longer translations than just the exact above. for example, below is the entire introduction used for a certificate that was presented to those who downloaded firefox during the download day campaign. the french content runs three lines: msgid "certificate_intro" msgstr "" "m...
...a file is sometimes impossible because the editing tool can save the .po file using a completely different structure or order of entities. read more about gettext on wikipedia and on mdc. wiki blogging, documentation, and other types of mozilla content often surface as wikis. case study: download day in the above gettext example, notice how the web developer used "certificate_intro" as the value of the msgid. this is not the actual content that was translated. so, if a localizer wanted to use one of the many powerful gettext tools, like po-editor, the msgid provides no context for translation or for other localizers to verify translations when qa-ing. this should have been avoided. in the case of download day, someone created entity-like identifiers in the msgid, which we have shown abo...
...l gettext tools, like po-editor, the msgid provides no context for translation or for other localizers to verify translations when qa-ing. this should have been avoided. in the case of download day, someone created entity-like identifiers in the msgid, which we have shown above with the "certificate_intro" key. then, an en-us repository was created holding the translations to all the entity-like values of msgid. this is very non-standard because it avoids one of the obvious powers of gettext. when english content is used as the value of the msgid, there is no need to place that content in a special repository. but, in the download day example, when changes were made to en-us, the web-developer had to push those changes to all the repositories of all the locales. localizers had to revisit an e...
...push those changes to all the repositories of all the locales. localizers had to revisit an en-us repository to find the exact msgid, review the change, and return to their repository to make changes. without having the exact content as the msgid, this process may cause several errors since the localizers cannot has to continually switch back-and-forth. in this case, the choice to use customized values for msgid was error-prone, onerous, and unfamiliar to localizers who are used to more customary gettext operations. ...
Mozilla Style System Documentation
ters to their frames, but instead, we have the reverse and is probably the biggest flaw in the design of this part of the system. getting style data from a style context to get style data from a style context, use the getstyledata method to fill in a pointer to a style struct. each of the style structs contains a group of properties. the structs are listed in, nsstylestruct.hand the many of the values are in nsstyleconsts.h. each of the structs includes either only features that are inherited by default or single properties that are set to the initial value by default (see css26.1.1), which is essential for the ruletree. the fundamental way to get a style struct from a style context looks like this: const nsstyledisplay *display = ns_static_cast(const nsstyledisplay*, ...
...except they are more general, and are used by other code that needs to add style information to the document. for the css stylesheets, this process corresponds to css selector matching. the output of css selector matching as defined by the css specification is an ordered list of rules, where the order determines which declarations override other declarations. (in css,declarations are the property-value pairs within style rules. in mozilla, nscssdeclaration objects correspond to css declaration-blocks.) due to the high similarity of these lists between elements in the content tree, mozilla stores the output of the selector matching process in a lexicographic tree, the rule tree. this double tree (style context tree and rule tree) allows for sharing of style data, which allows the data to take up...
... | | [quote: a] [quote: a] | [span: e] the reason the rule tree shares style data naturally is that most style rules specify properties in very few structs. as stated above, each style struct contains only features that are inherited by default or those that are set to their initial value ("reset") by default. this leads to (or perhaps three, depending on how you count) two types of sharing. for those structs where all the values are inherited by default, a style context can often (when none of the rules matched by the style context specifies any properties in the struct, or when explicit inherit is used) use the same struct as its parent style context. for the structs where all t...
...ending on how you count) two types of sharing. for those structs where all the values are inherited by default, a style context can often (when none of the rules matched by the style context specifies any properties in the struct, or when explicit inherit is used) use the same struct as its parent style context. for the structs where all the properties are reset by default, if no explicit inherit values or em or similar units are used, the style struct can be cached on the rule node rather than the style context and shared between all style contexts pointing to that rule node. furthermore, if the rule specifies no values for a struct, it can use the same struct as its parent. while the style context tree is generally quite deep, since it corresponds roughly to the content tree, the rule tree is...
Activity Monitor, Battery Status Menu and top
hich is useful, so it's the best one to use. the following screenshot shows a customized "energy" tab. the power-related columns are as follows. energy impact / avg energy impact: see the separate section below. % cpu: cpu usage percentage. this can exceed 100% if multiple cores are being used. idle wake ups: in mac os 10.9 this measured "package idle exit" wakeups. this is the same value as powermetrics' "pkg idle" measurement (i.e. task_power_info::task_platform_idle_wakeups obtained from the task_info function.) in mac os 10.10 it appears to have been changed to measure interrupt-level wakeups (a superset of idle wakeups), which are less interesting. this is the same value as powermetrics' "intr" measurement (i.e. task_power_info::task_interrupt_wakeups obtained from the tas...
...with actual power consumption and should be avoided in favour of direct measurements that have clear physical meanings. what does "average energy impact" measure? when the energy tab of activity monitor is first opened, the "average energy impact" column is empty and the title bar says "activity monitor (processing...)". after 5–10 seconds, the "average energy impact" column is populated with values and the title bar changes to "activity monitor (applications in last 8 hours)". if you have top open during those 5–10 seconds you'll see that systemstats is running and using a lot of cpu, and so presumably the measurements are obtained from it. systemstats is a program that runs continuously and periodically measures, among other things, cpu usage and idle wakeups for each running process. ...
...o show up in the battery status menu. and once the application stops using high amounts of energy it takes a few minutes to disappear. the exception is when the application is closed, in which case it disappears immediately. and it appears that a program with an “energy impact” of roughly 20 or more will eventually show up as significant, and programs that have much higher “energy impact” values tend to show up more quickly. all of these battery status menu observations are difficult to make reliably and so should be treated with caution. it is clear, however, that the window used by the battery status menu is measured in seconds or minutes, which is much less than the 8 hour window used for “average energy impact” in activity monitor. top top is similar to activity monitor, but ...
... top is unlikely to be much use for power profiling. ...
Investigating leaks using DMD heap scan mode
when combined with cycle collector logging, this can be used to investigate leaks of refcounted cycle collected objects, by figuring out what holds a strong reference to a leaked object. when should you use this? dmd heap scan mode is intended to be used to investigate leaks of cycle collected (cced) objects. ...
..._shutdown_log=$logdir: this option specifies that we want a dmd log to be taken very late in xpcom shutdown, and the location for that log to be saved. like with the cc log, we want this log very late to avoid as many non-leaking things as possible. moz_dmd_log_process=tab: as with the cc, this means that we only want these logs in content processes, in order to make shutdown faster. the allowed values here are the same as those returned by xre_getprocesstype(), so adjust as needed. finally, the --dmd option need to be passed in so that dmd will be run. --mode=scan is needed so that when we get a dmd log the entire contents of each block of memory is saved for later analysis. with that command line in hand, you can start firefox. be aware that this may take multiple minutes if you have opti...
...ocess that leaked. you'll want to write down the name of the file and the pid. let's call the file $cclog and the pid $pid. * 0x7f0897082c00: this is the address of the leaking window. you'll also want to write that down. let's call this $winaddr. if there are multiple files, you'll end up with one that looks like cc-edges.$pid.log and one or more that look like cc-edges.$pid-$n.log for various values of $n. you want the one with the largest $n, as this was recorded the latest, and so it will contain the least non-garbage. identifying the root in the cycle collector log the next step is to figure out why the cycle collector could not collect the window, using the find_roots.py script from the heapgraph repository. the command to invoke this looks like this: python $heapgraph/find_roots.py...
... need to figure out what the unknown reference is from, as that is where our leak really is. figure out what is holding the leaking object alive. now we need to use the dmd heap scan logs. these contain the contents of every live block of memory. the first step to using the dmd heap scan logs is to do some pre-processing for the dmd log. stacks need to be symbolicated, and we need to clamp the values contained in the heap. clamping is the same kind of analysis that a conservative gc does: if a word-aligned value in a heap block points to somewhere within another heap block, replace that value with the address of the block. both kinds of preprocessing are done by the dmd.py script, which can be invoked like this: $objdir/dist/bin/dmd.py --clamp-contents dmd-$pid.log.gz this can take a few ...
A guide to searching crash reports
clicking the links at the top right of the tab. the links within the results do the following things. the link in each "crash id" column cell links to an individual crash report. the links in each "signature" column cell have the same effect that they did in the "signature facet" tab. the links in the remaining column cells also let you perform a narrower subsequent search with that link's value added to the search criteria. a narrower search you can add criteria to perform a narrower search. for example, to perform a search for all mac crash reports that occurred while javascript garbage collection was running, do the following. add "mac os x" to the "platform" field. select "new line", and then choose a field ("is garbage collecting") and an operator ("is true"). the operators a...
... do a search with non-signature grouping first click on the "more options..." text, which reveals the additional fields shown in the following screenshot. (the "show columns" and "sort by" fields are straightforward. they apply to the "crash reports" tab of any search results, and are not related to grouping.) the "facet on" field is the one that controls grouping. by default, it contains the value "signature", which explains why we saw a "signature facet" tab in the earlier search results. but we can change the values in this field and get different facet tabs in the search results. grouping by platform for example, if we start with a default search for all firefox crashes in the past week, but then replace the "signature" facet with "platform" and "moz crash reason", we get search resul...
...quently by users. only a subset of crash reports have the "moz crash reason" field -- those that crashed due to hitting a moz_crash call -- so all crashes that lack that field are omitted from this tab. for that reason, the percentages do not add up to 100. an example of less useful grouping the usefulness of grouping varies from field to field. ...
... advanced usage the combination of searching and grouping is powerful. searches find crash reports that match particular criteria, and grouping organizes those crash reports into interesting groups. when a search is performed, the page's url is updated to include the search parameters. ...
PLHashAllocOps
a pair of functions is used to allocate and tree the table, and another pair of functions is used to allocate and free the table entries. the first argument, pool, for all four functions is a void * pointer that is a piece of data for the memo...
...a pair of functions is used to allocate and tree the table, and another pair of functions is used to allocate and free the table entries. the first argument, pool, for all four functions is a void * pointer that is a piece of data for the memo...
...a pair of functions is used to allocate and tree the table, and another pair of functions is used to allocate and free the table entries. the first argument, pool, for all four functions is a void * pointer that is a piece of data for the memory allocator. typically pool points...
... allocation functions. a pair of functions is used to allocate and tree the table, and another pair of functions is used to allocate and free the table entries. the first argument, pool, for all four functions is a void * pointer that is a piece of data for the memory allocator. typically pool points to a memory pool used by the memory allocator. the freeentry function does not need to free the value of the entry. if flag is ht_free_entry, the function frees the entry. remark the key argument for the allocentry function does not seem to be useful. it is unused in the default allocentry function. ...
PLHashComparator
syntax #include <plhash.h> typedef printn (pr_callback *plhashcomparator)( const void *v1, const void *v2); description plhashcomparator is a function type that compares two values of an unspecified type. it returns a nonzero value if the two values are equal, and 0 if the two values are not equal. plhashcomparator defines the meaning of equality for the unspecified type. for convenience, two comparator functions are provided. pl_comparestrings compare two character strings using strcmp. ...
... description plhashcomparator is a function type that compares two values of an unspecified type. it returns a nonzero value if the two values are equal, and 0 if the two values are not equal. plhashcomparator defines the meaning of equality for the unspecified type. for convenience, two comparator functions are provided. pl_comparestrings compare two character strings using strcmp. pl_comparevalues compares the values of the arguments v1 and v2 numerically. ...
...ecified type. it returns a nonzero value if the two values are equal, and 0 if the two values are not equal. plhashcomparator defines the meaning of equality for the unspecified type. for convenience, two comparator functions are provided. pl_comparestrings compare two character strings using strcmp. pl_comparevalues compares the values of the arguments v1 and v2 numerically. remark the return value of plhashcomparator functions should be of type prbool. ...
...equal. plhashcomparator defines the meaning of equality for the unspecified type. for convenience, two comparator functions are provided. pl_comparestrings compare two character strings using strcmp. ...
PL_NewHashTable
allocops a pointer to a plhashallocops structure that must exist throughout the lifetime of the new hash table. ...
...ash.h> plhashtable *pl_newhashtable( pruint32 numbuckets, plhashfunction keyhash, plhashcomparator keycompare, plhashcomparator valuecompare, const plhashallocops *allocops, void *allocpriv ); parameters the function has the following parameters: numbuckets the number of buckets in the hash table. keyhash hash function. keycompare function used to compare keys of entries. valuecompare function used to compare keys of entries. allocops a pointer to a plhashallocops structure that must exist throughout the lifetime of the new hash table. allocpriv passed as the first argument (pool). returns the new hash table. ...
... function used to compare keys of entries. valuecompare function used to compare keys of entries. allocops a pointer to a plhashallocops structure that must exist throughout the lifetime of the new hash table. allocpriv passed as the first argument (pool). returns the new hash table. description pl_newhashtable creates a new hash table. the table has at least 16 buckets. you can pass a value of 0 as numbuckets to create the default number of buckets in the new table. the arguments keycompare and valuecompare are functions of type plhashcomparator that the hash table library functions use to compare the keys and the values of entries. the argument allocops points to a plhashallocops structure that must exist throughout the lifetime of the new hash table. the hash table library functi...
...se to compare the keys and the values of entries. the argument allocops points to a plhashallocops structure that must exist throughout the lifetime of the new hash table. the hash table library functions do not make a copy of this structure. when the allocation functions in allocops are invoked, the allocation private data allocpriv is passed as the first argument (pool). you can specify a null value for allocops to use the default allocation functions. if allocops is null, allocpriv is ignored. note that the default freeentry function does not free the value of the entry. ...
PR_AtomicAdd
...
... ...
... ...
... ...
PR_InitializeNetAddr
initializes or reinitializes a network address. the storage for the network address structure is allocated by, and remains the responsibility of, the calling client. syntax #include <prnetdb.h> prstatus pr_initializenetaddr( prnetaddrvalue val, pruint16 port, prnetaddr *addr); parameters the function has the following parameters: val the value to be assigned to the ip address portion of the network address. this must be pr_ipaddrnull, pr_ipaddrany, or pr_ipaddrloopback. port the port number to be assigned in the network address structure. the value is specified in host byte order. addr a pointer to the prnetaddr structure to be manipulated. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. this may occur...
... this must be pr_ipaddrnull, pr_ipaddrany, or pr_ipaddrloopback. port the port number to be assigned in the network address structure. the value is specified in host byte order. addr a pointer to the prnetaddr structure to be manipulated. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. this may occur, for example, if the value of val is not within the ranges defined by prnetaddrvalue. you can retrieve the reason for the failure by calling pr_geterror. ...
...cture to be manipulated. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. this may occur, for example, if the value of val is not within the ranges defined by prnetaddrvalue. you can retrieve the reason for the failure by calling pr_geterror. description pr_initializenetaddr allows the assignment of special network address values and the port number, while also setting the state that indicates the version of the address being used. the special network address values are identified by the enum prnetaddrvalue: typedef enum prnetaddrvalue{ pr_ipaddrnull, pr_ipaddrany, pr_ipaddrloopback } prnetaddrvalue; the enum has the following enumerators: pr_ipaddrnull do not overwrite the ip address. this allows the calle...
...num prnetaddrvalue: typedef enum prnetaddrvalue{ pr_ipaddrnull, pr_ipaddrany, pr_ipaddrloopback } prnetaddrvalue; the enum has the following enumerators: pr_ipaddrnull do not overwrite the ip address. this allows the caller to change the network address' port number assignment without affecting the host address. pr_ipaddrany assign logical pr_inaddr_any to ip address. this wildcard value is typically used to establish a socket on which to listen for incoming connection requests. pr_ipaddrloopback assign logical pr_inaddr_loopback. a client can use this value to connect to itself without knowing the host's network address. ...
PR_Open
hree flags may be used. if the flags parameter does not include any of the first three flags (pr_rdonly, pr_wronly, or pr_rdwr), the open file can't be read or written, which is not useful. note: the constants pr_rdwr and friends are not in any interface (bug 433295). thus they cannot be used in javascript, you have to use the octal constants (see file i/o snippets). name value description pr_rdonly 0x01 open for reading only. pr_wronly 0x02 open for writing 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 i...
...st, 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 file is created, these flags define the access permission bits of the newly created file. this feature is currently only applicable on unix platforms. it is ignored by any other platform but it may apply to other platforms in the future. possible values of the mode parameter are listed in the table below. name value description pr_irwxu 0700 read, write, execute/search by owner. pr_irusr 0400 read permission, owner. pr_iwusr 0200 write permission, owner. pr_ixusr 0100 execute/search permission, owner. pr_irwxg 0070 read,...
...the prfiledesc should be freed by calling pr_close. if the file was not opened successfully, a null pointer. description pr_open creates a file descriptor (prfiledesc) for the file with the pathname name and sets the file status flags of the file descriptor according to the valu...
...alues: if the file is successfully opened, a pointer to a dynamically allocated prfiledesc for the newly opened file. the prfiledesc should be freed by calling pr_close. if the file was not opened successfully, a null pointer. description pr_open creates a file descriptor (prfiledesc) for the file with the pathname name and sets the file status flags of the file descriptor according to the value of flags. if a new file is created as a result of the pr_open call, its file mode bits are set according to the mode parameter. ...
PR_SetThreadPrivate
sets per-thread private data. syntax #include <prthread.h> prstatus pr_setthreadprivate(pruintn index, void *priv); parameters pr_setthreadprivate has the following parameters: index an index into the per-thread private data table. priv the per-thread private data, or more likely, a pointer to the data. returns the function returns one of the following values: if successful, pr_success. ...
...the runtime provides no protection for the private data. ...
...the runtime provides no protection for the private data. the destructor is called with the runtime holding no locks. synchronization is the client's responsibility. ...
...the runtime provides no protection for the private data. the destructor is called with the runtime holding no locks. synchronization is the client's responsibility. ...
NSS 3.12.4 release notes
xten the old documentation of the expression matching syntax rules was incorrect, and the new corrected documentation is as follows for public nssutil functions (see portreq.h): port_regexpvalid port_regexpsearch port_regexpcasesearch these functions will match a string with a shell expression. the expressions accepted are based loosely on the expressions accepted by zsh. expected return values: non_sxp if exp is a standard string invalid_sxp if exp is a shell expression, but invalid valid_sxp if exp is a valid shell expression expression matching rules: * matches anything ? matches one character \ will escape a special character $ matches the end of the string bracketed expressions: [abc] matches one occurence of a, b, or c. [^abc] matches any character except a, b, or c. to be ma...
....1 drbg testing bug 486304: cert7.db/cert8.db corruption when importing a large certificate (>64k) bug 486405: allocator mismatches in pk12util.c bug 486537: disable execstack in freebl x86_64 builds on linux bug 486698: facilitate the building of major components independently and in a chain manner by downstream distributions bug 486999: calling ssl_setsockpeerid a second time leaks the previous value bug 487007: make lib/jar conform to nss coding style bug 487162: ckfw/capi build failure on windows bug 487239: nssutil.rc doesn't compile on wince bug 487254: sftkmod.c uses posix file io functions on wince bug 487255: sdb.c uses posix file io functions on wince bug 487487: cert_nametoascii reports !invalid ava! whenever value exceeds 384 bytes bug 487736: libpkix passes wrong argument to der_de...
... shutdown bug 493135: bltest crashes if it can't open the input file bug 493364: can't build with --disable-dbm option when not cross-compiling bug 493693: sse2 instructions for bignum are not implemented on os/2 bug 493912: sqlite3_reset should be invoked in sdb_findobjectsinit when error occurs bug 494073: update rsa/dsa powerupself tests to be compliant for 2011 bug 494087: passing null as the value of cert_pi_trustanchors causes a crash in cert_pkixsetparam bug 494107: during nss_nodb_init(), softoken tries but fails to load libsqlite3.so crash [@ @0x0 ] bug 495097: sdb_mapsqlerror returns signed int bug 495103: nss_initreadwrite(sql:<dbdir>) causes nss to look for sql:<dbdir>/libnssckbi.so bug 495365: add const to the 'nickname' parameter of sec_certnicknameconflict bug 495656: nss_initrea...
...5: add const to the 'nickname' parameter of sec_certnicknameconflict bug 495656: nss_initreadwrite(sql:<configdir>) leaves behind a pkcs11.txu file if libnssckbi.so is in <configdir>. bug 495717: unable to compile nss/cmd/certutil/keystuff.c on wince bug 496961: provide truncated hmac support for testing tool fipstest bug 497002: lab required nspr-free freebl changes. bug 497217: the first random value ever generated by the rng should be discarded bug 498163: assert if profile path contains cyrillic chars. [[@isspace - secmod_argisblank - secmod_arghasblanks - secmod_formatpair - secmod_mknewmodulespec] bug 498509: produce debuggable optimized builds for mozilla on macosx bug 498511: produce debuggable optimized nss builds for mozilla on linux bug 499385: drbg reseed function needs to be tested...
Enc Dec MAC Using Key Wrap CertReq PKCS10 CSR
e header file */ case 'e': /* encrypt with public key from cert in header file */ case 's': /* sign with private key */ case 'd': /* decrypt with the matching private key */ case 'v': /* verify with the matching public key */ cmd = option2command(optstate->option); break; case 'd': dbdir = strdup(optstate->value); break; case 'f': pwdata.source = pw_fromfile; pwdata.data = strdup(optstate->value); break; case 'p': pwdata.source = pw_plaintext; pwdata.data = strdup(optstate->value); break; case 'i': infilename = strdup(optstate->value); break; case 'b': ...
... pwdata.source = pw_fromfile; pwdata.data = strdup(optstate->value); break; case 'p': pwdata.source = pw_plaintext; pwdata.data = strdup(optstate->value); break; case 'i': infilename = strdup(optstate->value); break; case 'b': headerfilename = strdup(optstate->value); break; case 'e': encryptedfilename = strdup(optstate->value); break; case 'o': outfilename = strdup(optstate->value); break; case 'z': noisefilename = strdup(optstate->value); break; case 's': subjectstr = strdup(optstate->value); subject ...
... case 'o': outfilename = strdup(optstate->value); break; case 'z': noisefilename = strdup(optstate->value); break; case 's': subjectstr = strdup(optstate->value); subject = cert_asciitoname(subjectstr); break; case 'r': certreqfilename = strdup(optstate->value); break; case 'c': certfilename = strdup(optstate->value); break; case 'u': issuernamestr = strdup(optstate->value); break; case 'n': nicknamestr = strdup(optstate->value); break; case 'x': selfsign = pr_true; break; case 'm': ...
...c': certfilename = strdup(optstate->value); break; case 'u': issuernamestr = strdup(optstate->value); break; case 'n': nicknamestr = strdup(optstate->value); break; case 'x': selfsign = pr_true; break; case 'm': serialnumberstr = strdup(optstate->value); serialnumber = atoi(serialnumberstr); break; case 't': truststr = strdup(optstate->value); break; case 'v': sigverify = pr_true; break; default: usage(progname); break; } } pl_destroyoptstate(optstate); if (cmd == unknown || !dbdir) ...
nss tech note2
to enable this mode, set: nspr_log_modules=nss_mod_log:4 nspr_log_file=<logfile> the output format is the same as above, but with more information. for example, 1024[805ef10]: c_findobjectsinit 1024[805ef10]: hsession = 0x1000001 1024[805ef10]: pt...
... 1024[805ef10]: pinfo = 0xbffff340 1024[805ef10]: rv = 0x0 1024[805ef10]: c_getslotlist 1024[805ef10]: tokenpresent = 0x0 1024[805ef10]: pslotlist = 0x0 1024[805ef10]: pulcount = 0xbffff33c 1024[805ef10]: *pulcount = 0x2 1024[805ef10]: rv = 0x0 note that when a pkcs #11 function takes a pointer argument for which it will set a value (c_getslotlist above), this mode will display the value upon return. 3. display verbose information, including template values, array values, etc. to enable this mode, set: nspr_log_modules=nss_mod_log:4 nspr_log_file=<logfile> the output format is the same as above, but with more information. for example, 1024[805ef10]: c_findobjectsinit 1024[805ef10]: hsession = 0x1000001 1024[805ef10]: ptemplate = 0xbffff410 1024[805ef10]: ulcount = 3 1024[8...
...jects 1024[805ef10]: hsession = 0x1000001 1024[805ef10]: phobject = 0x806d810 1024[805ef10]: ulmaxobjectcount = 16 1024[805ef10]: pulobjectcount = 0xbffff38c 1024[805ef10]: *pulobjectcount = 0x1 1024[805ef10]: phobject[0] = 0xf6457d04 1024[805ef10]: rv = 0x0 1024[805ef10]: c_findobjectsfinal 1024[805ef10]: hsession = 0x1000001 1024[805ef10]: rv = 0x0 1024[805ef10]: c_getattributevalue 1024[805ef10]: hsession = 0x1000001 1024[805ef10]: hobject = 0xf6457d04 1024[805ef10]: ptemplate = 0xbffff2d0 1024[805ef10]: ulcount = 2 1024[805ef10]: cka_token = 0 [1] 1024[805ef10]: cka_label = 0 [20] 1024[805ef10]: rv = 0x0 1024[805ef10]: c_getattributevalue 1024[805ef10]: hsession = 0x1000001 1024[805ef10]: hobject = 0xf6457d04 1024[805ef10]: ptemplate = 0xbffff2d0 10...
...com [20] 1024[805ef10]: rv = 0x0 4. collect performance data. this mode is most useful in optimized builds. the number of calls to each pkcs #11 function will be counted, and the time spent in each function as well. a summary of performance data is dumped during nss shutdown. no additional environment variables are required for this mode. if the environment variable nss_output_file is set, its value will be used as the path name of the file to which the final output will be written. otherwise, the output will be written to stdout. ...
NSS functions
3.2.1 and later cert_createsubjectcertlist mxr 3.4 and later cert_createvalidity mxr 3.5 and later cert_crlcacherefreshissuer mxr 3.7 and later cert_decodealtnameextension mxr 3.10 and later cert_decodeauthinfoaccessextension mxr 3.10 and later cert_decodeauthkeyid mxr 3.10 and later cert_decodeavavalue mxr 3.4 and later cert_decodebasicconstraintvalue mxr 3.2 and later cert_decodecertfrompackage mxr 3.4 and later cert_decodecertificatepoliciesextension mxr 3.2 and later cert_decodecertpackage mxr 3.2 and later cert_decodecrldistributionpoints mxr 3.10 and later cert_decodedercrl mxr 3.2 and later ...
... mxr 3.5 and later cert_dupcertificate mxr 3.2 and later cert_dupcertlist mxr 3.2 and later cert_enableocspchecking mxr 3.2 and later cert_encodealtnameextension mxr 3.7 and later cert_encodeandaddbitstrextension mxr 3.5 and later cert_encodeauthkeyid mxr 3.5 and later cert_encodebasicconstraintvalue mxr 3.5 and later cert_encodecertpoliciesextension mxr 3.12 and later cert_encodecrldistributionpoints mxr 3.5 and later cert_encodegeneralname mxr 3.4 and later cert_encodeinfoaccessextension mxr 3.12 and later cert_encodeinhibitanyextension mxr 3.12 and later cert_encodenoticereference mxr 3.12 and l...
...xr 3.2 and later pk11_savecontextalloc mxr 3.6 and later pk11_setfortezzahack mxr 3.2 and later pk11_setpasswordfunc mxr 3.2 and later pk11_setprivatekeynickname mxr 3.4 and later pk11_setpublickeynickname mxr 3.4 and later pk11_setslotpwvalues mxr 3.2 and later pk11_setsymkeynickname mxr 3.4 and later pk11_setsymkeyuserdata mxr 3.11 and later pk11_setwrapkey mxr 3.2 and later pk11_sign mxr 3.2 and later pk11_signaturelen mxr 3.2 and later pk11_symkeyfromhandle mxr...
...gneddata_getdigestalgs mxr 3.2 and later nss_cmssigneddata_getsignerinfo mxr 3.2 and later nss_cmssigneddata_hasdigests mxr 3.2 and later nss_cmssigneddata_importcerts mxr 3.2 and later nss_cmssigneddata_setdigests mxr 3.2 and later nss_cmssigneddata_setdigestvalue mxr 3.4 and later nss_cmssigneddata_signerinfocount mxr 3.2 and later nss_cmssigneddata_verifycertsonly mxr 3.2 and later nss_cmssigneddata_verifysignerinfo mxr 3.2 and later nss_cmssignerinfo_addmssmimeenckeyprefs mxr 3.6 and later nss_cmssignerinfo_addsmime...
ssltyp.html
not shared objects. when an application makes a copy of a particular key structure that already exists in memory, ssl makes a deep copy--that is, it makes a whole new copy of that object. when you call seckey_destroyprivatekey, the function both frees the memory and sets all the bits to zero. never alter the contents of a key structure. treat the structure as read only. secstatus the return value for many ssl functions. syntax #include <seccomon.h> typedef enum { secwouldblock = -2, secfailure = -1, secsuccess = 0 } secstatus; enumerators the enum includes the following enumerators: secwouldblock reserved for internal use. secfailure the operation failed. to find out...
...= 0 } secstatus; enumerators the enum includes the following enumerators: secwouldblock reserved for internal use. secfailure the operation failed. to find out why, call pr_geterror. secsuccess the operation succeeded. in this case the value returned by pr_geterror is meaningless. managing secitem memory these functions are available for managing the memory associated with secitem structures and the structures to which they point. secitem_freeitem secitem_zfreeitem secitem_freeitem frees the memory associated with a secitem structure. syntax #include <prtypes.h> secstatus secitem_freeitem ( secitem ...
...parameter this function has the following parameter: item a pointer to a secitem structure. freeitem when pr_false, free only the structure pointed to. otherwise, free both the structure pointed to and the secitem structure itself. returns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. use pr_geterror to retrieve the error code. description this function frees the memory associated with the structure to which the specified item points, when that structure is no longer used. when freeitem is not pr_false, also frees the item structure itself. secitem_zfreeitem zeroes and frees the memory associated with a...
...parameter this function has the following parameter: item a pointer to a secitem structure. freeitem when pr_false, free only the structure pointed to. otherwise, free both the structure pointed to and the secitem structure itself. returns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. use pr_geterror to retrieve the error code. description this function is similar to secitem_freeitem, except that it overwrites the structures to be freed with zeroes before it frees them. zeros and frees the memory associated with the structure to which the specified item points, when that structure is no longer used. when fre...
Scripting Java
and classes every piece of java code is part of a class. every java class is part of a package. in javascript, however, scripts exist outside of any package hierarchy. how then, do we access classes in java packages? rhino defines a top-level variable named packages. the properties of the packages variable are all the top-level java packages, such as java and com. for example, we can access the value of the java package: js> packages.java [javapackage java] as a handy shortcut, rhino defines a top-level variable java that is equivalent to packages.java. so the previous example could be even shorter: js> java [javapackage java] we can access java classes simply by stepping down the package hierarchy: js> java.io.file [javaclass java.io.file] if your scripts access a lot of different ja...
...s. being able to view the parameters and return type of java methods is particularly useful in exploratory programming where we might be investigating a method and are unsure of the parameter or return types. another useful feature for exploratory programming is the ability to see all the methods and fields defined for an object. using the javascript for..in construct, we can print out all these values: js> for (i in f) { print(i) } exists parentfile mkdir tostring wait [44 others] note that not only the methods of the file class are listed, but also the methods inherited from the base class java.lang.object (like wait). this makes it easier to work with objects in deeply nested inheritance hierarchies since you can see all the methods that are available for that object. rhino provides ano...
...eed, rhino provides the ability to create new java objects that implement interfaces. first we must define a javascript object with function properties whose names match the methods required by the java interface. to implement a runnable, we need only define a single method run with no parameters. if you remember from chapter 3, it is possible to define a javascript object with the {propertyname: value} notation. we can use that syntax here in combination with a function expression to define a javascript object with a run method: js> obj = { run: function () { print("\nrunning"); } } [object object] js> obj.run() running now we can create an object implementing the runnable interface by constructing a runnable: js> r = new java.lang.runnable(obj); [object javaobject] in java it is not po...
...ray.newinstance(java.lang.string, 5); [ljava.lang.string;@7ffe01 to create an array of primitive types, we must use the special type field defined in the associated object class in the java.lang package. for example, to create an array of bytes, we must use the special field java.lang.byte.type: js> a = java.lang.reflect.array.newinstance(java.lang.character.type, 2); [c@7a84e4 the resulting value can then be used anywhere a java array of that type is allowed. js> a[0] = 104 104 js> a[1] = 105 105 js> new java.lang.string(a) hi java strings and javascript strings it's important to keep in mind that java strings and javascript strings are not the same. java strings are instances of the type java.lang.string and have all the methods defined by that class. javascript strings have methods ...
DOUBLE_TO_JSVAL
obsolete since jsapi 42this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. casts a pointer to a gc-allocated jsdouble to type jsval. please use js::doublevalue instead in spidermonkey 45 or later. syntax jsval double_to_jsval(double d); name type description d double c double to convert to a jsval. ...
.... try to avoid using it. casts a pointer to a gc-allocated jsdouble to type jsval. please use js::doublevalue instead in spidermonkey 45 or later. syntax jsval double_to_jsval(double d); name type description d double c double to convert to a jsval. description double_to_jsval is the inverse of js::tonumber. to convert a c float, double to type js::value, use js_numbervalue instead. ...
...blevalue instead in spidermonkey 45 or later. syntax jsval double_to_jsval(double d); name type description d double c double to convert to a jsval. description double_to_jsval is the inverse of js::tonumber. to convert a c float, double to type js::value, use js_numbervalue instead. ...
...in spidermonkey 45 or later. syntax jsval double_to_jsval(double d); name type description d double c double to convert to a jsval. ...
JSNewEnumerateOp
numerate. this callback overrides a portion of spidermonkey's default [[enumerate]] internal method. syntax typedef bool (* jsnewenumerateop)(jscontext *cx, js::handleobject obj, js::autoidvector &properties); // added in spidermonkeysidebar 38 typedef bool (* jsnewenumerateop)(jscontext *cx, js::handleobject obj, jsiterateop enum_op, js::mutablehandlevalue statep, js::mutablehandleid idp); // obsolete since jsapi 37 name type description cx jscontext * the context in which the enumeration is taking place. obj js::handleobject the object to be enumerated. properties js::autoidvector &amp; out parameter. id array to populate with all property keys. enum_op jsiterateop obsole...
...from spidermonkey 38, jsnewenumerateop is the type of objectops::enumerate. this callback overrides a portion of spidermonkey's default [[enumerate]] internal method. when an ordinary object is enumerated, that object and each object on its prototype chain is tested for an enumerate op, and those ops are called in order. the properties each op adds to the properties vector are added to the set of values the for-in loop will iterate over. all of this is nonstandard. an object is "enumerated" when it's the target of a for-in loop or js_enumerate. all other property inspection, including object.keys(obj), goes through [[ownkeys]]. the callback's job is to populate properties with all property keys that the for-in loop should visit. before jsapi 37, jsnewenumerateop was the type of jsclass.enum...
...rateop was the type of jsclass.enumerate. to use a jsnewenumerateop in a jsclass, set the jsclass_new_enumerate bit in the jsclass.flags field and set the jsclass.enumerate field to your jsnewenumerateop, casting it to jsenumerateop. (spidermonkey, noting the jsclass_new_enumerate flag, will cast that function pointer back to type jsnewenumerateop before calling it.) the behavior depends on the value of enum_op: jsenumerate_init a new, opaque iterator state should be allocated and stored in *statep. (you can use private_to_jsval to tag the pointer to be stored). the number of properties that will be enumerated should be returned as an integer jsval in *idp, if idp is non-null, and provided the number of enumerable properties is known. if idp is non-null and the number of enumerable pr...
...ed in via statep. return the next jsid in the iteration using *idp. the opaque iterator state pointed at by statep is destroyed and *statep is set to jsval_null if there are no properties left to enumerate. jsenumerate_destroy destroy the opaque iterator state previously allocated in *statep by a call to this function when enum_op was jsenumerate_init or jsenumerate_init_all. the return value is used to indicate success, with a value of false indicating failure. see also mxr id search for jsnewenumerateop jsenumerateop bug 1097267 ...
JS_CompareStrings
js_comparestrings(jscontext *cx, jsstring *str1, jsstring *str2, int32_t *result); name type description 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. thi...
...s 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 (<, <=, >, >=), as described in ecma 262-3 § 11.8.5. as the standard says: the comparison of strings uses a simple lexicographic ordering on sequences of code point value values. there is no attempt to use the more complex, semantically oriented definitions of character or string equality and collating order defined in the unicode specification. therefore strings that are canonically equal according to the unicode standard could test as unequal. ...
...a simple lexicographic ordering on sequences of code point value values. there is no attempt to use the more complex, semantically oriented definitions of character or string equality and collating order defined in the unicode specification. therefore strings that are canonically equal according to the unicode standard could test as unequal. ...
...f code point value values. there is no attempt to use the more complex, semantically oriented definitions of character or string equality and collating order defined in the unicode specification. therefore strings that are canonically equal according to the unicode standard could test as unequal. ...
JS_DefineConstDoubles
create multiple constant double or integer valued properties on an object. syntax bool js_defineconstdoubles(jscontext *cx, js::handleobject obj, const jsconstdoublespec *cds); bool js_defineconstintegers(jscontext *cx, js::handleobject obj, const jsconstintegerspec *cis); // added in spidermonkey 38 name type description cx jscontext * the context in which to define the new properties. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object for which to create new properties. cds jsconstdoublespec * pointer to an array of jsconstdoublespec records containing property names and values to create. the last array elemen...
... the context in which to define the new properties. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object for which to create new properties. cds jsconstdoublespec * pointer to an array of jsconstdoublespec records containing property names and values to create. the last array element must contain zero-valued members. cis jsconstintegerspec * pointer to an array of jsconstintegerspec records containing property names and values to create. the last array element must contain zero-valued members. description js_defineconstdoubles creates one or more properties for a specified object, obj, where each property consists of a double value. js_defineconstintegers creates one or more pro...
...the attributes for each property is set to jsprop_readonly | jsprop_permanent. obsolete from jsapi 35 each property is automatically assigned attributes as specified in the flags field of the jsconstdoublespec/jsconstintegerspec structure pointed to by cds/cis. ...
...s as specified in the flags field of the jsconstdoublespec/jsconstintegerspec structure pointed to by cds/cis. if flags is set to 0, the attributes for the property are automatically set to jsprop_permanent | jsprop_readonly. cds and cis are pointers to the first element of an array of jsconstdoublespec/jsconstintegerspec structures. each array element defines a single property name and property value to create. the name field of the last element of the array must contain 0. js_defineconstdoubles/js_defineconstintegers create one property for each element in the array what contains a non-zero name field. on success, js_defineconstdoubles/js_defineconstintegers returns true, indicating it has created all properties listed in the array. otherwise it returns false. see also mxr id search for js...
JS_DefinePropertyWithTinyId
obsolete since jsapi 30this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. create a new object property with a tiny id. syntax jsbool js_definepropertywithtinyid( jscontext *cx, jsobject *obj, const char *name, int8 tinyid, jsval value, jspropertyop getter, jspropertyop setter, unsigned int attrs); jsbool js_defineucpropertywithtinyid( jscontext *cx, jsobject *obj, const jschar *name, size_t namelen, int8 tinyid, jsval value, jspropertyop getter, jspropertyop setter, unsigned int attrs); name type description cx jscontext * the context in which to define the property. requires request. in a js_threadsafe build, the caller must b...
... 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 method for specifying a new property value. attrs unsigned int property attributes. description js_definepropertywithtinyid defines an object property with a tiny id. js_defineu...
...unsigned int property attributes. description js_definepropertywithtinyid defines an object property with a tiny id. js_defineucpropertywithtinyid is the unicode version of the function. except for the tinyid parameter, these functions behave exactly as js_defineproperty and js_defineucproperty. see those functions for more details. tinyid is a signed 8-bit integer that affects the id value passed to certain callbacks. any time the javascript engine would pass the name of the property as a string to the id parameter of a tiny-id-aware callback, it passes int_to_jsval(tinyid) instead. the tiny-id-aware callbacks are: property getters and setters; and jsclass.addproperty, .delproperty, .getproperty, and .setproperty. tiny ids only affect the ids passed to these hooks; the javascript e...
...perty getters and setters; and jsclass.addproperty, .delproperty, .getproperty, and .setproperty. tiny ids only affect the ids passed to these hooks; the javascript engine does not use them as property names internally. tiny ids are helpful for getters and setters that are shared by several different properties. those getters and setters can use switch (jsval_to_int(id)), instead of checking the value of id as a string, to determine which property is being accessed. however, tiny ids can cause confusion when used with jsclass callbacks. for example, if a property named "color" is defined with tiny id 10, then the javascript expressions obj[10] and obj.color will both result in int_to_jsval(10) being passed to jsclass.getproperty as the id parameter. per-property getters and setters do not suf...
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 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 boolean value. description js_executeregexp and js_newregexpobjectnostatics execute the regexp object, reobj, to the specified input string, chars, from *indexp index. if test is false, js_executeregexp and js_newregexpobjectnostatics store the match result array to *rval if matches...
...value. description js_executeregexp and js_newregexpobjectnostatics execute the regexp object, reobj, to the specified input string, chars, from *indexp index. if test is false, js_executeregexp and js_newregexpobjectnostatics store the match result array to *rval if matches, otherwise stores null to *rval. if test is true, js_executeregexp and js_newregexpobjectnostatics store the boolean value true to *rval if matches, otherwise stores null to *rval. js_executeregexp updates the built-in regexp object's properties. ...
...f matches, otherwise stores null to *rval. if test is true, js_executeregexp and js_newregexpobjectnostatics store the boolean value true to *rval if matches, otherwise stores null to *rval. js_executeregexp updates the built-in regexp object's properties. ...
JS_GetGCParameter
adjust performance parameters related to garbage collection. syntax uint32_t js_getgcparameter(jsruntime *rt, jsgcparamkey key); void js_setgcparameter(jsruntime *rt, jsgcparamkey key, uint32_t value); uint32_t js_getgcparameterforthread(jscontext *cx, jsgcparamkey key); // added in spidermonkeysidebar 17 void js_setgcparameterforthread(jscontext *cx, jsgcparamkey key, uint32_t value); // added in spidermonkeysidebar 17 name type description rt jsruntime * the runtime to configure. cx jscontext * the context to configure. requires request. ...
... uint32_t value); // added in spidermonkeysidebar 17 name type description rt jsruntime * the runtime to configure. cx jscontext * the context to configure. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. key jsgcparamkey specifies which garbage collection parameter to get or set. value uint32_t (js_setgcparameter only) the value to assign to the parameter. typedef enum jsgcparamkey { jsgc_max_bytes, jsgc_max_malloc_bytes, jsgc_max_nursery_bytes, jsgc_bytes, jsgc_number, jsgc_mode, jsgc_unused_chunks, jsgc_total_chunks, jsgc_slice_time_budget, jsgc_mark_stack_limit, jsgc_high_frequency_time_limit, jsgc_high_frequency_l...
... jsgc_max_malloc_bytes / "maxmallocbytes" number of js_malloc bytes before last ditch gc. jsgc_max_nursery_bytes / "maxnurserybytes" maximum size the nursery may grow to, or 0 to disable generational gc. jsgc_min_nursery_bytes / "minnurserybytes" mini...
... disable. jsgc_nursery_free_threshold_for_idle_collection / "nurseryfreethresholdforidlecollection" collect the nursery in idle time if it has less than this many bytes of free space. jsgc_nursery_free_threshold_for_idle_collection_percent / "nurseryfreethresholdforidlecollectionpercent" collect the nursery in idle time if it has less than this percentage of capacity free (value from 0 - 99). jsgc_pretenure_threshold / "pretenurethreshold" if this percentage of the nursery is tenured and the nursery is at least 4mb, then process object groups to look for pretenuring candidates. jsgc_pretenure_group_threshold / "pretenuregroupthreshold" if more than this number of objects in a given object group are tenured, then pretenruing will be enabled for new...
JS_GetPropertyDefault
obsolete since jsapi 26this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this article covers features introduced in spidermonkey 1.8.5 finds a specified property and retrieves its value or provided default value. syntax bool js_getpropertydefault(jscontext *cx, jsobject *obj, const char *name, jsval def, js::mutablehandle<js::value> vp); bool js_getpropertybyiddefault(jscontext *cx, jsobject *obj, jsid id, jsval def, js::mutablehandle<js::value> vp); name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext.
... description js_getpropertydefault examines a specified js object obj and its prototype chain for a property with the specified name. ...
...ndle<js::value> vp); name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object to search on for the property. name or id const char * or js::handleid name of the property to look up. def js::handlevalue default value if the property is not found. vp js::mutablehandlevalue out parameter. on success, *vp receives the current value of the property, or undefined if no such property is found. description js_getpropertydefault examines a specified js object obj and its prototype chain for a property with the specified name. ...
...lue default value if the property is not found. vp js::mutablehandlevalue out parameter. on success, *vp receives the current value of the property, or undefined if no such property is found. description js_getpropertydefault examines a specified js object obj and its prototype chain for a property with the specified name. on success, these functions set *vp to the current value of the property, or def if obj has no such property, and return true. on an error or exception, these functions return false, and the value left in *vp is undefined. see also bug 905774 ...
JS_GetReservedSlot
access an object's reserved slots. syntax // added in spidermonkey 42 js::value js_getreservedslot(jsobject *obj, uint32_t index); void js_setreservedslot(jsobject *obj, uint32_t index, js::value v); // obsolete since spidermonkey 42 jsval js_getreservedslot(jsobject *obj, uint32_t index); void js_setreservedslot(jsobject *obj, uint32_t index, jsval v); name type description obj jsobject * an object that has reserved slots. index uint32_t index of the reserved slot to access. v js::value (in js_setreservedslot) the value to store. description if a jsclass has jsclass_has_reserved_slots(n) in its flags, with n > 0, or has a non-null jsclass.reserveslots callback, then objects of that class have n reserved slots in whic...
...to access. v js::value (in js_setreservedslot) the value to store. description if a jsclass has jsclass_has_reserved_slots(n) in its flags, with n > 0, or has a non-null jsclass.reserveslots callback, then objects of that class have n reserved slots in which the application may store data. these fields are not directly exposed to scripts. reserved slots may contain any js::value, and the garbage collector will hold the value alive as long as the object itself is alive. reserved slots may also contain private values to store pointer values (whose lowest bit is 0) or uint32_t, when non-javascript values must be stored; the garbage collector ignores such values when it sees them. (note that private values must not be exposed directly to javascript. it's only legal to store...
... hold the value alive as long as the object itself is alive. reserved slots may also contain private values to store pointer values (whose lowest bit is 0) or uint32_t, when non-javascript values must be stored; the garbage collector ignores such values when it sees them. (note that private values must not be exposed directly to javascript. it's only legal to store and retrieve data from private values. they cannot be returned from functions, set as properties on objects, embedded in javascript arrays, and so on.) new objects' reserved slots are initialized to undefined. ...
...not be exposed directly to javascript. it's only legal to store and retrieve data from private values. they cannot be returned from functions, set as properties on objects, embedded in javascript arrays, and so on.) new objects' reserved slots are initialized to undefined. ...
JS_InternString
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. ...
... 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 a new string is created and added to the table. strings created with these functions are protected from garbage collection for the lif...
...e. strings created with these functions are protected from garbage collection for the lifetime of the jsruntime. ...
...e jsruntime. on success, these functions return a pointer to the interned string. otherwise they report an error and return null. ...
JS_LookupElement
obsolete since jsapi 37this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. determine if a specified numeric property exists. ...
... description js_lookupelement examines a specified javascript object, obj, for a numeric property numbered index. note: in the javascript language, numeric properties (also called "elements") are just ordinary properties whose names are numeric strings. ...
...ption cx jscontext * the context in which to look up the property. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to search. index uint32_t the numeric id of the property to look up. vp js::mutablehandlevalue out parameter. on success, *vp receives the stored value of obj[index], or undefined if the element does not exist. description js_lookupelement examines a specified javascript object, obj, for a numeric property numbered index. note: in the javascript language, numeric properties (also called "elements") are just ordinary properties whose names are numeric strings. for example, obj[6] is always exactly the same as obj["6"]. the ecmascript sta...
...inary properties whose names are numeric strings. for example, obj[6] is always exactly the same as obj["6"]. the ecmascript standard also specifies this behavior: see ecma 262-3 §11.2.1, step 6. so any call to js_lookupelement is equivalent to a call to js_lookupproperty passing a numeric string for the name. if the property obj[index] exists, js_lookupelement sets *vp to the property's stored value and returns true. if no such property exists, js_lookupelement sets *vp to undefined and returns true (to indicate that no error occurred). on error or exception, js_lookupelement returns false, and the value left in *vp is undefined. js_lookupelement does not distinguish between a property with a value of undefined and a property that does not exist. see also js_defineelement js_deleteelem...
OBJECT_TO_JSVAL
obsolete since jsapi 42this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. casts a specified js object to a js value. please use js::objectvalue/js::objectornullvalue instead in spidermonkey 45 or later. syntax jsval object_to_jsval(jsobject *obj); name type description obj jsobject * a pointer to a javascript object to convert to a jsval. ...
...::objectornullvalue instead in spidermonkey 45 or later. syntax jsval object_to_jsval(jsobject *obj); name type description obj jsobject * a pointer to a javascript object to convert to a jsval. description object_to_jsval casts obj from type jsobject * to jsval. if obj is null, the result is jsval_null. ...
...ad in spidermonkey 45 or later. ...
...r later. ...
TPS Formdata Lists
a formdata asset list is an array of objects, each with the following properties: fieldname: required. value: required. date: the date the form data was used, expressed in hours from the present, so 0 means now, and -24 means 24 hours ago. optional, defaults to 0. ...
... a formdata asset list is an array of objects, each with the following properties: fieldname: required. value: required. date: the date the form data was used, expressed in hours from the present, so 0 means now, and -24 means 24 hours ago. optional, defaults to 0. ...
...a formdata asset list is an array of objects, each with the following properties: fieldname: required. value: required. date: the date the form data was used, expressed in hours from the present, so 0 means now, and -24 means 24 hours ago. optional, defaults to 0. ...
...ng properties: fieldname: required. value: required. date: the date the form data was used, expressed in hours from the present, so 0 means now, and -24 means 24 hours ago. optional, defaults to 0. ...
TPS Pref Lists
to find the list of valid preferences, go to about:config on a browser that has weave installed, and search for services.sync.prefs.sync. ...
...to find the list of valid preferences, go to about:config on a browser that has weave installed, and search for services.sync.prefs.sync. ...
...to find the list of valid preferences, go to about:config on a browser that has weave installed, and search for services.sync.prefs.sync. ...
...to find the list of valid preferences, go to about:config on a browser that has weave installed, and search for services.sync.prefs.sync. ...
A Web PKI x509 certificate primer
for businesses to have to help limit risk imposed by losing the private key of the ca. authority information access this extension is primarily used to to describe the ocsp location for revocation checking. it is mandatory for certificates that chain up to a root in the mozilla ca program. self-signed certificates these are the steps to generate a certificate for www.example.com. replace this value with the actual server name in the steps below. 1. generate the key using the following command: openssl genpkey -algorithm rsa -out key.pem -pkeyopt rsa_keygen_bits:2048 2048 is considered secure for the next 4 years. 2. generate csr using this command: openssl req -new -key key.pem -days 1096 -extensions v3_ca -batch -out example.csr -utf8 -subj '/cn=www.example.com' this creates ...
...-issue the certificate with names that are within the namespace of all certificates in the chain sec_error_cert_signature_algorithm_disabled a certificate has been signed with an obsolete algorithm re-sign the certificate using a modern algorithm sec_error_expired_certificate a certificate is too old to be used re-generate the certificate sec_error_extension_value_invalid a certificate has an extension with an empty value re-generate the certificate without the extension, or re-generate it with a non-empty value sec_error_inadequate_cert_type a certificate has an extended key usage extension that does not assert a required usage, or an end-entity certificate asserts the id-kp-ocspsigning usage when it shouldn't re-generate the certific...
...ith an empty value re-generate the certificate without the extension, or re-generate it with a non-empty value sec_error_inadequate_cert_type a certificate has an extended key usage extension that does not assert a required usage, or an end-entity certificate asserts the id-kp-ocspsigning usage when it shouldn't re-generate the certificate with the appropriate extended key usage values sec_error_inadequate_key_usage a certificate has a key usage extension that does not assert a required usage re-generate the certificate with the appropriate key usage values sec_error_invalid_algorithm a certificate has been signed with an unknown algorithm re-sign the certificate with a standardized certificate signing algorithm sec_error_invalid_time ...
...a certificate has a key usage extension that does not assert a required usage re-generate the certificate with the appropriate key usage values sec_error_invalid_algorithm a certificate has been signed with an unknown algorithm re-sign the certificate with a standardized certificate signing algorithm sec_error_invalid_time a time field in a certificate has an invalid value re-generate the certificate with valid encodings for time fields mozilla_pkix_error_key_pinning_failure sec_error_path_len_constraint_invalid sec_error_unknown_critical_extension a certificate contains an extension marked as critical that is not handled by mozilla::pkix re-generate the certificate without the extension or with it not marked as c...
Querying Places
= placesutils.history.getnewqueryoptions(); // no query parameters will return everything let query = placesutils.history.getnewquery(); // execute the query let result = placesutils.history.executequery(query, options); result types nsinavhistoryqueryoptions has a resulttype property that allows configuration of the grouping and level of detail to be returned in the results. the different values for this property are listed below. these values are also properties of nsinavhistoryqueryoptions, and are accessed like this: components.interfaces.nsinavhistoryqueryoptions.results_as_visit. results_as_uri: this is the default, and returns one result node of type result_type_uri for each uri that matches the query. the visit date for each node will be the last visit date for that url. resu...
...arked, it will expand to the results of the query when it is opened by the user. the original objects can be deserialized from the string using querystringtoqueries. be careful, querystringtoqueries may not return any query objects if the string was empty. your code should handle this case. there will always be an options structure returned. if no options were specified, it will have the default values. if there were no query parameters specified but the input string was not empty (there were options) you may get one query object returned, containing the default query values. example of serializing and deserializing two queries and an options object: let querystring = placesutils.history.queriestoquerystring([query1, query2], 2, options); let queriesref = { }; let querycountref = { }; let o...
... using the results the most common way to use results is to implement a view. there is a built-in view that will put results in tree controls, and you can also implement your own. see displaying places information using views for more on this. ...
... using the results the most common way to use results is to implement a view. there is a built-in view that will put results in tree controls, and you can also implement your own. see displaying places information using views for more on this. ...
Fun With XBL and XPConnect
ss="addressingwidget"/> <xul:menupopup/> </content> <implementation> <property name="autocompletesession"> <![cdata[ components.classes['component://netscape/messenger/autocomplete&type=addrbook']. getservice(components.interfaces.nsiautocompletesession); ]]> </property> so we've defined a property on the widget called autocompletesession. the initial value of this property evaluates to an xp-connect object. now accesses to autocompletesession will return the xp-connect object. exposing the xpcom interfaces one somewhat nasty trick you need to do is to manually expose the interfaces of the xpcom object that you want your widget to support. all you have to do is specifically defining a method on the xbl widget which forwards the method call to the ...
...o complete session. i wanted the auto complete session to call back into the widget with search results. i could apply a trick similar to what i did for the xpcom object: <property name="autocompletelistener"> <![cdata[ ({ onautocompleteresult: function(aitem, aoriginalstring, amatch) { if ( aitem ) { anonymouscontent[0].value = amatch; } } }) ]]> </property> as long as the js for the value of autocompletelistener evaluates to an object (and wrapping the expression with a set of parens like i did, does this), then the value of autocompletelistener is an object that implements my interface. now i can pass the result of autocompletelistener into methods that require an auto comp...
...session object). creating the event handler the last part is the easy part. i wanted a handler that would kick off the auto complete search. ...
...dler the last part is the easy part. i wanted a handler that would kick off the auto complete search. the handler calls the auto complete method we've exposed on the widget which in turn forwards the call to the xpcom object, passing in our implementation of nsiautocompletelistener. ...
An Overview of XPCOM
but enabling exceptions and rtti may not be an option because of performance overhead and compatibility on many platforms, so xpcom does things differently. exceptions in xpcom c++ exceptions are not supported directly by xpcom. instead all exceptions must be handled within a given component, before crossing interface boundaries. in xpcom, all interface methods should return an nsresult error value (see the xpcom api reference for a listing of these error codes). these error code results become the "exceptions" that xpcom handles. instead of leveraging c++ rtti, xpcom uses the special queryinterface method that casts the object to the right interface if that interface is supported. every interface is assigned an identifier that gets generated from a tool commonly named "uuidgen". this un...
...th the nsisupports iid. queryinterface should support all interfaces that the component supports. in implementations of queryinterface, the iid argument is checked against the nsiid class. if there is a match, the object's this pointer is cast to void, the reference count is incremented, and the interface returned to the caller. if there isn't a match, the class returns an error and sets the out value to null. in the example above, it's easy enough to use a c-style cast. but casting can become more involved where you must first cast void then to the requested type, because you must return the interface pointer in the vtable corresponding to the requested interface. casting can become a problem when there is an ambiguous inheritance hierarchy. xpcom identifiers in addition to the iid interfa...
...his: 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, ns_web_shell_cid); a cid is sometimes also referred to as a class identifier. if the class to which a cid refers implements more than one interface, that cid guarantees that the class implements that whole set of interfaces when it's published or frozen. contract id a contract id is a human readable string used to access a component. a cid or a ...
...tus codes these macros test status codes. ns_failed return true if the passed status code was a failure. ns_succeeded returns true is the passed status code was a success. variable mappings nsrefcnt default reference count type. maps to a 32-bit integer. nsresult default error type. maps to a 32-bit integer. nsnull default null value. common xpcom error codes ns_error_not_initialized returned when an instance is not initialized. ns_error_already_initialized returned when an instance is already initialized. ns_error_not_implemented returned by an unimplemented method. ns_error_no_interface returned when a given interface is not supported. ns_error_null_pointer ...
Components.results
elements in this array can be used to test against unknown nsresult variables or they can be 'thrown' to indicate failure... ...
...elements in this array can be used to test against unknown nsresult variables or they can be 'thrown' to indicate failure... ...
...elements in this array can be used to test against unknown nsresult variables or they can be 'thrown' to indicate failure... ...
...st unknown nsresult variables or they can be 'thrown' to indicate failure... if(something_unexpected_happened) throw components.results.ns_error_unexpected; the elements of the components.results object can be enumerated using a for-in loop. usage implementing nsisupports the standard nsisupports is usually implemented in javascript by using components.results to get a failure return value if does not implement the given interface. note the common use of an abbreviation for components.results, cr: const ci = components.interfaces, cr = components.results; function class() { /* ... */ } class.prototype = { /* ... */ queryinterface: function(id) { if (id.equals(ci.imyinterface)) return this; throw cr.ns_error_no_interface; } }; ...
Components.utils.createObjectIn
r-the-add-on-sdk/. syntax var newobject = components.utils.createobjectin(obj, options); parameters obj an object indicating the compartment in which the new object should be created; the new object will be created in the scope of this object's compartment. options an object containing a single option defineas, which determines the name of the object in the target compartment. ...
... the new object should be created; the new object will be created in the scope of this object's compartment. options an object containing a single option defineas, which determines the name of the object in the target compartment. return value a new object in the specified scope. ...
... of this object's compartment. options an object containing a single option defineas, which determines the name of the object in the target compartment. return value a new object in the specified scope. ...
...s object's compartment. options an object containing a single option defineas, which determines the name of the object in the target compartment. return value a new object in the specified scope. ...
nsAdoptingCString
note that this class violates constness in a few places. ...
...note that this class violates constness in a few places. ...
...en string and this string. @param astring is the string to check @param aignorecase tells us how to treat case @param acount tells us how many chars to compare @return boolean parameters char* astring print32 acount tofloat float tofloat(print32*) const - source perform string to float conversion. ...
...s whitespace throughout the string. replacechar void replacechar(char, char) - source swaps occurence of 1 string for another parameters char aoldchar char anewchar void replacechar(const char*, char) - source parameters char* aset char anewchar replacesubstring void replacesubstring(const nscstring&, const nscstring&) - source parameters nscstring& atarget nscstring& anewvalue void replacesubstring(const char*, const char*) - source parameters char* atarget char* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequo...
nsAdoptingString
note that this class violates constness in a few places. ...
...note that this class violates constness in a few places. ...
...arinset(const nsstring&, print32) const - source parameters nsstring& astring print32 aoffset equalsignorecase prbool equalsignorecase(const char*, print32) const - source parameters char* astring print32 acount tofloat float tofloat(print32*) const - source perform string to float conversion. ...
...e string. replacechar void replacechar(prunichar, prunichar) - source swaps occurence of 1 string for another parameters prunichar aoldchar prunichar anewchar void replacechar(const char*, prunichar) - source parameters char* aset prunichar anewchar replacesubstring void replacesubstring(const nsstring&, const nsstring&) - source parameters nsstring& atarget nsstring& anewvalue void replacesubstring(const prunichar*, const prunichar*) - source parameters prunichar* atarget prunichar* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing...
amIInstallTrigger
] in amiinstallcallback acallback); boolean installchrome(in pruint32 atype, in astring aurl, in astring askin); deprecated since gecko 2.0 boolean startsoftwareupdate(in astring aurl, [optional] in print32 aflags); deprecated since gecko 2.0 boolean updateenabled(); deprecated since gecko 2.0 constants retained for backwards compatibility. constant value description skin 1 locale 2 content 4 package 7 methods enabled() tests if installation is enabled. boolean enabled(); parameters none. return value install() starts a new installation of a set of add-ons. boolean install( in nsivariant aargs, in amiinstallcallback acallback optional ); parameters a...
... methods enabled() tests if installation is enabled. boolean enabled(); parameters none. return value install() starts a new installation of a set of add-ons. boolean install( in nsivariant aargs, in amiinstallcallback acallback optional ); parameters aargs the add-ons to install. this should be a js object, each property is the name of an add-on to be installed. the value of the property should either be a string url, or an object with the following properties: url for the add-on's url iconurl for an icon for the add-on hash for a hash of the add-on. acallback optional a callback to call as each installation succeeds or fails. return value true if the installations were successfully started. installchrome starts installing a new add-on. this met...
...installations were successfully started. installchrome starts installing a new add-on. this method is deprecated, please use install() in the future. boolean installchrome( in pruint32 atype, in astring aurl, in astring askin ); parameters atype unused, retained for backwards compatibility. aurl the url of the add-on. askin unused, retained for backwards compatibility. return value true if the installation was successfully started. startsoftwareupdate starts installing a new add-on. boolean startsoftwareupdate( in astring aurl, in print32 aflags optional ); parameters aurl the url of the add-on. aflags optional unused, retained for backwards compatibility. return value true if the installation was successfully started. updateenabled tests if installatio...
...pdate starts installing a new add-on. boolean startsoftwareupdate( in astring aurl, in print32 aflags optional ); parameters aurl the url of the add-on. ...
mozIStorageRow
the mozistoragerow interface represents a row in the result set from a storage database query. storage/public/mozistoragerow.idlscriptable please add a summary to this article. ...
...e/public/mozistoragerow.idlscriptable 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: mozistoragevaluearray method overview nsivariant getresultbyindex(in unsigned long aindex); nsivariant getresultbyname(in autf8string aname); methods getresultbyindex() returns the value from a specific column in the row, using a zero-based index to identify the column. ...
... nsivariant getresultbyindex(in unsigned long aindex); nsivariant getresultbyname(in autf8string aname); methods getresultbyindex() returns the value from a specific column in the row, using a zero-based index to identify the column. nsivariant getresultbyindex( in unsigned long aindex ); parameters aindex the zero-based index of the column number whose value is to be returned. return value an nsivariant object containing the value of the specified column. getresultbyname() returns the value from a specific column in the row, identifying the column by name. ...
...g aindex ); parameters aindex the zero-based index of the column number whose value is to be returned. return value an nsivariant object containing the value of the specified column. getresultbyname() returns the value from a specific column in the row, identifying the column by name. nsivariant getresultbyname( in autf8string aname ); parameters aname the name of the column whose value is to be returned. return value an nsivariant object containing the value of the specified column. see also storage mozistorageresultset mozistorageconnection mozistoragestatement ...
mozITXTToHTMLConv
rlinks for urls in the text. methods scantxt() scans the specified text, applying the requested conversions and outputting html. wstring scantxt( in wstring text, in unsigned long whattodo ); parameters text the original, plain text to scan and convert into html. whattodo a bit field composed of the conversion control attributes indicating what conversions to apply. return value the html version of the specified string. scanhtml() scans the specified user-edited html, adding additional formatting that the user may not have known to do. this should correct html that isn't entirely standards-compliant. warning: don't use the kglyphsubstitution conversion type with this method, as doing so generates html that is non-standard. wstring scanhtml( in wstring text, in u...
...sn't entirely standards-compliant. warning: don't use the kglyphsubstitution conversion type with this method, as doing so generates html that is non-standard. wstring scanhtml( in wstring text, in unsigned long whattodo ); parameters text the original, user-edited html. whattodo a bit field composed of the conversion control attributes indicating what conversions to apply. return value a normalized version of the original html string. citeleveltxt() returns the "cite level" of the specified text; that is, it indicates how many levels of email reply quotes are used, when the text uses "quote" characters (such as ">") at the beginning of the line to indicate cite levels. unsigned long citeleveltxt( in wstring line, out unsigned long loglinestart ); parameters line t...
...such as ">") at the beginning of the line to indicate cite levels. unsigned long citeleveltxt( in wstring line, out unsigned long loglinestart ); parameters line the original line of text, which may begin with one or more cite characters such as ">". loglinestart on output, this parameter is set to indicate the offset into the string of the first non-cite character. you must 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 alength, in long apos, out long astartpos, out long aendpos ); parameters ...
...ngth of the buffer to scan. apos the character offset into the string at which to begin the scan. astartpos on return, indicates the offset to the first character of the first found url, or -1 if no url was found. aendpos on return, indicates the offset to the last character of the first found url, or -1 if no url was found. remarks you can call this method repeatedly, passing in updated values for apos, to locate all the urls in a string. ...
nsIAccessibleSelectable
(in long index); void clearselection(); nsiarray getselectedchildren(); boolean ischildselected(in long index); nsiaccessible refselection(in long index); void removechildfromselection(in long index); boolean selectallselection(); attributes attribute type description selectioncount long the number of accessible children currently selected. read only. constants constant value description eselection_add 0 eselection_remove 1 eselection_getstate 2 methods addchildtoselection() adds the specified accessible child of the object to the object's selection. if the specified object is already selected, then it does nothing. void addchildtoselection( in long index ); parameters index the zero-based accessible child index. exceptions thrown ns_error_failure...
...the zero-based accessible child index. exceptions thrown ns_error_failure if the specified object is not selectable. clearselection() clears the selection in the object so that no children in the object are selected. void clearselection(); parameters none. getselectedchildren() returns an nsiarray of the selected nsiaccessible children. nsiarray getselectedchildren(); parameters none. return value an nsiarray. ischildselected() determines if the current child of this object is selected. boolean ischildselected( in long index ); parameters index the zero-based accessible child index. return value true if the child is selected, false if not. refselection() returns a reference to the accessible object representing the specified selected child of the object. nsiaccessible refselection( ...
...removechildfromselection() removes the specified child of the object from the object's selection. if the specified object was not selected, then it does nothing. ...
...fied child of the object from the object's selection. if the specified object was not selected, then it does nothing. void removechildfromselection( in long index ); parameters index zero-based accessible child index. exceptions thrown ns_error_failure if the specified object is not selectable. selectallselection() select all children. boolean selectallselection(); parameters none. return value if the object does not accept multiple selection, return false. otherwise, returns true. ...
nsIAppStartup
sinativeappsupport getter for "native application support." read only. obsolete since gecko 1.9.1 constants the following flags may be passed as the amode parameter to the quit() method. one and only one of the "quit" flags must be specified. the erestart flag may be bit-wise combined with one of the "quit" flags to cause the application to restart after it quits. constant value description econsiderquit 0x01 attempt to quit if all windows are closed. eattemptquit 0x02 try to close all windows, then quit if successful. eforcequit 0x03 force all windows to close, then quit. erestart 0x10 restart the application after quitting. the application will be restarted with the same profile and an empty command line. ...
... creates the initial state of the application by launching tasks specfied by "general.startup.*" prefs. note: size_to_content may be used for width or height. boolean createstartupstate( in long awindowwidth, in long awindowheight ); parameters awindowwidth the width to make the initial window(s) opened. awindowheight the height to make the initial window(s) opened. return value true if a window was opened. destroyhiddenwindow() destroys the hidden window. this will have no effect if the hidden window has not yet been created. void destroyhiddenwindow(); parameters none. doprofilestartup() obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) starts up the profile manager with the given arguments. void doprofilesta...
...r situations when all application windows will be closed but we don't want to take this as a signal to quit the application. bracket the code where the last window could close with these. void exitlastwindowclosingsurvivalarea(); parameters none. getstartupinfo() returns a javascript object with events from startup and the timestamps indicating when they occurred. parameters none. return value a javascript object with the following fields. keys are the event names and their values are the times. events that didn't occur are not in the object. event identifier (key) description main time at which main application core was loaded. note: only available with libxul builds. firstpaint time the first paint occurred. note: onl...
...oid quit( in pruint32 aquitmode ); parameters aquitmode this parameter modifies how the app is shutdown. run() runs an application event loop: normally the main event pump which defines the lifetime of the application. if there are no windows open and no outstanding calls to enterlastwindowclosingsurvivalarea() this method will exit immediately. void run(); parameters none. return value returns ns_success_restart_app code. this return code indicates that the application should be restarted because quit was called with the erestart flag. see also nsicmdlineservice nsiappstartup_mozilla_2_0 ...
nsIAutoCompleteInput
ng the starting index of the current selection in the text field. read only. showcommentcolumn boolean if true, a column is added to the popup, showing the comment for each autocomplete result. showimagecolumn boolean if true, a column is added to the popup, showing an additional image for each autocomplete result. textvalue astring the value of the text in the autocomplete text field. timeout unsigned long the number of milliseconds after a keystroke before a search begins. methods getsearchat() returns the name of one of the autocomplete search session objects. acstring getsearchat( in unsigned long index ); parameters index the index number of the ...
...te text field. timeout unsigned long the number of milliseconds after a keystroke before a search begins. methods getsearchat() returns the name of one of the autocomplete search session objects. acstring getsearchat( in unsigned long index ); parameters index the index number of the search session object whose name is to be returned. ...
...selecttextrange() selects a range of text in the autocomplete text field. ...
...selecttextrange() selects a range of text in the autocomplete text field. ...
nsIBlocklistService
unsigned long getaddonblockliststate( in jsval addon, in astring appversion, optional in astring toolkitversion optional ); parameters addon the add...
...the addon object whose blocklist state is to be determined. appversion optional the version of the application we are checking in the blocklist. if this parameter is null, the version of the running application is used. toolkitversion optional the version of the toolkit we are checking in the blocklist. if this parameter is null, the version of the running toolkit is used. return value the blocklist state of the add-on, one of the constants. getpluginblockliststate() determine the blocklist state of a plugin. unsigned long getpluginblockliststate( in nsiplugintag plugin, in astring appversion, optional in astring toolkitversion optional ); parameters plugin the plugin to get the state for. appversion optional the version of the application we are checkin...
...parameters plugin the plugin to get the state for. appversion optional the version of the application we are checking in the blocklist. if this parameter is null, the version of the running application is used. toolkitversion optional the version of the toolkit we are checking in the blocklist. if this parameter is null, the version of the running toolkit is used. return value the blocklist state of the plugin, one of the constants. isaddonblocklisted() determine if an item is blocklisted. boolean isaddonblocklisted( in jsval addon, in astring appversion, optional from gecko 1.9.1 in astring toolkitversion optional from gecko 1.9.1 ); parameters addon the addon object to be checked. appversion optional from gecko 1.9.1 the version of the applica...
...don object to be checked. appversion optional from gecko 1.9.1 the version of the application we are checking in the blocklist. if this parameter is null, the version of the running application is used. toolkitversion optional from gecko 1.9.1 the version of the toolkit we are checking in the blocklist. if this parameter is null, the version of the running toolkit is used. return value true if the item is blocklisted, otherwise false. ...
nsIBoxObject
lement.getclientrects and element.getboundingclientrect should be used instead. method overview wstring getlookandfeelmetric(in wstring propertyname); obsolete since gecko 1.9 wstring getproperty(in wstring propertyname); nsisupports getpropertyassupports(in wstring propertyname); void removeproperty(in wstring propertyname); void setproperty(in wstring propertyname, in wstring propertyvalue); void setpropertyassupports(in wstring propertyname, in nsisupports value); attributes attribute type description element nsidomelement read only. firstchild nsidomelement the first child of the box, in box-ordinal-group order. read only. height long the height of the box, in css pixels. read only. lastchild nsidomelement the last child of the box, in box-ordinal-group order. rea...
... pixels. read only. width long the width of the box, in css pixels. read only. x long the x coordinate of the box, in css pixels. read only. y long the y coordinate of the box, in css pixels. read only. ...
... of the box, in css pixels. read only. y long the y coordinate of the box, in css pixels. read only. ...
...andfeelmetric() obsolete since gecko 1.9 (firefox 3) wstring getlookandfeelmetric( in wstring propertyname ); parameters propertyname return value getproperty() wstring getproperty( in wstring propertyname ); parameters propertyname return value getpropertyassupports() nsisupports getpropertyassupports( in wstring propertyname ); parameters propertyname return value removeproperty() void removeproperty( in wstring propertyname ); parameters propertyname setproperty() void setproperty( in wstring propertyname, in wstring propertyvalue ); parameters propertyname propertyvalue setpropertyassupports() void setpropertyassupports( in wstring propertyname, in nsisupports value ); parameters propertyname value ...
nsIClipboardCommands
n cancopyselection(); boolean cancutselection(); boolean canpaste(); void copyimagecontents(); void copyimagelocation(); void copylinklocation(); void copyselection(); void cutselection(); void paste(); void selectall(); void selectnone(); methods cancopyimagecontents() returns whether we can copy an image's contents. boolean cancopyimagecontents(); parameters none. ...
... void cutselection(); void paste(); void selectall(); void selectnone(); methods cancopyimagecontents() returns whether we can copy an image's contents. boolean cancopyimagecontents(); parameters none. return value true if an image is selected, false otherwise. cancopyimagelocation() returns whether we can copy an image location. boolean cancopyimagelocation(); parameters none. return value true if an image is selected, false otherwise. cancopylinklocation() returns whether we can copy a link location. boolean cancopylinklocation(); parameters none. ...
...pyimagecontents(); parameters none. return value true if an image is selected, false otherwise. cancopyimagelocation() returns whether we can copy an image location. boolean cancopyimagelocation(); parameters none. return value true if an image is selected, false otherwise. cancopylinklocation() returns whether we can copy a link location. boolean cancopylinklocation(); parameters none. return value true if a link is selected, false otherwise. cancopyselection() returns whether there is a selection and it is copyable. boolean cancopyselection(); parameters none. return value true if there is a selection, false otherwise. cancutselection() returns whether there is a selection and it is not read-only. boolean cancutselection(); parameters none. ...
...cation(); parameters none. return value true if a link is selected, false otherwise. cancopyselection() returns whether there is a selection and it is copyable. boolean cancopyselection(); parameters none. return value true if there is a selection, false otherwise. cancutselection() returns whether there is a selection and it is not read-only. boolean cancutselection(); parameters none. return value true if the current selection can be cut, false otherwise. canpaste() returns whether the current contents of the clipboard can be pasted and if the current selection is not read-only. boolean canpaste(); parameters none. return value true if there is data to paste on the clipboard and the current selection is not read-only, false otherwise. copyimagecontents() copy the contents of the selected ...
nsIDOMStorage
ored in session storage may be accessed by any interested party in the same browsing context. 1.0 66 introduced gecko 1.8.1 inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) a dom window's session storage object can be retrieved from the window's sessionstorage attribute. a storage object stores an arbitrary set of key-value pairs, which may be retrieved, modified and removed as needed. a key may only exist once within a storage object, and only one value may be associated with a particular key. keys are stored in a particular order with 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();...
...ription length unsigned long the number of keys stored in the session store. read only. methods clear() clear the content of this storage bound to a domain or an origin. void clear(); parameters none. getitem() returns from session storage the data corresponding to the specified key. domstring getitem( in domstring key ); parameters key the key for which data should be returned. return value an nsidomstorageitem object describing the data corresponding to the specified key, or null if no data exists for the given key. key() returns the key for the item stored at the specified index in the data store. domstring key( in unsigned long index ); parameters index the index for which the corresponding key should be returned. return value a string containing the requested key. exception...
...void setitem( in domstring key, in domstring data ); parameters key the key for which data should be set. ...
...s thrown index_size_err there is no key at the specified index. removeitem() given a key, removes the corresponding entry from the session store. void removeitem( in domstring key ); parameters key the key for which data should be removed from storage. setitem() sets the value corresponding to a given key. if the key does not already exist, a new key is added, associated with the specified value. if the key already exists, the existing value is replaced with the specified value. void setitem( in domstring key, in domstring data ); parameters key the key for which data should be set. data the data to associate with the specified key. see also dom storage structured client-side storage (html 5 specification) nsidomstorageitem ...
nsIDispatchSupport
capscheck, out boolean classexists); boolean isobjectsafeforscripting(in voidptr theobject, in nsiidref id); void jsval2comvariant(in jsval var, out comvariant comvar); methods comvariant2jsval() converts a com variant to a jsval. void comvariant2jsval( in comvariantptr comvar, out jsval val ); parameters comvar the com variant to be converted. val the jsval to receive the converted value. gethostingflags() return the activex security and hosting flags. see nsiactivexsecuritypolicy for list of flags. unsigned long gethostingflags( in string acontext ); parameters acontext return value isclassmarkedsafeforscripting() test if the specified class is marked safe for scripting. boolean isclassmarkedsafeforscripting( in nscidref cid, out boolean classexists ); parameters c...
... gethostingflags( in string acontext ); parameters acontext return value isclassmarkedsafeforscripting() test if the specified class is marked safe for scripting. boolean isclassmarkedsafeforscripting( in nscidref cid, out boolean classexists ); parameters cid the nsid representation of the clsid to test. classexists returns containing pr_false if the class is not registered. return value isclasssafetohost() test if the class is safe to host. boolean isclasssafetohost( in jscontextptr cx, in nscidref cid, in boolean capscheck, out boolean classexists ); parameters cx cid capscheck classexists returns containing pr_false if the class is not registered. ...
...n of the clsid to test. classexists returns containing pr_false if the class is not registered. return value isclasssafetohost() test if the class is safe to host. boolean isclasssafetohost( in jscontextptr cx, in nscidref cid, in boolean capscheck, out boolean classexists ); parameters cx cid capscheck classexists returns containing pr_false if the class is not registered. return value isobjectsafeforscripting() test if the instantiated object is safe for scripting on the specified interface. boolean isobjectsafeforscripting( in voidptr theobject, in nsiidref id ); parameters theobject the object to test (an iunknown cast into a void *). id return value jsval2comvariant() converts a jsval to a com variant. void jsval2comvariant( in jsval var, out comvariant comvar...
...ied interface. boolean isobjectsafeforscripting( in voidptr theobject, in nsiidref id ); parameters theobject the object to test (an iunknown cast into a void *). id return value jsval2comvariant() converts a jsval to a com variant. void jsval2comvariant( in jsval var, out comvariant comvar ); parameters var the jsval to be converted. comvar the com variant to receive the converted value. ...
nsIDownloadProgressListener
description document nsidomdocument document the document of the download manager frontend. methods ondownloadstatechange() called when the status of a particular download changes. void ondownloadstatechange( in short astate, in nsidownload adownload ); parameters astate the previous state of the download. see nsidownloadmanager.constants for a list of possible values. adownload the nsidownload object representing the file whose download status has changed. you can get the new state of the download from this object. onlocationchange() obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) void onlocationchange( in nsiwebprogress awebprogress, in nsirequest arequest, in nsiuri alocation, in nsidownload...
...curtotalprogress, in long long amaxtotalprogress, in nsidownload adownload ); parameters awebprogress the nsiwebprogress instance used by the download manager to monitor downloads. arequest the nsichannel that changed state. this parameter will not be null. acurselfprogress the current amount of progress that's been made on the download specified by adownload. amaxselfprogress the value that the self progress needs to reach to indicate that the download is complete. acurtotalprogress the current amount of progress that's been made on all downloads. amaxtotalprogress the value that the total progress needs to reach to indicate that all downloads are complete. adownload the nsidownload object whose progress is represented by the acurselfprogress and amaxselfprogress paramete...
... in nsiwebprogress awebprogress, in nsirequest arequest, in unsigned long astate, in nsidownload adownload ); parameters awebprogress the nsiwebprogress instance used by the download manager to monitor downloads. arequest the nsichannel that changed state. this parameter will not be null. astate the new state of the download. see nsidownloadmanager.constants for a list of possible values. adownload the download whose security level is changing. onstatechange() called when the state of a particular download changes. void onstatechange( in nsiwebprogress awebprogress, in nsirequest arequest, in unsigned long astateflags, in nsresult astatus, in nsidownload adownload ); parameters awebprogress the nsiwebprogress instance used by the download manager to monitor...
...nge( in nsiwebprogress awebprogress, in nsirequest arequest, in unsigned long astateflags, in nsresult astatus, in nsidownload adownload ); parameters awebprogress the nsiwebprogress instance used by the download manager to monitor downloads. arequest the nsichannel that changed state. this parameter will not be null. astateflags flags indicating the download's new state. this value is a combination of one of the nsiwebprogresslistener.state_transition_flags. astatus the new state information for the download. see nsiwebprogresslistener.onstatechange() for details. this can also be one of the nsidownloadmanager.constants. adownload the download whose state changed. onstatuschange() obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2...
nsIEditor
roduced gecko 1.0 inherits from: nsisupports last changed in gecko 18.0 (firefox 18.0 / thunderbird 18.0 / seamonkey 2.15) method overview [noscript] void init(in nsidomdocument doc, in nsicontent aroot, in nsiselectioncontroller aselcon, in unsigned long aflags); void setattributeorequivalent(in nsidomelement element, in astring sourceattrname, in astring sourceattrvalue, in boolean asuppresstransaction); void removeattributeorequivalent(in nsidomelement element, in domstring sourceattrname, in boolean asuppresstransaction); void postcreate(); void predestroy(in boolean adestroyingframes); selected content removal void deleteselection(in short action, in short stripwrappers); document info and file methods ...
...ods void selectall(); void beginningofdocument(); void endofdocument(); drag/drop methods boolean candrag(in nsidomevent aevent); void dodrag(in nsidomevent aevent); void insertfromdrop(in nsidomevent aevent); node manipulation methods void setattribute(in nsidomelement aelement, in astring attributestr,in astring attvalue); boolean getattributevalue(in nsidomelement aelement, in astring attributestr, out astring resultvalue); void removeattribute(in nsidomelement aelement, in astring aattribute); void cloneattribute(in astring aattribute, in nsidomnode asourcenode); void cloneattributes(in nsidomnode destnode, in nsidomnode sourcenode); nsidomnode createnode(in astring ...
... document document ...
... ...
nsIGSettingsCollection
rvice.idlscriptable please add a summary to this article. ...
... article. ...
...inherits from: nsisupports last changed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) method overview boolean getboolean(in autf8string key); long getint(in autf8string key); autf8string getstring(in autf8string key); void setboolean(in autf8string key, in boolean value); void setint(in autf8string key, in long value); void setstring(in autf8string key, in autf8string value); methods getboolean() boolean getboolean( in autf8string key ); parameters key return value getint() long getint( in autf8string key ); parameters key return value getstring() autf8string getstring( in autf8string key ); parameters key return value setboolean() void setboolean( in autf8string key, in boolean value ); parameters key value setint() void setint( i...
...olean getboolean( in autf8string key ); parameters key return value getint() long getint( in autf8string key ); parameters key return value getstring() autf8string getstring( in autf8string key ); parameters key return value setboolean() void setboolean( in autf8string key, in boolean value ); parameters key value setint() void setint( in autf8string key, in long value ); parameters key value setstring() void setstring( in autf8string key, in autf8string value ); parameters key value ...
nsIHttpServer
ory(in string path, in nsifile dir); /** * associates files with the given extension with the given content-type when * served by this server, in the absence of any file-specific information * about the desired content-type. if type is empty, removes any extant * mapping, if one is present. * * @throws ns_error_invalid_arg * if the given type is not a valid header field value, i.e. if it doesn't * match the field-value production in rfc 2616 * @note * no syntax checking is done of the given type, beyond ensuring that it is * a valid header field value. behavior when not given a string matching * the media-type production in rfc 2616 section 3.7 is undefined. * implementations may choose to define specific behavior for types which do * ...
...* * retrieves the string associated with the given key in this, for the given * path's saved state. all keys are initially associated with the empty * string. */ astring getstate(in astring path, in astring key); /** * sets the string associated with the given key in this, for the given path's * saved state. ...
... key, in astring value); /** * retrieves the string associated with the given key in this, in * entire-server saved state. all keys are initially associated with the * empty string. */ astring getsharedstate(in astring key); /** * sets the string associated with the given key in this, in entire-server * saved state. */ void setsharedstate(in astring key, in astring value); /** * retrieves the object associated with the given key in this in * object-valued saved state. all keys are initially associated with null. */ nsisupports getobjectstate(in astring key); /** * sets the object associated with the given key in this in object-valued * saved state. the value may be null. ...
...ing value); /** * retrieves the object associated with the given key in this in * object-valued saved state. all keys are initially associated with null. */ nsisupports getobjectstate(in astring key); /** * sets the object associated with the given key in this in object-valued * saved state. the value may be null. ...
nsIInputStream
lly close() when end-of-file is reached; others do not. note: this method should not be used to determine the total size of a stream, even if the stream corresponds to a local file. moreover, since a stream may make available more than 2^32 bytes of data, this method is incapable of expressing the entire size of the underlying data source. unsigned long available(); parameters none. return value number of bytes currently available in the stream, or pr_uint32_max if the size of the stream exceeds pr_uint32_max. exceptions thrown <other-error> if the stream is closed due to some error condition. ns_base_stream_closed if the stream is closed normally. close() close the stream. this method causes subsequent calls to read() and readsegments() to return 0 bytes read to indicate end-...
...tion. ns_base_stream_closed if the stream is closed normally. close() close the stream. this method causes subsequent calls to read() and readsegments() to return 0 bytes read to indicate end-of-file. note: the close method may be called more than once, but subsequent calls are ignored. void close(); parameters none. isnonblocking() boolean isnonblocking(); parameters none. ...
...it returns 0 to indicate end-of-file. exceptions thrown <other-error> on failure. ns_base_stream_would_block indicates that reading from the input stream would block the calling thread for indeterminate amount of time. ...
...tr aclosure, in unsigned long acount ); parameters awriter the "consumer" of the data to be read. a callback function that may be called once for each buffer segment contained in the stream. see nswritesegmentfun for more details on this function. aclosure a parameter that is passed to awriter each time it is called. acount the maximum number of bytes to read from the stream. return value the number of bytes read from the stream (may be less than acount). it returns 0 to indicate end-of-file. exceptions thrown <other-error> on failure. ns_error_not_implemented indicates that the stream does not have an internal buffer that can be accessed directly. ns_base_stream_would_block indicates that reading from the input stream would block the calling thread for indeterminate amo...
nsIJumpListBuilder
the current host. read only. islistcommitted boolean jumplist management. indicates if a commit has already occurred in this session. read only. exceptions thrown ns_error_not_available on all calls if taskbar functionality is not supported by the operating system. maxlistitems short the maximum number of jump list items the current desktop can support. read only. constants constant value description jumplist_category_tasks 0 tasks are common actions performed by users within the application. a task can be represented by an application shortcut and associated command line parameters or a uri. task lists should generally be static lists that do not change often, if at all - similar to an application menu. tasks are given the highest priority of all lists when space is limited. ...
...bortlistbuild(); parameters none. addlisttobuild() adds a list and if required, a set of items for the list. boolean addlisttobuild( in short acattype, in nsiarray items, optional in astring catname optional ); parameters acattype the type of list to add. items optional an array of nsijumplistitem items to add to the list. catname optional for custom lists, the title of the list. return value true if the operation completed successfully. exceptions thrown ns_error_unexpected on internal errors. ns_error_illegal_value if an item is added that was removed since the last commit. ns_error_invalid_arg if incorrect parameters are passed for a particular category or item type. commitlistbuild() commits the current jump list build to the taskbar. boolean commitlistbuild(); parameters none.
... the operation completed successfully. exceptions thrown ns_error_unexpected on internal errors. ns_error_illegal_value if an item is added that was removed since the last commit. ns_error_invalid_arg if incorrect parameters are passed for a particular category or item type. commitlistbuild() commits the current jump list build to the taskbar. boolean commitlistbuild(); parameters none. return value true if the operation completed successfully. deleteactivelist() deletes any currently applied taskbar jump list for this application. common uses would be the enabling of a privacy mode and uninstallation. boolean deleteactivelist(); parameters none. return value true if the operation completed successfully. exceptions thrown ns_error_unexpected on internal errors. initlistbuild() initializes...
... ...
nsILocalFileMac
ntifier autf8string returns the identifier of the bundle. read only. filecreator ostype native code only! filesizewithresfork print64 returns the combined size of both the data fork and the resource fork (if present) rather than just the size of the data fork as returned by getfilesize() read only. filetype ostype file type and creator attributes. native code only! constants constant value description current_process_creator 0x8000000 use with setfiletype() to specify the signature of current process. obsolete since gecko 2.0 methods native code only!getcfurl note: observes the state of the followlinks attribute. if the file object is an alias and followlinks is true, returns the target of the alias. if followlinks is false, returns the unresolved alias file. note: supported o...
...type() to specify the signature of current process. obsolete since gecko 2.0 methods native code only!getcfurl note: observes the state of the followlinks attribute. if the file object is an alias and followlinks is true, returns the target of the alias. if followlinks is false, returns the unresolved alias file. note: supported only for xp_macosx. cfurlref getcfurl(); parameters none. return value the cfurlref of the file object. the caller is responsible for calling cfrelease() on it. native code only!getfsref note: observes the state of the followlinks attribute. if the file object is an alias and followlinks is true, returns the target of the alias. if followlinks is false, returns the unresolved alias file. note: supported only for xp_macosx. fsref getfsref(); parameters none. return ...
... the cfurlref of the file object. the caller is responsible for calling cfrelease() on it. native code only!getfsref note: observes the state of the followlinks attribute. if the file object is an alias and followlinks is true, returns the target of the alias. if followlinks is false, returns the unresolved alias file. note: supported only for xp_macosx. fsref getfsref(); parameters none. return value the fsref of the file object. native code only!getfsspec note: observes the state of the followlinks attribute. if the file object is an alias and followlinks is true, returns the target of the alias. if followlinks is false, returns the unresolved alias file. fsspec getfsspec(); parameters none. return value the fsspec of the file object. native code only!inittoappwithcreatorcode obsolete sin...
...nnec 1.0)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. init this object with an fsspec legacy method - leaving in place for now. void initwithfsspec( [const] in fsspecptr afilespec ); parameters afilespec the native file spec. ispackage() boolean ispackage(); parameters none. return value true if a directory is determined to be a package under mac os 9/x. launchwithdoc() launch the application that this file points to with a document. void launchwithdoc( in nsilocalfile adoctoload, in boolean alaunchinbackground ); parameters adoctoload must not be null. if no document, use nsilocalfile::launch. alaunchinbackground true if the application should not come to the front. opend...
nsILoginInfo
te for the password input in a form. non-form logins should specify an empty string (""). username astring the username for the login. usernamefield astring the name attribute for the username input in a form. non-form logins should specify an empty string (""). methods clone() returns a clone of this login. nsilogininfo clone(); parameters none. return value an nsilogininfo containing a clone of the login on which this method was invoked. equals() tests to determine whether this login is exactly equal to another nsilogininfo object. boolean equals( in nsilogininfo alogininfo ); parameters alogininfo the login to which to compare for equality. return value true if the two logins are exactly equal or false if they're not. init() initia...
...which to compare for equality. return value true if the two logins are exactly equal or false if they're not. init() initializes a newly created nsilogininfo object. void init( in astring ahostname, in astring aformsubmiturl, in astring ahttprealm, in astring ausername, in astring apassword, in astring ausernamefield, in astring apasswordfield ); parameters ahostname the value to assign to the hostname field. aformsubmiturl the value to assign to the formsubmiturl field. ahttprealm the value to assign to the httprealm field. ausername the value to assign to the username field. apassword the value to assign to the password field. ausernamefield the value to assign to the usernamefield field. apasswordfield the value to assign to the passwordfield field. ma...
...e httprealm field. ausername the value to assign to the username field. apassword the value to assign to the password field. ausernamefield the value to assign to the usernamefield field. apasswordfield the value to assign to the passwordfield field. matches() tests to determine whether this login is loosely equivalent to another nsilogininfo object. the passwordfield and usernamefield values are ignored, and the password values may be optionally ignored. if one login's formsubmiturl is an empty string (but not null), it will be treated as a wildcard. a blank value indicates the login was stored before bug 360493 was fixed. boolean matches( in nsilogininfo alogininfo, in boolean ignorepassword ); parameters alogininfo the login to which to compare for equality. ignorepas...
...e optionally ignored. if one login's formsubmiturl is an empty string (but not null), it will be treated as a wildcard. a blank value indicates the login was stored before bug 360493 was fixed. boolean matches( in nsilogininfo alogininfo, in boolean ignorepassword ); parameters alogininfo the login to which to compare for equality. ignorepassword if true, do not examine the password value when matching. return value true if the two logins are equivilant or false if they're not. see also nsiloginmanager using nsiloginmanager ...
nsIMemory
ace guidelines void heapminimize(in boolean immediate); boolean islowmemory(); deprecated since gecko 2.0 voidptr realloc(in voidptr ptr, in size_t newsize); violates the xpcom interface guidelines methods alloc allocates a block of memory of a particular size. voidptr alloc( in size_t size ); parameters size the size of the block to allocate. return value if the memory cannot be allocated (because of an out-of-memory condition), null is returned. otherwise, it returns a pointer to the newly allocated memory segment. the result must be freed with a call to free() when it is no longer needed. free frees a previously allocated block of memory. void free( in voidptr ptr ); parameters ptr the address of the memory block to free. this may be...
...y determine if we are in a low-memory situation (what constitutes low-memory is platform dependent). this can be used to trigger the memory pressure observers. note: this method was deprecated in gecko 2.0. if you need to monitor low memory conditions, you should watch for the low memory notifications "memory-pressure" notifications instead. boolean islowmemory(); parameters none. return value true if we are in a low-memory situation. otherwise false. note: from gecko 2.0 always returns false. see bug 592308. realloc() reallocates a block of memory to a new size. voidptr realloc( in voidptr ptr, in size_t newsize ); parameters ptr the address of the memory block to reallocate. this may be null, in which case realloc behaves like alloc(). newsize specifies the new size...
...592308. realloc() reallocates a block of memory to a new size. voidptr realloc( in voidptr ptr, in size_t newsize ); parameters ptr the address of the memory block to reallocate. this may be null, in which case realloc behaves like alloc(). newsize specifies the new size in bytes of the block of memory to allocate. this may be 0, in which case realloc behaves like alloc(). return value null if the memory allocation fails. otherwise, it returns a pointer to the newly allocated memory segment. the result must be freed with a call to free() when it is no longer needed. low memory notifications an nsimemory implementation may be capable of monitoring heap usage. moreover, a mechanism exists by which a client can receive notifications about low-memory situations. a client that w...
...ecause the client maintains a large memory cache that could be released when memory is tight) should register with the observer service (see nsiobserverservice) using the topic "memory-pressure". there are three specific types of notifications that can occur. these types will be passed as the adata parameter of the of the "memory-pressure" notification: "low-memory" this will be passed as the value of adata when a low-memory condition occurs (not necessarily an out-of-memory condition). "heap-minimize" this will be passed as the value of adata when an explicit call to heapminimize() was made. "alloc-failure" this will be passed as the value of adata when an out-of-memory condition occurs. when a nsimemory instance notifies memory pressure observers, it passes itself as the asubject pa...
nsIMsgDatabase
msghdr, in nsidbchangelistener instigator,in boolean commit, in boolean notify); void removeheadermdbrow(in nsimsgdbhdr msghdr); void undodelete(in nsimsgdbhdr msghdr); void markmarked(in nsmsgkey key, in boolean mark, in nsidbchangelistener instigator); void markoffline(in nsmsgkey key, in boolean offline, in nsidbchangelistener instigator); void setlabel(in nsmsgkey key, in nsmsglabelvalue label); void setstringproperty(in nsmsgkey akey, in string aproperty, in string avalue); void markimapdeleted(in nsmsgkey key, in boolean deleted, in nsidbchangelistener instigator); void applyretentionsettings(in nsimsgretentionsettings amsgretentionsettings, in boolean adeleteviafolder); boolean hasnew(); void clearnewlist(in boolean notify); void addtonewlist(in nsmsgkey key); vo...
...rinfo readonly: firstnew nsmsgkey readonly: msgretentionsettings nsimsgretentionsettings msgdownloadsettings nsimsgdownloadsettings lowwaterarticlenum nsmsgkey readonly: highwaterarticlenum nsmsgkey readonly: nextpseudomsgkey nsmsgkey for undo-redo of move pop->imap. nextfakeofflinemsgkey nsmsgkey readonly: for saving "fake" offline msg hdrs. defaultviewflags nsmsgviewflagstypevalue readonly: defaultsorttype nsmsgviewsorttypevalue readonly: defaultsortorder nsmsgviewsortordervalue readonly: msghdrcachesize unsigned long folderstream nsioutputstream summaryvalid boolean methods open() opens a database folder. void open(in nsilocalfile afoldername, in boolean acreate, in boolean aleaveinvaliddb); parameters afoldername the name of t...
...if deletev...
...if deleteviafolder is true, we'll call nsimsgfolder.deletemessages() to delete the messages. otherwise, we'll just delete them from the db. void applyretentionsetting...
nsINavHistoryContainerResultNode
whether or not the node can have children, and may be used whether the container is open or closed. when the container is closed, the result is an exact answer if the node can be populated easily (for example, for bookmark folders). if it can't be populated easily (for complex history queries, for example), the result is always true. when the container is open, the result is always accurate. this value is intended to be used to see if the "+" should be drawn next to a tree item, indicating that the item can be opened. read-only. remotecontainertype obsolete since gecko 1.9 autf8string a string representing the remote container service api that is responsible for this container. if there is no such api, this value is an empty string. read only. the container may be a result_type_remote_contai...
...ad only. the container may be a result_type_remote_container node that has been dynamically generated by the remote container api, or a bookmark folder (result_type_folder) for which some service (such as livemarks) has registered to provide certain operations. state unsigned short the current state of the container. this is one of the state constants. constants state constants constant value description state_closed 0 the container is closed. state_loading 1 the container has been opened asynchronously, but is still loading and is not all the way opened yet. state_opened 2 the container is open. methods findnodebydetails() returns a node matching specified details. nsinavhistoryresultnode findnodebydetails( in autf8string auristring, in prtime atime, in long long...
...he container has been opened asynchronously, but is still loading and is not all the way opened yet. state_opened 2 the container is open. methods findnodebydetails() returns a node matching specified details. nsinavhistoryresultnode findnodebydetails( in autf8string auristring, in prtime atime, in long long aitemid, in boolean recursive ); parameters auristring the uri attribute value to match on. atime the time attribute to match on. aitemid the item id to match on. arecursive if true, the search will recurse through all child containers of the current container; if false, only direct children of the container are searched. return value an nsinavhistoryresultnode of a node matching the specified details or null if no match is found. exceptions thrown ns_error_not_available ...
...etch. returns the node located at the specified index. exceptions thrown ns_error_not_available the containeropen attribute is currently false, indicating that the node isn't open for access. getchildindex() returns the index of a direct child of this container. unsigned long getchildindex( in nsinavhistoryresultnode anode ); parameters anode the node whose index is to be returned. return value the index of the specified node into the list of immediate children of the container. exceptions thrown ns_error_not_available the container isn't open (that is, containeropen is false). ns_error_invalid_arg the specified node isn't a direct child of this container. remarks there are a number of untested methods on this interface that are not documented at present, and are disabled in the idl ...
nsINavHistoryResultTreeViewer
prevents you from seeing multiple entries for things when you have selected to get visits. when you sort by date, the multiple entries will then appear because they will be separated (unless you clicked reload a bunch of times in a row). if you know you'll only ever want one entry per site, you should ask for uris back instead of visits so it will be more efficient. default = true. changing this value is somewhat heavyweight since it will force a tree refresh. obsolete since gecko 1.9 flatitemcount pruint32 this tells you how many items are in the flattened list of results, that is how many rows are in this tree right now. the tree adaptor will also qi to nsitreeview, and this will be the same as nsitreeview.rowcount. this is only valid when a tree is attached, the result will be 0 otherwise...
...solete since gecko 1.9 flatitemcount pruint32 this tells you how many items are in the flattened list of results, that is how many rows are in this tree right now. the tree adaptor will also qi to nsitreeview, and this will be the same as nsitreeview.rowcount. this is only valid when a tree is attached, the result will be 0 otherwise. read only. obsolete since gecko 1.9 constants constant value description index_invisible 0xffffffff returned by treeindexfornode() when the requested node isn't visible (such as when its parent is collapsed). also returned if there is no tree attached. methods nodefortreeindex() returns the node for a given row index. this is only valid when a tree is attached. nsinavhistoryresultnode nodefortreeindex( in unsigned long aindex ); parameters aindex ...
...urned by treeindexfornode() when the requested node isn't visible (such as when its parent is collapsed). also returned if there is no tree attached. methods nodefortreeindex() returns the node for a given row index. this is only valid when a tree is attached. nsinavhistoryresultnode nodefortreeindex( in unsigned long aindex ); parameters aindex the row index of the note to return. return value the node located at the specified index in the tree. treeindexfornode() returns the row index corresponding to the specified node within the tree, or index_invisible if the tree is unattached or the node is not visible (if, for example, its parent container is collapsed). unsigned long treeindexfornode( in nsinavhistoryresultnode anode ); parameters anode the node whose index is to be returne...
... index corresponding to the specified node within the tree, or index_invisible if the tree is unattached or the node is not visible (if, for example, its parent container is collapsed). unsigned long treeindexfornode( in nsinavhistoryresultnode anode ); parameters anode the node whose index is to be returned. this must be a node retrieved from the same result that the viewer displays. return value the row index of the node specified by anode, or index_invisible for nodes that are hidden (by their parents being collapsed, for example) or if there is no attached tree. see also querying places displaying places information using views nsinavhistoryresult nsitreeview ...
nsIOutputStream
g() note: writing to a blocking output stream will block the calling thread until all given data can be consumed by the stream. note: a non-blocking output stream may implement nsiasyncoutputstream to provide consumers with a way to wait for the stream to accept more data once its write() method is unable to accept any data without blocking. boolean isnonblocking(); parameters none. return value true if stream is non-blocking. exceptions thrown ns_base_stream_would_block a non-blocking stream may throw this exception when written to if space for the data is not immediately available. write() this method copies data from a buffer into the stream. note: though this method is scriptable, javascript code must only pass an ascii character string as the abuf parameter. c++ code may h...
...t code must only pass an ascii character string as the abuf parameter. c++ code may however pass any arbitrary binary data, including data with embedded null bytes. unsigned long write( in string abuf, in unsigned long acount ); parameters abuf the buffer containing the data to be written. acount the size of the buffer, or the maximum number of bytes to copy from the buffer. return value this method returns the number of bytes copied from the buffer (may be less than acount). exceptions thrown ns_base_stream_would_block if writing to the output stream would block the calling thread (non-blocking mode only) writefrom() this method copies data from an nsiinputstream to this nsioutputstream. a nsioutputstream is not required to implement this method. in some contexts, writ...
.... if this method was provided as an external facility, a separate char* buffer would need to be used in order to call the output stream's other write() method. unsigned long writefrom( in nsiinputstream afromstream, in unsigned long acount ); parameters afromstream an nsiinputstream containing the data to be written. acount the maximum number of bytes to write to the stream. return value this method returns the number of bytes written to the stream (may be less than acount). exceptions thrown ns_base_stream_would_block indicates that writing to the output stream would block the calling thread for an indeterminate amount of time. this exception may only be thrown if isnonblocking() returns true. ns_error_not_implemented indicates that the stream does not implement this met...
...zation. unsigned long writesegments( in nsreadsegmentfun areader, in voidptr aclosure, in unsigned long acount ); parameters areader a callback function that may be called multiple times. see nsreadsegmentfun for more details on this function. aclosure a parameter that is passed to areader each time it is called. acount the maximum number of bytes to write to the stream. return value this method returns the number of bytes written to the stream (may be less than acount). exceptions thrown ns_base_stream_would_block indicates that writing to the output stream would block the calling thread for an indeterminate amount of time. this exception may only be thrown if isnonblocking() returns true. ns_error_not_implemented indicates that the stream does not have an internal b...
nsIParentalControlsService
file downloads. read only. loggingenabled boolean true if the current user account has parental controls logging enabled. if this is true, applications should log relevant events using log() method. read only. parentalcontrolsenabled boolean true if the current user account has parental controls restrictions enabled. read only. constants constant value description epclog_urivisit 1 this log entry type represents an access to web content. epclog_filedownload 2 this log entry type represents a file download. methods log() logs an application specific parental controls event. void log( in short aentrytype, in boolean aflag, in nsiuri asource, in nsifile atarget optional ); parameters aentryty...
...try type represents an access to web content. epclog_filedownload 2 this log entry type represents a file download. methods log() logs an application specific parental controls event. void log( in short aentrytype, in boolean aflag, in nsiuri asource, in nsifile atarget optional ); parameters aentrytype the type of event to log. see the constants for allowed values. aflag pass true if the event was blocked or false if it was allowed. asource the uri source of the subject content. atarget optional the location to which the content was saved if it was not blocked. requesturioverride() requests that a blocked uri be allowed through parental control filters. this method may block while the operating system presents user interface to handle the overri...
...l filters. this method may block while the operating system presents user interface to handle the override request (such as an "enter an administrator's password" dialog box). boolean requesturioverride( in nsiuri atarget, in nsiinterfacerequestor awindowcontext optional ); parameters atarget the uri to be overridden. awindowcontext optional the window generating the event. return value true if the block was successfully overridden, otherwise false. requesturioverrides() requests that a set of uris be allowed through the parental control filters. this method may block while the operating system presents user interface to handle the override request (such as an "enter an administrator's password" dialog box). boolean requesturioverrides( in nsiarray atargets, in nsiinter...
... ...
nsIParserUtils
sanitizerallowstyle (1 << 1) flag for sanitizer: allow <style> elements and style attributes (with contents sanitized in case of -moz-binding). note: if -moz-binding is absent, properties that might be xss risks in other web engines are preserved! sanitizerc...
...vals (1 << 6) flag for sanitizer: log messages to the console for everything that gets sanitized. methods converttoplaintext() converts html to plain text. astring converttoplaintext( in astring src, in unsigned long flags, in unsigned long wrapcol ); parameters src the html source to parse (c++ callers are allowed but not required to use the same string for the return value.) flags conversion option flags defined in nsidocumentencoder. wrapcol number of characters per line; 0 for no auto-wrapping. return value the plain text conversion of the html specified in src. parsefragment() parses markup into a sanitized document fragment. nsidomdocumentfragment parsefragment( in astring fragment, in unsigned long flags, in boolean isxml, in nsiuri baseuri, ...
...ment parsefragment( in astring fragment, in unsigned long flags, in boolean isxml, in nsiuri baseuri, in nsidomelement element ); parameters fragment the input markup. flags sanitization option flags defined above. isxml true if |fragment| is xml and false if html. baseuri the base url for this fragment. element the context node for the fragment parsing algorithm. return value an nsidomdocumentfragment object for the resulting sanitized document fragment. sanitize() parses a string into an html document, sanitizes the document, and returns the result serialized to a string. the sanitizer is designed to protect against xss when sanitized content is inserted into a different-origin context without an iframe-equivalent sandboxing mechanism. by default, the sanitizer ...
.... note: if -moz-binding is not present, <style> elements and style attributes, and if sanitizerallowstyle is specified, the sanitized content may still be xss dangerous if loaded into a non-gecko web engine! astring sanitize( in astring src, in unsigned long flags ); parameters src the html source to parse (c++ callers are allowed but not required to use the same string for the return value). flags sanitization option flags defined above. return value the resulting text. ...
nsIPlacesView
information using views for examples. selectednode nsinavhistoryresultnode the selected node in the view. if there are multiple selected nodes, this is null. read only. methods getdragableselection() returns an array of selected nsinavhistoryresultnode objects that can be dragged from the view. nsinavhistoryresultnode[] getdragableselection(); parameters none. ...
... getresultnode() returns the root node, an nsinavhistorycontainerresultnode object, of the view's result. ...
...hat can be removed from the view. each inner array represents a contiguous range of nodes that can be removed. nsinavhistoryresultnode[][] getremovableselectionranges(); parameters none. return value an array of arrays of nsinavhistoryresultnode objects. getresult() returns the nsinavhistoryresult object that the view displays. nsinavhistoryresult getresult(); parameters none. return value the nsinavhistoryresult object that the view displays. getresultnode() returns the root node, an nsinavhistorycontainerresultnode object, of the view's result. nsinavhistorycontainerresultnode getresultnode(); paramters none. return value the root nsinavhistorycontainerresultnode of the view's result. getselectionnodes() returns an array of all currently selected nsinavhistoryresultnod...
...alue the root nsinavhistorycontainerresultnode of the view's result. getselectionnodes() returns an array of all currently selected nsinavhistoryresultnode objects of the view. the nodes are not necessarily returned in the same order in which they occur in the model, or in the same container, or from the same provider. nsinavhistoryresultnode[] getselectionnodes(); parameters none. return value an array of nsinavhistoryresultnode objects that are selected. selectall() selects all the nodes displayed in the view. void selectall(); parameters none. see also displaying places information using views ...
nsIPrefService
oot); nsiprefbranch getdefaultbranch(in string aprefroot); void readuserprefs(in nsifile afile); void resetprefs(); void resetuserprefs(); void savepreffile(in nsifile afile); methods getbranch() call to get a preferences "branch" which accesses user preference data. using a set method on this object will always create or set a user preference value. when using a get method a user set value will be returned if one exists, otherwise a default value will be returned. nsiprefbranch getbranch( in string aprefroot ); parameters aprefroot the preference root tree on which to base this branch. for example, if the root browser.startup. is used, the branch will be able to easily access the preferences browser.startup.page, browser.startup.ho...
... the preference root tree on which to base this branch. for example, if the root browser.startup. is used, the branch will be able to easily access the preferences browser.startup.page, browser.startup.homepage, and browser.startup.homepage_override by simply requesting page, homepage, or homepage_override. nsnull or "" (empty string) may be used to access to the entire preference tree. return value nsiprefbranch - the object representing the requested branch. getdefaultbranch() call to get a preferences branch which accesses only the default preference data. using a set method on this object will always create or set a default preference value. when using a get method a default value will always be returned. note: few consumers will want to create default branch objects. many of the bra...
... the preference root tree on which to base this branch. for example, if the root browser.startup. is used, the branch will be able to easily access the preferences browser.startup.page, browser.startup.homepage, and browser.startup.homepage_override by simply requesting page, homepage, or homepage_override. nsnull or "" (empty string) may be used to access to the entire preference tree. return value nsiprefbranch - the object representing the requested default branch. readuserprefs() called to read in the preferences specified in a user preference file. note: if nsnull is passed in for the afile parameter the default preferences file(s) [prefs.js, user.js] will be read and processed. void readuserprefs( in nsifile afile ); parameters afile the file to be read. resetprefs() ca...
...snull is passed in for the afile parameter the default preferences file(s) [prefs.js, user.js] will be read and processed. void readuserprefs( in nsifile afile ); parameters afile the file to be read. resetprefs() called to completely flush and re-initialize the preferences system. void resetprefs(); parameters none. resetuserprefs() called to reset all preferences with user set values back to the application default values. void resetuserprefs(); parameters none. savepreffile() called to write current preferences state to a file. note: if nsnull is passed in for the afile parameter the preference data is written out to the current preferences file (usually prefs.js.) void savepreffile( in nsifile afile ); parameters afile the file to be written. see also ...
nsIProcess
this is only valid after the process has exited. read only. isrunning boolean true if the process is running, otherwise false. only accurate if the process was run with blocking disabled. read only. location nsifile the location of the executable file on disk. read only. gecko 1.9.1 note this att...
...this is only valid after the process has exited. read only. isrunning boolean true if the process is running, otherwise false. only accurate if the process was run with blocking disabled. read only. location nsifile the location of the executable file on disk. read only. gecko 1.9.1 note this attribute is no longer i...
...cess is running, otherwise false. only accurate if the process was run with blocking disabled. read only. location nsifile the location of the executable file on disk. read only. gecko 1.9.1 note this attribute is no longer implemented as of gecko 1.9.1, and is removed entirely in gecko 1.9.2. pid unsigned long the process id of the process. this value is only available after the process has started; in addition, some platforms may not offer this value at all. read only. processname string the name of the process. read only. gecko 1.9.1 note this attribute is no longer implemented as of gecko 1.9.1, and is removed entirely in gecko 1.9.2. processsignature unsigned long the process signature...
... works if the process was run without blocking enabled. gecko 1.9.1 note prior to gecko 1.9.1 (firefox 3.5), this method did not work on windows or mac os x. now it does. void kill(); parameters none. run() starts executing the process. gecko 1.9.1 note prior to gecko 1.9.1 (firefox 3.5), this method returned the process id of the newly executing process. it no longer returns a value. void run( in boolean blocking, [array, size_is(count)] in string args, in unsigned long count ); parameters blocking if true, this method will block until the process terminates; if false, the method returns immediately. args an array of count arguments, using the native character set, to be passed to the executable on its command line. count the number of arguments in the args...
nsIPrompt
se the prompt service as it is more flexible, but sometimes a callback will request an nsiprompt via nsiinterfacerequestor.getinterface(). to get an instance, call the nsiwindowwatcher.getnewprompter(). ...
...). ...
...ean confirm(in wstring dialogtitle, in wstring text); boolean confirmcheck(in wstring dialogtitle, in wstring text, in wstring checkmsg, inout boolean checkvalue); print32 confirmex(in wstring dialogtitle, in wstring text, in unsigned long buttonflags, in wstring button0title, in wstring button1title, in wstring button2title, in wstring checkmsg, inout boolean checkvalue); boolean prompt(in wstring dialogtitle, in wstring text, inout wstring value, in wstring checkmsg, inout boolean checkvalue); boolean promptpassword(in wstring dialogtitle, in wstring text, inout wstring password, in wstring checkmsg, inout boolean checkvalue); boolean promptusernameandpassword(in wstring dialogtitle, in wstring text, inout wstring...
...inout wstring value, in wstring checkmsg, inout boolean checkvalue); boolean promptpassword(in wstring dialogtitle, in wstring text, inout wstring password, in wstring checkmsg, inout boolean checkvalue); boolean promptusernameandpassword(in wstring dialogtitle, in wstring text, inout wstring username, inout wstring password, in wstring checkmsg, inout boolean checkvalue); boolean select(in wstring dialogtitle, in wstring text, in pruint32 count, [array, size_is(count)] in wstring selectlist, out long outselection); constants the button flags defined in nsiprompt are the same as those defined in nsipromptservice.constants. example usage is also documented: using the button flags see also nsipromptservice ...
nsISecurityCheckedComponent
code that has the "universalxpconnect" capability is allowed to access all of xpcom. this includes creating instances of arbitrary xpcom objects and calling methods and setting properties on them. code that has the "universalbrowserread" capability is allowed to perform certain actions that allow it to read information from the local system. for example, this capability allows code to set the value of <input type="file"> and access an arbitrary file on disk. standard web pages have no special capabilities. extensions can define their own capabilities and use this interface to only allow access to code trusted with that capability. the two special return values of '"allaccess" or "noaccess" unconditionally allow or deny access to the operation. all code has the "allaccess" capability, an...
...y(in nsiidptr iid, in wstring propertyname); methods cancallmethod() returns a capability string indicating what permissions are required to call the specified method on the given interface. string cancallmethod( in nsiidptr iid, in wstring methodname ); parameters iid the iid of the interface this method exists on. methodname the name of the method to be called on the interface. return value the capability required to call this method. see capability strings for details. cancreatewrapper() returns a string indicating what permissions are required to create a wrapper for the given interface. string cancreatewrapper( in nsiidptr iid ); parameters iid the interface to reflect into javascript. return value the capability required to reflect this interface. note that if wrapper cre...
...hods will be visible, not not usable. see capability strings for details. cangetproperty() returns the permissions required to get the specified property on the given interface. string cangetproperty( in nsiidptr iid, in wstring propertyname ); parameters iid the interface that the property to get exists on. propertyname the name of the property to be retrieved on this interface. return value the capability required to get the property. see capability strings for details. cansetproperty() returns the permissions required to set the specified property on the given interface. string cansetproperty( in nsiidptr iid, in wstring propertyname ); parameters iid the interface that the property to set exists on. propertyname the name of the property to be set on this interface. retur...
...he capability required to get the property. see capability strings for details. cansetproperty() returns the permissions required to set the specified property on the given interface. string cansetproperty( in nsiidptr iid, in wstring propertyname ); parameters iid the interface that the property to set exists on. propertyname the name of the property to be set on this interface. return value the capability required to set the property. see capability strings for details. ...
nsISelection2
n short avpercent, in short ahpercent ); parameters aregion the region inside the selection to scroll into view (see selection region constants defined in nsiselectioncontroller). aissynchronous when true, scrolls the selection into view before returning. if false, posts a request which is processed at some point after the method returns. avpercent how to align the frame vertically. ...
...lection to scroll into view (see selection region constants defined in nsiselectioncontroller). aissynchronous when true, scrolls the selection into view before returning. if false, posts a request which is processed at some point after the method returns. avpercent how to align the frame vertically. a value of 0 means the frame's upper edge is aligned with the top edge of the visible area. a value of 100 means the frame's bottom edge is aligned with the bottom edge of the visible area. for values in between, the point "avpercent" down the frame is placed at the point "avpercent" down the visible area. a value of 50 centers the frame vertically. a value of -1 means move the frame the minimum amount necessary in order for the entire frame to be visible vertically (if possible). ahpercent h...
...is aligned with the bottom edge of the visible area. for values in between, the point "avpercent" down the frame is placed at the point "avpercent" down the visible area. a value of 50 centers the frame vertically. a value of -1 means move the frame the minimum amount necessary in order for the entire frame to be visible vertically (if possible). ahpercent how to align the frame horizontally. a value of 0 means the frame's left edge is aligned with the left edge of the visible area. a value of 100 means the frame's right edge is aligned with the right edge of the visible area. for values in between, the point "ahpercent" across the frame is placed at the point "ahpercent" across the visible area. ...
...o be visible vertically (if possible). ahpercent how to align the frame horizontally. a value of 0 means the frame's left edge is aligned with the left edge of the visible area. a value of 100 means the frame's right edge is aligned with the right edge of the visible area. for values in between, the point "ahpercent" across the frame is placed at the point "ahpercent" across the visible area. a value of 50 centers the frame horizontally . a value of -1 means move the frame the minimum amount necessary in order for the entire frame to be visible horizontally (if possible). see also nsiselectionprivate ...
nsIServerSocket
, this address may not necessarily be specific to a single network device. in the case of an ip socket, the ip address field would be zeroed out to indicate a server socket bound to all network devices. therefore, this method cannot be used to determine the ip address of the local system. see nsidnsservice.myhostname() if this is what you need. prnetaddr getaddress(); parameters none. return value the network address to which the socket is bound. init() initializes a server socket. void init( in long aport, in boolean aloopbackonly, in long 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 i...
...backonly 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, in long abacklog ); parameters aaddr the address to which this server socket should be bound. abacklog the maximum length the queue of pend...
... ...
...dress (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. ...
nsISupportsID
remarks this interface was frozen for gecko 1.2. ...
...remarks this interface was frozen for gecko 1.2. ...
...remarks this interface was frozen for gecko 1.2. see bug bug 166426 for details. ...
...remarks this interface was frozen for gecko 1.2. see bug bug 166426 for details. from gecko 2.0 interfaces are no longer frozen. ...
nsISupportsPRTime
remarks this interface was frozen for gecko 1.2. ...
...remarks this interface was frozen for gecko 1.2. ...
...remarks this interface was frozen for gecko 1.2. see bug 166426 for details. ...
...remarks this interface was frozen for gecko 1.2. see bug 166426 for details. from gecko 2.0 interfaces are no longer frozen. ...
nsIToolkitProfileService
must first call aprofile.queryinterface(components.interfaces.nsitoolkitprofile) to get access to its attributes and methods). selectedprofile nsitoolkitprofile the profile that is marked as "default=1" in the profiles.ini file. (not the profile currently in use.) not sure what happens if you change this setting but someone said: you can change profiles by setting this attribute's value. this may throw an ns_error_failure (0x80004005) when trying to get the current profile if it's unavailable or if permissions restrict access. startoffline boolean startwithlastprofile boolean methods createprofile() creates a new profile. the profile temporary directory will be chosen based on where the profile directory is located. nsitoolkitprofile create...
...ates a new profile. the profile temporary directory will be chosen based on where the profile directory is located. nsitoolkitprofile createprofile( in nsilocalfile arootdir, in autf8string aname ); parameters arootdir the profile directory. may be null, in which case a suitable default will be chosen based on the profile name. aname the name to give the new profile. return value an nsitoolkitprofile object representing the newly-created profile. exceptions thrown ns_error_unexpected an unexpected error condition occurred. ns_error_file_not_directory one of the specified directory files is not actually a directory. ns_error_out_of_memory unable to allocate the new profile object. flush() flushes the profile list to disk. the profile list file is ...
...thrown ns_error_out_of_memory an error occurred trying to allocate the memory buffer used to construct the profile list. ns_error_unexpected an error occurred writing the profile list file to disk. getprofilebyname() gets a profile, given the profile's name. nsitoolkitprofile getprofilebyname( in autf8string aname ); parameters aname the profile name to find. return value an nsitoolkitprofile object describing the specified profile. exceptions thrown ns_error_failure no matching profile was found. lockprofilepath() locks an arbitrary path as a profile. if the path does not exist, it is created and the defaults copied from the application directory. nsiprofilelock lockprofilepath( in nsilocalfile adirectory, in nsilocalfile atempdirectory ); paramete...
... locks an arbitrary path as a profile. if the path does not exist, it is created and the defaults copied from the application directory. nsiprofilelock lockprofilepath( in nsilocalfile adirectory, in nsilocalfile atempdirectory ); parameters adirectory the directory to lock as a profile directory. atempdirectory the directory to lock as a profile temporary directory. return value an nsiprofilelock object representing the locked directory. see also profile management nsitoolkitprofile nsiprofilelock ...
nsITransport
oid close(in nsresult areason); nsiinputstream openinputstream(in unsigned long aflags, in unsigned long asegmentsize, in unsigned long asegmentcount); nsioutputstream openoutputstream(in unsigned long aflags, in unsigned long asegmentsize, in unsigned long asegmentcount); void seteventsink(in nsitransporteventsink asink, in nsieventtarget aeventtarget); constants open flags. ...
...void close( in nsresult areason ); parameters areason the reason for closing the stream. ...
...tream. this interface allows the consumer of the stream to be notified when the stream can again be read. open_unbuffered if specified, the resulting stream may not support readsegments. readsegments is only guaranteed to be implemented when this flag is not specified. asegmentsize if open_unbuffered is not set, then this parameter specifies the size of each buffer segment (pass 0 to use default value). asegmentcount if open_unbuffered is not set, then this parameter specifies the maximum number of buffer segments (pass 0 to use default value). return value openoutputstream() open an output stream on this transport. nsioutputstream openoutputstream( in unsigned long aflags, in unsigned long asegmentsize, in unsigned long asegmentcount ); parameters aflags optional transport specific ...
...r of the stream to be notified when the stream can again accept more data. open_unbuffered if specified, the resulting stream may not support writesegments and writefrom. writesegments and writefrom are only guaranteed to be implemented when this flag is not specified. asegmentsize if open_unbuffered is not set, then this parameter specifies the size of each buffer segment (pass 0 to use default value). asegmentcount if open_unbuffered is not set, then this parameter specifies the maximum number of buffer segments (pass 0 to use default value). return value seteventsink() set the transport event sink. void seteventsink( in nsitransporteventsink asink, in nsieventtarget aeventtarget ); parameters asink receives transport layer notifications. aeventtarget indicates the event target to wh...
nsITreeColumns
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 element. nsitreecolumn getcolumnfor( in nsidomelement element ); parameters element a dom element return value a nsitreecolumn for this element. getfirstcolumn() get the first column. nsitreecolumn getfirstcolumn(); parameters none. return value the first nsitreecolumn. getkeycolumn() get the key column. nsitreecolumn...
...for() get the column for a given element. nsitreecolumn getcolumnfor( in nsidomelement element ); parameters element a dom element return value a nsitreecolumn for this element. getfirstcolumn() get the first column. nsitreecolumn getfirstcolumn(); parameters none. return value the first nsitreecolumn. getkeycolumn() get the key column. nsitreecolumn getkeycolumn(); parameters none. return value the key nsitreecolumn. getlastcolumn() get the last column. nsitreecolumn getlastcolumn(); parameters none. return value the last nsitreecolumn. getnamedcolumn() get a column for a given name. nsitreecolumn getnamedcolumn( in astring id ); parameters id a column id return value the nsitreecolumn for this id. getprimarycolumn() get the primary column. nsitreecolumn getprimarycolumn(); param...
...invalidatecolumns() this method is called whenever a treecol is added or removed and the column cache needs to be rebuilt. void invalidatecolumns(); parameters none. ...
...invalidatecolumns() this method is called whenever a treecol is added or removed and the column cache needs to be rebuilt. void invalidatecolumns(); parameters none. ...
nsIURIFixup
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 fro...
... utf-8 to encode the uri instead of the platform character set. fixup_flag_fix_scheme_typos 8 fix common scheme typos. methods createexposableuri() converts an internal uri (for example a wysiwyg uri) into one which we can expose to the user, for example on the url bar. nsiuri createexposableuri( in nsiuri auri ); parameters auri the uri to be converted. return value the converted, exposable uri, as an nsiuri. exceptions thrown ns_error_unknown_protocol when we can not get a protocol handler service for the uri scheme. ns_error_malformed_uri when the exposable portion of auri is malformed. createfixupuri() converts the specified string into a uri, first attempting to correct any errors in the syntax or other vagaries. returns a well formed uri or n...
...auri is malformed. createfixupuri() converts the specified string into a uri, first attempting to correct any errors in the syntax or other vagaries. returns a well formed uri or nsnull if it cannot. nsiuri createfixupuri( in autf8string auritext, in unsigned long afixupflags ); parameters auritext candidate uri. afixupflags flags that govern ways the uri may be fixed up. return value the converted uri. keywordtouri() converts the specified keyword string into a uri. note that it is the caller's responsibility to check whether keywords are enabled and whether akeyword is a sensible keyword. nsiuri keywordtouri( in autf8string akeyword ); parameters akeyword the keyword to convert into a uri. return value the converted uri. getfixupuriinfo() same as createfixu...
... the converted uri. ...
nsIWebBrowser
he browser object. the chrome object may optionally implement nsiwebprogresslistener instead of explicitly calling addwebbrowserlistener() and removewebbrowserlistener() to register a progress listener object. if the implementation does this, it must also implement nsiweakreference. note: the implementation should not refcount the supplied chrome object; it should assume that a non nsnull value is always valid. the embedder must explicitly set this value back to nsnull if the chrome object is destroyed before the browser object. note: nsiinterfacerequestor and nsiweakreference might also need to be implemented by the chrome object. contentdomwindow nsidomwindow the top-level dom window. the embedder may walk the entire dom starting from this value. read only. isa...
...t. the embedder may set this property to their own implementation if they intend to override or prevent how certain kinds of content are loaded. note: if this attribute is set to an object that implements nsisupportsweakreference, the implementation should get the nsiweakreference and hold that. otherwise, the implementation should not refcount this interface; it should assume that a non null value is always valid. in that case, the embedder should explicitly set this value back to null if the parent content listener is destroyed before the browser object. methods addwebbrowserlistener() registers a listener of the type specified by the iid to receive callbacks. the browser stores a weak reference to the listener to avoid any circular dependencies. typically this method will be called...
...d will be called to register an object to receive nsiwebprogresslistener or nsishistorylistener notifications in which case the the iid is that of the interface. void addwebbrowserlistener( in nsiweakreference alistener, in nsiidref aiid ); parameters alistener the listener to be added. aiid the iid of the interface that will be called on the listener as appropriate. return value ns_ok listener was successfully added. ns_error_invalid_arg one of the arguments was invalid or the object did not implement the interface specified by the iid. removewebbrowserlistener() removes a previously registered listener. void removewebbrowserlistener( in nsiweakreference alistener, in nsiidref aiid ); parameters alistener the listener to be removed. ai...
...e arguments was invalid or the object did not implement the interface specified by the iid. removewebbrowserlistener() removes a previously registered listener. void removewebbrowserlistener( in nsiweakreference alistener, in nsiidref aiid ); parameters alistener the listener to be removed. aiid the iid of the interface on the listener that will no longer be called. return value ns_ok listener was successfully added. ns_error_invalid_arg one of the arguments was invalid or the object did not implement the interface specified by the iid. see also nsibasewindow nsicontextmenulistener nsidomwindow nsiembeddingsitewindow nsiinterfacerequestor nsishistorylistener nsitooltiplistener nsiuricontentlistener nsiweakreference nsiwebbrowserchrome nsiweb...
nsIWebNavigation
load_flags_is_refresh 16 this flag specifies that the load should have the semantics of an html meta-refresh tag (that is, that the cache should be bypassed). this flag is only applica...
...s , in nsiuri referrer , in nsiinputstream postdata, in nsiinputstream headers) void reload(in unsigned long reloadflags) void stop(in unsigned long stopflags) constants load flags constant value description load_flags_mask 65535 this flag defines the range of bits that may be specified. load_flags_none 0 this is the default value for the load flags parameter. load_flags_is_refresh 16 this flag specifies that the load should have the semantics of an html meta-refresh tag (that is, that the cache should be bypassed). this flag is only applicable to loaduri. xxx the meaning of this flag is poorly defined. xxx no one uses this, so we should probably deprecate and remove it. load_flags_is_link 32 ...
..., since setting incorrectly can cause us to assume that nothing was actually loaded in this object if the load ends up being handled by an external application. load_flags_allow_popups 32768 this flag specifies that the load should not be subject to popup blocking checks. note for valid load flag combinations look here nsdocshellloadtypes.h stop flags constant value description stop_network 1 this flag specifies that all network activity should be stopped. this includes both active network loads and pending meta-refreshes. stop_content 2 this flag specifies that all content activity should be stopped. this includes animated images, plugins and pending javascript timeouts. stop_all 3 this flag specifies that all...
...iuri the referring uri for the currently loaded uri or null. read only. sessionhistory nsishistory the session history object used by this web navigation instance. methods goback() tells the object to navigate to the previous session history item. when a page is loaded from session history, all content is loaded from the cache (if available) and page state (such as form values and scroll position) is restored. void goback( ); goforward() tells the object to navigate to the next session history item. when a page is loaded from session history, all content is loaded from the cache (if available) and page state (such as form values and scroll position) is restored. void goforward( ); gotoindex() tells the object to navigate to the session history item at a given ...
NS_CStringCopy
« xpcom api reference summary the ns_cstringcopy function copies the value from one nsacstring instance to another. this is a low-level api. #include "nsstringapi.h" nsresult ns_cstringcopy( nsacstring& adeststring, const nsacstring& asrcstring ); parameters adeststring [in] a nsacstring instance to be modified. asrcstring [in] a nsacstring instance containing the new string value. return values the ns_cstringcopy function returns ns_ok if successful. otherwise, it returns an error code. remarks this function is designed to allow the implementation to efficiently assign the same value to two string objects. ...
...see bug 239123 for details. ...
...see bug 239123 for details. ...
... the ns_cstringcopy function returns ns_ok if successful. otherwise, it returns an error code. remarks this function is designed to allow the implementation to efficiently assign the same value to two string objects. the implementation may employ reference counting techniques to optimize this operation. example /* attribute acstring value; */ ns_imethodimp mycomponent::getvalue(nsacstring& avalue) { return ns_cstringcopy(avalue, mvalue); } ns_imethodimp mycomponent::setvalue(const nsacstring& avalue) { return ns_cstringcopy(mvalue, avalue); } history this function was frozen in mozilla 1.7. see bug 239123 for details. see also nsacstring ...
Working with out parameters
following one: [scriptable, uuid(8b5314bc-db01-11d2-96ce-0060b0fb9956)] interface nsitransferable : nsisupports { ... void gettransferdata ( in string aflavor, out nsisupports adata, out unsigned long adatalen ) ; ... } the gettransferdata method takes three parameters, aflavor, adata, and adatalen, and returns nothing. adata and adatalen are marked as out, meaning that they act as "return values" for this method, and are changed during the method call. these are so-called out parameters. usage in order to use such a method from javascript via xpconnect, you have to follow a specific rule. to get at the out parameters, you have to pass in an object. after the call, this object will have a new property called value, which contains the out values. assuming you have an object called transfe...
...llow a specific rule. to get at the out parameters, you have to pass in an object. after the call, this object will have a new property called value, which contains the out values. assuming you have an object called transferable, you would invoke gettransferdata() as follows: var adata = {}; var adatalen = {}; transferable.gettransferdata("text/unicode", adata, adatalen); var data = adata.value; var datalen = adatalen.value; as you can see, after the call to gettransferdata(), the out values are then contained in the value 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: ...
...data(), the out values are then contained in the value 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) { .. .. ...
...contained in the value 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) { .. .. ...
Filelink Providers
p the account will only become enabled once the checkvalidity method for the form returns true. saving custom settings in preferences custom settings for a provider are saved using the preferences api. saving the preferences is handled automatically by the dialog code. ...
...rue. saving custom settings in preferences custom settings for a provider are saved using the preferences api. saving the preferences is handled automatically by the dialog code. providers need only provide an extraargs function in the iframe content which returns an object specifying the name, type, and value to save. the format for the returned object is: { field_name: {type: field_type, value: field_value} } where field_type is "int", "bool", or "char". ...
...roviders need only provide an extraargs function in the iframe content which returns an object specifying the name, type, and value to save. the format for the returned object is: { field_name: {type: field_type, value: field_value} } where field_type is "int", "bool", or "char". for example, the hightail implementation provides the following function: function extraargs() { var usernamevalue = document.getelementbyid("username").value; return { "username": {type: "char", value: usernamevalue}, }; } in this example, the username value is read from the input, and then the specially-crafted object is returned. once this is done, the field is accessible from within the implementation via the preferences api using the key mail.cloud_files.accounts.account_key.username where acc...
... the hightail settings.xhtml and settings.js file have examples of this. management interface once an account has been created, it is manageable from within the preferences dialog, in the attachment pane, in the outgoing tab. ...
Using Objective-C from js-ctypes
oc = sel_registername("alloc"); sending a message once target class and selector are ready, you can send a message. this message can be sent using the objc_msgsend function, and its variants, which are declared in /usr/include/objc/message.h. objc_msgsend function, receives the instance which receives the message, the selector, and variable argument list for the message, returning the returned value from the method. id objc_msgsend(id self, sel op, ...); id is defined as the following, in /usr/include/objc/objc.h, it's also an opaque type. class can be cast into id, so we can pass class returned by objc_getclass. typedef struct objc_object *id; in this example, we send an alloc message without any arguments using the following code. this code returns an allocated nsspeechsynthesizer in...
...h is compatible with id, we can cast it, or just use it as id type (since we don't need to use a different type for each instance, in terms of c). otherwise, the following functions can be used, depending on return type and architecture. objc_msgsend_stret for the method which returns structs on the stack. objc_msgsend_fpret / objc_msgsend_fp2ret for the method which returns floating-point values on the stack. objc_msgsend for the method which returns the value in a register, or returns nothing. for example, [nsspeechsynthesizer isspeaking] returns bool. in this case, bool can be passed through a register, and we can use objc_msgsend. as [nsobject release] returns nothing, we can also use objc_msgsend. nsstring literals another objective-c syntax used is the @"..." literal, which c...
...in fact, here we can use the same definition in all cases, as a minimal case. let objc_msgsend = lib.declare("objc_msgsend", ctypes.default_abi, id, id, sel, "..."); declaring a dedicated function for...
...; let objc_msgsend_void = lib.declare("objc_msgsend", ctypes.default_abi, ctypes.void_t, id, sel, "..."); the first two cases are both integers (including pointer), so we can cast them after receiving the value in pointer type. the third case is void, but we're going to use the same function internally, the only difference is if we need to ignore the returned value or not. in fact, here we can use the same definition in all cases, as a minimal case. let objc_msgsend = lib.declare("objc_msgsend", ctypes.default_abi, id, id, sel, "..."); declaring a dedicated function for bool might be more efficient, directly getting the primitive value. let objc_msgsend = lib.declare("objc_msgsend", ctypes.default_abi, ...
Declaring and Using Callbacks
warning: you must store a reference to the callback object as long as the native code might call it. i...
...as the this parameter: function myjscallback() { alert(this.message); }; var receiver = { message: 'hi there!' }; var callback = funcptrtype(myjscallback, receiver); // alerts with 'hi there' when the callback is invoked if three arguments are passed to the callback constructor, the third argument is used as a sentinel value which the callback returns if an exception is thrown. the sentinel value must be convertible to the return type of the callback: function myjscallback() { throw "uh oh"; }; var callback1 = funcptrtype(myjscallback, null, -1); // returns -1 to the native caller when the exception is thrown. warning: you must store a reference to the callback object as long as the native code might call it. if you don't, the gc might collect the relevant data structures, and the b...
... "uh oh"; }; var callback1 = funcptrtype(myjscallback, null, -1); // returns -1 to the native caller when the exception is thrown. warning: you must store a reference to the callback object as long as the native code might call it. if you don't, the gc might collect the relevant data structures, and the browser will crash when native code attempts to invoke your callback. ...
... to the native caller when the exception is thrown. warning: you must store a reference to the callback object as long as the native code might call it. if you don't, the gc might collect the relevant data structures, and the browser will crash when native code attempts to invoke your callback. arguments and return values js-ctypes automatically handles the conversion between javascript and c value representations. before the javascript callback function is invoked, js-ctypes converts the arguments passed by the caller to javascript values. where possible, js-ctypes will convert arguments to primitive types. for arguments of complex types, temporary cdata objects will be created. the return value is converted in a similar manner. ...
Standard OS Libraries
g your own dll (for windows) or so (for linux) file with c functions that can be called from your add-on with js-ctypes. the dll/so/etc file you make must be shipped with your add-on. standard libraries offer the advantage of not having to ship anything. they are already available on the operating system for you. you just need to supply the path to appropriate files and set up the proper types of values/arguments in the js-ctypes code. this article allows you to find out what types to give to values/arguments by supplying links to the documentation of the os libraries. windows windows has many standard os libraries. the most common, found on all windows os version, is "winapi". windows also has the "winapilists" and ".net framework" (i'm not sure if it can be accessed jsctypes but probably). ...
...t probably). a complete list of windows apis can be found at the msdn api index. winapi this is the one that is most commonly used by js-ctypes. this comes shipped by default with all installations of windows operating systems since win98. it's also known as winapi32 or just winapi. a list of all the functions available through this api can be found at the msdn winapi index. for finding out the values and types of arguments and returns of the functions you want to use from this api, you must visit the functions page on this linked msdn site; it will give you all that information. example: getcursorpos i wanted to get the mouse cursor position without using a mousemove listener, as this is a high overhead event listener. so i went to the msdn winapi index page and then went to the "cursors" ...
...if you would like to do stuff off of the main thread, in chromeworker's, then you should use xcb. xcb is ...
...if you would like to do stuff off of the main thread, in chromeworker's, then you should use xcb. xcb is thread safe. resour...
CType
bjects of these types, find out information about them, and so forth. the specific properties and methods on each object vary depending on the data type represented. there are several kinds of types: primitive types these are typical unstructured data, such as the predefined types listed in predefined data types. big integer types the int64 and uint64 types provide access to 64-bit integer values, which javascript doesn't currently support. pointertype these represent pointers to data in memory. functiontype these represent callable c functions. structtype these represent c structures. arraytype these represent c arrays. method overview methods available on all ctype objects ctype array([n]) string tosource() string tostring() properties pro...
..., this is simply the string that was passed to the constructor. for other function, pointer, and array types, this should be a valid c type expression. ptr ctype returns a ctype representing the data type "pointer to this type". this is the result of calling ctypes.pointertype(the_type). read only. size number the size of the type, in bytes. this is the same value as the c sizeof. read only. note: ctypes.void_t.size is undefined. methods available on all ctype objects array() returns a new ctype representing an array of elements of the type on which it was called. ctype array( [n] }; parameters n optional the number of elements in the declared array type. if this parameter is left out, the array's size is indeterminate. return ...
... as the c sizeof. read only. note: ctypes.void_t.size is undefined. methods available on all ctype objects array() returns a new ctype representing an array of elements of the type on which it was called. ctype array( [n] }; parameters n optional the number of elements in the declared array type. if this parameter is left out, the array's size is indeterminate. return value a ctype representing the data type "array of this type". this is the same as calling ctypes.arraytype(the_type[, n]). tosource() returns a javascript expression that evaluates to a ctype describing the same c type as this object. string tosource(); parameters none. return value a javascript expression that evaluates to a ctype describing the same c type as this object. example ctypes.u...
...describing the same c type as this object. string tosource(); parameters none. return value a javascript expression that evaluates to a ctype describing the same c type as this object. example ctypes.uint32_t.tosource() returns "ctypes.uint32_t". tostring() returns a string identifying the type. the format of this string is "type " + name. string tostring(); parameters none. return value a string identifying the data type. see also arraytype functiontype pointertype structtype type conversion ...
Mozilla
the documents below cover the ways in which we do so. add-ons add-ons allow developers to extend and modify the functionality of firefox. adding a new css property this page describes how to add a new css property to the style system. the style system is the part of the code in gecko that is responsible for producing a computed value for every property for every element. see the gecko overview for more information about the style system. adding a new event this draft document covers how to add a new event to the mozilla (firefox) source code. adding a new word to the en-us dictionary occasionally bugs are filed pointing out situations where perfe...
... continuous integration systems. cookies in mozilla suggestions as to needed documentation can be directed to mike connor. cookies preferences in mozilla these preferences apply to most mozilla products (including firefox and seamonkey), however they are application-specific, so not all of them may apply to you. the default values given are for firefox 3. creating a firefox sidebar web publishers can offer visitors a firefox sidebar to encourage their engagement. there are two ways to create a sidebar for firefox users: the social api and an extension. you can choose either depending on your needs and resources. creating a language pack ...
...ing mozilla project code. mozilla quirks mode behavior the following is a rough list of the differences that exist between mozilla's standards mode and quirks mode behavior. mozilla style system the style system is the module of mozilla's code responsible for the loading and parsing of css style sheets, and the computation of computed values for all css properties. the handling of those computed values is the responsibility of other parts of the code. mozilla style system documentation see also the style techtalk for more complete although less detailed documentation. mozilla svg project since you have come this far, you probably already know that svg stands f...
...code or an add-on. phishing: a short definition in 2014, the msci estimated an annual global impact of phishing, and various forms of identity theft, to be as high as $5 billion usd. the impact has not improved much since. preferences the preference system makes it possible to store data for mozilla applications using a key/value pairing system. these articles provide information about how to use the preference system. productization guide productization is the choice of ''default'' search engines, content and protocol handlers, bookmarks, links to recommended sites on the in-product pages, etc. the web services that make up the productization of mozilla software are often specif...
Constants - Plugins
nperr_generic_error 1 error with no specific error code occurred. nperr_invalid_instance_error 2 invalid instance passed to the plug-in. nperr_invalid_functable_error 3 function table invalid. nperr_module_load_failed_error 4 loading of plug-in failed. ...
... plug-in and communicator do not match. nperr_invalid_param 9 parameter missing or invalid. nperr_invalid_url 10 url missing or invalid. nperr_file_not_found 11 file missing or invalid. nperr_no_data 12 stream contains no data. nperr_stream_not_seekable 13 seekable stream expected. result codes constant value description npres_done 0 (most common): completed normally; all data was sent to the instance. npres_network_err 1 stream failed due to problems with network, disk i/o, lack of memory, or other problems. npres_user_break 2 user canceled stream directly by clicking the stop button or indirectly by some action such as deleting the instance or initiati...
...nt to the instance. npres_network_err 1 stream failed due to problems with network, disk i/o, lack of memory, or other problems. npres_user_break 2 user canceled stream directly by clicking the stop button or indirectly by some action such as deleting the instance or initiating higher-priority network operations. plug-in version constants constant value description np_version_major 0 major version number; changes with major code release number. np_version_minor 22 minor version number; changes with point release number. version feature constants npvers constant: version feature information value description npvers_has_streamoutput 8 streaming data. npvers_has_notific...
...onnect. npvers_win16_has_liveconnect 9 liveconnect (win16). npvers_68k_has_liveconnect 11 liveconnect (68k). npvers_has_windowless 11 windowless plug-in. npvers_has_xpconnect_scripting 13 plug-in is scriptable using xpconnect. npvers_has_npruntime_scripting 14 plug-in is scriptable using npruntime. npvers_has_form_values 15 nppvformvalue nppvariables are supported. npvers_has_popups_enabled_state 16 the npn_pushpopupsenabledstate() and npn_poppopupsenabledstate() functions are supported. npvers_has_response_headers 17 npstreams have response headers for http streams. npvers_has_npobject_enum 18 the npclass in question has an enumerate field, which lets you enume...
Scripting plugins - Plugins
the browser, and is thus a much stronger and more flexible api.) the information in this section applies to firefox 1.0 and mozilla 1.7.5 and newer versions. how the dom handles scripting the mozilla dom code now checks if a plugin supports this new scriptability api and if it exposes a scriptable object through this new mechanism. mozilla does this by calling the old plugin api call npp_getvalue with the new enumeration value that has been added to the nppvariable enumeration. the new nppvariable enumeration is defined in npapi.h as: nppvpluginscriptablenpobject = 15 threading model this api is not designed to be thread safe. the threading model for this api is such that all calls through this api are synchronous and calls from a plugin to methods in this api must come from the thre...
...loaded code from other origins. this way such code can be executed with only the privileges of the origin of the code, and not the privileges of the plugin page's origin. what's in the plugin code? a plugin that wishes to be scriptable using this new mechanism needs to return the appropriate npobject (which is created by calling npn_createobject) when the browser requests it by calling: npp_getvalue(npp, nppvpluginscriptablenpobject, ...); accessing browser objects from a plugin a plugin that wishes to access objects in the browser window that loaded the plugin can do this by getting the npobject for the browser's window object, or the dom element that loaded the plugin. this is done by using an extension to npn_getvalue. the extensions are two additions to the npnvariables enumeration; t...
...ugin that wishes to access objects in the browser window that loaded the plugin can do this by getting the npobject for the browser's window object, or the dom element that loaded the plugin. this is done by using an extension to npn_getvalue. the extensions are two additions to the npnvariables enumeration; the new enumerations are npnvwindownpobject and npnvpluginelementnpobject. calling npn_getvalue() with either of those new enumerations will return an npobject representing the browser object, and from there, the functions in this api can be used to get and set properties, and to call methods on those browser objects. and as always when working with reference counted npobjects, the caller is responsible for calling npn_releaseobject on the npobject to drop the reference. the new npnvariab...
...= 16 how to call plugin native methods the following html code will do the job: <embed type="application/plugin-mimetype"> <script> var embed = document.embeds[0]; embed.nativemethod(); alert(embed.nativeproperty); embed.nativeproperty.anothernativemethod(); </script> the api extensions the api extensions are based on four new structs: npstring npvariant npn_releasevariantvalue npn_getstringidentifier npn_getstringidentifiers npn_getintidentifier npn_identifierisstring npn_utf8fromidentifier npn_intfromidentifier npobject npn_construct (since firefox 3.0b1) npn_createobject npn_retainobject npn_releaseobject npn_invoke npn_invokedefault npn_enumerate (since mozilla 1.9a1) npn_evaluate npn_getproperty npn_setproper...
Streams - Plugins
e the plug-in returns from this method, the browser deletes the npstream object. the plug-in can terminate the stream itself by calling npn_destroystream. you should delete any private data allocated in the plug-in's stream->pdata field when you destroy a stream. the plug-in can store private data associated with the stream in stream->pdata. ...
... npres_user_break: the user canceled the stream directly by clicking the stop button or indirectly by some action, such as by deleting the instance or initiating higher-priority network operations. ...
... data to the instance as it can handle at one time, and it helps both the browser and the plug-in to use their resources efficiently. after a call to npp_newstream, in which the plug-in requested a normal-mode stream, the browser delivers the data in the stream progressively in a series of calls to npp_writeready and npp_write. the browser calls npp_writeready before each call to npp_write. the value returned by npp_writeready indicates how many bytes the plug-in instance can accept for this stream. if the plug-in allocates memory for the entire stream at once, it can return a large number. this number tells the browser that it can pass as much data to the instance as possible in a single call to npp_write. the browser can write a smaller amount of data if desired or necessary (for example, i...
... by calling the npn_destroystream function. nperror npn_newstream(npp instance, npmimetype type, const char* target, npstream** stream); the instance parameter is the plug-in instance that is creating the stream; the type specifies the mime type of the stream. the target parameter specifies the window or frame. for the possible values of named targets, see the reference entry for npn_newstream. the target should not be the same window. the stream parameter represents the stream that the browser creates. for an example that demonstrates using this function with npn_write and npn_destroystream, see "example of sending a stream." pushing data into the stream after creating a stream with npn_newstream, the plug-in can call np...
Gecko Plugin API Reference - Plugins
ethods in the plug-in api that are available from the plug-in object. the names of all of these methods begin with npp_ to indicate that they are implemented by the plug-in and called by the browser. for an overview of how these two sides of the plug-in api interact, see the how plug-ins work and overview of plug-in structure sections in the introduction. npp_destroy npp_destroystream npp_getvalue np_getvalue npp_handleevent np_initialize npp_new npp_newstream npp_print npp_setvalue npp_setwindow np_shutdown npp_streamasfile npp_urlnotify npp_write npp_writeready browser side plug-in api this chapter describes methods in the plug-in api that are available from the browser. the names of all of these methods begin with npn_ to indicate that they are implemented by the brows...
...ream. npn_forceredraw forces a paint message for a windowless plug-in. npn_getauthenticationinfo this function is called by plug-ins to get http authentication information from the browser. npn_geturl asks the browser to create a stream for the specified url. npn_geturlnotify requests creation of a new stream with the contents of the specified url; gets notification of the result. npn_getvalue allows the plug-in to query the browser for information. npn_getvalueforurl provides information to a plug-in which is associated with a given url, for example the cookies or preferred proxy. npn_invalidaterect invalidates specified drawing area prior to repainting or refreshing a windowless plug-in. npn_invalidateregion invalidates specified drawing region prior to repainting or refreshin...
...-in was initiated). npn_poppopupsenabledstate pops the popups-enabled state. npn_posturl posts data to a url. npn_posturlnotify posts data to a url, and receives notification of the result. npn_pushpopupsenabledstate pushes the popups-enabled state. npn_reloadplugins reloads all plug-ins in the plugins directory. npn_requestread requests a range of bytes for a seekable stream. npn_setvalue sets windowless plug-in as transparent or opaque. npn_setvalueforurl allows a plug-in to change the stored information associated with a url, in particular its cookies. npn_status displays a message on the status line of the browser window. npn_useragent returns the browser's user agent field. npn_version returns version information for the plug-in api. npn_write pushes data into a str...
...version information for the plug-in api. npn_write pushes data into a stream produced by the plug-in and consumed by the browser. ...
Set a breakpoint - Firefox Developer Tools
there are many different types of breakpoint that can be set in the debugger; this article covers standard (unconditional) breakpoints and conditional breakpoints. breakpoints in brief breakpoints are very useful when debugging javascript — you basically set a point in your code where you would like execution of the code to pause. at this point you can do useful things like studying the value of different variables at that point, allowing you to work out why a problem is occurring. the source pane context menu in the source pane, you can handle setting breakpoints by bringing up the context menu over a line number. there are a few options available here: add breakpoint: add a standard unconditional breakpoint at this line number (see below). add condition: add a condition and crea...
...ring. the source pane context menu in the source pane, you can handle setting breakpoints by bringing up the context menu over a line number. there are a few options available here: add breakpoint: add a standard unconditional breakpoint at this line number (see below). add condition: add a condition and create a conditional breakpoint (see below). add log: add a log point, which logs a value to your console rather than pausing execution as a breakpoint does. continue to here: when stepping through code, this option tells the debugging to continue execution through to this point. unconditional breakpoints an unconditional breakpoint is one where the code will always pause execution when it is reached. you can set an unconditional breakpoint using the context menu (see above), or b...
...w icon to the left of it. these are called column breakpoints, and allow you to set the breakpoint to happen exactly on any one of the function calls in the line (or multiple calls), by clicking on each relevant one. conditional breakpoints a conditional breakpoint is one where the code will pause execution when it is reached, only if a certain condition is met, such a variable having a certain value at the time. you can set a conditional breakpoint using the context menu (see above), or by highlighting the line you want to break at in the source pane and pressing ctrl + shift + b (windows/linux) or cmd + shift + b (macos). when you first choose to set a conditional breakpoint, a text entry line will appear into which you add the condition you want it to break on: once you've entered your...
...oint, you'll get an option edit condition, which allows you to change the previously set condition. inline variable preview new in firefox 71, the source pane now gives you an inline preview of the variables on each line of code you've stepped through: this is a very useful timesaver when stepping through your code. previously you’d have to scroll through the scopes panel to find variable values, or hover over a variable in the source pane. now when execution pauses, you can view relevant variables immediately. note: there is also a new option in the context menu for the actual code in the source pane — hide inline preview/show inline preview — which allows you to turn the inline variables on/off. ...
UI Tour - Firefox Developer Tools
at a breakpoint, the entire line gets a green overlay. in the screenshot below there are three breakpoints: line 82 has a normal breakpoint and execution is paused here line 85 has a logpoint which logs the contents of tablerow to the console line 100 has a conditional breakpoint the third column shows more information about the breakpoints. for example, the logpoint at line 85 logs the value of the tablerow variable to the console and the conditional breakpoint at line 100 breaks if the contents of the todolist is undefined. toolbar at the top of the right-hand pane, there's a toolbar: the toolbar consists of: four buttons to control the debugger's movement through the script: play/pause (f8): pauses or resumes execution of the script you're debugging. when it displays...
...ettings menu that contains: disable javascript: disables javascript for this tab. this option enables you to see how your web page looks if the user has disabled javascript via an extension or a configuration setting. the setting is reset when the developer tools are closed (except in firefox 77, see bug 1640318). inline variable preview: enabled by default, this option displays variable values within the source pane when the debugger is paused. source maps: enabled by default, this option directs the debugger to load the original versions of files, and map them to the generated ones loaded in a page, to ease debugging of translformed sources. see use a source map for details. breakpoints list under the toolbar, you'll see all the breakpoints you've set. next to each breakpo...
...d sources. see use a source map for details. breakpoints list under the toolbar, you'll see all the breakpoints you've set. next to each breakpoint is a checkbox which you can use to enable/disable it: watch expressions you can add watch expressions in the right pane. they will be evaluated when code execution is paused: variable tooltip hover on a variable show a tooltip with its value inside: call stack when the debugger's paused, you'll see a call stack: each level of the call stack gets a line, with the name of the function and the filename and line number. clicking a line selects the corresponding line in the source pane. note: if you click step over (f10) after changing the selected line in the source pane, the debugger executes until reaching the line following the...
... ...
Migrating from Firebug - Firefox Developer Tools
he style attribute of an element, in firebug you have to right-click into the style side panel and choose edit element style... from the context menu. the devtools display an element {} rule for this purpose, which requires a single click into it to start editing the properties. auto-completion of css as in firebug, the rules view provides an auto-completion for the css property names and their values. a few property values are not auto-completed yet, which is tracked in bug 1337918. copy & paste css firebug's style side panel as well as the devtools' rules side panel provide options within their context menus to copy the css rule or the style declarations. the devtools additionally provide an option to copy the selector of a rule and copy disabled property declarations as commented out. th...
...re in the rules side panel of the devtools, but it is requested in bug 1335327. inspect box model in firebug the box model can be inspected via the layout side panel. in the devtools the box model is part of the computed side panel. both tools highlight the different parts of the box model within the page when hovering them in the box model view. also, both tools allow you to edit the different values inline via a click on them. inspect computed styles the computed values of css properties are displayed within the devtools' computed side panel like within firebug's computed side panel. the difference is that in the devtools the properties are always listed alphabetically and not grouped (see bug 977128) and there is no option to hide the mozilla specific styles, therefore there is an input ...
...inspect cookies but also other kinds of storages like the local and session storage, the cache and indexeddb databases. inspect cookies all cookies related to a website are listed inside the cookies panel in firebug. inside the devtools, the cookies are grouped by domain under the cookies section within the storage inspector. both show pretty much the same information per cookie, i.e. the name, value, domain, path, expiration date and whether the cookie is http-only. the devtools don't show by default whether a cookie is secure, but this can be enabled by right-clicking the table header and checking secure from the context menu. additionally, the devtools allow to display the creation date of a cookie as well as when it was last accessed and whether it is host-only. edit cookies to edit a ...
...cookie as well as when it was last accessed and whether it is host-only. edit cookies to edit a cookie in firebug you have to right-click the cookie and choose edit from the context menu. then a dialog pops up allowing you to edit the data of the cookie and save it. inside the storage inspector you just have to double-click the data you want to edit. then an inline editor allows you to edit the value. delete cookies firebug's cookies panel allows you to delete all cookies of a website via the menu option cookies > remove cookies or by pressing ctrl+shift+o. it also allows you to only remove session cookies via cookies > remove session cookies and to remove single cookies by right-clicking them and choosing delete. the devtools storage inspector allows to remove all cookies and a single one ...
Cookies - Firefox Developer Tools
when you select an origin inside the cookies storage type from the storage tree, all the cookies present for that origin will be listed in a table. the cookies table has the following columns: name — the name of the cookie. value — the value of the cookie. domain — the domain of the cookie. path — the path property of the cookie. expires / max-age — the time when the cookie will expire. if the cookie is a session cookie, the value of this column will be "session" size — the size of the cookie name plus value in bytes. httponly — is this cookie http only? secure — is this cookie a secure cookie? samesite — is this cookie a same-site cookie? same-site cookies allow servers to mitigate the risk of csrf and information leakage attacks by asserting that a particular coo...
...kie? same-site cookies allow servers to mitigate the risk of csrf and information leakage attacks by asserting that a particular cookie should only be sent with requests initiated from the same registrable domain. last accessed — date and time when the cookie was last read. created — date and time when the cookie was created. ...
... context menu the context menu for each cookie includes the following commands: add item - add a new cookie. ...
...ote: some of the columns are not shown by default — to change the column display, right-click on the existing table headings and use the resulting context menu to show/hide the columns. you can edit cookies by double-clicking inside cells in the table widget and editing the values they contain, and add new cookies by clicking the "plus" (+) button and then editing the resulting new row to the value you want. context menu the context menu for each cookie includes the following commands: add item - add a new cookie. delete <cookie name>.<domain> - deletes the selected cookie delete all from <domain> - deletes all cookies from the selected domain. this must be an exact match. for example, if you select "delete all from test8.example.com" only cookies from that domain will be deleted. co...
AbstractRange - Web APIs
_top"><rect x="1" y="1" width="130" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="66" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">abstractrange</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties collapsed read only a boolean value which is true if the range is collapsed. a collapsed range is one whose start position and end position are the same, resulting in a zero-character-long range. endcontainer read only the dom node in which the end of the range, as specified by the endoffset property, is located. endoffset read only an integer value indicating the offset, in characters, from the beginning of the node's conten...
...e start position and end position are the same, resulting in a zero-character-long range. endcontainer read only the dom node in which the end of the range, as specified by the endoffset property, is located. endoffset read only an integer value indicating the offset, in characters, from the beginning of the node's contents to the beginning of the range represented by the range object. this value must be less than the length of the endcontainer node. ...
... methods the abstractrange interface offers no methods. ...
... 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. ...
AddressErrors.country - Web APIs
the text should also include, when possible, advice about how to go about correcting the error. ...
... the text should also include, when possible, advice about how to go about correcting the error. ...
... the text should also include, when possible, advice about how to go about correcting the error. ...
... the text should also include, when possible, advice about how to go about correcting the error. ...
Animation.currentTime - Web APIs
examples in the drink me/eat me game, alice's height is animated so it can go from small to large or large to small. ...
... examples in the drink me/eat me game, alice's height is animated so it can go from small to large or large to small. ...
... examples in the drink me/eat me game, alice's height is animated so it can go from small to large or large to small. ...
... default and defaults to 20us in firefox 59; in 60 it will be 2ms. // reduced time precision (2ms) in firefox 60 animation.currenttime; // 23.404 // 24.192 // 25.514 // ... // reduced time precision with `privacy.resistfingerprinting` enabled animation.currenttime; // 49.8 // 50.6 // 51.7 // ... in firefox, you can also enabled privacy.resistfingerprinting, the precision will be 100ms or the value of privacy.resistfingerprinting.reducetimerprecision.microseconds, whichever is larger. specifications specification status comment web animationsthe definition of 'currenttime' in that specification. working draft ...
AnimationEffect.getComputedTiming() - Web APIs
the getcomputedtiming() method of the animationeffect interface returns the calculated timing properties for this animation effect. although many of the attributes of the returned object are common to the effecttiming contained in the object returned by the animationeffect.gettiming() method, the values returned by this object differ in the following ways: duration returns the calculated value of the iteration duration. ...
...ion effect. although many of the attributes of the returned object are common to the effecttiming contained in the object returned by the animationeffect.gettiming() method, the values returned by this object differ in the following ways: duration returns the calculated value of the iteration duration. if effecttiming.duration is the string auto, this attribute will return 0. fill the auto value is replaced with the appropriate effecttiming.fill value. these values are comparable to the computed styles of an element returned using window.getcomputedstyle(elem). ...
...bject differ in the following ways: duration returns the calculated value of the iteration duration. if effecttiming.duration is the string auto, this attribute will return 0. fill the auto value is replaced with the appropriate effecttiming.fill value. these values are comparable to the computed styles of an element returned using window.getcomputedstyle(elem). syntax 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 millise...
...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 null if the animation is not running or its keyframeeffect isn't associated with an animation. currentiteration the number of times this animation has looped, starting from 0. returns null if the animation is not running or its keyframeeffect isn't associated with an a...
AudioBufferSourceNode - Web APIs
the associated audiobuffer constructor audiobuffersourcenode() creates and returns a new audiobuffersourcenode object. an audiobuffersourcenode can be instantiated using the audiocontext.createbuffersource() method. properties inherits properties from its parent, audionode. audiobuffersourcenode.buffer an audiobuffer that defines the audio asset to be played, or when set to the value null, defines a single channel of silence (in which every sample is 0.0). audiobuffersourcenode.detune is a k-rate audioparam representing detuning of playback in cents. this value is compounded with playbackrate to determine the speed at which the sound is played. its default value is 0 (meaning no detuning), and its nominal range is -∞ to ∞. audiobuffersourcenode.loop a boolean attribut...
... is a k-rate audioparam representing detuning of playback in cents. this value is compounded with playbackrate to determine the speed at which the sound is played. its default value is 0 (meaning no detuning), and its nominal range is -∞ to ∞. audiobuffersourcenode.loop a boolean attribute indicating if the audio asset must be replayed when the end of the audiobuffer is reached. its default value is false. audiobuffersourcenode.loopstart optional a floating-point value indicating the time, in seconds, at which playback of the audiobuffer must begin when loop is true. its default value is 0 (meaning that at the beginning of each loop, playback begins at the start of the audio buffer). audiobuffersourcenode.loopend optional a floating-point number indicating the time, in seconds, at whi...
...h playback of the audiobuffer must begin when loop is true. its default value is 0 (meaning that at the beginning of each loop, playback begins at the start of the audio buffer). audiobuffersourcenode.loopend optional a floating-point number indicating the time, in seconds, at which playback of the audiobuffer stops and loops back to the time indicated by loopstart, if loop is true. the default value is 0. audiobuffersourcenode.playbackrate an a-rate audioparam that defines the speed factor at which the audio asset will be played, where a value of 1.0 is the sound's natural sampling rate. since no pitch correction is applied on the output, this can be used to change the pitch of the sample. this value is compounded with detune to determine the final playback rate. event handlers inherits...
...should clearly explain what is going on. you can also run the code live, or view the source. ...
AudioContext.createMediaStreamSource() - Web APIs
ia instance), the audio from which can then be played and manipulated. for more details about media stream audio source nodes, check out the mediastreamaudiosourcenode reference page. syntax audiosourcenode = audiocontext.createmediastreamsource(stream); parameters stream a mediastream to serve as an audio source to be fed into an audio processing graph for use and manipulation. return value a new mediastreamaudiosourcenode object representing the audio node whose media is obtained from the specified source stream. example in this example, we grab a media (audio + video) stream from navigator.getusermedia, feed the media into a <video> element to play then mute the audio, but then also feed the audio into a mediastreamaudiosourcenode. next, we feed this source audio into a low pas...
...tusermedia, feed the media into a <video> element to play then mute the audio, but then also feed the audio into a mediastreamaudiosourcenode. next, we feed this source audio into a low pass biquadfilternode (which effectively serves as a bass booster), then a audiodestinationnode. the range slider below the <video> element controls the amount of gain given to the lowpass filter — increase the value of the slider to make the audio sound more bass heavy! note: you can see this example running live, or view the source. var pre = document.queryselector('pre'); var video = document.queryselector('video'); var myscript = document.queryselector('script'); var range = document.queryselector('input'); // getusermedia block - grab stream // put it into a mediastreamaudiosourcenode // also output...
... video.muted = true; }; // create a mediastreamaudiosourcenode // feed the htmlmediaelement into it var audioctx = new audiocontext(); var source = audioctx.createmediastreamsource(stream); // create a biquadfilter var biquadfilter = audioctx.createbiquadfilter(); biquadfilter.type = "lowshelf"; biquadfilter.frequency.value = 1000; biquadfilter.gain.value = range.value; // connect the audiobuffersourcenode to the gainnode // and the gainnode to the destination, so we can play the // music and adjust the volume using the mouse cursor source.connect(biquadfilter); biquadfilter.connect(audioctx.destination); // get new mouse pointer coordinates when mouse is mov...
...in.value = range.value; // connect the audiobuffersourcenode to the gainnode // and the gainnode to the destination, so we can play the // music and adjust the volume using the mouse cursor source.connect(biquadfilter); biquadfilter.connect(audioctx.destination); // get new mouse pointer coordinates when mouse is moved // then set new gain value range.oninput = function() { biquadfilter.gain.value = range.value; } }) .catch(function(err) { console.log('the following gum error occured: ' + err); }); } else { console.log('getusermedia not supported on your browser!'); } // dump script to pre element pre.innerhtml = myscript.innerhtml; note: as a consequence of calling createmediastrea...
AudioNode - Web APIs
Web › API › AudioNode
other hand, a destination node has no outputs; instead, all its inputs are directly played back on the speakers (or whatever audio output device the audio context uses). in addition, there are processing nodes which have inputs and outputs. the exact processing done varies from one audionode to another but, in general, a node reads its inputs, does some audio-related processing, and generates new values for its outputs, or simply lets the audio pass through (for example in the analysernode, where the result of the processing is accessed separately). the more nodes in a graph, the higher the latency will be. for example, if your graph has a latency of 500ms, when the source node plays a sound, it will take half a second until that sound can be heard on your speakers (or even longer because of l...
... methods continue to be included in the spec and are not deprecated. properties audionode.context read only returns the associated baseaudiocontext, that is the object representing the processing graph the node is participating in. audionode.numberofinputs read only returns the number of inputs feeding the node. source nodes are defined as nodes having a numberofinputs property with a value of 0. audionode.numberofoutputs read only returns the number of outputs coming out of the node. destination nodes — like audiodestinationnode — have a value of 0 for this attribute. audionode.channelcount represents an integer used to determine how many channels are used when up-mixing and down-mixing connections to any inputs to the node. its usage and precise definition depend on...
.... audionode.numberofoutputs read only returns the number of outputs coming out of the node. destination nodes — like audiodestinationnode — have a value of 0 for this attribute. audionode.channelcount represents an integer used to determine how many channels are used when up-mixing and down-mixing connections to any inputs to the node. its usage and precise definition depend on the value of audionode.channelcountmode. audionode.channelcountmode represents an enumerated value describing the way channels must be matched between the node's inputs and outputs. ...
... to determine how many channels are used when up-mixing and down-mixing connections to any inputs to the node. its usage and precise definition depend on the value of audionode.channelcountmode. audionode.channelcountmode represents an enumerated value describing the way channels must be matched between the node's inputs and outputs. audionode.channelinterpretation represents an enumerated value describing the meaning of the channels. this interpretation will define how audio up-mixing and down-mixing will happen. the possible values are "speakers" or "discrete". methods also implements methods from the interface eventtarget. audionode.connect() allows us to connect the output of this node to be input into another node, either as audio data or as the value of an audioparam. audi...
AudioWorkletNodeOptions - Web APIs
options when constructing a new audioworkletnode object for custom audio processing. it is only used when calling the audioworkletnode() constructor. during internal instantiation of the underlying audioworkletprocessor, the the structured clone algorithm is applied to the options object and the result is passed into audioworkletprocessor's constructor. properties numberofinputs optional the value to initialize the numberofinputs property to. defaults to 1. numberofoutputs optional the value to initialize the numberofoutputs property to. defaults to 1. outputchannelcount optional an array defining the number of channels for each output. for example, outputchannelcount: [n, m] specifies the number of channels in the first output to be n and the second output to be m. the array length mu...
... 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. ...
...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 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 le...
...sn'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 the current setting of the audionode property channelcountmode. otherwise, if outputchannelcount is provided and if the values of numberofinputs and numberofoutputs are both 1, the audio worklet node's channel count is set to the value of outputchannelcount. otherwise, the channel count of each channel in the set of output channels is set to match the corresponding value in the outputchannelcount array. examples // fill in example snippet specifications specification status comment web audio ...
AudioWorkletProcessor() - Web APIs
ly internally by the creation of an associated audioworkletnodes. var processor = new audioworkletprocessor(options); parameters options an object that is passed as options parameter to audioworkletnode constructor and passed through the structured clone algorithm. the object is based on audioworkletnodeoptions dictionary. available properties are as follows: numberofinputs optional the value to initialize the numberofinputs property to. defaults to 1. numberofoutputs optional the value to initialize the numberofoutputs property to. defaults to 1. outputchannelcount optional an array defining the number of channels for each output. for example, outputchannelcount: [n, m] specifies the number of channels in the first output to be n and the second output to be m. the array length mu...
...nal 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. ...
...atch 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 default values for the first two properties, so even if there are no options object passed to the audioworkletnode constructor, the options object passed by the node to the audioworkletprocessor constructor will exist and at minimum have numberofinputs and numberofoutputs. return value the newly constructed audioworkletprocessor instance. example in this example we pass custom options to the audioworkletn...
...arameters) { return true } } registerprocessor('test-processor', testprocessor) next, in our main script file we'll load the processor, create an instance of audioworkletnode passing it the name of the processor and options object. in the options object we pass processoroptions with a map instance under someusefulvariable key. we don't pass numberofinputs and see how it gets its default value. const audiocontext = new audiocontext() await audiocontext.audioworklet.addmodule('test-processor.js') const testnode = new audioworkletnode(audiocontext, 'test-processor', { processoroptions: { someusefulvariable: new map([[1, 'one'], [2, 'two']]) } }) the console output will be as follows: > 1 // audioworkletnode options.numberofinputs set to default > map(2) {1 => "one", 2 => "two...
BaseAudioContext.createDynamicsCompressor() - Web APIs
tedynamicscompressor() to add compression to an audio track. for a more complete example, have a look at our basic compressor example (view the source code). ...
.... for a more complete example, have a look at our basic compressor example (view the source code). ...
...pressor example (view the source code). ...
...ementaudiosourcenode // feed the htmlmediaelement into it var source = audioctx.createmediaelementsource(myaudio); // create a compressor node var compressor = audioctx.createdynamicscompressor(); compressor.threshold.setvalueattime(-50, audioctx.currenttime); compressor.knee.setvalueattime(40, audioctx.currenttime); compressor.ratio.setvalueattime(12, audioctx.currenttime); compressor.attack.setvalueattime(0, audioctx.currenttime); compressor.release.setvalueattime(0.25, audioctx.currenttime); // connect the audiobuffersourcenode to the destination source.connect(audioctx.destination); button.onclick = function() { var active = button.getattribute('data-active'); if(active == 'false') { button.setattribute('data-active', 'true'); button.innerhtml = 'remove compression'; sou...
BaseAudioContext.createStereoPanner() - Web APIs
which can be used to apply stereo panning to an audio source. it positions an incoming audio stream in a stereo image using a low-cost equal-power panning algorithm. syntax baseaudiocontext.createstereopanner(); returns a stereopannernode. example in our stereopannernode example (see source code) html we have a simple <audio> element along with a slider <input> to increase and decrease pan value. in the javascript we create a mediaelementaudiosourcenode and a stereopannernode, and connect the two together using the connect() method. we then use an oninput event handler to change the value of the stereopannernode.pan parameter and update the pan value display when the slider is moved. moving the slider left and right while the music is playing pans the music across to the left and right ...
...rameter and update the pan value display when the slider is moved. moving the slider left and right while the music is playing pans the music across to the left and right speakers of the output, respectively. ...
...when the slider is moved. moving the slider left and right while the music is playing pans the music across to the left and right speakers of the output, respectively. ...
...lue'); pre.innerhtml = myscript.innerhtml; // create a mediaelementaudiosourcenode // feed the htmlmediaelement into it var source = audioctx.createmediaelementsource(myaudio); // create a stereo panner var pannode = audioctx.createstereopanner(); // event handler function to increase panning to the right and left // when the slider is moved pancontrol.oninput = function() { pannode.pan.setvalueattime(pancontrol.value, audioctx.currenttime); panvalue.innerhtml = pancontrol.value; } // connect the mediaelementaudiosourcenode to the pannode // and the pannode to the destination, so we can play the // music and adjust the panning using the controls source.connect(pannode); pannode.connect(audioctx.destination); specifications specification status comment web aud...
CSS - Web APIs
Web › API › CSS
css.paintworklet secure context provides access to the worklet responsible for all the classes related to painting. methods the css interface is a utility interface and no object of this type can be created: only static methods are defined on it. static methods no inherited static methods. ...
...he worklet responsible for all the classes related to painting. methods the css interface is a utility interface and no object of this type can be created: only static methods are defined on it. static methods no inherited static methods. css.registerproperty() registers custom properties, allowing for property type checking, default values, and properties that do or do not inherit their value. css.supports() returns a boolean indicating if the pair property-value, or the condition, given in parameter is supported. css.escape() can be used to escape a string mostly for use as part of a css selector. css factory functions can be used to return a new cssunitvalue with a value of the parameter number of the units of the name of the factory function method used. css.em(3) // cssun...
... working draft adds the paintworklet static property. css object model (cssom)the definition of 'css' in that specification. ...
... working draft adds the paintworklet static property. css object model (cssom)the definition of 'css' in that specification. ...
CSSStyleDeclaration.setProperty() - Web APIs
the cssstyledeclaration.setproperty() method interface sets a new value for a property on a css style declaration object. syntax style.setproperty(propertyname, value, priority); parameters propertyname is a domstring representing the css property name (hyphen case) to be modified. value optional is a domstring containing the new property value. if not specified, treated as the empty string. note: value must not contain "!important" -- that should be set using the priority parameter. priority optional is a domstring allowing the "important" css priority to be set. if not specified, treated as the empty string. ...
...ty name (hyphen case) to be modified. value optional is a domstring containing the new property value. if not specified, treated as the empty string. note: value must not contain "!important" -- that should be set using the priority parameter. priority optional is a domstring allowing the "important" css priority to be set. if not specified, treated as the empty string. the following values are accepted: string value "important" keyword undefined string empty value "" return value undefined exceptions domexception (nomodificationallowederror): if the property or declaration block is read only. ...
...wing values are accepted: string value "important" keyword undefined string empty value "" return value undefined exceptions domexception (nomodificationallowederror): if the property or declaration block is read only. if priority can be omitted, javascript has a special simpler syntax for setting a css property on a style declaration object: style.csspropertyname = 'value'; examples in this example we have three buttons, which can be pressed to dynamically alter our box paragraph's border, background color, and text color to random values (see the live example at the end of this section). we know that the rule we want to alter to do this is contained inside the second stylesheet applied to the page, so we grab a reference to it using document.stylesheets[1]. we...
.... we then loop through the different rules contained inside the stylesheet, which are contained in the array found at stylesheet.cssrules; for each one, we check whether its cssstylerule.selectortext property is equal to the selector .box p, which indicates it is the one we want. if so, we store a reference to this cssstylerule object in a variable. we then use three functions to generate random values for the properties in question, and update the rule with these values. in each case, this is done with the setproperty() method, for example boxpararule.style.setproperty('border', newborder); html <div class="controls"> <button class="border">border</button> <button class="bgcolor">background</button> <button class="color">text</button> </div> <div class="box"> <p>box</p> </div> css ...
CanvasRenderingContext2D.addHitRegion() - Web APIs
canvas without seeing it. syntax void ctx.addhitregion(options); options the options argument is optional. when provided, it is an object which can contain the following properties: path a path2d object describing the area of the hit region. if not provided, the current path is used. fillrule the algorithm by which to determine if a point is inside or outside the hit region. possible values: nonzero: the non-zero winding rule. default rule. evenodd: the even-odd winding rule. id the id for this hit region to reference it for later use in events, for example. parentid the id of the parent region for cursor fallback and navigation by accessibility tools. cursor the cursor to use when the mouse is over this region (defaults to inherit). inherits the cursor of the paren...
...t the code below to see your changes update live in the canvas. ...
...n the canvas. ...
...* math.pi, false); ctx.fill(); ctx.addhitregion({id: "eyes"}); // mouth ctx.beginpath(); ctx.arc(100, 110, 50, 0, math.pi, false); ctx.stroke();</textarea> var canvas = document.getelementbyid("canvas"); var ctx = canvas.getcontext("2d"); var textarea = document.getelementbyid("code"); var reset = document.getelementbyid("reset"); var edit = document.getelementbyid("edit"); var code = textarea.value; function drawcanvas() { ctx.clearrect(0, 0, canvas.width, canvas.height); eval(textarea.value); } reset.addeventlistener("click", function() { textarea.value = code; drawcanvas(); }); edit.addeventlistener("click", function() { textarea.focus(); }); canvas.addeventlistener("mousemove", function(event){ if(event.region) { alert("ouch, my eye :("); } }); textarea.addeventlis...
CanvasRenderingContext2D.createImageData() - Web APIs
the canvasrenderingcontext2d.createimagedata() method of the canvas 2d api creates a new, blank imagedata object with the specified dimensions. all of the pixels in the new object are transparent black. syntax imagedata ctx.createimagedata(width, height); imagedata ctx.createimagedata(imagedata); parameters width the width to give the new imagedata object. a negative value flips the rectangle around the vertical axis. height the height to give the new imagedata object. a negative value flips the rectangle around the horizontal axis. imagedata an existing imagedata object from which to copy the width and height. the image itself is not copied. return value a new imagedata object with the specified width and height. the new object is filled with transparent black pixels. errors t...
...xsizeerror thrown if either of the width or 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...
...elementbyid('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"></canvas> javascript 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. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const imagedata = ctx.createimagedata(100, 100); // iterate through every pixel for (let i = 0; i < imagedata.data.length; i += 4) { // modify pixel data ...
... of four. the array values associated with each pixel are r (red), g (green), b (blue), and a (alpha), in that order. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const imagedata = ctx.createimagedata(100, 100); // iterate through every pixel for (let i = 0; i < imagedata.data.length; i += 4) { // modify pixel data imagedata.data[i + 0] = 190; // r value imagedata.data[i + 1] = 0; // g value imagedata.data[i + 2] = 210; // b value imagedata.data[i + 3] = 255; // a value } // draw image data to the canvas ctx.putimagedata(imagedata, 20, 20); result more examples for more examples using createimagedata() and the imagedata object, see pixel manipulation with canvas and imagedata.data. specifications specification statu...
CanvasRenderingContext2D.lineWidth - Web APIs
examples changing line width this example draws a line and a rectangle, using a line width of 15 units. ...
... examples changing line width this example draws a line and a rectangle, using a line width of 15 units. ...
... examples changing line width this example draws a line and a rectangle, using a line width of 15 units. ...
... examples changing line width this example draws a line and a rectangle, using a line width of 15 units. ...
CanvasRenderingContext2D.miterLimit - Web APIs
the canvasrenderingcontext2d.miterlimit property of the canvas 2d api sets the miter limit ratio. for more info about miters, see applying styles and color in the canvas tutorial. syntax ctx.miterlimit = value; options value a number specifying the miter limit ratio, in coordinate space units. zero, negative, infinity, and nan values are ignored. the default value is 10.0. examples using the miterlimit property see the chapter applying styles and color in the canvas tutorial for more information. ...
..., in coordinate space units. zero, negative, infinity, and nan values are ignored. the default value is 10.0. examples using the miterlimit property see the chapter applying styles and color in the canvas tutorial for more information. ...
...ity, and nan values are ignored. the default value is 10.0. examples using the miterlimit property see the chapter applying styles and color in the canvas tutorial for more information. ...
...t" /> </div> <textarea id="code" class="playable-code"> ctx.beginpath(); ctx.moveto(0,0); ctx.linewidth = 15; ctx.lineto(100, 100); ctx.stroke();</textarea> var canvas = document.getelementbyid("canvas"); var ctx = canvas.getcontext("2d"); var textarea = document.getelementbyid("code"); var reset = document.getelementbyid("reset"); var edit = document.getelementbyid("edit"); var code = textarea.value; function drawcanvas() { ctx.clearrect(0, 0, canvas.width, canvas.height); eval(textarea.value); } reset.addeventlistener("click", function() { textarea.value = code; drawcanvas(); }); edit.addeventlistener("click", function() { textarea.focus(); }) textarea.addeventlistener("input", drawcanvas); window.addeventlistener("load", drawcanvas); screenshotlive sample specifications ...
CanvasRenderingContext2D.textAlign - Web APIs
"right" the text is right-aligned. "center" the text is centered. ...
... "right" the text is right-aligned. "center" the text is centered. ...
...t" the text is left-aligned. "right" the text is right-aligned. "center" the text is centered. "start" the text is aligned at the normal start of the line (left-aligned for left-to-right locales, right-aligned for right-to-left locales). "end" the text is aligned at the normal end of the line (right-aligned for left-to-right locales, left-aligned for right-to-left locales). the default value is "start". examples general text alignment this example demonstrates the three "physical" values of the textalign property: "left", "center", and "right". html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); canvas.width = 350; const ctx = canvas.getcontext('2d'); const x = canvas.width / 2; ctx.beginpath(); ctx.moveto(x, 0); ctx.lineto(x, canv...
...note that the direction property is manually specified as "ltr", although this is also the default for english-language text. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.font = '30px serif'; ctx.direction = 'ltr'; ctx.textalign = 'start'; ctx.filltext(...
Compositing example - Web APIs
this sample program demonstrates a number of compositing operations. the output looks like this: compositing example this code sets up the global values used by the rest of the program. var canvas1 = document.createelement("canvas"); var canvas2 = document.createelement("canvas"); var gco = [ 'source-over','source-in','source-out','source-atop', 'destination-over','destination-in','destination-out','destination-atop', 'lighter', 'copy','xor', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity' ].reverse(); var gcotext = [ 'this is the default setting and draws new shapes on top of the existing canvas cont...
...', 'the existing canvas content is kept where both the new shape and existing canvas content overlap. everything else is made transparent.', 'the existing content is kept where it doesn\'t overlap the new shape.', 'the existing canvas is only kept where it overlaps the new shape. the new shape is drawn behind the canvas content.', 'where both shapes overlap the color is determined by adding color values.', 'only the new shape is shown.', 'shapes are made transparent where both overlap and drawn normal everywhere else.', 'the pixels are of the top layer are multiplied with the corresponding pixel of the bottom layer. a darker picture is the result.', 'the pixels are inverted, multiplied, and inverted again. a lighter picture is the result (opposite of multiply)', 'a combination of multiply and s...
...yer by the inverted top layer.', 'divides the inverted bottom layer by the top layer, and then inverts the result.', 'a combination of multiply and screen like overlay, but with top and bottom layer swapped.', 'a softer version of hard-light. ...
...fwidth + 6, otop); ctx.fillstyle = gradient; ctx.fill(); ctx.translate(oleft + halfwidth, otop + halfwidth); ctx.rotate(rotate); ctx.translate(-(oleft + halfwidth), -(otop + halfwidth)); } ctx.beginpath(); ctx.fillstyle = "#00f"; ctx.fillrect(15,15,30,30) ctx.fill(); return ctx.canvas; }; // hsv (1978) = h: hue / s: saturation / v: value color = {}; color.hsv_rgb = function (o) { var h = o.h / 360, s = o.s / 100, v = o.v / 100, r, g, b; var a, b, c, d; if (s == 0) { r = g = b = math.round(v * 255); } else { if (h >= 1) h = 0; h = 6 * h; d = h - math.floor(h); a = math.round(255 * v * (1 - s)); b = math.round(255 * v * (1 - (s * d))); c...
Using channel messaging - Web APIs
when the iframe has loaded, we register an onclick handler for our button and an onmessage handler for messagechannel.port1. finally we transfer messagechannel.port2 to the iframe using the ...
...// listen for messages on port1 port1.onmessage = onmessage; // transfer port2 to the iframe iframe.contentwindow.postmessage('init', '*', [channel.port2]); } // post a message on port1 when the button is clicked function onclick(e) { e.preventdefault(); port1.postmessage(input.value); } // handle messages received on port1 function onmessage(e) { output.innerhtml = e.data; input.value = ''; } we start off by creating a new message channel by using the messagechannel() constructor. when the iframe has loaded, we register an onclick handler for our button and an onmessage handler for messagechannel.port1. finally we transfer messagechannel.port2 to the iframe using the window.postmessage method. let's explore how the iframe.contentwindow.postmessage line works in a bit more d...
...this example it is set to 'init'. the origin the message is to be sent to. * means "any origin". an object, the ownership of which is transferred to the receiving browsing context. in this case, we are transferring messagechannel.port2 to the iframe, so it can be used to communicate with the main page. when our button is clicked, we prevent the form from submitting as normal and then send the value entered in our text input to the iframe via the messagechannel. receiving the port and message in the iframe over in the iframe, we have the following javascript: var list = document.queryselector('ul'); var port2; // listen for the initial port transfer message window.addeventlistener('message', initport); // setup the transferred port function initport(e) { port2 = e.ports[0]; port2.on...
...t a confirmation message back to the main page via the message channel by calling messageport.postmessage on messagechannel.port2 that was initially transferred to the iframe. receiving the confirmation in the main page returning to the main page, let's now look at the onmessage handler function. // handle messages received on port1 function onmessage(e) { output.innerhtml = e.data; input.value = ''; } when a message is received back from the iframe confirming that the original message was received successfully, this simply outputs the confirmation to a paragraph and empties the text input ready for the next message to be sent. specifications specification status comment html living standardthe definition of 'channel messaging' in that specification. living...
Console.countReset() - Web APIs
o 0. examples for example, given code like this: let user = ""; function greet() { console.count(); return "hi " + user; } user = "bob"; greet(); user = "alice"; greet(); greet(); console.count(); console.countreset(); console output will look something like this: "default: 1" "default: 2" "default: 3" "default: 4" "default: 0" note that the call to console.counterreset() resets the value of the default counter to zero. if we pass the user variable as the label argument with the string "bob" to the first invocation of count(), and the string "alice" to the second: let user = ""; function greet() { console.count(user); return "hi " + user; } user = "bob"; greet(); user = "alice"; greet(); greet(); console.countreset("bob"); console.count("alice"); we will see output like t...
... specifications specification status comment console apithe definition of 'console.countreset()' in that specification. living standard initial definition ...
... specifications specification status comment console apithe definition of 'console.countreset()' in that specification. living standard initial definition ...
... specifications specification status comment console apithe definition of 'console.countreset()' in that specification. living standard initial definition ...
DOMPointInit.z - Web APIs
Web › API › DOMPointInit › z
the dompointinit dictionary's z property is used to specify the z-coordinate of a point in 2d or 3d space when either creating or serializing to json a dompoint or dompointreadonly object. typically, a z value of 0 represents the plane of the screen. as the value increases, the point moves outward from the screen toward the user. as the value decreases, the point moves farther from the user, with negative values being behind the screen, receding into the distance. of course, if transforms have been applied, the axes may have changed orientation. ...
.... as the value increases, the point moves outward from the screen toward the user. as the value decreases, the point moves farther from the user, with negative values being behind the screen, receding into the distance. of course, if transforms have been applied, the axes may have changed orientation. syntax var dompointinit = { z: zpos }; dompointinit.z = zpos; var zpos = dompointinit.z; value a double-precision floating-point value indicating the point's z-coordinate. this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity). there are two methods which use dompointinit: the static function dompointreadonly.frompoint() takes an object that complies with dompointinit as its sole input parameter, to specify the co...
...ing-point value indicating the point's z-coordinate. this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity). there are two methods which use dompointinit: the static function dompointreadonly.frompoint() takes an object that complies with dompointinit as its sole input parameter, to specify the coordinates and perspective value of the new point to be created. this method is, by inheritance, also available as dompoint.frompoint(). the dompointreadonly.tojson() method returns a dompointinit object that describes the same point as the original point. by inheritance, this method is also available as dompoint.tojson(). ...
... specifications specification status comment geometry interfaces module level 1the definition of 'z' in that specification. ...
DOMRect - Web APIs
Web › API › DOMRect
s domrect inherits properties from its parent, domrectreadonly. the difference is that they are not read-only anymore. domrectreadonly.x the x coordinate of the domrect's origin. domrectreadonly.y the y coordinate of the domrect's origin. domrectreadonly.width the width of the domrect. domrectreadonly.height the height of the domrect. ...
...rom its parent, domrectreadonly. the difference is that they are not read-only anymore. domrectreadonly.x the x coordinate of the domrect's origin. domrectreadonly.y the y coordinate of the domrect's origin. domrectreadonly.width the width of the domrect. domrectreadonly.height the height of the domrect. ...
...nly.x the x coordinate of the domrect's origin. domrectreadonly.y the y coordinate of the domrect's origin. domrectreadonly.width the width of the domrect. domrectreadonly.height the height of the domrect. ...
...ect's origin. domrectreadonly.y the y coordinate of the domrect's origin. domrectreadonly.width the width of the domrect. domrectreadonly.height the height of the domrect. domrectreadonly.top returns the top coordinate value of the domrect (has the same value as y, or y + height if height is negative.) domrectreadonly.right returns the right coordinate value of the domrect (has the same value as x + width, or x if width is negative.) domrectreadonly.bottom returns the bottom coordinate value of the domrect (has the same value as y + height, or y if height is negative.) domrectreadonly.left returns the left coordinate value of the domrect (has the same value as x, or x + width if width is negative.) methods domrect inherits methods from its parent, domrectreadonly. static m...
DOMTokenList - Web APIs
eturned by element.classlist, htmllinkelement.rellist, htmlanchorelement.rellist, htmlareaelement.rellist, htmliframeelement.sandbox, or htmloutputelement.htmlfor. it is indexed beginning with 0 as with javascript array objects. domtokenlist is always case-sensitive. properties domtokenlist.length read only is an integer representing the number of objects stored in the object. domtokenlist.value a stringifier property that returns the value of the list as a domstring. methods domtokenlist.item(index) returns the item in the list by its index, or undefined if index is greater than or equal to the list's length. domtokenlist.contains(token) returns true if the list contains the given token, otherwise false. domtokenlist.add(token1[, token2[, ...tokenn]]) adds the specified token...
...oken. domtokenlist.supports(token) returns true if a given token is in the associated attribute's supported tokens. domtokenlist.toggle(token [, force]) removes token from the list if it exists, or adds token to the list if it doesn't. returns a boolean indicating whether token is in the list after the operation. ...
...turns a boolean indicating whether token is in the list after the operation. domtokenlist.entries() returns an iterator, allowing you to go through all key/value pairs contained in this object. domtokenlist.foreach(callback [, thisarg]) executes a provided callback function once per domtokenlist element. domtokenlist.keys() returns an iterator, allowing you to go through all keys of the key/value pairs contained in this object. domtokenlist.values() returns an iterator, allowing you to go through all values of the key/value pairs contained in this object. examples in the following simple example, we retrieve the list of classes set on a <p> element as a domtokenlist using element.classlist, add a class using domtokenlist.add(), and then update the node.textcontent of the <p> to equal...
...for example: <span class=" d d e f"></span> let span = document.queryselector("span"); let classes = span.classlist; span.classlist.add("x"); span.textcontent = `span classlist is "${classes}"`; the output looks like this: specifications specification status comment domthe definition of 'domtokenlist' in that specification. living standar...
DataTransfer.dropEffect - Web APIs
the datatransfer.dropeffect property controls the feedback (typically visual) the user is given during a drag and drop operation. it will affect which cursor is displayed while dragging. for example, when the user hovers over a target drop element, the browser's cursor may indicate which type of operation will occur. when the datatransfer object is created, dropeffect is set to a string value. on getting, it returns its current value. on setting, if the new value is one of the values listed below, then the property's current value will be set to the new value and other values will be ignored. for the dragenter and dragover events, dropeffect will be initialized based on what action the user is requesting. how this is determined is platform specific, but typically the user can press modifier ...
...ermined is platform specific, but typically the user can press modifier keys such as the alt key to adjust the desired action. within event handlers for dragenter and dragover events, dropeffect should be modified if a different action is desired than the action that the user is requesting. for the drop and dragend events, dropeffect will be set to the action that was desired, which will be the value dropeffect had after the last dragenter or dragover event. in a dragend event, for instance, if the desired dropeffect is "move", then the data being dragged should be removed from the source. syntax datatransfer.dropeffect; values a domstring representing the drag operation effect. the possible values are: copy a copy of the source item is made at the new location. move an item is mov...
... example this example shows the use of the dropeffect and effectallowed properties. ...
... example this example shows the use of the dropeffect and effectallowed properties. html content <div> <p id="source" ondragstart="dragstart_handler(event);" draggable="true"> select this element, drag it to the drop zone and then release the selection to move the element. ...
DeprecationReportBody - Web APIs
a deprecation report is generated when a deprecated feature (e.g. a deprecated api method) is used on a document being observed by a reportingobserver. properties id a string representing the deprecated feature that generated the report, for example navigatorgetusermedia. this can be used to group reports by deprecated feature. anticipatedremoval a date object (rendered as a string) representing the date when the feature is expected to be removed from the current browser. ...
...we loop over each report using a basic for loop, then iterate over each entry of in the report's body (a deprecationreportbody instance) using a for...in structure, displ...
... specifications specific...
...ody[key]; innerlistitem.textcontent = key + ': ' + keyvalue; innerlist.appendchild(innerlistitem); } } } the reports parameter contains an array of all the reports in the observer's report queue. we loop over each report using a basic for loop, then iterate over each entry of in the report's body (a deprecationreportbody instance) using a for...in structure, displaying each key/value pair inside a list item. specifications specification status comment reporting apithe definition of 'deprecationreportbody' in that specification. editor's draft ...
Using light sensors - Web APIs
ight events give a web application access to a device's ambient light sensor to detect changes in light intensity. how does it work? when the light sensor of the device detects a change in light intensity, the browser is notified of the change and fires a devicelightevent event. the event gives information about the light intensity of the device's environment. ...
...ation about the light intensity of the device's environment. the devicelightevent provides a value attribute with light intensity in lux which is generally treated as shown below. 10 ~ 50 lux : dim environment 100 ~ 1000 lux : normal > 10000 lux : bright it uses the addeventlistener method of the window object. ...
...y of the device's environment. the devicelightevent provides a value attribute with light intensity in lux which is generally treated as shown below. 10 ~ 50 lux : dim environment 100 ~ 1000 lux : normal > 10000 lux : bright it uses the addeventlistener method of the window object. ...
... below. 10 ~ 50 lux : dim environment 100 ~ 1000 lux : normal > 10000 lux : bright it uses the addeventlistener method of the window object. window.addeventlistener("devicelight", function (event) { // read out the lux value var luminosity = event.value; alert(luminosity); }); example: window.addeventlistener('devicelight', function(event) { var bodybg= document.body.style; //event.value is the lux value returned by the sensor on the device if (event.value < 100) { alert('hey, you! you are working in a dark environment'); bodybg.backgroundcolor="lightgrey"; } else { bodybg.backgroundcolor="#fff"; } }); this example shows how the api can actually be used in the wild. if your app contains a lot of white in the ui, it is usually beneficial to the user to change the ui to a da...
DisplayMediaStreamConstraints.video - Web APIs
the displaymediastreamconstraints dictionary's video property is used to configure the video track in the stream returned by getdisplaymedia(). this value may simply be a boolean, where true specifies that a default selection of input source be made (typically the entire display area of the device in use, spanning every screen in a multiple screen configuration). since a video track must always be included, a value of false results in a typeerror exception being thrown. more precise control over the format of the returned video track may be exercised by instead providing a mediatrackconstraints object, which is used to process the video data after obtaining it from the device but prior to adding it to the stream. syntax displaymediastreamconstraints.video = allowvideoflag; displaymediastrea...
...rack may be exercised by instead providing a mediatrackconstraints object, which is used to process the video data after obtaining it from the device but prior to adding it to the stream. syntax displaymediastreamconstraints.video = allowvideoflag; displaymediastreamconstraints.video = mediatrackconstraints; displaymediastreamconstraints = { video: allowvideoflag | mediatrackconstraints; } value the value may be either a boolean or a mediatrackconstraints object. if a boolean is specified, a value of true (the default) indicates that the stream returned by getdisplaymedia() should be in whatever format the user agent feels is best. a value of false is not permitted and will throw a typeerror. if a mediatrackconstraints object is given instead, the video track will be processed to matc...
... to screen sharing these constraints apply to mediatrackconstraints objects specified as part of the displaymediastreamconstraints object's video property when using getdisplaymedia() to obtain a stream for screen sharing. cursor a constraindomstring which specifies whether or not to include the mouse cursor in the generated track, and if so, whether or not to hide it while not moving. the value may be a single one of the following strings, or an array of them to allow the browser flexibility in deciding what to do about the cursor. always the mouse is always visible in the video content of the {domxref("mediastream"), unless the mouse has moved outside the area of the content. motion the mouse cursor is always included in the video if it's moving, and for a short time after i...
...he windows of the application chosen by the user rendered into the one video track. browser the stream contains the contents of a single browser tab selected by the user. monitor the stream's video track contains the entire contents of one or more of the user's screens. window the stream contains a single window selected by the user for sharing. logicalsurface a constrainboolean value which may contain a single boolean value or a set of them, indicating whether or not to allow the user to choose source surfaces which do not directly correspond to display areas. these may include backing buffers for windows to allow capture of window contents that are hidden by other windows in front of them, or buffers containing larger documents that need to be scrolled through to see the ent...
Document.createElement() - Web APIs
in an html document, the document.createelement() method creates the html element specified by tagname, or an htmlunknownelement if tagname isn't recognized. syntax let element = document.createelement(tagname[, options]); parameters tagname a string that specifies the type of element to be created. the nodename of the created element is initialized with the value of tagname. ...
... examples basic example this creates a new <div> and inserts it before the element with the id "div1". ...
... examples basic example this creates a new <div> and inserts it before the element with the id "div1". ...
...structor definition left out for brevity ... } } // define the new element customelements.define('expanding-list', expandinglist, { extends: "ul" }); if we wanted to create an instance of this element programmatically, we'd use a call along the following lines: let expandinglist = document.createelement('ul', { is : 'expanding-list' }) the new element will be given an is attribute whose value is the custom element's tag name. note: for backwards compatibility with previous versions of the custom elements specification, some browsers will allow you to pass a string here instead of an object, where the string's value is the custom element's tag name. specifications specification status comment domthe definition of 'document.createelement' in that specifi...
Document.forms - Web APIs
Web › API › Document › forms
the forms read-only property of the document interface returns an htmlcollection listing all the <form> elements contained in the document. 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. ...
...nt'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. ...
...ent has no forms, the returned collection is empty, with a length of zero. ...
... <!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="button" onclick="alert(document.forms[2].id);" value="paul's form" /> </form> </body> </html> getting an element from within a form var selectform = document.forms[index]; var selectformelement = document.forms[index].elements[index]; named form access <!doctype html> <html lang="en"> <head> <title>document.forms example</title> </head> <body> <form name="login"> <input name="email" type="email"> <input name="password" type="password...
EffectTiming.easing - Web APIs
the effecttiming dictionary's easing property in the web animations api specifies the timing function used to scale the time to produce easing effects, where easing is the rate of the animation's change over time. element.animate(), keyframeeffectreadonly(), and keyframeeffect() all accept an object of timing properties including easing. the value of easing corresponds directly to animationeffecttimingreadonly.easing in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. syntax var timingproperties = { easing: single-transition-timing-function } timingproperties.easing = single-transition-timing-function value a string defining the timing function to use for easing transitions during the animation process. accepts several pre-def...
...adonly.easing in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. syntax var timingproperties = { easing: single-transition-timing-function } timingproperties.easing = single-transition-timing-function value a string defining the timing function to use for easing transitions during the animation process. accepts several pre-defined domstring values, a steps() timing function like steps(5, end), or a custom cubic-bezier value like cubic-bezier(0.42, 0, 0.58, 1). defaults to linear. available values include: linear a constant rate of change, neither accelerating nor deccelerating. cubic-bezier(<number>, <number>, <number>, <number>) specifies a cubic bézier timing function. the four numbers specify points p1 and p2 of the curve as ...
... ease a decelerated rate of change, going from fast to slow. equivalent to cubic-bezier(0.25, 0.1, 0.25, 1). ease-in an accelerated rate of change, going from slow to fast. equivalent to cubic-bezier(0.42, 0, 1, 1). ease-out another decelerated rate of change, going from fast to slow. ...
...timing function, which breaks the animation down into a number of equal time intervals. the browser flips to a different static frame when each interval is reached, rather than animating smoothly. the first parameter specifies the number of intervals in the function. it must be a positive integer (greater than 0). the second parameter, which is optional, specifies the point at which the change of values occur within the interval. if the second parameter is omitted, it is given the value end. step-start equivalent to steps(1, start) step-end equivalent to steps(1, end). examples in the red queen's race example, we animate alice and the red queen by passing an easing of steps(7, end) to animate(): // define the key frames var spriteframes = [ { transform: 'translatey(0)' }, { transfor...
EffectTiming.fill - Web APIs
Web › API › EffectTiming › fill
the element will continue to be drawn in the state it was in at its last rendered frame. note that authors are discouraged from using fill modes to persist the effect of an animation indefinitely. see the alternatives to fill modes section below for approaches that are simpler and more performant. element.animate(), and keyframeeffect() accept an object of timing properties including fill. ...
...the default is "auto". ...
...y which can lead to confusing behavior. this is because animations take priority in the css cascade over normal author styles. in order to avoid leaking memory when many filling animations overlap, the browser is required to remove overlapped animations which can lead to surprising results in some cases. rather than using fill modes to persist an animation, it is often simpler to set the final value of the animation effect directly in specified style: elem.animate({ transform: 'translatey(100px)' }, 200).finished.then(() => { elem.style.transform = 'translatey(100px)'; }); alternatively, it may be simpler still to set the final value in specified style before triggering the animation and then animate from the start value. this is the approach used in flip animation. elem.style.transfor...
...o set the final value in specified style before triggering the animation and then animate from the start value. this is the approach used in flip animation. elem.style.transform = 'translatey(100px)'; elem.animate({ transform: 'none', offset: 0 }, 200); for some complex effects where animations layer on top of one another, it may be necessary to use a fill mode temporarily to capture the final value of an animation before canceling it. elem.addeventlistener('click', async evt => { const animation = elem.animate( { transform: `translate(${evt.clientx}px, ${evt.clienty}px)` }, { duration: 800, fill: 'forwards' } ); await animation.finished; // commitstyles will record the style up to and including `animation` and // update elem’s specified style with the result. animatio...
EffectTiming.iterationStart - Web APIs
web animations api's effecttiming dictionary's iterationstart property specifies the repetition number which repetition the animation begins at and its progress through it. element.animate(), keyframeeffectreadonly.keyframeeffectreadonly(), and keyframeeffect.keyframeeffect() all accept an object of timing properties including iterationstart. ...
...effect() all accept an object of timing properties including iterationstart. the value of iterationstart corresponds directly to animationeffecttimingreadonly.iterationstart in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. syntax var timingproperties = { iterationstart = iterationnumber }; timingproperties.iterationstart = iterationnumber; value a floating-point value whose value is at least 0 and is not +infinity, indicating the offset into the number of iterations the animation sequence is to run at which to start animating. iterationstart represents the iteration index at which the animation effect begins as well as its progress through that iteration. ...
... timingproperties.iterationstart = iterationnumber; value a floating-point value whose value is at least 0 and is not +infinity, indicating the offset into the number of iterations the animation sequence is to run at which to start animating. iterationstart represents the iteration index at which the animation effect begins as well as its progress through that iteration. usually you'll use a value between 0.0 and 1.0 to indicate an offset into the first run of the animation at which to begin the animation performance, but any positive, non-infinite value is allowed. since all animations' iteration indexes start at 0, a value of 0.5 would start the animation halfway through its first iteration or loop. ...
... as well as its progress through that iteration. usually you'll use a value between 0.0 and 1.0 to indicate an offset into the first run of the animation at which to begin the animation performance, but any positive, non-infinite value is allowed. since all animations' iteration indexes start at 0, a value of 0.5 would start the animation halfway through its first iteration or loop. meanwhile, a value of 1.2 means the animation will begin playback 20% of the way through its second iteration, and so forth. it's currently undefined what happens if you specify a value of iterationstart which is greater than the value of animationeffecttimingproperties.iterations. see issue 170 in the web animations api specification's issue tracker for details and status of any changes to the specification in t...
EffectTiming.iterations - Web APIs
the web animations api dictionary effecttiming's iterations property specifies the number of times the animation should repeat. the default value is 1, indicating that it should only play once, but you can set it to any floating-point value (including positive infinity defaults to 1, and can also take a value of infinity to make it loop infinitely. element.animate(), keyframeeffectreadonly(), and keyframeeffect() all accept an object of timing properties including iterations. the value of iterations corresponds directly to animationeffecttimingreadonly.iterations in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. syntax var timingproperties = { iterations: numberofiterations }; timingproperties.iterations = numberofiterations; ...
...), and keyframeeffect() all accept an object of timing properties including iterations. the value of iterations corresponds directly to animationeffecttimingreadonly.iterations in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. syntax var timingproperties = { iterations: numberofiterations }; timingproperties.iterations = numberofiterations; value a floating-point value specifying the number of times the animation sequence will play through. any value from 0 (don't play the animation at all) to positive infinity (run the animation indefinitely) is supported. defaults to 1, meaning the animation sequence plays through once then stops automatically. ...
...tions = numberofiterations; value a floating-point value specifying the number of times the animation sequence will play through. any value from 0 (don't play the animation at all) to positive infinity (run the animation indefinitely) is supported. defaults to 1, meaning the animation sequence plays through once then stops automatically. exceptions typeerror an attempt was made to set the value of this property to a negative number or nan. the property's value is left unchanged. ...
...definitely) is supported. defaults to 1, meaning the animation sequence plays through once then stops automatically. exceptions typeerror an attempt was made to set the value of this property to a negative number or nan. the property's value is left unchanged. ...
Element.computedStyleMap() - Web APIs
the computedstylemap() method of the element interface returns a stylepropertymapreadonly interface which provides a read-only representation of a css declaration block that is an alternative to cssstyledeclaration. syntax var stylepropertymapreadonly = element.computedstylemap() parameters none. return value a stylepropertymapreadonly interface. examples we start with some simple html: a paragraph with a link, and a definition list to which we will add all the css property / value pairs. <p> <a href="https://example.com">link</a> </p> <dl id="regurgitation"></dl> we add a little bit of css a { --colour: red; color: var(--colour); } we add javascript to grab our link and return back a definition list of all the css property values using computedstylemap(). // get the ele...
...finition list of all the css property values using computedstylemap(). ...
...computed styles with computedstylemap() const allcomputedstyles = myelement.computedstylemap(); // iterate thru the map of all the properties and values, adding a <dt> and <dd> for each for (const [prop, val] of allcomputedstyles) { // properties const cssproperty = document.createelement('dt'); cssproperty.appendchild(document.createtextnode(prop)); styleslist.appendchild(cssproperty); // values const cssvalue = document.createelement('dd'); cssvalue.appendchild(document.createtextnode(val)); styleslist.appendchild(cssvalue); } in browsers that support computedstylemap(), you'll see a list of all the css properties and values. in other browsers you'll just see a link. did you realize how many default css properties a link had? update the 'a' to the 'p', and you'll notice a differ...
...e.appendchild(document.createtextnode(val)); styleslist.appendchild(cssvalue); } in browsers that support computedstylemap(), you'll see a list of all the css properties and values. in other browsers you'll just see a link. did you realize how many default css properties a link had? update the 'a' to the 'p', and you'll notice a difference in the margin-top and margin-bottom default computed values. specifications specification status comment css typed om level 1the definition of 'computedstylemap()' in that specification. working draft initial definition. ...
Element.getBoundingClientRect() - Web APIs
the element.getboundingclientrect() method returns the size of an element and its position relative to the viewport. the element's size is equal to its width/height + padding + border-width in the case that the standard box model is being used, or width/height only if box-sizing: border-box has been set on it. syntax domrect = element.getboundingclientrect(); value the returned value is a domrect object which is the union of the rectangles returned by getclientrects() for the element, i.e., the css border-boxes associated with the element. the result is the smallest rectangle which contains the entire element, with read-only left, top, right, bottom, x, y, width, and height properties describing the overall border-box in pixels. properties other than width and height are relative to the t...
... with a width and height of zero and where the top and left are the top-left of the border-box for the first css box (in content order) for the element. the amount of scrolling that has been done of the viewport area (or any other scrollable element) is taken into account when computing the bounding rectangle. this means that the rectangle's boundary edges (top, right, bottom, left) change their values every time the scrolling position changes (because their values are relative to the viewport and not absolute). if you need the bounding rectangle relative to the top-left corner of the document, just add the current scrolling position to the top and left properties (these can be obtained using window.scrollx and window.scrolly) to get a bounding rectangle which is independent from the current ...
...rple; } let elem = document.queryselector('div'); let rect = elem.getboundingclientrect(); for (var key in rect) { if(typeof rect[key] !== 'function') { let para = document.createelement('p'); para.textcontent = `${ key } : ${ rect[key] }`; document.body.appendchild(para); } } notice how the width/height are equal to the equal to its width/height + padding. also note how the values of x/left, y/top, right, and bottom are equal to the absolute distance from the relevant edge of the viewport to that side of the element, in each case. specifications specification status comment css object model (cssom) view modulethe definition of 'element.getboundingclientrect()' in that specification. working draft initial definition notes the ret...
... as object.keys() will fail. moreover, and unexpectedly, the es2015 and newer features such as object.assign() and object rest/spread will fail to copy returned properties. rect = elt.getboundingclientrect() // the result in emptyobj is {} emptyobj = object.assign({}, rect) emptyobj = { ...rect } {width, ...emptyobj} = rect domrect properties top, left, right, and bottom are computed using the values of the object's other properties. ...
Element.innerHTML - Web APIs
Web › API › Element › innerHTML
e characters (&), (<), or (>), innerhtml returns these characters as the html entities "&amp;", "&lt;" and "&gt;" respectively. use node.textcontent to get a raw copy of these text nodes' contents. to insert the html into the document rather than replace the contents of an element, use the method insertadjacenthtml(). syntax const content = element.innerhtml; element.innerhtml = htmlstring; value a domstring containing the html serialization of the element's descendants. setting the value of innerhtml removes all of the element's descendants and replaces them with nodes constructed by parsing the html given in the string htmlstring. exceptions syntaxerror an attempt was made to set the value of innerhtml using a string which is not properly-formed html. nomodificationallowederror ...
.... the resulting string is returned. let contents = myelement.innerhtml; this lets you look at the html markup of the element's content nodes. note: the returned html or xml fragment is generated based on the current contents of the element, so the markup and formatting of the returned fragment is likely not to match the original page markup. replacing the contents of an element setting the value of innerhtml lets you easily replace the existing contents of an element with new content. for example, you can erase the entire contents of a document by clearing the contents of the document's body attribute: document.body.innerhtml = ""; this example fetches the document's current html markup and replaces the "<" characters with the html entity "&lt;", thereby essentially converting the htm...
...lement with new content. for example, you can erase the entire contents of a document by clearing the contents of the document's body attribute: document.body.innerhtml = ""; this example fetches the document's current html markup and replaces the "<" characters with the html entity "&lt;", thereby essentially converting the html into raw text. this is then wrapped in a <pre> element. ...
...raw text. this is then wrapped in a <pre> element. then the value of innerhtml is changed to this new string. as a result, the document contents are replaced with a display of the page's entire source code. document.documentelement.innerhtml = "<pre>" + document.documentelement.innerhtml.replace(/</g,"&lt;") + "</pre>"; operational details what exactly happens when you set value of innerhtml? doing so causes the user agent to follow these steps: the specified value is parsed as html or xml (based on the document type), resulting in a documentfragment object representing the new set of dom nodes for the new elements. if the element whose contents are being replaced is a <template> element, then the <template> element's content attribute is replaced with the new docume...
Element - Web APIs
Web › API › Element
h provides a read-only representation of a css declaration block that is an alternative to cssstyledeclaration. eventtarget.dispatchevent() dispatches an event to this node in the dom and returns a boolean that indicates whether no handler canceled the event. element.getanimations() returns an array of animation objects currently active on the element. element.getattribute() retrieves the value of the named attribute from the current node and returns it as an object. element.getattributenames() returns an array of attribute names from the current element. element.getattributens() retrieves the value of the attribute with the specified name and namespace, from the current node and returns it as an object. element.getboundingclientrect() returns the size of an element and its positi...
...the pointer to be locked on the given element. element.scroll() scrolls to a particular set of coordinates inside a given element. element.scrollby() scrolls an element by the given amount. element.scrollintoview() scrolls the page until the element gets into the view. element.scrollto() scrolls to a particular set of coordinates inside a given element. element.setattribute() sets the value of a named attribute of the current node. element.setattributens() sets the value of the attribute with the specified name and namespace, from the current node. element.setcapture() sets up mouse event capture, redirecting all mouse events to this element. element.setpointercapture() designates a specific element as the capture target of future pointer events. element.toggleattribute() ...
... full-screen mode. also available via the onfullscreenchange property. fullscreenerror sent to an element if an error occurs while attempting to switch it into or out of full-screen mode. also available via the onfullscreenerror property. keyboard events keydown fired when a key is pressed. also available via the onkeydown property. keypress fired when a key that produces a character value is pressed down. also available via the onkeypress property. keyup fired when a key is released. also available via the onkeyup property. mouse events auxclick fired when a non-primary pointing device button (e.g., any mouse button other than the left button) has been pressed and released on an element. also available via the onauxclick property. click fired when a pointing device ...
...nt' in that specification. living standard added the following methods: closest(), insertadjacentelement() and insertadjacenttext(). moved hasattributes() from the node interface to this one. dom4the definition of 'element' in that specification. obsolete removed the following methods: setidattribute(), setidattributens(), and setidattributenode(). modified the return value of getelementsbytagname() and getelementsbytagnamens(). removed the schematypeinfo property. document object model (dom) level 3 core specificationthe definition of 'element' in that specification. obsolete added the following methods: setidattribute(), setidattributens(), and setidattributenode(). these methods were never implemented and have been removed in later specificatio...
Event - Web APIs
Web › API › Event
vgzoomevent timeevent touchevent trackevent transitionevent uievent userproximityevent webglcontextevent wheelevent constructor event() creates an event object, returning it to the caller. properties event.bubbles read only a boolean indicating whether or not the event bubbles up through the dom. event.cancelbubble a historical alias to event.stoppropagation(). setting its value to true before returning from an event handler prevents propagation of the event. event.cancelable read only a boolean indicating whether the event is cancelable. event.composed read only a boolean indicating whether or not the event can bubble across the boundary between the shadow dom and the regular dom. event.currenttarget read only a reference to the currently registered target for ...
...cates whether or not the call to event.preventdefault() canceled the event. event.eventphase read only indicates which phase of the event flow is being processed. event.explicitoriginaltarget read only the explicit original target of the event (mozilla-specific.) event.originaltarget read only the original target of the event, before any retargetings. (mozilla-specific.) event.returnvalue a historical property introduced by internet explorer and eventually adopted into the dom specification in order to ensure existing sites continue to work. ideally, you should try to use event.preventdefault() and event.defaultprevented instead, but you can use returnvalue if you choose to do so. event.srcelement a non-standard alias (from old versions of microsoft internet explorer) for eve...
... event.srcelement a non-standard alias (from old versions of microsoft internet explorer) for event.target. some other browsers are starting to support it for web compatibility purposes. event.target read only a reference to the target to which the event was originally dispatched. event.timestamp read only the time at which the event was created (in milliseconds). by specification, this value is time since epoch—but in reality, browsers' definitions vary. in addition, work is underway to change this to be a domhighrestimestamp instead. event.type read only the name of the event. case-insensitive. event.istrusted read only indicates whether or not the event was initiated by the browser (after a user click, for instance) or by a script (using an event creation method, like event...
...eners attached to the same element as well as those attached to elements that will be traversed later (during the capture phase, for instance). event.stoppropagation() stops the propagation of events further along in the dom. deprecated methods event.createevent() creates a new event, which must then be initialized by calling its initevent() method. event.initevent() initializes the value of an event created. if the event has already been dispatched, this method does nothing. event.getpreventdefault() returns the value of event.defaultprevented. event.preventbubble() prevents the event from bubbling. use event.stoppropagation instead. event.preventcapture() prevents the event from bubbling. use event.stoppropagation instead. specifications specificati...
FileSystemDirectoryEntry.getDirectory() - Web APIs
web contexts. successcallback optional a method to be called once the filesystemdirectoryentry has been created. the method receives a single parameter: the filesystemdirectoryentry object representing the directory in question. errorcallback optional a method to be called if an error occurs. receives as its sole input parameter a fileerror object describing the error which occurred. return value undefined. errors if an error occurs and an errorcallback was specified, it gets called with a single parameter: a fileerror object describing the error. the fileerror.code specifies what type of error occurred, as follows: fileerror.not_found_err the create option was not specified (or was specified as false), and the directory doesn't exist. fileerror.path_exists_err the create and exc...
...reate optional if this property is true, and the requested file or directory doesn't exist, the user agent should create it. the default is false. the parent directory must already exist. exclusive optional if true, and the create option is also true, the file must not exist prior to issuing the call. instead, it must be possible for it to be created newly at call time. the default is false. ...
...ive optional if true, and the create option is also true, the file must not exist prior to issuing the call. instead, it must be possible for it to be created newly at call time. the default is false. values and results the table below describes the result of each possible combination of these flags depending on whether or not the target file or directory path already exists. option values file/directory condition result create exclusive false n/a[1] path exists and matches the desired type (depending on whether the function called is getfile() or getdirectory() the successcallback is called with a filesystemfileentry if getfile() was called or a filesystemdirectoryentry if getdirectory() was called. false n/a[1] path exists b...
...ssed to the successcallback, as appropriate. true true path exists the errorcallback is called with an appropriate error, such as fileerror.path_exists_err. true true path doesn't exist the file or directory is created, then a filesystemfileentry or a filesystemdirectoryentry is passed to the successcallback, as appropriate. [1] when create is false, the value of exclusive is irrelevant and ignored. example in this example, a function is presented whose job it is to locate within a user's app data directory a json file containing a user dictionary for a specified language, then load that dictionary. let dictionary = null; function loaddictionaryforlanguage(appdatadirentry, lang) { dictionary = null; appdatadirentry.getdirectory("dictionaries",...
FileSystemDirectoryEntry.getFile() - Web APIs
not useful in web contexts. successcallback optional a method to be called once the filesystemfileentry has been created. the method receives a single parameter: the filesystemfileentry object representing the file in question. errorcallback optional a method to be called if an error occurs. receives as its sole input parameter a fileerror object describing the error which occurred. return value undefined. errors if an error occurs and an errorcallback was specified, it gets called with a single parameter: a fileerror object describing the error. the {domxref("fileerror.code")}} specifies what type of error occurred, as follows: fileerror.not_found_err the create option was not specified (or was specified as false), and the file doesn't exist. fileerror.path_exists_err the creat...
...reate optional if this property is true, and the requested file or directory doesn't exist, the user agent should create it. the default is false. the parent directory must already exist. exclusive optional if true, and the create option is also true, the file must not exist prior to issuing the call. instead, it must be possible for it to be created newly at call time. the default is false. ...
...ive optional if true, and the create option is also true, the file must not exist prior to issuing the call. instead, it must be possible for it to be created newly at call time. the default is false. values and results the table below describes the result of each possible combination of these flags depending on whether or not the target file or directory path already exists. option values file/directory condition result create exclusive false n/a[1] path exists and matches the desired type (depending on whether the function called is getfile() or getdirectory() the successcallback is called with a filesystemfileentry if getfile() was called or a filesystemdirectoryentry if getdirectory() was called. false n/a[1] path exists b...
...ssed to the successcallback, as appropriate. true true path exists the errorcallback is called with an appropriate error, such as fileerror.path_exists_err. true true path doesn't exist the file or directory is created, then a filesystemfileentry or a filesystemdirectoryentry is passed to the successcallback, as appropriate. [1] when create is false, the value of exclusive is irrelevant and ignored. example in this example, a function is presented whose job it is to locate within a user's app data directory a json file containing a user dictionary for a specified language, then load that dictionary. let dictionary = null; function loaddictionaryforlanguage(appdatadirentry, lang) { dictionary = null; appdatadirentry.getdirectory("dictionaries",...
FileSystemFlags.exclusive - Web APIs
the exclusive property on the filesystemflags dictionary is used in tandem with the create property to determine whether or not it's acceptable to require that the file not already exist when the reference to it is created by calling filesystemdirectoryentry.getfile() or filesystemdirectoryentry.getdirectory(). ...
... the exclusive property on the filesystemflags dictionary is used in tandem with the create property to determine whether or not it's acceptable to require that the file not already exist when the reference to it is created by calling filesystemdirectoryentry.getfile() or filesystemdirectoryentry.getdirectory(). ...
...quire that the file not already exist when the reference to it is created by calling filesystemdirectoryentry.getfile() or filesystemdirectoryentry.getdirectory(). syntax filesystemflags.exclusive = booleanvalue values the table below describes the result of each possible combination of these flags depending on whether or not the target file or directory path already exists. option values file/directory condition result create exclusive false n/a[1] path exists and matches the desired type (depending on whether the function called is getfile() or getdirectory() the successcallback is called with a filesystemfileentry if getfile() was called or a filesystemdirectoryentry if getdirectory() was called. false n/a[1] path exists b...
...ssed to the successcallback, as appropriate. true true path exists the errorcallback is called with an appropriate error, such as fileerror.path_exists_err. true true path doesn't exist the file or directory is created, then a filesystemfileentry or a filesystemdirectoryentry is passed to the successcallback, as appropriate. [1] when create is false, the value of exclusive is irrelevant and ignored. specifications specification status comment file and directory entries apithe definition of 'filesystemflags' in that specification. draft initial 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 h...
FontFace.display - Web APIs
Web › API › FontFace › display
(see below.) block period the browser invisibly prepares a fallback font. ...
...it's used to display the text and display is complete. swap period if the font face is still not loaded, the fallback font will be shown. when the font face loads, the fallback will be swaped for the downloaded font. failure period if the font face still is not loaded, the fallback font will be shown and no swap will occur. syntax var display = fontface.display fontface.display = display value a cssomstring with one of the following values. 'auto': use the font display strategy provided by the user agent. 'block': gives the font face a short block period and an infinite swap period. the spec recommends 3 seconds for the block period, though this may vary from browser to browser. 'fallback': gives the font face a short block period and a short swap period. the spec recommends 100 ...
...y strategy provided by the user agent. 'block': gives the font face a short block period and an infinite swap period. the spec recommends 3 seconds for the block period, though this may vary from browser to browser. 'fallback': gives the font face a short block period and a short swap period. the spec recommends 100 ms or less for the block period and 3 seconds for the swap period, though these values may vary from browser to browser. 'optional': gives the font face a short block period and no swap period. the spec recommends 100 ms or less, though this may vary from browser to browser. 'swap': gives the font face a 0 second block period and an infinite swap period. specifications specification status comment css font loading module level 3the definition of 'displ...
...er. 'swap': gives the font face a 0 second block period and an infinite swap period. specifications specification status comment css font loading module level 3the definition of 'display' in that specification. working draft initial definition. css fonts module level 4the definition of 'font-display' in that specification. working draft defines the values for the display property. (they are the same as for font-display.) browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox...
FormData() - Web APIs
Web › API › FormData › FormData
the formdata() constructor creates a new formdata object. note: this feature is available in web workers. syntax var formdata = new formdata(form) parameters form optional an html <form> element — when specified, the formdata object will be populated with the form's current keys/values using the name property of each element for the keys and their submitted value for the values. it will also encode file input content. ...
...m optional an html <form> element — when specified, the formdata object will be populated with the form's current keys/values using the name property of each element for the keys and their submitted value for the values. it will also encode file input content. ...
...heir submitted value for the values. it will also encode file input content. ...
...those with a name, not disabled and checked (radio buttons and checkboxes) or selected (one or more options within a select). let myform = document.getelementbyid('myform'); let formdata = new formdata(myform); specifications specification status comment xmlhttprequestthe ...
Using FormData Objects - Web APIs
it is primarily intended for use in sending form data, but can be used independently from forms in order to transmit keyed data. the transmitted data is in the same format that the form's submit() method would use to send the data if the form's encoding type were set to multipart/form-data. ...
...new blob([content], { type: "text/xml"}); formdata.append("webmasterfile", blob); var request = new xmlhttprequest(); request.open("post", "http://foo.com/submitform.php"); request.send(formdata); note: the fields "userfile" and "webmasterfile" both contain a file. the number assigned to the field "accountnum" is immediately converted into a string by the formdata.append() method (the field's value can be a blob, file, or a string: if the value is neither a blob nor a file, the value is converted to a string). this example builds a formdata instance containing values for fields named "username", "accountnum", "userfile" and "webmasterfile", then uses the xmlhttprequest method send() to send the form's data. the field "webmasterfile" is a blob. a blob object represents a file-like object of...
...hod="post" name="fileinfo"> <label>your email address:</label> <input type="email" autocomplete="on" autofocus name="userid" placeholder="email" required size="32" maxlength="64" /><br /> <label>custom file label:</label> <input type="text" name="filelabel" size="12" maxlength="32" /><br /> <label>file to stash:</label> <input type="file" name="file" required /> <input type="submit" value="stash the file!" /> </form> <div></div> then you can send it using code like the following: var form = document.forms.nameditem("fileinfo"); form.addeventlistener('submit', function(ev) { var ooutput = document.queryselector("div"), odata = new formdata(form); odata.append("customfield", "this is some extra data"); var oreq = new xmlhttprequest(); oreq.open("post", "stash.php...
...ch fires the formdata event new formdata(formelem); }); when the formdata event fires we can access the formdata object using formdataevent.formdata, then do what we like with it (below we post it to the server using xmlhttprequest). formelem.addeventlistener('formdata', (e) => { console.log('formdata fired'); // get the form data from the event object let data = e.formdata; for (var value of data.values()) { console.log(value); } // submit the data via xhr let request = new xmlhttprequest(); request.open("post", "/formhandler"); request.send(data); }); note: the formdata event and formdataevent object are available in chrome from version 77 (and other equivalent chromiums), and firefox 72 (first available behind the dom.formdata.event.enabled pref in firefox 71). ...
FormData.append() - Web APIs
Web › API › FormData › append
the append() method of the formdata interface appends a new value onto an existing key inside a formdata object, or adds the key if it does not already exist. the difference between formdata.set and append() is that if the specified key already exists, formdata.set will overwrite all existing values with the new one, whereas append() will append the new value onto the end of the existing set of values. note: this method is available in web workers. syntax there are two versions of this method: a two and a three parameter version: formdata.append(name, value); formdata.append(name, value, filename); parameters name the name of the field whose data is contained in value. value the field's value. this can be a usvstring or blob (including subclasses such as file). if none of these a...
... filename optional the filename reported to the server (a usvstring), when a blob or file is passed as the second parameter. the default filename for blob objects is "blob". ...
...t filename for file objects is the file's filename. note: if you specify a blob as the data to append to the formdata object, the filename that will be reported to the server in the "content-disposition" header used to vary from browser to browser. returns void. example the following line creates an empty formdata object: var formdata = new formdata(); // currently empty you can add key/value pairs to this using formdata.append: formdata.append('username', 'chris'); formdata.append('userpic', myfileinput.files[0], 'chris.jpg'); as with regular form data, you can append multiple values with the same name. for example (and being compatible with php's naming conventions by adding [] to the name): formdata.append('userpic[]', myfileinput.files[0], 'chris1.jpg'); formdata.append('userpi...
...tiple values with the same name. for example (and being compatible with php's naming conventions by adding [] to the name): formdata.append('userpic[]', myfileinput.files[0], 'chris1.jpg'); formdata.append('userpic[]', myfileinput.files[1], 'chris2.jpg'); this technique makes it simpler to process multi-file uploads because the resultant data structure is more conducive to looping. if the sent value is different than string or blob it will be automatically converted to string: formdata.append('name', true); formdata.append('name', 74); formdata.append('name', 'john'); formdata.getall('name'); // ["true", "74", "john"] specifications specification status comment xmlhttprequestthe definition of 'append()' in that specification. living standard initial definit...
FormData.set() - Web APIs
Web › API › FormData › set
the set() method of the formdata interface sets a new value for an existing key inside a formdata object, or adds the key/value if it does not already exist. the difference between set() and formdata.append is that if the specified key does already exist, set() will overwrite all existing values with the new one, whereas formdata.append will append the new value onto the end of the existing set of values. note: this method is available in web workers. syntax there are two versions of this method: a two and a three parameter version: formdata.set(name, value); formdata.set(name, value, filename); parameters name the name of the field whose data is contained in value. value the field's value. this can be a usvstring or blob (including subclasses such as file). if none of these are ...
... filename optional the filename reported to the server (a usvstring), when a blob or file is passed as the second parameter. the default filename for blob objects is "blob". ...
...lob". the default filename for file objects is the file's filename. note: if you specify a blob as the data to append to the formdata object, the filename that will be reported to the server in the "content-disposition" header used to vary from browser to browser. ...
...filename that will be reported to the server in the "content-disposition" header used to vary from browser to browser. example the following line creates an empty formdata object: var formdata = new formdata(); // currently empty you can set key/value pairs on this using formdata.set: formdata.set('username', 'chris'); formdata.set('userpic', myfileinput.files[0], 'chris.jpg'); if the sent value is different than string or blob it will be automatically converted to string: formdata.set('name', 72); formdata.get('name'); // "72" specifications specification status comment xmlhttprequestthe definition of 'set()' in that specification. living standard ...
FormData - Web APIs
Web › API › FormData
it uses the same format a form would use if the encoding type were set to "multipart/form-data". you can also pass it directly to the urlsearchparams constructor if you want to generate query parameters in the way a <form> would do if it were using simple get submission. an object implementing formdata can directly be used in a for...of structure, instead of entries(): for (var p of myformdata) is equivalent to for (var p of myformdata.entries()). note: this feature is available in web workers. ...
... way a <form> would do if it were using simple get submission. an object implementing formdata can directly be used in a for...of structure, instead of entries(): for (var p of myformdata) is equivalent to for (var p of myformdata.entries()). note: this feature is available in web workers. constructor formdata() creates a new formdata object. methods formdata.append() appends a new value onto an existing key inside a formdata object, or adds the key if it does not already exist. formdata.delete() deletes a key/value pair from a formdata object. formdata.entries() returns an iterator allowing to go through all key/value pairs contained in this object. formdata.get() returns the first value associated with a given key from within a formdata object. formdata.getall() returns...
... inside a formdata object, or adds the key if it does not already exist. formdata.delete() deletes a key/value pair from a formdata object. formdata.entries() returns an iterator allowing to go through all key/value pairs contained in this object. formdata.get() returns the first value associated with a given key from within a formdata object. formdata.getall() returns an array of all the values associated with a given key from within a formdata. formdata.has() returns a boolean stating whether a formdata object contains a certain key. formdata.keys() returns an iterator allowing to go through all keys of the key/value pairs contained in this object. formdata.set() sets a new value for an existing key inside a formdata object, or adds the key/value if it does not already exist. f...
...ated with a given key from within a formdata. formdata.has() returns a boolean stating whether a formdata object contains a certain key. formdata.keys() returns an iterator allowing to go through all keys of the key/value pairs contained in this object. formdata.set() sets a new value for an existing key inside a formdata object, or adds the key/value if it does not already exist. formdata.values() returns an iterator allowing to go through all values contained in this object. specifications specification status comment xmlhttprequestthe definition of 'formdata' in that specification. living standard formdata defined in xhr spec ...
FullscreenOptions.navigationUI - Web APIs
the default is "auto". ...
...the default is "auto". ...
...the default is "auto". ...
...n and the entire dimensions of the screen will be allocated to the display of the element. "show" the browser will present page navigation controls and possibly other user interface; the dimensions of the element (and the perceived size of the screen) will be clamped to leave room for this user interface. "auto" the browser will choose which of the above settings to apply. this is the default value. example in this example, the entire document is placed into full-screen mode by calling requestfullscreen() on the document's document.documentelement, which is the document's root <html> element. let elem = document.documentelement; elem.requestfullscreen({ navigationui: "show" }).then({}).catch(err => { alert(`an error occurred while trying to switch into full-screen mode: ${err.message...
Fullscreen API - Web APIs
r which is called when the fullscreenchange event is sent to the element, indicating that the element has been placed into, or removed from, full-screen mode. element.onfullscreenerror an event handler for the fullscreenerror event when sent to an element which has encountered an error while transitioning into or out of full-screen mode. obsolete properties document.fullscreen a boolean value which is true if the document has an element currently being displayed in full-screen mode; otherwise, this returns false. note: use the fullscreenelement property on the document or shadowroot instead; if it's not null, then it's an element currently being displayed in full-screen mode. events the fullscreen api defines two events which can be used to detect when full-screen mode is turned...
...element if an error occurs while attempting to switch it into or out of full-screen mode. dictionaries fullscreenoptions provides optional settings you can specify when calling requestfullscreen(). controlling access the availability of full-screen mode can be controlled using feature policy. the full-screen mode feature is identified by the string "fullscreen", with a default allow-list value of "self", meaning that full-screen mode is permitted in top-level document contexts, as well as to nested browsing contexts loaded from the same origin as the top-most document. see using feature policy to learn more about using feature policy to control access to an api. usage notes users can choose to exit full-screen mode simply by pressing the esc (or f11) key, rather than waiting for the...
...== 13) { togglefullscreen(); } }, false); toggling full-screen mode this code is called by the event handler above when the user hits the enter key. ...
...t.documentelement.requestfullscreen(); } else { if (document.exitfullscreen) { document.exitfullscreen(); } } } this starts by looking at the value of the document's fullscreenelement attribute. in a real-world deployment, at this time, you'll want to check for prefixed versions of this (mozfullscreenelement, msfullscreenelement, or webkitfullscreenelement, for example). if the value is null, the document is currently in windowed mode, so we need to switch to full-screen mode; otherwise, it's the element that's currently in full-screen mode. switching to full-screen mode is done by calling element.requestfullscreen() on the <video> element. if full-screen mode is already active (fullscreenelement is not null), we call exitfullscreen() on the document to shut off full-screen ...
GestureEvent - Web APIs
ng this interface include gesturestart, gesturechange, and gestureend. gestureevent derives from uievent, which in turn derives from event. constructor gestureevent() creates a gestureevent object. properties this interface also inherits properties of its parents, uievent and event. gestureevent.rotation read only change in rotation (in degrees) since the event's beginning. ...
...rechange, and gestureend. gestureevent derives from uievent, which in turn derives from event. constructor gestureevent() creates a gestureevent object. properties this interface also inherits properties of its parents, uievent and event. gestureevent.rotation read only change in rotation (in degrees) since the event's beginning. positive values indicate clockwise rotation; negative values indicate anticlockwise rotation. ...
...from uievent, which in turn derives from event. constructor gestureevent() creates a gestureevent object. properties this interface also inherits properties of its parents, uievent and event. gestureevent.rotation read only change in rotation (in degrees) since the event's beginning. positive values indicate clockwise rotation; negative values indicate anticlockwise rotation. initial value: 0.0 gestureevent.scale read only distance between two digits since the event's beginning. ...
....rotation read only change in rotation (in degrees) since the event's beginning. positive values indicate clockwise rotation; negative values indicate anticlockwise rotation. initial value: 0.0 gestureevent.scale read only distance between two digits since the event's beginning. expressed as a floating-point multiple of the initial distance between the digits at the beginning of the gesture. values below 1.0 indicate an inward pinch (zoom out). values above 1.0 indicate an outward unpinch (zoom in). initial value: 1.0 methods this interface also inherits methods of its parents, uievent and event. gestureevent.initgestureevent() initializes the value of an gestureevent. if the event has already being dispatched, this method does nothing. gesture event types gesturestart gesture...
GlobalEventHandlers.onformdata - Web APIs
the onformdata property of the globaleventhandlers mixin is the eventhandler for processing formdata events, fired after the entry list representing the form's data is constructed. this happens when the form is submitted, but can also be triggered by the invocation of a formdata() constructor. onformdata is available on htmlformelement. syntax target.onformdata = functionref; value functionref is a function name or a function expression. the function receives a formdataevent object as its sole argument. examples // grab reference to form const formelem = document.queryselector('form'); // submit handler formelem.addeventlistener('submit', (e) => { // on form submission, prevent default e.preventdefault(); // construct a formdata object, which fires the formdata event new for...
... living standard ...
... living standard ...
... living standard ...
HTMLButtonElement - Web APIs
oes not accept any clicks. htmlbuttonelement.form read only is a htmlformelement reflecting the form that this button is associated with. if the button is a descendant of a form element, then this attribute is the id of that form element. if the button is not a descendant of a form element, then the attribute can be the id of any form element in the same document it is related to, or the null value if none matches. htmlbuttonelement.formaction is a domstring reflecting the uri of a resource that processes information submitted by the button. if specified, this attribute overrides the action attribute of the <form> element that owns this element. htmlbuttonelement.formenctype is a domstring reflecting the type of content that is used to submit the form to the server. if specified, this a...
...". htmlbuttonelement.name is a domstring representing the name of the object when submitted with a form. html5 if specified, it must not be the empty string. htmlbuttonelement.tabindex is a long that represents this element's position in the tabbing order. htmlbuttonelement.type is a domstring indicating the behavior of the button. this is an enumerated attribute with the following possible values: submit: the button submits the form. this is the default value if the attribute is not specified, html5 or if it is dynamically changed to an empty or invalid value. reset: the button resets the form. button: the button does nothing. menu: the button displays a menu. htmlbuttonelement.willvalidate read only is a boolean indicating whether the button is a candidate for constra...
...ing the localized message that describes the validation constraints that the control does not satisfy (if any). this attribute is the empty string if the control is not a candidate for constraint validation (willvalidate is false), or it satisfies its constraints. htmlbuttonelement.validity read only is a validitystate representing the validity states that this button is in. htmlbuttonelement.value is a domstring representing the current form control value of the button. methods inherits methods from its parent, htmlelement name return type description checkvalidity() boolean not supported for reset or button elements. reportvalidity() boolean not supported for reset or button elements. setcustomvalidity(in domstring error) v...
...-submit-invalid pseudo-class to style submit buttons based on the validation of a form. specifications specification status comment html living standardthe definition of 'htmlbuttonelement' in that specification. living standard html 5.2the definition of 'htmlbuttonelement' in that specification. recommendation the menu attribute and type="menu" value have been removed. html 5.1the definition of 'htmlbuttonelement' in that specification. recommendation the following attribute has been added: menu. the type attribute can take one more value, "menu". html5the definition of 'htmlbuttonelement' in that specification. recommendation the attributes tabindex and accesskey, are now defined on htmlelement. the foll...
HTMLCanvasElement.getContext() - Web APIs
e argument. to get a different drawing context object you need to pass a different contexttype or call the method on a different canvas element. syntax var ctx = canvas.getcontext(contexttype); var ctx = canvas.getcontext(contexttype, contextattributes); parameters contexttype is a domstring containing the context identifier defining the drawing context associated to the canvas. possible values are: "2d", leading to the creation of a canvasrenderingcontext2d object representing a two-dimensional rendering context. "webgl" (or "experimental-webgl") which will create a webglrenderingcontext object representing a three-dimensional rendering context. this context is only available on browsers that implement webgl version 1 (opengl es 2.0). "webgl2" which will create a webgl2renderi...
...to perform anti-aliasing. depth: boolean that indicates that the drawing buffer has a depth buffer of at least 16 bits. failifmajorperformancecaveat: boolean that indicates if a context will be created if the system performance is low or if no hardware gpu is available. powerpreference: a hint to the user agent indicating what configuration of gpu is suitable for the webgl context. possible values are: "default": let the user agent decide which gpu configuration is most suitable. this is the default value. "high-performance": prioritizes rendering performance over power consumption. "low-power": prioritizes power saving over rendering performance. premultipliedalpha: boolean that indicates that the page compositor will assume the drawing buffer contains colors wit...
...h gpu configuration is most suitable. this is the default value. "high-performance": prioritizes rendering performance over power consumption. "low-power": prioritizes power saving over rendering performance. premultipliedalpha: boolean that indicates that the page compositor will assume the drawing buffer contains colors with pre-multiplied alpha. preservedrawingbuffer: if the value is true the buffers will not be cleared and will preserve their values until cleared or overwritten by the author. stencil: boolean that indicates that the drawing buffer has a stencil buffer of at least 8 bits. ...
...ipliedalpha: boolean that indicates that the page compositor will assume the drawing buffer contains colors with pre-multiplied alpha. preservedrawingbuffer: if the value is true the buffers will not be cleared and will preserve their values until cleared or overwritten by the author. stencil: boolean that indicates that the drawing buffer has a stencil buffer of at least 8 bits. return value a renderingcontext which is either a canvasrenderingcontext2d for "2d", webglrenderingcontext for "webgl" and "experimental-webgl", webgl2renderingcontext for "webgl2" or imagebitmaprenderingcontext for "bitmaprenderer". if the contexttype doesn't match a possible drawing context, null is returned. examples given this <canvas> element: <canvas id="canvas" width="300" height="300"></ca...
HTMLElement: beforeinput event - Web APIs
the dom beforeinput event fires when the value of an <input>, <select>, or <textarea> element is about to be modified. the event also applies to elements with contenteditable enabled, and to any element when designmode is turned on. in the case of contenteditable and designmode, the event target is the editing host. if these properties apply to multiple elements, the editing host is the nearest ancestor element whose parent isn't editable. ...
... if these properties apply to multiple elements, the editing host is the nearest ancestor element whose parent isn't editable. ...
...iting host is the nearest ancestor element whose parent isn't editable. bubbles yes cancelable yes interface inputevent event handler property none sync / async sync composed yes default action update the dom element examples this example logs current value of the element immediately before replacing that value with the new one applied to the <input> element. ...
...yes interface inputevent event handler property none sync / async sync composed yes default action update the dom element examples this example logs current value of the element immediately before replacing that value with the new one applied to the <input> element. html <input placeholder="enter some text" name="name"/> <p id="values"></p> javascript const input = document.queryselector('input'); const log = document.getelementbyid('values'); input.addeventlistener('beforeinput', updatevalue); function updatevalue(e) { log.textcontent = e.target.value; } result specifications specification status ui eventsthe definition of 'beforeinput event' in that specification. working draft ...
HTMLInputElement: invalid event - Web APIs
displaying a summary of the problems with a form on submission. when a form is submitted, invalid events are fired at each form control that is invalid. the validity of submittable elements is checked before submitting their owner <form>, or after the checkvalidity() method of the element or its owner <form> is called. it is not checked on blur. examples if a form is submitted with an invalid value, the submittable elements are checked and, if an error is found, the invalid event will fire on the invalid element. in this example, when an invalid event fires because of an invalid value in the input, the invalid value is logged. html <form action="#"> <ul> <li><label>enter an integer between 1 and 10: <input type="number" min="1" max="10" required></label></li> <li><input type="su...
...submittable elements are checked and, if an error is found, the invalid event will fire on the invalid element. in this example, when an invalid event fires because of an invalid value in the input, the invalid value is logged. ...
... living standard html 5.1the definition of 'invalid event' in that specification. ...
...lue is logged. html <form action="#"> <ul> <li><label>enter an integer between 1 and 10: <input type="number" min="1" max="10" required></label></li> <li><input type="submit" value="submit"></li> </ul> </form><p id="log"></p> javascript const input = document.queryselector('input') const log = document.getelementbyid('log') input.addeventlistener('invalid', logvalue) function logvalue(e) { log.textcontent += e.target.value } result specifications specification status comment html living standardthe definition of 'invalid event' in that specification. living standard html 5.1the definition of 'invalid event' in that specification. recommendation html5the definition of 'invalid event' in that specification. re...
HTMLMeterElement - Web APIs
4" stroke-width="2px" /><text x="411" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlmeterelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties also inherits properties from its parent, htmlelement. htmlmeterelement.high a double representing the value of the high boundary, reflecting the high attribute. htmlmeterelement.low a double representing the value of the low boundary, reflecting the lowattribute. htmlmeterelement.max a double representing the maximum value, reflecting the max attribute. htmlmeterelement.min a double representing the minimum value, reflecting the min attribute. htmlmeterelement.optimum a double representing the ...
... htmlmeterelement.labelsread only a nodelist of <label> elements that are associated with the element. methods this interface does not implement any specific methods but inherits methods from its parent, htmlelement. ...
... htmlmeterelement.labelsread only a nodelist of <label> elements that are associated with the element. methods this interface does not implement any specific methods but inherits methods from its parent, htmlelement. ...
... htmlmeterelement.labelsread only a nodelist of <label> elements that are associated with the element. methods this interface does not implement any specific methods but inherits methods from its parent, htmlelement. ...
HTMLParamElement - Web APIs
the htmlparamelement interface provides special properties (beyond those of the regular htmlelement object interface it inherits) for manipulating <param> elements, representing a pair of a key and a value that acts as a parameter for an <object> element. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#...
...="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlparamelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlparamelement.name is a domstring representing the name of the parameter. it reflects the name attribute. ...
..." fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlparamelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlparamelement.name is a domstring representing the name of the parameter. it reflects the name attribute. htmlparamelement.value is a domstring representing the value associated to the parameter. it reflects the value attribute. htmlparamelement.type is a domstring containing the type of the parameter when valuetype has the "ref" value. it reflects the type attribute. htmlparamelement.valuetype is a domstring containing the type of the value. it reflects the valuetype attribute and has one of the values: "data", "ref", or "object". methods no specif...
... methods no specific methods, inherits methods from its parent, htmlelement. specifications specification status comment html living standardthe definition of 'htmlparamelement' in that specification. living standard html5the definition of 'htmlparamelement' in that specification. recommendation the following properties are now obsolete: type, and valuetype. document object model (dom) level 2 html specificationthe definition of 'htmlparamelement' in that specification. obsolete no change from document object model (dom) level 1 specification. document object model (dom) level 1 specificationthe definition of 'htmlparamelement' in that specification. obsolete initial definition. ...
HTMLSelectElement.disabled - Web APIs
tml attribute, which indicates whether the control is disabled. if it is disabled, it does not accept clicks. a disabled element is unusable and un-clickable. ...
...her the control is disabled. if it is disabled, it does not accept clicks. a disabled element is unusable and un-clickable. ...
... is disabled, it does not accept clicks. a disabled element is unusable and un-clickable. ...
...icks. a disabled element is unusable and un-clickable. ...
HTMLSelectElement - Web APIs
flecting the name html attribute, containing the name of this control used by servers and dom search functions. htmlselectelement.optionsread only an htmloptionscollection representing the set of <option> (htmloptionelement) elements contained by this element. htmlselectelement.required a boolean reflecting the required html attribute, which indicates whether the user is required to select a value before submitting the form. htmlselectelement.selectedindex a long reflecting the index of the first selected <option> element. the value -1 indicates no element is selected. htmlselectelement.selectedoptionsread only an htmlcollection representing the set of <option> elements that are selected. htmlselectelement.size a long reflecting the size html attribute, which contains the number of...
...epresenting a localized message that describes the validation constraints that the control does not satisfy (if any). this attribute is the empty string if the control is not a candidate for constraint validation (willvalidate is false), or it satisfies its constraints. htmlselectelement.validityread only a validitystate reflecting the validity state that this control is in. htmlselectelement.value a domstring reflecting the value of the form control. returns the value property of the first selected option element if there is one, otherwise the empty string. htmlselectelement.willvalidateread only a boolean that indicates whether the button is a candidate for constraint validation. it is false if any conditions bar it from constraint validation. methods this interface inherits the me...
...t returns true. htmlselectelement.setcustomvalidity() sets the custom validity message for the selection element to the specified message. use the empty string to indicate that the element does not have a custom validity error. events listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface: input event fires when the value of an <input>, <select>, or <textarea> element has been changed. example get information about the selected option /* assuming we have the following html <select id='s'> <option>first</option> <option selected>second</option> <option>third</option> </select> */ var select = document.getelementbyid('s'); // return the index of the selected option console.log(select.selectedindex)...
...t>, or <textarea> element has been changed. example get information about the selected option /* assuming we have the following html <select id='s'> <option>first</option> <option selected>second</option> <option>third</option> </select> */ var select = document.getelementbyid('s'); // return the index of the selected option console.log(select.selectedindex); // 1 // return the value of the selected option console.log(select.options[select.selectedindex].value) // second a better way to track changes to the user's selection is to watch for the change event to occur on the <select>. this will tell you when the value changes, and you can then update anything you need to. see the example provided in the documentation for the change event for details. specifications ...
HTMLTableRowElement - Web APIs
px" /><text x="396" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmltablerowelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmltablerowelement.align is a domstring containing an enumerated value reflecting the align attribute. it indicates the alignment of the element's contents with respect to the surrounding context. the possible values are "left", "right", and "center". htmltablerowelement.bgcolor is a domstring containing the background color of the cells. it reflects the obsolete bgcolor attribute. htmltablerowelement.cells read only returns a live htmlcollection containing t...
...onal and was not very well supported. htmltablerowelement.choff is 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 htmltablerowelement.ch. this property was optional and was not very well supported. ...
...s; or at the left for right-to-left scripts) of the character defined by htmltablerowelement.ch. this property was optional and was not very well supported. htmltablerowelement.rowindex read only returns a long value which gives the logical position of the row within the entire table. if the row is not part of a table, returns -1. htmltablerowelement.sectionrowindex read only returns a long value which gives the logical position of the row within the table section it belongs to. if the row is not part of a section, returns -1. htmltablerowelement.valign is a domstring representing an enumerated value indicating how the content of the cell must be vertically aligned. it reflects the valign attribute and can have one of the following values: "top", "middle", "bottom", or "baseline". m...
... can have one of the following values: "top", "middle", "bottom", or "baseline". methods inherits methods from its parent, htmlelement. htmltablerowelement.deletecell() removes the cell at the given position in the row. if the given position is greater (or equal as it starts at zero) than the amount of cells in the row, or is smaller than 0, it raises a domexception with the indexsizeerror value. htmltablerowelement.insertcell() inserts a new cell just before the given position in the row. if the given position is not given or is -1, it appends the cell to the row. if the given position is greater (or equal as it starts at zero) than the amount of cells in the row, or is smaller than -1, it raises a domexception with the indexsizeerror value. returns a reference to a htmltablecelleleme...
Headers.set() - Web APIs
Web › API › Headers › set
the set() method of the headers interface sets a new value for an existing header inside a headers object, or adds the header if it does not already exist. the difference between set() and headers.append is that if the specified header already exists and accepts multiple values, set() overwrites the existing value with the new one, whereas headers.append appends the new value to the end of the set of values. for security reasons, some headers can only be controller by the user agent. these headers include the forbidden header names and forbidden response header names. syntax myheaders.set(name, value); parameters name the name of the http header you want to set to a new value. ...
...o the end of the set of values. for security reasons, some headers can only be controller by the user agent. these headers include the forbidden header names and forbidden response header names. syntax myheaders.set(name, value); parameters name the name of the http header you want to set to a new value. if the given name is not the name of an http header, this method throws a typeerror. value the new value you want to set. returns void. ...
...e); parameters name the name of the http header you want to set to a new value. if the given name is not the name of an http header, this method throws a typeerror. value the new value you want to set. returns void. example creating an empty headers object is simple: var myheaders = new headers(); // currently empty you could add a header to this using headers.append, then set a new value for this header using set(): myheaders.append('content-type', 'image/jpeg'); myheaders.set('content-type', 'text/html'); if the specified header does not already exist, set() will create it and set its value to the specified value. ...
...); // currently empty you could add a header to this using headers.append, then set a new value for this header using set(): myheaders.append('content-type', 'image/jpeg'); myheaders.set('content-type', 'text/html'); if the specified header does not already exist, set() will create it and set its value to the specified value. if the specified header does already exist and does accept multiple values, set() will overwrite the existing value with the new one: myheaders.set('accept-encoding', 'deflate'); myheaders.set('accept-encoding', 'gzip'); myheaders.get('accept-encoding'); // returns 'gzip' you'd need headers.append to append the new value onto the values, not overwrite it. specifications specification status comment fetchthe definition of 'set()' in that spec...
IDBCursor.advance() - Web APIs
Web › API › IDBCursor › advance
its position forward. note: this feature is available in web workers. syntax cursor.advance(count); parameters count the number of times to move the cursor forward. exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbcursor's transaction is inactive. typeerror the value passed into the count parameter was zero or a negative number. invalidstateerror the cursor is currently being iterated or has iterated past its end. example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through the records in the object store. here we use cursor.advance(2) to jump 2 places forward each time, mean...
...re we use cursor.advance(2) to jump 2 places forward each time, meaning that only every other result will be displayed. advance() works in a similar way to idbcursor.continue, except that it allows you to jump multiple records at a time, not just always go onto the next record. note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo. for a complete working example, see our idbcursor example (view example live.) function advanceresult() { list.innerhtml = ''; var transaction = db.transaction(['rushalbumlist'], "readonly"); var objectstore = transaction.objectstore('rushalbumlist'); objectstore.opencursor().onsuccess = function(event) { var cursor = event.target.result; if(cursor) { var listitem = d...
... recommendation indexed database api draftthe defin...
... recommendation indexed database api draftthe definition of 'advance()' in that specification...
IDBCursor.delete() - Web APIs
Web › API › IDBCursor › delete
be aware that you can't call delete() (or idbcursor.update()) on cursors obtained from idbindex.openkeycursor(). for such needs, you have to use idbindex.opencursor() instead. note: this feature is available in web workers. ...
... through all the records in the object store. if the albumtitle of the current cursor is "grace under pressure", we delete that entire record using var request = cursor.delete();. the cursor does not require us to select the data based on a key; we can just grab all of it. ...
....value.foo. for a complete working example, see our idbcursor example (view example live.) function deleteresult() { list.innerhtml = ''; var transaction = db.transaction(['rushalbumlist'], 'readwrite'); var objectstore = transaction.objectstore('rushalbumlist'); objectstore.opencursor().onsuccess = function(event) { var cursor = event.target.result; if(cursor) { if(cursor.value.albumtitle === 'grace under pressure') { var request = cursor.delete(); request.onsuccess = function() { console.log('deleted that mediocre album from 1984. ...
...t.target.result; if(cursor) { if(cursor.value.albumtitle === 'grace under pressure') { var request = cursor.delete(); request.onsuccess = function() { console.log('deleted that mediocre album from 1984. even power windows is better.'); }; } else { var listitem = document.createelement('li'); listitem.innerhtml = '<strong>' + cursor.value.albumtitle + '</strong>, ' + cursor.value.year; list.appendchild(listitem); } cursor.continue(); } else { console.log('entries displayed.'); } }; }; specifications specification status comment indexed database api 2.0the definition of 'delete()' in that specification. recommendation indexed database api draftthe defini...
IDBCursor.primaryKey - Web APIs
the primarykey read-only property of the idbcursor interface returns the cursor's current effective key. if the cursor is currently being iterated or has iterated outside its range, this is set to undefined. the cursor's primary key can be any data type. note: this feature is available in web workers. syntax var value = cursor.primarykey; value a value of any data type. example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store. within each iteration we log the primary key of the cursor to the console, something like this (its the album title in each case, which is our primarykey): hemispheres the cursor does not require us to select the data based on a key; we can just grab al...
...ct store. within each iteration we log the primary key of the cursor to the console, something like this (its the album title in each case, which is our primarykey): hemispheres the cursor does not require us to select the data based on a key; we can just grab all of it. also note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo. for a complete working example, see our idbcursor example (view example live.) function displaydata() { var transaction = db.transaction(['rushalbumlist'], "readonly"); var objectstore = transaction.objectstore('rushalbumlist'); objectstore.opencursor().onsuccess = function(event) { var cursor = event.target.result; if(cursor) { var listitem = document.createelement('li...
... recommendation indexed da...
... recommendation indexed database api draftthe definition of...
IDBCursor.source - Web APIs
Web › API › IDBCursor › source
the source read-only property of the idbcursor interface returns the idbobjectstore or idbindex that the cursor is iterating over. this function never returns null or throws an exception, even if the cursor is currently being iterated, has iterated past its end, or its transaction is not active. note: this feature is available in web workers. syntax var source = cursor.source; value the idbobjectstore or idbindex that the cursor is iterating over. example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store. within each iteration we log the source of the cursor, which will log our idbobjectstore object to the console, something like this: idbobjectstore {autoincrement: false, transaction: i...
...o the console, something like this: idbobjectstore {autoincrement: false, transaction: idbtransaction, indexnames: domstringlist, keypath: "albumtitle", name: "rushalbumlist"…} the cursor does not require us to select the data based on a key; we can just grab all of it. also note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo. for a complete working example, see our idbcursor example (view example live.) function displaydata() { var transaction = db.transaction(['rushalbumlist'], "readonly"); var objectstore = transaction.objectstore('rushalbumlist'); objectstore.opencursor().onsuccess = function(event) { var cursor = event.target.result; if(cursor) { var listitem = document.createelement('li...
... recommendation indexed database a...
... recommendation indexed database api draftthe definition of 'source...
IDBIndex.openCursor() - Web APIs
er the specified key range. the method sets the position of the cursor to the appropriate record, based on the specified direction. if the key range is not specified or is null, then the range includes all the records. a success event is always fired on the result object. if at least one record matches the key range, then the result property of the event is set to the new idbcursorwithvalue object; the value of the cursor object is set to a structured clone of the referenced value. if no records match the key range then then the result property of the event is set to null. note: this feature is available in web workers. syntax var request = myindex.opencursor(); var request = myindex.opencursor(range); var request = myindex.opencursor(range, direction); parameters ra...
... var request = myindex.opencursor(); var request = myindex.opencursor(range); var request = myindex.opencursor(range, direction); parameters range optional a key or idbkeyrange to use as the cursor's range. if nothing is passed, this will default to a key range that selects all the records in this object store. direction optional the cursor's direction. see idbcursor constants for possible values. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbindex's transaction is inactive. typeerror the value for the direction parameter is invalid. dataerror ...
...eentry.innerhtml = ''; var transaction = db.transaction(['contactslist'], 'readonly'); var objectstore = transaction.objectstore('contactslist'); var myindex = objectstore.index('lname'); myindex.opencursor().onsuccess = function(event) { var cursor = event.target.result; if(cursor) { var tablerow = document.createelement('tr'); tablerow.innerhtml = '<td>' + cursor.value.id + '</td>' + '<td>' + cursor.value.lname + '</td>' + '<td>' + cursor.value.fname + '</td>' + '<td>' + cursor.value.jtitle + '</td>' + '<td>' + cursor.value.company + '</td>' + '<td>' + cursor.value.email + '</td>' + '<td>' + cursor.val...
....lname + '</td>' + '<td>' + cursor.value.fname + '</td>' + '<td>' + cursor.value.jtitle + '</td>' + '<td>' + cursor.value.company + '</td>' + '<td>' + cursor.value.email + '</td>' + '<td>' + cursor.value.phone + '</td>' + '<td>' + cursor.value.age + '</td>'; tableentry.appendchild(tablerow); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'opencursor()' in that specification. recommendation indexed database api draftthe definition of 'opencursor()' in t...
IDBObjectStore - Web APIs
on objects in this object store. idbobjectstore.keypath read only the key path of this object store. if this attribute is null, the application must provide a key for each modification operation. idbobjectstore.name the name of this object store. idbobjectstore.transaction read only the idbtransaction object to which this object store belongs. idbobjectstore.autoincrement read only the value of the auto increment flag for this object store. methods idbobjectstore.add() returns an idbrequest object, and, in a separate thread, creates a structured clone of the value, and stores the cloned value in the object store. this is for adding new records to an object store. idbobjectstore.clear() creates and immediately returns an idbrequest object, and clears this object store in a sep...
...cts in the object store matching the specified parameter or all objects in the store if no parameters are given. idbobjectstore.index() opens an index from this object store after which it can, for example, be used to return a sequence of records sorted by that index using a cursor. ...
...this is for updating existing records in an object store when the transaction's mode is readwrite. ...
...alue object. used for iterating through an object store by primary key with a cursor. idbobjectstore.openkeycursor() returns an idbrequest object, and, in a separate thread, returns a new idbcursor. used for iterating through an object store with a key. idbobjectstore.put() returns an idbrequest object, and, in a separate thread, creates a structured clone of the value, and stores the cloned value in the object store. this is for updating existing records in an object store when the transaction's mode is readwrite. example this example shows a variety of different uses of object stores, from updating the data structure with idbobjectstore.createindex inside an onupgradeneeded function, to adding a new item to our object store with idbobjectstore.add. for a full working example, se...
ImageData() - Web APIs
]); new imagedata(width, height); parameters array optional a uint8clampedarray containing the underlying pixel representation of the image. if no such array is given, an image with a transparent black rectangle of the 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 1...
...00 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. ...
...ach 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. ...
...ues. 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.length; i += 4) { arr[i + 0] = 0; // r value arr[i + 1] = 190; // g value arr[i + 2] = 0; // b value arr[i + 3] = 255; // a value } // initialize a new imagedata object let imagedata = new imagedata(arr, 200); // draw image data to the canvas ctx.putimagedata(imagedata, 20, 20); result specification specification status comment html living standardthe definition of 'imagedata()' in that specification. living standard initial...
compareVersion - Web APIs
elative pathname, such as plugsin/royalairway/royalsw. note that the registry pathname is not the location of the software on the computer; it is the location of information about the software inside the client version registry. ...
... -4 registryname has a smaller (earlier) major number than version. -3 registryname has a smaller (earlier) minor number than version. -2 registryname has a smaller (earlier) release number than version. -1 registryname has a smaller (earlier) build number than version. ...
...ersion. 0 the version numbers are the same; both objects represent the same version. 1 registryname has a larger (newer) build number than version. 2 registryname has a larger (newer) release number than version. 3 registryname has a larger (newer) minor number than version. 4 registryname has a larger (newer) major number than version. ...
...n. 3 registryname has a larger (newer) minor number than version. 4 registryname has a larger (newer) major number than version. the following constants can be used to check the value returned by compareversion: int major_diff = 4; int minor_diff = 3; int rel_diff = 2; int bld_diff = 1; int equal = 0; in communicator 4.5, the following constants are defined and available for checking the value returned by compareversion: <code>installtrigger.major_diff installtrigger.minor_diff installtrigger.rel_diff installtrigger.bld_diff installtrigger.equal </code> description the compareversion method compares the version of an installed file or package with a specified version. it is often used as a check against which to initiate the installation process. if registryname is not found in the...
IntersectionObserver - Web APIs
constructor intersectionobserver.intersectionobserver() creates a new intersectionobserver object which will execute a specified callback function when it detects that a target element's visibility has crossed one or more thresholds. properties intersectionobserver.root read only the element or document whose bounds are used as the bounding box when testing for intersection. ...
...ctionobserver() creates a new intersectionobserver object which will execute a specified callback function when it detects that a target element's visibility has crossed one or more thresholds. properties intersectionobserver.root read only the element or document whose bounds are used as the bounding box when testing for intersection. ...
...each offset can be expressed in pixels (px) or as a percentage (%). the default is "0px 0px 0px 0px". ...
...offset can be expressed in pixels (px) or as a percentage (%). the default is "0px 0px 0px 0px". intersectionobserver.thresholds read only a list of thresholds, sorted in increasing numeric order, where each threshold is a ratio of intersection area to bounding box area of an observed target. notifications for a target are generated when any of the thresholds are crossed for that target. if no value was passed to the constructor, 0 is used. methods intersectionobserver.disconnect() stops the intersectionobserver object from observing any target. intersectionobserver.observe() tells the intersectionobserver a target element to observe. intersectionobserver.takerecords() returns an array of intersectionobserverentry objects for all observed targets. intersectionobserver.unobserve() ...
KeyboardEvent.initKeyEvent() - Web APIs
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the keyboardevent.initkeyevent() method is used to initialize the value of an event created using document.createevent("keyboardevent"). events initialized in this way must have been created with the document.createevent("keyboardevent") method. initkeyevent() must be called to set the event before it is dispatched. do not use this method anymore, use the keyboardevent() constructor instead. this method is based on early drafts of document object model (dom) level 2 events specification and is im...
... altkeyarg, shiftkeyarg, metakeyarg, keycodearg, charcodearg) parameters type is a domstring representing the type of event. bubbles is a boolean indicating whether the event should bubble up through the event chain or not (see bubbles). cancelable is a boolean i indicating whether the event can be canceled (see cancelable). viewarg specifies the uievent.view; this value may be null. ctrlkeyarg is a boolean that is true if the virtual key to be generated is a combination of keys containing the ctrl key. altkeyarg is a boolean that is true if the virtual key to be generated is a combination of keys containing the alt key. shiftkeyarg a boolean that is true if the virtual key to be generated is a combination of keys containing the shift key. metakeyarg is a...
...ue if the virtual key to be generated is a combination of keys containing the alt key. shiftkeyarg a boolean that is true if the virtual key to be generated is a combination of keys containing the shift key. metakeyarg is a boolean that is true if the virtual key to be generated is a combination of keys containing the meta key. keycodearg is a unsigned long representing the virtual key code value of the key which was depressed, otherwise 0. see keyboardevent.keycode for the list of key codes. charcodearg is a unsigned long representingthe unicode character associated with the depressed key otherwise 0. example var event = document.createevent('keyboardevent'); // create a key event // define the event event.initkeyevent("keypress", // typearg, true, ...
...e character associated with the depressed key otherwise 0. example var event = document.createevent('keyboardevent'); // create a key event // define the event event.initkeyevent("keypress", // typearg, true, // canbubblearg, true, // cancelablearg, null, // viewarg, specifies uievent.view. this value may be null. false, // ctrlkeyarg, false, // altkeyarg, false, // shiftkeyarg, false, // metakeyarg, 9, // keycodearg, 0); // charcodearg); document.getelementbyid('blah').dispatchevent(event); specification ...
KeyboardEvent.location - Web APIs
the keyboardevent.location read-only property returns an unsigned long representing the location of the key on the keyboard or other input device. possible values are: constant value description dom_key_location_standard 0 the key has only one version, or can't be distinguished between the left and right versions of the key, and was not pressed on the numeric keypad or a key that is considered to be part of the keypad. dom_key_location_left 1 the key was the left-hand version of the key; for example, the left-hand control key was pressed on a standard 101 key us keyboard. this value is only used for keys that have more than one possible location on the keyboard. dom_key_location_right 2 the key was the right-hand version of the key;...
... dom_key_location_numpad 3 the key was on the numeric keypad, or has a virtual key code that corresponds to the numeric keypad. ...
...s returns dom_key_location_numpad for the keys on the numeric pad. otherwise, when numlock is unlocked and the keyboard actually has a numeric keypad, gecko always returns dom_key_location_numpad too. on the other hand, if the keyboard doesn't have a keypad, such as on a notebook computer, some keys become numpad only when numlock is locked. when such keys fires key events, the location attribute value depends on the key. that is, it must not be dom_key_location_numpad. note: numlock key's key events indicate dom_key_location_standard both on gecko and internet explorer. dom_key_location_mobile obsolete since gecko 38 4 the key was on a mobile device; this can be on either a physical keypad or a virtual keyboard. note: gecko always returns dom_key_location_mob...
...y_location_mobile on android (prior to 18) and maemo. however, at gecko 38, this is dropped. dom_key_location_joystick obsolete since gecko 38 5 the key was a button on a game controller or a joystick on a mobile device. note: gecko never fires trusted key events with dom_key_location_joystick except on android. starting 18, native key events on android may have this value. however, at gecko 38, this is dropped. syntax var location = event.location; example function keyevent(event) { console.log("location of key pressed: " + event.location); } specifications specification status comment document object model (dom) level 3 events specificationthe definition of 'keyboardevent.location' in that specification. obsolete ...
KeyboardLayoutMap.get() - Web APIs
example the following example demonstrates how to get the location- or layout-specific string associated with the key that corresponds to the 'w' key on an english qwerty keyboard. ...
... example the following example demonstrates how to get the location- or layout-specific string associated with the key that corresponds to the 'w' key on an english qwerty keyboard. ...
... example the following example demonstrates how to get the location- or layout-specific string associated with the key that corresponds to the 'w' key on an english qwerty keyboard. ...
... example the following example demonstrates how to get the location- or layout-specific string associated with the key that corresponds to the 'w' key on an english qwerty keyboard. ...
Keyboard API - Web APIs
keyboard api is by web applications such as games or remote access apps that provide a full-screen immersive experience. keyboard api concepts and usage keyboard mapping on physical keyboards, the code attribute contains the physical location of the key that was pressed, and the key attribute contains the string generated by pressing the key at that physical location on the keyboard. the key value takes into account the keyboard's locale (for example, 'en-us'), layout (for example, 'qwerty'), and modifier-key state (shift, control, etc.). historically there has been no way to retrieve that information. the keyboard map api provides a way to retrieve the string generated by a particular key press, through the keyboard interface and the keyboardlayoutmap interface. the keyboard interface is...
...rovides a way to retrieve the string generated by a particular key press, through the keyboard interface and the keyboardlayoutmap interface. the keyboard interface is accessed through navigator.keyboard. keyboard provides the keyboard.getlayoutmap method, which returns a promise that resolves with a keyboardlayoutmap object that contains members for converting codes to keys. a list of valid code values is found in the writing system keys section of the ui events keyboardevent code values spec. the following example demonstrates how to get the location-specific or layout-specific string associated with the key labeled w on an english qwerty keyboard. if (navigator.keyboard) { var keyboard = navigator.keyboard; keyboard.getlayoutmap() .then(keyboardlayoutmap => { var upkey = keyboard...
...ss to special keys and keyboard shortcuts while in full-screen mode. examples of such key/key combinations include escape, alt+tab, and ctrl+n. those keys and key combinations are typically captured by the user agent or the underlying operating system, as illustrated in the following example. to capture the "w", "a", "s", and "d" keys, call lock() with a list that contains the key code attribute value for each of these keys: navigator.keyboard.lock(["keyw", "keya", "keys", "keyd"]); this captures these keys regardless of which modifiers are used with the key press. assuming a standard united states qwerty layout, registering keyw ensures that "w", shift+"w", control+"w", control+shift+"w", and all other key modifier combinations with "w" are sent to the app. the same applies to for keya, key...
...+"w", control+shift+"w", and all other key modifier combinations with "w" are sent to the app. the same applies to for keya, keys and keyd. writing system keys the codes passed keyboard.lock and the various methods of the keyboardlayoutmap interface are called “writing system keys”. “writing system keys” are defined in the writing system keys section of the ui events keyboardevent code values spec as the physical keys that change meaning based on the current locale and keyboard layout. these keys are shown below. blue keys are present on all standard keyboards while green keys are only available on some keyboards. interfaces keyboard provides functions that retrieve keyboard layout maps and toggle capturing of key presses from the physical keyboard. keyboardlayoutmap a m...
KeyframeEffect.getKeyframes() - Web APIs
offset the offset of the keyframe specified as a number between 0.0 and 1.0 inclusive or null. ...
... offset the offset of the keyframe specified as a number between 0.0 and 1.0 inclusive or null. ...
... offset the offset of the keyframe specified as a number between 0.0 and 1.0 inclusive or null. ...
...effect.spacing. computedoffset the computed offset for this keyframe, calculated when the list of computed keyframes was produced according to keyframeeffect.spacing. unlike offset, above, the computedoffset is never null. easing the timing function used from this keyframe until the next keyframe in the series. composite the keyframeeffect.composite operation used to combine the values specified in this keyframe with the underlying value. this will be absent if the composite operation specified on the effect is being used. examples in the red queen race example, we can inspect alice and the redqueen's animation to see its individual keyframes like so: // return the array of keyframes redqueen_alice.effect.getkeyframes(); specifications specification statu...
MediaDevices.getUserMedia() - Web APIs
mum resolution of 1280x720: { audio: true, video: { width: { min: 1280 }, height: { min: 720 } } } if no camera exists with this resolution or higher, then the returned promise will be rejected with overconstrainederror, and the user will not be prompted. the reason for the difference in behaviour is that the keywords min, max, and exact are inherently mandatory. whereas plain values and a keyword called ideal are not. here's a full example: { audio: true, video: { width: { min: 1024, ideal: 1280, max: 1920 }, height: { min: 576, ideal: 720, max: 1080 } } } an ideal value, when used, has gravity, which means that the browser will try to find the setting (and camera, if you have more than one), with the smallest fitness distance from the ideal values given. ...
...keyword called ideal are not. here's a full example: { audio: true, video: { width: { min: 1024, ideal: 1280, max: 1920 }, height: { min: 576, ideal: 720, max: 1080 } } } an ideal value, when used, has gravity, which means that the browser will try to find the setting (and camera, if you have more than one), with the smallest fitness distance from the ideal values given. plain values are inherently ideal, which means that the first of our resolution examples above could have been written like this: { audio: true, video: { width: { ideal: 1280 }, height: { ideal: 720 } } } not all constraints are numbers. for example, on mobile devices, the following will prefer the front camera (if one is available) over the rear one: { audio: true, video: { facingmode: "...
...e a deviceid from mediadevices.enumeratedevices(), you can use it to request a specific device: { video: { deviceid: mypreferredcameradeviceid } } the above will return the camera you requested, or a different camera if that specific camera is no longer available. again, to require the specific camera, you would use: { video: { deviceid: { exact: myexactcameraorbustdeviceid } } } return value a promise whose fulfillment handler receives a mediastream object when the requested media has successfully been obtained. exceptions rejections of the returned promise are made by passing a domexception error object to the promise's failure handler. possible errors are: aborterror although the user and operating system both granted access to the hardware device, and no hardware issues occ...
...rror although the user granted permission to use the matching devices, a hardware error occurred at the operating system, browser, or web page level which prevented access to the device. overconstrainederror the specified constraints resulted in no candidate devices which met the criteria requested. the error is an object of type overconstrainederror, and has a constraint property whose string value is the name of a constraint which was impossible to meet, and a message property containing a human-readable string explaining the problem. because this error can occur even when the user has not yet granted permission to use the underlying device, it can potentially be used as a fingerprinting surface. securityerror user media support is disabled on the document on which getusermedia() was ...
MediaPositionState.playbackRate - Web APIs
er might use this information along with the position property and the navigator.mediasession.playbackstate, as well as the session's metadata to provide an integrated common user interface showing the currently playing media as well as standard pause, play, forward, reverse, and other controls. ...
...ation along with the position property and the navigator.mediasession.playbackstate, as well as the session's metadata to provide an integrated common user interface showing the currently playing media as well as standard pause, play, forward, reverse, and other controls. ...
...provide an integrated common user interface showing the currently playing media as well as standard pause, play, forward, reverse, and other controls. syntax let positionstate = { playbackrate: rate }; let playbackrate = positionstate.playbackrate; value a floating-point value specifying a multiplier corresponding to the current relative rate at which the media being performed is playing. a value of 1.0 indicates the media is playing forward at normal speed, while higher values indicate that the media is being played faster than normal. lower values indicate the media is being played more slowly. negative values can be specified to indicate the media is playing in reverse, with decreasing values then indicating faster and faster reverse playback. note: a value of 0.0 is not permitted. ...
...hat the user has clicked a button causing the playback to shift to a double-speed mode. it begins by creating a mediapositionstate object, then submits it to the browser it by calling navigator.mediasession.setpositionstate(). let positionstate = { duration: mymediaduration; playbackrate: 2.0; position: mymediaposition; }; navigator.mediasession.setpositionstate(positionstate); note the value 2.0 as the playbackrate. specifications specification status comment media session standardthe definition of 'mediapositionstate.playbackrate' in that specification. draft initial definition. ...
active - Web APIs
example in this example, a new stream whose source is the user's local camera and microphone is requested using getusermedia(). ...
... example in this example, a new stream whose source is the user's local camera and microphone is requested using getusermedia(). ...
... example in this example, a new stream whose source is the user's local camera and microphone is requested using getusermedia(). ...
...ue which is true if the stream is currently active; otherwise, it returns false. a stream is considered active if at least one of its mediastreamtracks is not in the mediastreamtrack.ended state. once every track has ended, the stream's active property becomes false. syntax var isactive = mediastream.active; value a boolean value which is true if the stream is currently active; otherwise, the value is false. example in this example, a new stream whose source is the user's local camera and microphone is requested using getusermedia(). when that stream becomes available (that is, when the returned promise is fulfilled, a button on the page is updated based on whether or not the stream is currently active. var promise = navigator.mediadevices.getusermedia({ audio: true, video: true }); ...
MediaTrackConstraints.aspectRatio - Web APIs
the mediatrackconstraints dictionary's aspectratio property is a constraindouble describing the requested or mandatory constraints placed upon the value of the aspectratio constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.aspectratio as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.aspectratio as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { aspectratio: constraint }; constraintsobject.aspectratio = constraint; value a constraindouble describing the acceptable or required value(s) for a video track's aspect ratio. the value is the width divided by the height and is rounded to ten decimal places. for example, the standard high-definition video aspect ratio of 16:9 can be computed as 1920/1080, or 1.7777777778. ...
...sobject = { aspectratio: constraint }; constraintsobject.aspectratio = constraint; value a constraindouble describing the acceptable or required value(s) for a video track's aspect ratio. the value is the width divided by the height and is rounded to ten decimal places. for example, the standard high-definition video aspect ratio of 16:9 can be computed as 1920/1080, or 1.7777777778. if this value is a number, the user agent will attempt to obtain media whose aspect ratio is as close as possible to this number given the capabilities of the hardware and the other constraints specified. ...
...th divided by the height and is rounded to ten decimal places. for example, the standard high-definition video aspect ratio of 16:9 can be computed as 1920/1080, or 1.7777777778. if this value is a number, the user agent will attempt to obtain media whose aspect ratio is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constraindouble will guide the user agent in its efforts to provide an exact match to the required aspect ratio (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment ...
MediaTrackConstraints.autoGainControl - Web APIs
the mediatrackconstraints dictionary's autogaincontrol property is a constrainboolean describing the requested or mandatory constraints placed upon the value of the autogaincontrol constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.autogaincontrol as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...iadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. automatic gain control is typically a feature provided by microphones, although it can be provided by other input sources as well. ...
...pportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. automatic gain control is typically a feature provided by microphones, although it can be provided by other input sources as well. ...
...though it can be provided by other input sources as well. syntax var constraintsobject = { autogaincontrol: constraint }; constraintsobject.autogaincontrol = constraint; value if this value is a simple true or false, the user agent will attempt to obtain media with automatic gain control enabled or disabled as specified, if possible, but will not fail if this can't be done. if, instead, the value is given as an object with an exact field, that field's boolean value indicates a required setting for the automatic gain control feature; if it can't be met, then the request will result in an error. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media capture and str...
MediaTrackConstraints.cursor - Web APIs
the mediatrackconstraints dictionary's cursor property is a constraindomstring describing the requested or mandatory constraints placed upon the value of the cursor constrainable property, which is used to specify whether or not the cursor should be included in the captured video. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.cursor as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...see how constraints are defined in capabilities, constraints, and settings for an explanation of how to define constraints. ...
...e mediastream returned by the call to getdisplaymedia(). see how constraints are defined in capabilities, constraints, and settings for an explanation of how to define constraints. usage notes you can check the setting selected by the user agent after the display media has been created by getdisplaymedia() by calling getsettings() on the display media's video mediastreamtrack, then checking the value of the returned mediatracksettings object's cursor object. for example, if your app needs to alter the stream by inserting a representation of the cursor position if the stream doesn't include the rendered cursor, you can determine the need to do so by using code like this: let insertfakecursorflag = false; if (displaystream.getvideotracks()[0].getsettings().cursor === "never") { insertfake...
...ion if the stream doesn't include the rendered cursor, you can determine the need to do so by using code like this: let insertfakecursorflag = false; if (displaystream.getvideotracks()[0].getsettings().cursor === "never") { insertfakecursorflag = true; } following this code, insertfakecursorflag is true if there's no cursor rendered into the stream already. later code can detect this flag's value and if it's true, can manually look at some metadata that might be provided and insert a fake representation of the cursor at the correct position. examples here are some example constraints objects for getdisplaymedia() that make use of the cursor property. in addition, see example: constraint exerciser in capabilities, constraints, and settings for a complete example showing how constraints a...
MediaTrackConstraints.deviceId - Web APIs
the mediatrackconstraints dictionary's deviceid property is a constraindomstring describing the requested or mandatory constraints placed upon the value of the deviceid constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.deviceid as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. ...
...y a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. ...
...onstraintsobject = { deviceid: constraint }; constraintsobject.deviceid = constraint; value an object based on constraindomstring specifying one or more acceptable, ideal, and/or exact (mandatory) device ids which are acceptable as the source of media content. device ids are unique for a given origin, and are guaranteed to be the same across browsing sessions on the same origin. however, the value of the deviceid is determined by the source of the track's content, and there's no particular format mandated by the specification (although some kind of guid is recommended). that means that a given track will only return one value for the deviceid when you call getcapabilities(). because of this, there's no use for the device id when calling mediastreamtrack.applyconstraints(), since there is ...
...s determined by the source of the track's content, and there's no particular format mandated by the specification (although some kind of guid is recommended). that means that a given track will only return one value for the deviceid when you call getcapabilities(). because of this, there's no use for the device id when calling mediastreamtrack.applyconstraints(), since there is only one possible value; however, you can record a deviceid and use it to ensure that you get the same source for multiple calls to getusermedia(). an exception to the rule that device ids are the same across browsing sessions: private browsing mode will use a different id, and will change it each browsing session. example see example: constraint exerciser in capabilities, constraints, and settings for an example. ...
MediaTrackConstraints.displaySurface - Web APIs
the mediatrackconstraints dictionary's displaysurface property is a constraindomstring describing the requested or mandatory constraints placed upon the value of the displaysurface constrainable property. this is used to specify the type or types of display surfaces which getdisplaymedia() will let the user select among for sharing purposes. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.displaysurface as returned by a call to mediadevices.getsupportedconstraints(). ...
... see how constraints are defined in capabilities, constraints, and settings for an explanation of how to define constraints. ...
...rface as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { displaysurface: constraint }; constraintsobject.displaysurface = constraint; value a constraindomstring which specifies the type of display surface that's being captured. this value does not affect the list of display sources in the browser's user interface. see how constraints are defined in capabilities, constraints, and settings for an explanation of how to define constraints. usage notes you can check the setting selected by the user agent after the display media has been created by getdisplaymedia() by calling getsettings() on the display media's video mediastreamtra...
...ist of display sources in the browser's user interface. see how constraints are defined in capabilities, constraints, and settings for an explanation of how to define constraints. usage notes you can check the setting selected by the user agent after the display media has been created by getdisplaymedia() by calling getsettings() on the display media's video mediastreamtrack, then checking the value of the returned mediatracksettings object's displaysurface object. for example, if your app needs to know that the surface being shared is a monitor or application—meaning that there's possibly a non-content backdrop—it can use code similar to this: let mayhavebackdropflag = false; let displaysurface = displaystream.getvideotracks()[0].getsettings().displaysurface; if (displaysurface === ...
MediaTrackConstraints.echoCancellation - Web APIs
the mediatrackconstraints dictionary's echocancellation property is a constrainboolean describing the requested or mandatory constraints placed upon the value of the echocancellation constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.echocancellation as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...adevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. ...
...portedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. ...
...a webrtc rtcpeerconnection will never include this property. syntax var constraintsobject = { echocancellation: constraint }; constraintsobject.echocancellation = constraint; value if this value is a simple true or false, the user agent will attempt to obtain media with echo cancellation enabled or disabled as specified, if possible, but will not fail if this can't be done. if, instead, the value is given as an object with an exact field, that field's boolean value indicates a required setting for the echo cancellation feature; if it can't be met, then the request will result in an error. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media capture and streamst...
MediaTrackConstraints.latency - Web APIs
the mediatrackconstraints dictionary's latency property is a constraindouble describing the requested or mandatory constraints placed upon the value of the latency constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.latency as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. ...
... by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. syntax var constraintsobject = { latency: constraint }; constraintsobject.latency = constraint; value a constraindouble describing the acceptable or required value(s) for an audio track's latency, with values specified in seconds. in audio processing, latency is the time between the start of processing (when sound occurs in the real world, or is generated by a hardware device) and the data being made available to the next step in the audio input or output process. in most cases, low latency is d...
...t of processing (when sound occurs in the real world, or is generated by a hardware device) and the data being made available to the next step in the audio input or output process. in most cases, low latency is desirable for performance and user experience purposes, but when power consumption is a concern, or delays are otherwise acceptable, higher latency might be acceptable. ...
...able for performance and user experience purposes, but when power consumption is a concern, or delays are otherwise acceptable, higher latency might be acceptable. if this property's value is a number, the user agent will attempt to obtain media whose latency tends to be as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constraindouble will guide the user agent in its efforts to provide an exact match to the required latency (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. latency is always prone to some variation due to hardware usage demands, network constraints, and so forth, so even in an "exact" match, some variation should be expected. ...
MediaTrackConstraints.noiseSuppression - Web APIs
the mediatrackconstraints dictionary's noisesuppression property is a constrainboolean describing the requested or mandatory constraints placed upon the value of the noisesuppression constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.noisesuppression as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. noise suppression is typically provided by microphones, although it can be provided by other input sources as well. ...
...a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. noise suppression is typically provided by microphones, although it can be provided by other input sources as well. ...
...devices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. noise suppression is typically provided by microphones, although it can be provided by other input sources as well. ...
... although it can be provided by other input sources as well. syntax var constraintsobject = { noisesuppression: constraint }; constraintsobject.noisesuppression = constraint; value if this value is a simple true or false, the user agent will attempt to obtain media with noise suppression enabled or disabled as specified, if possible, but will not fail if this can't be done. if, instead, the value is given as an object with an exact field, that field's boolean value indicates a required setting for the noise suppression feature; if it can't be met, then the request will result in an error. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media capture and streamst...
MediaTrackControls.volume - Web APIs
the mediatrackconstraints dictionary's volume property is a constraindouble describing the requested or mandatory constraints placed upon the value of the volume constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.volume as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
... can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.volume as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { volume: constraint }; constraintsobject.volume = constraint; value a constraindouble describing the acceptable or required value(s) for an audio track's volume, on a linear scale where 0.0 means silence and 1.0 is the highest supported volume. ...
...r, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { volume: constraint }; constraintsobject.volume = constraint; value a constraindouble describing the acceptable or required value(s) for an audio track's volume, on a linear scale where 0.0 means silence and 1.0 is the highest supported volume. if this value is a number, the user agent will attempt to obtain media whose volume is as close as possible to this number given the capabilities of the hardware and the other constraints specified. ...
... value a constraindouble describing the acceptable or required value(s) for an audio track's volume, on a linear scale where 0.0 means silence and 1.0 is the highest supported volume. if this value is a number, the user agent will attempt to obtain media whose volume is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constraindouble will guide the user agent in its efforts to provide an exact match to the required volume (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. any constraint set which only permits values outside the range 0.0 to 1.0 cannot be satisfied and will result in failure. example see example: constraint exerciser in capab...
MediaTrackSettings.channelCount - Web APIs
the mediatracksettings dictionary's channelcount property is an integer indicating how many audio channel the mediastreamtrack is currently configured to have. this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.channelcount property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.channelcount as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var channelcount = mediatracksettings.channel...
... example see example: constraint exerciser in capabilities, constraints, and settings for an example. ...
... example see example: constraint exerciser in capabilities, constraints, and settings for an example. ...
... example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media capture and streamsthe definition of 'channelcount' in that specification. ...
MediaTrackSettings.deviceId - Web APIs
the mediatracksettings dictionary's deviceid property is a domstring which uniquely identifies the source for the corresponding mediastreamtrack for the origin corresponding to the browsing session. this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.deviceid property you provided when calling either getusermedia(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.deviceid as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associat...
...tracksupportedconstraints.deviceid as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. ...
....deviceid as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. ...
...include this property. syntax var deviceid = mediatracksettings.deviceid; value a domstring whose value is an origin-unique identifier for the track's source. this id is valid across multiple browsing sessions for the same origin and is guaranteed to be different for all other origins, so you can safely use it to request the same source be used for multiple sessions, for example. the actual value of the string, however, is determined by the source of the track, and there is no guarantee what form it will take, although the specification does recommend it be a guid. since there is a one-to-one pairing of id with each source, all tracks with the same source will share the same id for any given origin, so mediastreamtrack.getcapabilities() will always return exactly one value for deviceid. ...
MediaTrackSettings.echoCancellation - Web APIs
echo cancellation is a feature which attempts to prevent echo effects on a two-way audio connection by attempting to reduce or eliminate crosstalk between the user's output device and their input device. ...
... echo cancellation is a feature which attempts to prevent echo effects on a two-way audio connection by attempting to reduce or eliminate crosstalk between the user's output device and their input device. ...
...t echo effects on a two-way audio connection by attempting to reduce or eliminate crosstalk between the user's output device and their input device. for example, it might apply a filter that negates the sound being produced on the speakers from being included in the input track generated from the microphone. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.echocancellation as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. syntax var echocancellation = mediat...
...s.echocancellation as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. syntax var echocancellation = mediatracksettings.echocancellation; value a boolean value which is true if the track has echo cancellation functionality enabled or false if echo cancellation is disabled. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media capture and streamsthe definition of 'echocancellation' in that specification. can...
MediaTrackSettings.groupId - Web APIs
the mediatracksettings dictionary's groupid property is a browsing-session unique domstring which identifies the group of devices which includes the source for the mediastreamtrack. this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.groupid property you provided when calling either getusermedia(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.groupid as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rt...
...diatracksupportedconstraints.groupid as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. syntax var groupid = mediatracksettings.groupid; value a domstring whose value is a browsing-session unique identifier for a group of devices which includes the source of the track's contents. two devices share the same group id if they belong to the same physical hardware device. for example, a headset has two devices on it: a microphone which can serve as a source for audio tracks and a speaker which can serve as an output for audio. the group id...
...an serve as a source for audio tracks and a speaker which can serve as an output for audio. the group id is not usable across multiple browsing sessions. however, it can be used to ensure that audio input and output are both being performed on the same headset, for example, or to ensure that the built-in camera and microphone on a phone are being used for video conferencing purposes. the actual value of the string, however, is determined by the source of the track, and there is no guarantee what form it will take, although the specification does recommend it be a guid. since this property isn't stable across browsing sessions, its usefulness when calling getusermedia() is generally limited to ensuring that tasks performed during the same browsing session use devices from the same group (or t...
...oes recommend it be a guid. since this property isn't stable across browsing sessions, its usefulness when calling getusermedia() is generally limited to ensuring that tasks performed during the same browsing session use devices from the same group (or that they don't use devices from the same group). there is no situation in which the groupid is useful when calling applyconstraints(), since the value can't be changed. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media capture and streamsthe definition of 'groupid' in that specification. candidate recommendation initial specification. ...
MediaTrackSettings.sampleRate - Web APIs
the mediatracksettings dictionary's samplerate property is an integer indicating how many audio samples per second the mediastreamtrack is currently configured for. this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.samplerate property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.samplerate as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var samplerate = mediatracksettings.samplera...
....applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.samplerate as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var samplerate = mediatracksettings.samplerate; value an integer value indicating how many samples each second of audio data includes. ...
...by checking the value of mediatracksupportedconstraints.samplerate as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var samplerate = mediatracksettings.samplerate; value an integer value indicating how many samples each second of audio data includes. common values include 44,100 (standard cd audio), 48,000 (standard digital audio), 96,000 (commonly used in audio mastering and post-production), and 192,000 (used for high-resolution audio in professional recording and mastering sessions). ...
... example see example: constraint exerciser in capabilities, constraints, and settings for an example. ...
MessageEvent - Web APIs
ing the sharedworker.port property. ...
...dworker.port property. ...
...the ports associated with that worker are accessible in the connect event's ports property — we t...
...the ports associated with that worker are accessible in the connect event's ports property — we then use messa...
MutationObserverInit - Web APIs
e of childlist, attributes, and/or characterdata must be true when you call observe(). otherwise, a typeerror exception will be thrown. subtree optional set to true to extend monitoring to the entire subtree of nodes rooted at target. all of the other mutationobserverinit properties are then extended to all of the nodes in the subtree instead of applying solely to the target node. ...
... subtree of nodes rooted at target. all of the other mutationobserverinit properties are then extended to all of the nodes in the subtree instead of applying solely to the target node. the default value is false. childlist optional set to true to monitor the target node (and, if subtree is true, its descendants) for the addition of new child nodes or removal of existing child nodes. the default value is false. attributes optional set to true to watch for changes to the value of attributes on the node or nodes being monitored. the default value is true if either of attributefilter or attributeoldvalue is specified, otherwise the default value is false. attributefilter optional an array of specific attribute names to be monitored. if this property isn't included, changes to all attributes c...
...ue to watch for changes to the value of attributes on the node or nodes being monitored. the default value is true if either of attributefilter or attributeoldvalue is specified, otherwise the default value is false. attributefilter optional an array of specific attribute names to be monitored. if this property isn't included, changes to all attributes cause mutation notifications. attributeoldvalue optional set to true to record the previous value of any attribute that changes when monitoring the node or nodes for attribute changes; see monitoring attribute values in mutationobserver for details on watching for attribute changes and value recording. the default value is false. characterdata optional set to true to monitor the specified target node (and, if subtree is true, its descendant...
...n monitoring the node or nodes for attribute changes; see monitoring attribute values in mutationobserver for details on watching for attribute changes and value recording. the default value is false. characterdata optional set to true to monitor the specified target node (and, if subtree is true, its descendants) for changes to the character data contained within the node or nodes. the default value is true if characterdataoldvalue is specified, otherwise the default value is false. characterdataoldvalue optional set to true to record the previous value of a node's text whenever the text changes on nodes being monitored. for details and an example, see monitoring text content changes in mutationobserver. the default value is false. specifications specification status comm...
MutationRecord - Web APIs
of the added or removed nodes, or null. mutationrecord.nextsibling node return the next sibling of the added or removed nodes, or null. mutationrecord.attributename string returns the local name of the changed attribute, or null. mutationrecord.attributenamespace string returns the namespace of the changed attribute, or null. ...
...ull. mutationrecord.nextsibling node return the next sibling of the added or removed nodes, or null. mutationrecord.attributename string returns the local name of the changed attribute, or null. mutationrecord.attributenamespace string returns the namespace of the changed attribute, or null. mutationrecord.oldvalue string the return value depends on the mutationrecord.type. ...
...ng of the added or removed nodes, or null. mutationrecord.attributename string returns the local name of the changed attribute, or null. mutationrecord.attributenamespace string returns the namespace of the changed attribute, or null. mutationrecord.oldvalue string the return value depends on the mutationrecord.type. for attributes, it is the value of the changed attribute before the change. ...
...mespace of the changed attribute, or null. mutationrecord.oldvalue string the return value depends on the mutationrecord.type. for attributes, it is the value of the changed attribute before the change. for characterdata, it is the data of the changed node before the change. for childlist, it is null. note that for this to work as expected, attributeoldvalue or characterdataoldvalue must be set to true in the corresponding mutationobserverinit parameter of the mutationobserver observe method specifications specification status comment domthe definition of 'mutationrecord' in that specification. living standard ...
Navigator - Web APIs
Web › API › Navigator
t inherit any properties, but implements those defined in navigatorid, navigatorlanguage, navigatoronline, navigatorcontentutils, navigatorstorage, navigatorstorageutils, navigatorconcurrenthardware, navigatorplugins, and navigatorusermedia. standard navigatorid.appcodename read only returns the internal "code" name of the current browser. do not rely on this property to return the correct value. navigatorid.appname read only returns a domstring with the official name of the browser. do not rely on this property to return the correct value. navigatorid.appversion read only returns the version of the browser as a domstring. do not rely on this property to return the correct value. navigator.battery read only returns a batterymanager object you can use to get information about t...
...hether the host browser is java-enabled or not. navigator.keyboard read only returns a keyboard object which provides access to functions that retrieve keyboard layout maps and toggle capturing of key presses from the physical keyboard. navigatorlanguage.language read only returns a domstring representing the preferred language of the user, usually the language of the browser ui. the null value is returned when this is unknown. navigatorlanguage.languages read only returns an array of domstring representing the languages known to the user, by order of preference. navigator.locks read only returns a lockmanager object which provides methods for requesting a new lock object and querying for an existing lock object navigator.mediacapabilities read only returns a mediacapabilitie...
...gator.online read only returns a boolean indicating whether the browser is working online. navigator.permissions read only returns a permissions object that can be used to query and update permission status of apis covered by the permissions api. navigatorid.platform read only returns a string representing the platform of the browser. do not rely on this function to return a significant value. navigatorplugins.plugins read only returns a pluginarray listing the plugins installed in the browser. navigatorid.product read only always returns 'gecko', on any browser. this property is kept only for compatibility purpose. navigator.serviceworker read only returns a serviceworkercontainer object, which provides access to registration, removal, upgrade, and communication with the ...
... now returns a fixed timestamp as a privacy measure, e.g. 20181001000000 in firefox 64 onwards. navigator.credentials returns the credentialscontainer interface which exposes methods to request credentials and notify the user agent when interesting events occur such as successful sign in or sign out. navigator.devicememory read only returns the amount of device memory in gigabytes. this value is an approximation given by rounding to the nearest power of 2 and dividing that number by 1024. navigator.donottrack reports the value of the user's do-not-track preference. when this value is "yes", your web site or application should not track the user. navigator.mediadevices returns a reference to a mediadevices object which can then be used to get information about available media d...
Node.textContent - Web APIs
Web › API › Node › textContent
the textcontent property of the node interface represents the text content of the node and its descendants. note: textcontent and htmlelement.innertext are easily confused, but the two properties are different in important ways. syntax let text = somenode.textcontent someothernode.textcontent = string value a string or null description the value of textcontent depends on the situation: if the node is a document or a doctype, textcontent returns null. note: to get all of the text and cdata data for the whole document, one could use document.documentelement.textcontent. if the node is a cdata section, comment, processing instruction, or text node, textcontent returns the text inside the node, i.e., the node.nodevalue. for other node types, textcontent returns the concatenatio...
... differences from innertext don't get confused by the differences between node.textcontent and htmlelement.innertext. although the names seem similar, there are important differences: textcontent gets the content of all elements, including <script> and <style> elements. in contrast, innertext only shows “human-readable” elements. ...
...e important differences: textcontent gets the content of all elements, including <script> and <style> elements. in contrast, innertext only shows “human-readable” elements. textcontent returns every element in the node. in contrast, innertext is aware of styling and won’t return the text of “hidden” elements. moreover, since innertext takes css styles into account, reading the value of innertext triggers a reflow to ensure up-to-date computed styles. (reflows can be computationally expensive, and thus should be avoided when possible.) unlike textcontent, altering innertext in internet explorer (version 11 and below) removes child nodes from the element and permanently destroys all descendant text nodes. it is impossible to insert the nodes again into any other element ...
...child nodes from the element and permanently destroys all descendant text nodes. it is impossible to insert the nodes again into any other element or into the same element after doing so. differences from innerhtml element.innerhtml returns html, as its name indicates. sometimes people use innerhtml to retrieve or write text inside an element, but textcontent has better performance because its value is not parsed as html. moreover, using textcontent can prevent xss attacks. examples given this html fragment: <div id="diva">this is <span>some</span> text!</div> ... you can use textcontent to get the element's text content: let text = document.getelementbyid('diva').textcontent; // the text variable is now: 'this is some text!' ... or set the element's text content: document.getelement...
OffscreenCanvas.getContext() - Web APIs
canvas, or null if the context identifier is not supported. note: this api is currently implemented for webgl1 and webgl2 contexts only. see bug 801176 for canvas 2d api support from workers. syntax offscreen.getcontext(contexttype, contextattributes); parameters contexttype is a domstring containing the context identifier defining the drawing context associated to the canvas. possible values are: "2d" creates a canvasrenderingcontext2d object representing a two-dimensional rendering context. "webgl" creates a webglrenderingcontext object representing a three-dimensional rendering context. this context is only available on browsers that implement webgl version 1 (opengl es 2.0). "webgl2" creates a webgl2renderingcontext object representing a three-dimensional rendering contex...
... buffer has a depth buffer of at least 16 bits. stencil: boolean that indicates that the drawing buffer has a stencil buffer of at least 8 bits. antialias: boolean that indicates whether or not to perform anti-aliasing. premultipliedalpha: boolean that indicates that the page compositor will assume the drawing buffer contains colors with pre-multiplied alpha. ...
...t indicates that the drawing buffer has a stencil buffer of at least 8 bits. antialias: boolean that indicates whether or not to perform anti-aliasing. premultipliedalpha: boolean that indicates that the page compositor will assume the drawing buffer contains colors with pre-multiplied alpha. preservedrawingbuffer: if the value is true the buffers will not be cleared and will preserve their values until cleared or overwritten by the author. ...
...indicates that the page compositor will assume the drawing buffer contains colors with pre-multiplied alpha. preservedrawingbuffer: if the value is true the buffers will not be cleared and will preserve their values until cleared or overwritten by the author. failifmajorperformancecaveat: boolean that indicates if a context will be created if the system performance is low. return value a renderingcontext which is either a canvasrenderingcontext2d for "2d", webglrenderingcontext for "webgl" and "experimental-webgl", webgl2renderingcontext for "webgl2" and "experimental-webgl2" , or imagebitmaprenderingcontext for "bitmaprenderer". if the contexttype doesn't match a possible drawing context, null is returned. examples var offscreen = new offscreencanvas(256, 256); var...
OscillatorNode - Web APIs
properties inherits properties from its parent, audioscheduledsourcenode, and adds the following properties: oscillatornode.frequency an a-rate audioparam representing the frequency of oscillation in hertz (though the audioparam returned is read-onl...
... number of inputs 0 number of outputs 1 channel count mode max channel count 2 (not used in the default count mode) channel interpretation speakers constructor oscillatornode() creates a new instance of an oscillatornode object, optionally providing an object specifying default values for the node's properties. if the default values are acceptable, you can simply call the baseaudiocontext.createoscillator() factory method. properties inherits properties from its parent, audioscheduledsourcenode, and adds the following properties: oscillatornode.frequency an a-rate audioparam representing the frequency of oscillation in hertz (though the audioparam returned is read-only, the value it represents is not). the default va...
...llowing properties: oscillatornode.frequency an a-rate audioparam representing the frequency of oscillation in hertz (though the audioparam returned is read-only, the value it represents is not). the default value is 440 hz (a standard middle-a note). oscillatornode.detune an a-rate audioparam representing detuning of oscillation in cents (though the audioparam returned is read-only, the value it represents is not). the default value is 0. oscillatornode.type a string which specifies the shape of waveform to play; this can be one of a number of standard values, or custom to use a periodicwave to describe a custom waveform. different waves will produce different tones. standard values are "sine", "square", "sawtooth", "triangle" and "custom". the default is "sine". event handlers...
...udiocontext to create an oscillator node and to start playing a tone on it. for an applied example, check out our violent theremin demo (see app.js for relevant code). // create web audio api context var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); // create oscillator node var oscillator = audioctx.createoscillator(); oscillator.type = 'square'; oscillator.frequency.setvalueattime(440, audioctx.currenttime); // value in hertz oscillator.connect(audioctx.destination); oscillator.start(); specifications specification status comment web audio apithe definition of 'oscillatornode' in that specification. working draft ...
PaymentAddress - Web APIs
or location and can include, for example, a street name, house number, apartment number, rural delivery route, descriptive instructions, or post office box number. paymentaddress.country read only a domstring specifying the country in which the address is located, using the iso-3166-1 alpha-2 standard. the string is always given in its canonical upper-case form. some examples of valid country values: "us", "gb", "cn", or "jp". paymentaddress.city read only a domstring which contains the city or town portion of the address. paymentaddress.dependentlocality read only a domstring giving the dependent locality or sublocality within a city, for example, a neighborhood, borough, district, or uk dependent locality. paymentaddress.organization read only a domstring specifying the name of t...
..., oblast, or prefecture. paymentaddress.regioncode read only a domstring specifying the region of the address, represented as a "code element" of an iso3166-2 country subdivision name (e.g. "qld" for queensland, australia, "ca" for california, and so on). paymentaddress.sortingcode read only a domstring providing a postal sorting code such as is used in france. note: properties for which values were not specified contain empty strings. obsolete properties the following properties are obsolete and should no longer be used, but may still be present in some browser versions. paymentaddress.languagecode read only a domstring indicating the language code of the address. this identifies the language in which the address is given, and is intended to aid in localization of the displa...
...ipping options), and an optional object containing further options. the first of these three (supportedinstruments in the example below) contains a data property that has to conform to the structure defined by the basiccardrequest dictionary. ...
... the example below) contains a data property that has to conform to the structure defined by the basiccardrequest dictionary. const supportedinstruments = [ { supportedmethods: "basic-card", }, ]; const details = { total: { label: "donation", amount: { currency: "usd", value: "65.00" } }, displayitems: [ { label: "original donation amount", amount: { currency: "usd", value: "65.00" }, }, ], shippingoptions: [ { id: "standard", label: "standard shipping", amount: { currency: "usd", value: "0.00" }, selected: true, }, ], }; const options = { requestshipping: true }; async function dopaymentrequest() { const request = new paymentrequest(supportedinstruments, details, options); // add event listeners here. // call show(...
Using the Payment Request API - Web APIs
this returns a promise that fulfills with a paymentresponse object if the payment is successful: request.show().then(f...
...this returns a promise that fulfills with a paymentresponse object if the payment is successful: request.show().then(function(paymentresponse) { // here we would process the payment. for this demo, simulate immedi...
...ment() can be used to check whether the paymentrequest object is capable of making a payment before you start the payment process. it returns a promise that fulfills with a boolean indicating whether it is or not, for example: // dummy payment request to check whether payment can be made new paymentrequest(buildsupportedpaymentmethoddata(), {total: {label: 'stub', amount: {currency: 'usd', value: '0.01'}}}) .canmakepayment() .then(function(result) { if(result) { // real payment request var request = new paymentrequest(buildsupportedpaymentmethoddata(), checkoutobject); request.show().then(function(paymentresponse) { // here we would process the payment. paymentresponse.co...
... same method names and data. // the page has loaded. should the page use paymentrequest? // if paymentrequest fails, should the page fallback to manual // web form checkout? const supportedpaymentmethods = ... let shouldcallpaymentrequest = true; let fallbacktolegacyonpaymentrequestfailure = false; (new paymentrequest(supportedpaymentmethods, {total: {label: 'stub', amount: {currency: 'usd', value: '0.01'}}}) .canmakepayment() .then(function(result) { shouldcallpaymentrequest = result; }).catch(function(error) { console.log(error); // the user may have turned off query ability in their privacy settings. // let's use paymentrequest by default and fallback to legacy // web form based checkout. shouldcallpaymentrequest = true; fallbacktolegacyonpaymentrequestfailure = true; }); ...
performance.now() - Web APIs
Web › API › Performance › now
the performance.now() method returns a domhighrestimestamp, measured in milliseconds. note: this feature is available in web workers. the returned value represents the time elapsed since the time origin. bear in mind the following points: in dedicated workers created from a window context, the value in the worker will be lower than performance.now() in the window who spawned that worker. it used to be the same as t0 of the main context, but this was changed. in shared or service workers, the value in the worker might be higher than that of the main context because that window can be created after those workers. ...
...in the window who spawned that worker. it used to be the same as t0 of the main context, but this was changed. in shared or service workers, the value in the worker might be higher than that of the main context because that window can be created after those workers. it's important to keep in mind that to mitigate potential security threats such as spectre, browsers typically round the returned value by some amount in order to be less predictable. this inherently introduces a degree of inaccuracy by limiting the resolution or precision of the timer. for example, firefox rounds the returned time to 1 millisecond increments. the precision of the returned value is subject to change if/when the security concerns are alleviated through other means. syntax t = performance.now(); example const ...
...); dosomething(); const t1 = performance.now(); console.log(`call to dosomething took ${t1 - t0} milliseconds.`); unlike other timing data available to javascript (for example date.now), the timestamps returned by performance.now() are not limited to one-millisecond resolution. instead, they represent times as floating-point numbers with up to microsecond precision. also unlike date.now(), the values returned by performance.now() always increase at a constant rate, independent of the system clock (which might be adjusted manually or skewed by software like ntp). otherwise, performance.timing.navigationstart + performance.now() will be approximately equal to date.now(). reduced time precision to offer protection against timing attacks and fingerprinting, the precision of performance.now() m...
...reference is enabled by default and defaults to 1ms. // reduced time precision (1ms) in firefox 60 performance.now(); // 8781416 // 8781815 // 8782206 // ... // reduced time precision with `privacy.resistfingerprinting` enabled performance.now(); // 8865400 // 8866200 // 8866700 // ... in firefox, you can also enable privacy.resistfingerprinting — this changes the precision to 100ms or the value of privacy.resistfingerprinting.reducetimerprecision.microseconds, whichever is larger. starting with firefox 79, high resolution timers can be used if you cross-origin isolate your document using the cross-origin-opener-policy and cross-origin-embedder-policy headers: cross-origin-opener-policy: same-origin cross-origin-embedder-policy: require-corp these headers ensure a top-level document ...
PerformanceNavigationTiming.unloadEventEnd - Web APIs
example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
PointerEvent.PointerEvent() - Web APIs
creates a new synthetic and untrusted pointerevent object instance. syntax event = new pointerevent(type, pointereventinit); arguments type is a domstring representing the name of the event (see pointerevent event types). pointereventinitoptional is a pointereventinit dictionary, having the following fields: pointerid — optional and defaulting to 0, of type long, that sets the value of the instance's pointerevent.pointerid. width — optional and defaulting to 1, of type double, that sets the value of the instance's pointerevent.width. height — optional and defaulting to 1, of type double, that sets the value of the instance's pointerevent.height. pressure — optional and defaulting to 0, of type float, that sets the value of the instance's pointerevent.pressure. ...
...1, of type double, that sets the value of the instance's pointerevent.width. height — optional and defaulting to 1, of type double, that sets the value of the instance's pointerevent.height. pressure — optional and defaulting to 0, of type float, that sets the value of the instance's pointerevent.pressure. tangentialpressure — optional and defaulting to 0, of type float, that sets the value of the instance's pointerevent.tangentialpressure. tiltx — optional and defaulting to 0, of type long, that sets the value of the instance's pointerevent.tiltx. tilty — optional and defaulting to 0, of type long, that sets the value of the instance's pointerevent.tilty. twist — optional and defaulting to 0, of type long, that sets the value of the instance's pointerevent.twist. poin...
... note: the pointereventinit dictionary also accepts fields from the mouseevent, uieventinit and eventinit dictionaries. ...
... note: the pointereventinit dictionary also accepts fields from the mouseevent, uieventinit and eventinit dictionaries. ...
Pointer Lock API - Web APIs
('mozpointerlockerror', lockerror, false); function lockerror(e) { alert("pointer lock failed"); } note: until firefox 50 the above events were prefixed with moz in firefox. extensions to mouse events the pointer lock api extends the normal mouseevent interface with movement attributes. two new attributes to mouse events—movementx and movementy—provide the change in mouse positions. the values of the parameters are the same as the difference between the values of mouseevent properties, screenx and screeny, which are stored in two subsequent mousemove events, enow and eprevious. in other words, the pointer lock parameter movementx = enow.screenx - eprevious.screenx. locked state when pointer lock is enabled, the standard mouseevent properties clientx, clienty, screenx, and screeny ar...
...ious. in other words, the pointer lock parameter movementx = enow.screenx - eprevious.screenx. locked state when pointer lock is enabled, the standard mouseevent properties clientx, clienty, screenx, and screeny are held constant, as if the mouse is not moving. the movementx and movementy properties continue to provide the mouse's change in position. there is no limit to movementx and movementy values if the mouse is continuously moving in a single direction. the concept of the mouse cursor does not exist and the cursor cannot move off the window or be clamped by a screen edge. unlocked state the parameters movementx and movementy are valid regardless of the mouse lock state, and are available even when unlocked for convenience. when the mouse is unlocked, the system cursor can exit and re...
... also includes if() statements to check whether the ball has gone off the edges of the canvas. if so, it makes the ball wrap around to the opposite edge. it also includes a check whether a requestanimationframe() call has previously been made, and if so, calls it again as required, and calls the canvasdraw() function that updates the canvas scene. a tracker is also set up to write out the x and y values to the screen, for reference. var tracker = document.getelementbyid('tracker'); var animation; function updateposition(e) { x += e.movementx; y += e.movementy; if (x > canvas.width + radius) { x = -radius; } if (y > canvas.height + radius) { y = -radius; } if (x < -radius) { x = canvas.width + radius; } if (y < -radius) { y = canvas.height + radius; } trac...
...tions pointer lock can only lock one iframe at a time. if you lock one iframe, you cannot try to lock another iframe and transfer the target to it; pointer lock will error out. to avoid this limitation, first unlock the locked iframe, and then lock the other. while iframes work by default, "sandboxed" iframes block pointer lock. the ability to avoid this limitation, in the form of the attribute/value combination <iframe sandbox="allow-pointer-lock">, is expected to appear in chrome soon. specifications specification status comment pointer lock candidate recommendation initial specification. ...
PublicKeyCredentialCreationOptions.authenticatorSelection - Web APIs
authenticatorselection, an optional property of the publickeycredentialcreationoptions dictionary, is an object giving criteria to filter out the authenticators to be used for the creation operation. syntax authenticatorselection = publickeycredentialcreationoptions.authenticatorselection value an object with the following properties: authenticatorattachmentoptional a string which is either "platform" or "cross-platform". the former describes an authenticator which is bound to the client and which is generally not removable. the latter describes a device which may be used across different platform (such as a usb or nfc device). requireresidentkeyoptional a boolean which indicated that the credential private key must be stored in the authenticator, the client or in a client ...
...r "cross-platform". the former describes an authenticator which is bound to the client and which is generally not removable. the latter describes a device which may be used across different platform (such as a usb or nfc device). requireresidentkeyoptional a boolean which indicated that the credential private key must be stored in the authenticator, the client or in a client device. ...
...cribes a device which may be used across different platform (such as a usb or nfc device). requireresidentkeyoptional a boolean which indicated that the credential private key must be stored in the authenticator, the client or in a client device. the default value is false. userverificationoptional a string qualifying how the user verification should be part of the authentication process. ...
...y of authenticatorattestationresponse.attestationobject) "preferred": user verification is prefered, the operation will not fail if the response does not have the uv flag (as part of the authenticatordata property of authenticatorattestationresponse.attestationobject) "discouraged": user verification should not be employed as to minimize the user interaction during the process. the default value is "preferred". the authenticator used for the creation of the public key credential must comply with the requirements. note: see publickeycredential.isuserverifyingplatformauthenticatoravailable() which resolves to true when a user-verifiying platform authenticator is available. examples var publickey = { authenticatorselection:{ authenticatorattachment: "cross-platform", requir...
RTCDataChannel - Web APIs
ge data receives a datachannel event (which has type rtcdatachannelevent) to let it know the data channel has been added to the connection. propertiesalso inherits properties from: eventtargetbinarytype the property binarytype on the rtcdatachannel interface is a domstring which specifies the type of javascript object which should be used to represent binary data received on the rtcdatachannel. values allowed by the websocket.binarytype property are also permitted here: "blob" if blob objects are being used or "arraybuffer" if arraybuffer objects are being used. the default is "blob".bufferedamount read only the read-only rtcdatachannel property bufferedamount returns the number of bytes of data currently queued to be sent over the data channel.bufferedamountlowthreshold the rtcdatachannel...
...r objects are being used. the default is "blob".bufferedamount read only the read-only rtcdatachannel property bufferedamount returns the number of bytes of data currently queued to be sent over the data channel.bufferedamountlowthreshold the rtcdatachannel property bufferedamountlowthreshold is used to specify the number of bytes of buffered outgoing data that is considered "low." the default value is 0.id read only the read-only rtcdatachannel property id returns an id number (between 0 and 65,534) which uniquely identifies the rtcdatachannel.label read only the read-only rtcdatachannel property label returns a domstring containing a name describing the data channel. these labels are not required to be unique.maxpacketlifetime read only the read-only rtcdatachannel property maxpacket...
...l property ordered indicates whether or not the data channel guarantees in-order delivery of messages; the default is true, which indicates that the data channel is indeed ordered.protocol read only the read-only rtcdatachannel property protocol returns a domstring containing the name of the subprotocol in use. ...
...nel.close() method closes the rtcdatachannel. either peer is permitted to call this method to initiate closure of the channel.send()the send() method of the rtcdatachannel interface sends data across the data channel to the remote peer. events bufferedamountlow sent to the channel's onbufferedamountlow event handler when the number of bytes of data in the outgoing data buffer falls below the value specified by bufferedamountlowthreshold. close sent to the onclose event handler when the underlying data transport closes. error sent to the onerror event handler when an error occurs on the data channel. message sent to the onmessage event handler when a message has been received from the remote peer. the message contents can be found in the event's data property. open sent to the onope...
RTCDtlsTransport.state - Web APIs
connecting dtls is in the process of negotiating a secure connection and verifying the remote fingerprint. ...
... connecting dtls is in the process of negotiating a secure connection and verifying the remote fingerprint. ...
... connecting dtls is in the process of negotiating a secure connection and verifying the remote fingerprint. ...
...tcpeerconnection.close(). failed the transport has failed as the result of an error (such as receipt of an error alert or failure to validate the remote fingerprint). examples this example presents a function, tallysenders(), which iterates over an rtcpeerconnection's rtcrtpsenders, tallying up how many of them are in various states. the function returns an object containing properties whose values indicate how many of the senders are in each state. let pc = new rtcpeerconnection({ bundlepolicy: "max-bundle" }); /* ... */ function tallysenders(pc) { let results = { transportmissing: 0, connectionpending: 0, connected: 0, closed: 0, failed: 0, unknown: 0 }; let senderlist = pc.getsenders(); senderlist.foreach(sender => { let transport = sender.transpo...
RTCIceCandidate.priority - Web APIs
the rtcicecandidate interface's read-only priority property specifies the candidate's priority according to the remote peer; the higher this value is, the better the remote peer considers the candidate to be. as is the case with most of rtcicecandidate's properties, the value of priority is extracted from the candidate a-line string specified when creating the rtcicecandidate. the a-line string is obtained either from the rtcicecandidateinit property candidate or from an a-line string passed into rtcpeerconnection.addicecandidate() instead of an rtcicecandidate. ...
... priority is initialized to null if it is not specified in the candidate, or if the candidate string can't be parsed propertly. ...
... priority is initialized to null if it is not specified in the candidate, or if the candidate string can't be parsed propertly. ...
...when creating the rtcicecandidate. the a-line string is obtained either from the rtcicecandidateinit property candidate or from an a-line string passed into rtcpeerconnection.addicecandidate() instead of an rtcicecandidate. syntax var priority = rtcicecandidate.priority; value a long, unsigned integer value indicating the priority of the candidate according to the remote peer. the larger this value is, the more preferable the remote peer considers this candidate to be. priority is initialized to null if it is not specified in the candidate, or if the candidate string can't be parsed propertly. note: if priority is null, passing the candidate to addicecandidate() will fail, throwing an operationerror exception. this applies only if the candidate implements the priority property. usage n...
RTCIceCandidate.type - Web APIs
these candidate types are listed in order of priority; the higher in the list they are, the more efficient they are. ...
... these candidate types are listed in order of priority; the higher in the list they are, the more efficient they are. ...
... these candidate types are listed in order of priority; the higher in the list they are, the more efficient they are. ...
... these candidate types are listed in order of priority; the higher in the list they are, the more efficient they are. ...
RTCIceCandidate.usernameFragment - Web APIs
the read-only usernamefragment property on the rtcicecandidate interface is a string indicating the username fragment ("ufrag") that uniquely identifies a single ice interaction session. this value is specified when creating the rtcicecandidate by setting the corresponding usernamefragment value in the rtcicecandidateinit object when creating a new candidate with new rtcicecandidate(). note that 24 bits of the username fragment are required to be randomized by the browser. see randomization below for details. ...
...ting the rtcicecandidate by setting the corresponding usernamefragment value in the rtcicecandidateinit object when creating a new candidate with new rtcicecandidate(). note that 24 bits of the username fragment are required to be randomized by the browser. see randomization below for details. if you instead call rtcicecandidate() with a string parameter containing the candidate m-line text, the value of usernamefragment is extracted from the m-line. syntax var ufrag = rtcicecandidate.usernamefragment; value a domstring containing the username fragment (usually referred to in shorthand as "ufrag" or "ice-ufrag") that, along with the ice password ("ice-pwd"), uniquely identifies a single ongoing ice interaction, including for any communication with the stun server. the string may be up to 2...
... randomization at least 24 bits of the text in the ufrag are required to be randomly selected by the ice layer at the beginning of the ice session. the specifics for which bits are random and what the remainder of the ufrag text are are left up to the browser implementation to decide. ...
...e ice password, for what should be fairly obvious security reasons. the usernamefragment and password both change every time an ice restart occurs. example although the webrtc infrastructure will filter out obsolete candidates for you after an ice restart, you can do it yourself if you're trying to absolutely minimize the number of messages going back and forth. to do so, you can compare the value of usernamefragment to the current usernamefragment being used for the connection after receiving the candidate from the signaling server and before caling addicecandidate() to add it to the set of possible candidates. when the web app receives a message from the signaling server that includes a candidate to be added to the rtcpeerconnection, you can (and generally should) simply call addicecand...
RTCIceCandidate - Web APIs
s works, see lifetime of a webrtc session. the article webrtc connectivity provides additional useful details. constructor rtcicecandidate() creates an rtcicecandidate object to represent a single ice candidate, optionally configured based on an object based on the rtcicecandidateinit dictionary. note: for backward compatibility, the constructor also accepts as input a string containing the value of the candidate property instead of a rtcicecandidateinit object, since the candidate includes all of the information that rtcicecandidateinit does and more. properties candidate read only a domstring representing the transport address for the candidate that can be used for connectivity checks. the format of this address is a candidate-attribute as defined in rfc 5245. this string is em...
...candidate read only a domstring representing the transport address for the candidate that can be used for connectivity checks. the format of this address is a candidate-attribute as defined in rfc 5245. this string is empty ("") if the rtcicecandidate is an "end of candidates" indicator. component read only a domstring which indicates whether the candidate is an rtp or an rtcp candidate; its value is either "rtp" or "rtcp", and is derived from the "component-id" field in the candidate a-line string. the permitted values are listed in the rtcicecomponent enumerated type. foundation read only returns a domstring containing a unique identifier that is the same for any candidates of the same type, share the same base (the address from which the ice agent sent the candidate), and come from ...
... same for any candidates of the same type, share the same base (the address from which the ice agent sent the candidate), and come from the same stun server. this is used to help optimize ice performance while prioritizing and correlating candidates that appear on multiple rtcicetransport objects. ip read only a domstring containing the ip address of the candidate. port read only an integer value indicating the candidate's port number. priority read only a long integer value indicating the candidate's priority. protocol read only a string indicating whether the candidate's protocol is "tcp" or "udp". the string is one of those in the enumerated type rtciceprotocol. relatedaddress read only if the candidate is derived from another candidate, relatedaddress is a domstring containin...
... relatedport read only for a candidate that is derived from another, such as a relay or reflexive candidate, the relatedport is a number indicating the port number of the candidate from which this candidate is derived. for host candidates, the relatedport property is null. ...
RTCIceCandidatePairStats.availableOutgoingBitrate - Web APIs
the rtcicecandidatepairstats property availableoutgoingbitrate returns a value indicative of the available outbound capacity of the network connection represented by the candidate pair. the higher the value, the more bandwidth you can assume is available for outgoing data. you can get the incoming available bitrate from availableincomingbitrate. syntax availableoutgoingbitrate = rtcicecandidatepairstats.availableoutgoingbitrate; value a floating-point value which approximates the amount of available bandwidth for outgoing data on the network connection described by the rtcicecandidatepair. the value is reported in bits per second and is computed over a 1-second interval. ...
... available bitrate from availableincomingbitrate. syntax availableoutgoingbitrate = rtcicecandidatepairstats.availableoutgoingbitrate; value a floating-point value which approximates the amount of available bandwidth for outgoing data on the network connection described by the rtcicecandidatepair. the value is reported in bits per second and is computed over a 1-second interval. the returned value is undefined in each of the following situations: the underlying implementation doesn't support computing a sender-side estimate of the outgoing bit rate. the rtcicecandidatepair described by this object has never been used. ...
...epair. the value is reported in bits per second and is computed over a 1-second interval. the returned value is undefined in each of the following situations: the underlying implementation doesn't support computing a sender-side estimate of the outgoing bit rate. the rtcicecandidatepair described by this object has never been used. the candidate pair was once in use, but no longer is. the value returned is calculated by adding up the available bit rate for every rtp stream using the connection described by this candidate pair. the returned value doesn't take into account overhead introduced by underlying protocols, including ip, udp, or tcp. ...
...candidatepair described by this object has never been used. the candidate pair was once in use, but no longer is. the value returned is calculated by adding up the available bit rate for every rtp stream using the connection described by this candidate pair. the returned value doesn't take into account overhead introduced by underlying protocols, including ip, udp, or tcp. note: the returned value is computed using a method similar—but not identical—to the transport independent application specific maximum (tias) described in rfc 3890: 6.2. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.availableoutgoingbitrate' in that specification. candidate recommendation initial spe...
RTCIceCandidatePairStats.totalRoundTripTime - Web APIs
the rtcicecandidatepairstats dictionary's totalroundtriptime property is the total time that has elapsed between sending stun requests and receiving the responses, for all such requests that have been made so far on the pair of candidates described by this rtcicecandidatepairstats object. this value includes both connectivity check and consent check requests. ...
... dictionary's totalroundtriptime property is the total time that has elapsed between sending stun requests and receiving the responses, for all such requests that have been made so far on the pair of candidates described by this rtcicecandidatepairstats object. this value includes both connectivity check and consent check requests. ...
...ime property is the total time that has elapsed between sending stun requests and receiving the responses, for all such requests that have been made so far on the pair of candidates described by this rtcicecandidatepairstats object. this value includes both connectivity check and consent check requests. ...
...otalrtt = rtcicecandidatepairstats.totalroundtriptime; value this floating-point value indicates the total number of seconds which have elapsed between sending out stun connectivity and consent check requests and receiving their responses, for all such requests made so far on the connection described by this candidate pair. you can calculate the average round-trip time (rtt) by dividing this value by the value of the responsesreceived property: rtt = rtcicecandidatepairstats.totalroundtriptime / rtcicecandidatepairstats.responsesreceived; specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.totalroundtriptime' in that specification. candidate recommendation initial speci...
RTCIceServer.credentialType - Web APIs
this process is detailed in rfc 7635. this property was formerly called token. ...
...this process is detailed in rfc 7635. this property was formerly called token. ...
...this process is detailed in rfc 7635. this property was formerly called token. ...
...this process is detailed in rfc 7635. this property was formerly called token. ...
RTCPeerConnection() - Web APIs
device and a remote peer. syntax pc = new rtcpeerconnection([configuration]); parameters configuration optional an rtcconfiguration dictionary providing options to configure the new connection. rtcconfiguration dictionary bundlepolicy optional specifies how to handle negotiation of candidates when the remote peer is not compatible with the sdp bundle standard. this must be one of the values from the enum rtcbundlepolicy. if this value isn't included in the dictionary, "balanced" is assumed. certificates optional an array of objects of type rtccertificate which are used by the connection for authentication. if this property isn't specified, a set of certificates is generated automatically for each rtcpeerconnection instance. although only one certificate is used by a given connect...
...ltiple algorithms may improve the odds of successfully connecting in some circumstances. see using certificates below for additional information. this configuration option cannot be changed after it is first specified; once the certificates have been set, this property is ignored in future calls to rtcpeerconnection.setconfiguration(). icecandidatepoolsize optional an unsigned 16-bit integer value which specifies the size of the prefetched ice candidate pool. the default value is 0 (meaning no candidate prefetching will occur). you may find in some cases that connections can be established more quickly by allowing the ice agent to start fetching ice candidates before you start trying to connect, so that they're already available for inspection when rtcpeerconnection.setlocaldescription() i...
... iceservers optional an array of rtciceserver objects, each describing one server which may be used by the ice agent; these are typically stun and/or turn servers. if this isn't specified, the connection attempt will be made with no stun or turn server available, which limits the connection to local peers. icetransportpolicy optional the current ice transport policy; this must be one of the values from the rtcicetransportpolicy enum. if this isn't specified, "all" is assumed. peeridentity optional a domstring which specifies the target peer identity for the rtcpeerconnection. if this value is set (it defaults to null), the rtcpeerconnection will not connect to a remote peer unless it can successfully authenticate with the given name. rtcpmuxpolicy optional the rtcp mux policy to use w...
...umed. peeridentity optional a domstring which specifies the target peer identity for the rtcpeerconnection. if this value is set (it defaults to null), the rtcpeerconnection will not connect to a remote peer unless it can successfully authenticate with the given name. rtcpmuxpolicy optional the rtcp mux policy to use when gathering ice candidates, in order to support non-multiplexed rtcp. the value must be one of those from the rtcrtcpmuxpolicy enum. the default is "require". return value a newly-created rtcpeerconnection object, configured as described by configuration, if specified; otherwise, configured to appropriate basic defaults. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconne...
RTCPeerConnection.createDataChannel() - Web APIs
it your needs: ordered optional indicates whether or not messages sent on the rtcdatachannel are required to arrive at their destination in the same order in which they were sent (true), or if they're allowed to arrive out-of-order (false). default: true. maxpacketlifetime optional the maximum number of milliseconds that attempts to transfer a message may take in unreliable mode. while this value is a 16-bit unsigned number, each user agent may clamp it to whatever maximum it deems appropriate. default: null. maxretransmits optional the maximum number of times the user agent should attempt to retransmit a message which fails the first time in unreliable mode. while this value is a16-bit unsigned number, each user agent may clamp it to whatever maximum it deems appropriate. default: null...
...l by default (false), data channels are negotiated in-band, where one side calls createdatachannel, and the other side listens to the rtcdatachannelevent event using the ondatachannel eventhandler . alternatively (true), they can be negotiated out of-band, where both sides call createdatachannel with an agreed-upon id. default: false. ...
... exceptions invalidstateerror the rtcpeerconnection is closed. ...
... by options if that parameter is included; otherwise, the defaults listed above are established. exceptions invalidstateerror the rtcpeerconnection is closed. typeerror this can happen in a couple of situations: the label and/or protocol string is too long; these cannot be longer than 65,535 bytes (bytes, rather than characters). the id is 65535. while this is a valid unsigned 16-bit value, it's not a permitted value for id. syntaxerror values were specified for both the maxpacketlifetime and maxretransmits options. you may only specify a non-null value for one of these. resourceinuse an id was specified, but another rtcdatachannel is already using the same value. operationerror either the specified id is already in use or, if no id was specified, the webrtc layer was una...
RTCPeerConnection.setConfiguration() - Web APIs
this lets you change the ice servers used by the connection and which transport policies to use. the most common use case for this method (and even then, probably not a very common use case) is to replace the set of ice servers to be used. two potential scenarios in which this might be done: the rtcpeerconnection was instantiated without specifying any ice servers. ...
...n, one might call setconfiguration() to switch to new regional ice servers, then initiate an ice restart. you cannot change the identity information for a connection once it's already been set. syntax rtcpeerconnection.setconfiguration(configuration); parameters configuration an rtcconfiguration object which provides the options to be set. the changes are not additive; instead, the new values completely replace the existing ones. exceptions invalidaccesserror one or more of the urls specified in configuration.iceservers is a turn server, but complete login information is not provided (that is, either the rtciceserver.username or rtciceserver.credentials is missing). this prevents successful login to the server. invalidmodificationerror the configuration includes changed ident...
...ogin information is not provided (that is, either the rtciceserver.username or rtciceserver.credentials is missing). this prevents successful login to the server. invalidmodificationerror the configuration includes changed identity information, but the connection already has identity information specified. this happens if configuration.peeridentity or configuration.certificates is set and their values differ from the current configuration. invalidstateerror the rtcpeerconnection is closed. syntaxerror one or more of the urls provided in the configuration.iceservers list is invalid. example in this example, it has already been determined that ice restart is needed, and that negotiation needs to be done using a different ice server. var restartconfig = { iceservers: [{ ...
... { return mypeerconnection.setlocaldescription(offer); }) .then(function() { // send the offer to the other peer using the signaling server }) .catch(reporterror); first, a new rtcconfiguration is created, restartconfig, specifying the new ice server and its credentials. this is then passed into setconfiguration(). ice negotiation is restarted by calling createoffer(), specifying true as the value of the icerestart option. from there, we handle the process as usual, by setting the local description to the returned offer and then sending that offer to the other peer. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'setconfiguration()' in that specification. candidate recommendation initial defi...
RTCRtpContributingSource.audioLevel - Web APIs
the read-only audiolevel property of the rtcrtpcontributingsource interface indicates the audio level contained in the last rtp packet played from the described source. audiolevel will be the level value defined in [rfc6465] if the rfc 6465 header extension is present, and otherwise null. syntax var audiolevel = rtcrtpcontributingsource.audiolevel value a double-precision floating-point number which indicates the volume level of the audio in the most recently received rtp packet from the source described by the rtcrtpcontributingsource. ...
...scribed source. audiolevel will be the level value defined in [rfc6465] if the rfc 6465 header extension is present, and otherwise null. syntax var audiolevel = rtcrtpcontributingsource.audiolevel value a double-precision floating-point number which indicates the volume level of the audio in the most recently received rtp packet from the source described by the rtcrtpcontributingsource. this value, which is in the range 0.0 to 1.0, is on a linear scale and its value is defined in dbov, or decibels (overload). this is the amplitude relative to the point at which clipping of the audio begins to occur. ...
...e-precision floating-point number which indicates the volume level of the audio in the most recently received rtp packet from the source described by the rtcrtpcontributingsource. this value, which is in the range 0.0 to 1.0, is on a linear scale and its value is defined in dbov, or decibels (overload). this is the amplitude relative to the point at which clipping of the audio begins to occur. a value of 1.0 represents 0 dbov (maximum volume), a value of 0.0 represents silence, and a value of 0.5 represents approximately 6 db spl (decibels of sound pressure level) change in the sound pressure level from 0 dbov. ...
... audiolevel may be absent from rtcrtpcontributingsource objects, which indicates that no volume level was provided by the source; however, it is required and always available on all rtcrtpsynchronizationsource objects. ...
RTCRtpEncodingParameters.scaleResolutionDownBy - Web APIs
the rtcrtpencodingparameters dictionary's scaleresolutiondownby property can be used to specify a factor by which to reduce the size of a video track during encoding. this property is only available for tracks whose kind is video. ...
...h to reduce the size of a video track during encoding. this property is only available for tracks whose kind is video. syntax rtpencodingparameters.scaleresolutiondownby = scalingfactor; rtpencodingparameters = { scaleresolutiondownby: scalingfactor }; value a double-precison floating-point number specifying the amount by which to reduce the size of the video during encoding. the default value, 1.0, means that the video will be encoded at its original size. ...
...only available for tracks whose kind is video. syntax rtpencodingparameters.scaleresolutiondownby = scalingfactor; rtpencodingparameters = { scaleresolutiondownby: scalingfactor }; value a double-precison floating-point number specifying the amount by which to reduce the size of the video during encoding. the default value, 1.0, means that the video will be encoded at its original size. a value of 2.0 would reduce the size of the video by a factor of 2 both horizontally and vertically, resulting in a video 25% the original size. ...
...scaleresolutiondownby: scalingfactor }; value a double-precison floating-point number specifying the amount by which to reduce the size of the video during encoding. the default value, 1.0, means that the video will be encoded at its original size. a value of 2.0 would reduce the size of the video by a factor of 2 both horizontally and vertically, resulting in a video 25% the original size. a value less than 1.0 would cause the video to get larger rather than smaller, which is not the intent of this property. therefore, specifying a value less than 1.0 is not permitted and will cause a rangeerror exception to be thrown by rtcpeerconnection.addtransceiver() or rtcrtpsender.setparameters(). specifications specification status comment webrtc 1.0: real-time communicati...
RTCSessionDescription() - Web APIs
ibed in the specified object. this constructor has been deprecated because rtcpeerconnection.setlocaldescription() and other methods which take sdp as input now directly accept an object conforming to the rtcsessiondescriptioninit dictionary, so you don't have to instantiate an rtcsessiondescription yourself. ...
...tcpeerconnection.setlocaldescription() and other methods which take sdp as input now directly accept an object conforming to the rtcsessiondescriptioninit dictionary, so you don't have to instantiate an rtcsessiondescription yourself. syntax sessiondescription = new rtcsessiondescription(rtcsessiondescriptioninit); values rtcsessiondescriptioninit optional an object providing the default values for the session description; the object conforms to the rtcsessiondescriptioninit dictionary. that dictionary has the following properties: type required. a string which is a member of the rtcsdptype enum; it must have one of the following values: this enum defines strings that describe the current state of the session description, as used in the type property. the session description's ...
...conforms to the rtcsessiondescriptioninit dictionary. that dictionary has the following properties: type required. a string which is a member of the rtcsdptype enum; it must have one of the following values: this enum defines strings that describe the current state of the session description, as used in the type property. the session description's type will be specified using one of these values. value description answer the sdp contained in the sdp property is the definitive choice in the exchange. in other words, this session description describes the agreed-upon configuration, and is being sent to finalize negotiation. offer the session description object describes the initial proposal in an offer/answer exchange. the session negotiation proce...
... pranswer the session description object describes a provisional answer; that is, a response to a previous offer that is not the final answer. it is usually employed by legacy hardware. rollback this special type with an empty session description is used to roll back to the previous stable state. sdp a string containing a sdp message describing the session. this value is an empty string ("") by default and may not be null. example this example uses the constructor to convert an sdp offer into an rtcsessiondescription object. this is no longer necessary, however; rtcpeerconnection.setlocaldescription() and other methods which take sdp as input now directly accept an object conforming to the rtcsessiondescriptioninit dictionary, so you don't have to ins...
RTCSessionDescription.sdp - Web APIs
the property rtcsessiondescription.sdp is a read-only domstring containing the sdp which describes the session. ...
... the property rtcsessiondescription.sdp is a read-only domstring containing the sdp which describes the session. ...
... the property rtcsessiondescription.sdp is a read-only domstring containing the sdp which describes the session. ...
... the property rtcsessiondescription.sdp is a read-only domstring containing the sdp which describes the session. ...
ReadableStream.tee() - Web APIs
the browser, but also stream it to the serviceworker cache. since a response body cannot be consumed more than once, you’d need two copies to do this. to cancel the stream you then need to cancel both resulting branches. teeing a stream will generally lock it for the duration, preventing other readers from locking it. syntax var teedstreams = readablestream.tee(); parameters none. return value an array containing two readablestream instances. exceptions typeerror the source stream is not a readablestream. examples in the following simple example, a previously-created stream is teed, then both resulting streams (contained in two members of a generated array) are passed to a function that reads the data out of the two streams and prints each stream's chunks sequentially to a dif...
...nd prints each stream's chunks sequentially to a different part of the ui. see simple tee example for the full code. ...
... see simple tee example for the full code. ...
... fetchstream(teedoff[1], list3); } function fetchstream(stream, list) { const reader = stream.getreader(); let charsreceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processtext({ done, value }) { // result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. always undefined when done is true. if (done) { console.log("stream complete"); 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.appendchi...
ReadableStreamDefaultReader.ReadableStreamDefaultReader() - Web APIs
the readablestreamdefaultreader() constructor creates and returns a readablestreamdefaultreader object instance. note: you generally wouldn't use this constructor manually; instead, you'd use the readablestream.getreader() method. syntax var readablestreamdefaultreader = new readablestreamdefaultreader(stream); parameters stream the readablestream to be read. return value an instance of the readablestreamdefaultreader object. exceptions typeerror the supplied stream parameter is not a readablestream, or it is already locked for reading by another reader. examples in the following simple example, a previously-created custom readablestream is read using a readablestreamdefaultreader created using getreader(). (see our simple random stream example for the full code). each chu...
...simple random stream example for the full code). each chunk is read sequentially and output to the ui, until the stream has finished being read, at which point we return out of the recursive function and print the entire stream to another part of the ui. ...
...tially and output to the ui, until the stream has finished being read, at which point we return out of the recursive function and print the entire stream to another part of the ui. ...
...t the entire stream to another part of the ui. function fetchstream() { const reader = stream.getreader(); let charsreceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processtext({ done, value }) { // result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. always undefined when done is true. if (done) { console.log("stream complete"); para.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 ...
SVGFEColorMatrixElement - Web APIs
svg_fe...
...-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgfecolormatrixelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constants name value description svg_fecolormatrix_type_unknown 0 the type is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_fecolormatrix_type_matrix 1 corresponds to the matrix value. svg_fecolormatrix_type_saturate 2 corresponds to the saturate value. svg_fecolormatrix_type_huerotate 3 corresponds to huerotate value. svg_fecolormatrix_type_luminancetoalpha 4 corresponds to luminancetoa...
... properties this interface also inherits properties from its parent interface, svgelement , and also implements properties of svgfilterprimitivestandardattributes. svgfecolormatrixelement.in1 read only an svganimatedstring corresponding to the in attribute of the given element. ...
...rties of svgfilterprimitivestandardattributes. svgfecolormatrixelement.in1 read only an svganimatedstring corresponding to the in attribute of the given element. svgfecolormatrixelement.type read only an svganimatedenumeration corresponding to the type attribute of the given element. it takes one of the svg_fecolormatrix_type_* constants defined on this interface. svgfecolormatrixelement.values read only an svganimatednumberlist corresponding to the values attribute of the given element. methods this interface does not provide any specific methods, but implements those of its parent, svgelement , and also implements methods of svgfilterprimitivestandardattributes. specifications specification status comment filter effects module level 1the definition of '...
SVGMarkerElement - Web APIs
marker_orient_angle = 2 svg_markerunits_unknown = 0 svg_markerunits_userspaceonuse = 1 svg_markerunits_strokewidth = 2 normative document svg 1.1 (2nd edition) constants orientation name value description svg_marker_orient_unknown 0 the marker orientation is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_marker_orient_auto 1 attribute orient has value 'auto'. ...
... 0 the marker orientation is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_marker_orient_auto 1 attribute orient has value 'auto'. svg_marker_orient_angle 2 attribute orient has an angle value. units name value description svg_markerunits_unknown 0 the marker unit type is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. ...
... orienttype svganimatedenumeration corresponds to attribute orient on the given marker element. one of the marker orientation types defined on this interface. orientangle svganimatedangle corresponds to attribute orient on the given marker element. if markerunits is svg_marker_orient_angle, the angle value for attribute orient; otherwise, it will be set to zero. methods this also inherits methods from its parent, svgelement, and implements properties from svgstylable. setorienttoangle(in svgangle angle) void sets the value of attribute orient to the given angle. ...
... exceptions: a domexception with code no_modification_allowed_err is raised when the object itself is read only. ...
SecurityPolicyViolationEvent.SecurityPolicyViolationEvent() - Web APIs
itdict optional a dictionary object containing information about the properties of the securitypolicyviolationevent to be constructed. this can include the following properties, but bear in mind that if you do include an eventinitdict, certain properties must be included (marked below with required): blockeduri: the blockeduri of the securitypolicyviolationevent. if not included, the default value is "". columnnumber: the columnnumber of the securitypolicyviolationevent. if not included, the default value is 0. disposition: the disposition of the securitypolicyviolationevent (required). documenturi: the documenturi of the securitypolicyviolationevent (required). effectivedirective: the effectivedirective of the securitypolicyviolationevent (required). linenumber: the linenumber o...
...lationevent. if not included, the default value is 0. disposition: the disposition of the securitypolicyviolationevent (required). documenturi: the documenturi of the securitypolicyviolationevent (required). effectivedirective: the effectivedirective of the securitypolicyviolationevent (required). linenumber: the linenumber of the securitypolicyviolationevent. if not included, the default value is 0. originalpolicy: the originalpolicy of the securitypolicyviolationevent (required). referrer: the referrer of the securitypolicyviolationevent. if not included, the default value is "". sample: the sample of the securitypolicyviolationevent. if not included, the default value is "". ...
... example let spvevt = new securitypolicyviolationevent('foo', { ... ...
... example let spvevt = new securitypolicyviolationevent('foo', { ... ...
Using server-sent events - Web APIs
ter of a line is in essence a comment, and is ignored. note: the comment line can be used to prevent connections from timing out; a server can send a comment periodically to keep the connection alive. each message consists of one or more lines of text listing the fields for that message. each field is represented by the field name, followed by a colon, followed by the text data for that field's value. fields each message received has some combination of the following fields, one per line: event a string identifying the type of event described. if this is specified, an event will be dispatched on the browser to the listener for the specified event name; the website source code should use addeventlistener() to listen for named events. the onmessage handler is called if no event name is sp...
...listener() to listen for named events. the onmessage handler is called if no event name is specified for a message. data the data field for the message. when the eventsource receives multiple consecutive lines that begin with data:, it concatenates them, inserting a newline character between each one. trailing newlines are removed. id the event id to set the eventsource object's last event id value. retry the reconnection time to use when attempting to send the event. this must be an integer, specifying the reconnection time in milliseconds. if a non-integer value is specified, the field is ignored. all other field names are ignored. note: if a line doesn't contain a colon, the entire line is treated as the field name with an empty value string. examples data-only messages in the fo...
... colon, the entire line is treated as the field name with an empty value string. examples data-only messages in the following example, there are three messages sent. the first is just a comment, since it starts with a colon character. as mentioned previously, this can be useful as a keep-alive mechanism if messages might not be sent regularly. the second message contains a data field with the value "some text". the third message contains a data field with the value "another message\nwith two lines". note the newline special character in the value. : this is a test stream data: some text data: another message data: with two lines named events this example sends named events. ...
...the data field could, of course, have any string data; it doesn't have to be json. ...
ServiceWorkerRegistration.showNotification() - Web APIs
x ​serviceworkerregistration.shownotification(title, [options]); parameters title the title that must be shown within the notification options optional an object that allows configuring the notification. it can have the following properties: actions: an array of actions to display in the notification. the members of the array should be an object literal. it may contain the following values: action: a domstring identifying a user action to be displayed on the notification. title: a domstring containing action text to be shown to the user. icon: a usvstring containing the url of an icon to display with the action. appropriate responses are built using event.action within the notificationclick event. badge: a usvstring containing the url of an image to repres...
...or rtl icon: a usvstring containing the url of an image to be used as an icon by the notification. image: a usvstring containing the url of an image to be displayed in the notification. lang: specify the lang used within the notification. this string must be a valid bcp 47 language tag. renotify: a boolean that indicates whether to suppress vibrations and audible alerts when reusing a tag value. ...
... renotify: a boolean that indicates whether to suppress vibrations and audible alerts when reusing a tag value. if options’s renotify is true and options’s tag is the empty string a typeerror will be thrown. the default is false. requireinteraction: indicates that on devices with sufficiently large screens, a notification should remain active until the user clicks or dismisses it. if this value is absent or false, the desktop version of chrome will auto-minimize notifications after approximately twenty seconds. the default value is false. silent: when set indicates that no sounds or vibrations should be made. if options’s silent is true and options’s vibrate is present a typeerror exception will be thrown. the default value is false. tag: an id for a given notification that allo...
...ate the time at which a notification is actual. for example, this could be in the past when a notification is used for a message that couldn’t immediately be delivered because the device was offline, or in the future for a meeting that is about to start. vibrate: a vibration pattern to run with the display of the notification. a vibration pattern can be an array with as few as one member. the values are times in milliseconds where the even indices (0, 2, 4, etc.) indicate how long to vibrate and the odd indices indicate how long to pause. for example, [300, 100, 400] would vibrate 300ms, pause 100ms, then vibrate 400ms. return value a promise that resolves to undefined. examples navigator.serviceworker.register('sw.js'); function shownotification() { notification.requestpermissi...
Using Service Workers - Web APIs
promises can do a variety of things, but all you need to know for now is that if something returns a promise, you can attach .then() to the end and include callbacks inside it for success cases, or you can insert .catch() on the end if you want to include a failure callback. let’s compare a traditional synchronous callback structure to its asynchronous promise equivalent. ...
..., but all you need to know for now is that if something returns a promise, you can attach .then() to the end and include callbacks inside it for success cases, or you can insert .catch() on the end if you want to include a failure callback. let’s compare a traditional synchronous callback structure to its asynchronous promise equivalent. sync try { const value = myfunction(); console.log(value); } catch(err) { console.log(err); } async myfunction().then((value) => { console.log(value); }).catch((err) => { console.log(err); }); in the first example, we have to wait for myfunction() to run and return value before any more of the code can execute. in the second example, myfunction() returns a promise for value, then the rest of the code can carry on running. when the promise reso...
...esolve at the same time as the iterations are being done (that is a synchronous process.) we actually resolve the promise with an array, as we want to make the loaded image blob available to the resolving function later on in the code, but also the image name, credits and alt text (see app.js lines 31-34). promises will only resolve with a single argument, so if you want to resolve with multiple values, you need to use an array/object. to access the resolved promise values, we then access this function as you’d then expect (see app.js lines 60-64). this may seem a bit odd at first, but this is the way promises work. enter service workers note : we're using the es6 arrow functions syntax in the service worker implementation now let’s get on to service workers! registering your worker ...
...avascript file residing inside our app (note this is the file's url relative to the origin, not the js file that references it.) the scope parameter is optional, and can be used to specify the subset of your content that you want the service worker to control. in this case, we have specified '/sw-test/', which means all content under the app's origin. if you leave it out, it will default to this value anyway, but we specified it here for illustration purposes. the .then() promise function is used to chain a success case onto our promise structure. when the promise resolves successfully, the code inside it executes. finally, we chain a .catch() function onto the end that will run if the promise is rejected. this registers a service worker, which runs in a worker context, and therefore has ...
SharedWorker - Web APIs
ing the sharedworker.port property. ...
...dworker.port property. ...
...the ports associated with that worker are accessible in the connect event's ports property — we t...
...the ports associated with that worker are accessible in the connect event's ports property — we then use messa...
SourceBuffer.mode - Web APIs
Web › API › SourceBuffer › mode
the mode property of the sourcebuffer interface controls whether media segments can be appended to the sourcebuffer in any order, or in a strict sequence. the two available values are: segments: the media segment timestamps determine the order in which the segments are played. the segments can be appended to the sourcebuffer in any order. sequence: the order in which the segments are appended to the sourcebuffer determines the order in which they are played. segment timestamps are generated automatically for the segments that observe this order. ...
...lable values are: segments: the media segment timestamps determine the order in which the segments are played. the segments can be appended to the sourcebuffer in any order. sequence: the order in which the segments are appended to the sourcebuffer determines the order in which they are played. segment timestamps are generated automatically for the segments that observe this order. the mode value is initially set when the sourcebuffer is created using mediasource.addsourcebuffer(). if timestamps already exist for the media segments, then the value will be set to segments; if they don't, then the value will be set to sequence. if you try to set the mode property value to segments when the initial value is sequence, an exception will be thrown. the existing segment order must be maintained...
...ed using mediasource.addsourcebuffer(). if timestamps already exist for the media segments, then the value will be set to segments; if they don't, then the value will be set to sequence. if you try to set the mode property value to segments when the initial value is sequence, an exception will be thrown. the existing segment order must be maintained in sequence mode. you can, however, change the value from segments to sequence. it just means the play order will be fixed, and new timestamps generated to reflect this. this property cannot be changed during while the sourcebuffer is processing either an appendbuffer() or remove() call. syntax var mymode = sourcebuffer.mode; sourcebuffer.mode = 'sequence'; value a domstring. exceptions the following exceptions may be thrown when setting a...
... segments to sequence. it just means the play order will be fixed, and new timestamps generated to reflect this. this property cannot be changed during while the sourcebuffer is processing either an appendbuffer() or remove() call. syntax var mymode = sourcebuffer.mode; sourcebuffer.mode = 'sequence'; value a domstring. exceptions the following exceptions may be thrown when setting a new value for this property. exception explanation invalidaccesserror an attempt was made to set the value to segments when the initial value is sequence. invalidstateerror the sourcebuffer object is being updated (i.e. its sourcebuffer.updating property is currently true), the last media segment appended to this sourcebuffer is incomplete, or this sourcebuffer has ...
StaticRange - Web APIs
staticrange.endcontainer read only returns the dom node which contains the ending point of the range. the offset into the ...
...iddle">staticrange</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constructor staticrange() creates a new staticrange object given the staticrangeinit dictionary specifying the default values for its properties. properties the properties below are inherited from its parent interface, abstractrange. staticrange.collapsed read only returns a boolean value which is true if the range's start and end positions are the same, resulting in a range of length 0. ...
...ange.collapsed read only returns a boolean value which is true if the range's start and end positions are the same, resulting in a range of length 0. staticrange.endcontainer read only returns the dom node which contains the ending point of the range. the offset into the node at which the end position is located is indicated by endoffset. staticrange.endoffset read only returns an integer value indicating the offset into the node given by endcontainer at which the last character of the range is found. staticrange.startcontainer read only returns the dom node which contains the starting point of the range (which is in turn identified by startoffset. ...
...dicated by endoffset. staticrange.endoffset read only returns an integer value indicating the offset into the node given by endcontainer at which the last character of the range is found. staticrange.startcontainer read only returns the dom node which contains the starting point of the range (which is in turn identified by startoffset. staticrange.startoffset read only returns an integer value indicating the offset into the node specified by startcontainer at which the first character of the range is located. methods staticrange.torange() returns a new range object which describes the same range as the source staticrange, but is "live" with values that change to reflect changes in the contents of the dom tree. usage notes a dom range specifies a span of content in a document, ...
StereoPannerNode.StereoPannerNode() - Web APIs
de that can be used to pan an audio stream left or right. syntax var stereopannernode = stereopannernode(context, options) parameters inherits parameters from the audionodeoptions dictionary. context a reference to an audiocontext. options optional options are as follows: pan: a floating point number in the range [-1,1] indicating the position of an audionode in an output image. the value -1 represents full left and 1 represents full right. the default value is 0. return value a new stereopannernode object instance. specifications specification status comment web audio apithe definition of 'stereopannernode()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is genera...
...pat-data and send us a pull request. ...
... 53ie no support noopera full support 42safari no support nowebview android full support 55notes full support 55notes notes before chrome 59, the default values were not supported.chrome android full support 55notes full support 55notes notes before chrome 59, the default values were not supported.firefox android full support 53opera android full support 42safari ios ...
... ...
SubtleCrypto.decrypt() - Web APIs
ments a key to decrypt with, some optional extra parameters, and the data to decrypt (also known as "ciphertext"). it returns a promise which will be fulfilled with the decrypted data (also known as "plaintext"). syntax const result = crypto.subtle.decrypt(algorithm, key, data); parameters algorithm is an object specifying the algorithm to be used, and any extra parameters as required. the values given for the extra parameters must match those passed into the corresponding encrypt() call. to use rsa-oaep, pass an rsaoaepparams object. to use aes-ctr, pass an aesctrparams object. to use aes-cbc, pass an aescbcparams object. to use aes-gcm, pass an aesgcmparams object. key is a cryptokey containing the key to be used for decryption. if using rsa-oaep, this is the priv...
...object. to use aes-ctr, pass an aesctrparams object. to use aes-cbc, pass an aescbcparams object. to use aes-gcm, pass an aesgcmparams object. key is a cryptokey containing the key to be used for decryption. if using rsa-oaep, this is the privatekey property of the cryptokeypair object. data is a buffersource containing the data to be decrypted (also known as ciphertext). return value result is a promise that fulfills with an arraybuffer containing the plaintext. exceptions the promise is rejected when the following exceptions are encountered: invalidaccesserror raised when the requested operation is not valid for the provided key (e.g. invalid encryption algorithm, or invalid key for the specified encryption algorithm). operationerror raised when the operation fai...
...ote: you can try the working examples on github. rsa-oaep this code decrypts ciphertext using rsa-oaep. see the complete code on github. function decryptmessage(privatekey, ciphertext) { return window.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 gi...
...see the complete code on github. ...
Touch - Web APIs
Web › API › Touch
uch interface represents a single contact point on a touch-sensitive device. the contact point is commonly a finger or stylus and the device may be a touchscreen or trackpad. the touch.radiusx, touch.radiusy, and touch.rotationangle describe the area of contact between the user and the screen, the touch area. this can be helpful when dealing with imprecise pointing devices such as fingers. these values are set to describe an ellipse that as closely as possible matches the entire area of contact (such as the user's fingertip). note: many of the properties' values are hardware-dependent; for example, if the device doesn't have a way to detect the amount of pressure placed on the surface, the force value will always be 0. this may also be the case for radiusx and radiusy; if the hardware repo...
... constructor touch() creates a touch object. properties this interface has no parent, and doesn't inherits or implements any other property. basic properties touch.identifier read only returns a unique identifier for this touch object. ...
...oordinate of the touch point relative to the left edge of the browser viewport, not including any scroll offset. touch.clienty read only returns the y coordinate of the touch point relative to the top edge of the browser viewport, not including any scroll offset. touch.pagex read only returns the x coordinate of the touch point relative to the left edge of the document. unlike clientx, this value includes the horizontal scroll offset, if any. touch.pagey read only returns the y coordinate of the touch point relative to the top of the document. unlike clienty, this value includes the vertical scroll offset, if any. touch.target read only returns the element on which the touch point started when it was first placed on the surface, even if the touch point has since moved outside the in...
...touch.target read only returns the element on which the touch point started when it was first placed on the surface, even if the touch point has since moved outside the interactive area of that element or even been removed from the document. touch area touch.radiusx read only returns the x radius of the ellipse that most closely circumscribes the area of contact with the screen. the value is in pixels of the same scale as screenx. touch.radiusy read only returns the y radius of the ellipse that most closely circumscribes the area of contact with the screen. the value is in pixels of the same scale as screeny. touch.rotationangle read only returns the angle (in degrees) that the ellipse described by radiusx and radiusy must be rotated, clockwise, to most accurately cover ...
USBConfiguration - Web APIs
the usbconfiguration interface of the webusb api provides information about a particular configuration of a usb device and the interfaces that it supports. constructor usbconfiguration.usbconfiguration() creates a new usbconfiguration object which contains information about the configuration on the provided usbdevice with the given configuration value. ...
...bconfiguration interface of the webusb api provides information about a particular configuration of a usb device and the interfaces that it supports. constructor usbconfiguration.usbconfiguration() creates a new usbconfiguration object which contains information about the configuration on the provided usbdevice with the given configuration value. ...
...provides information about a particular configuration of a usb device and the interfaces that it supports. constructor usbconfiguration.usbconfiguration() creates a new usbconfiguration object which contains information about the configuration on the provided usbdevice with the given configuration value. properties usbconfiguration.configurationvalueread only returns the configuration value of this configuration. ...
...evice and the interfaces that it supports. constructor usbconfiguration.usbconfiguration() creates a new usbconfiguration object which contains information about the configuration on the provided usbdevice with the given configuration value. properties usbconfiguration.configurationvalueread only returns the configuration value of this configuration. this is equal to the bconfigurationvalue field of the configuration descriptor provided by the device defining this configuration. usbconfiguration.configurationnameread only returns the name provided by the device to describe this configuration. this is equal to the value of the string descriptor with the index provided in the iconfiguration field of the configuration descriptor defining this configuration. usbconfiguration.interfa...
ValidityState.patternMismatch - Web APIs
the read-only patternmismatch property of a validitystate object indicates if the value of an <input>, after having been edited by the user, does not conform to the constraints set by the element's pattern attribute. if the field supports the pattern attribute -- which means the <input> is of type text, tel, email, url, password, or search -- and the pattern value is set to a valid regular expression, if the value don't doesn't conform to the constraints set by the pattern value, the patternmismatch property will be true. examples given the following: <p> <label>enter your phone number in the format (123)456-7890 (<input name="tel1" type="tel" pattern="[0-9]{3}" placeholder="###" aria-label="3-digit area code" size="2"/>)- <input name="tel2" type="tel" pattern="[0-9]{3}" placeholder...
...git prefix" size="2"/> - <input name="tel3" type="tel" pattern="[0-9]{4}" placeholder="####" aria-label="4-digit number" size="3"/> </label> </p> here we have 3 sections for a north american phone number with an implicit label encompassing all three components of the phone number, expecting 3-digits, 3-digits and 4-digits respectively, as defined by the pattern attribute set on each. ...
...had we used minlength and maxlength attributes instead, we may have seen validitystate.toolong or validitystate.tooshort being true. ...
...g or too short, or contain characters that aren't digits, patternmismatch will be true. when true, the element matches the :invalid css pseudo-classes. input:invalid { border: red solid 3px; } note, in this case, we get a patternmismatch not a validitystate.toolong or validitystate.tooshort if the values are too long or too short because it is the pattern that is dictating the length of the value. had we used minlength and maxlength 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 if the pattern...
WaveShaperNode.oversample - Web APIs
the oversample property of the waveshapernode interface is an enumerated value indicating if oversampling must be used. oversampling is a technique for creating more samples (up-sampling) before applying a distortion effect to the audio signal. once applied, the number of samples is reduced to its initial numbers. this leads to better results by avoiding some aliasing, but comes at the expense of a lower precision shaping curve. the possible oversample values are: value effect 'none' do not perform any oversampling. '2x' double the amount of samples before applying the shaping curve. '4x' multiply by 4 the amount of samples before applying the shaping curve. ...
... example the following example shows basic usage of an audiocontext to create a wave shaper node. for applied examples/information, check out our voice-change-o-matic demo (see app.js for relevant code). ...
... example the following example shows basic usage of an audiocontext to create a wave shaper node. for applied examples/information, check out our voice-change-o-matic demo (see app.js for relevant code). ...
... example the following example shows basic usage of an audiocontext to create a wave shaper node. for applied examples/information, check out our voice-change-o-matic demo (see app.js for relevant code). note: sigmoid functions are commonly used for distortion curves because of their natural properties. ...
WebGL2RenderingContext.samplerParameter[if]() - Web APIs
the webgl2renderingcontext.samplerparameter[if]() methods of the webgl 2 api set webglsampler parameters. syntax void gl.samplerparameteri(sampler, pname, param); void gl.samplerparameterf(sampler, pname, param); parameters sampler a webglsampler object. pname a glenum specifying which parameter to set. possible values: gl.texture_compare_func: a glenum specifying the texture comparison function. gl.texture_compare_mode: a glenum specifying the texture comparison mode. gl.texture_mag_filter: a glenum specifying the texture magnification filter. gl.texture_max_lod: a glfloat specifying the maximum level-of-detail value. gl.texture_min_filter: a glenum specifying the texture minification filter gl.texture_min_lod: a glfloat specifying the minimum level-of-detail...
...mparison function. gl.texture_compare_mode: a glenum specifying the texture comparison mode. gl.texture_mag_filter: a glenum specifying the texture magnification filter. gl.texture_max_lod: a glfloat specifying the maximum level-of-detail value. gl.texture_min_filter: a glenum specifying the texture minification filter gl.texture_min_lod: a glfloat specifying the minimum level-of-detail value. gl.texture_wrap_r: a glenum specifying the texture wrapping function for the texture coordinate r. ...
... examples var sampler = gl.createsampler(); gl.samplerparameteri(sampler, gl.texture_mag_filter, gl.nearest); specifications the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ap_r: a glenum specifying the texture wrapping function for the texture coordinate r. gl.texture_wrap_s: a glenum specifying the texture wrapping function for the texture coordinate s. gl.texture_wrap_t: a glenum specifying the texture wrapping function for the texture coordinate t. param a glint (samplerparameteri) or a glfloat (samplerparameterf) specifying a value for pname. return value none. examples var sampler = gl.createsampler(); gl.samplerparameteri(sampler, gl.texture_mag_filter, gl.nearest); specifications the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariand...
WebGL2RenderingContext.texImage3D() - Web APIs
th, border, format, type, imagedata source); void gl.teximage3d(target, level, internalformat, width, height, depth, border, format, type, arraybufferview? srcdata); void gl.teximage3d(target, level, internalformat, width, height, depth, border, format, type, arraybufferview srcdata, srcoffset); parameters target a glenum specifying the binding point (target) of the active texture. ...
... gl.rgb: discards the alpha components and reads the red, green and blue components. gl.rgba: red, green, blue and alpha components are read from the color buffer. ...
...he width of the texture. height a glsizei specifying the height of the texture. depth a glsizei specifying the depth of the texture. border a glint specifying the width of the border. must be 0. format a glenum specifying the format of the texel data. the correct combinations with internalformat are listed in this table. type a glenum specifying the data type of the texel data. possible values: gl.unsigned_byte: 8 bits per channel for gl.rgba gl.unsigned_short_5_6_5: 5 red bits, 6 green bits, 5 blue bits. gl.unsigned_short_4_4_4_4: 4 red bits, 4 green bits, 4 blue bits, 4 alpha bits. gl.unsigned_short_5_5_5_1: 5 red bits, 5 green bits, 5 blue bits, 1 alpha bit. gl.byte gl.unsigned_short gl.short gl.unsigned_int gl.int gl.half_float gl.float gl.unsigned_int_2_...
...source one of the following objects can be used as a pixel source for the texture: arraybufferview, imagebitmap, imagedata, htmlimageelement, htmlcanvaselement, htmlvideoelement. offset a glintptr byte offset into the webglbuffer's data store. used to upload data to the currently bound webgltexture from the webglbuffer bound to the pixel_unpack_buffer target. return value none. examples gl.teximage3d(gl.texture_3d, 0, // level gl.rgba, // internalformat 1, // width 1, // height 1, // depth ...
WebGL2RenderingContext.texSubImage3D() - Web APIs
depth, format, type, htmlcanvaselement? pixels); void gl.texsubimage3d(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, htmlvideoelement? pixels); void gl.texsubimage3d(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, glintptr offset); 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 within the texture image. yoffset a glint specifying the y offset within the texture image. zoffset a glint specifyi...
...et within the texture image. yoffset a glint specifying the y offset within the texture image. zoffset a glint specifying the z offset within the texture image. width a glsizei specifying the width of the texture. height a glsizei specifying the height of the texture. depth a glsizei specifying the depth of the texture. format a glenum specifying the format of the texel data. possible values: gl.alpha: discards the red, green and blue components and reads the alpha component. gl.rgb: discards the alpha components and reads the red, green and blue components. gl.rgba: red, green, blue and alpha components are read from the color buffer. gl.luminance: each color component is a luminance component, alpha is 1.0. gl.luminance_alpha: each component is a luminance/alpha compon...
...pha: each component is a luminance/alpha component. gl.r8 gl.r16f gl.r32f gl.r8ui gl.rg8 gl.rg16f gl.rg32f gl.rgui gl.rgb8 gl.srgb8 gl.rgb565 gl.r11f_g11f_b10f gl.rgb9_e5 gl.rgb16f gl.rgb32f gl.rgb8ui gl.rgba8 gl.srgb_aplha8 gl.rgb5_a1 gl.rgba4444 gl.rgba16f gl.rgba32f gl.rgba8ui type a glenum specifying the data type of the texel data. possible values: gl.unsigned_byte: 8 bits per channel for gl.rgba gl.unsigned_short_5_6_5: 5 red bits, 6 green bits, 5 blue bits. gl.unsigned_short_4_4_4_4: 4 red bits, 4 green bits, 4 blue bits, 4 alpha bits. gl.unsigned_short_5_5_5_1: 5 red bits, 5 green bits, 5 blue bits, 1 alpha bit. gl.byte gl.unsigned_short gl.short gl.unsigned_int gl.int gl.half_float gl.float gl.unsigned_int_2_...
...signed_short_5_5_5_1, or ext.half_float_oes. a float32array must be used if type is gl.float. imagebitmap, imagedata, htmlimageelement, htmlcanvaselement, htmlvideoelement. offset a glintptr byte offset into the webglbuffer's data store. used to upload data to the currently bound webgltexture from the webglbuffer bound to the pixel_unpack_buffer target. return value none. examples gl.texsubimage3d(gl.texture_3d, 0, 0, 0, 0, image.width, image.height, 1, gl.rgba, gl.unsigned_byte, image); specifications specification status comment webgl 2.0the definition of 'texsubimage3d' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'gltexsubimage2d' in that specification. ...
WebGLRenderingContext.blendEquationSeparate() - Web APIs
ion and alpha blend equation separately. the blend equation determines how a new pixel is combined with a pixel already in the webglframebuffer. syntax void gl.blendequationseparate(modergb, modealpha); parameters modergb a glenum specifying how the red, green and blue components of source and destination colors are combined. ...
...stination colors are combined. must be either: gl.func_add: source + destination (default value), gl.func_subtract: source - destination, gl.func_reverse_subtract: destination - source, when using the ext_blend_minmax extension: ext.min_ext: minimum of source and destination, ext.max_ext: maximum of source and destination. when using a webgl 2 context, the following values are available additionally: gl.min: minimum of source and destination, gl.max: maximum of source and destination. modealpha a glenum specifying how the alpha component (transparency) of source and destination colors are combined. ...
...urce and destination. when using a webgl 2 context, the following values are available additionally: gl.min: minimum of source and destination, gl.max: maximum of source and destination. modealpha a glenum specifying how the alpha component (transparency) of source and destination colors are combined. must be either: gl.func_add: source + destination (default value), gl.func_subtract: source - destination, gl.func_reverse_subtract: destination - source, when using the ext_blend_minmax extension: ext.min_ext: minimum of source and destination, ext.max_ext: maximum of source and destination. ...
...stination colors are combined. must be either: gl.func_add: source + destination (default value), gl.func_subtract: source - destination, gl.func_reverse_subtract: destination - source, when using the ext_blend_minmax extension: ext.min_ext: minimum of source and destination, ext.max_ext: maximum of source and destination. when using a webgl 2 context, the following values are available additionally: gl.min: minimum of source and destination, gl.max: maximum of source and destination. return value none. exceptions if mode is not one of the three possible values, a gl.invalid_enum error is thrown. examples to set the blend equations, use: gl.blendequationseparate(gl.func_add, gl.func_subtract); to get the current blend equations, qu...
WebGLRenderingContext.blendFunc() - Web APIs
the webglrenderingcontext.blendfunc() method of the webgl api defines which function is used for blending pixel arithmetic. syntax void gl.blendfunc(sfactor, dfactor); parameters sfactor a glenum specifying a multiplier for the source blending factors. the default value is gl.one. for possible values, see below. dfactor a glenum specifying a multiplier for the destination blending factors. the default value is gl.zero. for possible values, see below. return value none. exceptions if sfactor or dfactor is not one of the listed possible values, a gl.invalid_enum error is thrown. if a constant color and a constant alpha value are used together as source and destination factors, a gl.invalid_enum error is thrown. constants the following constants can be used for sfactor and df...
... constant factor description gl.zero 0,0,0,0 multiplies all colors by 0. gl.one 1,1,1,1 multiplies all colors by 1. gl.src_color rs, gs, bs, as multiplies all colors by the source colors. gl.one_minus_src_color 1-rs, 1-gs, 1-bs, 1-as multiplies all colors by 1 minus each source color. ...
... gl.one_minus_src_color 1-rs, 1-gs, 1-bs, 1-as multiplies all colors by 1 minus each source color. gl.dst_color rd, gd, bd, ad multiplies all colors by the destination color. gl.one_minus_dst_color 1-rd, 1-gd, 1-bd, 1-ad multiplies all colors by 1 minus each destination color. gl.src_alpha as, as, as, as multiplies all colors by the source alpha value. gl.one_minus_src_alpha 1-as, 1-as, 1-as, 1-as multiplies all colors by 1 minus the source alpha value. gl.dst_alpha ad, ad, ad, ad multiplies all colors by the destination alpha value. gl.one_minus_dst_alpha 1-ad, 1-ad, 1-ad, 1-ad multiplies all colors by 1 minus the destination alpha value. gl.constant_color rc, gc, bc, ac multiplies a...
..._dst_alpha 1-ad, 1-ad, 1-ad, 1-ad multiplies all colors by 1 minus the destination alpha value. gl.constant_color rc, gc, bc, ac multiplies all colors by a constant color. gl.one_minus_constant_color 1-rc, 1-gc, 1-bc, 1-ac multiplies all colors by 1 minus a constant color. gl.constant_alpha ac, ac, ac, ac multiplies all colors by a constant alpha value. gl.one_minus_constant_alpha 1-ac, 1-ac, 1-ac, 1-ac multiplies all colors by 1 minus a constant alpha value. gl.src_alpha_saturate min(as, 1 - ad), min(as, 1 - ad), min(as, 1 - ad), 1 multiplies the rgb colors by the smaller of either the source alpha value or the value of 1 minus the destination alpha value. the alpha value is multiplied by 1. exampl...
WebGLRenderingContext.blendFuncSeparate() - Web APIs
the webglrenderingcontext.blendfuncseparate() method of the webgl api defines which function is used for blending pixel arithmetic for rgb and alpha components separately. syntax void gl.blendfuncseparate(srcrgb, dstrgb, srcalpha, dstalpha); parameters srcrgb a glenum specifying a multiplier for the red, green and blue (rgb) source blending factors. the default value is gl.one. for possible values, see below. dstrgb a glenum specifying a multiplier for the red, green and blue (rgb) destination blending factors. the default value is gl.zero. for possible values, see below. srcalpha a glenum specifying a multiplier for the alpha source blending factor. the default value is gl.one. for possible values, see below. dstalpha a glenum specifying a multiplier for the alpha destination bl...
... glenum specifying a multiplier for the red, green and blue (rgb) destination blending factors. the default value is gl.zero. for possible values, see below. srcalpha a glenum specifying a multiplier for the alpha source blending factor. the default value is gl.one. for possible values, see below. dstalpha a glenum specifying a multiplier for the alpha destination blending factor. the default value is gl.zero. for possible values, see below. return value none. exceptions if srcrgb, dstrgb, srcalpha, or dstalpha is not one of the listed possible values, a gl.invalid_enum error is thrown. if a constant color and a constant alpha value are used together as source (srcrgb) and destination (dstrgb) factors, a gl.invalid_enum error is thrown. constants the following constants can be us...
... gl.one 1,1,1,1 1 multiplies all colors by 1. ...
...ha 1-ad, 1-ad, 1-ad 1-ad multiplies all colors by 1 minus the destination alpha color. gl.constant_color rc, gc, bc ac multiplies all colors by a constant color. gl.one_minus_constant_color 1-rc, 1-gc, 1-bc 1-ac multiplies all colors by 1 minus a constant color. gl.constant_alpha ac, ac, ac ac multiplies all colors by a constant alpha value. gl.one_minus_constant_alpha 1-ac, 1-ac, 1-ac 1-ac multiplies all colors by 1 minus a constant alpha value. gl.src_alpha_saturate min(as, 1 - ad), min(as, 1 - ad), min(as, 1 - ad) 1 multiplies the rgb colors by the smaller of either the source alpha color or the value of 1 minus the destination alpha color. the alpha value is multiplied by 1. ex...
WebGLRenderingContext.bufferData() - Web APIs
lizes 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 buffer object to another. gl.copy_write_buffer: buffer for copyin...
...setting the size in bytes of the buffer object's data store. srcdata optional an arraybuffer, sharedarraybuffer or one of the arraybufferview typed array types that will be copied into the data store. if null, a data store is still created, but the content is uninitialized and undefined. usage a glenum specifying the intended usage pattern of the data store for optimization purposes. possible values: gl.static_draw: the contents are intended to be specified once by the application, and used many times as the source for webgl drawing and image specification commands. gl.dynamic_draw: the contents are intended to be respecified repeatedly by the application, and used many times as the source for webgl drawing and image specification commands. gl.stream_draw: the contents are intended ...
...ynamic_draw: the contents are intended to be respecified repeatedly by the application, and used many times as the source for webgl drawing and image specification commands. gl.stream_draw: the contents are intended to be specified once by the application, and used at most a few times as the source for webgl drawing and image specification commands. when using a webgl 2 context, the following values are available additionally: gl.static_read: the contents are intended to be specified once by reading data from webgl, and queried many times by the application. gl.dynamic_read: the contents are intended to be respecified repeatedly by reading data from webgl, and queried many times by the application. gl.stream_read: the contents are intended to be specified once by reading data fr...
...rce 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'); var gl = canvas.getcontext('webgl'); var buffer = ...
WebGLRenderingContext.disable() - Web APIs
see webglrenderingcontext.blendfunc(). gl.cull_face deactivates culling of polygons. see webglrenderingcontext.cullface(). ...
...see webglrenderingcontext.blendfunc(). gl.cull_face deactivates culling of polygons. see webglrenderingcontext.cullface(). ...
...ce deactivates culling of polygons. see webglrenderingcontext.cullface(). gl.depth_test deactivates depth comparisons and updates to the depth buffer. see webglrenderingcontext.depthfunc(). gl.dither deactivates dithering of color components before they get written to the color buffer. gl.polygon_offset_fill deactivates adding an offset to depth values of polygon's fragments. see webglrenderingcontext.polygonoffset(). gl.sample_alpha_to_coverage deactivates the computation of a temporary coverage value determined by the alpha value. gl.sample_coverage deactivates anding the fragment's coverage with the temporary coverage value. see webglrenderingcontext.samplecoverage(). gl.scissor_test deactivat...
... see webglrenderingcontext.samplecoverage(). gl.scissor_test deactivates the scissor test that discards fragments that are outside of the scissor rectangle. see webglrenderingcontext.scissor(). gl.stencil_test deactivates stencil testing and updates to the stencil buffer. see webglrenderingcontext.stencilfunc(). when using a webgl 2 context, the following values are available additionally: constant description gl.rasterizer_discard deactivates that primitives are discarded immediately before the rasterization stage, but after the optional transform feedback stage. gl.clear() commands are ignored. return value none. examples gl.disable(gl.dither); to check if a capability is disabled, use the webg...
WebGLRenderingContext.drawElements() - Web APIs
the webglrenderingcontext.drawelements() method of the webgl api renders primitives from array data. syntax void gl.drawelements(mode, count, type, offset); parameters mode a glenum specifying the type primitive to render. possible values are: gl.points: draws a single dot. gl.line_strip: draws a straight line to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. ...
...ine to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. count a glsizei specifying the number of elements to be rendered. ...
... a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. count a glsizei specifying the number of elements to be rendered. type a glenum specifying the type of the values in the element array buffer. possible values are: gl.unsigned_byte gl.unsigned_short when using the oes_element_index_uint extension: gl.unsigned_int offset a glintptr specifying a byte offset in the element array buffer. must be a valid multiple of the size of the given type. return value none. exceptions if mode is not one of the accepted values, a gl.invalid_enum error is thrown. if offset is not a v...
... examples gl.drawelements(gl.points, 8, gl.unsigned_byte, 0); specifications specification status comment webgl 1.0the definition of 'drawelements' in that specification. ...
WebGLRenderingContext.enable() - Web APIs
see webglrenderingcontext.blendfunc(). gl.cull_face activates culling of polygons. see webglrenderingcontext.cullface(). ...
...see webglrenderingcontext.blendfunc(). gl.cull_face activates culling of polygons. see webglrenderingcontext.cullface(). ...
....cull_face activates culling of polygons. see webglrenderingcontext.cullface(). gl.depth_test activates depth comparisons and updates to the depth buffer. see webglrenderingcontext.depthfunc(). gl.dither activates dithering of color components before they get written to the color buffer. gl.polygon_offset_fill activates adding an offset to depth values of polygon's fragments. see webglrenderingcontext.polygonoffset(). gl.sample_alpha_to_coverage activates the computation of a temporary coverage value determined by the alpha value. gl.sample_coverage activates anding the fragment's coverage with the temporary coverage value. see webglrenderingcontext.samplecoverage(). gl.scissor_test activates the...
...lue. see webglrenderingcontext.samplecoverage(). gl.scissor_test activates the scissor test that discards fragments that are outside of the scissor rectangle. see webglrenderingcontext.scissor(). gl.stencil_test activates stencil testing and updates to the stencil buffer. see webglrenderingcontext.stencilfunc(). when using a webgl 2 context, the following values are available additionally: constant description gl.rasterizer_discard primitives are discarded immediately before the rasterization stage, but after the optional transform feedback stage. gl.clear() commands are ignored. return value none. examples gl.enable(gl.dither); to check if a capability is enabled, use the webglrenderingcontext.i...
WebGLRenderingContext.framebufferRenderbuffer() - Web APIs
the webglrenderingcontext.framebufferrenderbuffer() method of the webgl api attaches a webglrenderbuffer object to a webglframebuffer object. syntax void gl.framebufferrenderbuffer(target, attachment, renderbuffertarget, renderbuffer); parameters target a glenum specifying the binding point (target) for the framebuffer. possible values: gl.framebuffer: collection buffer data storage of color, alpha, depth and stencil buffers used to render an image. when using a webgl 2 context, the following values are available additionally: gl.draw_framebuffer: equivalent to gl.framebuffer. used as a destination for drawing, rendering, clearing, and writing operations. gl.read_framebuffer: used as a source for reading operations. attachment a glenum specifying the atta...
...render an image. when using a webgl 2 context, the following values are available additionally: gl.draw_framebuffer: equivalent to gl.framebuffer. used as a destination for drawing, rendering, clearing, and writing operations. gl.read_framebuffer: used as a source for reading operations. attachment a glenum specifying the attachment point for the render buffer. possible values: gl.color_attachment0: color buffer. gl.depth_attachment: depth buffer. gl.depth_stencil_attachment: depth and stencil buffer. gl.stencil_attachment: stencil buffer. ...
...ations. gl.read_framebuffer: used as a source for reading operations. attachment a glenum specifying the attachment point for the render buffer. possible values: gl.color_attachment0: color buffer. gl.depth_attachment: depth buffer. gl.depth_stencil_attachment: depth and stencil buffer. gl.stencil_attachment: stencil buffer. ...
..._attachment7_webgl ext.color_attachment8_webgl ext.color_attachment9_webgl ext.color_attachment10_webgl ext.color_attachment11_webgl ext.color_attachment12_webgl ext.color_attachment13_webgl ext.color_attachment14_webgl ext.color_attachment15_webgl renderbuffertarget a glenum specifying the binding point (target) for the render buffer. possible values: gl.renderbuffer: buffer data storage for single images in a renderable internal format. renderbuffer a webglrenderbuffer object to attach. return value none. exceptions a gl.invalid_enum error is thrown if target is not gl.framebuffer, gl.draw_framebuffer, or gl.read_framebuffer. a gl.invalid_enum error is thrown if renderbuffertarget is not gl.renderbuffer. a gl.invalid_enum...
WebGLRenderingContext.framebufferTexture2D() - Web APIs
the webglrenderingcontext.framebuffertexture2d() method of the webgl api attaches a texture to a webglframebuffer. syntax void gl.framebuffertexture2d(target, attachment, textarget, texture, level); parameters target a glenum specifying the binding point (target). possible values: gl.framebuffer: collection buffer data storage of color, alpha, depth and stencil buffers used to render an image. when using a webgl 2 context, the following values are available additionally: gl.draw_framebuffer: equivalent to gl.framebuffer. used as a destination for drawing, rendering, clearing, and writing operations. gl.read_framebuffer: used as a source for reading operations. attachment a glenum specifying the attachment point for the texture. possible v...
... attachment a glenum specifying the attachment point for the texture. possible values: gl.color_attachment0: attaches the texture to the framebuffer's color buffer. gl.depth_attachment: attaches the texture to the framebuffer's depth buffer. gl.stencil_attachment: attaches the texture to the framebuffer's stencil buffer. when using a webgl 2 context, the following values are available additionally: gl.depth_stencil_attachment: depth and stencil buffer. gl.color_attachment1 gl.color_attachment2 gl.color_attachment3 gl.color_attachment4 gl.color_attachment5 gl.color_attachment6 gl.color_attachment7 gl.color_attachment8 gl.color_attachment9 gl.color_attachment10 gl.color_attachment11 gl.color_attach...
...t.color_attachment10_webgl ext.color_attachment11_webgl ext.color_attachment12_webgl ext.color_attachment13_webgl ext.color_attachment14_webgl ext.color_attachment15_webgl when using the webgl_depth_texture extension: gl.depth_stencil_attachment: depth and stencil buffer data storage. textarget a glenum specifying the texture target. possible values: gl.texture_2d: a 2d image. gl.texture_cube_map_positive_x: image for the positive x face of the cube. gl.texture_cube_map_negative_x: image for the negative x face of the cube. gl.texture_cube_map_positive_y: image for the positive y face of the cube. gl.texture_cube_map_negative_y: image for the negative y face of the cube. gl.texture_cube_map_positive_z: image for the positive z...
...he cube. gl.texture_cube_map_negative_y: image for the negative y face of the cube. gl.texture_cube_map_positive_z: image for the positive z face of the cube. gl.texture_cube_map_negative_z: image for the negative z face of the cube. texture a webgltexture object whose image to attach. level a glint specifying the mipmap level of the texture image to be attached. must be 0. return value none. exceptions a gl.invalid_enum error is thrown if target is not gl.framebuffer. attachment is not one of the accepted attachment points. textarget is not one of the accepted texture targets. a gl.invalid_value error is thrown if level is not 0. a gl.invalid_operation error is thrown if texture isn't 0 or the name of an existing texture object. examples gl.framebuff...
WebGLRenderingContext.getError() - Web APIs
the command is ignored and the error flag is set. gl.invalid_operation the specified command is not allowed for the current state. ...
...the command is ignored and the error flag is set. gl.invalid_operation the specified command is not allowed for the current state. ...
...the command is ignored and the error flag is set. gl.invalid_operation the specified command is not allowed for the current state. ...
...the command is ignored and the error flag is set. gl.invalid_operation the specified command is not allowed for the current state. the command is ignored and the error flag is set. ...
WebGLRenderingContext.getProgramParameter() - Web APIs
the webglrenderingcontext.getprogramparameter() method of the webgl api returns information about the given program. syntax any gl.getprogramparameter(program, pname); parameters program a webglprogram to get parameter information from. pname a glenum specifying the information to query. possible values: gl.delete_status: returns a glboolean indicating whether or not the program is flagged for deletion. gl.link_status: returns a glboolean indicating whether or not the last link operation was successful. gl.validate_status: returns a glboolean indicating whether or not the last validation operation was successful. gl.attached_shaders: returns a glint indicating the number of attached shaders to a program. gl.active_attributes: returns a glint indicating the number of activ...
... not the last validation operation was successful. gl.attached_shaders: returns a glint indicating the number of attached shaders to a program. gl.active_attributes: returns a glint indicating the number of active attribute variables to a program. gl.active_uniforms: returns a glint indicating the number of active uniform variables to a program. when using a webgl 2 context, the following values are available additionally: gl.transform_feedback_buffer_mode: returns a glenum indicating the buffer mode when transform feedback is active. may be gl.separate_attribs or gl.interleaved_attribs. gl.transform_feedback_varyings: returns a glint indicating the number of varying variables to capture in transform feedback mode. gl.active_uniform_blocks: returns a glint indicating the...
...eturns a glenum indicating the buffer mode when transform feedback is active. may be gl.separate_attribs or gl.interleaved_attribs. gl.transform_feedback_varyings: returns a glint indicating the number of varying variables to capture in transform feedback mode. gl.active_uniform_blocks: returns a glint indicating the number of uniform blocks containing active uniforms. return value returns the requested program information (as specified with pname). examples gl.getprogramparameter(program, gl.delete_status); specifications specification status comment webgl 1.0the definition of 'getprogramparameter' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glgetprogramiv' in that specification. ...
...cation status comment webgl 1.0the definition of 'getprogramparameter' in that specification. ...
WebGLRenderingContext.getRenderbufferParameter() - Web APIs
the webglrenderingcontext.getrenderbufferparameter() method of the webgl api returns information about the renderbuffer. syntax any gl.getrenderbufferparameter(target, pname); parameters target a glenum specifying the target renderbuffer object. possible values: gl.renderbuffer: buffer data storage for single images in a renderable internal format. pname a glenum specifying the information to query. possible values: gl.renderbuffer_width: returns a glint indicating the width of the image of the currently bound renderbuffer. gl.renderbuffer_height: returns a glint indicating the height of the image of the currently bound renderbuffer. gl.renderbuffer_internal_format: returns a glenum indicating the internal format of the currently bound renderbuffer. the default is gl.
... gl.rgb565: 5 red bits, 6 green bits, 5 blue bits. gl.rgb5_a1: 5 red bits, 5 green bits, 5 blue bits, 1 alpha bit. gl.depth_component16: 16 depth bits. gl.stencil_index8: 8 stencil bits. gl.renderbuffer_green_size: returns a glint that is the resolution size (in bits) for the green color. ...
...ts) for the red color. gl.renderbuffer_alpha_size: returns a glint that is the resolution size (in bits) for the alpha component. gl.renderbuffer_depth_size: returns a glint that is the resolution size (in bits) for the depth component. gl.renderbuffer_stencil_size: returns a glint that is the resolution size (in bits) for the stencil component. when using a webgl 2 context, the following value is available additionally: gl.renderbuffer_samples: returns a glint indicating the number of samples of the image of the currently bound renderbuffer. return value depends on the requested information (as specified with pname). either a glint or a glenum. examples gl.getrenderbufferparameter(gl.renderbuffer, gl.renderbuffer_width); specifications specification ...
...teriv' in that specification. ...
WebGLRenderingContext.stencilFuncSeparate() - Web APIs
the webglrenderingcontext.stencilfuncseparate() method of the webgl api sets the front and/or back function and reference value for stencil testing. stencilling enables and disables drawing on a per-pixel basis. it is typically used in multipass rendering to achieve special effects. syntax void gl.stencilfuncseparate(face, func, ref, mask); parameters face a glenum specifying whether the front and/or back stencil state is updated. the possible values are: gl.front gl.back gl.front_and_back func a glenum specifying the test function. the default function is gl.always. the possible values are: gl.never: never pass. gl.less: pass if (ref & mask) < (stencil & mask). gl.equal: pass if (ref & mask) = (stencil & mask). gl.lequal: pass if (ref...
...(ref & mask) < (stencil & mask). gl.equal: pass if (ref & mask) = (stencil & mask). gl.lequal: pass if (ref & mask) <= (stencil & mask). gl.greater: pass if (ref & mask) > (stencil & mask). gl.notequal: pass if (ref & mask) != (stencil & mask). gl.gequal: pass if (ref & mask) >= (stencil & mask). gl.always: always pass. ref a glint specifying the reference value for the stencil test. this value is clamped to the range 0 to 2n -1 where n is the number of bitplanes in the stencil buffer. the default value is 0. mask a gluint specifying a bit-wise mask that is used to and the reference value and the stored stencil value when the test is done. the default value is all 1. return value none. examples the stencil testing is disabled by default. to enable...
...the stored stencil value when the test is done. the default value is all 1. return value none. examples the stencil testing is disabled by default. to enable or disable stencil testing, use the enable() and disable() methods with the argument gl.stencil_test. gl.enable(gl.stencil_test); gl.stencilfuncseparate(gl.front, gl.less, 0.2, 1110011); to get the current stencil function, reference value, or other stencil information, query the following constants with getparameter(). ...
...t. to enable or disable stencil testing, use the enable() and disable() methods with the argument gl.stencil_test. gl.enable(gl.stencil_test); gl.stencilfuncseparate(gl.front, gl.less, 0.2, 1110011); to get the current stencil function, reference value, or other stencil information, query the following constants with getparameter(). gl.getparameter(gl.stencil_func); gl.getparameter(gl.stencil_value_mask); gl.getparameter(gl.stencil_ref); gl.getparameter(gl.stencil_back_func); gl.getparameter(gl.stencil_back_value_mask); gl.getparameter(gl.stencil_back_ref); gl.getparameter(gl.stencil_bits); specifications specification status comment webgl 1.0the definition of 'stencilfuncseparate' in that specification. recommendation initial definition. opengl es ...
WebGLRenderingContext.stencilOpSeparate() - Web APIs
the webglrenderingcontext.stencilopseparate() method of the webgl api sets the front and/or back-facing stencil test actions. syntax void gl.stencilopseparate(face, fail, zfail, zpass); parameters the fail, zfail and zpass parameters accept all constants listed below. face a glenum specifying whether the front and/or back stencil state is updated. the possible values are: gl.front gl.back gl.front_and_back fail a glenum specifying the function to use when the stencil test fails. the default value is gl.keep. zfail a glenum specifying the function to use when the stencil test passes, but the depth test fails. the default value is gl.keep. zpass a glenum specifying the function to use when both the stencil test and the depth test pass, or when the stencil test passes a...
...use when the stencil test fails. the default value is gl.keep. zfail a glenum specifying the function to use when the stencil test passes, but the depth test fails. the default value is gl.keep. zpass a glenum specifying the function to use when both the stencil test and the depth test pass, or when the stencil test passes and there is no depth buffer or depth testing is disabled. the default value is gl.keep. return value none. constants gl.keep keeps the current value. gl.zero sets the stencil buffer value to 0. gl.replace sets the stencil buffer value to the reference value as specified by webglrenderingcontext.stencilfunc(). gl.incr increments the current stencil buffer value. clamps to the maximum representable unsigned value. gl.incr_wrap increments the current stencil...
...eep. return value none. constants gl.keep keeps the current value. gl.zero sets the stencil buffer value to 0. gl.replace sets the stencil buffer value to the reference value as specified by webglrenderingcontext.stencilfunc(). gl.incr increments the current stencil buffer value. clamps to the maximum representable unsigned value. gl.incr_wrap increments the current stencil buffer value. wraps stencil buffer value to zero when incrementing the maximum representable unsigned value. gl.decr decrements the current stencil buffer value. clamps to 0. gl.decr_wrap decrements the current stencil buffer value. wraps stencil buffer value to the maximum representable unsigned value when decrementing a stencil buffer value of 0. ...
... examples the stencil testing is disabled by default. to enable or disable stencil testing, use the enable() and disable() methods with the argument gl.stencil_test. gl.enable(gl.stencil_test); gl.stencilopseparate(gl.front, gl.incr, gl.decr, gl.invert); to get the current information about stencil and depth pass or fail, query the following constants with getparameter(). ...
WebGLRenderingContext.vertexAttrib[1234]f[v]() - Web APIs
the webglrenderingcontext.vertexattrib[1234]f[v]() methods of the webgl api specify constant values for generic vertex attributes. syntax void gl.vertexattrib1f(index, v0); void gl.vertexattrib2f(index, v0, v1); void gl.vertexattrib3f(index, v0, v1, v2); void gl.vertexattrib4f(index, v0, v1, v2, v3); void gl.vertexattrib1fv(index, value); void gl.vertexattrib2fv(index, value); void gl.vertexattrib3fv(index, value); void gl.vertexattrib4fv(index, value); parameters index a gluint specifying the position of the vertex attribute to be modified. v0, v1, v2, v3 a floating point number for the vertex attribute value. value a float32array for floating point vector vertex attribute values. ...
...exattrib1fv(index, value); void gl.vertexattrib2fv(index, value); void gl.vertexattrib3fv(index, value); void gl.vertexattrib4fv(index, value); parameters index a gluint specifying the position of the vertex attribute to be modified. v0, v1, v2, v3 a floating point number for the vertex attribute value. value a float32array for floating point vector vertex attribute values. return value none. description while vertex attributes are usually used to specify values which are different for each vertex (using vertexattribpointer), it can be useful to specify a constant value. for example, if you have a shader which has a color vertex attribute, but you want to draw everything in a single color, you can use vertexattrib to achieve that without creating a buffer filled with only one...
... none. description while vertex attributes are usually used to specify values which are different for each vertex (using vertexattribpointer), it can be useful to specify a constant value. for example, if you have a shader which has a color vertex attribute, but you want to draw everything in a single color, you can use vertexattrib to achieve that without creating a buffer filled with only one value or having to create a separate shader which uses a uniform for the color. this value will be used if a bound array buffer has not been enabled with enablevertexattribarray. attributes may be matrices, in which case columns of the matrix must be loaded into successive vertex attribute slots. the values set with vertexattribpointer are context-global, i.e. they aren't part of the shader state (l...
...utes may be matrices, in which case columns of the matrix must be loaded into successive vertex attribute slots. the values set with vertexattribpointer are context-global, i.e. they aren't part of the shader state (like generix vertex attribute indexes to shader variable bindings) and aren't part of the vertex array object state (like enabled vertex attribute arrays). the only way to change the values is by calling this function again. examples const a_foobar = gl.getattriblocation(shaderprogram, 'foobar'); //either set each component individually: gl.vertexattrib3f(a_foobar, 10.0, 5.0, 2.0); //or provide a float32array: const floatarray = new float32array([10.0, 5.0, 2.0]); gl.vertexattrib3fv(a_foobar, floatarray); // we want to load the following 3x3 matrix into attribute named "matrix...
Matrix math for the web - Web APIs
ent technologies including webgl, the webxr (vr and ar) api, and glsl shaders. this article is also available as an mdn content kit. the live examples use a collection of utility functions available under a global object named mdn. transformation matrices there are many types of matrices, but the ones we are interested in are the 3d transformation matrices. these matrices consist of a set of 16 values arranged in a 4x4 grid. in javascript, it is easy to represent a matrix as an array. let's begin by considering the identity matrix. this is a special transformation matrix which functions much like the number 1 does in scalar multiplication; just like n * 1 = n, multiplying any matrix by the identity matrix gives a resulting matrix whose values match the original matrix. the identity matrix l...
...by convention, this dimension is called the perspective, and is represented by the letter w. for a typical position, setting w to 1 will make the math work out. ...
...by convention, this dimension is called the perspective, and is represented by the letter w. for a typical position, setting w to 1 will make the math work out. ...
...' class='transformable'> <h2>move me with a matrix</h2> <p>lorem ipsum dolor sit amet, consectetur adipisicing elit...</p> </div> finally, for each of the examples we will generate a 4x4 matrix, then update the <div>'s style to have a transform applied to it, set to a matrix3d. bear in mind that even though the matrix is made up of 4 rows and 4 columns, it collapses into a single line of 16 values. matrices are always stored in one-dimensional lists in javascript. // create the matrix3d style property from a matrix array function matrixarraytocssmatrix(array) { return 'matrix3d(' + array.join(',') + ')'; } // grab the dom element let moveme = document.getelementbyid('move-me'); // returns a result like: "matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 50, 100, 0, 1);" let matrix3drule ...
Using bounded reference spaces - Web APIs
ise. therefore, the bounded reference space's origin always places the y=0 plane at floor level. the boundary is then defined using an array of 2d coordinates, specifying only the x and z components since y is always 0. these points go around the room in a clockwise direction. note that if the underlying platform defines a fixed room-scale origin and boundary, it may initialize any uninitialized values to match that predefined information; this is not unexpected behavior for users of these platforms. the space inside the boundary is then the user's safe movement area, within which they are tracked and their movements replicated into the virtual world. although the user's xr system may provide automated detection and protection against exiting the safe area, it is always good practice to handl...
...tance that approximates human eye level by transforming it by providing an appropriate transform matrix to the xrreferencespace method requestoffsetreferencespace(). ...
... it by providing an appropriate transform matrix to the xrreferencespace method requestoffsetreferencespace(). this would change the onrefspacecreated() method from the above snippet to: function onrefspacecreated(refspace) { xrsession.updaterenderstate({ baselayer: new xrwebgllayer(xrsession, gl) }); let startposition = vec3.fromvalues(0, 1.5, 0); const startorientation = vec3.fromvalues(0, 0, 1.0); xrreferencespace = xrreferencespace.getoffsetreferencespace( new xrrigidtransform(startposition, startorientation)); xrsession.requestanimationframe(ondrawframe); } in this code, executed after the reference space has been created, we create an xrrigidtransform representing the transform that will move the viewpoint upward by 1.5 meters. this approximates human heigh...
... new xrrigidtransform(startposition, startorientation)); xrsession.requestanimationframe(ondrawframe); } in this code, executed after the reference space has been created, we create an xrrigidtransform representing the transform that will move the viewpoint upward by 1.5 meters. this approximates human height, though it assumes we've previously transformed the coordinate system so that the value of each coordinate is no longer constrained to -1 to 1, while maintaining the definition that a value of 1 represents one meter). the new transform is passed into requestoffsetreferenceframe() to obtain a reference frame which maps the coordinates between the base coordinate system and that of the rendered image. the new reference space replaces the original one. finally, drawing begins by calli...
Web Audio API best practices - Web APIs
and volume/mute controls. the using the web audio api tutorial goes over how to do this. if you have buttons that switch audio on and off, using the aria role="switch" attribute on them is a good option for signalling to assistive technology what the button's exact purpose is, and therefore making the app more accessible. there's a demo of how to use it here. as you work with a lot of changing values within the web audio api and will want to provide users with control over these, the range input is often a good choice of control to use. it's a good option as you can set minimum and maximum values, as well as increments with the step attribute. setting audioparam values there are two ways to manipulate audionode values, which are themselves objects of type audioparam interface. the first is...
... web audio api and will want to provide users with control over these, the range input is often a good choice of control to use. it's a good option as you can set minimum and maximum values, as well as increments with the step attribute. setting audioparam values there are two ways to manipulate audionode values, which are themselves objects of type audioparam interface. the first is to set the value directly via the property. so for instance if we want to change the gain value of a gainnode we would do so thus: gainnode.gain.value = 0.5; this will set our volume to half. ...
...es there are two ways to manipulate audionode values, which are themselves objects of type audioparam interface. the first is to set the value directly via the property. so for instance if we want to change the gain value of a gainnode we would do so thus: gainnode.gain.value = 0.5; this will set our volume to half. however, if you're using any of the audioparam's defined methods to set these values, they will take precedence over the above property setting. if for example, you want the gain value to be raised to 1 in 2 seconds time, you can do this: gainnode.gain.setvalueattime(1, audioctx.currenttime + 2); it will override the previous example (as it should), even if it were to come later in your code. bearing this in mind, if your website or application requires timing and scheduling...
... if for example, you want the gain value to be raised to 1 in 2 seconds time, you can do this: gainnode.gain.setvalueattime(1, audioctx.currenttime + 2); it will override the previous example (as it should), even if it were to come later in your code. bearing this in mind, if your website or application requires timing and scheduling, it's best to stick with the audioparam methods for setting values. if you're sure it doesn't, setting it with the value property is fine. ...
Window.innerHeight - Web APIs
to change the width of the window, call one of its resize methods, such as resizeto() or resizeby(). ...
... to change the width of the window, call one of its resize methods, such as resizeto() or resizeby(). ...
... to change the width of the window, call one of its resize methods, such as resizeto() or resizeby(). ...
... to change the width of the window, call one of its resize methods, such as resizeto() or resizeby(). usage notes to obtain the height of the window minus its horizontal scroll bar and any borders, use the root <html> element's clientheight() property instead. ...
Window.matchMedia() - Web APIs
Web › API › Window › matchMedia
tchmedia() method returns a new mediaquerylist object that can then be used to determine if the document matches the media query string, as well as to monitor the document to detect when it matches (or stops matching) that media query. syntax mqlist = window.matchmedia(mediaquerystring) parameters mediaquerystring a string specifying the media query to parse into a mediaquerylist. return value a new mediaquerylist object for the media query. use this object's properties and events to detect matches and to monitor for changes to those matches over time. usage notes you can use the returned media query to perform both instantanteous and event-driven checks to see if the document matches the media query. to perform a one-time, instantaneous check to see if the document matches the med...
... object for the media query. use this object's properties and events to detect matches and to monitor for changes to those matches over time. usage notes you can use the returned media query to perform both instantanteous and event-driven checks to see if the document matches the media query. to perform a one-time, instantaneous check to see if the document matches the media query, look at the value of the matches property, which will be true if the document meets the media query's requirements. if you need to be kept aware of whether or not the document matches the media query at all times, you can instead watch for the change event to be delivered to the object. there's a good example of this in the article on window.devicepixelratio. examples this example runs the media query (max-widt...
...ich will be true if the document meets the media query's requirements. if you need to be kept aware of whether or not the document matches the media query at all times, you can instead watch for the change event to be delivered to the object. there's a good example of this in the article on window.devicepixelratio. ...
.... examples this example runs the media query (max-width: 600px) and displays the value of the resulting mediaquerylist's matches property in a <span>; as a result, the output will say "true" if the viewport is less than or equal to 600 pixels wide, and will say "false" if the window is wider than that. javascript let mql = window.matchmedia('(max-width: 600px)'); document.queryselector(".mq-value").innertext = mql.matches; the javascript code simply passes the media query to match into matchmedia() to compile it, then sets the <span>'s innertext to the value of the results' matches property, so that it indicates whether or not the document matches the media query at the moment the page was loaded. html <span class="mq-value"></span> a simple <span> to receive the output. css .mq-v...
Window.print() - Web APIs
Web › API › Window › print
bilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetprintchrome full support 1notes full support 1notes notes starting with chrome 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.edge full support 12firefox full support 1ie full support 5opera full support 6notes full support 6notes notes starting with opera 33, this method is blocked in...
... 12firefox full support 1ie full support 5opera full support 6notes full support 6notes notes starting with opera 33, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.safari full support 1.1webview android full support 1notes full support 1notes notes starting with webview 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.chrome android full suppo...
... 1notes notes starting with webview 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.chrome android full support 18notes full support 18notes notes starting with chrome 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.firefox android no support nonotes no support nonotes notes see bug 1247609.opera android full support 10.1notes full support 10.1notes notes starting with opera 33, this method is blocked inside an <ifra...
... no support nonotes no support nonotes notes see bug 1247609.opera android full support 10.1notes full support 10.1notes notes starting with opera 33, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.safari ios full support 1samsung internet android full support 1.0notes full support 1.0notes notes starting with samsung internet 5.0, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.legend ...
Window.sessionStorage - Web APIs
accesses a session storage object for the current origin. sessionstorage is similar to localstorage; the difference is that while data in localstorage doesn't expire, data in sessionstorage is cleared when the page session ends. a page session lasts as long as the browser is open, and survives over page reloads and restores. opening a page in a new tab or window creates a new session with the value of the top-level browsing context, which differs from how session cookies work. opening multiple tabs/windows with the same url creates sessionstorage for each tab/window. closing a tab/window ends the session and clears objects in sessionstorage. data stored in sessionstorage is specific to the protocol of the page. in particular, data stored by a script on a site accessed with http (e.g., h...
...age for each tab/window. closing a tab/window ends the session and clears objects in sessionstorage. data stored in sessionstorage is specific to the protocol of the page. in particular, data stored by a script on a site accessed with http (e.g., http://example.com) is put in a different sessionstorage object from the same site accessed with https (e.g., https://example.com). the keys and the values are always in the utf-16 domstring format, which uses two bytes per character. as with objects, integer keys are automatically converted to strings. syntax mystorage = window.sessionstorage; value a storage object which can be used to access the current origin's session storage space. exceptions securityerror the request violates a policy decision, or the origin is not a valid scheme/h...
... origin's session storage object and adds data to it with storage.setitem(). sessionstorage.setitem('mycat', 'tom'); the following example autosaves the contents of a text field, and if the browser is refreshed, restores the text field content so that no writing is lost. ...
...f a text field, and if the browser is refreshed, restores the text field content so that no writing is lost. // get the text field that we're going to track let field = document.getelementbyid("field"); // see if we have an autosave value // (this will only happen if the page is accidentally refreshed) if (sessionstorage.getitem("autosave")) { // restore the contents of the text field field.value = sessionstorage.getitem("autosave"); } // listen for changes in the text field field.addeventlistener("change", function() { // and save the results into the session storage object sessionstorage.setitem("autosave", field.value); }); note: please refer to the using the web storage api article for a full example. specifications specification status comment html l...
Window.showModalDialog() - Web APIs
this feature has been removed. please fix your web sites and applications. this method was removed in chrome 43 and firefox 56. the window.showmodaldialog() created and displayed a modal dialog box containing a specified html document. syntax returnval = window.showmodaldialog(uri[, arguments][, options]); returnval holds the returnvalue property as set by the document specified by uri. ...
... chrome 43 and firefox 56. the window.showmodaldialog() created and displayed a modal dialog box containing a specified html document. syntax returnval = window.showmodaldialog(uri[, arguments][, options]); returnval holds the returnvalue property as set by the document specified by uri. uri is the url of the document to display in the dialog. arguments is an optional variant containing values passed to the dialog; these are made available in the window object's window.dialogarguments property. ...
...default is yes. dialogheight: height the height of the dialog box in pixels. dialogleft: left distance of the dialog box from the left edge of the desktop. ...
...yes. dialogheight: height the height of the dialog box in pixels. dialogleft: left distance of the dialog box from the left edge of the desktop. dialogwidth: width the width of the dialog box in pixels. dialogtop: top distance of the dialog box from the top edge of the desktop. resizable: {on | off | yes | no | 1 | 0 } if this argument's value is on, yes, or 1, the dialog window can be resized by the user; otherwise its size is fixed. the default value is no. scroll: {on | off | yes | no | 1 | 0 } if on, yes, or 1, the dialog window has scroll bars; otherwise its size is fixed. default is no. note: firefox does not implement the dialoghide, edge, status, or unadorned arguments. examples try out showmodaldialog(). ...
WindowEventHandlers.onbeforeunload - Web APIs
ow.addeventlistener("beforeunload", function(event) { ... }); window.onbeforeunload = function(event) { ... }; typically, it is better to use window.addeventlistener() and the beforeunload event, instead of onbeforeunload. example this example prompts the user before unloading. ...
...his example prompts the user before unloading. the html specification states that authors should use the event.preventdefault() method instead of using event.returnvalue to prompt the user. ...
...er before unloading. the html specification states that authors should use the event.preventdefault() method instead of using event.returnvalue to prompt the user. ...
...ld use the event.preventdefault() method instead of using event.returnvalue to prompt the user. window.addeventlistener('beforeunload', function (e) { // cancel the event e.preventdefault(); // if you prevent default behavior in mozilla firefox prompt will always be shown // chrome requires returnvalue to be set e.returnvalue = ''; }); guarantee the browser unload by removing the returnvalue property of the event window.addeventlistener('beforeunload', function (e) { // the absence of a returnvalue property on the event will guarantee the browser unload happens delete e['returnvalue']; }); notes when your page uses javascript to render content, the javascript may stop when leaving and then navigating back to the page. you can bind to window.onbeforeunload to prevent the browse...
WindowOrWorkerGlobalScope.fetch() - Web APIs
s that you want to apply to the request. the possible options are: method the request method, e.g., get, post. note that the origin header is not set on fetch requests with a method of head or get. (this behavior was corrected in firefox 65 — see bug 1508661). headers any headers you want to add to your request, contained within a headers object or an object literal with bytestring values. note that some names are forbidden. body any body that you want to add to your request: this can be a blob, buffersource, formdata, urlsearchparams, usvstring, or readablestream object. note that a request using the get or head method cannot have a body. mode the mode you want to use for the request, e.g., cors, no-cors, or same-origin. credentials the request credentials you want t...
...vstring specifying the referrer of the request. this can be a same-origin url, about:client, or an empty string. referrerpolicy specifies the referrer policy to use for the request. may be one of no-referrer, no-referrer-when-downgrade, same-origin, origin, strict-origin, origin-when-cross-origin, strict-origin-when-cross-origin, or unsafe-url. integrity contains the subresource integrity value of the request (e.g., sha256-bpfbw7ivv8q2jlit13fxdyae2tjllusrsz273h2nfse=). keepalive the keepalive option can be used to allow the request to outlive the page. fetch with the keepalive flag is a replacement for the navigator.sendbeacon() api. signal an abortsignal object instance; allows you to communicate with a fetch request and abort it if desired via an abortcontroller. return ...
... of the request (e.g., sha256-bpfbw7ivv8q2jlit13fxdyae2tjllusrsz273h2nfse=). keepalive the keepalive option can be used to allow the request to outlive the page. fetch with the keepalive flag is a replacement for the navigator.sendbeacon() api. signal an abortsignal object instance; allows you to communicate with a fetch request and abort it if desired via an abortcontroller. return value a promise that resolves to a response object. exceptions aborterror the request was aborted due to a call to the abortcontroller method abort() method. typeerror the specified url string includes user credentials. this information should instead be provided using an authorization header. examples in our fetch request example (see fetch request live) we create a new request object using...
... ...
Worker.prototype.postMessage() - Web APIs
the postmessage() method of the worker interface sends a message to the worker's inner scope. this accepts a single parameter, which is the data to send to the worker. the data may be any value or javascript object handled by the structured clone algorithm, which includes cyclical references. the worker can send back information to the thread that spawned it using the dedicatedworkerglobalscope.postmessage method. syntax worker.postmessage(message, [transfer]); parameters message the object to deliver to the worker; this will be in the data field in the event delivered to the dedicatedworkerglobalscope.onmessage handler. this may be any value or javascript object handled by the structured clone algorithm, which includes cyclical references. if the message parameter is not provided, a ...
...sfer optional an optional array of transferable objects to transfer ownership of. if the ownership of an object is transferred, it becomes unusable (neutered) in the context it was sent from and becomes available only to the worker it was sent to. transferable objects are instances of classes like arraybuffer, messageport or imagebitmap objects that can be transferred. null is not an acceptable value for transfer. returns void. example the following code snippet shows the creation of a worker object using the worker() constructor. when either of two form inputs (first and second) have their values changed, change events invoke postmessage() to send the value of both inputs to the current worker. var myworker = new worker('worker.js'); first.onchange = function() { myworker.postmessag...
...sfer. returns void. example the following code snippet shows the creation of a worker object using the worker() constructor. when either of two form inputs (first and second) have their values changed, change events invoke postmessage() to send the value of both inputs to the current worker. ...
...ns void. example the following code snippet shows the creation of a worker object using the worker() constructor. when either of two form inputs (first and second) have their values changed, change events invoke postmessage() to send the value of both inputs to the current worker. var myworker = new worker('worker.js'); first.onchange = function() { myworker.postmessage([first.value,second.value]); console.log('message posted to worker'); } second.onchange = function() { myworker.postmessage([first.value,second.value]); console.log('message posted to worker'); } for a full example, see ourbasic dedicated worker example (run dedicated worker). note: postmessage() can only send a single object at once. as seen above, if you want to pass multiple values you can send an array. t...
XPathResult - Web APIs
the xpathresult interface represents the results generated by evaluating an xpath expression within the context of a given node. since xpath expressions can result in a variety of result types, this interface makes it possible to determine and handle the type and value of the result. properties xpathresult.booleanvalueread only a boolean representing the value of the result if resulttype is boolean_type. xpathresult.invaliditeratorstateread only signifies that the iterator has become invalid. it is true if resulttype is unordered_node_iterator_type or ordered_node_iterator_type and the document has been modified since this result was returned. xpathresult.numbervalueread only a number representing the value of the result if resulttype is number_type. xpathresult.resulttyperead onl...
...e if resulttype is unordered_node_iterator_type or ordered_node_iterator_type and the document has been modified since this result was returned. xpathresult.numbervalueread only a number representing the value of the result if resulttype is number_type. xpathresult.resulttyperead only a number code representing the type of the result, as defined by the type constants. xpathresult.singlenodevalueread only a node representing the value of the single node result, which may be null. xpathresult.snapshotlengthread only the number of nodes in the result snapshot. xpathresult.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 nex...
...ates over it and returns the next node from it or null if there are no more nodes. xpathresult.snapshotitem() returns an item of the snapshot collection or null in case the index is not within the range of nodes. unlike the iterator result, the snapshot does not become invalid, but may not correspond to the current document if it is mutated. constants result type defined constant value description any_type 0 a result set containing whatever type naturally results from evaluation of the expression. note that if the result is a node-set then unordered_node_iterator_type is always the resulting type. number_type 1 a result containing a single number. this is useful for example, in an xpath expression using the count() function. string_...
... of the expression. note that if the result is a node-set then unordered_node_iterator_type is always the resulting type. number_type 1 a result containing a single number. this is useful for example, in an xpath expression using the count() function. string_type 2 a result containing a single string. boolean_type 3 a result containing a single boolean value. this is useful for example, in an xpath expression using the not() function. unordered_node_iterator_type 4 a result node-set containing all the nodes matching the expression. the nodes may not necessarily be in the same order that they appear in the document. ordered_node_iterator_type 5 a result node-set containing all the nodes matching the expression. the nodes ...
XRHandedness - Web APIs
left the input controller is being held in, worn on, or is attached to the user's left hand. right the input controller is being held in, worn on, or is attached to the user's right hand. ...
... left the input controller is being held in, worn on, or is attached to the user's left hand. right the input controller is being held in, worn on, or is attached to the user's right hand. ...
... left the input controller is being held in, worn on, or is attached to the user's left hand. right the input controller is being held in, worn on, or is attached to the user's right hand. ...
...gripspace which isn't null. if a gripspace is present, that means the input source is a hand-held device of some sort, so it should be rendered visibly if possible. if gripspace is non-null, the function proceeds to get the pose for the gripspace transformed into the current reference space. assuming that's then valid, a function called myrenderhandobject() is called with the grip's pose and the value of handedness. with these values in hand (no pun intended), myrenderhandobject() can draw the appropriate model positioned and formed for the correct hand. specifications specification status comment webxr device apithe definition of 'xrhandedness' in that specification. working draft initial definition. ...
XRInputSource.targetRaySpace - Web APIs
the read-only xrinputsource property targetrayspace returns an xrspace (typically an xrreferencespace) representing the position and orientation of the target ray in the virtual space. its native origin tracks the position of the origin point of the target ray, and its orientation indicates the orientation of the controller device itself. ...
... in the context of the input source's targetraymode, can be used both to fully interpret the device as an input source. <<<--- needs diagram showing targetrayspace relative to gripspace and world space --->>> to obtain an xrspace representing the input controller's position and orientation in virtual space, use the gripspace property. syntax let targetrayspace = xrinputsource.targetrayspace; value an xrspace object—typically an xrreferencespace or xrboundedreferencespace—which represents the position and orientation of the input controller's target ray in virtual space. the native origin of the returned xrspace is located at the point from which the target ray is emitted, and the orientation of the space indicates the direction in which the target ray is pointing. usage notes all i...
...native origin of the returned xrspace is located at the point from which the target ray is emitted, and the orientation of the space indicates the direction in which the target ray is pointing. usage notes all input sources—regardless of their targetraymode—have a valid targetrayspace. the exact meaning of this space varies, however, depending on the mode: every gaze input (targetraymode value of gaze), shares the same xrspace object as their target ray space, since the gaze input comes from the viewer's head. this shared space represents the same location as the space returned by the xrsession method requestreferencespace(), but is maintained as a different object to allow for future enhancements to the api. the target ray space reported by tracked pointer inputs (targetraymode of tr...
...ice. to determine the position and orientation of the target ray while rendering a frame, pass it into the xrframe method getpose() method, then use the returned xrpose object's transform to gather the spatial information you need. example this fragment of code shows part of a function to be called once every frame. it looks for inputs which have a non-null targetrayspace. inputs which have a value for this property represent inputs that project a target ray outward from the user. for each such input, this example looks for inputs whose targetraymode is tracked-pointer, indicating that the input is in fact intended to represent a targeting device rather than a gazing device, screen tap, or mouse click. for tracked pointers, a function myrendertargetrayasbeam() is called to render a beam fr...
XRPose.emulatedPosition - Web APIs
usage notes there are two basic categories of xr tracking systems. ...
... usage notes there are two basic categories of xr tracking systems. ...
... usage notes there are two basic categories of xr tracking systems. a basic xr headset provides three degrees of freedom (3dof), tracking the pitch, yaw, and roll of the user's head. ...
...en from other sources, such as keyboard or mouse inputs or game controllers. as such, the position is considered to be emulated, so the emulatedposition property is true. contrariwise, xr devices which can also track movement forward and backward as well as laterally—six degree of freedom (6dof) devices—don't require any information from other sources to determine the user's position, so the value of emulatedposition is false. the same notion applies not just to the user's head, but to any object. a hand controller that can directly report its position would have a value of false for this property as well. if its position is computed as an offset from another object (such as by basing it off the model representing the user's body), then this value is true. this information is important b...
XRRenderStateInit - Web APIs
the xrrenderstateinit dictionary is a writeable version of the xrrenderstate interface, and is used when calling an xrsession's updaterenderstate() method to apply changes to the render state prior to rendering the next frame. all distances are specified as floating-point values in meters; you can specify a value of 50 centimeters using a value of 0.5, for example. properties baselayer optional an xrwebgllayer object from which the webxr compositor will obtain imagery. this is null by default. depthfar optional a floating-point value specifying the distance in meters from the viewer to the far clip plane, which is a plane parallel to the display surface beyond which no further rendering will occur. all rendering will take place between the distances specified by depthnear and depthfa...
...ull by default. depthfar optional a floating-point value specifying the distance in meters from the viewer to the far clip plane, which is a plane parallel to the display surface beyond which no further rendering will occur. all rendering will take place between the distances specified by depthnear and depthfar. this is 1000 meters (1 kilometer) by default. depthnear optional a floating-point value indicating the distance in meters from the viewer to a plane parallel to the display surface to be the near clip plane. no part of the scene on the viewer's side of this plane will be rendered. this is 0.1 meters (10 centimeters) by default. ...
...and depthfar. this is 1000 meters (1 kilometer) by default. depthnear optional a floating-point value indicating the distance in meters from the viewer to a plane parallel to the display surface to be the near clip plane. no part of the scene on the viewer's side of this plane will be rendered. this is 0.1 meters (10 centimeters) by default. inlineverticalfieldofview optional a floating-point value indicating the default field of view, in radians, to be used when computing the projection matrix for an inline xrsession. the projection matrix calculation also takes into account the output canvas's aspect ratio. this property must not be specified for immersive sessions, so the value is null by default for immersive sessions. the default value is otherwise π * 0.5 (half of the value of pi). ...
...ix calculation also takes into account the output canvas's aspect ratio. this property must not be specified for immersive sessions, so the value is null by default for immersive sessions. the default value is otherwise π * 0.5 (half of the value of pi). usage notes any properties not specified in the xrrenderstateinit compliant object passed into updaterenderstate() are left at their current values. specifications specification status comment webxr device apithe definition of 'xrrenderstateinit' in that specification. working draft initial definition. ...
XRSession.updateRenderState() - Web APIs
newstate an object conforming to the xrrenderstateinit dictionary specifying the properties of the session's renderstate to update before rendering the next frame. the specified object may have any combination of the following fields. baselayer optional an xrwebgllayer object from which the webxr compositor will obtain imagery. this is null by default. ...
...ull by default. depthfar optional a floating-point value specifying the distance in meters from the viewer to the far clip plane, which is a plane parallel to the display surface beyond which no further rendering will occur. all rendering will take place between the distances specified by depthnear and depthfar. this is 1000 meters (1 kilometer) by default. depthnear optional a floating-point value indicating the distance in meters from the viewer to a plane parallel to the display surface to be the near clip plane. no part of the scene on the viewer's side of this plane will be rendered. this is 0.1 meters (10 centimeters) by default. ...
...and depthfar. this is 1000 meters (1 kilometer) by default. depthnear optional a floating-point value indicating the distance in meters from the viewer to a plane parallel to the display surface to be the near clip plane. no part of the scene on the viewer's side of this plane will be rendered. this is 0.1 meters (10 centimeters) by default. inlineverticalfieldofview optional a floating-point value indicating the default field of view, in radians, to be used when computing the projection matrix for an inline xrsession. the projection matrix calculation also takes into account the output canvas's aspect ratio. this property must not be specified for immersive sessions, so the value is null by default for immersive sessions. the default value is otherwise π * 0.5 (half of the value of pi). ...
... exceptions this method may throw any of the following exceptions. ...
XRSession.visibilityState - Web APIs
the read-only visibilitystate property of the xrsession interface is a string indicating whether the webxr content is currently visible to the user, and if it is, whether it's the primary focus. every time the visibility state changes, a visibilitychange event is fired on the xrsession object. ...
... the read-only visibilitystate property of the xrsession interface is a string indicating whether the webxr content is currently visible to the user, and if it is, whether it's the primary focus. every time the visibility state changes, a visibilitychange event is fired on the xrsession object. ...
... time the visibility state changes, a visibilitychange event is fired on the xrsession object. syntax visibilitystate = xrsession.visibilitystate; value a domstring containing one of the values defined in the enumerated type xrvisibilitystate; this string indicates whether or not the xr content is visible to the user and if it is, whether or not it's currently the primary focus. the possible values of visibilitystate are: hidden the virtual scene generated by the xrsession is not currently visible to the user, so its requestanimationframe() callbacks are not being executed until thevisibilitystate changes. input controllers are not being handled for the session. visible the virtual scene rendered by the xrsession is currently visible to the user and is the primary focus of the user's...
...tilization, the user agent may be handling the session's requestanimationframe() callbacks at a throttled rate. input controllers are not being processed for the session. usage notes it's important to keep in mind that because an immersive webxr session is potentially being shown using a different display than the html document in which it's running (such as when being shown on a headset), the value of a session's visibilitystate may not necessarily be the same as the owning document's visibilitystate. for instance, if the viewer is using a headset tethered to a computer and the immersive scene is obscured by a configuration ui, the user could peek out from behind the headset and still be able to see the document itself on their computer's monitor. specifications specification ...
XRView.eye - Web APIs
Web › API › XRView › eye
right the view represents the viewer's right eye. ...
... right the view represents the viewer's right eye. ...
... right the view represents the viewer's right eye. ...
... updateinjury() returns true if the eye is still injured or fal...
XRWebGLLayer.getNativeFramebufferScaleFactor() static method - Web APIs
ng in the frame buffer's contents being scaled down for display to the xr device. this can happen for display environments which use superscaling or anti-aliasing techniques to improve perceived image quality. syntax let nativescaling = xrwebgllayer.getnativeframebufferscalefactor(session); parameters session the xrsession for which to return the native framebuffer scaling factor. return value a floating-point value which, when multiplied by the xrsession's recommended framebuffer dimensions, results in the xr device's native frame buffer resolution. if the session has ended, this function returns 0.0. usage notes the scaling factor returned by this function will be 1.0 if the native resolution of the xr device and the resolution of the xr device match. in any case, multiplying the ...
...on's recommended framebuffer dimensions, results in the xr device's native frame buffer resolution. if the session has ended, this function returns 0.0. usage notes the scaling factor returned by this function will be 1.0 if the native resolution of the xr device and the resolution of the xr device match. in any case, multiplying the recommended resolution as identified by the xrsession by this value will result in the actual native resolution of the xr hardware. the recommended webgl frame buffer resolution is the best possible estimate of the resolution necessary to contain all of fthe xrviews needed by the device while at the same time providing typical applications an acceptable balance of image quality and performance. for example, consider a device which uses a 2560x1440 pixel frame b...
...h is used to render two views, for the left and right eyes, side by side each at a resolution of 1280x1440 pixels). consider a frame buffer which at full size looks like this: if, on this device, it's determined that due to gpu limitations the browser needs to reduce image quality in order to improve performance to an acceptable level, it might choose to halve the resolution. in this case, the value returned by xrwebgllayer.getnativeframebufferscalefactor() will be 2.0. this method of dividing the frame buffer between views is shown in the following diagram. now the width and height of the frame buffer are 50% what they were before, resulting in a total frame buffer size of 1280 by 720 pixels, with each eye's half of the buffer being 640x720 pixels. now we can see the coordinates of each ...
...); xrsession.updaterenderstate({ baselayer: gllayer }); }); }; this starts by calling the webgl rendering context function makexrcompatible(). when the returned promise resolves, we proceed by calling xrwebgllayer's getnativeframebufferscalefactor() static function to get the scale factor needed to reach the native resolution, and we then pass that into the webgllayer() constructor as the value of the framebufferscalefactor property in its layerinit dictionary, which is an xrwebgllayerinit object. that gets us a new xrwebgllayer object representing a rendering surface we can use for the xrsession; we set it as the rendering surface for xrsession by calling its updaterenderstate() method, passing the new gllayer in using the xrrenderstate dictionary's xrrenderstate.baselayer property. t...
Web APIs
Web › API
ooth bluetoothadvertisingdata bluetoothcharacteristicproperties bluetoothdevice bluetoothremotegattcharacteristic bluetoothremotegattdescriptor bluetoothremotegattserver bluetoothremotegattservice body broadcastchannel budgetservice budgetstate buffersource bytelengthqueuingstrategy 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 cssstylesheet cssstylevalue csssupportsrule cssunitvalue cssunparsedvalue cssvalue cssvaluelist cssvaria...
...merule csskeyframesrule csskeywordvalue cssmathproduct cssmathsum cssmathvalue cssmediarule cssnamespacerule cssnumericvalue cssomstring csspagerule csspositionvalue cssprimitivevalue csspseudoelement cssrule cssrulelist cssstyledeclaration cssstylerule cssstylesheet cssstylevalue csssupportsrule cssunitvalue cssunparsedvalue cssvalue cssvaluelist cssvariablereferencevalue cache cachestorage canvascapturemediastreamtrack canvasgradient canvasimagesource canvaspattern canvasrenderingcontext2d caretposition channelmergernode channelsplitternode characterdata childnode client clients clipboard clipboardevent clipboarditem closeevent comment compositionevent constantsourcenode constrainboolean constraindomstring constraindouble constrainulong contenti...
...geevent f featurepolicy federatedcredential fetchevent file fileentrysync fileerror fileexception filelist filereader filereadersync filerequest filesystem filesystemdirectoryentry filesystemdirectoryreader filesystementry filesystementrysync filesystemfileentry filesystemflags filesystemsync focusevent fontface fontfaceset fontfacesetloadevent formdata formdataentryvalue formdataevent fullscreenoptions g gainnode gamepad gamepadbutton gamepadevent gamepadhapticactuator geolocation geolocationcoordinates geolocationposition geolocationpositionerror geometryutils gestureevent globaleventhandlers gyroscope h htmlanchorelement htmlareaelement htmlaudioelement htmlbrelement htmlbaseelement htmlbasefontelement htmlbodyelement htmlbuttonelement htmlcanvasele...
...element htmltablecaptionelement htmltablecellelement htmltablecolelement htmltableelement htmltablerowelement htmltablesectionelement htmltemplateelement htmltextareaelement htmltimeelement htmltitleelement htmltrackelement htmlulistelement htmlunknownelement htmlvideoelement hashchangeevent headers history hkdfparams hmacimportparams hmackeygenparams i idbcursor idbcursorsync idbcursorwithvalue idbdatabase idbdatabaseexception idbdatabasesync idbenvironment idbenvironmentsync idbfactory idbfactorysync idbindex idbindexsync idbkeyrange idblocaleawarekeyrange idbmutablefile idbobjectstore idbobjectstoresync idbopendbrequest idbrequest idbtransaction idbtransactionsync idbversionchangeevent idbversionchangerequest iirfilternode idledeadline imagebitmap imagebi...
Using the aria-orientation attribute - Accessibility
the aria-orientation attribute is used to indicate whether an element is oriented horizontally or vertically. value vocabulary vertical the element is oriented vertically. horizontal (default) the element is oriented horizontally. possible effects on user agents and assistive technology note: opinions may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples example 1: the snippet below shows a simple slider that is oriented vertically. ...
...s and assistive technology note: opinions may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples example 1: the snippet below shows a simple slider that is oriented vertically. ...
... note: opinions may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples example 1: the snippet below shows a simple slider that is oriented vertically. ...
...fer on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples example 1: the snippet below shows a simple slider that is oriented vertically. ...
Using the aria-relevant attribute - Accessibility
removals are deletion of nodes in the accessiblity tree; should be considered relevant. ...
... removals are deletion of nodes in the accessiblity tree; should be considered relevant. ...
... describe what types of changes have occurred to an aria-live region, and which are relevant and should be announced. any change that is not relevant acts in the same manner it would if the aria-live attribute were set to off. aria-relevant is commonly used when a web page contains content that may be updated while viewing the page. ...
...ng values: additions element nodes added to the accessibility tree within the live region; should be considered relevant. removals are deletion of nodes in the accessiblity tree; should be considered relevant. text are changes to the textual content of existing nodes; should be considered relevant. all is equivalent to additions removals text. aria-relevant="additions text" is the default value on a live region. additional resources wai-aria specification for aria-relevant ...
ARIA annotations - Accessibility
cessibility purposes. it is useful to know when to use each. you’ll see examples of most of these later on in the article, but briefly: aria-label="" can be set on an element to provide a brief descriptive label when it isn't appropriate to have the label actually appearing in the ui, for example a search input in a horizontal nav bar. aria-labelledby="" can be set on an element and given a value the same as the id of an element that contains a label for the element. this is useful when the element’s label is available in the ui, but for some reason a conventional <label> won’t work. aria-description="" works the same as aria-label="", but is used when you want to give an element a more detailed description, rather than a short label. aria-describedby="" works the same as aria-label...
...shows numbers of votes, but you want to summarize the purpose of the widget in a clear description because the ui does not make it clear: <section aria-description="choose your favourite fruit — the fruit with the highest number of votes will be added to the lunch options next week."> <p>pick your favourite fruit:</p> <form> <ul> <li><label>apple: <input type="radio" name="fruit" value="apple"></label></li> <li><label>orange: <input type="radio" name="fruit" value="orange"></label></li> <li><label>banana: <input type="radio" name="fruit" value="banana"></label></li> </ul> </form> </section> if the descriptive text does appear in the ui, you can link the description to the widget using aria-describedby, like so: <p id="fruit-desc">choose your favourite fruit ...
...rm> </section> if the descriptive text does appear in the ui, you can link the description to the widget using aria-describedby, like so: <p id="fruit-desc">choose your favourite fruit — the fruit with the highest number of votes will be added to the lunch options next week.</p> <section aria-describedby="fruit-desc"> <form> <ul> <li><label>apple: <input type="radio" name="fruit" value="apple"></label></li> <li><label>orange: <input type="radio" name="fruit" value="orange"></label></li> <li><label>banana: <input type="radio" name="fruit" value="banana"></label></li> </ul> </form> </section> insertions and deletions a common wish in online document systems like google docs is to be able to track changes, to see what reviewers or editors have suggested as chan...
...-author="chris"> <h3>chris said</h3> <p class="comment-text">i really think this could use more cowbell.</p> <p><time datetime="2019-03-30t19:29">march 30 2019, 19:29</time></p> </div> we’ve used role="comment" to mark this up as a comment. to associate the comment with the text being commented, we need to wrap the commented text with an element containing the aria-details attribute, the value of which should be the id of the comment. <mark> is a suitable element for this purpose (a comment is a reference annotation), so the annotation could look like this: <p>the last half of the song is a slow-rising crescendo that peaks at the <mark aria-details="thread-1">end of the guitar solo</mark>, before fading away sharply.</p> <div role="comment" id="thread-1" data-author="chris"> <h3>ch...
ARIA: row role - Accessibility
lls in the corresponding column. role="rowheader" a header cell that is the structural equivalent of the html <th> element with a row scope. unlike a plain cell, the rowheader role establishes a relationship between it and all cells in the corresponding row. states and properties aria-expanded state the aria-expanded attribute, which defines the state of the row, can take one of three values, or be omitted: aria-expanded="true: row is currently expanded. aria-expanded="false": row is currently collapsed. aria-expended="undefined" or the attribute is missing: the row is neither expandable nor collapsible. if the element with the aria-expanded attribute controls the expansion of another grouping container that is not 'owned by' the element, the author should reference the...
... the aria-expanded attribute controls the expansion of another grouping container that is not 'owned by' the element, the author should reference the container by using the aria-controls attribute. aria-selected state only relevant if the row is in an interactive container, such as a grid or treegrid, but not relevant if the row is in a table. the aria-selected attribute can take one of three values, or be omitted: aria-selected="true: row is currently selected aria-selected="false": row is not currently selected. aria-selected="undefined" or the attribute is missing: the row is not selectable. aria-colindex attribute the aria-colindex attribute is only needed if columns are hidden from the dom. it is generally placed on row children, rather than on the row itself. if the c...
...s not currently selected. aria-selected="undefined" or the attribute is missing: the row is not selectable. aria-colindex attribute the aria-colindex attribute is only needed if columns are hidden from the dom. it is generally placed on row children, rather than on the row itself. if the columns displayed are contiguous, then it can be placed on the row. the attribute takes as its value an integer between 1 and the total number of columns within the table, grid or treegrid. when placed on the row, the aria-colindex defines an element's column index or position with respect to the total number of columns within a row. for example, in a table with 15 columns, and columns 4, 5, and 6 are in the dom, aria-colindex="4" could be set on every row. if the set of columns which is pr...
...anning more than one row or column, put the aria-colindex on all of the children of each row instead of on the row itself. if all the columns are in the dom, this attribute is not necessary. aria-rowindex attribute the aria-rowindex attribute is only needed if rows are hidden from the dom, to indicate which row, in the list of total rows, is being read. the attribute, placed with a unique value on each row, takes as its value an integer between 1 and the total number of rows within the table, grid or treegrid, indicating the position, or index, of each row. for example, if a table has 1,500 rows, but only the header and rows 47 and 52 are in the dom, aria-rowindex="1" would be set on the header row, and aria-rowindex="47" and aria-rowindex="52" would be set on the 47th and 52nd row, res...
ARIA: table role - Accessibility
the table value of the aria role attribute identifies the element containing the role as having a non-interactive table structure containing data arranged in rows and columns, similar to the native <table> html element. <div role="table" aria-label="semantic elements" aria-describedby="semantic_elements_table_desc" aria-rowcount="81"> <div id="semantic_elements_table_desc">semantic elements to use instead of aria's roles</div> <div role="rowgroup"> <div role="row"> <span role="columnheader" aria-sort="none">aria role</span> <span role="columnheader" aria-sort="none">semantic element</span> </div> </div> <div role="rowgroup"> <div role="row" aria-rowindex="11"> <span role="cell">header</span> <span role="cell">h1</span> </div> <div role="row"...
...sible is strongly encouraged. associated wai-aria roles, states, and properties role="rowgroup" an optional child of the table, the row group encapsulates a group of rows, similar to thead, tbody, and tfoot. role="row" a row within the table, and optionally within a rowgroup, that is a container for one or more cells, columnheaders, or rowheaders. ...
.... aria-describedby attribute takes as its value the id of the element that serves as a description for the table. aria-label attribute the aria-label provides an accessible name for the table. aria-colcount attribute this attribute is only required if the columns are not present in the dom all the time. it provides an explicit indication of the number of columns in the full table. set the value to the total number of columns in the full table. if unknown, set aria-colcount="-1". aria-rowcount attribute this attribute is only required if the rows are not present in the dom all the time, such as scrollable tables that reuse rows to minimize the number of dom nodes. it provides an explicit indication of the number of rows in the full table. ...
...if unknown, set aria-colcount="-1". keyboard interactions none required javascript features none. for sortable columns, see the columnheader aria role. ...
-moz-orient - CSS: Cascading Style Sheets
the -moz-orient css property specifies the orientation of the element to which it's applied. syntax the -moz-orient property is specified as one of the keyword values chosen from the list below. values inline the element is rendered in the same direction as the axis of the text: horizontally for horizontal writing modes, vertically for vertical writing modes. block the element is rendered orthogonally to the axis of the text: vertically for horizontal writing modes, horizontal for vertical writing modes. horizontal the element is rendered horizontally. vertical the element is rendered vertically. ...
... same direction as the axis of the text: horizontally for horizontal writing modes, vertically for vertical writing modes. block the element is rendered orthogonally to the axis of the text: vertically for horizontal writing modes, horizontal for vertical writing modes. horizontal the element is rendered horizontally. vertical the element is rendered vertically. ...
...is rendered orthogonally to the axis of the text: vertically for horizontal writing modes, horizontal for vertical writing modes. horizontal the element is rendered horizontally. vertical the element is rendered vertically. ...
... is rendered vertically. formal definition initial valueinlineapplies toany element; it has an effect on progress and meter, but not on <input type="range"> or other elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax inline | block | horizontal | vertical examples html <p> the following progress meter is horizontal (the default): </p> <progress max="100" value="75"></progress> <p> the following progress meter is vertical: </p> <progress class="vert" max="100" value="75"></progress> css .vert { -moz-orient: vertical; width: 16px; height: 150px; } result specifications not part of any standard. though submitted to the w3c, with positive initial feedback, this property is not yet part of any specification; currently, this is a mozilla-spec...
-moz-user-input - CSS: Cascading Style Sheets
in mozilla applications, -moz-user-input determines if an element will accept user input. /* keyword values */ -moz-user-input: none; -moz-user-input: enabled; -moz-user-input: disabled; /* global values */ -moz-user-input: inherit; -moz-user-input: initial; -moz-user-input: unset; for elements that normally take user input, such as a <textarea>, the initial value of -moz-user-input is enabled. note: -moz-user-input was one of the proposals leading to the proposed css 3 user-input property, which has not yet reached candidate recommendation (call for implementations). ...
... disabled the element does not accept user input. ...
...ecommendation (call for implementations). a similar property, user-focus, was proposed in early drafts of a predecessor of the css3 ui specification, but was rejected by the working group. syntax values none the element does not respond to user input, and it does not become :active. enabled the element accepts user input. for textboxes, this is the default behavior. please note that this value is no longer supported in firefox 60 onwards (bug 1405087). disabled the element does not accept user input. ...
...espond to user input, and it does not become :active. enabled the element accepts user input. for textboxes, this is the default behavior. please note that this value is no longer supported in firefox 60 onwards (bug 1405087). disabled the element does not accept user input. however, this is not the same as setting disabled to true, in that the element is drawn normally. please note that this value is no longer supported in firefox 60 onwards (bug 1405087). formal definition initial valueautoapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax auto | none | enabled | disabled examples disabling user input for an element input.example { /* the user will be able to select the text, but not change it. */ -moz-user-input: disabled; } spe...
font-display - CSS: Cascading Style Sheets
block gives the font face a short block period and an infinite swap period. swap gives the font face an extremely small block period and an infinite swap period. fallback gives the font face an extremely small block period and a short swap period. ...
... block gives the font face a short block period and an infinite swap period. swap gives the font face an extremely small block period and an infinite swap period. fallback gives the font face an extremely small block period and a short swap period. ...
...d, it is used normally. font swap period if the font face is not loaded, any element attempting to use it must render a fallback font face. if the font face successfully loads during this period, it is used normally. font failure period if the font face is not loaded, the user agent treats it as a failed load causing normal font fallback. ...
...ally. font swap period if the font face is not loaded, any element attempting to use it must render a fallback font face. if the font face successfully loads during this period, it is used normally. font failure period if the font face is not loaded, the user agent treats it as a failed load causing normal font fallback. ...
size - CSS: Cascading Style Sheets
Web › CSS › @page › size
the size css at-rule descriptor, used with the @page at-rule, defines the size 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...
...er 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 printing.) a3 ...
...ns: 257mm x 364mm. letter this keyword is a equivalent 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. ...
... letter this keyword is a equivalent 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. ...
@supports - CSS: Cascading Style Sheets
Web › CSS › @supports
ny other conditional group at-rule. @supports (display: grid) { div { display: grid; } } @supports not (display: grid) { div { float: right; } } in javascript, @supports can be accessed via the css object model interface csssupportsrule. syntax the @supports at-rule associates a block of statements with a supports condition. the supports condition consists of one or more name-value pairs combined by conjunctions (and), disjunctions (or), and/or negations (not). precedence of operators can be defined with parentheses. declaration syntax the most basic supports condition is a simple declaration (a property name followed by a value, separated by a colon). the declaration must be surrounded by parentheses. the following example returns true if the browser's transform-origin p...
...<compound-selector> ]*where <compound-selector> = [ <type-selector>? <subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!<combinator> = '>' | '+' | '~' | [ '|' ]where <type-selector> ...
...<compound-selector> ]*where <compound-selector> = [ <type-selector>? <subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!<combinator> = '>' | '+' | '~' | [ '|' ]where <type-selector> = <wq-name> | <ns-prefix>? '...
...subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!<combinator> = '>' | '+' | '~' | [ '|' ]where <type-selector> = <wq-name> | <ns-prefix>? '*'<subclass-selector> = <id-selector> | <class-selector> | <attribute-selector> | <pseudo-class-selector><pseudo-element-selector> = ':' <pseudo-class-selector><pseudo-class-selector> = ':' <ident-token> | ':' <function-token> <any-value> ')'where <wq-name> = <ns-prefix>? <ident-token><ns-prefix> = [ <ident-token> | '*' ]? | <id-selector> = <hash-token><class-selector> = '.' <ident-token><attribute-selector> = '[' <wq-name> ']' | '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'where <attr-matcher> = [ '~' | | | '^' | '$' | '*' ]? '='<attr-modifier> = i | s examples testing for the support ...
width - CSS: Cascading Style Sheets
Web › CSS › @viewport › width
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. ...
...t 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 vertical lengths respectively. must be non-negative. ...
...idth: 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 vertical lengths respectively. must be non-negative. ...
...iewport at zoom factor 1.0, for horizontal and vertical lengths respectively. must be non-negative. ...
Detecting CSS animation support - CSS: Cascading Style Sheets
le elem is set. this means the browser supports css animation without any prefix, which, to date, none of them do. if the browser does not support non-prefixed animation and animation is still false, we iterate over all the possible prefixes, since all the major browsers are currently prefixing this property and changing its name to animationname instead. once this code is finished running, the value of animation will be false if css animation support isn't available, or it will be true. if it is true then both the animation property name and the keyframe prefix will be the right ones. so if you use a new firefox, the property will be mozanimation and the keyframe prefix -moz- and with chrome it'll be webkitanimation and -webkit-. notice browsers don't make it easy with the switching between ...
...however, adding keyframes is trickier, since they're not defined using traditional css syntax (which makes them more flexibl...
...however, adding keyframes is trickier, since they're not defined using traditional css syntax (which makes them more flexible, but harder to define from script). ...
...eyframes needed by our animation sequence. the next task is to actually add the keyframes to the page's css. the first thing to do is look to see if there's already a style sheet on the document; if so, we simply insert the keyframe description into that stylesheet; this is done in lines 13-15. if there isn't already a style sheet, a new <style> element is created, and its content is set to the value of keyframes. then the new <style> element is inserted into the document's <head>, thereby adding the new style sheet to the document. view on jsfiddle ...
Resizing background images with background-size - CSS: Cascading Style Sheets
s full size by specifying the width and/or height of the image. by doing so, you can scale the image upward or downward as desired. tiling a large image let's consider a large image, a 2982x2808 firefox logo image. we want (for some reason likely involving horrifyingly bad site design) to tile four copies of this image into a 300x300-pixel element. to do this, we can use a fixed background-size value of 150 pixels. html <div class="tiledbackground"> </div> css .tiledbackground { background-image: url(https://www.mozilla.org/media/img/logos/firefox/logo-quantum.9c5e96634f92.png); background-size: 150px; width: 300px; height: 300px; border: 2px solid; color: pink; } result stretching an image you can also specify both the horizontal and vertical sizes of the image, like th...
...spectrum, you can scale an image up in the 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. ...
...round. 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 see th...
...le below to see this in action. html <div class="bgsizecontain"> <p>try resizing this element!</p> </div> css .bgsizecontain { background-image: url(https://www.mozilla.org/media/img/logos/firefox/logo-quantum.9c5e96634f92.png); background-size: contain; width: 160px; height: 160px; border: 2px solid; color: pink; resize: both; overflow: scroll; } result cover the cover value specifies that the background image should be sized so that it is as small as possible while ensuring that both dimensions are greater than or equal to the corresponding size of the container. try resizing the example below to see this in action. html <div class="bgsizecover"> <p>try resizing this element!</p> </div> css .bgsizecover { background-image: url(https://www.mozilla.org/media/i...
Handling content breaks in multicol - CSS: Cascading Style Sheets
entation properties give us ways to exercise some control over this. there are various places we might want to control our breaks: breaks inside boxes, for example inside a figure element. breaks before and after boxes, which would include our heading example above. breaks between lines. breaks inside boxes to control breaks inside boxes use the break-inside property. ...
... breaks between lines the orphans and widows properties are also useful. the orphans property controls the number of lines left on their own at the end of a fragment. ...
...umn column in this next example, we are forcing a column break before an h2 element. breaks between lines the orphans and widows properties are also useful. the orphans property controls the number of lines left on their own at the end of a fragment. the widows property controls the number left on their own at the start of a fragment. the orphans and widows properties take an integer as a value, which represents the number of lines to keep together at the end and start of a fragment, respectively. note that these properties only work inside a block container, such as a paragraph. if the block has fewer lines in it than the number that you specify as a value, all lines will be kept together. in the example below, we are using the orphans property to control the number of lines left at t...
...eep together at the end and start of a fragment, respectively. note that these properties only work inside a block container, such as a paragraph. if the block has fewer lines in it than the number that you specify as a value, all lines will be kept together. in the example below, we are using the orphans property to control the number of lines left at the bottom of a column. you can change that value to see the effect on the breaking of the content. when things don’t work as expected if you have small amounts of content and are trying to control breaks in a number of ways or on several elements, your content needs to break somewhere, so you may not always get the result you intended. to some extent your use of fragmentation is always a suggestion to the browser, to control breaks in thi...
Styling Columns - CSS: Cascading Style Sheets
or now, however, we are able to change the spacing and add lines between columns. the column-gap property the gap between our columns is controlled by the column-gap property. this property was originally defined in the multi-column layout specification. however, it is now defined in box alignment in order to unify gaps between boxes in other specifications such as css grid layout. ...
...lumns is controlled by the column-gap property. this property was originally defined in the multi-column layout specification. however, 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. ...
... 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 a shorthand column...
...n be used as a column-rule-style. these properties are applied to the element which is the multicol container and therefore all columns will have the same rule. rules are only drawn between columns and not on the outer edges. rules should also only be drawn between columns which have content. in this next example i have created a 5px dotted rule with a color of rebeccapurple, using the longhand values. note that the rule itself does not take up any space: a wide rule will not push the columns apart to make space for the rule. instead, the rule overlays the gap. in this next example we have a very wide rule of 40px and a 10px gap. the rule displays under the content of the columns. in order to make space on both sides of the rule, the gap would need to be increased to be larger than 40px. ...
Auto-placement in CSS Grid Layout - CSS: Cascading Style Sheets
* {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; } <d...
...v>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> <div>six</div> <div>seven</div> <div>eight</div> </div> .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 10px; grid-auto-rows: 100px 200px; } auto-placement by column you can also ask grid to auto-place items by column. using the property grid-auto-flow with a value of column. in this case grid will add items in rows that you have defined using grid-template-rows. when it fills up a column it will move onto the next explicit column, or create a new column track in the implicit grid. as with implicit row tracks, these column tracks will be auto sized. you can control the size of implicit column tracks with grid-auto-columns, this works in the same way as grid...
...: 2 / 4; } .wrapper div:nth-child(5) { grid-column: 1 / 3; grid-row: 1 / 3; } deal with items that span tracks you can use placement properties while still taking advantage of auto-placement. in this next example i have added to the layout by setting odd items to span two tracks both for rows and columns. i do this with the grid-column-end and grid-row-end properties and setting the value of this to span 2. what this means is that the start line of the item will be set by auto-placement, and the end line will span two tracks. you can see how this then leaves gaps in the grid, as for the auto-placed items if grid comes across an item that doesn’t fit into a track, it will move to the next row until it finds a space the item can fit in. * {box-sizing: border-box;} .wrapper { ...
...d and keeping items in dom order. this is generally what you want, if you are laying out a form for example you wouldn’t want the labels and fields to become jumbled up in order to fill in some gap. however sometimes, we are laying things out that don’t have a logical order and we would like to create a layout that doesn’t have gaps in it. to do this, add the property grid-auto-flow with a value of dense to the container. this is the same property you use to change the flow order to column, so if you were working in columns you would add both values grid-auto-flow: column dense. having done this, grid will now backfill the gaps, as it moves through the grid it leaves gaps as before, but then if it finds an item that will fit in a previous gap it will pick it up and take it out of dom or...
Using CSS transforms - CSS: Cascading Style Sheets
r 2d elements will behave in that space. perspective the first element to set is the perspective. the perspective is what gives us the 3d impression. the farther from the viewer the elements are, the smaller they are. 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 set at different values. <table> <tbody> <tr> <th><code>perspective: 250px;</code> </th> <th><code>perspective: 350px;</code> </th> </tr> <tr> <td> <div class="container"> <div class="cube pers250"> <div class...
... <div class="face top">5</div> <div class="face bottom">6</div> </div> </div> </td> </tr> </tbody> </table> css the css establishes classes that can be used to set the perspective to different distances. it also includes classes for the container box and the cube itself, as well as each of its faces. ...
...er */ th, p, td { background-color: #eeeeee; padding: 10px; font-family: sans-serif; text-align: left; } result the second element to configure is the position of the viewer, with the perspective-origin property. by default the perspective is centered on the viewer, which is not always adequate. changing the perspective origin this example shows cubes with popular perspective-origin values. html <section> <figure> <caption><code>perspective-origin: top left;</code></caption> <div class="container"> <div class="cube potl"> <div class="face front">1</div> <div class="face back">2</div> <div class="face right">3</div> <div class="face left">4</div> <div class="face top">5</div> <div class="face bottom">6</div> </div> </figure> <fig...
...spective-origin: 200% -200%;</code></caption> <div class="container"> <div class="cube po200200"> <div class="face front">1</div> <div class="face back">2</div> <div class="face right">3</div> <div class="face left">4</div> <div class="face top">5</div> <div class="face bottom">6</div> </div> </div> </figure> </section> css /* perspective-origin values (unique per example) */ .potl { perspective-origin: top left; } .potm { perspective-origin: top; } .potr { perspective-origin: top right; } .poml { perspective-origin: left; } .pomm { perspective-origin: 50% 50%; } .pomr { perspective-origin: right; } .pobl { perspective-origin: bottom left; } .pobm { perspective-origin: bottom; } .pobr { perspective-origin: bottom right; } .po...
<angle> - CSS: Cascading Style Sheets
Web › CSS › angle
it is used, for example, in <gradient>s and in some transform functions. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax the <angle> data type consists of a <number> followed by one of the units listed below. as with all dimensions, there is no space between the unit literal and the number. the angle unit is optional after the number 0. optionally, it may be preceded by a single + or - sign. ...
...units listed below. as with all dimensions, there is no space between the unit literal and the number. the angle unit is optional after the number 0. optionally, it may be preceded by a single + or - sign. positive numbers represent clockwise angles, while negative numbers represent counterclockwise angles. for static properties of a given unit, any angle can be represented by various equivalent values. for example, 90deg equals -270deg, and 1turn equals 4turn. for dynamic properties, like when applying an animation or transition, the effect will nevertheless be different. units deg represents an angle in degrees. one full circle is 360deg. examples: 0deg, 90deg, 14.23deg. grad represents an angle in gradians. one full circle is 400grad. examples: 0grad, 100grad, 38.8grad. rad represe...
... candidate recommendation initial definition. ...
... candidate recommendation initial definition. ...
animation-iteration-count - CSS: Cascading Style Sheets
the animation-iteration-count css property sets the number of times an animation sequence should be played before stopping. if multiple values are specified, each time the animation is played the next value in the list is used, cycling back to the first value after the last one is used. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. it is often convenient to use the shorthand property animation to set all animation properties at once. ...
... to the first value after the last one is used. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. it is often convenient to use the shorthand property animation to set all animation properties at once. syntax /* keyword value */ animation-iteration-count: infinite; /* <number> values */ animation-iteration-count: 3; animation-iteration-count: 2.4; /* multiple values */ animation-iteration-count: 2, 0, infinite; the animation-iteration-count property is specified as one or more comma-separated values. values infinite the animation will repeat forever. <number> the number of times the animation will repeat; th...
...mber> values */ animation-iteration-count: 3; animation-iteration-count: 2.4; /* multiple values */ animation-iteration-count: 2, 0, infinite; the animation-iteration-count property is specified as one or more comma-separated values. values infinite the animation will repeat forever. <number> the number of times the animation will repeat; this is 1 by default. you may specify non-integer values to play part of an animation cycle: for example, 0.5 will play half of the animation cycle. negative values are invalid. note: when you specify multiple values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are. for more information, see setting multiple animation property values. for...
...mation cycle: for example, 0.5 will play half of the animation cycle. negative values are invalid. note: when you specify multiple values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are. for more information, see setting multiple animation property values. formal definition initial value1applies toall elements, ::before and ::after pseudo-elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <single-animation-iteration-count>#where <single-animation-iteration-count> = infinite | <number> examples see css animations for examples. specifications specification status comment css animationsthe definition of 'animation-iter...
background-attachment - CSS: Cascading Style Sheets
the background-attachment css property sets whether a background image's position is fixed within the viewport, or scrolls with its containing 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. syntax /* keyword values */ background-attachment: scroll; background-attachment: fixed; background-attachment: local; /* global values */ background-attachment: inherit; background-attachment: initial; background-attachment: unset; the background-attachment property is specified as one of the keyword values from the list below. values fixed the background is fixed relative to the viewport. even if an element has ...
...nism, the background scrolls with the element's contents, and the background painting area and background positioning area are relative to the scrollable area of the element rather than to the border framing them. scroll the background is fixed relative to the element itself and does not scroll with its contents. ...
...positioning area are relative to the scrollable area of the element rather than to the border framing them. scroll the background is fixed relative to the element itself and does not scroll with its contents. (it is effectively attached to the element's border.) formal definition initial valuescrollapplies toall elements. it also applies to ::first-letter and ::first-line.inheritednocomputed valueas specifiedanimation typediscrete formal syntax <attachment>#where <attachment> = scroll | fixed | local examples simple example html <p> there were doors all round the hall, but they were all locked; and when alice had been all the way down one side and up the other, trying every door, she walked sadly down the middle, wondering how she was ever to get out again. </p> css p { b...
...gif"); background-attachment: fixed, scroll; background-repeat: no-repeat, repeat-y; } result specifications specification status comment css backgrounds and borders module level 3the definition of 'background-attachment' in that specification. candidate recommendation the shorthand property has been extended to support multiple backgrounds and the local value. css level 2 (revision 1)the definition of 'background-attachment' in that specification. recommendation no significant change. css level 1the definition of 'background-attachment' in that specification. recommendation no significant change. ...
border-collapse - CSS: Cascading Style Sheets
the border-collapse css property sets whether cells inside a <table> have shared or separate borders. the source for this interactive example is stored in a github repository. if 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 github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. when cells are collapsed, the border-style value of inset behaves like groove, and outset behaves like ridge. when cells are separated, the distance between cells is defined by the border-spacing property. syntax /* keyword values */ border-collapse: collapse; border-collapse: separate; /* global values */ border-collapse: inherit; border-collapse: initial; border-collapse: unset; the border-collapse property is specified as a single keyword, which may be chosen from the list below. values collapse adjacent cells have shared borders (the collapsed-border table rendering model). separate adjacent cells have disti...
...collapse: inherit; border-collapse: initial; border-collapse: unset; the border-collapse property is specified as a single keyword, which may be chosen from the list below. values collapse adjacent cells have shared borders (the collapsed-border table rendering model). separate adjacent cells have distinct borders (the separated-border table rendering model). ...
...border-collapse property is specified as a single keyword, which may be chosen from the list below. values collapse adjacent cells have shared borders (the collapsed-border table rendering model). separate adjacent cells have distinct borders (the separated-border table rendering model). ...
border-right-width - CSS: Cascading Style Sheets
the border-right-width css property 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 valu...
...in 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-specific. ...
...edium 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-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. ...
...use the specification 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. ...
border-top-style - CSS: Cascading Style Sheets
css property sets the line style of an element's top border. the source for this interactive example is stored in a github repository. if 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 specification doesn't define how borders of different styles connect in the corners. ...
...ll request. the specification doesn't define how borders of different styles connect in the corners. syntax /* keyword values */ border-top-style: none; border-top-style: hidden; border-top-style: dotted; border-top-style: dashed; border-top-style: solid; border-top-style: double; border-top-style: groove; border-top-style: ridge; border-top-style: inset; border-top-style: outset; /* global values */ border-top-style: inherit; border-top-style: initial; border-top-style: unset; the border-top-style property is specified as a single keyword chosen from those available for the border-style property. formal definition initial valuenoneapplies toall elements. ...
...e: ridge; border-top-style: inset; border-top-style: outset; /* global values */ border-top-style: inherit; border-top-style: initial; border-top-style: unset; the border-top-style property is specified as a single keyword chosen from those available for the border-style property. formal definition initial valuenoneapplies toall elements. ...
...: outset;} result specifications specification status comment css backgrounds and borders module level 3the definition of 'border-top-style' in that specification. candidate recommendation no significant change. css level 2 (revision 1)the definition of 'border-top-style' in that specification. recommendation initial definition. initial valuenoneapplies toall elements. it also applies to ::first-letter.inheritednocomputed valueas specifiedanimation typediscrete ...
box-sizing - CSS: Cascading Style Sheets
m/mdn/interactive-examples and send us a pull request. by default in the css box model, the width and height you assign to an element is applied only to the element's content box. if the element has any border or padding, this is then added to the width and height to arrive at the size of the box that's rendered on the screen. this means that when you set width and height, you have to adjust the value you give to allow for any border or padding that may be added. for example, if you have four boxes with width: 25%;, if any has left or right padding or a left or right border, they will not by default fit on one line within the constraints of the parent container. the box-sizing property can be used to adjust this behavior: content-box gives you the default css box-sizing behavior. if you se...
...perty can be used to adjust this behavior: content-box gives you the default css box-sizing behavior. if you set an element's width to 100 pixels, then the element's content box will be 100 pixels wide, and the width of any border or padding will be added to the final rendered width, making the element wider than 100px. border-box tells the browser to account for any border and padding in the values you specify for an element's width and height. if you set an element's width to 100 pixels, that 100 pixels will include any border or padding you added, and the content box will shrink to absorb that extra width. this typically makes it much easier to size elements. note: it is often useful to set box-sizing to border-box to layout elements. this makes dealing with the sizes of elements much...
...akes it much easier to size elements. note: it is often useful to set box-sizing to border-box to layout elements. this makes dealing with the sizes of elements much easier, and generally eliminates a number of pitfalls you can stumble on while laying out your content. on the other hand, when using position: relative or position: absolute, use of box-sizing: content-box allows the positioning values to be relative to the content, and independent of changes to border and padding sizes, which is sometimes desirable. syntax the box-sizing property is specified as a single keyword chosen from the list of values below. values content-box this is the initial and default value as specified by the css standard. the width and height properties include the content, but does not include the pa...
... black;} renders a box that is 350px wide, with the area for content being 330px wide. the content box can't be negative and is floored to 0, making it impossible to use border-box to make the element disappear. here the dimensions of the element are calculated as: width = border + padding + width of the content, and height = border + padding + height of the content. formal definition initial valuecontent-boxapplies toall elements that accept width or heightinheritednocomputed valueas specifiedanimation typediscrete formal syntax content-box | border-box examples box sizes with content-box and border-box this example shows how different box-sizing values alter the rendered size of two otherwise identical elements. html <div class="content-box">content box</div> <br> <div class="borde...
column-gap (grid-column-gap) - CSS: Cascading Style Sheets
layout methods. now specified in 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 ...
...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. ...
...ng 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. ...
...s, 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. ...
column-rule-style - CSS: Cascading Style Sheets
the column-rule-style css property sets the style 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. ...
...please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <'border-style'> values */ column-rule-style: none; column-rule-style: hidden; column-rule-style: dotted; column-rule-style: dashed; column-rule-style: solid; column-rule-style: double; column-rule-style: groove; column-rule-style: ridge; column-rule-style: inset; column-rule-style: outset; /* global values */ column-rule-style: inherit; column-rule-style: initial; column-rule-style: unset; the column-rule-style property is specified as a single <'border-style'> value. values <'border-style'> is a keyword defined by border-style describing the style of the rule. ...
... the `column-rule-style` property is used to change the style of the line that is drawn between columns. ...
...le: inherit; column-rule-style: initial; column-rule-style: unset; the column-rule-style property is specified as a single <'border-style'> value. values <'border-style'> is a keyword defined by border-style describing the style of the rule. the styling must be interpreted as in the collapsing border model. formal definition initial valuenoneapplies tomulticol elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <'border-style'> examples setting a dashed column rule html <p>this is a bunch of text split into three columns. the `column-rule-style` property is used to change the style of the line that is drawn between columns. don't you think that's wonderful?</p> css p { column-count: 3; column-rule-style: dashed; } result specificat...
columns - CSS: Cascading Style Sheets
Web › CSS › columns
t, 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: column-count column-width syntax /* column 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 el...
... 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. ...
...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. ...
...lement'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. ...
<display-outside> - CSS: Cascading Style Sheets
inline the element generates one or more inline element boxes that do not generate line breaks before or after themselves. ...
... inline the element generates one or more inline element boxes that do not generate line breaks before or after themselves. ...
... inline the element generates one or more inline element boxes that do not generate line breaks before or after themselves. ...
...t inline box of the block box that follows it. run-in elements act like inlines or blocks, depending on the surrounding elements. that is: if the run-in box contains a block box, same as block. if a block box follows the run-in box, the run-in box becomes the first inline box of the block box. if an inline box follows, the run-in box becomes a block box. note: browsers that support the two value syntax, on finding the outer value only, such as when display: block or display: inline is specified, will set the inner value to flow. this will result in expected behavior; for example if you specify an element to be block, you would expect that the children of that element would participate in block and inline normal flow layout. examples in the following example, span elements (normally di...
flex-basis - CSS: Cascading Style Sheets
or height in case of flex-direction: column) are set for an element, flex-basis has priority. syntax /* specify <'width'> */ flex-basis: 10em; flex-basis: 3px; flex-basis: auto; /* intrinsic 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 conten...
...the equivalent effect can be had by using auto together with a main size (width or height) of auto. ...
...omatic sizing, and "main-size" was introduced as the "look at my width or height property" keyword. it was implemented in bug 1032922. then, that change was reverted in bug 1093316, 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). ...
...n, that change was reverted in bug 1093316, 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). ...
flex-shrink - CSS: Cascading Style Sheets
flex-shrink. in use, flex-shrink is used alongside the other flex properties flex-grow and flex-basis, and normally defined using the flex shorthand. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...e other flex properties flex-grow and flex-basis, and normally defined using the flex shorthand. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...le is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <number> values */ flex-shrink: 2; flex-shrink: 0.6; /* global values */ flex-shrink: inherit; flex-shrink: initial; flex-shrink: unset; the flex-shrink property is specified as a single <number>. values <number> see <number>. negative values are invalid. defaults to 1. ...
...e clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <number> values */ flex-shrink: 2; flex-shrink: 0.6; /* global values */ flex-shrink: inherit; flex-shrink: initial; flex-shrink: unset; the flex-shrink property is specified as a single <number>. values <number> see <number>. negative values are invalid. defaults to 1. formal definition initial value1applies toflex items, including in-flow pseudo-elementsinheritednocomputed valueas specifiedanimation typea number formal syntax <number> examples setting flex item shrink factor html <p>the width of content is 500px; the flex-basis of the flex items is 120px.</p> <p>a, b, c have flex-shrink:1 set. d and e have flex-shrink:2 set</p> <p>the width of d and e is less than the others.</p> <div...
font-kerning - CSS: Cascading Style Sheets
/mdn/interactive-examples and send us a pull request. kerning defines how letters are spaced. in well-kerned fonts, this feature makes character spacing more uniform and pleasant to read than it would otherwise be. ...
...les and send us a pull request. kerning defines how letters are spaced. in well-kerned fonts, this feature makes character spacing more uniform and pleasant to read than it would otherwise be. in the image below, for instance, the examples on the left do not use kerning, while the ones on the right do: syntax the font-kerning property is specified as one of the keyword values listed below. values auto the browser determines whether font kerning should be used or not. for example, some browsers will disable kerning on small fonts, since applying it could harm the readability of text. normal font kerning information stored in the font must be applied. none font kerning information stored in the font is disabled. formal definition initial valueautoapplies toall elements. it also ...
... used or not. for example, some browsers will disable kerning on small fonts, since applying it could harm the readability of text. normal font kerning information stored in the font must be applied. none font kerning information stored in the font is disabled. formal definition initial valueautoapplies toall elements. it also applies to ::first-letter and ::first-line.inheritedyescomputed valueas specifiedanimation typediscrete formal syntax auto | normal | none examples enabling and disabling kerning html <div id="kern"></div> <div id="nokern"></div> <textarea id="input">av t. ij</textarea> css div { font-size: 2rem; font-family: serif; } #nokern { font-kerning: none; } #kern { font-kerning: normal; } javascript let input = document.getelementbyid('input'); let ker...
...</div> <textarea id="input">av t. ij</textarea> css div { font-size: 2rem; font-family: serif; } #nokern { font-kerning: none; } #kern { font-kerning: normal; } javascript let input = document.getelementbyid('input'); let kern = document.getelementbyid('kern'); let nokern = document.getelementbyid('nokern'); input.addeventlistener('keyup', function() { kern.textcontent = input.value; /* update content */ nokern.textcontent = input.value; }); kern.textcontent = input.value; /* initialize content */ nokern.textcontent = input.value; specifications specification status comment css fonts module level 3the definition of 'font-kerning' in that specification. candidate recommendation initial definition. ...
font-language-override - CSS: Cascading Style Sheets
the font-language-override css property controls the use of language-specific glyphs in a typeface. /* keyword value */ font-language-override: normal; /* <string> values */ font-language-override: "eng"; /* use english glyphs */ font-language-override: "trk"; /* use turkish glyphs */ /* global values */ font-language-override: initial; font-language-override: inherit; font-language-override: unset; by default, html's lang attribute tells browsers to display glyphs designed specifically for that language. for example, a lot of fonts have a special character for the digraph fi that merge the dot on the "i" with the "f." however, if the language is set to turkish the typeface will likely know not to use the merged glyph; turkish has two versions of the "i," one with a dot (i) and one with...
...rride the typeface behavior for a specific language. this is useful, for example, when the typeface you're using lacks proper support for the language. for instance, if a typeface doesn't have proper rules for the azeri language, you can force the font to use turkish glyphs, which follow similar rules. syntax the font-language-override property is specified as the keyword normal or a <string>. values normal tells the browser to use font glyphs that are appropriate for the language specified by the lang attribute. this is the default value. <string> tells the browser to use font glyphs that are appropriate for the language specified by the string. the string must match a language tag found in the opentype language system. for example, "eng" is english, and "kor" is korean. formal defi...
...ls the browser to use font glyphs that are appropriate for the language specified by the lang attribute. this is the default value. <string> tells the browser to use font glyphs that are appropriate for the language specified by the string. the string must match a language tag found in the opentype language system. for example, "eng" is english, and "kor" is korean. formal definition initial valuenormalapplies toall elements. ...
...is is the default value. <string> tells the browser to use font glyphs that are appropriate for the language specified by the string. the string must match a language tag found in the opentype language system. for example, "eng" is english, and "kor" is korean. formal definition initial valuenormalapplies toall elements. ...
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. antialiased - smooth the font on the level of the pixel, as opposed to the subpixel. ...
...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. antialiased - smooth the font on the level of the pixel, as opposed to the subpixel. ...
...ont smoothing off; display text with jagged sharp edges. antialiased - smooth the font on the level of the pixel, as opposed to the subpixel. switching from subpixel rendering to antialiasing for light text on dark backgrounds makes it look lighter. subpixel-antialiased - on most non-retina displays, this will give the sharpest text. ...
...but with different values: -moz-osx-font-smoothing. it only works on mac os x/macos. auto - allow the browser to select an optimization for font smoothing, 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 b...
font-variant-position - CSS: Cascading Style Sheets
the font-variant-position css property controls the use of alternate, smaller glyphs that are positioned as superscript or subscript. the glyphs are positioned relative to the baseline of the font, which remains unchanged. these glyphs are typically used in <sub> and <sup> elements. /* keyword values */ font-variant-position: normal; font-variant-position: sub; font-variant-position: super; /* global values */ font-variant-position: inherit; font-variant-position: initial; font-variant-position: unset; when the usage of these alternate glyphs is activated, if one character in the run doesn't have such a typographically-enhanced glyph, the whole set of characters of the run is rendered using a fallback method, synthesizing these glyphs. these alternate glyphs share the same em-box and the...
...-enhanced glyph, the whole set of characters of the run is rendered using a fallback method, synthesizing these glyphs. these alternate glyphs share the same em-box and the same baseline as the rest of the font. they are merely graphically enhanced, and have no effect on the line-height and other box characteristics. syntax the font-variant-position property is specified as one of the keyword values listed below. values normal deactivates alternate superscript and subscript glyphs. sub activates subscript alternate glyphs. if, in a given run, one such glyph is not available for a character, all the characters in the run are rendered using synthesized glyphs. super activates superscript alternate glyphs. if, in a given run, one such glyph is not available for a character, all the ch...
...hs. sub activates subscript alternate glyphs. if, in a given run, one such glyph is not available for a character, all the characters in the run are rendered using synthesized glyphs. super activates superscript alternate glyphs. if, in a given run, one such glyph is not available for a character, all the characters in the run are rendered using synthesized glyphs. ...
...haracter, all the characters in the run are rendered using synthesized glyphs. super activates superscript alternate glyphs. if, in a given run, one such glyph is not available for a character, all the characters in the run are rendered using synthesized glyphs. formal definition initial valuenormalapplies toall elements. ...
<frequency-percentage> - CSS: Cascading Style Sheets
the <frequency-percentage> css data type represents a value that can be either a <frequency> or a <percentage>. frequency values, e.g. the pitch of a speaking voice, are not currently used in any css properties. syntax the value of a <frequency-percentage> is either a <frequency> or a <percentage>; see their individual reference pages for details about their syntaxes. description use in calc() where a <frequency-percentage> is specified as an allowable type, this means that the percentage resolves to a frequency and therefore can be used in a calc() expression. ...
...roperties. syntax the value of a <frequency-percentage> is either a <frequency> or a <percentage>; see their individual reference pages for details about their syntaxes. description use in calc() where a <frequency-percentage> is specified as an allowable type, this means that the percentage resolves to a frequency and therefore can be used in a calc() expression. examples valid percentage values 90% positive percentage +90% positive percentage with leading + -90% negative percentage — not valid for all properties that use percentages invalid percentage values 90 % no space is allowed between the number and the unit valid frequency values 12hz positive integer 4.3hz non-integer 14khz the unit is case-insensitive, though non-si capitalization is not recommended. +0hz ...
...not valid for all properties that use percentages invalid percentage values 90 % no space is allowed between the number and the unit valid frequency values 12hz positive integer 4.3hz non-integer 14khz the unit is case-insensitive, though non-si capitalization is not recommended. +0hz zero, with a leading + and a unit -0khz zero, with a leading - and a unit invalid frequency values 12.0 this is a <number>, not an <frequency>, because it is missing a unit. 7 hz no space is allowed between the number and the unit. 0 although unitless zero is an allowable <length>, it's an invalid <frequency>. ...
... 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>. adds calc() ...
height - CSS: Cascading Style Sheets
Web › CSS › height
ox-sizing is set to border-box, 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 el...
...ace replaced by the specified argument, i.e. 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. mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.4 | w3c understanding wcag 2.0 formal definition initial valueautoapplies toall elements but non-replaced inline elements, table columns, and column groupsinheritednopercentagesthe percentage 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. a percent...
...mn groupsinheritednopercentagesthe percentage 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. ...
...ss box sizing module level 4the definition of 'height' in that specification. editor's draft css box sizing module level 3the definition of 'height' in that specification. working draft added the max-content, min-content, fit-content keywords. css level 2 (revision 1)the definition of 'height' in that specification. recommendation adds support for the <length> values and precises on which element it applies to. css level 1the definition of 'height' in that specification. recommendation initial definition. ...
image-rendering - CSS: Cascading Style Sheets
author specifies dimensions other than its natural size. scaling may also occur due to user interaction (zooming). for example, if the natural size of an image is 100×100px, but its actual dimensions are 200×200px (or 50×50px), then the image will be upscaled (or downscaled) using the algorithm specified by image-rendering. this property has no effect on non-scaled images. syntax /* keyword values */ image-rendering: auto; image-rendering: crisp-edges; image-rendering: pixelated; /* global values */ image-rendering: inherit; image-rendering: initial; image-rendering: unset; values auto the scaling algorithm is ua dependent. since version 1.9 (firefox 3.0), gecko uses bilinear resampling (high quality). smooth the image should be scaled with an algorithm that maximizes the appear...
... algorithm that maximizes the appearance of the image. in particular, scaling algorithms that "smooth" colors are acceptable, such as bilinear interpolation. this is intended for images such as photos. high-quality identical to smooth, but with a preference for higher-quality scaling. if system resources are constrained, images with high-quality should be prioritized over those with any other value, when considering which images to degrade the quality of and to what degree. crisp-edges the image must be scaled with an algorithm that preserves contrast and edges in the image, and which does not smooth colors or introduce blur to the image in the process. suitable algorithms include nearest-neighbor and other non-smoothing scaling algorithms such as 2×sai and hqx-family algorithms. this va...
...uitable algorithms include nearest-neighbor and other non-smoothing scaling algorithms such as 2×sai and hqx-family algorithms. this value is intended for pixel-art images, such as in browser games. pixelated when scaling the image up, the nearest-neighbor algorithm must be used, so that the image appears to be composed of large pixels. when scaling down, this is the same as auto. note: the values optimizequality and optimizespeed present in an early draft (and coming from its svg counterpart image-rendering) are defined as synonyms for the smooth and pixelated values respectively. ...
... the image up, the nearest-neighbor algorithm must be used, so that the image appears to be composed of large pixels. when scaling down, this is the same as auto. note: the values optimizequality and optimizespeed present in an early draft (and coming from its svg counterpart image-rendering) are defined as synonyms for the smooth and pixelated values respectively. formal definition initial valueautoapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax auto | crisp-edges | pixelated examples setting image scaling algorithms in practical use, the pixelated and crisp-edges rules can be combined to provide some fallback for each other. (just prepend the actual rules with the fallback.) the canvas api can provide a fallback solution for pixelated...
initial-letter - CSS: Cascading Style Sheets
the initial-letter css property sets styling for dropped, raised, and sunken initial letters. /* keyword values */ initial-letter: normal; /* numeric values */ initial-letter: 1.5; /* initial letter occupies 1.5 lines */ initial-letter: 3.0; /* initial letter occupies 3 lines */ initial-letter: 3.0 2; /* initial letter occupies 3 lines and sinks 2 lines */ /* global values */ initial-letter: inherit; initial-letter: initial; initial-letter: unset; syntax the keyword value normal, or a <number> optionally followed by an <integer>. values normal no special initial-letter effect. text behaves as normal. <number> defines the size of the initial letter, in terms of how many lines it occupies. negative values are not allowed. <integer> defines the nu...
...r: unset; syntax the keyword value normal, or a <number> optionally followed by an <integer>. values normal no special initial-letter effect. text behaves as normal. <number> defines the size of the initial letter, in terms of how many lines it occupies. negative values are not allowed. <integer> defines the number of lines the initial letter should sink when the size of it is given. values must be greater than zero. if omitted, it duplicates the size value, floored to the nearest positive whole number. ...
...text behaves as normal. <number> defines the size of the initial letter, in terms of how many lines it occupies. negative values are not allowed. <integer> defines the number of lines the initial letter should sink when the size of it is given. values must be greater than zero. if omitted, it duplicates the size value, floored to the nearest positive whole number. ...
...ve values are not allowed. <integer> defines the number of lines the initial letter should sink when the size of it is given. values must be greater than zero. if omitted, it duplicates the size value, floored to the nearest positive whole number. ...
<integer> - CSS: Cascading Style Sheets
Web › CSS › integer
er, whether positive or negative. integers can be used in numerous css properties, such as column-count, counter-increment, grid-column, grid-row, and z-index. syntax the <integer> data type consists of one or several decimal digits, 0 through 9 inclusive, optionally preceded by a single + or - sign. there is no unit associated with integers. note: there is no official range of valid <integer> values. opera 12.1 supports values up to 215-1, ie up to 220-1, and other browsers even higher. during the css3 values cycle there was a lot of discussion about setting a minimum range to support: the latest decision, in april 2012 during the lc phase, was [-227-1; 227-1], but other values like 224-1 and 230-1 were also proposed. however, the latest spec doesn't specify a range anymore. interpolation ...
...the speed of the interpolation is determined by the timing function associated with the animation. ...
...the speed of the interpolation is determined by the timing function associated with the animation. ...
... letters are not allowed. _5 special characters are not allowed. \35 escaped unicode characters are not allowed, even if they are an integer (here: 5). \4e94 non-arabic numerals are not allowed, even when escaped (here: the japanese 5, 五). 3e4 scientific notation is not allowed. specifications specification status comment css values and units module level 4the definition of '<integer>' in that specification. editor's draft no significant change. css values and units module level 3the definition of '<integer>' in that specification. candidate recommendation no significant change. css level 2 (revision 1)the definition of '<integer>' in that specification. recommendation explicit definition...
line-break - CSS: Cascading Style Sheets
loose break text using the least restrictive line break rule. typically used for short lines, such as in newspapers. normal break text using the most common line break rule. strict break text using the most stringent line break rule. ...
... loose break text using the least restrictive line break rule. typically used for short lines, such as in newspapers. normal break text using the most common line break rule. strict break text using the most stringent line break rule. ...
... loose break text using the least restrictive line break rule. typically used for short lines, such as in newspapers. normal break text using the most common line break rule. strict break text using the most stringent line break rule. ...
...character unit, including around any punctuation character or preserved white spaces, or in the middle of words, disregarding any prohibition against line breaks, even those introduced by characters with the gl, wj, or zwj character class or mandated by the word-break property. the different wrapping opportunities must not be prioritized. hyphenation is not applied. formal definition initial valueautoapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax auto | loose | normal | strict | anywhere examples setting text wrapping see whether the text is wrapped before "々", "ぁ" and "。". html <div lang="ja"> <p class="wrapbox auto">auto:<br>そこは湖のほとりで木々が輝いていた。<br>その景色に、美しいなぁと思わ...
linear-gradient() - CSS: Cascading Style Sheets
or 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 position of the gradient line's starting point. if specified, it consists of the word to and up to two keywords: one indicates the horizontal side (left or right), and the other the vertical side (top or bottom). the order of the side keywords does not matter. if unspecified, it defaults to to bottom. the values to top, to bottom, to left, and to right are equivalent to...
...oint. if specified, it consists of the word to and up to two keywords: one indicates the horizontal side (left or right), and the other the vertical side (top or bottom). the order of the side keywords does not matter. if unspecified, it defaults to to bottom. the values to top, to bottom, to left, and to right 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. <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...
...however the midpoint of the transition is at the 30% mark rather than 50% as would have happened without the 30% color hint. linear-gradient(red 10%, 30%, blue 90%); if two or more color stops are at the same location, the transition will be a hard line between the first and last colors declared at that location. color stops should be listed in ascending order. subsequent color stops of lower value will override the value of the previous color stop creating a hard transition. the following changes from red to yellow at the 30% mark, and then transitions from yellow to blue over 35% of the gradient linear-gradient(red 40%, yellow 30%, blue 65%); multi-position color stop are allowed. a color can be declared as two adjacent color stops by including both positions in the css declaration. th...
... body { width: 100vw; height: 100vh; } body { background: linear-gradient(to right, red 20%, orange 20% 40%, yellow 40% 60%, green 60% 80%, blue 80%); } more linear-gradient examples please see using css gradients for more examples. specifications specification status comment css images module level 4the definition of 'gr...
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>. ...
...rder-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 outset applies to the top and bottom, the second to the left and right. ...
...tset: 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 outset applies to the top and bottom, the second to the left and right. when three values are specified, the first outset applies to the top, the second to the left and right, the third to the bottom. when four values are specified, the outsets apply to the top, right, bottom, and left in that order (clockwise). values <length> the size of the mask border outset as a dimension. <number> the size of the mask border outset as a multiple of the corresponding border-width. for...
...st outset applies to the top, the second to the left and right, the third to the bottom. when four values are specified, the outsets apply to the top, right, bottom, and left in that order (clockwise). values <length> the size of the mask border outset as a dimension. <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 sup...
mask-type - CSS: Cascading Style Sheets
Web › CSS › mask-type
the mask-type css property sets whether an svg <mask> element is used as a luminance or an alpha mask. it applies to the <mask> element itself. /* keyword values */ mask-type: luminance; mask-type: alpha; /* global values */ mask-type: inherit; mask-type: initial; mask-type: unset; this property may be overridden by the mask-mode property, which has the same effect but applies to the element where the mask is used. alpha masks will generally be faster to render. syntax the mask-type property is specified as one of the keyword values listed below. values luminance is a keyword indicating that the associated mask image is a luminance mask, i.e., that its relative luminance values must be used when applying it. alpha is a keyword indicating that the associated mask image is an alpha...
...generally be faster to render. syntax the mask-type property is specified as one of the keyword values listed below. values luminance is a keyword indicating that the associated mask image is a luminance mask, i.e., that its relative luminance values must be used when applying it. alpha is a keyword indicating that the associated mask image is an alpha mask, i.e., that its alpha channel values must be used when applying it. ...
...specified as one of the keyword values listed below. values luminance is a keyword indicating that the associated mask image is a luminance mask, i.e., that its relative luminance values must be used when applying it. alpha is a keyword indicating that the associated mask image is an alpha mask, i.e., that its alpha channel values must be used when applying it. ...
...s luminance is a keyword indicating that the associated mask image is a luminance mask, i.e., that its relative luminance values must be used when applying it. alpha is a keyword indicating that the associated mask image is an alpha mask, i.e., that its alpha channel values must be used when applying it. ...
max-width - CSS: Cascading Style Sheets
Web › CSS › max-width
the max-width css property sets the maximum width of an element. it prevents 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. ...
... 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 containing blo...
...d by the specified argument, i.e. 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. ...
... and/or do not obscure other content when the page is zoomed to increase text size. ...
object-position - CSS: Cascading Style Sheets
the replaced element's object's intrinsic size (that is, its natural size) is adjusted to fit within the element's box using the object-fit property. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <position> values */ object-position: center top; object-position: 100px 50px; /* global values */ object-position: inherit; object-position: initial; object-position: unset; values <position> from one 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. formal definitio...
...-position: center top; object-position: 100px 50px; /* global values */ object-position: inherit; object-position: initial; object-position: unset; values <position> from one 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. ...
...: initial; object-position: unset; values <position> from one 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. ...
... full support 19 full support 19 full support 12prefixed prefixed implemented with the vendor prefix: -o-safari ios full support 10samsung internet android full support 2.0support for three-value syntax of positionchrome no support 31 — 68edge no support 16 — 79firefox no support 36 — 70ie no support noopera no support 19 — 55 no support 19 — 55 full support 11.6...
outline-style - CSS: Cascading Style Sheets
wn around an element, outside the border. the source for this interactive example is stored in a github repository. if 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-style: auto; outline-style: none; outline-style: dotted; outline-style: dashed; outline-style: solid; outline-style: double; outline-style: groove; outline-style: ridge; outline-style: inset; outline-style: outset; /* global values */ outline-style: inherit; outline-style: initial; outline-style: unset; the outline-style property is specified as any one of the values listed below. ...
... none no outline is used. the outline-width is 0. ...
...tween them. groove the outline looks as though it were carved into the page. ridge the opposite of groove: the outline looks as though it were extruded from the page. inset the outline makes the box look as though it were embedded in the page. outset the opposite of inset: the outline makes the box look as though it were coming out of the page. formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | <'border-style'> examples setting outline style to auto the auto value indicates a custom outline style — typically a style [that] is either a user interface default for the platform, or perhaps a style that is richer than can be described in detail in css, e.g. a rounded edge outline ...
... css level 2 (revision 1)the definition of 'outline-style' in that specification. recommendation initial definition. ...
outline-width - CSS: Cascading Style Sheets
wn around an element, outside the border. the source for this interactive example is stored in a github repository. if 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 de...
...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 equivalent to 3px in desktop browsers (including firefox). thick depends on the user agent. typically equivalent to 5px in desktop browsers (including firefox). ...
...gth>. thin depends 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). ...
...esktop 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). ...
overflow-anchor - CSS: Cascading Style Sheets
the overflow-anchor css property provides a way to opt out of the browser's scroll anchoring behavior, which adjusts scroll position to minimize content shifts. scroll anchoring behavior is enabled by default in any browser that supports it. therefore, changing the value of this property is typically only required if you are experiencing problems with scroll anchoring in a document or part of a document and need to turn the behavior off. ...
...he browser's scroll anchoring behavior, which adjusts scroll position to minimize content shifts. scroll anchoring behavior is enabled by default in any browser that supports it. therefore, changing the value of this property is typically only required if you are experiencing problems with scroll anchoring in a document or part of a document and need to turn the behavior off. ...
...on to minimize content shifts. scroll anchoring behavior is enabled by default in any browser that supports it. therefore, changing the value of this property is typically only required if you are experiencing problems with scroll anchoring in a document or part of a document and need to turn the behavior off. syntax /* keyword values */ overflow-anchor: auto; overflow-anchor: none; /* global values */ overflow-anchor: inherit; overflow-anchor: initial; overflow-anchor: unset; values auto the element becomes a potential anchor when adjusting scroll position. none the element won't be selected as a potential anchor. ...
...of a document and need to turn the behavior off. syntax /* keyword values */ overflow-anchor: auto; overflow-anchor: none; /* global values */ overflow-anchor: inherit; overflow-anchor: initial; overflow-anchor: unset; values auto the element becomes a potential anchor when adjusting scroll position. none the element won't be selected as a potential anchor. formal definition initial valueautoapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | none examples prevent scroll anchoring to prevent scroll anchoring in a document, use the overflow-anchor property. body { overflow-anchor: none; } specifications specification status comment css scroll anchoring module level 1the definition of 'overf...
overflow-block - CSS: Cascading Style Sheets
the overflow-block css property sets what shows when content overflows the block start and block end edges of a box. this may be nothing, a scroll bar, or the overflow content. the overflow-block property maps to overflow-y or overflow-x depending on the writing mode of the document. syntax /* keyword values */ overflow-block: visible; overflow-block: hidden; overflow-block: scroll; overflow-block: auto; /* global values */ overflow-block: inherit; overflow-block: initial; overflow-block: unset; the overflow-block property is specified as a single keyword chosen from the list of values below. values visible content is not clipped and may be rendered outside the padding box's block start and block end edges. hidden content is clipped if necessary to fit the block dimension in the...
...ent is actually clipped. (this prevents scrollbars from appearing or disappearing when the content changes.) printers may still print overflowing content. auto depends on the user agent. if content fits inside the padding box, it looks the same as visible, but still establishes a new block-formatting context. desktop browsers provide scrollbars if content overflows. ...
...ntent changes.) printers may still print overflowing content. auto depends on the user agent. if content fits inside the padding box, it looks the same as visible, but still establishes a new block-formatting context. desktop browsers provide scrollbars if content overflows. ...
...den; margin-bottom: 120px;} #div2 { overflow-block: scroll; margin-bottom: 120px;} #div3 { overflow-block: visible; margin-bottom: 120px;} #div4 { overflow-block: auto; margin-bottom: 120px;} result specifications specification status comment css overflow module level 3the definition of 'overflow-block' in that specification. working draft initial valueautoapplies toblock-containers, flex containers, and grid containersinheritednocomputed valueas specified, except with visible/clip computing to auto/hidden respectively if one of overflow-x or overflow-y is neither visible nor clipanimation typediscrete ...
overflow-wrap - CSS: Cascading Style Sheets
est. note: in contrast to word-break, overflow-wrap will only create a break if an entire word cannot be placed on its own line without overflowing. the property was originally a nonstandard and unprefixed microsoft extension called word-wrap, and was implemented by most browsers with the same name. it has since been renamed to overflow-wrap, with word-wrap being an alias. syntax /* keyword values */ overflow-wrap: normal; overflow-wrap: break-word; overflow-wrap: anywhere; /* global values */ overflow-wrap: inherit; overflow-wrap: initial; overflow-wrap: unset; the overflow-wrap property is specified as a single keyword chosen from the list of values below. values normal lines may only break at normal word break points (such as a space between two words). anywhere to prevent ov...
... to prevent overflow, an otherwise unbreakable string of characters — like a long word or url — may be broken at any point if there are no otherwise-acceptable break points in the line. no hyphenation character is inserted at the break point. soft wrap opportunities introduced by the word break are considered when calculating min-content intrinsic sizes. ...
... break are considered when calculating min-content intrinsic sizes. break-word the same as the anywhere value, with normally unbreakable words allowed to be broken at arbitrary points if there are no otherwise acceptable break points in the line, but soft wrap opportunities introduced by the word break are not considered when calculating min-content intrinsic sizes. formal definition initial valuenormalapplies tonon-replaced inline elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax normal | break-word | anywhere examples comparing overflow-wrap, word-break, and hyphens this example compares the results of overflow-wrap, word-break, and hyphens when breaking up a long word. html <p>they say the fishing is excellent at lake <em class="normal">chargogg...
...: gold; } .ow-anywhere { overflow-wrap: anywhere; } .ow-break-word { overflow-wrap: break-word; } .word-break { word-break: break-all; } .hyphens { hyphens: auto; } result specifications specification status comment css text module level 3the definition of 'overflow-wrap' in that specification. working draft initial definition initial valuenormalapplies tonon-replaced inline elementsinheritedyescomputed valueas specifiedanimation typediscrete ...
overscroll-behavior - CSS: Cascading Style Sheets
the overscroll-behavior css property sets what a browser does when reaching the boundary of a scrolling area. it's a shorthand for overscroll-behavior-x and overscroll-behavior-y. /* keyword values */ overscroll-behavior: auto; /* default */ overscroll-behavior: contain; overscroll-behavior: none; /* two values */ overscroll-behavior: auto contain; /* global values */ overscroll-behavior: inherit; overscroll-behavior: initial; overscroll-behavior: unset; by default, mobile browsers tend to provide a "bounce" effect or even a page refresh when the top or bottom of a page (or other scroll area) is reached. you may also have noticed that when you have a dialog box with scrolling content on top of a page of scrolling content, once the dialog box's scroll boundary is reached, the underlying pa...
... is reached, the underlying page will then start to scroll — this is called scroll chaining. in some cases these behaviors are not desirable. you can use overscroll-behavior to get rid of unwanted scroll chaining and the browser's facebook/twitter app-inspired "pull to refresh"-type behavior. syntax the overscroll-behavior property is specified as one or two keywords chosen from the list of values below. two keywords specifies the overscroll-behavior value on the x and y axes respectively. if only one value is specified, both x and y are assumed to have the same value. values auto the default scroll overflow behavior occurs as normal. contain default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll cha...
...curs as normal. contain default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occurs to neighbouring scrolling areas, e.g. underlying elements will not scroll. none no scroll chaining occurs to neighbouring scrolling areas, and default scroll overflow behavior is prevented. ...
...(e.g. "bounce" effects or refreshes), but no scroll chaining occurs to neighbouring scrolling areas, e.g. underlying elements will not scroll. none no scroll chaining occurs to neighbouring scrolling areas, and default scroll overflow behavior is prevented. formal definition initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax [ contain | none | auto ]{1,2} examples preventing an underlying element from scrolling in our overscroll-behavior example (see the source code also), we present a full-page list of fake contacts, and a dialog box containing a chat window. both of these areas scroll; normally if you scrolled the chat window until you hit a scroll boundary, t...
padding-bottom - CSS: Cascading Style Sheets
is stored in a github repository. if 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. ...
...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. syntax /* <length> values */ padding-bottom: 0.5em; padding-bottom: 0; padding-bottom: 2cm; /* <percentage> value */ padding-bottom: 10%; /* global values */ padding-bottom: inherit; padding-bottom: initial; padding-bottom: unset; the padding-bottom property is specified as a single value chosen from the list below. unlike margins, negative values are not allowed for padding. values <length> the size of the padding as a fixed value. must be nonnegative. <percentage> the size of the padding as a per...
...ttom: unset; the padding-bottom property is specified as a single value chosen from the list below. unlike margins, negative values are not allowed for padding. values <length> the size of the padding as a fixed value. 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. ...
...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. 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. w...
padding-left - CSS: Cascading Style Sheets
e is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. 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. ...
...xamples 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. syntax /* <length> values */ padding-left: 0.5em; padding-left: 0; padding-left: 2cm; /* <percentage> value */ padding-left: 10%; /* global values */ padding-left: inherit; padding-left: initial; padding-left: unset; the padding-left property is specified as a single value chosen from the list below. unlike margins, negative values are not allowed for padding. values <length> the size of the padding as a fixed value. must be nonnegative. <percentage> the size of the padding as a percentage, r...
...g-left: unset; the padding-left property is specified as a single value chosen from the list below. unlike margins, negative values are not allowed for padding. values <length> the size of the padding as a fixed value. 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. ...
...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. 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 ...
padding-right - CSS: Cascading Style Sheets
e is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. 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. ...
...ples 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. syntax /* <length> values */ padding-right: 0.5em; padding-right: 0; padding-right: 2cm; /* <percentage> value */ padding-right: 10%; /* global values */ padding-right: inherit; padding-right: initial; padding-right: unset; the padding-right property is specified as a single value chosen from the list below. unlike margins, negative values are not allowed for padding. values <length> the size of the padding as a fixed value. must be nonnegative. <percentage> the size of the padding as a percenta...
...right: unset; the padding-right property is specified as a single value chosen from the list below. unlike margins, negative values are not allowed for padding. values <length> the size of the padding as a fixed value. 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. ...
...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. 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. work...
page-break-inside - CSS: Cascading Style Sheets
this property has been replaced by the break-inside property. the page-break-inside css property adjusts page breaks inside the current element. /* keyword values */ page-break-inside: auto; page-break-inside: avoid; /* global values */ page-break-inside: inherit; page-break-inside: initial; page-break-inside: unset; syntax values auto initial value. automatic page breaks (neither forced nor forbidden). avoid avoid page breaks inside the element. page break aliases the page-break-inside property is now a legacy property, replaced by break-inside. ...
...automatic page breaks (neither forced nor forbidden). avoid avoid page breaks inside the element. page break aliases the page-break-inside property is now a legacy property, replaced by break-inside. for compatibility reasons, page-break-inside should be treated by browsers as an alias of break-inside. this ensures that sites using page-break-inside continue to work as designed. ...
...acy property, replaced by break-inside. for compatibility reasons, page-break-inside should be treated by browsers as an alias of break-inside. this ensures that sites using page-break-inside continue to work as designed. a subset of values should be aliased as follows: page-break-inside break-inside auto auto avoid avoid formal definition initial valueautoapplies toblock-level elements in the normal flow of the root element. ...
...ng page-break-inside continue to work as designed. a subset of values should be aliased as follows: page-break-inside break-inside auto auto avoid avoid formal definition initial valueautoapplies toblock-level elements in the normal flow of the root element. ...
<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,...
...the speed of the interpolation is determined by the timing function associated with the animation. ...
... candidate recommendation no significant change from css level 2 (revision 1). css level 2 (revision 1)the definition of '<percentage>' in that specification. ...
...full-size text (18px)</p> <p><span style="font-size:50%;">50% (9px)</span></p> <p><span style="font-size:200%;">200% (36px)</span></p> </div> the above html will output: specifications specification status comment css values and units module level 4the definition of '<percentage>' in that specification. editor's draft no significant change. css values and units module level 3the definition of '<percentage>' in that specification. candidate recommendation no significant change from css level 2 (revision 1). css level 2 (revision 1)the definition of '<percentage>' in that specification. recommendation no change from css level 1. css level 1the definition of '<percentage>' in that specification. recommendation ...
radial-gradient() - 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 /* a gradient at the center of its container, starting red, changing to blue, and finishing green */ radial-gradient(circle at center, red 0, blue, green 100%) values <position> the position of the gradient, interpreted in the same way as background-position or transform-origin. if unspecified, it defaults to center. <shape> the gradient's shape. the value can be circle (meaning that the gradient's shape is a circle with constant radius) or ellipse (meaning that the shape is an axis-aligned ellipse). if unspecified, it defaults to ellipse. <extent-keyw...
... as background-position or transform-origin. if unspecified, it defaults to center. <shape> the gradient's shape. the value can be circle (meaning that the gradient's shape is a circle with constant radius) or ellipse (meaning that the shape is an axis-aligned ellipse). if unspecified, it defaults to ellipse. <extent-keyword> a keyword describing how big the ending shape must be. the possible values are: keyword description closest-side the gradient's ending shape meets the side of the box closest to its center (for circles) or meets both the vertical and horizontal sides closest to the center (for ellipses). closest-corner the gradient's ending shape is sized so that it exactly meets the closest corner of the box from its center. ...
... closest to the center (for ellipses). closest-corner the gradient's ending shape is sized so that it exactly meets the closest corner of the box from its center. farthest-side similar to closest-side, except the ending shape is sized to meet the side of the box farthest from its center (or vertical and horizontal sides). farthest-corner the default value, the gradient's ending shape is sized so that it exactly meets the farthest corner of the box from its center. 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. <linea...
... so that it exactly meets the farthest corner of the box from its center. 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 equiva...
repeating-linear-gradient() - CSS: Cascading Style Sheets
gth 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 values are different, this will result in a sharp visual transition. this can be altered with repeating the first color again as the last color. as with any gradient, a repeating linear 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 the element it applies to. because <gradient>s belong to the <image> dat...
...bottom to top, starting blue, turning green after 40%, and finishing red. ...
...ng-linear-gradient(to right, red 0%, green 10%, red 20%); values <side-or-corner> the position of the gradient line's starting point. if specified, it consists of the word to and up to two keywords: one indicates the horizontal side (left or right), and the other the vertical side (top or bottom). the order of the side keywords does not matter. if unspecified, it defaults to to bottom. the values to top, to bottom, to left, and to right 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. ...
...if unspecified, it defaults to to bottom. the values to top, to bottom, to left, and to right 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. <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 stop...
scroll-margin-block-start - CSS: Cascading Style Sheets
ormed 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. ...
...tainer’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. ...
...in a github repository. if 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. ...
.../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 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-padding-block - CSS: Cascading Style Sheets
allows the author to exclude regions of the 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 o...
... 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 will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. ...
...; 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 will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. ...
... 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, 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
ntent (such as fixed-positioned toolbars 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-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...
...tom: 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 generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. ...
...herit; 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 generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. ...
... 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 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 - CSS: Cascading Style Sheets
ows the author to exclude regions of the scrollport 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...
...%; /* 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. 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. ...
...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. 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. ...
... 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, 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
ntent (such as fixed-positioned toolbars 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-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...
...adding-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, but a user agent is able to detect and do something else if a non-zero value is more appropriate. ...
...eft: 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, but a user agent is able to detect and do something else if a non-zero value is more appropriate. ...
...rds 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, 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
ntent (such as fixed-positioned toolbars 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-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 determ...
...ing-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 be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. ...
...t: 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 be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. ...
...rds 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 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
ntent (such as fixed-positioned toolbars 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 use...
...oll-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 user agent is able to detect and do something else if a non-zero value is more appropriate. ...
...g-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 user agent is able to detect and do something else if a non-zero value is more appropriate. ...
...rds 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 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
ons of the 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-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...
...oll-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, but the user agent is free to detect and do something else if a non-zero value is more appropriate. ...
...nherit; 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, but the user agent is free to detect and do something else if a non-zero value is more appropriate. ...
...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, 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 ...
scroll-snap-coordinate - CSS: Cascading Style Sheets
the scroll-snap-coordinate css property defines the x and y coordinate positions within an element that will align with its nearest ancestor scroll container's scroll-snap-destination for each respective axis. /* keyword value */ scroll-snap-coordinate: none; /* <position> values */ scroll-snap-coordinate: 50px 50px; /* single coordinate */ scroll-snap-coordinate: 100px 100px, 100px bottom; /* multiple coordinates */ /* global values */ scroll-snap-coordinate: inherit; scroll-snap-coordinate: initial; scroll-snap-coordinate: unset; if the element has been transformed, the snap coordinates are likewise transformed, thus aligning the snap points with the element as it is displayed. syntax values none specifies that the element does not contribute to a snap point. ...
...ap-coordinate: unset; if the element has been transformed, the snap coordinates are likewise transformed, thus aligning the snap points with the element as it is displayed. syntax values none specifies that the element does not contribute to a 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. ...
...ing the snap points with the element as it is displayed. syntax values none specifies that the element does not contribute to a 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. ...
...the element does not contribute to a 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. ...
scroll-snap-type - CSS: Cascading Style Sheets
e is one. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. specifying any precise animations or physics used to enforce those snap points is not covered by this property but instead left up to the user agent. ...
... x the scroll container snaps to snap positions in its horizontal axis only. ...
... x the scroll container snaps to snap positions in its horizontal axis only. y the scroll container snaps to snap positions in its vertical axis only. block the scroll container snaps to snap positions in its block axis only. inline the scroll container snaps to snap positions in its inline...
...e scroll offset will be adjusted to maintain the resting on that snap point. proximity the visual viewport of this scroll container may come to rest on a snap point if it isn't currently scrolled considering the user agent's scroll parameters. if content is added, moved, deleted or resized the scroll offset may be adjusted to maintain the resting on that snap point. formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax none | [ x | y | block | inline | both ] [ mandatory | proximity ]? examples snapping in different axes html <div class="holster"> <div class="container x mandatory-scroll-snapping" dir="ltr"> <div>x mand. ltr</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> </div> <div cla...
scrollbar-width - CSS: Cascading Style Sheets
the scrollbar-width property allows the author to set the maximum thickness of an element’s scrollbars when they are shown. initial valueautoapplies toscrolling boxesinheritednocomputed valueas specifiedanimation typediscrete syntax /* keyword values */ scrollbar-width: auto; scrollbar-width: thin; scrollbar-width: none; /* global values */ scrollbar-width: inherit; scrollbar-width: initial; scrollbar-width: unset; values <scrollbar-width> defines the width of the scrollbar as a keyword. it must be one of the following values: auto the default scrollbar width for the platform. thin a thin scrollbar width variant on platforms that provide that option, or a thinner scrollbar than the default platform scrollbar width. none no scrollba...
... accessibility concerns use this property with caution — setting scrollbar-width to thin or none can make content hard or impossible to scroll if the author does not provide an alternative scrolling mechanism. while swiping gestures or mouse wheels can enable scrolling on such content, some devices have no scroll alternative. ...
... at least 44px in width and height (although the problem is compounded on high-resolution screens; thorough testing is advised). ...
...em is compounded on high-resolution screens; thorough testing is advised). mdn understanding wcag, guideline 2.1 explanations mdn understanding wcag, guideline 2.5 explanations understanding success criterion 2.1.1 | w3c understanding wcag 2.1 understanding success criterion 2.5.5 | w3c understanding wcag 2.1 formal definition initial valueautoapplies toscrolling boxesinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | thin | none examples sizing overflow scrollbars css .scroller { width: 300px; height: 100px; overflow-y: scroll; scrollbar-width: thin; } html <div class="scroller">veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo melon azuki bean garlic. gumbo beet greens corn soko ...
text-decoration-thickness - CSS: Cascading Style Sheets
n-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 browser choosing a...
...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 application of this property, the 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. it also applies to ::first-letter and ::first-line.inheritednopercen...
...owser must use a minimum of 1 device pixel. for a given application of this property, the 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. ...
... for a given application of this property, the 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. ...
text-transform - CSS: Cascading Style Sheets
lÍ (firefox only). in some cases, a hyphen is also removed upon uppercasing: an t-uisce transforms to an tuisce (and the hyphen is correctly reinserted by text-transform: lowercase). the language is defined by the lang html attribute or the xml:lang xml attribute. note: support for language-specific cases varies between browsers, so check the browser compatibility table. syntax /* keyword values */ text-transform: none; text-transform: capitalize; text-transform: uppercase; text-transform: lowercase; text-transform: full-width; text-transform: full-size-kana; /* global values */ text-transform: inherit; text-transform: initial; text-transform: unset; capitalize is a keyword that converts the first letter of each word to uppercase. other characters remain unchanged (they retain t...
...e a square, allowing them to be aligned in the usual east asian scripts (like chinese or japanese). full-size-kana generally used for <ruby> annotation text, the keyword converts all small kana characters to the equivalent full-size kana, to compensate for legibility issues at the small font sizes typically used in ruby. ...
...o the equivalent full-size kana, to compensate for legibility issues at the small font sizes typically used in ruby. accessibility concerns large sections of text set with a text-transform value of uppercase may be difficult for people with cognitive concerns such as dyslexia to read. mdn understanding wcag, guideline 1.4 explanations w3c understanding wcag 2.1 formal definition initial valuenoneapplies toall elements. ...
...ed in ruby. accessibility concerns large sections of text set with a text-transform value of uppercase may be difficult for people with cognitive concerns such as dyslexia to read. mdn understanding wcag, guideline 1.4 explanations w3c understanding wcag 2.1 formal definition initial valuenoneapplies toall elements. ...
<transform-function> - CSS: Cascading Style Sheets
slates an element along the z-axis. description various coordinate models can be used to describe an html element's size and shape, as well as any transformations applied to it. the most common is the cartesian coordinate system, although homogeneous coordinates are also sometimes used. cartesian coordinates in the cartesian coordinate system, a two-dimensional point is described using two values: an x coordinate (abscissa) and a y coordinate (ordinate). this is represented by the vector notation (x, y). in css (and most computer graphics), the origin (0, 0) represents the top-left corner of any element. positive coordinates are down and to the right of the origin, while negative ones are up and to the left. thus, a point that's 2 units to the right and 5 units down would be (2, 5), whi...
...ents the top-left corner of any element. positive coordinates are down and to the right of the origin, while negative ones are up and to the left. thus, a point that's 2 units to the right and 5 units down would be (2, 5), while a point 3 units to the left and 12 units up would be (-3, -12). ...
...oint 3 units to the left and 12 units up would be (-3, -12). transformation functions transformation functions alter the appearance of an element by manipulating the values of its coordinates. a linear transformation function is described using a 2×2 matrix, like this: ac bd the function is applied to an element by using matrix multiplication. thus, each coordinate changes based on the values in the matrix: ac bd xy = ax+cy bx+dy it is even possible to apply several transformations in a row: a1 c1 b1 d1 a2 c2 b2 d2 = a1 a2 + c1 b2 a1 c2 + c1 d2 b1 a2 + d1 b2 b1 c2 + d1 d2 with this notation, it is possible to describe, and therefore compose, most common transformations: rotations, scaling, or skewing. (in fact, all transformatio...
...ackground: rgba(210,210,0,.7); transform: rotatex(90deg) translatez(50px); } .bottom { background: rgba(210,0,210,.7); transform: rotatex(-90deg) translatez(50px); } .select-form { margin-top: 50px; } javascript const selectelem = document.queryselector('select'); const example = document.queryselector('#example-element'); selectelem.addeventlistener('change', () => { if(selectelem.value === 'choose a function') { return; } else { example.style.transform = `rotate3d(1, 1, 1, 30deg) ${selectelem.value}`; settimeout(function() { example.style.transform = 'rotate3d(1, 1, 1, 30deg)'; }, 2000) } }) result specifications specification status comment css transforms level 2the definition of '<transform-function>' in that specific...
transform-style - CSS: Cascading Style Sheets
eractive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. if flattened, the element's children will not exist on their own in the 3d-space. as this property is not inherited, it must be set for all non-leaf descendants of the element. ...
...bute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. if flattened, the element's children will not exist on their own in the 3d-space. as this property is not inherited, it must be set for all non-leaf descendants of the element. ...
...e-examples and send us a pull request. if flattened, the element's children will not exist on their own in the 3d-space. as this property is not inherited, it must be set for all non-leaf descendants of the element. syntax /* keyword values */ transform-style: flat; transform-style: preserve-3d; /* global values */ transform-style: inherit; transform-style: initial; transform-style: unset; values flat indicates that the children of the element are lying in the plane of the element itself. ...
... keyword values */ transform-style: flat; transform-style: preserve-3d; /* global values */ transform-style: inherit; transform-style: initial; transform-style: unset; values flat indicates that the children of the element are lying in the plane of the element itself. preserve-3d indicates that the children of the element should be positioned in the 3d-space. formal definition initial valueflatapplies totransformable elementsinheritednocomputed valueas specifiedanimation typediscretecreates stacking contextyes formal syntax flat | preserve-3d examples transform style demonstration in this example we have a 3d cube created using transforms. the parent container of the cube faces has transform-style: preserve-3d set on it by default, so it is transformed in the 3d space and you c...
transition-property - CSS: Cascading Style Sheets
tive-examples and send us a pull request. note: the set of properties that can be animated is subject to change. as such, you should avoid including any properties in the list that don't currently animate, as someday they might, causing unexpected results. if you specify a shorthand property (e.g., background), all of its longhand sub-properties that can be animated will be. ...
... animated is subject to change. as such, you should avoid including any properties in the list that don't currently animate, as someday they might, causing unexpected results. if you specify a shorthand property (e.g., background), all of its longhand sub-properties that can be animated will be. ...
...s someday they might, causing unexpected results. if you specify a shorthand property (e.g., background), all of its longhand sub-properties that can be animated will be. syntax /* keyword values */ transition-property: none; transition-property: all; /* <custom-ident> values */ transition-property: test_05; transition-property: -specific; transition-property: sliding-vertically; /* multiple values */ transition-property: test1, animation4; transition-property: all, height, color; transition-property: all, -moz-specific, sliding; /* global values */ transition-property: inherit; transition-property: initial; transition-property: unset; values none no properties will transition. all all properties that can transition will. <custom-ident> a string identifying the property to which...
...nsition-property: all, height, color; transition-property: all, -moz-specific, sliding; /* global values */ transition-property: inherit; transition-property: initial; transition-property: unset; values none no properties will transition. all all properties that can transition will. <custom-ident> a string identifying the property to which a transition effect should be applied when its value changes. formal definition initial valueallapplies toall elements, ::before and ::after pseudo-elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax none | <single-transition-property>#where <single-transition-property> = all | <custom-ident> examples there are several examples of css transitions included in the main css transitions article. specifications ...
user-modify - CSS: Cascading Style Sheets
contents are read-only. read-write the user is able to read and write contents. ...
...contents are read-only. read-write the user is able to read and write contents. ...
...etermine whether or not the content of an element can be edited by a user. /* keyword values */ user-modify: read-only; user-modify: read-write; user-modify: write-only; /* global values */ user-modify: inherit; user-modify: initial; user-modify: unset; this property has been replaced by the contenteditable attribute. syntax the -moz-user-modify property is specified as one of the keyword values from the list below. values read-only default value. contents are read-only. read-write the user is able to read and write contents. read-write-plaintext-only same as read-write, but rich text formatting will be lost. write-only the user is able to edit the content, but not to read it. ...
...yntax the -moz-user-modify property is specified as one of the keyword values from the list below. values read-only default value. contents are read-only. read-write the user is able to read and write contents. read-write-plaintext-only same as read-write, but rich text formatting will be lost. write-only the user is able to edit the content, but not to read it. formal definition value not found in db! formal syntax syntax not found in db! examples html <div class="readwrite">the user is able to change this text.</div> css .readwrite { -moz-user-modify: read-write; -webkit-user-modify: read-write; } specifications not part of any standard. a similar property, user-focus, was proposed in early drafts of a predecessor of the css3 ui specification, but was rejected ...
white-space - CSS: Cascading Style Sheets
ty sets how white space inside an element is handled. the source for this interactive example is stored in a github repository. if 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: to make words break within themselves, use overflow-wrap, word-break, or hyphens instead. syntax /* keyword values */ white-space: normal; white-space: nowrap; white-space: pre; white-space: pre-wrap; white-space: pre-line; white-space: break-spaces; /* global values */ white-space: inherit; white-space: initial; white-space: unset; the white-space property is specified as a single keyword chosen from the list of values below. values normal sequences of white space are collapsed. newline characters i...
...e always takes up space, including at the end of the line. a line breaking opportunity exists after every preserved white space character, including between white space characters. such preserved spaces take up space and do not hang, and thus affect the box’s intrinsic sizes (min-content size and max-content size). ...
...es normal collapse collapse wrap remove nowrap collapse collapse no wrap remove pre preserve preserve no wrap preserve pre-wrap preserve preserve wrap hang pre-line preserve collapse wrap remove break-spaces preserve preserve wrap wrap formal definition initial valuenormalapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax normal | pre | nowrap | pre-wrap | pre-line | break-spaces examples basic example code { white-space: pre; } line breaks inside <pre> elements pre { word-wrap: break-word; /* ie 5.5-7 */ white-space: pre-wrap; /* modern browsers */ } in action html <div id="css-code" cl...
...ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt ...
writing-mode - CSS: Cascading Style Sheets
the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this property specifies the block flow direction, which is the direction in which block-level containers are stacked, and the direction in which inline-level content flows within a block container. thus, it also determines the ordering of block-level content. syntax /* keyword values */ writing-mode: horizontal-tb; writing-mode: vertical-rl; writing-mode: vertical-lr; /* global values */ writing-mode: inherit; writing-mode: initial; writing-mode: unset; the writing-mode property is specified as one of the values listed below. the flow direction in horizontal scripts is also affected by the directionality of that script, either left-to-right (ltr, like english and most othe...
...for rtl scripts, content flows horizontally from right to left. the next horizontal line is positioned below the previous line. vertical-rl for ltr scripts, content flows vertically from top to bottom, and the next vertical line is positioned to the left of the previous line. ...
...documents. for css, use horizontal-tb instead. rl deprecated except for svg1 documents. for css, use horizontal-tb instead. tb deprecated except for svg1 documents. for css, use vertical-lr instead. tb-lr deprecated except for svg1 documents. for css, use vertical-lr instead. tb-rl deprecated except for svg1 documents. for css, use vertical-rl instead. formal definition initial valuehorizontal-tbapplies toall elements except table row groups, table column groups, table rows, and table columnsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr examples using multiple writing modes this example demonstrates all of the writing modes, showing each with text in various languages. htm...
...mation typediscrete formal syntax horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr examples using multiple writing modes this example demonstrates all of the writing modes, showing each with text in various languages. html the html is a <table> with each writing mode in a row with a column showing text in various scripts using that writing mode. ...
zoom - CSS: Cascading Style Sheets
Web › CSS › zoom
the non-standard zoom css property can be used to control the magnification level of an element. transform: scale() should be used instead of this property, if possible. however, unlike css transforms, zoom affects the layout size of the element. /* keyword values */ zoom: normal; zoom: reset; /* <percentage> values */ zoom: 50%; zoom: 200%; /* <number> values */ zoom: 1.1; zoom: 0.7; /* global values */ zoom: inherit; zoom: initial; zoom: unset; syntax values normal render this element at its normal size. ...
...0.7; /* global values */ zoom: inherit; zoom: initial; zoom: unset; syntax values normal render this element at its normal size. reset do not (de)magnify this element if the user applies non-pinch-based zooming (e.g. by pressing ctrl-- or ctrl++ keyboard shortcuts) to the document. only supported by webkit (and possibly blink). <percentage> zoom factor. 100% is equivalent to normal. values larger than 100% zoom in. values smaller than 100% zoom out. <number> zoom factor. equivalent to the corresponding percentage (1.0 = 100% = normal). values larger than 1.0 zoom in. values smaller than 1.0 zoom out. ...
...rl++ keyboard shortcuts) to the document. only supported by webkit (and possibly blink). <percentage> zoom factor. 100% is equivalent to normal. values larger than 100% zoom in. values smaller than 100% zoom out. <number> zoom factor. equivalent to the corresponding percentage (1.0 = 100% = normal). values larger than 1.0 zoom in. values smaller than 1.0 zoom out. ...
...ted by webkit (and possibly blink). <percentage> zoom factor. 100% is equivalent to normal. values larger than 100% zoom in. values smaller than 100% zoom out. <number> zoom factor. equivalent to the corresponding percentage (1.0 = 100% = normal). values larger than 1.0 zoom in. values smaller than 1.0 zoom out. ...
Getting Started - Developer guides
e request is asynchronous. if true (the default), javascript execution will continue and the user can interact with the page while the server response has yet to arrive. this is the first a in ajax. the parameter to the send() method can be any data you want to send to the server if post-ing the request. form data should be sent in a format that the server can parse, like a query string: "name=value&anothername="+encodeuricomponent(myvar)+"&so=on" or other formats, like multipart/form-data, json, xml, and so on. note that if you want to post data, you may have to set the mime type of the request. for example, use the following before calling send() for form data sent as a query string: httprequest.setrequestheader('content-type', 'application/x-www-form-urlencoded'); step 2 – handling...
...uery string: httprequest.setrequestheader('content-type', 'application/x-www-form-urlencoded'); step 2 – handling the server response when you sent the request, you provided the name of a javascript function to handle the response: httprequest.onreadystatechange = nameofthefunction; what should this function do? first, the function needs to check the request's state. ...
..., the function needs to check the request's state. if the state has the value of xmlhttprequest.done (corresponding to 4), that means that the full server response was received and it's ok for you to continue processing it. if (httprequest.readystate === xmlhttprequest.done) { // everything is good, the response was received. } else { // not ready yet. } the full list of the readystate values is documented at xmlhttprequest.readystate and is as follows: 0 (uninitialized) or (request not initialized) 1 (loading) or (server connection established) 2 (loaded) or (request received) 3 (interactive) or (processing request) 4 (complete) or (request finished and response is ready) next, check the http response status codes of the http response. the possible codes are listed at the w...
...we'll change the request method from get to post, and include our data as a parameter in the call to httprequest.send(): function makerequest(url, username) { ... httprequest.onreadystatechange = alertcontents; httprequest.open('post', url); ...
WAI ARIA Live Regions/API Support - Developer guides
se events because they cause crashes on some important system -- show/hide are the equivalent of those events. ...
...they cause crashes on some important system -- show/hide are the equivalent of those events. ...
... aria-relevant on ancestor element container-busy "true" | "false" | "error" "false" the current changes are not yet complete. a state change event for the a11y api's busy state will be fired on the container object currently marked as busy, once it is no longer busy. this is especially...
... require author's cooperation. the "container-" prefix is so named because the attribute describes what the final computed property of similar name is for that node. this means that the at does not need to traverse up the parent chain to get this information. at this time, for properties where the container-[name] attribute has not been set, the at must have code to fall back on the default value as defined in the w3c spec. determining if event was from user input all events will now provide information about whether the event was caused by user input, or was something that the web page caused. this information is retrieved differently on each platform, because some platforms use asynchronous events. in iaccessible2, this is retrieved from the object attribute "event-from-input", which wi...
Adding captions and subtitles to HTML5 video - Developer guides
src is assigned a valid url pointing to the relevant webvtt subtitle file in each case. srclang ...
... src is assigned a valid url pointing to the relevant webvtt subtitle file in each case. srclang indicates what language each subtitle files' contents are in. the default attribute is...
...ve also added a new button to control the subtitles menu that we will build. ...
...reatemenuitem() 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'); }); // find the language to activate var lang = this.getat...
Video player styling basics - Developer guides
ned within <div> elements, rather than residing inside unordered list items. ...
...ber of properties that also need to be set for all elements within the video controls: .controls > * { float:left; width:3.90625%; height:100%; margin-left:0.1953125%; display:block; } .controls > *:first-child { margin-left:0; } all elements are floated left, as they are to be aligned next to one another, and each element is set to have a width of nearly 4% (again the actual value was calculated based on the required dimensions of the buttons), and a height of 100%. a value for margin-left is also set, but the first element (in this case the play/pause button) has this property overridden by the value 0. the <div> container for the <progress> element also requires some specific settings; it is set to be much wider than the other child elements and its cursor value is se...
...essing part of the faked progress bar has its width initially set to 0% (it is updated via javascript) and it also has its background colour set. there are some browser-specific properties that need to be set to ensure that firefox and chrome use the required colour for the progress bar: .controls progress::-moz-progress-bar { background-color:#0095dd; } .controls progress::-webkit-progress-value { background-color:#0095dd; } although the same properties are set to the same value, these rules need to be defined separately, otherwise chrome ignores it. javascript that's really it for the immediate styling; the next task is making a number of javascript changes to ensure that everything works as expected. control visibility the first change is simple: the data-state for showing the ...
...there is a reason for this...
HTML attribute: required - HTML: Hypertext Markup Language
the boolean required attribute which, if present, indicates that the user must specify a value for the input before the owning form can be submitted. the required attribute is supported by text, search, url, tel, email, password, date, month, week, time, datetime-local, number, checkbox, radio, file, <input> types along with the <select> and <textarea> form control elements. if present on any of these input types and elements, the :required pseudo class will match. if the attribute is not included, the :optional pseudo class will match. the attribute is not supported or relevant to range and color, as both have default values. it is also not supported on hidden as it can not be expected that a user to fill out a form that is hidden. nor is it supported on any of the button types, incl...
...ported on hidden as it can not be expected that a user to fill out a form that is hidden. nor is it supported on any of the button types, including image. note color and range don't support required, but type color defaults to #00000, and range defaults to the midpoint between min and max -- with min and max defaulting to 0 and 100 respectively in most browsers if not declared -- so always has a value. when an input has the required attribute, the :required pseudo-class also applies to it. conversely, inputs that support the required attribute but don't have the attribute set match the :optional pseudo-class. in the case of a same named group of radio buttons, if a single radio button in the group has the required attribute, a radio button in that group must be check, though it doesn't have ...
... in every same-named radio button in the group or none. in the case of a same named group of checkbox input types, only the checkboxes with the required attribute are required. note: setting aria-required="true" tells a screen reader that an element (any element) is required, but has no bearing on the optionality of the element. attribute interactions because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. usability when including the required attribute, provide a visible indication near the control informing the user that the input, select or textarea is required. in addition, target required form controls with the :required pseudo-class, styling them in a way to indicate they are required. this improves u...
... styling them in a way to indicate they are required. this improves usability for sited user. assistive technology should inform the user that the form control in mandatory based on the required attribute, but adding aria-required="true" doesn't hurt, in case the browser / screen reader combination does not support required yet. constraint validation if the element is required and the element's value is the empty string, then the element is suffering from valuemissing and the element will match the :invalid pseudo class. specifications specification status comment html living standardthe definition of 'required attribute' in that specification. living standard html5the definition of 'required attribute' in that specification. recommendation ...
<a>: The Anchor element - HTML: Hypertext Markup Language
Web › HTML › Element › a
for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. attributes this element's attributes include the global attributes. downloadhtml5 prompts the user to save the linked url instead of navigating to it. can be used with or without a value: without a value, the browser will suggest a filename/extension, generated from various sources: the content-disposition http header the final segment in the url path the media type (from the (content-type header, the start of a data: url, or blob.type for a blob: url) defining a value suggests it as the filename. / and \ characters are converted to underscores (_).
... use any url scheme supported by browsers: sections of a page with fragment urls pieces of media files with media fragments telephone numbers with tel: urls email addresses with mailto: urls while web browsers may not support other url schemes, web sites can with registerprotocolhandler() hreflang hints at the human language of the linked url. no built-in functionality. allowed values are the same as the global lang attribute. ping a space-separated list of urls. when the link is followed, the browser will send post requests with the body ping to the urls. typically for tracking. referrerpolicy how much of the referrer to send when following the link. see referrer-policy for possible values and their effects. rel the relationship of the linked url as space-separated li...
...l. note: this attribute is obsolete and should not be used by authors. use the http content-type header on the linked url. coordsobsolete since html5 used with the shape attribute. a comma-separated list of coordinates. nameobsolete since html5 was required to define a possible target location in a page. in html 4.01, id and name could both be used on <a>, as long as they had identical values. note: use the global attribute id instead. revobsolete since html5 specified a reverse link; the opposite of the rel attribute. deprecated for being very confusing. shapeobsolete since html5 the shape of the hyperlink’s region in an image map. note: use the <area> element for image maps instead. properties content categories flow content, phrasing content, interac...
...istive software have shortcuts to list all links on a page. however, strong link text benefits all users — the “list all links” shortcut emulates how sighted users quickly scan pages. onclick events anchor elements are often abused as fake buttons by setting their href to # or javascript:void(0) to prevent the page from refreshing, then listening for their click events . these bogus href values cause unexpected behavior when copying/dragging links, opening links in a new tab/window, bookmarking, or when javascript is loading, errors, or is disabled. they also convey incorrect semantics to assistive technologies, like screen readers. use a <button> instead. in general, you should only use a hyperlink for navigation to a real url. external links and linking to non-html resources links...
<dialog>: The Dialog element - HTML: Hypertext Markup Language
Web › HTML › Element › dialog
global attributes. the tabindex attribute must not be used on the <dialog> element. open indicates that the dialog is active and can be interacted with. when the open attribute is not set, the dialog shouldn't be shown to the user. usage notes <form> elements can close a dialog if they have the attribute method="dialog". when such a form is submitted, the dialog closes with its returnvalue property set to the value of the button that was used to submit the form. the ::backdrop css pseudo-element can be used to style behind a <dialog> element when the dialog is displayed with htmldialogelement.showmodal(). for example, to dim unreachable content behind the modal dialog. examples simple example <dialog open> <p>greetings, one and all!</p> </dialog> advanced example this exa...
...orm, when the "update details" button is clicked. ...
... simple pop-up dialog box containing a form --> <dialog id="favdialog"> <form method="dialog"> <p><label>favorite animal: <select> <option></option> <option>brine shrimp</option> <option>red panda</option> <option>spider monkey</option> </select> </label></p> <menu> <button value="cancel">cancel</button> <button id="confirmbtn" value="default">confirm</button> </menu> </form> </dialog> <menu> <button id="updatedetails">update details</button> </menu> <output aria-live="polite"></output> javascript var updatebutton = document.getelementbyid('updatedetails'); var favdialog = document.getelementbyid('favdialog'); var outputbox = document.queryselector('output'); var selectel = document.queryselector('select'); var c...
...ocument.queryselector('select'); var confirmbtn = document.getelementbyid('confirmbtn'); // "update details" button opens the <dialog> modally updatebutton.addeventlistener('click', function onopen() { if (typeof favdialog.showmodal === "function") { favdialog.showmodal(); } else { alert("the <dialog> api is not supported by this browser"); } }); // "favorite animal" input sets the value of the submit button selectel.addeventlistener('change', function onselect(e) { confirmbtn.value = selectel.value; }); // "confirm" button of form triggers "close" on dialog because of [method="dialog"] favdialog.addeventlistener('close', function onclose() { outputbox.value = favdialog.returnvalue + " button clicked - " + (new date()).tostring(); }); result specifications speci...
<nextid>: The NeXT ID element (Obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › nextid
sions. it is also probably one of the least understood of all of the early html elements. html "0.a" - from the beginning through january 10, 1991 this tag had not been invented as yet, so no examples are found from this period. html "0.c" - from january 23, 1991 though november 23, 1992 this early version of html introduced <nextid> in a non-sgml compliant form that simply used the numeric value alone as an "attribute." html "0.d" - from november 26, 1992 through may 24, 1993 during this span, next and the oldest surviving dtd's show <nextid> to take only a number for a value of its newly-introduced attribute n. html "1.k" - version 1 (first release) in this first published draft of html, <nextid> is the same as it would take in html 2, finally allowing the use of a name instead of o...
... html "1.m" - version 1 (second release) in the next published draft of html, <nextid> <nextid> can be individually deselected for display with a simple sgml command. ...
...on 3.2 <nextid> has vanished altogether, never to be heard from again. attributes like all other html elements, this element accepts the global attributes. n reference to anchor. example the user enters four section headings into the table of contents (and presumably also writing paragraph material within these sections). the heading for each of the four sections would be assigned name values of "z0", "z1", "z2", and "z3". the first of these would produce an entry in the table of contents like this: <a name="z0" href="#z4">first section name</a> and the section header would be marked like this: <h2><a name="z4">first section name</a></h2>. this continues for the next three sections, z5, z6, and z7 (and table of contents entries named z1, z2, and z3), each automatically given anchors ...
...ever ... </p> <h2><a name="z18">ninth section heading</a></h1><p> ... whatever ... </p> <h2><a name="z19">tenth section heading</a></h1><p> ... whatever ... </p> </body> </html> they then forward a copy of this document to someone with a next editor, and they delete sections z7 and z19, add ten more, z20 through z29, and then delete paragraphs z24 and z29. so then the nextid value is z30 when it's returned modified: <html> <head> <title> ... whatever ... </title> <link, meta, base, etc. as applicable for the head of this document> <nextid n="z30"> </head> <body> <a name="z0" href="#z4">first section heading</a> <a name="z1" href="#z5">second section heading</a> <a name="z8" href="#z14">newly inserted third secti...
<object> - HTML: Hypertext Markup Language
Web › HTML › Element › object
d type must be defined. declarehtml 4 onlyobsolete since html5 the presence of this boolean attribute makes this element a declaration only. the object must be instantiated by a subsequent <object> element. in html5, repeat the <object> element completely each that that the resource is reused. formhtml5 the form element, if any, that the object element is associated with (its form owner). the value of the attribute must be an id of a <form> element in the same document. height the height of the displayed resource, in css pixels. -- (absolute values only. no percentages) name the name of valid browsing context (html5), or the name of the control (html 4). standbyhtml 4 onlyobsolete since html5 a message that the browser can show while loading the object's implementation and data. tabi...
...the element in the tabbing navigation order for the current document. type the content type of the resource specified by data. at least one of data and type must be defined. typemustmatchhtml5 this boolean attribute indicates if the type attribute and the actual content type of the resource must match to be used. ...
...urce specified by data. at least one of data and type must be defined. typemustmatchhtml5 this boolean attribute indicates if the type attribute and the actual content type of the resource must match to be used. usemap a hash-name reference to a <map> element; that is a '#' followed by the value of a name of a map element. width the width of the display resource, in css pixels. -- (absolute values only. ...
... living standard html5the definition of '<object>' in that specification. recommendation html 4.01 specificationthe definition of '<object>' in that specification. ...
<option>: The HTML Option element - HTML: Hypertext Markup Language
Web › HTML › Element › option
et, this option is not checkable. often browsers grey out such control and it won't receive any browsing event, like mouse clicks or focus-related ones. if this attribute is not set, the element can still be disabled if one of its ancestors is a disabled <optgroup> element. label this attribute is text for the label indicating the meaning of the option. ...
... examples see <select> for examples. ...
... examples see <select> for examples. specifications specification status comment html living standardthe definition of '<option>' in that specification. ...
... examples see <select> for examples. ...
<tfoot>: The Table Foot element - HTML: Hypertext Markup Language
Web › HTML › Element › tfoot
requirement from html5. implicit aria role rowgroup permitted aria roles any dom interface htmltablesectionelement attributes this element includes the global attributes. deprecated attributes align deprecated since html4obsolete since html5 this enumerated attribute specifies how horizontal alignment of each cell content will be handled. ...
...ell center, centering the content in the cell right, aligning the content to the right of the cell justify, inserting spaces into the textual content so that the content is justified in the cell char, aligning the textual content on a special character with a minimal offset, defined by the char and charoff attributes unimplemented (see bug 2212). if this attribute is not set, the left value is assumed. note: do not use this attribute as it is obsolete (not supported) in the latest standard. to achieve the same effect as the left, center, right or justify values, use the css text-align property on it. to achieve the same effect as the char value, in css3, you can use the value of the char as the value of the text-align property unimplemented. bgcolor this attrib...
... non-standard and only implemented some versions of microsoft internet explorer: the <tfoot> element should be styled using css. to give a similar effect to the bgcolor attribute, use the css property background-color, on the relevant <td> or <th> elements. char deprecated since html4obsolete since html5 this attribute is used to set the character to align the cells in a column on. typical values for this include a period (.) when attempting to align numbers or monetary values. if align is not set to char, this attribute is ignored. note: do not use this attribute as it is obsolete (and not supported) in the latest standard. to achieve the same effect as the char, in css3, you can use the character set using the char attribute as the value of the text-align property unimplemented. ...
...s used to indicate the number of characters to offset the column data from the alignment characters specified by the char attribute. note: do not use this attribute as it is obsolete (and not supported) in the latest standard. valign deprecated since html4obsolete since html5 this attribute specifies the vertical alignment of the text within each row of cells of the table header. possible values for this attribute are: baseline, which will put the text as close to the bottom of the cell as it is possible, but align it on the baseline of the characters instead of the bottom of them. if characters are all of the size, this has the same effect as bottom. bottom, which will put the text as close to the bottom of the cell as it is possible; middle, which will center the text in the c...
<thead>: The Table Head element - HTML: Hypertext Markup Language
Web › HTML › Element › thead
fore any <tbody>, <tfoot> and <tr> element. implicit aria role rowgroup permitted aria roles any dom interface htmltablesectionelement attributes this element includes the global attributes. deprecated attributes align in html 4, in html5 this enumerated attribute specifies how horizontal alignment of each cell content will be handled. ...
...ell center, centering the content in the cell right, aligning the content to the right of the cell justify, inserting spaces into the textual content so that the content is justified in the cell char, aligning the textual content on a special character with a minimal offset, defined by the char and charoff attributes unimplemented (see bug 2212). if this attribute is not set, the left value is assumed. note: do not use this attribute as it is obsolete (not supported) in the latest standard. to achieve the same effect as the left, center, right or justify values, use the css text-align property on it. to achieve the same effect as the char value, in css3, you can use the value of the char as the value of the text-align property unimplemented. bgcolor this attrib...
...ribute, as it is non-standard and only implemented in some versions of microsoft internet explorer: the <thead> element should be styled using css. to give a similar effect to the bgcolor attribute, use the css property background-color, on the relevant <td> or <th> elements. char in html 4, in html5 this attribute is used to set the character to align the cells in a column on. typical values for this include a period (.) when attempting to align numbers or monetary values. if align is not set to char, this attribute is ignored. note: do not use this attribute as it is obsolete (and not supported) in the latest standard. to achieve the same effect as the char, in css3, you can use the character set using the char attribute as the value of the text-align property unimplemented. ...
...5 this attribute is used to indicate the number of characters to offset the column data from the alignment characters specified by the char attribute. note: do not use this attribute as it is obsolete (and not supported) in the latest standard. valign in html 4, in html5 this attribute specifies the vertical alignment of the text within each row of cells of the table header. possible values for this attribute are: baseline, which will put the text as close to the bottom of the cell as it is possible, but align it on the baseline of the characters instead of the bottom of them. if characters are all of the size, this has the same effect as bottom. bottom, which will put the text as close to the bottom of the cell as it is possible; middle, which will center the text in the c...
HTML elements reference - HTML: Hypertext Markup Language
Web › HTML › Element
otation element) indicates that the enclosed text is an extended quotation. usually, this is rendered visually by indentation (see notes for how to change it). a url for the source of the quotation may be given using the cite attribute, while a text representation of the source can be given using the <cite> element. <dd> the html <dd> element provides the description, definition, or value for the preceding term (<dt>) in a description list (<dl>). <div> the html content division element (<div>) is the generic container for flow content. it has no effect on the content or layout until styled using css. <dl> the html <dl> element represents a description list. the element encloses a list of groups of terms (specified using the <dt> element) and descriptio...
...he generic container for flow content. it has no effect on the content or layout until styled using css. <dl> the html <dl> element represents a description list. the element encloses a list of groups of terms (specified using the <dt> element) and descriptions (provided by <dd> elements). common uses for this element are to implement a glossary or to display metadata (a list of key-value pairs). <dt> the html <dt> element specifies a term in a description or definition list, and as such must be used inside a <dl> element. <figcaption> the html <figcaption> or figure caption element represents a caption or legend describing the rest of the contents of its parent <figure> element. <figure> the html <figure> (figure with optional caption) el...
...t, independent of its styled presentation. by default, it renders text within it one font-size smaller, such as from small to x-small. <span> the html <span> element is a generic inline container for phrasing content, which does not inherently represent anything. it can be used to group elements for styling purposes (using the class or id attributes), or because they share attribute values, such as lang. <strong> the html strong importance element (<strong>) indicates that its contents have strong importance, seriousness, or urgency. browsers typically render the contents in bold type. <sub> the html subscript element (<sub>) specifies inline text which should be displayed as subscript for solely typographical reasons. <sup> the html super...
... wide variety of types of input data and control widgets are available, depending on the device and user agent. <label> the html <label> element represents a caption for an item in a user interface. <legend> the html <legend> element represents a caption for the content of its parent <fieldset>. <meter> the html <meter> element represents either a scalar value within a known range or a fractional value. <optgroup> the html <optgroup> element creates a grouping of options within a <select> element. <option> the html <option> element is used to define an item contained in a <select>, an <optgroup>, or a <datalist> element. as such, <option> can represent menu items in popups and other lists of items in an html document. ...
itemscope - HTML: Hypertext Markup Language
a related attribute, itemtype, is used to specify the valid url of a vocabulary (such as schema.org) that describes the item and its properties context. in each of the following examples, the vocabulary is from schema.org. every html element may have an itemscope attribute specified. ...
...n>director: <span itemprop="director">james cameron</span> (born august 16, 1954)</span> <span itemprop="genre">science fiction</span> <a href="https://youtu.be/0ay1xikx7by" itemprop="trailer">trailer</a> </div> structured data the following table shows the structured data from the preceding example. itemscope itemtype movie itemprop (itemprop name) (itemprop value) itemprop director james cameron itemprop genre science fiction itemprop name avatar itemprop https://youtu.be/0ay1xikx7by trailer itemscope id attributes when you specify the itemscope attribute for an element, a new item is created. the item consists of a group of name-value pairs. for elements with an itemscope attribute and a...
...pan itemprop="name">carol smith</span> </span> </p> <p> published: <time datetime="2009-11-05" itemprop="datepublished">november 5, 2009</time> </p> <span itemprop="description">this is my grandmother's apple pie recipe. ...
...-sliced apples: 6 cups itemprop recipeingredient white sugar: 3/4 cup itemprop recipeinstructions 1. cut and peel apples 2. mix sugar and cinnamon. use additional sugar for tart apples . itemprop author [person] itemprop name carol smith itemscope itemprop[itemtype] aggregaterating [aggregaterating] itemprop ratingvalue 4.0 itemprop reviewcount 35 itemscope itemprop[itemtype] nutrition [nutritioninformation] itemprop servingsize 1 medium slice itemprop calories 250 cal itemprop fatcontent 12 g note: a handy tool for extracting microdata structures from html is google's structured data testing tool. try it on the html shown abov...
Microdata - HTML: Hypertext Markup Language
engines and web crawlers can extract and process microdata from a web page and use it to provide a richer browsing experience for users. search engines benefit greatly from direct access to this structured data because it allows search engines to understand the information on web pages and provide more relevant results to users. microdata uses a supporting vocabulary to describe an item and name-value pairs to assign values to its properties. microdata is an attempt to provide a simpler way of annotating html elements with machine-readable tags than the similar approaches of using rdfa and classic microformats. at a high level, microdata consists of a group of name-value pairs. the groups are called items, and each name-value pair is a property. items and properties are represented by regular...
...to the implementation of additional marking parameters of schema's vocabulary, the indexation of information in russian-language web-pages became considerably more successful. global attributes itemid – the unique, global identifier of an item. itemprop – used to add properties to an item. every html element may have an itemprop attribute specified, where an itemprop consists of a name and value pair. itemref – properties that are not descendants of an element with the itemscope attribute can be associated with the item using an itemref. itemref provides a list of element ids (not itemids) with additional properties elsewhere in the document. itemscope – itemscope (usually) works along with itemtype to specify that the html contained in a block is about a particular item. itemscope...
...example html <div itemscope itemtype="http://schema.org/softwareapplication"> <span itemprop="name">angry birds</span> - requires <span itemprop="operatingsystem">android</span><br> <link itemprop="applicationcategory" href="http://schema.org/gameapplication"/> <div itemprop="aggregaterating" itemscope itemtype="http://schema.org/aggregaterating"> rating: <span itemprop="ratingvalue">4.6</span> ( <span itemprop="ratingcount">8864</span> ratings ) </div> <div itemprop="offers" itemscope itemtype="http://schema.org/offer"> price: $<span itemprop="price">1.00</span> <meta itemprop="pricecurrency" content="usd" /> </div> </div> structured data itemscope itemtype softwareapplication (http://schema.org/softwareapplication) itemprop...
...try it on the html shown above. ...
Preloading content with rel="preload" - HTML: Hypertext Markup Language
the preload value of the <link> element's rel attribute lets you declare fetch requests in the html's <head>, specifying resources that your page will need very soon, which you want to start loading early in the page lifecycle, before browsers' main rendering machinery kicks in. this ensures they are available earlier and are less likely to block the page's render, improving performance. this article provides a basic guide to how <link rel="preload"> works. the basics you most commonly use <link> to load a css file to style your page with: <link rel="stylesheet" href="styles/main.css"> here however, we will use a rel value of preload, which turns <link> into a preloader for any resource we want. you will also need to specify: the path to the resource in the href attribute. the ...
...of content to be preloaded allows the browser to: prioritize resource loading more accurately. store in the cache for future requests, reusing the resource if appropriate. apply the correct content security policy to the resource. set the correct accept request headers for it. what types of content can be preloaded? many different content types can be preloaded. the possible as attribute values are: audio: audio file, as typically used in <audio>. document: an html document intended to be embedded by a <frame> or <iframe>. embed: a resource to be embedded inside an <embed> element. fetch: resource to be accessed by a fetch or xhr request, such as an arraybuffer or json file. font: font file. image: image file. object: a resource to be embedded inside an <object> element. scri...
...source to be accessed by a fetch or xhr request, such as an arraybuffer or json file. font: font file. image: image file. object: a resource to be embedded inside an <object> element. script: javascript file. style: css stylesheet. track: webvtt file. worker: a javascript web worker or shared worker. video: video file, as typically used in <video>. note: there's more detail about these values and the web features they expect to be consumed by in the preload spec — see link element extensions. also note that the full list of values the as attribute can take is governed by the fetch spec — see request destinations. including a mime type <link> elements can accept a type attribute, which contains the mime type of the resource the element points to. this is especially useful when ...
...ad spec — see link element extensions. also note that the full list of values the as attribute can take is governed by the fetch spec — see request destinations. including a mime type <link> elements can accept a type attribute, which contains the mime type of the resource the element points to. this is especially useful when preloading resources — the browser will use the type attribute value to work out if it supports that resource, and will only download it if so, ignoring it if not. you can see an example of this in our video example (see the full source code, and also the live version): <head> <meta charset="utf-8"> <title>video preload example</title> <link rel="preload" href="sintel-short.mp4" as="video" type="video/mp4"> <link rel="preload" href="sintel-short.webm" a...
HTTP conditional requests - HTTP
http has a concept of conditional requests, where the result, and even the success of a request, can be changed by comparing the affected resources with the value of a validator. such requests can be useful to validate the content of a cache, and sparing a useless control, to verify the integrity of a document, like when resuming a download, or when preventing to lose updates when uploading or modifying a document on the server. principles http conditional requests are requests that are executed differently, depending on the value of specific headers. these headers define a precondition, and the result of the request will be different if the precondition is matched or not. the different behaviors are defined by the method of the request used, and by the set of headers used for a preconditio...
...only if the original it is based on is the same as that stored on the server. validators all conditional headers try to check if the resource stored on the server matches a specific version. to achieve this, the conditional requests need to indicate the version of the resource. as comparing the whole resource byte to byte is impracticable, and not always what is wanted, the request transmits a value describing the version. such values are called validators, and are of two kinds: the date of last modification of the document, the last-modified date. an opaque string, uniquely identifying each version, called the entity tag, or the etag. comparing versions of the same resource is a bit tricky: depending on the context, there are two kinds of equality checks: strong validation is used ...
...ed and etag are sent, but it could equally have been only one of them. these validators are cached with the resource (like all headers) and will be used to craft conditional requests, once the cache becomes stale. as long as the cache is not stale, no requests are issued at all. but once it has become stale, this is mostly controlled by the cache-control header, the client doesn't use the cached value directly but issues a conditional request. the value of the validator is used as a parameter of the if-modified-since and if-match headers. if the resource has not changed, the server sends back a 304 not modified response. this makes the cache fresh again, and the client uses the cached resource. although there is a response/request round-trip that consumes some resources, this is more efficien...
...er a diff of both versions, helping them decide which changes they wish to keep. dealing with the first upload of a resource the first upload of a resource is an edge case of the previous. like any update of a resource, it is subject to a race condition if two clients try to perform at the similar times. to prevent this, conditional requests can be used: by adding if-none-match with the special value of '*', representing any etag. the request will succeed, only if the resource didn't exist before: if-none-match will only work with http/1.1 (and later) compliant servers. if unsure if the server will be compliant, you need first to issue a head request to the resource to check this. conclusion conditional requests are a key feature of http, and allow the building of efficient and complex a...
Accept-Encoding - HTTP
ontent encoding, usually a compression algorithm, the client is able to understand. using content negotiation, the server selects one of the proposals, uses it and informs the client of its choice with the content-encoding response header. even if both the client and the server supports the same compression algorithms, the server may choose not to compress the body of a response, if the identity value is also acceptable. two common cases lead to this: the data to be sent is already compressed and a second compression won't lead to smaller data to be transmitted. this may be the case with some image formats; the server is overloaded and cannot afford the computational overhead induced by the compression requirement. typically, microsoft recommends not to compress if a server uses more than ...
... data to be sent is already compressed and a second compression won't lead to smaller data to be transmitted. this may be the case with some image formats; the server is overloaded and cannot afford the computational overhead induced by the compression requirement. typically, microsoft recommends not to compress if a server uses more than 80% of its computational power. as long as the identity value, meaning no encoding, is not explicitly forbidden, by an identity;q=0 or a *;q=0 without another explicitly set value for identity, the server must never send back a 406 not acceptable error. notes: an iana registry maintains a complete list of official content encodings. two others content encoding, bzip and bzip2, are sometimes used, though not standard. they implement the algorithm u...
...gorithm used by these two unix programs. note that the first one was discontinued due to patent licensing problems. header type request header forbidden header name yes syntax accept-encoding: gzip accept-encoding: compress accept-encoding: deflate accept-encoding: br accept-encoding: identity accept-encoding: * // multiple algorithms, weighted with the quality value syntax: accept-encoding: deflate, gzip;q=1.0, *;q=0.5 directives gzip a compression format using the lempel-ziv coding (lz77), with a 32-bit crc. compress a compression format using the lempel-ziv-welch (lzw) algorithm. deflate a compression format using the zlib structure, with the deflate compression algorithm. br a compression format using the brotli algorithm. identity indicates ...
... gzip a compression format using the lempel-ziv coding (lz77), with a 32-bit crc. compress a compression format using the lempel-ziv-welch (lzw) algorithm. deflate a compression format using the zlib structure, with the deflate compression algorithm. br a compression format using the brotli algorithm. identity indicates the identity function (i.e. no compression, nor modification). this value is always considered as acceptable, even if not present. * matches any content encoding not already listed in the header. this is the default value if the header is not present. it doesn't mean that any algorithm is supported; merely that no preference is expressed. ;q= (qvalues weighting) any value is placed in an order of preference expressed using a relative quality value called weight. ...
Access-Control-Allow-Origin - HTTP
the access-control-allow-origin response header indicates whether the response can be shared with requesting code from the given origin. header type response header forbidden header name no syntax access-control-allow-origin: * access-control-allow-origin: <origin> access-control-allow-origin: null directives * for requests without credentials, the literal value "*" can be specified, as a wildcard; the value tells browsers to allow requesting code from any origin to access the resource. attempting to use the wildcard with credentials will result in an error. <origin> specifies an origin. only a single origin can be specified. if the server supports clients from multiple origins, it must return the origin for the specific client making the request. null...
...return access-control-allow-origin: "null", but the serialization of the origin of any resource that uses a non-hierarchical scheme (such as data: or file:) and sandboxed documents is defined to be "null". many user agents will grant such documents access to a response with an access-control-allow-origin: "null" header, and any origin can create a hostile document with a "null" origin. ...
...that tells the browser to allow code from any origin to access a resource will include the following: access-control-allow-origin: * a response that tells the browser to allow requesting code from the origin https://developer.mozilla.org to access a resource will include the following: access-control-allow-origin: https://developer.mozilla.org limiting the possible access-control-allow-origin values to a set of allowed origins requires code on the server side to check the value of the origin request header, compare that to a list of allowed origins, and then if the origin value is in the list, to set the access-control-allow-origin value to the same value as the origin value. cors and caching if the server sends a response with an access-control-allow-origin value that is an explicit orig...
...eader, compare that to a list of allowed origins, and then if the origin value is in the list, to set the access-control-allow-origin value to the same value as the origin value. cors and caching if the server sends a response with an access-control-allow-origin value that is an explicit origin (rather than the "*" wildcard), then the response should also include a vary response header with the value origin — to indicate to browsers that server responses can differ based on the value of the origin request header. access-control-allow-origin: https://developer.mozilla.org vary: origin specifications specification status comment fetchthe definition of 'access-control-allow-origin' in that specification. living standard initial definition. ...
CSP: default-src - HTTP
the http content-security-policy (csp) default-src directive serves as a fallback for the other csp fetch directives. ...
... the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content sour...
... <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still ...
...the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
CSP: form-action - HTTP
the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content sour...
... <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still ...
...the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
...orm-action 'none'; </ifmodule> nginx configuration add_header content-security-policy "form-action 'none';" violation case using a <form> element with an action set to inline javascript will result in a csp violation. <meta http-equiv="content-security-policy" content="form-action 'none'"> <form action="javascript:alert('foo')" id="form1" method="post"> <input type="text" name="fieldname" value="fieldvalue"> <input type="submit" id="submit" value="submit"> </form> // error: refused to send form data because it violates the following // content security policy directive: "form-action 'none'". specifications specification status comment content security policy level 3the definition of 'form-action' in that specification. working draft no changes. ...
CSP: navigate-to - HTTP
the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content sour...
... <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still ...
...the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
... examples meta tag configuration <meta http-equiv="content-security-policy" content="navigate-to 'none'"> violation case using a <form> element with an action set to inline javascript will result in a csp violation. <meta http-equiv="content-security-policy" content="navigate-to 'none'"> <form action="javascript:alert('foo')" id="form1" method="post"> <input type="text" name="fieldname" value="fieldvalue"> <input type="submit" id="submit" value="submit"> </form> specifications specification status comment content security policy level 3the definition of 'navigate-to' in that specification. working draft initial definition. ...
If-None-Match - HTTP
the if-none-match http request header makes the request conditional. for get and head methods, the server will send back the requested resource, with a 200 status, only if it doesn't have an etag matching the given ones. for other methods, the request will be processed only if the eventually existing resource's etag doesn't match any of the values listed. when the condition fails for get and head methods, then the server must return http status code 304 (not modified). for methods that apply server-side changes, the status code 412 (precondition failed) is used. note that the server generating a 304 response must generate any of the following header fields that would have been sent in a 200 (ok) response to the same request: cache-control, content-location, date, etag, expires, and vary. the...
...pages that differ by the date of generation in the footer would still be considered as identical. when used in combination with if-modified-since, if-none-match has precedence (if the server supports it). there are two common use cases: for get and head methods, to update a cached entity that has an associated etag. ...
... etag. for other methods, and in particular for put, if-none-match used with the * value can be used to save a file not known to exist, guaranteeing that another upload didn't happen before, losing the data of the previous put; this problem is a variation of the lost update problem. header type request header forbidden header name no syntax if-none-match: "<etag_value>" if-none-match: "<etag_value>", "<etag_value>", … if-none-match: * directives <etag_value> entity tags uniquely representing the requested resources. they are a string of ascii characters placed between double quotes (like "675af34563dc-tr34") and may be prefixed by w/ to indicate that the weak comparison algorithm should be used (this is useless with if-none-match as it only uses that al...
...they are only useful when uploading a resource, usually with put, to check if another resource with the identity has already been uploaded before. ...
Referrer-Policy - HTTP
gin-when-cross-origin referrer-policy: same-origin referrer-policy: strict-origin referrer-policy: strict-origin-when-cross-origin referrer-policy: unsafe-url directives no-referrer the referer header will be omitted entirely. no referrer information is sent along with requests. ...
... origin only send the origin of the document as the referrer. ...
...n, path, and querystring of the url are sent as a referrer when the protocol security level stays the same (http→http, https→https) or improves (http→https), but isn't sent to less secure destinations (https→http). there is effort from browsers in moving to a stricter default value, namely strict-origin-when-cross-origin (see https://github.com/whatwg/fetch/pull/952), consider using this value (or a stricter one), if possible, when changing the referrer-policy. origin only send the origin of the document as the referrer. for example, a document at https://example.com/page.html will send the referrer https://example.com/. origin-when-cross-origin send the origin, path, and query string when performing a same-origin request, but only send the origin of the document for other cases...
... specifications specification status referrer policy editor's draft ...
Regular expressions - JavaScript
ed with an object initializer without assigning it to a variable. if you do, however, every occurrence is a new regular expression. for this reason, if you use this form without assigning it to a variable, you cannot subsequently access the properties of that regular expression. ...
...o a variable. if you do, however, every occurrence is a new regular expression. for this reason, if you use this form without assigning it to a variable, you cannot subsequently access the properties of that regular expression. for example, assume you have this script: var myre = /d(b+)d/g; var myarray = myre.exec('cdbbdbsbz'); console.log('the value of lastindex is ' + myre.lastindex); // "the value of lastindex is 5" however, if you have this script: var myarray = /d(b+)d/g.exec('cdbbdbsbz'); console.log('the value of lastindex is ' + /d(b+)d/g.lastindex); // "the value of lastindex is 0" the occurrences of /d(b+)d/g in the two statements are different regular expression objects and hence have different values for their lastindex property. if you need to access the properties of a reg...
...ee digits \d{3}, followed by a close parenthesis \), (end non-capturing parenthesis )), followed by one dash, forward slash, or decimal point and when found, remember the character ([-\/\.]), followed by three digits \d{3}, followed by the remembered match of a dash, forward slash, or decimal point \1, followed by four digits \d{4}. the change event activated when the user presses enter sets the value of regexp.input. html <p> enter your phone number (with area code) and then click "check". <br> the expected format is like ###-###-####. </p> <form action="#"> <input id="phone"> <button onclick="testinfo(document.getelementbyid('phone'));">check</button> </form> javascript var re = /(?:\d{3}|\(\d{3}\))([-\/\.])\d{3}\1\d{4}/; function testinfo(phoneinput) { var ok = re.exec(pho...
...xp.input. html <p> enter your phone number (with area code) and then click "check". <br> the expected format is like ###-###-####. </p> <form action="#"> <input id="phone"> <button onclick="testinfo(document.getelementbyid('phone'));">check</button> </form> javascript var re = /(?:\d{3}|\(\d{3}\))([-\/\.])\d{3}\1\d{4}/; function testinfo(phoneinput) { var ok = re.exec(phoneinput.value); if (!ok) { console.error(phoneinput.value + ' isn\'t a phone number with area code!'); } else { console.log('thanks, your phone number is ' + ok[0]);} } result tools regexr an online tool to learn, build, & test regular expressions. regex tester an online regex builder/debugger regex visualizer an online visual regex tester. specifications specification ...
TypeError: can't redefine non-configurable property "x" - JavaScript
eated by an object initializer are configurable. however, 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 if you haven't specified them as configurable. ...
...ever, 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 if you haven't specified them as configurable. ...
...t specified them as configurable. var obj = object.create({}); object.defineproperty(obj, "foo", {value: "bar"}); object.defineproperty(obj, "foo", {value: "baz"}); // typeerror: can't redefine non-configurable property "foo" you will need to set the "foo" property to configurable, if you intend to redefine it later in the code. ...
...defineproperty(obj, "foo", {value: "bar"}); object.defineproperty(obj, "foo", {value: "baz"}); // typeerror: can't redefine non-configurable property "foo" you will need to set the "foo" property to configurable, if you intend to redefine it later in the code. ...
TypeError: invalid assignment to const "x" - JavaScript
the javascript exception "invalid assignment to const" occurs when it was attempted to alter a constant value. javascript const declarations can't be re-assigned or redeclared. message typeerror: invalid assignment to const "x" (firefox) typeerror: assignment to constant variable. (chrome) typeerror: assignment to const (edge) typeerror: redeclaration of const 'x' (ie) error type typeerror what went wrong? a constant is a value that cannot be altered by the program during normal execution. it cannot change through re-assignment, and it can't be redeclared. in javascript, constants are declared using the const keyword. examples invalid redeclaration assigning a value to the same constant name in the same block-scope will throw. const columns = 80; // ... columns = 120; // typeerror...
... with let or global variable with var. let columns = 80; // ... let columns = 120; scoping check if you are in the correct scope. should this constant appear in this scope or was it meant to appear in a function, for example? const columns = 80; function setupbigscreenenvironment() { const columns = 120; } const and immutability the const declaration creates a read-only reference to a value. ...
... with var. let columns = 80; // ... let columns = 120; scoping check if you are in the correct scope. should this constant appear in this scope or was it meant to appear in a function, for example? const columns = 80; function setupbigscreenenvironment() { const columns = 120; } const and immutability the const declaration creates a read-only reference to a value. ...
...80; function setupbigscreenenvironment() { const columns = 120; } const and immutability the const declaration creates a read-only reference to a value. it does not mean the value it holds is immutable, just that the variable identifier cannot be reassigned. for instance, in case the content is an object, this means the object itself can still be altered. ...
SyntaxError: missing formal parameter - JavaScript
ion "missing formal parameter" occurs when your function declaration is missing valid parameters. message syntaxerror: missing formal parameter (firefox) error type syntaxerror what went wrong? "formal parameter" is a fancy way of saying "function parameter". your function declaration is missing valid parameters. in the declaration of a function, the parameters must be identifiers, not any value like numbers, strings, or objects. declaring functions and calling functions are two separate steps. declarations require identifier as parameters, and only when calling (invoking) the function, you provide the values the function should use. in javascript, identifiers can contain only alphanumeric characters (or "$" or "_"), and may not start with a digit. an identifier differs from a string in...
...se. in javascript, identifiers can contain only alphanumeric characters (or "$" or "_"), and may not start with a digit. an identifier differs from a string in that a string is data, while an identifier is part of the code. examples provide proper function parameters function parameters must be identifiers when setting up a function. ...
...s provide proper function parameters function parameters must be identifiers when setting up a function. ...
..."}) { console.log(arg) }; // syntaxerror: missing formal parameter you will need to use identifiers in function declarations: function square(number) { return number * number; }; function greet(greeting) { return greeting; }; function log(arg) { console.log(arg) }; you can then call these functions with the arguments you like: square(2); // 4 greet("howdy"); // "howdy" log({obj: "value"}); // object { obj: "value" } ...
SyntaxError: missing = in const declaration - JavaScript
the javascript exception "missing = in const declaration" occurs when a const declaration was not given a value in the same statement (like const red_flag;). you need to provide one (const red_flag = '#ff0'). message syntaxerror: const must be initalized (edge) syntaxerror: missing = in const declaration (firefox) syntaxerror: missing initializer in const declaration (chrome) error type syntaxerror what went wrong? ...
...st declaration" occurs when a const declaration was not given a value in the same statement (like const red_flag;). you need to provide one (const red_flag = '#ff0'). message syntaxerror: const must be initalized (edge) syntaxerror: missing = in const declaration (firefox) syntaxerror: missing initializer in const declaration (chrome) error type syntaxerror what went wrong? a constant is a value that cannot be altered by the program during normal execution. it cannot change through re-assignment, and it can't be redeclared. in javascript, constants are declared using the const keyword. an initializer for a constant is required; that is, you must specify its value in the same statement in which it's declared (which makes sense, given that it can't be changed later). examples missing con...
...xecution. it cannot change through re-assignment, and it can't be redeclared. in javascript, constants are declared using the const keyword. an initializer for a constant is required; that is, you must specify its value in the same statement in which it's declared (which makes sense, given that it can't be changed later). examples missing const initializer unlike var or let, you must specify a value for a const declaration. this throws: const columns; // syntaxerror: missing = in const declaration fixing the error there are multiple options to fix this error. ...
...red (which makes sense, given that it can't be changed later). examples missing const initializer unlike var or let, you must specify a value for a const declaration. this throws: const columns; // syntaxerror: missing = in const declaration fixing the error there are multiple options to fix this error. check what was intended to be achieved with the constant in question. adding a constant value specify the constant value in the same statement in which it's declared: const columns = 80; const, let or var? do not use const if you weren't meaning to declare a constant. maybe you meant to declare a block-scoped variable with let or global variable with var. both don't require an initial value. let columns; ...
Array.prototype[@@iterator]() - JavaScript
the @@iterator method is part of the iterable protocol, that defines how to synchronously iterate over a sequence of values. the initial value of the @@iterator property is the same function object as the initial value of the values() property. syntax arr[symbol.iterator]() return value the initial value given by the values() iterator. by default, using arr[symbol.iterator] will return the values() function. examples iteration using for...of loop html <ul id="letterresult"> </ul> javascript var arr = ['a', 'b', 'c']; var earr = arr[symbol.iterator](); var letterresult = document.getelementbyid('letterresult'); // your browser must support for..of loop // and let-scoped variables in for loops // const and var could also be used for (let letter of earr) { letterresult.innerhtml += "<...
...if you have a function that takes an iterator and the...
...telementbyid('letterresult'); // your browser must support for..of loop // and let-scoped variables in for loops // const and var could also be used for (let letter of earr) { letterresult.innerhtml += "<li>" + letter + "</li>"; } result alternative iteration var arr = ['a', 'b', 'c', 'd', 'e']; var earr = arr[symbol.iterator](); console.log(earr.next().value); // a console.log(earr.next().value); // b console.log(earr.next().value); // c console.log(earr.next().value); // d console.log(earr.next().value); // e use case for brace notation the use case for this syntax over using the dot notation (array.prototype.values()) is in a case where you don't know what object is going to be ahead of time. if you have a function that takes an iterator and then iterate over the value, but don't k...
...this could be a built-in object like string object or a custom object. ...
Array.isArray() - JavaScript
see the article “determining with absolute accuracy whether or not a javascript object is an array” for more details. given a typedarray instance, false is always returned. polyfill running the following code before any other code will create array.isarray() if it's not natively available. ...
... see the article “determining with absolute accuracy whether or not a javascript object is an array” for more details. given a typedarray instance, false is always returned. polyfill running the following code before any other code will create array.isarray() if it's not natively available. ...
... see the article “determining with absolute accuracy whether or not a javascript object is an array” for more details. given a typedarray instance, false is always returned. polyfill running the following code before any other code will create array.isarray() if it's not natively available. ...
... see the article “determining with absolute accuracy whether or not a javascript object is an array” for more details. given a typedarray instance, false is always returned. polyfill running the following code before any other code will create array.isarray() if it's not natively available. ...
Array.prototype.toLocaleString() - JavaScript
x arr.tolocalestring([locales[, options]]); parameters locales optional a string with a bcp 47 language tag, or an array of such strings. for the general form and interpretation of the locales argument, see the intl page. options optional an object with configuration properties, for numbers see number.prototype.tolocalestring(), and for dates see date.prototype.tolocalestring(). return value a string representing the elements of the array. polyfill // https://tc39.github.io/ecma402/#sup-array.prototype.tolocalestring if (!array.prototype.tolocalestring) { object.defineproperty(array.prototype, 'tolocalestring', { value: function(locales, options) { // 1. let o be ? toobject(this value). if (this == null) { throw new typeerror('"this" is null or not defin...
... // note: in this case, we will use a comma var separator = ','; // 4. if len is zero, return the empty string. ...
... tostring(? // invoke( // firstelement, // "tolocalestring", // « locales, options » // ) // ) var r = firstelement == null ? '' : firstelement.tolocalestring(locales, options); // 8. let k be 1. var k = 1; // 9. repeat, while k < len while (k < len) { // a. let s be a string value produced by // concatenating r and separator. var s = r + separator; // b. let nextelement be ? get(a, tostring(k)). var nextelement = a[k]; // c. if nextelement is undefined or null, then // i. let r be the empty string. // d. else, // i. let r be ? // tostring(? // invoke( // nextele...
...i. let r be the empty string. // d. else, // i. let r be ? // tostring(? // invoke( // nextelement, // "tolocalestring", // « locales, options » // ) // ) r = nextelement == null ? '' : nextelement.tolocalestring(locales, options); // e. let r be a string value produced by // concatenating s and r. r = s + r; // f. increase k by 1. k++; } // 10. return r. return r; } }); } if you need to support truly obsolete javascript engines that don't support object.defineproperty, it's best not to polyfill array.prototype methods at all, as you can't make them non-enumerable. examples using locales a...
Atomics.sub() - JavaScript
the static atomics.sub() method substracts a given value at a given position in the array and returns the old value at that position. this atomic operation guarantees that no other write happens until the modified value is written back. the source for this interactive example is stored in a github repository. if 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 atomics.sub(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to subtract a value from. ...
... exceptions throws a typeerror, if typedarray is not one of the allowed integer types. ...
...se clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.sub(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to subtract a value from. value the number to subtract. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. ...
... to subtract. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using sub const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); ta[0] = 48; atomics.sub(ta, 0, 12); // returns 48, the old value atomics.load(ta, 0); // 36 specifications specification ecmascript (ecma-262)the definition of 'atomics.sub' in that specification. ...
BigInt - JavaScript
") // ↪ 9007199254740991n const hugebin = bigint("0b11111111111111111111111111111111111111111111111111111") // ↪ 9007199254740991n bigint is similar to number in some ways, but also differs in a few key matters — it cannot be used with methods in the built-in math object and cannot be mixed with instances of number in operations; they must be coerced to the same type. be careful coercing values back and forth, however, as the precision of a bigint may be lost when it is coerced to a number. type information when tested against typeof, a bigint will give "bigint": typeof 1n === 'bigint' // true typeof bigint('1') === 'bigint' // true when wrapped in an object, a bigint will be considered as a normal "object" type: typeof object(1n) === 'object' // true operators the...
...ed with logical operators ||, &&, and !; or within a conditional test like an if statement. if (0n) { console.log('hello from the if!') } else { console.log('hello from the else!') } // ↪ "hello from the else!" 0n || 12n // ↪ 12n 0n && 12n // ↪ 0n boolean(0n) // ↪ false boolean(12n) // ↪ true !12n // ↪ false !0n // ↪ true constructor bigint() creates a new bigint value. static methods bigint.asintn() wraps a bigint value to a signed integer between -2width-1 and 2width-1 - 1. bigint.asuintn() wraps a bigint value to an unsigned integer between 0 and 2width - 1. instance methods bigint.prototype.tolocalestring() returns a string with a language-sensitive representation of this number. overrides the object.prototype.tolocalestring() method. bigint.
...nteger between 0 and 2width - 1. instance methods bigint.prototype.tolocalestring() returns a string with a language-sensitive representation of this number. overrides the object.prototype.tolocalestring() method. bigint.prototype.tostring() returns a string representing the specified object in the specified radix (base). overrides the object.prototype.tostring() method. bigint.prototype.valueof() returns the primitive value of the specified object. overrides the object.prototype.valueof() method. usage recommendations coercion because coercing between number and bigint can lead to loss of precision, it is recommended to only use bigint when values greater than 253 are reasonably expected and not to coerce between the two types. cryptography the operations supported on bigints a...
...ercion because coercing between number and bigint can lead to loss of precision, it is recommended to only use bigint when values greater than 253 are reasonably expected and not to coerce between the two types. cryptography the operations supported on bigints are not constant time. bigint is therefore unsuitable for use in cryptography. use within json using json.stringify() with any bigint value will raise a typeerror as bigint values aren't serialized in json by default. however, you can implement your own tojson method if needed: bigint.prototype.tojson = function() { return this.tostring() } instead of throwing, json.stringify now produces a string like this: json.stringify(bigint(1)) // '"1"' examples calculating primes // returns true if passed bigint is a prime number functi...
Date.prototype.getYear() - JavaScript
the getyear() method returns the year in the specified date according to local time. because getyear() does not return full years ("year 2000 problem"), it is no longer used and has been replaced by the getfullyear() method. syntax dateobj.getyear() return value a number representing the year of the given date, according to local time, minus 1900. description for years greater than or equal to 2000, the value returned by getyear() is 100 or greater. for example, if the year is 2026, getyear() returns 126. for years between and including 1900 and 1999, the value returned by getyear() is between 0 and 99. for example, if the year is 1976, getyear() returns 76. for years less than 1900, the value returned by getyear() is less than 0. for example, if the year is 1800, getyear() returns...
...() is less than 0. for example, if the year is 1800, getyear() returns -100. to take into account years before and after 2000, you should use getfullyear() instead of getyear() so that the year is specified in full. backward compatibility behavior in javascript 1.2 and earlier the getyear() method returns either a 2-digit or 4-digit year: for years between and including 1900 and 1999, the value returned by getyear() is the year minus 1900. for example, if the year is 1976, the value returned is 76. for years less than 1900 or greater than 1999, the value returned by getyear() is the four-digit year. for example, if the year is 1856, the value returned is 1856. if the year is 2026, the value returned is 2026. examples years between 1900 and 1999 the second statement assigns the valu...
... by getyear() is the four-digit year. for example, if the year is 1856, the value returned is 1856. if the year is 2026, the value returned is 2026. examples years between 1900 and 1999 the second statement assigns the value 95 to the variable year. var xmas = new date('december 25, 1995 23:15:00'); var year = xmas.getyear(); // returns 95 years above 1999 the second statement assigns the value 100 to the variable year. var xmas = new date('december 25, 2000 23:15:00'); var year = xmas.getyear(); // returns 100 years below 1900 the second statement assigns the value -100 to the variable year. ...
... var xmas = new date('december 25, 2015 23:15:00'); xmas.setyear(95); var year = xmas.getyear(); // returns 95 specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getyear' in that specification. ...
Date.prototype.setMonth() - JavaScript
the setmonth() method sets the month for a specified date according to the currently set year. syntax dateobj.setmonth(monthvalue[, dayvalue]) versions prior to javascript 1.3 dateobj.setmonth(monthvalue) parameters monthvalue a zero-based integer representing the month of the year offset from the start of the year. so, 0 represents january, 11 represents december, -1 represents december of the previous year, and 12 represents january of the following year. dayvalue optional. an integer from 1 to 31, representing the day of the month. return value the number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if you do not specify the dayvalue parameter, the value returned from the getdate() method is used. if a parameter you specify is outs...
...th. return value the number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if you do not specify the dayvalue parameter, the value returned from the getdate() method is used. if a parameter you specify is outside of the expected range, setmonth() attempts to update the date information in the date object accordingly. for example, if you use 15 for monthvalue, the year will be incremented by 1, and 3 will be used for month. the current day of month will have an impact on the behaviour of this method. conceptually it will add the number of days given by the current day of the month to the 1st day of the new month specified as the parameter, to return the new date. ...
...this is because in 2016 february had 29 days. ...
...this is because in 2016 february had 29 days. ...
Date.prototype.setSeconds() - JavaScript
the setseconds() method sets the seconds for a specified date according to local time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... the setseconds() method sets the seconds for a specified date according to local time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... the seconds for a specified date according to local time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.setseconds(secondsvalue[, msvalue]) versions prior to javascript 1.3 dateobj.setseconds(secondsvalue) parameters secondsvalue an integer between 0 and 59, representing the seconds. msvalue optional. a number between 0 and 999, representing the milliseconds. return value the number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if you do not specify the msvalue parameter, the value returned from the getmilliseconds() method is used. if a paramet...
... examples using setseconds() var thebigday = new date(); thebigday.setseconds(30); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.setseconds' in that specification. ...
Date.prototype.setUTCDate() - JavaScript
the setutcdate() method sets the day of the month for a specified date according to universal time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... the setutcdate() method sets the day of the month for a specified date according to universal time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...cified date according to universal time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.setutcdate(dayvalue) parameters dayvalue an integer from 1 to 31, representing the day of the month. return value the number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. ...
...etutcdate(dayvalue) parameters dayvalue an integer from 1 to 31, representing the day of the month. return value the number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if a parameter you specify is outside of the expected range, setutcdate() attempts to update the date information in the date object accordingly. for example, if you use 40 for dayvalue, and the month stored in the date object is june, the day will be changed to 10 and the month will be incremented to july. examples using setutcdate() var thebigday = new date(); thebigday.setutcdate(20); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.setutcdate' in that specification. ...
Date.prototype.setUTCMilliseconds() - JavaScript
the setutcmilliseconds() method sets the milliseconds for a specified date according to universal time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...liseconds() method sets the milliseconds for a specified date according to universal time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...universal time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.setutcmilliseconds(millisecondsvalue) parameters millisecondsvalue a number between 0 and 999, representing the milliseconds. return value the number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. ...
...ters millisecondsvalue a number between 0 and 999, representing the milliseconds. return value the number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if a parameter you specify is outside of the expected range, setutcmilliseconds() attempts to update the date information in the date object accordingly. for example, if you use 1100 for millisecondsvalue, the seconds stored in the date object will be incremented by 1, and 100 will be used for milliseconds. examples using setutcmilliseconds() var thebigday = new date(); thebigday.setutcmilliseconds(500); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.setutcmilliseconds' in that specification. ...
Date.prototype.toLocaleString() - JavaScript
ments customize the behavior of the function and let applications specify the language whose formatting conventions should be used. in implementations, which ignore the locales and options arguments, the locale used and the form of the string returned are entirely implementation dependent. see the intl.datetimeformat() constructor for details on these parameters and how to use them. the default value for each date-time component property is undefined. but, if the weekday, year, month, and day properties are all undefined, then year, month, and day are assumed to be "numeric". return value a string representing the given date according to language-specific conventions. performance when formatting large numbers of dates, it is better to create an intl.datetimeformat object and use the func...
...however, this might change in the future, and isn't guaranteed for all languages; output variations are by design, and allowed by the specification. most notably, the ie and edge browsers insert bidirectional control characters around dates, so the output text will flow properly when concatenated with...
...however, this might change in the future, and isn't guaranteed for all languages; output variations are by design, and allowed by the specification. most notably, the ie and edge browsers insert bidirectional control characters around dates, so the output text will flow properly when concatenated with other text. for...
...t change in the future, and isn't guaranteed for all languages; output variations are by design, and allowed by the specification. most notably, the ie and edge browsers insert bidirectional control characters around dates, so the output text will flow properly when concatenated with other text. for this reason, you cannot expect to be able to compare the results of tolocalestring() to a static value: "1/1/2019, 01:00:00" === new date("2019-01-01t01:00:00z").tolocalestring("en-us"); // true in firefox and others // false in ie and edge note: see also this stackoverflow thread for more details and examples. specifications specification ecmascript (ecma-262)the definition of 'date.prototype.tolocalestring' in that specification. ecmascript internationalizati...
Error.prototype.stack - JavaScript
hese from the error thrown (but only the error, and not its trace).) note that this is the format used by firefox. there is no standard formatting. however, safari 6+ and opera 12- use a very similar format. browsers using the v8 javascript engine (such as chrome, opera 15+, android browser) and ie10+, on the other hand, uses a different format (see the archived msdn error.stack docs). ...
...rmat used by firefox. there is no standard formatting. however, safari 6+ and opera 12- use a very similar format. browsers using the v8 javascript engine (such as chrome, opera 15+, android browser) and ie10+, on the other hand, uses a different format (see the archived msdn error.stack docs). argument values in the stack: prior to firefox 14, the function name would be followed by the argument values converted to string in parentheses immediately before the at (@) sign. ...
...different format (see the archived msdn error.stack docs). argument values in the stack: prior to firefox 14, the function name would be followed by the argument values converted to string in parentheses immediately before the at (@) sign. while an object (or array, etc.) would appear in the converted form "[object object]", and as such could not be evaluated back into the actual objects, scalar values could be retrieved (though it may be — it is still possible in firefox 14 — easier to use arguments.callee.caller.arguments, as could the function name be retrieved by arguments.callee.caller.name). "undefined" is listed as "(void 0)". ...
...verted form "[object object]", and as such could not be evaluated back into the actual objects, scalar values could be retrieved (though it may be — it is still possible in firefox 14 — easier to use arguments.callee.caller.arguments, as could the function name be retrieved by arguments.callee.caller.name). "undefined" is listed as "(void 0)". note that if string arguments were passed in with values such as "@", "(", ")" (or if in file names), you could not easily rely on these for breaking the line into its component parts. thus, in firefox 14 and later this is less of an issue. different browsers set this value at different times. for example, firefox sets it when creating an error object, while phantomjs sets it only when throwing the error, and archived msdn docs also seem to match the...
Intl.Collator - JavaScript
llator.prototype.resolvedoptions() returns a new object with properties reflecting the locale and collation options computed during initialization of the object. examples using collator the following example demonstrates the different potential results for a string occurring before, after, or at the same level as another: console.log(new intl.collator().compare('a', 'c')); // → a negative value console.log(new intl.collator().compare('c', 'a')); // → a positive value console.log(new intl.collator().compare('a', 'a')); // → 0 note that the results shown in the code above can vary between browsers and browser versions. this is because the values are implementation-specific. that is, the specification requires only that the before and after values are negative and positive. using lo...
...ve. using locales the results provided by collator.prototype.compare() vary between languages. ...
...he sort order of the language used in the user interface of your application, make sure to specify that language (and possibly some fallback languages) using the locales argument: // in german, ä sorts with a console.log(new intl.collator('de').compare('ä', 'z')); // → a negative value // in swedish, ä sorts after z console.log(new intl.collator('sv').compare('ä', 'z')); // → a positive value using options the results provided by collator.prototype.compare() can be customized using the options argument: // in german, ä has a as the base letter console.log(new intl.collator('de', { sensitivity: 'base' }).compare('ä', 'a')); // → 0 // in swedish, ä and a are separate base letters console.log(new intl.collator('sv', { sensitivity: 'base' }).compare('ä', 'a')); // → a positiv...
... ...
Intl.DateTimeFormat.prototype.formatRangeToParts() - JavaScript
nge. ...
...07, 0, 10, 10, 0, 0)); let date2 = new date(date.utc(2007, 0, 10, 11, 0, 0)); // > 'wed, 10 jan 2007 10:00:00 gmt' // > 'wed, 10 jan 2007 11:00:00 gmt' let fmt = new intl.datetimeformat("en", { hour: 'numeric', minute: 'numeric' }); console.log(fmt.formatrange(date1, date2)); // > '10:00 – 11:00 am' fmt.formatrangetoparts(date1, date2); // return value: // [ // { type: 'hour', value: '10', source: "startrange" }, // { type: 'literal', value: ':', source: "startrange" }, // { type: 'minute', value: '00', source: "startrange" }, // { type: 'literal', value: ' – ', source: "shared" }, // { type: 'hour', value: '11', source: "endrange" }, // { type: 'literal', value: ':', source: "endrange" }, // { type: 'minute', value: '00', sourc...
... ...
... ...
Intl.DateTimeFormat.prototype.resolvedOptions() - JavaScript
s reflecting the locale and date and time formatting options computed during initialization of this datetimeformat object. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... and send us a pull request. syntax datetimeformat.resolvedoptions() return value a new object with properties reflecting the locale and date and time formatting options computed during the initialization of the given datetimeformat 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. calendar e.g. "gregory" numberingsystem the values requested using the unicode extension keys "ca" and "nu" or filled in as default values. ...
...age 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. calendar e.g. "gregory" numberingsystem the values requested using the unicode extension keys "ca" and "nu" or filled in as default values. timezone the value provided for this property in the options argument; undefined (representing the runtime's default time zone) if none was provided. warning: applications should not rely on undefined being returned, as future versions may return a string value identifying the runtime’s default time zone instead. hour12 the value provided for this property in the options argument or filled in as a default. wee...
...senting the runtime's default time zone) if none was provided. warning: applications should not rely on undefined being returned, as future versions may return a string value identifying the runtime’s default time zone instead. hour12 the value provided for this property in the options argument or filled in as a default. weekday era year month day hour minute second timezonename the values resulting from format matching between the corresponding properties in the options argument and the available combinations and representations for date-time formatting in the selected locale. some of these properties may not be present, indicating that the corresponding components will not be represented in formatted output. examples using the resolvedoptions method var germanfakeregion = ne...
Intl​.List​Format​.prototype​.formatToParts() - JavaScript
the intl.listformat.prototype.formattoparts() method returns an array of objects representing the different components that can be used to format a list of values in a locale-aware fashion. syntax intl.listformat.prototype.formattoparts(list) parameters list an array of values to be formatted according to a locale. return value an array of components which contains the formatted parts from the list. ...
... the locale and style options used for formatting are given when constructing the intl.listformat instance. ...
...s from the list. description whereas intl.listformat.prototype.format() returns a string being the formated version of the list (according to the given locale and style options), formattoparts() returns an array of the different components of the formated string. each element of the resulting array has two properties: type and value. the type property may be either "element", which refers to a value from the list, or "literal" which refers to a linguistic construct. the value property gives the content, as a string, of the token. the locale and style options used for formatting are given when constructing the intl.listformat instance. examples using formattoparts const fruits = ['apple', 'orange', 'pineapple']; const mylistformat = new intl.listformat('en-gb', { style: 'long', type: 'con...
... content, as a string, of the token. the locale and style options used for formatting are given when constructing the intl.listformat instance. examples using formattoparts const fruits = ['apple', 'orange', 'pineapple']; const mylistformat = new intl.listformat('en-gb', { style: 'long', type: 'conjunction' }); console.table(mylistformat.formattoparts(fruits)); // [ // { "type": "element", "value": "apple" }, // { "type": "literal", "value": ", " }, // { "type": "element", "value": "orange" }, // { "type": "literal", "value": ", and " }, // { "type": "element", "value": "pineapple" } // ] specifications specification intl.listformatthe definition of 'formattoparts()' in that specification. ...
Intl​.List​Format​.prototype​.resolvedOptions() - JavaScript
the intl.listformat.prototype.resolvedoptions() method returns a new object with properties reflecting the locale and style formatting options computed during the construction of the current listformat object. syntax listformat.resolvedoptions() return value an object with properties reflecting the locale and formatting options computed during the construction of the given listformat object. description the object returned by resolvedoptions() has the following properties: locale the bcp 47 language tag for the locale actually used. ...
...n of the current listformat object. syntax listformat.resolvedoptions() return value an object with properties reflecting the locale and formatting options computed during the construction of the given listformat object. description the object returned by resolvedoptions() 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 value provided for this property in the options argument of the constructor or the default value ("long"). ...
...perties: 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 value provided for this property in the options argument of the constructor or the default value ("long"). its value is either "long", "short", or "narrow". type the value provided for this property in the options argument of the constructor or the default value ("conjunction"). its value is either "conjunction", "disjunction", or "unit". examples using resolvedoptions const delistformatter = new intl.listformat("de-de", { style: "short" }); const usedoptions = de.resolvedoptions(); console.log(usedoptio...
... the default value ("conjunction"). its value is either "conjunction", "disjunction", or "unit". examples using resolvedoptions const delistformatter = new intl.listformat("de-de", { style: "short" }); const usedoptions = de.resolvedoptions(); console.log(usedoptions.locale); // "de-de" console.log(usedoptions.style); // "short" console.log(usedoptions.type); // "conjunction" (the default value) specifications specification intl.listformatthe definition of 'resolvedoptions()' in that specification. ...
Intl.Locale.prototype.caseFirst - JavaScript
efirst property is an accessor property that returns whether case is taken into account for the locale's collation rules. description a locale's collation rules are used to determine how strings are ordered in that locale. certain locales use a character's case (uppercase or lowercase) in the collation process. this additional rule can be expressed in a locale's casefirst property. ...
...nt for the locale's collation rules. description a locale's collation rules are used to determine how strings are ordered in that locale. certain locales use a character's case (uppercase or lowercase) in the collation process. this additional rule can be expressed in a locale's casefirst property. there are 3 values that the casefirst property can have, outlined in the table below. casefirst values value description upper upper case to be sorted before lower case. lower lower case to be sorted before upper case. false no special case ordering. examples setting the casefirst value via the locale string in the unicode locale string spec, the values that casefirst represents correspond to the key kf. kf is treated as a locale strin...
... false no special case ordering. examples setting the casefirst value via the locale string in the unicode locale string spec, the values that casefirst represents correspond to the key kf. kf is treated as a locale string "extension subtag". these subtags add additional data about the locale, and are added to locale identifiers by using the -u extension key. thus, the casefirst value can be added to the inital locale identifier string that is passed into the locale constructor. to add the casefirst value, first add the -u extension key to the string. next, add the -kf extension key to indicate that you are adding a value for casefirst. finally, add the casefirst value to the string. let casefirststr = new intl.locale("fr-latn-fr-u-kf-upper"); console.log(casefirststr.casefir...
...string that is passed into the locale constructor. to add the casefirst value, first add the -u extension key to the string. next, add the -kf extension key to indicate that you are adding a value for casefirst. finally, add the casefirst value to the string. let casefirststr = new intl.locale("fr-latn-fr-u-kf-upper"); console.log(casefirststr.casefirst); // prints "upper" setting the casefirst value via the configuration object argument the intl.locale constructor has an optional configuration object argument, which can be used to pass extension types. set the casefirst property of the configuration object to your desired casefirst value, and then pass it into the constructor. let casefirstobj= new intl.locale("en-latn-us", {casefirst: "lower"}); console.log(us12hour.casefirst); // prints ...
Intl.Locale.prototype.numberingSystem - JavaScript
for expressing numbers. the numberingsystem property helps to represent the different numeral systems used by various countries, regions, and cultures around the world. as with most internationalization schemas, the numeral systems that can be represented in a locale object by numberingsystem are standardized by unicode. a table of the standard unicode numeral systems can be seen below. ...
...merals — algorithmic tamldec modern tamil decimal digits telu telugu digits thai thai digits tirh tirhuta digits tibt tibetan digits traditio traditional numerals — may be algorithmic vaii vai digits wara warang citi digits wcho wancho digits examples setting the numberingsystem value via the locale string in the unicode locale string spec, the values that numberingsystem represents correspond to the key nu. nu is considered a locale string "extension subtag". these subtags add additional data about the locale, and are added to locale identifiers by first adding the -u key. to set the numberingsystem value via the string argument to the locale constructor, first add the -u ex...
...eringsystem represents correspond to the key nu. nu is considered a locale string "extension subtag". these subtags add additional data about the locale, and are added to locale identifiers by first adding the -u key. to set the numberingsystem value via the string argument to the locale constructor, first add the -u extension key. next, add the -nu extension key to indicate that you are adding a value for numberingsystem. finally, add the numberingsystem value to the string. ...
...alue via the string argument to the locale constructor, first add the -u extension key. next, add the -nu extension key to indicate that you are adding a value for numberingsystem. finally, add the numberingsystem value to the string. let numberingsystemviastr = new intl.locale("fr-latn-fr-u-nu-mong"); console.log(numberingsystemstr.numberingsystem); // prints "mong" setting the numberingsystem value via the configuration object argument the intl.locale constructor has an optional configuration object argument, which can be used to pass extension types. set the numberingsystem property of the configuration object to your desired numberingsystem value and pass it into the constructor. let numberingsystemviaobj= new intl.locale("en-latn-us", {numberingsystem: "latn"}); console.log(us12hour.nu...
Intl.NumberFormat.prototype.formatToParts() - JavaScript
the intl.numberformat.prototype.formattoparts() method allows locale-aware formatting of strings produced by numberformat formatters. syntax intl.numberformat.prototype.formattoparts(number) parameters number optional a number or bigint to format. return value an array of objects containing the formatted number in parts. description the formattoparts() method is useful for custom formatting of number strings. ...
...ray of objects containing the formatted number in parts. description the formattoparts() method is useful for custom formatting of number strings. it returns an array of objects containing the locale-specific tokens from which it possible to build custom strings while preserving the locale-specific parts. the structure the formattoparts() method returns, looks like this: [ { type: "integer", value: "3" }, { type: "group", value: "." }, { type: "integer", value: "500" } ] possible types are the following: currency the currency string, such as the symbols "$" and "€" or the name "dollar", "euro" depending on how currencydisplay is specified. decimal the decimal separator string ("."). fraction the fraction number. group the group separator string (","). infinity the infini...
...ntl.numberformat('de-de', { style: 'currency', currency: 'eur' }); formatter.format(number); // "3.500,00 €" however, in many user interfaces there is a desire to customize the formatting of this string. the formattoparts method enables locale-aware formatting of strings produced by numberformat formatters by providing you the string in parts: formatter.formattoparts(number); // return value: [ { type: "integer", value: "3" }, { type: "group", value: "." }, { type: "integer", value: "500" }, { type: "decimal", value: "," }, { type: "fraction", value: "00" }, { type: "literal", value: " " }, { type: "currency", value: "€" } ] now the information is available separately and it can be formatted and concatenated again in a customized way. for example b...
...ue: "00" }, { type: "literal", value: " " }, { type: "currency", value: "€" } ] now the information is available separately and it can be formatted and concatenated again in a customized way. for example by using array.prototype.map(), arrow functions, a switch statement, template literals, and array.prototype.reduce(). var numberstring = formatter.formattoparts(number).map(({type, value}) => { switch (type) { case 'currency': return `<strong>${value}</strong>`; default : return value; } }).reduce((string, part) => string + part); this will make the currency bold, when using the formattoparts() method. console.log(numberstring); // "3.500,00 <strong>€</strong>" specifications specification ecmascript internationalization api (ecma-402)the ...
Intl.PluralRules() constructor - JavaScript
les objects. syntax new intl.pluralrules([locales[, options]]) parameters locales optional. a string with a bcp 47 language tag, or an array of such strings. for the general form and interpretation of the locales argument, see the intl page. options optional. an object with some or all of the following properties: localematcher the locale matching algorithm to use. possible values are "lookup" and "best fit"; the default is "best fit". for information about this option, see the intl page. type the type to use. possible values are: "cardinal" for cardinal numbers (refering to the quantity of things). this is the default value. "ordinal" for ordinal number (refering to the ordering or ranking of things, e.g. "1st", "2nd", "3rd" in english). the follow...
...glish). the following properties fall into two groups: minimumintegerdigits, minimumfractiondigits, and maximumfractiondigits in one group, minimumsignificantdigits and maximumsignificantdigits in the other. if at least one property from the second group is defined, then the first group is ignored. minimumintegerdigits the minimum number of integer digits to use. possible values are from 1 to 21; the default is 1. minimumfractiondigits the minimum number of fraction digits to use. possible values are from 0 to 20; the default for plain number and percent formatting is 0; the default for currency formatting is the number of minor unit digits provided by the iso 4217 currency code list (2 if the list doesn't provide that information). maximumfractiondigits the max...
...ractiondigits the minimum number of fraction digits to use. possible values are from 0 to 20; the default for plain number and percent formatting is 0; the default for currency formatting is the number of minor unit digits provided by the iso 4217 currency code list (2 if the list doesn't provide that information). maximumfractiondigits the maximum number of fraction digits to use. possible values are from 0 to 20; the default for plain number formatting is the larger of minimumfractiondigits and 3; the default for currency formatting is the larger of minimumfractiondigits and the number of minor unit digits provided by the iso 4217 currency code list (2 if the list doesn't provide that information); the default for percent formatting is the larger of minimumfractiondigits and 0. minimu...
...nimumfractiondigits and 3; the default for currency formatting is the larger of minimumfractiondigits and the number of minor unit digits provided by the iso 4217 currency code list (2 if the list doesn't provide that information); the default for percent formatting is the larger of minimumfractiondigits and 0. minimumsignificantdigits the minimum number of significant digits to use. possible values are from 1 to 21; the default is 1. maximumsignificantdigits the maximum number of significant digits to use. possible values are from 1 to 21; the default is 21. examples basic usage in basic use without specifying a locale, a formatted string in the default locale and with default options is returned. this is useful to distinguish between singular and plural forms, e.g. "dog" and "...
Math.max() - JavaScript
the math.max() function returns the largest of the zero or more numbers given as input parameters. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.max([value1[, value2[, ...]]]) parameters value1, value2, ... numbers. ...
...eturns the largest of the zero or more numbers given as input parameters. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.max([value1[, value2[, ...]]]) parameters value1, value2, ... numbers. return value the largest of the given numbers. ...
... if at least one of arguments cannot be converted to a number, the result is nan. ...
... bigger, that's why when no arguments are given, -infinity is returned. if at least one of arguments cannot be converted to a number, the result is nan. examples using math.max() math.max(10, 20); // 20 math.max(-10, -20); // -10 math.max(-10, 20); // 20 getting the maximum element of an array array.reduce() can be used to find the maximum element in a numeric array, by comparing each value: var arr = [1,2,3]; var max = arr.reduce(function(a, b) { return math.max(a, b); }); the following function uses function.prototype.apply() to get the maximum of an array. getmaxofarray([1, 2, 3]) is equivalent to math.max(1, 2, 3), but you can use getmaxofarray() on programmatically constructed arrays. this should only be used for arrays with relatively few elements. function getmaxofarr...
Number.isFinite() - JavaScript
the number.isfinite() method determines whether the passed value is a finite number. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax number.isfinite(value) parameters value the value to be tested for finiteness. return value a boolean indicating whether or not the given value is a finite number. description in comparison to the global isfinite() function, this method doesn't forcibly convert the parameter to a number. this means only values of the type number, that are also finite, return true. ...
...lue to be tested for finiteness. return value a boolean indicating whether or not the given value is a finite number. description in comparison to the global isfinite() function, this method doesn't forcibly convert the parameter to a number. this means only values of the type number, that are also finite, return true. ...
...ness. return value a boolean indicating whether or not the given value is a finite number. description in comparison to the global isfinite() function, this method doesn't forcibly convert the parameter to a number. this means only values of the type number, that are also finite, return true. ...
... indicating whether or not the given value is a finite number. description in comparison to the global isfinite() function, this method doesn't forcibly convert the parameter to a number. this means only values of the type number, that are also finite, return true. ...
Object.seal() - JavaScript
the object.seal() method seals an object, preventing new properties from being added to it and marking all existing properties as non-configurable. values of present properties can still be changed as long as they are writable. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.seal(obj) parameters obj the object which should be sealed. return value the object being sealed. description by default, objects are extensible (new properties can be added to them). sealing an object prevents new properties from being added and marks all existing properties as non-configurable. this has the effect of ma...
...operties can be added to them). sealing an object prevents new properties from being added and marks all existing properties as non-configurable. this has the effect of making the set of properties on the object fixed and immutable. making all properties non-configurable also prevents them from being converted from data properties to accessor properties and vice versa, but it does not prevent the values of data properties from being changed. attempting to delete or add properties to a sealed object, or to convert a data property to accessor or vice versa, will fail, either silently or by throwing a typeerror (most commonly, although not exclusively, when in strict mode code). the prototype chain remains untouched. however, the __proto__ property is sealed as well. comparison to object.freeze(...
... objects sealed with object.seal() can have their existing properties changed. examples using object.seal var obj = { prop: function() {}, foo: 'bar' }; // new properties may be added, existing properties // may be changed or removed. obj.foo = 'baz'; obj.lumpy = 'woof'; delete obj.prop; var o = object.seal(obj); o === obj; // true object.issealed(obj); // === true // changing property values on a sealed object // still works. obj.foo = 'quux'; // but you can't convert data properties to accessors, // or vice versa. object.defineproperty(obj, 'foo', { get: function() { return 'g'; } }); // throws a typeerror // now any changes, other than to property values, // will fail. obj.quaxxor = 'the friendly duck'; // silently doesn't add the property delete obj.foo; // silently doesn't d...
...// silently doesn't add the property delete obj.foo; // silently doesn't delete the property // ...and in strict mode such attempts // will throw typeerrors. function fail() { 'use strict'; delete obj.foo; // throws a typeerror obj.sparky = 'arf'; // throws a typeerror } fail(); // attempted additions through // object.defineproperty will also throw. object.defineproperty(obj, 'ohai', { value: 17 }); // throws a typeerror object.defineproperty(obj, 'foo', { value: 'eit' }); // changes existing property value non-object coercion 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 treated as if it was a sealed ordinary object by simply returning it. object.seal(1); // typeerror: 1 is not an...
Object.setPrototypeOf() - JavaScript
gine developers address this issue, if you are concerned about performance, you should avoid setting the [[prototype]] of an object. instead, create a new object with the desired [[prototype]] using object.create(). syntax object.setprototypeof(obj, prototype) parameters obj the object which is to have its prototype set. prototype the object's new prototype (an object or null). return value the specified object. description throws a typeerror exception if the object whose [[prototype]] is to be modified is non-extensible according to object.isextensible(). does nothing if the prototype parameter isn't an object or null (i.e., number, string, boolean, or undefined). otherwise, this method changes the [[prototype]] of obj to the new value. object.setprototypeof() is in the ecmascr...
..., vs. the more controversial object.prototype.__proto__ property. appending prototype chains a combination of object.getprototypeof() and object.prototype.__proto__ permits appending a whole prototype chain to a new prototype object: /** *** object.appendchain(@object, @prototype) * * appends the first non-native prototype of a chain to a new prototype. * returns @object (if it was a primitive value it will transformed into an object). * *** object.appendchain(@object [, "@arg_name_1", "@arg_name_2", "@arg_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") ...
...es(smammalspecies) { this.species = smammalspecies; } mammalspecies.prototype = new mammal(); mammalspecies.prototype.constructor = mammalspecies; var ocat = new mammalspecies('felis'); console.log(ocat.ismammal); // 'yes' function animal() { this.breathing = 'yes'; } object.appendchain(ocat, new animal()); console.log(ocat.breathing); // 'yes' second example: transforming a primitive value into an instance of its constructor and append its chain to a prototype function mysymbol() { this.issymbol = 'yes'; } var nprime = 17; console.log(typeof nprime); // 'number' var oprime = object.appendchain(nprime, new mysymbol()); console.log(oprime); // '17' console.log(oprime.issymbol); // 'yes' console.log(typeof oprime); // 'object' third example: appending a chain to the function.
... ...
Object.prototype.toString() - JavaScript
the tostring() method returns a string representing the 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 obj.tostring() return value a string representing the object. description every object has a tostring() method that is automatically called when the object is to be represented as a text value or when an object is referred to in a manner in which a string is expected. by default, the tostring() method is inherited by every object descended from object. if this method is not overridden in a custom object, tostring() returns "[object type]", where type is the object type. the following code illust...
...s: const o = new object(); o.tostring(); // returns [object object] note: starting in javascript 1.8.5, tostring() called on null returns [object null], and undefined returns [object undefined], as defined in the 5th edition of ecmascript and subsequent errata. see using tostring() to detect object class. parameters for numbers and bigints tostring() takes an optional parameter radix the value of radix must be minimum 2 and maximum 36. by using radix you can also convert base 10 numbers (like 1,2,3,4,5,.........) to another base numbers, in example below we are converting base 10 number to a base 2 (binary) number let basetenint = 10; console.log(basetenint.tostring(2)); // expected output is "1010" and same for big integers let bignum = bigint(20); console.log(bignum.tostring...
... expected output is "10100" some common radix are 2 for binary numbers, 8 for octal numbers, 10 for decimal numbers, 16 for hexadecimal numbers. examples overriding the default tostring method you can create a function to be called in place of the default tostring() method. the tostring() method takes no arguments and should return a string. the tostring() method you create can be any value you want, but it will be most useful if it carries information about the object. the following code defines the dog object type and creates thedog, an object of type dog: function dog(name, breed, color, sex) { this.name = name; this.breed = breed; this.color = color; this.sex = sex; } thedog = new dog('gabby', 'lab', 'chocolate', 'female'); if you call the tostring() method on this ...
...if it carries information about the object. the following code defines the dog object type and creates thedog, an object of type dog: function dog(name, breed, color, sex) { this.name = name; this.breed = breed; this.color = color; this.sex = sex; } thedog = new dog('gabby', 'lab', 'chocolate', 'female'); if you call the tostring() method on this custom object, it returns the default value inherited from object: thedog.tostring(); // returns [object object] the following code creates and assigns dogtostring() to override the default tostring() method. this function generates a string containing the name, breed, color, and sex of the object, in the form "property = value;". dog.prototype.tostring = function dogtostring() { const ret = 'dog ' + this.name + ' is a ' + this.sex +...
handler.defineProperty() - JavaScript
t p = new proxy(target, { defineproperty: function(target, property, descriptor) { } }); parameters the following parameters are passed to the defineproperty() method. this is bound to the handler. target the target object. property the name or symbol of the property whose description is to be retrieved. descriptor the descriptor for the property being defined or modified. return value the defineproperty() method must return a boolean indicating whether or not the property has been successfully defined. description the handler.defineproperty() method is a trap for object.defineproperty(). interceptions this trap can intercept these operations: object.defineproperty() reflect.defineproperty() invariants if the following invariants are violated, the proxy will throw a...
...s or modified to be non-configurable, if it does not exists as a non-configurable own property of the target object. a property may not be non-configurable, if a corresponding configurable property of the target object exists. if a property has a corresponding target object property then object.defineproperty(target, prop, descriptor) will not throw an exception. ...
...ption. in strict mode, a false return value from the defineproperty() handler will throw a typeerror exception. examples trapping of defineproperty the following code traps object.defineproperty(). ...
... return true; } }); const desc = { configurable: true, enumerable: true, value: 10 }; object.defineproperty(p, 'a', desc); // "called: a" when calling object.defineproperty() or reflect.defineproperty(), the descriptor passed to defineproperty() trap has one restriction—only following properties are usable (non-standard properties will be ignored): enumerable configurable writable value get set const p = new proxy({}, { defineproperty(target, prop, descriptor) { console.log(descriptor); return reflect.defineproperty(target, prop, descriptor); } }); object.defineproperty(p, 'name', { value: 'proxy', type: 'custom' }); // { value: 'proxy' } specifications specification ecmascript (ecma-262)the definition of '[[defineownproperty]]' in ...
handler.get() - JavaScript
the handler.get() method is a trap for getting a property value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax const p = new proxy(target, { get: function(target, property, receiver) { } }); parameters the following parameters are passed to the get() method. this is bound to the handler. target the target object. property the name or symbol of the property to get. receiver either the proxy or an object that inherits from the proxy. return value the get() method can return any value. description the handler.get() method is a trap for getting a property value. interceptions this trap c...
...return value the get() method can return any value. description the handler.get() method is a trap for getting a property value. interceptions this trap can intercept these operations: property access: proxy[foo]and proxy.bar inherited property access: object.create(proxy)[foo] reflect.get() invariants if the following invariants are violated, the proxy will throw a typeerror: the value reported for a property must be the same as the value of the corresponding target object property if the target object property is a non-writable, non-configurable own data property. the value reported for a property must be undefined if the corresponding target object property is a non-configurable own accessor property that has undefined as its [[get]] attribute. examples trap for getting a...
...for a property must be the same as the value of the corresponding target object property if the target object property is a non-writable, non-configurable own data property. the value reported for a property must be undefined if the corresponding target object property is a non-configurable own accessor property that has undefined as its [[get]] attribute. examples trap for getting a property value the following code traps getting a property value. const p = new proxy({}, { get: function(target, property, receiver) { console.log('called: ' + property); return 10; } }); console.log(p.a); // "called: a" // 10 the following code violates an invariant. ...
...operty value the following code traps getting a property value. const p = new proxy({}, { get: function(target, property, receiver) { console.log('called: ' + property); return 10; } }); console.log(p.a); // "called: a" // 10 the following code violates an invariant. const obj = {}; object.defineproperty(obj, 'a', { configurable: false, enumerable: false, value: 10, writable: false }); const p = new proxy(obj, { get: function(target, property) { return 20; } }); p.a; // typeerror is thrown specifications specification ecmascript (ecma-262)the definition of '[[get]]' in that specification. ...
Reflect.getOwnPropertyDescriptor() - JavaScript
n a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax reflect.getownpropertydescriptor(target, propertykey) parameters target the target object in which to look for the property. propertykey the name of the property to get an own property descriptor for. return value a property descriptor object if the property exists in target object; otherwise, undefined. exceptions a typeerror, if target is not an object. description the reflect.getownpropertydescriptor method returns a property descriptor of the given property if it exists in the target object, undefined otherwise. the only difference to object.getownpropertydescriptor() is how non-object targets are...
... if target is not an object. description the reflect.getownpropertydescriptor method returns a property descriptor of the given property if it exists in the target object, undefined otherwise. the only difference to object.getownpropertydescriptor() is how non-object targets are handled. ...
...rwise. 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 not non-null o...
...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 not non-null object object.getownpropertydescriptor('foo', 0) // { value: "f", writable: false, enumerable: true, configurable: false } specifications specification ecmascript (ecma-262)the definition of 'reflect.getownpropertydescriptor' in that specification. ...
Planned changes to shared memory - JavaScript
mers, which can be created with shared memory. starting with firefox 79, the features described in this document are enabled by default. chrome intends to implement similar restrictions. new http header bonanza as a baseline requirement, documents will need to be in a secure context. for top-level documents, two headers will need to be set: cross-origin-opener-policy with same-origin as value (protects your origin from attackers) cross-origin-embedder-policy with require-corp as value (protects victims from your origin) with these two headers set, postmessage() will no longer throw for sharedarraybuffer objects and shared memory across threads is therefore available. nested documents and dedicated workers will need to set the cross-origin-embedder-policy header as well with the sa...
...rotects your origin from attackers) cross-origin-embedder-policy with require-corp as value (protects victims from your origin) with these two headers set, postmessage() will no longer throw for sharedarraybuffer objects and shared memory across threads is therefore available. nested documents and dedicated workers will need to set the cross-origin-embedder-policy header as well with the same value. no further changes are needed for same-origin nested documents and subresources. same-site (but cross-origin) nested documents and subresources will need to set the cross-origin-resource-policy header with same-site as value. and their cross-origin (and cross-site) counterparts need to set the same header with cross-origin as value. note that setting the cross-origin-resource-policy header to an...
...ther changes are needed for same-origin nested documents and subresources. same-site (but cross-origin) nested documents and subresources will need to set the cross-origin-resource-policy header with same-site as value. and their cross-origin (and cross-site) counterparts need to set the same header with cross-origin as value. note that setting the cross-origin-resource-policy header to any other value than same-origin opens up the resource to potential attacks, such as spectre. note that the cross-origin-opener-policy header limits your ability to retain a reference to popups. direct access between two top-level window contexts will essentially only work if they are same-origin and carry the same two headers with the same two values. api changes as a result of this newly required environmen...
...nd only sharing between threads is gated on the new headers), the webassembly atomic instructions are also unconditionally allowed. further reading coop and coep explained. cross-origin-opener-policy: whatwg/html issue #3740, draft specification. cross-origin-embedder-policy: whatwg/html issue #4175, draft specification. cross-origin-resource-policy: standardized in fetch, new cross-origin value is part of the cross-origin-embedder-policy effort. postmessage() changes and self.crossoriginisolated: whatwg/html issue #4732, whatwg/html issue #4872, draft specification. ...
String.prototype.lastIndexOf() - JavaScript
the lastindexof() method returns the index within the calling string object of the last occurrence of the specified value, searching backwards from fromindex. returns -1 if the value is not found. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.lastindexof(searchvalue[, fromindex]) parameters searchvalue a string representing the value to search for. if searchvalue is an empty string, then fromindex is returned. fromindex optional the index of the last character in the string to be considered as the beginning of a match. the default value is +infinity. if fromindex >= str.length, the whole string i...
... 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. ...
... 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. ...
...ote: 'abab'.lastindexof('ab', 2) will return 2 and not 0, as fromindex limits only the beginning of the match. case-sensitivity the lastindexof() method is case sensitive. for example, the following expression returns -1: 'blue whale, killer whale'.lastindexof('blue'); // returns -1 examples using indexof() and lastindexof() the following example uses indexof() and lastindexof() to locate values in the string "brave new world". let anystring = 'brave new world'; console.log('the index of the first w from the beginning is ' + anystring.indexof('w')); // logs 8 console.log('the index of the first w from the end is ' + anystring.lastindexof('w')); // logs 10 console.log('the index of "new" from the beginning is ' + anystring.indexof('new')); // logs 6 console.log('the index of "new" from...
String.prototype.substr() - JavaScript
interactive example is stored in a github repository. if 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. ...
... 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 the string. its value is capped at str.length. if start is a negative number, the index starts counting from the end of the string. its value is capped at -str.length. note: in microsoft jscript, negative values of the start argument are not considered to refer to the end of the string. if length is omitted, substr() extracts characters to the end of the string. if length is undefined, substr() extracts characters...
...alues of the start argument are not considered to refer to the end of the string. if length is omitted, substr() extracts characters to the end of the string. if length is undefined, substr() extracts characters to the end of the string. if length is a negative number, it is treated as 0. for both start and length, nan is treated as 0. polyfill microsoft's jscript does not support negative values for the start index. to use this feature in jscript, you can use the following code: // only run when the substr() function is broken if ('ab'.substr(-1) != 'b') { /** * get the substring of a string * @param {integer} start where to start the substring * @param {integer} length how many characters to return * @return {string} */ string.prototype.substr = function(...
...this.length + start : start, length) } }(string.prototype.substr); } examples using substr() var astring = 'mozilla'; console.log(astring.substr(0, 1)); // 'm' console.log(astring.substr(1, 0)); // '' console.log(astring.substr(-1, 1)); // 'a' console.log(astring.substr(1, -1)); // '' console.log(astring.substr(-3)); // 'lla' console.log(astring.su...
TypedArray.prototype.find() - JavaScript
the find() method returns a value in the typed array, if an element satisfies the provided testing function. otherwise undefined is returned. typedarray is one of the typed array types here. see also the findindex() method, which returns the index of a found element in the typed array instead of its value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.find(callback[, thisarg]) parameters callback function to execute on each value in the typed array, taking three arguments: element the current element being processed in the typed array. index the index of the current element being ...
...find(callback[, thisarg]) parameters callback function to execute on each value in the typed array, taking three arguments: element the current element being processed in the typed array. index the index of the current element being processed in the typed array. array the array find was called upon. thisarg optional. object to use as this when executing callback. return value a value in the array if an element passes the test; otherwise, undefined. description the find method executes the callback function once for each element present in the typed array until it finds one where callback returns a true value. if such an element is found, find immediately returns the value of that element. otherwise, find returns undefined. callback is invoked only for indexes of th...
...nt passes the test; otherwise, undefined. description the find method executes the callback function once for each element present in the typed array until it finds one where callback returns a true value. if such an element is found, find immediately returns the value of that element. otherwise, find returns undefined. callback is invoked only for indexes of the typed array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values. callback is invoked with three arguments: the value of the element, the index of the element, and the typed array object being traversed. if a thisarg parameter is provided to find, it will be used as the this for each invocation of the callback. if it is not provided, then undefined is used. find...
...he callback. if it is not provided, then undefined is used. find does not mutate the typed array on which it is called. the range of elements processed by find is set before the first invocation of callback. elements that are appended to the typed array after the call to find begins will not be visited by callback. if an existing, unvisited element of the typed array is changed by callback, its value passed to the visiting callback will be the value at the time that find visits that element's index; elements that are deleted are not visited. examples find a prime number in a typed array the following example finds an element in the typed array that is a prime number (or returns undefined if there is no prime number). function isprime(element, index, array) { var start = 2; while (star...
TypedArray.prototype.forEach() - JavaScript
the foreach() method executes a provided function once per array element. this method has the same algorithm as array.prototype.foreach(). typedarray is one of the typed array types here. syntax typedarray.foreach(callback[, thisarg]) parameters callback function that produces an element of the new typed array, taking three arguments: currentvalue the current element being processed in the typed array. index the index of the current element being processed in the array. array the array foreach() was called upon. thisarg optional. value to use as this when executing callback. return value undefined. description the foreach() method executes the provided callback once for each element present in the typed array in ascending order. it is not invoked for indexes tha...
...the array foreach() was called upon. thisarg optional. value to use as this when executing callback. return value undefined. description the foreach() method executes the provided callback once for each element present in the typed array in ascending order. it is not invoked for indexes that have been deleted or elided. however, it is executed for elements that are present and have the value undefined. callback is invoked with three arguments: the element value the element index the typed array being traversed if a thisarg parameter is provided to foreach(), it will be passed to callback when invoked, for use as its this value. otherwise, the value undefined will be passed for use as its this value. ...
...er, it is executed for elements that are present and have the value undefined. callback is invoked with three arguments: the element value the element index the typed array being traversed if a thisarg parameter is provided to foreach(), it will be passed to callback when invoked, for use as its this value. otherwise, the value undefined will be passed for use as its this value. the this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. the range of elements processed by foreach() is set before the first invocation of callback. elements that are appended to the typed array after the call to foreach() begins will not be visited by callback. ...
...fined will be passed for use as its this value. the this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. the range of elements processed by foreach() is set before the first invocation of callback. elements that are appended to the typed array after the call to foreach() begins will not be visited by callback. if the values of existing elements of the typed array are changed, the value passed to callback will be the value at the time foreach() visits them; elements that are deleted before being visited are not visited. foreach() executes the callback function once for each typed array element; unlike every() and some() it, always returns the value undefined. examples logging the contents of a typed array the fo...
encodeURIComponent() - JavaScript
e four escape sequences for characters composed of two "surrogate" characters). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax encodeuricomponent(str); parameters str string. a component of a uri. return value a new string representing the provided string encoded as a uri component. description encodeuricomponent() escapes all characters except: not escaped: a-z a-z 0-9 - _ . ! ~ * ' ( ) encodeuricomponent() differs from encodeuri as follows: var set1 = ";,/?:@&=+$"; // reserved characters var set2 = "-_.!~*'()"; // unescaped characters var set3 = "#"; // number sign var set4 ...
... // note that although rfc3986 reserves "!", rfc5987 does not, // so we do not need to escape it replace(/['()]/g, escape). // i.e., %27 %28 %29 replace(/\*/g, '%2a'). ...
...ial encoding required within utf-8 content-disposition and link server response header parameters (e.g., utf-8 filenames): var filename = 'my file(2).txt'; var header = "content-disposition: attachment; filename*=utf-8''" + encoderfc5987valuechars(filename); console.log(header); // logs "content-disposition: attachment; filename*=utf-8''my%20file%282%29.txt" function encoderfc5987valuechars(str) { return encodeuricomponent(str). // note that although rfc3986 reserves "!", rfc5987 does not, // so we do not need to escape it replace(/['()]/g, escape). // i.e., %27 %28 %29 replace(/\*/g, '%2a'). // the following are not required for percent-encoding per rfc5987, // so we can allow for a little better readability over the ...
... we do not need to escape it replace(/['()]/g, escape). // i.e., %27 %28 %29 replace(/\*/g, '%2a'). // the following are not required for percent-encoding per rfc5987, // so we can allow for a little better readability over the wire: |`^ replace(/%(?:7c|60|5e)/g, unescape); } // here is an alternative to the above function function encoderfc5987valuechars2(str) { return encodeuricomponent(str). // note that although rfc3986 reserves "!", rfc5987 does not, // so we do not need to escape it replace(/['()*]/g, c => "%" + c.charcodeat(0).tostring(16)). // i.e., %27 %28 %29 %2a (note that valid encoding of "*" is %2a // which necessitates calling touppercase() to proper...
null - JavaScript
null is not an identifier for a property of the global object, like undefined can be. instead, null expresses a lack of identification, indicating that a variable points to no object. in apis, null is often retrieved in a place where an object can be expected but no object is relevant. // foo does not exist. ...
...null is not an identifier for a property of the global object, like undefined can be. instead, null expresses a lack of identification, indicating that a variable points to no object. in apis, null is often retrieved in a place where an object can be expected but no object is relevant. // foo does not exist. ...
...bject, like undefined can be. instead, null expresses a lack of identification, indicating that a variable points to no object. in apis, null is often retrieved in a place where an object can be expected but no object is relevant. // foo does not exist. it is not defined and has never been initialized: foo; //referenceerror: foo is not defined // foo is known to exist now but it has no type or value: var foo = null; foo; //null examples difference between null and undefined when checking for null or undefined, beware of the differences between equality (==) and identity (===) operators, as the former performs type-conversion. typeof null // "object" (not "null" for legacy reasons) typeof undefined // "undefined" null === undefined // false null == undefined // true nul...
... ...
Logical NOT (!) - JavaScript
the logical not (!) operator (logical complement, negation) takes truth to falsity and vice versa. it is typically used with boolean (logical) values. when used with non-boolean values, it returns false if its single operand can be converted to true; otherwise, returns true. the source for this interactive example is stored in a github repository. if 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 !expr description returns false if its single operand can be converted to true; otherwise, returns true. if a value can be converted to true, the value is so-called truthy. if a value can be converted to false, the value is so-called falsy. examples of expressions that can be converted ...
...gle operand can be converted to true; otherwise, returns true. if a value can be converted to true, the value is so-called truthy. if a value can be converted to false, the value is so-called falsy. examples of expressions that can be converted to false are: null; nan; 0; empty string ("" or '' or ``); undefined. even though the ! operator can be used with operands that are not boolean values, it can still be considered a boolean operator since its return value can always be converted to a boolean primitive. to explicitly convert its return value (or any expression in general) to the corresponding boolean value, use a double not operator or the boolean constructor. examples using not the following code shows examples of the ! (logical not) operator. n1 = !true // !t...
... constructor. examples using not the following code shows examples of the ! (logical not) operator. n1 = !true // !t returns false n2 = !false // !f returns true n3 = !'' // !f returns true n4 = !'cat' // !t returns false double not (!!) it is possible to use a couple of not operators in series to explicitly force the conversion of any value to the corresponding boolean primitive. the conversion is based on the "truthyness" or "falsyness" of the value (see truthy and falsy). the same conversion can be done through the boolean function. n1 = !!true // !!truthy returns true n2 = !!{} // !!truthy returns true: any object is truthy... n3 = !!(new boolean(false)) // ...even boolean objects with a ...
... corresponding boolean primitive. the conversion is based on the "truthyness" or "falsyness" of the value (see truthy and falsy). the same conversion can be done through the boolean function. n1 = !!true // !!truthy returns true n2 = !!{} // !!truthy returns true: any object is truthy... ...
for await...of - JavaScript
the for await...of statement creates a loop iterating over async iterable objects as well as on sync iterables, including: built-in string, array, array-like objects (e.g., arguments or nodelist), typedarray, map, set, and user-defined async/sync iterables. it invokes a custom iteration hook with statements to be executed for the value of each distinct property of the object. like the await operator, the statement can only be used inside an async function. for await...of doesn't work with async iterators that are not async iterables. syntax for await (variable of iterable) { statement } variable on each iteration a value of a different property is assigned to variable. variable may be declared with const, let, or var. iterable object whose iterable properties are to be iterated o...
...le may be declared with const, let, or var. iterable object whose iterable properties are to be iterated over. examples iterating over async iterables you can also iterate over an object that explicitly implements async iterable protocol: const asynciterable = { [symbol.asynciterator]() { return { i: 0, next() { if (this.i < 3) { return promise.resolve({ value: this.i++, done: false }); } return promise.resolve({ done: true }); } }; } }; (async function() { for await (let num of asynciterable) { console.log(num); } })(); // 0 // 1 // 2 iterating over async generators since the return values of async generators conform to the async iterable protocol, they can be looped using for await...of. async function* a...
... // 1 // 2 for a more concrete example of iterating over an async generator using for await...of, consider iterating over data from an api. this example first creates an async iterable for a stream of data, then uses it to find the size of the response from the api. async function* streamasynciterable(stream) { const reader = stream.getreader(); try { while (true) { const { done, value } = await reader.read(); if (done) { return; } yield value; } } finally { reader.releaselock(); } } // fetches data 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. as...
...esponse 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 assign them to the loop control variable. function* generator() { yield 0; yield 1; yield promise.resolve(2); yield promise.resolve(3); yield 4; } (async function() { for await (let num of generator()) { console.log(num); } })(); // 0 // 1 // 2 // 3 // 4 // compare with for-of loop: for (let numorpromise of generator()) { console.log(numorpromise); } // 0 // 1 // p...
try...catch - JavaScript
ception is thrown from within the try-block. for example, when the exception occurs in the following code, control transfers to the catch-block. try { throw 'myexception'; // generates an exception } catch (e) { // statements to handle any exceptions logmyerrors(e); // pass exception object to error handler } the catch-block specifies an identifier (e in the example above) that holds the value of the exception; this value is only available in the scope of the catch-block. conditional catch-blocks you can create "conditional catch-blocks" by combining try...catch blocks with if...else if...else structures, like this: try { myroutine(); // may throw three types of exceptions } catch (e) { if (e instanceof typeerror) { // statements to handle typeerror exceptions } else if (e...
...l subset of expected errors, and then re-throw the error in other cases: try { myroutine(); } catch (e) { if (e instanceof rangeerror) { // statements to handle this very common expected error } else { throw e; // re-throw the error unchanged } } the exception identifier when an exception is thrown in the try-block, exception_var (i.e., the e in catch (e)) holds the exception value. you can use this identifier to get information about the exception that was thrown. this identifier is only available in the catch-block's scope. function isvalidjson(text) { try { json.parse(text); return true; } catch { return false; } } the finally-block the finally-block contains statements to execute after the try-block and catch-block(s) execute, but before the statem...
...sage); } // output: // "inner" "oops" // "finally" // "outer" "oops" any given exception will be caught only once by the nearest enclosing catch-block unless it is rethrown. of course, any new exceptions raised in the "inner" block (because the code in catch-block may do something that throws), will be caught by the "outer" block. returning from a finally-block if the finally-block returns a value, this value becomes the return value of the entire try-catch-finally statement, regardless of any return statements in the try and catch-blocks. this includes exceptions thrown inside of the catch-block: (function() { try { try { throw new error('oops'); } catch (ex) { console.error('inner', ex.message); throw ex; } finally { console.log('finally'); ...
... specifications specification ecmascript (ecma-262)the definition of 'try statement' in that specification. ...
Statements and declarations - JavaScript
teration of the current or labeled loop, and continues execution of the loop with the next iteration. empty an empty statement is used to provide no statement, although the javascript syntax would expect one. if...else executes a statement if a specified condition is true. if the condition is false, another statement can be executed. switch evaluates an expression, matching the expression's value to a case clause, and executes statements associated with that case. throw throws a user-defined exception. try...catch marks a block of statements to try, and specifies a response, should an exception be thrown. declarations var declares a variable, optionally initializing it to a value. let declares a block scope local variable, optionally initializing it to a value. const declare...
... class declares a class. iterations do...while creates a loop that executes a specified statement until the test condition evaluates to false. the condition is evaluated after executing the statement, resulting in the specified statement executing at least once. ...
...ed statement until the test condition evaluates to false. the condition is evaluated after executing the statement, resulting in the specified statement executing at least once. for creates a loop that consists of three optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop. for each...in iterates a specified variable over all values of object's properties. for each distinct property, a specified statement is executed. for...in iterates over the enumerable properties of an object, in arbitrary order. for each distinct property, statements can be executed. for...of iterates over iterable objects (including arrays, array-like objects, iterators and generators), invoking a custom iteration hook with statements to be execute...
...t's properties. for each distinct property, a specified statement is executed. for...in iterates over the enumerable properties of an object, in arbitrary order. for each distinct property, statements can be executed. for...of iterates over iterable objects (including arrays, array-like objects, iterators and generators), invoking a custom iteration hook with statements to be executed for the value of each distinct property. for await...of iterates over async iterable objects, array-like objects, iterators and generators, invoking a custom iteration hook with statements to be executed for the value of each distinct property. while creates a loop that executes a specified statement as long as the test condition evaluates to true. the condition is evaluated before executing the statement.
<mi> - MathML
Web › MathML › Element › mi
the mathml <mi> element indicates that the content should be rendered as an identifier such as function names, variables or symbolic constants. you can also have arbitrary text in it to mark up terms. attributes class, id, style provided for use with stylesheets. dir the text direction. possible values are either ltr (left to right) or rtl (right to left). 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 typo...
...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 the named typography. ...
... 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 the named typography. ...
...er, which varies in typography. that is, although the names suggest the typographic style for the class, semantically, items with the same class are treated "the same" within an expression, which might or might not involve displaying them with the named typography. ...
Codecs used by WebRTC - Web media technologies
f the main profile, and is specifically designed for low-complexity, low-delay applications such as mobile video and videoconferencing, as well as for platforms with lower performing video processing capabilities. our overview of avc and its features can be found in the main video codec guide. special parameter support requirements avc offers a wide array of parameters for controlling optional values. in order to improve reliability of webrtc media sharing across multiple platforms and browsers, it's required that webrtc endpoints that support avc handle certain parameters in specific ways. sometimes this simply means a parameter must (or must not) be supported. sometimes it means requiring a specific value for a parameter, or that a specific set of values be allowed. and sometimes the requi...
... 6184 for details. max-dpb if specified and supported, max-dpb indicates the maximum decoded picture buffer size, given in units of 8/3 macroblocks. see rfc 6184, page 46 for further details. max-fs if specified and supported by the software, max-fs specifies the maximum size of a single video frame, given as a number of macroblocks. max-mbps if specified and supported by the software, this value is an integer specifying the maximum rate at which macroblocks should be processed per second (in macroblocks per second). max-smbps if specified and supported by the software, this specifies an integer stating the maximum static macroblock processing rate in static macroblocks per second (using the hypothetical assumption that all macroblocks are static macroblocks). parameters with specific...
...tion must be signaled in-band; the sprop-parameter-sets parameter must therefore not be included in the sdp. parameters which must be specified these parameters must be specified whenever using avc in a webrtc connection. profile-level-id all webrtc implementations are required to specify and interpret this parameter in their sdp, identifying the sub-profile used by the codec. the specific value that is set is not defined; what matters is that the parameter be used at all. this is useful to note, since in rfc 6184 ("rtp payload format for h.264 video"), profile-level-id is entirely optional. other requirements for the purposes of supporting switching between portrait and landscape orientations, there are two methods that can be used. the first is the video orientation (cvo) header ext...
...ct, we set codeclist to the codecs property and return to the caller. if no video track is found, we set codeclist to null. on return, then, codeclist is either null to indicate that no video tracks were found or it's an array of rtcrtpcodecparameters objects, each describing one permitted codec configuration. of special importance in these objects: the payloadtype property, which is a one-byte value which uniquely identifies the described configuration. note: the two methods for obtaining lists of codecs shown here use different output types in their codec lists. be aware of this when using the results. customizing the codec list once you have a list of the available codecs, you can alter it and then send the revised list to rtcrtptransceiver.setcodecpreferences() to rearrange the codec...
OpenSearch description format
it must be 16 or fewer characters of plain text, w...
...it must be 16 or fewer characters of plain text, with no html or other markup. description a brief description of the search engine. it must be 1024 or f...
...it must be 16 or fewer characters of plain text, with no html or other markup. description a brief description of the search engine. it must be 1024 or fewer characters of...
...namic search parameters are described in opensearch 1.1 parameters. for search suggestions, the application/x-suggestions+json url template is used to fetch a suggestion list in json format. for details on how to implement search suggestion support on a server, see supporting search suggestions in search plugins. param the parameters that must be passed in along with the search query as key/value pairs. when specifying values, you can use {searchterms} to insert the search terms entered by the user in the search bar. moz:searchform the url for the site's search page for which the plugin. this lets firefox users visit the web site directly. note: since this element is firefox-specific, and not part of the opensearch specification, we use the moz: xml namespace prefix in the example ab...
baseline-shift - SVG: Scalable Vector Graphics
might be a 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. ...
...ribute 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. ...
...y 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 css inline layo...
... scalable vector graphics (svg) 2the definition of 'alignment-baseline' in that specification. candidate recommendation refers to the definition in css inline layout and notes that vertical-align should be preferred. ...
clip - SVG: Scalable Vector Graphics
Web › SVG › Attribute › clip
the clip attribute is a presentation attribute defining the visible region of an element. this attribute has the same parameter values as defined for the css clip property. unitless values, which indicate current user coordinates, are permitted on the coordinate values on the rect(). the value of auto defines a clipping path along the bounds of the viewport created by the given element. as a presentation attribute, it can be applied to any element but it has effect only on the following six elements: <svg>, <symbol>, <image>, <foreignobject>, <pattern>, <marker> html,body,svg { height:100% } <svg viewbox="0 0 20 10" xmlns="http://www.w3.org/2000/svg"> <!-- auto clipping --> <svg x="0" width="10" height="10" clip="auto"> <circle cx="5" cy="5" r="4" stroke="green" /> </...
...pping --> <svg x="0" width="10" height="10" clip="auto"> <circle cx="5" cy="5" r="4" stroke="green" /> </svg> <!-- rect(top, right, bottom, left) clipping --> <svg x="10" width="10" height="10" clip="rect(1, 9, 8, 2)"> <circle cx="5" cy="5" r="4" stroke="green" /> </svg> </svg> usage notes warning: this property is deprecated. use clip-path instead. ...
...="10" clip="auto"> <circle cx="5" cy="5" r="4" stroke="green" /> </svg> <!-- rect(top, right, bottom, left) clipping --> <svg x="10" width="10" height="10" clip="rect(1, 9, 8, 2)"> <circle cx="5" cy="5" r="4" stroke="green" /> </svg> </svg> usage notes warning: this property is deprecated. use clip-path instead. ...
...r="4" stroke="green" /> </svg> <!-- rect(top, right, bottom, left) clipping --> <svg x="10" width="10" height="10" clip="rect(1, 9, 8, 2)"> <circle cx="5" cy="5" r="4" stroke="green" /> </svg> </svg> usage notes warning: this property is deprecated. use clip-path instead. value auto | rect() default value auto animatable yes the value auto defines a clipping path along the bounds of the viewport created by the given element.the value rect() defines a clipping rectangle following the following syntax: rect(<top>, <right>, <bottom>, <left>). the <top> and <bottom> values specify offsets from the top border edge of the element viewport, while <right> and <left> specify offsets from the left border edge of the element viewport. s...
color-interpolation - SVG: Scalable Vector Graphics
or filter effects, the color-interpolation-filters property controls which color space is used. the color-interpolation property chooses between color operations occurring in the srgb color space or in a (light energy linear) linearized rgb color space. having chosen the appropriate color space, component-wise linear interpolation is used. when a child element is blended into a background, the value of the color-interpolation property on the child determines the type of blending, not the value of the color-interpolation on the parent. for gradients which make use of the href or the deprecated xlink:href attribute to reference another gradient, the gradient uses the propertyʼs value from the gradient element which is directly referenced by the fill or stroke property. when animating colors, ...
... note: as a presentation attribute, color-interpolation can be used as a css property. ...
...this option indicates that the author doesn't require that color interpolation occur in a particular color space. srgb indicates that color interpolation should occur in the srgb color space. li...
...this option indicates that the author doesn't require that color interpolation occur in a particular color space. srgb indicates that color interpolation should occur in the srgb color space. linearrgb indicates that color interpolation should...
diffuseConstant - SVG: Scalable Vector Graphics
the brighter the lighting-color, the smaller this number should be. ...
...the brighter the lighting-color, the smaller this number should be. ...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'diffuseconstant' in that specification. recommendati...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'diffuseconstant' in that specification. recommendation initial definition ...
dur - SVG: Scalable Vector Graphics
Web › SVG › Attribute › dur
itʼs possible to combine those time representations to create some complex durations like hh:mm:ss.i...
...itʼs possible to combine those time representations to create some complex durations like hh:mm:ss.iii or mm:ss.iii.
...height="100"> <animate attributetype="xml" attributename="y" from="0" to="50" dur="1s" repeatcount="indefinite"/> </rect> <rect x="120" y="0" width="100" height="100"> <animate attributetype="xml" attributename="y" from="0" to="50" dur="3s" repeatcount="indefinite"/> </rect> </svg> usage notes value <clock-value> | media | indefinite default value indefinite animatable no <clock-value> this value specifies the length of the simple duration. 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 dura...
... note: the interpolation will not work if the simple duration is indefinite (although this may still be useful for <set> elements). ...
enable-background - SVG: Scalable Vector Graphics
pecifies how the accumulation of the background image is managed. note: as a presentation attribute, enable-background can be used as a css property. as a presentation attribute, it can be applied to any element but it has effect only on the following eleven elements: <a>, <defs>, <glyph>, <g>, <marker>, <mask>, <missing-glyph>, <pattern>, <svg>, <switch>, and <symbol> context notes value accumulate | new [ <x> <y> <width> <height> ]? default value accumulate animatable no accumulate if an ancestor container element has a property value of enable-background: new, then all graphics elements within the current container element are rendered both onto the parent container elementʼs background image canvas and onto the target device. otherwise...
...tainer element has a property value of enable-background: new, then all graphics elements within the current container element are rendered both onto the parent container elementʼs background image canvas and onto the target device. otherwise, there is no current background image canvas, so graphics elements are only rendered onto the target device. new [ <x> <y> <width> <height> ]? this value enables the ability of children of the current container element to access the background image. it also indicates that a new (i.e., initially transparent black) background image canvas is established and that in effect all children of the current container element shall be rendered into the new background image canvas in addition to being rendered onto the target device. the optional <x>, <y...
...ontainer element to access the background image. it also indicates that a new (i.e., initially transparent black) background image canvas is established and that in effect all children of the current container element shall be rendered into the new background image canvas in addition to being rendered onto the target device. ...
... is established and that in effect all children of the current container element shall be rendered into the new background image canvas in addition to being rendered onto the target device. the optional <x>, <y>, <width>, and <height> parameters are <number> values that indicate the subregion of the container elementʼs user space where access to the background image is allowed to happen. those values act as a clipping rectangle on the background image canvas. negative values for <width> or <height> are forbidden. if one, two, or three values are specified or if neither <width> nor <height> are specified, the backgroundimage and backgroundalpha of a filter primitive are processed as if background image processing were not enabled. specifications specification status comm...
fill-opacity - SVG: Scalable Vector Graphics
browser compatibility the compatibility table on this page is generated from structured data...
... browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, plea...
... 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 req...
... 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. ...
fill-rule - SVG: Scalable Vector Graphics
pe. note: as a presentation attribute, fill-rule can be used as a css property. as a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <altglyph>, <path>, <polygon>, <polyline>, <text>, <textpath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewbox="-10 -10 220 120" xmlns="http://www.w3.org/2000/svg"> <!-- default value for fill-rule --> <polygon fill-rule="nonzero" stroke="red" points="50,0 21,90 98,35 2,35 79,90"/> <!-- the center of the shape has two path segments (shown by the red stroke) between it and infinity. it is therefore considered outside the shape, and not filled. --> <polygon fill-rule="evenodd" stroke="red" points="150,0 121,90 198,35 102,35 179,90"/> </svg> usage notes...
...ule --> <polygon fill-rule="nonzero" stroke="red" points="50,0 21,90 98,35 2,35 79,90"/> <!-- the center of the shape has two path segments (shown by the red stroke) between it and infinity. it is therefore considered outside the shape, and not filled. ...
...e="red" points="50,0 21,90 98,35 2,35 79,90"/> <!-- the center of the shape has two path segments (shown by the red stroke) between it and infinity. it is therefore considered outside the shape, and not filled. --> <polygon fill-rule="evenodd" stroke="red" points="150,0 121,90 198,35 102,35 179,90"/> </svg> usage notes value nonzero | evenodd default value nonzero animatable yes the fill-rule attribute provides two options for how the inside (that is, the area to be filled) of a shape is determined: nonzero the value nonzero determines the "insideness" of a point in the shape by drawing a ray from that point to infinity in any direction, and then examining the places where a segment of the shape crosses the ray. starting wit...
...if this number is odd, the point is inside; if even, the point is outside. example html,body,svg { height:100% } <svg viewbox="-10 -10 320 120" xmlns="http://www.w3.org/2000/svg"> <!-- e...
glyph-orientation-horizontal - SVG: Scalable Vector Graphics
glyph-orientation-horizontal attribute affects the amount that hte current text position advances as each glyph is rendered. when the reference orientation direction is horizontal and the glyph-orientation-horizontal results in an orientation angle that is a multiple of 180 degrees, then the current text position is incremented according to the horizontal metrics of the glyph. otherwise, if the value of this attribute is not a multiple of 180 degrees, then the current text position is incremented according to the vertical metrics of the glyph. this attribute is applied only to text written in a horizontal writing-mode. note: as a presentation attribute, glyph-orientation-horizontal can be used as a css property. as a presentation attribute, it can be applied to any element but it has effec...
...vertical metrics of the glyph. this attribute is applied only to text written in a horizontal writing-mode. note: as a presentation attribute, glyph-orientation-horizontal can be used as a css property. ...
...is attribute is applied only to text written in a horizontal writing-mode. note: as a presentation attribute, glyph-orientation-horizontal can be used as a css property. ...
...ting-mode. note: as a presentation attribute, glyph-orientation-horizontal can be used as a css property. as a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <altglyph>, <textpath>, <text>, <tref>, and <tspan> context notes value <angle> default value 0deg animatable no <angle> the value of the angle is restricted to 0, 90, 180, and 270 degrees. if another angle is specified, it is rounded to the closest of the permitted values. a value of 0deg indicates that all glyphs are set with the top of the glyphs oriented towards the reference orientation. a value of 90deg indicates an orientation of 90 degrees clockwise from the reference orientation. specifications speci...
id - SVG: Scalable Vector Graphics
Web › SVG › Attribute › id
ssigns a unique name to an element. all elements are using this attribute. ...
...ent. all elements are using this attribute. ...
... it must be valid in xml documents. ...
... scalable vector graphics (svg) 1.1 (second edition)the definition of 'id' in that specification. recommendation initial definition ...
kerning - SVG: Scalable Vector Graphics
Web › SVG › Attribute › kerning
<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 uni...
... <length> if a length is provided, then auto-kerning is disabled. instead, inter-character spacing is set to the given length. if a length is provided without a unit identifier (e.g., an unqualified number ...
...nt: 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., an unqualified number such as 128), the length is processed as a width value in the...
... if a length is provided, then auto-kerning is disabled. instead, inter-character spacing is set to the given length. if a length is provided without a unit identifier (e.g., an unqualified number such as 128), the length is processed as a width value in the current user coordinate system. if a unit identifier (e.g., 0.25em or 1%) is provided, then the length is converted into a corresponding value in the current user coordinate system. the most common scenario, other than auto, is to set kerning to a value of 0 so that auto-kerning is disabled. the given length is added to the inter-character spacing value specified by the letter-spacing attribute. ...
lang - SVG: Scalable Vector Graphics
Web › SVG › Attribute › lang
ttribute (with namespace). if both of them are defined, the one with namespace is used and the one without is ignored. in svg 1.1 there was a lang attribute defined with a different meaning and only applying to <glyph> elements. that attribute specified a list of languages in bcp 47 format. ...
...d. in svg 1.1 there was a lang attribute defined with a different meaning and only applying to <glyph> elements. that attribute specified a list of languages in bcp 47 format. the glyph was meant to be used if the xml:lang attribute exactly matched one of the languages given in the value of this parameter, or if the xml:lang attribute exactly equaled a prefix of one of the languages given in the value of this parameter such that the first tag character following the prefix was "-". ...
...n the value of this parameter, or if the xml:lang attribute exactly equaled a prefix of one of the languages given in the value of this parameter such that the first tag character following the prefix was "-". all elements are using this attribute. <svg viewbox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> <text lang="en-us">this is some english text</text> </svg> usage notes value <language-tag> default value none animatable no <language-tag> this value specifies the language used for the element. the syntax of this value is defined in the bcp 47 specification. ...
...en-us for us english or de-at for austrian german. ...
marker-end - SVG: Scalable Vector Graphics
for <path> elements, for each closed subpath, the last vertex is the same as the first vertex. marker-end is only rendered on the final vertex of the path data. ...
...if the reference is not valid, then no marker will be drawn. specifications specification status comment ...
...if the reference is not valid, then no marker will be drawn. specifications specification status comment scalable vector graphics (svg) 2the defi...
...if the reference is not valid, then no marker will be drawn. ...
marker-start - SVG: Scalable Vector Graphics
for <path> elements, for each closed subpath, the last vertex is the same as the first vertex. marker-start is only rendered on the first vertex of the path data. ...
...if the reference is not valid, then no marker will be drawn. specifications specification status comment ...
...if the reference is not valid, then no marker will be drawn. specifications specification status comment scalable vector graphics (svg) 2the defi...
...if the reference is not valid, then no marker will be drawn. ...
max - SVG: Scalable Vector Graphics
Web › SVG › Attribute › max
the max attribute specifies the maximum value of the active animation duration. ...
...e specifies the maximum value of the active animation duration. ...
... specifications specification status co...
...2000/svg"> <circle cx="60" cy="10" r="10"> <animate attributename="cx" dur="4s" max="6s" repeatcount="indefinite" values="60 ; 110 ; 60 ; 10 ; 60" keytimes="0 ; 0.25 ; 0.5 ; 0.75 ; 1"/> <animate attributename="cy" dur="4s" max="6s" repeatcount="indefinite" values="10 ; 60 ; 110 ; 60 ; 10" keytimes="0 ; 0.25 ; 0.5 ; 0.75 ; 1"/> </circle> </svg> usage notes value <clock-value> default value none animatable no <clock-value> specifies the length of the maximum value of the active duration, measured in local time. 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 chang...
media - SVG: Scalable Vector Graphics
Web › SVG › Attribute › media
if not specified, the style sheet is applied unconditionally. specifications specification status comment scalable vector graphics (svg) 2the definition of 'me...
... if not specified, the style sheet is applied unconditionally. specifications specification status comment scalable vector graphics (svg) 2the definition of 'media' in that specification. candidate reco...
.../2000/svg"> <style> rect { fill: black; } </style> <style media="all and (min-width: 600px)"> rect { fill: seagreen; } </style> <text y="15">resize the window to see the effect</text> <rect y="20" width="200" height="200" /> </svg> usage notes value <media-query-list> default value all animatable yes <media-query-list> this value holds a media query that needs to match in order for the style sheet to be applied. ...
... scalable vector graphics (svg) 1.1 (second edition)the definition of 'media' in that specification. ...
min - SVG: Scalable Vector Graphics
Web › SVG › Attribute › min
the min attribute specifies the minimum value of the active animation duration. ...
...e specifies the minimum value of the active animation duration. ...
... specifications specification status comme...
...2000/svg"> <circle cx="60" cy="10" r="10"> <animate attributename="cx" dur="4s" min="2s" repeatcount="indefinite" values="60 ; 110 ; 60 ; 10 ; 60" keytimes="0 ; 0.25 ; 0.5 ; 0.75 ; 1"/> <animate attributename="cy" dur="4s" min="2s" repeatcount="indefinite" values="10 ; 60 ; 110 ; 60 ; 10" keytimes="0 ; 0.25 ; 0.5 ; 0.75 ; 1"/> </circle> </svg> usage notes value <clock-value> default value 0 animatable no <clock-value> specifies the length of the minimum value of the active duration, measured in local time. 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 ...
name - SVG: Scalable Vector Graphics
Web › SVG › Attribute › name
the name attribute specifies either the name of a color profile or a font face. two elements are using this attribute: <color-profile> and <font-face-name> color-profile for <color-profile>, name defines the name of the color profile. value <name> default value none animatable yes <name> this value is the name which is used as the first parameter for icc color specifications within fill, stroke, stop-color, flood-color and lighting-color property values to identify the color profile to use for the icc color specification and the name which can be the value of the color-profile property. note: if no name is provided, it will be impossible to reference the given color profile description. the name "srgb" is predefined; any color profile d...
...unlike the syntax allowed between the parentheses of the local(…) clause in an @font-face rule src descriptor, the font name specified in this attribute is not surrounded in single or double quotes. ...
...unlike the syntax allowed between the parentheses of the local(…) clause in an @font-face rule src descriptor, the font name specified in this attribute is not surrounded in single or double quotes. ...
...s provided, it will be impossible to reference the given color profile description. the name "srgb" is predefined; any color profile descriptions with <name> set to "srgb" (case-insensitively) will be ignored. font-face-name for <font-face-name>, name defines the name of the font face. value <name> default value none animatable yes <name> this value specifies the name of a local font. unlike the syntax allowed between the parentheses of the local(…) clause in an @font-face rule src descriptor, the font name specified in this attribute is not surrounded in single or double quotes. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'name for <font-fa...
opacity - SVG: Scalable Vector Graphics
Web › SVG › Attribute › opacity
specifications specification status comment css color module level 4the definition of 'opaci...
... specifications specification status comment css color module level 4the definition of 'opacity' in that specific...
... specifications specification status comment css color module level 4the definition of 'opacity' in that specification. workin...
... <stop offset="100%" style="stop-color:seagreen;" /> </lineargradient> </defs> <rect x="0" y="0" width="100%" height="100%" fill="url(#gradient)" /> <circle cx="50" cy="50" r="40" fill="black" /> <circle cx="150" cy="50" r="40" fill="black" opacity="0.3" /> </svg> usage notes default value 1 value <alpha-value> animatable yes <alpha-value> the uniform opacity setting to be applied across an entire object, as a <number>. any values outside the range 0.0 (fully transparent) to 1.0 (fully opaque) will be clamped to this range. specifications specification status comment css color module level 4the definition of 'opacity' in that specification. working draft defines in more detail what this attrib...
patternContentUnits - SVG: Scalable Vector Graphics
attribute indicates which coordinate system to use for the contents of the <pattern> element. note: that this attribute has no effect if attribute viewbox is specified on the <pattern> element. ...
...n tile that content coordinates and values are computed against the current coordinate user space. note that the size of the tile is computed against the bounding box of the target element --> <pattern id="p1" width="20%" height="20%" patterncontentunits="userspaceonuse"> <circle cx="10" cy="10" r="10" /> </pattern> <!-- a pattern tile that content coordinates and values are computed against the bounding box of the target element. note that the size of the tile is also computed against the bounding box of the target element --> <pattern id="p2" width="20%" height="20%" patterncontentunits="objectboundingbox"> <circle cx=".1" cy=".1" r=".1" /> </pattern> <!-- left square with user space tiles --> <rect x="10" y="10" width="80" he...
...r=".1" /> </pattern> <!-- left square with user space tiles --> <rect x="10" y="10" width="80" height="80" fill="url(#p1)" /> <!-- right square with bounding box tiles --> <rect x="110" y="10" width="80" height="80" fill="url(#p2)" /> </svg> pattern for <pattern>, patterncontentunits defines the coordinate system in use for the content of the element. ...
...iles --> <rect x="10" y="10" width="80" height="80" fill="url(#p1)" /> <!-- right square with bounding box tiles --> <rect x="110" y="10" width="80" height="80" fill="url(#p2)" /> </svg> pattern for <pattern>, patterncontentunits defines the coordinate system in use for the content of the element. value userspaceonuse | objectboundingbox default value userspaceonuse animatable yes userspaceonuse this value indicates that all coordinates inside the <pattern> element refer to the user coordinate system as defined when the pattern tile was created. objectboundingbox this value indicates that all coordinates inside the <pattern> element are relative to the bounding box of the element the pattern is applied to. a bounding...
points - SVG: Scalable Vector Graphics
Web › SVG › Attribute › points
and a group of coordinates by a space. it makes things more readable for human beings. --> </svg> polyline for <polyline>, points defines a list of points, each representing a vertex of the line to be drawn. each point is define by a x and y coordinate in the user coordinate system. note: a polyline is an open shape, meaning the last point is not connected to the first point. ...
... it makes things more readable for human beings. --> </svg> polyline for <polyline>, points defines a list of points, each representing a vertex of the line to be drawn. each point is define by a x and y coordinate in the user coordinate system. note: a polyline is an open shape, meaning the last point is not connected to the first point. value [ <number>+ ]# default value none animatable yes example html,body,svg { height:100% } <svg viewbox="-10 -10 120 120" xmlns="http://www.w3.org/2000/svg"> <!-- polyline is an open shape --> <polyline stroke="black" fill="none" points="50,0 21,90 98,35 2,35 79,90"/> </svg> polygon for <polygon>, points defines a list of points, each representing a vertex of the shape to be drawn. each point...
...is an open shape --> <polyline stroke="black" fill="none" points="50,0 21,90 98,35 2,35 79,90"/> </svg> polygon for <polygon>, points defines a list of points, each representing a vertex of the shape to be drawn. each point is define by a x and y coordinate in the user coordinate system. note: a polygon is a closed shape, meaning the last point is connected to the first point. ...
...black" fill="none" points="50,0 21,90 98,35 2,35 79,90"/> </svg> polygon for <polygon>, points defines a list of points, each representing a vertex of the shape to be drawn. each point is define by a x and y coordinate in the user coordinate system. note: a polygon is a closed shape, meaning the last point is connected to the first point. ...
repeatDur - SVG: Scalable Vector Graphics
until the document ends). specifications specification status comment svg an...
...until the document ends). specifications specification status comment svg animations level 2...
...until the document ends). specifications specification status comment svg animations level 2the definition of 'repeatdur' in that...
...ype="xml" attributename="y" from="0" to="50" dur="1s" repeatdur="5s"/> </rect> <rect x="120" y="0" width="100" height="100"> <animate attributetype="xml" attributename="y" from="0" to="50" dur="1s" repeatdur="indefinite"/> </rect> </svg> usage notes value <clock-value> | indefinite default values none animatable no <clock-value> this value specifies the duration in presentation time to repeat the animation. indefinite this value indicates that the animation will be repeated indefinitely (i.e. until the document ends). specifications specification status comment svg animations level 2the definition of 'repeatdur' in that specification. editor's draft no change s...
result - SVG: Scalable Vector Graphics
Web › SVG › Attribute › result
the result attribute defines the assigned name for this filter primitive. if supplied, then graphics that result from processing this filter primitive can be referenced by an in attribute on a subsequent filter primitive within the same <filter> element. if no value is provided, the output will only be available for re-use as the implicit input into the next filter primitive if that filter primitive provides no value for its in attribute. seventeen elements are using this attribute: <feblend>, <fecolormatrix>, <fecomponenttransfer>, <fecomposite>, <feconvolvematrix>, <fediffuselighting>, <fedisplacementmap>, <fedropshadow>, <feflood>, <fegaussianblur>, <feimage>, <femerge>, <femorphology>, <feoffset>, <fespecularlighting>, <fetile>, and <feturbulence> html, body, svg { height: 100%; } ...
...it is only meaningful within a given <filter> element and thus has only local scope. it is legal for the same <filter-primitive-reference> to appear multiple times within the same <filter> ele...
...bulence type="turbulence" basefrequency="0.05" numoctaves="2" result="turbulence"/> <fedisplacementmap in2="turbulence" in="sourcegraphic" scale="50" xchannelselector="r" ychannelselector="g"/> </filter> <circle cx="100" cy="100" r="100" style="filter: url(#displacementfilter)"/> </svg> usage notes value <filter-primitive-reference> default value none animatable yes <filter-primitive-reference> this value is a <custom-ident> and defines the name for the filter primitive. it is only meaningful within a given <filter> element and thus has only local scope. it is legal for the same <filter-primitive-reference> to appear multiple times within the same <filter> element. when referenced, this value will use the closest ...
... legal for the same <filter-primitive-reference> to appear multiple times within the same <filter> element. when referenced, this value will use the closest preceding filter primitive with the given result. specifications specification status comment filter effects module level 1the definition of 'result' in that specification. working draft clarifies that the value is a <custom-ident>. scalable vector graphics (svg) 1.1 (second edition)the definition of 'result' in that specification. recommendation initial definition ...
stroke-dasharray - SVG: Scalable Vector Graphics
gaps --> <line x1="0" y1="1" x2="30" y2="1" stroke="black" /> <!-- dashes and gaps of the same size --> <line x1="0" y1="3" x2="30" y2="3" stroke="black" stroke-dasharray="4" /> <!-- dashes and gaps of different sizes --> <line x1="0" y1="5" x2="30" y2="5" stroke="black" stroke-dasharray="4 1" /> <!-- dashes and gaps of various sizes with an odd number of values --> <line x1="0" y1="7" x2="30" y2="7" stroke="black" stroke-dasharray="4 1 2" /> <!-- dashes and gaps of various sizes with an even number of values --> <line x1="0" y1="9" x2="30" y2="9" stroke="black" stroke-dasharray="4 1 2 3" /> </svg> usage notes value none | <dasharray> default value none animatable yes <dashar...
...thus, 5,3,2 is equivalent to 5,3,2,5,3,2. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...thus, 5,3,2 is equivalent to 5,3,2,5,3,2. browser compatibility the compatibility table on this page is generated from structured data. ...
...thus, 5,3,2 is equivalent to 5,3,2,5,3,2. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
stroke-opacity - SVG: Scalable Vector Graphics
it's important to know that the stroke partially covers the fill of a shape, so a stroke wi...
... it's important to know that the stroke partially covers the fill of a shape, so a stroke with an opacity different than 1 will partially s...
... it's important to know that the stroke partially covers the fill of a shape, so a stroke with an opacity different than 1 will partially show the fill underneath. to avoid this effect, it is possible to apply a globa...
... it's important to know that the stroke partially covers the fill of a shape, so a stroke with an opacity different than 1 will partially show the fill underneath. ...
systemLanguage - SVG: Scalable Vector Graphics
systemlanguage is often used in conjunction with the <switch> element. if the attribute is used in other situations, then it represents a simple switch on the given element whether to...
... systemlanguage is often used in conjunction with the <switch> element. if the attribute is used in other situations, then it represents a simple switch on the given element whether to render the element or not. note: if seve...
...as>, <circle>, <clippath>, <cursor>, <defs>, <discard>, <ellipse>, <foreignobject>, <g>, <iframe>, <image>, <line>, <mask>, <path>, <pattern>, <polygon>, <polyline>, <rect>, <set>, <svg>, <switch>, <text>, <textpath>, <tref>, <tspan>, <unknown>, <use>, and <video> usage notes value <language-tags> default value none animatable no <language-tags> the value is a set of comma-separated tokens, each of which must be a language-tag value, as defined in bcp 47. systemlanguage is often used in conjunction with the <switch> element. if the attribute is used in other situations, then it represents a simple switch on the given element whether to render the element or not. note: if several alternative language objects are enclosed in a <switch> and none o...
...ch> and none of them matches, this may lead to situations where no content is displayed. it is thus recommended to include a "catch-all" choice at the end of such a <switch> which is acceptable in all cases. the attribute evaluates to "true" if one of the language tags indicated by user preferences is a case-insensitive match or prefix (followed by a "-") of one of the language tags given in the value of this parameter. otherwise it evaluates to "false". note: the prefix matching rule does not imply that if a user understands a language with a certain tag, that the user will also understand all languages with the tag as prefix. if the attribute is not present, then it implicitly evaluates to "true". if a null string or empty string value is given, the attribute evaluates to "false". the pre...
text-anchor - SVG: Scalable Vector Graphics
-align. for multi-line text, the alignment takes place for each line. the text-anchor attribute is applied to each individual text chunk within a given <text> element. each text chunk has an initial current text position, which represents the point in the user coordinate system resulting from (depending on context) application of the x and y attributes on the <text> element, any x or y attribute values on a <tspan>, <tref> or <altglyph> element assigned explicitly to the first rendered character in a text chunk, or determination of the initial current text position for a <textpath> element. note: as a presentation attribute, text-anchor can be used as a css property. as a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <altglyph...
...for an element with a direction...
... <text text-anchor="end" x="60" y="110">a</text> <!-- materialisation of anchors --> <circle cx="60" cy="40" r="3" fill="red" /> <circle cx="60" cy="75" r="3" fill="red" /> <circle cx="60" cy="110" r="3" fill="red" /> <style><![cdata[ text { font: bold 36px verdana, helvetica, arial, sans-serif; } ]]></style> </svg> usage notes default value start value start | middle | end animatable yes start the rendered characters are aligned such that the start of the text string is at the initial current text position. for an element with a direction property value of ltr (typical for most european languages), the left side of the text is rendered at the initial text position. for an element with a direction property value of rtl (...
...string and the end of the text string is determined. then, the text string is mapped onto the path with this midpoint placed at the current text position.) end the rendered characters are shifted such that the end of the resulting rendered text (final current text position before applying the text-anchor property) is at the initial current text position. for an element with a direction property value of ltr (typical for most european languages), the right side of the text is rendered at the initial text position. for an element with a direction property value of rtl (typical for arabic and hebrew), the left side of the text is rendered at the initial text position. for an element with a vertical primary text direction (often typical for asian text), the bottom of the text is rendered at the i...
text-decoration - SVG: Scalable Vector Graphics
defines whether text is decorated with an underline, overline and/or strike-through. it is a shorthand for the text-decoration-line and text-decoration-style properties. the fill and stroke of the text decoration are given by the fill and stroke of the text at the point where the text decoration is declared. the paint order of the text decoration, i.e. the fill and stroke, is determined by the value of the paint-order attribute at the point where the text decoration is declared. note: as a presentation attribute, text-decoration can be used as a css property. see the css text-decoration property for more information. as a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> htm...
... specifications specification status comment css text decoration module level 3the definition of 'text-decoration' ...
... specifications specification status comment css text decoration module level 3the definition of 'text-decoration' in that specification. candidate recommendation defines the property as a shorthand for text-decoration...
....w3.org/2000/svg"> <text y="20" text-decoration="underline">underlined text</text> <text x="0" y="40" text-decoration="line-through">struck-through text</text> </svg> usage notes value <'text-decoration-line'> || <'text-decoration-style'> || <'text-decoration-color'> default value see individual properties animatable yes for a description of the values, please refer to the css text-decoration property. specifications specification status comment css text decoration module level 3the definition of 'text-decoration' in that specification. candidate recommendation defines the property as a shorthand for text-decoration-line, text-decoration-style, and text-decoration-color. scalable vector graphics (sv...
vert-adv-y - SVG: Scalable Vector Graphics
the vert-adv-y attribute indicates the vertical advance after rendering a glyph in vertical orientation. three elements are using this attribute: <font>, <glyph>, and <missing-glyph> font for <font> elements, vert-adv-y specifies the default vertical advance for a glyph in vertical orientation. ...
... the vert-adv-y attribute indicates the vertical advance after rendering a glyph in vertical orientation. three elements are using this attribute: <font>, <glyph>, and <missing-glyph> font for <font> elements, vert-adv-y specifies the default vertical advance for a glyph in vertical orientation. ...
...dicates the vertical advance after rendering a glyph in vertical orientation. three elements are using this attribute: <font>, <glyph>, and <missing-glyph> font for <font> elements, vert-adv-y specifies the default vertical advance for a glyph in vertical orientation. ...
...for a glyph in vertical orientation. value <number> default value 1 em as of units-per-em animatable no <number> this value indicates the default vertical advance of the glyph in vertical direction glyph, missing-glyph for <glyph> and <missing-glyph> elements, vert-adv-y specifies the vertical advance for a glyph in vertical orientation. value <number> default value <font>ʼs vert-adv-y value animatable no <number> this value indicates the vertical advance of the glyph in vertical direction specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'vert-adv-y for <glyph> and <missing-glyph>' in that specification. ...
xml:space - SVG: Scalable Vector Graphics
:space attribute to handle whitespace characters inside elements. child elements inside an element may also have an xml:space attribute that overrides the parentʼs one. note: instead of using the xml:space attribute, use the white-space css property. this attribute influences how browsers parse text content and therefore changes the way the dom is built. ...
... all tab characters are converted into space characters. all leading and trailing space characters are removed. ...
...ributeʼs value through the dom api may have no effect. all elements are using this attribute. html, body, svg { height: 100%; } <svg viewbox="0 0 140 50" xmlns="http://www.w3.org/2000/svg"> <text y="20" xml:space="default">default spacing</text> <text y="40" xml:space="preserve">preserved spacing</text> </svg> usage notes value default | preserve default value default animatable no default with this value set, whitespace characters will be processed in this order: all newline characters are removed. all tab characters are converted into space characters. all leading and trailing space characters are removed. all contiguous space characters are collapsed into a single space character. ...
...then, it draws all space characters (including leading, trailing and multiple consecutive space characters). for example, the string "a b" (three spaces between "a" and "b") separates "a" and "b" more than "a b" (one space between "a" and "b"). ...
<feComposite> - SVG: Scalable Vector Graphics
(with the result clamped between [0..1]) can be applied. the arithmetic operation is useful for combining the output from the <fediffuselighting> and <fespecularlighting> filters with texture data. ...
... combining the output from the <fediffuselighting> and <fespecularlighting> filters with texture data. ...
...nt interface. example svg <svg width="330" height="195" viewbox="0 0 1100 650" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>example fecomposite - examples of fecomposite operations</title> <desc>four rows of six pairs of overlapping triangles depicting the six different fecomposite operators under different opacity values and different clearing of the background.</desc> <defs> <desc>define two sets of six filters for each of the six compositing operators. the first set wipes out the background image by flooding with opaque white. the second set does not wipe out the background, with the result that the background sometimes shines through and is other cases is blended i...
... scalable vector graphics (svg) 1.1 (second edition)the definition of '<fecomposite>' in that specification. recommendation initial definition ...
current - XPath
de-set containing only the current node. notes this function is an xslt-specific addition to xpath. it is not a part of the core xpath function library. for an outermost expression (an expression not occurring within another expression), the current node is always the same as the context node (which will be returned by the . or self syntax). the following two are symantically equivalent. ...
...de. notes this function is an xslt-specific addition to xpath. it is not a part of the core xpath function library. for an outermost expression (an expression not occurring within another expression), the current node is always the same as the context node (which will be returned by the . or self syntax). the following two are symantically equivalent. ...
...y equivalent. <xsl:value-of select="current()"/> <xsl:value-of select="."/> in an inner expression (e.g. in square brackets), the current node is still the same as it would have been in an outermost expression. thus within all of the following three expressions the current function (not the entire expressions) returns the same node. moreover, the latter two are semantically equivalent. <xsl:value-of select="current()"/> <xsl:value-of select="foo/bar[current() = x]"/> <xsl:variable name="current" select="current()"/> <xsl:value-of select="foo/bar[$current = x]"/> and the next code is also semantically equivalent to the latter two, since the . occurs in an outermost expression. <xsl:variable name="current" select="."/> <xsl:value-of select="foo/bar[$current = x]"/> but the . always...
...= x]"/> the . returns the bar node, which may be different from the current node. ...
key - XPath
Web › XPath › Functions › key
returns a node set. notes the xsl:key element defines what attribute on what given elements will be used to match the key. ...
... returns a node set. notes the xsl:key element defines what attribute on what given elements will be used to match the key. ...
... returns a node set. notes the xsl:key element defines what attribute on what given elements will be used to match the key. ...
... returns a node set. notes the xsl:key element defines what attribute on what given elements will be used to match the key. ...
Index - XPath
Web › XPath › Index
the generate-id function generates a unique id for the first node in a given node-set and returns a string containing that id. 32 id xslt, xslt_reference the id function finds nodes matching the given ids and returns a node-set containing the identified nodes. 33 key xslt, xslt_reference the key function returns a node-set of nodes that have the given value for the given key. 34 lang xslt, xslt_reference the lang function determines whether the context node matches the given language and returns boolean true or false. 35 last xslt, xslt_reference the last function returns a number equal to the context size from the expression evaluation context. 36 local-name xslt, xslt_reference t...
...first node in a given node-set. 39 normalize-space xslt, xslt_reference the normalize-space function strips leading and trailing white-space from a string, replaces sequences of whitespace characters by a single space, and returns the resulting string. 40 not xslt, xslt_reference the not function evaluates a boolean expression and returns the opposite value. 41 number xslt, xslt_reference the number function converts an object to a number and returns the number. 42 position xslt, xslt_reference the position function returns a number equal to the context position from the expression evaluation context. 43 round xslt, xslt_reference the round function returns a number that is the nea...
... the substring-after function returns a string that is the rest of a given string after a given substring. 49 substring-before xslt, xslt_reference the substring-before function returns a string that is the part of a given string before a given substring. 50 sum xslt, xslt_reference the sum function returns a number that is the sum of the numeric values of each node in a given node-set. 51 system-property xslt, xslt_reference the system-property function returns an object representing the given system-property. 52 translate xslt, xslt_reference the translate function evaluates a string and a set of characters to translate and returns the translated string. 53 true xslt, xslt_reference ...
...51 system-property xslt, xslt_reference the system-property function returns an object representing the given system-property. 52 translate xslt, xslt_reference the translate function evaluates a string and a set of characters to translate and returns the translated string. 53 true xslt, xslt_reference the true function returns a boolean value of true. 54 unparsed-entity-url xslt, xslt_reference the unparsed-entity-url() function returns the uri of the unparsed entity with the given name. this is non-xml data referenced in the dtd of the source document. 55 index index, reference, xpath, xslt found 57 pages: 56 introduction to using xpath in javascript add-ons, dom, extensions,...
XSLT elements reference - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element
, not discussed here, is the literal result element (lre). an lre also appears in a template. it consists of any non-instruction element that should be copied as-is to the result document, for example, an <hr> element in an html conversion stylesheet. on a related note, any attribute in an lre and some attributes of a limited number of xslt elements can also include what is known as an attribute value template. an attribute value template is simply a string that includes an embedded xpath expression which is used to specify the value of an attribute. at run-time the expression is evaluated and the result of the evaluation is substituted for the xpath expression. for example, assume that a variable "image-dir" is defined as follows: <xsl:variable name="image-dir">/images</xsl:variable> the ex...
...s that follow include a description, a syntax listing, a list of required and optional attributes, a description of type and position, its source in the w3c recommendation and an explanation of the degree of present gecko support. use the {{listsubpages}} macro once the bcd for <xsl:fallback>, <xsl:import>, <xsl:namespace-alias>, <xsl:number>, <xsl:output>, <xsl:stylesheet>, <xsl:text> and <xsl:value-of> is fully migrated. <xsl:apply-imports><xsl:apply-templates><xsl:attribute-set><xsl:attribute><xsl:call-template><xsl:choose><xsl:comment><xsl:copy-of><xsl:copy><xsl:decimal-format><xsl:element><xsl:fallback><xsl:for-each><xsl:if><xsl:import><xsl:include><xsl:key><xsl:message><xsl:namespace-alias><xsl:number><xsl:otherwise><xsl:output><xsl:param><xsl:preserve-space><xsl:processing-instruction>...
...:attribute><xsl:call-template><xsl:choose><xsl:comment><xsl:copy-of><xsl:copy><xsl:decimal-format><xsl:element><xsl:fallback><xsl:for-each><xsl:if><xsl:import><xsl:include><xsl:key><xsl:message><xsl:namespace-alias><xsl:number><xsl:otherwise><xsl:output><xsl:param><xsl:preserve-space><xsl:processing-instruction><xsl:sort><xsl:strip-space><xsl:stylesheet><xsl:template><xsl:text><xsl:transform><xsl:value-of><xsl:variable><xsl:when><xsl:with-param> <xsl:apply-imports> <xsl:apply-templates> <xsl:attribute> <xsl:attribute-set> <xsl:call-template> <xsl:choose> <xsl:comment> <xsl:copy> <xsl:copy-of> <xsl:decimal-format> <xsl:element> <xsl:fallback> (not supported) <xsl:for-each> <xsl:if> <xsl:import> (mostly supported) <xsl:include> <xsl:key> <xsl:message> <xsl:namespace-alias> (n...
...t> (mostly supported) <xsl:include> <xsl:key> <xsl:message> <xsl:namespace-alias> (not supported) <xsl:number> (partially supported) <xsl:otherwise> <xsl:output> (partially supported) <xsl:param> <xsl:preserve-space> <xsl:processing-instruction> <xsl:sort> <xsl:strip-space> <xsl:stylesheet> (partially supported) <xsl:template> <xsl:text> (partially supported) <xsl:transform> <xsl:value-of> (partially supported) <xsl:variable> <xsl:when> <xsl:with-param> ...
Content Scripts - Archive of obsolete content
s presented in this guide are available as complete, but minimal, add-ons in the addon-sdk-content-scripts repository on github. loading content scripts you can load a single script by assigning a string to either the contentscript or the contentscriptfile option. the contentscript option treats the string itself as a script: // main.js var pagemod = require("sdk/page-mod"); var contentscriptvalue = 'document.body.innerhtml = ' + ' "<h1>page matches ruleset</h1>";'; pagemod.pagemod({ include: "*.mozilla.org", contentscript: contentscriptvalue }); the contentscriptfile option treats the string as a resource:// url pointing to a script file stored in your add-on's data directory. jpm doesn't make a "data" directory by default, so you must add it and put your co...
...he dom for the page has been loaded: that is, at the point the domcontentloaded event fires. at this point, content scripts are able to interact with the dom content, but externally-referenced stylesheets and images may not have finished loading. "end": load the scripts after all content (dom, js, css, images) for the page has been loaded, at the time the window.onload event fires. ...
...load the scripts after all content (dom, js, css, images) for the page has been loaded, at the time the window.onload event fires. the default value is "end". note that tab.attach() doesn't accept contentscriptwhen, because it's generally called after the page has loaded. passing configuration options the contentscriptoptions is a json object that is exposed to content scripts as a read-only value under the self.options property: // main.js var tabs = require("sdk/tabs"); tabs.on('ready', function(tab) { tab.attach({ contentscript: 'window.alert(self.options.message);', contentscriptoptions: {"message" : "hello world"} }); }); any kind of jsonable value (object, array, string, etc.) can be used here. accessing the dom content scripts can access the dom of a page, of c...
content/loader - Archive of obsolete content
file urls of content scripts to load. content scripts specified by this property are loaded before those specified by the contentscript property. contentscript the texts of content scripts to load. content scripts specified by this property are loaded after those specified by the contentscriptfile property. contentscriptwhen when to load the content scripts. ...
...optional. contenturl the url of the content loaded. allow permissions for the content, with the following keys: ...
...optional. contenturl the url of the content loaded. allow permissions for the content, with the following keys: ...
content/mod - Archive of obsolete content
/ assuming window points to the content page we want to modify attachto(style, window); // ... detachfrom(style, window); parameters modification : object the modification we want to remove from the target window : nsidomwindow the window to be modified. if window is not provided modification is removed from all targets it's being attached to. gettargetwindow(target) function takes target, value representing content (page) and returns nsidomwindow for that content. if target does not represents valid content null is returned. for example target can be a content window itself in which case it's will be returned back. parameters target : object the object for which we want to obtain the window represented or contained. if a nsidomwindow is given, it works as an identify function, return...
... as an identify function, returns target itself. returns nsidomwindow|null : the window represented or contained by the target, if any. returns null otherwise. attach(modification, target) function applies given modification to a given target representing a content to be modified. parameters modification : object the modification we want to apply to the target target : object target is a value that representing content to be modified. it is valid only when gettargetwindow(target) returns nsidomwindow of content it represents. detach(modification, target) function removes attached modification. if target is specified modification is removed from that target only, otherwise modification is removed from all the targets it's being attached to. parameters modification : object the modi...
...twindow(target) returns nsidomwindow of content it represents. detach(modification, target) function removes attached modification. if target is specified modification is removed from that target only, otherwise modification is removed from all the targets it's being attached to. parameters modification : object the modification we want to remove from the target target : object target is a value that representing content to be modified. it is valid only when gettargetwindow(target) returns nsidomwindow of content it represents. if target is not provided modification is removed from all targets it's being attached to. ...
stylesheet/utils - Archive of obsolete content
working with stylesheets. globals functions loadsheet(window, uri, type) synchronously loads a style sheet from uri and adds it to the list of additional style sheets of the document. the sheets added takes effect immediately, and only on the document of the window given. parameters window : nsidomwindow uri : string, nsiuri} type : string the type of the sheet. ...
...i, type) synchronously loads a style sheet from uri and adds it to the list of additional style sheets of the document. the sheets added takes effect immediately, and only on the document of the window given. parameters window : nsidomwindow uri : string, nsiuri} type : string the type of the sheet. it accepts the following values: "agent", "user" and "author". if not provided, the default value is "author". removesheet(window, uri, type) remove the document style sheet at sheeturi from the list of additional style sheets of the document. the removal takes effect immediately. parameters window : nsidomwindow uri : string, nsiuri} type : string the type of the sheet. it accepts the following values: "agent", "user" and "author". if not provided, the default value is "author". ist...
...at sheeturi from the list of additional style sheets of the document. the removal takes effect immediately. parameters window : nsidomwindow uri : string, nsiuri} type : string the type of the sheet. it accepts the following values: "agent", "user" and "author". if not provided, the default value is "author". istypevalid(type) verifies that the type given is a valid stylesheet's type. the values considered valid are: "agent", "user" and "author". parameters type : string the type of the sheet. returns boolean : true if the type given is valid, otherwise false. ...
test/assert - Archive of obsolete content
ents the assert interface defined in the commonjs unit testing specification version 1.1. usage to use the assert module, write a set of unit tests following the instructions in the unit testing tutorial. each test will be passed an assert object when you run the tests using jpm test. you can use this object to make assertions about your program's state. for example: var a = 1; exports["test value of a"] = function(assert) { assert.ok(a == 1, "test that a is 1"); } require("sdk/test").run(exports); globals constructors assert(logger) create a new assert object. this function is only called by the unit test framework, and not by unit tests themselves. parameters logger : object object used to log the results of assertions. assert an object used to make assertions about a program...
...is not two"); parameters actual : object the actual result. expected : object the expected result. message : string optional message to log, providing extra information about the test. deepequal(actual, expected, message) tests that two objects have a deep equality relation. deep equality is defined in the commonjs specification for assert, item 7, which is quoted here: all identical values are equivalent, as determined by ===. if the expected value is a date object, the actual value is equivalent if it is also a date object that refers to the same time. other pairs that do not both pass typeof value == "object", equivalence is determined by ==. for all other object pairs, including array objects, equivalence is determined by having the same number of owned properties (as verifi...
...note: this accounts for both named and indexed properties on arrays. assert.deepequal({ a: "foo" }, { a: "foo" }, "equivalent objects"); parameters actual : object the actual result. expected : object the expected result. ...
cfx to jpm - Archive of obsolete content
e one for you, which will look something like "jid1-f3boogbjqje67a". add-on ids need to be one of two types: a guid or a string that includes an "@" symbol. the sdk expects the latter format, and if the id in package.json doesn't contain "@", then cfx xpi will append "@jetpack" to the package.json field, and make that the add-on id. so: if you never did anything with ids when using cfx, then the value in your add-on's package.json will be something like "jid1-f3boogbjqje67a", and the corresponding id in the install.rdf will be "jid1-f3boogbjqje67a@jetpack". id handling with jpm when you create an xpi with jpm xpi: if the package.json does not include an id field, then the id written into the install.rdf is the value of the name field prepended with "@". if the package.json does include a...
...ue of the name field prepended with "@". if the package.json does include an id field, and it contains "@", then this is written into the install.rdf as the add-on id. if the package.json does include an id field, and it does not contain "@", then jpm xpi raises an error and the xpi will not be built. what you need to do all this means that: if your package.json contains an id field, and its value does not contain "@", then you must append "@jetpack" to it when switching to jpm. if you do this, the add-on's id will be the same as it was when you were using cfx. entry point the add-on's entry point is the file that's executed when the add-on needs to initialize itself: for example, when firefox starts, or when the add-on's installed, enabled, or upgraded. with cfx, this defaults to "lib/...
...ox starts, or when the add-on's installed, enabled, or upgraded. with cfx, this defaults to "lib/main.js", although it can be set to a different file using the main field in package.json. in jpm, the entry point defaults to "index.js". so when switching over to jpm: either rename your "main.js" to "index.js" and move it from "lib" to the top level or add a main field to package.json with the value "lib/main.js". loading modules the jpm tool uses the same logic as node.js to determine how to resolve the argument to require(). in most respects this is the same as the old cfx logic. however there are a few differences, because old compatibility shims have been removed. requiring local modules suppose your add-on is structured into separate modules: my-addon lib main.js...
Canvas code snippets - Archive of obsolete content
this can be used to determine if the mouse cursor is inside a certain shape or not. function getpixelcolour(canvas, x, y) { var cx = canvas.getcontext('2d'); var pixel = cx.getimagedata(x, y, 1, 1); return { r: pixel.data[0], g: pixel.data[1], b: pixel.data[2], a: pixel.data[3] }; } chaining methods this class provides j...
... canvas2dcontext.prototype[method] = function() { this.ctx[method].apply(this.ctx, arguments); return this; }; } for (let m of gettermethods) { let method = m; canvas2dcontext.prototype[method] = function() { return this.ctx[method].apply(this.ctx, arguments); }; } for (let p of props) { let prop = p; canvas2dcontext.prototype[prop] = function(value) { if (value === undefined) return this.ctx[prop]; this.ctx[prop] = value; return this; }; } }; var canvas = document.getelementbyid('canvas'); // use context to get access to underlying context var ctx = canvas2dcontext(canvas) .strokestyle('rgb(30, 110, 210)') .transform(10, 3, 4, 5, 1, 0) .strokerect(2, 10, 15, 20) .context; // use property name as a ...
... saving a canvas image to a file the following function accepts a canvas object and a destination file path string. ...
Miscellaneous - Archive of obsolete content
nction(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.getelementbyid("example"), "th...
...that was attempt number %s. these properties can be accessed from javascript in the following manner: var common = {...
...that was attempt number %s. ...
SVG General - Archive of obsolete content
here are some examples of using it: var circle = makesvg("circle", {id: "circle1", c...
...here are some examples of using it: var circle = makesvg("circle", {id: "circle1", cx: "60", cy: "60", r: "50"}); var img = makesvg("image", {id: "img1", x: "110", y: "110", width: "100", height: "100", s...
...; function makesvg(tag, attributes) { var elem = document.createelementns(svgns, tag); for (var attribute in attributes) { var name = (attribute in attr_map ? attr_map[attribute] : attribute); var value = attributes[attribute]; if (attribute in ns_map) elem.setattributens(ns_map[attribute], name, value); else elem.setattribute(name, value); } return elem; } attributes are packed in a literal object and the helper script unpacks them and adds them to the element. here are some examples of using it: var circle = makesvg("circle", {id: "circle1", cx: "60", cy: "60", r: "50"}); var img = makesvg("image", {id: "img1", x: "110", y: "110", width: "100", height: "100", svghref: "bubbles.png"}); var text = makesvg("text", {id:...
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
on xpidl_module = myextension xpi_name = myextension exports = \ myheader.h \ $(null) xpidlsrcs = \ myifirstcomponent.idl \ myisecondcomponent.idl \ $(null) include $(topsrcdir)/config/rules.mk xpidl_module is the name of the generated xpt file that contains type information about your idl interfaces. ...
...xpidlsrcs are run through the idl processor, and the generated c++ headers are copied into the same include directory. in addition, an xpt (type library) file is generated and placed in the components/ subdirectory of your extension. ...
... every makefile to be safe. you can use the same module in both base/ and advanced/ so that all the generated include files go into the same directory, but make sure that you don't use the same xpidl_module in the two public/ directories or one of the component type libraries (i.e. xpt files) will overwrite the other one and all hell will break loose. each module must also have a different value for the library_name variable. this is the name of the generated dynamic library, so if we call the libraries "mybase" and "myadvanced", we'll end up with mybase.dll and myadvanced.dll (on windows, at least). and each of these modules is going to have a separate c++ file for registering components. so there will be two files that look like myextension.cpp in the original example, say base.cpp and...
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
t the attributes we used: the toolbarname is the name that will appear on the view > toolbars menulist. this menu allows hiding and showing any toolbar. the customizable attribute determines if the user can customize the toolbar. you should normally set this to true, unless you have strong reasons not to want users changing your toolbar. the mode attribute is set to icons, which is the usual value. this can be changed in the customize dialog by the user. the context attribute should also be set if you want a customizable toolbar. it points to the id of a popup element that holds the customization options that are displayed when the user right-clicks on the toolbar. this popup is already part of the main window, so it doesn't need to be implemented again. the defaultset attribute lists th...
...oints to the id of a popup element that holds the customization options that are displayed when the user right-clicks on the toolbar. this popup is already part of the main window, so it doesn't need to be implemented again. the defaultset attribute lists the ids of the icons you want to include on your toolbar by default. it's a comma-separated list of ids, and it can also include other special values: spacer, separator and spring. spacer represents an empty button space, separator a vertical separation line and spring a flexible empty area that stretches. finally, the insertbefore attribute places our toolbar above the bookmarks toolbar. this is a matter of personal preference, but the mac os theme seems to be designed so that the bookmarks toolbar is always the last one (it has a lighter c...
...olbars dialog firefox has the option to customize its toolbars. we've already mentioned this before, and if you follow our recommendations, then you shouldn't have many problems making your toolbar compatible with the customize toolbars dialog. the dialog can be opened from view > toolbars > customize..., or by right-clicking on the main toolbar (or any toolbar with the correct context attribute value) and clicking on the customize option. other than what we have stated before, you should take into account the controls at the bottom of the customize toolbars dialog. you should test your toolbar buttons and items under all combinations of icons / icons and text / text, use small icons, and having your icons in different toolbars. you should also test that the reset to defaults button works cor...
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
arkup 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" language="javascript" src="xmlrequest.js"></script> <script> /* ***** begin license block ***** * version: mpl 1.1 * * the contents...
...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.getelementsbytagname(tagname).item(0).firstchild.nodevalue; linkk=article.getattribute("url"); strvalue="<div class='nde-blurb'><h3><a href='"+linkk+"'>"+valuee+"</a>...
... tagname="summary"; // ie fix if(document.all) tagname="nde:"+tagname; paraa=article.getelementsbytagname(tagname).item(0).firstchild.nodevalue; linkk=article.getattribute("url"); strvalue="<div class='nde-blurb'><h3><a href='"+linkk+"'>"+valuee+"</a></h3><p>"+paraa+"</p></div>"; document.getelementbyid("container").innerhtml+=strvalue; } } if(previousele) { previousele.style.backgroundcolor="white"; } ele.style.backgroundcolor="#ddeeff"; previousele=ele; } var previousele=null; </script> <style> .tab { position:relative;top:1px; border: 1px solid #dddddd; color:white; background-color:white; padding-left: 5px; border-bottom:white;padding-right: 5px; padding-top:3px; text-decoration:none;} .tab:hover { bac...
Using content preferences - Archive of obsolete content
setting and retrieving preferences for specific sites or in the global preference space; global preferences are used whenever a site-specific preference isn't available. site-specific content preferences are stored in the profile folder, in the database file "content-prefs.sqlite". example: setting and retrieving preferences this example demonstrates how to save a preference and then retrieve its value. var iosvc = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); var prefservice = components.classes["@mozilla.org/content-pref/service;1"] .getservice(components.interfaces.nsicontentprefservice); // create a uri object referencing the site to save a preference for var uri = iosvc.newuri("http://developer.mozill...
...@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); var prefservice = components.classes["@mozilla.org/content-pref/service;1"] .getservice(components.interfaces.nsicontentprefservice); // create a uri object referencing the site to save a preference for var uri = iosvc.newuri("http://developer.mozilla.org/", null, null); // set the value of the "devmo.somesetting" preference to "foo". prefservice.setpref(uri, "devmo.somesetting", "foo"); ... // retrieve the value of the "devmo.somesetting" preference. var value = prefservice.getpref(uri, "devmo.somesetting"); built-in site-specific preferences preference name menu equivalent values notes browser.content.full-zoom view / zoom exa...
... browser.content.full-zoom view / zoom example: "1.10000002384186" (rounding variant of "1.1") related about:config preferences: browser.zoom.full boolean, set by the menu item view / zoom / zoom text only. despite the confusion in names, this preference is not site-specific. browser.zoom.sitespecific toolkit.zoommanager.zoomvalues zoom.maxpercent and zoom.minpercent browser.download.lastdir path of a filesystem directory related about:config preferences: browser.download.lastdir the last directory for any site use downloadlastdir.jsm for access to these preferences. browser.upload.lastdir path of a filesystem d...
How Mozilla finds its configuration files - Archive of obsolete content
we chose to point this to the user's home directory (h:\mozilla). ...
...we chose to point this to the user's home directory (h:\mozilla). ...
...the xml file back into the binary registry.dat file. usage: ./writemozprofile.pl < registry.xml >registry.dat a ready-to-use registry.dat file pointing to h:\mozilla a registry.xml file pointing to h:\mozilla an example of a prefs.js file (to put into the user's h:\mozilla directory). if you use the userd system from the lll project, you can generate this automatically with the user's personal values by using this template file prefs.js.tmpl n.b. mozilla includes a profile manager, but unfortunately this always include a random part (salt) into the profile's filename, and thus cannot be used to point mozilla to a profile of the our chosing. n.b. the above scripts have been tested with perl-5.8.0, xml-parser-2.34, xml-sax-0.13 and xml-simple-2.14. different versions of perl, or of these modu...
In-Depth - Archive of obsolete content
rent; -moz-border-bottom-colors: threeddarkshadow threedshadow transparent; -moz-border-left-colors: threeddarkshadow threedshadow transparent; -moz-border-top-colors see -moz-border-bottom-colors above. -moz-border-left-colors see -moz-border-bottom-colors above. -moz-border-right-colors see -moz-border-bottom-colors above. -moz-border-radius rounds the corners of a box. if you specify one px/% value, it will apply it to all the corners, or you can specify 4 values (separated by a space) and have each corner different. -moz-border-radius-topleft the same as -moz-border-radius but only applies to the top left corner. an example of where this would be used is on tabs. -moz-border-radius-topright the same as -moz-border-radius but only applies to the top right corner. an example of where this wo...
...ld be used is on a footer. -moz-box-direction controls which way the items in this box are displayed. normal in english web browsers items are displayed top to bottom and left to right. this will flip it around so items inside of this box will be displayed bottom to top and right to left. this is useful for, say, putting the navigation controls (back button) on the right hand side of the toolbar. ...
...how do i know what to modify? now that you've got everything extracted and you know how to modify items, you might be wondering, how do i know where everything is? well there is an easy way to find out - using the dom inspector. ...
Block and Line Layout Cheat Sheet - Archive of obsolete content
eated. nslinebox a block consists of lines and other blocks, stacked vertically. a block frame has one nslinebox for each line, and one nslinebox for each block child. these are stored as a doubly-linked list in the mlines member of nsblockframe. nsinlineframe mflags ns_inline_frame_contains_percent_aware_child this flag is set if the inline frame has any children that have a percentage value set (via the style context) for the width or height of the content area, padding, border, or margin. nshtmlreflowstate the current state of reflow, built up as reflow recursively descends the frame tree. this is "passed in" to a child frame from its parent, and provides the constraints in which the child frame must size itself; e.g. the width and height available to the child frame. mcompute...
... provides the constraints in which the child frame must size itself; e.g. the width and height available to the child frame. mcomputedwidth mcomputedheight mcomputedmargin mcomputedborderpadding mcomputedpadding mcomputedoffsets mcomputedminwidth mcomputedmaxwidth mcomputedminheight mcomputedmaxheight given the current container frame and the style applied to the child, these values are the resolved values for the child frame's box. nshtmlreflowmetrics the structure that is "filled in" by a frame during reflow, and is used to communicate the frame's desired size information back to its container. mmaximumwidth the maximum width that the frame would consume if it were reflowed with an unconstrained available width. it might be better named "preferred width". this is co...
...uld consume if it were reflowed with an unconstrained available width. it might be better named "preferred width". this is computed when the nsblockreflowstate flag brs_computemaxwidth is set. maxelementwidth the maximum width for elements within the frame that cannot be broken down further; e.g., the longest word in a paragraph. note that an out-of-flow frame (e.g., a floater) may affect this value. this field is a pointer to an nssize object. when null, the frame need not compute it. nsblockreflowstate additional reflow state information that the block frame uses along with nshtmlreflowstate. like nshtmlreflowstate, this is read-only data that is passed down from a parent frame to its children. mflags brs_unconstrainedwidth this flag is set in the nsblockreflowstate constructor whe...
Creating a Help Content Pack - Archive of obsolete content
a firefox help") for the help window. this attribute is required. nc:defaulttopic will hold the rdf:id of the topic you want displayed when the viewer first loads if none has been specified. this attribute also specifies what topic is loaded when the user hits the home button in the viewer. we'll get to exactly how to fill in this attribute later. this attribute is optional, with fallback to the value welcome. nc:base contains the base url relative to which the help content referenced in the descriptor file is located. for example, if your glossary, index, and table of contents rdf files are all located at chrome://myapp/locale/help/*, then you could put chrome://myapp/locale/help/ here and use only the actual file names without path when needed later. you don't actually need this attribute i...
... rdf:id="foo" nc:link="foo.html" nc:title="foo"/></rdf:li> next, add the following to your file just after the existing rdf:description element: <rdf:description rdf:about="#foo"> <nc:subheadings> <rdf:seq> <rdf:li><rdf:description rdf:id="bar" nc:link="bar.html" nc:title="bar"/></rdf:li> </rdf:seq> </nc:subheadings> </rdf:description> except for the different value for rdf:about, this looks exactly like a top-level entry definition. the difference is a result of how rdf works. in rdf data describes data. top-level entries describe the root node, urn:root; nested entries describe other entries. you can refer to an entry by giving the entry a unique rdf:id attribute. then, to describe that entry, you set an rdf:about attribute to the value of the entry's rdf:...
...rsions of the viewer, it will be the only data source ever directly displayed. it's the primary way to provide a structured view of the help you provide to users. the table of contents also provides the list of topics from which the home page for the viewer will be chosen. recall that in the content pack descriptor file you included an nc:defaulttopic attribute, which defaulted to "welcome". the value of that attribute is the rdf:id of the topic you want displayed when the viewer is loaded. the table of contents data source is exactly like an index data source, and if you have a working index data source you could use it as a table of contents with no changes whatsoever. see the instructions on creating glossary and index data sources to learn how to create a table of contents. additional se...
Introducing the Audio API extension - Archive of obsolete content
ms, and a pre-buffer equal to 500 ms, one would write an array of (2 * 44100 / 10) = 8820 samples, and a total of (currentsampleoffset + 2 * 44100 / 2). it's also possible to auto-detect the minimal duration of the pre-buffer, such that the sound is played without interruptions, and lag between writing and playback is minimal. ...
...uto-detect the minimal duration of the pre-buffer, such that the sound is played without interruptions, and lag between writing and playback is minimal. to do this start writing the data in small portions and wait for the value returned by mozcurrentsampleoffset() to be greater than 0. var prebuffersize = samplerate * 0.020; // initial buffer is 20 ms var autolatency = true, started = new date().valueof(); ... ...
...tween writing and playback is minimal. to do this start writing the data in small portions and wait for the value returned by mozcurrentsampleoffset() to be greater than 0. var prebuffersize = samplerate * 0.020; // initial buffer is 20 ms var autolatency = true, started = new date().valueof(); ... // auto latency detection if (autolatency) { prebuffersize = math.floor(samplerate * (new date().valueof() - started) / 1000); if (audio.mozcurrentsampleoffset()) { // play position moved? autolatency = false; } processing an audio stream since the mozaudioavailable event and the mozwriteaudio() method both use float32array values, it is possible to take the output of one audio stream and pass it directly (or process first and then pass) to a second. the first audio stream needs to be mut...
Menu - Archive of obsolete content
Archive › Mozilla › Jetpack › UI › Menu
rgets. if no such target exists, the position at which the items are added is at the discretion of jetpack. item(target) returns an item in the menu. the item may be modified. if the menu is hidden, it will reflect the changes when it is next shown. if the menu is visible, it will reflect the changes immediately. parameters target indicates the existing item. see targets. return value a menuitem object, or null if no such target exists. popupon(node) binds the menu to a given node. the menu will be shown when the node is left-clicked. parameters node the menu is attached to this node, which may be either a raw dom node or a dom node wrapped by jquery. remove(target) removes an item from the menu. parameters target indicates the existing item to...
...ed by jquery. menuitems menus in jetpack contain menuitem objects, including both built-in firefox menus and menus that features create. no menuitem constructor is exposed, because jetpack automatically boxes simple javascript objects into menuitem objects. creating menuitems to pass a new menuitem into the api, pass one of the following types: null a simple menu separator. (note that any falsey value will suffice, including undefined, null, and the empty string. null is recommended because it stands out.) function a menuitem that will update itself when its menu is shown. the function is invoked just before the item's menu is shown and when the items array of the item's menu is retrieved. it must return a non-function menuitem. if the item belongs to a context menu, the function is called as ...
...match links and all elements contained in links, use jetpack.menu.context.page.on("a[href], a[href] *"). a future version of jetpack may change this behavior; see bug 527924. what do you think? leave a comment on that bug or send a message to the mailing list. parameters selector one or more css selectors. a string. examples: "a[href]", "a[href] > img", "a[href], img". return value a new contextmenuset object. jetpack.menu.context the feature's context menu. all of the feature's context menus are exposed through jetpack.menu.context, including slidebar, panel, toolbar, and status bar item context menus. a contextmenuset object. jetpack.menu.context.browser the chrome context menu. this is the context menu that appears when right-clicking on an element in firefox's interface...
RDF Datasource How-To - Archive of obsolete content
to the component manager rv = compmgr->registercomponent(kmydatasourcecid, "my data source", ns_rdf_datasource_progid_prefix "my-datasource", apath, pr_true, pr_true); ... } replace kmydatasourcecid with your datasource's clsid. replace "my data source" with a descriptive string that should appear in the registry. finally, replace "my-datasource" with a value appropriate for your datasource. this value, when prefixed with "rdf:", is a datasource identifier, and may be used with nsirdfservice::getdatasource() to retrieve your datasource from the rdf service. for example, the above datasource would be accessable as follows: nsirdfservice* rdf; rv = nsservicemanager::getservice(krdfservicecid, kirdfserviceiid, (nsisupports**) &rdf); ...
...om/) that your datasource describes: <window xmlns:html="http://www.w3.org/1999/xhtml" xmlns:rdf="http://www.w3.org/tr/wd-rdf-syntax#" xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul"> <tree datasources="rdf:my-datasource" ref="http://foo.bar.com/"> <template> <treechildren> <treeitem uri="..."> <treerow> <treecell> <text value="rdf:http://home.netscape.com/nc-rdf#name" /> </treecell> <treecell> <text value="rdf:http://home.netscape.com/nc-rdf#url" /> </treecell> </treerow> </treeitem> </treechildren> </template> <treehead> <treeitem> <treecell>name</treecell> <treecell>url</treecell> </treeitem> </treehead...
...e internal xpcom datasource "identifiers" (as described above) and uris for local or remote rdf/xml documents. each datasource that is listed will be loaded, and the assertions contained in the datasource will be made available to the tree control for display. ref="http://foo.bar.com/". this roots the graph in your content model. the tree tag will be treated as if it has the id attribute with a value http://foo.bar.com/. <template>...</template>. the xul template that is used to build content from the graph. starting with the resource that corresponds to the tree element, http://foo.bar.com/, the graph will be traversed and content will be constructed using the pattern specified within the template tags. for a complete description of how content is built from rdf, see the xul:template gui...
Running Tamarin performance tests - Archive of obsolete content
ttvmi (tamarin-tracing interp) -m --memory logs the high water memory mark --aotsdk location of the aot sdk used to compile tests to standalone executables. --...
...dex= index file to use (must end with .py) --saveindex= save results to given index file name option details indexing: there are two command line flags that control indexing: --index and —saveindex both require an index filename to be specified after the flag. "--index index.py" will load index.py and run all of the tests in that index and report results normalized to the index values. a subset of the tests in the index can be run by passing what tests you want to run after specifying the index file. "--saveindex indexname.py" will run the specified tests and save the values to the give index file. specifying both --index and --saveindex will merge the values specified in --index to the new saved indexfile. cumulative score: new option of --score will display a cumulati...
...index file. "--saveindex indexname.py" will run the specified tests and save the values to the give index file. specifying both --index and --saveindex will merge the values specified in --index to the new saved indexfile. cumulative score: new option of --score will display a cumulative score for every metric. really most useful with an index file (or v8 tests), since running with raw time values will skew the results towards longer running tests csv output: "--csv filename" will save run results to a csv file that can be analyzed using excel pivottables. use --csvappend if you want to append the results to the csv file support files testconfig.txt this file contains instructions for how the harness should handle performance tests. metricinfo.py this file contains a list of metrics ...
Binding Attachment and Detachment - Archive of obsolete content
an individual url in the set consists of the binding document's url and the binding's document-unique identifier. in the following example, a binding is referenced that will be attached to all html checkbox elements. ...
...an individual url in the set consists of the binding document's url and the binding's document-unique identifier. in the following example, a binding is referenced that will be attached to all html checkbox elements. ...
...ed through the dom are detached when the following conditions are met: mozbinding style rule is removed the element is destroyed (e.g., by closing the document) when a binding is detached, the following events occur: anonymous content generated by the binding is destroyed. methods and properties with getters/setters are no longer accessible from the binding, although properties with raw values remain. any specified event handlers are unhooked from their respective targets. a binding can specify a <destructor> block within <implementation> section that executes prior to the binding detachment. using a <destructor> block, a binding can perform any necessary cleanup before it is torn down. bindings in an inheritance chain are always detached from the most derived binding to the base.
align - Archive of obsolete content
for boxes that have horizontal orientation, it specifies how its children will be aligned vertically. for boxes that have vertical orientation, it specifies how its children will be aligned horizontally. start child elements are aligned starting from the left or top edge of the box. if the box is larger than the total size of the children, the extra space is placed on the right or bottom side. ...
... extra space is split equally along each side of the child elements, resulting in the children being placed in the center of the box. end child elements are placed on the right or bottom edge of the box. if the box is larger than the total size of the children, the extra space is placed on the left or top side. baseline this value applies to horizontally oriented boxes only. it causes the child elements to be aligned so that their text labels are lined up. stretch this is the default value. the child elements are stretched to fit the size of the box. for a horizontal box, the children are stretched to be the height of the box. for a vertical box, the children are stretched to be the width of t...
...n. left the elements are aligned on their left edges. center the elements are centered horizontally. right the elements are aligned on their right edges. the pack attribute is related to the alignment but is used to specify the position in the opposite direction. you can also specify the value of align using the style property -moz-box-align. ...
crop - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › crop
an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. ...
...th the start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. ...
...atform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or the maxwidth attribute) to override this size. ...
dir - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › dir
for other elements, they are placed right to left or bottom to top. this is reverse of the order in which they appear in the xul code. ...
...for other elements, they are placed right to left or bottom to top. this is reverse of the order in which they appear in the xul code. ...
...for other elements, they are placed right to left or bottom to top. this is reverse of the order in which they appear in the xul code. ...
hidespinbuttons - Archive of obsolete content
...
... ...
... ...
min - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › min
...
... ...
... ...
pageincrement - Archive of obsolete content
...
... ...
... ...
popup.position - Archive of obsolete content
« xul reference home position type: string the position attribute determines where the popup appears relative to the element the user clicked to invoke the popup. this allows you to place the popup on one side of a button. note that a context menu will never respect this attribute, always appearing relative to the mouse cursor. ...
...voke the popup. this allows you to place the popup on one side of a button. note that a context menu will never respect this attribute, always appearing relative to the mouse cursor. this value can be specified either as a single word offering pre-defined alignment positions, or as 2 words specifying exactly which part of the anchor and popup should be aligned. if specified as 2 words, the value indicates which corner or edge of the anchor (the first word) is aligned which which corner of the popup (the second word). the anchor value (ie, the first word) can be one of topleft, topright, bottomleft, bottomright, leftcenter, rightcenter, topcenter or bottomcenter. the popup value (ie, the second word) can be one of topleft, topright, bottomleft or bottomright. positions specified as a...
...hor (the first word) is aligned which which corner of the popup (the second word). the anchor value (ie, the first word) can be one of topleft, topright, bottomleft, bottomright, leftcenter, rightcenter, topcenter or bottomcenter. the popup value (ie, the second word) can be one of topleft, topright, bottomleft or bottomright. positions specified as a single word string are shortcuts for the values above. valid single-word values are after_start, after_end, before_start, before_end, end_after, end_before, start_after, start_before, overlap, at_pointer or after_pointer. for more details, including examples, please see popup positioning see also position ...
preference.type - Archive of obsolete content
file a file. ...
... file a file. ...
... file a file. the file path will be stored in the preferences. ...
textbox.min - Archive of obsolete content
...
... ...
... ...
width - Archive of obsolete content
« xul reference home width type: string (representing an integer) the preferred width of the element. the value should not include a unit as all values are in pixels. the actual displayed width may be different if the element or its contents have a minimum or maximum width, or the size is adjusted by the flexibility or alignment of its parent. the css width property may also be used. in this example, the preferred width of the inner hbox will be displayed at 40 pixels. the displayed width is also 40 pixels as no flexibility or alignment applies. ...
... or its contents have a minimum or maximum width, or the size is adjusted by the flexibility or alignment of its parent. the css width property may also be used. in this example, the preferred width of the inner hbox will be displayed at 40 pixels. the displayed width is also 40 pixels as no flexibility or alignment applies. ...
...so 40 pixels as no flexibility or alignment applies. <hbox> <hbox width="40" style="background-color: red;"> <label value="40"/> </hbox> </hbox> however, in the following example, despite that the preferred width of the box is 30 pixels, the displayed size of the box will be larger to accommodate the larger label. <vbox width="30" align="start" style="background-color: red;"> <label value="vbox xul width 10px red"/> </vbox> note: when used on treecol objects, the width attribute can be used to allow a tree to be scrolled horizontally if the column widths add up to be wider than the containing object. ...
Accessing Files - Archive of obsolete content
rting directories. to retrieve other files, you will need to use nsiscriptableio.getfile() to access a directory and iterate through subdirectories until you come to the file that you want. for more information about this, see working with directories. starting directories the examples above use the profile directory 'profile' as the starting directory for locating a file. there are several other values which may be used as the first argument to nsiscriptableio.getfile(), listed in the following table. application the directory of the executing application. for firefox, for instance, this will be the directory where firefox is installed. for a xulrunner application, this will be the directory where the application is installed. working the current work...
... instance, this will be the directory where firefox is installed. for a xulrunner application, this will be the directory where the application is installed. working the current working directory. if the application was launched from a command line, for instance, this will be the directory where the application was launched from, which may be different from the 'application' value. profile the profile directory where preferences are stored. desktop the desktop directory. usually, you would use this as the default directory for saving files. components the components directory where xpcom components are installed. temp the temporary directory. you would store any temporary or cache files...
...directory where preferences are stored. desktop the desktop directory. usually, you would use this as the default directory for saving files. components the components directory where xpcom components are installed. temp the temporary directory. you would store any temporary or cache files here. there are a number of other values that may be used, most of which are platform specific. for instance, on windows, the value 'strt' returns the start directory, where applications which run when the system starts up are placed. on other platforms, using this value will just result in an error. ...
getElementsByAttribute - Archive of obsolete content
note that like most nodelists (but unlike the nodelist returned by queryselectorall), the nodelist returned by this method is live. ...
...note that like most nodelists (but unlike the nodelist returned by queryselectorall), the nodelist returned by this method is live. ...
...note that like most nodelists (but unlike the nodelist returned by queryselectorall), the nodelist returned by this method is live. ...
openPopup - Archive of obsolete content
« xul reference home openpopup( anchor , position , x , y , iscontextmenu, attributesoverride, triggerevent ) return type: no return value opens the popup relative to a specified node at a specific location. anchor the popup may be either anchored to another node or opened freely. to anchor a popup to a node, supply an anchor node and set the position to a string indicating the manner in which the popup should be anchored. the anchor node does not need to be in the same document as the popup. unanchored popups may be created by supplying null as the anchor node. ...
...nchor a popup to a node, supply an anchor node and set the position to a string indicating the manner in which the popup should be anchored. the anchor node does not need to be in the same document as the popup. unanchored popups may be created by supplying null as the anchor node. the direction in which the popup is oriented depends on the direction of the anchor. position possible values for position are: before_start, before_end, after_start, after_end, start_before, start_after, end_before, end_after, overlap, and after_pointer. check positioning of the popup guide for a precise description of the effect of the different values. x, y for an anchored popup, the x and y arguments may be used to offset the popup from its anchored position by some number, measured in...
... iscontextmenu the iscontextmenu argument should be true for context menus and false for all other types of popups. it affects menu item highlighting; that is, while a context menu is open, menus opened earlier do not highlight or execute their items. attributesoverride if the attributesoverride argument is true, the position attribute on the popup node overrides the position value argument. if attributesoverride is false, the attribute is only used if the position argument is empty. triggerevent the event that triggered the popup (such as a mouse click, if the user clicked something to open the popup). ...
showPopup - Archive of obsolete content
if x and y are -1, the popup will be positioned relative to the element specified as the first argument. this is what you might do to show a popup below a button, for example. ...
...if x and y are -1, the popup will be positioned relative to the element specified as the first argument. this is what you might do to show a popup below a button, for example. ...
...he popupalign attribute on the element. the anchor and align arguments are ignored if either x or y are not -1. to have a popup appear relative to another element yet still offset by some number of pixels, determine the actual screen position of the element using the boxobject.screenx and boxobject.screeny properties of the element, and use those as the x and y arguments offset by the desired values. the popuptype should be one of the strings popup, context, or tooltip. each type of popup is intended to be displayed only temporarily; they are not expected to be displayed permanently. ...
MenuItems - Archive of obsolete content
sed to toggle a toolbar on and off. to indicate the current state of the toolbar, a checkbox would be displayed next to the menu item label. if the checkbox is on, the toolbar is shown, whereas if the checkbox is off, the toolbar is not shown. the user can select the menu item to switch the toolbar visibility. this type of menuitem can be created by using the type attribute and setting it to the value "checkbox". <menu label="view" accesskey="v"> <menupopup> <menuitem label="show toolbar" accesskey="t" type="checkbox" checked="true"/> <menuitem label="show status bar" accesskey="s" type="checkbox"/> </menupopup> </menu> both menuitems are of the checkbox type. the first menuitem is checked by default, as indicated by the checked attribute set to the value true. the second menu...
...os used when you wish to have a group of menuitems in which only one can be checked at a time. this works similarly to the checkbox type, except when selecting an item, all others in the same group are automatically unchecked. to create a menuitem that acts like a radio button, set the type attribute to "radio". in addition, set the name attribute to the name of the group that it belongs to. the value of this attribute can be any name you wish; all radio menuitems within the same menu with the same name are part of the same group. <menu label="sort" accesskey="s"> <menupopup> <menuitem label="by name" accesskey="n" type="radio" name="sort"/> <menuitem label="by date" accesskey="d" type="radio" name="sort" checked="true"/> <menuitem label="by subject" accesskey="s" type="radio" n...
...radio type menuitems all with the same name "sort". that means that activating one of the items will check that item and uncheck all other items. the last two menuitems are in a different group "order". activating one will uncheck the other, but will not affect the items in the other group. note how the checked attribute is set to true on one of the radios in each group. this becomes the default value for the menu. if you do not set one, none of the items in that group will be checked by default. as with checkbox type menuitems, you can also set the autocheck attribute on a radio menuitem to disable the automatic adjustment of the checked state. this needs to be set on each radio menuitem. disabling a menuitem to have an item initially disabled, set the disabled attribute to true as in the ...
accessibleType - Archive of obsolete content
« xul reference accessibletype type: integer a value indicating the type of accessibility object for the element. ...
... « xul reference accessibletype type: integer a value indicating the type of accessibility object for the element. ...
... « xul reference accessibletype type: integer a value indicating the type of accessibility object for the element. ...
Sorting and filtering a custom tree view - Archive of obsolete content
this will not work for other types of trees, for example rdf-backed or ones created with dom methods. for the sake of simplicity, strings are not localized and the data loaded is hard coded. because of bug 340478, this code will only work from privileged script. ...
...(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.issorted = function(){ return false; }; this.getlevel = function(row){ return 0; }; this.getimages...
..., lowercases them function prepareforcomparison(o) { if (typeof o == "string") { return o.tolowercase(); } return o; } function 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; loadtab...
Bindings - Archive of obsolete content
"?start"/> <member container="?start" child="?photo"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/description" object="?description"/> </query> it works similarly to the previous triple. the ?photo variable is filled in with the known value and then the arc is looked up the datasource, filling in the value for the ?description variable. the ?description variable would then be used in the action body. let assume though, that we are only going to add a description to one of the photos in the datasource; the other two photos will not have a description. this may mean the description is not known, or that it wasn't filled in by the user...
...for the second photo, the datasource doesn't have any matches for the description, so that potential result will be removed. the same happens for the third photo. in the end, only one photo remains. (?start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/palace.jpg, ?title = 'palace from above', ?description = 'view from th...
...the attributes are the same. this allows a match to occur even if the description is not specified. note that when bindings are used, the bindings and the action must be enclosed inside a rule element. the template builder examines bindings after the query has generated results. it has already determined, in this example, that three matches have been found. the builder continues by filling in the values for any bindings. they are evaluated in a similar though simpler manner than the triples. the value of the ?photo variable is known for each match, the datasource is examined for the description, and the value of the ?description variable is filled in. the effect is three matches, only one of which will display a description. the photos that don't have a description will be treated as if the des...
Multiple Rule Example - Archive of obsolete content
le"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/description" object="?description"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/date" object="?date"/> </conditions> <action> <hbox uri="?photo" class="box-padded"> <vbox> <label value="?title"/> <image src="?photo"/> </vbox> <groupbox> <caption label="photo details"/> <label value="?description"/> <label value="date: ?date"/> </groupbox> </hbox> </action> </rule> <rule> <conditions> <content uri="?start"/> <member container="?start" child="?photo"/> ...
...the second rule matches those photos with a title. if a photo did not have a title, it would not match any rule. in the example data, only the first photo has been given all the pr...
...le doesn't use it, so you cannot refer to the ?date variable in this rule. but, you could use a <binding> to get the date without requiring it to match the conditions. of course, the variable doesn't have to be ?date in the second rule. you might notice that the ?title variable is used in the first rule whereas the ?phototitle variable is used for the second rule, despite that they both store the value of the title predicate. there is no reason for this -- it is only used in this example to show that there is no connection between the variables used in the two rules. you can use different variables if it makes sense in the context of the template or the data, although in this example it would seem more reasonable to use the same variable name. the only exception to this is that the container an...
Template Builder Interface - Archive of obsolete content
ould also be used, for example, to generate html elements. this isn't a very common technique, however, here is an example of how this can be used: <html:div id="photoslist" datasources="template-guide-photos5.rdf" ref="http://www.xulplanet.com/rdf/myphotos" xmlns:html="http://www.w3.org/1999/xhtml"> <html:h1>my photos</html:h1> <template> <html:p uri="rdf:*"><textnode value="rdf:http://purl.org/dc/elements/1.1/title"/></html:p> </template> </html:div> this example generates three paragraphs. some static content before the <template> element displays a <h1> header. since templates were designed for creating xul content, sometimes there can be unusual results when using html. sometimes this is due to different whitespace handling for html and xul, which is why the c...
...ild the template, but we'll see in a later section why this is not usually necessary. to summarize, the refresh method reloads the data, whereas the rebuild method reconstructs the content. the builder is accessible to unprivileged code, so the rebuild and refresh methods may be called by remote code. changing the datasource you can modify the datasource that is used for a template by setting the value of the datasources attribute on the root element. changing this attribute causes the new datasource to be retrieved and the template to be rebuilt. the rdf datasource associated with the template can be retrieved using the element's 'database' property. it implements the nsirdfcompositedatasource interface. since this is a composite datasource, it may contain more than one datasource. these may b...
...may situtations where this will be necessary. if you do plan on determining the datasources dynamically, it is common to start with an empty datasource using the special uri 'rdf:null'. <tree datasources="rdf:null" ref="http://www.xulplanet.com/rdf/myphotos"> this will create a composite datasource with no datasources in it. this syntax is necessary as otherwise you wouldn't be able to specify a value for the datasources attribute, and a template builder would not be attached to the element. in a chrome context, the datasource 'rdf:local-store' is always included even if you don't specify it. this is something to watch out for if you are going to be manipulating the composite datasource. one more note: the datasources attribute may use either absolute or relative urls. relative urls are relati...
Using Multiple Queries to Generate More Results - Archive of obsolete content
erson. a header class is used to distinguish the content, although you could use exactly the same content if you wish. ...
... multiple queries with xml sources you can also use more than query when using an xml source. here is an example which generates two sets of results and shows them together. <vbox datasources="people.xml" ref="*" querytype="xml"> <template> <queryset> <query expr="group[@name='male']/*"/> ...
...e. here is an example which generates two sets of results and shows them together. ...
Adding Event Handlers - Archive of obsolete content
event handling) as this is a fairly large topic and there are plenty of other resources that are available for this. by default the javascript console only shows errors from web content. to show errors in chrome javascript, it is necessary to change the preference javascript.options.showinconsole to true. you can also change the preference javascript.options.strict for debugging. by setting this value to true, non-standard, poorly written, or syntax prone to cause logic errors are logged to the javascript console. responding to events the script will contain code which responds to various events triggered by the user or other situations. there are about thirty or so different events that may be handled in several different ways. a typical event is the user pressing a mouse button or pressing...
...a checkbox or selecting an item from a menu. the command event is a useful event since it automatically handles different ways of activating the element. for example, the command event will occur regardless of whether the user uses the mouse to click a button, or presses the enter key. there are two ways to attach an event listener to an element. first, by using an attribute with a script as its value. second, by calling an element's addeventlistener method. the former may only handle bubbling events but tends to be simpler to write. the latter can handle events at any phase and may also be used to attach multiple listeners for an event to an element. using the attribute form is more common for most events. attribute event listeners to use the attribute form, place an attribute on the elemen...
... to attach multiple listeners for an event to an element. using the attribute form is more common for most events. attribute event listeners to use the attribute form, place an attribute on the element where you want the event listener to be, the name of which should be the event name preceded by the word 'on'. for example, the corresponding attribute for the 'command' event is 'oncommand'. the value of the attribute should be some script that should be executed when the event occurs. typically, this code will be short or just call a function defined in a separate script. an example of responding to a button being pressed: example 1 : source view <button label="ok" oncommand="alert('button was pressed!');"/> since the command event will bubble, it is also possible to place the event liste...
Adding HTML Elements - Archive of obsolete content
xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> then, you can use html tags as you would normally, keeping in mind the following: you must add a html: prefix to the beginning of each tag, assuming you declared the html namespace as above. the tags must be entered in lowercase. ...
...you should always use xul features if they are available and you probably should not use tables for layout in xul. ...
...t i did last summer) was not. this is because there is no html or xul element capable of displaying text enclosing it. to have this text appear, you would need to put it inside the div tag, or enclose the text in a description tag. note: due to bug 554290, this text actually does render in gecko 1.9.2 and later. invalid html elements <html:po>case 1</html:po> <div>case 2</div> <html:description value="case 3"/> all three of the cases above will not display, each for a different reason. case 1 po is not a valid html tag and mozilla has no idea what to do with it. case 2 div is valid but only in html. to get it to work, you will need to add the html: qualifier. case 3 a description element is only valid in xul and not in html. it should not have the html: qualifier. n...
Adding Labels and Images - Archive of obsolete content
ements you cannot embed text directly into a xul file without tags around it and expect it to be displayed. you can use two xul elements for this purpose. label element the most basic way to include text in a window is to use the label element. it should be used when you want to place a descriptive label beside a control, such as a button. an example is shown below: example 1 : source view <label value="this is some text"/> the value attribute can be used to specify the text that you wish to have displayed. the text will not wrap, so the text will all be displayed on a single line. this syntax is the most common of labels. if the text needs to wrap, you can place the text content inside opening and closing tags as in the following example: example 2 : <label>this is some longer text that will ...
...onstrain the width of elements so that we can see the wrapping more easily. control attribute you can use the control attribute to set which control the label is associated with. when the user clicks on an associated label, that control will be focused. this association is also important for accessibility, so that screen readers read aloud the label for the control as the user tabs to it. set the value of the control attribute to the id of the element to be focused. example 3 : source view <label value="click here:" control="open-button"/> <button id="open-button" label="open"/> in the example above, clicking the label will cause the button to be focused. description element for descriptive text not associated with any particular control, you can use the description tag. this element is useful...
...button"/> <button id="open-button" label="open"/> in the example above, clicking the label will cause the button to be focused. description element for descriptive text not associated with any particular control, you can use the description tag. this element is useful for informative text at the top of a dialog or a group of controls for example. as with the label element, you can either use the value attribute for a single line of text or place text or xhtml content inside opening and closing description tags for longer blocks 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 prope...
Custom Tree Views - Archive of obsolete content
om elsewhere. thus, you can just leave the treechildren element empty. the following example shows this: <tree id="my-tree" flex="1"> <treecols> <treecol id="namecol" label="name" flex="1"/> <treecol id="datecol" label="date" flex="1"/> </treecols> <treechildren/> </tree> to assign data to be displayed in the tree, the view object needs to be created which is used to indicate the value of each cell, the total number of rows plus other optional information. the tree will call methods of the view to get the information that it needs to display. in general, although the tree view has thirty or so functions that may be implemented, you only need to implement the ones that the tree will call. three methods that you should implement are listed below. rowcount this property shoul...
...ted, you only need to implement the ones that the tree will call. three methods that you should implement are listed below. rowcount this property should be set to the total number of rows in the tree. getcelltext( row , column ) this method should return the text contents at the specified row and column. this will be called to display data for each cell. the rows are supplied as numeric values starting at 0. the columns are treecolumn objects. in the older versions of mozilla (before firefox 1.5 or mozilla 1.8), the columns are supplied as the values of the id attribute on the columns. if you need a id attribute like older versions, the id property of treecolumn can be used. settree( tree ) this method is called once to set the tree element on the view. here is an example of defin...
...rty of the column argument to the text 'namecol'. this text 'namecol' corresponds to the id of the first treecol in the example above. this example is very simple of course -- in reality you would have more complex data in each cell. the final step is to associate the view object with the tree. the tree has a property view, which can be assigned to the view object declared above. we can assign a value to this property at any time to set or change the view. function setview(){ document.getelementbyid('my-tree').view = treeview; } the following presents the example together. an inline script has been used here to simplify the example. normally, you would put the script in an external script file. example custom tree source <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/...
Grids - Archive of obsolete content
Archive › Mozilla › XUL › Tutorial › Grids
f the button element of course. if you wanted one particular cell to contain multiple elements, you can use a nested hbox or other box element. an hbox is a single element but you can put as many elements that you want inside it. for example: example 2 : source view <grid flex="1"> <columns> <column/> <column flex="1"/> </columns> <rows> <row> <label control="doctitle" value="document title:"/> <textbox id="doctitle" flex="1"/> </row> <row> <label control="docpath" value="path:"/> <hbox flex="1"> <textbox id="docpath" flex="1"/> <button label="browse..."/> </hbox> </row> </rows> </grid> notice in the image how the first column of elements containing the labels has only a single element in each row. the second...
...minwidth and maxwidth and related attributes to further define the size. column based organization you can also place the elements inside the column elements instead of the rows. if you do this, the rows are just declared to specify how many rows there are. example 3 : source view <grid> <rows> <row/> <row/> <row/> </rows> <columns> <column> <label control="first" value="first name:"/> <label control="middle" value="middle name:"/> <label control="last" value="last name:"/> </column> <column> <textbox id="first"/> <textbox id="middle"/> <textbox id="last"/> </column> </columns> </grid> this grid has three rows and two columns. the row elements are just placeholders to specify how many there are. you may add the flex...
...s the entire width or height of the grid. to do this, just add an element inside the rows element that isn't inside a row element. you can use a box type for example, and put other elements inside it if you want to use several elements. here is a simple example: example 5 : source view <grid> <columns> <column flex="1"/> <column flex="1"/> </columns> <rows> <row> <label value="northwest"/> <label value="northeast"/> </row> <button label="equator"/> <row> <label value="southwest"/> <label value="southeast"/> </row> </rows> </grid> the button will stretch to fit the entire width of the grid as it is not inside a grid row. you can use a similar technique to add an element in-between two columns. it would stretch to fit the height of ...
Groupboxes - Archive of obsolete content
and a caption, although you can change the appearance using css. you can create a caption for your groupbox by inserting a caption element as the first child. groupboxes are box elements, so you can use the box attributes, such as orient and flex. a simple groupbox example the example below shows a simple groupbox: example 1 : source view <groupbox> <caption label="answer"/> <description value="banana"/> <description value="tangerine"/> <description value="phone booth"/> <description value="kiwi"/> </groupbox> this will cause four pieces of text to be displayed surrounded by a box with the label answer. note that the groupbox has a vertical orientation by default which is necessary to have the text elements stack in a single column. more complex captions you can also add child e...
...n also add child elements inside the caption element to create a more complex caption. for example, mozilla's font preferences panel uses a drop-down menu as a caption. although any content can be used, usually you would use a checkbox or dropdown menu. example 2 : source view <groupbox flex="1"> <caption> <checkbox label="enable backups"/> </caption> <hbox> <label control="dir" value="directory:"/> <textbox id="dir" flex="1"/> </hbox> <checkbox label="compress archived files"/> </groupbox> in this example, a checkbox has been used as a caption. we might use a script to enable and disable the contents of the groupbox when the checkbox is checked and unchecked. the groupbox contains a horizontal box with a label and textbox. both the textbox and groupbox have been m...
...e of box. you can put any element you want inside it, and apart from its special handling of radio buttons, it works like any other box. any radio buttons placed inside the radio group will be grouped together, even if they are inside nested boxes. this could be used to add extra elements within the structure, such as in the following example: example 3 : source view <radiogroup> <radio id="no" value="no" label="no number"/> <radio id="random" value="random" label="random number"/> <hbox> <radio id="specify" value="specify" label="specify number:"/> <textbox id="specificnumber"/> </hbox> </radiogroup> note that the radiogroup element does not draw a border around it. you should place a groupbox element around it if a border and caption are desired. next, we'll use what we've le...
Progress Meters - Archive of obsolete content
indeterminate progress meters are used when you do not know the length of time of an operation. the progress meter will have an animation such as a spinning barber pole or a sliding box, depending on the platform and theme used. ...
...etermined" 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 determinate. the f...
...normally put an indeterminate progress meter as we don't know how many files we'll be searching or how long the search will take. however, we'll add a normal one for now as an animating one can be distracting during development. the progress meter would normally only appear while the search is taking place. we'll add a script later to turn it on and off. <textbox id="find-text"/> <html:progress value="50" max="100" style="margin: 4px;"/> <button id="find-button" label="find" default="true"/> the value has been set to 50% so that we can see the meter on the window. a margin has been set to 4 pixels so that it is separated from the edge of the window. as was stated earlier, we only want the progress bar to be displayed while the search was occurring. a script will show and hide it as necessa...
Stacks and Decks - Archive of obsolete content
ed over an existing element. for example, a progress bar might be created using a bar and a label overlaid on top of it. shadowing with stacks one convenient use of the stack element however is that you could emulate a number of css properties with it. for example, you could create an effect similar to the text-shadow property with the following: example 1 : source view <stack> <description value="shadowed" style="padding-left: 1px; padding-top: 1px; font-size: 15pt"/> <description value="shadowed" style="color: red; font-size: 15pt;"/> </stack> both description elements create text with a size of 15 points. the first, however is offset one pixel to the right and down by adding a padding to its left and top sides. this has the result of drawing the same text 'shadowed' again but sli...
...ave its own font, underline or size. (you could even make the shadow blink). it is also useful as mozilla doesn't currently support css text shadowing. a disadvantage is that the area taken up by the shadow makes the size of the stack larger. shadowing is very useful for creating the disabled appearance of buttons: example 2 : source view <stack style="background-color: #c0c0c0"> <description value="disabled" style="color: white; padding-left: 1px; padding-top: 1px;"/> <description value="disabled" style="color: grey;"/> </stack> this arrangement of text and shadow colors creates the disabled look under some platforms. note that events such as mouse clicks and keypresses are passed to the element on the top of the stack, that is, the last element in the stack. that means that buttons w...
... the deck element, the deck will have three children. the displayed page of the deck can be changed by setting an selectedindex attribute on the deck element. the index is a number that identifies which page to display. pages are numbered starting from zero. so, the first child of the deck is page 0, the second is page 1 and so on. example 3 : source view <deck selectedindex="2"> <description value="this is the first page"/> <button label="this is the second page"/> <box> <description value="this is the third page"/> <button label="this is also the third page"/> </box> </deck> three pages exist here, the default being the third one. the third page is a box with two elements inside it. both the box and the elements inside it make up the page. the deck will be as large as the ...
Trees - Archive of obsolete content
Archive › Mozilla › XUL › Tutorial › Trees
appear in a tree by setting the rows attribute on the tree element. this attribute specifies how many rows are displayed in the user interface, not how many rows of data there are. the total number of rows is supplied by the tree view. if there are more rows of data in the tree, a scrollbar will appear to allow the user to see the rest of them. if you don't specify the rows attribute, the default value is 0, which means that none of the rows will appear. in this case, you would make the tree flexible. if your tree is flexible, it doesn't need a rows attribute since it will grow to fit the available space. the content tree view having said that the data to be displayed in a tree comes from a view and not from xul tags, there happens to be a built-in tree view which gets its data from xul tags.
...hich should be placed inside a treeitem tag. treecell a single cell in a tree. this element would go inside a treerow element. conveniently, these tags may be placed directly inside the treechildren tag, nested in the order above. the tags define the data to be displayed in the tree body. in this case, the tree uses the built-in tree view, called a content tree view, which uses the labels and values specified on these elements as the data for the tree. when the tree needs to display a row, the tree asks the content tree view for a cell's label by calling the view's getcelltext function, which in turn gets the data from the label of the appropriate treecell. however, the three elements listed above are not displayed directly. they are used only as the source for the data for the view. thus,...
...umn, the second treecell determines the content that will appear in the second column, and so on. the user can select the treeitems by clicking on them with the mouse, or by highlighting them with the keyboard. the user can select multiple items by holding down the shift or control keys and clicking additional rows. to disable multiple selection, place a seltype attribute on the tree, set to the value single. with this, the user may only select a single row at a time. add a tree to our find files example let's add a tree to the find files window where the results of the search would be displayed. the tree will use a content tree view. the following code should be added in place of the iframe. <tree flex="1"> <treecols> <treecol id="name" label="filename" flex="1"/> <treecol id="l...
The Implementation of the Application Object Model - Archive of obsolete content
e the desirable solution for buttons that observe preferences (like the home button) denoting persistence of local annotations to the aom: the persistent attribute a content tree in xul that wishes to allow persistent local annotations to be made to all the nodes in the subtree (including the node itself) must specify this capability using the persistent attribute. ...
...n the subtree (including the node itself) must specify this capability using the persistent attribute. the persistent attribute has values of true and false, with true specifying that local annotations that are persistent are desired. the default assumption if this attribute is not present is that local annotations are not allowed. one subtree nested inside another subtree can specify a different value for the persistent attribute, thus allowing the xul writer to specify a default for the whole window, but to still selectively override it for certain subtrees. note that even if the persistent attribute is set to false, that changes can still be made to a window's content tree. they simply won't be remembered across sessions. preventing the persistence of attributes: the discardable attribute ...
...he discardable attribute. for example, the open attribute used to indicate whether a node is expanded or collapsed in a tree view is something that is sometimes persistent (in the case of bookmarks) and sometimes not (in the case of mail folders). in both cases, the overall tree structure needs to be persistent, but this particular attribute could be either. the discardable attribute takes as its value the attribute name that should be non-persistent. within the subtree at which the discardable attribute occurs, the attribute in question will be considered to be non-persistent. the discardable attribute is ignored when used inside a non-persistent subtree. note that the persistent and discardable attributes only apply when a change has been made to the composite data source that was not handled...
dialogheader - Archive of obsolete content
an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right sid...
...th the start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. ...
... title type: string the text to appear in the title bar of the window. ...
key - Archive of obsolete content
Archive › Mozilla › XUL › key
e displayable characters, such as the enter key or function keys, use this attribute instead of the key attribute. valid keys are listed at keyboard shortcuts. keytext type: string a label for the keyboard shortcut. this text would appear next to a menuitem label if that menuitem is associated with the key element via its key attribute. modifiers type: space-separated list of the values below a list of modifier keys that should be pressed to invoke the keyboard shortcut. multiple keys may be separated by spaces or commas. keys will map to other keys on platforms that do not have them. shift: the shift key. alt: the alt key. on the macintosh, this is the option key. on macintosh this can only be used in conjunction with another modifier, since alt+letter combinations are r...
...meta: the meta key. on the macintosh, this is the command key. control: the control key. os: windows logo key on windows, super or hyper key on linux. this shouldn't be specified directly because it may conflict with system wide shortcut key. accel: the key used for keyboard shortcuts on the user's platform, which is control on windows and linux, and command on mac. usually, this would be the value you would use. access: the access key for activating menus and other elements. on windows, this is the alt key, used in conjuction with an element's accesskey. any: indicates that all modifiers preceding it are optional. oncommand type: script code this event handler is called when the command is activated. this occurs when a user selects a menu item or presses a keyboard shortcut atta...
...onjuction with an element's accesskey. any: indicates that all modifiers preceding it are optional. oncommand type: script code this event handler is called when the command is activated. this occurs when a user selects a menu item or presses a keyboard shortcut attached to the command. phase type: string the event phase where the handler is invoked. this should be set to the value capturing to indicate during the event capturing phase or target to indicate at the target element or left out entirely for the bubbling phase. properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, ...
observes - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] the observes element can be used to listen to a broadcaster and receive events and attributes from it. the observes element should be placed inside the element that wants to observe the broadcaster. ...
...the id, ref, and persist attributes are not observed. element type: id the id of the broadcaster element that the observer is observing. ...
...the id, ref, and persist attributes are not observed. element type: id the id of the broadcaster element that the observer is observing. ...
scrollbar - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] when a container's contents which are larger that the size of the container, scroll bars may be placed at the side of the container to allow the user to scroll around in the container. the scroll bar may also be used independently when a numeric value or percentage needs to be selected by the user. the user can adjust the position of the scroll bar by clicking arrows on either end of the scroll bar or by dragging the scroll bar thumb around. more information is available in the xul tutorial. attributes curpos, increment, maxpos, pageincrement examples <scrollbar curpos="5" maxpos="50"/> attributes curpos type: integer the current position of the scrollbar, which ranges from 0 ...
...n adjust the position of the scroll bar by clicking arrows on either end of the scroll bar or by dragging the scroll bar thumb around. more information is available in the xul tutorial. attributes curpos, increment, maxpos, pageincrement examples <scrollbar curpos="5" maxpos="50"/> attributes curpos type: integer the current position of the scrollbar, which ranges from 0 to the value of the maxpos attribute. the default value is 0. increment type: integer the amount by which the curpos (for scroll bars) or value (for number boxes and scale) attribute changes when the arrows are clicked(or scales are dragged). the default value is 1. maxpos type: integer the maximum position of the scrollbar. the default value is 100. pageincrement ty...
... value is 0. increment type: integer the amount by which the curpos (for scroll bars) or value (for number boxes and scale) attribute changes when the arrows are clicked(or scales are dragged). the default value is 1. maxpos type: integer the maximum position of the scrollbar. the default value is 100. pageincrement type: integer the amount by which the value of the curpos or value attribute changes when the tray of the scroll bar (the area in which the scroll bar thumb moves) is clicked, or when the page up or page down keys are pressed. the default value is 10. properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height...
toolbar - Archive of obsolete content
be invisible unless the alt key is pressed by the user. when set to false, the default, the toolbar is visible. this only has an effect on windows and needs to be combined with type="menubar" and a menubar element. currentset not in seamonkey 1.x type: comma-separated string the current set of displayed items on the toolbar. this will be modified when the user customizes the toolbar. the value of this attribute should be a comma-separated list of item ids from the toolbarpalette or, additionally, any of the following strings: "separator", "spring", "spacer". customindex not in seamonkey 1.x type: integer this value is the index of the toolbar in the list of the custom toolbars. the value is updated automatically by the toolbar customization dialog. customizable not in s...
...rty may also be used. iconsize type: string indicates whether the toolbar should display large icons or small icons; this should be the string "large" or "small", respectively. these can vary from one toolbar to another within a given toolbox, whose iconsize attribute defines the default for all toolbars that don't specify an icon size. mode not in seamonkey 1.x type: one of the values below how the toolbarbuttons on the toolbar are displayed. icons show only icons. text show only text. full show both. toolbarname not in seamonkey 1.x type: string the name of the toolbar, which is listed on the show/hide toolbars menu. properties accessibletype type: integer a value indicating the type of accessibility object for the element. cu...
... you may change the current set of items by setting this property. be careful, as setting this property doesn't automatically update the currentset attribute. firstpermanentchild not in seamonkey 1.x type: element the first permanent child of the toolbar. a permanent child is one that is not customizable and remains on the toolbar. ...
XUL Application Packaging - Archive of obsolete content
p" if xulrunner is registered on the system. see command line options for more details. note: for instructions on deploying your applications see deploying xulrunner. application.ini the application.ini manifest is located at the root of the extension and provides metadata that allows xulrunner to launch the application properly. it is parsed as a windows-style ini file with [headings] and key=value pairs. lines beginning with ; or # are treated as comments. a sample application.ini file can be found in the mozilla source tree. the [app] section the app section specifies metadata about the application name specifies the application name. required name example: name=testapplication version specifies the application version number. required see toolkit version format f...
...of xulrunner is required by the application. minversion specifies the minimum xulrunner version needed by this application. if there are binary components, minversion must equal the version of the libxul sdk which is used to build the application. required example: minversion=1.8 maxversion specify the maximum xulrunner version needed by this application. optional - default value is any xulrunner less than xulrunner 2 example: maxversion=1.8.0.* the [xre] section the xre section specifies various features of xulrunner startup that can be enabled enableextensionmanager specifies whether to enable extensions and extension management. legal values are 1 and 0. optional - default is 0 note: this option does not add menu items that make the extension/theme mana...
...note: this option does not add menu items that make the extension/theme manager available in the ui; that is the responsibility of the application author. example: enableextensionmanager=1 enableprofilemigrator specifies whether, when the application is launched for the first time and there are no profiles, to enable profile migration code through the nsiprofilemigrator interface. legal values are 1 and 0. optional - default is 0 note: the application author is responsible for implementing the nsiprofilemigrator interface; if an implementation is not found no migration will be performed. example: enableprofilemigrator=1 the [crash reporting] section using crash reporting in a xulrunner application ...
Mozprofile - Archive of obsolete content
setting permissions mozprofile also takes care of adding permissions to the profile. see https://github.com/mozilla/mozbase/b...permissions.py resources other mozilla programs offer additional and overlapping functionality for...
...setting permissions mozprofile also takes care of adding permissions to the profile. see https://github.com/mozilla/mozbase/b...permissions.py resources other mozilla programs offer additional and overlapping functionality for profiles. there ...
...pass preferences in to the profile class's constructor: obj = firefoxprofile(preferences=[("accessibility.typeaheadfind.flashbar", 0)]) using a json blob file: mozprofile --preferences myprefs.json using a .ini file: mozprofile --preferences myprefs.ini via the command line: mozprofile --pref key:value --pref key:value [...] when setting preferences from an .ini file or the --pref switch, the value will be interpolated as an integer or a boolean (true/false) if possible. setting permissions mozprofile also takes care of adding permissions to the profile. see https://github.com/mozilla/mozbase/b...permissions.py resources other mozilla programs offer additional and overlapping functionality for profiles. there is also substantive documentation on profiles and their management. profilemanag...
nsIContentPolicy - Archive of obsolete content
in general, you should try not to use this type unless none of the others is a fit. type_script 2 indicates an executable script (such as javascript). type_image 3 indicates an image (for example, <img> elements). type_stylesh...
...eflect the actual mime type of the requested content. aextra an optional argument, pass-through for non-gecko callers to pass extra data to callees. arequestprincipal optional. defines the principal that caused the load. this is optional only for non-gecko code: all gecko code should set this argument. for navigation events, this is the principal of the page that caused this load. return value accept or reject_* shouldprocess() should the resource be processed? shouldprocess() will be called once all the information passed to it has been determined about the resource, typically after part of the resource has been loaded. "processing" means handling by the application. for instance, shouldprocess could be used to allow a response from a server to be handled or ignored depending on th...
...of those; can be null if inapplicable. amimetype the mime type of the requested resource (for example, image/png), as reported by the networking library, if available (may be empty if inappropriate for the type, e.g., type_refresh). aextra an optional argument, pass-through for non-gecko callers to pass extra data to callees. arequestprincipal optional. the requesting principal. return value accept or reject_* example you can implement this interface easily by including the nsicontentpolicy.h header file and implementing public nsicontentpolicy into your class, like this: // put this into your header file #include "_path_to_sdk/include/content/nsicontentpolicy.h" class myclass: public nsisupports, public nsicontentpolicy { ... ns_decl_nsicontentpolicy ... } // and this i...
NPN_GetURLNotify - Archive of obsolete content
char* url, const char* target, void* notifydata); parameters the function has the following parameters: instance pointer to the current plug-in instance. url pointer to the url of the request. can be of any type, such as http, ftp, news, or mailto. target name of the target window or frame, or one of several special target names. for values, see npn_geturl(). notifydata plug-in-private value for associating the request with the subsequent npp_urlnotify() call, which passes this value (see description below). returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. description npn_geturlnotify() work...
... npn_geturlnotify() typically handles the url request asynchronously. it returns immediately and only later handles the request and calls npp_urlnotify(). ...
...ts that complete unsuccessfully, the browser calls npp_urlnotify() as soon as possible. for requests that complete successfully: if the target is non-null, the browser calls npp_urlnotify() after it has finished loading the url. if the target is null, the browser calls npp_urlnotify() after closing the stream by calling npn_destroystream(). if this function is called with a target parameter value of _self or a parent to _self, this function should return nperr_invalid_param. this is the only way to notify the plug-in once it is deleted. warning: in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1), npn_geturlnotify() does not notify the plug-in if notifydata is null. see bug 638367 for details. see also npn_geturl() npn_posturl() npn_posturlnotify() npp_urlnotify() npp ...
NPP_New - Archive of obsolete content
tance, uint16 mode, int16 argc, char *argn[], char *argv[], npsaveddata *saved); parameters the function has the following parameters: plugintype pointer to the mime type for new plug-in instance. instance contains instance-specific private data for the plug-in and the browser. this data is stored in instance->pdata. mode display mode of plug-in. values: np_embed: (1) instance was created by an embed tag and shares the browser window with other content. np_full: (2) instance was created by a separate file and is the primary content in the window. argc number of html arguments in the embed tag for an embedded plug-in; determines the number of attributes in the argn and argv arrays. argn[] array of attribute names passed to th...
... shares the browser window with other content. np_full: (2) instance was created by a separate file and is the primary content in the window. argc number of html arguments in the embed tag for an embedded plug-in; determines the number of attributes in the argn and argv arrays. argn[] array of attribute names passed to the plug-in from the embed tag. argv[] array of attribute values passed to the plug-in from the embed tag. saved pointer to data saved by npp_destroy for a previous instance of this plug-in at the same url. if non-null, the browser passes ownership of the npsaveddata object back to the plug-in. the plug-in is responsible for freeing the memory for the npsaveddata and the buffer it contains. returns if successful, the function returns nperr_no_error.
...ta saved by npp_destroy for a previous instance of this plug-in at the same url. if non-null, the browser passes ownership of the npsaveddata object back to the plug-in. the plug-in is responsible for freeing the memory for the npsaveddata and the buffer it contains. returns if successful, the function returns nperr_no_error. if unsuccessful, the function returns an error code. for possible values, see error codes. description npp_new creates a new instance of a plug-in. it is called after np_initialize and is passed the mime type, embedded or full-screen display mode, and, for embedded plug-ins, information about html embed arguments. a new instance pointer (npp instance) is created by the plug-in, which is valid until the instance is destroyed with npp_destroy. if instance data was...
NPP_NewStream - Archive of obsolete content
ing whether the stream is seekable: true: seekable. stream supports random access through calls to npn_requestread (for example, local files or http servers that support byte-range requests). false: not seekable. the browser must copy data in the stream to the local cache to satisfy random access requests made through npn_requestread. stype out parameter. the plugin should set this value to request a mode for the stream. for more information about each of these values, see directions in this section. np_normal (default): delivers stream data to the instance in a series of calls to npp_writeready and npp_write. np_asfileonly: saves stream data to a file in the local cache. np_asfile: file download. like np_asfileonly except that data is delivered to the plug-in as it is sa...
.... np_asfile: file download. like np_asfileonly except that data is delivered to the plug-in as it is saved to the file (as in mode np_normal). np_seek: stream data randomly accessible by the plug-in as needed, through calls to npn_requestread. implementation note: some plugins, notably silverlight, do not set this outparam, and rely on the outparam being initialized to a default np_normal value. returns if successful, the function should return nperr_no_error. if unsuccessful, the function should return one of the nperror error codes. this will cause the browser to destroy the stream without calling npp_destroystream. description npp_newstream notifies the plug-in when a new stream is created. the npstream* pointer is valid until the stream is destroyed. the plug-in can stor...
...the src attribute of the embed tag, for an embedded instance, or the file itself, for a full-page instance. a plug-in can also request a stream with the function npn_geturl. the browser calls npp_destroystream when the stream completes (either successfully or abnormally). the plug-in can terminate the stream itself by calling npn_destroystream. the parameter stype defines the mode of the stream. values: np_normal (default): delivers stream data to the instance in a series of calls to npp_writeready and npp_write. the plug-in can process the data progressively as it arrives from the network or file system. np_asfileonly: the browser saves stream data to a file in the local cache. when the stream is complete, the browser calls npp_streamasfile to deliver the path of the file to the plug-in. ...
NPP_SetWindow - Archive of obsolete content
in when a window is created, moved, sized, or destroyed. syntax #include <npapi.h> nperror npp_setwindow(npp instance, npwindow *window); parameters the function has the following parameters: instance pointer to the current plug-in instance. must be embedded or full-screen. window pointer to the window into which the instance draws. the window structure contains a window handle and values for top left corner, width, height, and clipping rectangle (see note on unix below). returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. description the browser calls npp_setwindow after creating the instance to allow drawing to begin. subsequent calls to npp_...
...if the window handle is set to null, the window is destroyed. in this case, the plug-in must not perform any additional graphics operations on the window and should free any associated resources. ...
.... in this case, the plug-in must not perform any additional graphics operations on the window and should free any associated resources. the data structure passed in npp_setwindow is an npwindow object, which contains the coordinates of the instance's area and various platform-specific data. this window is valid for the life of the instance, or until npp_setwindow is called again with a different value. for windowed plug-ins on windows and unix, the window parameter contains a handle to a subwindow of the browser window hierarchy. on mac os, this field points to an np_port structure. for windowless plug-ins, it is a platform-specific handle to a drawable. before setting the window parameter to point to a new window, it is a good idea to compare the information about the new window to the prev...
NPP_URLNotify - Archive of obsolete content
notify(npp instance, const char* url, npreason reason, void* notifydata); parameters the function has the following parameters: instance pointer to the current plug-in instance. url url of the npn_geturlnotify() or npn_posturlnotify() request that has completed. reason reason code for completion of request. ...
... description the browser calls npp_urlnotify() after the completion of a npn_geturlnotify() or npn_posturlnotify() request to inform the plug-in that the request was completed and supply a reason code for the completion. ...
...eason code is npres_done, indicating simply that the request completed normally. other possible reason codes are npres_user_break, indicating that the request was halted due to a user action (for example, clicking the stop button), and npres_network_err, indicating that the request could not be completed, perhaps because the url could not be found. the parameter notifydata is the plug-in-private value passed as an argument by a previous npn_geturlnotify() or npn_posturlnotify() call, and can be used as an identifier for the request. see also npn_geturlnotify() npn_geturl() npn_posturlnotify() npn_posturl() ...
NPWindow - Archive of obsolete content
ping to the cliprect prevents the plug-in from overwriting the status bar, scroll bars, and other page elements when partially scrolled off the screen. mac os: cliprect is the rectangle in port coordinates to which the plug-in should clip its drawing. ws_info unix: contains information about the plug-in's unix window environment; points to an npsetwindowcallbackstruct. type npwindowtype value that specifies whether the npwindow instance represents a window or a drawable. values: npwindowtypewindow: indicates that the window field holds a platform-specific handle to a window (as in navigator 2.0 and navigator 3.0). the plug-in is considered windowed. npwindowtypedrawable: indicates that the plugin is windowless. the window field holds a platform-specific handle to a drawable or a...
...dow or a drawable, and contains information about coordinate position, size, whether the plug-in is windowed or windowless, and some platform-specific information. the plug-in area is a native window element on windows and unix, or a rectangle within a native window on mac os. the x, y, height, and width coordinates of npwindow specify the position and size of this area. the browser calls npp_setvalue whenever the drawable changes. a windowed plug-in is drawn into a native window (or portion of a native window) on a web page. for windowed plug-ins, the browser calls the npp_setwindow method with an npwindow structure that represents a drawable (a pointer to an npwindow allocated by the browser). this window is valid until npp_setwindow is called again with a different window or the instance i...
...s window is valid until npp_setwindow is called again with a different window or the instance is destroyed. a windowless plug-in is drawn into a target called a drawable, which can be defined in several ways depending on the platform. for windowless plug-ins, the browser calls the npp_setwindow method with an npwindow structure that represents a drawable. the plug-in should not modify the field values in this structure. see also npp_setwindow, np_port, npsetwindowcallbackstruct, nprect ...
NPAPI plug-in side API - Archive of obsolete content
the plug-in object; these allow plug-ins to interact with the browser. the names of all of these methods begin with npp_ to indicate that they are implemented by the plug-in and called by the browser. ...
...bject; these allow plug-ins to interact with the browser. the names of all of these methods begin with npp_ to indicate that they are implemented by the plug-in and called by the browser. ...
...se methods begin with npp_ to indicate that they are implemented by the plug-in and called by the browser. ...
Adobe Flash - Archive of obsolete content
browsers: use dom methods to get a handle to the html element that spawns the plugin. this may be the embed element or the object element's name or id attribute respectively. treat the handle to the html element as a handle to the actual flash plugin and invoke the published methods on it. the illustrative code snippet below shows this idea: <object id="myflash" ..... > <param name="movie" value="somefile.swf" /> .... var myflash = document.getelementbyid("myflash").setvariable("myvar", sendtext); a more expanded code example that shows how example 2 was created is shown in this source listing. fscommands: accessing javascript from flash note: fscommand may not work with flash player versions older than version 8 if the user has installed multiple mozilla based browsers onto the ...
...mbed element, the underscore ("_"), and the string "dofscommand". the following code snippet illustrates the ideas behind the use of fscommands demonstrated in example 3: <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" id="myflash" width="250" height="150" viewastext> <param name="movie" value="js2flash.swf" /> <param name="quality" value="high"></param> <embed src="js2flash.swf" width="250" height="150" swliveconnect="true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="myflash"> </embed> </object> ..... function myflash_dofscommand(command, args) { // handle any callback logic that you may have designe...
...src="js2flash.swf" width="250" height="150" swliveconnect="true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="myflash"> </embed> </object> ..... function myflash_dofscommand(command, args) { // handle any callback logic that you may have designed into your flash plugin // the flash animation will supply you with the values for command and args // this is a function that handles any information that the flash animation may pass it // actionscript can communicate with javascript via fscommands! } in the above code listing, the javascript function handles what flash sends it, and is named the same as the embed element's name attribute, concatenated with "_dofscommand". the source listing flash-to-js.html shows a ...
Introduction to Public-Key Cryptography - Archive of obsolete content
r is permitted to access the requested resource, and if so allows the client to access it. with this arrangement, the user must supply a new password for each server, and the administrator must keep track of the name and password for each user, typically on separate servers. proper implementation does not store passwords in plaintext. instead it concatenates the password with a random per-user value (so called "salt") and stores the hash value of the result along with the salt. this makes certain kinds of brute-force atacks more difficult. as shown in the next section, one of the advantages of certificate-based authentication is that it can be used to replace the first three steps in figure 4 with a mechanism that allows the user to supply just one password (which is not sent across the net...
...e line: -----begin certificate----- following this line is the certificate data, which can be in any of the binary formats described. this data should be base-64 encoded, as described by rfc 1113. the certificate information is followed by this line: -----end certificate----- distinguished names an x.509 v3 certificate binds a distinguished name (dn) to a public key. a dn is a series of name-value pairs, such as uid=doe, that uniquely identify an entity-that is, the certificate subject. for example, this might be a typical dn for an employee of example corp: uid=doe,e=doe@example.net,cn=john doe,o=example corp.,c=us the abbreviations before each equal sign in this example have these meanings: uid: user id e: email address cn: the user's common name o: organization c: country d...
...identify an entity-that is, the certificate subject. for example, this might be a typical dn for an employee of example corp: uid=doe,e=doe@example.net,cn=john doe,o=example corp.,c=us the abbreviations before each equal sign in this example have these meanings: uid: user id e: email address cn: the user's common name o: organization c: country dns may include a variety of other name-value pairs. they are used to identify both certificate subjects and entries in directories that support the lightweight directory access protocol (ldap). the rules governing the construction of dns can be quite complex and are beyond the scope of this document. for comprehensive information about dns, see a string representation of distinguished names] at the following url: https://www.ietf.org/rfc/...
-moz-text-blink - Archive of obsolete content
blink text blinks. ...
... blink text blinks. ...
... blink text blinks. ...
-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>. snapinterval( <length-percentage>, <length-percentage> ) specifies a starting snap-point followed by the interval between all snap-points. the first value specifies where the first snap-point will be placed. the second value specifies the distance between subsequent snap-points both to the left and the right of the initial snap-point. snaplist( <length-percen...
...ies a starting snap-point followed by the interval between all snap-points. the first value specifies where the first snap-point will be placed. the second value specifies the distance between subsequent snap-points both to the left and the right of the initial snap-point. snaplist( <length-percentage># ) specifies the position of individual snap-points as a comma-separated list of values, each of which represents a zoom factor. if any value is less than -ms-scroll-limit-x-min , then -ms-scroll-limit-x-min is used. if any value is greater than -ms-scroll-limit-x-max, then -ms-scroll-limit-x-max is used. formal syntax snapinterval( <length-percentage>, <length-percentage> ) | snaplist( <length-percentage># )where <length-percentage> = <length> | <percentage> exam...
...in the first selector, the first snap-point is at 0%, and the interval is set to 100%. in the second selector, each snap-point is listed separately — 100%, 200%, 300%, and so on. ...
-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>. snapinterval( <length-percentage>, <length-percentage> ) specifies a starting snap-point followed by the interval between all snap-points. the first value specifies where the first snap-point will be placed. the second value specifies the distance between subsequent snap-points both above and below the initial snap-point. snaplist( <length-percentage>#...
...> ) specifies a starting snap-point followed by the interval between all snap-points. the first value specifies where the first snap-point will be placed. the second value specifies the distance between subsequent snap-points both above and below the initial snap-point. snaplist( <length-percentage># ) specifies the position of individual snap-points as a comma-separated list of values, each of which represents a zoom factor. if any value is less than -ms-scroll-limit-y-min , then -ms-scroll-limit-y-min is used. if any value is greater than -ms-scroll-limit-y-max, then -ms-scroll-limit-y-max is used. formal syntax snapinterval( <length-percentage>, <length-percentage> ) | snaplist( <length-percentage># )where <length-percentage> = <length> | <percentage> exam...
...in the first selector, the first snap-point is at 0%, and the interval is set to 100%. in the second selector, each snap-point is listed separately — 100%, 200%, 300%, and so on. ...
-ms-wrap-flow - Archive of obsolete content
both inline flow content can flow on all sides of the exclusion. start inline flow content can wrap on the start edge of the exclusion area but must leave empty the area after the end edge of the exclusion area. ...
... both inline flow content can flow on all sides of the exclusion. start inline flow content can wrap on the start edge of the exclusion area but must leave empty the area after the end edge of the exclusion area. ...
...other side of the exclusion. clear inline flow content can only wrap on top and bottom of the exclusion and must leave empty the areas to the start and end edges of the exclusion box. formal syntax auto | both | start | end | maximum | clear specifications not part of any specification. remarks the -ms-wrap-flow property makes an element an exclusion element when it has a computed value other than auto. this property specifies that the exclusion element (the exclusion) can be positioned in various ways, and that inline content will wrap around the exclusion in a way similar to how it wraps around floated elements. when the -ms-wrap-flow property's computed value is auto, the element does not become an exclusion element unless its float property's computed value is not none. in ...
azimuth - Archive of obsolete content
Archive › Web › CSS › azimuth
rty enables different audio sources to be positioned spatially for aural presentation. this is important in that it provides a natural way to tell several voices apart, as each can be positioned to originate at a different location on the sound stage. stereo output produce a lateral sound stage, while binaural headphones and multi-speaker setups allow for a fully three-dimensional stage. ...
...patially for aural presentation. this is important in that it provides a natural way to tell several voices apart, as each can be positioned to originate at a different location on the sound stage. stereo output produce a lateral sound stage, while binaural headphones and multi-speaker setups allow for a fully three-dimensional stage. initial valuecenterapplies toall elementsinheritedyescomputed valuenormalized angleanimation typediscrete syntax <angle> | [ [ left-side | far-left | left | center-left | center | center-right | right | far-right | right-side ] | behind ] | leftwards | rightwards values angle audible source position is described as an angle within the range -360deg to 360deg. the value 0deg means directly ahead in the center of the sound stage (this is the default value). ...
...nd: same as 200deg. center: same as 0deg. center behind: same as 180deg. center-right: same as 20deg. center-right behind: same as 160deg. right: same as 40deg. right behind: same as 140deg. far-right: same as 60deg. far-right behind: same as 120deg. right-side: same as 90deg. right-side behind: same as 90deg. behind: same as 180deg. also used as a modifier for other positional keyword values, as above. leftwards: moves the sound counter-clockwise by 20 degrees, relative to the current angle. rightwards: moves the sound clockwise by 20 degrees, relative to the current angle. examples h1 { azimuth: 30deg; } td.a { azimuth: far-right; } /* 60deg */ #12 { azimuth: behind far-right; } /* 120deg */ p.comment { azimuth: behind; } /* 180deg */ specifications ...
ArrayBuffer.transfer() - Archive of obsolete content
s data and then is either truncated or zero-extended by newbytelength. if newbytelength is undefined, the bytelength of the oldbuffer is used. this operation leaves oldbuffer in a detached state. syntax arraybuffer.transfer(oldbuffer [, newbytelength]); parameters oldbuffer an arraybuffer object from which to transfer. newbytelength the byte length of the new arraybuffer object. return value a new arraybuffer object. description the arraybuffer.transfer() method allows you to grow and detach arraybuffer objects. the ability to grow an arraybuffer without copying has the advantage of being much faster for large buffers (similar to realloc). the ability to detach an arraybuffer gives the developer explicit control over when the underlying memory is released. this avoids having to d...
...uffers (similar to realloc). the ability to detach an arraybuffer gives the developer explicit control over when the underlying memory is released. this avoids having to drop all references and wait for garbage collection. ...
...p all references and wait for garbage collection. examples var buf1 = new arraybuffer(40); new int32array(buf1)[0] = 42; var buf2 = arraybuffer.transfer(buf1, 80); buf1.bytelength; // 0 but if you use the polyfill then the value is still 40 buf2.bytelength; // 80 new int32array(buf2)[0]; // 42 var buf3 = arraybuffer.transfer(buf2, 0); buf2.bytelength; // 0 but if you use the polyfill then the value is still 80 buf3.bytelength; // 0 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 transfer() in browsers that do not natively support it. this is not the exact equivalent of this api because browsers that natively support it are be able to internally use the c++ function realloc() which e...
ECMAScript 2015 support in Mozilla - Archive of obsolete content
. a channel for feedback on ecmascript standards is es-discuss. ...
... array.prototype.keys() (firefox 28), array.prototype.values() array.prototype.copywithin() (firefox 32) get array[@@species] (firefox 48) new map and set objects, and their weak counterparts map (firefox 13) map iteration with for...of (firefox 17) map.prototype.foreach() (firefox 25) map.prototype.entries() (firefox 20) map.prototype.keys() (firefox 20) map.prototype.values() constructor argument: new map(null) (firefox 37) monkey-patched set() in constructor (firefox 37) get map[@@species] (firefox 41) set (firefox 13) set iteration with for...of (firefox 17) set.prototype.foreach() (firefox 25) set.prototype.entries(), set.prototype.keys(), set.prototype.values() (firefox 24) constructor argument: new set(null) (firefox 37) ...
...iance bug 1055984) statements for...of (firefox 13) works in terms of .iterator() and .next() (firefox 17) use "@@iterator" property (firefox 27) use symbol.iterator property (firefox 36) functions rest parameters (firefox 15) default parameters (firefox 15) parameters without defaults after default parameters (firefox 26) destructured parameters with default value assignment (firefox 41) arrow functions (firefox 22) generator function (firefox 26) yield (firefox 26) yield* (firefox 27) arguments[@@iterator] (firefox 46) other features binary and octal numeric literals (firefox 25) template strings (firefox 34) object initializer: shorthand property names (firefox 33) object initializer: computed property names (firefox 34) ob...
Number.toInteger() - Archive of obsolete content
examples using tointeger number.tointeger(0.1); // 0 number.tointeger(1); // 1 number.tointeger(math.pi); // 3 number.tointeger(null); // 0 specifications not part of any standard. ...
... examples using tointeger number.tointeger(0.1); // 0 number.tointeger(1); // 1 number.tointeger(math.pi); // 3 number.tointeger(null); // 0 specifications not part of any standard. ...
... examples using tointeger number.tointeger(0.1); // 0 number.tointeger(1); // 1 number.tointeger(math.pi); // 3 number.tointeger(null); // 0 specifications not part of any standard. ...
Object.unobserve() - Archive of obsolete content
the object.unobserve() method was used to remove observers set by object.observe(), but has been deprecated and removed from browsers. you can use the more general proxy object instead. syntax object.unobserve(obj, callback) parameters obj the object to stop observing. callback the reference to the observer to stop calling each time changes are made on the object obj. return value the specified object. description object.unobserve() should be called after object.observe() in order to remove an observer from an object. the callback should be a reference to a function and not an anonymous function, because this reference will be used to unset the previous observer. it's useless to call object.unobserve() with an anonymous function as callback, it will not remove any obse...
...strawman proposal specification. ...
...strawman proposal specification. ...
Archived JavaScript Reference - Archive of obsolete content
he specified formatting. intl.datetimeformat is an alternative to format dates in a standards-compliant way. see also the newer version of date.prototype.tolocaledatestring().ecmascript 2016 to es.next support in mozillaexpression closuresexpression closures are a shorthand function syntax for writing simple functions.for each...inthe for each...in statement iterates a specified variable over all values of object's properties. for each distinct property, a specified statement is executed.function.aritynot part of any standard.function.prototype.isgenerator()the non-standard isgenerator() method used to determine whether or not a function is a generator. it has been removed from firefox starting with version 58.generator comprehensionsthe generator comprehension syntax was a javascript expressio...
...it provided a stream of changes in the order i...
...you can use the more general proxy object instead.reflect.enumerate()the static reflect.enumerate() method used to return an iterator with the enumerable own and inherited properties of the target object, but ...
JSObject - Archive of obsolete content
script code. see the core javascript 1.5 guide for more information about data type conversions. method summary the netscape.javascript.jsobject class has the following methods: call calls a javascript method. equals determines if two jsobject objects refer to the same instance. (what's the problem with == ?) eval evaluates a javascript expression. getmember retrieves the value of a property of a javascript object. getslot retrieves the value of an array element of a javascript object. removemember removes a property of a javascript object. setmember sets the value of a property of a javascript object. setslot sets the value of an array element of a javascript object. tostring converts a jsobject to a string. the netscape.javascript.jsobj...
...ent versions, the same jsobject can appear as different java objects. you can use the equals method to determine whether two jsobjects refer to the same instance. eval method. evaluates a javascript expression. the expression is a string of javascript source code which will be evaluated in the context given by "this". declaration public object eval(string s) getmember method. retrieves the value of a property of a javascript object. equivalent to "this.name" in javascript. declaration public object getmember(string name) getslot method. retrieves the value of an array element of a javascript object. equivalent to "this[index]" in javascript. declaration public object getslot(int index) getwindow static method. returns a jsobject for the window containing the given applet. this ...
...claration public object getslot(int index) getwindow static method. returns a jsobject for the window containing the given applet. this method is useful in client-side javascript only. declaration public static jsobject getwindow(applet applet) removemember method. removes a property of a javascript object. declaration public void removemember(string name) setmember method. sets the value of a property of a javascript object. equivalent to "this.name = value" in javascript. declaration public void setmember(string name, object value) setslot method. sets the value of an array element of a javascript object. equivalent to "this[index] = value" in javascript. declaration public void setslot(int index, object value) tostring method. converts a jsobject to a string. o...
XForms Custom Controls Examples - Archive of obsolete content
images <binding id="output-image" extends="chrome://xforms/content/xforms.xml#xformswidget-base"> <content> <html:div> <html:img anonid="content"/> </html:div> </content> <implementation implements="nsixformsuiwidget"> <method name="refresh"> <body> var img = document.getanonymouselementbyattribute(this, "anonid", "content"); img.setattribute("src", this.stringvalue); return true; </body> </method> </implementation> </binding> output showing xhtml <binding id="output-xhtml" extends="chrome://xforms/content/xforms-xhtml.xml#xformswidget-output"> <content> <children includes="label"/> <xhtml:div class="xf-value" anonid="content"></xhtml:div> <children/> </content> <implementation implements="nsixformsuiwidget"> <field ...
...s="xf-value" anonid="content"></xhtml:div> <children/> </content> <implementation implements="nsixformsuiwidget"> <field name="_domparser">null</field> <property name="domparser" readonly="true"> <getter> if (!this._domparser) this._domparser = new domparser(); return this._domparser; </getter> </property> <method name="refresh"> <body> // get new value, parse, and import it. ...
...ldren/> </content> <implementation implements="nsixformsuiwidget"> <field name="_domparser">null</field> <property name="domparser" readonly="true"> <getter> if (!this._domparser) this._domparser = new domparser(); return this._domparser; </getter> </property> <method name="refresh"> <body> // get new value, parse, and import it. ...
XForms Alert Element - Archive of obsolete content
the message of the alert element can exist in instance data, in a remote document, or as inline text. if more than one source of message is specified in this element, the order of precedence is: single node binding attributes, linking attributes, inline text. attributes single-node binding linking src - url of a document whose contents will be retrieved by the alert element and used to provide the alert message for the containing form control. ...
...you should type only numbers!</xforms:alert> </xforms:input> ...
... font-style: italic; width: 40%; } } </style> <xforms:input bind="x"> <xforms:label>you can type only numbers (validation happens on blur): </xforms:label> <xforms:alert>wrong value! you should type only numbers!</xforms:alert> </xforms:input> <xforms:input bind="x"> <xforms:label>you can type only numbers (validation happens on blur): </xforms:label> <xforms:alert class="inline">wrong value! you should type only numbers!</xforms:alert> </xforms:input> ...
XForms Repeat Element - Archive of obsolete content
introduction a repeat element contains markup and is itself bound to a nodeset in an instance document (see the spec). for each node in the nodeset, the contents of the repeat element will be displayed in the form. that node will serve as the context node for any relative xpath expressions in that set of repeated markup. attributes ui common appearance - the value of this attribute gives a hint to the xforms processor as to which type of widget(s) to use to represent this control. node set binding special startindex - optional 1-based initial value of the repeat index. the default value is 1. number - isn't supported type restrictions the repeat element can be bound to a nodeset. representations the repeat element doesn't have a visual representation. however, it can influen...
...nt can be bound to a nodeset. representations the repeat element doesn't have a visual representation. however, it can influence the layout of generated controls depending on its appearance attribute. default layout each generated control set is placed vertically. compact layout each generated control set is placed horizontally. occurs when the repeat element's appearance attribute has a value of compact. behaviour focusing a generated control may change the current index of the containing repeat element. the index is equal to the index of the control set that the focused control belongs to. actions you can use xforms action module elements to modify the nodeset that the repeat element is bound to. the most useful actions for altering the contents of a repeat are the insert (see ...
.../instance> </model> <repeat id="lineset" nodeset="/my:lines/my:line"> <input ref="my:price"> <label>line item</label> </input> <input ref="@name"> <label>name</label> </input> </repeat> <trigger> <label>insert a new item after the current one</label> <action ev:event="domactivate"> <insert nodeset="/my:lines/my:line" at="index('lineset')" position="after"/> <setvalue ref="/my:lines/my:line[index('lineset')]/@name"/> <setvalue ref="/my:lines/my:line[index('lineset')]/price">0.00</setvalue> </action> </trigger> <trigger> <label>remove current item</label> <delete ev:event="domactivate" nodeset="/my:lines/my:line" at="index('lineset')"/> </trigger> attribute based repeat when using xforms within host languages like xhtml, it is oft...
XForms Submit Element - Archive of obsolete content
is form control initiates a submission. the result of which is all or part of an instance document being sent to a target destination, which could be local or remote (see the spec). upon receiving a domactivate event, this form control dispatches a xforms-submit event to the submission element (see the spec) specified in its submission attibute. attributes ui common appearance - the value of this attribute gives a hint to the xforms processor as to which type of widget(s) to use to represent this control. accesskey - used to specify the keyboard shortcut for focusing this control. single-node binding special submission - required reference to element submission. type restrictions the submit element can be bound to a node containing data of any...
...ound to a node containing data of any type. actually, the submit element doesn't interact with the data in the bound node. however, the relevant model item property on the bound node has an effect on a submit. if the bound node is irrelevant, then the submit will be hidden. representations the xforms submit element can be represented by the following widgets for the specified appearance attribute values: button - default representation (xhtml/xul) link/clickable text - used when appearance = 'minimal' (xhtml only) button displaying a button is the default presentation (xhtml/xul). characteristics analogous widgets are <html:input type="submit"/> and <xul:button/> link/clickable text xforms authors can use this representation if they want to have a widget like a xhtml anchor (xhtml onl...
... ...
XForms Trigger Element - Archive of obsolete content
actually, the trigger element doesn't interact with the data in the bound node. ...
...nd to a node containing data of any type. actually, the trigger element doesn't interact with the data in the bound node. however, relevant model item property on the bound node has an effect on a trigger. if the bound node is irrelevant, then the trigger will be hidden. representations the xforms trigger element can be represented by the following widgets for the specified appearance attribute values: button - default representation (xhtml/xul) link/clickable text - used when appearance = 'minimal' (xhtml only) button displaying a button is the default presentation (xhtml/xul). characteristics analogous widgets are <html:input type="button"/> and <xul:button/> link/clickable text xforms authors can use this representation if they want to have a widget like a xhtml anchor (xhtml...
... ...
Describing microformats in JavaScript - Archive of obsolete content
rray indicating the names of any properties that must be specified. this may be left out if all properties are optional. properties a structure describing the properties of the microformat. property specifications each property in the properties structure is specified by its name, and may include additional attributes if the property so requires. ...
...be left out if all properties are optional. properties a structure describing the properties of the microformat. property specifications each property in the properties structure is specified by its name, and may include additional attributes if the property so requires. standard attributes are: plural a boolean value indicating that, if true indicates that the property can have multiple values. if a property is plural, it is returned as an array. virtual a boolean value indicating whether or not the property is virtual. if it's virtual, the virtualgetter() method will be called to attempt to create the property if it doesn't exist. virtualgetter a function that is called to get a virtual property's value. this is only used if virtual is true. value the property's default value. ...
...property if it doesn't exist. virtualgetter a function that is called to get a virtual property's value. this is only used if virtual is true. value the property's default value. subproperties it's possible for a property to itself include more properties; to do so, include them in a subproperties structure within the property. datatype the type of data contained by the property. possible values are: datetime an iso date anyuri a uri email an email address tel a telephone number html html including tags float a floating-point number microformat a microformat microformat_property a specific property within the microformat specified by microformat. custom custom data a simple example the hcard microformat for defining contact information makes use of the adr micr...
RDF in Mozilla FAQ - Archive of obsolete content
erver's methods will be called-back as // the load progresses. } note that the observer will remain attached to the rdf/xml datasource unless removexmlsinkobserver is called. how do i access the information in a datasource? the nsirdfdatasource interface is the means by which you access and manipulate the assertions in a datasource. boolean hasassertion(asource, aproperty, atarget, atruthvalue). this tests the datasource to see if it has the specified tuple. nsirdfnode gettarget(asource, aproperty, atruthvalue). nsisimpleenumerator gettargets(asource, aproperty, atruthvalue). nsirdfresource getsource(aproperty, atarget, atruthvalue). nsisimpleenumerator getsources(aproperty, atarget, atruthvalue). nsisimpleenumerator arclabelsin(atarget). nsisimpleenumerator arclabelsout(asourc...
...target, atruthvalue). nsisimpleenumerator arclabelsin(atarget). nsisimpleenumerator arclabelsout(asource). you can also use the rdf container interfaces to access information contained in rdf containers. how do i change information in the datasource? to use 'assert' to add one assertion and 'unassert' to remove one. refer to mozilla rdf back end architecture ds.assert(homepage, fv_quality, value, true); ds.unassert(homepage, fv_quality, value, true); how do i save back changes to an rdf/xml datasource? an rdf/xml datasource can be queryinterface()'d to nsirdfremotedatasource. this interface has a flush() method, which will attempt to write the contents of the datasource back to the url from which they were loaded, using a protocol specific mechanism (e.g., a file: url just writes the ...
...out a template using the w3c dom apis. the only caveat is that you must call rebuild() before the changes you've made will take effect (just as you must if you add a datasource to the xul template). how do i insert plaintext from a template? to insert plaintext in a template, use the <text> element. <template> <rule> <query>...</query> <binding>...</binding> <action> <text value="?some-variable" /> </action> </rule> </template> the above template will create a content model that runs a series of text nodes together. troubleshooting tricks and tips from the field. my rdf/xml file won't load. the most common cause for rdf/xml not to load from a web server is incorrect mime type. make sure your server is delivering the file as text/xml (recommended) or text/rdf ...
Building up a basic demo with Babylon.js - Game development
add the following new code below your previous additions: var box = babylon.mesh.createbox("box", 2, scene); a mesh is a way the engine creates geometric shapes, so material can be easily applied to them later on. in this case we're creating a box using the mesh.createbox method with it's own name, a size of 2, and a declaration of which scene we want it added to. note: the size or position values (e.g. for the box size) are unitless, and can basically be anything you deem suitable for your scene — milimeters, meters, feet, or miles — it's up to you. if you save and refresh now, your object will look like a square, because it's facing the camera. the good thing about objects is that we can move them on the scene however we want, for example rotating and scaling. let's apply a little...
...the scene should look right now: this works, but it is a bit boring. in a game something is usually happening — we can see animations and such — so let's try to breathe a little life into those shapes by animating them. animation we already used position and rotation to adjust the position of the shapes; we could also scale them. to show actual animation, we need to make changes to these values inside the rendering loop at the end of our code, so they are updated on every frame. define a helper variable — t — that we will use for animations, just before the renderloop, and decrement it on every frame inside the loop, like this: var t = 0; var renderloop = function () { scene.render(); t -= 0.01; // animation code goes here }; engine.runrenderloop(renderloop); the t v...
... frame. rotation applying rotation is as easy as adding this line at the end of the renderloop function: box.rotation.y = t*2; it will rotate the box along the y axis. scaling add this line below the previous one to scale the torus: torus.scaling.z = math.abs(math.sin(t*2))+0.5; there's a little bit of adjustment made to make the animation look and feel nice. you can experiment with the values and see how it affects the animation. moving by changing the position of the cylinder directly we can move it on the scene — add this line below the previous one: cylinder.position.y = math.sin(t*3); the cylinder will float up and down on the y axis thanks to the math.sin() function. conclusion here's the final code listing, along with a viewable live example: you can also see it on ...
Desktop gamepad controls - Game development
roller (for example which buttons are where, because an xbox 360 layout may be different to a generic one), the cache containing the information about the buttons from the previous frame and the status containing the information from the current frame. the pressed() function gets the input data and sets the information about it in our object, and the axes property stores the array containing the values signifying the amount an axis is pressed in the x and y directions, represented by a float in the (-1, 1) range. after the gamepad is connected, the information about the controller is stored in the object: connect: function(event) { gamepadapi.controller = event.gamepad; gamepadapi.active = true; }, the disconnect function removes the information from the object: disconnect: functio...
... a++) { axes.push(c.axes[a].tofixed(2)); } } gamepadapi.axes.status = axes; gamepadapi.buttons.status = pressed; return pressed; }, the function above clears the buttons cache, and copies their status from the previous frame to the cache. next, the button status is cleared and the new information is added. the same goes for the axes information — looping through axes adds the values to the array. received values are assigned to the proper objects and returns the pressed info for debugging purposes. the button.pressed() function detects the actual button presses: pressed: function(button, hold) { var newpress = false; for(var i=0,s=gamepadapi.buttons.status.length; i<s; i++) { if(gamepadapi.buttons.status[i] == button) { newpress = true; if(!hold) { ...
... // move player up } else if(gamepadapi.axes.status[0] < -0.5) { // move player down } if(gamepadapi.axes.status[1] > 0.5) { // move player left } else if(gamepadapi.axes.status[1] < -0.5) { // move player right } } they can now move the ship on the screen by using the dpad buttons, or the left stick axes. have you noticed that the current value of the axes is evaluated against 0.5? it's because axes are having floating point values while buttons are booleans. after a certain threshold is reached we can assume the input is done deliberately by the user and can act accordingly. for the shooting controls, we used the a button — when it is held down, a new bullet is spawned, and everything else is handled by the game: if(gamepadapi.butt...
Attribute - MDN Web Docs Glossary: Definitions of Web-related terms
that is a shorthand for providing the empty string in html, or the attribute’s name in xml. ...
...that is a shorthand for providing the empty string in html, or the attribute’s name in xml. ...
...that is a shorthand for providing the empty string in html, or the attribute’s name in xml. ...
Canonical order - MDN Web Docs Glossary: Definitions of Web-related terms
in css, canonical order is used to refer to the order in which separate values need to be specified (or parsed) or are to be serialized as part of a css property value. it is defined by the formal syntax of the property and normally refers to the order in which longhand values should be specified as part of a single shorthand value. for example, background shorthand property values are made up of several background-* longhand properties. ...
...ed to be specified (or parsed) or are to be serialized as part of a css property value. it is defined by the formal syntax of the property and normally refers to the order in which longhand values should be specified as part of a single shorthand value. for example, background shorthand property values are made up of several background-* longhand properties. the canonical order of those longhand values is defined as background-image background-position background-size background-repeat background-attachment background-origin background-clip background-color furthermore, its syntax defines, that if a value for the background-size is given, it must be specified after the value for the background-position, separated by a slash. other values may appear in any order. learn more what...
... furthermore, its syntax defines, that if a value for the background-size is given, it must be specified after the value for the background-position, separated by a slash. other values may appear in any order. learn more what does “canonical order” mean with respect to css properties? on stack overflow provides useful further discussion. the description of the formal syntax used for css values on mdn ...
Constant - MDN Web Docs Glossary: Definitions of Web-related terms
. ...
.... ...
.... ...
IDL - MDN Web Docs Glossary: Definitions of Web-related terms
mming language. content versus idl attributes in html, most attributes 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 maxlength to 42 using the content attribute, you have to call setattribute("maxlength", "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 underlyi...
...e, to set an <input> element's maxlength to 42 using the content attribute, you have to call setattribute("maxlength", "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 save something in the content attribute when you set it. in other words, the idl attributes, in essence, reflect the content attributes. most of the time, idl attributes will return 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 ...
...ttribute when you set it. in other words, the idl attributes, in essence, reflect the content attributes. most of the time, idl attributes will return 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.maxlength is a number (a signed long). when using idl attributes, you read or set values of the desired type, so input.maxlength is always going to return a number and when you set input.maxlength ,it wants a number. if you pass another type, it is automatica...
Mutable - MDN Web Docs Glossary: Definitions of Web-related terms
mutable is a type of variable that can be changed. in javascript, only objects and arrays are mutable, not primitive values. (you can make a variable name point to a new value, but the previous value is still held in memory. hence the need for garbage collection.) a mutable object is an object whose state can be modified after it is created. immutables are the objects whose state cannot be changed once the object is created. strings and numbers are immutable. lets understand this with an example: var immutablestring = "hello"; // in the above code, a new object with string value is created. ...
...ose state can be modified after it is created. immutables are the objects whose state cannot be changed once the object is created. strings and numbers are immutable. lets understand this with an example: var immutablestring = "hello"; // in the above code, a new object with string value is created. immutablestring = immutablestring + "world"; // we are now appending "world" to the existing value. ...
... are the objects whose state cannot be changed once the object is created. strings and numbers are immutable. lets understand this with an example: var immutablestring = "hello"; // in the above code, a new object with string value is created. immutablestring = immutablestring + "world"; // we are now appending "world" to the existing value. on appending the "immutablestring" with a string value, following events occur: existing value of "immutablestring" is retrieved "world" is appended to the existing value of "immutablestring" the resultant value is then allocated to a new block of memory "immutablestring" object now points to the newly created memory space previously created memory space is now available for garbage collection. learn more general knowledge immutable ob...
Parameter - MDN Web Docs Glossary: Definitions of Web-related terms
a parameter is a named variable passed into a function. parameter variables are used to import arguments into functions. note the difference between parameters and arguments: function parameters are the names listed in the function's definition. function arguments are the real values passed to the function. parameters are initialized to the values of the arguments supplied. two kinds of parameters: input parameters the most common kind; they pass values into functions. ...
...unction parameters are the names listed in the function's definition. function arguments are the real values passed to the function. parameters are initialized to the values of the arguments supplied. two kinds of parameters: input parameters the most common kind; they pass values into functions. depending on programming language, input parameters can be passed several ways (e.g., call-by-value, call-by-address, call-by-reference). ...
... real values passed to the function. parameters are initialized to the values of the arguments supplied. two kinds of parameters: input parameters the most common kind; they pass values into functions. depending on programming language, input parameters can be passed several ways (e.g., call-by-value, call-by-address, call-by-reference). ...
Signature (functions) - MDN Web Docs Glossary: Definitions of Web-related terms
a function signature (or type signature, or method signature) defines input and output of functions or methods. a signature can include: parameters and their types a return value and type exceptions that might be thrown or passed back information about the availability of the method in an object-oriented program (such as the keywords public, static, or prototype). in depth signatures in javascript javascript is a loosely typed or a dynamic language. that means you don't have to declare the type of a variable ahead of time. the type will get determined automatically while the program is being processed. a signature in javascript can still give you some information about the method: myobject.prototype.myfunction(value) the method is installed on an object called myobject. ...
... signatures in java in java, signatures are used to identify methods and classes at the level of the virtual machine code. you have to declare types of variables in your code in order to be able to run the java code. ...
...va is strictly typed and will check any parameters at compilation time if they are correct. public static void main(string[] args) the public keyword is an access modifier and indicates that this method can be called by any object. the static keyword indicates that this method is a class method as opposed to being an instance method. the void keyword indicates that this method has no return value. the name of the method is main. the method accepts one parameter of type string array. it is named args. learn more general knowledge java internal type signatures on wikipedia ...
Property (CSS) - MDN Web Docs Glossary: Definitions of Web-related terms
a css property is a characteristic (like color) whose associated value defines one aspect of how the browser should display the element. ...
... a css property is a characteristic (like color) whose associated value defines one aspect of how the browser should display the element. ...
... value defines one aspect of how the browser should display the element. ...
MDN Web Docs Glossary: Definitions of Web-related terms
modularity mozilla firefox mutable mvc n namespace nan nat native navigation directive netscape navigator network throttling nntp node node (dom) node (networking) node.js non-normative normative null nullish value number o object object reference oop opengl openssl opera browser operand operator origin ota owasp p p2p pac packet page load time page prediction parameter parent object parse ...
... progressive enhancement progressive web apps promise property property (css) property (javascript) protocol prototype prototype-based programming proxy server pseudo-class pseudo-element pseudocode public-key cryptography python q quality values quaternion quic r rail random number generator raster image rdf real user monitoring (rum) recursion reference reflow regular expression rendering engine repo reporting directive request header resource timing response header ...
...ls) tree shaking trident truthy ttl turn type type coercion type conversion u udp (user datagram protocol) ui undefined unicode uri url urn usenet user agent utf-8 ux v validator value variable vendor prefix viewport visual viewport voip w w3c wai wcag web performance web server web standards webassembly webdav webextensions webgl webidl webkit webm webp webrtc websockets ...
CSS and JavaScript accessibility best practices - Learn web development
l> <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't interfere with the screen reader being able to read content from it. ...
...such as visibility or display, because it doesn't interfere with the screen reader being able to read content from it. real form validation would be much more complex than this — you'd want to check that the entered name actually looks like a name, the entered age is actually a number and is realistic (e.g. nonnegative and less than 4 digits). here we've just implemented a simple check that a value has been filled in to each input field (if(testitem.input.value === '')). when the validation has been performed, if the tests pass then the form is submitted. if there are errors (if(errorlist.innerhtml !== '')) then we stop the form submitting (using preventdefault()), and display any error messages that have been created (see below). this mechanism means that the errors will only be shown if ...
...validation has been performed, if the tests pass then the form is submitted. if there are errors (if(errorlist.innerhtml !== '')) then we stop the form submitting (using preventdefault()), and display any error messages that have been created (see below). this mechanism means that the errors will only be shown if there are errors, which is better for usability. for each input that doesn't have a value filled in when the form is submitted, we create a list item with a link and insert it in the errorlist. function createlink(testitem) { const listitem = document.createelement('li'); const anchor = document.createelement('a'); anchor.textcontent = testitem.input.name + ' field is empty: fill in your ' + testitem.input.name + '.'; anchor.href = '#' + testitem.input.name; anchor.onclick...
Accessible multimedia - Learn web development
avoid the user interface going wrong if they attempt to fast forward when the video is not playing, or fast forward past the end of the video. last of all, add the following to the end of the code, to control the time elapsed display: player.ontimeupdate = function() { let minutes = math.floor(player.currenttime / 60); let seconds = math.floor(player.currenttime - minutes * 60); let minutevalue; let secondvalue; if (minutes<10) { minutevalue = "0" + minutes; } else { minutevalue = minutes; } if (seconds<10) { secondvalue = "0" + seconds; } else { secondvalue = seconds; } mediatime = minutevalue + ":" + secondvalue; timelabel.textcontent = mediatime; }; each time the time updates (once per second), we fire this function. it works out the number of mi...
... further reading this gives you a basic idea of how to add custom player functionality to video/audio player instances. ...
... further reading this gives you a basic idea of how to add custom player functionality to video/audio player instances. ...
Fundamental CSS comprehension - Learn web development
at gives the <p> inside the footer an effective font size of 15px (but expressed in ems) and an appropriate line height to place it in the center of the footer's content box. recall from earlier that the content box height should be 30px — this gives you all the numbers you need to calculate the line height. as a last little touch, give the paragraph inside the <article> an appropriate padding value so that its left edge lines up with the <h2> and footer paragraph, and set its color to be fairly light so it is easy to read. note: bear in mind that the second ruleset sets font-size: 10px; on the <html> element — this means that for any descendants of <html>, an em will be equal to 10px rather than 16px as it is by default. (this is of course, provided the descendants in question don't ha...
... bear in mind that the second ruleset sets font-size: 10px; on the <html> element — this means that for any descendants of <html>, an em will be equal to 10px rather than 16px as it is by default. (this is of course, provided the descendants in question don't have any ancestors sitting in between them and <html> in the hierarchy that have a different font-size set on them. this could affect the values you need, although in this simple example this is not an issue.) other things to think about: you'll get bonus marks if you write your css for maximum readability, with a separate declaration on each line. you should 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 ...
...arate declaration on each line. you should 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...
Images, media, and form elements - Learn web development
will see that the smaller image remains unchanged, but the larger one becomes smaller to fit into the box. you can make other choices about images inside containers. for example, you may want to size an image so it completely covers a box. the object-fit property can help you here. when using object-fit the replaced element can be sized to fit a box in a variety of ways. below we have used the value cover, which sizes the image down, maintaining the aspect ratio so that it neatly fills the box. as the aspect ratio is maintained some parts of the image will be cropped by the box. if we use contain as a value the image will be scaled down until it is small enough to fit inside the box. this will result in "letterboxing" if it is not the same aspect ratio as the box. you could also try the ...
... cover, which sizes the image down, maintaining the aspect ratio so that it neatly fills the box. as the aspect ratio is maintained some parts of the image will be cropped by the box. if we use contain as a value the image will be scaled down until it is small enough to fit inside the box. this will result in "letterboxing" if it is not the same aspect ratio as the box. you could also try the value of fill, which will fill the box but not maintain the aspect ratio. replaced elements in layout when using various css layout techniques on replaced elements, you may well find that they behave slightly differently to other elements. for example, in a flex or grid layout elements are stretched by default to fill the entire area. images will not stretch, and instead will be aligned to the start ...
...e we'll look over a few tips you'll find useful when you have to style html tables. ...
Organizing your CSS - Learn web development
e developers put all of the rules onto a single line, like so: .box { background-color: #567895; } h2 { background-color: black; color: white; } other developers prefer to break everything onto a new line: .box { background-color: #567895; } h2 { background-color: black; color: white; } css doesn't mind which one you use. we personally find it is more readable to have each property and value pair on a new line. comment your css adding comments to your css will help any future developer work with your css file, but will also help you when you come back to the project after a break. /* this is a css comment it can be broken onto multiple lines. */ a good tip is to add a block of comments between logical sections in your stylesheet too, to help locate different sections quickly when...
...rocessor solution for doing this would be cssnano. wrapping up this is the final part of our learning css guide, and as you can see there are many ways in which your exploration of css can continue from this point. to learn more about layout in css, see the learn css layout section. you should also now have the skills to explore the rest of the mdn css material. you can look up properties and values, explore our css cookbook for patterns to use, and read more in some of the specific guides such as our guide to css grid layout. previous overview: building blocks in this module cascade and inheritance css selectors type, class, and id selectors attribute selectors pseudo-classes and pseudo-elements combinators the box model backgrounds and borders handling d...
..., and read more in some of the specific guides such as our guide to css grid layout. ...
CSS selectors - Learn web development
html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn how css selectors work in detail. what is a selector? you have met selectors already. a css selector is the first part of a css rule. it is a pattern of elements and other terms that tell the browser which html elements should be selected to have the css property values inside the rule applied to them. the element or elements which are selected by the selector are referred to as the subject of the selector. in earlier articles you met some different selectors, and learned that there are selectors that target the document in different ways — for example by selecting an element such as h1, or a class such as .special. in css, selectors are defined in the cs...
...ludes selectors that target an html element such as an <h1>. h1 { } it also includes selectors which target a class: .box { } or, an id: #unique { } attribute selectors this group of selectors gives you different ways to select elements based on the presence of a certain attribute on an element: a[title] { } or even make a selection based on the presence of an attribute with a particular value: a[href="https://example.com"] { } pseudo-classes and pseudo-elements this group of selectors includes pseudo-classes, which style certain states of an element. the :hover pseudo-class for example selects an element only when it is being hovered over by the mouse pointer: a:hover { } it also includes pseudo-elements, which select a certain part of an element rather than the element itself. f...
...jacent sibling combinator h1 + p adjacent sibling general sibling combinator h1 ~ p general sibling in this module cascade and inheritance css selectors type, class, and id selectors attribute selectors pseudo-classes and pseudo-elements combinators the box model backgrounds and borders handling different text directions overflowing content values and units sizing items in css images, media, and form elements styling tables debugging css organizing your css ...
CSS FAQ - Learn web development
Learn › CSS › Howto › CSS FAQ
llow you to style multiple elements, therefore they can lead to shorter stylesheets, rather than having to write out the same styling information in multiple rules that use id selectors. shorter stylesheets are more performant. class selectors have lower specificity than id selectors, so are easier to override if needed. note: see selectors for more information. ...
...e out the same styling information in multiple rules that use id selectors. shorter stylesheets are more performant. class selectors have lower specificity than id selectors, so are easier to override if needed. note: see selectors for more information. how do i restore the default value of a property? initially css didn't provide a "default" keyword and the only way to restore the default value of a property is to explicitly re-declare that property. for example: /* heading default color is black */ h1 { color: red; } h1 { color: black; } this has changed with css 2; the keyword initial is now a valid value for a css property. it resets it to its default value, which is defined in the css specification of the given property. /* heading default color is black */ h1 { color: red; } h1 ...
... error, try to define rules only once for a certain selector, and group all rules belonging to that selector. use of a shorthand property using shorthand properties for defining style rules is good because it uses a very compact syntax. using shorthand with only some attributes is possible and correct, but it must be remembered that undeclared attributes are automatically reset to their default values. this means that a previous rule for a single attribute could be implicitly overridden. #stockticker { font-size: 12px; font-family: verdana; font-weight: bold; } .stocksymbol { font: 14px arial; color: red; } <div id="stockticker"> nys: <span class="stocksymbol">ge</span> +1.0 ... </div> in the previous example the problem occurred on rules belonging to different elements, but it could h...
How can we design for all types of users? - Learn web development
nd background. the calculation may seem pretty complicated, but we can rely on tools to do the job for us. let's download and install the paciello group's colour contrast analyser. note: alternatively you can find a number of contrast checkers online, such as webaim's color contrast checker. we suggest a local checker because it comes packaged with an on-screen color picker to find out a color value. for instance, let's test the colors on this page and see how we fare in the colour contrast analyser: the luminosity contrast ratio between text and background is 8.30:1, which exceeds the minimum standard (4.5:1) and should enable many visually-impaired people to read this page. font size you can specify font size on a website either through relative units or absolute units. absolute un...
... a browser is going to come around and refuse to zoom up text whose size is expressed in pixels. also, check your website's statistics: you may receive visits from older browsers. we would advise the following: describe fonts in rem units, most browsers will be very happy with them; let older browsers display fonts with their own internal 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 newspap...
.... at minimum, you must provide a relevant alt attribute. if the image can be described succinctly, you can provide an alt attribute and nothing more. if the image cannot be described succinctly, you will have to either provide the same content in another form in the same page (e.g., complement a pie chart with a table providing the same data), or resort to a longdesc attribute. this attribute's value is a url pointing towards a resource explicitly describing in detail the image's content. note: the use and even the existence of longdesc has been debated for quite some time. please refer to the w3c's image description extension (longdesc) for the full explanation and thorough examples. audio/video you must also provide alternatives to multimedia content. subtitling/close-captioning yo...
Example 2 - Learn web development
this is the second example that explain how to build custom form widgets. ...
....5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #f0f0f0; background : -webkit-linear-gradient(90deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "▼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : ce...
... = document.queryselector('form'); form.classlist.remove("no-widget"); form.classlist.add("widget"); }); result for js no js html content <form class="no-widget"> <select name="myfruit"> <option>cherry</option> <option>lemon</option> <option>banana</option> <option>strawberry</option> <option>apple</option> </select> <div class="select"> <span class="value">cherry</span> <ul class="optlist hidden"> <li class="option">cherry</li> <li class="option">lemon</li> <li class="option">banana</li> <li class="option">strawberry</li> <li class="option">apple</li> </ul> </div> <form> css content .widget select, .no-widget .select { position : absolute; left : -5000em; height : 0; overflow : hidden; } result...
Example - Learn web development
ow to structure an html form. ...
..."required">*</abbr></strong>.</p> <section> <h2>contact information</h2> <fieldset> <legend>title</legend> <ul> <li> <label for="title_1"> <input type="radio" id="title_1" name="title" value="a"> ace </label> </li> <li> <label for="title_2"> <input type="radio" id="title_2" name="title" value="k" > king </label> </li> <li> <label for="title_3"> <input type="radio" id="title_3" name="title" value="q"> queen </label> </li> </ul> </fieldset> <p> <label for="name"> <span>name: </span> <strong><abbr title="required">*</abbr></strong> </label> <input type...
...</p> <p> <label for="pwd"> <span>password: </span> <strong><abbr title="required">*</abbr></strong> </label> <input type="password" id="pwd" name="password"> </p> </section> <section> <h2>payment information</h2> <p> <label for="card"> <span>card type:</span> </label> <select id="card" name="usercard"> <option value="visa">visa</option> <option value="mc">mastercard</option> <option value="amex">american express</option> </select> </p> <p> <label for="number"> <span>card number:</span> <strong><abbr title="required">*</abbr></strong> </label> <input type="tel" id="number" name="cardnumber"> </p> <p> <label for="date"> <span...
Styling web forms - Learn web development
havior is often inconsistent. by default, some widgets do not inherit font-family and font-size from their parents. many browsers use the system default appearance instead. to make your forms' appearance consistent with the rest of your content, you can add the following rules to your stylesheet: button, input, select, textarea { font-family: inherit; font-size: 100%; } the inherit property value causes the property value to match the computed value of the property of its parent element; inheriting the value of the parent. the screenshots below show the difference. on the left is the default rendering of an <input type="text">, <input type="date">, <select>, <textarea>, <input type="submit">, and a <button> in chrome on macos, with the platform's default font style in use. on the right a...
... up to you to define how you wish to blend them into your content. if you want to keep the native look and feel of the widgets, you'll face a little difficulty if you want to give them a consistent size. this is because each widget has their own rules for border, padding and margin. to give the same size to several different widgets, you can use the box-sizing property along with some consistent values for other properties: input, textarea, select, button { width : 150px; padding: 0; margin: 0; box-sizing: border-box; } in the screenshot below, the left column shows the default rendering of an <input type="radio">, <input type="checkbox">, <input type="range">, <input type="text">, <input type="date"> input, <select>, <textarea>,<input type="submit">, and <button>. the right column o...
...he two important things here are the resize and overflow properties. while our design is a fixed-size design, and we could use the resize property to prevent users from resizing our multi-line text field, it is best to not prevent users from resizing a textarea if they so choose. the overflow property is used to make the field render more consistently across browsers. some browsers default to the value auto, while some default to the value scroll. in our case, it's better to be sure every one will use auto: textarea { display : block; padding : 10px; margin : 10px 0 0 -10px; width : 100%; height : 90%; border-right: 1px solid; /* resize : none; */ overflow: auto; } styling the submit button the <button> element is really convenient to style with css; you can do whatev...
HTML basics - Learn web development
the content of the element, which in this case, is just text. the element: the opening tag, the closing tag and the content together comprise the element. elements can also have attributes that look like the following: attributes contain extra information about the element that you don't want to appear in the actual content. here, class is the attribute name and editor-note is the attribute value. the class attribute allows you to give the element a non-unique identifier that can be used to target it (and any other elements with the same class value) with style information and other things. an attribute should always have the following: a space between it and the element name (or the previous attribute, if the element already has one or more attributes). the attribute name followed b...
... to give the element a non-unique identifier that can be used to target it (and any other elements with the same class value) with style information and other things. an attribute should always have the following: a space between it and the element name (or the previous attribute, if the element already has one or more attributes). the attribute name followed by an equal sign. the attribute value wrapped by opening and closing quotation marks. note: simple attribute values that don't contain ascii whitespace (or any of the characters " ' ` = < > ) can remain unquoted, but it is recommended that you quote all attribute values, as it makes the code more consistent and understandable. nesting elements you can put elements inside other elements too — this is called nesting. if we wan...
...k, we need to use a simple element — <a> — "a" being the short form for "anchor". to make text within your paragraph into a link, follow these steps: choose some text. we chose the text "mozilla manifesto". wrap the text in an <a> element, as shown below: <a>mozilla manifesto</a> give the <a> element an href attribute, as shown below: <a href="">mozilla manifesto</a> fill in the value of this attribute with the web address that you want the link to link to: <a href="https://www.mozilla.org/about/manifesto/">mozilla manifesto</a> you might get unexpected results if you omit the https:// or http:// part, called the protocol, at the beginning of the web address. after making a link, click it to make sure it is sending you where you wanted it to. href might appear like a r...
Add a hitmap on top of an image - Learn web development
ou insert your image much the same way as always (with an <img> element and alt text). if the image is only present as a navigation device, you may write alt="", provided you furnish appropriate alt text in the <area> elements later on. you will need a special usemap attribute. come up with a unique name, containing no spaces, for your image map. then assign that name (preceded by a hash) as the value for the usemap attribute: <img src="image-map.png" alt="" usemap="#example-map-1" /> step 2: activate your hotspots in this step, put all your code inside a <map> element. <map> only needs one attribute, the same map name as you used in your usemap attribute above: <map name="example-map-1"> </map> inside the <map> element, we need <area> elements. an <area> element corresponds to a s...
... attribute above: <map name="example-map-1"> </map> inside the <map> element, we need <area> elements. an <area> element corresponds to a single hotspot. to keep keyboard navigation intuitive, make sure the source order of <area> elements corresponds to the visual order of hotspots. <area> elements 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...
...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 the current area to link anywhere (say, if you’re making a hollow circle.) alt a mandatory attribute, telling people where the link goes or what it does. alt text only displays when the im...
Test your skills: Loops - Learn web development
creating infinite loops and crashing the assessment page! if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. dom manipulation: considered useful some of the questions below require you to write some dom manipulation code to complete them — such as creating new html elements, setting their text contents to equal specific string values, and nesting them inside existing elements on the page — all via javascript. we haven't explicitly taught this yet in the course, but you'll have seen some examples that make use of it, and we'd like you to do some research into what dom apis you need to successfully answer the questions. a good starting place is our manipulating documents tutorial. loops 1 in our first looping task we want...
...in an online editor. loops 2 in this next task, we want you to write a simple program that, given a name, searches an array of objects containing names and phone numbers (phonebook) and, if it finds the name, outputs the name and phone number into the paragraph (para) and then exits the loop before it has run its course. you are given three variables to begin with: i — starts off with a value of 0; intended to be used as an iterator. name — contains a name to search for para — contains a reference to a paragraph, which will be used to report the results. you should use a type of loop that you've not used in the previous task. download the starting point for this task to work in your own editor or in an online editor. loops 3 in this final task, you are provided with the f...
...ator. name — contains a name to search for para — contains a reference to a paragraph, which will be used to report the results. you should use a type of loop that you've not used in the previous task. download the starting point for this task to work in your own editor or in an online editor. loops 3 in this final task, you are provided with the following: i — starts off with a value of 500; intended to be used as an iterator. para — contains a reference to a paragraph, which will be used to report the results. isprime() — a function that, when passed a number, returns true if the number is a prime number, and false if not. you need to use a loop to go through the numbers 2 to 500 backwards (1 is not counted as a prime number), and run the provided isprime() function ...
Test your skills: Math - Learn web development
section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version). math 1 let's start out by testing your knowledge of basic math operators. you will have to create four numeric values, then add the first two together, then subtract the fourth from the third, then multiply the two secondary results together to get a result of 48. finally, we need to write a test that proves that this value is an even number. so, try updating the live code below to recreate the finished example, following these steps: create four variables that contain numbers. call the variables something ...
...ll the variables something sensible. add the first two variables together and store the result in another variable. subtract the fourth variable from the third and store the result in another variable. multiply the results from the last two steps together, storing the result in a variable called finalresult. the product should be 48. if it isn't, you'll have to adjust some of the initial input values. finally, write a calculation that checks whether finalresult is an even number. store the result in a variable called evenoddresult. download the starting point for this task to work in your own editor or in an online editor. math 2 in the second task you are already provided with two calculations, with the results stored in the variables result and result2. but these results aren't wh...
...t. this will require assignment shorthand. write a line of code that takes result and formats it to 2 decimal places, storing the result of this in a variable called finalresult. check the data type of finalresult using typeof; you'll probably see that it is actually of string type! write a line of code that converts it to a number type, storing the result in a variable called finalnumber. the value of finalnumber needs to be 10.42. go back and update the original calculations you were provided with so that they give this final result. don't update the numbers or the operators. download the starting point for this task to work in your own editor or in an online editor. math 3 in the final task for this article, we want you to write some tests. you've got three groups, each consisting...
Test your skills: Strings - Learn web development
ed 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 quotelength. 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 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.
... there is one more small fix to do — add a full stop onto the end of the quote, and save the final version in a variable called finalquote. 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 4 in the final string task, we have given you the name of a theorem, two numeric values, and an incomplete string (the bits that need adding are marked with asterisks (*)). we want you to change the value of the string as follows: change it from a regular string literal into a template literal. replace the four asterisks with four template literal placeholders. these should be: the name of the theorem. the two number values we have. the length of the hypotenuse of a...
...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 editor. ...
Adding features to our bouncing balls demo - Learn web development
inal ball() constructor did. remember to set the ball() constructor's prototype and constructor appropriately. the ball draw(), update(), and collisiondetect() method definitions should be able to stay exactly the same as they were before. you also need to add a new parameter to the new ball() ( ... ) constructor call — the exists parameter should be the 5th parameter, and should be given a value of true. at this point, try reloading the code — it should work just the same as it did before, with our redesigned objects. defining evilcircle() now it's time to meet the bad guy — the evilcircle()! our game is only going to involve one evil circle, but we are still going to define it using a constructor that inherits from shape() to give you some practice. you might want to add another ...
... by copying the ball.prototype.draw definition. you should then make the following changes: we want the evil circle to not be filled in, but rather just have an outer line (stroke). you can achieve this by updating fillstyle and fill() to strokestyle and stroke(). we also want to make the stroke a bit thicker, so you can see the evil circle a bit more easily. this can be achieved by setting a value for linewidth somewhere after the beginpath() call (3 will do). checkbounds() this method will do the same thing as the first part of ball()'s update() function — look to see whether the evil circle is going to go off the edge of the screen, and stop it from doing so. again, you can mostly just copy the ball.prototype.update definition, but there are a few changes you should make: get rid...
... just copy the ball.prototype.update definition, but there are a few changes you should make: get rid of the last two lines — we don't want to automatically update the evil circle's position on every frame, because we will be moving it in some other way, as you'll see below. inside the if() statements, if the tests return true we don't want to update velx/vely; we want to instead change the value of x/y so the evil circle is bounced back onto the screen slightly. adding or subtracting (as appropriate) the evil circle's size property would make sense. setcontrols() this method will add an onkeydown event listener to the window object so that when certain keyboard keys are pressed, we can move the evil circle around. the following code block should be put inside the method definition: l...
Object building practice - Learn web development
needs in order to function in our program: x and y coordinates — the horizontal and vertical coordinates where the ball starts on the screen. this can range between 0 (top left hand corner) to the width and height of the browser viewport (bottom right hand corner). horizontal and vertical velocity (velx and vely) — each ball is given a horizontal and vertical velocity; in real terms these values are regularly added to the x/y coordinate values when we animate the balls, to move them by this much on each frame. color — each ball gets a color. size — each ball gets a size — this is its radius, in pixels. this handles the properties, but what about the methods? we want to get our balls to actually do something in our program. drawing the ball first add the following draw() meth...
...bottom edge). if the y coordinate is smaller than 0 (the ball is going off the top edge). in each case, we include the size of the ball in the calculation because the x/y coordinates are in the center of the ball, but we want the edge of the ball to bounce off the perimeter — we don't want the ball to go halfway off the screen before it starts to bounce back. the last two lines add the velx value to the x coordinate, and the vely value to the y coordinate — the ball is in effect moved 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. the following ...
...so when we have 25 balls on screen, no more balls appear. you can try varying 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 bal...
Vue conditional rendering: editing existing todos - Learn web development
this.isediting = true; } } conditionally displaying components via v:if and v:else now we have an isediting flag that we can use to signify that the item is being edited (or not). if isediting is true, we want to use that flag to display our todoitemeditform instead of the checkbox. to do that, we'll use another vue directive: v-if. the v-if directive will only render a block if the value passed to it is truthy. this is similar to how an if statement works in javascript. v-if also has corresponding v-else-if and v-else directives to provide the equivalent of javascript else if and else logic inside vue templates. it's important to note that v-else and v-else-if blocks need to be the first sibling of a v-if/v-else-if block, otherwise vue will not recognize them. you can also attac...
.... cancel the edit by pressing the "cancel" button. note the state of the checkbox after you cancel — not only has the app forgotten the state of the checkbox, but the done status of that todo item is now out of whack. if you try checking (or unchecking) it again, the completed count will change in the opposite way to what you'd expect. this is because the isdone inside data is only given the value this.done on component load. fixing this is fortunately quite easy — we can do this by converting our isdone data item into a computed property — another advantage of computed properties is that they preserve reactivity, meaning (among other things) that their state is saved when the template changes like ours is now doing. so, let's implement the fix: remove the following line from i...
...-cancelled event emitted by the oncancel() method inside the todoitemeditform component when the "cancel" button is clicked. result: editcancelled() method is invoked, which sets this.isediting back to false, so that the edit form is no longer shown on re-render. todoitemeditform.vue <form> listens for submit event. result: onsubmit() method is invoked, which checks to see if the new label value is not blank, and not the same as the old one, and if so emits the item-edited event (which is then listened for inside todoitem.vue, see above). "cancel" <button> listens for click event. result: oncancel() method is invoked, which emits the edit-cancelled event (which is then listened for inside todoitem.vue, see above). summary this article has been fairly intense, and we covered a lot her...
Focus management with Vue refs - Learn web development
dom nodes (like when setting focus), you can use vue refs. for custom vue components, you can also use refs to directly access the internal structure of a child component, however this should be done with caution as it can make code harder to reason about and understand. to use a ref in a component, you add a ref attribute to the element that you want to access, with a string identifier for the value of the attribute. it's important to note that a ref needs to be unique within a component. no two elements rendered at the same time should have the same ref. adding a ref to our app so, let's attach a ref to our "edit" button in todoitem.vue. update it like this: <button type="button" class="btn" ref="editbutton" @click="toggletoitemeditform"> edit <span class="visually-hidden">{{label}}<...
...t to note that a ref needs to be unique within a component. no two elements rendered at the same time should have the same ref. adding a ref to our app so, let's attach a ref to our "edit" button in todoitem.vue. ...
...ould have the same ref. adding a ref to our app so, let's attach a ref to our "edit" button in todoitem.vue. update it like this: <button type="button" class="btn" ref="editbutton" @click="toggletoitemeditform"> edit <span class="visually-hidden">{{label}}</span> </button> to access the value associated with our ref, we use the $refs property provided on our component instance. to see the value of the ref when we click our "edit" button, add a console.log() to our toggletoitemeditform() method, like so: toggletoitemeditform() { console.log(this.$refs.editbutton); this.isediting = true; } if you activate the "edit" button at this point, you should see an html <button> element referenced in your console. vue's $nexttick() method we want to set focus on the "edit" button when a use...
Handling common accessibility problems - Learn web development
k text to make sense in context and out of context. next on our list, the form <label> element is one of the central features that allows us to make forms accessible. the trouble with forms is that you need labels to say what data should be entered into each form input. each label needs to be included inside a <label> to link it unambiguously to its partner form input (each <label> for attribute value needs to match the form element id value), and it will make sense even if the source order is not completely logical (which to be fair it should be). note: for more information about link text and form labels, read meaningful text labels. finally, a quick word about data tables. a basic data table can be written with very simple markup (see bad-table.html live, and source), but this has probl...
...rs and screen readers. to deal with complex form widgets, you need to use aria attributes like roles to state what role different elements have in a widget (for example, are they a tab, or a tab panel?), aria-disabled to say whether a control is disabled or not, etc. to deal with regularly updating regions of content, you can use the aria-live attribute, which identifies an updating region. its value indicates how urgently the screen reader should read it out: off: the default. updates should not be announced. polite: updates should be announced only if the user is idle. assertive: updates should be announced to the user as soon as possible. rude: updates should be announced straight away, even if this interrupts the user. here's an example: <p><span id="liveregion1" aria-live="polit...
...em and read it. enter/return (when link/button or other activatable item is selected) activate item. nvda + space (when form is selected) enter form so individual items can be selected, or leave form if you are already in it. shift tab and tab (when inside form) move between form inputs. up cursor and down cursor (when inside form) change form input values (in the case of things like select boxes). spacebar (when inside form) select chosen value. ctrl + alt + cursor keys (when a table is selected) move between table cells. screenreader testing now you've gotten used to using a screenreader, we'd like you to use it to do some quick accessibility tests, to get an idea of how screenreaders deal with good and bad webpag...
Mozilla accessibility architecture
ity server like mozilla should use the api's programmatic interfaces to expose this information to an accessibility client (the assistive technology). each platform's accessibility api has made different assumptions, although there are a number of common characteristics. for example, they all expose an accessible name, or text representation, of each object, and they all use an enumerated integer value from a finite list, to expose the role of an object. examples of accessible role constants are role_button, role_checkbox and role_list, although they can have slightly different names and values in each api. in general, the accessibility apis use similar concepts, but use different method, constant and interfaces names. given that there is a fair amount of commonality between accessibility api t...
...bute on an anchor element changes, or the usemap attribute of an img changes. these cases are not very likely, but we should try to think of real-world scenarios where it might happen. if we do this, the code would go into nsdocaccessible::attrmodified(). unique 32-bit identifiers in msaa in msaa, we must hand out a unique 32 bit child number for each target accessible with the event. to get this value we currently take the pointer to the dom node, turn it into an integer, and then negate it. when the msaa client calls back for the accessible node using accessibleobjectfromevent(), windows asks our doc accessible for a child with that child id. this is handled in in nsdocaccessiblewrap::get_accchild(), where we check for a negative child number and then use the accessibility cache to return th...
...ble for any document. per-document cache of accessibles a cache in each nsdocaccessible (maccessnodecache), containing all of the accessible nodes created so far for each document. member variables in nsaccessible that keep track of the number of children (maccchildcount), the parent (mparent), the first child (mfirstchild) and the next sibling (mnextsibling). if mnextsibling equals the magic value dead_end_accessible (void*)1, then there are known to be no more siblings. if mnextsiblings == nsnull, then there could still be more siblings. this architecture allows us to quickly wipe away an entire document's worth of cached nodes when a document goes away, simply by destroying the document accessible's cache. however, it takes two steps to get a dom node's cached accessible. we must first ...
Chrome registration
plemented by the component. to generate a unique classid, use a uuid generator program or site. contract contract @foobar/mycontract;1 {00000000-0000-0000-0000-000000000000} [flags] maps a contract id (a readable string) to the classid for a specific implementation. typically a contract id will be paired with a component entry immediately preceding. category category category entry-name value [flags] registers an entry in the category manager. the specific format and meaning of category entries depend on the category. content a content package is registered with the line: content packagename uri/to/files/ [flags] this will register a location to use when resolving the uri chrome://packagename/content/.... the uri may be absolute or relative to the location of the manifest file.
... of firefox do not understand the contentaccessible flag, any extension designed to work with both firefox 3 and older versions of firefox will need to provide a fallback. for example: content packagename chrome/path/ content packagename chrome/path/ contentaccessible=yes os extensions (or themes) may offer different features depending on the operating system on which firefox is running. the value is compared to the value of os_target for the platform. os=winnt os=darwin see os_target for a more complete list of os names. the os name is case insensitive. osversion an extension or theme may need to operate differently depending on which version of an operating system is running. for example, a theme may wish to adopt a different look on mac os x 10.5 than 10.4: osversion>=10.5 abi ...
...t of os names. the os name is case insensitive. osversion an extension or theme may need to operate differently depending on which version of an operating system is running. for example, a theme may wish to adopt a different look on mac os x 10.5 than 10.4: osversion>=10.5 abi if a component is only compatible with a particular abi, it can specify which abi/os by using this directive. the value is taken from the nsixulruntime os and xpcomabi values (concatenated with an underscore). for example: binary-component component/mylib.dll abi=winnt_x86-msvc binary-component component/mylib.so abi=linux_x86-gcc3 see xpcom abi for more details. platform (platform-specific packages) some packages are marked with a special flag indicating that they are platform specific. some parts of conten...
Creating MozSearch plugins
firefox will use the above search engine description to construct the following ...
...firefox will use the above search engine description to construct the following search url: http://search.yahoo.com/search...
...search box and presses the enter key. firefox will use the above search engine description to construct the following search url: http://search.yahoo.com/search?p=mozilla&ei=utf-8&fr=moz2 if the user clicks the magnifying glass icon in the search bar, or chooses the web search option in the tools menu when the search bar isn't visible, the browser will take them to http://search.yahoo.com/, the value of the <searchform> element. example: searching mdc this plugin lets you easily search the mozilla developer center web site. <searchplugin xmlns="http://www.mozilla.org/2006/browser/search/"> <shortname>mdc</shortname> <description>mozilla developer center search</description> <inputencoding>utf-8</inputencoding> <image width="16" height="16">data:image/x-icon;base64,ivborw0kggoaaaansuheugaaa...
Eclipse CDT
e mozilla source you must increase its memory limits. when eclipse's indexer tries to process the mozilla source, eclipse will need considerably more memory than the limits imposed by its default configuration. you can increase eclipse's memory limits using the eclipse.ini that lives alongside the eclipse binary. set an initial heap space of 1 gb and max heap space of 5 gb, say, by modifying the values of the following two lines in eclipse.ini: -xms1g -xmx5g if you fail to increase these limits, then you will likely find that eclipse either hangs when it tries to index the mozilla source or else that the code intelligence is very broken after the indexing "completes". express setup for the eclipse indexer to work well you must first build mozilla, so that it includes headers from the objdi...
..._impl_ns_layout issue described above, you would use the context menu for the 'layout' directory in the project explorer tab to open the directory's properties. you'd select "c/c++ general > prepocessor include paths, macros etc.", and select "gnu c++" and "cdt user settings entries". you'd then click "add", select "preprocessor macro" from the drop-down, and set name to _impl_ns_layout and leave value blank. finally, you'd click ok twice to return to the main eclipse window, and then use the context menu for the 'layout' directory to re-index the 'layout' directory, and then to "run c/c++ code analysis" on it to see if the problem is fixed. this "parse once" strategy can also cause "unresolved inclusion" errors in headers if the first time eclipse sees the header is while indexing a file for ...
...o resolve this issue is to remove any source entry from the debug configuration (run->open debug dialog...) in the source tab. doing so will, unfortunately, remove the binding between the binaries and the source code. to keep this feature working, you need to add a "path mapping" by clicking "add..." in the source tab. once a "path mapping" is created, select "edit..." and add an entry with these values compilation path: / local file system path: / this is the only known workaround to bind binaries to source files. it has been tested and works perfectly under eclipse europa (3.3.2) with eclipse-cdt (4.0.3). ...
Experimental features in Firefox
ut while having normal grid layout on the other. this allows to create gallery style layouts like on pinterest. see bug 1607954 for more details. release channel version added enabled by default? nightly 77 no developer edition 77 no beta 77 no release 77 no preference name layout.css.grid-template-masonry-value.enabled media feature: prefers-contrast the prefers-contrast media feature is used to detect whether the user has specified a preference for higher (or lower) contrast in the presentation of web content. refer to bug 1506364 for more details. release channel version added enabled by default? nightly 80 no developer edition 80 no b...
... release channel version added enabled by default? nightly 74 no developer edition 74 no beta 74 no release 74 no preference name dom.input_events.beforeinput.enabled htmlmediaelement method: setsinkid() htmlmediaelement.setsinkid() allows you to set the sink id of an audio output device on...
...se 33 no preference name media.track.enabled dom document property: autoplaypolicy the document property autoplaypolicy returns a string indicating how the browser handles requests to automatically play media (either using the autoplay property on a media element or by attempting to trigger playback from javascript code. the spec for this api is still being written. the value changes over time depending on what the user is doing, their preferences, and the state of the browser in general. potential values include allowed (autoplay is currently permitted), allowed-muted (autoplay is allowed but only with no—or muted—audio), and disallowed (autoplay is not allowed at this time). see bug 1506289 for more details. release channel version added enabled ...
CSS <display-xul> component
see this firefox site compatibi...
...see this firefox site compatibility post for more details. ...
...see this firefox site compatibility post for more details. ...
HTTP Cache
siloadcontextinfo. the form is following (currently pending in bug 968593): a,b,i1009,p, regular expression: (.([^,]+)?,)* the first letter is an identifier, identifiers are to be alphabetically sorted and always terminate with ',' a - when present the scope is belonging to an anonymous load b - when present the scope is in browser element load i - when present must have a decimal integer value that represents an app id the scope belongs to, otherwise there is no app (app id is considered 0) p - when present the scope is of a private browsing load, this never persists cachestorageservice keeps a global hashtable mapped by the scope key. elements in this global hashtable are hashtables of cache entries. the cache entries are mapped by concantation of enhance id and uri passed to nsica...
... consumer releases the entry) oncacheentryavailable is invoked on the opener with anew = false and the entry opener is removed from the fifo result == entry_not_wanted: oncacheentryavailable is invoked on the opener with null for the entry opener is removed from the fifo state == writing or revalidating: do nothing and exit any other value of state is unexpected here (assertion failure) loop this process while there are openers in the fifo cacheentry::onfileready (entry atomic): load result == failure or the file has not been found on disk (is new): state = empty otherwise: state = ready since the cache file has been found and is usable containing meta data and data of the entry call to cacheentry::invokecallbacks cacheen...
...y 250kb and is controlled by a new browser.cache.disk.metadata_memory_limit preference. when the limit is exceeded, we purge (throw away) first expired and then least used entries to free up memory again. only cacheentry objects that are already loaded and filled with data and having the 'consumer reference == 0' (bug 942835) can be purged. the 'least used' entries are recognized by the lowest value of frecency we re-compute for each entry on its every access. the decay time is controlled by the browser.cache.frecency_half_life_hours preference and defaults to 6 hours. the best decay time will be based on results of an experiment. the memory pool is represented by two lists (strong refering ordered arrays) of cacheentry objects: sorted by expiration time (that default to 0xffffffff) sor...
Internationalized Domain Names (IDN) Support in Mozilla Browsers
netscape 7.1 or mozilla 1.4: type about:config into the location/url bar. this will list all the preferences for your current profile. these preferences can be modified or new ones can be created without quitting the browser using the steps described below. create a new preference item using the menu new > string via a right-mouse click. the name of the preference is: network.idn_prefix. ...
...rowser using the steps described below. create a new preference item using the menu new > string via a right-mouse click. the name of the preference is: network.idn_prefix. the value should be "bq--". this will change the default from puncycode to race. next create another new preference item using the right-mouse click menu new > boolean. the name of the preference is: network.idn_testbed. the value should be "true". now access idn sites under the .com and .net top domains. you should succeed in reaching the sample sites. ...
...this means that there is no longer any need to use a plug-in to process non-ascii domain names. ...
Addon
in datadirectorycallback callback) required properties attribute type description appdisabled read only boolean true if this add-on cannot be used in the application based on version compatibility, dependencies, and blocklisting. blockliststate read only integer the current blocklist state of this add-on; see nsiblocklistservice for possible values. creator read only addonauthor the creator of the add-on. foreigninstall read only boolean true or false depending on whether the add-on is a third party add-on installation or not. id read only string the id of the add-on. no other installed add-on will have the same id. isactive read only boolean true if the add-on is currently f...
...ay for this add-on. this is passed to window.opendialog() when presenting the about dialog. if you don't provide an abouturl, a generic about dialog is displayed. the dialog receives the addon object representing your add-on as a parameter. applybackgroundupdates integer indicates whether updates found in the background for this add-on will be applied automatically. see auto update values. the user is provided a ui for this in the add-ons manager and it's the add-on provider's responsibility to remember its selection. contributors read only addonauthor[] an array of strings holding the contributors of the add-on. description read only string the description of the add-on. developers read only addonauthor[] an array of strings holdin...
...addon object. releasenotesuri read only nsiuri a uri for release notes for this version. screenshots read only addonscreenshot[] an array of addonscreenshot objects containing urls of preview images for the add-on. size read only integer the size of the add-on's files in bytes. for an add-on that has not yet been downloaded, this may be an estimated value. sourceuri read only nsiuri the uri that this add-on was installed from. syncguid read only string string guid to identify the add-on in sync. the guid is generated randomly and is made consistent across devices during sync. translators read only addonauthor[] an array of strings holding the translators of the add-on. updatedate read only ...
Assert.jsm
.1, which provides a basic, standardized interface for performing in-code logical assertions with optional, customizable error reporting. to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://testing-common/assert.jsm"); the assert class offers methods for performing common logical assertions. ...
...or); constructor creates a new assert object. let assert = new assert(reporterfunc); the new assert instance, assert, uses reporterfunc to report assertion results or throws an assertionerror when an assertion fails, as default behavior. ok, equal, notequal, deepequal, notdeepequal, strictequal, notstrictequal, throws, setreporter, report methods ok() pure assertion tests whether a value is truthy, as determined by !!guard. this statement is equivalent to assert.equal(true, !!guard, message_opt);. to test strictly for the value true, use assert.strictequal(true, guard, message_opt);. undefined ok( actual, message ); parameters actual test subject to be evaluated as truthy message short explanation of the expected result equal() the equality assertion tests shallo...
... an error object when the assertion failed or null when it passed message message describing the assertion stack stack trace of the assertion function. report() all of the aforementioned functions must throw an assertionerror when a corresponding condition is not met, with a message that may be undefined if not provided. all assertion methods provide both the actual and expected values to the assertion error for display purposes. this report method only throws errors on assertion failures, as per spec, but consumers of this module (think: xpcshell-test, mochitest) may want to override this default implementation. undefined report( failed, actual, expected, message, operator ); parameters failed indicates if the assertion failed or not actual the result of...
DownloadTarget
target file. partfilepath read only string the path of the ".part" file containing the data downloaded so far, or null to disable the use of a ".part" file to keep partially downloaded data. size read only number the size of the target file, in bytes, or zero if the download has not yet been completed. ...
...g the path of the ".part" file containing the data downloaded so far, or null to disable the use of a ".part" file to keep partially downloaded data. size read only number the size of the target file, in bytes, or zero if the download has not yet been completed. it is possible for this property to have a non-zero value even if the target file no longer exists, if the value is available in download metadata. if that metadata is no longer available and the file has been deleted, then this value is zero. for single-file downloads, this property's value will always match the actual size of the file on disk, while the download.totalbytes property, when available, may indicate the size of the data as encoded for transfer instead. for downloads of multiple files...
...media to disk, the meaning of this property is undefined. it currently indicates the size of the main file (such as the html document) rather than the sum of all of the files' sizes, but you must not rely upon this behavior, as it is subject to change. this is a dynamic property, which is updated when the download finishes or whenever the download.refresh() method is called. you can use this value from the front-end to reduce file i/o that would be required to check the file directly. methods refresh() updates the state of a finished, failed, or canceled download based on the current state as indicated by the file system. if the download is in progress or has been finalized, this method does nothing and returns a resolved promise. calling this method lets the download object'...
Http.jsm
http.jsm http.jsm provides httprequest - a wrapper for xmlhttprequest that provides convenient and simplified api for dealing with http requests. httprequest supports the following parameters: name meaning headers an array of headers postdata this can be: a string: send it as is an array of parameters: encode as form values null/undefined: no post data. method get, post or put (this is automatically set if postdata exists). onload a function handle to call when the load is complete, it takes two parameters: the responsetext and the xhr object. onerror a function handle to call when an error occurs, it takes three parameters: the error, the responsetext and the xhr ...
...d is complete, it takes two parameters: the responsetext and the xhr object. onerror a function handle to call when an error occurs, it takes three parameters: the error, the responsetext and the xhr object. logger an object that implements the debug and log methods (e.g. log.jsm). headers or post data are given as an array of arrays, for each inner array the first value is the key and the second is the value. for example: [["key1", "value1"], ["key2", "value2"]]. submitting post data httprequest allows attaching data to the post requests. the data can be specified via postdata option. postdata can be of 2 different types: a string or an array of parameters. when null/undefined is given, no post data will be attached. if a string is given the data will be appen...
...ng post data httprequest allows attaching data to the post requests. the data can be specified via postdata option. postdata can be of 2 different types: a string or an array of parameters. when null/undefined is given, no post data will be attached. if a string is given the data will be appended to the request as is. in case an array of parameters is given, it will be treated as an array of key-value pairs. the elements of the array will be url-encoded and "application/x-www-form-urlencoded; charset=utf-8" will be enforced as the content type. http.jsm only forces the content type if the post data is an array, and it serializes it automatically. if the provided postdata is a string, the content type isn't touched. in this case, the content type may be set through the headers parameter. addit...
Encodings for localization files
aller can’t handle utf-8, but only the codepages provided by windows. this is tricky to hook up in the build process, so here it goes: file encoding notes toolkit/installer/windows/charset.mk ascii the win_installer_charset variable must be set to an encoding which matches toolkit/installer/windows/install.it charset= parameter. see the table below for appropriate values. toolkit/installer/windows/install.it a windows codepage. this must match the charset= parameter in this file, and the win_installer_charset parameter in charset.mk the fontname/fontsize/charset parameters in this file must be set to good values. for most western scripts, ‘ms sans serif’ and ‘8’ are good defaults for the font settings. eastern scripts will need to choose a...
...tch the charset= parameter in this file, and the win_installer_charset parameter in charset.mk the fontname/fontsize/charset parameters in this file must be set to good values. for most western scripts, ‘ms sans serif’ and ‘8’ are good defaults for the font settings. eastern scripts will need to choose appropriate fonts that are shipped with windows. see the table below for appropriate values for the charset= parameter. ...
...gs. eastern scripts will need to choose appropriate fonts that are shipped with windows. see the table below for appropriate values for the charset= parameter. ...
Localization and Plurals
e from javascript is simple with components.utils.import. just put the following line somewhere that will be evaluated before you want to use pluralform. at the top of your javascript file is fine. components.utils.import("resource://gre/modules/pluralform.jsm"); methods: get these methods make use of the browser's current locale specified by chrome://global/locale/intl.properties's pluralrule value. /** * get the correct plural form of a word based on the number * * @param anum * the number to decide which plural form to use * @param awords * a semi-colon (;) separated string of words to pick the plural form * @return the appropriate plural form of the word */ string pluralform get(int anum, string awords) here is an example of using this method: // load pluralform ...
...the following would be better: components.utils.import("resource://gre/modules/pluralform.jsm"); let downloads = "you have one download.;you have #1 do...
...t plural form, * function that returns the number of plural forms] */ [string pluralform get(int anum, string awords), int numforms numforms()] makegetter(int arulenum) here is an example usage of makegetter: components.utils.import("resource://gre/modules/pluralform.jsm"); // let's get irish (plural rule #11) let [get, numforms] = pluralform.makegetter(11); // make up some values to use with "get" let dummytext = "form 1;form 2;form 3;form 4;form 5"; let dummynum = 10; // in the case of irish, the value 10 uses plural form #4, so "form 4" is printed print(get(dummynum, dummytext)); in this example, the irish plural rule was hardcoded, but this could be a value specified in the .properties file. so for your extension, specify a pluralrule value in the .properties, and c...
Basics
∫ a b d x + mathml and javascript html content <p> and you can turn to javascript and the dom for dynamic operations. </p> <div style="text-align:center"> fill the gaps in this matrix with resizable input fields. ...
... you can turn to javascript and the dom for dynamic operations. </p> <div style="text-align:center"> fill the gaps in this matrix with resizable input fields. ...
...nvisibletimes;</mo> <msup> <mi>y</mi> <mn>4</mn> </msup> </mrow> <mo>+</mo> <msup> <mi>y</mi> <mn>5</mn> </msup> </mrow> </maction> </mtd> </mtr> </mtable> </mtd> </mtr> </mtable> </math> </div> css content .control { text-decoration: none; font-weight: bold; font-size: 200%; } input { color: red; } [class="inputmath"] { border: 1px dotted; } javascript content function setselection(id,value) { document.getelementbyid(id).setattribute("selection",value); } function expand() { setselection("a11","2"); setselection("a12","2"); setselection("a13","2"); setselection("a21","2"); setselection("a22","2"); setselection("a23","2"); setselection("a31","2"); setselection("a32","2"); setselection("a33","2"); setselection("a41","2"); setselection("a42","2"); setselection("a43","2"...
MathML Torture Test
mathml torture test html content <p> render mathematics with: <select name="mathfont" id="mathfont"> <option value="default" selected="selected">default fonts</option> <option value="asana">asana</option> <option value="cambria">cambria</option> <option value="dejavu">dejavu</option> <option value="latinmodern">latin modern</option> <option value="libertinus">libertinus</option> <option value="lucidabright">lucida bright</option> <option value="minion">minion</option> <option value="stixtwo">stix two</option> <option value="texgyrebonum">tex gyre bonum</option> <option value="texgyrepagella">tex gyre pagella</option> <option value="texgyreschola">tex gyre schola</option> <option value="texgyretermes">tex gyre termes</option> ...
...ption> <option value="lucidabright">lucida bright</option> <option value="minion">minion</option> <option value="stixtwo">stix two</option> <option value="texgyrebonum">tex gyre bonum</option> <option value="texgyrepagella">tex gyre pagella</option> <option value="texgyreschola">tex gyre schola</option> <option value="texgyretermes">tex gyre termes</option> <option value="xits">xits</option> </select> <br/> </p> <table> <tr> <td></td> <th scope="col">as rendered by tex</th> <th scope="col">as rendered by your browser</th></tr> <tr> <td>1</td> <td><img src="https://udn.realityripple.com/samples/45/d5a0dbbca3.png" width="38" height="22" alt="texbook, 16.2-16.3" /></td> <td> <math display="block"> <mrow> ...
... addeventlistener("change", updatemathfont, false) } window.addeventlistener("load", load, false); the following test contains sample tex formulas from knuth's tex book and equivale...
Using the viewport meta tag to control layout on mobile browsers
ors. learn more about viewports in different mobile browsers in a tale of two viewports at quirksmode.org. viewport basics a typical mobile-optimized site contains something like the following: <meta name="viewport" content="width=device-width, initial-scale=1"> the width property controls the size of the viewport. it can be set to a specific number of pixels like width=600 or to the special value device-width, which is the width of the screen in css pixels at a scale of 100%. (there are corresponding height and device-height values, which may be useful for pages with elements that change size or position based on the viewport height.) the initial-scale property controls the zoom level when the page is first loaded. the maximum-scale, minimum-scale, and user-scalable properties control ho...
...sharper images on these screens, web developers may want to design images – or whole layouts – at a higher scale than their final size and then scale them down using css or viewport properties. this is consistent with the css 2.1 specification, which says: if the pixel density of the output device is very different from that of a typical computer display, the user agent should rescale pixel values. it is recommended that the pixel unit refer to the whole number of device pixels that best approximates the reference pixel. it is recommended that the reference pixel be the visual angle of one pixel on a device with a pixel density of 96dpi and a distance from the reader of an arm's length. for web developers, this means that the size of a page is much smaller than the actual pixel count an...
...nges in zoom level. not all mobile browsers handle orientation changes in the same way. for example, mobile safari often just zooms the page when changing from portrait to landscape, instead of laying out the page as it would if originally loaded in landscape. if web developers want their scale settings to remain consistent when switching orientations on the iphone, they must add a maximum-scale value to prevent this zooming, which has the sometimes-unwanted side effect of preventing users from zooming in: <meta name="viewport" content="initial-scale=1, maximum-scale=1"> suppress the small zoom applied by many smartphones by setting the initial scale and minimum-scale values to 0.86. the result is horizontal scroll is suppressed in any orientation and the user can zoom in if they want to. <...
about:memory
e bytes as their unit, but some are counts or percentages. most measurements are presented within trees. for example: 585 (100.0%) -- preference-service └──585 (100.0%) -- referent ├──493 (84.27%) ── strong └───92 (15.73%) -- weak ├──92 (15.73%) ── alive └───0 (00.00%) ── dead leaf nodes represent actual measurements; the value of each internal node is the sum of all its children. the use of trees allows measurements to be broken down into further categories, sub-categories, sub-sub-categories, etc., to arbitrary depth, as needed. all the measurements within a single tree are non-overlapping. tree paths can be written using '/' as a separator. for example, preference/referent/weak/dead represents the path to the final...
....62 mb (03.45%) ++ images ├────5.82 mb (03.03%) ++ workers/workers(chrome) ├────5.36 mb (02.80%) ++ (16 tiny) ├────4.07 mb (02.12%) ++ storage ├────2.74 mb (01.43%) ++ startup-cache └────2.16 mb (01.12%) ++ xpconnect some expertise is required to understand the full details here, but there are various things worth pointing out. this "explicit" value at the root of the tree represents all the memory allocated via explicit calls to allocation functions. the "window-objects" sub-tree represents all javascript window objects, which includes the browser tabs and ui windows. for example, the "top(http://edition.cnn.com/, id=8)" sub-tree represents the tab open to cnn.com, and "top(chrome://browser/content/browser.xul, id=3)" represents the main b...
...h names like "(2 tiny)" are artificial nodes inserted to allow insignificant sub-trees to be collapsed by default. if you select the "verbose" checkbox before measuring, all trees will be shown fully expanded and no artificial nodes will be inserted. the "js-non-window" sub-tree represents javascript memory usage that doesn't come from windows, but from the browser core. the "heap-unclassified" value represents heap-allocated memory that is not measured by any memory reporter. this is typically 10--20% of "explicit". if it gets higher, it indicates that additional memory reporters should be added. dmd can be used to determine where these memory reporters should be added. there are measurements for other content such as images and workers, and for browser subsystems such as the startup cache ...
Localization Use Cases
consequently, using the existing localization frameworks, the developer needs to predict which strings might need pluralization in othe...
...n french, the unit abbreviations are as follows: byteunit-b = o byteunit-kb = ko byteunit-mb = mo byteunit-gb = go byteunit-tb = to solution in l20n, the french localizer could provide the translation of unit abbreviations locally in the localization file, without impacting the english localization file. ...
... ...
AsyncTestUtils extended framework
. a function should yield true or return true when the asynchronous driver should continue executing without stopping. a function that does not return anything (or returns undefined) and is not a generator is treated like a function that returned true. most of the things you will want to do already have helper functions that take care of all of this, so all you need to do is pass their return values through. for example, you would do "yield async_move_messages(...);" and be done with it. helpers for the asynchronous function contract it can be annoying to have to write interface boilerplate just to call async_driver. if you have the following types of listeners you can use the following pre-defined helpers: nsiurllistener: asyncurllistener (predefined). if you need to wrap an existing ...
...eed to wrap an existing url listener or need a callback or fancy promise, create an instance of asyncurllistener. copy listener: asynccopylistener. bringing messages into the picture synthetic set definitions most of the code involved in creating synthetic messages takes an object that defines how to generate the set. the following is a list of frequently used attributes where the default value is listed after the attribute name. there are more attributes you can specify; consult the documentation for more information. (see the bottom of this page for links to the source files.) count: 10 the number of messages that should be in the set. note that the default is subject to change, so if you want 10, say 10, instead of relying on the default. msgsperthread: 1 how many messages shou...
...nutes, hours, days, weeks. these attributes specify how old the message should be. for example, {weeks: 2, days: 3} would be a message sent exactly 17 days ago. if you pass age, you should also pass age_incr. age_incr: (no increment) takes an object of the same style taken by age. this specifies the time interval we should add to the date for each message. due to a bug, you should pass negative values. (we will probably auto-correct that in the future.) if your set definition was {count: 3, age: {days: 7}, age_incr: {days: -1}}, then you would generate messages from 7, 6, and 5 days ago. subject: (automatically generated random subject) force all the messages to have the same subject you pass in. for example, {count: 1, subject: "my suitcase"} would result in a single message with the subje...
Optimizing Applications For NSPR
other thread. for more details, see the memo on automatic addresses. windows 3.1 does not support 64 bit file offsets. the nspr 64 bit file offset apis map to windows 3.1 32 bit file offset apis. you may use nspr's 64bit file offset apis in your windows 3.1 applications for cross platform consistency, but do not expect to see real 64 bit file offset behavior. on windows 3.1, when nspr detects a value in a 64 bit file offset greater than 32bit significance, it terminates with an assert. the general rules of 16 bit large model memory restrictions apply to applications using nspr on windows 3.1. the nspr process creation api functions return an error when invoked on windows 3.1. functions called in an application by a shared library require an additional function prolog. the prolog is present...
...acro <tt>pr_callback</tt>. for any function made available to any shared library (most likely passed in as a function pointer), that function must have the <tt>pr_callback</tt> qualifier. nspr functions are normally declared <tt>__cdecl</tt>. these declarations are hidden in the <tt>pr_extern()</tt> declarations in nspr's header files. nspr functions returning floating point types and structs by value, including the derived types print64, are declared <tt>__pascal</tt>. these different declarations are to accommodate restrictions in watcom's c/c++ version 11.0 and 11.0a compiler. windows 3.1 does not provide a non-blocking file i/o interface. nspr's file i/o is done using windows 3.1's synchronous file i/o api. the nspr file i/o apis may cause a thread switch even though the i/o is fully sync...
...indows 3.1's synchronous file i/o api. the nspr file i/o apis may cause a thread switch even though the i/o is fully synchronous. do not depend on file i/o being synchronous. command line applications using the libc printf() and related apis behave funny on windows 3.1. read the fine print in the windows sdk for the grizzly details. watch out for printn overflow on win16. make sure all possible values of your printn variables are within 2^16. win-95 the win-95 version of nspr should really be labeled win-32. the same library will work on either win-nt or win-95. win-95 nspr uses native threads as nspr threads. generally speaking, the native threads (on nt or '95) are quite functional. however, having lots of them (100s or even 1000s) is unrealistic. <tt>pr_interrupt()</tt> is not implem...
PRExplodedTime
minute, second. it also has a microsecond component, as well as the day of week and the day of year. in addition, prexplodedtime includes a prtimeparameters structure representing the local time zone information, so that the time point is non-ambiguously specified. ...
... tm_usec: number of microseconds past tm_sec. the range is [0, 999999]. tm_params: a prtimeparameters structure representing the local time zone information. the nonessential members of prexplodedtime are: tm_wday: day of week. the range is [0, 6]. 0 is sunday, 1 is monday, and 6 is saturday. tm_yday: day of year. ...
... ...
PR_CEnterMonitor
nters the lock associated with a cached monitor. syntax #include <prcmon.h> prmonitor* pr_centermonitor(void *address); parameter the function has the following parameter: address a reference to the data that is to be protected by the monitor. this reference must remain valid as long as there are monitoring operations being performed. ...
...entermonitor(void *address); parameter the function has the following parameter: address a reference to the data that is to be protected by the monitor. this reference must remain valid as long as there are monitoring operations being performed. returns the function returns one of the following values: if successful, the function returns a pointer to the prmonitor associated with the value specified in the address parameter. if unsuccessful (the monitor cache needs to be expanded and the system is out of memory), the function returns null. description pr_centermonitor uses the value specified in the address parameter to find a monitor in the monitor cache, then enters the lock associated with the monitor. if no match is found, an available monitor is associated with the address...
...if a match is found, then either the calling thread is already in the monitor (and this is a reentrant call) or another thread is holding the monitor's mutex. in the former case, the entry count is simply incremented and the function returns. ...
PR_GetRandomNoise
produces a random value for use as a seed value for another random number generator. syntax #include <prrng.h> nspr_api(prsize) pr_getrandomnoise( void *buf, prsize size ); parameters the function has these parameters: buf a pointer to a caller-supplied buffer to contain the generated random number. buf must be at least as large as specified in size. size the size, in bytes, of the requested random 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. ...
...in bytes, of the requested random 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. ...
...d 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, extremely difficult to predict and is as nondeterministic as the underlying platfrom permits. ...
PR_ReadDir
gets a pointer to the next entry in the directory. syntax #include <prio.h> prdirentry* pr_readdir( prdir *dir, prdirflags flags); parameters the function has the following parameters: dir a pointer to a prdir object that designates an open directory. flags specifies which directory entries, if any, to skip. values can include the following: pr_skip_none. do not skip any files. pr_skip_dot. ...
... returns a pointer to the next entry in the directory. if the end of the directory is reached or an error occurs, null. the reason can be retrieved via pr_geterror. ...
... pr_skip_none. do not skip any files. pr_skip_dot. skip the directory entry "." representing the current directory. pr_skip_dot_dot. skip the directory entry ".." representing the parent directory. pr_skip_both. skip both "." and ".." pr_skip_hidden. skip hidden files. on windows platforms and the mac os, this value identifies files with the "hidden" attribute set. on unix platform, this value identifies files whose names begin with a period ("."). returns a pointer to the next entry in the directory. if the end of the directory is reached or an error occurs, null. the reason can be retrieved via pr_geterror. description pr_readdir returns a pointer to a directory entry structure: struct prdirentry { const char *name; }; typedef struct prdirentry prdirentry; the stru...
PR_Seek64
moves the current read-write file pointer by an offset expressed as a 64-bit integer. syntax #include <prio.h> print64 pr_seek64( prfiledesc *fd, print64 offset, prseekwhence whence); parameters the function has the following parameters: fd a pointer to a prfiledesc object. offset a value, in bytes, used with the whence parameter to set the file pointer. a negative value causes seeking in the reverse direction. ...
... an offset expressed as a 64-bit integer. syntax #include <prio.h> print64 pr_seek64( prfiledesc *fd, print64 offset, prseekwhence whence); parameters the function has the following parameters: fd a pointer to a prfiledesc object. offset a value, in bytes, used with the whence parameter to set the file pointer. a negative value causes seeking in the reverse direction. whence a value of type prseekwhence that specifies how to interpret the offset parameter in setting the file pointer associated with the fd parameter. the value for the whence parameter can be one of the following: pr_seek_set. sets the file pointer to the value of the offset parameter. pr_seek_cur. sets the file pointer to its current location plus the value of the offset parameter. pr_seek_end. sets t...
...pret the offset parameter in setting the file pointer associated with the fd parameter. the value for the whence parameter can be one of the following: pr_seek_set. sets the file pointer to the value of the offset parameter. pr_seek_cur. sets the file pointer to its current location plus the value of the offset parameter. pr_seek_end. sets the file pointer to the size of the file plus the value of the offset parameter. returns the function returns one of the following values: if the function completes successfully, it returns the resulting file pointer location, measured in bytes from the beginning of the file. if the function fails, the file pointer remains unchanged and the function returns -1. the error code can then be retrieved with pr_geterror. description this is th...
PR_TicksPerSecond
the relationship between a printervaltime tick and standard clock units is platform-dependent. pr_pr_tickspersecond() allows you to discover exactly what that relationship is. ...
... the relationship between a printervaltime tick and standard clock units is platform-dependent. pr_pr_tickspersecond() allows you to discover exactly what that relationship is. ...
... the relationship between a printervaltime tick and standard clock units is platform-dependent. pr_pr_tickspersecond() allows you to discover exactly what that relationship is. ...
PR_Writev
tax #include <prio.h> print32 pr_writev( prfiledesc *fd, priovec *iov, print32 size, printervaltime timeout); #define pr_max_iovector_size 16 parameters the function has the following parameters: fd a pointer to a prfiledesc object for a socket. iov an array of priovec structures that describe the buffers to write from. size number of priovec structures in the iov array. ...
...function has the following parameters: fd a pointer to a prfiledesc object for a socket. iov an array of priovec structures that describe the buffers to write from. size number of priovec structures in the iov array. the value of this parameter must not be greater than pr_max_iovector_size. if it is, the function will fail and the error will be set to pr_buffer_overflow_error. timeout a value of type printervaltime describing the time limit for completion of the entire write operation. returns one of the following values: a positive number indicates the number of bytes successfully written. the value -1 indicates that the operation failed. the reason for the failure can be obtained by calling pr_geterror. description the thread calling pr_writev blocks until all the data is ...
...note that if pr_writev returns -1, part of the data may have been written before an error occurred. ...
PR_dtoa
number to be converted to a string. mode the type of conversion to employ. ndigits the number of digits desired in the output string. decpt a pointer to a memory location where the runtime will store the offset, relative to the beginning of the output string, of the conversion's decimal point. sign a location where the runtime can store an indication that the conversion was of a negative value. *rve if not null this location is set to the address of the end of the result. buf the address of the buffer in which to store the result. bufsz the size of the buffer provided to hold the result. results the principle output is the null-terminated string stored in buf. if rve is not null, *rve is set to point to the end of the returned value. description this function converts the sp...
...n converts the specified floating point number to a string, using the method specified by mode. possible modes are: 0 shortest string that yields d when read in and rounded to nearest. 1 like 0, but with steele & white stopping rule. for example, with ieee 754 arithmetic, mode 0 gives 1e23 whereas mode 1 gives 9.999999999999999e22. 2 max(1, ndigits) significant digits. this gives a return value similar to that of ecvt, except that trailing zeros are suppressed. 3 through ndigits past the decimal point. this gives a return value similar to that from fcvt, except that trailing zeros are suppressed, and ndigits can be negative. 4,5,8,9 same as modes 2 and 3, but usingleft to right digit generation. 6-9 same as modes 2 and 3, but do not try fast floating-point estimate (if applicable)...
...are suppressed, and ndigits can be negative. 4,5,8,9 same as modes 2 and 3, but usingleft to right digit generation. 6-9 same as modes 2 and 3, but do not try fast floating-point estimate (if applicable). all others treated as mode 2. upon return, the buffer specified by buf and bufsz contains the converted string. trailing zeros are suppressed. sufficient space is allocated to the return value to hold the suppressed trailing zeros. if the input parameter d is+infinity,-infinity ornan, *decpt is set to 9999. ...
NSS 3.35 release notes
zilla.org/pub/mozilla.org/security/nss/releases/nss_3_35_rtm/src/ new in nss 3.35 new functionality tls 1.3 support has been updated to draft -23. this includes a large number of changes since 3.34, which supported only draft -18. see below for details. new types in sslt.h sslhandshaketype - the type of a tls handshake message. for the sslsignaturescheme enum, the enumerated values ssl_sig_rsa_pss_sha* are deprecated in response to a change in tls 1.3. please use the equivalent ssl_sig_rsa_pss_rsae_sha* for rsaencryption keys, or ssl_sig_rsa_pss_pss_sha* for pss keys. note that this release does not include support for the latter. notable changes in nss 3.35 previously, nss used the dbm file format by default. starting with version 3.35, nss uses the sql file fo...
...f records. ssl_keylogfile support was updated for tls 1.3. an option to enable tls 1.3 compatibility mode, ssl_enable_tls13_compat_mode, was added. note: in this release, support for new rsa_pss_pss_shax signature schemes have been disabled; end-entity certificates with rsa-pss keys will still be used to produce signatures, but they will use the rsa_pss_rsae_shax codepoints. note: the value of ssl_tls13_key_share_xtn value, from the sslextensiontype, has been renumbered to match changes in tls 1.3. this is not expected to cause problems; code compiled against previous versions of tls will now refer to an unsupported codepoint, if this value was used. recompilation should correct any mismatches. note: dtls support is promoted in draft -23, but this is currently not compliant with...
...tion. note that a dtls server is also provided in tstclnt. tls compression is no longer possible with nss. the option can be enabled, but nss will no longer negotiate compression. the signatures of functions ssl_optionset, ssl_optionget, ssl_optionsetdefault and ssl_optiongetdefault have been modified, to take a printn argument rather than prbool. this makes it clearer, that options can have values other than 0 or 1. note this does not affect abi compatibility, because prbool is a typedef for printn. experimental apis and functionality the functionality and the apis listed in this section are experimental. any of these apis may be removed from future nss versions. applications must not rely on these apis to be present. if an application is linked at runtime to a later version of nss, w...
NSS Sample Code Sample_1_Hashing
* it writes out the digest as a hexadecimal string. */ static int digestfile(prfiledesc *outfile, prfiledesc *infile, secoidtag hashoidtag) { unsigned int nb; unsigned char ibuf[4096]; unsigned char digest[64]; unsigned int len; unsigned int digestlen; hash_hashty...
... * it writes out the digest as a hexadecimal string. */ static int digestfile(prfiledesc *outfile, prfiledesc *infile, secoidtag hashoidtag) { unsigned int nb; unsigned char ibuf[4096]; unsigned char digest[64]; unsigned int len; unsigned int digestlen; hash_hashtype hashtype; ...
... secsuccess) { fprintf(stderr, "%s: nss_init failed in directory %s\n", progname, "/tmp"); return -1; } /* parse command line arguments */ optstate = pl_createoptstate(argc, argv, "t:"); while ((status = pl_getnextopt(optstate)) == pl_opt_ok) { switch (optstate->option) { case 't': require_arg(optstate->option, optstate->value); hashname = strdup(optstate->value); break; } } if (!hashname) usage(progname); /* convert and validate */ hashoidtag = hashnametooidtag(hashname); if (hashoidtag == sec_oid_unknown) { fprintf(stderr, "%s: invalid digest type - %s\n", progname, hashname); usage(progname); } /* digest it and print the result */...
NSS Sample Code Sample_2_Initialization of NSS
= null; char *pwfile = null; char * progname = strrchr(argv[0], '/'); progname = progname ? ...
..., '/'); progname = progname ? ...
...arguments */ optstate = pl_createoptstate(argc, argv, "d:p:q:f:g:"); while ((status = pl_getnextopt(optstate)) == pl_opt_ok) { switch (optstate->option) { case 'd': dbdir = strdup(optstate->value); break; case 'p': plainpass = strdup(optstate->value); break; case 'f': pwfile = strdup(optstate->value); break; default: usage(progname); break; } } pl_destroyoptstate(optstate); if (!dbdir) usage(progname); pr_init(pr_user_thread, pr_priority_normal, 0); /* create the database */ rv = nss_initreadwrite(dbdir); if (rv != secsuccess) { pr_fprintf(pr_stderr, "nss_initialize failed"); pr_clea...
Hashing - sample 1
* it writes out the digest as a hexadecimal string. */ static int digestfile(prfiledesc *outfile, prfiledesc *infile, secoidtag hashoidtag) { unsigned int nb; unsigned char ibuf[4096]; unsigned char digest[64]; unsigned int len; hash_hashtype hashtype; hashcontext ...
... * it writes out the digest as a hexadecimal string. */ static int digestfile(prfiledesc *outfile, prfiledesc *infile, secoidtag hashoidtag) { unsigned int nb; unsigned char ibuf[4096]; unsigned char digest[64]; unsigned int len; hash_hashtype hashtype; hashcontext *hashcontex...
... secsuccess) { fprintf(stderr, "%s: nss_init failed in directory %s\n", progname, "/tmp"); return -1; } /* parse command line arguments */ optstate = pl_createoptstate(argc, argv, "t:"); while ((status = pl_getnextopt(optstate)) == pl_opt_ok) { switch (optstate->option) { case 't': require_arg(optstate->option, optstate->value); hashname = strdup(optstate->value); break; } } if (!hashname) usage(progname); /* convert and validate */ hashoidtag = hashnametooidtag(hashname); if (hashoidtag == sec_oid_unknown) { fprintf(stderr, "%s: invalid digest type - %s\n", progname, hashname); usage(progname); } /* digest it and print the result */...
Initialize NSS database - sample 2
= null; char *pwfile = null; char * progname = strrchr(argv[0], '/'); progname = progname ? ...
..., '/'); progname = progname ? ...
...arguments */ optstate = pl_createoptstate(argc, argv, "d:p:q:f:g:"); while ((status = pl_getnextopt(optstate)) == pl_opt_ok) { switch (optstate->option) { case 'd': dbdir = strdup(optstate->value); break; case 'p': plainpass = strdup(optstate->value); break; case 'f': pwfile = strdup(optstate->value); break; default: usage(progname); break; } } pl_destroyoptstate(optstate); if (!dbdir) usage(progname); pr_init(pr_user_thread, pr_priority_normal, 0); /* create the database */ rv = nss_initreadwrite(dbdir); if (rv != secsuccess) { pr_fprintf(pr_stderr, "nss_initialize failed"); pr_clea...
sample1
* it writes out the digest as a hexadecimal string. */ static int digestfile(prfiledesc *outfile, prfiledesc *infile, secoidtag hashoidtag) { unsigned int nb; unsigned char ibuf[4096]; unsigned char digest[64]; unsigned int len; unsigned int digestlen; h...
... * it writes out the digest as a hexadecimal string. */ static int digestfile(prfiledesc *outfile, prfiledesc *infile, secoidtag hashoidtag) { unsigned int nb; unsigned char ibuf[4096]; unsigned char digest[64]; unsigned int len; unsigned int digestlen; hash_hashtype ...
...(rv != secsuccess) { fprintf(stderr, "%s: nss_init failed in directory %s\n", progname, "/tmp"); return -1; } /* parse command line arguments */ optstate = pl_createoptstate(argc, argv, "t:"); while ((status = pl_getnextopt(optstate)) == pl_opt_ok) { switch (optstate->option) { case 't': require_arg(optstate->option, optstate->value); hashname = strdup(optstate->value); break; } } if (!hashname) usage(progname); /* convert and validate */ hashoidtag = hashnametooidtag(hashname); if (hashoidtag == sec_oid_unknown) { fprintf(stderr, "%s: invalid digest type - %s\n", progname, hashname); usage(progname); } /* digest it and pri...
sample2
'g': /* generate a csr */ case 'a': /* add cert to database */ case 'h': /* save cert to the header file */ case 'e': /* encrypt with public key from cert in header file */ case 's': /* sign with private key */ case 'd': /* decrypt with the matching private key */ case 'v': /* verify with the matching public key */ cmd = option2command(optstate->option); break; case 'd': dbdir = strdup(optstate->value); break; case 'f': pwdata.source = pw_fromfile; pwdata.data = strdup(optstate->value); break; case 'p': pwdata.source = pw_plaintext; pwdata.data = strdup(optstate->value); break; case 'i': infilename = strdup(optstate->value); break; case 'b': headerfilename = strdup(optstate->value); break; case 'e': encryptedfilename = strdup(optstate->value); break; case 'o': outfilename = strdup(optstate->va...
...data = strdup(optstate->value); break; case 'p': pwdata.source = pw_plaintext; pwdata.data = strdup(optstate->value); break; case 'i': infilename = strdup(optstate->value); break; case 'b': headerfilename = strdup(optstate->value); break; case 'e': encryptedfilename = strdup(optstate->value); break; case 'o': outfilename = strdup(optstate->value); break; case 'z': noisefilename = strdup(optstate->value); break; case 's': subjectstr = strdup(optstate->value); subject = cert_asciitoname(subjectstr); break; case 'r': certreqfilename = strdup(optstate->value); break; case 'c': certfilename = strdup(optstate->value); break; case 'u': issuernamestr = strdup(optstate->value); break; case 'n': nicknamestr = strdup(optstate->value); break; case 'x': selfsign = pr_true; break; case 'm': serialnumberstr =...
...: subjectstr = strdup(optstate->value); subject = cert_asciitoname(subjectstr); break; case 'r': certreqfilename = strdup(optstate->value); break; case 'c': certfilename = strdup(optstate->value); break; case 'u': issuernamestr = strdup(optstate->value); break; case 'n': nicknamestr = strdup(optstate->value); break; case 'x': selfsign = pr_true; break; case 'm': serialnumberstr = strdup(optstate->value); serialnumber = atoi(serialnumberstr); break; case 't': truststr = strdup(optstate->value); break; case 'v': sigverify = pr_true; break; default: usage(progname); break; } } pl_destroyoptstate(optstate); if (cmd == unknown || !dbdir) usage(progname); /* open db for read/write and authenticate to it */ pr_init(pr_user_thread, pr_priority_normal, 0); initialized = pr_true; rv = nss_initreadwrite(d...
nss tech note1
onent class type. it is specified in the upper 2 tag bits (number 6 and 7). there are four classes of asn.1 tags : universal, application-specific, context-specific, and private. you can specify the class of the tag using the macros sec_asn1_universal, sec_asn1_application, sec_asn1_context_specific and sec_asn1_private. universal is the default tag class and does not have to be specified, as the value of the class type is zero. the method type : whether the component type is constructed or primitive. this information is stored in the next lowest tag bit (number 5). you can use the macro sec_asn1_constructed for a constructed component type. a sec_asn1_primitive macro is also provided, but does not need to be included as it is zero. the tag number. it is stored in the lower 5 tag bits (nu...
...n1_constructed for a constructed component type. a sec_asn1_primitive macro is also provided, but does not need to be included as it is zero. the tag number. it is stored in the lower 5 tag bits (number 0 through 4). the asn.1 standard only defines tag numbers in the universal class. if you you are using a tag of a different classes, you can define your own tag number macros or specify the tag value within the template definition. the following macros are provided for tag numbers within the universal class : sec_asn1_boolean, sec_asn1_integer, sec_asn1_bit_string, sec_asn1_octet_string, sec_asn1_null, sec_asn1_object_id, sec_asn1_object_descriptor,† sec_asn1_real, sec_asn1_enumerated, sec_asn1_embedded_pdv, sec_asn1_utf8_string, sec_asn1_sequence, sec_asn1_set, sec_asn1_numeric_string...
...ng, sec_asn1_visible_string, sec_asn1_general_string, sec_asn1_universal_string, sec_asn1_bmp_string note that for sec_asn1_set and sec_asn1_sequence types, you must also include the method type macro sec_asn1_constructed to construct a fully valid tag, as defined by the asn.1 standard . decoder modifiers : these modifiers are also specified in the kind field of the template structure. all the values are in the 9 - 31 bit range. sec_asn1_optional: tells the decoder that this component is optional. if the component in the input data does not match this template, the decoder will continue processing the input data using the next available template. sec_asn1_explicit: tells the decoder that explicit tagging is being used. this is always a constructed type. it requires a subtemplate defi...
nss tech note3
sed to verify s/mime email signatures certusageemailrecipient ...... used to encrypt s/mime emails. certusageobjectsigner ........ used to verify signatures on files of executable code, e.g. jar files. certusagestatusresponder ..... used by an ocsp responder certusageverifyca ............ a ca of any kind. each cert has a "type" and a "key usage", each of which may contain one or more valid values. each of the above seccertusages translates into a required set of cert type and key usage for the certificate itself, and into another set of required cert type and key usage for all the ca certs in the cert chain. to determine if a cert is valid for a given cert usage, it must have the the cert type and key usage required for that cert usage, and all the ca certs in the cert chain must have ...
...s key_encipherment. for other types of keys, it is key_agreement. cert extensions: one vital certificate extension is the "basic constraints" extension. it tells nss whether the cert is a ca cert, or not, and affects every other aspect of how the cert is interpreted by nss. the oid for this extension is { 2 5 29 19 }, encoded in hex as 0x55, 0x1d, 0x13. if the extension is present and has the value true, then this cert is taken to be a ca cert. otherwise it is not (except that trust flags may override this, see discussion of trust flags farther below). netscape has its own openly defined cert type extension, which can be used to explicitly set the cert type in any cert. the cert type extension has bits in it that correspond directly to the cert types named above. the oid for this extensi...
...rectly to the cert types named above. the oid for this extension is { 2 16 840 1 113730 1 1 } encoded in hex as 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42, 0x01, 0x01 in addition to netscape's own cert type extension, nss recognizes various x.509 extensions. the x.509 key usage extension has oid { 2 5 29 0f } encoded in hex as 0x55, 0x1d, 0x0f. if present, this extension directly determines the values of the 8 key usages defined above. if absent, the cert is assumed to be valid for all key usages. the x.509v3 extended key usage extension as oid { 2 5 29 37 } encoded in hex as 0x55, 0x1d, 0x25. that extension contains a sequence of oids, each of which signifies one or more cert types, depending on the presence or absence of of the true basic constraints extension; that is, the interpretatio...
nss tech note8
(the ssl2 session lifetime) extern pruint32 ssl3_sid_timeout; (the ssl3 session lifetime) each of these variables applied to both client and server sessions. that is, the client session lifetime was not separately settable from the server session lifetime. these two variables were private, declared in a private header file. there was no api function by which client programs could set these values. however since nss was delivered as archive libraries, client programs merely declared these two variables for themselves, and then were able to alter those variables directly. for server programs, the function for initializing the server session cache would set these two variables according to two of the arguments to that function. so, ssl protocol code that wanted to cache a sid would do the...
...if zero, then the called cache function would compute the correct expiration time by adding the chosen timeout (from one of those two global variables) to the sid's creationtime, giving the expirationtime. however, none of the callers relied on the ability of the respective cache functions to be able to compute the expiration time. all callers computed the expiration times explicitl...
...timeout and ssl_sid_timeout, but rather to set the server cache's variables. since all the callers of the socket's cache function always initialized both their creationtime and expirationtime using the client's session lifetime variables, i changed the server's caching function to ignore the expirationtime computed by the caller, and compute its own expiration time, using the cache's own timeout values, or that was the intent. but an implementation flaw caused the caching code to continue to use the client's timeout time values, not the server cache's own timeout values. that is the subject of bug 223242. ...
NSS Tools ssltap
[-p port] hostname:port options the command does not require any options other than hostname:port, but you normally use them to control the connection interception and output. the options for the command are the following: -v print a version string for the tool. -h turn on hex/ascii printing. instead of outputting raw data, the command interprets each record as a numbered line of hex values, followed by the same data as ascii characters. the two parts are separated by a vertical bar. nonprinting characters are replaced by dots. -f turn on fancy printing. output is printed in colored html. data sent from the client to the server is in blue; the server's reply is in red. when used with looping mode, the different connections are separated with horizontal lines. you can use this opt...
...s is because, by default, the tool closes down after the first connection is complete, so the browser 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. 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. command ssltap.exe -sx -p 444 interzone.mcom.com:443 > sx.txt output output connected to interzone.mcom.com:443--> [alloclen = 66 bytes [ssl2] clienthellov2 { version = {0x03, 0x00} cipher-specs-length = 39 (0x27) sid-length = 0 (0x00) challenge-length = 16 (0x10) cipher...
... = 23 (application_data) version = { 3,0 } length = 223 (0xdf) < encrypted >}sslrecord { 0: 15 03 00 00 12 |..... type = 21 (alert) version = { 3,0 } length = 18 (0x12) < encrypted >}]server socket closed. example 2 the -s option turns on ssl parsing. because the -x option is not used in this example, undecoded values are output as raw data. the output is routed to a text file. command ssltap.exe -s -p 444 interzone.mcom.com:443 > s.txt output connected to interzone.mcom.com:443--> [alloclen = 63 bytes [ssl2] clienthellov2 { version = {0x03, 0x00} cipher-specs-length = 36 (0x24) sid-length = 0 (0x00) challenge-length = 16 (0x10) cipher-suite...
Garbage collection
er, so there is a function jsobject::writebarrierpre(jsobject* old). if zone->needsincrementalbarrier(), then writebarrierpre() marks old. that's it. the class heap<t> is provided to make it easy to invoke write barriers. a heap<t> encapsulates a t* and invokes the write barrier whenever assigned to. thus, object fields of gc-pointer type should normally be defined as type heap<t>. the class heapvalue does the same thing for value. heapslot (and the related class heapslotarray) is the same, but for object slots. heapid is the same, but for jsid. object private fields must be handled specially. the private field itself is opaque to the engine, but it may point to things that need to be marked, e.g., an array of jsobject pointers. in this example, if the private field is overwritten, the jsobje...
...registered by a root. ...
...le pointer to a gc thing (it is essentially a cell** that the gc knows about.) root a starting point to the gc graph traversal, a root is known to be alive for some external reason (one other than being reachable by some other part of the gc heap.) weak pointer in common cs terminology, a weak pointer is one that doesn't keep the pointed-to value live for gc purposes. typically, a weak pointer value has a get() method that returns a null pointer if the object has been gc'd. in gecko/spidermonkey, a weak pointer is a pointer to an object that can be gc'd that is not marked through. thus, there is no get() method and no protection against the pointed-to value getting gc'd--the programmer must ensure that the lifetime of the pointed-to object contains the lifetime of the weak pointer. todo make...
Introduction to the JavaScript shell
t specified, evalcx() returns a new object with eager standard classes. if string is "lazy" and object is not specified, evalcx() returns a new object with lazy standard classes. note: evalcx() is only useful for people doing deep internal work on the javascript engine, for testing evalinsandbox-like environments in the shell. gc() runs the garbage collector to free up memory. gcparam(name[, value]) added in spidermonkey 1.8 read or configure garbage collector parameters. the name must be one of the parameter keys (such as 'maxbytes', 'maxmallocbytes' or 'gcnumber') defined by for_each_gc_param in https://searchfox.org/mozilla-central/source/js/src/builtin/testingfunctions.cpp#464. if value is not specified, gcparam() returns the current value associated with gc parameter named name. i...
... added in spidermonkey 1.8 read or configure garbage collector parameters. the name must be one of the parameter keys (such as 'maxbytes', 'maxmallocbytes' or 'gcnumber') defined by for_each_gc_param in https://searchfox.org/mozilla-central/source/js/src/builtin/testingfunctions.cpp#464. if value is not specified, gcparam() returns the current value associated with gc parameter named name. if value is specified, it must be convertable to a positive uint32; gcparam() sets gc parameter name to value. for more information, see the c/c++ functions js_getgcparameter and js_setgcparameter. gczeal(level) added in spidermonkey 1.8 debug only. set the level of gc zeal, a debugging feature. this can be 0 for normal periodic garbage collection, 1 for very frequent gc, or 2 for extremely frequent g...
...ified commands, or about all available functions if none are specified. intern(string) internalizes the specified string into the atom table. every string has a unique identifier, called an atom. this system makes it easier to do comparisons between strings. note: this function is intended only for use when testing the javascript engine. line2pc([function, ] line) returns the program counter value corresponding to the specified line of code. if function is specified, line is an offset into the specified function. load(filename1 [filename]) loads the javascript files with the specified names. note: for loading non-javascript files, use read(). options([option ...]) lets you set or get options. if you specified options on the command line, the results of calling options will indicate wh...
JS::AutoVectorRooter
the last element. t *end() returns a pointer to the element next to the last element. range all() returns the range of the array. const t &back() const returns the last element. description js::autovectorrooter<t> holds a variable-size rooted array of type t. ...
...d() returns a pointer to the element next to the last element. range all() returns the range of the array. const t &back() const returns the last element. description js::autovectorrooter<t> holds a variable-size rooted array of type t. ...
...utovectorrooter<value> js::autoidvector autovectorrooter<jsid> js::autoobjectvector added in spidermonkey 24 autovectorrooter<jsobject *> js::autofunctionvector added in spidermonkey 31 autovectorrooter<jsfunction *> js::autoscriptvector autovectorrooter<jsscript *> see also mxr id search for js::autovectorrooter mxr id search for js::autovaluevector mxr id search for js::autoidvector mxr id search for js::autoobjectvector mxr id search for js::autofunctionvector mxr id search for js::autoscriptvector js::autovaluearray&lt;n&gt; - fixed-size array of js::value bug 677079 bug 868580 - expose js::autoobjectvector bug 848592 - added js::autofunctionvector bug 676281 - added js::autoscriptvector ...
JS::Construct
this article covers features introduced in spidermonkey 38 call a specified js constructor. syntax bool js::construct(jscontext *cx, js::handlevalue fun, const js::handlevaluearray& args, js::mutablehandlevalue rval); 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. fun js::handlevalue pointer to the function to call. should be a native function or jsapi-compiled function.. args js::handlevaluearray &amp; arguments you are passing to the function. rval js::mutablehandlevalue out parameter. on success, *rval receives the newly cr...
... args js::handlevaluearray &amp; arguments you are passing to the function. rval js::mutablehandlevalue out parameter. on success, *rval receives the newly created object from the constructor call. description js::construct calls a specified function as a constructor, fun. for more detail, see js::call, js_callfunction, js_callfunctionname, and js_callfunctionvalue. ...
...lehandlevalue out parameter. on success, *rval receives the newly created object from the constructor call. description js::construct calls a specified function as a constructor, fun. for more detail, see js::call, js_callfunction, js_callfunctionname, and js_callfunctionvalue. ...
JS::CreateError
this article covers features introduced in spidermonkey 38 create an error object. syntax // added in spidermonkey 45 bool js::createerror(jscontext *cx, jsexntype type, handleobject stack, handlestring filename, uint32_t linenumber, uint32_t columnnumber, jserrorreport *report, handlestring message, mutablehandlevalue rval); // obsolete since jsapi 39 bool js::createerror(jscontext *cx, jsexntype type, handlestring stack, handlestring filename, uint32_t linenumber, uint32_t columnnumber, jserrorreport *report, handlestring message, mutablehandlevalue rval); name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_...
...report, handlestring message, mutablehandlevalue rval); name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. type jsexntype the exception's type. stack js::handlestring or js::handleobject the value of error.prototype.stack. filename js::handlestring the value of error.prototype.filename. linenumber uint32_t the value of error.prototype.linenumber. columnnumber uint32_t the value of error.prototype.columnnumber. report jserrorreport * a pointer to jserrorreport instance. ...
...bject the value of error.prototype.stack. filename js::handlestring the value of error.prototype.filename. linenumber uint32_t the value of error.prototype.linenumber. columnnumber uint32_t the value of error.prototype.columnnumber. report jserrorreport * a pointer to jserrorreport instance. message js::handlestring the value of error.prototype.message. rval js::mutablehandlevalue out parameter. receives the created error object. description js::createerror creates an error object with specified properties. if successful, js::createerror stores the created error object to *rval and returns true, otherwise returns false and the value of *rval is undefined. see also mxr id search for js::crea...
JS::OrdinaryToPrimitive
this article covers features introduced in spidermonkey 38 convert an ordinary object to a primitive value. syntax bool js::ordinarytoprimitive(jscontext *cx, js::handleobject obj, jstype type, js::mutablehandlevalue vp); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to convert. type jstype the type of converted value. vp js::mutablehandlevalue out parameter. on success, *vp receives the converted value. ...
... most users should not call this -- use js::tonumber, js::toboolean, or js::tostring instead. ...
..., by the algorithm specified in es6 draft rev 28 (2014 oct 14) 7.1.1, second algorithm. most users should not call this -- use js::tonumber, js::toboolean, or js::tostring instead. this should only be called from custom convert hooks. it implements the default conversion behavior shared by most objects in js, so it's useful as a fallback. on success, js::ordinarytoprimitive stores the converted value in *vp and returns true. on error or exception, it returns false, and the value left in *vp is undefined. see also mxr id search for js::ordinarytoprimitive js::tonumber js::toboolean js::tostring bug 1103152 ...
JSClass.flags
if this flag is set, each instance of the class has a field for private data. the field can be accessed using js_getprivate and js_setprivate. mxr id search for jsclass_has_private jsclass_private_is_nsisupports mozilla extension. ...
... strict equality (=== and !==) comparisons are also unaffected by this flag. mxr id search for jsclass_emulates_undefined jsclass_has_reserved_slots(n) indicates that instances of this class have n reserved slots. n is an integer in the range [0..255]. the...
...bject that emulates undefined) are unaffected by this flag. strict equality (=== and !==) comparisons are also unaffected by this flag. mxr id search for jsclass_emulates_undefined jsclass_has_reserved_slots(n) indicates that instances of this class have n reserved slots. n is an integer in the range [0..255]. the slots initially contain unspecified valid jsval values. they can be accessed using js_getreservedslot and js_setreservedslot. (the jsclass.reserveslots hook also allocates reserved slots to objects.) mxr id search for jsclass_has_reserved_slots jsclass_global_flags this flag is only relevant for the class of an object that is used as a global object. (ecmascript specifies a single global object, but in spiderm...
JSConstDoubleSpec
this article covers features introduced in spidermonkey 17 describes a double and integer value and assigns it a name. syntax template<typename t> struct jsconstscalarspec { const char *name; t val; /* uint8_t flags; // obsolete from jsapi 35 uint8_t spare[3]; // obsolete from jsapi 35 */ }; typedef jsconstscalarspec<double> jsconstdoublespec; typedef jsconstscalarspec<int32_t> jsconstintegerspec; // added in spidermonkey 38 name type description val double or int32_t value for the double or integer. name const char * name to assign the double. flags uint8_t property attributes for the double. ...
... jsprop_readonly: property is read-only. jsprop_permanent: property cannot be deleted. jsprop_exported: property can be exported outside its object. ...
...jsprop_exported: property can be exported outside its object. jsprop_index: property is actually an array element. if this field is 0, js_defineconstdoubles uses the default attributes jsprop_readonly | jsprop_permanent instead. spare uint8_t [3] reserved for future use. obsolete since jsapi 35 description jsconstdoublespecs is used to define a set of double values that are assigned as properties to an object using js_defineconstdoubles. jsconstintegerspecs is used to define a set of double values that are assigned as properties to an object using js_defineconstintegers. see also mxr id search for jsconstdoublespec mxr id search for jsconstintegerspec js_defineconstdoubles. js_defineconstintegers bug 1066020 - changed to template, and removed flags and...
JSConvertOp
jsconvertop is the type of jsclass.convert. syntax typedef bool (* jsconvertop)(jscontext *cx, js::handleobject obj, jstype type, js::mutablehandlevalue vp); name type description cx jscontext * the context in which the convert is taking place. obj js::handleobject the object to be converted. hint jstype the hint to pass to the [[defaultvalue]] hook when converting the object. hint will be jstype_string or jstype_number to pass the corresponding type as a hint, or jstype_void to pass no hint. other types may be passed as hints, but such behavior is deprecated. vp js::mutablehandlevalue out parameter. on success, *vp receives the converted value. description jsconvertop callback specifies co...
...r jstype_number to pass the corresponding type as a hint, or jstype_void to pass no hint. other types may be passed as hints, but such behavior is deprecated. vp js::mutablehandlevalue out parameter. on success, *vp receives the converted value. description jsconvertop callback specifies conversion behavior for objects having this class, implementing the ecmascript [[defaultvalue]] behavior for them. on success it must return a primitive value in *vp. implementations of this hook have historically been required to accept any type. however, the engine itself only requires support for jstype_string, jstype_number, and jstype_void, if js_convertvalue is not used. if you do not use the js_convertvalue method, you may omit support for other types. (support for the other types...
...string, jstype_number, and jstype_void, if js_convertvalue is not used. if you do not use the js_convertvalue method, you may omit support for other types. (support for the other types may eventually be removed.) the callback returns true to indicate success or false to indicate failure. jsclass hooks jsclass offers the following hook: the jsclass.convert callback implements the [[defaultvalue]] behavior for objects having that class. see also mxr id search for jsconvertop jsclass ...
JSFastNative
e calls this callback only from within an active request on cx. the callback does not need to call js_beginrequest()). argc unsigned int the number of arguments supplied to the function by the caller (as opposed to, say, the number of arguments the function is specified to take in its jsfunctionspec). vp jsval * the arguments, including the this argument, the return-value slot, and the callee function object are accessible through this pointer using macros described below. description the callback should use the following macros to access the fields of vp: macro name description js_callee(cx, vp) returns the function object that was called, as a jsval. native methods must not call js_callee after calling js_set_rval. (the ret...
...t, and the callee function object are accessible through this pointer using macros described below. description the callback should use the following macros to access the fields of vp: macro name description js_callee(cx, vp) returns the function object that was called, as a jsval. native methods must not call js_callee after calling js_set_rval. (the return value and the callee are stored in the same stack slot.) js_this(cx, vp) returns the this argument as a jsval, or jsval_null on error. native methods must not call js_this after calling js_set_rval. (js_this may call js_callee.) js_this_object(cx, vp) returns the this argument as a jsobject *, or null on error. native methods must not call js_this_object after ca...
...returns the this argument as a jsobject *, or null on error. native methods must not call js_this_object after calling js_set_rval. (js_this_object may call js_callee.) js_argv(cx, vp) returns the argv pointer. this points to element 0 of an array of argc jsvals, the arguments supplied by the caller. js_rval(cx, vp) returns the jsval that is currently in the return-value slot. js_set_rval(cx, vp, value) sets the return value of the native function. it is safe to call this multiple times within a single call to a jsfastnative. if the jsfastnative returns js_true, the last value passed to this macro will be returned to the caller. on success, the callback must call js_set_rval (at least once) and return js_true. on error or exception, it must ret...
JSFunction
to get the jsobject * given the jsfunction *, use js_getfunctionobject. ...
...to get the jsobject * given the jsfunction *, use js_getfunctionobject. for other function objects - that is, functions created by running javascript code containing function declarations or function-expressions-the relationship between the jsfunction * and the jsobject * is not well-defined. ...
...s a result, some apis (such as js_callfunction) that operate on jsfunctions do not work properly with closures. the documentation for each affected api contains a warning about the problem. if the application can't be sure that a given function jsobject is either native or jsapi-compiled, it must not use the affected apis. instead of using js_callfunction, for example, it must call js_callfunctionvalue. function objects created by calling js_newfunction have two reserved slots for the application's use. see js_newfunction for details. see also mxr id search for jsfunction ...
JSHasInstanceOp
bp bool * out parameter. on success, the callback stores the result of the type check in *bp. description jshasinstanceop is called to check whether v is an instance of obj. ...
... bp bool * out parameter. on success, the callback stores the result of the type check in *bp. description jshasinstanceop is called to check whether v is an instance of obj. ...
... bp bool * out parameter. on success, the callback stores the result of the type check in *bp. description jshasinstanceop is called to check whether v is an instance of obj. ...
JSNative
jsnative is the type of many jsapi callbacks. in particular, apis such as js_initclass and js_definefunctions create custom methods on javascript objects that are implemented as jsnative callbacks provided by the application, written in c/c++ code. the term "native" here refers to c/c++ code as opposed to javascript code. syntax typedef bool (* jsnative)(jscontext *cx, unsigned argc, js::value *vp); name type description cx jscontext * the context in which the native function is being called. provides request. in js_threadsafe builds, the javascript engine calls this callback only from within an active request on cx. the callback does not need to call js_beginrequest()). argc unsigned the number of arguments supplied to the function by the c...
...d. provides request. in js_threadsafe builds, the javascript engine calls this callback only from within an active request on cx. the callback does not need to call js_beginrequest()). argc unsigned the number of arguments supplied to the function by the caller (as opposed to, say, the number of arguments the function is specified to take in its jsfunctionspec). vp js::value * the arguments, the this argument, the return-value slot, and the callee function object are accessible through this pointer using macros described below. description jsnative is the type of native implementations of javascript functions. full documentation of how to define a jsnative (or a jsfastnative, the equivalent typedef which preceded it) is available in the api header "js/cal...
...ned there; the macros providing equivalent functionality are deprecated. the behavior of a jsnative is implemented using a js::callargs structure added in spidermonkey 17. (this structure is now provided in "js/callargs.h" added in spidermonkey 24 as well as through "jsapi.h".) this structure encapsulates access to the callee function, this, the function call's arguments, and the eventual return value. on success, the callback must set js::callargs::rval() or call js_set_rval (at least once) and return true. otherwise it should either report an error (using e.g. js_reporterror or js_reportoutofmemory) or raise an exception (using js_setpendingexception), and the callback must return false. (returning false without reporting an error or raising an exception terminates the script with an uncatc...
JSObjectOps.defineProperty
api. details of the api may change from one release to the next. this documentation should be considered spidermonkey internals documentation, not api documentation. see bug 408416 for details. the jsobjectops.defineproperty callback is called whenever an object property is defined. it implements js_defineproperty. ...
...x, jsobject *obj, jsid id, jsval value, jspropertyop getter, jspropertyop setter, unsigned int attrs); name type description cx jscontext * pointer to the js context in which the property is being defined. obj jsobject * the object on which the property is being defined. id jsid the name or index of the property to define. value jsval the initial value for the new property. getter jspropertyop the getter for the new property. setter jspropertyop the setter for the new property. attrs unsigned int the property attributes for the new property. ...
...he property to define. value jsval the initial value for the new property. getter jspropertyop the getter for the new property. setter jspropertyop the setter for the new property. attrs unsigned int the property attributes for the new property. description define obj[id], an own property of obj named id, having the given initial value, with the specified getter, setter, and attributes. ...
JSPropertyDescriptor
a descriptor is used to declare whether an attribute can be written to whether it can delete an object that can enumerate and specify content. properties a descriptor is an object that can have the following key values field name description getter the get syntax binds an object property to a function that will be called when that property is looked up. setter the set syntax binds an object property to a function to be called when there is an attempt to set that property. ...
... specify content. properties a descriptor is an object that can have the following key values field name description getter the get syntax binds an object property to a function that will be called when that property is looked up. setter the set syntax binds an object property to a function to be called when there is an attempt to set that property. value describes the value of the specified property, which can be any valid javascript value (function, object, string...) configurable declare that the property can be modified and deleted enumerable declare that the property can be enumerated, and the enumerable genus can be traversed by the for...in loop. writable declare whether the specified attribute can be ...
...riptor() function to get the corresponding property of an object. descriptor. examples the following example demonstrates how to use the object.defineproperty() function to create a property under an object in a javascript via a descriptor. var language = {}; // define an empty object language object.defineproperty(language, 'log', { // define the log attribute under the language object value : ['cn','en'], writable : true, enumerable : true, configurable : true }) in the above example we defined a writable, deletable enumerable property.this is the same as the javascript directly defined property. in other words, the above code is equivalent to the following code. var language = {}; // define an empty object language languange.log = ['cn','en']; // define the log attr...
JSVAL_TO_BOOLEAN
obsolete since jsapi 32this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. cast a boolean javascript value to a c integer, either 0 or 1, without any type checking or error handling. syntax jsbool jsval_to_boolean(jsval v); description jsval_to_boolean casts the value v to a c integer, either 0 or 1. as a precondition, jsval_is_boolean(v) must be true. that is, v must be either jsval_true or jsval_false. otherwise the behavior is undefined. ...
...that function has well-defined behavior even when the argument is an object, number, or something else. to convert a jsbool to jsval, use boolean_to_jsval. ...
...that function has well-defined behavior even when the argument is an object, number, or something else. to convert a jsbool to jsval, use boolean_to_jsval. ...
JS_AddArgumentFormatter
jsbool fromjs, jsval **vpp, va_list *app); name type description cx jscontext * the context in which the conversion is being performed. format const char * the tail of the format string whose prefix is associated with this formatting function. fromjs jsbool js_true if the conversion function should convert from jsval values to c values; js_false if the conversion function should convert from c values to jsval values. vpp jsval ** in-out parameter. a pointer into an array of jsval values. app va_list * in-out parameter. a pointer to an argument pointer, used to retrieve pointers to c values. callback description the conversion function should return true on success, and return fal...
...etecting an already-reported error. for a given format string, for example "aa", the formatter is called from js_convertargumentsva like so: formatter(cx, "aa...", js_true, &sp, &ap); sp points into the arguments array on the js stack, while ap points into the stdarg.h va_list on the c stack. ...
...or. for a given format string, for example "aa", the formatter is called from js_convertargumentsva like so: formatter(cx, "aa...", js_true, &sp, &ap); sp points into the arguments array on the js stack, while ap points into the stdarg.h va_list on the c stack. the js_true passed for fromjs tells the formatter to convert zero or more jsvals at sp to zero or more c values accessed via pointers-to-values at ap, updating both sp (via *vpp) and ap (via *app) to point past the converted arguments and their result pointers on the c stack. when called from js_pushargumentsva, the formatter is invoked thus: formatter(cx, "aa...", js_false, &sp, &ap); where js_false for fromjs means to wrap the c values at ap according to the format specifier and store them at sp, updating ap and sp appropriately. the...
JS_CompileFunction
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. ...
... obj with the given name and the new function object as its value.) on success, js_compilefunction and js_compileucfunction return a pointer to the newly compiled function. on error or exception, they return null. ...
...mpiled function. on error or exception, they return null. ...
JS_DefineOwnProperty
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 please provide a description for this function. syntax bool js_defineownproperty(jscontext *cx, js::handleobject obj, js::handleid id, js::handlevalue descriptor, bool *bp); 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 object on which the property should be defined own. id js::handleid the jsid of the property that should be defined. descriptor js::handl...
...descriptor, bool *bp); 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 object on which the property should be defined own. id js::handleid the jsid of the property that should be defined. descriptor js::handlevalue this should be an jsval consisting of an object interpretable as property descriptor. bp bool * true if successful. description js_defineownproperty implements the ecmascript defined function object.defineproperty. so the same restrictions apply as for that function (e.g. it is not possible to change a non-configurable property). descriptor is supposed to be a property des...
...erty descriptor. bp bool * true if successful. description js_defineownproperty implements the ecmascript defined function object.defineproperty. so the same restrictions apply as for that function (e.g. it is not possible to change a non-configurable property). descriptor is supposed to be a property descriptor, this means you need to create an object with properties such as value, writable, get or set. see object.defineproperty for a list of possible fields. a getter or setter defined with this functions will be observable from js code. see also js_setproperty js_getpropertydescriptorbyid object.defineproperty bug 1017323 ...
JS_DumpHeap
tracekind kind, void *thingtofind, size_t maxdepth, void *thingtoignore); name type description cx jscontext * pointer to a js context. every jscontext is permanently associated with a jsruntime; each jsruntime contains a gc heap. fp file * file for the dump output. startthing void * null or a pointer to a gc thing (use js::value::togcthing() to obtain a pointer to pass here). when null, dump all things reachable from the runtime roots. when non-null, dump only things reachable from the object indicated. startkind jsgctracekind trace kind of startthing, if startthing is not null. must be jstrace_object when startthing is null. thingtofind void * null or a pointer to a gc thing. if this is non...
...ading to the specified thing. maxdepth size_t the upper bound on the number of edges to descend from the graph roots. thingtoignore void * null or a pointer to a gc thing that will be ignored during graph traversal. enum jsgctracekind { // these trace kinds have a publicly exposed, although opaque, c++ type. // note: the order here is determined by our value packing. other users // should sort alphabetically, for consistency. jstrace_object = 0x00, jstrace_string = 0x01, jstrace_symbol = 0x02, jstrace_script = 0x03, // shape details are exposed through js_traceshapecyclecollectorchildren. jstrace_shape = 0x04, // the kind associated with a nullptr. jstrace_null = 0x06, // a kind that indicates the real...
... detail. when tracing a thing, the gc needs to know about the layout of the object it is looking at. there are a fixed number of different layouts that the gc knows about. the "trace kind" is a static map which tells which layout a gc thing has. although this map is public, the details are completely hidden. not all of the matching c++ types are exposed, and those that are, are opaque. see js::value::gckind() and jstracecallback in <codde>tracer.h</codde> for more details. see also bug 378261 bug 1122842 ...
JS_EncodeCharacters
s, its use is discouraged since it could be removed at any time. try to avoid using it. convert a 16-bit string to an 8-bit string. syntax jsbool js_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, *d...
... parameter. on entry, if dst is non-null, *dstlenp must be the length of the destination string in 16-bit units. on success, *dstlenp receives the length of the converted string, in bytes. on failure, *dstlenp receives the number of bytes written to dst before the error occurred. description js_encodecharacters copies the characters of a jschar array into a char array, converting the 16-bit values to 8-bit values. if spidermonkey was built with js_c_strings_are_utf8 defined or js_setcstringsareutf8 was called, the string is converted to utf-8. otherwise each character is simply truncated to 8 bits. if utf-8 is 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 alloca...
... ... /* 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-terminated string, allocate an extra byte for the null character and set it manually. to convert bytes to jschars, the opposite conversion, use js_decodebytes. to convert a jsstring to a c char string, use js_encodestring or js_getst...
JS_EvaluateScript
igned int the length of src, in characters. filename const char * name of file or url containing the script. used to report filename or url in error messages. lineno unsigned int line number. used to report the offending line in the file or url if an error occurs. rval jsval * out parameter. on success, if rval is not null, *rval receives the result value. description js_evaluatescript compiles and executes a script in the specified scope, obj. js_evaluateucscript is the unicode version of the function. src is the string containing the text of the script. 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 er...
...he size of the text version of the script in characters. filename is the name of the file (or url) containing the script. this information is used in messages if an error occurs during compilation. similarly, lineno is used to report the line number of the script or file where an error occurred during compilation. rval is an optional out parameter. if it is non-null, then on success, the result value is stored in *rval. this value is determined the same way as for the standard eval function. in the common case where the script is just an expression, the result value is simply the value of that expression. more generally, the result value is the value of the last-executed expression statement in the script that isn't in a function. if a script compiles and executes successfully, js_evaluatesc...
...t is just an expression, the result value is simply the value of that expression. more generally, the result value is the value of the last-executed expression statement in the script that isn't in a function. if a script compiles and executes successfully, js_evaluatescript or js_evaluateucscript stores the result in *rval, if non-null, and returns js_true. otherwise it returns js_false and the value left in *rval is undefined. see also mxr id search for js_evaluatescript mxr id search for js_evaluateucscript js_compilefile js_compilescript js_decompilescript js_destroyscript js_evaluatescriptforprincipals bug 1100579 ...
JS_ExecuteScriptPart
readsafe 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. script jsscript * the compiled script to execute. part jsexecpart the part of script to execute. rval jsval * out parameter. ...
...to execute both parts of a script, use js_executescript instead. ...
...criptpart executes part of a previously compiled script, script. the part parameter must be either jsexec_prolog to execute the script prolog or jsexec_main to execute the main section of the script. if the script executes successfully, js_executescriptpart stores the value of the last-executed expression statement in the script in *rval and returns js_true. otherwise it returns js_false, and the value left in *rval is undefined. to execute both parts of a script, use js_executescript instead. see also mxr id search for js_executescriptpart js_executescript bug 555104 ...
JS_ForgetLocalRoot
obsolete since javascript 1.8.5this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. remove a value from the innermost current local root scope. syntax void js_forgetlocalroot(jscontext *cx, void *thing); name type description cx jscontext * pointer to the context in which the caller is running. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. thing void * pointer to the value to be unrooted. this must point to a jsobject, jsstring, jsfunction, or jsdouble. it must not be null. description this function is used to interact with scoped local root management. see js_enterlocalrootscope for more ...
...nter to the value to be unrooted. this must point to a jsobject, jsstring, jsfunction, or jsdouble. it must not be null. description this function is used to interact with scoped local root management. see js_enterlocalrootscope for more on this topic. in case a native hook allocates many objects or other gc-things, but the native protects some of those gc-things by storing them as property values in an object that is itself protected, the hook can call js_forgetlocalroot to free the local root automatically pushed for the now-protected gc-thing. ...
...anagement. see js_enterlocalrootscope for more on this topic. in case a native hook allocates many objects or other gc-things, but the native protects some of those gc-things by storing them as property values in an object that is itself protected, the hook can call js_forgetlocalroot to free the local root automatically pushed for the now-protected gc-thing. (here the term gc-thing refers to any value that is subject to garbage collection: a jsobject, jsstring, jsfunction, or jsdouble.) js_forgetlocalroot works on any gc-thing allocated in the current local root scope, but it's more time-efficient when called on references to more recently created gc-things. calling it successively on other than the most recently allocated gc-thing will tend to average the time inefficiency, and may risk o(n2)...
JS_GetLocaleCallbacks
pointer to a jslocalecallbacks struct. ...
... jslocaletolow...
..._intl_api jslocaletounicode localetounicode; }; typedef bool (* jslocaletouppercase)(jscontext *cx, js::handlestring src, js::mutablehandlevalue rval); typedef bool (* jslocaletolowercase)(jscontext *cx, js::handlestring src, js::mutablehandlevalue rval); typedef bool (* jslocalecompare)(jscontext *cx, js::handlestring src1, js::handlestring src2, js::mutablehandlevalue rval); typedef bool (* jslocaletounicode)(jscontext *cx, const char *src, js::mutablehandlevalue rval); type description jslocaletouppercase implementation of string.prototype.tolocaleuppercase() function. jslocaletolowercase implementation of string.prototype.tolocalelowercase() function. jslocalecompare implementation of string.prototype.localec...
JS_GetStringLength
. this is the same as the length property of the string. ...
...he length property of the string. this is the same as the length of the array returned by js_getstringchars, in char16_ts (not bytes). ...
...eturned by js_getstringchars, in char16_ts (not bytes). ...
JS_GetTypeName
teral description of a specified js data type, type. ...
... type, type. ...
...e following table lists jstypes and the string literals reported by js_gettypename: type literal jstype_void "undefined" jstype_object "object" jstype_function "function" jstype_string "string" jstype_number "number" jstype_boolean "boolean" any other value null see also js_convertvalue js_typeofvalue js_valuetoboolean js_valuetofunction js_valuetoint32 js_valuetonumber js_valuetoobject js_valuetostring bug 1037718 ...
JS_LeaveLocalRootScopeWithResult
obsolete since javascript 1.8.5this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. leave a local root scope, transferring the result value to the next enclosing root scope. syntax void js_leavelocalrootscopewithresult(jscontext *cx, jsval rval); name type description cx jscontext * pointer to the context. this must be the same context that was passed to js_enterlocalrootscope. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. rval jsval the result value that should remain protected from garbage collection. description see js_enterlocalrootscope for an explanation of local root scopes. the pro...
..._threadsafe build, the caller must be in a request on this jscontext. rval jsval the result value that should remain protected from garbage collection. description see js_enterlocalrootscope for an explanation of local root scopes. the protection this function affords to rval is tenuous. if there is an enclosing local root scope, then rval is transferred to it. otherwise, the value is stored in an internal per-jscontext slot. ...
...val jsval the result value that should remain protected from garbage collection. description see js_enterlocalrootscope for an explanation of local root scopes. the protection this function affords to rval is tenuous. if there is an enclosing local root scope, then rval is transferred to it. otherwise, the value is stored in an internal per-jscontext slot. this slot is rooted, but the value will eventually be overwritten by some other operation, and it is very difficult to figure out exactly when this will happen—or more to the point, guarantee that it won't happen in the time it takes some specific chunk of code to run. in any case, all other newborn values protected by the local root scope, aside from rval, become subject to garbage collection. see also bug 519949 bug 803907 ...
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&amp; 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 * p...
...h 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&amp; 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 * 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...
... 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. (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. thi...
JS_NewDouble
obsolete since jsapi 17this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. use js_newnumbervalue instead. allocates a copy of jsdouble on the gc heap. syntax jsdouble * js_newdouble(jscontext *cx, jsdouble d); name type description cx jscontext * the context in which to create the new number. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. d jsdouble the number to copy. description js_newdouble allocates a copy of the number d on the javascript garbage collection heap. this function is not very useful. to convert a jsdouble to a jsval, use js_newnumbervalue instead. warning: the argu...
...w number. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. d jsdouble the number to copy. description js_newdouble allocates a copy of the number d on the javascript garbage collection heap. this function is not very useful. to convert a jsdouble to a jsval, use js_newnumbervalue instead. warning: the argument d must not be a value that could fit in an integer jsval. if it is, js_newdouble creates a bad jsdouble that might behave as desired in some cases but not others. the new jsdouble is subject to garbage collection until you protect it using a local root, an object property, or the js_addroot function. on success, js_newdouble returns a pointer to the new number. otherwise it returns null. the application must treat th...
...t others. ...
JS_NewObject
r to an existing class to use for internal methods, such as finalize. the javascript engine selects a prototype object for you. on success, js_newobject returns a pointer to the new object. otherwise it returns null. added in spidermonkey 1.8 js_newobjectwithgivenproto creates a new object with the specified prototype. if null is passed as proto, the new object will have a prototype with the js value of null. to create a new object as a property of an existing object, use js_defineobject, a convenience function that combines js_newobject and js_defineproperty. obsolete ? starting with gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5), you can create a new object in a specific compartment using the components.utils.createobjectin() method. choosing a default prototype like many ...
...cript standard requires us in certain cases to use the original constructors' prototypes. if the global object's class's flags include jsclass_global_flags, then the global object always retains the original constructors for each standard class; we use these original constructors when they are available. finally, we must find a prototype. ...
...ard class; we use these original constructors when they are available. finally, we must find a prototype. if the constructor has a prototype property, we use its value. otherwise, we use object.prototype, looking up the constructor for object as described above. ...
JS_NewUCString
allocated on the heap using js_malloc. on success, the javascript engine adopts responsibility for memory management of this region. the application must not read, write, or free the buffer. this allows the javascript engine to avoid needless data copying. ...
...sing js_malloc. on success, the javascript engine adopts responsibility for memory management of this region. the application must not read, write, or free the buffer. this allows the javascript engine to avoid needless data copying. ...
... avoid needless data copying. on success, js_newstring and js_newucstring return a pointer to the new string. on error or exception, they return null. ...
JS_PreventExtensions
pair.proxy; var revoke = pair.revoke; revoke(); // bool succeeded; // bool rv = js_preventextensions(cx, proxy, &succeeded); // // rv == false, succeeded is indeterminate the second case occurs when no internal error is encountered, but the object simply refuses to be made non-extensible. for example, a proxy might refuse to be made non-extensible; this refusal would show up in the post-call value of *succeeded. var target = {}; var handler = { preventextensions: function(obj) { return false; } }; var obj = new proxy(target, handler); // bool succeeded; // bool rv = js_preventextensions(cx, obj, &succeeded); // // rv == true, succeeded == false note that as with most jsapi methods, *succeeded is only set if js_preventextensions returns true (that is, does not fail). thus you should alw...
... see also mxr id search for js_preventextensions bug 1113369 -- added result parameter ...
... see also mxr id search for js_preventextensions bug 1113369 -- added result parameter ...
JS_Remove*Root
obsolete since jsapi 31this 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. unregisters a pointer to a gc thing so that it is no longer a member of the garbage collector's root set. this enables any pointed-at gc thing to be garbage collected as needed. syntax jsbool js_removevalueroot(jscontext *cx, jsval *vp); jsbool js_removestringroot(jscontext *cx, jsstring **spp); jsbool js_removeobjectroot(jscontext *cx, jsobject **opp); jsbool js_removegcthingroot(jscontext *cx, void **rp); name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. vp jsval * ...
...bjectroot(jscontext *cx, jsobject **opp); jsbool js_removegcthingroot(jscontext *cx, void **rp); name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. vp jsval * address of the jsval variable to remove from the root set. this must have been passed to either js_addvalueroot or js_addnamedvalueroot. spp jsstring * address of the jsstring* variable to remove from the root set. this must have been passed to either js_addstringroot or js_addnamedstringroot. opp jsobject * address of the jsobject* variable to remove from the root set. this must have been passed to either js_addobjectroot or js_addnamedobjectroot. rp void **...
...iable to remove from the root set. this must have been passed to either js_addgcthingroot or js_addnamedgcthingroot. ...
JS_SetOptions
options. syntax uint32 js_setoptions(jscontext *cx, uint32 options); name type description cx jscontext * a context on which to set options. options uint32 the new set of options. this is the logical or of zero or more flags described below. description js_setoptions sets the option flags of a given js context cx. ...
...options(jscontext *cx, uint32 options); name type description cx jscontext * a context on which to set options. options uint32 the new set of options. this is the logical or of zero or more flags described below. description js_setoptions sets the option flags of a given js context cx. this function returns a uint32 value containing the previous values of the flags. ...
... mxr id search for jsoption_extra_warnings jsoption_werror convert warnings to errors. ...
JS_SetPropertyAttributes
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 integer containing the attribute value to set. it is the bitwise or of zer...
... 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 integer containing the attribute value to set. it is the bitwise or of zero or more of the following values: flag purpose jsprop_enumerate property is visible in for and in loops. jsprop_readonly property is read only. jsprop_permanent property cannot be deleted. jsprop_exported property can be imported by other objects. jsprop_index property is actually an index into an array of properties, and is cast to a const char *. ...
...prop_readonly property is read only. jsprop_permanent property cannot be deleted. jsprop_exported property can be imported by other objects. jsprop_index property is actually an index into an array of properties, and is cast to a const char *. if js_setpropertyattributes cannot locate an object with the specified property, it returns js_false, and the value left in *foundp is undefined. if the specified property or the specified object does not exist, foundp is set to js_false. then, if the property exists, but is associated with a different object, js_setpropertyattributes returns js_true. otherwise, it sets foundp to js_true, and attempts to set the attributes as specified. if the attributes can be set, js_setpropertyattributes returns js_true. i...
Web Replay
/breakpoints are active, and so can differ between recording and replay. the debugger can allocate gc things, and allocation of other gc things can differ in the debugger's presence. for example, script compilation involves gc thing allocation, and observing changes in an object will change its shape. relaxing non-determinism here has a number of ripple effects in other areas. mainly, pointer values may differ between recording and replay, and the points where gcs occur, and the set of objects collected, may differ. this non-determinism is prevented from spreading too far with the following techniques: different pointer values can affect the internal layout of hash tables. to prevent this from having an effect on iteration order (and execution behavior) in the table, the main table cla...
...ffect on execution behavior, gc finalizers which can affect the recording are instrumented so that the finalizer action is performed at the same time in the replay as it was during the recording. even if the associated js object has not been destroyed yet during the replay, it will never be used again because at this point in the recording it has been finalized. similarly, gc behavior can cause values read from weak pointers to differ between recording and replay. if this difference can affect the recording, the weak pointer must be instrumented so that during replay it holds onto its target for the same duration it was held while recording. recording a recording content process differs from a normal content process in the following ways: calls to certain functions are intercepted by h...
...complete" result. operations on the debuggee which have side effects — eval("x.f = 3") — should be avoided. when the process resumes forward or backward these side effects will be lost (the process reverts to its original state) and while paused at a breakpoint these effects can cause some strange behavior — after the above eval, getting the x.f property directly could produce a different value from eval("x.f"). while the strange behavior could be fixed (it's due to caching) it would be good to prevent or at least discourage users from performing such effectful operations. the underlying object of a debugger.object is inaccessible; object.unsafedereference is null. as described above under "debugger integration", child objects besides scripts and script sources become invalid when th...
Mozinfo
py+pasting, leaving the reader to wonder....is this specific check necessary for (e.g.) an operating system? because information is not consolidated, checks are not done consistently, nor is it defined what we are checking for. mozinfo proposes to solve this problem. mozinfo is a bridge interface, making the underlying (complex) plethora of os and architecture combinations conform to a subset of values of relevance to mozilla software. the current implementation exposes relevant key, values: os, version, bits, and processor. additionally, the service pack in use is available on the windows platform. api usage mozinfo is a python package. downloading the software and running python setup.py develop will allow you to do import mozinfo from python. mozinfo.py is the only file contained is this...
...p will allow you to do import mozinfo from python. mozinfo.py is the only file contained is this package, so if you need a single-file solution, you can just download or call this file through the web. the top level attributes (os, version, bits, processor) are available as module globals: if mozinfo.os == 'win': ... in addition, mozinfo exports a dictionary, mozinfo.info, that contain these values. mozinfo also exports: choices: a dictionary of possible values for os, bits, and processor main: the console_script entry point for mozinfo unknown: a singleton denoting a value that cannot be determined unknown has the string representation "unknown". unknown will evaluate as false in python: if not mozinfo.os: ... # unknown! command line usage mozinfo comes with a command line, moz...
...tring representation "unknown". unknown will evaluate as false in python: if not mozinfo.os: ... # unknown! command line usage mozinfo comes with a command line, mozinfo which may be used to diagnose one's current system. example output: os: linux version: ubuntu 10.10 bits: 32 processor: x86 three of these fields, os, bits, and processor, have a finite set of choices. you may display the value of these choices using mozinfo --os, mozinfo --bits, and mozinfo --processor. mozinfo --help documents command-line usage. ...
Setting up an update server
note: it can be a bit tricky to get the make_full_update.sh script to accept paths with spaces. serving the update preparing the update files first, create the directory that updates will be served from and put the mar file in it. then, create a file within called update.xml with these contents, replacing <mar n...
...h these contents, replacing <mar name>, <hash> and <size> with the mar's filename, its sha512 hash, and its file size in bytes. ...
...tes. ...
extISessionStorage
oolkit/components/exthelper/extiapplication.idl. implemented via xpcom service for extiapplication: see the instructions on the fuel (firefox), steel (thunderbird) and smile (seamonkey) pages. method overview these methods are usually accessed via application.storage. return type method boolean has(in astring aname) void set(in astring aname, in nsivariant avalue) nsivariant get(in astring aname, in nsivariant adefaultvalue) attributes attribute type description events readonly attribute extievents the events object for the storage supports: "change" methods has() determines if a storage item exists with the given name. boolean has(in astring aname) parameters aname the name of an item re...
... nsivariant get(in astring aname, in nsivariant adefaultvalue) attributes attribute type description events readonly attribute extievents the events object for the storage supports: "change" methods has() determines if a storage item exists with the given name. boolean has(in astring aname) parameters aname the name of an item return value true if an item exists with the given name, false otherwise. set() sets the value of a storage item with the given name. void set(in astring aname, in nsivariant avalue) parameters aname the name of an item return value get() gets the value of a storage item with the given name. returns a default value if the item does not exist. nsivariant get(in astring aname, in nsivariant ade...
...e if an item exists with the given name, false otherwise. set() sets the value of a storage item with the given name. void set(in astring aname, in nsivariant avalue) parameters aname the name of an item return value get() gets the value of a storage item with the given name. returns a default value if the item does not exist. nsivariant get(in astring aname, in nsivariant adefaultvalue) parameters aname the name of an item return value value of the item or the given default value if no item exists with the given name. see also fuel (firefox), steel (thunderbird) and smile (seamonkey) ...
XPCOM array guide
Mozilla › Tech › XPCOM › Guide › Arrays
amonkey 2.3) gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) introduces the removeobjectsat() method to nscomarray<t>. this lets you delete multiple objects from the array at once by specifying the index to the first item to delete as well as the number of items to delete. for example, to remove three objects, starting at the third object in the array (that is, the object with index value 2): myarray.removeobjectsat(2, 3); nstarray<t> nstarray<t> is a typesafe array for holding various objects. it can be used to hold objects directly, not just pointers to objects. usage it is most often used as a member of a c++ class to store a list of well-typed objects. it is also usually declared as an inline member rather than a pointer. for example, here is its use in a class: class ...
...oid notifyobservers(const nstarray<observerclass*>& observers) { for (pruint32 i = observers.length(); i > 0 ; ) { --i; observers[i]->observe(); } } bounds-safe access to elements you can also access elements in an nstarray<t> using the safeelementat() method. this method is bounds-safe; that is, if you attempt to access an element outside the range of the array, a specified "safe" value is returned. for example: var value = myarray.safeelementat(idx, defaultvalue); if (value == defaultvalue) { /* the index idx was out of bounds, or the value at that index was the default value */ } note: as of gecko 8.0, if the element type is a pointer type, you can use the safeelementat() method without providing a default value. it returns a null pointer if the index is out of bounds. ...
...it returns the underlying pointer type or the null pointer if the index is out of bounds. passing as a parameter when passing nstarray<t> among functions, the convention is to pass by reference. also be sure to use const if you want to enforce that the array is read-only. ...
Creating the Component Code
e nsifile parameter but the aloaderstr parameter can be used to refer to the location within the zip archive. the last parameter specifies what kind of loader to use on the component. this is reserved as an optimization, for the most part, but it can be a useful way to extend xpcom. since xpcom already knows internally what kind of file it has just loaded and called registerself on, passing this value to the registration methods is a shortcut for determining what kind of component is being registered. nsicomponentregistrar methods to tell xpcom what implementation is in the component library, call this method from registerself: ns_imethod registerfactorylocation(const nscid & aclass, const char *aclassname, const char *ac...
... sample object via the component manager as follows: nsicomponentmanager* compmanager; // assume initialized nsisupports* sample; compmanager->createinstance(ksamplecid, nsnull, kisupportsiid, (void**)&sample); in the above snippet, we assume that the component manager has been initialized. in many cases this value is passed in or easily accessible. if not, it can always be obtained by a call to ns_getcomponentmanager(). a listing of this and other global xpcom functions is in the xpcom api reference. the first parameter of the call to createinstance specifies the component the client code is looking for, which is the same value passed to registerfactorylocation. the next parameter is for aggregation, whic...
...ry object for each object that you have registered with xpcom. the main function that must be implemented in the nsifactory interface is createinstance. the implementation follows a simple algorithm: create the raw object. if that fails, return an out of memory error code. call queryinterface on the new object. if that fails, null the out param and free the new object. return the nsresult value from queryinterface. often, you don't have to create the object first because the factory implicitly knows what iids are supported. when this is not the case, however, doing it this way further abstracts the factories from their concrete classes. if you have a factory that knows every iid supported by the concrete base class, for example, then when you go to add a new supported interface you ad...
Components.utils.Sandbox
ad. samezoneas a javascript object in whose garbage collection region the sandbox should be created in. this helps to improve memory usage by allowing sandboxes to be discarded when that zone goes away. content scripts should pass the window they're running in as this parameter, in order to ensure that the script is cleaned up at the same time as the content itself. sandboxname a string value which identifies the sandbox in about:memory (and possibly other places in the future). this property is optional, but very useful for tracking memory usage of add-ons and other javascript compartments. a recommended value for this property is an absolute path to the script responsible for creating the sandbox. as of gecko 13 (firefox 13.0 / thunderbird 13.0 / seamonkey 2.10), if you don't specif...
... "wantglobalproperties": ["atob", "btoa"] } var sandbox = components.utils.sandbox("https://example.org/", options); components.utils.evalinsandbox(sandboxscript, sandbox); console.log(sandbox.encoded); // "sgvsbg8=" console.log(sandbox.decoded); // "hello" wantxhrconstructor this option was removed in gecko version 26. use wantglobalproperties instead. wantxrays a boolean value indicating whether the sandbox wants xray vision with respect to same-origin objects outside the sandbox. default: true. "xray vision" is exactly the same xray behavior that script always gets, by default, when working with dom objects across origin boundaries. this is primarily visible for chrome code accessing content. however, it also occurs during cross-origin access between two content pag...
...ject. for example: mysandbox.dosomething = function() { ... }; complex objects can be cloned into the sandbox using components.utils.cloneinto: mysandbox.someobject = components.utils.cloneinto({ a: 'string', b: 21 }, mysandbox); obviously you need to consider the security implications of the functions you import. this technique isn't limited to functions - it can be used to import objects or values. freeing the sandbox when you have finished using a sandbox, it should be freed to avoid memory leaks. generally the javascript garbage collector will take care of this when there are no remaining references to the sandbox or the code it contains. however, in some cases it can be difficult to remove all references. for example, the code in the sandbox might be a third-party library that sets e...
Components object
utils.createobjectin creates a new object in the scope of the specified object's compartment. may only be called from javascript code. utils.evalinsandbox runs javascript code in a sandbox, usually used to run code with restricted privileges. utils.forcegc forces a garbage collection cycle. ...
...ive (i.e. declared in the interface) method or property of an xpcom object. serves the same purpose as xpcnativewrapper. utils.makeobjectpropsnormal ensures that all functions come from the specified object's scope, and aren't cross-compartment wrappers. may only be called from javascript code. utils.methodjit obsolete since gecko 24.0 provides access to the value of the methodjit property in the javascript environment. utils.methodjit_always obsolete since gecko 24.0 provides access to the value of the methodjit_always property in the javascript environment. utils.relimit provides access to the value of the relimit property in the javascript environment. utils.reporterror reports a javascr...
...javascript error object to the error console. utils.scheduleprecisegc requests that garbage collection occur sometime in the future when no javascript code is running; accepts a callback function to receive notification once collection is complete. utils.setgczeal() sets the gc zeal level for the context. utils.strict provides access to the value of the strict property in the javascript environment. utils.werror provides access to the value of the werror property in the javascript environment. utils.sandbox creates sandbox objects for use with evalinsandbox. utils.xml provides access to the value of the xml property in the javascript environment. ...
Language bindings
a javascript function which can be used to create or construct new instances of xpcom components.components.exceptioncomponents.exception is a javascript constructor to create nsixpcexception objects. ...
...the scriptable methods on the nsicomponentmanager interface can be called directly on this object.components.resultscomponents.results is a read-only object whose properties are...
....managercomponents.manager is a convenience reflection of the global native component manager service. the scriptable methods on the nsicomponentmanager interface can be called directly on this object.components.resultscomponents.results is a read-only object whose properties are the names listed as the first parameters of the macros in js/xpconnect/src/xpc.msg (also at table of errors), with the value of each corresponding to that constant's value.components.returncodecomponents.stackcomponents.stack is a read only property of type nsistackframe (idl definition) that represents a snapshot of the current javascript callstack. this can be used for various diagnostic purposes.components.utilscomponents.utils is a collection of various useful xpconnect features. its interface is defined at js/xpco...
nsDependentCString
this class does not own its data, so the creator of objects of this type must take care to ensure that a nstdependentstring continues to reference valid memory for the duration of its use. ...
...en string and this string. @param astring is the string to check @param aignorecase tells us how to treat case @param acount tells us how many chars to compare @return boolean parameters char* astring print32 acount tofloat float tofloat(print32*) const - source perform string to float conversion. ...
...s whitespace throughout the string. replacechar void replacechar(char, char) - source swaps occurence of 1 string for another parameters char aoldchar char anewchar void replacechar(const char*, char) - source parameters char* aset char anewchar replacesubstring void replacesubstring(const nscstring&, const nscstring&) - source parameters nscstring& atarget nscstring& anewvalue void replacesubstring(const char*, const char*) - source parameters char* atarget char* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequo...
nsDependentString
this class does not own its data, so the creator of objects of this type must take care to ensure that a nstdependentstring continues to reference valid memory for the duration of its use. ...
...arinset(const nsstring&, print32) const - source parameters nsstring& astring print32 aoffset equalsignorecase prbool equalsignorecase(const char*, print32) const - source parameters char* astring print32 acount tofloat float tofloat(print32*) const - source perform string to float conversion. ...
...e string. replacechar void replacechar(prunichar, prunichar) - source swaps occurence of 1 string for another parameters prunichar aoldchar prunichar anewchar void replacechar(const char*, prunichar) - source parameters char* aset prunichar anewchar replacesubstring void replacesubstring(const nsstring&, const nsstring&) - source parameters nsstring& atarget nsstring& anewvalue void replacesubstring(const prunichar*, const prunichar*) - source parameters prunichar* atarget prunichar* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing...
operator=
« xpcom api reference summary this operator is a shortcut for the inherited nsacstring::assign family of functions. self_type& operator=( const self_type& astring ); parameters astring [in] a nsembedcstring to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( const abstract_string_type& astring ); parameters astring [in] a nsacstring to append to this string. ...
...gn family of functions. self_type& operator=( const self_type& astring ); parameters astring [in] a nsembedcstring to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( const abstract_string_type& astring ); parameters astring [in] a nsacstring to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( const char_type* adata ); parameters adata [in] a raw character array to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( char_type achar ); parameters achar ...
...ct being modified to allow operator chaining. self_type& operator=( const char_type* adata ); parameters adata [in] a raw character array to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( char_type achar ); parameters achar [in] a character to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. see also nsacstring::assign ...
operator=
« xpcom api reference summary this operator is a shortcut for the inherited nsastring::assign family of functions. self_type& operator=( const self_type& astring ); parameters astring [in] a nsembedstring to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( const abstract_string_type& astring ); parameters astring [in] a nsastring to append to this string. ...
...sign family of functions. self_type& operator=( const self_type& astring ); parameters astring [in] a nsembedstring to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( const abstract_string_type& astring ); parameters astring [in] a nsastring to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( const char_type* adata ); parameters adata [in] a raw character array to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( char_type achar ); parameters achar ...
...ct being modified to allow operator chaining. self_type& operator=( const char_type* adata ); parameters adata [in] a raw character array to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( char_type achar ); parameters achar [in] a character to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. see also nsastring::assign ...
IAccessibleApplication
uch as its name or version. method overview [propget] hresult appname([out] bstr name ); [propget] hresult appversion([out] bstr version ); [propget] hresult toolkitname([out] bstr name ); [propget] hresult toolkitversion([out] bstr version ); methods appname() returns the application name. [propget] hresult appname( [out] bstr name ); parameters name the application name. return value s_false if there is nothing to return, [out] value is null. s_ok. appversion() returns the application version. [propget] hresult appversion( [out] bstr version ); parameters version the application version. return value s_false if there is nothing to return, [out] value is null. s_ok. toolkitname() returns the toolkit/bridge name. [propget] hresult toolkitname( [out] bstr name ); paramet...
...s_ok. ...
...plication version. [propget] hresult appversion( [out] bstr version ); parameters version the application version. return value s_false if there is nothing to return, [out] value is null. s_ok. toolkitname() returns the toolkit/bridge name. [propget] hresult toolkitname( [out] bstr name ); parameters name the toolkit/bridge name. return value s_false if there is nothing to return, [out] value is null. s_ok. toolkitversion() returns the toolkit/bridge version. [propget] hresult toolkitversion( [out] bstr version ); parameters version the toolkit/bridge version. return value s_false if there is nothing to return, [out] value is null. s_ok. ...
IAccessibleHypertext
[propget] hresult hyperlink( [in] long index, [out] iaccessiblehyperlink hyperlink ); parameters index this 0 based index specifies the hyperlink to return. hyperlink if the given index is valid, that is it lies in the interval from 0 to the number of links minus one, a reference to the specified hyperlink object is returned. if the index is invalid then a null pointer is returned. return value e_invalidarg if bad [in] passed, [out] value is null. s_ok. hyperlinkindex() returns the index of the hyperlink that is associated with this character index. this is the case when a link spans the given character index. [propget] hresult hyperlinkindex( [in] long charindex, [out] long hyperlinkindex ); parameters charindex a 0 based index of the character for which to return the link index.
...ndex of the character for which to return the link index. if iaccessibletext is used to represent the text containing the link, then the character index is only valid if it is greater than or equal to zero and lower than the number of characters in the text. hyperlinkindex the 0 based index of the hyperlink that is associated with this character index, or -1 if charindex is not on a link. return value e_invalidarg if bad [in] passed, [out] value is null. s_false if there is nothing to return, [out] value is -1. s_ok. nhyperlinks() returns the number of links and link groups contained within this hypertext paragraph. [propget] hresult nhyperlinks( [out] long hyperlinkcount ); parameters hyperlinkcount the number of links and link groups within this hypertext paragraph. returns 0 if there is...
...ad [in] passed, [out] value is null. s_false if there is nothing to return, [out] value is -1. s_ok. nhyperlinks() returns the number of links and link groups contained within this hypertext paragraph. [propget] hresult nhyperlinks( [out] long hyperlinkcount ); parameters hyperlinkcount the number of links and link groups within this hypertext paragraph. returns 0 if there is no link. return value s_ok. see also iaccessiblehyperlink ...
IAccessibleRelation
get([in] long targetindex, [out] iunknown target ); [propget] hresult targets([in] long maxtargets, [out, size_is(maxtargets), length_is( ntargets)] iunknown targets, [out] long ntargets ); methods localizedrelationtype() returns a localized version of the relation type. [propget] hresult localizedrelationtype( [out] bstr localizedrelationtype ); parameters localizedrelationtype return value s_ok. ntargets() returns the number of targets() for this relation. [propget] hresult ntargets( [out] long ntargets ); parameters ntargets return value s_ok. relationtype() returns the type of the relation. [propget] hresult relationtype( [out] bstr relationtype ); parameters relationtype the strings returned are defined @ref grprelations "in this section of the documentation". return ...
... s_ok. ntargets() returns the number of targets() for this relation. [propget] hresult ntargets( [out] long ntargets ); parameters ntargets return value s_ok. relationtype() returns the type of the relation. [propget] hresult relationtype( [out] bstr relationtype ); parameters relationtype the strings returned are defined @ref grprelations "in this section of the documentation". return value s_ok. target() returns one accessible relation target. [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( ...
...y the client. targets the array of target objects. note that this array is to be allocated by the client and freed when no longer needed. refer to @ref _arrayconsideration "special consideration when using arrays" for more details. you will need to use queryinterface on the iunknown to get the iaccessible2. ntargets actual number of targets in the returned array (not more than maxtargets) return value s_false if there is nothing to return, ntargets() is set to 0. s_ok. see also iaccessible2 ...
imgILoader
imgirequest loadimage( in nsiuri auri, in nsiuri ainitialdocumenturl, in nsiuri areferreruri, in nsiprincipal aloadingprincipal, in nsiloadgroup aloadgroup, in imgidecoderobserver aobserver, in nsisupports acx, in nsloadflags aloadflags, i...
...y be null) acx some random data. aloadflags load flags for the request. cachekey arequest a newly created, unused imgirequest object or null for one to be created for you. libpr0n does not keep a strong ref to the observer; this prevents reference cycles. this means that callers of loadimage should make sure to cancel() the resulting request before the observer goes away. channelpolicy return value loadimagewithchannel() start the load and decode of an image. libpr0n does not keep a strong ref to the observer; this prevents reference cycles. this means that callers of loadimagewithchannel should make sure to cancel() the resulting request before the observer goes away. imgirequest loadimagewithchannel( in nsichannel achannel, in imgidecoderobserver aobserver, in nsisupports cx, out ...
...lready be opened before this method is called, and there must have been no ondataavailable calls for it yet. aobserver the observer (may be null) cx some random data. alistener a listener that you must send the channel's notifications and data to. can be null, in which case imagelib has found a cached image and is not interested in the data. achannel will be canceled for you in this case. return value supportimagewithmimetype() checks if a decoder for the an image with the given mime type is available. boolean supportimagewithmimetype( in string mimetype ); parameters mimetype the type to find a decoder for. return value true if a decoder is available, false otherwise. ...
imgIRequest
siprincipal the principal gotten from the channel the image was loaded from. read only. imagestatus unsigned long status flags of the status_* variety. read only. mimetype string read only. uri nsiuri the uri the image load was started with. note that this might not be the actual uri for the image (for example if http redirects happened during the load). read only. constants constant value description status_none 0x0 nothing to report. status_size_available 0x1 we received enough image data from the network or filesystem that we know the width and height of the image, and have thus called setsize() on the container. status_load_partial 0x2 used internally by imgrequest to flag that a request is being cancelled as a result of a failure of a proxy holder and not an internal f...
...celandforgetobserver( in nsresult astatus ); parameters astatus clone() clone this request; the returned request will have aobserver as the observer. aobserver will be notified synchronously (before the clone call returns) with all the notifications that have already been dispatched for this image load. ...
...void incrementanimationconsumers(); parameters none. lockimage() locks an image. if the image does not exist yet, locks it once it becomes available. the lock persists for the lifetime of the imgirequest (until unlockimage() is called) even if the underlying image changes. ...
mozIStorageStatementParams
this interface has no defined properties, but has properties based on the named parameters found in the sql from the statement it was accessed off of. ...
...ve one property, item_id, that you can use to bind a value to that named parameter like so: statement.params.item_id = 2; for more details on why you should bind parameters as opposed to hard-coding them into your statement, please see the overview document about binding parameters. enumeration of properties you can also enumerate all the properties on this object with a for..in enumeration: // valuestobind is an object that contains key-value pairs // to bind to the statement before executing it. ...
...ters as opposed to hard-coding them into your statement, please see the overview document about binding parameters. ...
mozIThirdPartyUtil
.google.com/", achannel has a uri of "http://google.com/", and its parent is the topmost content window with a uri of "http://mozilla.com", the result will be true. boolean isthirdpartychannel( in nsichannel achannel, in nsiuri auri optional ); parameters achannel the channel associated with the load. auri optional a uri to test against. if null, the uri of the channel will be used. return value true if auri is third party with respect to the channel uri or any of the uris associated with the same-type window hierarchy of the channel. isthirdpartyuri() determine whether two uris are third party with respect to each other. this is determined by computing the base domain for both uris. if they can be determined, and the base domains match, the request is defined as first party. if it cann...
...st', or a file:// uri), an exact string comparison on host is performed. for example, the uri "http://mail.google.com/" is not third party with respect to "http://images.google.com/", but "http://mail.yahoo.com/" and "http://192.168.1.1/" are. boolean isthirdpartyuri( in nsiuri afirsturi, in nsiuri aseconduri ); parameters afirsturi missing description aseconduri missing description return value true if afirsturi is third party with respect to aseconduri. isthirdpartywindow() determine whether the given window hierarchy is third party. this is done as follows: obtain the uri of the principal associated with awindow. call this the 'bottom uri'. if auri is provided, determine if it is third party with respect to the bottom uri. if so, return. find the same-type parent window, if there is...
... a uri of "http://google.com/", and its parent is the topmost content window with a uri of "http://mozilla.com", the result will be true. boolean isthirdpartywindow( in nsidomwindow awindow, in nsiuri auri optional ); parameters awindow the bottommost window in the hierarchy. auri optional a uri to test against. if null, the uri of the principal associated with awindow will be used. return value true if auri is third party with respect to any of the uris associated with awindow and its same-type parents. ...
nsIAccessibleHyperText
ng the number of links contained within this hypertext object. read only. note: renamed from links in gecko 1.9 methods getlink() retrieves the nsiaccessiblehyperlink object at the given link index. nsiaccessiblehyperlink getlink( in long linkindex ); parameters linkindex 0-based index of the link that is to be retrieved. this can be retrieved via getlinkindex(). ...
...ndex(). return value an nsiaccessiblehyperlink object. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. ns_error_invalid_arg the link index is invalid. getlinkindex() the link index at the given offset (character index). long getlinkindex( in long charindex ); parameters charindex the 0-based character index. return value the index of the link if it's presented on the given character index, otherwise -1. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. getselectedlinkindex() obsolete since gecko 1.9 (firefox 3) long getselectedlinkindex(); parameters none. ...
... charindex the 0-based character index. return value the index of the link if it's presented on the given character index, otherwise -1. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. getselectedlinkindex() obsolete since gecko 1.9 (firefox 3) long getselectedlinkindex(); parameters none. return value missing description exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. see also nsiaccessiblehyperlink ...
nsIAccessibleProvider
accessible/public/nsiaccessibleprovider.idlscriptable used to link element and accessible object. for that xbl binding, element should implement the interface. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) attributes attribute type description accessible nsiaccessible read only. obsolete since gecko 1.9 accessibletype long value representing the type of accessible object. see constants for details. read only. constants common use constants constant value description noaccessible 0 do not create an accessible for this object this is useful if an ancestor binding already implements nsiaccessibleprovider, but no accessible is desired for the inheriting binding. outerdoc 0x00000001 for elements that spawn a new document. for example now it is use...
...onstant value description noaccessible 0 do not create an accessible for this object this is useful if an ancestor binding already implements nsiaccessibleprovider, but no accessible is desired for the inheriting binding. outerdoc 0x00000001 for elements that spawn a new document. for example now it is used by <xul:iframe>, <xul:browser> and <xul:editor>. ...
... the collection of tab objects, usable in the tabbox and independent of as well. xultext 0x0000101a xultextbox 0x0000101b xulthumb 0x0000101c xultree 0x0000101d xultreecolumns 0x0000101e xultreecolumnitem 0x0000101f xultoolbar 0x00001020 xultoolbarseparator 0x00001021 xultooltip 0x00001022 xultoolbarbutton 0x00001023 xforms elements constants constant value description xformscontainer 0x00002000 used for xforms elements that provide accessible object for itself as well for anonymous content. this property is used for upload, input[type="xsd:gday"] and input[type="xsd:gmonth"] xformslabel 0x00002001 used for label element. xformsouput 0x00002002 used for output element. xformstrigger 0x00002003 used for trigger and submit elements. xformsin...
nsIAccessibleRole
role_titlebar 1 represents a title or caption bar for a window. it is used by msaa only, supported automatically by ms windows. ...
... for html:select, xul:menulist, role="combobox". role_droplist 47 represents the calendar control. it is used for date xforms:input. role_progressbar 48 represents a progress bar, dynamically showing the user the percent complete of an operation in progress. it is used for xul:progressmeter, role="progressbar". role_dial 49 represents a dial or knob whose purpose is to allow a user to set a value. role_hotkeyfield 50 represents a hot-key field that allows the user to enter a combination or sequence of keystrokes. role_slider 51 represents a slider, which allows the user to adjust a setting in given increments between minimum and maximum values. it is used by xul:scale, role="slider", xforms:range. role_spinbutton 52 represents a spin box, which is a control that allows the user to i...
...it is used for xul:spinbuttons. role_diagram 53 represents a graphical image used to diagram data. ...
nsIAppShellService
atically created and maintained by this appshellservice. read only. hiddenwindow nsixulwindow return the (singleton) application hidden window, automatically created and maintained by this appshellservice. read only. nativeappsupport nsinativeappsupport getter for "native application support." read only. obsolete since gecko 1.8 constants constant value description size_to_content -1 create a window, which will be initially invisible. econsiderquit 1 attempt to quit if all windows are closed. obsolete since gecko 1.8 eattemptquit 2 try to close all windows, then quit if successful. obsolete since gecko 1.8 eforcequit 3 force all windows to close, then quit. obsolete since gecko 1.8 ...
... creates the initial state of the application by launching tasks specfied by "general.startup.*" prefs. note: size_to_content may be used for width or height. boolean createstartupstate( in long awindowwidth, in long awindowheight ); parameters awindowwidth the width to make the initial window(s) opened. awindowheight the height to make the initial window(s) opened. return value true if a window was opened. createtoplevelwindow() this method creates a window, which will be initially invisible. nsixulwindow createtoplevelwindow( in nsixulwindow aparent, in nsiuri aurl, in boolean ashowwindow, in boolean aloaddefaultpage, in pruint32 achromemask, in long ainitialwidth, in long ainitialheight, in nsiappshell aappshell ); parameters aparent the pare...
...idden by the "width" tag in the xul. set to ns_sizetocontent to force the window to wrap to its contents. ainitialheight height, in pixels, of the window. height of window at creation. can be overridden by the "height" tag in the xul. set to ns_sizetocontent to force the window to wrap to its contents. aappshell a widget "appshell" (event processor) to associate with the new window. return value returns the newly created window. destroyhiddenwindow() destroys a hidden window. void destroyhiddenwindow(); parameters none. doprofilestartup() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) starts up the profile manager with the given arguments. void doprofilestartup( in nsicmdlineservice acmdlineservice, in boolean caninteract ...
nsIArray
gned long indexof(in unsigned long startindex, in nsisupports element); void queryelementat(in unsigned long index, in nsiidref uuid, [iid_is(uuid), retval] out nsqiresult result); attributes attribute type description length unsigned long the number of elements in the array. read only. methods enumerate() enumerate the array. nsisimpleenumerator enumerate(); parameters none. return value a new enumerator positioned at the start of the array. exceptions thrown ns_error_failure if the array is empty (to make it easy to detect errors). ns_error_out_of_memory if there is not enough memory to complete the operation. indexof() get the position of a specific element. note that since null is a valid input, exceptions are used to indicate that an element is not found. unsigned long inde...
...dexof() get the position of a specific element. note that since null is a valid input, exceptions are used to indicate that an element is not found. unsigned long indexof( in unsigned long startindex, in nsisupports element ); parameters startindex the initial element to search in the array. to start at the beginning, use 0 as the startindex. element the element you are looking for. return value a number >= startindex which is the position of the element in the array. exceptions thrown ns_error_failure if the element was not in the array. queryelementat() retrieve a specific element of the array, and queryinterface it to the specified interface. null is a valid result for this method, but exceptions are thrown in other circumstances. void queryelementat( in unsigned long index, in ...
...interface. null is a valid result for this method, but exceptions are thrown in other circumstances. void queryelementat( in unsigned long index, in nsiidref uuid, [iid_is(uuid), retval] out nsqiresult result ); parameters index position of element. uuid the iid of the requested interface. result the object, queryinterface'd to the requested interface. exceptions thrown ns_error_illegal_value when index > length-1. see also nsimutablearray ...
nsIAuthPrompt2
no security provided. level_pw_encrypted 1 password will be sent encrypted, but the connection is otherwise insecure. level_secure 2 the connection, both for password and data, is secure. methods asyncpromptauth() asynchronously prompt the user for a username and password. this...
...romptcallback acallback, in nsisupports acontext, in pruint32 level, in nsiauthinformation authinfo ); parameters achannel the channel that requires authentication. acallback acontext level one of the level constants. authinfo authentication information object. the implementation should fill in this object with the information entered by the user before returning. return value promptauth() requests a username and a password. implementations will commonly show a dialog with a username and password field, depending on flags also a domain field. note: exceptions thrown from this function will be treated like a return value of false. boolean promptauth( in nsichannel achannel, in pruint32 level, in nsiauthinformation authinfo ); parameters achannel the ch...
...d like a return value of false. boolean promptauth( in nsichannel achannel, in pruint32 level, in nsiauthinformation authinfo ); parameters achannel the channel that requires authentication. level one of the level constants. authinfo authentication information object. the implementation should fill in this object with the information entered by the user before returning. return value false, authentication should be cancelled, usually because the user did not provide username/password. true, authentication can proceed using the values in the authinfo object. see also nsiauthprompt ...
nsIBinaryOutputStream
this might be used, for example, to implement network protocols or to produce architecture-neutral binary disk files, that is ones that can be read and written by both big-endian and little-endian platforms. output is written in big-endian order (high-order byte first), as this is traditional network order. ...
... pruint16 a16 ); parameters a16 the 16-bit integer to write to the stream. write32() writes a 32-bit integer to the stream. void write32( in pruint32 a32 ); parameters a32 the 32-bit integer to write to the stream. write64() writes a 64-bit integer to the stream. void write64( in pruint64 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. void writebytearray( [array, size_is(alength)] in pruint8 abytes, in pruint32 alength ); parameters abytes the bytes to write to the stream. ...
... byte array to write to the stream. alength the number of bytes to write to the stream. writedouble() writes a double precision floating point number to the stream. void writedouble( in double adouble ); parameters adouble the double to write to the stream. writefloat() writes a floating point number to the stream. void writefloat( in float afloat ); parameters afloat the floating point value to write to the stream. writestringz() writes an 8-bit pascal style string to the stream. the output data consists of a 32-bit length field, followed by that many 8-bit characters. void writestringz( in string astring ); parameters astring the string to write to the stream. writeutf8z() writes an 8-bit pascal style string (utf8-encoded) to the stream. the output data consists of a 32-bit le...
nsIBrowserSearchService
l, in boolean confirm, [optional] in nsisearchinstallcallback callback ); parameters engineurl the url to the search engine's description file. datatype an integer representing the plugin file format. must be one of the supported search engine data types defined above. iconurl a url string to an icon file to be used as the search engine's icon. this value may be overridden by an icon specified in the engine description file. confirm a boolean value indicating whether the user should be asked for confirmation before this engine is added to the list. if this value is false, the engine will be added to the list upon successful load, but it will not be selected as the current engine. callback a nsisearchinstallcallback that...
...e. must not be null. iconurl optional: a url string pointing to the icon to be used to represent the engine. alias optional: a unique shortcut that can be used to retrieve the search engine. description optional: a description of the search engine. method the http request method used when submitting a search query. must be a case insensitive value of either "get" or "post". url the url to which search queries should be sent. must not be null. getdefaultengines() returns an array of all default search engines. this includes all loaded engines that aren't in the user's profile directory (ns_app_user_search_dir). void getdefaultengines( [optional] out unsigned long enginecount, [retval, array, size_is(enginecount)] out nsis...
... [retval, array, size_is(enginecount)] out nsisearchengine engines ); parameters enginecount the number of default search engines. engines an array of the default nsisearchengines. getenginebyalias() returns an engine with the specified alias. nsisearchengine getenginebyalias( in astring alias ); parameters alias the search engine's alias. return value an nsisearchengine getenginebyname() returns an engine with the specified name. nsisearchengine getenginebyname( in astring aenginename ); parameters aenginename the name of the engine. return value the specified nsisearchengine. getengines() returns an array of all installed search engines. void getengines( [optional] out unsigned long enginecount, [retval, array, size_is(...
nsICRLManager
void deletecrl( in unsigned long crlindex ); parameters crlindex getcrls...
...hedulecrlautoupdate(); boolean updatecrlfromurl(in wstring url, in wstring key); constants constant value description type_autoupdate_time_based 1 type_autoupdate_freq_based 2 methods computenextautoupdatetime() wstring computenextautoupdatetime( in nsicrlinfo info, in unsigned 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 dosi...
...ength 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 the last fetched url. needed for the update button in crl manager. boolean updatecrlfromurl( in wstring url, in wstring key ); parameters url key return value ...
nsIChromeRegistry
converts a chrome url into a canonical representation by ensuring that the filename portion of the url is included, as i...
...specified in "shorthand", leaving the "file" portion off. in that case, the url is expanded to chrome://package/provider/package.ext. the extension, ext, is one of: xul for a "content" package. css for a "skin" package. dtd for a "locale" package. nsiuri convertchromeurl( in nsiuri achromeurl ); parameters achromeurl the url that is to be converted. ...
... url that is to be converted. return value a new nsiuri object containing the loadable uri for the specified chrome url. violates the xpcom interface guidelines wrappersenabled() returns whether xpcnativewrappers are enabled for the specified uri. boolean wrappersenabled( in nsiuri auri ); parameters auri the uri for which to determine if xpcnativewrappers are enabled. return value true if xpcnativewrappers are enabled for the specified uri; otherwise false. see also chrome registration ...
nsIClipboard
supportsfindclipboard(); constants most clipboard operations in firefox use kglobalclipboard, which is the one also used by the typical control-c/control-v keyboard shortcuts. the kselectionclipboard is peculiar to the x windows system, where it refers to the primary selection, which is the one that simple mouse selection and middle-click paste operations are using. constant value description kselectionclipboard 0 clipboard for selection. kglobalclipboard 1 clipboard for global use. kfindclipboard 2 clipboard for find strings. methods emptyclipboard() this method empties the clipboard and notifies the clipboard owner. it empties the "logical" clipboard. it does not clear the native clipboard. void emptyclipboard( ...
...there is data on the clipboard matching any of the flavors in the given list. boolean hasdatamatchingflavors( [array, size_is(alength)] in string aflavorlist, in unsigned long alength, in long awhichclipboard ); parameters aflavorlist an array of ascii strings. alength 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 the data from a transferable on the native clipboard. void setdata( in nsitransferable atransferable, in nsiclipboardowner anowner, in long awhichclipboard ); parameters atransferable the transferable containing the data to put on the clipboard. anowner th...
... the transferable containing the data to put on the clipboard. anowner the owner of the transferable. awhichclipboard specifies the clipboard to which this operation applies. supportsselectionclipboard() this method allows clients to determine if the implementation supports the concept of a separate clipboard for selection. boolean supportsselectionclipboard(); parameters none. return value returns true if kselectionclipboard is available. otherwise it returns false. supportsfindclipboard() this method allows clients to determine if the implementation supports the concept of a separate clipboard for find search strings. boolean supportsfindclipboard(); parameters none. return value returns true if the separate clipboard for find search strings is supported. otherwise it ret...
nsICompositionStringSynthesizer
this means that the clause is not converted. i.e., raw text of user input. attr_selectedrawtext 0x03 a clause attribute but this is typically not used. this means that the clause is not converted but selected to convert or modify. attr_convertedtext 0x04 a clause attribute. this means that the ...
...ommits composition string. if appendclause() and/or setcaret() are not called properly, e.g., sum of alength of calls of appendclause() is not same as composition string set by setstring(), this throws an exception. after a call of this, all stored composition string information is cleared. therefore, you can reuse the instance for modifying composition string. boolean dispatchevent(); return value if dispatched event's default is prevented, returns true. however, this must always return false since all dispatching dom events are not cancelable. setcaret() sets caret position in the composition string set by setstring(). this is optional. i.e., you may not call this before dispatchevent(). void setcaret(in unsigned long aoffset, in unsigned long alength); parameters ...
...true. however, this must always return false since all dispatching dom events are not cancelable. setcaret() sets caret position in the composition string set by setstring(). this is optional. i.e., you may not call this before dispatchevent(). void setcaret(in unsigned long aoffset, in unsigned long alength); parameters aoffset caret offset in the composition string. this value must be between 0 and the length of astring of setstring(). alength if you want wide caret, you can set over 0. however, gecko doesn't support wide caret yet. (bug 979112) setstring() sets new composition string. this must be called before every call of dispatchevent(). void setstring(in astring astring); parameters astring new composition string. ...
nsIConsoleService
elistener to remove. ...
... logg...
...m asourcename file. you are responsible for providing this line. you may pass null if you are lazy; this will prevent the source line showing in the error console. alinenumber and acolumnnumber — specify the exact location of an error. acolumnnumber is used to draw the arrow pointing to the problem character. aflags — one of flags declared in nsiscripterror. at the time of writing, possible values are: nsiscripterror.errorflag = 0 nsiscripterror.warningflag = 1 nsiscripterror.exceptionflag = 2 and nsiscripterror.strictflag = 4. acategory — a string indicating what kind of code caused the error message. there are quite a few category strings and they do not currently seem to be listed in a single place. hopefully, they will all eventually be listed in nsiscripterror.
nsIContentPrefObserver
dom/interfaces/base/nsicontentprefservice.idlscriptable this interface allows code to easily watch for changes to the values of content preferences. 1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview void oncontentprefremoved(in astring agroup, in astring aname); void oncontentprefset(in astring agroup, in astring aname, in nsivariant avalue); methods oncontentprefremoved() called when a content preference is removed. void oncontentprefremoved( in astring agroup, in astring aname ); parameters agroup the group to which the removed preference belonged; this may be the uri of a web site. this value is null if the preference was global, applying to all web sites. ana...
...ed() called when a content preference is removed. void oncontentprefremoved( in astring agroup, in astring aname ); parameters agroup the group to which the removed preference belonged; this may be the uri of a web site. this value is null if the preference was global, applying to all web sites. aname the name of the preference that was removed. oncontentprefset() called when the value of a preference is set (either by changing its current value or by creating the preference). void oncontentprefset( in astring agroup, in astring aname, in nsivariant avalue ); parameters agroup the group to which the preference belongs; this may be the uri of a web site. this value is null if the preference is global, applying to all web sites. aname the name of the preference who...
... a preference is set (either by changing its current value or by creating the preference). void oncontentprefset( in astring agroup, in astring aname, in nsivariant avalue ); parameters agroup the group to which the preference belongs; this may be the uri of a web site. this value is null if the preference is global, applying to all web sites. aname the name of the preference whose value has changed. avalue the preference's new value. see also nsicontentprefservice using content preferences ...
nsIConverterInputStream
rg/intl/converter-input-stream;1. to create an instance, use: var converterinputstream = components.classes["@mozilla.org/intl/converter-input-stream;1"] .createinstance(components.interfaces.nsiconverterinputstream); method overview void init(in nsiinputstream astream, in string acharset, in long abuffersize, in prunichar areplacementchar); constants constant value description default_replacement_character 0xfffd default replacement character value. methods init() initialize this stream. void init( in nsiinputstream astream, in string acharset, in long abuffersize, in prunichar areplacementchar ); parameters astream the source stream which is read and converted. acharset the character encoding to use for converting the bytes of the stream. a ...
...latin 1 is specified as "iso-8859-1". abuffersize defines the buffer size of the converter stream. in case of a buffer size of less than or equal to 0, the default size converter_buffer_size will be used. this is currently set to 8192 bytes. ...
...utf-8" equals utf-8 encoding. latin 1 is specified as "iso-8859-1". abuffersize defines the buffer size of the converter stream. in case of a buffer size of less than or equal to 0, the default size converter_buffer_size will be used. this is currently set to 8192 bytes. areplacementchar any unknown byte sequence will be replaced with this character. the default replacement character is u+fffd. a value of 0x0000 will cause an exception to be thrown if unknown byte sequences are encountered in the stream. see also nsiconverteroutputstream see reading textual data for an example. ...
nsIDNSService
sidnsrecord resolve(in autf8string ahostname, in unsigned long aflags); void shutdown(); obsolete since gecko 1.8 attributes attribute type description myhostname autf8string read only. constants resolve flag constants various flags that may be ored together to form the aflags parameter passed to asyncresolve() and resolve(). constant value description resolve_bypass_cache (1 << 0) this flag suppresses the internal dns lookup cache. resolve_canonical_name (1 << 1) the canonical name of the specified host will be queried. resolve_priority_medium (1 << 2) the query is given medium priority. if used with low, medium takes precedence. resolve_priority_low (1 << 3) the query...
...lag constants. alistener the listener to be notified when the result is available. alistenertarget optional parameter (may be null). if not null, this parameter specifies the nsieventtarget of the thread on which the listener's onlookupcomplete should be called. if this parameter is null, then onlookupcomplete will be called on an unspecified thread (possibly recursively). return value an object that can be used to cancel the host lookup. init() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) called to initialize the dns service. void init(); parameters none. resolve() called to synchronously resolve a host name. warning this method may block the calling thread for a long period of time. it is extremely unwise to call this fun...
...name. warning this method may block the calling thread for a long period of time. it is extremely unwise to call this function on the user interface thread of an application. nsidnsrecord resolve( in autf8string ahostname, in unsigned long aflags ); parameters ahostname the host name or ip-address-literal to resolve. aflags a bitwise or of the resolve flag constants. return value dns record corresponding to the given host name. exceptions thrown ns_error_unknown_host if host could not be resolved. shutdown() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) called to shutdown the dns service. any pending asynchronous requests will be canceled, and the local cache of dns records will be cleared. note: the operating...
nsIDOMOfflineResourceList
ady; this event is not currently used since versioned application caches aren't supported yet. oncached nsidomeventlistener an event listener to be called when caching is complete. status unsigned short one of the application cache state constants indicating the status of the application cache. constants application cache state constants constant value description uncached 0 the object isn't associated with an application cache. idle 1 the application cache is not in the process of being updated. checking 2 the application cache manifest is being fetched and checked for updates. downloading 3 resources are being downloaded to be added to the cache. updateready 4 there...
...is a new version of the application cache available. obsolete 5 the application cache group is now obsolete. methods mozadd() adds an item to the dynamically managed entries. the resource will be fetched and added to the application cache. void mozadd( in domstring uri ); parameters uri the uri of the resource to add to the list. mozhasitem returns a boolean value indicating whether or not the specified uri represents a resource that's in the application cache's list. note: this method has been deprecated. you should use the mozitems attribute instead. void mozhasitem( in domstring uri ); parameters uri the uri of the resource to check. return value true if the resource is in the list, otherwise false. mozitem returns the uri of the item ...
...resource is in the list, otherwise false. mozitem returns the uri of the item at the specific offset into the list of cached resources. note: this method is deprecated in firefox 3.5; you should instead access the list directly using the items attribute. domstring mozitem( in unsigned long index ); parameters index the index of the cached item whose uri should be returned. return value an domstring containing the uri of the specified resource. mozremove() removes an item from the list of dynamically managed entries. if this was the last reference to the given uri in the application cache, the cache entry is removed. void mozremove( in domstring uri ); parameters uri the uri of the item to remove from the list. swapcache() swaps in the newest version of the app...
nsIDOMStorage2
ts method overview void clear(); domstring getitem(in domstring key); domstring key(in unsigned long index); void removeitem(in domstring key); void setitem(in domstring key, in domstring data); attributes attribute type description length unsigned long the number of keys stored in local storage. methods clear() clears the contents of this storage context; this removes all values bound to the domain or origin. void clear(); parameters none. getitem() returns from local storage the data corresponding to the specified key. domstring getitem( in domstring key ); parameters key the key for which data should be returned. return value a string containing the data corresponding to the specified key, or null if no data exists for the given key. key() returns the key for the...
...; parameters key the key for which data should be returned. return value a string containing the data corresponding to the specified key, or null if no data exists for the given key. key() returns the key for the item stored at the specified index in the data store. domstring key( in unsigned long index ); parameters index the index for which the corresponding key should be returned. return value a string containing the requested key. exceptions thrown index_size_errthere is no key at the specified index. removeitem() given a key, removes the corresponding entry from local storage. void removeitem( in domstring key ); parameters key the key for which data should be removed from storage. setitem() sets the value corresponding to a given key. if the key does not already exist, a new k...
...eptions thrown index_size_errthere is no key at the specified index. removeitem() given a key, removes the corresponding entry from local storage. void removeitem( in domstring key ); parameters key the key for which data should be removed from storage. setitem() sets the value corresponding to a given key. if the key does not already exist, a new key is added, associated with the specified value. if the key already exists, the existing value is replaced with the specified value. void setitem( in domstring key, in domstring data ); parameters key the key for which data should be set. data the data to associate with the specified key. ...
nsIDOMStorageEventObsolete
ontents of a dom storage space; it is used for both session storage and local storage. 1.0 66 introduced gecko 1.8 obsolete gecko 2.0 inherits from: nsidomevent last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) when a dom storage event is received, the recipient can check its domain attribute to determine which domain's data store has changed. ...
...read only. methods initstorageevent() initializes a storage event. ...
...read only. methods initstorageevent() initializes a storage event. ...
nsIDOMXPathEvaluator
xpathexpression createexpression( in domstring expression, in nsidomxpathnsresolver resolver ); parameters expression a string representing the xpath to be created. resolver a name space resolver created by creatensresolver(), or a user defined name space resolver. read more on implementing a user defined namespace resolver if you wish to take the latter approach. return value an xpath expression, as an nsidomxpathexpression object. creatensresolver() creates an nsidomxpathexpression which resolves name spaces with respect to the definitions in scope for a specified node. it is used to resolve prefixes within the xpath itself, so that they can be matched with the document. null is common for html documents or when no name space prefixes are used. nsidomxpathnsresolver ...
... the definitions in scope for a specified node. it is used to resolve prefixes within the xpath itself, so that they can be matched with the document. null is common for html documents or when no name space prefixes are used. nsidomxpathnsresolver creatensresolver( in nsidomnode noderesolver ); parameters noderesolver the node to be used as a context for name space resolution. return value a name space resolver. evaluate() evaluate the specified xpath expression. nsisupports evaluate( in domstring expression, in nsidomnode contextnode, in nsidomxpathnsresolver resolver, in unsigned short type, in nsisupports result ); parameters expression a string representing the xpath to be evaluated. contextnode a dom node to evaluate the xpath expression against. to...
... a name space resolver created by creatensresolver(), or a user defined name space resolver. read more on implementing a user defined namespace resolver if you wish to take the latter approach. type a number that corresponds to one of the type constants of nsixpathresult. result an existing nsixpathresult to use for the result. using null will create a new nsixpathresult. return value an xpath result. see also introduction to using xpath in javascript document.evaluate dom level 3 xpath specification xml path language (xpath)rec nsidomxpathresult nsidomxpathexception ...
nsIDownloadManager
nload location for files: 0: files are downloaded to the desktop by default. 1: files are downloaded to the system's downloads folder by default. 2: files are downloaded to the local path specified by the browser.download.dir preference. if this preference is invalid, the download directory falls back to the default. read only. constants constant value description download_notstarted -1 the download has not been started yet. download_downloading 0 the download is in the process of being downloaded. download_finished 1 download completed including any processing of the target file. download_failed 2 the download failed due to error. download_canceled 3 the user cancele...
...al to the target file). the file will be moved to the location indicated by atarget when the download is complete. this may be null. acancelable an object that can be used to abort the download. must not be null. aisprivate indicates whether this download should be considered private (ie. to be removed at the end of the private browsing session, cached in non-permanent storage, etc.) return value the newly created download item with the passed-in properties. addlistener() adds a listener to the download manager. void addlistener( in nsidownloadprogresslistener alistener ); parameters alistener the nsidownloadprogresslistener object to receive status information from the download manager. canceldownload() cancels the download with the specified id if it's currently in-progre...
...rbird 1.5 / seamonkey 1.0) flush the download datasource to disk. void flush(); parameters none. getdownload() retrieves a download managed by the download manager. this can be one that is in progress, or one that has completed in the past and is stored in the database. nsidownload getdownload( in unsigned long aid ); parameters aid the unique id of the download. return value the download with the specified id. exceptions thrown ns_error_not_available the download is not in the database. onclose() obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. called when the download manager ...
nsIDroppedLinkHandler
boolean candroplink( in nsidomdragevent aevent, in prbool aallowsamedocument ); parameters aevent a dragenter or dragover event. aallowsamedocument if false, drops are only allowed if the document of the source of the drag is different from the destination. this check includes any parent, sibling and child frames in the same content tree. if true, the source is not checked. return value true if the link being dragged can be dropped. exceptions thrown missing exception missing description droplink() given a drop event, determines the link being dragged. if a uri is returned the caller can, for instance, load it. if null is returned, there is no valid link to be dropped. astring droplink( in nsidomdragevent aevent, out astring aname, [optional] in boolean adisallow...
...iven a drop event, determines the link being dragged. if a uri is returned the caller can, for instance, load it. if null is returned, there is no valid link to be dropped. astring droplink( in nsidomdragevent aevent, out astring aname, [optional] in boolean adisallowinherit ); parameters aevent a drop event. aname the link title if it exists, or an empty string otherwise. return value a uri, or null if there is no valid link to be dropped. exceptions thrown ns_error_dom_security_err error will be thrown and the event canceled if the receiving target should not load the uri for security reasons. this will occur if the source of the drag initiated a link for dragging that it itself cannot access. this prevents a source document from tricking the user into a dragging a chro...
...d link to be dropped. void droplinks( in nsidomdragevent aevent, [optional] in boolean adisallowinherit, [optional] out unsigned long acount, [retval, array, size_is(acount)] out nsidroppedlinkitem alinks ); parameters aevent a drop event. adisallowinherit acount receives the count of alinks array alinks recives an array of objects with nsidroppedlinkitem interface return value nothing. see also nsidroppedlinkitem ...
nsIHttpActivityObserver
asizedata, in acstring aextrastringdata); attributes attribute type description isactive boolean true when the interface is active and should observe http activity, otherwise false. if this is false, the observeactivity() method should not be called. read only. note: this attribute is present only for compatibility and should not be used. constants activity type constants constant value description activity_type_socket_transport 0x0001 socket transport activity has occurred. activity_type_http_transaction 0x0002 http transport activity has occurred. activity subtype constants constant value description activity_subtype_request_header 0x5001 the http request is about to be queued for sending. observers can look at request headers in aextrastringdata activity_subtyp...
...you wish to perform when http activity occurs. void observeactivity( in nsisupports ahttpchannel, in pruint32 aactivitytype, in pruint32 aactivitysubtype, in prtime atimestamp, in pruint64 aextrasizedata, in acstring aextrastringdata ); parameters ahttpchannel the nsihttpchannel on which the activity occurred. aactivitytype the type of activity that occurred; this will be one of the values specified in activity type constants. aactivitysubtype the subtype that further narrows the type of activity that occurred. if the activity type is activity_type_socket_transport, this value will be one of the status_* constants defined by nsisockettransport. if the activity type is activity_type_http_transaction, this will be one of the constants specified in activity subtype constants above. a...
... atimestamp the time at which the activity occurred, specified as microseconds elapsed since the epoch of midnight on january 1, 1970. aextrasizedata any additional size data available with this activity. see interpreting activity data below. aextrastringdata any additional string data available with this activity. see interpreting activity data below. interpreting activity data depending on the values of the aactivitytype and aactivitysubtype fields, the aextrasizedata and aextrastringdata parameters take on different meanings. socket transport activity when the activity type is activity_type_socket_transport and the subtype is status_sending_to, the aextrasizedata parameter contains the number of bytes sent. because a single http transaction may consist of multiple chunks of data transmitted...
nsIHttpHeaderVisitor
netwerk/protocol/http/nsihttpheadervisitor.idlscriptable this interface is used to view http request and response headers. inherits from: nsisupports last changed in gecko 1.7 method overview void visitheader(in acstring aheader, in acstring avalue); methods visitheader() called by the nsihttpchannel implementation when visiting request and response headers. this method can throw an exception to terminate enumeration of the channel's headers. void visitheader( in acstring aheader, in acstring avalue ); parameters aheader a string containing the key for a header such as "content-type" avalue the header's value field such as "text/html". multiple values are separated by a comma. example this example shows how to detect flash content. it implemen...
...mime type of a http response. this is done by subscribing to the http-on-examine-response and http-on-examine-cached-response observers. when the observer fires, the visitor interface is used to walk through the response headers and evaluate the mime type. ...
...nse and http-on-examine-cached-response observers. when the observer fires, the visitor interface is used to walk through the response headers and evaluate the mime type. ...
nsIIDNService
verts an ace (ascii compatible encoding) hostname into unicode format, returning a utf-8 format string. this combines two operations: running the rfc 3490 "tounicode" operation on the original string, then converting the resulting unicode string into utf-8 format. autf8string convertacetoutf8( in acstring input ); parameters input the ace encoded hostname to convert into utf-8 format. return value the utf-8 encoded equivalent of the hostname. converttodisplayidn() normalizes a hostname into utf-8 format if the hostname is in the idn whitelist. if the hostname isn't in the whitelist, it's converted into ace format. the resulting string is useful for display purposes, and ensures that the encoding is consistent with nsiuri.gethost(). autf8string converttodisplayidn( in autf8string input, ...
...'s converted into ace format. the resulting string is useful for display purposes, and ensures that the encoding is consistent with nsiuri.gethost(). autf8string converttodisplayidn( in autf8string input, out boolean isascii ); parameters input the string to convert to display format. isascii on return, this is set to true if the result is ascii or ace encoded; otherwise it's false. return value the display formatted hostname. convertutf8toace() converts the specified hostname from utf-8 to ace format, using the idna "toascii" algorithm. acstring convertutf8toace( in autf8string input ); parameters input the hostname to convert to ace format. return value the ace encoded version of the hostname. isace() determines whether or not the specified hostname is ace encoded. boolean isace( ...
...ied hostname from utf-8 to ace format, using the idna "toascii" algorithm. acstring convertutf8toace( in autf8string input ); parameters input the hostname to convert to ace format. return value the ace encoded version of the hostname. isace() determines whether or not the specified hostname is ace encoded. boolean isace( in acstring input ); parameters input the string to check. return value returns true if the specified string is ace encoded; otherwise, returns false. normalize() performs the unicode normalization needed for hostnames in idn. this is useful if you need to normalize a hostname separately from converting it to display format. autf8string normalize( in autf8string input ); parameters input the hostname to normalize. return value the normalized hostname. see also ...
nsIJetpack
name); void evalscript(in astring ascript); nsivariant createhandle(); void destroy(); methods sendmessage() this method asynchronously sends a message to the jetpack process. void sendmessage( in astring amessagename, [optional] in jsval v1, optional [optional] in jsval v2, optional ... ); parameters amessagename the name of the message to send. v1, v2, ... optional javascript values to send with the message; they must be either json-serializable types or handles. registerreceiver() this registers a callback to be triggered whenever the jetpack process sends a particular message. note: multiple callbacks may be registered for the same message; they will all be triggered. void registerreceiver( in astring amessagename, in jsval areceiver ); parameters amessagename the ...
... jsval areceiver ); parameters amessagename the name of the message from the jetpack process on which the callback is triggered. areceiver a javascript function. the first argument passed to it is the name of the message, and all arguments following it are either json-serializable types or handles. if the message was sent synchronously from the jetpack process via callmessage(), then the return value of this function is passed back to the jetpack process. unregisterreceiver() this unregisters a callback previously registered with registerreceiver() void unregisterreceiver( in astring amessagename, in jsval areceiver ); parameters amessagename the name of the message on which the callback should no longer be triggered. areceiver the javascript function that should no longer be triggered...
...s of the form //@line 1 "foo.js" can be used to specify filename and line number information for debugging purposes. void evalscript( in astring ascript ); parameters ascript the full contents of the script to evaluate in the jetpack process. createhandle() this creates an opaque handle that can transparently be exchanged between processes. nsivariant createhandle(); parameters none. return value the new handle. destroy() this terminates the jetpack process. void destroy(); parameters none. special messages if an exception goes uncaught in the jetpack process, it will be reported to the chrome process via a message with the name core:exception. the message comes with one argument, which represents the exception object that was thrown. warning: bug 589308 prevents this message from being ...
nsIMimeConverter
ive code, as xpconnect translation causes it to not work properly. string encodemimepartiistr(in string header, in boolean structured, in string mailcharset, in long fieldnamelen, in long encodedwordsize); parameters propertyname the name of the property to retrieve. return value the value of the property. encodemimepartiistr_utf8() encodes a string into a mime-encoded form according to rfc 2047. string encodemimepartiistr_utf8(in autf8string header, in boolean structured, in string mailcharset, in long fieldnamelen, in long ...
...ring 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 getstringproperty(in string propertyname); parameters propertyname the name of the property to retrieve. return value the value of the property. b64encoderinit() get an integer property. usually you would use this to store you own properties. unsig...
...usually you would use this to store you own properties. unsigned long getuint32property(in string propertyname); parameters propertyname the name of the property to retrieve. thunderbird stored uint32 properties (not a complete list): indexed used for spotlight integration on osx. notaphishmessage indicates whether phisihing filters have been run on a message yet. return value the value of the property. qpencoderinit() void setuint32property(in string propertyname, in unsigned long propertyval); parameters propertyname the name of the property to set. propertyval the value of the property. encoderdestroy() marks this header as read. thunderbird provides a utility function which performs this for the currently selected message: mar...
nsIMsgRuleAction
defined in comm-central/ mailnews/ base/ search/ public/ nsimsgfilter.idl [scriptable, uuid(190a2a18-d245-473a-a402-9f0814598c7f)] interface nsimsgruleaction : nsisupports { attribute nsmsgruleactiontype type; // target priority.. throws an exception if the action is not priority attribute nsmsgpriorityvalue priority; // target folder.. throws an exception if the action is not move to folder attribute acstring targetfolderuri; // target label. ...
...terface nsimsgruleaction : nsisupports { attribute nsmsgruleactiontype type; // target priority.. throws an exception if the action is not priority attribute nsmsgpriorityvalue priority; // target folder.. throws an exception if the action is not move to folder attribute acstring targetfolderuri; // target label. ...
...not priority attribute nsmsgpriorityvalue priority; // target folder.. throws an exception if the action is not move to folder attribute acstring targetfolderuri; // target label. ...
nsIMsgSearchTerm
defined in mozilla/ mailnews/ base/ search/ public/ nsimsgsearchterm.idl attributes attrib attribute nsmsgsearchattribvalue attrib; op attribute nsmsgsearchopvalue op; value attribute nsimsgsearchvalue value; booleanand attribute boolean booleanand; arbitraryheader attribute acstring arbitraryheader; hdrproperty /** * not to be confused with arbitraryheader, which is a header in the * rfc822 message. this is a property of the nsimsgdbhdr, and may have * nothing to do the message headers, e.g., gloda-id. * value.str will be compared with nsimsghdr::getproperty(hdrproperty). */ attribute acstring hdrproperty; customid /// identifier for a custom id used for this term, if any. attribute acstring customid; beginsgrouping attribute boolean beginsgrouping; endsg...
...thods matchrfc822string boolean matchrfc822string(in string astring, in string charset, in boolean charsetoverride); matchrfc2047string boolean matchrfc2047string(in string astring, in string charset, in boolean charsetoverride); matchdate boolean matchdate(in prtime atime); matchstatus boolean matchstatus(in unsigned long astatus); matchpriority boolean matchpriority(in nsmsgpriorityvalue priority); matchage boolean matchage(in prtime days); matchsize boolean matchsize(in unsigned long size); matchlabel boolean matchlabel(in nsmsglabelvalue alabelvalue); matchjunkstatus boolean matchjunkstatus(in string ajunkscore); matchjunkpercent /* * test search term match for junkpercent * * @param ajunkpercent junkpercent for message (0-100, 100 is junk) * @return ...
... * @param ascopeterm scope of search * @param aoffset offset of message in message store. * @param alength length of message. * @pa...
nsINavHistoryObserver
euri(in nsiuri auri, in acstring aguid); obsolete since gecko 21.0 void onbeginupdatebatch(); void onclearhistory(); void ondeleteuri(in nsiuri auri, in acstring aguid); void ondeletevisits(in nsiuri auri, in prtime avisittime, in acstring aguid); void onendupdatebatch(); void onpagechanged(in nsiuri auri, in unsigned long awhat, in astring avalue); void onpageexpired(in nsiuri auri, in prtime avisittime, in boolean awholeentry); obsolete since gecko 2.0 void ontitlechanged(in nsiuri auri, in astring apagetitle); void onvisit(in nsiuri auri, in long long avisitid, in prtime atime, in long long asessionid, in long long areferringid, in unsigned long atransitiontype, in acstring aguid, out unsigned long aadded); ...
... methods onbeforedeleteuri() obsolete since gecko 21.0 (firefox 21.0 / thunderbird 21.0 / seamonkey 2.18) note: this method was removed in gecko 21.0 as part of bug 826409. the specified page and all its visits are about to be deleted. note: the page does not necessarily have to have ...
...tes, and so forth. this is called sometime after onbeginupdatebatch(). void onendupdatebatch(); parameters none. onpagechanged() some attribute on the specified page has changed. note that for typed and hidden pages, the page might not actually have been added yet. this needs to be clarified; what are typed and hidden? void onpagechanged( in nsiuri auri, in unsigned long awhat, in astring avalue ); parameters auri the uri of the page on which an attribute changed. awhat the attribute whose value changed. avalue the attribute's new value. onpageexpired() obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) note: this method was removed in gecko 2.0. use ondeletevisits() instead. called when a history entry expires. t...
nsIObserver
fications in the implementation of this method. void observe( in nsisupports asubject, in string atopic, in wstring adata ); parameters asubject in general reflects the object whose change or action is being observed. atopic indicates the specific change or action. adata an optional parameter or other auxiliary data further describing the change or action. remarks the specific values and meanings of the parameters provided varies widely, though, according to where the observer was registered, and what topic is being observed. a single nsiobserver implementation can observe multiple types of notification, and is responsible for dispatching its own behavior on the basis of the parameters for a given callback. in general, atopic is the primary criterion for such dispatch; nsio...
...observer was registered, and what topic is being observed. a single nsiobserver implementation can observe multiple types of notification, and is responsible for dispatching its own behavior on the basis of the parameters for a given callback. in general, atopic is the primary criterion for such dispatch; nsiobserver implementations should take care that they can handle being called with unknown values for atopic. the most common implementation of nsiobserverservice is the xpcom observer service. with this implementation, it's safe (and common practice) for an implementation of nsiobserver to remove itself as an observer during the observe callback, or to add or remove other observers. be careful, though, because other uses of nsiobserver may not support these operations correctly within obse...
...server(this, "mytopicid"); } } instantiation - this should be fired once you're ready to start observing (for example a window's load event). observer = new myobserver(); destruction - this should be fired once you're done observing (for example a window's unload event). failure to do so may result in memory leaks. observer.unregister(); "get everything" - note that "*" is an acceptable value (be careful with this, because it observes many events, and can degrade performance). observer.register("*"); see also nsiobserverservice observer_notifications ...
nsIObserverService
true and anobserver supports the nsisupportsweakreference interface, a weak reference will be held. otherwise an error will be returned. (in most cases, you should use false.) enumerateobservers() called to enumerate all observers registered for a particular topic. nsisimpleenumerator enumerateobservers( in string atopic ); parameters atopic the notification topic or subject. return value returns an enumeration of all registered listeners. see nsisimpleenumerator. notifyobservers() this method is called to notify all observers for a particular topic. see example. void notifyobservers( in nsisupports asubject, in string atopic, in wstring somedata ); parameters asubject a notification specific interface pointer. this usually corresponds to the source of the notifica...
...rs for a particular topic. see example. void notifyobservers( in nsisupports asubject, in string atopic, in wstring somedata ); parameters asubject a notification specific interface pointer. this usually corresponds to the source of the notification, but could be defined differently depending on the notification topic and may even be null. atopic the notification topic. this string-valued key uniquely identifies the notification. this parameter must not be null. somedata a notification specific string value. the meaning of this parameter is dependent on the topic. it may be null. removeobserver() this method is called to unregister an observer for a particular topic. void removeobserver( in nsiobserver anobserver, in string atopic ); parameters anobserver the nsio...
...this parameter must not be null. example this notifies all nsiobservers watching the "mytopicid" topic with an additional data parameter. ...
nsIPrefLocalizedString
modules/libpref/public/nsipreflocalizedstring.idlscriptable this interface is simply a wrapper 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. inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview void setdatawithlength(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 setdatawithlength() used to set the contents of this...
...a); wstring tostring(); attributes attribute type description data wstring provides access to string data stored in this property. methods setdatawithlength() used to set the contents of this object. void setdatawithlength( in unsigned long length, [size_is(length)] in wstring data ); parameters length the length of the string. this value should not include space for the null terminator, nor should it account for the size of a character. it should only be the number of characters for which there is space in the string. data the string data to be stored. tostring() used to retrieve the contents of this object into a wide string. note: this makes a copy of the string argument passed in. wstring tostring(); parameters none.
...not include space for the null terminator, nor should it account for the size of a character. it should only be the number of characters for which there is space in the string. data the string data to be stored. tostring() used to retrieve the contents of this object into a wide string. note: this makes a copy of the string argument passed in. wstring tostring(); parameters none. return value returns wstring - the string containing the data stored within this object. ...
nsIProfile
void renameprofile(in wstring oldname, in wstring newname); void shutdowncurrentprofile(in unsigned long shutdowntype); attributes attribute type description currentprofile wstring the name of the profile currently in use. profilecount long the number of profiles. read only. constants profile shutdown types constant value description shutdown_persist 0x00000001 when shutting down the profile, save all changes. shutdown_cleanse 0x00000002 when shutting down the profile, discard changes. unimplemented methods cloneprofile() clones the current profile, creating a copy of it with a new name. void cloneprofile( in wstring profilename ); parameters profilename the name ...
... shutdown_cleanse 0x00000002 when shutting down the profile, discard changes. unimplemented methods cloneprofile() clones the current profile, creating a copy of it with a new name. void cloneprofile( in wstring profilename ); parameters profilename the name to assign to the new clone of the current profile. createnewprofile() creates a new profile. appropriate default values will be copied into the preferences in the new profile. void createnewprofile( in wstring profilename, in wstring nativeprofiledir, in wstring langcode, in boolean useexistingdir ); parameters profilename the name to assign to the new profile. nativeprofiledir the pathname of the directory to use as the profile directory; if you specify null, a new folder will be create...
...arameters length on return, contains the number of profiles in the profilenames array. profilenames on return, contains an array of all of the available profiles' names. profileexists() determine whether or not a profile with the specified name exists. boolean profileexists( in wstring profilename ); parameters profilename the name of the profile to look for. return value true if there is a profile with the specified name. renameprofile() renames an existing profile. void renameprofile( in wstring oldname, in wstring newname ); parameters oldname the name of the profile to rename. newname the new name to assign to the profile. exceptions thrown ns_error_failure a profile already exists with the name newname. shutdowncurrentprofile(...
nsIProtocolHandler
y_anyone, uri_dangerous_to_load, uri_is_ui_resource, or uri_is_local_file must be set on every protocol handler. current versions of firefox assume that the uri has uri_loadable_by_anyone set, but this will not work starting with the mozilla 2 platform. scheme acstring the scheme for this protocol ("file", "http", and so forth). read only. constants constant value description uri_std 0 a standard full uri with authority component and understanding relative uris; this includes http and ftp, for example. uri_norelative 1<<0 the protocol doesn't support relative uris (for example, about and javascript). uri_noauth 1<<1 the protocol doesn't have an authority component (for example, file). uri_inherits_se...
... protocols, port 25 (simple mail transfer protocol) is banned. when a uri containing this port number is encountered, this method is called to ask if the protocol handler wants to override the ban. boolean allowport( in long port, in string scheme ); parameters port the port for which an override is being requested. scheme the scheme for which an override is being requested. return value return true if the override is approved; otherwise, return false. newchannel() constructs a new channel from the given uri for this protocol handler. nsichannel newchannel( in nsiuri auri ); parameters auri the uri for which to construct a channel. return value return the newly constructed channel. newuri() makes a uri object that is suitable for loading by this protocol, where t...
...acter set that should be used when communicating this uri to an origin server. if this is null, then utf-8 encoding is assumed and no character transformation is not performed. abaseuri if null, aspec must specify an absolute uri. otherwise, aspec may be resolved relative to abaseuri, depending on the protocol. if the protocol has no concept of relative uris, this parameter is ignored. return value the new uri object suitable for loading using the protocol. see also nsiproxiedprotocolhandler adding a new protocol to mozilla writing a firefox protocol handler custom about: urls - similar to adding new protocol but adding onto the existing about: protocol ...
nsIProxyInfo
failovertimeout unsigned long this attribute specifies the failover timeout in seconds for this proxy. if a nsiproxyinfo is reported as failed via nsiprotocolproxyservice.getfailoverforproxy(), then the failed proxy will not be used again for this many seconds. read only. flags unsigned long this attribute specifies flags that modify the proxy type. the value of this attribute is the bit-wise combination of the proxy flags defined below. any undefined bits are reserved for future use. read only. host autf8string this attribute specifies the hostname of the proxy server. read only. note: prior to gecko 1.8 host was available by the host method. next nsiproxyinfo proxy info objects...
... failover. read only. obsolete since gecko 1.8 port long this attribute specifies the port number of the proxy server. read only. note: prior to gecko 1.8 port was available by the port method. type acstring this attribute specifies the type of the proxy server as a case insensitive ascii string. some special values for this attribute include (but are not limited to) the following: "http" - http proxy (or ssl connect for https) "socks" - socks v5 proxy "socks4" - socks v4 proxy "direct" - no proxy "unknown" - unknown proxy (see nsiprotocolproxyservice.resolve()) a future version of this interface may define additional types. read on...
...rvice.resolve()) a future version of this interface may define additional types. read only. note: prior to gecko 1.8 type was available by the type method. constants the following "proxy flags" may be bit-wise combined to construct the flags attribute defined on this interface. all unspecified bits are reserved for future use. constant value description transparent_proxy_resolves_host 1 << 0 this flag is set if the proxy is to perform name resolution itself. if this is the case, the hostname is used in some fashion, and we shouldn't do any form of dns lookup ourselves. see also nsiprotocolproxyservice nsiprotocolproxyfilter ...
nsIScriptableInputStream
return the number of bytes currently available in the stream. note: this method should not be used to determine the total size of a stream, even if the stream corresponds to a local file. moreover, since a stream may make available more than 2^32 bytes of data, this method is incapable of expressing the entire size of the underlying data source. unsigned long available(); parameters none. return value the number of bytes. exceptions thrown ns_base_stream_closed if called after the stream has been closed. close() closes the stream. note: the close method may be called more than once, but subsequent calls are ignored. void close(); parameters none. init() wrap the given nsiinputstream with this nsiscriptableinputstream. note: the init method may be called more than once, allowing a ns...
...d. void init( in nsiinputstream ainputstream ); parameters ainputstream the nsiinputstream to be wrapped. read() read data from the stream. warning: if the data contains a null byte, then this method will return a truncated string. note: it is also important to consider how a language bindings may interpret the string data type. in particular, some bindings may convert the byte values into unicode code points, by assuming the byte values are encoded as iso-latin-1. this is the case for the javascript bindings. string read( in unsigned long acount ); parameters acount the maximum number of bytes to read from the stream. return value the data read as a string, which will be an empty string if the stream is at eof. exceptions thrown ns_error_not_initialized ...
...ream_would_block indicates that reading from the input stream would block the calling thread for an indeterminate amount of time. this exception may only be thrown if nsiinputstream.isnonblocking() returns true. readbytes() read data from the stream, including null bytes. acstring readbytes( in unsigned long acount ); parameters acount the maximum number of bytes to read. return value the data from the stream, which will be an empty string if eof has been reached. exceptions thrown ns_error_failure if there are not enough bytes available to read acount amount of data. ns_base_stream_would_block if reading from the input stream would block the calling thread (non-blocking mode only). remarks this interface provides javascript with a way to read ascii text from...
nsISeekableStream
xpcom/io/nsiseekablestream.idlscriptable provides seeking support in data streams. inherits from: nsisupports last changed in gecko 1.7 method overview void seek(in long whence, in long long offset); void seteof(); long long tell(); constants constant value description ns_seek_set 0 specifies that the offset is relative to the start of the stream. ns_seek_cur 1 specifies that the offset is relative to the current position in the stream. ns_seek_end 2 specifies that the offset is relative to the end of the stream. methods seek() this method moves the stream offset of the stream implementing this interface. void seek( in long whence, in long long offset ); parameters whence...
...e to the end of the stream. methods seek() this method moves the stream offset of the stream implementing this interface. void seek( in long whence, in long long offset ); parameters whence specifies how to interpret the 'offset' parameter in setting the stream offset associated with the implementing stream, according to the table of constants above. offset specifies a value, in bytes, that is used in conjunction with the 'whence' parameter to set the stream offset of the implementing stream. a negative value causes seeking in the reverse direction. exceptions thrown ns_base_stream_closed if called on a closed stream. seteof() this method truncates the stream at the current offset. void seteof(); parameters none. exceptions thrown ns_base_stream_clos...
...direction. exceptions thrown ns_base_stream_closed if called on a closed stream. seteof() this method truncates the stream at the current offset. void seteof(); parameters none. exceptions thrown ns_base_stream_closed if called on a closed stream. tell() this method reports the current offset, in bytes, from the start of the stream. long long tell(); parameters none. return value the current offset, in bytes, from the start of the stream. exceptions thrown ns_base_stream_closed if called on a closed stream. ...
nsIStringBundle
rties file (that is you can't omit %1 and use only %2). do not try to use any other types. this uses nstextformatter::smprintf. wstring formatstringfromid( in long aid, [array, size_is(length)] in wstring params, in unsigned long length ); parameters aid the id of the string to retrieve. params parameters to pass in to the string. length the length of the parameter list. return value returns the formatted string. formatstringfromname() returns a formatted string with the given key name from the string bundle, where each occurrence of %s (uppercase) is replaced by each successive element in the supplied array. you may also use other formatting codes, but can only pass unicode strings in. the name should refer to a string in the bundle that uses %s, and the number of strings...
...it %1 and use only %2). do not try to use any other types. this uses nstextformatter::smprintf to do the dirty work. wstring formatstringfromname( in wstring aname, [array, size_is(length)] in wstring params, in unsigned long length ); parameters aname the name of the string to retrieve. params parameters to pass in to the string. length the length of the parameter list. return value returns the formatted string. getsimpleenumeration() nsisimpleenumerator getsimpleenumeration(); parameters none. return value returns a nsisimpleenumerator of all nsipropertyelement entries in the string bundle. getstringfromid() retrieves a string from the bundle by its id. wstring getstringfromid( in long aid ); parameters aid the id of the string to retrieve. string id's ar...
...mpleenumeration(); parameters none. return value returns a nsisimpleenumerator of all nsipropertyelement entries in the string bundle. getstringfromid() retrieves a string from the bundle by its id. wstring getstringfromid( in long aid ); parameters aid the id of the string to retrieve. string id's are assigned by the order in which they are stored in the properties file. return value returns the requested string. getstringfromname() retrieves a string from the bundle by its name. wstring getstringfromname( in wstring aname ); parameters aname the name of the string to retrieve. string name are designated in the properties file. return value returns the requested string. see also xul:stringbundle xul tutorial:property files nsistringbundleservice ...
nsIStringBundleService
createextensiblebundle(in string aregistrykey); void flushbundles(); wstring formatstatusmessage(in nsresult astatus, in wstring astatusarg); methods createbundle() nsistringbundle createbundle( in string aurlspec ); parameters aurlspec the url of the properties file to load. this is typically a locale url, e.g. chrome://global/locale/global.properties return value a string bundle corresponding to the properties file. this string bundle has functions available on it. on the return value object on you can call functions like getstringfromname and formatstringfromname see nsistringbundle. createextensiblebundle() nsistringbundle createextensiblebundle( in string aregistrykey ); parameters aregistrykey the name of the category under which the ...
... flushbundles() flushes the string bundle cache - useful when the locale changes or when we need to get some extra memory back. (automatically called for the memory-pressure and chrome-flush-caches global observer topics.) void flushbundles(); parameters none. ...
...essage received by a nsiprogresseventsink's onstatus method. wstring formatstatusmessage( in nsresult astatus, in wstring astatusarg ); parameters astatus the status code. this is mapped into a string id and and used in the string lookup process (see nsierrorservice). astatusarg the status message argument(s). multiple arguments can be separated by newline ('\n') characters. return value the formatted message. see also code snippets : miscellaneous : using string bundles from javascript how to localize html pages, xul files, and js/jsm files from bootstrapped add-ons. the localizing js/jsm files uses the nsistringbundleservice: bootstrapped extensions :: localization (l10n) nsistringbundle ...
nsITaskbarProgress
ing in windows 7, applications can display a progress notification in the taskbar. this class wraps around the native functionality to do this. 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 setprogressstate(in nstaskbarprogressstate state, in unsigned long long currentvalue optional, in unsigned long long maxvalue optional); constants constant value description state_no_progress 0 stop displaying progress on the taskbar button. this should be used when the operation is complete or canceled. state_indeterminate 1 display a cycling, indeterminate progress bar. state_normal 2 display a determinate, normal progress bar. state_error 3 display a determinate,...
...used when the operation is complete or canceled. state_indeterminate 1 display a cycling, indeterminate progress bar. state_normal 2 display a determinate, normal progress bar. state_error 3 display a determinate, error progress bar. state_paused 4 display a determinate progress bar indicating that the operation has paused. methods setprogressstate() sets the taskbar progress state and value for this window. the currentvalue and maxvalue parameters are optional and should be supplied when state is one of state_normal, state_error or state_paused. void setprogressstate( in nstaskbarprogressstate state, in unsigned long long currentvalue, optional in unsigned long long maxvalue optional ); parameters state one of the state constants. currentvalue the current progress value. max...
... for this window. the currentvalue and maxvalue parameters are optional and should be supplied when state is one of state_normal, state_error or state_paused. void setprogressstate( in nstaskbarprogressstate state, in unsigned long long currentvalue, optional in unsigned long long maxvalue optional ); parameters state one of the state constants. currentvalue the current progress value. maxvalue the maximum progress value. exceptions thrown ns_error_illegal_value if currentvalue is greater than maxvalue. ns_error_invalid_arg if state is state_no_progress or state_indeterminate, and either currentvalue or maxvalue is not 0. see also nsiwintaskbar windows 7 taskbar apis ...
nsIThread
e thread was not created with the thread manager's nsithreadmanager.newthread() method, or the thread is already in the process of being shut down. haspendingevents() determines whether or not the thread has events that are ready to be processed. note: this method must be called from within the thread itself, and not from another thread. boolean haspendingevents() parameters none. return value true if there are pending events at the time the function was called. since other threads may add events to the current thread, it's possible that by the time this method returns, the event queue may no longer be empty, even if a false result is reported. exceptions thrown ns_error_unexpected the method was called when this thread wasn't the current thread. processnextevent() processes t...
...events to the current thread, it's possible that by the time this method returns, the event queue may no longer be empty, even if a false result is reported. exceptions thrown ns_error_unexpected the method was called when this thread wasn't the current thread. processnextevent() processes the next pending event. if there aren't any pending events, this method may wait -- depending on the value of the maywait parameter -- until an event is dispatched to the thread. this method is re-entrant but may only be called if this thread is the current thread. warning: calling nsithread.processnextevent allows network and ui events to run which can modify data structures that your code isn't expecting to be modified during a synchronous method call. this can cause random crashes and other ...
...g a synchronous method call. this can cause random crashes and other bugs that may be hard to find and fix. consider use asynchronous callbacks instead. boolean processnextevent( in boolean maywait ); parameters maywait if true, this method blocks until an event is available to process if the event queue is empty. if false, this method returns immediately if the queue is empty. return value returns true if an event was processed, or false if there were no pending events. exceptions thrown ns_error_unexpected this method was called when this thread wasn't the current thread. see also the thread manager nsithreadmanager nsithreadpool nsithreadinternal nsithreadobserver nsithreadeventfilter ...
nsITransactionList
y. methods getchildlistforitem() returns the list of children associated with the item at aindex. implementations may return null if there are no children, or an empty list. the list returned is addref'd so it is up to the caller to release the transaction when it is done. nsitransactionlist getchildlistforitem( in long aindex ); parameters aindex the index of the item in the list. return value the nsitransactionlist of children associated with the item at aindex. getitem() returns the transaction at the given index in the list. note that a null can be returned here if the item is a batch. the transaction returned is addref'd so it is up to the caller to release the transaction when it is done. nsitransaction getitem( in long aindex ); parameters aindex the index of the item in the ...
...ctionlist of children associated with the item at aindex. getitem() returns the transaction at the given index in the list. note that a null can be returned here if the item is a batch. the transaction returned is addref'd so it is up to the caller to release the transaction when it is done. nsitransaction getitem( in long aindex ); parameters aindex the index of the item in the list. return value missing description getnumchildrenforitem() returns the number of child (auto-aggreated) transactions the item at aindex has. long getnumchildrenforitem( in long aindex ); parameters aindex the index of the item in the list. return value the number of child (auto-aggreated) transactions the item at aindex has. itemisbatch() returns true if the item at aindex is a batch. note that currently t...
...see also nsitransaction nsitransactionlistener nsitransactionmanager ...
nsITreeColumn
n. read only. selectable boolean if true the nsitreecolumn is able to be selected. if the selectable attribute is not set, the column cells are not selectable. read only. type short the type of the column, see constants. read only. width long the width of nsitreecolumn. read only. x long the x position in the tree of the left edge of the nsitreecolumn. read only. ...
...invalidate() void invalidate(); parameters none. ...
...eter column type. methods native code only!getidconst void getidconst( [shared] out wstring idconst ); parameters idconst getnext() get the next column in the nsitreecolumns. nsitreecolumn getnext(); parameters none. return value the next nsitreecolumn in the nsitreecolumns. getprevious() get the previous column in the nsitreecolumn. nsitreecolumn getprevious(); parameters none. return value the previous nsitreecolumn in the nsitreecolumns. invalidate() void invalidate(); parameters none. see also nsitreecolumns ...
nsITreeSelection
); parameters index index of the change. count number of rows changed. clearrange() clears the range. void clearrange( in long startindex, in long endindex ); parameters startindex index to clearing at. endindex index to stop clearing at. clearselection() clears the selection. void clearselection(); parameters none. getrangeat() returns two objects whose value properties represent the minimum and maximum indices of the given selection range. see the tree selection tutorial. void getrangeat( in long i, out long min, out long max ); parameters i index of range to get (0 <= i < getrangecount()) min index of first object in range. max index of last object in this range. for single selections, min == max. getran...
...ee selection tutorial. void getrangeat( in long i, out long min, out long max ); parameters i index of range to get (0 <= i < getrangecount()) min index of first object in range. max index of last object in this range. for single selections, min == max. getrangecount() returns a count of selection ranges. long getrangecount(); parameters none. return value long - number of selection ranges invalidateselection() can be used to invalidate the selection. void invalidateselection(); parameters none. invertselection() inverts the selection. void invertselection(); parameters none. isselected() indicates whether or not the row at the specified index is part of the selection. boolean isselected( in long index ); parameters index index of the...
...tion ranges invalidateselection() can be used to invalidate the selection. void invalidateselection(); parameters none. invertselection() inverts the selection. void invertselection(); parameters none. isselected() indicates whether or not the row at the specified index is part of the selection. boolean isselected( in long index ); parameters index index of the row to check. return value rangedselect() select the range specified by the indices. void rangedselect( in long startindex, in long endindex, in boolean augment ); parameters startindex index to start selecting at. endindex index to stop selecting at. this parameter is inclusive; to select one item, set endindex == startindex. augment if true, the range is added to the selection without cle...
nsIUpdateTimerManager
ject 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. ...
.... remarks note that the timer is not precise, and that the default minimum interval is 2 minutes. ...
... method the method used to instantiate the interface; this should be either getservice or createinstance, depending on your component. id the id that identifies the interval; this is the same id you would pass into registertimer(). ...
nsIWebBrowserPersist
areferrerpolicy, in nsiinputstream apostdata, in string aextraheaders, in nsisupports afile, in boolean aisprivate); attributes attribute type description currentstate unsigned long current state of the persister object. read only. persistflags unsigned long flags governing how data is fetched and saved from the network. ...
...headers, in nsisupports afile, in boolean aisprivate); attributes attribute type description currentstate unsigned long current state of the persister object. read only. persistflags unsigned long flags governing how data is fetched and saved from the network. it is best to set this value explicitly unless you are prepared to accept the default values. progresslistener nsiwebprogresslistener callback listener for progress notifications. the object that the embbedder supplies may also implement nsiinterfacerequestor and be prepared to return nsiauthprompt or other interfaces that may be required to download data. result unsigned long value indicating the success or failure of the persist operation. read only. ...
...webprogresslistener callback listener for progress notifications. the object that the embbedder supplies may also implement nsiinterfacerequestor and be prepared to return nsiauthprompt or other interfaces that may be required to download data. result unsigned long value indicating the success or failure of the persist operation. read only. constants constant value description persist_flags_none 0 no special persistence behavior. persist_flags_from_cache 1 only use cached data (could result in failure if data is not cached). persist_flags_bypass_cache 2 bypass the cached data. persist_flags_ignore_redirected_data 4 ignore any redirected data (usually adverts). persist_flags_ignore_ifram...
nsIWebNavigationInfo
image 1 returned by istypesupported() to indicate that a type is supported as an image. plugi...
...bnavigationinfo); method overview unsigned long istypesupported(in acstring atype, in nsiwebnavigation awebnav); constants support type constants constant value description unsupported 0 returned by istypesupported() to indicate lack of support for a type. note: this is guaranteed not to change, so that boolean tests can be done on the return value if istypesupported to detect whether a type is supported at all. image 1 returned by istypesupported() to indicate that a type is supported as an image. plugin 2 returned by istypesupported() to indicate that a type is supported via an npapi ("netscape 4 api") plug-in. this is not the value returned for "xpcom plug-ins". other 1 << 15 note: other ...
... parameters atype the mime type to check. awebnav the nsiwebnavigation object on which to check for compatibility. you may specify null to check for compatibility with nsiwebnavigation objects that are in their default state; otherwise, the result is determined based on the configuration of the specified object (that is, how it is configured by using nsiwebbrowsersetup). return value returns one of the support type constants, indicating whether or not the specified mime type is supported, and in what form that support exists. example let webnavigationinfo_service = components.classes["@mozilla.org/webnavigation-info;1"] .getservice(components.interfaces.nsiwebnavigationinfo); let support_code = webnavigationinfo_service.istypesupported(contentt...
nsIWebSocketChannel
copen(in nsiuri auri, in acstring aorigin, in nsiwebsocketlistener alistener, in nsisupports acontext); void close(in unsigned short acode, in autf8string areason); void sendbinarymsg(in acstring amsg); void sendmsg(in autf8string amsg); attributes attribute type description extensions acstring sec-websocket-extensions response header value. read only. loadgroup nsiloadgroup the load group of the websockets code. notificationcallbacks nsiinterfacerequestor the notification callbacks for authorization and so forth. originaluri nsiuri the original uri used to construct the protocol connection. this is used in the case of a redirect or uri "resolution" (for example resolving a resource: uri ...
...n callbacks for authorization and so forth. originaluri nsiuri the original uri used to construct the protocol connection. this is used in the case of a redirect or uri "resolution" (for example resolving a resource: uri to a file: uri) so that the original pre-redirect uri can still be obtained. this is never null. read only. protocol acstring sec-websocket-protocol value. securityinfo nsisupports transport-level security information (if any). read only. uri nsiuri the uri corresponding to the protocol connection after any redirections are completed. read only. status codes the following values are permitted status codes. status code name description 0-999 reserved and not used. 1000 c...
...bsocket protocol; this may be redirected. aorigin the uri of the originating resource. alistener the nsiwebsocketlistener implementation. acontext an opaque parameter forwarded to alistener's methods. close() void close( in unsigned short acode, in autf8string areason ); parameters acode the status of the connection when closed; see status codes for possible values. areason a human-readable string describing the reason the connection closed. sendbinarymsg() sends a binary message to the websocket peer. void sendbinarymsg( in acstring amsg ); parameters amsg the data to send. sendmsg() sends a text message to the websocket peer. void sendmsg( in autf8string amsg ); parameters amsg the utf-8 string to send. see also webso...
nsIWinTaskbar
oobar systems.squashweb.1.0". see xul application packaging for additional details. methods createjumplistbuilder() retrieve a taskbar jump list builder. fails if a jump list build operation has already been initiated, developers should make use of a single instance of nsijumplistbuilder for building lists within an application. nsijumplistbuilder createjumplistbuilder(); parameters none. return value an nsijumplistbuilder. createtaskbartabpreview() creates a taskbar tab preview, given an nsidocshell reference to a top-level window. nsitaskbartabpreview createtaskbartabpreview( in nsidocshell shell, in nsitaskbarpreviewcontroller controller ); parameters shell an nsidocshell object representing the top-level window from which to create the preview. controller an nsitaskbarpreviewcontroll...
...eatetaskbartabpreview() creates a taskbar tab preview, given an nsidocshell reference to a top-level window. nsitaskbartabpreview createtaskbartabpreview( in nsidocshell shell, in nsitaskbarpreviewcontroller controller ); parameters shell an nsidocshell object representing the top-level window from which to create the preview. controller an nsitaskbarpreviewcontroller you implement. return value an nsitaskbartabpreview object for the new tab preview. example netscape.security.privilegemanager.enableprivilege("universalxpconnect"); var taskbar = components.classes["@mozilla.org/windows-taskbar;1"].getservice(components.interfaces.nsiwintaskbar); // get the docshell for the browser var navigator2 = top.queryinterface(components.interfaces.nsiinterfacerequestor).getinterface(components.in...
...ces.nsidocshelltreeitem); var parent = docshelltreeitem.parent; var ds = parent.queryinterface(components.interfaces.nsidocshell); // create the preview taskbar.createtaskbartabpreview(ds, {}); gettaskbarprogress() gets the taskbar progress for a window. nsitaskbarprogress gettaskbarprogress( in nsidocshell shell ); parameters shell the nsidocshell used to find the toplevel window. return value an nsitaskbarprogress. gettaskbarwindowpreview() returns the taskbar preview for the window whose top level is identified by nsidocshell. nsitaskbarwindowpreview gettaskbarwindowpreview( in nsidocshell shell ); parameters shell an nsidocshell object to use to find the top-level window. return value an nsitaskbarwindowpreview object for the window's preview. setgroupidforwindow() set the grou...
nsIXULSortService
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. used internally for insertion sorting. void insertcontainernode( in nsirdfcompositedatasource...
... in boolean anotify ); parameters db sortstateptr root trueparent container node anotify sort() sort the contents of the widget containing anode using asortkey as the comparison key, and asorthints as how to sort. void sort( in nsidomnode anode, in astring asortkey, in astring asorthints ); parameters anode a node in the xul widget whose children are to be sorted. ...
...de anode, in astring asortkey, in astring asorthints ); parameters anode a node in the xul widget whose children are to be sorted. asortkey the value to be used as the comparison key. ...
nsIXULTemplateBuilder
luated after a rule has matched. templates may generate content recursively, using the previous iteration's results as reference point to invoke the same queries. since the reference point is different, different output will typically be generated. the reference point nsixultemplateresult object for the first iteration is determined by calling the query processor's translateref() method using the value of the root node's ref attribute. this object may be retrieved later via the builder's rootresult property. for convenience, each reference point as well as all results implement the nsixultemplateresult interface, allowing the result objects from each iteration to be used directly as the reference points for the next iteration. when using multiple queries, each may generate results with the same...
...o change errors throws ns_error_null_pointer if aresult is null getresultforid() returns the result for a given id. only one such result is returned and is always the result with that id associated with the active match. this method will return null is there is no result for the id. nsixultemplateresult getresultforid( in astring aid ); parameters aid the id to return the result for return value the result for the given id. getresultforcontent() retrieves the result corresponding to a generated element, or null is there isn't one. nsixultemplateresult getresultforcontent( in nsidomelement aelement ); parameters acontent element to result the result of return value the result for the specified element. hasgeneratedcontent() determines whether or not the node has content generated for ...
... or not the node has content generated for it. this method is intended to be called only by the rdf query processor. if atag is set, the content must have a tag name that matches atag. atag may be ignored for builders that don't generate real dom content. boolean hasgeneratedcontent( in nsirdfresource anode, in nsiatom atag ); parameters anode node to check. atag tag that must match. return value returns true if the node has content generated for it; otherwise returns false. addrulefilter() adds a rule filter for a given rule, which may be used for specialized rule filtering. any existing filter on the rule is removed. the default conditions specified inside the <rule> tag are applied before the rule filter is applied, meaning that the filter may be used to further filter out results but ...
nsIXULWindow
ly. xulbrowserwindow nsixulbrowserwindow provides access to the xulbrowserwindow object offering a way for the browser to update the user interface of the enclosing xul window. zlevel unsigned long one of the z level constants below. on some platforms, windows with a higher zlevel will be kept above windows with a lower zlevel. constants constant value description lowestz 0 loweredz 4 the z level of an independent window opened with the "alwayslowered" chrome flag. normalz 5 the default z level of an independent window. raisedz 6 the z level of an independent window opened with the "alwaysraised" chrome flag. highestz 9 methods addchildwindow() tell this ...
...ase.) aalert true to move the window to an alert position, generally centered horizontally and 1/3 down from the top. createnewwindow() create a new window. nsixulwindow createnewwindow( in print32 achromeflags, in nsiappshell aappshell ); parameters achromeflags see nsiwebbrowserchrome. aappshell the app shell passed to nsiappshellservice's createtoplevelwindow method. return value the newly minted window. in the case of a content window, the function creates a browser window and waits for it to load. you can then load a document into the window's primary content shell. getcontentshellbyid() the content shell specified by the supplied id. note: that this is a docshell tree item and therefore can not be assured of what object it is. it could be an editor, a docshell, or ...
...sured of what object it is. it could be an editor, a docshell, or a browser object. or down the road any other object that supports being a docshelltreeitem query accordingly to determine the capabilities. nsidocshelltreeitem getcontentshellbyid( in wstring id ); parameters id the id of the content shell, which is the same as the "type" attribute on the containing frame element. return value the tree item corresponding to the given id, if any. removechildwindow() tell this window that it has lost a child xul window. note that xul windows do not currently track child xul windows. void removechildwindow( in nsixulwindow achild ); parameters achild the child window being removed. showmodal() shows the window as a modal window. that is, ensures that it is visible and runs ...
NS_StringCopy
removed by bug 1332639 « xpcom api reference summary the ns_stringcopy function copies the value from one nsastring instance to another. this is a low-level api. #include "nsstringapi.h" nsresult ns_stringcopy( nsastring& adeststring, const nsastring& asrcstring ); parameters adeststring [in] a nsastring instance to be modified. asrcstring [in] a nsastring instance containing the new string value. return values the ns_stringcopy function returns ns_ok if successful. otherwise, it returns an error code. remarks this function is designed to allow the implementation to efficiently assign the same value to two string objects. the implementation may employ reference counting techniques to optimize this operation. example code /* attribute acstring valu...
...see bug 239123 for details. ...
...s_stringcopy function returns ns_ok if successful. otherwise, it returns an error code. remarks this function is designed to allow the implementation to efficiently assign the same value to two string objects. the implementation may employ reference counting techniques to optimize this operation. example code /* attribute acstring value; */ ns_imethodimp mycomponent::getvalue(nsastring& avalue) { return ns_stringcopy(avalue, mvalue); } ns_imethodimp mycomponent::setvalue(const nsastring& avalue) { return ns_stringcopy(mvalue, avalue); } history this function was frozen for mozilla 1.7. see bug 239123 for details. see also nsastring ...
Setting HTTP request headers
lo: world" header to the request httpchannel.setrequestheader("x-hello", "world", false); in the example code above we have a variable named httpchannel which points to an object implementing nsihttpchannel. (this variable could have been named anything though.) the setrequestheader method takes 3 parameters. the first parameter is the name of the http request header. the second parameter is the value of the http request header. and for now, just ignore the third parameter, and just always make it false. in our example code, the http request header that we added is named x-hello and the value of this http request header is world. note: if you are making up your own http header, you must put a x- in front of the name. (in our example, our made up http header is x-hello and not hello because w...
...request observer per application (and not one per window). this means that you should put the observer's implementation in an xpcom component instead of an overlay. if you want to support gecko2 (firefox4) you need to register your javascript component as described here: https://developer.mozilla.org/en/xpcom/xpcom_changes_in_gecko_2.0#javascript_components. ...
...gmessage(text); } function myhttplistener() { } myhttplistener.prototype = { observe: function(subject, topic, data) { if (topic == "http-on-modify-request") { log("----------------------------> (" + subject + ") mod request"); var httpchannel = subject.queryinterface(components.interfaces.nsihttpchannel); httpchannel.setrequestheader(headername, headervalue, false); return; } if (topic == "profile-after-change") { log("----------------------------> profile-after-change"); var os = components.classes["@mozilla.org/observer-service;1"] .getservice(components.interfaces.nsiobserverservice); os.addobserver(this, "http-on-modify-request", false); return; ...
nsIMsgCloudFileProvider
nt. managementurl acstring readonly: a chrome url for an xhtml page displayed within the filelink preferences dialog, used for displaying and setting provider-specific settings once the account has already been set up. this url should not point to external web content. fileuploadsizelimit long readonly: the upper size limit in bytes for a file to be uploaded. if this value is not known, returns -1. remainingfilespace long long readonly: the remaining storage space available for this account in bytes. if this value is not known, returns -1. filespaceused long long readonly: the total amount of space used by this account. if this value is not known, returns -1. lasterror acstring readonly: the last error message received f...
... autherr 0x8055001e returned when authorizing has failed. uploaderr 0x8055311a returned when uploading has failed for an unknown reason. ...
...n nsilocalfile afile, in nsirequestobserver acallback); parameters afile the file to be uploaded. acallback the nsirequestobserver callback to receive request start and stop notices. urlforfile() returns the url for a file that has been uploaded. acstring urlforfile(in nsilocalfile afile); parameters afile the previously uploaded file to get the url for. return value the string representation of the url for the uploaded file. if the file was not uploaded with this instance of the nsimsgcloudfileprovider, returns undefined. cancelfileupload() cancels an upload currently in progress for some nsilocalfile. void cancelfileupload(in nsilocalfile afile); parameters afile the nsilocalfile that is currently being uploaded to cancel. refreshuserinfo() ref...
Mail event system
otifydeleteormovemessages ondeleteormovemessages sample code in this example, a listener will be set up to be notified when the message count changes in a folder: // our variable to know if the listener fired var listenerhasfired = false; var totalmessageslistenerhasfired = false; // the listening function that will react to changes function myonintpropertychanged(item, property, oldvalue, newvalue) { listenerhasfired=true; var propertystring = property.getunicode(); dump("onintpropertychanged has fired with property + " + propertystring + "!\n"); if (propertystring == "totalmessages") { totalmessageslistenerhasfired=true; //now show us visually var folder = item.queryinterface(components.interfaces.nsimsgfolder); dump("the folder " + folder.pret...
...true; var propertystring = property.getunicode(); dump("onintpropertychanged has fired with property + " + propertystring + "!\n"); if (propertystring == "totalmessages") { totalmessageslistenerhasfired=true; //now show us visually var folder = item.queryinterface(components.interfaces.nsimsgfolder); dump("the folder " + folder.prettyname + " now has " + newvalue + " messages."); } else if (propertystring == "testproperty") { dump("recieved integer test property fired on folder " + folder.prettyname + " with values " + oldvalue + " and " + newvalue + "\n"); } // set up the folder listener to point to the above function var folderlistener = { onitemadded: function(parent, item, viewstring) {}, onitemremoved: function(parent, item,...
... " + newvalue + "\n"); } // set up the folder listener to point to the above function var folderlistener = { onitemadded: function(parent, item, viewstring) {}, onitemremoved: function(parent, item, viewstring) {}, onitempropertychanged: function(parent, item, viewstring) {}, onitemintpropertychanged: myonintpropertychanged, onitemboolpropertychanged: function(item, property, oldvalue, newvalue) {}, onitemunicharpropertychanged: function(item, property, oldvalue, newvalue) {}, onitempropertyflagchanged: function(item, property, oldflag, newflag) {}, onitemevent: function(item, event) = {}, onfolderloaded: function(afolder) = {} ondeleteormovemessagescompleted: function( afolder) = {}, } // now register myself as a listener on every mail folder var mailsession = comp...
Using the Multiple Accounts API
user_pref("mail.server.server4.hostname", "news.mozilla.org"); user_pref("mail.identity.id1.useremail", "alecf@mywork.com"); user_pref("mail.identity.id2.useremail", "alecf@myisp.com"); user_pref("mail.identity.id3.useremail", "alecfnospam@myisp.com"); there is a lot of information missing here of course. the keys used here are the account1, server1, id1, etc. these keys are listed in the value of some of these preferences, such as "mail.accountmanager.accounts", and are used to construct the preference names, such as "mail.account.account1.server". this the way accounts know which server and which identities they contain. creating new accounts it is possible to create and modify accounts through the account manager api. the account manager is responsible for the creation of all acco...
...r api. the account manager is responsible for the creation of all accounts, incoming servers, and identities. you should not use createinstance() to create any of the relevant objects because the account manager needs to keep track of all of these objects as they are created. to create accounts using the api, you should do the following: create a fresh identity with createidentity(); assign values to the various identity properties as necessary. create a fresh incoming server with createincomingserver(). you will need to pass it the server type as a string, from the list above. assign values to the various server properties as necessary. the most important properties here are the username and the hostname. create a fresh account with createaccount(); assign the server to the accou...
...eference: mail.server.server.max_cached_connections - integer, max number of connections left open to the server preference: mail.server.server.empty_trash_threshhold integer, (should not be imap-specific) max k of wasted diskspace before we purge a folder preference: mail.server.server.delete_model - integer, delete model (move to trash, imap delete, purge immediately, not sure of values) preference: mail.server.server.timeout - integer, number of minutes a connection is idle before we drop it preference: mail.server.server.capability - list of capabilities of this server preference: mail.server.server.namespace.public - the server's namespace for public folders preference: mail.server.server.namespace.personal - the server's namespace for personal folders pr...
Declaring types
the ctypes object offers a number of constructor methods that let you declare types. every type is represented by a ctype object, which, in turn, provides a constructor method you can call to define values of those types. each type you declare using js-ctypes corresponds to a compatible c declaration. types are declared in terms of other, already defined types. at the core of all this is a set of predefined types provided by js-ctypes. these are all primitive types, upon which all other types are eventually based. ...
...ine values of those types. each type you declare using js-ctypes corresponds to a compatible c declaration. types are declared in terms of other, already defined types. at the core of all this is a set of predefined types provided by js-ctypes. these are all primitive types, upon which all other types are eventually based. primitive types primitive types are those types that represent a single value in memory, as opposed to arrays, structures, or functions. you can define values of these types without declaring new types. ...
... is a set of predefined types provided by js-ctypes. these are all primitive types, upon which all other types are eventually based. primitive types primitive types are those types that represent a single value in memory, as opposed to arrays, structures, or functions. you can define values of these types without declaring new types. for example, to define a new 32-bit integer variable with the value 5: var i = ctypes.int32_t(5); you can then pass a pointer to this value to a c function that requires a pointer to a 32-bit integer, like this: some_c_function(i.address()); declaring new primitive types there are times when you want to create new types that are simply new names for existing primitive types. for example, on windows, you may wish to be able to use the windows-standard dword...
FunctionType
functiontype represents c function. syntax returns a new ctype object describing a c function. ctype functiontype( abi, returntype[, argtype1, ...] ); parameters abi the abi type for the function; this is one of the abi constants. returntype a ctype indicating the type of the value returned by the function. argtype1... argtypen zero or more ctype objects indicating the types of each of the parameters passed into the c function. return value a ctype describing the function type. the equivalent c function type declaration would be: returntype (*) ([argtype1, ..., argtypen]); exceptions thrown typeerror abi is not a valid abi constants, or returntype or any of the argument types are not valid ctype objects. properties property type descriptio...
..., this is simply the string that was passed to the constructor. for other function, pointer, and array types, this should be a valid c type expression. ptr ctype returns a ctype representing the data type "pointer to this type". this is the result of calling ctypes.pointertype(the_type). read only. size number the size of the type, in bytes. this is the same value as the c sizeof. read only. note: ctypes.void_t.size is undefined. method overview methods inherited from ctype ctype array([n]) string tosource() string tostring() functiontype cdata functiontype cdata cannot be constructed. function pointer is created with functiontype.ptr. cdata functiontype.ptr([func]); functiontype is functiontype ctype...
... note: ctypes.void_t.size is undefined. method overview methods inherited from ctype ctype array([n]) string tosource() string tostring() functiontype cdata functiontype cdata cannot be constructed. function pointer is created with functiontype.ptr. cdata functiontype.ptr([func]); functiontype is functiontype ctype. parameters func a pointer value or javascript function. return value a cdata representing the newly allocated function pointer. exceptions thrown typeerror func is not either pointer value or javascript function. see also ctype cdata abi library type conversion ...
PKCS #11 Netscape Trust Objects - Network Security Services
ity trust root, and confers its trust to other certificates. certificate reference each trust object contains a reference to a certificate. there are two ways to refer to a certificate depending on whether that certificate is self-signed (like a certificate authority) or signed by another trusted certificate. certificates used as a root of trust are referred to by the complete hash of the der value of the certificate. certificates in a trust chain whose issuer is trusted are referred to by the der value of the issuer field, and the serial number. pkcs#11 representation trust objects are stored as objects on a pkcs#11 token. although these are specific to a certificate, they do not need to be stored on the same token as the certificate. trust objects are of the class cko_netscape_trust and...
...nt key usage purpose. cka_trust_key_agreement ck_trust level of trust for key-agreement key usage purpose. cka_trust_key_cert_sign ck_trust level of trust for certificate signing key usage purpose. cka_trust_key_crl_sign ck_trust level of trust for crl signing key usage purpose. ck_trust is a ck_ulong which can contain one several values. it represents the level of trust. level of trust values. value description ck_untrusted explicitly untrusted. ck_unknown trust is unknown and should be determined elsewhere. ck_trusted explicitly trusts the certificate referred to in the trust object. ckt_trusted_delegator trusts the certificate as a certificate authority, and dele...
... explicitly untrusted. ck_unknown trust is unknown and should be determined elsewhere. ck_trusted explicitly trusts the certificate referred to in the trust object. ckt_trusted_delegator trusts the certificate as a certificate authority, and delegates trust (for the purpose) to other signed certificates. definitions definitions for all of the above values are defined in pkcs11n.h in the nss source. ...
Initialization and Destruction - Plugins
ization process, you can call other methods, such as npn_memalloc and npn_status, from np_initialize. instance creation after initialization, the plug-in instance is created. more than one instance of the same plug-in can exist if a single page contains multiple embedded plug-ins, or if several browser windows are open and display the same data type. at this point, a plug-in can call the npn_setvalue function to specify whether it is windowed (the default) or windowless. plug-in instances are created with npp_new and destroyed with npp_destroy. npp_new informs the plug-in of the creation of a new instance with the specified mime type. you can allocate instance-specific private data at this time. nperror npp_new(npmimetype plugintype, npp instance, uint16 mode, ...
...ll means that the instance was created by a separate file and is the primary content in the window. the next three parameters pass parameters from the embed element that called the plug-in. the argc parameter is the number of html arguments in the element. it determines the number of attributes in the arrays specified by the argn and argv parameters. the arguments in the embed element are name-value pairs made up of the attribute name (for example, align) and its value (for example, top). the argn array contains the attribute names; the argv array contains the attribute values. the browser ignores any nonstandard attributes in an embed element, so the web page author can use the arg parameters to specify private attributes defined for a particular plug-in. for example, the following embed e...
...dard attributes in an embed element, so the web page author can use the arg parameters to specify private attributes defined for a particular plug-in. for example, the following embed element has the standard attributes src, height, and width and the private attribute loop: <embed src="movie.avi" height="100" width="100" loop="true"> with the embed element in the example, the browser passes the values in argv to the plug-in instance: argc = 4 argn = { "src", "height", "width", "loop" } argv = { "movie.avi", "100", "100", "true" } the saved parameter allows an instance of a plug-in to save its data and, when the instance is destroyed, pass the data to the next instance of the plug-in at the same url. the data is saved in the history list. as long as the plug-in still appears in this list, t...
Accessibility Inspector - Firefox Developer Tools
ated <label>. on the right-hand side, you can see further information about the currently selected item. the listed properties are as follows: name — the item's name, as described above. role — the item's role, as described above. actions — a list of actions that can be performed on the item, for example, a pushbutton would have "press" listed, while a link would have "jump" listed. value — the value of the item. this can mean different things depending on the type of the item; for example, a form input (role: entry) would have a value of whatever is entered in the input, whereas a link's value would be the url in the corresponding <a> element's href. domnode — the type of dom node that the item in the accessibility tree represents. you can click on the "target" icon that com...
...description provided on the element, usually by the content of a title attribute. keyboardshortcut — any keyboard shortcut that is available to activate the element, as specified in an accesskey attribute. note that this works correctly as of firefox 62 (bug 1467381). childcount — the number of child items the current item has in the accessibility tree hierarchy. indexinparent — an index value indicating what number child the item is, inside its parent. if the item is the first item inside its parent, it has a value of 0. if it is the second, it has a value of 1. and so on. states — a list of the different accessibility-relevant states that can apply to the current item. for example, one of the links in one demo has states of focusable, linked, selectable text, opaque, enabled, and ...
...rast ratios. for example: the color contrast in the image above is 2.86, so potentially not enough contrast to make it easy to read. notice the warning symbol that indicates that the contrast fails to meet the acceptable contrast ratio. as of firefox 65, viewing this information for some foreground text that has a complex background image (e.g. a gradient) gives you a range of color contrast values. for example: in this example, the contrast ranges from 4.72 to 5.98. the numbers are followed by aaa and a checkmark in green, indicating that the large text has a contrast ratio of 4.5:1 or more, meeting the criteria for enhanced contrast, or level aaa. see color contrast for more information on color contrast. accessibility picker like the element picker button on the page inspector, th...
Examine, modify, and watch variables - Firefox Developer Tools
r details on what these property descriptors mean. you can filter the variables that are displayed, either by using the "*" modifier in the script filter, or by typing into the filter variables box, if you have enabled this in the debugger settings. ...
...you can then examine the results of these expressions. ...
... a watch expression, click in the box that says "add watch expression" and enter a javascript expression whose output you'd like to monitor as you step through code. then start running your code. the watch expression does nothing until you begin to step through your code, so nothing happens until you reach a breakpoint. at that point, a box showing your active watch expressions and their current values will appear: you can step through your code, watching the value of the expression as it changes; each time it does, the box will flash briefly yellow. you can remove a watch expression by clicking the "x" icon next to it, and, of course, you can have more than one watch expression at a time. ...
Debugger.Script - Firefox Developer Tools
thus, we use a/b to refer to theb defined withina, and a< to refer to a function that occurs somewhere within an expression that is assigned toa. for example: function h() { var i = function() {}; // display name: h/i f(function () {}); // display name: h/< } var s = f(function () {}); // display name: s< if the instance refers to webassembly code,...
...fers to the global directly, not via a wrapper or a windowproxy (“outer window”, in firefox). if the instance refers to webassembly code, throw a typeerror. format if the instance refers to a jsscript, "js". if the instance refers to webassembly code, "wasm". function properties of the debugger.script prototype object the functions described below may only be called with a this value referring to a debugger.script instance; they may not be used as methods of other kinds of objects. getalloffsets() if the instance refers to a jsscript, return an arrayl describing the relationship between bytecode instruction offsets and source code positions in this script.l is sparse, and indexed by source line number. if a source line numberline has no code, thenl has noline property. ...
...fers to a jsscript, set a breakpoint at the bytecode instruction atoffset in this script, reporting hits to the hit method ofhandler. ifoffset is not a valid offset in this script, throw an error. when execution reaches the given instruction, spidermonkey calls the hit method ofhandler, passing a debugger.frame instance representing the currently executing stack frame. the hit method’s return value should be a resumption value, determining how execution should continue. any number of breakpoints may be set at a single location; when control reaches that point, spidermonkey calls their handlers in an unspecified order. any number of breakpoints may use the samehandler object. breakpoint handler method calls are cross-compartment, intra-thread calls: the call takes place in the same thr...
Eyedropper - Firefox Developer Tools
the eyedropper is new in firefox 31. the eyedropper tool enables you to select colors in the current page. it works like a magnifying glass over the page, enabling you to select with pixel precision. ...
...rs in the current page. it works like a magnifying glass over the page, enabling you to select with pixel precision. underneath the magnifying glass it shows the color value for the current pixel using whichever scheme you've selected in settings > inspector > default color unit: you can use it in one of two ways: to select a color from the page and copy it to the clipboard to change a color value in the inspector's rules view to a color you've selected from the page copying a color to the clipboard open the eyedropper in one of these two ways: select "eyedropper" under the "web developer" menu open the page inspector tab and click the eyedropper button in its toolbar as you move the mouse around the page you'll see the current color value in the eyedropper change. clicking copies...
... rules view to a color you've selected from the page copying a color to the clipboard open the eyedropper in one of these two ways: select "eyedropper" under the "web developer" menu open the page inspector tab and click the eyedropper button in its toolbar as you move the mouse around the page you'll see the current color value in the eyedropper change. clicking copies the current color value to the clipboard. changing a color value in the rules view color values appearing in the inspector's rules view have color samples next to them: clicking the sample shows a color picker popup. from firefox 31, the popup contains an eyedropper icon: click this icon to activate the eyedropper. now, when you click the eyedropper, the color in the rules view is set to the color you selected. ...
Work with animations - Firefox Developer Tools
s, you'll see details of all the properties that were changed in the animation. for example, try clicking on the bar for img#icon's animation: this is telling us that two properties were modified: filter and transform. each dot represents an entry for that property in the set of keyframes used for the animation. both properties were initialized at 0ms and finalized at 750ms. ...
... for example, try clicking on the bar for img#icon's animation: this is telling us that two properties were modified: filter and transform. each dot represents an entry for that property in the set of keyframes used for the animation. both properties were initialized at 0ms and finalized at 750ms. filter was given a value at 250ms and transform at 500ms. ...
...nvolved two elements, span#note and img#icon. hovering over these selectors, we can see that those elements are, respectively, the browser name "firefox developer edition" and the browser icon. the img#icon animation: animated the filter and transform properties, to scale the icon and color it lasted 750ms, had an enddelay of 100ms used the compositor thread was given an easing value of ease-in: you can see this by the concave shape of the green bar. the span#note animation: animated the width and opacity properties, to make the name gradually appear lasted 500ms, and had a delay of 150ms was given an easing value of ease-out: you can see this by the convex shape of the green bar. animation playback at the top of the animation inspector: there a...
Responsive Design Mode - Firefox Developer Tools
lect when in responsive design mode and the orientation (portrait or landscape) is saved between sessions. information for the selected device is centered over the display. from left to right, the display includes: name of the selected device - a drop-down list that includes whatever devices you have selected from the device settings screen. screen size - you can edit the width and height values to change the device size by editing a number directly or using the up and down keys to increase or decrease the value by 1 pixels on each keypress or hold and shift to change the value by 10. the mouse wheel changes the size values by 1 pixel at a time you can also change the device's screen size by grabbing the bottom-right corner of the viewport and dragging it to the size you want. ...
...evice: screen size device pixel ratio (the ratio of device physical pixels to device-independent pixels) touch event simulation additionally, firefox sets the user-agent http request header to identify itself as the default browser on the selected device. for example, if you've selected an iphone, then firefox identifies itself as safari. the navigator.useragent property is set to the same value. ...
...you can also define a custom device, as described below. creating custom devices you can create and save custom devices in responsive design mode by clicking the add custom device button. ...
ANGLE_instanced_arrays.drawElementsInstancedANGLE() - Web APIs
renders primitives from array data like the gl.drawelements() method. in addition, it can execute multiple instances of a set of elements. note: when using webgl2, this method is available as gl.drawelementsinstanced() by default. syntax void ext.drawelementsinstancedangle(mode, count, type, offset, primcount); parameters mode a glenum specifying the type primitive to render. possible values are: gl.points: draws a single dot. gl.line_strip: draws a straight line to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. count a glsizei specifying the n...
...ine to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. count a glsizei specifying the number of elements to be rendered. type a glenum specifying the type of the values in the element array buffer. possible values are: gl.unsigned_byte gl.unsigned_short when using the oes_element_index_uint extension: gl.unsigned_int offset a glintptr specifying an offset in the element array buffer. must be a valid multiple of the size of the given type. primcount a glsizei specifying the number of instances of the set of elements to execute. r...
...he element array buffer. possible values are: gl.unsigned_byte gl.unsigned_short when using the oes_element_index_uint extension: gl.unsigned_int offset a glintptr specifying an offset in the element array buffer. must be a valid multiple of the size of the given type. primcount a glsizei specifying the number of instances of the set of elements to execute. return value none. exceptions if mode is not one of the accepted values, a gl.invalid_enum error is thrown. if offset is a invalid multiple of the size of the given type, a gl.invalid_operation error is thrown. if count or primcount are negative, a gl.invalid_value error is thrown. examples var ext = gl.getextension('angle_instanced_arrays'); ext.drawelementsinstancedangle(gl.points, 2, gl.unsigned_...
AddressErrors.languageCode - Web APIs
an object based on addresserrors includes a languagecode property when the address's languagecode property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. ...
... an object based on addresserrors includes a languagecode property when the address's languagecode property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. ...
...aymentaddress object's languagecode property could not be validated, this property contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. this validation might be as simple as ensuring the text of the string is compliant with the syntax defined in bcp-47, or as detailed as actually verifying that the specified string matches a value from a database. if the languagecode value was validated successfully, this property is not included in the addresserrors object. specifications specification status comment payment request apithe definition of 'addresserrors.languagecode' in that specification. candidate recommendation initial definition. ...
AddressErrors.organization - Web APIs
an object based on addresserrors includes an organization property when the address's organization property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. ...
... an object based on addresserrors includes an organization property when the address's organization property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. ...
...ed, this property contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. for example, if validation simply ensures that only permitted characters are included in the organization's name, this might return a string such as "the organization name may only contain the letters a-z, digits, spaces, and commas." if the organization value was validated successfully, this property is not included in the addresserrors object. specifications specification status comment payment request apithe definition of 'addresserrors.organization' in that specification. candidate recommendation initial definition. ...
AddressErrors - Web APIs
which is compatible with paymentmethoddata, and defaultpaymentdetails, which is a paymentdetailsupdate object. let supportedhandlers = [ { supportedmethods: "basic-card", data: { supportednetworks: ["visa", "mastercard", "amex", "discover"], supportedtypes: ["credit", "debit"] } } ]; let defaultpaymentdetails = { total: {label: 'donation', amount: {currency: 'usd', value: '65.00'}}, displayitems: [ { label: 'original donation amount', amount: {currency: 'usd', value: '65.00'} } ], shippingoptions: [ { id: 'standard', label: 'standard shipping', amount: {currency: 'usd', value: '0.00'}, selected: true } ] }; supportedhandlers describes the supported payment handlers and the details for those. in this exa...
...; shippingaddresserrors.country = invalidcountryerror; updatedetails = { error: genericaddresserror, shippingaddresserrors, ...defaultpaymentdetails }; } ev.updatewith(updatedetails); } the shippingaddresschange event doesn't receive the paymentrequest object directly, so we fetch it from the target property of the event. if the request's shippingaddress has a value for country which isn't in the array validcountries, we generate the error. that's done by removing all shipping options currently set on the request, then set up an object named shippingaddresserrors which contains a country property which is an error message describing why the stated country isn't being permitted as a value. then a paymentdetailsupdate object is created with its error set to ...
...r. that's done by removing all shipping options currently set on the request, then set up an object named shippingaddresserrors which contains a country property which is an error message describing why the stated country isn't being permitted as a value. then a paymentdetailsupdate object is created with its error set to a generic message about address errors and with the reset of the object's values taken from shippingaddresserrors, and, using "...defaultpaymentdetails" as the final entry in the object, the remeainder of the properties' values are taken from defaultpaymentdetails. the final step is to call the event's updatewith() method, passing along the updatedetails object. this lets the payment request api know to present the specified error or errors but to allow the user to keep try...
AesCtrParams - Web APIs
pto.encrypt(), subtlecrypto.decrypt(), subtlecrypto.wrapkey(), or subtlecrypto.unwrapkey(), when using the aes-ctr algorithm. aes is a block cipher, meaning that it splits the message into blocks and encrypts it a block at a time. in ctr mode, every time a block of the message is encrypted, an extra block of data is mixed in. this extra block is called the "counter block". ...
...the nonce part of the block stays the same for every block in the message. each time a new message is to be encrypted, a new nonce is chosen. nonces don't have to be secret, but they must not be reused with the same key. a counter. ...
... block is encrypted. essentially: the nonce should ensure that counter blocks are not reused 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. ...
AnalyserNode.getFloatFrequencyData() - Web APIs
if you need higher performance and don't care about precision, you can use analysernode.getbytefrequencydata() instead, which works on a uint8array. ...
... if you need higher performance and don't care about precision, you can use analysernode.getbytefrequencydata() instead, which works on a uint8array. ...
...octx.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 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...
AnalyserNode.smoothingTimeConstant - Web APIs
the smoothingtimeconstant property of the analysernode interface is a double value representing the averaging constant with the last analysis frame. it's basically an average between the current buffer and the last buffer the analysernode processed, and results in a much smoother set of value changes over time. syntax var smoothvalue = analysernode.smoothingtimeconstant; analysernode.smoothingtimeconstant = newvalue; value a double within the range 0 to 1 (0 meaning no time averaging). the default value is 0.8. if 0 is set, there is no averaging done, whereas a value of 1 means "overlap the previous and current buffer quite a lot while computing the value", which essentially smoothes the changes across analysernode.getfloatfrequencydata/analysernode.getbytefrequencydata calls. in techni...
... 0 to 1 (0 meaning no time averaging). the default value is 0.8. if 0 is set, there is no averaging done, whereas a value of 1 means "overlap the previous and current buffer quite a lot while computing the value", which essentially smoothes the changes across analysernode.getfloatfrequencydata/analysernode.getbytefrequencydata calls. in technical terms, we apply a blackman window and smooth the values over time. the default value is good enough for most cases. note: if a value outside the range 0–1 is set, an index_size_err exception is thrown. example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input. for...
...ta repeatedly and draw a "winamp bargraph style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). if you are curious about the effect the smoothingtimeconstant() has, 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; ... analyser.fftsize = 256; var bufferlength = analyser.frequencybincount; console.log(bufferlength); var dataarray = new uint8array(bufferlength); canv...
AnimationEvent() - Web APIs
e : afloat, pseudoelement: apseudoelementname}); parameters the animationevent() constructor also inherits arguments from event(). type a domstring representing the name of the type of the animationevent. it is case-sensitive and can be: 'animationstart', 'animationend', or 'animationiteration'. ...
...ration'. animationname optional a domstring containing the value of the animation-name css property associated with the transition. it defaults to "". elapsedtime optional a float giving the amount of time the animation has been running, in seconds, when this event fired, excluding any time the animation was paused. for an "animationstart" event, elapsedtime is 0.0 unless there was a negative value for animation-delay, in which case the event will be fired with elapsedtime containing (-1 * delay). it defaults to 0.0. pseudoelement optional is a domstring, starting with "::", containing the name of the pseudo-element the animation runs on. ...
... specifications specification status comment css animationsthe definition of 'animationevent()' in that specification. ...
AnimationEvent.initAnimationEvent() - Web APIs
gress of being removed from most implementations. do not use this method; instead, use the standard constructor, animationevent(), to create a synthetic animationevent. syntax animationevent.initanimationevent(typearg, canbubblearg, cancelablearg, animationnamearg, elapsedtimearg); parameters typearg a domstring identifying the specific type of animation event that occurred. the following values are allowed: value meaning animationstart the animation has started. animationend the animation completed. animationiteration the current iteration just completed. canbubblearg a boolean flag indicating if the event can bubble (true) or not (false). cancelablearg a boolean flag indicating if the event associate...
...ion has started. animationend the animation completed. animationiteration the current iteration just completed. canbubblearg a boolean flag indicating if the event can bubble (true) or not (false). cancelablearg a boolean flag indicating if the event associated action can be avoided (true) or not (false). ...
...(true) or not (false). animationnamearg a domstring containing the value of the animation-name css property associated with the transition. elapsedtimearg a float indicating the amount of time the animation has been running, in seconds, as of the time the event was fired, excluding any time the animation was paused. for an "animationstart" event, elapsedtime is 0.0 unless there was a negative value for animation-delay, in which case the event will be fired with elapsedtime containing (-1 * delay). ...
AudioBuffer.copyFromChannel() - Web APIs
at32array. syntax myarraybuffer.copyfromchannel(destination, channelnumber, startinchannel); parameters destination a float32array to copy the channel's samples to. channelnumber the channel number of the current audiobuffer to copy the channel data from. startinchannel optional an optional offset into the source channel's buffer from which to begin copying samples. ...
...ber, startinchannel); parameters destination a float32array to copy the channel's samples to. channelnumber the channel number of the current audiobuffer to copy the channel data from. startinchannel optional an optional offset into the source channel's buffer from which to begin copying samples. if not specified, a value of 0 (the beginning of the buffer) is assumed by default. return value undefined. ...
...l's samples to. channelnumber the channel number of the current audiobuffer to copy the channel data from. startinchannel optional an optional offset into the source channel's buffer from which to begin copying samples. if not specified, a value of 0 (the beginning of the buffer) is assumed by default. return value undefined. exceptions indexsizeerror one of the input parameters has a value that is outside the accepted range: the value of channelnumber specifies a channel number which doesn't exist (that is, it's greater than or equal to the value of numberofchannels on the channel). the value of startinchannel is outside the current range of samples that already exist in the source buffer; that is, it's greater than its current length. example this example creates a ne...
AudioBufferSourceNode.detune - Web APIs
the detune property of the audiobuffersourcenode interface is a k-rate audioparam representing detuning of oscillation in cents. for example, values of +100 and -100 detune the source up or down by one semitone, while +1200 and -1200 detune it up or down by one octave. syntax var source = audioctx.createbuffersource(); source.detune.value = 100; // value in cents note: though the audioparam returned is read-only, the value it represents is not. value a k-rate audioparam whose value indicates the detuning of oscillation in cents. example const audioctx = new audiocontext(); const channelcount = 2; const framecount = audioctx.samplerate * 2.0; // 2 seconds const myarraybuffer = audioctx.createbuffer(channelcount, framecount, audioctx.samplerate); for (let channel = 0; channel < chan...
... working draft ...
... working draft ...
AudioBufferSourceNode.start() - Web APIs
dio data contained in the buffer, or to begin playback immediately. syntax audiobuffersourcenode.start([when][, offset][, duration]); parameters when optional the time, in seconds, at which the sound should begin to play, in the same time coordinate system used by the audiocontext. if when is less than (audiocontext.currenttime, or if it's 0, the sound begins to play at once. ...
... is less than (audiocontext.currenttime, or if it's 0, the sound begins to play at once. the default value is 0. offset optional an offset, specified as the number of seconds in the same time coordinate system as the audiocontext, to the time within the audio buffer that playback should begin. for example, to start playback halfway through a 10-second audio clip, offset should be 5. the default value, 0, will begin playback at the beginning of the audio buffer, and offsets past the end of the audio which will be played (based on the audio buffer's duration and/or the loopend property) are silently clamped to the maximum value allowed. the computation of the offset into the sound is performed using the sound buffer's natural sample rate, rather than the current playback rate, so even if the so...
... the midway point through a 10-second audio buffer is still 5. duration optional the duration of the sound to be played, specified in seconds. if this parameter isn't specified, the sound plays until it reaches its natural conclusion or is stopped using the stop() method. using this parameter is functionally identical to calling start(when, offset) and then calling stop(when+duration). return value undefined. exceptions typeerror a negative value was specified for one or more of the three time parameters. please don't attempt to tamper with the laws of temporal physics. invalidstateerror start() has already been called. you can only call this function once during the lifetime of an audiobuffersourcenode. examples the most simple example just starts the audio buffer playing from t...
AudioContext.createMediaStreamTrackSource() - Web APIs
atemediastreamsource(), which creates a mediastreamaudiosourcenode whose audio comes from the audio track in a specified mediastream whose id is first, lexicographically (alphabetically). syntax var audioctx = new audiocontext(); var track = audioctx.createmediastreamtracksource(track); parameters track the mediastreamtrack to use as the source of all audio data for the new node. return value a mediastreamtrackaudiosourcenode object which acts as a source for audio data found in the specified audio track. example in this example, getusermedia() is used to request access to the user's microphone. once that access is attained, an audio context is established and a mediastreamtrackaudiosourcenode is created using createmediastreamtracksource(), taking its audio from the first audio tr...
... working draft ...
... working draft ...
AudioContextOptions.latencyHint - Web APIs
the audiocontextoptions dictionary (used when instantiating an audiocontext) may contain a property named latencyhint, which indicates the preferred maximum latency in seconds for the audio context. the value is specified either as a member of the string enum audiocontextlatencycategory or a double-precision value. syntax audiocontextoptions.latencyhint = "interactive"; audiocontextoptions.latencyhint = 0.2; var latencyhint = audiocontextoptions.latencyhint; value the preferred maximum latency for the audiocontext. there are two ways this value can be specified. ...
... member of the string enum audiocontextlatencycategory or a double-precision value. syntax audiocontextoptions.latencyhint = "interactive"; audiocontextoptions.latencyhint = 0.2; var latencyhint = audiocontextoptions.latencyhint; value the preferred maximum latency for the audiocontext. there are two ways this value can be specified. the best way to specify the preferred latency is to use a value form the string enum audiocontextlatencycategory. in fact, the default value of latencyhint is "interactive" (meaning the browser should try to use the lowest possible and reliable latency it can). the value can also be specified as a double-precision floating-point value, specifying the preferred maximum latency in seconds. this provides more precise control over the balance between audio laten...
...ive" (meaning the browser should try to use the lowest possible and reliable latency it can). the value can also be specified as a double-precision floating-point value, specifying the preferred maximum latency in seconds. this provides more precise control over the balance between audio latency and device energy usage. to determine the actual latency of the context after creating it, check the value of the context's baselatency property. specifications specification status comment web audio apithe definition of 'audiocontextoptions.latencyhint' in that specification. working draft initial definition. ...
AudioContextOptions - Web APIs
the audiocontextoptions dictionary is used to specify configuration options when constructing a new audiocontext object to represent a graph of web audio nodes. it is only used when calling the audiocontext() constructor. properties latencyhint optional the type of playback that the context will be used for, as a value from the audiocontextlatencycategory enum or a double-precision floating-point value indicating the preferred maximum latency of the context in seconds. the user agent may or may not choose to meet this request; check the value of audiocontext.baselatency to determine the true latency after creating the context. samplerate optional the samplerate to be used by the audiocontext, specified in samples per second. the value may be any value supported by audiobuffer. if not sp...
...se to meet this request; check the value of audiocontext.baselatency to determine the true latency after creating the context. samplerate optional the samplerate to be used by the audiocontext, specified in samples per second. the value may be any value supported by audiobuffer. if not specified, the preferred sample rate for the context's output device is used by default. constants standard values for latencyhint the latencyhint property can be number specifying a preferred maximum latency in seconds or a string from the audiocontextlatencycategory enumerated string, which selects a standard value for a given type of audio usage: value description "balanced" the user agent should balance audio output latency and power consumption when selecting a latency value. ...
... "playback" the user agent should select a latency that will maximize playback time by minimizing power consumption at the expense of latency. useful for non-interactive playback, such as playing music. ...
AudioNode.disconnect() - Web APIs
the disconnect() method of the audionode interface lets you disconnect one or more nodes from the node on which the method is called. ...
...(destination, output, input); return value undefined parameters there are several versions of the disconnect() method, which accept different combinations of parameters to control which nodes to disconnect from. if no parameters are provided, all outgoing connections are disconnected. destination optional an audionode or audioparam specifying the node or nodes to disconnect from. if this value is an audionode, a single node is disconnected from, with any other, optional, parameters (output and/or input) further limiting which inputs and/or outputs should be disconnected. if this value is an audioparam, then the connection to that audioparam is terminated, and the node's contributions to that computed parameter become 0 going forward once the change takes effect. if no matching connecti...
...hannels). if this parameter is out-of-bound, an indexsizeerror exception is thrown. input optional an index describing which input into the specified destination audionode is to be disconnected. the index numbers are defined according to the number of input channels (see audio channels). if this parameter is out-of-bound, an indexsizeerror exception is thrown. exceptions indexsizeerror a value specified for input or output is invalid, referring to a node which doesn't exist or outside the permitted range. invalidaccesserror the node on which disconnect() was called isn't connected to the specified destination node. example var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); var oscillator = audioctx.createoscillator(); var gain...
AudioParamMap - Web APIs
the web audio api interface audioparammap represents a set of multiple audio parameters, each described as a mapping of a domstring identifying the parameter to the audioparam object representing its value. ...
... the web audio api interface audioparammap represents a set of multiple audio parameters, each described as a mapping of a domstring identifying the parameter to the audioparam object representing its value. ...
...tring identifying the parameter to the audioparam object representing its value. properties the audioparammap object is accessed as a map in which each parameter is identified by a name string which is mapped to an audioparam containing the value of that parameter. ...
AudioTrack.enabled - Web APIs
the audiotrack property enabled specifies whether or not the described audio track is currently enabled for use. if the track is disabled by setting enabled to false, the track is muted and does not produce audio. syntax isaudioenabled = audiotrack.enabled; audiotrack.enabled = true | false; value the enabled property is a boolean whose value is true if the track is enabled; enabled tracks produce audio while the media is playing. setting enabled to false effectively mutes the audio track, preventing it from contributing to the media's audio performance. example this example switches between the main and commentary audio tracks of a media element. function swapcommentarymain() { var videoelem = document.getelementbyid("main-video"); var audiotrackmain; var audiotrackcommentary; ...
...these represent the primary audio track and the commentary track. note: this example assumes that there is only one of each kind of track in the video, but this is not necessarily the case. the element's audio tracks are then scanned through using the javascript foreach() method (although the audiotracks property of a media element isn't actually a javascript arr...
...k. note: this example assumes that there is only one of each kind of track in the video, but this is not necessarily the case. the element's audio tracks are then scanned through using the javascript foreach() method (although the audiotracks property of a media element isn't actually a javascript array, it can be accessed like one for the most part). the scan looks for the tracks whose kind values are "main" and "commentary" and remembers those audiotrack objects. once those have been found, the values of the two tracks' enabled properties are exchanged, which results in swapping which of the two tracks is currently active. specifications specification status comment html living standardthe definition of 'audiotrack.enabled' in that specification. living s...
AuthenticatorAssertionResponse.userHandle - Web APIs
the userhandle read-only property of the authenticatorassertionresponse interface is an arraybuffer object which is an opaque identifier for the given user. such an identifier can be used by the relying party's server to link the user account with its corresponding credentials and other data. the same value may be found on the id property of the options.user object (used for the creation of the publickeycredential instance). ...
...tions.user object (used for the creation of the publickeycredential instance). note: an authenticatorassertionresponse instance is available on publickeycredential.response after calling navigator.credentials.get(). note: this property may only be used in top-level contexts and will not be available in an <iframe> for example. ...
...t be available in an <iframe> for example. syntax userhandle = authenticatorassertionresponse.userhandle value an arraybuffer object which is an opaque identifier for the current user. this is not human-readable and does not contain any personally identifying information (e.g. ...
BaseAudioContext.createBuffer() - Web APIs
you should be using. syntax var buffer = baseaudiocontext.createbuffer(numofchannels, length, samplerate); parameters note: for an in-depth explanation of how audio buffers work, and what these parameters mean, read audio buffers: frames, samples and channels from our basic concepts guide. numofchannels an integer representing the number of channels this buffer should have. the default value is 1, and all user agents must support at least 32 channels. length an integer representing the size of the buffer in sample-frames (where each sample-frame is the size of a sample in bytes multiplied by numofchannels). to determine the length to use for a specific number of seconds of audio, use numseconds * samplerate. samplerate the sample rate of the linear audio data in sample-frames per...
...ific number of seconds of audio, use numseconds * samplerate. samplerate the sample rate of the linear audio data in sample-frames per second. all browsers must support sample rates in at least the range 8,000 hz to 96,000 hz. returns an audiobuffer configured based on the specified options. exceptions notsupportederror one or more of the options are negative or otherwise has an invalid value (such as numberofchannels being higher than supported, or a samplerate outside the nominal range). rangeerror there isn't enough memory available to allocate the buffer. examples first, a couple of simple trivial examples, to help explain how the parameters are used: var audioctx = new audiocontext(); var buffer = audioctx.createbuffer(2, 22050, 44100); if you use this call, you will get a...
...t should clearly explain what is going on. you can also run the code live, or view the source. ...
BaseAudioContext.createPeriodicWave() - Web APIs
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 peak value of 1. example the following example illustrates simple usage of createperiodicwave(), to create a periodicwave object containing a simple sine wave. var real = new float32array(2); var imag = new float32array(2); var ac = new audiocontext(); var osc = ac.createoscillator(); real[0] = 0; imag[0] = 0; real[1] = 1; imag[1] = 0; var wave = ac.createperiodicwave(real, imag, {disablenormalization...
...here, with createperiodicwave(), yo...
...r osc = ac.createoscillator(); real[0] = 0; imag[0] = 0; real[1] = 1; imag[1] = 0; var wave = ac.createperiodicwave(real, imag, {disablenormalization: true}); osc.setperiodicwave(wave); osc.connect(ac.destination); osc.start(); osc.stop(2); this works because a sound that contains only a fundamental tone is by definition a sine wave here, we create a periodicwave with two values. the first value is the dc offset, which is the value at which the oscillator starts. 0 is good here, because we want to start the curve at the middle of the [-1.0; 1.0] range. the second and subsequent values are sine and cosine components. you can think of it as the result of a fourier transform, where you get frequency domain values from time domain value. here, with createperiodicwave(), you specify the freq...
BasicCardResponse - Web APIs
t has to conform to the structure defined by the basiccardrequest dictionary. ...
... // call show() to trigger the browser's payment flow. r...
... // call show() to trigger the browser's payment flow. ...
BeforeUnloadEvent - Web APIs
some implementations only show the dialog box if the frame or any embedded frame receives a user gesture or user interaction. see browser compatibility for more information. ...
...some implementations only show the dialog box if the frame or any embedded frame receives a user gesture or user interaction. see browser compatibility for more information. ...
...o,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">beforeunloadevent</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} bubbles no cancelable yes target objects defaultview interface event examples window.addeventlistener("beforeunload", function( event ) { event.returnvalue = "\o/"; }); // is equivalent to window.addeventlistener("beforeunload", function( event ) { event.preventdefault(); }); webkit-derived browsers don't follow the spec for the dialog box. an almost-cross-browser working example would be close to the below example. window.addeventlistener("beforeunload", function (e) { var confirmationmessage = "\o/"; (e || window.event).returnvalue = con...
BiquadFilterNode.frequency - Web APIs
the frequency property of the biquadfilternode interface is a k-rate audioparam, a double representing a frequency in the current filtering algorithm measured in hertz (hz). frequency's default value is 350 with a nominal range of 10 to the nyquist frequency — that is, half of the sample rate. syntax var audioctx = new audiocontext(); var biquadfilter = audioctx.createbiquadfilter(); biquadfilter.frequency.value = 3000; note: though the audioparam returned is read-only, the value it represents is not. value an audioparam. example the following example shows basic usage of an audiocontext to create a biquad filter node. for a complete working example, check out our voice-change-o-matic demo (look at the source code too). var audioctx = new (window.audiocontext || window.webkitau...
... working draft ...
... working draft ...
BiquadFilterNode.gain - Web APIs
the gain property of the biquadfilternode interface is a a-rate audioparam, a double representing the gain used in the current filtering algorithm. when it takes a positive value it is a real gain, when negative it is an attenuation. it is expressed in db, has a default value of 0 and can take a value in a nominal range of -40 to 40. syntax var audioctx = new audiocontext(); var biquadfilter = audioctx.createbiquadfilter(); biquadfilter.gain.value = 25; note: though the audioparam returned is read-only, the value it represents is not. value an audioparam. example the following example shows basic usage of an audiocontext to create a biquad filter node. for a complete working example, check out our voice-change-o-matic demo (look at the source code too). var audioctx = new (window...
... working draft ...
... working draft ...
Blob.slice() - Web APIs
Web › API › Blob › slice
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. syntax var newblob = blob.slice(start, end, contenttype); parameters start optional an index into the blob indicating the first byte to include in the new blob. if you specify a negative value, it's treated as an offset from the end of the blob toward the beginning. for example, -10 would be the 10th from last byte in the blob. the default value is 0. if you specify a value for start that is larger than the size of the source blob, the returned blob has size 0 and contains no data. end optional an index into the blob indicating the first byte that will *not* be included in the new blob (i.e. the byte exactly at this index is not included). if yo...
...le, -10 would be the 10th from last byte in the blob. the default value is 0. if you specify a value for start that is larger than the size of the source blob, the returned blob has size 0 and contains no data. end optional an index into the blob indicating the first byte that will *not* be included in the new blob (i.e. the byte exactly at this index is not included). if you specify a negative value, it's treated as an offset from the end of the blob toward the beginning. for example, -10 would be the 10th from last byte in the blob. the default value is size. contenttype optional the content type to assign to the new blob; this will be the value of its type property. the default value is an empty string. ...
...the original blob is not altered. ...
Body.body - Web APIs
Web › API › Body › body
example in our simple stream pump example we fetch an image, expose the response's stream using response.body, create a reader using readablestream.getreader(), then enqueue that stream's chunks into a second, custom readable stream — effectively creating an identical copy of the image. ...
... identical copy of the image. ...
... living standard ...
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. syntax css.number(number); css.percent(number); // <length> css.em(number); css.ex(number); css.ch(number); css.ic(number); css.rem(number); css.lh(number); css.rlh(number); css.vw(number); css.vh(number); css.vi(number); css.vb(number); css.vmin(number); css.vmax(number); css.cm(number); css.mm(number); css.q(number); css.in(number); css.pt(number); css.pc(number); css.px(number); // <angle> css.deg(number); css.grad(number); css.rad(number); css.turn(number); // <time> css.s(number); ...
...er); css.pt(number); css.pc(number); css.px(number); // <angle> css.deg(number); css.grad(number); css.rad(number); css.turn(number); // <time> css.s(number); css.ms(number); // <frequency> css.hz(number); css.khz(number); // <resolution> css.dpi(number); css.dpcm(number); css.dppx(number); // <flex> css.fr(number); examples we use the css.vmax() numeric factory function to create a cssunitvalue: let height = css.vmax(50); console.log( height ); // cssunitvalue {value: 50, unit: "vmax"} console.log( height.value ) // 50 console.log( height.unit ) // vmax in this example, we set the margin on our element using the css.px() factory function: myelement.attributestylemap.set('margin', css.px(40)); let currentmargin = myelement.attributestylemap.get('margin'); console.log(current...
... working draft initial definition ...
CSSMathProduct - Web APIs
methods none. ...
... methods none. ...
... methods none. ...
CacheStorage.match() - Web APIs
th the response }); parameters request the request you want to match. this can be a request object or a url string. options optional an object whose properties control how matching is done in the match operation. the available options are: ignoresearch: a boolean that specifies whether the matching process should ignore the query string in the url. for example, if set to true, the ?value=bar part of http://foo.com/?value=bar would be ignored when performing a match. it defaults to false. ignoremethod: a boolean that, when set to true, prevents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false. ignorevary: a boolean that, when set to true, tells the matching operation not to perform vary header matching. ...
...y get and head are allowed.) it defaults to false. ignorevary: a boolean that, when set to true, tells the matching operation not to perform vary header matching. in other words, if the url matches you will get a match regardless of whether the response object has a vary header or not. it defaults to false. cachename: a domstring that represents a specific cache to search within. return value a promise that resolves to the matching response. if no matching response to the specified request is found, the promise resolves with undefined. examples this example is from the mdn sw-test example (see sw-test running live). here we wait for a fetchevent to fire. we construct a custom response like so: check whether a match for the request is found in the cachestorage using cachestorage.
...work request using return response.clone(). the last is necessary because put() consumes the response body. if this fails (e.g., because the network is down), return a fallback response. ...
CanvasRenderingContext2D.direction - Web APIs
examples changing text direction this example draws two pieces of text. ...
... examples changing text direction this example draws two pieces of text. the first one is left-to-right, and the second is right-to-left. ...
... examples changing text direction this example draws two pieces of text. the first one is left-to-right, and the second is right-to-left. note that "hi!" in ltr becomes "!hi" in rtl. ...
CanvasRenderingContext2D.font - Web APIs
the default font is 10px sans-serif. examples using a custom font in this example we use the font property to specify a custom font weight, size, and family. ...
...the default font is 10px sans-serif. examples using a custom font in this example we use the font property to specify a custom font weight, size, and family. ...
...the default font is 10px sans-serif. examples using a custom font in this example we use the font property to specify a custom font weight, size, and family. ...
CanvasRenderingContext2D.lineDashOffset - Web APIs
examples offsetting a line dash this example draws two dashed lines. the first has no dash offset. the second has a dash offset of 4. ...
... examples offsetting a line dash this example draws two dashed lines. the first has no dash offset. the second has a dash offset of 4. ...
... examples offsetting a line dash this example draws two dashed lines. the first has no dash offset. the second has a dash offset of 4. ...
CanvasRenderingContext2D.putImageData() - Web APIs
om a canvas using the getimagedata() method. you can find more information about putimagedata() and general manipulation of canvas contents in the article pixel manipulation with canvas. syntax void ctx.putimagedata(imagedata, dx, dy); void ctx.putimagedata(imagedata, dx, dy, dirtyx, dirtyy, dirtywidth, dirtyheight); parameters imagedata an imagedata object containing the array of pixel values. dx horizontal position (x coordinate) at which to place the image data in the destination canvas. dy vertical position (y coordinate) at which to place the image data in the destination canvas. dirtyx optional horizontal position (x coordinate) of the top-left corner from which the image data will be extracted. defaults to 0. dirtyy optional vertical position (y coordinate) of the top-l...
... javascript const canvas = document.createelement("canvas"); canvas.width = 1; canvas.height = 1; const context = canvas.getcontext("2d"); const imgdata = context.getimagedata(0, 0, canvas.width, canvas.height); const pixels = imgdata.data; pixels[0 + 0] = 1; pixels[0 + 1...
...ata(0, 0, 100, 100); // use the putimagedata function that illustrates how putimagedata works putimagedata(ctx, imagedata, 150, 0, 50, 50, 25, 25); result data loss due to browser optimization due to the lossy nature of converting to and from premultiplied alpha color values, pixels that have just been set using putimagedata() might be returned to an equivalent getimagedata() as different values. javascript const canvas = document.createelement("canvas"); canvas.width = 1; canvas.height = 1; const context = canvas.getcontext("2d"); const imgdata = context.getimagedata(0, 0, canvas.width, canvas.height); const pixels = imgdata.data; pixels[0 + 0] = 1; pixels[0 + 1] = 127; pixels[0 + 2] = 255; pixels[0 + 3] = 1; console.log("before:", pixels); context.putimagedata(imgdata, 0, 0); const...
CanvasRenderingContext2D.shadowColor - Web APIs
the canvasrenderingcontext2d.shadowcolor property of the canvas 2d api specifies the color of shadows. be aware that the shadow's rendered opacity will be affected by the opacity of the fillstyle color when filling, and of the strokestyle color when stroking. note: shadows are only drawn if the shadowcolor property is set to a non-transparent value. one of the shadowblur, shadowoffsetx, or shadowoffsety properties must be non-zero, as well. syntax ctx.shadowcolor = color; color a domstring parsed as a css <color> value. the default value is fully-transparent black. examples adding a shadow to shapes this example adds a shadow to two squares; the first one is filled, and the second one is stroked. the shadowcolor property sets the shadows' color, while shadowoffsetx and shadowoff...
...the alpha of the stroke shadow is .8 * .6, or .48. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // shadow ctx.shadowcolor = 'rgba(255, 0, 0, .8)'; ctx.shadowblur = 8; ctx...
...the alpha of the stroke shadow is .8 * .6, or .48. ...
CanvasRenderingContext2D.strokeStyle - Web APIs
tyle property of the canvas 2d api specifies the color, gradient, or pattern to use for the strokes (outlines) around shapes. the default is #000 (black). for more examples of stroke and fill styles, see applying styles and color in the canvas tutorial. syntax ctx.strokestyle = color; ctx.strokestyle = gradient; ctx.strokestyle = pattern; options color a domstring parsed as css <color> value. gradient a canvasgradient object (a linear or radial gradient). pattern a canvaspattern object (a repeating image). examples changing the stroke color of a shape this example applies a blue stroke color to a rectangle. html <canvas id="canvas"></canvas> javascript var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); ctx.strokestyle = 'blue'; ctx.stroke...
...canvas.getcontext('2d'); ctx.strokestyle = 'blue'; ctx.strokerect(10, 10, 100, 100); result creating multiple stroke colors using loops in this example, we use two for loops and the arc() method to draw a grid of circles, each having a different stroke color. ...
...tyle = 'blue'; ctx.strokerect(10, 10, 100, 100); result creating multiple stroke colors using loops in this example, we use two for loops and the arc() method to draw a grid of circles, each having a different stroke color. to achieve this, we use the two variables i and j to generate a unique rgb color for each circle, and only modify the green and blue values. ...
CanvasRenderingContext2D - Web APIs
canvasrenderingcontext2d.stroketext() draws (strokes) a given text at the given (x, y) position. canvasrenderingcontext2d.measuretext() returns a textmetrics object. line styles the following methods and properties control how lines are drawn. canvasrenderingcontext2d.linewidth width of lines. default 1.0. canvasrenderingcontext2d.linecap type of endings on the end of lines. possible values: butt (default), round, square. canvasrenderingcontext2d.linejoin defines the type of corners where two lines meet. possible values: round, bevel, miter (default). canvasrenderingcontext2d.miterlimit miter limit ratio. default 10. canvasrenderingcontext2d.getlinedash() returns the current line dash pattern array containing an even number of non-negative numbers. canvasrenderingcontext2d.s...
...inedash() returns the current line dash pattern array containing an even number of non-negative numbers. canvasrenderingcontext2d.setlinedash() sets the current line dash pattern. canvasrenderingcontext2d.linedashoffset specifies where to start a dash array on a line. text styles the following properties control how text is laid out. canvasrenderingcontext2d.font font setting. default value 10px sans-serif. canvasrenderingcontext2d.textalign text alignment setting. possible values: start (default), end, left, right, center. canvasrenderingcontext2d.textbaseline baseline alignment setting. possible values: top, hanging, middle, alphabetic (default), ideographic, bottom. canvasrenderingcontext2d.direction directionality. possible values: ltr, rtl, inherit (default). fill and s...
...s the current transformation matrix with the matrix described by its arguments. canvasrenderingcontext2d.settransform() resets the current transform to the identity matrix, and then invokes the transform() method with the same arguments. canvasrenderingcontext2d.resettransform() resets the current transform by the identity matrix. compositing canvasrenderingcontext2d.globalalpha alpha value that is applied to shapes and images before they are composited onto the canvas. default 1.0 (opaque). canvasrenderingcontext2d.globalcompositeoperation with globalalpha applied this sets how shapes and images are drawn onto the existing bitmap. drawing images canvasrenderingcontext2d.drawimage() draws the specified image. this method is available in multiple formats, providing a great de...
Manipulating video using canvas - Web APIs
note that you can simply pass the video element into the context's drawimage() method to draw the current video frame into the context. the result is: line 3 fetches a copy of the raw graphics data for the current frame of video by calling the getimagedata() method on the first context. this provides raw 32-bit pixel image data we can the...
... the raw graphics data for the current frame of video by calling the getimagedata() method on the first context. this provides raw 32-bit pixel image data we can then manipulate. line 4 computes the number of pixels in the image by dividing the total size of the frame's image data by four. ...
...rame of video by calling the getimagedata() method on the first context. this provides raw 32-bit pixel image data we can then manipulate. line 4 computes the number of pixels in the image by dividing the total size of the frame's image data by four. the for loop that begins on line 6 scans through the frame's pixels, pulling out the red, green, and blue values for each pixel, and compares the values against predetermined numbers that are used to detect the green screen that will be replaced with the still background image imported from foo.png. every pixel in the frame's image data that is found that is within the parameters that are considered to be part of the green screen has its alpha value replaced with a zero, indicating that the pixel is entirely transparent. as a result, the final...
console.log() - Web APIs
Web › API › Console › log
the console method log() outputs a message to the web console. the message may be a single string (with optional substitution values), or it may be any one or more javascript objects. note: this feature is available in web workers. syntax console.log(obj1 [, obj2, ..., objn]); console.log(msg [, subst1, ..., substn]); parameters obj1 ... objn a list of javascript objects to output. the string representations of each of these objects are appended together in the order listed and output. ...
...console.log(msg [, subst1, ..., substn]); parameters obj1 ... objn a list of javascript objects to output. the string representations of each of these objects are appended together in the order listed and output. please be warned that if you log objects in the latest versions of chrome and firefox what you get logged on the console is a reference to the object, which is not necessarily the 'value' of the object at the moment in time you call console.log(), but it is the value of the object at the moment you open the console. msg a javascript string containing zero or more substitution strings. subst1 ... substn javascript objects with which to replace substitution strings within msg. this gives you additional control over the format of the output. see outputting text to the console ...
...onsole.log gives special treatment to dom elements, whereas console.dir does not. this is often useful when trying to see the full representation of the dom js object. there's more information in the chrome console api reference about this and other functions. logging objects don't use console.log(obj), use console.log(json.parse(json.stringify(obj))). this way you are sure you are seeing the value of obj at the moment you log it. otherwise, many browsers provide a live view that constantly updates as values change. this may not be what you want. specifications specification status comment console apithe definition of 'console.log()' in that specification. living standard initial definition ...
console - Web APIs
Web › API › Console
vailable in web workers. note: the actual console interface is defined as all lower case (i.e. not console), for historical reasons. methods console.assert() log a message and stack trace to console if the first argument is false. console.clear() clear the console. console.count() log the number of times this line has been called with the given label. console.countreset() resets the value of the counter with the given label. console.debug() outputs a message to the console with the log level debug. console.dir() displays an interactive listing of the properties of a specified javascript object. this listing lets you use disclosure triangles to examine the contents of child objects. console.dirxml() displays an xml/html element representation of the specified object if possib...
...ile in the browser's performance tool (for example, the firefox performance tool). console.table() displays tabular data as a table. console.time() starts a timer with a name specified as an input parameter. up to 10,000 simultaneous timers can run on a given page. console.timeend() stops the specified timer and logs the elapsed time in seconds since it started. console.timelog() logs the value of the specified timer to the console. console.timestamp() adds a marker to the browser's timeline or waterfall tool. console.trace() outputs a stack trace. console.warn() outputs a warning message. you may use string substitution and additional arguments with this method. examples outputting text to the console the most frequently-used feature of the console is logging of text and ot...
...s log()), you may use these substitution strings: %o or %o outputs a javascript object. clicking the object name opens more information about it in the inspector. %d or %i outputs an integer. number formatting is supported, for example console.log("foo %.2d", 1.1) will output the number as two significant figures with a leading 0: foo 01 %s outputs a string. %f outputs a floating-point value. formatting is supported, for example console.log("foo %.2f", 1.1) will output the number to 2 decimal places: foo 1.10 note: precision formatting doesn't work in chrome each of these pulls the next argument after the format string off the parameter list. for example: for (var i=0; i<5; i++) { console.log("hello, %s. you've called me %d times.", "bob", i+1); } the output looks like thi...
ConstrainDouble - Web APIs
the constraindouble type is used to specify a constraint for a property whose value is a double-precision floating-point number. it extends the doublerange dictionary (which provides the ability to specify a permitted range of property values) to also support an exact value and/or an ideal value the property should take on. additionally, you can specify the property's value as a simple floating-point value, in which case the user agent does its best to match the value once all other more stringent constraints are met. properties if the value of a constraindouble is an object rather than a number, it may have the properties below in addition the properties it inherits from doublerange. ...
... specifications specification status comment media capture and streamsthe definition of 'constraindouble' in that specification. ...
... specifications specification status comment media capture and streamsthe definition of 'constraindouble' in that specification. ...
DOMMatrixReadOnly.scale() - Web APIs
the scale() method of the dommatrixreadonly interface creates a new matrix being the result of the original matrix with a scale transform applied. syntax the scale() method is specified with either one or six values. dommatrix.scale(scalex[, scaley][, scalez][, originx][, originy][, originz]) parameters scalex a multiplier for the scale value on the x-axis. scaley optional a multiplier for the scale value on the y-axis. if not supplied, this defaults to the value of scalex. scalez optional a multiplier for the scale value on the z-axis. if this value is anything other than 1, the resulting matrix will be 3d. originx optional an x-coordinate for the origin of the transformation. if no origin is supplied, this defaults to 0. originy optional a y-coordinate for the o...
... the resulting matrix will be 3d. originx optional an x-coordinate for the origin of the transformation. if no origin is supplied, this defaults to 0. originy optional a y-coordinate for the origin of the transformation. if no origin is supplied, this defaults to 0. originz optional a z-coordinate for the origin of the transformation. if no origin is supplied, this defaults to 0. if this value is anything other than 0, the resulting matrix will be 3d. return value returns a dommatrix containing a new matrix being the result of the matrix x and y dimensions being scaled by the given factor, centered on the origin given. the original matrix is not modified. if a scale is applied about the z-axis, the resulting matrix will be a 4x4 3d matrix. note: at time of writing, firefox still ...
...rns a dommatrix containing a new matrix being the result of the matrix x and y dimensions being scaled by the given factor, centered on the origin given. the original matrix is not modified. if a scale is applied about the z-axis, the resulting matrix will be a 4x4 3d matrix. note: at time of writing, firefox still supports an older version of the specification that accepts either one or three values. dommatrix.scale(scale[, originx][, originy]) we'll show an example of how you can deal with the cross-browser support implications of this in the examples section, below. examples this svg contains three squares, one red, one blue, and one green, each positioned at the document origin: <svg width="250" height="250" viewbox="0 0 25 25"> <rect width="25" height="25" fill="red" /> <rect ...
DOMParser - Web APIs
Web › API › DOMParser
dom document. note: xmlhttprequest can parse xml and html directly from a url-addressable resource, returning a document in its response property. you can perform the opposite operation—converting a dom tree into xml or html source—using the xmlserializer interface. in the case of an html document, you can also replace portions of the dom with new dom trees built from html by setting the value of the element.innerhtml and outerhtml properties. these properties can also be read to fetch html fragments corresponding to the corresponding dom subtree. syntax let domparser = new domparser()​​ methods domparser.parsefromstring() syntax let doc = domparser.parsefromstring(string, mimetype) return either document or xmldocument depending on the mimetype argument. parameters this ...
...arsefromstring() syntax let doc = domparser.parsefromstring(string, mimetype) return either document or xmldocument depending on the mimetype argument. parameters this method has 2 parameters (both required): string the domstring to be parsed. it must contain either html, xml, xhtml+xml, or svg document. mimetype a domstring. this string determines a class of the the method's return value. ...
...ntax let doc = domparser.parsefromstring(string, mimetype) return either document or xmldocument depending on the mimetype argument. parameters this method has 2 parameters (both required): string the domstring to be parsed. it must contain either html, xml, xhtml+xml, or svg document. mimetype a domstring. this string determines a class of the the method's return value. ...
DOMPoint - Web APIs
Web › API › DOMPoint
a dompoint object represents a 2d or 3d point in a coordinate system; it includes values for the coordinates in up to three dimensions, as well as an optional perspective value. dompoint is based on dompointreadonly but allows its properties' values to be changed. in general, a positive x component represents a position to the right of the origin, a positive y component is downward from the origin, and a positive z component extends outward from the screen (in other words, toward the user). constructor dompoint() creates and returns a new dompoint object given the values of zero or more of its coordinate components and optionally the w perspective value. you can also use an existing dompoint or dompointreadonly or a dompointinit dictionary to create a new point by calling the dompoint.fr...
...ive value. you can also use an existing dompoint or dompointreadonly or a dompointinit dictionary to create a new point by calling the dompoint.frompoint() static method. methods dompoint inherits methods from its parent, dompointreadonly. static methods dompoint.frompoint() creates a new mutable dompoint object given an existing point (or a dompointinit dictionary) which provides the values for its properties. properties dompoint inherits properties from its parent, dompointreadonly. dompoint.x the x coordinate of the dompoint. dompoint.y the y coordinate of the dompoint. dompoint.z the z coordinate of the dompoint. dompoint.w the perspective value of the dompoint. ...
...a dompointinit dictionary) which provides the values for its properties. properties dompoint inherits properties from its parent, dompointreadonly. dompoint.x the x coordinate of the dompoint. dompoint.y the y coordinate of the dompoint. dompoint.z the z coordinate of the dompoint. dompoint.w the perspective value of the dompoint. examples in the webxr device api, dompointreadonly values are used to represent positions and orientations. in the following snippet, the pose of the xr device (such as a vr headset or phone with ar capabilities) can be retrieved by calling using xrframe.getviewerpose() during an xrsession animation frame, then accessing the resulting xrpose's transform property, which contains two dompointreadonly attributes: position as a vector and orientation as a ...
DOMPointInit.y - Web APIs
Web › API › DOMPointInit › y
the dompointinit dictionary's y property is used to specify the y-coordinate of a point in 2d or 3d space when either creating or serializing to json a dompoint or dompointreadonly object. in general, the value of y increases to the right and decreases to the left, becoming negative to the left of the origin. this may change if transforms have been applied causing the axes' orientation to change. syntax var dompointinit = { y: ypos }; dompointinit.y = ypos; var ypos = dompointinit.y; value a double-precision floating-point value indicating the point's y-coordinate. ...
...t. in general, the value of y increases to the right and decreases to the left, becoming negative to the left of the origin. this may change if transforms have been applied causing the axes' orientation to change. syntax var dompointinit = { y: ypos }; dompointinit.y = ypos; var ypos = dompointinit.y; value a double-precision floating-point value indicating the point's y-coordinate. this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity). if this property is missing when the dompointinit object is passed into frompoint(), the value is assumed to be 0 by default. there are two methods which use dompointinit: the static function dompointreadonly.frompoint() takes an object that complies with dompointinit as its s...
...this method is, by inheritance, also available as dompoint.frompoint(). the dompointreadonly.tojson() method returns a dompointinit object that describes the same point as the original point. by inheritance, this method is also available as dompoint.tojson(). ...
DOMPointInit - Web APIs
the dompointinit dictionary is used to provide the values of the coordinates and perspective when creating and jsonifying a dompoint or dompointreadonly object. it's used as an input parameter to the dompoint/dompointreadonly method frompoint(). it's used as the return value when calling tojson(). properties dompointinit.x an unrestricted floating-point value indicating the x-coordinate of the point in space. this is generally the horizontal coordinate, with positive values being to the right and negative values to the left. the default value is 0. dompointinit.y an unrestricted floating-point number providing the point's y-coordinate. ...
...-point value indicating the x-coordinate of the point in space. this is generally the horizontal coordinate, with positive values being to the right and negative values to the left. the default value is 0. dompointinit.y an unrestricted floating-point number providing the point's y-coordinate. this is the vertical coordinate, and barring any transforms applied to the coordinate system, positive values are downward and negative values upward toward the top of the screen. the default is 0. dompointinit.z an unrestricted floating-point value which gives the point's z-coordinate, which is (assuming no transformations that alter the situation) the depth coordinate; positive values are closer to the user and negative values retreat back into the screen. the default value is 0. dompointinit.w th...
...the default is 1. example this example creates a new dompoint representing the top-left corner of the current window, with a z component added to move the point closer to the user. this same code will work to create a dompointreadonly object; just change the interface name in the code. ...
DOMPointReadOnly - Web APIs
the dompointreadonly interface specifies the coordinate and perspective fields used by dompoint to define a 2d or 3d point in a coordinate system. note: this feature is available in web workers. there are two ways to create a new dompointreadonly instance. ...
...to create a point using adompointinit object, you can instead use dompointreadonly.frompoint(). properties dompointreadonly.x read only the point's horizontal coordinate, x. dompointreadonly.y read only the point's vertical coordinate, y. dompointreadonly.z read only the point's depth coordinate, z. dompointreadonly.w read only the point's pers...
... coordinates and perspective. to create a point using adompointinit object, you can instead use dompointreadonly.frompoint(). properties dompointreadonly.x read only the point's horizontal coordinate, x. dompointreadonly.y read only the point's vertical coordinate, y. dompointreadonly.z read only the point's depth coordinate, z. dompointreadonly.w read only the point's perspective value, w. static methods dompointreadonly.frompoint() a static method that creates a new dompointreadonly object given the coordinates provided in the specified dompointinit object. methods matrixtransform() applies a matrix transform specified as a dommatrixinit object to the dompointreadonly object. tojson() returns a json representation of the dompointreadonly object. specificatio...
DedicatedWorkerGlobalScope.onmessage - Web APIs
erglobalscope interface represents an eventhandler to be called when the message event occurs and bubbles through the worker — i.e. when a message is sent to the worker using the worker.postmessage method. syntax self.onmessage = function() { ... }; example the following code snippet shows creation of a worker object using the worker() constructor. ...
... { ... }; example the following code snippet shows creation of a worker object using the worker() constructor. messages are passed to the worker when the value inside the form input first changes. a worker.onmessage handler is also present, to deal with messages are passed back from the worker. ...
...ample the following code snippet shows creation of a worker object using the worker() constructor. messages are passed to the worker when the value inside the form input first changes. a worker.onmessage handler is also present, to deal with messages are passed back from the worker. ...
DelayNode.delayTime - Web APIs
the delaytime property of the delaynode interface is an a-rate audioparam representing the amount of delay to apply. delaytime is expressed in seconds, its minimal value is 0, and its maximum value is defined by the maxdelaytime argument of the audiocontext.createdelay() method that created it. syntax var audioctx = new audiocontext(); var mydelay = audioctx.createdelay(5.0); mydelay.delaytime.value = 3.0; note: though the audioparam returned is read-only, the value it represents is not. value an audioparam. example we have created a simple example that allows you to play three different samples on a constant loop — see create-delay (you can also view the source code). if you just press the play buttons, the loops will start immediately; if you slide the sliders up to the right,...
... working draft ...
... working draft ...
DeviceOrientationEvent - Web APIs
sing them. constructor deviceorientationevent.deviceorientationevent() creates a new deviceorientationevent. properties deviceorientationevent.absolute read only a boolean that indicates whether or not the device is providing orientation data absolutely. ...
...e read only a boolean that indicates whether or not the device is providing orientation data absolutely. deviceorientationevent.alpha read only a number representing the motion of the device around the z axis, express in degrees with values ranging from 0 to 360. deviceorientationevent.beta read only a number representing the motion of the device around the x axis, express in degrees with values ranging from -180 to 180. this represents a front to back motion of the device. deviceorientationevent.gamma read only a number representing the motion of the device around the y axis, express in degrees with values ranging from -90 to 90. this represents a left to right motion of the device. deviceorientationevent.webkitcompassheading read only a number represents the difference between t...
... deviceorientationevent.webkitcompassaccuracy read only the accuracy of the compass means that the deviation is positive or negative. it's usually 10. ...
DeviceProximityEvent - Web APIs
vent interface provides information about the distance of a nearby physical object using the proximity sensor of a device. ...
...yevent.max read only the maximum sensing distance the sensor is able to report, in centimeters. deviceproximityevent.min read only the minimum sensing distance the sensor is able to report, in centimeters. ususally zero. ...
...nly the maximum sensing distance the sensor is able to report, in centimeters. deviceproximityevent.min read only the minimum sensing distance the sensor is able to report, in centimeters. ususally zero. ...
DisplayMediaStreamConstraints - Web APIs
r audio tracks in the mediastream to be returned by getdisplaymedia(), as well as what type of processing must be applied to the tracks. processing information is specified using mediatrackconstraints objects providing options which are applied to the track after the media data is received but before it is made available on the mediastream. ...
...astream to be returned by getdisplaymedia(), as well as what type of processing must be applied to the tracks. processing information is specified using mediatrackconstraints objects providing options which are applied to the track after the media data is received but before it is made available on the mediastream. properties audio a boolean or mediatrackconstraints value; if a boolean, this value simply indicates whether or not to include an audio track in the mediastream returned by getdisplaymedia(). if a mediatrackconstraints object is provided here, an audio track is included in the stream, but the audio is processed to match the specified constraints after being retrieved from the hardware but before being added to the mediastream. the default value is false. video if true (the def...
...retrieved from the hardware but before being added to the mediastream. the default value is false. video if true (the default), the display contents are included in a mediastreamtrack within the stream provided by getdisplaymedia(). optionally, a mediatrackconstraints object may be given, providing options specifying processing to be performed on the video data before adding it to the stream. a value of false is not permitted, and results in a typeerror being thrown. specifications specification status comment unknownthe definition of 'displaymediastreamconstraints' in that specification. unknown initial definition ...
Document.createElementNS() - Web APIs
specified namespace uri and qualified name. to create an element without specifying a namespace uri, use the createelement() method. syntax var element = document.createelementns(namespaceuri, qualifiedname[, options]); parameters namespaceuri a string that specifies the namespace uri to associate with the element. ...
...ri, qualifiedname[, options]); parameters namespaceuri a string that specifies the namespace uri to associate with the element. the namespaceuri property of the created element is initialized with the value of namespaceuri. see valid namespace uris. qualifiedname a string that specifies the type of element to be created. the nodename property of the created element is initialized with the value of qualifiedname. optionsoptional an optional elementcreationoptions object containing a single property named is, whose value is the tag name for a custom element previously defined using customelements.define(). for backwards compatibility with previous versions of the custom elements specification, some browsers will allow you to pass a string here instead of an object, where the string's va...
... defined using customelements.define(). for backwards compatibility with previous versions of the custom elements specification, some browsers will allow you to pass a string here instead of an object, where the string's value is the custom element's tag name. see extending native html elements for more information on how to use this parameter. the new element will be given an is attribute whose value is the custom element's tag name. custom elements are an experimental feature only available in some browsers. return value the new element. important namespace uris html http://www.w3.org/1999/xhtml svg http://www.w3.org/2000/svg mathml http://www.w3.org/1998/math/mathml xul http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul xbl http://www.mozilla.org/xbl examp...
Document.hasStorageAccess() - Web APIs
if the promise gets resolved and a user gesture event was being processed when the function was originally called, the resolve handler will run as if a user gesture was being processed, so it will be able to call apis that require user activation. ...
... if the promise gets resolved and a user gesture event was being processed when the function was originally called, the resolve handler will run as if a user gesture was being processed, so it will be able to call apis that require user activation. ...
... if the promise gets resolved and a user gesture event was being processed when the function was originally called, the resolve handler will run as if a user gesture was being processed, so it will be able to call apis that require user activation. ...
EffectTiming.direction - Web APIs
the direction property of the web animations api dictionary effecttiming indicates an animation's playback direction along its timeline, as well as its behavior when it reaches the end of an iteration element.animate(), keyframeeffectreadonly(), and keyframeeffect() all accept an object of timing properties including direction. ...
...ding direction. the value of direction corresponds directly to animationeffecttimingreadonly.direction in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. syntax var timingproperties = { direction: "normal" | "reverse" | "alternate" | "alternate-reverse" }; timingproperties.direction = "normal" | "reverse" | "alternate" | "alternate-reverse"; value a domstring which specifies the direction in which the animation should play as well as what to do when the playback reaches the end of the animation sequence in the current direction. it can take one of the following values, with the default being "normal": "normal" the animation runs forwards, from beginning to end, in the way we experience the flow of time. "reverse" the animation runs ...
...n, then backward through the sequence the second iteration, and so forth. "alternate-reverse" similar to "alternate", except the animation playback starts by going from the end of the animation sequence toward the beginning the first iteration, then goes forward during the second, and so forth. ...
EffectTiming.duration - Web APIs
the duration property of the dictionary effecttiming in the web animations api specifies the duration in milliseconds that a single iteration (from beginning to end) the animation should take to complete. element.animate(), keyframeeffectreadonly(), and keyframeeffect() all accept an object of timing properties including duration. the value of duration corresponds directly to animationeffecttimingreadonly.duration in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. syntax var timingproperties = { duration: durationinmilliseconds | "auto" }; timingproperties.duration = durationinmilliseconds | "auto"; value the number of milliseconds long a single beginning-to-end iteration of the animation should take. the default is "auto". t...
...mingreadonly.duration in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. syntax var timingproperties = { duration: durationinmilliseconds | "auto" }; timingproperties.duration = durationinmilliseconds | "auto"; value the number of milliseconds long a single beginning-to-end iteration of the animation should take. the default is "auto". this value must not be negative; otherwise, it can have any value (including positive infinity). ...
...yframeeffect. syntax var timingproperties = { duration: durationinmilliseconds | "auto" }; timingproperties.duration = durationinmilliseconds | "auto"; value the number of milliseconds long a single beginning-to-end iteration of the animation should take. the default is "auto". this value must not be negative; otherwise, it can have any value (including positive infinity). currently, a value of "auto" is the same as specifying 0.0. this is a forwards-compatiblity measure since in the future, "auto" will be expanded to take into account the duration of any child effects. consider using "auto" rather than 0 if that makes sense. exceptions typeerror the specified value is either a string other than "auto", a number less than zero, nan, or some other type of object entirely. exam...
Element: DOMMouseScroll event - Web APIs
other mouse wheel events may be fired without this event. on gecko 17 (firefox 17) or later, you need to call preventdefault() of wheel events which must be fired for every native event. use the standardized wheel event if available. properties the event has only one additional property beyond standard events. ...
... event. on gecko 17 (firefox 17) or later, you need to call preventdefault() of wheel events which must be fired for every native event. use the standardized wheel event if available. properties the event has only one additional property beyond standard events. detail the detail property describes the scroll more precisely, with positive values indicating scrolling downward and negative values indicating scrolling upward. if the event represents scrolling up by a page, the value of detail is -32768. if the event indictes scrolling down by a page, the value is +32768. any other value represents the number of lines to scroll, with the direction indicated by the value's sign. note: trusted events are never sent with a value of 0 for detail. trusted events are never fired with 0. n...
...ng down by a page, the value is +32768. any other value represents the number of lines to scroll, with the direction indicated by the value's sign. note: trusted events are never sent with a value of 0 for detail. trusted events are never fired with 0. note: if the platform's native mouse wheel events only provide scroll distance by pixels, or if the speed can be customized by the user, the value is computed using the line height of the nearest scrollable ancestor element of the event's target. if that element's font size is smaller than mousewheel.min_line_scroll_amount, that preference's value is used as the line height. ...
Element: MSGestureHold event - Web APIs
hold event is fired when the user contacts the touch surface and remains in the same position for a while. it is a proprietary event specific to microsoft edge and internet explorer. ...
...acts the touch surface and remains in the same position for a while. it is a proprietary event specific to microsoft edge and internet explorer. ...
...t specific to microsoft edge and internet explorer. bubbles unknown cancelable unknown interface msgestureevent event handler property unknown the uievent.detail property of an msgesturehold event has 3 possible values: msgesture_flag_begin this value indicates that the user started contacting the touch surface. msgesture_flag_end this value indicates that the user has stopped touching the touch surface. msgesture_flag_end & msgesture_flag_cancel (bitwise and-ed together) this value indicates that the user has moved their finger, regardless of whether they also stopped touching the touch surface specifications not part of any specification. ...
Element: MozMousePixelScroll event - Web APIs
ated. it's represented by the mousescrollevent interface. important: do not use this non-standard and obsolete event. instead, you should always use the standard wheel event. ...
... obsolete event. instead, you should always use the standard wheel event. bubbles yes cancelable yes interface mousescrollevent getting the distance scrolled the event's detail property indicates the scroll distance in terms of lines, with negative values indicating the scrolling movement is either toward the bottom or toward the right, and positive values indicating scrolling to the top or left. ...
...scrollevent getting the distance scrolled the event's detail property indicates the scroll distance in terms of lines, with negative values indicating the scrolling movement is either toward the bottom or toward the right, and positive values indicating scrolling to the top or left. if the platform's native mouse wheel events indicate the scroll distance in terms of lines or pages, the value of detail is computed using that value and the line height or page width/height of the nearest ancestor scrollable element that contains the target element. note: on macos, the scroll distance (and therefore the value of detail) is computed based on the accelerated scroll distance. the value of detail is never 0 if the events are legitimate. ...
Element.currentStyle - Web APIs
/* any copyright is dedicated to the public domain. ...
... /* any copyright is dedicated to the public domain. ...
... /* any copyright is dedicated to the public domain. ...
Element.getAttribute() - Web APIs
the getattribute() method of the element interface returns the value of a specified attribute on the element. if the given attribute does not exist, the value returned will either be null or "" (the empty string); see non-existing attributes for details. syntax let attribute = element.getattribute(attributename); where attribute is a string containing the value of attributename. attributename is the name of the attribute whose value you want to get. examples const div1 = document.getelementbyid('div1'); const align = div1.getattribute('align'); alert(align); // shows the value of align for the element with id="div1" description lower casing when called on an html element in a dom flagged as an html document, getattribute() lower-cases its argument before proceeding. non-existin...
...roceeding. non-existing attributes essentially all web browsers (firefox, internet explorer, recent versions of opera, safari, konqueror, and icab, as a non-exhaustive list) return null when the specified attribute does not exist on the specified element; this is what the current dom specification draft specifies. the old dom 3 core specification, on the other hand, says that the correct return value in this case is actually the empty string, and some dom implementations implement this behavior. the implementation of getattribute() in xul (gecko) actually follows the dom 3 core specification and returns an empty string. consequently, you should use element.hasattribute() to check for an attribute's existence prior to calling getattribute() if it is possible that the requested attribute does n...
...dom implementations implement this behavior. the implementation of getattribute() in xul (gecko) actually follows the dom 3 core specification and returns an empty string. consequently, you should use element.hasattribute() to check for an attribute's existence prior to calling getattribute() if it is possible that the requested attribute does not exist on the specified element. retrieving nonce values for security reasons, csp nonces from non-script sources, such as css selectors, and .getattribute("nonce") calls are hidden. let nonce = script.getattribute('nonce'); // returns empty string instead of retrieving the nonce from the content attribute, use the nonce property: let nonce = script.nonce; specifications specification status comment domthe definit...
Element.name - Web APIs
Web › API › Element › name
getelementsbyname() method, a form and with the form elements collection. when used with a form or elements collection, it may return a single element or a collection. ...
... ...
... ...
Element.outerHTML - Web APIs
Web › API › Element › outerHTML
erface gets the serialized html fragment describing the element including its descendants. it can also be set to replace the element with nodes parsed from the given string. to only obtain the html representation of the contents of an element, or to replace the contents of an element, use the innerhtml property instead. syntax var content = element.outerhtml; element.outerhtml = htmlstring; value reading the value of outerhtml returns a domstring containing an html serialization of the element and its descendants. setting the value of outerhtml replaces the element and all of its descendants with a new dom tree constructed by parsing the specified htmlstring. exceptions syntaxerror an attempt was made to set outerhtml using an html string which is not valid. nomodificationalloweder...
...replaces the element and all of its descendants with a new dom tree constructed by parsing the specified htmlstring. exceptions syntaxerror an attempt was made to set outerhtml using an html string which is not valid. nomodificationallowederror an attempt was made to set outerhtml on an element which is a direct child of a document, such as document.documentelement. ...
... work...
Element.querySelector() - Web APIs
t on which it is invoked that matches the specified group of selectors. syntax element = baseelement.queryselector(selectors); parameters selectors a group of selectors to match the descendant elements of the element baseelement against; this must be valid css syntax, or a syntaxerror exception will occur. the first element found which matches this group of selectors is returned. return value the first descendant element of baseelement which matches the specified group of selectors. the entire hierarchy of elements is considered when matching, including those outside the set of elements including baseelement and its descendants; in other words, selectors is first applied to the whole document, not the baseelement, to generate an initial list of potential elements. the resulting eleme...
...ents including baseelement and its descendants; in other words, selectors is first applied to the whole document, not the baseelement, to generate an initial list of potential elements. the resulting elements are then examined to see if they are descendants of baseelement. the first match of those remaining elements is returned by the queryselector() method. ...
... of potential elements. the resulting elements are then examined to see if they are descendants of baseelement. the first match of those remaining elements is returned by the queryselector() method. if no matches are found, the returned value is null. exceptions syntaxerror the specified selectors are invalid. examples let's consider a few examples. ...
Element.requestFullscreen() - Web APIs
orientation change; otherwise it will fail. syntax var promise = element.requestfullscreen(options); parameters options optional a fullscreenoptions object providing options that control the behavior of the transition to full-screen mode. currently, the only option is navigationui, which controls whether or not to show navigation ui while the element is in full-screen mode. the default value is "auto", which indicates that the browser should decide what to do. return value a promise which is resolved with a value of undefined when the transition to full screen is complete. exceptions rather than throw a traditional exception, the requestfullscreen() procedure announces error conditions by rejecting the promise it has returned. the rejection handler receives one of the following ...
... the element is not contained by a document. ...
...we don't need to do anything special if successful, but if the request fails, our promise's catch() handler presents an alert with an appropriate error message. if, on the other hand, full-screen mode is already in effect, we call document.exitfullscreen() to disable full-screen mode. you can see this example in action or view or remix the code ...
Element.scrollHeight - Web APIs
the element.scrollheight read-only property is a measurement of the height of an element's content, including content not visible on the screen due to overflow. the scrollheight value is equal to the minimum height the element would require in order to fit all the content in the viewport without using a vertical scrollbar. the height is measured in the same way as clientheight: it includes the element's padding, but not its border, margin or horizontal scrollbar (if present). it can also include the height of pseudo-elements such as ::before or ::after. if the element's content can fit without a need for vertical scrollbar, its scrollheight is equal to clientheight this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). syntax...
...orizontal scrollbar (if present). it can also include the height of pseudo-elements such as ::before or ::after. if the element's content can fit without a need for vertical scrollbar, its scrollheight is equal to clientheight this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). syntax elemscrollheight = element.scrollheight; value an integer corresponding to the scrollheight pixel value of the element. example padding-top lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cil...
...aliquam nisi ornare. integer laoreet nisi a odio ornare non congue turpis eleifend. cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. cras vulputate libero sed arcu iaculis nec lobortis orci fermentum. ...
Event.composed - Web APIs
Web › API › Event › composed
the read-only composed property of the event interface returns a boolean which indicates whether or not the event will propagate across the shadow dom boundary into the standard dom. note: this property was formerly named scoped. syntax const iscomposed = event.composed; value a boolean which is true if the event will cross from the shadow dom into the standard dom after reaching the shadow root. (that is, the first node in the shadow dom in which the event began to propagate.) all ua-dispatched ui events are composed (click/touch/mouseover/copy/paste, etc.). most other types of events are not composed, and so will return false. for example, this includes synthetic events that are created without their composed option wil set to true. propagation only occurs if the bubbles property is...
...e. for example, this includes synthetic events that are created without their composed option wil set to true. propagation only occurs if the bubbles property is also true. however, capturing only composed events are also handled at host as if they were in at_target phase. you can determine the path the event will follow through the shadow root to the dom root by calling composedpath(). if this value is false, the shadow root will be the last node to be offered the event. examples in our composed-composed-path example (see it live), we define two trivial custom elements, <open-shadow> and <closed-shadow>, both of which take the contents of their text attribute and insert them into the element's shadow dom as the text content of a <p> element. the only difference between the two is that thei...
...ment: document.queryselector('html').addeventlistener('click',function(e) { console.log(e.composed); console.log(e.composedpath()); }); when you click on the <open-shadow> element and then the <closed-shadow> element, you'll notice two things. the composed property returns true beause the click event is always able to propagate across shadow boundaries. you'll notice a difference in the value of composedpath for the two elements. the <open-shadow> element's composed path is this: array [ p, shadowroot, open-shadow, body, html, htmldocument https://mdn.github.io/web-components-examples/composed-composed-path/, window ] whereas the <closed-shadow> element's composed path is a follows: array [ closed-shadow, body, html, htmldocument https://mdn.github.io/web-components-examples/comp...
Event.currentTarget - Web APIs
the currenttarget read-only property of the event interface identifies the current target for the event, as the event traverses the dom. it always refers to the element to which the event handler has been attached, as opposed to event.target, which identifies the element on which the event occurred and which may be its descendant. syntax var currenteventtarget = 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...
...instead, you can either directly console.log(event.currenttarget) to be able to view it in the console or use the debugger statement, which will pause the execution of your code t...
...ment 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 for the currenttarget key in the console, its value will be null. instead, you can either directly console.log(event.currenttarget) to be able to view it in the console or use the debugger statement, which will pause the execution of your code thus showing you the value of event.currenttarget. specifications specification status comment domthe definition of 'event.currenttarget' in that specification. living standard ...
Event.timeStamp - Web APIs
Web › API › Event › timeStamp
the timestamp read-only property of the event interface returns the time (in milliseconds) at which the event was created. note: this property only works if the event system supports it for the particular event. syntax time = event.timestamp; value this value is the number of milliseconds elapsed from the beginning of the current document's lifetime till the event was created. in newer implementations, the value is a domhighrestimestamp accurate to 5 microseconds (0.005 ms). in older implementations, the value is a domtimestamp, accurate to a millisecond. example html <p> focus this iframe and press any key to get the current timestamp for the keypress event. </p> <p>timestamp: <span id="time">-</span></p> javascript function gettime(event) { var time = document.getelementb...
...stimestamp accurate to 5 microseconds (0.005 ms). in older implementations, the value is a domtimestamp, accurate to a millisecond. example html <p> focus this iframe and press any key to get the current timestamp for the keypress event. </p> <p>timestamp: <span id="time">-</span></p> javascript function gettime(event) { var time = document.getelementbyid("time"); time.firstchild.nodevalue = event.timestamp; } document.body.addeventlistener("keypress", gettime); result reduced time precision to offer protection against timing attacks and fingerprinting, the precision of event.timestamp might get rounded depending on browser settings. in firefox, the privacy.reducetimerprecision preference is enabled by default and defaults to 20us in firefox 59; in 60 it will be 2ms. // redu...
...irefox 59; in 60 it will be 2ms. // reduced time precision (2ms) in firefox 60 event.timestamp; // 1519211809934 // 1519211810362 // 1519211811670 // ... // reduced time precision with `privacy.resistfingerprinting` enabled event.timestamp; // 1519129853500 // 1519129858900 // 1519129864400 // ... in firefox, if you also enable privacy.resistfingerprinting, the precision will be 100ms or the value of privacy.resistfingerprinting.reducetimerprecision.microseconds, whichever is larger. specifications specification status comment domthe definition of 'event.timestamp' in that specification. living standard ...
EventSource - Web APIs
e instance opens a persistent connection to an http server, which sends events in text/event-stream format. the connection remains open until closed by calling eventsource.close(). once the connection is opened, incoming messages from the server are delivered to your code in the form of events. if there is an event field in the incoming message, the triggered event is the same as the event field value. if no event field is present, then a generic message event is fired. unlike websockets, server-sent events are unidirectional; that is, data messages are delivered in one direction, from the server to the client (such as a user's web browser). that makes them an excellent choice when there's no need to send data from the client to the server in message form. for example, eventsource is a useful...
...is negotiated between the server and the client (defaults to 100). constructor eventsource() creates a new eventsource to handle receiving server-sent events from a specified url, optionally in credentials mode. properties this interface also inherits properties from its parent, eventtarget. eventsource.readystate read only a number representing the state of the connection. possible values are connecting (0), open (1), or closed (2). eventsource.url read only a domstring representing the url of the source. eventsource.withcredentials read only a boolean indicating whether the eventsource object was instantiated with cross-origin (cors) credentials set (true), or not (false, the default). event handlers eventsource.onerror is an eventhandler called when an error occurs ...
...e to closed. if the connection is already closed, the method does nothing. events error fired when a connection to an event source failed to open. message fired when data is received from an event source. open fired when a connection to an event source has opened. additionally, the event source itself may send messages with an event field, which will create ad-hoc events keyed to that value. examples in this basic example, an eventsource is created to receive unnamed events from the server; a page with the name sse.php is responsible for generating the events. var evtsource = new eventsource('sse.php'); var eventlist = document.queryselector('ul'); evtsource.onmessage = function(e) { var newelement = document.createelement("li"); newelement.textcontent = "message: " + e.dat...
FileSystemFlags.create - Web APIs
the create property on the filesystemflags dictionary is used to indicate whether or not the file should be created if it's missing. filesystemflags is only used when calling filesystemdirectoryentry.getfile() or filesystemdirectoryentry.getdirectory(). syntax filesystemflags.create = booleanvalue values the table below describes the result of each possible combination of these flags depending on whether or not the target file or directory path already exists. ...
...t the file should be created if it's missing. filesystemflags is only used when calling filesystemdirectoryentry.getfile() or filesystemdirectoryentry.getdirectory(). syntax filesystemflags.create = booleanvalue values the table below describes the result of each possible combination of these flags depending on whether or not the target file or directory path already exists. option values file/directory condition result create exclusive false n/a[1] path exists and matches the desired type (depending on whether the function called is getfile() or getdirectory() the successcallback is called with a filesystemfileentry if getfile() was called or a filesystemdirectoryentry if getdirectory() was called. false n/a[1] path exists b...
...ssed to the successcallback, as appropriate. true true path exists the errorcallback is called with an appropriate error, such as fileerror.path_exists_err. true true path doesn't exist the file or directory is created, then a filesystemfileentry or a filesystemdirectoryentry is passed to the successcallback, as appropriate. [1] when create is false, the value of exclusive is irrelevant and ignored. specifications specification status comment file and directory entries apithe definition of 'filesystemflags' in that specification. draft initial 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 h...
FormDataEvent.formData - Web APIs
living standard ...
... living standard ...
... living standard ...
FormDataEvent - Web APIs
living standard ...
... living standard ...
... living standard ...
GainNode - Web APIs
Web › API › GainNode
the gainnode interface represents a change in volume. it is an audionode audio-processing module that causes a given gain to be applied to the input data before its propagation to the output. a gainnode always has exactly one input and one output, both with the same number of channels. the gain is a unitless value, changing with time, that is multiplied to each corresponding sample of all input channels. if modified, the new gain is instantly applied, causing unaesthetic 'clicks' in the resulting audio. to prevent this from happening, never change the value directly but use the exponential interpolation methods on the audioparam interface. number of inputs 1 number of outputs 1 channel count mode "max" channel count 2 (not used in the default...
... channel interpretation "speakers" constructor gainnode() creates a new instance of a gainnode object. you shouldn't manually create a gain node; instead, use the method audiocontext.creategain(). properties inherits properties from its parent, audionode. gainnode.gain read only is an a-rate audioparam representing the amount of gain to apply. you have to set audioparam.value or use the methods of audioparam to change the effect of gain. methods no specific method; inherits methods from its parent, audionode. example the following example shows basic usage of an audiocontext to create a gainnode, which is then used to mute and unmute the audio when a mute button is clicked by changing the gain property value. the below snippet wouldn't work as is — for a compl...
... ); } else { console.log('getusermedia not supported on your browser!'); } source.connect(gainnode); gainnode.connect(audioctx.destination); ... mute.onclick = voicemute; function voicemute() { if(mute.id == "") { // 0 means mute. if you still hear something, make sure you haven't // connected your source into the output in addition to using the gainnode. gainnode.gain.setvalueattime(0, audioctx.currenttime); mute.id = "activated"; mute.innerhtml = "unmute"; } else { gainnode.gain.setvalueattime(1, audioctx.currenttime); mute.id = ""; mute.innerhtml = "mute"; } } specifications specification status comment web audio apithe definition of 'gainnode' in that specification. working draft ...
Gamepad.axes - Web APIs
Web › API › Gamepad › axes
the gamepad.axes property of the gamepad interface returns an array representing the controls with axes present on the device (e.g. analog thumb sticks).- each entry in the array is a floating point value in the range -1.0 – 1.0, representing the axis position from the lowest value (-1.0) to the highest value (1.0). syntax readonly attribute double[] axes; example function gameloop() { if(navigator.webkitgetgamepads) { var gp = navigator.webkitgetgamepads()[0]; } else { var gp = navigator.getgamepads()[0]; } if(gp.axes[0] != 0) { b -= gp.axes[0]; } else if(gp.axes[1] != 0) { a += gp.axes[1]; } else if(gp.axes[2] != 0) { b += gp.axes[2]; } else if(gp.axes[3] != 0) { a -= gp.axes[3]; } ball.style.left = a*2 + "px"; ball.style.top...
... specifications specification status comment gamepadthe definition of 'gamepad.axes' in that specification. working draft initial definition ...
... specifications specification status comment gamepadthe definition of 'gamepad.axes' in that specification. working draft initial definition ...
GeolocationCoordinates - Web APIs
.latitude read only secure context returns a double representing the position's latitude in decimal degrees. geolocationcoordinates.longitude read only secure context returns a double representing the position's longitude in decimal degrees. geolocationcoordinates.altitude read only secure context returns a double representing the position's altitude in meters, relative to sea level. this value can be null if the implementation cannot provide the data. geolocationcoordinates.accuracy read only secure context returns a double representing the accuracy of the latitude and longitude properties, expressed in meters. geolocationcoordinates.altitudeaccuracy read only secure context returns a double representing the accuracy of the altitude expressed in meters. this value can be null. g...
...senting the accuracy of the latitude and longitude properties, expressed in meters. geolocationcoordinates.altitudeaccuracy read only secure context returns a double representing the accuracy of the altitude expressed in meters. this value can be null. geolocationcoordinates.heading read only secure context returns a double representing the direction towards which the device is facing. this value, specified in degrees, indicates how far off from heading true north the device is. 0 degrees represents true north, and the direction is determined clockwise (which means that east is 90 degrees and west is 270 degrees). if speed is 0, heading is nan. if the device is unable to provide heading information, this value is null. geolocationcoordinates.speed read only secure context returns a dou...
...he device is. 0 degrees represents true north, and the direction is determined clockwise (which means that east is 90 degrees and west is 270 degrees). if speed is 0, heading is nan. if the device is unable to provide heading information, this value is null. geolocationcoordinates.speed read only secure context returns a double representing the velocity of the device in meters per second. this value can be null. methods the geolocationcoordinates interface neither implements, nor inherits any method. specifications specification status comment geolocation apithe definition of 'geolocationcoordinates' in that specification. recommendation initial specification. ...
GeolocationPositionError.code - Web APIs
2 position_unavailable the acquisition of the geolocation failed because one or several internal sources of position returned an internal error. ...
... 2 position_unavailable the acquisition of the geolocation failed because one or several internal sources of position returned an internal error. ...
... 2 position_unavailable the acquisition of the geolocation failed because one or several internal sources of position returned an internal error. ...
GlobalEventHandlers.onchange - Web APIs
syntax target.onchange = functionref; functionref is a function name or a function expression. the function receives an event object as its sole argument. ...
... syntax target.onchange = functionref; functionref is a function name or a function expression. the function receives an event object as its sole argument. ...
...put> element, every time you modify its contents and then change focus away from it. html <input type="text" placeholder="type something here, then click outside of the field." size="50"> <p id="log"></p> javascript let input = document.queryselector('input'); let log = document.getelementbyid('log'); input.onchange = handlechange; function handlechange(e) { log.textcontent = `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.ontransitioncancel - Web APIs
the ontransitioncancel property of the globaleventhandlers mixin is an eventhandler that processes transitioncancel events. the transitioncancel event is sent when a css transition is cancelled. the transition is cancelled when: the value of the transition-property property that applies to the target is changed the display property is set to "none". the transition is stopped before it has run to completion, e.g. by moving the mouse off a hover-transitioning element. ...
... cancelled. the transition is cancelled when: the value of the transition-property property that applies to the target is changed the display property is set to "none". the transition is stopped before it has run to completion, e.g. by moving the mouse off a hover-transitioning element. syntax var transitioncancelhandler = target.ontransitioncancel; target.ontransitioncancel = function value a function to be called when a transitioncancel event occurs indicating that a css transition has been cancelled on the target, where the target object is an html element (htmlelement), document (document), or window (window). ...
... value a function to be called when a transitioncancel event occurs indicating that a css transition has been cancelled on the target, where the target object is an html element (htmlelement), document (document), or window (window). the function receives as input a single parameter: a transitionevent object describing the event which occurred; the event's transitionevent.elapsedtime property's value should be the same as the value of transition-duration. note: elapsedtime does not include time prior to the transition effect beginning; that means that the value of transition-delay doesn't affect the value of elapsedtime, which is zero until the delay period ends and the animation begins. example in this example, we use the transitionrun and transitionend events to detect when the transit...
GlobalEventHandlers.ontransitionend - Web APIs
the ontransitionend property of the globaleventhandlers mixin is an eventhandler that processes transitionend events. the transitionend event is sent to when a css transition completes. if the transition is removed from its target node before the transition completes execution, the transitionend event won't be generated. ...
... the transition is removed from its target node before the transition completes execution, the transitionend event won't be generated. one way this can happen is by changing the value of the transition-property attribute which applies to the target. another is if the display attribute is set to none. syntax var transitionendhandler = target.ontransitionend; target.ontransitionend = function value a function to be called when a transitionend event occurs indicating that a css transition has completed on the target, where the target object is an html element (htmlelement), document (document), or window (window). ...
...unction value a function to be called when a transitionend event occurs indicating that a css transition has completed on the target, where the target object is an html element (htmlelement), document (document), or window (window). the function receives as input a single parameter: a transitionevent object describing the event which occurred; the event's transitionevent.elapsedtime property's value should be the same as the value of transition-duration. elapsedtime does not include time prior to the transition effect beginning; that means that the value of transition-delay doesn't affect the value of elapsedtime, which is zero until the delay period ends and the animation begins. example in this example, we use the transitionrun and transitionend events to detect when the transition be...
msAudioCategory - Web APIs
the msaudiocategory property of the html <audio> element, is a read/write proprietary attribute, specific to internet explorer and microsoft edge. msaudiocategory specifies the purpose of the audio or video media, such as background audio or alerts. ...
... edge. msaudiocategory specifies the purpose of the audio or video media, such as background audio or alerts. syntax <audio controls="controls" msaudiocategory="backgroundcapablemedia"> </audio> the msaudiocategory property offers a variety of values that can enhance the behavior of your audio-aware app. note that you must set the msaudiocategory before setting the src property in code. value include a description of the property's value, including data type and what it represents. ...
...s. syntax <audio controls="controls" msaudiocategory="backgroundcapablemedia"> </audio> the msaudiocategory property offers a variety of values that can enhance the behavior of your audio-aware app. note that you must set the msaudiocategory before setting the src property in code. value include a description of the property's value, including data type and what it represents. value description background capable? alert looping or longer running alert sounds: alarms ring tones ringing notification sounds that need to attenuate existing audio no backgroundcapablemedia for audio that needs to continue playing in the background. examples include the following local media playback scenarios: local p...
HTMLElement.hidden - Web APIs
this is quite different from using the css property display to control the visibility of an element. the hidden property applies to all presentation modes and should not be used to hide content that is meant to be directly accessible to the user. ...
...er parts of the page in a template-like fashion creating an offscreen canvas as a drawing buffer inappropriate use cases include: hiding panels in a tabbed dialog box hiding content in one presentation while intending it to be visible in others elements that are not hidden must not link to elements which are. syntax ishidden = htmlelement.hidden; htmlelement.hidden = true | false; value a boolean which is true if the element is hidden from view; otherwise, the value is false. example here's an example where a hidden block is used to contain a thank you message that is displayed after a user agrees to an unusual request. javascript document.getelementbyid("okbutton") .addeventlistener("click", function() { document.getelementbyid("welcome").hidden = true; documen...
... "ok" you agree to be awesome every day!</p> <button class="button" id="okbutton">ok</button> </div> this html creates a panel (in a <div> block) that welcomes the user to a site and tells them what they're agreeing to by clicking the ok button. the follow-up panel once the user clicks the "ok" button in the welcome panel, the javascript code swaps the two panels by changing their respective values for hidden. the follow-up panel looks like this in html: <div id="awesome" class="panel" hidden> <h1>thanks!</h1> <p>thank you <strong>so</strong> much for agreeing to be awesome today! now get out there and do awesome things awesomely to make the world more awesome!</p> </div> css the content is styled using the css below. .panel { font: 16px "open sans", helvetica, arial, sans-se...
HTMLElement.innerText - Web APIs
ould get if they highlighted the contents of the element with the cursor and then copied it to the clipboard. note: innertext is easily confused with node.textcontent, but there are important differences between the two. basically, innertext is aware of the rendered appearance of text, while textcontent is not. syntax const renderedtext = htmlelement.innertext htmlelement.innertext = string value a domstring representing the rendered text content of an element. if the element itself is not being rendered (e.g detached from the document or is hidden from view), the returned value is the same as the node.textcontent property. example this example compares innertext with node.textcontent. note how innertext is aware of things like <br> elements, and ignores hidden elements. html <h3>sou...
... living standard introduced, based on the draft of the innertext specification. see whatwg/html#465 and whatwg/compat#5 for history. ...
... living standard introduced, based on the draft of the innertext specification. see whatwg/html#465 and whatwg/compat#5 for history. ...
Image() - Web APIs
usage note the entire bitmap is loaded regardless of the sizes specified in the constructor. ...
... usage note the entire bitmap is loaded regardless of the sizes specified in the constructor. ...
...tor. the size specified in the constructor is reflected through the properties htmlimageelement.width and htmlimageelement.height of the resulting instance. the intrinsic width and height of the image in css pixels are reflected through the properties htmlimageelement.naturalwidth and htmlimageelement.naturalheight. if no size is specified in the constructor both pairs of properties have the same values. examples var myimage = new image(100, 200); myimage.src = 'picture.jpg'; document.body.appendchild(myimage); this would be the equivalent of defining the following html tag inside the <body>: <img width="100" height="200" src="picture.jpg"> specifications specification status comment html living standardthe definition of 'image()' in that specification. living ...
HTMLImageElement.alt - Web APIs
g alt strings for your images, imagine what you would say when reading the page to someone over the phone without mentioning that there's an image on the page. the alternate text is displayed in the space the image would occupy and should be able to take the place of the image without altering the meaning of the page. syntax htmlimageelement.alt = alttext; let alttext = htmlimageelement.alt; value a domstring which contains the alternate text to display when the image is not loaded or for use by assistive devices. the alt attribute is officially mandatory; it's meant to always be specified. if the image doesn't require a fallback (such as for an image which is simply decorative or an advisory icon of minimal importance), you may specify an empty string (""). for compatibility reasons, br...
... a caption or title. there are separate attributes and elements designed for those purposes. examples beyond that, there are additional guidelines for using alt appropriately which vary depending on what the image is being used for. these are shown in the examples below. decorative images images with no semantic meaning—such as those which are solely decorative—or of limited informational value, should have their alt attributes set to the empty string (""). this is shown in the example below. html in the html for this example, shown below, the <img> element includes the alt property, which will prevent the image from having any alternate text, since it's simply a decorational detail. <div class="container"> <div class="left-margin"> <img src="/files/16861/margin-flourish.svg" a...
...h, or map, the alt text should provide the same information, at least in summary form. this is true whether the /me image is in a bitmapped format such as png or jpeg or in a vector format like svg. for a map, the alt text could be directions to the place indicated by the map, similarly to how you would explain it verbally. for a chart, the text could describe the items in the chart and their values. for a diagram, the text could be an explanation of the concept presented by the diagram. keep in mind that any text included in diagrams and charts presented in svg format may be read by screen readers. this may impact the decisions you make shen writing the alt text for the diagram. icons or logos logos (such as corporate or brand logos) and informational icons should use the correspondin...
HTMLImageElement.complete - Web APIs
the image is considered completely loaded if any of the following are true: neither the src nor the srcset attribute is specified. the srcset attribute is absent and the src attribute, while specified, is the empty string (""). the image resource has been fully fetched and has been queued for rendering/compositing. the image element has previously determined that the image is fully available and ready for use. ...
...ring (""). the image resource has been fully fetched and has been queued for rendering/compositing. the image element has previously determined that the image is fully available and ready for use. the image is "broken;" that is, the image failed to load due to an error or because image loading is disabled. it's worth noting that due to the image potentially being received asynchronously, the value of complete may change while your script is running. examples consider a photo library app that provides the ability to open images into a lightbox mode for improved viewing as well as editing of the image. these photos may be very large, so you don't want to wait for them to load, so your code uses async/await to load the images in the background. but imagine that you have other code that nee...
...eeds to only run when the image has completed loading, such as a command that performs red-eye removal on the image in the lightbox. while ideally this command wouldn't even be executed if the image hasn't fully loaded, for improved reliability you want to check to ensure this is the case. so the fixredeyecommand() function, which is called by the button that triggers red-eye removal, checks the value of the lightbox image's complete property before attempting to do its work. this is demonstrated in the code below. let lightboxelem = document.queryselector("#lightbox"); let lightboximgelem = lightboxelem.queryselector("img"); let lightboxcontrolselem = lightboxelem.queryselector(".toolbar"); async function loadimage(url, elem) { return new promise((resolve, reject) => { elem.onload = (...
HTMLImageElement.loading - Web APIs
the htmlimageelement property loading is a string whose value provides a hint to the user agent that tells the browser how to handle loading images which are currently outside the window's visual viewport. this helps to optimize the loading of the document's contents by postponing loading the image until it's expected to be needed, rather than immediately during the initial page load. syntax let imageloadscheduling = htmlimageelement.loading; htmlimageelement.loading = eagerorlazy; value a domstring providing a hint to the user agent as to how to best schedule the loading of the image to optimize page performance. the possible values are: eager the default behavior, eager tells the browser to load the image as soon as the <img> element is processed. lazy tells the user agent to hold...
...o best schedule the loading of the image to optimize page performance. the possible values are: eager the default behavior, eager tells the browser to load the image as soon as the <img> element is processed. lazy tells the user agent to hold off on loading the image until the browser estimates that it will be needed imminently. for instance, if the user is scrolling through the document, a value of lazy will cause the image to only be loaded shortly before it will appear in the window's visual viewport. usage notes timing of the load event the load event is fired when the document has been fully processed. ...
... images whose loading attribute is set to lazy but are located within the visual viewport immediately upon initial page load are loaded as soon as the layout is known, but their loads do not delay the firing of the load event. ...
HTMLImageElement.srcset - Web APIs
r which that candidate should be used instead of the image specified by the src property. the srcset property, along with the sizes property, are a crucial component in designing responsive web sites, as they can be used together to make pages that use appropriate images for the rendering situation. syntax htmlimageelement.srcset = imagecandidatestrings; let srcset = htmlimageelement.srcset; value a usvstring containing a comma-separated list of one or more image candidate strings to be used when determining which image resource to present inside the <img> element represented by the htmlimageelement. each image candidate string must begin with a valid url referencing a non-interactive graphic resource. this is followed by a comma (,) character and then a condition descriptor that indicat...
...scriptor string 450w. the specified width must be a positive, non-zero, integer, and must match the intrinsic width of the referenced image. alternatively, you can use a pixel density descriptor, which specifies the condition in which the corresponding image resource should be used as the display's pixel density. this is written by stating the pixel density as a positive, non-zero floating-point value followed by the lower-case letter "x". as an example, to state that the corresponding image should be used when the pixel density is double the standard density, you can give the pixel density descriptor 2x or 2.0x. you may mix and match the two types of descriptor. you must not, however, provide multiple image candidate strings that specify the same descriptor. all of the following are valid ...
... displays. <div class="box"> <img src="/files/16797/clock-demo-200px.png" alt="clock" srcset="/files/16864/clock-demo-200px.png 1x, /files/16797/clock-demo-400px.png 2x"> </div> css the css simply specifies that the image and its surrounding box should be 200 pixels square and should have a simple border around it. also provided is the word-break attribute, using the break-all value to tell the browser to wrap the string within the width available regardless of where in the string the wrap must occur. .box { width: 200px; border: 2px solid rgba(150, 150, 150, 255); padding: 0.5em; word-break: break-all; } .box img { width: 200px; } javascript the following code is run within a handler for the window's load event. it uses the image's currentsrc property to fet...
HTMLInputElement.setSelectionRange() - Web APIs
ectionstart' property from 'htmlinputelement': the input element's type ('number') does not support selection". if you wish to select all text of an input element, you can use the htmlinputelement.select() method instead. syntax element.setselectionrange(selectionstart, selectionend [, selectiondirection]); parameters if selectionend is less than selectionstart, 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...
...ength 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 values: "forward" "backward" "none" if the direction is unknown or irrelevant. default value. example click the button in this example to select the third, fourth, and fifth characters in the text box ("zil" in the word "mozilla"). ...
... string indicating the direction in which the selection is considered to have been performed. possible values: "forward" "backward" "none" if the direction is unknown or irrelevant. default value. example click the button in this example to select the third, fourth, and fifth characters in the text box ("zil" in the word "mozilla"). html <input type="text" id="text-box" size="20" value="mozilla"> <button onclick="selecttext()">select text</button> javascript function selecttext() { const input = document.getelementbyid('text-box'); input.focus(); input.setselectionrange(2, 5); } result specifications specification status comment html living standardthe definition of 'htmlinputelement.setselectionrange()' in that specification. living...
HTMLMarqueeElement - Web APIs
1" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlmarqueeelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlmarqueeelement.behavior sets how the text is scrolled within the marquee. possible values are scroll, slide and alternate. if no value is specified, the default value is scroll. htmlmarqueeelement.bgcolor sets the background color through color name or hexadecimal value. htmlmarqueeelement.direction sets the direction of the scrolling within the marquee. possible values are left, right, up and down. if no value is specified, the default value is left. htmlmarqueeelement.height ...
... value is specified, the default value is scroll. htmlmarqueeelement.bgcolor sets the background color through color name or hexadecimal value. htmlmarqueeelement.direction sets the direction of the scrolling within the marquee. possible values are left, right, up and down. if no value is specified, the default value is left. htmlmarqueeelement.height sets the height in pixels or percentage value. htmlmarqueeelement.hspace sets the horizontal margin. htmlmarqueeelement.loop sets the number of times the marquee will scroll. if no value is specified, the default value is −1, which means the marquee will scroll continuously. htmlmarqueeelement.scrollamount sets the amount of scrolling at each interval in pixels. the default value is 6. htmlmarqueeelement.scrolldelay sets the interv...
...mlmarqueeelement.loop sets the number of times the marquee will scroll. if no value is specified, the default value is −1, which means the marquee will scroll continuously. htmlmarqueeelement.scrollamount sets the amount of scrolling at each interval in pixels. the default value is 6. htmlmarqueeelement.scrolldelay sets the interval between each scroll movement in milliseconds. the default value is 85. note that any value smaller than 60 is ignored and the value 60 is used instead, unless truespeed is true. htmlmarqueeelement.truespeed by default, scrolldelay values lower than 60 are ignored. if truespeed is true, then those values are not ignored. htmlmarqueeelement.vspace sets the vertical margin. htmlmarqueeelement.width sets the width in pixels or percentage value. event hand...
HTMLMediaElement.ended - Web APIs
example var obj = document.createelement('video'); console.log(obj.ended); // false specifications specification status comment html living standardthe definition of 'htmlmediaelement.ended' in that specification. ...
... example var obj = document.createelement('video'); console.log(obj.ended); // false specifications specification status comment html living standardthe definition of 'htmlmediaelement.ended' in that specification. ...
... example var obj = document.createelement('video'); console.log(obj.ended); // false specifications specification status comment html living standardthe definition of 'htmlmediaelement.ended' in that specification. ...
HTMLOrForeignElement.tabIndex - Web APIs
the tabindex property of the htmlorforeignelement interface represents the tab order of the current element. tab order is as follows: elements with a positive tabindex. elements that have identical tabindex values should be navigated in the order they appear. navigation proceeds from the lowest tabindex to the highest tabindex. elements that do not support the tabindex attribute or support it and assign tabindex to 0, in the order they appear. elements that are disabled do not participate in the tabbing order. ...
...s follows: elements with a positive tabindex. elements that have identical tabindex values should be navigated in the order they appear. navigation proceeds from the lowest tabindex to the highest tabindex. elements that do not support the tabindex attribute or support it and assign tabindex to 0, in the order they appear. elements that are disabled do not participate in the tabbing order. values don't need to be sequential, nor must they begin with any particular value. they may even be negative, though each browser trims very large values. ...
...at do not support the tabindex attribute or support it and assign tabindex to 0, in the order they appear. elements that are disabled do not participate in the tabbing order. values don't need to be sequential, nor must they begin with any particular value. they may even be negative, though each browser trims very large values. syntax element.tabindex = index; var index = element.tabindex; value index is an integer example const b1 = document.getelementbyid('button1'); b1.tabindex = 1; specifications specification status comment html living standardthe definition of 'tabindex' in that specification. living standard no change from document object model (dom) level 2 html specification. document object model (dom) level 2 html specification...
HTMLSelectElement.labels - Web APIs
the htmlselectelement.labels read-only property returns a nodelist of the <label> elements associated with the <select> element. syntax var labelelements = select.labels; return value a nodelist containing the <label> elements associated with the <select> element. ...
... the htmlselectelement.labels read-only property returns a nodelist of the <label> elements associated with the <select> element. syntax var labelelements = select.labels; return value a nodelist containing the <label> elements associated with the <select> element. ...
... the htmlselectelement.labels read-only property returns a nodelist of the <label> elements associated with the <select> element. syntax var labelelements = select.labels; return value a nodelist containing the <label> elements associated with the <select> element. ...
HTMLSelectElement.options - Web APIs
the htmlselectelement.options read-only property returns a htmloptionscollection of the <option> elements contained by the <select> element. syntax var options = select.options; return value a htmloptionscollection containing the <option> elements contained by the <select> element. ...
... the htmlselectelement.options read-only property returns a htmloptionscollection of the <option> elements contained by the <select> element. syntax var options = select.options; return value a htmloptionscollection containing the <option> elements contained by the <select> element. ...
... htmlselectelement.options read-only property returns a htmloptionscollection of the <option> elements contained by the <select> element. syntax var options = select.options; return value a htmloptionscollection containing the <option> elements contained by the <select> element. ...
HTMLStyleElement.scoped - Web APIs
the htmlstyleelement.scoped property is a boolean value indicating if the element applies to the whole document (false) or only to the parent's sub-tree (true). ...
... the htmlstyleelement.scoped property is a boolean value indicating if the element applies to the whole document (false) or only to the parent's sub-tree (true). ...
... the htmlstyleelement.scoped property is a boolean value indicating if the element applies to the whole document (false) or only to the parent's sub-tree (true). ...
HTMLTableElement - Web APIs
htmltableelement changes. htmltableelement.tbodiesread only returns a live htmlcollection containing all the <tbody> of the element. the htmlcollection is live and is automatically updated when the htmltableelement changes. obsolete properties warning: the following properties are obsolete. you should avoid using them. htmltableelement.align is a domstring containing an enumerated value reflecting the align attribute. it indicates the alignment of the element's contents with respect to the surrounding context. the possible values are "left", "right", and "center". htmltableelement.bgcolor is a domstring containing the background color of the cells. it reflects the obsolete bgcolor attribute. htmltableelement.border is a domstring containing the width in pixels of the bor...
...ects the obsolete cellpadding attribute. htmltableelement.cellspacing is a domstring containing the width in pixels of the horizontal and vertical separation between cells. it reflects the obsolete cellspacing attribute. htmltableelement.frame is a domstring containing the type of the external borders of the table. it reflects the obsolete frame attribute and can take one of the following values: "void", "above", "below", "hsides", "vsides", "lhs", "rhs", "box", or "border". htmltableelement.rules is a domstring containing 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...
...eelement.insertrow() returns an htmltablerowelement representing a new row of the table. it inserts it in the rows collection immediately before the <tr> element at the given index position. if necessary a <tbody> is created. if the index is -1, the new row is appended to the collection. if the index is smaller than -1 or greater than the number of rows in the collection, a domexception with the value indexsizeerror is raised. htmltableelement.deleterow() removes the row corresponding to the index given in parameter. if the index value is -1 the last row is removed; if it smaller than -1 or greater than the amount of rows in the collection, a domexception with the value indexsizeerror is raised. specifications specification status comment html living standardth...
HTMLTableSectionElement - Web APIs
ext x="376" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmltablesectionelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmltablesectionelement.align is a domstring containing an enumerated value reflecting the align attribute. it indicates the alignment of the element's contents with respect to the surrounding context. the possible values are "left", "right", and "center". htmltablesectionelement.rows read only returns a live htmlcollection containing the rows in the section. the htmlcollection is live and is automatically updated when rows are added or removed. htmltablesectioneleme...
...ll supported. htmltablesectionelement.choff is 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 htmltablerowelement.ch. this property was optional and was not very well supported. htmltablesectionelement.valign is a domstring representing an enumerated value indicating how the content of the cell must be vertically aligned. it reflects the valign attribute and can have one of the following values: "top", "middle", "bottom", or "baseline". methods inherits methods from its parent, htmlelement. htmltablesectionelement.deleterow() removes the cell at the given position in the section. if the given position is greater (or equal as it starts at zer...
...one of the following values: "top", "middle", "bottom", or "baseline". methods inherits methods from its parent, htmlelement. htmltablesectionelement.deleterow() removes the cell at the given position in the section. if the given position is greater (or equal as it starts at zero) than the amount of rows in the section, or is smaller than 0, it raises a domexception with the indexsizeerror value. htmltablesectionelement.insertrow() inserts a new row just before the given position in the section. if the given position is not given or is -1, it appends the row to the end of section. if the given position is greater (or equal as it starts at zero) than the amount of rows in the section, or is smaller than -1, it raises a domexception with the indexsizeerror value. specifications ...
The HTML DOM API - Web APIs
cification, are used by the websockets_api. closeevent websocket server-sent events interfaces the eventsource interface represents the source which sent or is sending server-sent events. eventsource examples in this example, an <input> element's input event is monitored in order to update the state of a form's "submit" button based on whether or not a given field currently has a value. javascript const namefield = document.getelementbyid("username"); const sendbutton = document.getelementbyid("sendbutton") sendbutton.disabled = true; // [note: this is disabled since it causes this article to always load with this example focused and scrolled into view] //namefield.focus(); namefield.addeventlistener("input", event => { const elem = event.target; const valid = elem.valu...
...inputelement 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 marked with "*" are r...
...d when it's empty. html the html for the form looks like this: <p>please provide the information below. ...
Headers.getAll() - Web APIs
Web › API › Headers › getAll
obsolete since gecko 52 (firefox 52 / thunderbird 52 / seamonkey 2.49)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. the getall() method of the headers interface used to return an array of all the values of a header within a headers object with a given name; in newer versions of the fetch spec, it has been deleted, and headers.get() has been updated to fetch all header values instead of only the first one. if the requested header doesn't exist in the headers object, it returns an empty array. for security reasons, some headers can only be controller by the user agent. these headers include the forbidden header names and forbidden response header names. syntax myheaders.get...
...to fetch all header values instead of only the first one. if the requested header doesn't exist in the headers object, it returns an empty array. for security reasons, some headers can only be controller by the user agent. these headers include the forbidden header names and forbidden response header names. syntax myheaders.getall(name); parameters name the name of the http header whose values you want to retrieve from the headers object. if the given name is not the name of an http header, this method throws a typeerror. returns an array containing a bytestring sequence representing the values of the retrieved header. example creating an empty headers object is simple: var myheaders = new headers(); // currently empty you could add a header to this using headers.append, then r...
...ytestring sequence representing the values of the retrieved header. example creating an empty headers object is simple: var myheaders = new headers(); // currently empty you could add a header to this using headers.append, then retrieve it using getall(): myheaders.append('content-type', 'image/jpeg'); myheaders.getall('content-type'); // returns [ "image/jpeg" ] if the header has multiple values associated with it, the array will contain all the values, in the order they were added to the headers object: myheaders.append('accept-encoding', 'deflate'); myheaders.append('accept-encoding', 'gzip'); myheaders.getall('accept-encoding'); // returns [ "deflate", "gzip" ] note: use headers.get to return only the first value added to the headers object. ...
IDBCursor.continue() - Web APIs
d past its end. example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store. the cursor does not require us to select the data based on a key; we can just grab all of it. also note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo. for a complete working example, see our idbcursor example (view example live.) function displaydata() { var transaction = db.transaction(['rushalbumlist'], "readonly"); var objectstore = transaction.objectstore('rushalbumlist'); objectstore.opencursor().onsuccess = function(event) { var cursor = event.target.result; if(cursor) { var listitem = document.createelement('li...
... recommendation indexed database api draftthe definition of '...
... recommendation indexed database api draftthe definition of 'continue()' in that specification...
IDBCursor.request - Web APIs
Web › API › IDBCursor › request
examples when you open a cursor, the request property is then available on that cursor object, to tell you what request object the cursor originated from. ...
... recommendation initia...
... recommendation initial definition. browser compatibility...
IDBDatabase.transaction() - Web APIs
bdatabase interface immediately returns a transaction object (idbtransaction) containing the idbtransaction.objectstore method, which you can use to access your object store. note: this feature is available in web workers. syntax idbdatabase.transaction(storenames); idbdatabase.transaction(storenames, mode); parameters "durability" -- the durability constrints for the transction. valid values are: "default", "strict", and "relaxed". storenames the names of object stores that are in the scope of the new transaction, declared as an array of strings. specify only the object stores that you need to access. if you need to access only one object store, you can specify its name as a string. therefore the following lines are equivalent: var transaction = db.transaction(['my-store-na...
...orce a transaction to flush to disk before delivering the complete event by creating a transaction using the experimental (non-standard) readwriteflush mode (see idbdatabase.transaction.) this is currently experimental, and can only be used if the dom.indexeddb.experimental pref is set to true in about:config. details optional dictionary of other settings, supported only by chrome: return value an idbtransaction object. exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror the close() method has previously been called on this idbdatabase instance. notfounderror an object store specified in in the storenames parameter has been deleted or removed. typeerror the...
... an idbtransaction object. exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror the close() method has previously been called on this idbdatabase instance. notfounderror an object store specified in in the storenames parameter has been deleted or removed. typeerror the value for the mode parameter is invalid. invalidaccesserror the function was called with an empty list of store names. example in this example we open a database connection, then use transaction() to open a transaction on the database. for a complete example, see our to-do notifications app (view example live.) var db; // let us open our database var dbopenrequest = window.i...
IDBFactory.cmp() - Web APIs
Web › API › IDBFactory › cmp
the cmp() method of the idbfactory interface compares two values as keys to determine equality and ordering for indexeddb operations, such as storing and iterating. note: this feature is available in web workers. note: do not use this method for comparing arbitrary javascript values, because many javascript values are either not valid indexeddb keys (booleans and objects, for example) or are treated as equivalent indexeddb keys (for example, since indexeddb ignores arrays with non-numeric properties and treats them as empty arrays, so any non-numeric arrays are treated as equivalent). this throws an exception if either of the values is not a valid key. syntax var result = indexeddb.cmp(first, second); parameters first the first key to compare. second the second key to compare. ...
...quivalent indexeddb keys (for example, since indexeddb ignores arrays with non-numeric properties and treats them as empty arrays, so any non-numeric arrays are treated as equivalent). this throws an exception if either of the values is not a valid key. syntax var result = indexeddb.cmp(first, second); parameters first the first key to compare. second the second key to compare. ...
...and treats them as empty arrays, so any non-numeric arrays are treated as equivalent). this throws an exception if either of the values is not a valid key. syntax var result = indexeddb.cmp(first, second); parameters first the first key to compare. second the second key to compare. return value an integer that indicates the result of the comparison; the table below lists the possible values and their meanings: returned value description -1 1st key is less than the 2nd key 0 1st key is equal to the 2nd key 1 1st key is greater than the 2nd key exceptions this method may raise a domexception of the following types: attribute description dataerror one of the supplied keys was not a valid key. exam...
IDBIndex.count() - Web APIs
Web › API › IDBIndex › count
the count() method of the idbindex interface returns an idbrequest object, and in a separate thread, returns the number of records within a key range. note: this feature is available in web workers. syntax var request = myindex.count(); var request = myindex.count(key); parameters key optional the key or key range that identifies the record to be counted. return value a idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbindex's transaction is inactive. dataerror the key or key range provided contains an invalid key. invalidstateerror the idbindex has been ...
....objectstore('contactslist'); var myindex = objectstore.index('lname'); var countrequest = myindex.count(); countrequest.onsuccess = function() { console.log(countrequest.result); } myindex.opencursor().onsuccess = function(event) { var cursor = event.target.result; if(cursor) { var tablerow = document.createelement('tr'); tablerow.innerhtml = '<td>' + cursor.value.id + '</td>' + '<td>' + cursor.value.lname + '</td>' + '<td>' + cursor.value.fname + '</td>' + '<td>' + cursor.value.jtitle + '</td>' + '<td>' + cursor.value.company + '</td>' + '<td>' + cursor.value.email + '</td>' + '<td>' + cursor.val...
....lname + '</td>' + '<td>' + cursor.value.fname + '</td>' + '<td>' + cursor.value.jtitle + '</td>' + '<td>' + cursor.value.company + '</td>' + '<td>' + cursor.value.email + '</td>' + '<td>' + cursor.value.phone + '</td>' + '<td>' + cursor.value.age + '</td>'; tableentry.appendchild(tablerow); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'count()' in that specification. recommendation indexed database api draftthe definition of 'count()' in that spec...
IDBIndex.get() - Web APIs
Web › API › IDBIndex › get
the get() method of the idbindex interface returns an idbrequest object, and, in a separate thread, finds either the value in the referenced object store that corresponds to the given key or the first corresponding value, if key is set to an idbkeyrange. if a value is found, then a structured clone of it is created and set as the result of the request object: this returns the record the key is associated with. note: this feature is available in web workers. syntax var request = myindex.get(key); parameters key optional a key or idbkeyrange that identifies the record to be retrieved. if this value is null or missing, the browser will use an unbound key range. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method ...
....objectstore('contactslist'); var myindex = objectstore.index('lname'); var getrequest = myindex.get('bungle'); getrequest.onsuccess = function() { console.log(getrequest.result); } myindex.opencursor().onsuccess = function(event) { var cursor = event.target.result; if(cursor) { var tablerow = document.createelement('tr'); tablerow.innerhtml = '<td>' + cursor.value.id + '</td>' + '<td>' + cursor.value.lname + '</td>' + '<td>' + cursor.value.fname + '</td>' + '<td>' + cursor.value.jtitle + '</td>' + '<td>' + cursor.value.company + '</td>' + '<td>' + cursor.value.email + '</td>' + '<td>' + cursor.val...
....lname + '</td>' + '<td>' + cursor.value.fname + '</td>' + '<td>' + cursor.value.jtitle + '</td>' + '<td>' + cursor.value.company + '</td>' + '<td>' + cursor.value.email + '</td>' + '<td>' + cursor.value.phone + '</td>' + '<td>' + cursor.value.age + '</td>'; tableentry.appendchild(tablerow); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'get()' in that specification. recommendation browser compatibility the compatibility table on this page is genera...
IDBIndex.getKey() - Web APIs
Web › API › IDBIndex › getKey
t corresponding primary key, if key is set to an idbkeyrange. if a primary key is found, it is set as the result of the request object. note that this doesn't return the whole record as idbindex.get does. note: this feature is available in web workers. syntax var request = myindex.getkey(key); parameters key optional a key or idbkeyrange that identifies a record to be retrieved. if this value is null or missing, the browser will use an unbound key range. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbindex's transaction is inactive. dataerror the key or...
...('contactslist'); var myindex = objectstore.index('lname'); var getkeyrequest = myindex.getkey('bungle'); getkeyrequest.onsuccess = function() { console.log(getkeyrequest.result); } myindex.opencursor().onsuccess = function(event) { var cursor = event.target.result; if(cursor) { var tablerow = document.createelement('tr'); tablerow.innerhtml = '<td>' + cursor.value.id + '</td>' + '<td>' + cursor.value.lname + '</td>' + '<td>' + cursor.value.fname + '</td>' + '<td>' + cursor.value.jtitle + '</td>' + '<td>' + cursor.value.company + '</td>' + '<td>' + cursor.value.email + '</td>' + '<td>' + cursor.val...
....lname + '</td>' + '<td>' + cursor.value.fname + '</td>' + '<td>' + cursor.value.jtitle + '</td>' + '<td>' + cursor.value.company + '</td>' + '<td>' + cursor.value.email + '</td>' + '<td>' + cursor.value.phone + '</td>' + '<td>' + cursor.value.age + '</td>'; tableentry.appendchild(tablerow); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'getkey()' in that specification. recommendation indexed database api draftthe definition of 'getkey()' in that spec...
IDBIndex.isAutoLocale - Web APIs
the isautolocale read-only property of the idbindex interface returns a boolean indicating whether the index had a locale value of auto specified upon its creation (see createindex()'s optionalparameters.) syntax var myindex = objectstore.index('index'); console.log(myindex.isautolocale); value a boolean. example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database. we then open a basic cursor on the index using idbindex.opencursor — this works the same as opening a cursor directly on an objectstore using idbobjectstore.opencursor except that the returned records are sorted based on the index, not the primary key. the isautolocale value is logged to the console. function displaydatabyindex() { tableen...
...ion = db.transaction(['contactslist'], 'readonly'); var objectstore = transaction.objectstore('contactslist'); var myindex = objectstore.index('lname'); console.log(myindex.isautolocale); myindex.opencursor().onsuccess = function(event) { var cursor = event.target.result; if(cursor) { var tablerow = document.createelement('tr'); tablerow.innerhtml = '<td>' + cursor.value.id + '</td>' + '<td>' + cursor.value.lname + '</td>' + '<td>' + cursor.value.fname + '</td>' + '<td>' + cursor.value.jtitle + '</td>' + '<td>' + cursor.value.company + '</td>' + '<td>' + cursor.value.email + '</td>' + '<td>' + cursor.val...
... ...
IDBIndex.keyPath - Web APIs
Web › API › IDBIndex › keyPath
example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database. ...
...nsaction = db.transaction(['contactslist'], 'readonly'); var objectstore = transaction.objectstore('contactslist'); var myindex = objectstore.index('lname'); console.log(myindex.keypath); myindex.opencursor().onsuccess = function(event) { var cursor = event.target.result; if(cursor) { var tablerow = document.createelement('tr'); tablerow.innerhtml = '<td>' + cursor.value.id + '</td>' + '<td>' + cursor.value.lname + '</td>' + '<td>' + cursor.value.fname + '</td>' + '<td>' + cursor.value.jtitle + '</td>' + '<td>' + cursor.value.company + '</td>' + '<td>' + cursor.value.email + '</td>' + '<td>' + cursor.val...
....lname + '</td>' + '<td>' + cursor.value.fname + '</td>' + '<td>' + cursor.value.jtitle + '</td>' + '<td>' + cursor.value.company + '</td>' + '<td>' + cursor.value.email + '</td>' + '<td>' + cursor.value.phone + '</td>' + '<td>' + cursor.value.age + '</td>'; tableentry.appendchild(tablerow); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'keypath' in that specification. recommendation indexed database api draftthe definition of 'keypath' in that specific...
IDBIndex.name - Web APIs
Web › API › IDBIndex › name
exceptions there are a several exceptions which can occur when you attempt to change an index's name. invalidstateerror the index, or its object store, has been deleted; or the current transaction is not an upgrade transaction. you can only rename indexes during upgrade transactions; that is, when the mode is "versionchange". ...
...transaction = db.transaction(['contactslist'], 'readonly'); var objectstore = transaction.objectstore('contactslist'); var myindex = objectstore.index('lname'); console.log(myindex.name); myindex.opencursor().onsuccess = function(event) { var cursor = event.target.result; if(cursor) { var tablerow = document.createelement('tr'); tablerow.innerhtml = '<td>' + cursor.value.id + '</td>' + '<td>' + cursor.value.lname + '</td>' + '<td>' + cursor.value.fname + '</td>' + '<td>' + cursor.value.jtitle + '</td>' + '<td>' + cursor.value.company + '</td>' + '<td>' + cursor.value.email + '</td>' + '<td>' + cursor.val...
....lname + '</td>' + '<td>' + cursor.value.fname + '</td>' + '<td>' + cursor.value.jtitle + '</td>' + '<td>' + cursor.value.company + '</td>' + '<td>' + cursor.value.email + '</td>' + '<td>' + cursor.value.phone + '</td>' + '<td>' + cursor.value.age + '</td>'; tableentry.appendchild(tablerow); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'name' in that specification. recommendation indexed database api draftthe definition of 'name' in that specification.
IDBIndex.objectStore - Web APIs
example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database. we then open a basic cursor on the index using idbindex.opencursor. ...
...tion = db.transaction(['contactslist'], 'readonly'); var objectstore = transaction.objectstore('contactslist'); var myindex = objectstore.index('lname'); console.log(myindex.objectstore); myindex.opencursor().onsuccess = function(event) { var cursor = event.target.result; if(cursor) { var tablerow = document.createelement('tr'); tablerow.innerhtml = '<td>' + cursor.value.id + '</td>' + '<td>' + cursor.value.lname + '</td>' + '<td>' + cursor.value.fname + '</td>' + '<td>' + cursor.value.jtitle + '</td>' + '<td>' + cursor.value.company + '</td>' + '<td>' + cursor.value.email + '</td>' + '<td>' + cursor.val...
....lname + '</td>' + '<td>' + cursor.value.fname + '</td>' + '<td>' + cursor.value.jtitle + '</td>' + '<td>' + cursor.value.company + '</td>' + '<td>' + cursor.value.email + '</td>' + '<td>' + cursor.value.phone + '</td>' + '<td>' + cursor.value.age + '</td>'; tableentry.appendchild(tablerow); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'objectstore' in that specification. recommendation indexed database api draftthe definition of 'objectstore' in that ...
IDBIndex.unique - Web APIs
Web › API › IDBIndex › unique
property returns a boolean that states whether the index allows duplicate keys. this is decided when the index is created, using the idbobjectstore.createindex method. this method takes an optional parameter, unique, which if set to true means that the index will not be able to accept duplicate entries. note: this feature is available in web workers. syntax var isunique = idbindex.unique; value a boolean: value effect true the current index does not allow duplicate values for a key. false the current index allows duplicate key values. example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database. we then open a basic cursor on the index using idbindex.opencursor — t...
...ansaction = db.transaction(['contactslist'], 'readonly'); var objectstore = transaction.objectstore('contactslist'); var myindex = objectstore.index('lname'); console.log(myindex.unique); myindex.opencursor().onsuccess = function(event) { var cursor = event.target.result; if(cursor) { var tablerow = document.createelement('tr'); tablerow.innerhtml = '<td>' + cursor.value.id + '</td>' + '<td>' + cursor.value.lname + '</td>' + '<td>' + cursor.value.fname + '</td>' + '<td>' + cursor.value.jtitle + '</td>' + '<td>' + cursor.value.company + '</td>' + '<td>' + cursor.value.email + '</td>' + '<td>' + cursor.val...
....lname + '</td>' + '<td>' + cursor.value.fname + '</td>' + '<td>' + cursor.value.jtitle + '</td>' + '<td>' + cursor.value.company + '</td>' + '<td>' + cursor.value.email + '</td>' + '<td>' + cursor.value.phone + '</td>' + '<td>' + cursor.value.age + '</td>'; tableentry.appendchild(tablerow); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'unique' in that specification. recommendation indexed database api draftthe definition of 'unique' in that specificat...
IDBObjectStore.add() - Web APIs
this is for adding new records to an object store. to determine if the add operation has completed successfully, listen for the transaction’s complete event in addition to the idbobjectstore.add request’s success event, because the transaction may still fail after the success event fires. in other words, the success event is only triggered when the transaction has been successfully queued. the add method is an insert only method. ...
... been successfully queued. the add method is an insert only method. if a record already exists in the object store with the key parameter as its key, then an error constrainerror event is fired on the returned request object. for updating existing records, you should use the idbobjectstore.put method instead. note: this feature is available in web workers. syntax var request = objectstore.add(value); var request = objectstore.add(value, key); parameters value the value to be stored. key optional the key to use to identify the record. if unspecified, it results to null. returns an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description ...
...es not contain a valid key. invalidstateerror the idbobjectstore has been deleted or removed. datacloneerror the data being stored could not be cloned by the internal structured cloning algorithm. constrainterror an insert operation failed because the primary key constraint was violated (due to an already existing record with the same primary key value). example in the following code snippet, we open a read/write transaction on our database and add some data to an object store using add(). note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure. for a full working example, see our to-do notifications app (view example live.) // let us open our...
IDBObjectStore.autoIncrement - Web APIs
false the object store does not auto increment. example in the following code snippet, we open a read/write transaction on our database and add some data to an object store using add(). ...
... false the object store does not auto increment. example in the following code snippet, we open a read/write transaction on our database and add some data to an object store using add(). ...
... false the object store does not auto increment. example in the following code snippet, we open a read/write transaction on our database and add some data to an object store using add(). ...
IDBObjectStore.get() - Web APIs
to tell these situations apart, call the opencursor() method with the same key. ...
...nd, in a separate thread, returns the object store selected by the specified key. this is for retrieving specific records from an object store. if a value is successfully found, then a structured clone of it is created and set as the result of the request object. note: this method produces the same result for: a) a record that doesn't exist in the database and b) a record that has an undefined value. to tell these situations apart, call the opencursor() method with the same key. that method provides a cursor if the record exists, and no cursor if it does not. note: this feature is available in web workers. ...
... exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbobjectstore's transaction is inactive. ...
IDBObjectStore.index() - Web APIs
the index() method of the idbobjectstore interface opens a named index in the current object store, after which it can be used to, for example, return a series of records sorted by that index using a cursor. note: this feature is available in web workers. syntax var index = objectstore.index(name); parameters name the name of the index to open. return value an idbindex object for accessing the index. exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror the source object store has been deleted, or the transaction for the object store has finished. notfounderror there is no index with the given name (case-sensitive) in the database. example in the following exa...
...leentry.innerhtml = ''; var transaction = db.transaction(['contactslist'], 'readonly'); var objectstore = transaction.objectstore('contactslist'); var myindex = objectstore.index('lname'); myindex.opencursor().onsuccess = function(event) { var cursor = event.target.result; if(cursor) { var tablerow = document.createelement('tr'); tablerow.innerhtml = '<td>' + cursor.value.id + '</td>' + '<td>' + cursor.value.lname + '</td>' + '<td>' + cursor.value.fname + '</td>' + '<td>' + cursor.value.jtitle + '</td>' + '<td>' + cursor.value.company + '</td>' + '<td>' + cursor.value.email + '</td>' + '<td>' + cursor.val...
....lname + '</td>' + '<td>' + cursor.value.fname + '</td>' + '<td>' + cursor.value.jtitle + '</td>' + '<td>' + cursor.value.company + '</td>' + '<td>' + cursor.value.email + '</td>' + '<td>' + cursor.value.phone + '</td>' + '<td>' + cursor.value.age + '</td>'; tableentry.appendchild(tablerow); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'index()' in that specification. recommendation indexed database api draftthe definition of 'index()' in that specific...
IDBObjectStore.openCursor() - Web APIs
used for iterating through an object store with a cursor. to determine if the add operation has completed successfully, listen for the results’s success event. note: this feature is available in web workers. syntax var request = objectstore.opencursor(); var request = objectstore.opencursor(query); var request = objectstore.opencursor(query, direction); parameters query optional a key or idbkeyrange to be queried. ...
...= objectstore.opencursor(query, direction); parameters query optional a key or idbkeyrange to be queried. if a single valid key is passed, this will default to a range containing only that key. if nothing is passed, this will default to a key range that selects all the records in this object store. direction optional an idbcursordirection telling the cursor what direction to travel. valid values are "next", "nextunique", "prev", and "prevunique". the default is "next". return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror this idbobjectstore or idbindex has been deleted. transactionin...
... recommendation indexed database api draftthe definition of...
IDBRequest.error - Web APIs
Web › API › IDBRequest › error
in chrome 48+/firefox 58+ this property returns a domexception because domerror has been removed from the dom standard. the following error codes are returned under certain conditions: error explanation aborterror if you abort the transaction, then all requests still in progress receive this error. ...
...k dog"; // open up a transaction as usual var objectstore = db.transaction(['todolist'], "readwrite").objectstore('todolist'); // get the do-do list with the specified title var objectstoretitlerequest = objectstore.get(title); objectstoretitlerequest.onsuccess = function() { // grab the data object returned as the result var data = objectstoretitlerequest.result; // update the notified value in the object to "yes" data.notified = "yes"; // create another request that inserts the item // back into the database var updatetitlerequest = objectstore.put(data); // when this new request succeeds, run the displaydata() // function again to update the display updatetitlerequest.onsuccess = function() { displaydata(); }; }; objectstoretitlerequest.onerror = function() {...
... full support 14safari ios full support 8samsung internet android full support 1.5 full support 1.5 no support 1.5 — 7.0prefixed prefixed implemented with the vendor prefix: webkitdomexception value instead of domerrorchrome full support 48edge full support ≤18firefox full support 58ie no support noopera full support yessafari no support ...
IDBTransaction - Web APIs
transaction failures transactions can fail for a fixed number of reasons, all of which (except the user agent crash) will trigger an abort callback: abort due to bad requests, e.g. trying to add() the same key twice, or put() with the same index key with a uniqueness constraint. this causes an error on the request, which can bubble up to an error on...
...a domexception indicating the type of error that occured when there is an unsuccessful transaction. this property is null if the transaction is not finished, is finished and successfully committed, or was aborted with theidbtransaction.abort() function. idbtransaction.mode read only the mode for isolating access to data in the object stores that are in the scope of the transaction. the default value is readonly. idbtransaction.objectstorenames read only returns a domstringlist of the names of idbobjectstore objects associated with the transaction. methods inherits from: eventtarget idbtransaction.abort() rolls back all the changes to objects in the database associated with this transaction. if this transaction has been aborted or completed, this method fires an error event. idbtra...
...ia the oncomplete property. error fired when a request returns an error and the event bubbles up to the transaction object. also available via the onerror property. mode constants these constants are no longer available — they were removed in gecko 25. you should use the string constants directly instead. (bug 888598) transactions can have one of three modes: constant value description read_only "readonly" (0 in chrome) allows data to be read but not changed. read_write "readwrite" (1 in chrome) allows reading and writing of data in existing data stores to be changed. version_change "versionchange" (2 in chrome) allows any operation to be performed, including ones ...
IIRFilterNode.getFrequencyResponse() - Web APIs
the getfrequencyresponse() method of the iirfilternode interface takes the current filtering algorithm's settings and calculates the frequency response for frequencies specified in a specified array of frequencies. the two output arrays, magresponseoutput and phaseresponseoutput, must be created before calling this method; they must be the same size as the array of input frequency values (frequencyarray). syntax iirfilternode.getfrequencyresponse(frequencyarray, magresponseoutput, phaseresponseoutput); parameters frequencyarray a float32array containing an array of frequencies, specified in hertz, which you want to filter. magresponseoutput a float32array to receive the computed magnitudes of the freqency response for each frequency value in the frequencyarray. phaseresponseoutpu...
...encyarray, magresponseoutput, phaseresponseoutput); parameters frequencyarray a float32array containing an array of frequencies, specified in hertz, which you want to filter. magresponseoutput a float32array to receive the computed magnitudes of the freqency response for each frequency value in the frequencyarray. 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 re...
... 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. ...
IdleDeadline.didTimeout - Web APIs
the read-only didtimeout property on the idledeadline interface is a boolean value which indicates whether or not the idle callback is being invoked because the timeout interval specified when window.requestidlecallback() was called has expired. if didtimeout is true, the idledeadline object's timeremaining() method will return approximately 0. idle callbacks support the concept of a timeout in order to ensure that whatever task they're meant to perform actually happens, even if the user agent never has enough idle time available. ...
...specified when window.requestidlecallback() was called has expired. if didtimeout is true, the idledeadline object's timeremaining() method will return approximately 0. idle callbacks support the concept of a timeout in order to ensure that whatever task they're meant to perform actually happens, even if the user agent never has enough idle time available. ...
... example see our complete example in the article cooperative scheduling of background tasks api. ...
ImageData.data - Web APIs
Web › API › ImageData › data
the readonly imagedata.data property returns a uint8clampedarray that contains the imagedata object's pixel data. data is stored as a one-dimensional array in the rgba order, with integer values between 0 and 255 (inclusive). syntax imagedata.data 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"...
...ixel, 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 = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const imagedata = ctx.createimagedata(100, 100); // iterate through every pixel for (let i = 0; i < imagedata.data.length; i += 4) { // pe...
...st ctx = canvas.getcontext('2d'); const imagedata = ctx.createimagedata(100, 100); // iterate through every pixel for (let i = 0; i < imagedata.data.length; i += 4) { // percentage in the x direction, times 255 let x = (i % 400) / 400 * 255; // percentage in the y direction, times 255 let y = math.ceil(i / 400) / 100 * 255; // modify pixel data imagedata.data[i + 0] = x; // r value imagedata.data[i + 1] = y; // g value imagedata.data[i + 2] = 255 - x; // b value imagedata.data[i + 3] = 255; // a value } // draw image data to the canvas ctx.putimagedata(imagedata, 20, 20); result more examples for more examples using imagedata.data, see pixel manipulation with canvas, canvasrenderingcontext2d.createimagedata(), and canvasrenderingcontext2d.putimageda...
IntersectionObserver.IntersectionObserver() - Web APIs
is approximately the same as that for the css margin property; see the root element and root margin in intersection observer api for more information on how the margin works and the syntax. the default is "0px 0px 0px 0px". threshold either a single number or an array of numbers between 0.0 and 1.0, specifying a ratio of intersection area to total bounding box area for the observed target. ...
...0.0 and 1.0, specifying a ratio of intersection area to total bounding box area for the observed target. a value of 0.0 means that even a single visible pixel counts as the target being visible. 1.0 means that the entire target element is visible. see thresholds in intersection observer api for a more in-depth description of how thresholds are used. the default is a threshold of 0.0. return value a new intersectionobserver which can be used to watch for the visibility of a target element within the specified root crossing through any of the specified visibility thresholds. call its observe() method to begin watching for the visibility changes on a given target. ...
... example this example creates a new intersection observer which calls the function myobservercallback every time the visible area of the element being observed changes by at least 10%. ...
KeyboardEvent() - Web APIs
the keyboardevent() constructor creates a new keyboardevent. syntax event = new keyboardevent(typearg, keyboardeventinit); values typearg is a domstring representing the name of the event. keyboardeventinitoptional is a keyboardeventinit dictionary, having the following fields: "key", optional and defaulting to "", of type domstring, that sets the value of keyboardevent.key. "code", optional and defaulting to "", of type domstring, that sets the value of keyboardevent.code. "location", optional and defaulting to 0, of type unsigned long, that sets the value of keyboardevent.location. "ctrlkey", optional and defaulting to false, of type boolean, that sets the value of keyboardevent.ctrlkey. "shiftkey", optional and defaulting to false, of type boolean, that sets the va...
... optional and defaulting to 0, of type unsigned long, that sets the value of keyboardevent.location. "ctrlkey", optional and defaulting to false, of type boolean, that sets the value of keyboardevent.ctrlkey. "shiftkey", optional and defaulting to false, of type boolean, that sets the value of keyboardevent.shiftkey. "altkey", optional and defaulting to false, of type boolean, that sets the value of keyboardevent.altkey. "metakey", optional and defaulting to false, of type boolean, that sets the value of keyboardevent.metakey. "repeat", optional and defaulting to false, of type boolean, that sets the value of keyboardevent.repeat. "iscomposing", optional and defaulting to false, of type boolean, that sets the value of keyboardevent.iscomposing. "charcode", optional and defaulting ...
...onal and defaulting to false, of type boolean, that sets the value of keyboardevent.metakey. "repeat", optional and defaulting to false, of type boolean, that sets the value of keyboardevent.repeat. "iscomposing", optional and defaulting to false, of type boolean, that sets the value of keyboardevent.iscomposing. "charcode", optional and defaulting to 0, of type unsigned long, that sets the value of the deprecated keyboardevent.charcode. "keycode", optional and defaulting to 0, of type unsigned long, that sets the value of the deprecated keyboardevent.keycode. "which", optional and defaulting to 0, of type unsigned long, that sets the value of the deprecated keyboardevent.which. the keyboardeventinit dictionary also accepts fields from the uieventinit and eventinit dictionaries.
KeyboardEvent.getModifierState() - Web APIs
this is case-sensitive. ...
...this is case-sensitive. ...
...this is case-sensitive. ...
KeyframeEffect.KeyframeEffect() - Web APIs
ards (normal), backwards (reverse), switches direction after each iteration (alternate), or runs backwards and switches direction after each iteration (alternate-reverse). defaults to "normal". duration optional the number of milliseconds each iteration of the animation takes to complete. defaults to 0. although this is technically optional, keep in mind that your animation will not run if this value is 0. easing optional the rate of the animation's change over time. accepts the pre-defined values "linear", "ease", "ease-in", "ease-out", and "ease-in-out", or a custom "cubic-bezier" value like "cubic-bezier(0.42, 0, 0.58, 1)". defaults to "linear". enddelay optional the number of milliseconds to delay after the end of an animation. this is primarily of use when sequencing animations based...
...ptional dictates whether the animation's effects should be reflected by the element(s) prior to playing ("backwards"), retained after the animation has completed playing ("forwards"), or both. defaults to "none". iterationstart optional describes at what point in the iteration the animation should start. 0.5 would indicate starting halfway through the first iteration for example, and with this value set, an animation with 2 iterations would end halfway through a third iteration. defaults to 0.0. iterations optional the number of times the animation should repeat. defaults to 1, and can also take a value of infinity to make it repeat for as long as the element exists. composite determines how values are combined between this animation and the element's underlying values. iteration...
... the second type of constructor (see above) creates a clone of an existing keyframeeffect object instance. ...
KeyframeEffect - Web APIs
these can then be played using the animation() constructor. constructor keyframeeffect() returns a new keyframeeffect object instance, and also allows you to clone an existing keyframe effect object instance. properties keyframeeffect.target gets and sets the element, or originating element of the pseudo-element, being animated by this object. this may be null for animations that do not target a specific element or pseudo-element. ...
...d by this object. this may be null for animations that do not target a specific element or pseudo-element. keyframeeffect.pseudoelement gets and sets the selector of the pseudo-element being animated by this object. this may be null for animations that do not target a pseudo-element. keyframeeffect.iterationcomposite gets and sets the iteration composite operation for resolving the property value changes of this keyframe effect. keyframeeffect.composite gets and sets the composite operation property for resolving the property value changes between this and other keyframe effects. methods this interface inherits some of its methods from its parent, animationeffect. animationeffect.getcomputedtiming() returns the calculated, current timing values for this keyframe effect. keyframe...
... keyframeeffect.setkeyframes() replaces the set of keyframes that make up this effect. animationeffect.updatetiming() updates the specified timing properties. ...
MSSiteModeEvent - Web APIs
stopimmediatepropagation prevents any further propagation of an event. stoppropagation prevents propagation of an event beyond the current target. properties property description actionurl gets the url of a jump list item that is removed. *this property is not supported for windows store apps using javascript. ...
...s the url of a jump list item that is removed. *this property is not supported for windows store apps using javascript. bubbles gets a value that indicates whether an event propagates up from the event target. buttonid gets the thumbnail toolbar button id that is clicked. *this property is not supported for windows store apps using javascript. cancelable gets a value that indicates whether you can cancel an event's default action. cancelbubble gets or sets a value that indicates whether an event should be stopped from propagating up from the current target. currenttarget gets the event target that is currently being processed. defaultprevented gets a value that indicates whether the default action should be canceled. ...
... srcelement gets the element that the event was originally dispatched to. compare to target. target gets the element that is the target of the event. timestamp gets the time, in milliseconds, when an event occurred. type gets the name of an event. ...
MediaKeyStatusMap.forEach() - Web APIs
returns undefined. ...
... returns undefined. ...
... returns undefined. specifications specification status comment encrypted media extensions recommendation initial definition. ...
MediaKeyStatusMap - Web APIs
the mediakeystatusmap interface of the encryptedmediaextensions api is a read-only map of media key statuses by key ids. properties mediakeystatusmap.size read only returns the number of key/value pars in the status map. methods mediakeystatusmap.entries() read only returns a new iterator object containing an array of [key, value] for each element in the status map, in insertion order. mediakeystatusmap.foreach(callback[, argument]) read only calls callback once for each key-value pair in the status map, in insertion order. if argument is present it will be passed to the callback. ...
...smap.entries() read only returns a new iterator object containing an array of [key, value] for each element in the status map, in insertion order. mediakeystatusmap.foreach(callback[, argument]) read only calls callback once for each key-value pair in the status map, in insertion order. if argument is present it will be passed to the callback. mediakeystatusmap.get() read only returns the value associated with the given key, or undefined if there is none. mediakeystatusmap.has() read only returns a boolean asserting whether a value has been associated with the given key. ...
...k. mediakeystatusmap.get() read only returns the value associated with the given key, or undefined if there is none. mediakeystatusmap.has() read only returns a boolean asserting whether a value has been associated with the given key. mediakeystatusmap.keys() read only returns a new iterator object containing keys for each element in the status map, in insertion order. mediakeystatusmap.values() read only returns a new iterator object containing values for each element in the status map, in insertion order. mediakeystatusmap.[@@iterator]() read only returns a new iterator object containing an array of [key, value] for each element in the status map, in insertion order. specifications specification status comment encrypted media extensionsthe definition ...
MediaPositionState - Web APIs
the media session api's mediapositionstate dictionary is used to represent the current playback position of a media session. its contents can be used by the user agent to provide a user interface displaying information about the playback position and duration of the media currently being performed. properties duration a floating-point value giving the total duration of the current media in seconds. ...
...e a user interface displaying information about the playback position and duration of the media currently being performed. properties duration a floating-point value giving the total duration of the current media in seconds. this should always be a positive number, with positive infinity (infinity) indicating media without a defined end, such as a live stream. playbackrate a floating-point value indicating the rate at which the media is being played, as a ratio relative to its normal playback speed. thus, a value of 1 is playing at normal speed, 2 is playing at double speed, and so forth. ...
...media in seconds. this should always be a positive number, with positive infinity (infinity) indicating media without a defined end, such as a live stream. playbackrate a floating-point value indicating the rate at which the media is being played, as a ratio relative to its normal playback speed. thus, a value of 1 is playing at normal speed, 2 is playing at double speed, and so forth. negative values indicate that the media is playing in reverse; -1 indicates playback at the normal speed but backward, -2 is double speed in reverse, and so on. position a floating-point value indicating the last reported playback position of the media in seconds. this must always be a positive value. specifications specification status comment media session standardthe definiti...
MediaQueryList.media - Web APIs
the media read-only property of the mediaquerylist interface is a domstring representing a serialized media query. syntax var media = mediaquerylist.media; value a domstring representing a serialized media query. examples this example runs the media query (max-width: 600px) and displays the value of the resulting mediaquerylist's media property in a <span>. ...
...e is a domstring representing a serialized media query. syntax var media = mediaquerylist.media; value a domstring representing a serialized media query. examples this example runs the media query (max-width: 600px) and displays the value of the resulting mediaquerylist's media property in a <span>. javascript let mql = window.matchmedia('(max-width: 600px)'); document.queryselector(".mq-value").innertext = mql.media; the javascript code simply passes the media query to match into matchmedia() to compile it, then sets the <span>'s innertext to the value of the result's media property. html <span class="mq-value"></span> a simple <span> to receive the output. ...
...y in a <span>. javascript let mql = window.matchmedia('(max-width: 600px)'); document.queryselector(".mq-value").innertext = mql.media; the javascript code simply passes the media query to match into matchmedia() to compile it, then sets the <span>'s innertext to the value of the result's media property. html <span class="mq-value"></span> a simple <span> to receive the output. css .mq-value { font: 18px arial, sans-serif; font-weight: bold; color: #88f; padding: 0.4em; border: 1px solid #dde; } result specifications specification status comment css object model (cssom) view modulethe definition of 'media' in that specification. working draft initial definition ...
MediaSession.setActionHandler() - Web APIs
arameters type a domstring representing an action type to listen for. it will be one of play, pause, seekbackward, seekforward, seekto, skipad,previoustrack, or nexttrack. further details on the action types can be found below under media session actions. callback a function to call when the specified action type is invoked. the callback receives no input parameters, and should not return a value. return value undefined. description to remove a previously-established action handler, call setactionhandler() again, specifying null as the callback. the action handler receives as input a single parameter: an object conforming to the mediasessionactiondetails dictionary, which provides both the action type (so the same function can handle multiple action types), as well as data needed in...
... the action handler receives as input a single parameter: an object conforming to the mediasessionactiondetails dictionary, which provides both the action type (so the same function can handle multiple action types), as well as data needed in order to perform the action. media session actions a media session action's type is specified using a string from the mediasessionaction enumerated type. values each of the actions is a common media session control request. implement support for each of these in order to allow that type of action to be performed. the following strings identify the currently available types of media session action: nexttrack advances playback to the next track. pause pauses playback of the media. play begins (or resumes) playback of the media. previoustrack m...
...me + skiptime, audio.duration); }); navigator.mediasession.setactionhandler('seekbackward', evt => { // user clicked "seek backward" media notification icon. ...
Media Session action types - Web APIs
using, or changing tracks, you need to call the mediasession interface's setactionhandler() method to establish a handler for that action. the specific type of media session action to be handled on a mediasession is identified using a string from the mediasessionaction enumerated type. syntax a media session action's type is specified using a string from the mediasessionaction enumerated type. values each of the actions is a common media session control request. implement support for each of these in order to allow that type of action to be performed. the following strings identify the currently available types of media session action: nexttrack advances playback to the next track. pause pauses playback of the media. play begins (or resumes) playback of the media. previoustrack m...
...details property seekoffset specifies the amount of time to seek forward. seekto moves the playback position to the specified time within the media. the time to which to seek is specified in the mediasessionactiondetails property seektime. if you intend to perform multiple seekto operations in rapid succession, you can also specify the mediasessionactiondetails property fastseek property with a value of true. this lets the browser know it can take steps to optimize repeated operations, and is likely to result in improved performance. skipad skips past the currently playing advertisement or commercial. this action may or may not be available, depending on the platform and user agent, or may be disabled due to subscription level or other circumstances. stop halts playback entirely. descri...
...me + skiptime, audio.duration); }); navigator.mediasession.setactionhandler('seekbackward', evt => { // user clicked "seek backward" media notification icon. ...
MediaSessionActionDetails.seekOffset - Web APIs
if the offset isn't specified, the user agent will choose an appropriate offset automatically. this is typically in the range of five to ten seconds. ...
...if the offset isn't specified, the user agent will choose an appropriate offset automatically. this is typically in the range of five to ten seconds. ...
...if the offset isn't specified, the user agent will choose an appropriate offset automatically. this is typically in the range of five to ten seconds. ...
MediaStream - Web APIs
mediastream. constructor mediastream() creates and returns a new mediastream object. you can create an empty stream, a stream which is based upon an existing stream, or a stream that contains a specified list of tracks (specified as an array of mediastreamtrack objects). properties this interface inherits properties from its parent, eventtarget. mediastream.active read only a boolean value that returns true if the mediastream is active, or false otherwise. mediastream.ended read only a boolean value set to true if the end of the stream has been reached. this has been removed from the specification; you should instead check the value of mediastreamtrack.readystate to see if its value is ended for the track or tracks you want to ensure have finished playing. mediastream.id r...
...ired when a mediastreamtrack object is removed from it. methods this interface inherits methods from its parent, eventtarget. mediastream.addtrack() stores a copy of the mediastreamtrack given as argument. if the track has already been added to the mediastream object, nothing happens. mediastream.clone() returns a clone of the mediastream object. the clone will, however, have a unique value for id. mediastream.getaudiotracks() returns a list of the mediastreamtrack objects stored in the mediastream object that have their kind attribute set to audio. the order is not defined, and may not only vary from one browser to another, but also from one call to another. mediastream.gettrackbyid() returns the track whose id corresponds to the one given in parameters, trackid. if no pa...
... call to another. mediastream.gettrackbyid() returns the track whose id corresponds to the one given in parameters, trackid. if no parameter is given, or if no track with that id does exist, it returns null. if several tracks have the same id, it returns the first one. mediastream.gettracks() returns a list of all mediastreamtrack objects stored in the mediastream object, regardless of the value of the kind attribute. the order is not defined, and may not only vary from one browser to another, but also from one call to another. mediastream.getvideotracks() returns a list of the mediastreamtrack objects stored in the mediastream object that have their kind attribute set to "video". the order is not defined, and may not only vary from one browser to another, but also from one call to ...
MediaStreamTrack.applyConstraints() - Web APIs
constraints can be used to ensure that the media meets certain guidelines you prefer. for example, you may prefer high-density video but require that the frame rate be a little low to help keep the data rate low enough not overtax the network. constraints can also specify ideal and/or acceptable sizes or ranges of sizes. ...
...es. see applying constraints in capabilities, constraints, and settings for more information on how to apply your preferred constraints. syntax const appliedpromise = track.applyconstraints([constraints]) parameters constraints optional a mediatrackconstraints object listing the constraints to apply to the track's constrainable properties; any existing constraints are replaced with the new values specified, and any constrainable properties not included are restored to their default constraints. if this parameter is omitted, all currently set custom constraints are cleared. this object represents the basic set of constraints that must apply for the promise to resolve. the object may contain an advanced property containing an array of additional mediatrackconstrants objects, which are trea...
...e properties not included are restored to their default constraints. if this parameter is omitted, all currently set custom constraints are cleared. this object represents the basic set of constraints that must apply for the promise to resolve. the object may contain an advanced property containing an array of additional mediatrackconstrants objects, which are treated as exact requires. return value a promise which resolves when the constraints have been successfully applied. if the constraints cannot be applied, the promise is rejected with a mediastreamerror whose name is overconstrainederror, to indicate that the constraints could not be met. this can happen if the specified constraints are too strict to find a match when attempting to configure the track. examples the following shows ...
MediaStreamTrack.enabled - Web APIs
the enabled property on the mediastreamtrack interface is a boolean value which is true if the track is allowed to render the source stream or false if it is not. this can be used to intentionally mute a track. when enabled, a track's data is output from the source to the destination; otherwise, empty frames are output. in the case of audio, a disabled track generates frames of silence (that is, frames in which every sample's value is 0). for video tracks, every frame is filled entirely with black pixels. the value of enabled, in essence, represents what a typical user would consider the muting state for a track, whereas the muted property indicates a state in which the track is temporarily unable to output data, such as a scenario in which frames have been lost in transit. note: if the tr...
...e is 0). for video tracks, every frame is filled entirely with black pixels. the value of enabled, in essence, represents what a typical user would consider the muting state for a track, whereas the muted property indicates a state in which the track is temporarily unable to output data, such as a scenario in which frames have been lost in transit. note: if the track has been disconnected, the value of this property can be changed, but has no effect. syntax const enabledflag = track.enabled track.enabled = [true | false] value when true, enabled indicates that the track is permitted to render its actual media to the output. when enabled is set to false, the track only generates empty frames. empty audio frames have every sample's value set to 0. empty video frames have every pixel set ...
...ers turns off while the track is muted in this way. example this example demonstrates a click event handler for a pause button. pausebutton.onclick = function(evt) { const newstate = !myaudiotrack.enabled; pausebutton.innerhtml = newstate ? "&#x25b6;&#xfe0f;" : "&#x23f8;&#xfe0f;"; myaudiotrack.enabled = newstate; } this creates a variable, newstate, which is the opposite of the current value of enabled, then uses that to select either the emoji character for the "play" icon or the character for the "pause" icon as the new innerhtml of the pause button's element. finally, the new value of enabled is saved, making the change take effect. specifications specification status comment media capture and streamsthe definition of 'enabled' in that specification.
MediaStreamTrack.getConstraints() - Web APIs
constraints can be used to ensure that the media meets certain guidelines you prefer. ...
... constraints can be used to ensure that the media meets certain guidelines you prefer. ...
...r example, you may prefer high definition video but require that the frame rate be a little low to help keep the data rate low enough not overtax the network. constraints can also specify ideal and/or acceptable sizes or ranges of sizes. see capabilities, constraints, and settings for details on how to work with constrainable properties. syntax const constraints = track.getconstraints() return value a mediatrackconstraints object which indicates the constrainable properties the web site or app most recently set using applyconstraints(). the properties in the returned object are listed in the same order as when they were set, and only properties specifically set by the site or app are included. note: the returned set of constraints doesn't necessarily describe the actual state of the media...
MediaStreamTrackAudioSourceNode - Web APIs
tusermedia, feed the media into a <video> element to play then mute the audio, but then also feed the audio into a mediastreamaudiosourcenode. next, we feed this source audio into a low pass biquadfilternode (which effectively serves as a bass booster), then a audiodestinationnode. the range slider below the <video> element controls the amount of gain given to the lowpass filter — increase the value of the slider to make the audio sound more bass heavy! note: you can see this example running live, or view the source. var pre = document.queryselector('pre'); var video = document.queryselector('video'); var myscript = document.queryselector('script'); var range = document.queryselector('input'); // getusermedia block - grab stream // put it into a mediastreamaudiosourcenode // also output...
... video.muted = true; }; // create a mediastreamaudiosourcenode // feed the htmlmediaelement into it var audioctx = new audiocontext(); var source = audioctx.createmediastreamsource(stream); // create a biquadfilter var biquadfilter = audioctx.createbiquadfilter(); biquadfilter.type = "lowshelf"; biquadfilter.frequency.value = 1000; biquadfilter.gain.value = range.value; // connect the audiobuffersourcenode to the gainnode // and the gainnode to the destination, so we can play the // music and adjust the volume using the mouse cursor source.connect(biquadfilter); biquadfilter.connect(audioctx.destination); // get new mouse pointer coordinates when mouse is mov...
...in.value = range.value; // connect the audiobuffersourcenode to the gainnode // and the gainnode to the destination, so we can play the // music and adjust the volume using the mouse cursor source.connect(biquadfilter); biquadfilter.connect(audioctx.destination); // get new mouse pointer coordinates when mouse is moved // then set new gain value range.oninput = function() { biquadfilter.gain.value = range.value; } }) .catch(function(err) { console.log('the following gum error occured: ' + err); }); } else { console.log('getusermedia not supported on your browser!'); } // dump script to pre element pre.innerhtml = myscript.innerhtml; note: as a consequence of calling createmediastrea...
MediaTrackConstraints.channelCount - Web APIs
the mediatrackconstraints dictionary's channelcount property is a constrainlong describing the requested or mandatory constraints placed upon the value of the channelcount constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.channelcount as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...ther or not this constraint is supported by checking the value of mediatracksupportedconstraints.channelcount as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { channelcount: constraint }; constraintsobject.channelcount = constraint; value if this value is a number, the user agent will attempt to obtain media whose channel count is as close as possible to this number given the capabilities of the hardware and the other constraints specified. ...
... will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { channelcount: constraint }; constraintsobject.channelcount = constraint; value if this value is a number, the user agent will attempt to obtain media whose channel count is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constrainlong will guide the user agent in its efforts to provide an exact match to the required channel count (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. the channel count is 1 for monaural sound, 2 for stereo, and so forth. example see example: constraint exerciser in capabilities, constraints, and settings for an exam...
MediaTrackConstraints.facingMode - Web APIs
the mediatrackconstraints dictionary's facingmode property is a constraindomstring describing the requested or mandatory constraints placed upon the value of the facingmode constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.facingmode as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. ...
...call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. ...
...e rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. syntax var constraintsobject = { facingmode: constraint }; constraintsobject.facingmode = constraint; value an object based on constraindomstring specifying one or more acceptable, ideal, and/or exact (mandatory) facing modes are acceptable for a video track. an exact value in this case indicates that the specified facing mode is specifically required; for example: var constraints = { facingmode: { exact: "user" } }; this indicates that only a user-facing camera is acceptable; if there is no user-facing camera, or the user declines permission to use that camera, the media request will fail. the following strings are permitted values for the facing mode. these m...
MediaTrackConstraints.groupId - Web APIs
the mediatrackconstraints dictionary's groupid property is a constraindomstring describing the requested or mandatory constraints placed upon the value of the groupid constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.groupid as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { groupid: constraint }; constraintsobject.groupid = constraint; value an object based on constraindomstring specifying one or more acceptable, ideal, and/or exact (mandatory) group ids which are acceptable as the source of media content. group ids are uniqu...
...ssion, and are shared by all media sources that come from the same physical device. for example, the microphone and speaker on the same headset would share a group id. this makes it possible to use the group id to ensure that the audio and input devices are on the same headset by retrieving the group id of the input device and specifying it when asking for an output device, perhaps. however, the value of the groupid is determined by the source of the track's content, and there's no particular format mandated by the specification (although some kind of guid is recommended). that means that a given track will only return one value for the groupid when you call getcapabilities(), and keep in mind that this value will change for each browsing session. because of this, there's no use for the group...
... example see example: constraint exerciser in capabilities, constraints, and settings for an example. ...
MediaTrackConstraints.height - Web APIs
the mediatrackconstraints dictionary's height property is a constrainlong describing the requested or mandatory constraints placed upon the value of the height constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.height as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
... can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.height as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { height: constraint }; constraintsobject.height = constraint; value if this value is a number, the user agent will attempt to obtain media whose height is as close as possible to this number given the capabilities of the hardware and the other constraints specified. ...
...sary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { height: constraint }; constraintsobject.height = constraint; value if this value is a number, the user agent will attempt to obtain media whose height is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constrainlong will guide the user agent in its efforts to provide an exact match to the required height (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment ...
MediaTrackConstraints.logicalSurface - Web APIs
the mediatrackconstraints dictionary's logicalsurface property is a constraindomstring describing the requested or mandatory constraints placed upon the value of the logicalsurface constrainable property. this is used to specify whether or not getdisplaymedia() should allow the user to choose display surfaces which are not necessarily fully visible on the screen, such as occluded windows or the complete content of windows which are large enough to require scrolling to see their entire contents. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.logicalsurface as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they'...
... see how constraints are defined in capabilities, constraints, and settings for an explanation of how to define constraints. ...
...e permitted among the selections available to the user. see how constraints are defined in capabilities, constraints, and settings for an explanation of how to define constraints. usage notes you can check the setting selected by the user agent after the display media has been created by getdisplaymedia() by calling getsettings() on the display media's video mediastreamtrack, then checking the value of the returned mediatracksettings object's logicalsurface object. for example, if your app needs to know if the selected display surface is a logical one: let islogicalsurface = displaystream.getvideotracks()[0].getsettings().logicalsurface; following this code, islogicalsurface is true if the display surface contained in the stream is a logical surface; that is, one which may not be entir...
MediaTrackConstraints.sampleRate - Web APIs
the mediatrackconstraints dictionary's samplerate property is a constrainlong describing the requested or mandatory constraints placed upon the value of the samplerate constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.samplerate as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...ne whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.samplerate as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { samplerate: constraint }; constraintsobject.samplerate = constraint; value if this value is a number, the user agent will attempt to obtain media whose sample rate is as close as possible to this number given the capabilities of the hardware and the other constraints specified. ...
...owsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { samplerate: constraint }; constraintsobject.samplerate = constraint; value if this value is a number, the user agent will attempt to obtain media whose sample rate is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constrainlong will guide the user agent in its efforts to provide an exact match to the required sample rate (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment ...
MediaTrackConstraints.sampleSize - Web APIs
the mediatrackconstraints dictionary's samplesize property is a constrainlong describing the requested or mandatory constraints placed upon the value of the samplesize constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.samplesize as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...ne whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.samplesize as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { samplesize: constraint }; constraintsobject.samplesize = constraint; value if this value is a number, the user agent will attempt to obtain media whose sample size (in bits per linear sample) is as close as possible to this number given the capabilities of the hardware and the other constraints specified. ...
...y constraints they're unfamiliar with. syntax var constraintsobject = { samplesize: constraint }; constraintsobject.samplesize = constraint; value if this value is a number, the user agent will attempt to obtain media whose sample size (in bits per linear sample) is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constrainlong will guide the user agent in its efforts to provide an exact match to the required sample size (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. since this property can only represent linear sample sizes, this constraint can only be met by devices that can produce audio with linear samples. example see example:...
MediaTrackSettings.height - Web APIs
the mediatracksettings dictionary's height property is an integer indicating the number of pixels tall mediastreamtrack is currently configured to be. this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.height property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.height as returned by a call to mediadevices.getsupportedconstraints(). ...
... example see example: constraint exerciser in capabilities, constraints, and settings for an example. ...
... example see example: constraint exerciser in capabilities, constraints, and settings for an example. ...
MediaTrackSettings.sampleSize - Web APIs
the mediatracksettings dictionary's samplesize property is an integer indicating the linear sample size (in bits per sample) the mediastreamtrack is currently configured for. this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.samplesize property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.samplesize as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var samplesize = mediatracksetting...
...the most commonly used sample size for many years now is 16 bits per sample, which was used for cd audio among others. ...
...the most commonly used sample size for many years now is 16 bits per sample, which was used for cd audio among others. other common sample sizes are 8 (for reduced bandwidth requirements) and 24 (for high-resolution professional audio). ...
MediaTrackSettings.width - Web APIs
the mediatracksettings dictionary's width property is an integer indicating the number of pixels wide mediastreamtrack is currently configured to be. this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.width property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.width as returned by a call to mediadevices.getsupportedconstraints(). ...
... example see example: constraint exerciser in capabilities, constraints, and settings for an example. ...
... example see example: constraint exerciser in capabilities, constraints, and settings for an example. ...
MediaTrackSupportedConstraints.autoGainControl - Web APIs
you can access the supported constraints dictionary by calling navigator.mediadevices.getsupportedconstraints(). ...
... you can access the supported constraints dictionary by calling navigator.mediadevices.getsupportedconstraints(). ...
...onstraints(). the autogaincontrol constraint indicates whether or not the browser offers the ability to automatically control the gain (volume) on media tracks; this obviously is contingent on whether or not the individual device supports automatic gain control as well; it's typically a feature provided by microphones. syntax autogainsupported = supportedconstraintsdictionary.autogaincontrol; value this property is present in the dictionary (and its value is always true) if the user agent supports the autogaincontrol constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. example this example simply displays whether or not your browser supports the autogaincontrol constraint. ...
MediaTrackSupportedConstraints.noiseSuppression - Web APIs
you can access the supported constraints dictionary by calling navigator.mediadevices.getsupportedconstraints(). ...
... you can access the supported constraints dictionary by calling navigator.mediadevices.getsupportedconstraints(). ...
...ing navigator.mediadevices.getsupportedconstraints(). the noisesuppression constraint indicates whether or not the browser offers the ability to automatically control the gain (volume) on media tracks; this obviously is contingent on whether or not the individual device supports automatic gain control as well. syntax noisesuppressionsupported = supportedconstraintsdictionary.noisesuppression; value this property is present in the dictionary (and its value is always true) if the user agent supports the noisesuppression constraint (and therefore supports noise suppression on audio tracks). if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. example this example simply displays whether o...
MouseEvent.button - Web APIs
Web › API › MouseEvent › button
it may not have been caused by the button that is physically left–most on the pointing device; however, it should behave as if the left button was clicked in the standard button layout. note: do not confuse this property with the mouseevent.buttons property, which indicates which buttons are pressed for all mouse events types. ...
...the browser forward button as noted above, buttons may be configured differently to the standard "left to right" layout. a mouse configured for left-handed use may have the button actions reversed. some pointing devices only have one button and use keyboard or other input mechanisms to indicate main, secondary, auxilary, etc. others may have many buttons mapped to different functions and button values. example html <button id="button" oncontextmenu="event.preventdefault();">click here with your mouse...</button> <p id="log"></p> javascript let button = document.queryselector('#button'); let log = document.queryselector('#log'); button.addeventlistener('mouseup', logmousebutton); function logmousebutton(e) { if (typeof e === 'object') { switch (e.button) { case 0: log...
... document object model (dom) level 2 events specificationthe definition of 'mouseevent.button' in that specification. obsolete initial definition. ...
MouseEvent.buttons - Web APIs
the mouseevent.buttons read-only property indicates which buttons are pressed on the mouse (or other input device) when a mouse event is triggered. each button that can be pressed is represented by a given number (see below). if more than one button is pressed, the button values are added together to produce a new number. for example, if the secondary (2) and auxilary (4) buttons are pressed simultaneously, the value is 6 (i.e., 2 + 4). note: do not confuse this property with the mouseevent.button property. the mouseevent.buttons property indicates the state of buttons pressed during any kind of mouse event, while the mouseevent.button property only guarantees the correct value for mouse events caused by pressing or releasing one or multiple buttons. syntax var buttonspressed = instanceo...
... 2 + 4). note: do not confuse this property with the mouseevent.button property. the mouseevent.buttons property indicates the state of buttons pressed during any kind of mouse event, while the mouseevent.button property only guarantees the correct value for mouse events caused by pressing or releasing one or multiple buttons. syntax var buttonspressed = instanceofmouseevent.buttons return value a number representing one or more buttons. for more than one button pressed simultaneously, the values are combined (e.g., 3 is primary + secondary). 0 : no button or un-initialized 1 : primary button (usually the left button) 2 : secondary button (usually the right button) 4 : auxiliary button (usually the mouse wheel button or middle button) 8 : 4th button (typically the "browser b...
...n) 16 : 5th button (typically the "browser forward" button) example this example logs the buttons property when you trigger a mousedown event. ...
MouseEvent.pageX - Web APIs
Web › API › MouseEvent › pageX
entire document. this includes any portion of the document not currently visible. being based on the edge of the document as it is, this property takes into account any horizontal scrolling of the page. ...
... pixels inward from the left edge of the view, the value returned by pagex will be 300. originally, this property was defined as a long integer. the cssom view module redefined it as a double float. see the browser compatibility section for details. see page in coordinate systems for some additional information about coordinates specified in this fashion. syntax var pagex = mouseevent.pagex; value a floating-point number of pixels from the left edge of the document at which the mouse was clicked, regardless of any scrolling or viewport positioning that may be in effect. this property was originally specified in the touch events specification as a long integer, but was redefined in the cssom view module to be a double-precision floating-point number to allow for subpixel precision. even t...
...e); box.addeventlistener("mouseenter", updatedisplay, false); box.addeventlistener("mouseleave", updatedisplay, false); the javascript code uses addeventlistener() to register the function updatedisplay() as the event handler for the mousemove, mouseenter, and mouseleave events. updatedisplay() simply replaces the contents of the <span> elements meant to contain the x and y coordinates with the values of pagex and pagey. html <div class="box"> <p> move the mouse around in this box to watch its coordinates change. </p> <p> <code>pagex</code>: <span id="x">n/a</span> </p> <p> <code>pagey</code>: <span id="y">n/a</span> </p> </div> the html is simple; the box we'll be watching for mouse events on is given the class "box". it has two <span> elements, one with the id "x"...
MutationObserver.MutationObserver() - Web APIs
llback) parameters callback a function which will be called on each dom change that qualifies given the observed node or subtree and options. the callback function takes as input two parameters: an array of mutationrecord objects, describing each change that occurred; and the mutationobserver which invoked the callback. see the example below for more details. return value a new mutationobserver object, configured to call the specified callback when dom mutations occur. example this example simply creates a new mutationobserver configured to watch a node and all of its children for additions and removals of elements to the tree, as well as any changes to attributes on any of the elements in the tree. the callback function function callback(mutationlist, observ...
...nts in the tree. the callback function function callback(mutationlist, observer) { mutationlist.foreach( (mutation) => { switch(mutation.type) { case 'childlist': /* one or more children have been added to and/or removed from the tree. (see mutation.addednodes and mutation.removednodes.) */ break; case 'attributes': /* an attribute value changed on the element in mutation.target. the attribute name is in mutation.attributename, and its previous value is in mutation.oldvalue. */ break; } }); } the callback() function is invoked when the observer sees changes matching the configuration of the observation request specified when calling observe() to begin watching the dom. the kind of...
...ist: true, attributes: true, // omit (or set to false) to observe only changes to the parent node subtree: true } const observer = new mutationobserver(callback); observer.observe(targetnode, observeroptions); the desired subtree is located by finding an element with the id someelement. a set of options for the observer is also established in the observeroptions record. in it, we specify values of true for both childlist and attributes, so we get the information we want. then the observer is instantiated, specifying the callback() function. we begin observing the dom nodes of interest by calling observe(), specifying the target node and the options object. from this point until disconnect() is called, callback() will be called each time an element is added to or removed from the dom ...
NavigatorID.appCodeName - Web APIs
specifications specification status comment html living standardthe definition of 'navigatorid.appcodename' in that specification. ...
... specifications specification status comment html living standardthe definition of 'navigatorid.appcodename' in that specification. ...
... specifications specification status comment html living standardthe definition of 'navigatorid.appcodename' in that specification. ...
NavigatorID.appName - Web APIs
specifications specification status comment html living standardthe definition of 'navigatorid.appname' in that specification. ...
... specifications specification status comment html living standardthe definition of 'navigatorid.appname' in that specification. ...
... specifications specification status comment html living standardthe definition of 'navigatorid.appname' in that specification. ...
NavigatorID.product - Web APIs
specifications specification status comment html living standardthe definition of 'navigatorid.product' in that specification. ...
... specifications specification status comment html living standardthe definition of 'navigatorid.product' in that specification. ...
... specifications specification status comment html living standardthe definition of 'navigatorid.product' in that specification. ...
NodeIterator.whatToShow - Web APIs
nodefilter.show_attribute 2 shows attribute attr nodes. ...
... nodefilter.show_attribute 2 shows attribute attr nodes. ...
... nodefilter.show_attribute 2 shows attribute attr nodes. ...
NodeList.prototype.forEach() - Web APIs
Web › API › NodeList › forEach
the foreach() method of the nodelist interface calls the callback given in parameter once for each value pair in the list, in insertion order. syntax somenodelist.foreach(callback[, thisarg]); parameters callback a function to execute on each element of somenodelist. it accepts 3 parameters: currentvalue the current element being processed in somenodelist. currentindex optional the index of the currentvalue being processed in somenodelist. listobj optional the somenodelist that foreach() is being applied to. thisarg optional value to use as this when executing callback. return value undefined. example let node = document.createelement("div"); let kid1 = document.createelement("p"); let kid2 = document.createtextnode("hey"); let kid3 = document.createelement(...
...arg optional value to use as this when executing callback. return value undefined. ...
...ack. return value undefined. ...
NodeList - Web APIs
Web › API › NodeList
st.length the number of nodes in the nodelist. methods nodelist.item() returns an item in the list by its index, or null if the index is out-of-bounds. an alternative to accessing nodelist[i] (which instead returns undefined when i is out-of-bounds). this is mostly useful for non-javascript dom implementations. nodelist.entries() returns an iterator, allowing code to go through all key/value pairs contained in the collection. (in this case, the keys are numbers starting from 0 and the values are nodes.) nodelist.foreach() executes a provided function once per nodelist element, passing the element as an argument to the function. nodelist.keys() returns an iterator, allowing code to go through all the keys of the key/value pairs contained in the collection. (in this case, the keys ...
...this case, the keys are numbers starting from 0 and the values are nodes.) nodelist.foreach() executes a provided function once per nodelist element, passing the element as an argument to the function. nodelist.keys() returns an iterator, allowing code to go through all the keys of the key/value pairs contained in the collection. (in this case, the keys are numbers starting from 0.) nodelist.values() returns an iterator allowing code to go through all values (nodes) of the key/value pairs contained in the collection. example it's possible to loop over the items in a nodelist using a for loop: for (let i = 0; i < mynodelist.length; i++) { let item = mynodelist[i]; } don't use for...in to enumerate the items in nodelists, since they will also enumerate its length and item properties...
...cript 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 = document.queryselectorall('input[type=checkbox]'); for (let checkbox of list) { checkbox.checked = true; } recent browsers also support iterator methods (foreach()) as well as entries(), values(), and keys(). there is also an internet explorer-compatible way to use array.prototype.foreach for iteration: const list = document.queryselectorall('input[type=checkbox]'); array.prototype.foreach.call(list, function (checkbox) { checkbox.checked = true; }); specifications specification status comment domthe definition of 'nodelist' in that specification. l...
Notification.requestPermission() - Web APIs
c has updated this method to a promise-based syntax that works like this: notification.requestpermission().then(function(permission) { ... }); previously, the syntax was based on a simple callback; this version is now deprecated: notification.requestpermission(callback); parameters callback optional deprecated since gecko 46 an optional callback function that is called with the permission value. ...
...ax that works like this: notification.requestpermission().then(function(permission) { ... }); previously, the syntax was based on a simple callback; this version is now deprecated: notification.requestpermission(callback); parameters callback optional deprecated since gecko 46 an optional callback function that is called with the permission value. deprecated in favor of the promise return value. ...
..., the syntax was based on a simple callback; this version is now deprecated: notification.requestpermission(callback); parameters callback optional deprecated since gecko 46 an optional callback function that is called with the permission value. deprecated in favor of the promise return value. returns a promise that resolves to a domstring with the permission picked by the user. ...
Using the Notifications API - Web APIs
is from version 72, for example, and safari has done it for some time. in addition, in chrome and firefox you cannot request notifications at all unless the site is a secure context (i.e. https), and you can no longer allow notification permissions to be requested from cross-origin <iframe>s. checking current permission status you can check to see if you already have permission by checking the value of the notification.permission read only property. it can have one of three possible values: default the user hasn't been asked for permission yet, so notifications won't be displayed. granted the user has granted permission to display notifications, after having been asked previously. denied the user has explicitly declined permission to show notifications. getting permission if permi...
...supported. if it is, we run the promise-based version (supported everywhere except safari), and if not, we run the older callback-based version (which is supported in safari). to avoid duplicating code, we have stored a few bits of housekeeping code inside the handlepermission() function, which is the first main block inside this snippet. inside here we explicitly set the notification.permission value (some old versions of chrome failed to do this automatically), and show or hide the button depending on what the user chose in the permission dialog. we don't want to show it if permission has already been granted, but if the user chose to deny permission, we want to give them the chance to change their mind later on. note: before version 37, chrome doesn't let you call notification.requestperm...
... the "hi! 9" notification var n = new notification("hi! " + i, {tag: 'somanynotification'}); if (i++ == 9) { window.clearinterval(interval); } }, 200); } // if the user hasn't told if he wants to be notified or not // note: because of chrome, we are not sure the permission property // is set, therefore it's unsafe to check for the "default" value. else if (window.notification && notification.permission !== "denied") { notification.requestpermission(function (status) { // if the user said okay if (status === "granted") { var i = 0; // using an interval cause some browsers (including firefox) are blocking notifications if there are too much in a certain time. var interval = window.seti...
OVR_multiview2.framebufferTextureMultiviewOVR() - Web APIs
the ovr_multiview2.framebuffertexturemultiviewovr() method of the webgl api attaches a multiview texture to a webglframebuffer. syntax void ext.framebuffertexturemultiviewovr(target, attachment, texture, level, baseviewindex, numviews); parameters target a glenum specifying the binding point (target). possible values: gl.framebuffer: collection buffer data storage of color, alpha, depth and stencil buffers used to render an image. ...
... gl.framebuffer: collection buffer data storage of color, alpha, depth and stencil buffers used to render an image. gl.draw_framebuffer: equivalent to gl.framebuffer. used as a destination for drawing, rendering, clearing, and writing operations. gl.read_framebuffer: used as a source for reading operations. attachment a glenum specifying the attachment point for the texture. possible values: gl.color_attachment0: attaches the texture to the framebuffer's color buffer. gl.depth_attachment: attaches the texture to the framebuffer's depth buffer. gl.stencil_attachment: attaches the texture to the framebuffer's stencil buffer. gl.depth_stencil_attachment: depth and stencil buffer. gl.color_attachment1 gl.color_attachment2 gl.color_attachment3 gl.color_attachment4 ...
...ttachment: depth and stencil buffer data storage. texture a webgltexture object whose image to attach. level a glint specifying the mipmap level of the texture image to be attached. must be 0. baseviewindex a glint specifying the base view index of the framebuffer object attachment. numviews a glsizei specifying the number of views of the framebuffer object attachment. return value none. exceptions a gl.invalid_enum error is thrown if target is not gl.framebuffer. attachment is not one of the accepted attachment points. a gl.invalid_value error is thrown if level is not 0. if numviews is less than one or more than max_views_ovr. a gl.invalid_operation error is thrown if texture isn't 0 or the name of an existing texture object. example...
OscillatorNode.OscillatorNode() - Web APIs
the oscillatornode() constructor of the web audio api creates a new oscillatornode object which is an audionode that represents a periodic waveform, like a sine wave, optionally setting the node's properties' values to match values in a specified object. if the default values of the properties are acceptable, you can optionally use the audiocontext.createoscillator() factory method instead. syntax var oscillatornode = new oscillatornode(context, options) parameters inherits parameters from the audionodeoptions dictionary. context a reference to an audiocontext. options optional an object whose properties specify the initial values for the oscillator node's properties. any properties omitted from the object will take on the default value as documented. type the shape of the wav...
...latornode(context, options) parameters inherits parameters from the audionodeoptions dictionary. context a reference to an audiocontext. options optional an object whose properties specify the initial values for the oscillator node's properties. any properties omitted from the object will take on the default value as documented. type the shape of the wave produced by the node. valid values are 'sine', 'square', 'sawtooth', 'triangle' and 'custom'. the default is 'sine'. detune a detuning value (in cents) which will offset the frequency by the given amount. ...
... specifications specification status comment web audio apithe definition of 'oscillatornode()' in that specification. ...
OscillatorNode.type - Web APIs
the type property of the oscillatornode interface specifies what shape of waveform the oscillator will output. there are several common waveforms available, as well as an option to specify a custom waveform shape. the shape of the waveform will affect the tone that is produced. syntax oscillatornode.type = type; value a domstring specifying the shape of oscillator wave. the different available values are: sine a sine wave. this is the default value. square a square wave with a duty cycle of 0.5; that is, the signal is "high" for half of each period. sawtooth a sawtooth wave. triangle a triangle wave. custom a custom waveform. you never set type to custom manually; instead, use the setperiodicwave() method to provide the data representing the waveform. doing so automatically s...
...uare a square wave with a duty cycle of 0.5; that is, the signal is "high" for half of each period. sawtooth a sawtooth wave. triangle a triangle wave. custom a custom waveform. you never set type to custom manually; instead, use the setperiodicwave() method to provide the data representing the waveform. doing so automatically sets the type to custom. exceptions invalidstateerror the value custom was specified. to set a custom waveform, just call setperiodicwave(). doing so automatically sets the type for you. example the following example shows basic usage of an audiocontext to create an oscillator node. for an applied example, check out our violent theremin demo (see app.js for relevant code). // create web audio api context var audioctx = new (window.audiocontext || window.w...
... example shows basic usage of an audiocontext to create an oscillator node. for an applied example, check out our violent theremin demo (see app.js for relevant code). // create web audio api context var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); // create oscillator node var oscillator = audioctx.createoscillator(); oscillator.type = 'square'; oscillator.frequency.setvalueattime(440, audioctx.currenttime); // value in hertz oscillator.start(); specifications specification status comment web audio apithe definition of 'type' in that specification. working draft ...
Page Visibility API - Web APIs
an specified for more details. budget-based background timeout throttling is now available in modern browsers (firefox 58+, chrome 57+), placing an additional limit on background timer cpu usage. this operates in a similar way across modern browsers, with the details being as follows: in firefox, windows in background tabs each have their own time budget in milliseconds — a max and a min value of +50 ms and -150 ms, respectively. chrome is very similar except that the budget is specified in seconds. windows are subjected to throttling after 30 seconds, with the same throttling delay rules as specified for window timers (again, see reasons for delays longer than specified). in chrome, this value is 10 seconds. timer tasks are only permitted when the budget is non-negative. once...
...itle = 'playing'; }, false); } properties added to the document interface the page visibility api adds the following properties to the document interface: document.hidden read only returns true if the page is in a state considered to be hidden to the user, and false otherwise. document.visibilitystate read only a domstring indicating the document's current visibility state. possible values are: visible the page content may be at least partially visible. in practice this means that the page is the foreground tab of a non-minimized window. hidden the page's content is not visible to the user, either due to the document's tab being in the background or part of a window that is minimized, or because the device's screen is off. prerender the page's content is being preren...
.... prerender the page's content is being prerendered and is not visible to the user. a document may start in the prerender state, but will never switch to this state from any other state, since a document can only prerender once. note: not all browsers support prerendering. unloaded the page is in the process of being unloaded from memory. note: not all browsers support the unloaded value. document.onvisibilitychange an eventlistener providing the code to be called when the visibilitychange event is fired. //startsimulation and pausesimulation defined elsewhere function handlevisibilitychange() { if (document.hidden) { pausesimulation(); } else { startsimulation(); } } document.addeventlistener("visibilitychange", handlevisibilitychange, false); specif...
PannerNode.refDistance - Web APIs
the refdistance property of the pannernode interface is a double value representing the reference distance for reducing volume as the audio source moves further from the listener – i.e. the distance at which the volume reduction starts taking effect. this value is used by all distance models. the refdistance property's default value is 1. syntax var audioctx = new audiocontext(); var panner = audioctx.createpanner(); panner.refdistance = 1; value a non-negative number. if the value is set to less than 0, a rangeerror is thrown. exceptions rangeerror the property has been given a value that is outside the accepted range. example this example demonstrates how different values of refdistance affect how the volume of a sound decays as it moves away from the listener. unlike rollof...
... panner.refdistance = 1; value a non-negative number. if the value is set to less than 0, a rangeerror is thrown. exceptions rangeerror the property has been given a value that is outside the accepted range. example this example demonstrates how different values of refdistance affect how the volume of a sound decays as it moves away from the listener. unlike rollofffactor, changing this value also delays the volume decay until the sound moves past the reference point. const context = new audiocontext(); // all our test tones will last this many seconds const note_length = 6; // this is how far we'll move the sound const z_distance = 20; // this function creates a graph for the test tone with a given refdistance // and schedules it to move away from the listener along the z (depth-wi...
...schedules it to move away from the listener along the z (depth-wise) axis // at the given start time, 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 schedule...
PannerNode.rolloffFactor - Web APIs
the rollofffactor property of the pannernode interface is a double value describing how quickly the volume is reduced as the source moves away from the listener. this value is used by all distance models.the rollofffactor property's default value is 1. syntax var audioctx = new audiocontext(); var panner = audioctx.createpanner(); panner.rollofffactor = 1; value a number whose range depends on the distancemodel of the panner as follows (negative values are not allowed): "linear" the range is 0 to 1. "inverse" the range is 0 to infinity. "exponential" the range is 0 to infinity. exceptions rangeerror the property has been given a value that is outside the accepted range. ...
...ber whose range depends on the distancemodel of the panner as follows (negative values are not allowed): "linear" the range is 0 to 1. "inverse" the range is 0 to infinity. "exponential" the range is 0 to infinity. exceptions rangeerror the property has been given a value that is outside the accepted range. ...
...les it to move away from the listener along the z (depth-wise) axis // at the given start time, resulting 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.curr...
PayerErrors.name - Web APIs
Web › API › PayerErrors › name
this string will be displayed to the user by the user agent's payment handling user interface. ...
...this string will be displayed to the user by the user agent's payment handling user interface. ...
...this string will be displayed to the user by the user agent's payment handling user interface. if the payer's name is valid, this property is left out of the payererrors object. ...
PaymentAddress.addressLine - Web APIs
e read-only property of the paymentaddress interface is an array of domstring objects, each specifying a line of the address that is not covered by one of the other properties of paymentaddress. these lines may include the street name, house number, apartment number, rural delivery route, descriptive instructions, or post office box. ...
...elivery route, descriptive instructions, or post office box. syntax var paymentaddresslines = paymentaddress.addressline; value an array of domstring objects, each containing one line of the address. ...
...jects, each containing one line of the address. for example, the addressline array for the mozilla space in london would have the following entries: example showing addressline entries for an address in london index addressline[] value 0 metal box factory 1 suite 441, 4th floor 2 30 great guildford street these, combined with additional values for other properties of the paymentaddress, would represent the full address, which is: mozilla metal box factory suite 441, 4th floor 30 great guildford street london se1 0hs united kingdom specifications specification status comment payment request apithe definition of 'paymentaddress.addressline' in that specification. candidate recommendation initial def...
PaymentRequest.prototype.id - Web APIs
Web › API › PaymentRequest › id
the id read-only attribute of the paymentrequest interface returns a unique identifier for a particular paymentrequest instance. when constructing an instance of the paymentrequest, you are able to supply an custom id via paymentdetailsinit dictionary's id member. if none is provided, the browser automatically sets the id value to a uuid. example this example shows how to give a paymentrequest instance a custom id. ...
...ng an instance of the paymentrequest, you are able to supply an custom id via paymentdetailsinit dictionary's id member. if none is provided, the browser automatically sets the id value to a uuid. example this example shows how to give a paymentrequest instance a custom id. const details = { id: "super-store-order-123-12312", total: { label: "total due", amount: { currency: "usd", value: "65.00" }, }, }; const request = new paymentrequest(methoddata, details); console.log(request.id); // super-store-order-123-12312 the id is then also available in the paymentresponse returned from the show() method, but under the requestid attribute. const response = await request.show(); console.log(response.requestid === request.id); // and in serialized form too const json = response.to...
...super-store-order-123-12312 the id is then also available in the paymentresponse returned from the show() method, but under the requestid attribute. const response = await request.show(); console.log(response.requestid === request.id); // and in serialized form too const json = response.tojson(); console.log(json.requestid,response.requestid, request.id); syntax var id = paymentrequest.id value a domstring. specifications specification status comment payment request apithe definition of 'id' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-...
PaymentRequest.shippingAddress - Web APIs
you can trigger this by setting paymentoptions.requestshipping to true when calling the paymentrequest constructor. in the example below, the cost of shipping varies by geography. ...
... }); payment.show().then(function(paymentresponse) { // processing of paymentresponse exerpted for brevity. ...
...); function updatedetails(details, shippingaddress, resolve) { if (shippingaddress.country === 'us') { var shippingoption = { id: '', label: '', amount: {currency: 'usd', value: '0.00'}, selected: true }; if (shippingaddress.region === 'mo') { shippingoption.id = 'mo'; shippingoption.label = 'free shipping in missouri'; details.total.amount.value = '55.00'; } else { shippingoption.id = 'us'; shippingoption.label = 'standard shipping in us'; shippingoption.amount.value = '5.00'; details.total.amount.value = '60.00'; } details.displayitems.splice(2, 1, shippingoption); details.shippingoptions = [shippingoption]; } else { delete details.shippingoptions; } resolve(details); } specifications ...
PaymentResponse: payerdetailchange event - Web APIs
if any are invalid, appropriate error messages should be configured and the retry() method should be called on the paymentresponse to ask the user to update the invalid entries. ...
...if any are invalid, appropriate error messages should be configured and the retry() method should be called on the paymentresponse to ask the user to update the invalid entries. ...
...quest.show(); // get the data from the response let { payername: oldpayername, payeremail: oldpayeremail, payerphone: oldpayerphone, } = response; // set up a handler for payerdetailchange events, to // request corrections as needed. response.onpayerdetailchange = async ev => { const promisestovalidate = []; const { payername, payeremail, payerphone } = response; // validate each value which changed by calling a function // that validates each type of data, returning a promise which // resolves if the data is valid. if (oldpayername !== payername) { promisestovalidate.push(validatename(payername)); oldpayername = payername; } if (oldpayeremail !== payeremail) { promisestovalidate.push(validateemail(payeremail)); oldpayeremail = payeremail; } if (o...
PaymentResponse.retry() - Web APIs
ors object, with the following properties: error optional a general description of a payment error from which the user may attempt to recover by retrying the payment, possibly after correcting mistakes in the payment information. error can be provided all by itself to provide only a generic error message, or in concert with the other properties to serve as an overview while other properties' values gude the user to errors in specific fields in the payment form. payer optional a payererrors compliant object which provides appropriate error messages for any of the fields describing the payer which failed validation. paymentmethod optional any payment method specific errors which may have occurred. this object's contents will vary depending on the payment used. for example, if the user ch...
...hod specific errors which may have occurred. this object's contents will vary depending on the payment used. for example, if the user chose to pay by credit card using the basic-card payment method, this is a basiccarderrors object. shippingaddress optional an addresserrors object which contains error messages for any of the fields in the shipping address that failed validation. return value a promise which is resolved when the payment is successfully completed. the promise is rejected with an appropriate exception value if the payment fails again. typically you will use this by calling show(), then entering a loop or recursive function that checks the paymentresponse for errors or other reasons to retry the payment request. if a retry is needed, the loop calls retry(), then loops ...
...l. see the example below for a thorough example, but the basic concept, in outline form, is: create a new paymentrequest (new paymentrequest()) display the payment request (paymentrequest.show() if show() resolves, the returned paymentresponse describes the requested payment and the options chosen by the user. continue by... validate the returned reponse; if there are any fields whose values are not acceptable, call the response's complete() method with a value of "fail" to indicate failure. if the response's data is valid and acceptable, call complete("success") to finalize the payment and proces it. if show() is rejected, the payment request failed, usually because either there's already one being processed, because the user agent doesn't support any of the specified paym...
PaymentResponse.shippingAddress - Web APIs
example generally, the user agent will fill the shippingaddress property for you. you can trigger this by setting paymentoptions.requestshipping to true when calling the paymentrequest constructor. ...
...yment.show().then(function(paymentresponse) { // processing of paymentresponse exerpted for the same of brevity. ...
...); function updatedetails(details, shippingaddress, resolve) { if (shippingaddress.country === 'us') { var shippingoption = { id: '', label: '', amount: {currency: 'usd', value: '0.00'}, selected: true }; if (shippingaddress.region === 'mo') { shippingoption.id = 'mo'; shippingoption.label = 'free shipping in missouri'; details.total.amount.value = '55.00'; } else { shippingoption.id = 'us'; shippingoption.label = 'standard shipping in us'; shippingoption.amount.value = '5.00'; details.total.amount.value = '60.00'; } details.displayitems.splice(2, 1, shippingoption); details.shippingoptions = [shippingoption]; } else { delete details.shippingoptions; } resolve(details); } specifications ...
PerformanceNavigationTiming.domComplete - Web APIs
example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
PerformanceNavigationTiming.domContentLoadedEventEnd - Web APIs
example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
PerformanceNavigationTiming.domContentLoadedEventStart - Web APIs
example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
PerformanceNavigationTiming.domInteractive - Web APIs
example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
PerformanceNavigationTiming.loadEventStart - Web APIs
example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
PerformanceNavigationTiming.unloadEventStart - Web APIs
example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
PerformanceResourceTiming.connectEnd - Web APIs
the connectend read-only property returns the timestamp immediately after the browser finishes establishing the connection to the server to retrieve the resource. the timestamp value includes the time interval to establish the transport connection, as well as other time intervals such as ssl handshake and socks authentication. note: this feature is available in web workers. syntax resource.connectend; 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. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = performance.getentriesbytype("resource"); for (var i=0; i < p.leng...
..." + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'connectend' in that specification. candidate recommendation initial definition. ...
... "redirectstart", "redirectend", "requeststart", "responsestart", "responseend", "secureconnectionstart"]; for (var i=0; i < properties.length; i++) { // check each property var supported = properties[i] in perfentry; if (supported) { var value = perfentry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'connectend' in that specification. candidate recommendation initial definition. ...
PerformanceResourceTiming.connectStart - Web APIs
the connectstart read-only property returns the timestamp immediately before the user agent starts establishing the connection to the server to retrieve the resource. note: this feature is available in web workers. syntax resource.connectstart; return value a domhighrestimestamp immediately 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. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = performance.getentriesbytype("resource"); for (var i=0; i < p.length; i++) { print_start_and_end_properties(p[i]); } } function print_start_and_end_properties(perfentry) {...
..." + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'connectstart' in that specification. candidate recommendation initial definition. ...
... "redirectstart", "redirectend", "requeststart", "responsestart", "responseend", "secureconnectionstart"]; for (var i=0; i < properties.length; i++) { // check each property var supported = properties[i] in perfentry; if (supported) { var value = perfentry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'connectstart' in that specification. candidate recommendation initial definition. ...
PerformanceResourceTiming.domainLookupEnd - Web APIs
nly property returns the timestamp immediately after the browser finishes the domain name lookup for the resource. if the user agent has the domain information in cache, domainlookupstart and domainlookupend represent the times when the user agent starts and ends the domain data retrieval from the cache. note: this feature is available in web workers. syntax resource.domainlookupend; return value a domhighrestimestamp 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. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = performance.getentriesbytype("resource");...
..." + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'domainlookupend' in that specification. candidate recommendation initial definition. ...
... "redirectstart", "redirectend", "requeststart", "responsestart", "responseend", "secureconnectionstart"]; for (var i=0; i < properties.length; i++) { // check each property var supported = properties[i] in perfentry; if (supported) { var value = perfentry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'domainlookupend' in that specification. candidate recommendation initial definition. ...
PerformanceResourceTiming.domainLookupStart - Web APIs
the domainlookupstart read-only property returns the timestamp immediately before the browser starts the domain name lookup for the resource. note: this feature is available in web workers. syntax resource.domainlookupstart; return value 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. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = performance.getentriesbytype("resource"); for (var i=0; i < p.length; i++) { print_start_and_end_properties(p[i]); } } function print_start_and_end_properties(perfentry) { // print timestamps of the performanceentry ...
..." + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'domainlookupstart' in that specification. candidate recommendation initial definition. ...
... "redirectstart", "redirectend", "requeststart", "responsestart", "responseend", "secureconnectionstart"]; for (var i=0; i < properties.length; i++) { // check each property var supported = properties[i] in perfentry; if (supported) { var value = perfentry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'domainlookupstart' in that specification. candidate recommendation initial definition. ...
PerformanceResourceTiming.fetchStart - Web APIs
the fetchstart read-only property represents a timestamp immediately before the browser starts to fetch the resource. if there are http redirects the property returns the time immediately before the user agent starts to fetch the final resource in the redirection. note: this feature is available in web workers. syntax resource.fetchstart; 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. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = performance.getentriesbytype("resource"); for (var i=0; i < p.length; i++) { print_start_and_end_properties(p[i]); } } ...
..." + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'fetchstart' in that specification. candidate recommendation initial definition. ...
... "redirectstart", "redirectend", "requeststart", "responsestart", "responseend", "secureconnectionstart"]; for (var i=0; i < properties.length; i++) { // check each property var supported = properties[i] in perfentry; if (supported) { var value = perfentry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'fetchstart' in that specification. candidate recommendation initial definition. ...
PerformanceResourceTiming.redirectEnd - Web APIs
redirects, and any of the redirects have an origin that is different from the current document, and the timing allow check algorithm passes for each redirected resource, this property returns the time immediately after receiving the last byte of the response of the last redirect; otherwise, zero is returned. note: this feature is available in web workers. syntax resource.redirectend; return 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. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = performance.getentriesbytype("resource"); for (var i=0; i < p.length; i...
..." + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'redirectend' in that specification. candidate recommendation initial definition. ...
... "redirectstart", "redirectend", "requeststart", "responsestart", "responseend", "secureconnectionstart"]; for (var i=0; i < properties.length; i++) { // check each property var supported = properties[i] in perfentry; if (supported) { var value = perfentry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'redirectend' in that specification. candidate recommendation initial definition. ...
PerformanceResourceTiming.redirectStart - Web APIs
http redirects when fetching the resource and if any of the redirects are not from the same origin as the current document, but the timing allow check algorithm passes for each redirected resource, this property returns the starting time of the fetch that initiates the redirect; otherwise, zero is returned. note: this feature is available in web workers. syntax resource.redirectstart; 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. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = performance.getentriesbytype("resource"); for (var i=0; i < p.length; i++) { ...
..." + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'redirectstart' in that specification. candidate recommendation initial definition. ...
... "redirectstart", "redirectend", "requeststart", "responsestart", "responseend", "secureconnectionstart"]; for (var i=0; i < properties.length; i++) { // check each property var supported = properties[i] in perfentry; if (supported) { var value = perfentry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'redirectstart' in that specification. candidate recommendation initial definition. ...
PerformanceResourceTiming.requestStart - Web APIs
the requeststart read-only property returns a timestamp of the time immediately before the browser starts requesting the resource from the server, cache, or local resource. if the transport connection fails and the browser retires the request, the value returned will be the start of the retry request. there is no end property for requeststart. note: this feature is available in web workers. syntax resource.requeststart; return value a domhighrestimestamp 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. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = perfo...
..." + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'requeststart' in that specification. candidate recommendation initial definition. ...
... "redirectstart", "redirectend", "requeststart", "responsestart", "responseend", "secureconnectionstart"]; for (var i=0; i < properties.length; i++) { // check each property var supported = properties[i] in perfentry; if (supported) { var value = perfentry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'requeststart' in that specification. candidate recommendation initial definition. ...
PerformanceResourceTiming.responseEnd - Web APIs
the responseend read-only property returns a timestamp immediately after the browser receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first. note: this feature is available in web workers. syntax resource.responseend; return value a domhighrestimestamp immediately after the browser receives the last 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. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = performance.getentriesbytype("resource"); for (var i=0; i < p.length; i++) { print_start_and...
..." + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'responseend' in that specification. candidate recommendation initial definition. ...
... "redirectstart", "redirectend", "requeststart", "responsestart", "responseend", "secureconnectionstart"]; for (var i=0; i < properties.length; i++) { // check each property var supported = properties[i] in perfentry; if (supported) { var value = perfentry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'responseend' in that specification. candidate recommendation initial definition. ...
PerformanceResourceTiming.responseStart - Web APIs
the responsestart read-only property returns a timestamp immediately after the browser receives the first byte of the response from the server, cache, or local resource. note: this feature is available in web workers. syntax resource.responsestart; return value a domhighrestimestamp 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. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = performance.getentriesbytype("resource"); for (var i=0; i < p.length; i++) { print_start_and_end_properties(p[i]); } } function print_start_and_end_properties(perfentry) { // print tim...
..." + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'responsestart' in that specification. candidate recommendation initial definition. ...
... "redirectstart", "redirectend", "requeststart", "responsestart", "responseend", "secureconnectionstart"]; for (var i=0; i < properties.length; i++) { // check each property var supported = properties[i] in perfentry; if (supported) { var value = perfentry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'responsestart' in that specification. candidate recommendation initial definition. ...
PerformanceResourceTiming.secureConnectionStart - Web APIs
the secureconnectionstart read-only property returns a timestamp immediately before the browser starts the handshake process to secure the current connection. if a secure connection is not used, the property returns zero. note: this feature is available in web workers. syntax resource.secureconnectionstart; return value if the resource is fetched over a secure connection, a domhighrestimestamp immediately before the browser starts the handshake process 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. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = performanc...
..." + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'secureconnectionstart' in that specification. candidate recommendation initial definition. ...
... "redirectstart", "redirectend", "requeststart", "responsestart", "responseend", "secureconnectionstart"]; for (var i=0; i < properties.length; i++) { // check each property var supported = properties[i] in perfentry; if (supported) { var value = perfentry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the definition of 'secureconnectionstart' in that specification. candidate recommendation initial definition. ...
PerformanceResourceTiming.workerStart - Web APIs
etiming interface returns a domhighrestimestamp immediately before dispatching the fetchevent if a service worker thread is already running, or immediately before starting the service worker thread if it is not already running. if the resource is not intercepted by a service worker the property will always return 0. note: this 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. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = performance.getentriesbytype("resource"); for (var i=0; i < p.length; i++) { print_start_and_end_properties(p[i]); } } function print_...
..." + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 2the definition of 'workerstart' in that specification. working draft initial definition. ...
...start", "redirectend", "requeststart", "responsestart", "responseend", "secureconnectionstart", "workerstart"]; for (var i=0; i < properties.length; i++) { // check each property var supported = properties[i] in perfentry; if (supported) { var value = perfentry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 2the definition of 'workerstart' in that specification. working draft initial definition. ...
Performance API - Web APIs
uch as ntp adjustments), the interfaces support a monotonic clock i.e. a clock that is always increasing. as such, the performance api defines a domhighrestimestamp type rather than using the date.now() interface. domhighrestimestamp the domhighrestimestamp type, as its name implies, represents a high resolution point in time. this type is a double and is used by the performance interfaces. ...
...mestamp type, as its name implies, represents a high resolution point in time. this type is a double and is used by the performance interfaces. the value could be a discrete point in time or the difference in time between two discrete points in time. the unit of domhighrestimestamp is milliseconds and should be accurate to 5 µs (microseconds). however, if the browser is unable to provide a time value accurate to 5 microseconds (because, for example, due to hardware or software constraints), the browser can represent the value as a time in milliseconds accurate to a millisecond. methods the performance interface has two methods. ...
...econds and should be accurate to 5 µs (microseconds). however, if the browser is unable to provide a time value accurate to 5 microseconds (because, for example, due to hardware or software constraints), the browser can represent the value as a time in milliseconds accurate to a millisecond. methods the performance interface has two methods. the now() method returns a domhighrestimestamp whose value that depends on the navigation start and scope. if the scope is a window, the value is the time the browser context was created and if the scope is a worker, the value is the time the worker was created. the tojson() method returns a serialization of the performance object, for those attributes that can be serialized. properties the performance interface has two properties. the timing property...
PeriodicWave - Web APIs
ines a periodic waveform that can be used to shape the output of an oscillatornode. periodicwave has no inputs or outputs; it is used to define custom oscillators when calling oscillatornode.setperiodicwave(). the periodicwave itself is created/returned by audiocontext.createperiodicwave(). constructor periodicwave.periodicwave() creates a new periodicwave object instance using the default values for all properties. if you wish to establish custom property values at the outset, use the audiocontext.createperiodicwave() factory method instead. properties none; also, periodicwave doesn't inherit any properties. methods none; also, periodicwave doesn't inherit any methods. example the following example illustrates simple usage of createperiodicwave(), to create a periodicwave object ...
...here, with createperiodicwave(), yo...
...r osc = ac.createoscillator(); real[0] = 0; imag[0] = 0; real[1] = 1; imag[1] = 0; var wave = ac.createperiodicwave(real, imag, {disablenormalization: true}); osc.setperiodicwave(wave); osc.connect(ac.destination); osc.start(); osc.stop(2); this works because a sound that contains only a fundamental tone is by definition a sine wave here, we create a periodicwave with two values. the first value is the dc offset, which is the value at which the oscillator starts. 0 is good here, because we want to start the curve at the middle of the [-1.0; 1.0] range. the second and subsequent values are sine and cosine components. you can think of it as the result of a fourier transform, where you get frequency domain values from time domain value. here, with createperiodicwave(), you specify the freq...
PromiseRejectionEvent.reason - Web APIs
this could be anything from an error code to an object with text, links, and whatever else you might wish to include. ...
...this could be anything from an error code to an object with text, links, and whatever else you might wish to include. ...
...this could be anything from an error code to an object with text, links, and whatever else you might wish to include. ...
PublicKeyCredentialCreationOptions.extensions - Web APIs
extensions, an optional property of the publickeycredentialcreationoptions dictionary, is an object providing the client extensions and their input values. extensions are values requesting additional processing by the client and by the authenticator. for instance, extensions may be used for: backward compatibility with the legacy fido js api, knowing the user verification process, etc. note: an analogous option exists for the fetching operation (navigators.credentials.get()), see publickeycredentialrequestoptions.extensions. syntax extensions = publickeycredentialcreationoptions.extensions value an object with various keys and values. here is the current (as of march 2019) list of potential extensions which may be used during the registration operation. warning! as of june 2...
... used. if no matching authenticator is available, the credential is still generated with another available authenticator. exts boolean supported extensions. if true, the client outputs an array of strings containing the extensions which are supported by the authenticator. uvi boolean user verification index. if true, the client outputs an arraybuffer which contains a value uniquely identifying a user verification data record. in other words, this may be used server side to check if the current operation is based on the same biometric data that the previous authentication. loc boolean location. if true, the client outputs a coordinates object representing the geolocation of the authenticator. uvm boolean user verification method. if tru...
...ecord. in other words, this may be used server side to check if the current operation is based on the same biometric data that the previous authentication. loc boolean location. if true, the client outputs a coordinates object representing the geolocation of the authenticator. uvm boolean user verification method. if true, the client outputs an array of arrays with 3 values containing information about how the user was verified (e.g. fingerprint, pin, pattern), how the key is protected, how the matcher (tool used for the authentication operation) is protected. biometricperfbounds object with two numerical properties: far and frr biometric authenticator performance bounds. the client must not use any authenticator with false acceptance rate (far) and ...
PublicKeyCredentialRequestOptions.extensions - Web APIs
extensions, an optional property of the publickeycredentialrequestoptions dictionary, is an object providing the client extensions and their input values. extensions are values requesting additional processing by the client and by the authenticator. for instance, extensions may be used for: backward compatibility with the legacy fido js api, knowing the user verification process, etc. note: an analogous option exists for the creation operation (navigators.credentials.create()), see publickeycredentialcreationoptions.extensions. syntax extensions = publickeycredentialrequestoptions.extensions value an object with various keys and values. here is the current (as of march 2019) list of potential extensions which may be used during the registration operation. warning! as of june...
...ore verifying the user or testing their presence. the contenttype gives the mime type of the resource to be displayed while content gives its actual content. the client outputs the hash of the content which was displayed (hashing with the same algorithm which is used for the signature). uvi boolean user verification index. if true, the client outputs an arraybuffer which contains a value uniquely identifying a user verification data record. in other words, this may be used server side to check if the current operation is based on the same biometric data that the previous authentication. loc boolean location. if true, the client outputs a coordinates object representing the geolocation of the authenticator. uvm boolean user verification method. if tru...
...ecord. in other words, this may be used server side to check if the current operation is based on the same biometric data that the previous authentication. loc boolean location. if true, the client outputs a coordinates object representing the geolocation of the authenticator. uvm boolean user verification method. if true, the client outputs an array of arrays with 3 values containing information about how the user was verified (e.g. fingerprint, pin, pattern), how the key is protected, how the matcher (tool used for the authentication operation) is protected. note: extensions are optional and different browsers may recognize different extensions. all extensions are optional for the client to process them: if a browser does not know a given extension, that ...
PublicKeyCredentialRequestOptions.userVerification - Web APIs
ntialrequestoptions. this is a string which indicates how the user verification should be part of the authentication process. note: an analogous option exists for the creation operation (navigators.credentials.create()), see the userverification property of publickeycredentialcreationoptions.authenticatorselection. ...
...uthentication process. note: an analogous option exists for the creation operation (navigators.credentials.create()), see the userverification property of publickeycredentialcreationoptions.authenticatorselection. syntax userverification = publickeycredentialrequestoptions.userverification value a string qualifying how the user verification should be part of the authentication process. ...
...esponse does not have the uv flag (as part of authenticatorassertionresponse.authenticatordata) "preferred": user verification is prefered, the operation will not fail if the response does not have the uv flag (as part of authenticatorassertionresponse.authenticatordata) "discouraged": user verification should not be employed as to minimize the user interaction during the process. the default value is "preferred". examples var options = { userverification: "preferred", challenge: new uint8array([/* bytes sent from the server */]), }; navigator.credentials.get({ "publickey": options }) .then(function (credentialinfoassertion) { // send assertion response back to the server // to proceed with the control of the credential }).catch(function (err) { console.error(err); }...
RTCDataChannel.bufferedAmount - Web APIs
ult of calls to the send() method. this only includes data buffered by the user agent itself; it doesn't include any framing overhead or buffering done by the operating system or network hardware. the user agent may implement the process of actually sending data in any way it chooses; this may be done periodically during the event loop or truly asynchronously. ...
...ctually sending data in any way it chooses; this may be done periodically during the event loop or truly asynchronously. as messages are actually sent, this value is reduced accordingly. closing the data channel doesn't reset this count, even though the user agent purges the queued messages. however, even after closing the channel, attempts to send messages continue to add to the bufferedamount value, even though the messages are neither sent nor buffered. whenever this value decreases to fall to or below the value specified in the bufferedamountlowthreshold property, the user agent fires the bufferedamountlow event. this event may be used, for example, to implement code which queues more messages to be sent whenever there's room to buffer them. syntax var amount = adatachannel.bufferedam...
... example the snippet below includes a function which changes the contents of a block with the id "buffersize" to a string indicating the number of bytes currently buffered on an rtcdatachannel. ...
RTCIceCandidate.RTCIceCandidate() - Web APIs
creates and returns a new rtcicecandidate object, which can be configured to represent a single ice candidate. syntax candidate = new rtcicecandidate([candidateinfo]); parameters candidateinfo optional an optional rtcicecandidateinit object providing information about the candidate; if this is provided, the candidate is initialized configured to represent the described candidate. return value a newly-created rtcicecandidate object, optionally configured based on the specified object based on the rtcicecandidateinit dictionary. if candidateinfo is provided, the new rtcicecandidate is initialized as follows: each member of the rtcicecandidateinit object is initialized to the value of the property by the same name from rtcicecandidateinit. this includes the candidate, sdpmid, sdpmli...
... the following fields are initialized to null if they are not included in the rtcicecandidate.candidate property: foundation, component, priority , ip, protocol, port, type, tcptype, relatedaddress, and relatedport. ...
... following fields are initialized to null if they are not included in the rtcicecandidate.candidate property: foundation, component, priority , ip, protocol, port, type, tcptype, relatedaddress, and relatedport. note: parsing of the candidate string is performed using the candidate-attribute grammar from the webrtc specification. exceptions typeerror the specified rtcicecandidateinit has values of null in both the sdpmid and sdpmlineindex properties. usage notes this constructor does not do complete validation of the specified candidateinfo object or string. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate()' in that specification. candidate recommendation initial defini...
RTCIceCandidate.protocol - Web APIs
the rtcicecandidate interface's read-only protocol property is a string which indicates whether the candidate uses udp or tcp as its transport protocol. protocol is null by default if not specified properly in the sdp, but this is an error condition and will result in a thrown exception when you call rtcpeerconnection.addicecandidate(). the protocol property's value is set when the rtcicecandidate() constructor is used. ...
...'s read-only protocol property is a string which indicates whether the candidate uses udp or tcp as its transport protocol. protocol is null by default if not specified properly in the sdp, but this is an error condition and will result in a thrown exception when you call rtcpeerconnection.addicecandidate(). the protocol property's value is set when the rtcicecandidate() constructor is used. the value is automatically extracted from the candidate a-line, if it's formatted properly. syntax var protocol = rtcicecandidate.protocol; value a domstring which indicates what network protocol the candidate uses, udp or tcp. these values are defined by the enumerated type rtciceprotocol: tcp the candidate, if selected, would use tcp as the transport protocol for its data. the tcptype property pr...
...ent — passing the candidate to addicecandidate() will fail, throwing an operationerror exception. usage notes here's an example candidate a-line from an ice transaction: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the third field, "udp", is the protocol type, indicating that the candidate would use the udp transport protocol. example this code snippet examines the value of protocol to decide if it should look at the value of tcptype to see if it's a simultaneous-open (s-o) candidate. if (candidate.protocol == "tcp") { if (candidate.tcptype == "so") { adjustforsimultaneousopen(candidate); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.protocol' ...
RTCIceCandidate.sdpMid - Web APIs
the read-only property sdpmid on the rtcicecandidate interface returns a domstring specifying the media stream identification tag of the media component with which the candidate is associated. this id uniquely identifies a given stream for the component with which the candidate is associated. this property can be configured by specifying the value of the sdpmid property when constructing the new candidate object using rtcicecandidate(). ...
...edia component with which the candidate is associated. this id uniquely identifies a given stream for the component with which the candidate is associated. this property can be configured by specifying the value of the sdpmid property when constructing the new candidate object using rtcicecandidate(). if you call the constructor with an m-line string instead of an rtcicecandidateinit object, the value of sdpmid is extracted from the specified candidate m-line string. ...
... which the candidate is associated. this property can be configured by specifying the value of the sdpmid property when constructing the new candidate object using rtcicecandidate(). if you call the constructor with an m-line string instead of an rtcicecandidateinit object, the value of sdpmid is extracted from the specified candidate m-line string. syntax var sdpmid = rtcicecandidate.sdpmid; value a domstring which uniquely identifies the source media component from which the candidate draws data, or null if no such association exists for the candidate. note: attempting to add a candidate (using addicecandidate()) that has a value of null for either sdpmid or sdpmlineindex will throw a typeerror exception. example ... specifications specification status comment ...
RTCIceCandidate. toJSON() - Web APIs
you can then get a stringified version of the object by calling stringify() on the returned object. see the example below. example this simple example obtains a json string representing an rtcicecandidate found in the variable candidate. ...
... you can then get a stringified version of the object by calling stringify() on the returned object. see the example below. example this simple example obtains a json string representing an rtcicecandidate found in the variable candidate. ...
... you can then get a stringified version of the object by calling stringify() on the returned object. see the example below. example this simple example obtains a json string representing an rtcicecandidate found in the variable candidate. ...
RTCIceCandidateInit.candidate - Web APIs
the optional property candidate in the rtcicecandidateinit dictionary specifies the value of the rtcicecandidate object's candidate property. value a domstring describing the properties of the candidate, taken directly from the sdp attribute "candidate". the candidate string specifies the network connectivity information for the candidate. if the candidate is an empty string (""), the end of the candidate list has been reached; this candidate is known as the "end-of-candidates" marker. the syntax of the candidate string is described in rfc 5245, section 15.1. ...
...the candidate. if the candidate is an empty string (""), the end of the candidate list has been reached; this candidate is known as the "end-of-candidates" marker. the syntax of the candidate string is described in rfc 5245, section 15.1. for an a-line (attribute line) that looks like this: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the corresponding candidate string's value will be "candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host". the user agent always prefers candidates with the highest priority, all else being equal. in the example above, the priority is 2043278322. the attributes are all separated by a single space character, and are in a specific order. the complete list of attributes for this example candidate is: foundation = 4234997325 ...
...that usage would change the above sample to look like this: function goticecandidatemessage(msg) { var icecandidate = new rtcicecandidate(msg.candidate); pc.addicecandidate(icecandidate).catch({ /* handle error */ }); } specifications specification status comment webrtc 1.0: r...
RTCIceCandidateInit.sdpMLineIndex - Web APIs
example ... ...
... example ... ...
... example ... specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidateinit.sdpmlineindex' in that specification. ...
RTCIceCandidateInit.sdpMid - Web APIs
example ... ...
... example ... ...
... example ... ...
RTCIceCandidateInit.usernameFragment - Web APIs
randomization at least 24 bits of the text in the ufrag are required to be randomly selected by the ice layer at the beginning of the ice session. ...
... randomization at least 24 bits of the text in the ufrag are required to be randomly selected by the ice layer at the beginning of the ice session. ...
... randomization at least 24 bits of the text in the ufrag are required to be randomly selected by the ice layer at the beginning of the ice session. the specifics for which bits are random and what the remainder of the ufrag text are are left up to the browser implementation to decide. ...
RTCIceCandidatePairStats.availableIncomingBitrate - Web APIs
the rtcicecandidatepairstats property availableincomingbitrate returns a value indicative of the available inbound capacity of the network connection represented by the candidate pair. the higher the value, the more bandwidth you can assume is available for incoming data. you can get the incoming outgoing bitrate from availableoutgoingbitrate. syntax availableincomingbitrate = rtcicecandidatepairstats.availableincomingbitrate; value a floating-point value which approximates the amount of available bandwidth for incoming data on the network connection described by the rtcicecandidatepair. the value is reported in bits per second and is computed over a 1-second interval. ...
...e incoming outgoing bitrate from availableoutgoingbitrate. syntax availableincomingbitrate = rtcicecandidatepairstats.availableincomingbitrate; value a floating-point value which approximates the amount of available bandwidth for incoming data on the network connection described by the rtcicecandidatepair. the value is reported in bits per second and is computed over a 1-second interval. the value returned is calculated by adding up the available bit rate for every rtp stream using the connection described by this candidate pair. the returned value doesn't take into account overhead introduced by underlying protocols, including ip, udp, or tcp. ...
... specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.availableincomingbitrate' in that specification. ...
RTCIceCandidatePairStats.state - Web APIs
when a candidate pair is added to the check list, it begins in the frozen state. ...
... when a candidate pair is added to the check list, it begins in the frozen state. ...
... when a candidate pair is added to the check list, it begins in the frozen state. as soon as there are no checks ongoing which block the pair from being analyzed, it is unfrozen and moves into the waiting state. ...
RTCIceCandidateStats - Web APIs
the webrtc api's rtcicecandidatestats dictionary provides statistics related to an rtcicecandidate. properties rtcicecandidatestats is based upon the rtcstats dictionary, so it includes those properties in addition to the ones below. address optional a string containing the address of the candidate. this value may be an ipv4 address, an ipv6 address, or a fully-qualified domain name. this property was previously named ip and only accepted ip addresses. ...
...cecandidatestats is based upon the rtcstats dictionary, so it includes those properties in addition to the ones below. address optional a string containing the address of the candidate. this value may be an ipv4 address, an ipv6 address, or a fully-qualified domain name. this property was previously named ip and only accepted ip addresses. candidatetype optional a string matching one of the values in the rtcicecandidatetype enumerated type, indicating what kind of candidate the object provides statistics for. deleted optional a boolean value indicating whether or not the candidate has been released or deleted; the default value is false. for local candidates, it's value is true if the candidate has been deleted or released. for host candidates, true means that any network resources (usu...
...or local candidates. port optional the network port number used by the candidate. priority optional the candidate's priority, corresponding to rtcicecandidate.priority. protocol optional a string specifying the protocol (tcp or udp) used to transmit data on the port. relayprotocol optional a string identifying the protocol used by the endpoint for communicating with the turn server; valid values are tcp, udp, and tls. only present for local candidates. transportid optional a string uniquely identifiying the transport object that was inspected in order to obtain the rtctransportstats associated with the candidate correspondin to these statistics. url optional for local candidates, the url property is the url of the ice server from which the candidate was received. this url matches th...
RTCInboundRtpStreamStats.averageRtcpInterval - Web APIs
the averagertcpinterval property of the rtcinboundrtpstreamstats dictionary is a floating-point value indicating the average rtcp transmission interval, in seconds. the rtcp interval is the amount of time that should elapse between transmissions of rtcp packets. syntax var averagertcpinterval = rtcinboundrtpstreamstats.averagertcpinterval; value a floating-point value indicating the average interval, in seconds, between transmissions of rtcp packets. this interval is computed following the formula outlined in rfc 1889: a.7. because the interval's value is determined in part by the number of active senders, it will be different for each user of a service. ...
...ragertcpinterval = rtcinboundrtpstreamstats.averagertcpinterval; value a floating-point value indicating the average interval, in seconds, between transmissions of rtcp packets. this interval is computed following the formula outlined in rfc 1889: a.7. because the interval's value is determined in part by the number of active senders, it will be different for each user of a service. since this value is also used to determine the number of seconds after a stream starts to flow before the first rtcp packet should be sent, the result is that if many users try to start using the service at the same time, the server won't be flooded with rtcp packets coming in all at once. ...
...mber of active senders, it will be different for each user of a service. since this value is also used to determine the number of seconds after a stream starts to flow before the first rtcp packet should be sent, the result is that if many users try to start using the service at the same time, the server won't be flooded with rtcp packets coming in all at once. the sending endpoint computes this value when sending compound rtcp packets, which must contain at least an rtcp rr or sr packet and an sdes packet with the cname item. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcinboundrtpstreamstats.averagertcpinterval' in that specification. candidate recommendation initial definition. ...
RTCNetworkType - Web APIs
cellular the connection uses a cellular data service to connect. this includes all cellular data services including edge (2g), hspa (3g), lte (4g), and nr (5g). ethernet the described connection uses an ethernet network. wifi the described connection uses wifi. ...
... cellular the connection uses a cellular data service to connect. this includes all cellular data services including edge (2g), hspa (3g), lte (4g), and nr (5g). ethernet the described connection uses an ethernet network. wifi the described connection uses wifi. ...
...e, which is not discernible. unknown the user's browser is unable or unwilling to identify the underlying connection technology used by the described connection. this may be because the browser isn't able to determine the network type for some reason or it may be intentionally getting obscured for security reasons, such as to avoid device fingerprinting. note: keep in mind that the specified value only reflects the initial connection between the local peer and the next hop along the network toward reaching the remote peer. for example, if the networktype is wifi but the user is connected using a cellular hotspot, the connection will be bottlenecked by the underlying cellular network (and any other networks between the two peers). specifications specification status commen...
RTCOutboundRtpStreamStats.averageRtcpInterval - Web APIs
the averagertcpinterval property of the rtcoutboundrtpstreamstats dictionary is a floating-point value indicating the average time that should pass between transmissions of rtcp packets on this stream. syntax var averagertcpinterval = rtcoutboundrtpstreamstats.averagertcpinterval; value a floating-point value indicating the average interval, in seconds, between transmissions of rtcp packets. this interval is computed following the formula outlined in rfc 1889: a.7. because the interval's value is determined in part by the number of active senders, it will be different for each user of a service. ...
...agertcpinterval = rtcoutboundrtpstreamstats.averagertcpinterval; value a floating-point value indicating the average interval, in seconds, between transmissions of rtcp packets. this interval is computed following the formula outlined in rfc 1889: a.7. because the interval's value is determined in part by the number of active senders, it will be different for each user of a service. since this value is also used to determine the number of seconds after a stream starts to flow before the first rtcp packet should be sent, the result is that if many users try to start using the service at the same time, the server won't be flooded with rtcp packets coming in all at once. ...
...mber of active senders, it will be different for each user of a service. since this value is also used to determine the number of seconds after a stream starts to flow before the first rtcp packet should be sent, the result is that if many users try to start using the service at the same time, the server won't be flooded with rtcp packets coming in all at once. the sending endpoint computes this value when sending compound rtcp packets, which must contain at least an rtcp rr or sr packet and an sdes packet with the cname item. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcoutboundrtpstreamstats.averagertcpinterval' in that specification. candidate recommendation initial definition. ...
RTCPeerConnection.currentRemoteDescription - Web APIs
the rtcpeerconnection finished negotiating and connecting to a remote peer. also included is a list of any ice candidates that may already have been generated by the ice agent since the offer or answer represented by the description was first instantiated. ...
... the description was first instantiated. to change the currentremotedescription, call rtcpeerconnection.setremotedescription(), which triggers a series of events which leads to this value being set. for details on what exactly happens and why the change isn't necessarily instantaneous, see pending and current descriptions in webrtc connectivity. unlike rtcpeerconnection.remotedescription, this value represents the actual current state of the local end of the connection; remotedescription may specify a description which the connection is currently in the process of switching over to. syntax sessiondescription = rtcpeerconnection.currentremotedescription; return value the current description of the remote end of the connection, if one has been set. if none has been successfully set, this ...
... represents the actual current state of the local end of the connection; remotedescription may specify a description which the connection is currently in the process of switching over to. syntax sessiondescription = rtcpeerconnection.currentremotedescription; return value the current description of the remote end of the connection, if one has been set. if none has been successfully set, this value is null. example this example looks at the currentremotedescription and displays an alert containing the rtcsessiondescription object's type and sdp fields. var pc = new rtcpeerconnection(); … var sd = pc.currentremotedescription; if (sd) { alert("local session: type='" + sd.type + "'; sdp description='" + sd.sdp + "'"); } else { alert("no local session yet."); } specif...
RTCPeerConnection.getStats() - Web APIs
the rtcpeerconnection method getstats() returns a promise which resolves with data providing statistics about either the overall connection or about the specified mediastreamtrack. syntax promise = rtcpeerconnection.getstats(selector) parameters selector optional a mediastreamtrack for which to gather statistics. if this is null (the default value), statistics will be gathered for the entire rtcpeerconnection. return value a promise which resolves with an rtcstatsreport object providing connection statistics. the contents of the report depend on the selector as well as other details of the connection. exceptions this method does not throw exceptions; instead, it rejects the returned promise with one of the following errors: invalidaccesserror there is no rtcrtpsender or rtc...
...oon be removed from most browsers; you should not use it, and should update existing code to use the new promise-based version. check the browser compatibility table to verify the state of this method. promise = rtcpeerconnection.getstats(selector, successcallback, failurecallback) parameters selector optional a mediastreamtrack for which to gather statistics. if this is null (the default value), statistics will be gathered for the entire rtcpeerconnection. successcallback a callback function to call when the stats have been retrieved. the function receives as input a single parameter: an rtcstatsreport with the collected statistics. no output is expected from the function. failurecallback a function to call when an error occurs while attempting to collect statistics. the callback r...
...n to call when the stats have been retrieved. the function receives as input a single parameter: an rtcstatsreport with the collected statistics. no output is expected from the function. failurecallback a function to call when an error occurs while attempting to collect statistics. the callback receives as input the exception (a domexception object describing the error which occurred. no return value is expected from the callback. example this example creates a periodic function using setinterval() that collects statistics for an rtcpeerconnection every second, generating an html-formatted report and inserting it into a specific element in the dom. window.setinterval(function() { mypeerconnection.getstats(null).then(stats => { let statsoutput = ""; stats.foreach(report => { ...
RTCPeerConnection: icecandidate event - Web APIs
vent's candidate property is null are not forwarded across the signaling connection. the end-of-candidates indication is described in section 9.3 of the trickle ice draft specification (note that the section number is subject to change as the specification goes through repeated drafts). indicating that ice gathering is complete once all ice transports have finished gathering candidates and the value of the rtcpeerconnection object's icegatheringstate has made the transition to complete, an icecandidate event is sent with the value of complete set to null. this signal exists for backward compatibility purposes and does not need to be delivered onward to the remote peer (which is why the code snippet above checks to see if event.candidate is null prior to sending the candidate along. if you ...
... this is a more reliable approach than looking at the individual ice messages for one indicating that the ice session is finished. examples this example creates a simple handler for the icecandidate event that uses a function called sendmessage() to cr...
...* gathering is either just starting or has been reset */ break; case "gathering": /* gathering has begun or is ongoing */ break; case "complete": /* gathering has ended */ break; } }); as you can see in this example, the icegatheringstatechange event lets you know when the value of the rtcpeerconnection property icegatheringstate has been updated. if that value is now complete, you know that ice gathering has just ended. this is a more reliable approach than looking at the individual ice messages for one indicating that the ice session is finished. examples this example creates a simple handler for the icecandidate event that uses a function called sendmessage() to create and send a reply to the remote peer through the signaling server. first, an ex...
RTCRtcpParameters - Web APIs
if false, compund rtcp is in use, as found in rfc 3550. this property cannot be changed once initialized. ...
...if false, compund rtcp is in use, as found in rfc 3550. this property cannot be changed once initialized. ...
...if false, compund rtcp is in use, as found in rfc 3550. this property cannot be changed once initialized. examples this example obtains the canonical name (cname) being used for rtcp on an rtcrtpsender or rtcrtpreceiver. ...
RTCRtpCodecParameters - Web APIs
ionary, part of the webrtc api, is used to describe the configuration parameters for a single media codec. in addition to being the type of the rtcrtpparameters.codecs property, it's used when calling rtcrtptransceiver.setcodecpreferences() to configure a transceiver's codecs before beginning the offer/answer process to establish a webrtc peer connection. most of the fields in this property take values which are defined and maintained by the internet assigned numbers authority (iana). references to relevant iana documents are provided in the see also section at the end of this article. properties payloadtype optional the rtp payload type used to identify this codec. mimetype optional the codec's mime media type and subtype specified as a domstring of the form "type/subtype". iana mainta...
...a). references to relevant iana documents are provided in the see also section at the end of this article. properties payloadtype optional the rtp payload type used to identify this codec. mimetype optional the codec's mime media type and subtype specified as a domstring of the form "type/subtype". iana maintains a registry of valid mime types. ...
...ayload type used to identify this codec. mimetype optional the codec's mime media type and subtype specified as a domstring of the form "type/subtype". iana maintains a registry of valid mime types. clockrate optional an unsigned long integer value specifying the codec's clock rate in hertz (hz). the clock rate is the rate at which the codec's rtp timestamp advances. most codecs have specific values or ranges of values they permit; see the iana payload format media type registry for details. channels optional an unsigned short integer indicating the number of channels the codec should support. for example, for audio codecs, a value of 1 specifies monaural sound while 2 indicates stereo. sdpfmtpline optional a domstring containing the format-specific parameters field from the "a=fmtp" li...
RTCRtpSender.replaceTrack() - Web APIs
ch camera and switch between the two as needed. see the example switching cameras below. syntax trackreplacedpromise = sender.replacetrack(newtrack); parameters newtrack optional a mediastreamtrack specifying the track with which to replace the rtcrtpsender's current source track. the new track's kind must be the same as the current track's, or the replace track request will fail. return value a promise which is fulfilled once the track has been successfully replaced. the promise is rejected if the track cannot be replaced for any reason; this is commonly because the change would require renegotiation of the codec, which is not allowed (see things that require negotiation). if newtrack was omitted or was null, replacetrack() simply stops the sender. no negotiation is required in this...
...ed. the promise is rejected if the track cannot be replaced for any reason; this is commonly because the change would require renegotiation of the codec, which is not allowed (see things that require negotiation). if newtrack was omitted or was null, replacetrack() simply stops the sender. no negotiation is required in this case. when the promise is fulfilled, the fulfillment handler receives a value of undefined. exceptions if the returned promise is rejected, one of the following exceptions is provided to the rejection handler: invalidmodificationerror replacing the rtcrtpsender's current track with the new one would require negotiation. invalidstateerror the track on which this method was called is stopped rather than running. typeerror the new track's kind doesn't match the orig...
...differs from that of the original track. the new track is an audio track with a different number of channels fom the original. media sources that have built-in encoders — such as hardware encoders — may not be able to provide the negotiated codec. software sources may not implement the negotiated codec. ...
RTCRtpSender.setParameters() - Web APIs
ers parameters an object conforming with the rtcrtpsendparameters dictionary, specifying options for the rtcrtpsender; these include potential codecs that could be use for encoding the sender's track. the available options are: degradationpreference specifies the preferred way the webrtc layer should handle optimizing bandwidth against quality in constrained-bandwidth situations; the value comes from the rtcdegradationpreference enumerated string type, and the default is balanced. encodings an array of rtcrtpencodingparameters objects, each specifying the parameters for a single codec that could be used to encode the track's media. priority a string from the rtcprioritytype enumerated type which indicates the encoding's priority. the default value is low. transactionid a stri...
...e default is balanced. encodings an array of rtcrtpencodingparameters objects, each specifying the parameters for a single codec that could be used to encode the track's media. priority a string from the rtcprioritytype enumerated type which indicates the encoding's priority. the default value is low. transactionid a string containing a unique id for the last set of parameters applied; this value is used to ensure that setparameters() can only be called to alter changes made by a specific previous call to getparameters(). return value a promise that resolves when the rtcrtpsender.track property is updated with the given parameters. exceptions if an error occurs, the returned promise is rejected with the appropriate exception from the list below. invalidmodificationerror one of...
...the current list's order. an attempt has been made to alter a property that cannot be changed after the sender is first created. invalidstateerror the transceiver of which the rtcrtpsender is a part is not running, or has no parameters to set. operationerror any error condition which occurs that isn't covered by one of the other error codes results in an operationerror. rangeerror the value specified for scaleresolutiondownby is less than 1.0, which would result in scaling up rather than down, which is not allowed; or one or more of the specified encodings' maxframerate values is less than 0.0. in addition, if a webrtc error occurs while configuring or accessing the media, an rtcerror is thrown with its errordetail set to hardware-encoder-error. specifications specifica...
RTCRtpStreamStats.ssrc - Web APIs
the rtcrtpstreamstats dictionary's ssrc property provides the synchronization source (ssrc), an integer which uniquely identifies the source of the rtp packets whose statistics are covered by the rtcstatsreport that includes this rtcrtpstreamstats dictionary. syntax var ssrc = rtcrtpstreamstats.ssrc; value the synchronization source (ssrc) is a 32-bit integer uniquely identifying the source of the rtp packets whose statistics are covered by the rtcstatsreport object of which this rtcrtpstreamstats object is a component. the manner in which these values are generated is not mandated by the specification, although it does make recommendations. you should not make any assumptions based on the value of ssrc other than that any two objects with the same ssrc value refer to the same source. see...
...ent. the manner in which these values are generated is not mandated by the specification, although it does make recommendations. you should not make any assumptions based on the value of ssrc other than that any two objects with the same ssrc value refer to the same source. see rfc 3550, section 8 for additional information about ssrc. note: the specification includes an example that generates values for ssrc using md5. while not part of the standard, exactly, it is a good mechanism that may be used by some browsers; others may use other methods, such as random number generators. ...
...two objects with the same ssrc value refer to the same source. see rfc 3550, section 8 for additional information about ssrc. note: the specification includes an example that generates values for ssrc using md5. while not part of the standard, exactly, it is a good mechanism that may be used by some browsers; others may use other methods, such as random number generators. do not rely upon these values meaning anything other than "these objects are associated with the same source." specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcrtpstreamstats.ssrc' in that specification. candidate recommendation initial definition. ...
RTCSctpTransport.state - Web APIs
connected the connection is open for data transmission. closed the connection is closed and can no longer be used. ...
... connected the connection is open for data transmission. closed the connection is closed and can no longer be used. ...
... connected the connection is open for data transmission. closed the connection is closed and can no longer be used. ...
RTCStatsType - Web APIs
candidate pairs other than the currently active pair for the transport are deleted when the rtcpeerconnection changes its rtcpeerconnection.icegatheringstate to new during an ice restart. ...
...e (csrc) that contributed to an inbound rtp stream. data-channel an rtcdatachannelstats object which contains statistics about each rtcdatachannel on the connection. inbound-rtp an rtcinboundrtpstreamstats object providing statistics about inbound data being received from remote peers. since this only provides statistics related to inbound data, without considering the local peer's state, any values that require knowledge of both, such as round-trip time, is not included. this report isn't available if there are no connected peers. local-candidate an rtcicecandidatestats object giving statistics about an ice local candidate; these candidates are found in the output from rtcicetransport.getlocalcandidates(). outbound-rtp the report is an rtcoutboundrtpstreamstats object providing statist...
...found in the output from rtcicetransport.getlocalcandidates(). outbound-rtp the report is an rtcoutboundrtpstreamstats object providing statistics based on the local peer's outgoing data being sent to its peers. this information considers only the outbound rtp stream, so any data which requires information about the state of the remote peers (such as round-trip time) is unavailable, since those values can't be computed without knowing about the other peers' states. peer-connection a rtcpeerconnectionstats object provides statistics related to the overall peer connection's rtcpeerconnection. receiver provides statistics about a specific rtcrtpreceiver. the statistics object is an rtcaudioreceiverstats object if kind is audio; if kind is video, the object is an rtcvideoreceiverstats object.
RadioNodeList - Web APIs
ill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="186" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">radionodelist</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties the radionodelist interface inherits the properties of nodelist. ...
..." font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">radionodelist</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties the radionodelist interface inherits the properties of nodelist. radionodelist.value if the underlying element collection contains radio buttons, the value property represents the checked radio button. ...
... fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">radionodelist</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties the radionodelist interface inherits the properties of nodelist. radionodelist.value if the underlying element collection contains radio buttons, the value property represents the checked radio button. on retrieving the value property, the value of the currently checked radio button is returned as a string. if the collection does not contain any radio buttons or none of the radio buttons in the collection is in checked state, the empty string is returned. on setting the value property, the first radio button input element whose value property is equal to the new value will be set to checked. methods the radionodeli...
Range.compareNode() - Web APIs
Web › API › Range › compareNode
obsolete since gecko 1.9 (firefox 3)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. the range.comparenode() returns a constant indicating the position of the node. the possible values are: node_before (0) node starts before the range node_after (1) node ends after the range node_before_and_after (2) node starts before and ends after the range node_inside (3) node starts after and ends before the range, i.e. the node is completely selected by the range. warning: this method has been removed from gecko 1.9 (firefox 3) and will not exist in future versions of firefox, which was the only browser implementing it; you should switch to range.compareboundarypoints() as soon as pos...
... specificat...
... (nodeisbefore && !nodeisafter) return 0; if (!nodeisbefore && nodeisafter) return 1; if (nodeisbefore && nodeisafter) return 2; return 3; } syntax returnvalue = range.comparenode( referencenode ); parameters referencenode the node to compare with the range. example range = document.createrange(); range.selectnode(document.getelementsbytagname("div").item(0)); returnvalue = range.comparenode(document.getelementsbytagname("p").item(0)); notes this method is obsolete; you should use the w3c dom range.compareboundarypoints() method. specifications this method is not standard and therefore not part of any specification. ...
ReadableStream - Web APIs
hed from another resource to the browser. it demonstrates the usage of a readablestream in combination with a uint8array. ...
...s the usage of a readablestream in combination with a uint8array. ...
... // "done" is a boolean and value a "uint8array" reader.read().then(({ done, value }) => { // is there no more data to read? if (done) { // tell the browser that we have finished sending data controller.close(); return; } // get the data and send it to the browser via the controller controller.enqueue(value); push(); }); }; push(); } }); return new response(stream, { headers: { "content-type": "text/html" } }); }); specifications specification status comment streamsthe definition of 'readablestream' in that specification. living standard initial definition ...
ReadableStreamDefaultReader.cancel() - Web APIs
and not completely get rid of the stream, you'd use readablestreamdefaultcontroller.close(). note: if the reader is active, the cancel() method behaves the same as that for the associated stream (readablestream.cancel()). syntax var promise = readablestreamdefaultreader.cancel(reason); parameters reason optional a domstring providing a human-readable reason for the cancellation. return value a promise, which fulfills with the value given in the reason parameter. exceptions typeerror the source object is not a readablestreamdefaultreader, or the stream has no owner. examples in the following simple example, a previously-created custom readablestream is read using a readablestreamdefaultreader created using getreader(). (this code is based on our simple random stream example).
...being read, at which point we return out of the recursive function and print the entire stream to another part of the ui. when the stream is done (if (done)), we run reader.cancel() to cancel the stream, signalling that we don't need to use it any more. function fetchstream() { const reader = stream.getreader(); let charsreceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processtext({ done, value }) { // result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. always undefined when done is true. if (done) { console.log("stream complete"); reader.cancel(); para.textcontent = result; return; } // valu...
...ext({ 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 ...
ReadableStreamDefaultReader - Web APIs
hed from another resource to the browser. it demonstrates the usage of a readablestream in combination with a uint8array. ...
...sage of a readablestream in combination with a uint8array. ...
...done" is a boolean and value a "uint8array" return reader.read().then(({ done, value }) => { // is there no more data to read? if (done) { // tell the browser that we have finished sending data controller.close(); return; } // get the data and send it to the browser via the controller controller.enqueue(value); push(); }); }; push(); } }); return new response(stream, { headers: { "content-type": "text/html" } }); }); specifications specification status comment streamsthe definition of 'readablestreamdefaultreader' in that specification. living standard initial definition ...
Request.mode - Web APIs
Web › API › Request › mode
the mode read-only property of the request interface contains the mode of the request (e.g., cors, no-cors, same-origin, or navigate.) this is used to determine if cross-origin requests lead to valid responses, and which properties of the response are readable. syntax var mymode = request.mode; value a requestmode value. the associated mode, available values of which are: same-origin — if a request is made to another origin with this mode set, the result is simply an error. you could use this to ensure that a request is always being made to your origin. no-cors — prevents the method from being anything other than head, get or post, and the headers from being anything other than simple headers. if any serviceworkers intercept these requests, they may not add or override ...
...s of the web and prevents security and privacy issues arising from leaking data across domains. cors — allows cross-origin requests, for example to access various apis offered by 3rd party vendors. these are expected to adhere to the cors protocol. only a limited set of headers are exposed in the response, but the body is readable. navigate — a mode for supporting navigation. ...
...rting navigation. the navigate value is intended to be used only by html navigation. a navigate request is created only while navigating between documents. default mode requests can be initiated in a variety of ways, and the mode for a request depends on the particular means by which it was initiated. for example, when a request object is created using the request.request constructor, the value of the mode property for that request is set to cors. however, for requests created other than by the request.request constructor, no-cors is typically used as the mode; for example, for embedded resources where the request is initiated from markup, unless the crossorigin attribute is present, the request is in most cases made using the no-cors mode — that is, for the <link> or <script> elemen...
Resource Timing API - Web APIs
figure. the performanceresourcetiming interface extends the performanceentry for performance entries which have an entrytype of "resource". high-resolution timestamps several of the resource timing properties return high-resolution timestamps. these timestamps have a domhighrestimestamp type and as its name implies, they represent a high-resolution point in time. ...
.... these timestamps have a domhighrestimestamp type and as its name implies, they represent a high-resolution point in time. this type is a double and its value is a discrete point in time or the difference in time between two discrete points in time. the unit of domhighrestimestamp is milliseconds and should be accurate to 5 µs (microseconds). however, if the browser is unable to provide a time value accurate to 5 µs (because, for example, due to hardware or software constraints), the browser can represent a the value as a time in milliseconds accurate to a millisecond. resource loading timestamps an application can get timestamps for the various stages used to load a resource. the first property in the processing model is starttime which returns the timestamp immediately before the resour...
... from the server; responsestart - the timestamp after the browser receives the first byte of the response from the server; and responseend - the timestamp after the browser receives the last byte of the resource. if the resource is loaded via a secure connection a secureconnectionstart timestamp will be available between the connection start and end events. when cors is in effect, many of these values are returned as zero unless the server's access policy permits these values to be shared. this requires the server providing the resource to send the timing-allow-origin http response header with a value specifying the origin or origins which are allowed to get the restricted timestamp values. the properties which are returned as 0 by default when loading a resource from a domain other than the...
SVGFEBlendElement - Web APIs
svg_feblend_mode_screen ...
...="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgfeblendelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constants name value description svg_feblend_mode_unknown 0 the type is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_feblend_mode_normal 1 corresponds to the value normal. svg_feblend_mode_multiply 2 corresponds to the value multiply. svg_feblend_mode_screen 3 corresponds to the value screen. svg_feblend_mode_darken 4 corresponds to the value darken. svg_feblend_mode_ligh...
... properties this interface also inherits properties from its parent interface, svgelement, and implements properties of svgfilterprimitivestandardattributes. svgfeblendelement.in1 read only an svganimatedstring corresponding to the in attribute of the given element. ...
SVGFEGaussianBlurElement - Web APIs
svg_edgemode_none 3 corresponds ...
...2px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgfegaussianblurelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constants name value description svg_edgemode_unknown 0 the type is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_edgemode_duplicate 1 corresponds to the duplicate value. svg_edgemode_wrap 2 corresponds to the wrap value. svg_edgemode_none 3 corresponds to none value. properties this interface also inherits properties from its parent interface, svgelement, and also implements properti...
...fegaussianblurelement.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. methods this interface also inherits methods of its parent, svgelement, and also implements methods of svgfilterprimitivestandardattributes. svgfegaussianblurelement.setstddeviation() sets the values for the stddeviation attribute. specifications specification status comment filter effects module level 1the definition of 'svgfegaussianblurelement' in that specification. working draft added edgemode property. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgfegaussianblurelement' in that specification. recommendation init...
SVGFETurbulenceElement - Web APIs
stitc...
...las,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgfeturbulenceelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constants turbulence types name value description svg_turbulence_type_unknown 0 the type is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_turbulence_type_fractalnoise 1 corresponds to the fractalnoise value. svg_turbulence_type_turbulence 2 corresponds to turbulence value. stitch options name value description svg_stitchtype_unknown 0 the type is not one of predefined types. it is invalid to a...
...empt to switch an existing value to this type. svg_turbulence_type_fractalnoise 1 corresponds to the fractalnoise value. svg_turbulence_type_turbulence 2 corresponds to turbulence value. stitch options name value description svg_stitchtype_unknown 0 the type is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_stitchtype_stitch 1 corresponds to the stitch value. svg_stitchtype_nostitch 2 corresponds to nostitch value. properties this interface also inherits properties from its parent interface, svgelement, and also implements properties of svgfilterprimitivestandardattributes. svgfeturbulen...
SVGPathSeg - Web APIs
pathseg_closepath 1 corresponds to a "closepath" (z) path data command. ...
... pathseg_closepath 1 corresponds to a "closepath" (z) path data command. ...
... pathseg_closepath 1 corresponds to a "closepath" (z) path data command. ...
SVGRect - Web APIs
Web › API › SVGRect
an svgrect object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. ...
..."2px" /><text x="38.5" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgrect</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties svgrect.x the exact effect of this coordinate depends on each element. ...
...middle">svgrect</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties svgrect.x the exact effect of this coordinate depends on each element. if the attribute is not specified, the effect is as if a value of 0 were specified. svgrect.y the exact effect of this coordinate depends on each element.if the attribute is not specified, the effect is as if a value of 0 were specified. svgrect.width this represents the width of the rectangle.a value that is negative results to an error. a value of zero disables rendering of the element svgrect.height this represents the height of the rectangle.a value that is negative results to an error.a value of zero disables rendering of the element. methods this interface also inherits properties from its parent...
SVGTextContentElement - Web APIs
lengthadjust_spacing 1 the spacing keyword. lengthadjust_spacingandglyphs 2 the spacingandglyphs keyword. properties this interface also inherits properties from its parent, svggraphicselement. svgtextcontentelement.textlength read only an svganimatedlength reflecting the textlength a...
... lengthadjust_spacing 1 the spacing keyword. ...
...spacingandglyphs keyword. properties this interface also inherits properties from its parent, svggraphicselement. svgtextcontentelement.textlength read only an svganimatedlength reflecting the textlength attribute of the given element. svgtextcontentelement.lengthadjust read only an svganimatedenumeration reflecting the lengthadjust attribute of the given element. the numeric type values represent one of the constant values above. methods this interface also inherits methods from its parent, svggraphicselement. svgtextcontentelement.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.getcomputedtextlength() returns ...
SVGTextPathElement - Web APIs
spacing types ...
...y="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgtextpathelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constants method types name value description textpath_methodtype_unknown 0 the type is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. textpath_methodtype_align 1 corresponds to the value align. textpath_methodtype_stretch 2 corresponds to the value stretch. spacing types name value description textpath_spacingtype_unknown 0 the type is not one of predefined types. it is invalid to attempt to d...
...e or to attempt to switch an existing value to this type. textpath_methodtype_align 1 corresponds to the value align. textpath_methodtype_stretch 2 corresponds to the value stretch. spacing types name value description textpath_spacingtype_unknown 0 the type is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. 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. svgtextpathelemen...
Screen.availHeight - Web APIs
ns the height, in css pixels, of the space available for web content on the screen. since screen is exposed on the window interface's window.screen property, you access availheight using window.screen.availheight. you can similarly use screen.availwidth to get the number of pixels which are horizontally available to the browser for its use. ...
... css pixels, of the space available for web content on the screen. since screen is exposed on the window interface's window.screen property, you access availheight using window.screen.availheight. you can similarly use screen.availwidth to get the number of pixels which are horizontally available to the browser for its use. ...
...ace's window.screen property, you access availheight using window.screen.availheight. you can similarly use screen.availwidth to get the number of pixels which are horizontally available to the browser for its use. syntax let availheight = window.screen.availheight; value a numeric value indicating the number of css pixels tall the screen's available space is. this can be no larger than the value of window.screen.height, and will be less if the device or user agent reserves any vertical space for itself. for instance, on a mac whose dock is located at the bottom of screen (which is the default), the value of availheight is approximately the value of height (the total height of the screen in css pixels) minus the heights of the dock and menu bar, as seen in the diagram below. example ...
Screen Capture API - Web APIs
ons. mediatrackconstraints mediatrackconstraints.cursor a constraindomstring indicating whether or not the cursor should be included in the captured display surface's stream, and if it should always be visible or if it should only be visible while the mouse is in motion. mediatrackconstraints.displaysurface a constraindomstring indicating what type of display surface is to be captured. the value is one of application, browser, monitor, or window. mediatrackconstraints.logicalsurface indicates whether or not the video in the stream represents a logical display surface (that is, one which may not be entirely visible onscreen, or may be completely offscreen). a value of true indicates a logical display surface is to be captured. mediatracksettings mediatracksettings.cursor a string ...
...y not be entirely visible onscreen, or may be completely offscreen). a value of true indicates a logical display surface is to be captured. mediatracksettings mediatracksettings.cursor a string which indicates whether or not the display surface currently being captured includes the mouse cursor, and if so, whether it's only visible while the mouse is in motion or if it's always visible. the value is one of always, motion, or never. mediatracksettings.displaysurface a string indicating what type of display surface is currently being captured. the value is one of application, browser, monitor, or window. mediatracksettings.logicalsurface a boolean value which is true if the video being captured doesn't directly correspond to a single onscreen display area. mediatracksupportedconstrain...
... current environment supports the mediatrackconstraints.displaysurface constraint. mediatracksupportedconstraints.logicalsurface a boolean which is true if the current environment supports the constraint mediatrackconstraints.logicalsurface. dictionaries the following dictionaries are defined by the screen capture api. cursorcaptureconstraint an enumerated string type used to provide the value for the cursor property for the settings and constraints. the possible values are always, motion, and never. displaycapturesurfacetype an enumerated string type which is used to identify the kind of display surface to capture. this type is used for the displaysurface property in the constraints and settings objects, and has the possible values application, browser, monitor, and window. featur...
ScrollToOptions.behavior - Web APIs
the behavior property of the scrolltooptions dictionary specifies whether the scrolling should animate smoothly, or happen instantly in a single jump. this is actually defined on the scrolloptions dictionary, which is implemented by scrolltooptions. syntax behavior: scrollbehavior value an enum, the value of which can be one of the following: smooth: the scrolling animates smoothly. auto: the scrolling happens in a single jump. examples in our scrolltooptions example (see it live) we include a form that allows the user to enter three values — two numbers representing the left and top properties (i.e. the positions to scroll to along the x and y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. when the form is submitted, an event handler is ru...
...a single jump. examples in our scrolltooptions example (see it live) we include a form that allows the user to enter three values — two numbers representing the left and top properties (i.e. the positions to scroll to along the x and y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. ...
...nd y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. when the form is submitted, an event handler is run that puts the entered values into a scrolltooptions dictionary, and then invokes the window.scrollto() method, passing the dictionary as a parameter: form.addeventlistener('submit', (e) => { e.preventdefault(); var scrolloptions = { left: leftinput.value, top: topinput.value, behavior: scrollinput.checked ? 'smooth' : 'auto' } window.scrollto(scrolloptions); }); specifications specification status comment css object model (cssom) view modulethe definition of 'behavior' in that specification. working draft ...
ScrollToOptions.left - Web APIs
the left property of the scrolltooptions dictionary specifies the number of pixels along the x axis to scroll the window or element. syntax left: double value a double. examples in our scrolltooptions example (see it live) we include a form that allows the user to enter three values — two numbers representing the left and top properties (i.e. the positions to scroll to along the x and y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. ...
...alue a double. examples in our scrolltooptions example (see it live) we include a form that allows the user to enter three values — two numbers representing the left and top properties (i.e. the positions to scroll to along the x and y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. ...
...nd y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. when the form is submitted, an event handler is run that puts the entered values into a scrolltooptions dictionary, and then invokes the window.scrollto() method, passing the dictionary as a parameter: form.addeventlistener('submit', (e) => { e.preventdefault(); var scrolloptions = { left: leftinput.value, top: topinput.value, behavior: scrollinput.checked ? 'smooth' : 'auto' } window.scrollto(scrolloptions); }); specifications specification status comment css object model (cssom) view modulethe definition of 'left' in that specification. working draft ...
ScrollToOptions.top - Web APIs
the top property of the scrolltooptions dictionary specifies the number of pixels along the y axis to scroll the window or element. syntax top: double value a double. examples in our scrolltooptions example (see it live) we include a form that allows the user to enter three values — two numbers representing the left and top properties (i.e. the positions to scroll to along the x and y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. ...
...alue a double. examples in our scrolltooptions example (see it live) we include a form that allows the user to enter three values — two numbers representing the left and top properties (i.e. the positions to scroll to along the x and y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. ...
...nd y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. when the form is submitted, an event handler is run that puts the entered values into a scrolltooptions dictionary, and then invokes the window.scrollto() method, passing the dictionary as a parameter: form.addeventlistener('submit', (e) => { e.preventdefault(); var scrolloptions = { left: leftinput.value, top: topinput.value, behavior: scrollinput.checked ? 'smooth' : 'auto' } window.scrollto(scrolloptions); }); specifications specification status comment css object model (cssom) view modulethe definition of 'top' in that specification. working draft ...
ScrollToOptions - Web APIs
number of pixels along the x axis to scroll the window or element. scrolltooptions.behavior specifies whether the scrolling should animate smoothly, or happen instantly in a single jump. this is actually defined on the scrolloptions dictionary, which is implemented by scrolltooptions. ...
...rolltooptions. examples in our scrolltooptions example (see it live) we include a form that allows the user to enter three values — two numbers representing the left and top properties (i.e. the positions to scroll to along the x and y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. ...
...nd y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. when the form is submitted, an event handler is run that puts the entered values into a scrolltooptions dictionary, and then invokes the window.scrollto() method, passing the dictionary as a parameter: form.addeventlistener('submit', (e) => { e.preventdefault(); var scrolloptions = { left: leftinput.value, top: topinput.value, behavior: scrollinput.checked ? 'smooth' : 'auto' } window.scrollto(scrolloptions); }); specifications specification status comment css object model (cssom) view modulethe definition of 'scrolltooptions' in that specification. working draft ...
SourceBuffer.appendWindowStart - Web APIs
the appendwindowstart property of the sourcebuffer interface controls the timestamp for the start of the append window, a timestamp range that can be used to filter what media data is appended to the sourcebuffer. coded media frames with timestamps wthin this range will be appended, whereas those outside the range will be filtered out. the default value of appendwindowstart is the presentation start time, which is the beginning time of the playable media. syntax var myappendwindowstart = sourcebuffer.appendwindowstart; sourcebuffer.appendwindowstart = 2.0; value a double, indicating the start time of the append window, in seconds. exceptions the following exceptions may be thrown when setting a new value for this property. exception explanation inv...
... invalidstateerror this sourcebuffer object is being updated (i.e. its sourcebuffer.updating property is currently true), or this sourcebuffer has been removed from the mediasource. ...
... invalidstateerror this sourcebuffer object is being updated (i.e. its sourcebuffer.updating property is currently true), or this sourcebuffer has been removed from the mediasource. ...
SourceBuffer.trackDefaults - Web APIs
exception explanation invalidstateerror one or more of the sourcebuffer objects in mediasource.sourcebuffers are being updated (i.e. ...
... exception explanation invalidstateerror one or more of the sourcebuffer objects in mediasource.sourcebuffers are being updated (i.e. ...
... exception explanation invalidstateerror one or more of the sourcebuffer objects in mediasource.sourcebuffers are being updated (i.e. ...
SpeechRecognition - Web APIs
echrecognition also inherits properties from its parent interface, eventtarget. speechrecognition.grammars returns and sets a collection of speechgrammar objects that represent the grammars that will be understood by the current speechrecognition. speechrecognition.lang returns and sets the language of the current speechrecognition. if not specified, this defaults to the html lang attribute value, or the user agent's language setting if that isn't set either. speechrecognition.continuous controls whether continuous results are returned for each recognition, or only a single result. defaults to single (false.) speechrecognition.interimresults controls whether interim results should be returned (true) or not (false.) interim results are results that are not yet final (e.g. the speechrec...
... only a single result. defaults to single (false.) speechrecognition.interimresults controls whether interim results should be returned (true) or not (false.) interim results are results that are not yet final (e.g. the speechrecognitionresult.isfinal property is false.) speechrecognition.maxalternatives sets the maximum number of speechrecognitionalternatives provided per result. the default value is 1. speechrecognition.serviceuri specifies the location of the speech recognition service used by the current speechrecognition to handle the actual recognition. the default is the user agent's default speech service. methods speechrecognition also inherits methods from its parent interface, eventtarget. speechrecognition.abort() stops the speech recognition service from listening t...
...rrent speechrecognition. also available via the onstart property. examples in our simple speech color changer example, we create a new speechrecognition object instance using the speechrecognition() constructor, create a new speechgrammarlist, and set it to be the grammar that will be recognised by the speechrecognition instance using the speechrecognition.grammars property. after some other values have been defined, we then set it so that the recognition service starts when a click event occurs (see speechrecognition.start().) when a result has been successfully recognised, the speechrecognition.onresult handler fires, we extract the color that was spoken from the event object, and then set the background color of the <html> element to that color. var grammar = '#jsgf v1.0; grammar colo...
SpeechSynthesisUtterance - Web APIs
ak() method. ...
... draft ...
... draft ...
Streams API concepts - Web APIs
to facilitate this: readablestream.pipethrough() — pipes the stream through a transform stream, which is a pair comprised of a writable stream that has data written to it, and a readable stream that then has the data read out of it — this acts as a kind of treadmill that constantly takes data in and transforms it to a new state. effectively the same stream is written to, and then the same values are read. a simple example is a text decoder, where raw bytes are written, and then strings are read. you can find more useful ideas and examples in the spec — see transform streams for ideas, and this web sockets example. readablestream.pipeto() — pipes to a writable stream that acts as the end point of the pipe chain. the start of the pipe chain is called the original source, and the en...
...f readable streams, these are the chunks that have been enqueued but not yet read in the case of writable streams, these are chunks that have been written but not yet processed by the underlying sink. internal queues employ a queuing strategy, which dictates how to signal backpressure based on the internal queue state. in general, the strategy compares the size of the chunks in the queue to a value called the high water mark, which is the largest total chunk size that the queue can realistically manage. the calculation performed is high water mark - total size of chunks in queue = desired size the desired size is the size of chunks the stream can still accept to keep the stream flowing but below the high water mark in size. after the calculation is performed, chunk generation will be slo...
...ormed is high water mark - total size of chunks in queue = desired size the desired size is the size of chunks the stream can still accept to keep the stream flowing but below the high water mark in size. after the calculation is performed, chunk generation will be slowed down/sped up as appropriate to keep the stream flowing as fast as possible while keeping the desired size above zero. if the value falls to zero (or below in the case of writable streams), it means that chunks are being generated faster than the stream can cope with, which results in problems. note: what happens in the case of zero or negative desired size hasn’t really been defined in the spec so far. patience is a virtue. as an example, let's take a chunk size of 1, and a high water mark of 3. this means that up to 3...
SubtleCrypto.importKey() - Web APIs
ss the string identifying the algorithm or an object of the form { "name": algorithm }, where algorithm is the name of the algorithm. for pbkdf2 : pass the string pbkdf2. extractable is a boolean indicating whether it will be possible to export the key using subtlecrypto.exportkey() or subtlecrypto.wrapkey(). keyusages is an array indicating what can be done with the key. possible array values are: encrypt: the key may be used to encrypt messages. decrypt: the key may be used to decrypt messages. sign: the key may be used to sign messages. verify: the key may be used to verify signatures. derivekey: the key may be used in deriving a new key. derivebits: the key may be used in deriving bits. wrapkey: the key may be used to wrap a key. unwrapkey: the key may b...
...sed to encrypt messages. decrypt: the key may be used to decrypt messages. sign: the key may be used to sign messages. verify: the key may be used to verify signatures. derivekey: the key may be used in deriving a new key. derivebits: the key may be used in deriving bits. wrapkey: the key may be used to wrap a key. unwrapkey: the key may be used to unwrap a key. return value result is a promise that fulfills with the imported key as a cryptokey object. exceptions the promise is rejected when one of the following exceptions is encountered: syntaxerror raised when keyusages is empty but the unwrapped key is of type secret or private. typeerror raised when trying to use an invalid format or if the keydata is not suited for that format. supported formats t...
..."], "kty": "ec", "x": "szrrxmyi8vwfjg1dpunbfcc9jzvjzefh7ulki1ukxaltd7rgwrcffxqygpcwu6aq", "y": "hhuag3ovdzer0uuqnd4pxhqtxp5idgdyhjhl-wlkjngjqaw0rngy5v29-av-ysew" }; examples note: you can try the working examples on github. raw import this example imports an aes key from an arraybuffer containing the bytes to use. see the complete code on github. const rawkey = window.crypto.getrandomvalues(new uint8array(16)); /* import an aes secret key from an arraybuffer containing the raw bytes. takes an arraybuffer string containing the bytes, and returns a promise that will resolve to a cryptokey representing the secret key. */ function importsecretkey(rawkey) { return window.crypto.subtle.importkey( "raw", rawkey, "aes-gcm", true, ["encrypt", "decrypt"] ); } pkcs #...
TextDecoder() - Web APIs
the textdecoder() constructor returns a newly created textdecoder object for the encoding specified in parameter. if the value for utflabel is unknown, or is one of the two values leading to a 'replacement' decoding algorithm ( "iso-2022-cn" or "iso-2022-cn-ext"), a domexception with the "typeerror" value is thrown. syntax decoder = new textdecoder(utflabel, options); parameters utflabeloptional is a domstring, defaulting to "utf-8", containing the label of the encoder. ...
... of the two values leading to a 'replacement' decoding algorithm ( "iso-2022-cn" or "iso-2022-cn-ext"), a domexception with the "typeerror" value is thrown. syntax decoder = new textdecoder(utflabel, options); parameters utflabeloptional is a domstring, defaulting to "utf-8", containing the label of the encoder. ...
...it defaults to false. example var textdecoder1 = new textdecoder("iso-8859-2"); var textdecoder2 = new textdecoder(); var textdecoder3 = new textdecoder("csiso2022kr", {fatal: true}); // allows encodingerror exception to be thrown. var textdecoder4 = new textdecoder("iso-2022-cn"); // throw a typeerror exception. specifications specification sta...
TextTrack.mode - Web APIs
Web › API › TextTrack › mode
the texttrack interface's mode property is a string specifying and controlling the text track's mode: disabled, hidden, or showing. you can read this value to determine the current mode, and you can change this value to switch modes. safari additionally requires the default boolean attribute to be set to true when implementing your own video player controls in order for the subtitles cues to be shown. syntax var mode = texttrack.mode; texttrack.mode = "disabled" | "hidden" | "showing"; value a domstring which indicates the track's current mode. the text track mode is one of the values listed below, under text track mode constants. ...
...btitles cues to be shown. syntax var mode = texttrack.mode; texttrack.mode = "disabled" | "hidden" | "showing"; value a domstring which indicates the track's current mode. the text track mode is one of the values listed below, under text track mode constants. text track mode constants the text track mode—sometimes identified using the idl enum texttrackmode—must be one of the following values: disabled the text track is currently disabled. while the track's presence is exposed in the dom, the user agent is otherwise ignoring it. no cues are active, no events are being fired, and the user agent won't attempt to obtain the track's cues. this is the default value, unless the text track has the default boolean attribute is specified, in which case the default is showing. hidden the...
...he corresponding times, even though the text isn't being displayed. showing the text track is currently enabled and is visible. if the track's cues list hasn't been obtained yet, it will be soon. the activecues list is being maintained and events are firing at the appropriate times; the track's text is also being drawn appropriately based on the styling and the track's kind. this is the default value if the text track's default boolean attribute is specified. usage notes the default mode is disabled, unless the default boolean attribute is specified, in which case the default mode is showing. when a text track is loaded in the disabled state, the corresponding webvtt file is not loaded until the state changes to either showing or hidden. this way, the resource fetch and memory usage are av...
Touch() - Web APIs
Web › API › Touch › Touch
ng to 0, of type double, that is the vertical position of the touch on the client window of the user's screen, including any scroll offset. "radiusx", optional and defaulting to 0, of type float, that is the radius of the ellipse which most closely circumscribes the touching area (e.g. finger, stylus) along the axis indicated by rotationangle, in css pixels of the same scale as screenx; 0 if no value is known. the value must not be negative. "radiusy", optional and defaulting to 0, of type float, that is the the radius of the ellipse which most closely circumscribes the touching area (e.g. finger, stylus) along the axis perpendicular to that indicated by rotationangle, in css pixels of the same scale as screeny; 0 if no value is known. the value must not be negative. "rotationangle", opt...
...s the touching area (e.g. finger, stylus) along the axis perpendicular to that indicated by rotationangle, in css pixels of the same scale as screeny; 0 if no value is known. the value must not be negative. "rotationangle", optional and defaulting to 0, of type float, that is the angle (in degrees) that the ellipse described by radiusx and radiusy is rotated clockwise about its center; 0 if no value is known. the value must be greater than or equal to 0 and less than 90. if the ellipse described by radiusx and radiusy is circular, then rotationangle has no effect. the user agent may use 0 as the value in this case, or it may use any other value in the allowed range. (for example, the user agent may use the rotationangle value from the previous touch event, to avoid sudden changes.). ​"fo...
.... if the ellipse described by radiusx and radiusy is circular, then rotationangle has no effect. the user agent may use 0 as the value in this case, or it may use any other value in the allowed range. (for example, the user agent may use the rotationangle value from the previous touch event, to avoid sudden changes.). ​"force", optional and defaulting to 0, of type float, that is the relative value of pressure applied, in the range 0 to 1, where 0 is no pressure, and 1 is the highest level of pressure the touch device is capable of sensing; 0 if no value is known. in environments where force is known, the absolute pressure represented by the force attribute, and the sensitivity in levels of pressure, may vary. specifications specification status comment to...
Touch.force - Web APIs
Web › API › Touch › force
the touch.force read-only property returns the amount of pressure the user is applying to the touch surface for a touch point. syntax touchitem.force; return value a float that represents the amount of pressure the user is applying to the touch surface. this is a value between 0.0 (no pressure) and 1.0 (the maximum amount of pressure the hardware can recognize). a value of 0.0 is returned if no value is known (for example the touch device does not support this property). in environments where force is known, the absolute pressure represented by the force attribute, and the sensitivity in levels of pressure, may vary. ...
...e hardware can recognize). a value of 0.0 is returned if no value is known (for example the touch device does not support this property). in environments where force is known, the absolute pressure represented by the force attribute, and the sensitivity in levels of pressure, may vary. example this example illustrates using the touch interface's touch.force property. this property is a relative value of pressure applied, in the range 0.0 to 1.0, where 0.0 is no pressure, and 1.0 is the highest level of pressure the touch device is capable of sensing. in following code snippet, the touchstart event handler iterrates through the targettouches list and logs the force value of each touch point but the code could invoke different processing depending on the value. someelement.addeventlistener('t...
...for example // minimum pressure vs. maximum pressure could result in // different handling of the user's input. ...
Touch.radiusX - Web APIs
Web › API › Touch › radiusX
summary returns the x radius of the ellipse that most closely circumscribes the area of contact with the touch surface. the value is in css pixels of the same scale as touch.screenx. this value, in combination with touch.radiusy and touch.rotationangle constructs an ellipse that approximates the size and shape of the area of contact between the user and the screen. this may be a relatively large ellipse representing the contact between a fingertip and the screen or a small area representing the tip of a stylus, for example. note: this attribute has not been formally standardized. ...
...y large ellipse representing the contact between a fingertip and the screen or a small area representing the tip of a stylus, for example. note: this attribute has not been formally standardized. it is specified in the touch events – level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. syntax var xradius = touchitem.radiusx; return value xradius the x radius of the ellipse that most closely circumscribes the area of contact with the touch surface. example this example illustrates using the touch interface's touch.radiusx, touch.radiusx and touch.rotationangle properties. the touch.radiusx property is the radius of the ellipse which most closely circumscribes the touching area (e.g. finger, stylus) along the axis indicated ...
...ch.rotationangle. the touch.rotationangle is the angle (in degrees) that the ellipse described by radiusx and radiusy is rotated clockwise about its center. the following simple code snippet, registers a single handler for the touchstart, touchmove and touchend events. when the src element is touched, the element's width and height will be calculate based on the touch point's radiusx and radiusy values and the element will then be rotated using the touch point's rotationangle. <div id="src"> ... </div> var src = document.getelementbyid("src"); src.addeventlistener('touchstart', rotate); src.addeventlistener('touchmove', rotate); src.addeventlistener('touchend', rotate); function rotate (e) { var touch = e.changedtouches.item(0); // turn off default event handling e.preventdefault()...
TreeWalker.whatToShow - Web APIs
nodefilter.show_attribute 2 shows attribute attr nodes. ...
... nodefilter.show_attribute 2 shows attribute attr nodes. ...
... nodefilter.show_attribute 2 shows attribute attr nodes. ...
WebGL2RenderingContext.compressedTexSubImage3D() - Web APIs
l.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 srclengthoverride); 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 within the compressed texture image. yoffset a glint specifying the y offset within the compressed texture image. zof...
... image. yoffset a glint specifying the y offset within the compressed texture image. zoffset a glint specifying the z offset within the compressed texture image. width a glsizei specifying the width of the texture. height a glsizei specifying the height of the texture. depth a glsizei specifying the depth of the texture. format a glenum specifying the compressed image format. ...
...ough_alpha1_etc2 gl.compressed_srgb8_punchthrough_alpha1_etc2 imagesize a glint specifying the number of bytes to read from the buffer bound to gl.pixel_unpack_buffer. offset a glint specifying the offset in bytes from which to read from the buffer bound to gl.pixel_unpack_buffer. srcdata an arraybufferview that be used as a data store for the compressed image data in memory. return value none. examples gl.compressedtexsubimage3d(gl.texture_3d, 0, 0, 0, 512, 512, 512, gl.compressed_r11_eac, texturedata); specifications specification status comment webgl 2.0the definition of 'compressedtexsubimage3d' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'glcompressedtexsubimage3d' in that spec...
WebGL2RenderingContext.drawElementsInstanced() - Web APIs
i renders primitives from array data like the gl.drawelements() method. in addition, it can execute multiple instances of a set of elements. note: when using webgl 1, the angle_instanced_arrays extension can provide this method, too. syntax void gl.drawelementsinstanced(mode, count, type, offset, instancecount); parameters mode a glenum specifying the type primitive to render. possible values are: gl.points: draws a single dot. gl.line_strip: draws a straight line to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. count a glsizei specifying the n...
...ine to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. count a glsizei specifying the number of elements to be rendered. type a glenum specifying the type of the values in the element array buffer. possible values are: gl.unsigned_byte gl.unsigned_short when using the oes_element_index_uint extension: gl.unsigned_int offset a glintptr specifying an offset in the element array buffer. must be a valid multiple of the size of the given type. instancecount a glsizei specifying the number of instances of the set of elements to execute.
...lement array buffer. possible values are: gl.unsigned_byte gl.unsigned_short when using the oes_element_index_uint extension: gl.unsigned_int offset a glintptr specifying an offset in the element array buffer. must be a valid multiple of the size of the given type. instancecount a glsizei specifying the number of instances of the set of elements to execute. return value none. exceptions if mode is not one of the accepted values, a gl.invalid_enum error is thrown. if offset is a valid multiple of the size of the given type, a gl.invalid_operation error is thrown. if count or instancecount are negative, a gl.invalid_value error is thrown. examples gl.drawelementsinstanced(gl.points, 2, gl.unsigned_short, 0, 4); specifications specification ...
WebGL2RenderingContext.drawRangeElements() - Web APIs
gl.line_strip: draws a straight line to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. ...
...aws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. start a gluint specifying the minimum array index contained in offset. end a gluint specifying the maximum array index contained in offset. count a glsizei specifying the number of elements to be rendered. type a glenum specifying the type of the values in the element array buffer. possible values are: gl.unsigned_byte gl.unsigned_short gl.unsigned_int offset a glintptr specifying an offset in the element array buffer. must be a valid multiple of the size of the given type. return value none. exceptions if mode is not one of the accepted values, a gl.invalid_enum error is thrown. if offset is a valid multiple of the size o...
... examples gl.drawrangeelements(gl.points, 0, 7, 8, gl.unsigned_byte, 0); specifications specification status comment webgl 2.0the definition of 'drawrangeelements' in that specification. ...
WebGL2RenderingContext.framebufferTextureLayer() - Web APIs
of the webgl 2 api attaches a single layer of a texture to a framebuffer. this method is similar to webglrenderingcontext.framebuffertexture2d(), but only a given single layer of the texture level is attached to the attachment point. syntax void gl.framebuffertexturelayer(target, attachment, texture, level, layer); parameters target a glenum specifying the binding point (target). ...
... gl.depth_attachment: attaches the texture to the framebuffer's depth buffer. gl.stencil_attachment: attaches the texture to the framebuffer's stencil buffer. gl.depth_stencil_attachment: depth and stencil buffer. ...
...the texture to the framebuffer's depth buffer. gl.stencil_attachment: attaches the texture to the framebuffer's stencil buffer. gl.depth_stencil_attachment: depth and stencil buffer. texture a webgltexture object whose image to attach. level a glint specifying the mipmap level of the texture image to attach. layer a glint specifying the layer of the texture image to attach. return value none. examples gl.framebuffertexturelayer(gl.framebuffer, gl.color_attachment0, texture, 0, 8); specifications specification status comment webgl 2.0the definition of 'framebuffertexturelayer' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'glframebuffertexturelayer' in that...
WebGL2RenderingContext.getSamplerParameter() - Web APIs
the webgl2renderingcontext.getsamplerparameter() method of the webgl 2 api returns parameter information of a webglsampler object. syntax any gl.getsamplerparameter(sampler, pname); parameters sampler a webglsampler object. pname a glenum specifying which information to return. possible values: gl.texture_compare_func: returns a glenum indicating the texture comparison function. gl.texture_compare_mode: returns a glenum indicating the texture comparison mode. gl.texture_mag_filter: returns a glenum indicating the texture magnification filter. gl.texture_max_lod: returns a glfloat indicating the maximum level-of-detail value. gl.texture_min_filter: returns a glenum indicating the texture minification filter gl.texture_min_lod: returns a glfloat indicating the m...
...mode: returns a glenum indicating the texture comparison mode. gl.texture_mag_filter: returns a glenum indicating the texture magnification filter. gl.texture_max_lod: returns a glfloat indicating the maximum level-of-detail value. gl.texture_min_filter: returns a glenum indicating the texture minification filter gl.texture_min_lod: returns a glfloat indicating the minimum level-of-detail value. gl.texture_wrap_r: returns a glenum indicating the texture wrapping function for the texture coordinate r. ...
... examples var sampler = gl.createsampler(); gl.getsamplerparameter(sampler, gl.texture_compare_func); specifications specification status comment webgl 2.0the definition of 'getsamplerparameter' in that specification. ...
WebGL2RenderingContext.renderbufferStorageMultisample() - Web APIs
the webgl2renderingcontext.renderbufferstoragemultisample() method of the webgl 2 api returns creates and initializes a renderbuffer object's data store and allows specifying a number of samples to be used. syntax void gl.renderbufferstoragemultisample(target, samples, internalformat, width, height); parameters target a glenum specifying the target renderbuffer object. ...
...ternalformat, width, height); parameters target a glenum specifying the target renderbuffer object. possible values: gl.renderbuffer: buffer data storage for single images in a renderable internal format. samples a glsizei specifying the number of samples to be used for the renderbuffer storage. internalformat a glenum specifying the internal format of the renderbuffer. ...
....rgba8ui gl.rgba8i gl.rgb10_a2ui gl.rgba16ui gl.rgba16i gl.rgba32i gl.rgba32ui gl.depth_component16 gl.depth_component24 gl.depth_component32f gl.depth_stencil gl.depth24_stencil8 gl.depth32f_stencil8 gl.stencil_index8 width a glsizei specifying the width of the renderbuffer in pixels. height a glsizei specifying the height of the renderbuffer in pixels. return value none. examples gl.renderbufferstoragemultisample(gl.renderbuffer, 4, gl.rbga4, 256, 256); specifications specification status comment webgl 2.0the definition of 'glrenderbufferstoragemultisample' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'glrenderbufferstoragemultisample' in that specification. ...
WebGL2RenderingContext.texStorage2D() - Web APIs
the webgl2renderingcontext.texstorage2d() method of the webgl api specifies all levels of two-dimensional texture storage. syntax void gl.texstorage2d(target, levels, internalformat, width, height); parameters target a glenum specifying the binding point (target) of the active texture. possible values: gl.texture_2d: a two-dimensional texture. gl.texture_cube_map: a cube-mapped texture. levels a glint specifying the number of texture levels. ...
...l.texstorage2d(target, levels, internalformat, width, height); parameters target a glenum specifying the binding point (target) of the active texture. possible values: gl.texture_2d: a two-dimensional texture. gl.texture_cube_map: a cube-mapped texture. levels a glint specifying the number of texture levels. internalformat a glenum specifying the texture store format. ...
...ac gl.compressed_rg11_eac gl.compressed_signed_rg11_eac gl.compressed_rgb8_etc2 gl.compressed_rgba8_etc2_eac gl.compressed_srgb8_etc2 gl.compressed_srgb8_alpha8_etc2_eac gl.compressed_rgb8_punchthrough_alpha1_etc2 gl.compressed_srgb8_punchthrough_alpha1_etc2 width a glsizei specifying the width of the texture. height a glsizei specifying the height of the texture. return value none. examples gl.texstorage2d(gl.texture_2d, 1, gl.rgb8, 256, 256); specifications specification status comment webgl 2.0the definition of 'texstorage2d' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'gltexstorage2d' in that specification. standard man page of the (similar) opengl es 3.0 api. ...
WebGL2RenderingContext.texStorage3D() - Web APIs
the webgl2renderingcontext.texstorage3d() method of the webgl api specifies all levels of a three-dimensional texture or two-dimensional array texture. syntax void gl.texstorage3d(target, levels, internalformat, width, height, depth); parameters target a glenum specifying the binding point (target) of the active texture. possible values: gl.texture_3d: a three-dimensional texture. ...
...get, levels, internalformat, width, height, depth); parameters target a glenum specifying the binding point (target) of the active texture. possible values: gl.texture_3d: a three-dimensional texture. gl.texture_2d_array: a two-dimensional array texture. level a glint specifying the number of texture levels. internalformat a glenum specifying the texture store format. ...
..._eac gl.compressed_rgb8_etc2 gl.compressed_rgba8_etc2_eac gl.compressed_srgb8_etc2 gl.compressed_srgb8_alpha8_etc2_eac gl.compressed_rgb8_punchthrough_alpha1_etc2 gl.compressed_srgb8_punchthrough_alpha1_etc2 width a glsizei specifying the width of the texture. height a glsizei specifying the height of the texture. depth a glsizei specifying the depth of the texture. return value none. examples gl.texstorage3d(gl.texture_3d, 1, gl.rgb8, 256, 256, 256); specifications specification status comment webgl 2.0the definition of 'texstorage3d' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'gltexstorage3d' in that specification. standard man page of the (similar) opengl es 3.0 ...
WebGL2RenderingContext - Web APIs
to get an object of this interface, call getcontext() on a <canvas> element, supplying "webgl2" as the argument: var canvas = document.getelementbyid('mycanvas'); var gl = canvas.getcontext('webgl2'); webgl 2 is an extension to webgl 1. the webgl2renderingcontext interface implements all members of the webglrenderingcontext interface. some methods of the webgl 1 context can accept additional values when used in a webgl 2 context. you will find this info noted on the webgl 1 reference pages. the webgl tutorial has more information, examples, and resources on how to get started with webgl. constants see the webgl constants page. state information webgl2renderingcontext.getindexedparameter() returns the indexed value for the given target. buffers webgl2renderingcontext.bufferdat...
...mpressed format. webgl2renderingcontext.compressedtexsubimage3d() specifies a three-dimensional sub-rectangle for a texture image in a compressed format. programs and shaders webgl2renderingcontext.getfragdatalocation() returns the binding of color numbers to user-defined varying out variables. uniforms and attributes webgl2renderingcontext.uniform[1234][uif][v]() methods specifying values of uniform variables. webgl2renderingcontext.uniformmatrix[234]x[234]fv() methods specifying matrix values for uniform variables. webgl2renderingcontext.vertexattribi4[u]i[v]() methods specifying integer values for generic vertex attributes. webgl2renderingcontext.vertexattribipointer() specifies integer data formats and locations of vertex attributes in a vertex attributes array. drawin...
...t is a valid webgltransformfeedback object. webgl2renderingcontext.bindtransformfeedback() binds a passed webgltransformfeedback object to the current gl state. webgl2renderingcontext.begintransformfeedback() starts a transform feedback operation. webgl2renderingcontext.endtransformfeedback() ends a transform feedback operation. webgl2renderingcontext.transformfeedbackvaryings() specifies values to record in webgltransformfeedback buffers. webgl2renderingcontext.gettransformfeedbackvarying() returns information about varying variables from webgltransformfeedback buffers. webgl2renderingcontext.pausetransformfeedback() pauses a transform feedback operation. webgl2renderingcontext.resumetransformfeedback() resumes a transform feedback operation. uniform buffer objects webgl2ren...
WebGLRenderingContext.activeTexture() - Web APIs
exceptions if texture is not one of gl.texturei, where i is within the range from 0 to gl.max_combined_texture_image_units - 1, a gl.invalid_enum error is thrown. examples the following call selects gl.texture1 as the current texture. ...
... exceptions if texture is not one of gl.texturei, where i is within the range from 0 to gl.max_combined_texture_image_units - 1, a gl.invalid_enum error is thrown. examples the following call selects gl.texture1 as the current texture. ...
...exture units is implementation dependent, you can get this number with the help of the max_combined_texture_image_units constant. it is, per specification, at least 8. gl.getparameter(gl.max_combined_texture_image_units); to get the active texture, query the active_texture constant. gl.activetexture(gl.texture0); gl.getparameter(gl.active_texture); // returns "33984" (0x84c0, gl.texture0 enum value) specifications specification status comment webgl 1.0the definition of 'activetexture' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glactivetexture' in that specification. standard man page of the opengl api. ...
WebGLRenderingContext.clearColor() - Web APIs
the webglrenderingcontext.clearcolor() method of the webgl api specifies the color values used when clearing color buffers. this specifies what color values to use when calling the clear() method. the values are clamped between 0 and 1. syntax void gl.clearcolor(red, green, blue, alpha); parameters red a glclampf specifying the red color value used when the color buffers are cleared. default value: 0. green a glclampf specifying the green color value used when the color buffers are cleared. default value: 0. blue a glclampf specifying the blue color value used when the color buffers are cleared. default value: 0. alpha a glclampf specifying the alpha (transparency) value used when the color buffers are cleared. default value: 0. return value none. examples gl.clearcolor(1, ...
... recommendation initial definition. ...
... recommendation initial definition. opengl es 2.0the definition of 'glclearcolor' in that specification. ...
WebGLRenderingContext.compressedTexSubImage2D() - Web APIs
le in webgl 2: void gl.compressedtexsubimage2d(target, level, xoffset, yoffset, width, height, format, imagesize, offset); void gl.compressedtexsubimage2d(target, level, xoffset, yoffset, width, height, format, arraybufferview srcdata, optional srcoffset, optional srclengthoverride); parameters target a glenum specifying the binding point (target) of the active compressed texture. 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-mapped texture. gl.texture_cube_map_negative_y: negative y face for a cube-mapped texture. gl.texture_cube_map_positive_z: positive ...
...compressed texture image. yoffset a glint specifying the vertical offset within the compressed texture image. width a glsizei specifying the width of the compressed texture. height a glsizei specifying the height of the compressed texture. format a glenum specifying the compressed image format. compressed image formats must be enabled by webgl extensions before using this method. ...
...c2_ext ext.compressed_signed_red_green_rgtc2_ext imagesize a glsizei specifying the number of bytes to read from the buffer bound to gl.pixel_unpack_buffer. offset a glintptr specifying the offset in bytes from which to read from the buffer bound to gl.pixel_unpack_buffer. pixels an arraybufferview that be used as a data store for the compressed image data in memory. return value none. examples var ext = ( gl.getextension('webgl_compressed_texture_s3tc') || gl.getextension('moz_webgl_compressed_texture_s3tc') || gl.getextension('webkit_webgl_compressed_texture_s3tc') ); gl.compressedtexsubimage2d(gl.texture_2d, 0, 256, 256, 512, 512, ext.compressed_rgba_s3tc_dxt5_ext, texturedata); specifications specification status comment webgl 1.0th...
WebGLRenderingContext.copyTexImage2D() - Web APIs
gl.texture_cube_map_positive_x: positive x face for a cube-mapped texture. ...
...face for a cube-mapped texture. gl.texture_cube_map_positive_z: positive z face for a cube-mapped texture. gl.texture_cube_map_negative_z: negative z face for a cube-mapped 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. internalformat a glenum specifying the color components in the texture. possible values: gl.alpha: discards the red, green and blue components and reads the alpha component. gl.rgb: discards the alpha components and reads the red, green and blue components. gl.rgba: red, green, blue and alpha components are read from the color buffer. gl.luminance: each color component is a luminance component, alpha is 1.0. gl.luminance_alpha: each component is a luminance/alpha compon...
... is a luminance/alpha component. x a glint specifying the x coordinate of the lower left corner where to start copying. y a glint specifying the y coordinate of the lower left corner where to start copying. width a glsizei specifying the width of the texture. height a glsizei specifying the height of the texture. border a glint specifying the width of the border. must be 0. return value none. examples gl.copyteximage2d(gl.texture_2d, 0, gl.rgba, 0, 0, 512, 512, 0); specifications specification status comment webgl 1.0the definition of 'copyteximage2d' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glcopyteximage2d' in that specification. standard man page of the (similar) opengl api. ...
WebGLRenderingContext.cullFace() - Web APIs
examples polygon culling is disabled by default. ...
... examples polygon culling is disabled by default. ...
... examples polygon culling is disabled by default. ...
WebGLRenderingContext.getBufferParameter() - Web APIs
the webglrenderingcontext.getbufferparameter() method of the webgl api returns information about the buffer. syntax any gl.getbufferparameter(target, pname); parameters target a glenum specifying the target buffer object. 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 another. gl.copy_write_buffer: buffer for copying from one buffer object to another. gl.transform_feedback_buffer: buffer for transform feedback operations. gl.uniform_buffer: buffer used for stori...
...fer for copying from one buffer object to another. gl.transform_feedback_buffer: buffer for transform feedback operations. gl.uniform_buffer: buffer used for storing uniform blocks. gl.pixel_pack_buffer: buffer used for pixel transfer operations. gl.pixel_unpack_buffer: buffer used for pixel transfer operations. pname a glenum specifying information to query. ...
...d for pixel transfer operations. pname a glenum specifying information to query. possible values: gl.buffer_size: returns a glint indicating the size of the buffer in bytes. gl.buffer_usage: returns a glenum indicating the usage pattern of the buffer. this is either: gl.static_draw, gl.dynamic_draw, gl.stream_draw. when using a webgl 2 context, the following values are available additionally: gl.static_read, gl.dynamic_read, gl.stream_read, gl.static_copy, gl.dynamic_copy, gl.stream_copy. return value depends on the requested information (as specified with pname). either a glint or a glenum. examples gl.getbufferparameter(gl.array_buffer, gl.buffer_size); specifications specif...
WebGLRenderingContext.getVertexAttrib() - Web APIs
the webglrenderingcontext.getvertexattrib() method of the webgl api returns information about a vertex attribute at a given position. syntax any gl.getvertexattrib(index, pname); parameters index a gluint specifying the index of the vertex attribute. pname a glenum specifying the information to query. possible values: gl.vertex_attrib_array_buffer_binding: returns the currently bound webglbuffer. gl.vertex_attrib_array_enabled: returns a glboolean that is true if the vertex attribute is enabled at this index. otherwise false. gl.vertex_attrib_array_size: returns a glint indicating the size of an element of the vertex array. gl.vertex_attrib_array_stride: returns a glint indicating the number of bytes between successive elements in the array. 0 means that the elements are se...
...s a glenum representing the array type. one of gl.byte, gl.unsigned_byte, gl.short, gl.unsigned_short, gl.float. gl.vertex_attrib_array_normalized: returns a glboolean that is true if fixed-point data types are normalized for the vertex attribute array at the given index. gl.current_vertex_attrib: returns a float32array (with 4 elements) representing the current value of the vertex attribute at the given index. when using a webgl 2 context, the following values are available additionally: gl.vertex_attrib_array_integer: returns a glboolean indicating whether or not an integer data type is in the vertex attribute array at the given index. gl.vertex_attrib_array_divisor: returns a glint describing the frequency divisor used for instanced rendering.
...or not an integer data type is in the vertex attribute array at the given index. gl.vertex_attrib_array_divisor: returns a glint describing the frequency divisor used for instanced rendering. when using the angle_instanced_arrays extension: ext.vertex_attrib_array_divisor_angle: returns a glint describing the frequency divisor used for instanced rendering. return value returns the requested vertex attribute information (as specified with pname). examples gl.getvertexattrib(0, gl.vertex_attrib_array_buffer_binding); specifications specification status comment webgl 1.0the definition of 'getvertexattrib' in that specification. recommendation initial definition for webgl. opengl es 2.0the definition of 'glgetvertexattri...
WebGLRenderingContext.hint() - Web APIs
the webglrenderingcontext.hint() method of the webgl api specifies hints for certain behaviors. the interpretation of these hints depend on the implementation. syntax void gl.hint(target, mode); parameters target sets which behavior to be controlled. possible values: gl.generate_mipmap_hint: quality of filtering when generating mipmap images with webglrenderingcontext.generatemipmap(). ...
... gl.nicest: the most correct or the highest quality option should be used. ...
...rd_derivatives extension: ext.fragment_shader_derivative_hint_oes: accuracy of the derivative calculation for the glsl built-in functions: dfdx, dfdy, and fwidth. when using a webgl 2 context, the following values are available additionally: gl.fragment_shader_derivative_hint: same as ext.fragment_shader_derivative_hint_oes mode sets the behavior. the default value is gl.dont_care. the possible values are: gl.fastest: the most efficient behavior should be used. gl.nicest: the most correct or the highest quality option should be used. gl.dont_care: there is no preference for this behavior. return value none. examples the following example hints that the quality of filtering when generating mipmap images should be most efficient instead of be...
WebGLRenderingContext.isEnabled() - Web APIs
the webglrenderingcontext.isenabled() method of the webgl api tests whether a specific webgl capability is enabled or not for this context. by default, all capabilities except gl.dither are disabled. syntax glboolean gl.isenabled(cap); parameters cap a glenum specifying which webgl capability to test. possible values: constant description gl.blend blending of the computed fragment color values. see webglrenderingcontext.blendfunc(). gl.cull_face culling of polygons. see webglrenderingcontext.cullface(). gl.depth_test depth comparisons and updates to the depth buffer. see webglrenderingcontext.depthfunc(). gl.dither dithering of color components before they get written to the color buffer. ...
...eringcontext.blendfunc(). gl.cull_face culling of polygons. see webglrenderingcontext.cullface(). gl.depth_test depth comparisons and updates to the depth buffer. see webglrenderingcontext.depthfunc(). gl.dither dithering of color components before they get written to the color buffer. gl.polygon_offset_fill adding an offset to depth values of polygon's fragments. see webglrenderingcontext.polygonoffset(). gl.sample_alpha_to_coverage computation of a temporary coverage value determined by the alpha value. gl.sample_coverage anding the fragment's coverage with the temporary coverage value. see webglrenderingcontext.samplecoverage(). gl.scissor_test scissor test that discards fragments ...
...he temporary coverage value. see webglrenderingcontext.samplecoverage(). gl.scissor_test scissor test that discards fragments that are outside of the scissor rectangle. see webglrenderingcontext.scissor(). gl.stencil_test stencil testing and updates to the stencil buffer. see webglrenderingcontext.stencilfunc(). when using a webgl 2 context, the following values are available additionally: constant description gl.rasterizer_discard primitives are discarded immediately before the rasterization stage, but after the optional transform feedback stage. gl.clear() commands are ignored. return value a glboolean indicating if the capability cap is enabled (true), or not (false). examples gl.isenabled(gl.st...
WebGLRenderingContext.pixelStorei() - Web APIs
the webglrenderingcontext.pixelstorei() method of the webgl api specifies the pixel storage modes. syntax void gl.pixelstorei(pname, param); parameters pname a glenum specifying which parameter to set. see below for possible values. param a glint specifying a value to set the pname parameter to. see below for possible values. return value none. pixel storage parameters parameter name (for pname) description type default value allowed values (for param) specified in gl.pack_alignment packing of pixel data into memory glint 4 1, 2, 4, 8 opengl es 2.0 gl.unpack_alignment unpacking of pixel data from memory. glint 4 1, 2, 4, 8 opengl es 2.0 gl.unpack_flip_y_webgl flips the source data along its v...
...gl gl.unpack_premultiply_alpha_webgl multiplies the alpha channel into the other color channels glboolean false true, false webgl gl.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 e...
...nt 0 0 to infinity opengl es 3.0 examples setting the pixel storage mode affects the webglrenderingcontext.readpixels() operations, as well as unpacking of textures with the webglrenderingcontext.teximage2d() and webglrenderingcontext.texsubimage2d() methods. var tex = gl.createtexture(); gl.bindtexture(gl.texture_2d, tex); gl.pixelstorei(gl.pack_alignment, 4); to check the values for packing and unpacking of pixel data, you can query the same pixel storage parameters with webglrenderingcontext.getparameter(). gl.getparameter(gl.pack_alignment); gl.getparameter(gl.unpack_alignment); specifications specification status comment webgl 1.0the definition of 'pixelstorei' in that specification. recommendation initial definition for webgl. ...
WebGLRenderingContext.readPixels() - Web APIs
st horizontal pixel that is read from the lower left corner of a rectangular block of pixels. y a glint specifying the first vertical pixel that is read from the lower left corner of a rectangular block of pixels. width a glsizei specifying the width of the rectangle. height a glsizei specifying the height of the rectangle. format a glenum specifying the format of the pixel data. possible values: gl.alpha: discards the red, green and blue components and reads the alpha component. gl.rgb: discards the alpha components and reads the red, green and blue components. gl.rgba: red, green, blue and alpha components are read from the color buffer. webgl2 adds gl.red gl.rg gl.red_integer gl.rg_integer gl.rgb_integer gl.rgba_integer type a glenum specifying the da...
...reen and blue components and reads the alpha component. gl.rgb: discards the alpha components and reads the red, green and blue components. gl.rgba: red, green, blue and alpha components are read from the color buffer. webgl2 adds gl.red gl.rg gl.red_integer gl.rg_integer gl.rgb_integer gl.rgba_integer type a glenum specifying the data type of the pixel data. possible values: gl.unsigned_byte gl.unsigned_short_5_6_5 gl.unsigned_short_4_4_4_4 gl.unsigned_short_5_5_5_1 gl.float webgl2 adds gl.byte gl.unsigned_int_2_10_10_10_rev gl.half_float gl.short gl.unsigned_short gl.int gl.unsigned_int gl.unsigned_int_10f_11f_11f_rev gl.unsigned_int_5_9_9_9_rev pixels an arraybufferview object to read data into. the array type must match...
...l.unsigned_int_10f_11f_11f_rev gl.unsigned_int_5_9_9_9_rev pixels an arraybufferview object to read data into. the array type must match the type of the type parameter. uint8array for gl.unsigned_byte. uint16array for gl.unsigned_short_5_6_5, gl.unsigned_short_4_4_4_4, or gl.unsigned_short_5_5_5_1. float32array for gl.float. dstoffset optional offset. defaults to 0. return value none. exceptions a gl.invalid_enum error is thrown if format or type is not an accepted value. a gl.invalid_operation error is thrown if type is gl.unsigned_short_5_6_5 and format is not gl.rgb. type is gl.unsigned_short_4_4_4_4 and format is not gl.rgba. type does not match the typed array type of pixels. a gl.invalid_framebuffer_operation error is thrown if the currently...
WebGLRenderingContext.renderbufferStorage() - Web APIs
the webglrenderingcontext.renderbufferstorage() method of the webgl api creates and initializes a renderbuffer object's data store. syntax void gl.renderbufferstorage(target, internalformat, width, height); parameters target a glenum specifying the target renderbuffer object. possible values: gl.renderbuffer: buffer data storage for single images in a renderable internal format. internalformat a glenum specifying the internal format of the renderbuffer. possible values: gl.rgba4: 4 red bits, 4 green bits, 4 blue bits 4 alpha bits. gl.rgb565: 5 red bits, 6 green bits, 5 blue bits. gl.rgb5_a1: 5 red bits, 5 green bits, 5 blue bits, 1 alpha bit. gl.depth_component16: 16 depth bits. gl.stencil_index8: 8 stencil bits. gl.depth_stencil when using a webgl 2 context, ...
...lenum specifying the internal format of the renderbuffer. possible values: gl.rgba4: 4 red bits, 4 green bits, 4 blue bits 4 alpha bits. gl.rgb565: 5 red bits, 6 green bits, 5 blue bits. gl.rgb5_a1: 5 red bits, 5 green bits, 5 blue bits, 1 alpha bit. gl.depth_component16: 16 depth bits. gl.stencil_index8: 8 stencil bits. ...
... ext.srgb8_alpha8_ext: 8-bit srgb and alpha. when using a webgl 2 context and the ext_color_buffer_float extension: gl.r16f gl.rg16f gl.rgba16f gl.r32f gl.rg32f gl.rgba32f gl.r11f_g11f_b10f width a glsizei specifying the width of the renderbuffer in pixels. height a glsizei specifying the height of the renderbuffer in pixels. return value none. examples gl.renderbufferstorage(gl.renderbuffer, gl.rgba4, 256, 256); specifications specification status comment webgl 1.0the definition of 'renderbufferstorage' in that specification. recommendation initial definition for webgl. opengl es 2.0the definition of 'glrenderbufferstorage' in that specification. standard man page of the opengl e...
Basic scissoring - Web APIs
lk about the difference between pixels and fragments. a pixel is a picture element (in practice, a point) on the screen, or a single element of the drawing buffer, that area in memory that holds your pixel data (such as rgba color components). a fragment refers to the pixel while it is being handled by the webgl pipeline. ...
... here we see another example of the distinction between fragments and pixels. ...
... here we see another example of the distinction between fragments and pixels. scissoring is a distinct stage in the webgl/opengl graphics pipeline (it occurs after color clearing, but before color masking). before the actual pixels are updated, fragments must go through the scissor test. ...
Using textures in WebGL - Web APIs
se { // no, it's not a power of 2. turn off mips and set // wrapping to clamp to edge gl.texparameteri(gl.texture_2d, gl.texture_wrap_s, gl.clamp_to_edge); gl.texparameteri(gl.texture_2d, gl.texture_wrap_t, gl.clamp_to_edge); gl.texparameteri(gl.texture_2d, gl.texture_min_filter, gl.linear); } }; image.src = url; return texture; } function ispowerof2(value) { return (value & (value - 1)) == 0; } the loadtexture() routine starts by creating a webgl texture object texture by calling the webgl createtexture() function. it then uploads a single blue pixel using teximage2d(). this makes the texture immediately usable as a solid blue color even though it may take a few moments for our image to download. to load the texture from the image file, it th...
...ssing them to the vertex shader; this will indicate the location within the texture corresponding to the vertex. the fragment shader the fragment shader likewise needs to be updated: const fssource = ` varying highp vec2 vtexturecoord; uniform sampler2d usampler; void main(void) { gl_fragcolor = texture2d(usampler, vtexturecoord); } `; instead of assigning a color value to the fragment's color, the fragment's color is computed by fetching the texel (that is, the pixel within the texture) based on the value of vtexturecoord which like the colors is interpolated bewteen vertices. attribute and uniform locations because we changed an attribute and added a uniform we need to look up their locations const programinfo = { program: shaderprogram, attribloc...
...location(shaderprogram, 'umodelviewmatrix'), usampler: gl.getuniformlocation(shaderprogram, 'usampler'), }, }; drawing the textured cube the changes to the drawscene() function are simple. ...
WebRTC connectivity - Web APIs
ding description (returned by rtcpeerconnection.pendinglocaldescription and rtcpeerconnection.pendingremotedescription) indicates a description which is currently under consideration following a call to setlocaldescription() or setremotedescription(), respectively. when reading the description (returned by rtcpeerconnection.localdescription and rtcpeerconnection.remotedescription), the returned value is the value of pendinglocaldescription/pendingremotedescription if there's a pending description (that is, the pending description isn't null); otherwise, the current description (currentlocaldescription/currentremotedescription) is returned. when changing the description by calling setlocaldescription() or setremotedescription(), the specified description is set as the pending description, and...
...ription isn't null); otherwise, the current description (currentlocaldescription/currentremotedescription) is returned. when changing the description by calling setlocaldescription() or setremotedescription(), the specified description is set as the pending description, and the webrtc layer begins to evaluate whether or not it's acceptable. once the proposed description has been agreed upon, the value of currentlocaldescription or currentremotedescription is changed to the pending description, and the pending description is set to null again, indicating that there isn't a pending description. the pendinglocaldescription contains not just the offer or answer under consideration, but any local ice candidates which have already been gathered since the offer or answer was created. similarly, pen...
... will try to simultaneously open a connection with its peer. choosing a candidate pair the ice layer selects one of the two peers to serve as the controlling agent. this is the ice agent which will make the final decision as to which candidate pair to use for the connection. the other peer is called the controlled agent. you can identify which one your end of the connection is by examining the value of rtcicecandidate.transport.role, although in general it doesn't matter which is which. the controlling agent not only takes responsibility for making the final decision as to which candidate pair to use, but also for signaling that selection to the controlled agent by using stun and an updated offer, if necessary. the controlled agent just waits to be told which candidate pair to use. it's im...
Using WebRTC data channels - Web APIs
ate the data transport and write your own code to signal to the other peer that it needs to connect to the new channel. let's look at each of these cases, starting with the first, which is the most common. automatic negotiation often, you can allow the peer connection to handle negotiating the rtcdatachannel connection for you. to do this, simply call createdatachannel() without specifying a value for the negotiated property, or specifying the property with a value of false. this will automatically trigger the rtcpeerconnection to handle the negotiations for you, causing the remote peer to create a data channel and linking the two together across the network. the rtcdatachannel object is returned immediately by createdatachannel(); you can tell when the connection has been made successful...
...estremotechannel(datachannel.id); in this code snippet, the channel is created with negotiated set to true, then a function called requestremotechannel() is used to trigger negotiation, to create a remote channel with the same id as the local channel. doing this lets you create data channels with each peer using different properties, and to create channels declaratively by simply using the same value for id. buffering webrtc data channels support buffering of outbound data. this is handled automatically. while there's no way to control the size of the buffer, you can learn how much data is currently buffered, and you can choose to be notified by an event when the buffer starts to run low on queued data. this makes it easy to write efficient routines that make sure there's always data ready ...
...eady to send without over-using memory or swamping the channel completely. <<<write more about using bufferedamount, bufferedamountlowthreshold, onbufferedamountlow, and bufferedamountlow here>>> ... understanding message size limits for any data being transmitted over a network, there are size restrictions. at a fundamental level, the individual network packets can't be larger than a certain value (the exact number depends on the network and the transport layer being used). at the application level—that is, within the user agent's implementation of webrtc on which your code is running—the webrtc implementation implements features to support messages that are larger than the maximum packet size on the network's transport layer. this can complicate things, since you don't necessarily kn...
WebSocket.close() - Web APIs
Web › API › WebSocket › close
reason optional a human-readable string explaining why the connection is closing. ...
... reason optional a human-readable string explaining why the connection is closing. ...
... reason optional a human-readable string explaining why the connection is closing. this string must be no longer than 123 bytes of utf-8 text (not characters). ...
WebSocket.send() - Web APIs
Web › API › WebSocket › send
the websocket.send() method enqueues the specified data to be transmitted to the server over the websocket connection, increasing the value of bufferedamount by the number of bytes needed to contain the data. if the data can't be sent (for example, because it needs to be buffered but the buffer is full), the socket is closed automatically. syntax websocket.send("hello server!"); parameters data the data to send to the server. it may be one of the following types: usvstring a text string. the string is added to the buffer in utf-8 format, and the value of bufferedamount is increased by the number of bytes required to represent the utf-8 string. arraybuffer you can send the underlying binary data used by a typed array object; its binary data contents are queued in the buffer, in...
...send to the server. it may be one of the following types: usvstring a text string. the string is added to the buffer in utf-8 format, and the value of bufferedamount is increased by the number of bytes required to represent the utf-8 string. arraybuffer you can send the underlying binary data used by a typed array object; its binary data contents are queued in the buffer, increasing the value of bufferedamount by the requisite number of bytes. blob specifying a blob enqueues the blob's raw data to be transmitted in a binary frame. the value of bufferedamount is increased by the byte size of that raw data. ...
... exceptions thrown invalid_state_err the connection is not currently open. syntax_err the data is a string that has unpaired surrogates. ...
Writing WebSocket client applications - Web APIs
data to the server. for example, a chat program can interact with a server using a protocol implemented using packets of json-encapsulated data: // send text to all users through the server function sendtext() { // construct a msg object containing the data the server needs to process the message from the chat client. ...
...to handle it, add an event listener for the message event, or use the onmessage event handler. ...
...t 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 websocket method close(): examplesocket.close(); it may be helpful to examine the socket's bufferedamount attribute before attempting to close the connection to determine if any data has yet to be transmitted on the network. if this value isn't 0, there's pending data still, so you may wish to wait before closing the connection. security considerations websockets should not be used in a mixed content environment; that is, you shouldn't open a non-secure websocket connection from a page loaded using https or vice-versa. most browsers now only allow secure websocket connections, and no longer support using them in insecure context...
Basic concepts behind Web Audio API - Web APIs
. 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. ...
...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. ...
...els (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 specific point in time: all the samples of all the channels that play at the same time (two for a stereo sound, 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...
Window: beforeunload event - Web APIs
user confirms, the browser navigates to the new page, otherwise it cancels the navigation. according to the specification, to show the confirmation dialog an event handler should call preventdefault() on the event. however note that not all browsers support this method, and some instead require the event handler to implement one of two legacy methods: assigning a string to the event's returnvalue property returning a string from the event handler. some browsers used to display the returned string in the confirmation dialog, enabling the event handler to display a custom message to the user. however, this is deprecated and no longer supported in most browsers. to combat unwanted pop-ups, browsers may not display prompts created in beforeunload event handlers unless the page has been in...
...ory page navigation caches, like firefox's back-forward cache or webkit's page cache. the html specification states that calls to window.alert(), window.confirm(), and window.prompt() methods may be ignored during this event. see the html specification for more details. examples the html specification states that authors should use the event.preventdefault() method instead of using event.returnvalue. ...
...ing this event. see the html specification for more details. examples the html specification states that authors should use the event.preventdefault() method instead of using event.returnvalue. however, this is not supported by all browsers. window.addeventlistener('beforeunload', (event) => { // cancel the event as stated by the standard. event.preventdefault(); // chrome requires returnvalue to be set. event.returnvalue = ''; }); specifications specification status comment html living standardthe definition of 'beforeunload' in that specification. living standard html5the definition of 'beforeunload' in that specification. recommendation initial definition ...
Window.getDefaultComputedStyle() - Web APIs
the object is of the same type as the object returned by window.getcomputedstyle(), but only takes into account user-agent and user rules. ...
...properties of an element, ignoring author styling. that is, only user-agent and user styles are taken into account. syntax var style = window.getdefaultcomputedstyle(element [, pseudoelt]); parameters element the element for which to get the computed style. pseudoelt optional a string specifying the pseudo-element to match. must be null (or not specified) for regular elements. return value the returned style is a cssstyledeclaration object. the object is of the same type as the object returned by window.getcomputedstyle(), but only takes into account user-agent and user rules. example simple example var elem1 = document.getelementbyid("elemid"); var style = window.getdefaultcomputedstyle(elem1); longer example <style> #elem-container { position: absolute; left: 10...
...mputedstyle() method can pull style info from pseudo-elements (e.g., ::before or ::after). <style> h3:after { content: ' rocks!'; } </style> <h3>generated content</h3> <script> var h3 = document.queryselector('h3'), result = getdefaultcomputedstyle(h3, ':after').content; console.log('the generated content is: ', result); // returns 'none' </script> notes the returned value is, in certain known cases, expressly incorrect by deliberate intent. in particular, to avoid the so called css history leak security issue, browsers may expressly "lie" about the used value for a link and always return values as if a user has never visited the linked site, and/or limit the styles that can be applied using the :visited pseudo-selector. see http://blog.mozilla.com/security/2010/03...
window.location - Web APIs
Web › API › Window › location
u can work with location as if it were a string in most cases: location = 'http://www.example.com' is a synonym of location.href = 'http://www.example.com'. see location for all available properties. syntax var oldlocation = location; location = newlocation; examples basic example alert(location); // alerts "/docs/web/api/window/location" example #1: navigate to a new page whenever a new value is assigned to the location object, a document will be loaded using the url as if location.assign() had been called with the modified url. note that security settings, like cors, may prevent this to effectively happen. location.assign("http://www.mozilla.org"); // or location = "http://www.mozilla.org"; example #2: force reloading the current page from the server location.reload(true); examp...
...called with the modified url. note that security settings, like cors, may prevent this to effectively happen. ...
... which will reload the page by using the replace() method to insert the value of location.pathname into the hash: function reloadpagewithhash() { var initialpage = location.pathname; location.replace('http://example.com/#' + initialpage); } example #4: display the properties of the current url in an alert dialog: function showloc() { var olocation = location, alog = ["property (typeof): value", "location (" + (typeof olocation) + "): " + olocation ]; for (var sprop in olocation){ alog.push(sprop + " (" + (typeof olocation[sprop]) + "): " + (olocation[sprop] || "n/a")); } alert(alog.join("\n")); } // in html: <button onclick="showloc();">show location properties</button> example #5: send a string of data to the server by modifying the search property: function senddata (sda...
Window.scrollX - Web APIs
Web › API › Window › scrollX
the read-only scrollx property of the window interface returns the number of pixels that the document is currently scrolled horizontally. this value is subpixel precise in modern browsers, meaning that it isn't necessarily a whole number. you can get the number of pixels the document is scrolled vertically from the scrolly property. syntax var x = window.scrollx; value in practice, the returned value is a double-precision floating-point value indicating the number of pixels the document is currently scrolled horizontally from the origin, where a positive value means the content is scrolled to the left. if the document is rendered on a subpixel-precise device, then the returned value is also subpixel-precise and may contain a decimal component. if the document isn't scrolled at all left or ...
... example this example checks the current horizontal scroll position of the document. ...
... example this example checks the current horizontal scroll position of the document. if it's greater than 400 pixels, the window is scrolled back to the beginning. ...
WindowEventHandlers.onhashchange - Web APIs
: window.onhashchange = funcref; using an html event handler: <body onhashchange="funcref();"> using an event listener: to add an event listener, use addeventlistener(): window.addeventlistener("hashchange", funcref, false); parameters funcref a reference to a function. examples using an event handler this example uses an event handler (window.onhashchange) to check the new hash value whenever it changes. if it equals #cool-feature, the script logs a message to the console. function locationhashchanged() { if (location.hash === '#cool-feature') { console.log("you're visiting a cool feature!"); } } window.onhashchange = locationhashchanged; using an event listener this example uses an event listener to log a notification whenever the hash has changed. function has...
...e!"); } } window.onhashchange = locationhashchanged; using an event listener this example uses an event listener to log a notification whenever the hash has changed. function hashhandler() { console.log('the hash has changed!'); } window.addeventlistener('hashchange', hashhandler, false); overriding the hash this function sets a new hash dynamically, setting it randomly to one of two values. function changehash() { location.hash = (math.random() > 0.5) ? 'location1' : 'location2'; } the hashchange event the dispatched hashchange event has the following properties: field type description newurl domstring the new url to which the window is navigating. oldurl domstring the previous url from which the window was navigated. poly...
...oldurl domstring the previous url from which the window was navigated. polyfill for event.newurl and event.oldurl // let this snippet run before your hashchange event binding code if (!window.hashchangeevent)(function(){ var lasturl = document.url; window.addeventlistener("hashchange", function(event){ object.defineproperty(event, "oldurl", {enumerable:true,configurable:true,value:lasturl}); object.defineproperty(event, "newurl", {enumerable:true,configurable:true,value:document.url}); lasturl = document.url; }); }()); specifications specification status comment html living standardthe definition of 'onhashchange' in that specification. living standard html 5.1the definition of 'globaleventhandlers' in that specific...
self.createImageBitmap() - Web APIs
ement, htmlvideoelement, htmlcanvaselement, blob, imagedata, imagebitmap, or offscreencanvas object. sx the x coordinate of the reference point of the rectangle from which the imagebitmap will be extracted. sy the y coordinate of the reference point of the rectangle from which the imagebitmap will be extracted. sw the width of the rectangle from which the imagebitmap will be extracted. this value can be negative. sh the height of the rectangle from which the imagebitmap will be extracted. this value can be negative. options optional an object that sets options for the image's extraction. the available options are: imageorientation: specifies whether the image should be presented as is or flipped vertically. either none (default) or flipy. premultiplyalpha: specifies whether the ...
...es whether the image should be presented as is or flipped vertically. either none (default) or flipy. premultiplyalpha: specifies whether the bitmap's color channels should be premultiplied by the alpha channel. one of none, premultiply, or default (default). colorspaceconversion: specifies whether the image should be decoded using color space conversion. either none or default (default). ...
... example creating sprites from a sprite sheet this example loads a sprite sheet, extracts individual sprites, and then renders each sprite to the canvas. ...
Worker.onmessage - Web APIs
Web › API › Worker › onmessage
d will be called when the worker's parent receives a message (i.e. from the dedicatedworkerglobalscope.postmessage method). note: the message payload is available in the message event's data property. syntax myworker.onmessage = function(e) { ... } example the following code snippet shows creation of a worker object using the worker() constructor. ...
...e) { ... } example the following code snippet shows creation of a worker object using the worker() constructor. messages are passed to the worker when the value inside the form input first changes. an onmessage handler is also present, to deal with messages that are passed back from the worker. ...
...xample the following code snippet shows creation of a worker object using the worker() constructor. messages are passed to the worker when the value inside the form input first changes. an onmessage handler is also present, to deal with messages that are passed back from the worker. ...
WorkerNavigator - Web APIs
ly returns a storagemanager interface for managing persistance permissions and estimating available storage. inherited properties navigatorid.appcodename read only always returns 'mozilla', in any browser. this property is kept only for compatibility purposes. navigatorid.appname read only returns the official name of the browser. do not rely on this property to return the correct value. ...
...gatorid.appcodename read only always returns 'mozilla', in any browser. this property is kept only for compatibility purposes. navigatorid.appname read only returns the official name of the browser. do not rely on this property to return the correct value. navigatorid.appversion read only returns the version of the browser as a string. do not rely on this property to return the correct value. navigatorconcurrenthardware.hardwareconcurrencyread only returns the number of logical processor cores available. navigatorlanguage.languageread only returns a domstring representing the language version of the browser. the null value is returned when this is unknown. navigatorlanguage.languagesread only returns an array of domstrings representing the languages known to the user, in ord...
...n this is unknown. navigatorlanguage.languagesread only returns an array of domstrings representing the languages known to the user, in order of preference. navigatoronline.onlineread only returns a boolean indicating whether the browser is online. navigatorid.platform read only returns a string representing the platform of the browser. do not rely on this property to return the correct value. navigatorid.product read only always returns 'gecko', on any browser. this property is kept only for compatibility purposes. navigatorid.useragentread only returns the user agent string for the current browser. methods the workernavigator interface implements methods from the navigatorid, navigatorlanguage and navigatoronline interfaces. specifications specification statu...
XMLHttpRequest: abort event - Web APIs
the abort event is fired when a request has been aborted, for example because the program called xmlhttprequest.abort(). ...
...r example because the program called xmlhttprequest.abort(). ...
... cancelable no interface progressevent event handler property onabort examples live example html <div class="controls"> <input class="xhr success" type="button" name="xhr" value="click to start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); con...
XMLHttpRequest: error event - Web APIs
the error event is fired when the request encountered an error. ...
... error event is fired when the request encountered an error. ...
... cancelable no interface progressevent event handler property onerror examples live example html <div class="controls"> <input class="xhr success" type="button" name="xhr" value="click to start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); con...
XMLHttpRequest: load event - Web APIs
the load event is fired when an xmlhttprequest transaction completes successfully. ...
...ed when an xmlhttprequest transaction completes successfully. ...
... cancelable no interface progressevent event handler property onload examples live example html <div class="controls"> <input class="xhr success" type="button" name="xhr" value="click to start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); con...
XMLHttpRequest: loadend event - Web APIs
the loadend event is fired when a request has completed, whether successfully (after load) or unsuccessfully (after abort or error). ...
...lly (after load) or unsuccessfully (after abort or error). ...
...cancelable no interface progressevent event handler property onloadend examples live example html <div class="controls"> <input class="xhr success" type="button" name="xhr" value="click to start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); con...
XMLHttpRequest: loadstart event - Web APIs
the loadstart event is fired when a request has started to load data. ...
... event is fired when a request has started to load data. ...
...ncelable no interface progressevent event handler property onloadstart examples live example html <div class="controls"> <input class="xhr success" type="button" name="xhr" value="click to start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); con...
XMLHttpRequest: progress event - Web APIs
the progress event is fired periodically when a request receives more data. ...
... is fired periodically when a request receives more data. ...
...ancelable no interface progressevent event handler property onprogress examples live example html <div class="controls"> <input class="xhr success" type="button" name="xhr" value="click to start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); con...
XREnvironmentBlendMode - Web APIs
the webxr api's enumerated type xrenvironmentblendmode defines strings used to identify if and how to blend the rendered virtual content with the real world. its values are used by the xrsession interface's environmentblendmode property. values opaque the rendered image is drawn without allowing any pass-through imagery. this is primarily used by fully-immersive vr headsets, which totally obscure the surrounding environment, with none of the real world shown to the user at all. the alpha values specified in the xrsession's renderstate property's baselayer field are ignored since the alpha values for the rendered imagery are all treated as being 1.0 (fully opaque). additive primarily used by ar devices with transparent lenses which directly allow reality to pass through to the user's eye...
...ditive blending mode is designed to be used in a situation in which the device has no control over the background and its brightness, since that isn't being digitally controlled. all the device can do is add more light to the image; it can't make things get darker. therefore, black is rendered as fully transparent, and there's no way to make a pixel fully opaque. as with the opaque setting, alpha values specified are ignored and treated as if they were 1.0. alpha-blend used by headsets or goggles which use cameras to capture the real world and display it digitally on the screen or screens used to render the content for the user to see, this offers a way to create an ar presentation using a vr device. alpha blending can also be used by non-wearable devices that provide ar modes, such as phones...
...ted, the brightness of each pixel can be controlled, whether it's reality or the rendered xr image, the user's environment can be blended with the virtual environment with each pixel having its color and brightness precisely controlled. in this mode, the xrsession's renderstate.baselayer property provides relative weights of the artificial layer during the compositing process. pixels whose alpha value is 1.0 are rendered fully opaque, totally obscuring the real world, while pixels with an alpha of 1.0 are totally transparent, leaving the surrounding environment to pass through. specifications specification status comment webxr augmented reality modulethe definition of 'xrenvironmentblendmode' in that specification. editor's draft initial definition. ...
XRInputSource.handedness - Web APIs
the read-only xrinputsource property handedness indicates which of the user's hands the webxr input source is associated with, or if it's not associated with a hand at all. syntax let hand = xrinputsource.handedness; value a domstring indicating whether the input controller is held in one of the user's hands, and if it is, which hand. the value, which comes from the xrhandedness enumerated type, is one of the following: none the input controller is not associated with one of the user's hands. left the input controller is being held in, worn on, or is attached to the user's left hand. right the input controller is being held in, worn on, or is attached to the user's right hand. usage notes if the input source is not a device associated with a user's hand (whether by being held,...
... none the input controller is not associated with one of the user's hands. left the input controller is being held in, worn on, or is attached to the user's left hand. right the input controller is being held in, worn on, or is attached to the user's right hand. usage notes if the input source is not a device associated with a user's hand (whether by being held, attached, or worn), the value of handedness is none. this may indicate, for example, an input source which isn't hand-held, such as controls built into a headset or an input device attached to the head or body. examples one important usage scentario for handedness is to determine which hand a controller is in so you can draw a representation of that hand (or the device that hand is controlling) in virtual space. function ...
...gripspace which isn't null. if a gripspace is present, that means the input source is a hand-held device of some sort, so it should be rendered visibly if possible. if gripspace is non-null, the function proceeds to get the pose for the gripspace transformed into the current reference space. assuming that's then valid, a function called myrenderhandobject() is called with the grip's pose and the value of handedness. with these values in hand (no pun intended), myrenderhandobject() can draw the appropriate model positioned and formed for the correct hand. specifications specification status comment webxr device apithe definition of 'xrinputsource.handedness' in that specification. working draft initial definition. ...
XRInputSourceArray.forEach() - Web APIs
the xrinputsourcearray method foreach() executes the specified callback once for each input source in the array, starting at index 0 and progressing until the end of the list. syntax xrinputsourcearray.foreach(callback, thisarg); parameters callback a function to execute once for each entry in the array xrinputsourcearray. the callback accepts up to three parameters: currentvalue a xrinputsource object which is the value of the item from within the xrinputsourcearray which is currently being processed. currentindex optional an integer value providing the index into the array at which the element given by currentvalue is located. if you don't need to know the index number, you can omit this. sourcelist optional the xrinputsourcearray object which is being processed. i...
...array which is currently being processed. currentindex optional an integer value providing the index into the array at which the element given by currentvalue is located. if you don't need to know the index number, you can omit this. sourcelist optional the xrinputsourcearray object which is being processed. if you don't need this information, you may omit this. thisarg optional the value to be used for this while executing the callback. note that if you use arrow function notation (=>) to provide the callback, you can omit thisarg, since all arrow functions lexically bind this. return value undefined. examples this example snippet gets the list of inputs for a session and tries to handle each type of input device it supports using. let inputsources = xrsession.inputsources;...
...od. specifications specification status comment webxr device apithe definition of 'xrinputsourcearray' in that specification.1 working draft xrinputsourcearray interface [1] see iterator-like methods in information contained in a webidl file for information on how an iterable declaration in an interface definition causes entries(), foreach(), keys(), and values() methods to be exposed from objects that implement the interface. ...
XRInputSourceArray.length - Web APIs
examples in this example, a game that requires at least one input source uses length to check this before proceeding to allow the user to play the game. ...
... examples in this example, a game that requires at least one input source uses length to check this before proceeding to allow the user to play the game. ...
... 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. ...
XRPermissionDescriptor.optionalFeatures - Web APIs
sed to specify a list of webxr features which your app or site would like to use but can operate without if permission isn't granted to use them. ...
... the reference space returned by xrsession.requestreferencespace() is either xrreferencespace or xrboundedreferencespace. ...
...t all beyond their starting position, and tracking is optimized for this use case. for devices with six degrees of freedom (6dof) tracking, the local reference space tries to keep the origin stable relative to the environment. xrreferencespace local-floor similar to the local type, except the starting position is placed in a safe location for the viewer to stand, where the value of the y axis is 0 at floor level. if that floor level isn't known, the user agent will estimate the floor level. if the estimated floor level is non-zero, the browser is expected to round it such a way as to avoid fingerprinting (likely to the nearest centimeter). xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely l...
XRPermissionDescriptor.requiredFeatures - Web APIs
supported for the app to work. this ensures that permissions are checked as applicable to ensure that those features are available upon request. syntax xrpermissiondescriptor = { mode: xrsessionmode, requiredfeatures: reqfeaturelist, optionalfeatures: optfeaturelist }; xrpermissiondescriptor.requiredfeatures = reqfeaturelist; reqfeaturelist = xrpermissiondescriptor.requiredfeatures; value an array of strings indicating the webxr features which must be available for use by the app or site. the permissions check will be performed in such a manner as to verify that all features in the list are available for use with the user's permission. currently, all features are members of the xrreferencespacetype enumerated type, indicating the reference space types that your app would like pe...
...ons check will be performed in such a manner as to verify that all features in the list are available for use with the user's permission. currently, all features are members of the xrreferencespacetype enumerated type, indicating the reference space types that your app would like permission to use, but can operate without. future editions of webxr may add more recognized features. the permitted values are: the types of reference space are listed in the table below, with brief information about their use cases and which interface is used to implement them. xrreferencespacetype description interface bounded-floor similar to the local type, except the user is not expected to move outside a predetermined boundary, given by the boundsgeometry in the returned objec...
...t all beyond their starting position, and tracking is optimized for this use case. for devices with six degrees of freedom (6dof) tracking, the local reference space tries to keep the origin stable relative to the environment. xrreferencespace local-floor similar to the local type, except the starting position is placed in a safe location for the viewer to stand, where the value of the y axis is 0 at floor level. if that floor level isn't known, the user agent will estimate the floor level. if the estimated floor level is non-zero, the browser is expected to round it such a way as to avoid fingerprinting (likely to the nearest centimeter). xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely l...
XRSession.onsqueeze - Web APIs
et to a function which is then invoked to handle the squeeze event that's sent when the user successfully completes a primary squeeze action on a webxr input device. these actions represent the user squeezing or gripping an object or controller. to learn more about how to use and handle webxr controller inputs, see inputs and input sources. ...
...handlerfunction; value a function to be invoked whenever the xrsession receives a squeeze event. examples handling squeeze events for a specific hand this snippet of code adds a simple handler for the squeeze event, which responds only to events on the user's off-hand (that is, the hand that isn't their dominant hand). this is determined by comparing the input source's handedness against the value of a handedness property on a user object we've established previously. xrsession.onsqueeze = event => { if (event.inputsource.handedness != user.handedness) { handleoffhandsqueeze(event.inputsource, event.frame); } }; finishing an ongoing squeeze action this example exapnds somewhat on the previous example by demonstrating a way to implement the ability for the user to drop an object...
...f code, but should establish the general idea. after checking that the event occurred on the user's dominant hand, the pose's target ray is obtained. then we pass the currently held object and the target ray's transform matrix into a function we call dropobjectusingray() to drop the object, using the target ray to determine the surface upon which the object should be placed. this also clears the value of heldobject so we know that there's no longer an object in hand. xrsession.onsqueeze = event => { if (event.inputsource.handedness == user.handedness) { let targetraypose = event.frame.getpose(event.inputsource.targetrayspace, myrefspace); if (user.heldobject && targetraypose) { dropobjectusingray(user.heldobject, targetraypose.transform.matrix): } } }; see the example...
XRSession - Web APIs
Web › API › XRSession
nput device used to control the camera and/or scene. renderstate read only an xrrenderstate object which contains options affecting how the imagery is rendered. this includes things such as the near and far clipping planes (distances defining how close and how far away objects can be and still get rendered), as well as field of view information. visibilitystate read only a domstring whose value is one of those found in the xrvisibilitystate enumerated type, indicating whether or not the session's imagery is visible to the user, and if so, if it's being visible but not currently the target for user events. methods xrsession provides the following methods in addition to those inherited from its parent interface, eventtarget. cancelanimationframe() removes a callback from the animat...
...on frame rendering callbacks, given the identifying handle returned by a previous call to requestanimationframe(). end() ends the webxr session. returns a promise which resolves when the session has been shut down. requestanimationframe() schedules the specified method to be called the next time the user agent is working on rendering an animation frame for the webxr device. returns an integer value which can be used to identify the request for the purposes of canceling the callback using cancelanimationframe(). this method is comparable to the window.requestanimationframe() method. requestreferencespace() requests that a new xrreferencespace of the specified type be created. returns a promise which resolves with the xrreferencespace or xrboundedreferencespace which was requested, or throw...
...ionframe() method. requestreferencespace() requests that a new xrreferencespace of the specified type be created. returns a promise which resolves with the xrreferencespace or xrboundedreferencespace which was requested, or throws a notsupportederror if the requested space type isn't supported by the device. updaterenderstate() updates the properties of the session's render state to match the values specified in the specified xrrenderstateinit dictionary. any properties not included in the given dictionary are left unchanged from their current values. events the following events are delivered to xrsession objects. event description end sent to the xrsession object after the webxr session has ended and all hardware-related functions have completed. the event i...
XRSessionMode - Web APIs
the session's environmentblendmode indicates the method to be used to blend the content together. important: the immersive-ar mode is defined by the webxr augmented reality module, which is not yet stable and should not be used other than for testing and experimentation. ...
...ed inline within the context of an element in a standard html document, rather than occupying the full visual space. inline sessions can be presented in either mono or stereo mode, and may or may not have viewer tracking available. inline sessions don't require special hardware and should be avalable on any user agent offering webxr api support. usage notes the xrsessionmode type indicates the values that can be specified when calling xr.issessionsupported() to determine whether or not the specified session type is supported and available to be used, and by requestsession() to attempt to open a new webxr session. the immersive-ar mode supports all the same features and reference spaces that immersive-vr does, since both are immersive sessions. browsers may support either or both of these mo...
... but if webxr is available, the inline mode is always supported. specifications specification status comment webxr device apithe definition of 'xrsessionmode' in that specification. working draft initial definition. webxr augmented reality modulethe definition of 'xrsessionmode: immersive-ar' in that specification. editor's draft the immersive-ar value added ...
XRWebGLLayerInit.alpha - Web APIs
example in this example, a new xrwebgllayer is created for a webxr session, xrsession, without an alpha channel. ...
... example in this example, a new xrwebgllayer is created for a webxr session, xrsession, without an alpha channel. ...
...in the xrwebgllayerinit dictionary passed into the xrwebgllayer() constructor, specifies that the new layer's color buffer is to include an alpha channel. otherwise, the color buffer won't have an alpha channel. the default is true. syntax let layerinit = { alpha: boolvalue }; let gllayer = new xrwebgllayer(xrsession, gl, layerinit); let gllayer = new xrwebgllayer(xrsession, gl, { alpha: boolvalue }); value a boolean which can be set to true to request that the new webgl layer for rendering the webxr scene is to have an alpha channel. example in this example, a new xrwebgllayer is created for a webxr session, xrsession, without an alpha channel. xrsession.updaterenderstate({ baselayer: new xrwebgllayer(xrsession, gl, { alpha: false }); }); specifications specific...
XRWebGLLayerInit.antialias - Web APIs
o true in the xrwebgllayerinit object provided as the xrwebgllayer() constructor's layerinit parameter, requests that the new webgl rendering layer support anti-aliasing. if this property is missing or is false, anti-aliasing is not desired. there is no way to request a specific anti-aliasing format or level; this decision is left up to the user agent. syntax let layerinit = { antialias: boolvalue }; let gllayer = new xrwebgllayer(xrsession, gl, layerinit); let gllayer = new xrwebgllayer(xrsession, gl, { antialias: boolvalue }); value a boolean value which can be set to true to request anti-aliasing support in the new webgl rendering layer. if false, anti-aliasing is not desired. usage notes the state of anti-aliasing for the context after being created can be read from the xrwebglla...
...ntialias: boolvalue }); value a boolean value which can be set to true to request anti-aliasing support in the new webgl rendering layer. if false, anti-aliasing is not desired. usage notes the state of anti-aliasing for the context after being created can be read from the xrwebgllayer property antialias. example in this example, before creating a new xrwebgllayer to use for rendering, the value of a user preference from a configuration interface is obtained using a function called getpreferencevalue() to determine whether the user has enabled or disabled anti-aliasing support; this is passed into the constructor. ...
...om the xrwebgllayer property antialias. example in this example, before creating a new xrwebgllayer to use for rendering, the value of a user preference from a configuration interface is obtained using a function called getpreferencevalue() to determine whether the user has enabled or disabled anti-aliasing support; this is passed into the constructor. let options = { antialias: getpreferencevalue("antialiasing") }; let gllayer = new xrwebgllayer(xrsession, gl, options); if (gllayer) { xrsession.updaterenderstate({ baselayer: gllayer }); } offering the user features such as the ability to enable or disable things like anti-aliasing can provide them with optiions to try when your app isn't performing as well as they'd like. disabling anti-aliasing may improve performance to some extent...
XRWebGLLayerInit.depth - Web APIs
sing the xrwebgllayer() constructor to create a new webgl rendering layer for webxr, providing as the layerinit parameter an object whose depth property is false will request that the new layer be created without a depth buffer. ...
...ayerinit); let gllayer = new xrwebgllayer(xrsession, gl, { depth: false }); value a boolean which can be set to false to specify that the new webgl layer should not have a depth buffer. this means that the only source for depth information is the vertex coordinates, and reduces the accuracy and quality of rendering, but may potentially affect the performance of rendering as well. the default value is true. usage notes this property differs from ignoredepthvalues in that a layer created with ignoredepthvalues set to true may still have a depth buffer, but will not make use of it. you can determine whether or not the depth buffer is being used by a given webgl rendering layer during your xr session by checking the value returned by xrwebgllayer.ignoredepthvalues. if this is true, then the...
...yer created with ignoredepthvalues set to true may still have a depth buffer, but will not make use of it. you can determine whether or not the depth buffer is being used by a given webgl rendering layer during your xr session by checking the value returned by xrwebgllayer.ignoredepthvalues. if this is true, then the depth buffer is either not present or is being ignored. if (gllayer.ignoredepthvalues) { /* not using the depth buffer */ } example in this example, a new xrwebgllayer is created for a webxr session, xrsession, without a depth buffer. xrsession.updaterenderstate({ baselayer: new xrwebgllayer(xrsession, gl, { depth: false }); }); specifications specification status comment webxr device apithe definition of 'xrwebgllayerinit.depth' in that sp...
XRWebGLLayerInit.stencil - Web APIs
using the xrwebgllayer() constructor to create a new webgl rendering layer for webxr, providing as the layerinit parameter an object whose stencil property is false requests that the new layer be created without a stencil buffer. the stencil buffer is an optional buffer which, just like the depth buffer, contains one entry for every pixel in the frame buffer. also just like the depth buffer, the value of an enter in the stencil buffer directly affects how (or if) the corresponding pixel is drawn during rendering. you can store values into each entry in the stencil bufer, then specify an operation that determines which stencil buffer values correspond to pixels which should be drawn to the screen during each frame. syntax let layerinit = { stencil: false }; let gllayer = new xrwebgllayer(xr...
... example in this example, a new xrwebgllayer is created for a webxr session, xrsession, without a stencil buffer. ...
... example in this example, a new xrwebgllayer is created for a webxr session, xrsession, without a stencil buffer. xrsession.updaterenderstate({ baselayer: new xrwebgllayer(xrsession, gl, { stencil: false }); }); specifications specification status comment webxr device apithe definition of 'xrwebgllayerinit.stencil' in that specification. ...
ARIA: cell role - Accessibility
to be supported, the cell must be nested in an element with the role of row. <div role="row"> <span role="cell">france</span> <span role="cell">67 million</span> </div> a better, more semantic way of writing the cells above would be to use the semantic <td> element. <tr role="row"> <td role="cell">france</td> <td role="cell">67 million</td> </tr> description the element with role="cell" is a cell within a row, optionally within a rowgroup, within a grid, table or treegrid within a static tabular structure. using native html <td> elements, whenever possible, is strongly encouraged. ...
... states and properties aria-colspan similar to the html <th> and <td> colspan attribute, it defines the number of columns spanned by the cell. aria-rowspan similar to the html <th> and <td> rowspan attribute, it defines the number of rows spanned by the cell. aria-colindex attribute the aria-colindex attribute is only needed if columns are hidden from the dom. the attribute takes as its value an integer between 1 and the total number of columns within the table, grid or treegrid. the aria-colindex defines an element's column index or position with respect to the total number of columns within a row. if all the columns are in the dom, this attribute is not necessary. aria-rowindex attribute the aria-rowindex attribute is only needed if rows are hidden from the dom, to indicate wh...
.... the aria-colindex defines an element's column index or position with respect to the total number of columns within a row. if all the columns are in the dom, this attribute is not necessary. aria-rowindex attribute the aria-rowindex attribute is only needed if rows are hidden from the dom, to indicate which row, in the list of total rows, the current cell is in. the attribute, takes as its value an integer between 1 and the total number of rows within the table, grid, or treegrid, indicating the position, or index, of the cell. for example, a cell in the first row of the first header would likely have aria-rowindex="1" set, and cells in row 47 would have aria-rowindex="47", if aria-rowindex were needed due to not all rows being in the dom. if the rows that are visible are contiguous, an...
ARIA: document role - Accessibility
dard input events, such as up or down arrow keyboard events, to control the reading cursor. in contrast to the article role, the document role does not have any relation to other elements with a document role, it merely has a relationship to the containing composit widget. an article can have associated articles. associated wai-aria roles, states, and properties aria-expanded include with a value of true or false if the document element is collapsible, to indicate if the document is currently expanded or collapsed. other values include the default undefined which means the document is not collapsible. tabindex="0" used to make it focusable so the assistive technology user can tab to it and start reading right away. keyboard interactions the element should be made focusable by se...
...lement is collapsible, to indicate if the document is currently expanded or collapsed. other values include the default undefined which means the document is not collapsible. tabindex="0" used to make it focusable so the assistive technology user can tab to it and start reading right away. keyboard interactions the element should be made focusable by setting the tabindex="0" attribute / value pair on it. this way, the user can tab to it, reading mode is invoked automatically, and the content can be read right away. required javascript features none, except as required by any attributes. for example, if the document is collapsible, then the state and the value of aria-expanded must be maintained. examples an example is gmail and the single conversation view. gmail is a web applicat...
...pse them, and manipulate them. once focus returns to the message list either by activating the back button or pressing an asociated keystroke, direct application interaction mode is invoked again, and the user can move to a different conversation in the list with the arrow keys. best practices always make sure an item with the document role is focusable, by setting the tabindex attribute with a value of 0. that will also include it in the tab order. added benefits the document role is an easy way to indirectly control assistive technology behavior by unambiguously stating that this is content the user should read with standard screen reader commands. specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'document' in...
ARIA - Accessibility
rs should prefer using the correct semantic html element over using aria, if such an element exists. for instance, native elements have built-in keyboard accessibility, roles and states. however, if you choose to use aria, you are responsible for mimicking (the equivalent) browser behaviour in script. here's the markup for a progress bar widget: <div id="percent-loaded" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"> </div> this progress bar is built using a <div>, which has no meaning. unfortunately, there isn't a more semantic tag available to developers in html 4, so we need to include aria roles and properties. these are specified by adding attributes to the element. in this example, the role="progressbar" attribute informs the browser that this elemen...
...s progress bar is built using a <div>, which has no meaning. unfortunately, there isn't a more semantic tag available to developers in html 4, so we need to include aria roles and properties. these are specified by adding attributes to the element. in this example, the role="progressbar" attribute informs the browser that this element is actually a javascript-powered progress bar widget. the aria-valuemin and aria-valuemax attributes specify the minimum and maximum values for the progress bar, and the aria-valuenow describes the current state of it and therefore must be kept updated with javascript. along with placing them directly in the markup, aria attributes can be added to the element and updated dynamically using javascript code like this: // find the progress bar <div> in the dom. var ...
... the markup, aria attributes can be added to the element and updated dynamically using javascript code like this: // find the progress bar <div> in the dom. var progressbar = document.getelementbyid("percent-loaded"); // set its aria roles and states, // so that assistive technologies know what kind of widget it is. progressbar.setattribute("role", "progressbar"); progressbar.setattribute("aria-valuemin", 0); progressbar.setattribute("aria-valuemax", 100); // create a function that can be called at any time to update // the value of the progress bar. function updateprogress(percentcomplete) { progressbar.setattribute("aria-valuenow", percentcomplete); } note that aria was invented after html4, so does not validate in html4 or its xhtml variants. however, the accessibility gains it provid...
Keyboard-navigable JavaScript widgets - Accessibility
ble by keyboard and script. when set to -1, the element becomes focusable by script, but it does not become part of the keyboard focus order. the order in which elements gain focus when using a keyboard, is the source order by default. in exceptional circumstances, authors may want to redefine the order. to do this, authors can set tabindex to any positive number. warning: avoid using positive values for tabindex. elements with a positive tabindex are put before the default interactive elements on the page, which means page authors will have to set (and maintain) tabindex values for all focusable elements on the page whenever they use one or more positive values for tabindex. the following table describes tabindex behavior in modern browsers: tabindex attribute focusable with...
... negative (i.e. tabindex="-1") yes no; author must focus the element with focus() in response to arrow or other key presses. zero (i.e. tabindex="0") yes in tab order relative to element's position in document (note that interactive elements like <a> have this behavior by default, they don't need the attribute). positive (e.g. tabindex="33") yes tabindex value determines where this element is positioned in the tab order: smaller values will position elements earlier in the tab order than larger values (for example, tabindex="7" will be positioned before tabindex="11"). non-native controls native html elements that are interactive, like <a>, <input> and <select>, are already accessible by keyboards, so to use one of them is the fastest path to m...
... handler to the container widget and using the aria-activedescendant to track a "virtual" focus. (for more information about aria, see this overview of accessible web applications and widgets.) the aria-activedescendant property identifies the id of the descendent element that currently has the virtual focus. the event handler on the container must respond to key and mouse events by updating the value of aria-activedescendant and ensuring that the current item is styled appropriately (for example, with a border or background color). see the source code of this aria radiogroup example for a direct illustration of how this works. general guidelines use onkeydown to trap key events, not onkeypress ie will not fire keypress events for non-alphanumeric keys. use onkeydown instead. ensure that k...
Custom properties (--*): CSS variables - CSS: Cascading Style Sheets
Web › CSS › --*
property names that are prefixed with --, like --example-name, represent custom properties that contain a value that can be used in other declarations using the var() function. custom properties are scoped to the element(s) they are declared on, and participate in the cascade: the value of such a custom property is that from the declaration decided by the cascading algorithm. initial valuesee proseapplies toall elementsinheritedyescomputed valueas specified with variables substitutedanimation typediscrete syntax --somekeyword: left; --somecolor: #0000ff; --somecomplexvalue: 3px 6px rgb(20, 32, 54); <declaration-value> this value matches any sequence of one or more tokens, so long as the sequence does not contain an unallowed token. it represents the entirety of what a valid declaratio...
...ntsinheritedyescomputed valueas specified with variables substitutedanimation typediscrete syntax --somekeyword: left; --somecolor: #0000ff; --somecomplexvalue: 3px 6px rgb(20, 32, 54); <declaration-value> this value matches any sequence of one or more tokens, so long as the sequence does not contain an unallowed token. it represents the entirety of what a valid declaration can have as its value. note: custom property names are case sensitive — --my-color will be treated as a separate custom property to --my-color. ...
...3px 6px rgb(20, 32, 54); <declaration-value> this value matches any sequence of one or more tokens, so long as the sequence does not contain an unallowed token. it represents the entirety of what a valid declaration can have as its value. note: custom property names are case sensitive — --my-color will be treated as a separate custom property to --my-color. ...
-moz-float-edge - CSS: Cascading Style Sheets
the non-standard -moz-float-edge css property specifies whether the height and width properties of the element include the margin, border, or padding thickness. /* keyword values */ -moz-float-edge: border-box; -moz-float-edge: content-box; -moz-float-edge: margin-box; -moz-float-edge: padding-box; /* global values */ -moz-float-edge: inherit; -moz-float-edge: initial; -moz-float-edge: unset; syntax values border-box the height and width properties include the content, padding and border but not the margin. content-box the height and width properties include the content, but not the padding, border or margin. margin-box the height and width properties include the content, padding, border and margin. padding-box the height and width properties include the content and pa...
...es include the content, padding and border but not the margin. content-box the height and width properties include the content, but not the padding, border or margin. margin-box the height and width properties include the content, padding, border and margin. padding-box the height and width properties include the content and padding but not the border or margin. ...
...gin. content-box the height and width properties include the content, but not the padding, border or margin. margin-box the height and width properties include the content, padding, border and margin. padding-box the height and width properties include the content and padding but not the border or margin. ...
-moz-force-broken-image-icon - CSS: Cascading Style Sheets
the -moz-force-broken-image-icon extended css property can be used to force the broken image icon to be shown even when a broken image has an alt attribute. syntax values <integer> a value of 1 means that the broken image icon is shown even if the image has an alt attribute. when the value 0 is used the image will act as usual and only display the alt attribute. note: even if the value is set to 1 the alt attribute will still be displayed, alongside the broken image icon. ...
...n when a broken image has an alt attribute. syntax values <integer> a value of 1 means that the broken image icon is shown even if the image has an alt attribute. when the value 0 is used the image will act as usual and only display the alt attribute. note: even if the value is set to 1 the alt attribute will still be displayed, alongside the broken image icon. ...
.... syntax values <integer> a value of 1 means that the broken image icon is shown even if the image has an alt attribute. when the value 0 is used the image will act as usual and only display the alt attribute. note: even if the value is set to 1 the alt attribute will still be displayed, alongside the broken image icon. ...
-moz-image-region - CSS: Cascading Style Sheets
for certain xul elements and pseudo-elements that use an image from the list-style-image property, this property specifies a region of the image that is used in place of the whole image. this allows elements to use different pieces of the same image to improve performance. /* keyword value */ -moz-image-region: auto; /* <shape> value */ -moz-image-region: rect(0, 8px, 4px, 4px); /* global values */ -moz-image-region: inherit; -moz-image-region: initial; -moz-image-region: unset; the syntax is similar to the clip property. all four values are relative to the upper left corner of the image. note: for a system that works on any background, see -moz-image-rect(). syntax values auto automatically defines the region of the image to use. <shape> a shape defining the part of t...
...note: for a system that works on any background, see -moz-image-rect(). syntax values auto automatically defines the region of the image to use. <shape> a shape defining the part of the image to use. the rect() function defines a rectangle to use as shape. its parameters define the top, right, bottom, and left offsets of the edges of the image, in this order. formal definition initial valueautoapplies toxul <image> elements and :-moz-tree-image, :-moz-tree-twisty, and :-moz-tree-checkbox pseudo-elements. note: -moz-image-region only works with <image> elements where the icon is specified using list-style-image. ...
...ight, bottom, and left offsets of the edges of the image, in this order. formal definition initial valueautoapplies toxul <image> elements and :-moz-tree-image, :-moz-tree-twisty, and :-moz-tree-checkbox pseudo-elements. note: -moz-image-region only works with <image> elements where the icon is specified using list-style-image. ...
-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>. ...
... 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. ...
...re 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 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; ...
-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>. ...
...x. 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. ...
...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. ...
-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>. ...
...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. ...
...urvature 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. ...
-moz-user-focus - CSS: Cascading Style Sheets
the -moz-user-focus css property is used to indicate whether an element can have the focus. /* keyword values */ -moz-user-focus: normal; -moz-user-focus: ignore; /* global values */ -moz-user-focus: inherit; -moz-user-focus: initial; -moz-user-focus: unset; by setting its value to ignore, you can disable focusing the element, which means that the user will not be able to activate the element. the element will be skipped in the tab sequence. initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete note: this property doesn't work for xul <xul:textbox> elements, because the textbox itself never takes focus. instead, xbl creates an anonymous html <input> element inside the textbox, and that element is what receives focus. you can stop the...
...te: this property doesn't work for xul <xul:textbox> elements, because the textbox itself never takes focus. instead, xbl creates an anonymous html <input> element inside the textbox, and that element is what receives focus. you can stop the textbox from taking keyboard focus by setting its tab index to -1, and from taking mouse focus by preventing the default action of mousedown events. ...
...s by setting its tab index to -1, and from taking mouse focus by preventing the default action of mousedown events. syntax values ignore the element does not accept the keyboard focus and will be skipped in the tab order. normal the element can accept the keyboard focus. select-after ? select-before ? select-menu ? select-same ? select-all ? none ? formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax ignore | normal | select-after | select-before | select-menu | select-same | select-all | none examples html <input class="ignored" value="the user cannot focus on this element."> css .ignored { -moz-user-focus: ignore; } specifications not part of any standard. a similar property, user-...
-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. ...
...dium; -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. ...
...th> 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-touch-callout - CSS: Cascading Style Sheets
the -webkit-touch-callout css property controls the display of the default callout shown when you touch and hold a touch target. when a target is touched and held on ios, safari displays a callout information about the link. this property allows disabling that behavior. ...
... the -webkit-touch-callout css property controls the display of the default callout shown when you touch and hold a touch target. when a target is touched and held on ios, safari displays a callout information about the link. this property allows disabling that behavior. ...
...out shown when you touch and hold a touch target. when a target is touched and held on ios, safari displays a callout information about the link. this property allows disabling that behavior. /* keyword values */ -webkit-touch-callout: default; -webkit-touch-callout: none; /* global values */ -webkit-touch-callout: initial; -webkit-touch-callout: inherit; -webkit-touch-callout: unset; syntax values default the default callout is displayed. none the callout is disabled. formal definition initial valuedefaultapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax default | none examples turn off touch callout .example { -webkit-touch-callout: none; } specifications not part of any standard. apple has a description in the safari css ...
:focus-visible - CSS: Cascading Style Sheets
an older, prefixed pseudo-class — :-moz-focusring. syntax :focus-visible examples basic example in this example, the :focus-visible selector uses the ua's behavior to determine when to match. compare what happens when you click on the different controls with a mouse, versus when you tab through them using a keyboard. note the difference in behavior from elements styled with :focus. ...
...sic example in this example, the :focus-visible selector uses the ua's behavior to determine when to match. compare what happens when you click on the different controls with a mouse, versus when you tab through them using a keyboard. note the difference in behavior from elements styled with :focus. ...
...mpare what happens when you click on the different controls with a mouse, versus when you tab through them using a keyboard. note the difference in behavior from elements styled with :focus. ...
:nth-last-child() - CSS: Cascading Style Sheets
siblings, counting backwards from the last one */ :nth-last-child(4n) { color: lime; } note: this pseudo-class is essentially the same as :nth-child, except it counts items backwards from the end, not forwards from the beginning. syntax the nth-last-child pseudo-class is specified with a single argument, which represents the pattern for matching elements, counting from the end. keyword values odd represents elements whose numeric position in a series of siblings is odd: 1, 3, 5, etc., counting from the end. even represents elements whose numeric position in a series of siblings is even: 2, 4, 6, etc., counting from the end. functional notation <an+b> represents elements whose numeric position in a series of siblings matches the pattern an+b, for every positive integer or ...
...odd represents elements whose numeric position in a series of siblings is odd: 1, 3, 5, etc., counting from the end. even represents elements whose numeric position in a series of siblings is even: 2, 4, 6, etc., counting from the end. functional notation <an+b> represents elements whose numeric position in a series of siblings matches the pattern an+b, for every positive integer or zero value of n. the index of the first element, counting from the end, is 1. the values a and b must both be <integer>s. formal syntax :nth-last-child( <nth> [ of <complex-selector-list> ]? )where <nth> = <an-plus-b> | even | odd<complex-selector-list> = <complex-selector>#where <complex-selector> = <compound-selector> [ <combinator>? <compound-selector> ]*where <compound-selector> = [ <type-selector>? ...
...subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!<combinator> = '>' | '+' | '~' | [ '|' ]where <type-selector> = <wq-name> | <ns-prefix>? '*'<subclass-selector> = <id-selector> | <class-selector> | <attribute-selector> | <pseudo-class-selector><pseudo-element-selector> = ':' <pseudo-class-selector><pseudo-class-selector> = ':' <ident-token> | ':' <function-token> <any-value> ')'where <wq-name> = <ns-prefix>? <ident-token><ns-prefix> = [ <ident-token> | '*' ]? | <id-selector> = <hash-token><class-selector> = '.' <ident-token><attribute-selector> = '[' <wq-name> ']' | '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'where <attr-matcher> = [ '~' | | | '^' | '$' | '*' ]? '='<attr-modifier> = i | s examples example selectors tr...
fallback - CSS: Cascading Style Sheets
the fallback descriptor can be used to specify a counter style to fall back to if the current counter style cannot create a marker representation for a particular counter value. syntax /* keyword values */ fallback: lower-alpha; fallback: custom-gangnam-style; description if the specified fallback style is also unable to construct a representation, then its fallback style will be used. if a valid fallback style is not specified, it defaults to decimal. a couple of scenarios where a fallback style will be used are: when the range descriptor is specified for a counter style, the fallback style will be used to represent values that fall outside the range. when the fixed system is used and there are not enough symbols to cover all the list items, the fallback style will be used for th...
...where a fallback style will be used are: when the range descriptor is specified for a counter style, the fallback style will be used to represent values that fall outside the range. when the fixed system is used and there are not enough symbols to cover all the list items, the fallback style will be used for the rest of the list items. ...
...e will be used are: when the range descriptor is specified for a counter style, the fallback style will be used to represent values that fall outside the range. when the fixed system is used and there are not enough symbols to cover all the list items, the fallback style will be used for the rest of the list items. ...
@document - CSS: Cascading Style Sheets
Web › CSS › @document
author-defined style sheets, too. @document url("https://www.example.com/") { h1 { color: green; } } syntax an @document rule can specify one or more matching functions. if any of the functions apply to a given url, the rule will take effect on that url. the functions available are: url(), which matches an exact url. ...
...for example, a . ...
...n the domain provided (or a subdomain of it). media-document(), with the parameter of video, image, plugin or all. regexp(), which matches if the document url is matched by the regular expression provided. the expression must match the entire url. the values provided to the url(), url-prefix(), domain(), and media-document() functions can be optionally enclosed by single or double quotes. the values provided to the regexp() function must be enclosed in quotes. escaped values provided to the regexp() function must additionally be escaped from the css. for example, a . (period) matches any character in regular expressions. to match a literal period, you would first need to escape it using regular expression rules (to \.), then escape that string using css rules (to \\.). @document is curren...
font-variation-settings - CSS: Cascading Style Sheets
the font-variation-settings css descriptor allows authors to specify low-level opentype or truetype font variations in the @font-face rule. syntax /* use the default settings */ font-variation-settings: normal; /* set values for opentype axis names */ font-variation-settings: "xhgt" 0.7; values normal text is laid out using default settings. <string> <number> when rendering text, the list of opentype axis names is passed to the text layout engine to enable or disable font features. each setting is always a <string> of 4 ascii characters, followed by a <number> indicating the axis value. if the <string> has more or fewer characters or contains characters outside the u+20 - u+7e codepoint range, the whole property is invalid. the <number> can be fractional or negative. formal defin...
...text layout engine to enable or disable font features. each setting is always a <string> of 4 ascii characters, followed by a <number> indicating the axis value. if the <string> has more or fewer characters or contains characters outside the u+20 - u+7e codepoint range, the whole property is invalid. the <number> can be fractional or negative. ...
...o enable or disable font features. each setting is always a <string> of 4 ascii characters, followed by a <number> indicating the axis value. if the <string> has more or fewer characters or contains characters outside the u+20 - u+7e codepoint range, the whole property is invalid. the <number> can be fractional or negative. ...
@keyframes - CSS: Cascading Style Sheets
the @keyframes css at-rule controls the intermediate steps in a css animation sequence by defining styles for keyframes (or waypoints) along the animation sequence. this gives more control over the intermediate steps of the animation sequence than transitions. syntax @keyframes slidein { from { transform: translatex(0%); } to { transform: translatex(100%); } } values <custom-ident> a name identifying the keyframe list. this must match the identifier production in css syntax. from a starting offset of 0%. to an ending offset of 100%. <percentage> a percentage of the time through the animation sequence at which the specified keyframe should occur. description javascript can access the @keyframes at-rule with the css object model interface csskeyframesrule. to us...
...sets exist for a given name, the last one encountered by the parser is used. @keyframes rules don't cascade, so animations never derive keyframes from more than one rule set. if a given animation time offset is duplicated, all keyframes in the @keyframes rule for that percentage are used for that frame. there is cascading within a @keyframes rule if multiple keyframes specify the same percentage values. when properties are left out of some keyframes properties that aren't specified in every keyframe are interpolated if possible — properties that can't be interpolated are dropped from the animation. for example: @keyframes identifier { 0% { top: 0; left: 0; } 30% { top: 50px; } 68%, 72% { left: 50px; } 100% { top: 100px; left: 100%; } } here, the top property animates using the 0...
...identifier { 0% { top: 0; left: 0; } 30% { top: 50px; } 68%, 72% { left: 50px; } 100% { top: 100px; left: 100%; } } here, the top property animates using the 0%, 30%, and 100% keyframes, and left animates using the 0%, 68%, 72% and 100% keyframes. when a keyframe is defined multiple times if a keyframe is defined multiple times but not all affected properties are in each keyframe, all values specified in these keyframes are considered. for example: @keyframes identifier { 0% { top: 0; } 50% { top: 30px; left: 20px; } 50% { top: 10px; } 100% { top: 0; } } in this example, at the 50% keyframe, the values used are top: 10px and left: 20px. cascading keyframes are supported starting in firefox 14. !important in a keyframe declarations in a keyframe qualified with !importa...
-webkit-animation - CSS: Cascading Style Sheets
false the browser doesn't support these prefixed css animations. ...
... false the browser doesn't support these prefixed css animations. ...
... false the browser doesn't support these prefixed css animations. ...
-webkit-transform-2d - CSS: Cascading Style Sheets
false the 2d css transforms prefixed with -webkit are not supported by the browser. examples basic example @media (-webkit-transform-2d) { div { -webkit-transform: translate(100px, 100px); } } this media feature is only supported by webkit. ...
... false the 2d css transforms prefixed with -webkit are not supported by the browser. examples basic example @media (-webkit-transform-2d) { div { -webkit-transform: translate(100px, 100px); } } this media feature is only supported by webkit. ...
... false the 2d css transforms prefixed with -webkit are not supported by the browser. examples basic example @media (-webkit-transform-2d) { div { -webkit-transform: translate(100px, 100px); } } this media feature is only supported by webkit. ...
-webkit-transform-3d - CSS: Cascading Style Sheets
false the 3d css transforms prefixed with -webkit are not supported by the browser. ...
... false the 3d css transforms prefixed with -webkit are not supported by the browser. ...
... false the 3d css transforms prefixed with -webkit are not supported by the browser. ...
height - CSS: Cascading Style Sheets
Web › CSS › @media › height
the height css media feature can be used to apply styles based on the height of the viewport (or the page box, for paged media). syntax the height feature is specified as a <length> value representing the viewport height. it is a range feature, meaning that you can also use the prefixed min-height and max-height variants to query minimum and maximum values, respectively. examples html <div>watch this element as you resize your viewport's height.</div> css /* exact height */ @media (height: 360px) { div { color: red; } } /* minimum height */ @media (min-height: 25rem) { div { background: yellow; } } /* maximum height */ @media (max-height: 40rem) { div { border: 2px solid blue; } } result specifications specification status comment ...
... ...
...order: 2px solid blue; } } result specifications specification status comment media queries level 4the definition of 'height' in that specification. candidate recommendation the value can now be negative, in which case it computes to false. media queriesthe definition of 'height' in that specification. recommendation initial definition. the value must be nonnegative. ...
monochrome - CSS: Cascading Style Sheets
Web › CSS › @media › monochrome
the monochrome css media feature can be used to test the number of bits per pixel in the monochrome frame buffer of the output device. syntax the monochrome feature is specified as an <integer> representing the number of bits per pixel in the monochrome frame buffer. if the device is not a monochrome device, the value is zero. it is a range feature, meaning that you can also use the prefixed min-monochrome and max-monochrome variants to query minimum and maximum values, respectively. examples html <p class="mono">your device supports monochrome pixels!</p> <p class="no-mono">your device doesn't support monochrome pixels.</p> css p { display: none; } /* any monochrome device */ @media (monochrome) { p.mono { display: block; color: #333; } } /* any non-monochrome device */...
... ...
...color: #ee3636; } } result specifications specification status comment media queries level 4the definition of 'monochrome' in that specification. candidate recommendation the value can now be negative, in which case it computes to false. media queriesthe definition of 'monochrome' in that specification. recommendation initial definition. the value must be nonnegative. ...
width - CSS: Cascading Style Sheets
Web › CSS › @media › width
the width css media feature can be used to test the width of the viewport (or the page box, for paged media). syntax the width feature is specified as a <length> value representing the viewport width. it is a range feature, meaning that you can also use the prefixed min-width and max-width variants to query minimum and maximum values, respectively. examples html <div>watch this element as you resize your viewport's width.</div> css /* exact width */ @media (width: 360px) { div { color: red; } } /* minimum width */ @media (min-width: 35rem) { div { background: yellow; } } /* maximum width */ @media (max-width: 50rem) { div { border: 2px solid blue; } } result specifications specification status comment media queries level 4the d...
... ...
... border: 2px solid blue; } } result specifications specification status comment media queries level 4the definition of 'width' in that specification. candidate recommendation the value can now be negative, in which case it computes to false. media queriesthe definition of 'width' in that specification. recommendation initial definition. the value must be nonnegative. ...
@media - CSS: Cascading Style Sheets
Web › CSS › @media
defined several additional media types (tty, tv, projection, handheld, braille, embossed, and aural), but they were deprecated in media queries 4 and shouldn't be used. the aural type has been replaced by speech, which is similar. media features media features describe specific characteristics of the user agent, output device, or environment. media feature expressions test for their presence or value, and are entirely optional. each media feature expression must be surrounded by parentheses. name summary notes any-hover does any available input mechanism allow the user to hover over elements? added in media queries level 4. any-pointer is any available input mechanism a pointing device, and if so, how accurate is it? added in media queries lev...
...media queries provide insights into the capabilities—and by extension, the features and design—of the device the user is working with, there is the potential that they could be abused to construct a "fingerprint" which identifies the device, or at least categorizes it to some degree of detail that may be undesirable to users. because of this potential, a browser may opt to fudge the returned values in some manner in order to prevent them from being used to precisely identify a computer. a browser might also offer additional measures in this area; for example, if firefox's "resist fingerprinting" setting is enabled, many media queries report default values rather than values representing the actual device state. formal syntax @media <media-query-list> { <group-rule-body> }where <media-q...
...r> = <media-not> | <media-and> | <media-in-parens>where <media-not> = not <media-in-parens><media-and> = <media-in-parens> [ and <media-in-parens> ]+<media-or> = <media-in-parens> [ or <media-in-parens> ]+<media-in-parens> = ( <media-condition> ) | <media-feature> | <general-enclosed>where <media-feature> = ( [ <mf-plain> | <mf-boolean> | <mf-range> ] )<general-enclosed> = [ <function-token> <any-value> ) ] | ( <ident> <any-value> )where <mf-plain> = <mf-name> : <mf-value><mf-boolean> = <mf-name><mf-range> = <mf-name> [ '<' | '>' ]? '='? <mf-value> | <mf-value> [ '<' | '>' ]? '='? <mf-name> | <mf-value> '<' '='? <mf-name> '<' '='? <mf-value> | <mf-value> '>' '='? <mf-name> '>' '='? <mf-value>where <mf-name> = <ident><mf-value> = <number> | <dimension> | <ident> | <ratio> examples testing for ...
bleed - CSS: Cascading Style Sheets
Web › CSS › @page › bleed
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. ...
...ed 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. values may be negative, but there may be implementation-specific limits. ...
...* 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. 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 ...
marks - CSS: Cascading Style Sheets
Web › CSS › @page › marks
css at-rule descriptor, used with the @page at-rule, adds crop and/or cross marks to the presentation of the document. crop marks indicate where the page should be cut. cross marks are used to align sheets. crop marks and cross marks are printed outside the page box. to have room to show crop and cross marks, the final pages will have to be somewhat bigger than the page box. ...
...ross marks to the presentation of the document. crop marks indicate where the page should be cut. cross marks are used to align sheets. crop marks and cross marks are printed outside the page box. to have room to show crop and cross marks, the final pages will have to be somewhat bigger than the page box. syntax /* keyword values */ marks: none; marks: crop; marks: cross; marks: crop cross; values crop crop marks will be displayed. ...
...rinted outside the page box. to have room to show crop and cross marks, the final pages will have to be somewhat bigger than the page box. syntax /* keyword values */ marks: none; marks: crop; marks: cross; marks: crop cross; values crop crop marks will be displayed. cross cross marks will be displayed. none no marks will be displayed. formal definition related at-rule@pageinitial valuenonecomputed valueas specified formal syntax none | [ crop | cross ] examples adding crop and cross marks @page { marks: crop cross; } specifications specification status comment css paged media module level 3the definition of 'marks' in that specification. working draft initial definition this css property was initially proposed in css level 2, b...
zoom - CSS: Cascading Style Sheets
Web › CSS › @viewport › zoom
the zoom css descriptor sets the initial zoom factor of a document defined by the @viewport at-rule. a zoom factor of 1.0 or 100% corresponds to no zooming. larger values are zoomed in. smaller values are zoomed out. syntax /* keyword value */ zoom: auto; /* <number> values */ zoom: 0.8; zoom: 2.0; /* <percentage> values */ zoom: 150%; values auto the user agent will set the document's initial zoom factor. the user agent may use the size of canvas area on which the document is rendered to determine that factor. <number> a non-negative number used as the zoom factor. ...
.../* keyword value */ zoom: auto; /* <number> values */ zoom: 0.8; zoom: 2.0; /* <percentage> values */ zoom: 150%; values auto the user agent will set the document's initial zoom factor. the user agent may use the size of canvas area on which the document is rendered to determine that factor. <number> a non-negative number used as the zoom factor. <percentage> a non-negative percentage value used as the zoom factor. ...
...rcentage> values */ zoom: 150%; values auto the user agent will set the document's initial zoom factor. the user agent may use the size of canvas area on which the document is rendered to determine that factor. <number> a non-negative number used as the zoom factor. <percentage> a non-negative percentage value used as the zoom factor. formal definition related at-rule@viewportinitial valueautopercentagesthe zoom factor itselfcomputed valueauto, or a non-negative number or percentage as specified formal syntax auto | <number> | <percentage> examples setting viewport zoom factor @viewport { zoom: 2.0; } specifications specification status comment css device adaptationthe definition of '"zoom" descriptor' in that specification. working draft ...
Basic Concepts of Multicol - CSS: Cascading Style Sheets
many columns of that width will fit into the multicol container and distribute any extra space equally between the columns. therefore, the column width should be seen as a minimum width, as column boxes are likely to be wider due to the additional space. the column box will only shrink to be smaller than the declared column width in the case of a single column with less available width than the value of column-width. in the below example we use the column-width property with a value of 200px. we get as many 200 pixel columns as will fit the container, with the extra space shared equally. using column-count and column-width together if you specify both properties on a multicol container then column-count will act as a maximum number of columns. therefore the behaviour as described for col...
...he behaviour as described for column-width will happen, until the number of columns in column-count is reached. after this point no more columns will be drawn, and the extra space is distributed evenly between the existing columns, even if there is enough room for more columns of the specified column-width size. when using both properties together you may get fewer 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 int...
...-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 result as example 3, with both column-count and column-width set. .container { columns: 2 200px; } next steps in this guide we've le...
CSS Display - CSS: Cascading Style Sheets
css ...
... grids, logical values and writing modes css grid layout and accessibility css grid layout and progressive enhancement realizing common layouts using grids specifications specification status comment css display module level 3the definition of 'display' in that specification. candidate recommendation added run-in, flow, flow-root, contents and multi-keyword values. css level 2 (revision 1)the definition of 'display' in that specification. recommendation added the table model values and inline-block. css level 1the definition of 'display' in that specification. recommendation initial definition. basic values: none, block, inline and list-item. in addition to the css display specification level 3, further specifications ...
...on 1)the definition of 'display' in that specification. recommendation added the table model values and inline-block. css level 1the definition of 'display' in that specification. recommendation initial definition. basic values: none, block, inline and list-item. in addition to the css display specification level 3, further specifications define the behavior of various values of display. ...
Mastering Wrapping of Flex Items - CSS: Cascading Style Sheets
s with laying out items as a row or as a column — but not both at once. there is however the ability to wrap flex items onto new lines, creating new rows if flex-direction is row and new columns if flex-direction is column. in this guide i will explain how this works, what it is designed for and what situations really require css grid layout rather than flexbox. making things wrap the initial value of the flex-wrap property is nowrap. this means that if you have a set of flex items that are too wide for their container, they will overflow it. if you want to cause them to wrap once they become too wide you must add the flex-wrap property with a value of wrap, or use the shorthand flex-flow with values of row wrap or column wrap. items will then wrap in the container. in the next example i h...
...rid we control both at the same time. if you want the space distribution row by row, use flexbox. if you don’t, use grid. how do flexbox-based grid systems work? typically flexbox-based grid systems work by taking flexbox back to the familiar world of float-based layouts. if you assign percentage widths to flex items — either as flex-basis or by adding a width to the item itself leaving the value of flex-basis as auto — you can get the impression of a two dimensional layout. you can see this working in the example below. here i have set flex-grow and flex-shrink to 0 to make inflexible flex items and am then controlling flexibility using percentages, just like we used to do in float layouts. if you need flex items to line up in the cross axis, controlling the width in this way will ...
...de content for example. the example in the specification demonstrates one such pattern. in the following live example i have a non-wrapped flex container. the third item has more content than the others yet is set to visibility: collapse and therefore the flex container is retaining a strut of the height required to display this item. if you remove visibility: collapse from the css or change the value to visible, you will see the item disappear and the space redistribute between non-collapsed items; the height of the flex container should not change. note: use firefox for the below two examples as chrome and safari treat collapse as hidden. when dealing with multiple-line flex containers however you need to understand that the wrapping is re-done after collapsing. so the browser needs to...
Logical properties for sizing - CSS: Cascading Style Sheets
left and right). ...
...s. i am using min-height in the first example and min-block-size in the second. max-width and max-height example finally you can use max-inline-size and max-block-size as logical replacements for max-width and max-height. try playing with the below example in the same way as before. logical keywords for resize the resize property sets whether or not an item can be resized and has physical values of horizontal and vertical. the resize property also has logical keyword values. using resize: inline allows resizing in the inline dimension and resize: block allow resizing in the block dimension. the keyword value of both for the resize property works whether you are thinking physically or logically. it sets both dimensions at once. try playing with the below example. note that currently...
...al and vertical. the resize property also has logical keyword values. using resize: inline allows resizing in the inline dimension and resize: block allow resizing in the block dimension. the keyword value of both for the resize property works whether you are thinking physically or logically. it sets both dimensions at once. try playing with the below example. note that currently the logical values for resize are only supported by firefox. ...
Stacking context example 1 - CSS: Cascading Style Sheets
and div #3), both relatively positioned, but without z-index properties. inside div #1 there is an absolutely positioned div #2, while in div #3 there is an absolutely positioned div #4, both without z-index properties. the only stacking context is the root context. without z-indexes, elements are stacked in order of occurrence. if div #2 is assigned a positive (non-zero and non-auto) z-index value, it is rendered above all the other divs. then if div #4 is also assigned a positive z-index greater than div #2's z-index, it is rendered above all the other divs including div #2. in this last example you can see that div #2 and div #4 are not siblings, because they belong to different parents in the html elements' hierarchy. even so, stacking of div #4 with respect of div #2 can be contr...
...dex greater than div #2's z-index, it is rendered above all the other divs including div #2. in this last example you can see that div #2 and div #4 are not siblings, because they belong to different parents in the html elements' hierarchy. even so, stacking of div #4 with respect of div #2 can be controlled through z-index. it happens that, since div #1 and div #3 are not assigned any z-index value, they do not create a stacking context. this means that all their content, including div #2 and div #4, belongs to the same root stacking context. in terms of stacking contexts, div #1 and div #3 are simply assimilated into the root element, and the resulting hierarchy is the following: root stacking context div #2 (z-index 1) div #4 (z-index 2) note: div #1 and div #3 are not...
...contexts, div #1 and div #3 are simply assimilated into the root element, and the resulting hierarchy is the following: root stacking context div #2 (z-index 1) div #4 (z-index 2) note: div #1 and div #3 are not translucent. it is important to remember that assigning an opacity less than 1 to a positioned element implicitly creates a stacking context, just like adding a z-index value. and this example shows what happens when a parent element does not create a stacking context. example html <div id="div1"> <br /><span class="bold">div #1</span> <br />position: relative; <div id="div2"> <br /><span class="bold">div #2</span> <br />position: absolute; <br />z-index: 1; </div> </div> <br /> <div id="div3"> <br /><span class="bold">div #3</span> <br />position:...
Basic concepts of CSS Scroll Snap - CSS: Cascading Style Sheets
ll be when scrolling finishes. however, it can cause problems if the content is larger than you expect — users may find themselves in the frustrating position of never being able to scroll and view a certain point in the content. therefore, use of mandatory should be carefully considered and only used in situations where you know how much content is on the screen at any one time. ...
...position of never being able to scroll and view a certain point in the content. therefore, use of mandatory should be carefully considered and only used in situations where you know how much content is on the screen at any one time. the proximity value will only snap to a position when it is close by, the exact distance being left to the browser to decide. in the example below you can change the value between mandatory and proximity to see the effect this has on the scroll experience. using scroll-snap-align the scroll-snap-align property can take a value of start, end, or center — indicating the point the content should snap to in the scroll container. in the below example you can change the value of scroll-snap-align to see how this changes the scroll behavior. padding the scroll co...
...alue of start, end, or center — indicating the point the content should snap to in the scroll container. in the below example you can change the value of scroll-snap-align to see how this changes the scroll behavior. padding the scroll container if you do not want the content to snap right to the edge of the scroll container you can use the scroll-padding property or its equivalent longhand values to set some padding. in the below example i have set scroll-padding to 40 pixels. when we snap to the start of the second and third sections, the scrolling stops 40 pixels away from the start of the section. try changing the scroll-padding value to see how this changes the distance. this is potentially useful if you have a fixed element, for example a navigation bar, which could end up overl...
CSS selectors - CSS: Cascading Style Sheets
mple: * will match all the elements of the document. type selector selects all elements that have the given node name. syntax: elementname example: input will match any <input> element. class selector selects all elements that have the given class attribute. syntax: .classname example: .index will match any element that has a class of "index". ...
... syntax: .classname example: .index will match any element that has a class of "index". id selector selects an element based on the value of its id attribute. there should be only one element with a given id in a document. syntax: #idname example: #toc will match the element that has the id "toc". attribute selector selects all elements that have the given attribute. syntax: [attr] [attr=value] [attr~=value] [attr|=value] [attr^=value] [attr$=value] [attr*=value] example: [autoplay] will match all elements that have the autoplay attribute set (to any value). grouping selectors selector list the , is a grouping method, it selects all the matching nodes. syntax: a, b example: div, span will match both <span> and <div> elements. combinators descendant combinator the (spac...
...e: p::first-line will match the first line of all <p> elements. specifications specification status comment selectors level 4 working draft added the || column combinator, grid structural selectors, logical combinators, location, time-demensional, resource state, linguistic and ui pseudo-classes, modifier for ascii case-sensitive and case-insensitive attribute value selection. selectors level 3 recommendation added the ~ general sibling combinator and tree-structural pseudo-classes. made pseudo-elements use a :: double-colon prefix. additional attribute selectors css level 2 (revision 1) recommendation added the > child and + adjacent sibling combinators. added the universal and attribute selectors. css level 1 ...
CSS data types - CSS: Cascading Style Sheets
Web › CSS › CSS Types
css data types define typical values (including keywords and units) accepted by css properties and functions. they are a special kind of component value type. in formal syntax, data types are denoted by a keyword placed between the inequality signs "<" and ">". ...
... special kind of component value type. in formal syntax, data types are denoted by a keyword placed between the inequality signs "<" and ">". ...
... <color-stop> <color-stop-angle> <counter-style> <custom-ident> <dimension> <filter-function> <flex> <frequency> <frequency-percentage> <gradient> <ident> <image> <integer> <length> <length-percentage> <number> <number-percentage> <percentage> <position> <quote> <ratio> <resolution> <shape-box> <shape-radius> <string> <time> <time-percentage> <timing-function> <toggle-value> <transform-function> <type-or-unit> <url> <url-modifier> <zero> specifications specification status comment css values and units module level 4 editor's draft css values and units module level 3 candidate recommendation initial definition. see also css units and values introduction to css: values and units ...
Using media queries - CSS: Cascading Style Sheets
defined several additional media types (tty, tv, projection, handheld, braille, embossed, and aural), but they were deprecated in media queries 4 and shouldn't be used. the aural type has been replaced by speech, which is similar. media features media features describe specific characteristics of the user agent, output device, or environment. media feature expressions test for their presence or value, and are entirely optional. each media feature expression must be surrounded by parentheses. name summary notes any-hover does any available input mechanism allow the user to hover over elements? added in media queries level 4. any-pointer is any available input mechanism a pointing device, and if so, how accurate is it? added in media queries lev...
...ia (hover: hover) { ... } many media features are range features, which means they can be prefixed with "min-" or "max-" to express "minimum condition" or "maximum condition" constraints. for example, this css will apply styles only if your browser's viewport width is equal to or narrower than 12450px: @media (max-width: 12450px) { ... } if you create a media feature query without specifying a value, the nested styles will be used as long as the feature's value is not zero (or none, in level 4). for example, this css will apply to any device with a color screen: @media (color) { ... } if a feature doesn't apply to the device on which the browser is running, expressions involving that media feature are always false. for example, the styles nested inside the following query will never be use...
...ht write the following: note: the media queries level 4 specification has reasonable support in modern browsers, but some media features are not well supported. see the @media browser compatibility table for more details. @media (max-width: 30em) { ... } in media queries level 4 this can be written as: @media (width <= 30em) { ... } using min- and max- we might test for a width between two values like so: @media (min-width: 30em) and (max-width: 50em) { ... } this would convert to the level 4 syntax as: @media (30em <= width <= 50em ) { ... } media queries level 4 also adds ways to combine media queries using full boolean algebra with and, not, and or. negating a feature with not using not() around a media feature negates that feature in the query. for example, not(hover) would ma...
Mozilla CSS extensions - CSS: Cascading Style Sheets
these extensions are prefixed with -moz-. mozilla-only properties and pseudo-classes (avoid using on websites) note: these properties and pseudo-classes will only work in mozilla applications such as firefox, and are not on a standards track. some of them apply only to xul elements. ...
...ill accepted] -moz-transform-style [prefixed version still accepted] -moz-transition [prefixed version still accepted] -moz-transition-delay [prefixed version still accepted] -moz-transition-duration [prefixed version still accepted] -moz-transition-property [prefixed version still accepted] -moz-transition-timing-function [prefixed version still accepted] -moz-user-select values global values -moz-initial -moz-appearance button button-arrow-down button-arrow-next button-arrow-previous button-arrow-up button-bevel checkbox checkbox-container checkbox-label checkmenuitem dialog groupbox listbox menuarrow menucheckbox menuimage menuitem menuitemtext menulist menulist-button menulist-text menulist-textfield menupopup menuradio menuseparat...
...ete since gecko 62 -moz-inline-stackobsolete since gecko 62 -moz-inline-table -moz-gridobsolete since gecko 62 -moz-grid-groupobsolete since gecko 62 -moz-grid-lineobsolete since gecko 62 -moz-groupbox -moz-deckobsolete since gecko 62 -moz-popupobsolete since gecko 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 -m...
animation-direction - CSS: Cascading Style Sheets
quest. it is often convenient to use the shorthand property animation to set all animation properties at once. syntax /* single animation */ animation-direction: normal; animation-direction: reverse; animation-direction: alternate; animation-direction: alternate-reverse; /* multiple animations */ animation-direction: normal, reverse; animation-direction: alternate, reverse, normal; /* global values */ animation-direction: inherit; animation-direction: initial; animation-direction: unset; values normal the animation plays forwards each cycle. in other words, each time the animation cycles, the animation will reset to the beginning state and start over again. this is the default value. reverse the animation plays backwards each cycle. in other words, each time the animation cycles, t...
.... alternate the animation reverses direction each cycle, with the first iteration being played forwards. the count to determine if a cycle is even or odd starts at one. alternate-reverse the animation reverses direction each cycle, with the first iteration being played backwards. the count to determine if a cycle is even or odd starts at one. ...
...cycle, with the first iteration being played backwards. the count to determine if a cycle is even or odd starts at one. note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are. for more information, see setting multiple animation property values. formal definition initial valuenormalapplies toall elements, ::before and ::after pseudo-elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <single-animation-direction>#where <single-animation-direction> = normal | reverse | alternate | alternate-reverse examples see css animations for examples. specifications specification status comment ...
animation-duration - CSS: Cascading Style Sheets
ractive 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. this may be specified in either seconds (s) or milliseconds (ms). the value must be positive or zero and the unit is required. a value of 0s, which is the default value, indicates that no animation should occur. note: negative values are invalid, causing the declaration to be ignored. some early, prefixed, implementations may ...
...ified in either seconds (s) or milliseconds (ms). the value must be positive or zero and the unit is required. a value of 0s, which is the default value, indicates that no animation should occur. note: negative values are invalid, causing the declaration to be ignored. some early, prefixed, implementations may consider them as identical to 0s. note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are. for more information, see setting multiple animation property values. ...
...nored. some early, prefixed, implementations may consider them as identical to 0s. note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are. for more information, see setting multiple animation property values. formal definition initial value0sapplies toall elements, ::before and ::after pseudo-elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <time># examples see css animations for examples. specifications specification status comment css animationsthe definition of 'animation-duration' in that specification. working draft initial definition. ...
animation-name - CSS: Cascading Style Sheets
mples 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-name: none; animation-name: test_05; animation-name: -specific; animation-name: sliding-vertically; /* multiple animations */ animation-name: test1, animation4; animation-name: none, -moz-specific, sliding; /* global values */ animation-name: initial animation-name: inherit animation-name: unset values none a special keyword denoting no keyframes. it can be used to deactivate an animation without changing the ordering of the other identifiers, or to deactivate animations coming from the cascade. <custom-ident> a name identifying the animation. this identifier is composed of a combination of case-sensitive le...
... name identifying the animation. this identifier is composed of a combination of case-sensitive letters a to z, numbers 0 to 9, underscores (_), and/or dashes (-). the first non-dash character must be a letter. also, two dashes are forbidden at the beginning of the identifier. furthermore, the identifier can't be none, unset, initial, or inherit. ...
...re forbidden at the beginning of the identifier. furthermore, the identifier can't be none, unset, initial, or inherit. note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are. for more information, see setting multiple animation property values. formal definition initial valuenoneapplies toall elements, ::before and ::after pseudo-elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax [ none | <keyframes-name> ]#where <keyframes-name> = <custom-ident> | <string> examples see css animations for examples. specifications specification status comment css animationsthe definiti...
animation-play-state - CSS: Cascading Style Sheets
ractive-examples and send us a pull request. resuming a paused animation will start the animation from where it left off at the time it was paused, rather than starting over from the beginning of the animation sequence. ...
... where it left off at the time it was paused, rather than starting over from the beginning of the animation sequence. syntax /* single animation */ animation-play-state: running; animation-play-state: paused; /* multiple animations */ animation-play-state: paused, running, running; /* global values */ animation-play-state: inherit; animation-play-state: initial; animation-play-state: unset; values running the animation is currently playing. paused the animation is currently paused. note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are. for more information, see setting multiple animation property values. formal definitio...
...g the animation is currently playing. paused the animation is currently paused. note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are. for more information, see setting multiple animation property values. formal definition initial valuerunningapplies toall elements, ::before and ::after pseudo-elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <single-animation-play-state>#where <single-animation-play-state> = running | paused examples see css animations for examples. specifications specification status comment css animationsthe definition of 'animation-play-state'...
background-blend-mode - CSS: Cascading Style Sheets
hub repository. if 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. ...
...he 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 several values, separated by commas. formal definition initial valuenormalapplies toall elements. in svg, it applies to container elements, gr...
...kground-blend-mode: inherit; background-blend-mode: unset; values <blend-mode> the blending mode to be applied. there can be several values, separated by commas. formal definition initial valuenormalapplies toall elements. in svg, it applies to container elements, graphics elements, and graphics referencing elements.. ...
background-origin - CSS: Cascading Style Sheets
's origin: from the border start, inside the border, or inside the padding. the source for this interactive example is stored in a github repository. if 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 background-origin is ignored when background-attachment is fixed. syntax /* keyword values */ background-origin: border-box; background-origin: padding-box; background-origin: content-box; /* global values */ background-origin: inherit; background-origin: initial; background-origin: unset; the background-origin property is specified as one of the keyword values listed below. values border-box the background is positioned relative to the border box. padding-box the background...
...it; background-origin: initial; background-origin: unset; the background-origin property is specified as one of the keyword values listed below. values border-box the background is positioned relative to the border box. padding-box the background is positioned relative to the padding box. content-box the background is positioned relative to the content box. formal definition initial valuepadding-boxapplies toall elements. ...
...of the keyword values listed below. values border-box the background is positioned relative to the border box. padding-box the background is positioned relative to the padding box. content-box the background is positioned relative to the content box. formal definition initial valuepadding-boxapplies toall elements. ...
border-block-style - CSS: Cascading Style Sheets
the border-block-style css property defines the style of the logical block borders of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-style and border-bottom-style, or border-left-style and border-right-style properties depending on the values defined for writing-mode, direction, and text-orientation. /* <'border-style'> values */ border-block-style: dashed; border-block-style: dotted; border-block-style: groove; the border style in the other dimension can be set with border-inline-style, which sets border-inline-start-style, and border-inline-end-style. syntax values <'border-style'> the line style of the border. see border-style. formal definition initial va...
...s */ border-block-style: dashed; border-block-style: dotted; border-block-style: groove; the border style in the other dimension can be set with border-inline-style, which sets border-inline-start-style, and border-inline-end-style. syntax values <'border-style'> the line style of the border. see border-style. ...
... editor's draft initial definition ...
border-bottom-color - CSS: Cascading Style Sheets
tom-color css property sets the color of an element's bottom border. it can also be set with the shorthand css properties border-color or border-bottom. the source for this interactive example is stored in a github repository. if 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'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <color> values */ border-bottom-color: red; border-bottom-color: #ffbb00; border-bottom-color: rgb(255, 0, 0); border-bottom-color: hsla(100%, 50%, 25%, 0.75); border-bottom-color: currentcolor; border-bottom-color: transparent; /* global values */ border-bottom-color: inherit; border-bottom-color: initial; border-bottom-color: unset; the border-bottom-color property is specified as a single value. values <color> the color of the bottom border. ...
...m-color: rgb(255, 0, 0); border-bottom-color: hsla(100%, 50%, 25%, 0.75); border-bottom-color: currentcolor; border-bottom-color: transparent; /* global values */ border-bottom-color: inherit; border-bottom-color: initial; border-bottom-color: unset; the border-bottom-color property is specified as a single value. values <color> the color of the bottom border. formal definition initial valuecurrentcolorapplies toall elements. it also applies to ::first-letter.inheritednocomputed valuecomputed coloranimation typea color formal syntax <'border-top-color'> examples a simple div with a border html <div class="mybox"> <p>this is a box with a border around it. note which side of the box is <span class="redtext">red</span>.</p> </div> css .mybox { border: solid 0.3em...
border-bottom-style - CSS: Cascading Style Sheets
perty sets the line style of an element's bottom border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: the specification doesn't define how borders of different styles connect in the corners. ...
...on doesn't define how borders of different styles connect in the corners. syntax /* keyword values */ border-bottom-style: none; border-bottom-style: hidden; border-bottom-style: dotted; border-bottom-style: dashed; border-bottom-style: solid; border-bottom-style: double; border-bottom-style: groove; border-bottom-style: ridge; border-bottom-style: inset; border-bottom-style: outset; /* global values */ border-bottom-style: inherit; border-bottom-style: initial; border-bottom-style: unset; the border-bottom-style property is specified as a single keyword chosen from those available for the border-style property. formal definition initial valuenoneapplies toall elements. ...
...ottom-style: inset; border-bottom-style: outset; /* global values */ border-bottom-style: inherit; border-bottom-style: initial; border-bottom-style: unset; the border-bottom-style property is specified as a single keyword chosen from those available for the border-style property. formal definition initial valuenoneapplies toall elements. ...
border-left-style - CSS: Cascading Style Sheets
roperty sets the line style of an element's left border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: the specification doesn't define how borders of different styles connect in the corners. ...
...ote: the specification doesn't define how borders of different styles connect in the corners. syntax /* keyword values */ border-left-style: none; border-left-style: hidden; border-left-style: dotted; border-left-style: dashed; border-left-style: solid; border-left-style: double; border-left-style: groove; border-left-style: ridge; border-left-style: inset; border-left-style: outset; /* global values */ border-left-style: inherit; border-left-style: initial; border-left-style: unset; the border-left-style property is specified as a single keyword chosen from those available for the border-style property. formal definition initial valuenoneapplies toall elements. ...
...ge; border-left-style: inset; border-left-style: outset; /* global values */ border-left-style: inherit; border-left-style: initial; border-left-style: unset; the border-left-style property is specified as a single keyword chosen from those available for the border-style property. formal definition initial valuenoneapplies toall elements. ...
border-right-style - CSS: Cascading Style Sheets
operty sets the line style of an element's right border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: the specification doesn't define how borders of different styles connect in the corners. ...
...pecification doesn't define how borders of different styles connect in the corners. syntax /* keyword values */ border-right-style: none; border-right-style: hidden; border-right-style: dotted; border-right-style: dashed; border-right-style: solid; border-right-style: double; border-right-style: groove; border-right-style: ridge; border-right-style: inset; border-right-style: outset; /* global values */ border-right-style: inherit; border-right-style: initial; border-right-style: unset; the border-right-style property is specified as a single keyword chosen from those available for the border-style property. formal definition initial valuenoneapplies toall elements. ...
...rder-right-style: inset; border-right-style: outset; /* global values */ border-right-style: inherit; border-right-style: initial; border-right-style: unset; the border-right-style property is specified as a single keyword chosen from those available for the border-style property. formal definition initial valuenoneapplies toall elements. ...
box-direction - CSS: Cascading Style Sheets
has been replaced by a newer standard. the -moz-box-direction will only be used for xul while the previous standard box-direction has been replaced by flex-direction. see flexbox for information about the current standard. the box-direction css property specifies whether a box lays out its contents normally (from the top or left edge), or in reverse (from the bottom or right edge). /* keyword values */ box-direction: normal; box-direction: reverse; /* global values */ box-direction: inherit; box-direction: initial; box-direction: unset; syntax the box-direction property is specified as one of the keyword values listed below. values normal the box lays out its contents from the start (the left or top edge). reverse the box lays out its contents from the end (the right or bottom ed...
...ox lays out its contents from the end (the right or bottom edge). notes the edge of the box designated the start for layout purposes depends on the box's orientation: horizontal left vertical top the edge opposite to the start is designated the end. if the direction is set using the element's dir attribute, then the style is ignored. ...
...or bottom edge). notes the edge of the box designated the start for layout purposes depends on the box's orientation: horizontal left vertical top the edge opposite to the start is designated the end. if the direction is set using the element's dir attribute, then the style is ignored. formal definition initial valuenormalapplies toelements with a css display value of box or inline-boxinheritednocomputed valueas specifiedanimation typediscrete formal syntax normal | reverse | inherit examples setting box direction .example { /* bottom-to-top layout */ -moz-box-direction: reverse; /* mozilla */ -webkit-box-direction: reverse; /* webkit */ box-direction: reverse; /* as specified */ } specifications not part of any standard. b...
box-flex-group - CSS: Cascading Style Sheets
this is a property of the original css flexible box layout module draft, and has been replaced by a newer standard. see flexbox for information about the current standard. the box-flex-group css property assigns the flexbox's child elements to a flex group. /* <integer> values */ box-flex-group: 1; box-flex-group: 5; /* global values */ box-flex-group: inherit; box-flex-group: initial; box-flex-group: unset; for flexible elements assigned to flex groups, the first flex group is 1 and higher values specify subsequent flex groups. the initial value is 1. when dividing up the box's extra space, the browser first considers all elements within the first flex group. each element within that group is given extra space based on the ratio of that element's flexibility compared to the flexibili...
...ldren has been computed, then space is removed from flexible elements in a manner similar to that used when adding extra space. each flex group is examined in turn and space is removed according to the ratio of the flexibility of each element. elements do not shrink below their minimum widths. syntax the box-flex-group property is specified as any positive <integer>. ...
...s in a manner similar to that used when adding extra space. each flex group is examined in turn and space is removed according to the ratio of the flexibility of each element. elements do not shrink below their minimum widths. syntax the box-flex-group property is specified as any positive <integer>. ...
box-ordinal-group - CSS: Cascading Style Sheets
this is a property of the original css flexible box layout module draft, and has been replaced by a newer standard. see flexbox for information about the current standard. the box-ordinal-group css property assigns the flexbox's child elements to an ordinal group. /* <integer> values */ box-ordinal-group: 1; box-ordinal-group: 5; /* global values */ box-ordinal-group: inherit; box-ordinal-group: initial; box-ordinal-group: unset; ordinal groups may be used in conjunction with the box-direction property to control the order in which the direct children of a box appear. when the computed box-direction is normal, a box will display its elements starting from the lowest numbered ordinal group and ensure that those elements appear to the left (for horizontal boxes) or at the top (f...
...(for horizontal boxes) or at the top (for vertical boxes) of the container. elements with the same ordinal group are flowed in the order they appear in the source document tree. in the reverse direction, the ordinal groups are examined in the same order, except the elements appear reversed. syntax the box-ordinal-group property is specified as any positive <integer>. ...
... the container. elements with the same ordinal group are flowed in the order they appear in the source document tree. in the reverse direction, the ordinal groups are examined in the same order, except the elements appear reversed. syntax the box-ordinal-group property is specified as any positive <integer>. ...
box-orient - CSS: Cascading Style Sheets
this is a property of the original css flexible box layout module draft, and has been replaced by a newer standard. see flexbox for information about the current standard. the box-orient css property sets whether an element lays out its contents horizontally or vertically. /* keyword values */ box-orient: horizontal; box-orient: vertical; box-orient: inline-axis; box-orient: block-axis; /* global values */ box-orient: inherit; box-orient: initial; box-orient: unset; syntax the box-orient property is specified as one of the keyword values listed below. values horizontal the box lays out its contents horizontally. vertical the box lays out its contents vertically. inline-axis (html) the box displays its children along the inline axis. block-axis (html) the box displays...
... its children along the inline axis. block-axis (html) the box displays its children along the block axis. the inline and block axes are the writing-mode dependent keywords which, in english, map to horizontal and vertical respectively. description html dom elements lay out their contents along the inline-axis by default. ...
... the box displays its children along the block axis. the inline and block axes are the writing-mode dependent keywords which, in english, map to horizontal and vertical respectively. description html dom elements lay out their contents along the inline-axis by default. this css property will only apply to html elements with a css display value of box or inline-box. formal definition initial valueinline-axis (horizontal in xul)applies toelements with a css display value of box or inline-boxinheritednocomputed valueas specifiedanimation typediscrete formal syntax horizontal | vertical | inline-axis | block-axis | inherit examples setting horizontal box orientation here, he box-orient property will cause the two <p> sections in the example to display in the same line. html <div class=...
color-adjust - CSS: Cascading Style Sheets
olor-adjust css property sets what, if anything, the user agent may do to optimize the appearance of the element on the output device. by default, the browser is allowed to make any adjustments to the element's appearance it determines to be necessary and prudent given the type and capabilities of the output device. syntax color-adjust: economy; color-adjust: exact; the color-adjust property's value must be one of the following keywords. values economy the user agent is allowed to make adjustments to the element as it deems appropriate and prudent in order to optimize the output for the device it's being rendered for. for example, when printing, a browser might opt to leave out all background images and to adjust text colors to be sure the contrast is optimized for reading on white pape...
... for legibility purposes. if the output device is a printer, and to save ink, dark or extremely dense background images might be removed. when printing a page, the browser might want to replace light-colored text on a dark background with dark text on a white background. ...
...y options the user agent offers the user to allow them to control the use of color and images will take priority over the value of color-adjust. in other words, there isn't any guarantee that color-adjust will do anything. not only can the user override the behavior, but each user agent is allowed to decide for itself how to handle color-adjust in any given situation. formal definition initial valueeconomyapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax economy | exact examples preserving low contrast in this example, a box is shown which uses a background-image and a translucent linear-gradient() function atop a black background color to have a dark blue gradient behind medium red text. for whatever reason, this is the desired appearance ...
counter() - CSS: Cascading Style Sheets
Web › CSS › counter
the counter() css function returns a string representing the current value of the named counter, if there is one. it is generally used with pseudo-elements, but can be used, theoretically, anywhere a <string> value is supported. /* simple usage */ counter(countername); /* changing the counter display */ counter(countername, upper-roman) a counter has no visible effect by itself. the counter() function (and counters() function) is what makes it useful by returning developer defined strings (or images). note: the counter() function can be used with any css property, but support for properties other than content is experimental, and support for the type-or-unit parameter is sparse. ...
...the counter() function (and counters() function) is what makes it useful by returning developer defined strings (or images). note: the counter() function can be used with any css property, but support for properties other than content is experimental, and support for the type-or-unit parameter is sparse. check the browser compatibility table carefully before using this in production. syntax values <custom-ident> a name identifying the counter, which is the same case-sensitive name used for the counter-reset and counter-increment. the name cannot start with two dashes and can't be none, unset, initial, or inherit. <counter-style> a counter style name or symbols() function, where a counter style name is a numeric, alphabetic, or symbolic simple predefined counter style, a complex lon...
...a numeric, alphabetic, or symbolic simple predefined counter style, a complex longhand east asian or ethiopic predefined counter style, or other predefined counter style. ...
<display-box> - CSS: Cascading Style Sheets
see appendix b: effects of display: contents on unusual elements for more details. due to a bug in browsers this will currently remove the element from the accessibility tree — screen readers will not look at what's inside. ...
...see appendix b: effects of display: contents on unusual elements for more details. due to a bug in browsers this will currently remove the element from the accessibility tree — screen readers will not look at what's inside. ...
...e document is rendered as though the element did not exist). all descendant elements also have their display turned off. to have an element take up the space that it would normally take, but without actually rendering anything, use the visibility property instead. accessibility concerns current implementations in most browsers will remove from the accessibility tree any element with a display value of contents. this will cause the element — and in some browser versions, its descendant elements — to no longer be announced by screen reading technology. this is incorrect behavior according to the csswg specification. more accessible markup with display: contents | hidde de vries display: contents is not a css reset | adrian roselli examples in this first example, the paragraph with ...
<display-inside> - CSS: Cascading Style Sheets
these keywords specify the element’s inner display type, which defines the type of formatting context that lays out its contents (assuming it is a non-replaced element). these keywords are used as values of the display property, and can be used for legacy purposes as a single keyword, or as defined in the level 3 specification alongside a value from the <display-outside> keywords. syntax valid <display-inside> values: flow the element lays out its contents using flow layout (block-and-inline layout). ...
...ion alongside a value from the <display-outside> keywords. syntax valid <display-inside> values: flow the element lays out its contents using flow layout (block-and-inline layout). if its outer display type is inline or run-in, and it is participating in a block or inline formatting context, then it generates an inline box. otherwise it generates a block container box. depending on the value of other properties (such as position, float, or overflow) and whether it is itself participating in a block or inline formatting context, it either establishes a new block formatting context (bfc) for its contents or integrates its contents into its parent formatting context. flow-root the element generates a block element box that establishes a new block formatting context, defining where t...
...behaves like a block element and lays out its content according to the flexbox model. grid the element behaves like a block element and lays out its content according to the grid model. ruby the element behaves like an inline element and lays out its content according to the ruby formatting model. it behaves like the corresponding html <ruby> elements. note: browsers that support the two value syntax, on finding the inner value only, such as when display: flex or display: grid is specified, will set their outer value to block. this will result in expected behavior; for example if you specify an element to be display: grid, you would expect that the box created on the grid container would be a block level box. examples in this example the parent box has been given display: flow-root ...
flex-grow - CSS: Cascading Style Sheets
Web › CSS › flex-grow
the flex-grow css property sets the flex grow factor of a flex item main size. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <number> values */ flex-grow: 3; flex-grow: 0.6; /* global values */ flex-grow: inherit; flex-grow: initial; flex-grow: unset; the flex-grow property is specified as a single <number>. values <number> see <number>. negative values are invalid. defaults to 0. description this property specifies how much of the remaining space in the flex container should be assigned to the item (the flex grow factor). the main size is either width or height of the item which is dependent...
... the remaining space is the size of the flex container minus the size of all flex items' sizes together. if all sibling items have the same flex grow factor, then all items will receive the same share of remaining space, otherwise it is distributed according to the ratio defined by the different flex grow factors. ...
...s the size of all flex items' sizes together. if all sibling items have the same flex grow factor, then all items will receive the same share of remaining space, otherwise it is distributed according to the ratio defined by the different flex grow factors. flex-grow is used alongside the other flex properties flex-shrink and flex-basis, and normally defined using the flex shorthand to ensure all values are set. formal definition initial value0applies toflex items, including in-flow pseudo-elementsinheritednocomputed valueas specifiedanimation typea number formal syntax <number> examples setting flex item grow factor html <h4>this is a flex-grow</h4> <h5>a,b,c and f are flex-grow:1 . d and e are flex-grow:2 .</h5> <div id="content"> <div class="box" style="background-color:red;">a</d...
font-family - CSS: Cascading Style Sheets
the font-family css property specifies a prioritized list of one or more font family names and/or generic family names for the selected 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. values are separated by commas to indicate that they are alternatives. the browser will select the first font in the list that is installed or that can be downloaded using a @font-face at-rule. it is often convenient to use the shorthand property font to set font-size and other font related properties all at once. you should always include at least one generic family name in a font-family list, since there's no guarantee that...
...f; font-family: "goudy bookletter 1911", sans-serif; /* a generic family name only */ font-family: serif; font-family: sans-serif; font-family: monospace; font-family: cursive; font-family: fantasy; font-family: system-ui; font-family: ui-serif; font-family: ui-sans-serif; font-family: ui-monospace; font-family: ui-rounded; font-family: emoji; font-family: math; font-family: fangsong; /* global values */ font-family: inherit; font-family: initial; font-family: unset; the font-family property lists one or more font families, separated by commas. each font family is specified as either a <family-name> or a <generic-name> value. the example below lists two font families, the first with a <family-name> and the second with a <generic-name>: font-family: gill sans extrabold, sans-serif; values...
...old, sans-serif; font-family: "goudy bookletter 1911", sans-serif; the following declarations are invalid: font-family: goudy bookletter 1911, sans-serif; font-family: red/black, sans-serif; font-family: "lucida" grande, sans-serif; font-family: ahem!, sans-serif; font-family: test@foo, sans-serif; font-family: #pound, sans-serif; font-family: hawaii 5-0, sans-serif; formal definition initial valuedepends on user agentapplies toall elements. it also applies to ::first-letter and ::first-line.inheritedyescomputed valueas specifiedanimation typediscrete formal syntax [ <family-name> | <generic-family> ]#where <family-name> = <string> | <custom-ident>+<generic-family> = serif | sans-serif | cursive | fantasy | monospace examples some common font families .serif { font-family: times, tim...
font-synthesis - CSS: Cascading Style Sheets
property controls which missing typefaces, bold or italic, may be synthesized by the browser. the source for this interactive example is stored in a github repository. if 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 this property can take any one of the following forms: the keyword value none. either of the keyword values weight and style. both the keyword values weight and style. values none indicates that neither bold nor italic typeface may be synthesized. weight indicates that a bold typeface may be synthesized if needed. style indicates that an italic typeface may be synthesized if needed. description most standard western fonts include italic and bold variant...
...needed. description most standard western fonts include italic and bold variants, but many novelty fonts do not. fonts used for chinese, japanese, korean and other logographic scripts tend not to include these variants, and synthesizing them may impede the legibility of the text. in these cases, it may be desirable to switch off the browser's default font-synthesis. ...
...t. fonts used for chinese, japanese, korean and other logographic scripts tend not to include these variants, and synthesizing them may impede the legibility of the text. in these cases, it may be desirable to switch off the browser's default font-synthesis. formal definition initial valueweight styleapplies toall elements. ...
grid-template-areas - CSS: Cascading Style Sheets
o contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. those areas are not associated with any particular grid item, but can be referenced from the grid-placement properties grid-row-start, grid-row-end, grid-column-start, grid-column-end, and their shorthands grid-row, grid-column, and grid-area. syntax /* keyword value */ grid-template-areas: none; /* <string> values */ grid-template-areas: "a b"; grid-template-areas: "a b b" "a c d"; /* global values */ grid-template-areas: inherit; grid-template-areas: initial; grid-template-areas: unset; values none the grid container doesn’t define any named grid areas. <string>+ a row is created for every separate string listed, and a colum...
... none the grid container doesn’t define any named grid areas. <string>+ a row is created for every separate string listed, and a column is created for each cell in the string. multiple named cell tokens within and between rows create a single named grid area that spans the corresponding grid cells. unless those cells form a rectangle, the declaration is invalid. ...
...grid areas. <string>+ a row is created for every separate string listed, and a column is created for each cell in the string. multiple named cell tokens within and between rows create a single named grid area that spans the corresponding grid cells. unless those cells form a rectangle, the declaration is invalid. ...
initial - CSS: Cascading Style Sheets
Web › CSS › initial
you should consider using the inherit, unset, or revert keywords instead. ...
...you should consider using the inherit, unset, or revert keywords instead. ...
... full support 1.0legend full support full support no support no supportrequires a vendor prefix or different name for use.requires a vendor prefix or different name for use. see also use unset to set a property to its inherited value if it inherits, or to its initial value if not. use revert to reset a property to the value established by the user-agent stylesheet (or by user styles, if any exist). use inherit to make an element's property the same as its parent. the all property lets you reset all properties to their initial, inherited, reverted, or unset state at once. ...
list-style-image - CSS: Cascading Style Sheets
o the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: this property is applied to list items, i.e. elements with display: list-item; by default this includes <li> elements. because this property is inherited, it can be set on the parent element (normally <ol> or <ul>) to let it apply to all list items. syntax /* keyword values */ list-style-image: none; /* <url> values */ list-style-image: url('starsolid.gif'); /* global values */ list-style-image: inherit; list-style-image: initial; list-style-image: unset; values <url> location of image to use as the marker. none specifies that no image is used as the marker. if this value is set, the marker defined in list-style-type will be used instead. formal definit...
...le-image: none; /* <url> values */ list-style-image: url('starsolid.gif'); /* global values */ list-style-image: inherit; list-style-image: initial; list-style-image: unset; values <url> location of image to use as the marker. none specifies that no image is used as the marker. if this value is set, the marker defined in list-style-type will be used instead. ...
...ge: url('starsolid.gif'); /* global values */ list-style-image: inherit; list-style-image: initial; list-style-image: unset; values <url> location of image to use as the marker. none specifies that no image is used as the marker. if this value is set, the marker defined in list-style-type will be used instead. ...
list-style-position - CSS: Cascading Style Sheets
to all list items. note that there is variance among browsers regarding behavior when a block element is placed first within a list element declared as list-style-position: inside. chrome and safari both place this element on the same line as the marker box, whereas firefox, internet explorer, and opera place it on the next line. for more information on this, see bug 36854. syntax /* keyword values */ list-style-position: inside; list-style-position: outside; /* global values */ list-style-position: inherit; list-style-position: initial; list-style-position: unset; the list-style-position property is specified as one of the keyword values listed below. values inside the ::marker is the first element among the list item's contents. outside the ::marker is outside the principal blo...
...t-style-position: outside; /* global values */ list-style-position: inherit; list-style-position: initial; list-style-position: unset; the list-style-position property is specified as one of the keyword values listed below. values inside the ::marker is the first element among the list item's contents. outside the ::marker is outside the principal block box. ...
...style-position: inherit; list-style-position: initial; list-style-position: unset; the list-style-position property is specified as one of the keyword values listed below. values inside the ::marker is the first element among the list item's contents. outside the ::marker is outside the principal block box. ...
mask-border-repeat - CSS: Cascading Style Sheets
the mask-border-repeat css property sets how the edge regions of a source image are adjusted to fit the dimensions of an element's mask border. syntax /* keyword value */ mask-border-repeat: stretch; mask-border-repeat: repeat; mask-border-repeat: round; mask-border-repeat: space; /* vertical | horizontal */ mask-border-repeat: round stretch; /* global values */ mask-border-repeat: inherit; mask-border-repeat: initial; mask-border-repeat: unset; the mask-border-repeat property may be specified using one or two values chosen from the list of values below. ...
...order-repeat: stretch; mask-border-repeat: repeat; mask-border-repeat: round; mask-border-repeat: space; /* vertical | horizontal */ mask-border-repeat: round stretch; /* global values */ mask-border-repeat: inherit; mask-border-repeat: initial; mask-border-repeat: unset; the mask-border-repeat property may be specified using one or two values chosen from the list of values below. when one value is specified, it applies the same behavior on all four sides. when two values are specified, the first applies to the top and bottom, the second to the left and right. values stretch the source image's edge regions are stretched to fill the gap between each border. repeat the source image's edge regions are tiled (repeated) to fill the gap between each border. tiles may be clipped to ach...
... tiles may be clipped to achieve the proper fit. round the source image's edge regions are tiled (repeated) to fill the gap between each border. tiles may be stretched to achieve the proper fit. space the source image's edge regions are tiled (repeated) to fill the gap between each border. extra space will be distributed in between tiles to achieve the proper fit. formal definition initial valuestretchapplies toall elements; in svg, it applies to container elements excluding the defs element and all graphics elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax [ stretch | repeat | round | space ]{1,2} examples basic usage this property doesn't appear to be supported anywhere yet. when it eventually starts to be supported, it will serve to define how the ...
minmax() - CSS: Cascading Style Sheets
Web › CSS › minmax
) css function defines a size range greater than or equal to min and less than or equal to max. it is used with css grids. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <inflexible-breadth>, <track-breadth> values */ minmax(200px, 1fr) minmax(400px, 50%) minmax(30%, 300px) minmax(100px, max-content) minmax(min-content, 400px) minmax(max-content, auto) minmax(auto, 300px) minmax(min-content, auto) /* <fixed-breadth>, <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 ...
...nmax(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 container in column grid tracks, and the...
mix-blend-mode - CSS: Cascading Style Sheets
the mix-blend-mode css property sets how an element's content should blend with the content of the element's parent and the element's background. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...-blend-mode: multiply; mix-blend-mode: screen; mix-blend-mode: overlay; mix-blend-mode: darken; mix-blend-mode: lighten; mix-blend-mode: color-dodge; mix-blend-mode: color-burn; mix-blend-mode: hard-light; mix-blend-mode: soft-light; mix-blend-mode: difference; mix-blend-mode: exclusion; mix-blend-mode: hue; mix-blend-mode: saturation; mix-blend-mode: color; mix-blend-mode: luminosity; /* global values */ mix-blend-mode: initial; mix-blend-mode: inherit; mix-blend-mode: unset; values <blend-mode> the blending mode that should be applied. formal definition initial valuenormalapplies toall elementsinheritednocomputed valueas specifiedanimation typediscretecreates stacking contextyes formal syntax <blend-mode>where <blend-mode> = normal | multiply | screen | overlay | darken | lighten ...
...n initial valuenormalapplies toall elementsinheritednocomputed valueas specifiedanimation typediscretecreates stacking contextyes formal syntax <blend-mode>where <blend-mode> = normal | multiply | screen | overlay | darken | lighten | color-dodge | color-burn | hard-light | soft-light | difference | exclusion | hue | saturation | color | luminosity examples effect of different mix-blend-mode values <div class="grid"> <div class="col"> <div class="note">blending in isolation (no blending with the background)</div> <div class="row isolate"> <div class="cell"> normal <div class="container normal"> <div class="group"> <div class="item firefox"></div> <svg viewbox="0 0 150 150"> <defs> <lineargradient id="...
<number> - CSS: Cascading Style Sheets
Web › CSS › number
the speed of the interpolation is determined by the timing function associated with the animation. ...
...the speed of the interpolation is determined by the timing function associated with the animation. ...
...h a leading - .60 fractional number without a leading zero 10e3 scientific notation -3.4e-2 complicated scientific notation invalid numbers 12. decimal points must be followed by at least one digit. +-12.2 only one leading +/- is allowed. 12.1.1 only one decimal point is allowed. specifications specification status comment css values and units module level 4the definition of '<number>' in that specification. editor's draft no significant change. css values and units module level 3the definition of '<number>' in that specification. candidate recommendation no significant change. css level 2 (revision 1)the definition of '<number>' in that specification. recommendation explicit definition. ...
object-fit - CSS: Cascading Style Sheets
ment's content object within the element's box using the object-position property. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax the object-fit property is specified as a single keyword chosen from the list of values below. values contain the replaced content is scaled to maintain its aspect ratio while fitting within the element’s content box. the entire object is made to fill the box, while preserving its aspect ratio, so the object will be "letterboxed" if its aspect ratio does not match the aspect ratio of the box. cover the replaced content is sized to maintain its aspect ratio while filling th...
...fill the element’s content box. the entire object will completely fill the box. if the object's aspect ratio does not match the aspect ratio of its box, then the object will be stretched to fit. none the replaced content is not resized. scale-down the content is sized as if none or contain were specified, whichever would result in a smaller concrete object size. ...
... completely fill the box. if the object's aspect ratio does not match the aspect ratio of its box, then the object will be stretched to fit. none the replaced content is not resized. scale-down the content is sized as if none or contain were specified, whichever would result in a smaller concrete object size. ...
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()). ...
...ffset-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()). ...
...sitioned 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 path, you would...
offset-rotate - CSS: Cascading Style Sheets
offset-rotate: auto; offset-rotate: auto 45deg; /* follow the path direction but facing the opposite direction of `auto` */ offset-rotate: reverse; /* keep a constant rotation regardless the position on the path */ offset-rotate: 90deg; offset-rotate: .5turn; auto the element is rotated by the angle of the direction of the offset-path, relative to the positive x-axis. this is the default value. <angle> the element has a constant clockwise rotation transformation applied to it by the specified rotation angle. auto <angle> if auto is followed by an <angle>, the computed value of the angle is added to the computed value of auto. reverse the element is rotated similar to auto, except it faces the opposite direction. it is the same as specifying a value of auto 180deg. ...
...as a constant clockwise rotation transformation applied to it by the specified rotation angle. auto <angle> if auto is followed by an <angle>, the computed value of the angle is added to the computed value of auto. reverse the element is rotated similar to auto, except it faces the opposite direction. it is the same as specifying a value of auto 180deg. ...
... by the specified rotation angle. auto <angle> if auto is followed by an <angle>, the computed value of the angle is added to the computed value of auto. reverse the element is rotated similar to auto, except it faces the opposite direction. it is the same as specifying a value of auto 180deg. ...
order - CSS: Cascading Style Sheets
Web › CSS › order
the order css property sets the order to lay out an item in a flex or grid container. items in a container are sorted by ascending order value and then by their source code order. the source for this interactive example is stored in a github repository. if 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 /* <integer> values */ order: 5; order: -5; /* global values */ order: inherit; order: initial; order: unset; since order is only meant to affect the visual order of elements and not their logical or tab order. order must not be used on non-visual media such as speech. values <integer> represents the ordinal group to be used by the item. accessibility concerns using the orde...
...ve technology such as a screen reader. if the visual (css) order is important, then screen reader users will not have access to the correct reading order. flexbox & the keyboard navigation disconnect — tink source order matters | adrian roselli mdn understanding wcag, guideline 1.3 explanations understanding success criterion 1.3.2 | w3c understanding wcag 2.0 formal definition initial value0applies toflex items and absolutely-positioned flex container childreninheritednocomputed valueas specifiedanimation typean integer formal syntax <integer> examples ordering items in a flex container this example uses css to create a classic two-sidebar layout surrounding a content block. the flexible box layout module automatically creates blocks of equal vertical size and uses as much hori...
... { display: flex; text-align:center; } main > article { flex:1; order: 2; } main > nav { width: 200px; order: 1; } main > aside { width: 200px; order: 3; } result specifications specification status comment css flexible box layout modulethe definition of 'order' in that specification. candidate recommendation initial definition initial value0applies toflex items and absolutely-positioned flex container childreninheritednocomputed valueas specifiedanimation typean integer ...
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, o...
...utline. 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, 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. ...
...de 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, 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. ...
overflow-inline - CSS: Cascading Style Sheets
the overflow-inline css property sets what shows when content overflows the inline start and end edges of a box. this may be nothing, a scroll bar, or the overflow content. the overflow-inline property maps to overflow-y or overflow-x depending on the writing mode of the document. syntax /* keyword values */ overflow-inline: visible; overflow-inline: hidden; overflow-inline: scroll; overflow-inline: auto; /* global values */ overflow-inline: inherit; overflow-inline: initial; overflow-inline: unset; the overflow-inline property is specified as a single keyword chosen from the list of values below. values visible content is not clipped and may be rendered outside the padding box's inline start and end edges. hidden content is clipped if necessary to fit the inline dimension in th...
...ent is actually clipped. (this prevents scrollbars from appearing or disappearing when the content changes.) printers may still print overflowing content. auto depends on the user agent. if content fits inside the padding box, it looks the same as visible, but still establishes a new block-formatting context. desktop browsers provide scrollbars if content overflows. ...
...ntent changes.) printers may still print overflowing content. auto depends on the user agent. if content fits inside the padding box, it looks the same as visible, but still establishes a new block-formatting context. desktop browsers provide scrollbars if content overflows. ...
overflow-x - CSS: Cascading Style Sheets
roperty sets what shows when content overflows a block-level element's left and right edges. this may be nothing, a scroll bar, or the overflow content. the source for this interactive example is stored in a github repository. if 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 */ overflow-x: visible; overflow-x: hidden; overflow-x: clip; overflow-x: scroll; overflow-x: auto; /* global values */ overflow-x: inherit; overflow-x: initial; overflow-x: unset; the overflow-x property is specified as a single keyword chosen from the list of values below. values visible content is not clipped and may be rendered outside the padding box's left and right edges. if overf...
...ent is actually clipped. (this prevents scrollbars from appearing or disappearing when the content changes.) printers may still print overflowing content. auto depends on the user agent. if content fits inside the padding box, it looks the same as visible, but still establishes a new block-formatting context. desktop browsers provide scrollbars if content overflows. ...
...nt changes.) printers may still print overflowing content. auto depends on the user agent. if content fits inside the padding box, it looks the same as visible, but still establishes a new block-formatting context. desktop browsers provide scrollbars if content overflows. ...
overflow-y - CSS: Cascading Style Sheets
roperty sets what shows when content overflows a block-level element's top and bottom edges. this may be nothing, a scroll bar, or the overflow content. the source for this interactive example is stored in a github repository. if 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 */ overflow-y: visible; overflow-y: hidden; overflow-y: clip; overflow-y: scroll; overflow-y: auto; /* global values */ overflow-y: inherit; overflow-y: initial; overflow-y: unset; the overflow-y property is specified as a single keyword chosen from the list of values below. if overflow-x is hidden, scroll or auto and this property is visible (default) it will implicitly compute to auto. va...
...ent is actually clipped. (this prevents scrollbars from appearing or disappearing when the content changes.) printers may still print overflowing content. auto depends on the user agent. if content fits inside the padding box, it looks the same as visible, but still establishes a new block-formatting context. desktop browsers provide scrollbars if content overflows. ...
...nt changes.) printers may still print overflowing content. auto depends on the user agent. if content fits inside the padding box, it looks the same as visible, but still establishes a new block-formatting context. desktop browsers provide scrollbars if content overflows. ...
overscroll-behavior-y - CSS: Cascading Style Sheets
the overscroll-behavior-y css property sets the browser's behavior when the vertical boundary of a scrolling area is reached. see overscroll-behavior for a full explanation. /* keyword values */ overscroll-behavior-y: auto; /* default */ overscroll-behavior-y: contain; overscroll-behavior-y: none; /* global values */ overscroll-behavior-y: inherit; overscroll-behavior-y: initial; overscroll-behavior-y: unset; initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete syntax the overscroll-behavior-y property is specified as a keyword chosen from the list of values below. values auto the default scroll overflow behavior occurs as normal. contain default scroll overflow behavior is o...
...pplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete syntax the overscroll-behavior-y property is specified as a keyword chosen from the list of values below. values auto the default scroll overflow behavior occurs as normal. contain default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occurs to neighbouring scrolling areas, e.g. underlying elements will not scroll. none no scroll chaining occurs to neighbouring scrolling areas, and default scroll overflow behavior is prevented. ...
...curs as normal. contain default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occurs to neighbouring scrolling areas, e.g. underlying elements will not scroll. none no scroll chaining occurs to neighbouring scrolling areas, and default scroll overflow behavior is prevented. formal definition initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax contain | none | auto examples preventing an underlying element from scrolling vertically .messages { height: 220px; overflow: auto; overscroll-behavior-y: contain; } see overscroll-behavior for a full example and explanation. ...
padding-top - CSS: Cascading Style Sheets
is stored in a github repository. if 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. syntax /* <length> values */ padding-top: 0.5em; padding-top: 0; padding-top: 2cm; /* <percentage> value */ padding-top: 10%; /* global values */ padding-top: inherit; padding-top: initial; padding-top: unset; the padding-top property is specified as a single value chosen from the list below. unlike margins, negative values are not allowed for padding. values <length> the size of the padding as a fixed value. mu...
...ing-top: unset; the padding-top property is specified as a single value chosen from the list below. unlike margins, negative values are not allowed for padding. values <length> the size of the padding as a fixed value. 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. ...
...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. 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 draf...
ruby-align - CSS: Cascading Style Sheets
the ruby-align css property defines the distribution of the different ruby elements over the base. /* keyword values */ ruby-align: start; ruby-align: center; ruby-align: space-between; ruby-align: space-around; /* global values */ ruby-align: inherit; ruby-align: initial; ruby-align: unset; syntax values start is a keyword indicating that the ruby will be aligned with the start of the base text. center is a keyword indicating that the ruby will be aligned at the middle of the base text. space-between is a keyword indicating that the extra space will be distributed between the elements of the ruby. ...
...ith the start of the base text. center is a keyword indicating that the ruby will be aligned at the middle of the base text. space-between is a keyword indicating that the extra space will be distributed between the elements of the ruby. space-around is a keyword indicating that the extra space will be distributed between the elements of the ruby, and around it. ...
... space-between is a keyword indicating that the extra space will be distributed between the elements of the ruby. space-around is a keyword indicating that the extra space will be distributed between the elements of the ruby, and around it. ...
scroll-behavior - CSS: Cascading Style Sheets
b.com/mdn/interactive-examples and send us a pull request. note that any other scrolls, such as those performed by the user, are not affected by this property. when this property is specified on the root element, it applies to the viewport instead. this property specified on the body element will not propagate to the viewport. user agents are allowed to ignore this property. syntax /* keyword values */ scroll-behavior: auto; scroll-behavior: smooth; /* global values */ scroll-behavior: inherit; scroll-behavior: initial; scroll-behavior: unset; the scroll-behavior property is specified as one of the keyword values listed below. values auto the scrolling box scrolls instantly. smooth the scrolling box scrolls in a smooth fashion using a user-agent-defined timing function over a user...
... initial; scroll-behavior: unset; the scroll-behavior property is specified as one of the keyword values listed below. values auto the scrolling box scrolls instantly. smooth the scrolling box scrolls in a smooth fashion using a user-agent-defined timing function over a user-agent-defined period of time. user agents should follow platform conventions, if any. ...
...r property is specified as one of the keyword values listed below. values auto the scrolling box scrolls instantly. smooth the scrolling box scrolls in a smooth fashion using a user-agent-defined timing function over a user-agent-defined period of time. user agents should follow platform conventions, if any. ...
scroll-margin-block-end - CSS: Cascading Style Sheets
formed 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. ...
...l 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. ...
... is stored in a github repository. if 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 type formal syntax <length> specifications specification status comment css scroll snap module level 1the definition of 'scroll-margin-block-end' in that specification. ...
scroll-margin-bottom - CSS: Cascading Style Sheets
formed 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. ...
... 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. ...
...ractive example is stored in a github repository. if 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 syntax <length> specifications specification status comment css scroll snap module level 1the definition of 'scroll-margin-bottom' in that specification. can...
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...
... 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 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 i...
...ize: 30px; display: flex; align-items: center; justify-content: center; scroll-snap-align: end; } .scroller > div:nth-child(2n) { background-color: #fff; color: #663399; } the most relevant part here is scroll-snap-align: end, which specifies that the right-hand edges (the "ends" along the x axis, in our case) are the designated snap points. last of all we specify the scroll margin values, a different one for the second and third child elements: .scroller > div:nth-child(2) { scroll-margin-inline: 1rem; } .scroller > div:nth-child(3) { scroll-margin-inline: 2rem; } this means that when scrolling past the middle child elements, the scrolling will snap to 1rem outside the inline end edge of the second <div>, and 2rems outside the inline end edge of the third <div>. note: h...
scroll-margin-left - CSS: Cascading Style Sheets
ormed 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. ...
...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. ...
...this interactive example is stored in a github repository. if 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. candid...
scroll-margin-right - CSS: Cascading Style Sheets
ormed 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. ...
...e 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-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 <length> specifications specification status comment css scroll snap module level 1the definition of 'scroll-margin-right' in that specification. candi...
scroll-margin-top - CSS: Cascading Style Sheets
formed 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. ...
...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. ...
...e for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <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 ...
scroll-snap-align - CSS: Cascading Style Sheets
the scroll-snap-align property specifies the box’s snap position as an alignment of its snap area (as the alignment subject) within its snap container’s snapport (as the alignment container). the two values specify the snapping alignment in the block axis and inline axis, respectively. if only one value is specified, the second value defaults to the same value. syntax /* keyword values */ scroll-snap-align: none; scroll-snap-align: start end; /* when two values set first is block, second inline */ scroll-snap-align: center; /* global values */ scroll-snap-align: inherit; scroll-snap-align: initial; scroll-snap-align: unset; values none the box does not define a snap position in that axis. start the start alignment of this box's scroll snap area, within the scroll container's sna...
...nt of this box's scroll snap area, within the scroll container's snapport is a snap position in this axis. end the end alignment of this box's scroll snap area, within the scroll container's snapport is a snap position in this axis. center the center alignment of this box's scroll snap area, within the scroll container's snapport is a snap position in this axis. ...
...he scroll container's snapport is a snap position in this axis. end the end alignment of this box's scroll snap area, within the scroll container's snapport is a snap position in this axis. center the center alignment of this box's scroll snap area, within the scroll container's snapport is a snap position in this axis. safari currently has the two value syntax in the wrong order, the first value being inline the second block. see bug #191865. formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax [ none | start | end | center ]{1,2} specifications specification status comment css scroll snap module level 1the definition of 'scroll-snap-align' in that specification. candidate r...
scroll-snap-destination - CSS: Cascading Style Sheets
the scroll-snap-destination css property defines the position in x and y coordinates within the scroll container's visual viewport which element snap points align with. /* <position> value */ scroll-snap-destination: 400px 600px; /* global values */ scroll-snap-destination: inherit; scroll-snap-destination: initial; scroll-snap-destination: unset; syntax values <position> specifies 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. ...
...x 600px; /* global values */ scroll-snap-destination: inherit; scroll-snap-destination: initial; scroll-snap-destination: unset; syntax values <position> specifies 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. ...
...ntax values <position> specifies 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. ...
<shape> - CSS: Cascading Style Sheets
Web › CSS › shape
he part of an element to 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. 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 i...
...th> 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, values of the <shape> data type are interpolated over their top, right, bottom, and left components, each treated as a real, floating-point number. the speed of the interpolation is determined by the timing function associated with the animation. example img.clip04 { clip: rect(10px, 20px, 20px, 10px); } specifications specification status comment css level 2 (revisio...
... ...
tab-size - CSS: Cascading Style Sheets
Web › CSS › tab-size
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. ...
.../* <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. ...
...<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. 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 t...
text-align-last - CSS: Cascading Style Sheets
the text-align-last css property sets how the last line of a block or a line, right before a forced line break, is aligned. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ text-align-last: auto; text-align-last: start; text-align-last: end; text-align-last: left; text-align-last: right; text-align-last: center; text-align-last: justify; /* global values */ text-align-last: inherit; text-align-last: initial; text-align-last: unset; values auto the affected line is aligned per the value of text-align, unless text-align is justify, in which case the effect is the same as setting text-align-last to start. start the same as left if direction is left-to-right and right if direction is right-to-left. end the same as right if direction is lef...
...rection is right-to-left. left the inline contents are aligned to the left edge of the line box. right the inline contents are aligned to the right edge of the line box. center the inline contents are centered within the line box. justify the text is justified. text should line up their left and right edges to the left and right content edges of the paragraph. formal definition initial valueautoapplies toblock containersinheritedyescomputed valueas specifiedanimation typediscrete formal syntax auto | start | end | left | right | center | justify examples justifying the last line <p>integer elementum massa at nulla placerat varius. suspendisse in libero risus, in interdum massa. vestibulum ac leo vitae metus faucibus gravida ac in neque. nullam est eros, suscipit sed dictum quis...
text-decoration-line - CSS: Cascading Style Sheets
ead. syntax /* single keyword */ text-decoration-line: none; text-decoration-line: underline; text-decoration-line: overline; text-decoration-line: line-through; text-decoration-line: blink; /* multiple keywords */ text-decoration-line: underline overline; /* two decoration lines */ text-decoration-line: overline underline line-through; /* multiple decoration lines */ /* global values */ text-decoration-line: inherit; text-decoration-line: initial; text-decoration-line: unset; the text-decoration-line property is specified as none, or one or more space-separated values from the list below. values none produces no text decoration. underline each line of text has a decorative line beneath it. overline each line of text has a decorative line above it. line-through e...
...om the list below. values none produces no text decoration. underline each line of text has a decorative line beneath it. overline each line of text has a decorative line above it. line-through each line of text has a decorative line going through its middle. blink the text blinks (alternates between visible and invisible). conforming user agents may simply not blink the text. this value is deprecated in favor of css animations. formal definition initial valuenoneapplies toall elements. ...
...bove it. line-through each line of text has a decorative line going through its middle. blink the text blinks (alternates between visible and invisible). conforming user agents may simply not blink the text. this value is deprecated in favor of css animations. formal definition initial valuenoneapplies toall elements. ...
text-decoration-skip-ink - CSS: Cascading Style Sheets
, please clone https://github.com/mdn/interactive-examples and send 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 underli...
... 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 glyph. this can be helpful with certain chinese, japanese, or korean (cjk) fonts, where the auto behavior might not create interruptions. ...
... 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 glyph. this can be helpful with certain chinese, japanese, or korean (cjk) fonts, where the auto behavior might not create interruptions. ...
text-decoration-style - CSS: Cascading Style Sheets
ough line meaning that some text has been deleted, authors are encouraged to denote this meaning using an html tag, like <del> or <s>. as browsers can disable styling in some cases, the semantic meaning won't disappear in such a situation. when setting multiple line-decoration properties at once, it may be more convenient to use the text-decoration shorthand property instead. syntax /* keyword values */ text-decoration-style: solid; text-decoration-style: double; text-decoration-style: dotted; text-decoration-style: dashed; text-decoration-style: wavy; /* global values */ text-decoration-style: inherit; text-decoration-style: initial; text-decoration-style: unset; values solid draws a single line. double draws a double line. dotted draws a dotted line. dashed draws a dashed line...
...d; text-decoration-style: wavy; /* global values */ text-decoration-style: inherit; text-decoration-style: initial; text-decoration-style: unset; values solid draws a single line. double draws a double line. dotted draws a dotted line. dashed draws a dashed line. wavy draws a wavy line. -moz-none draws no line. use text-decoration-line: none instead. formal definition initial valuesolidapplies toall elements. ...
...e: initial; text-decoration-style: unset; values solid draws a single line. double draws a double line. dotted draws a dotted line. dashed draws a dashed line. wavy draws a wavy line. -moz-none draws no line. use text-decoration-line: none instead. formal definition initial valuesolidapplies toall elements. ...
text-underline-offset - CSS: Cascading Style Sheets
xt-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. syntax /* single keyword */ text-underline-offset: auto; /* length */ text-underline-offset: 0.1em; text-underline-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 recommen...
... 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 across 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 t...
...he font. for a given application of this property, the offset is constant across 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:...
scale() - CSS: Cascading Style Sheets
al dimensions at different scales. its result is a <transform-function> data type. this scaling transformation is characterized by a two-dimensional vector. its coordinates define how much scaling is done in each direction. if both coordinates are equal, the scaling is uniform (isotropic) and the aspect ratio of the element is preserved (this is a homothetic transformation). ...
...ates define how much scaling is done in each direction. if both coordinates are equal, the scaling is uniform (isotropic) and the aspect ratio of the element is preserved (this is a homothetic transformation). when a coordinate value is outside the [-1, 1] range, the element grows along that dimension; when inside, it shrinks. if it is negative, the result a point reflection in that dimension. a value of 1 has no effect. note: the scale() function only scales in 2d. to scale in 3d, use scale3d() instead. syntax the scale() function is specified with either one or two values, which represent the amount of scaling to be applied in each direction. scale(sx) scale(sx, sy) values sx a <number> representing the abscissa of the scaling vector. sy a <number> representing the ordinate of t...
...n only scales in 2d. to scale in 3d, use scale3d() instead. syntax the scale() function is specified with either one or two values, which represent the amount of scaling to be applied in each direction. scale(sx) scale(sx, sy) values sx a <number> representing the abscissa of the scaling vector. sy a <number> representing the ordinate of the scaling vector. if not defined, its default value is sx, resulting in a uniform scaling that preserves the element's aspect ratio. cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coordinates on ℝℙ3 sx0 0sy sx000sy0001 sx000sy0001 sx0000sy0000100001 [sx 0 0 sy 0 0] accessibility concerns scaling/zooming animati...
skew() - 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. this transformation is a shear mapping (transvection) that distorts each point within an element by a certain angle in the horizontal and vertical directions. ...
...teractive-examples and send us a pull request. this transformation is a shear mapping (transvection) that distorts each point within an element by a certain angle in the horizontal and vertical directions. the coordinates of each point are modified by a value proportionate to the specified angle and the distance to the origin; thus, the farther from the origin a point is, the greater will be the value added it. syntax the skew() function is specified with either one or two values, which represent the amount of skewing to be applied in each direction. skew(ax) skew(ax, ay) values ax is an <angle> representing the angle to use to distort the element along the abscissa. ay is an <angle> representing the angle to use to distort the element along the ordinate. if not defined, its defaul...
...dded it. syntax the skew() function is specified with either one or two values, which represent the amount of skewing to be applied in each direction. skew(ax) skew(ax, ay) values ax is an <angle> representing the angle to use to distort the element along the abscissa. ay is an <angle> representing the angle to use to distort the element along the ordinate. if not defined, its default value is 0, resulting in a purely horizontal skewing. cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coordinates on ℝℙ3 1tan(ax)tan(ay)1 1tan(ax)0tan(ay)10001 1tan(ax)0tan(ay)10001 1tan(ax)00tan(ay)10000100001 [1 tan(ay) tan(ax) 1 0 0] examples using a single x-angle h...
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 b...
...0px, 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 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. ...
...or 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 coordinates on ℝℙ3 a translation is not a linear transformation in ℝ2 and can't be represented using a cartesian-coordinate matrix. ...
translateZ() - CSS: Cascading Style Sheets
ed 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 <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...
...relative; width: 60px; height: 60px; left: 100px; background-color: skyblue; } .moved { transform: perspective(500px) translatez(200px); background-color: pink; } what really matters here is the class "moved"; let's take a look at what it does. first, the perspective() function positions the viewer relative to the plane that lies where z=0 (in essence, the surface of the screen). ...
... surface of the screen). a value of 500px means the user is 500 pixels "in front of" the imagery located at z=0. then, the translatez() function moves the element 200 pixels "outward" from the screen, toward the user. this has the effect of making the element appear larger when viewed on a 2d display, or closer when viewed using a vr headset or other 3d display device. note if the perspective() value is less than the translatez() value, such as transform: perspective(200px) translatez(300px); the transformed element will not be visible as it is further than the user's viewport. the smaller the difference between the perspective and transform values, the closer the user is to the element and the larger the translated element will seem. result specifications specification statu...
word-break - CSS: Cascading Style Sheets
the word-break css property sets whether line breaks appear wherever the text would otherwise overflow its content box. the source for this interactive example is stored in a github repository. if 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 */ word-break: normal; word-break: break-all; word-break: keep-all; word-break: break-word; /* deprecated */ /* global values */ word-break: inherit; word-break: initial; word-break: unset; the word-break property is specified as a single keyword chosen from the list of values below. values normal use the default line break rule. break-all to prevent overflow, word breaks should be inserted between any two characters...
...default line break rule. break-all to prevent overflow, word breaks should be inserted between any two characters (excluding chinese/japanese/korean text). keep-all word breaks should not be used for chinese/japanese/korean (cjk) text. non-cjk text behavior is the same as for normal. ...
...wrap: anywhere, regardless of the actual value of the overflow-wrap property. note: in contrast to word-break: break-word and overflow-wrap: break-word (see overflow-wrap), word-break: break-all will create a break at the exact place where text would otherwise overflow its container (even if putting an entire word on its own line would negate the need for a break). formal definition initial valuenormalapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax normal | break-all | keep-all | break-word examples html <p>1. <code>word-break: normal</code></p> <p class="normal narrow">this is a long and honorificabilitudinitatibus califragilisticexpialidocious taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu グ...
z-index - CSS: Cascading Style Sheets
Web › CSS › z-index
ory. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. for a positioned box (that is, one with any position other than static), the z-index property specifies: the stack level of the box in the current stacking context. whether the box establishes a local stacking context. syntax /* keyword value */ z-index: auto; /* <integer> values */ z-index: 0; z-index: 3; z-index: 289; z-index: -1; /* negative values to lower the priority */ /* global values */ z-index: inherit; z-index: initial; z-index: unset; the z-index property is specified as either the keyword auto or an <integer>. values auto the box does not establish a new local stacking context. the stack level of the generated bo...
...nerated box in the current stacking context is the same as its parent's box. <integer> this <integer> is the stack level of the generated box in the current stacking context. the box also establishes a local stacking context in which its stack level is 0. this means that the z-indexes of descendants are not compared to the z-indexes of elements outside this element. ...
... its parent's box. <integer> this <integer> is the stack level of the generated box in the current stacking context. the box also establishes a local stacking context in which its stack level is 0. this means that the z-indexes of descendants are not compared to the z-indexes of elements outside this element. ...
regexp:match() - EXSLT
Web › EXSLT › regexp › match
containing character flags. the character flags are: g global match the submatches from every match in the string are returned. if this flag isn't specified, only the submatches from the first match are returned. i case insensitive match if this flag is specified, the match is performed in a case insensitive fashion. returns a node set of match elements, each of which has the string value equal to a portion of the first parameter string as captured by the regular expression. if the match isn't a global one, the first match element has the value of the portion of the string matched by the entire regular expression. for example: <xsl:for-each select="regexp:match('http://developer.mozilla.org/en/docs/firefox_3_for_developers', '(\w+):\/\/([^/:]+)...
...parameter string as captured by the regular expression. if the match isn't a global one, the first match element has the value of the portion of the string matched by the entire regular expression. ...
...ular expression. if the match isn't a global one, the first match element has the value of the portion of the string matched by the entire regular expression. ...
EXSLT
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes exslt is a set of extensions to xslt. there are a number of modules; those that are supported by firefox are listed below: common (exsl)the exslt common package provides basic functions that expand upon the capabilities of xslt.math (math)the exslt math package provides functions for working with numeric values and comparing nodes.regular expressions (regexp)the exslt regular expressions package provides functions that allow testing, matching, and replacing text using javascript style regular expressions.sets (set)the exslt sets package offers functions that let you perform set manipulation.strings (str)the exslt strings package provides functions that allow the manipulation of strings. exslt modules ...
...e an exslt function, you need to declare the namespace the function is in, and then use the appropriate prefix when calling the function. for example, to use the regular expressions package: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:regexp="http://exslt.org/regular-expressions"> <xsl:template match="/"> ... <xsl:value-of select="regexp:replace(/root/@value, 'before', 'gi', 'after')"/> ... </xsl:template> </xsl:stylesheet> common the exslt common package provides basic functions that expand upon the capabilities of xslt. the namespace for the common package is http://exslt.org/common. functions exsl:node-set() exsl:object-type() math the exslt math package provides functions for working with...
...the namespace for the math package is http://exslt.org/math. functions math:highest() math:lowest() math:max() math:min() regular expressions the exslt regular expressions package provides functions that allow testing, matching, and replacing text using javascript style regular expressions. ...
Localizations and character encodings - Developer guides
ious single region-specific encoding and heuristic detection among multiple legacy encodings was introduced to web browsers. this has then had the effect that web authors have depended on heuristic detection being present, so firefox still has heuristic detection in these locales. finding canonical encoding names the text below refers to canonical names of encodings. the canonical names are the values to the right of the equals sign in unixcharset.properties. specifying the fallback encoding as of firefox 28, this section is obsolete, since the preference intl.charset.default no longer exists. the mapping from locales onto fallback encodings is now built into gecko itself. the fallback encoding is specified by the preference intl.charset.default in intl.properties. it should be set to the ...
...lback encoding is currently iso-8859-1, it should be changed to windows-1252. iso-8859-1 is decoded in the exact same way as windows-1252, but firefox is moving to treating windows-1252 as the preferred label for this encoding in accordance with the encoding standard. for locales where internet explorer has more market share than firefox, the fallback encoding should typically be set to the same value as in internet explorer. you can see the fallback encoding a particular browser has by loading a test page. (be sure to use a browser installation that has its settings left to the defaults when investigating!) for locales where firefox has more market share than internet explorer, it's probably best not to change the fallback encoding even if it doesn't follow the guidance given above. (for exa...
...region. for example, for a localization for minority language in russia, it is appropriate to copy the settings from the russian localization. setting some encodings to be more easily selectable from the character encoding menu the preference intl.charsetmenu.browser.static in intl.properties makes some character encodings more easily available in the character encoding menu in the browser. the value should be a comma-separated list of canonical encoding names. the list should include at least the fallback encoding, windows-1252 and utf-8. for locales where there are multiple common legacy encodings, all those encodings should be included. for example, the fallback encoding for japanese is shift_jis, but there are other legacy encodings: iso-2022-jp and euc-jp. therefore, it makes sense for t...
<dl>: The Description List element - HTML: Hypertext Markup Language
Web › HTML › Element › dl
the html <dl> element represents a description list. the element encloses a list of groups of terms (specified using the <dt> element) and descriptions (provided by <dd> elements). common uses for this element are to implement a glossary or to display metadata (a list of key-value pairs). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, and if the <dl> element's children include one name-value group, palpable content. permitted content either: zero or more groups each consisting of one or more <dt> elements followed by one or more <dd> elements, optionally...
... cat or firefox, is a mostly herbivorous mammal, slightly larger than a domestic cat (60 cm long). </dd> <!-- other terms and descriptions --> </dl> multiple terms and descriptions it is also possible to define multiple terms with multiple corresponding descriptions, by combining the examples above. ...
...also possible to define multiple terms with multiple corresponding descriptions, by combining the examples above. metadata description lists are useful for displaying metadata as a list of key-value pairs. <dl> <dt>name</dt> <dd>godzilla</dd> <dt>born</dt> <dd>1952</dd> <dt>birthplace</dt> <dd>japan</dd> <dt>color</dt> <dd>green</dd> </dl> tip: it can be handy to define a key-value separator in the css, such as: dt::after { content: ": "; } wrapping name-value groups in <div> elements whatwg html allows wrapping each name-value group in a <dl> element in a <div> element. this can be useful when using microdata, or when global attributes apply to a whole group, or for styling purposes. <dl> <div> <dt>name</dt> <dd>godzilla</dd> </div> <div> <dt>born</...
<label> - HTML: Hypertext Markup Language
Web › HTML › Element › label
nd what data should be entered. you can click the associated label to focus/activate the input, as well as the input itself. this increased hit area provides an advantage to anyone trying to activate the input, including those using a touch-screen device. to associate the <label> with an <input> element, you need to give the <input> an id attribute. the <label> then needs a for attribute whose value is the same as the input's id. alternatively, you can nest the <input> directly inside the <label>, in which case the for and id attributes are not needed because the association is implicit: <label>do you like peas? <input type="checkbox" name="peas"> </label> other usage notes: the form control that the label is labeling is called the labeled control of the label element. one input can...
...an be associated with multiple labels. when a <label> is clicked or tapped and it is associated with a form control, the resulting click event is also raised for the associated control. attributes this element includes the global attributes. for the id of a labelable form-related element in the same document as the <label> element. the first element in the document with an id matching the value of the for attribute is the labeled control for this label element, if it is a labelable element. if it is not labelable then the for attribute has no effect. if there are other elements which also match the id value, later in the document, they are not considered. note: a <label> element can have both a for attribute and a contained control element, as long as the for attribute points to the co...
...ction of a form needs a title, use the <legend> element placed within a <fieldset>. don't <label for="your-name"> <h3>your name</h3> <input id="your-name" name="your-name" type="text"> </label> do <label class="large-label" for="your-name"> your name <input id="your-name" name="your-name" type="text"> </label> buttons an <input> element with a type="button" declaration and a valid value attribute does not need a label associated with it. doing so may actually interfere with how assistive technology parses the button input. the same applies for the <button> element. technical summary content categories flow content, phrasing content, interactive content, form-associated element, palpable content. permitted content phrasing content, but no descendant labe...
<marquee>: The Marquee element (Obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › marquee
the html <marquee> element is used to insert a scrolling area of text. you can control what happens when the text reaches the edges of its content area using its attributes. dom interface htmlmarqueeelement attributes behavior sets how the text is scrolled within the marquee. possible values are scroll, slide and alternate. if no value is specified, the default value is scroll. bgcolor sets the background color through color name or hexadecimal value. direction sets the direction of the scrolling within the marquee. possible values are left, right, up and down. if no value is specified, the default value is left. height sets the height in pixels or percentage value. hspace sets the horizontal margin loop sets the number of times the marquee will scroll. if n...
... bgcolor sets the background color through color name or hexadecimal value. direction sets the direction of the scrolling within the marquee. possible values are left, right, up and down. if no value is specified, the default value is left. height sets the height in pixels or percentage value. hspace sets the horizontal margin loop sets the number of times the marquee will scroll. if no value is specified, the default value is −1, which means the marquee will scroll continuously. scrollamount sets the amount of scrolling at each interval in pixels. the default value is 6. scrolldelay sets the interval between each scroll movement in milliseconds. the default value is 85. ...
...sets the horizontal margin loop sets the number of times the marquee will scroll. if no value is specified, the default value is −1, which means the marquee will scroll continuously. scrollamount sets the amount of scrolling at each interval in pixels. the default value is 6. scrolldelay sets the interval between each scroll movement in milliseconds. the default value is 85. note that any value smaller than 60 is ignored and the value 60 is used instead, unless truespeed is specified. truespeed by default, scrolldelay values lower than 60 are ignored. if truespeed is present, those values are not ignored. vspace sets the vertical margin in pixels or percentage value. width sets the width in pixels or percentage value. event handlers onbounce fires when the marquee has reache...
<output>: The Output element - HTML: Hypertext Markup Language
Web › HTML › Element › output
tarting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role status permitted aria roles any dom interface htmloutputelement attributes this element includes the global attributes. for a space-separated list of other elements’ ids, indicating that those elements contributed input values to (or otherwise affected) the calculation. form the <form> element to associate the output with (its form owner). the value of this attribute must be the id of a <form> in the same document. (if this attribute is not set, the <output> is associated with its ancestor <form> element, if any.) this attribute lets you associate <output> elements to <form>s anywhere in the document, not just insi...
...s attribute must be the id of a <form> in the same document. (if this attribute is not set, the <output> is associated with its ancestor <form> element, if any.) this attribute lets you associate <output> elements to <form>s anywhere in the document, not just inside a <form>. it can also override an ancestor <form> element. name the element's name. used in the form.elements api. the <output> value, name, and contents are not submitted during form submission. examples in the following example, the form provides a slider whose value can range between 0 and 100, and an <input> element into which you can enter a second number. the two numbers are added together, and the result is displayed in the <output> element each time the value of any of the controls changes. <form oninput="result.valu...
...ontents are not submitted during form submission. examples in the following example, the form provides a slider whose value can range between 0 and 100, and an <input> element into which you can enter a second number. the two numbers are added together, and the result is displayed in the <output> element each time the value of any of the controls changes. <form oninput="result.value=parseint(a.value)+parseint(b.value)"> <input type="range" id="b" name="b" value="50" /> + <input type="number" id="a" name="a" value="10" /> = <output name="result" for="a b">60</output> </form> accessibility concerns many browsers implement this element as an aria-live region. assistive technology will thereby announce the results of ui interactions posted inside it without requiring that focus is swi...
<param>: The Object Parameter element - HTML: Hypertext Markup Language
Web › HTML › Element › param
it is a void element, the start tag must be present and the end tag must not be present. permitted parents an <object> before any flow content. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlparamelement attributes this element includes the global attributes. name name of the parameter. ...
... the start tag must be present and the end tag must not be present. permitted parents an <object> before any flow content. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlparamelement attributes this element includes the global attributes. name name of the parameter. value specifies the value of the parameter. ...
...ed parents an <object> before any flow content. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlparamelement attributes this element includes the global attributes. name name of the parameter. value specifies the value of the parameter. deprecated attributes type only used if the valuetype is set to ref. specifies the mime type of values found at the uri specified by value. valuetype specifies the type of the value attribute. possible values are: data: default value. the value is passed to the object's implementation as a string. ref: the value is a uri to a resource where run-time values are stored. object: an id of another <object> in the same document. exam...
<progress>: The Progress Indicator element - HTML: Hypertext Markup Language
Web › HTML › Element › progress
arents any element that accepts phrasing content. implicit aria role progressbar permitted aria roles no role permitted dom interface htmlprogresselement attributes this element includes the global attributes. max this attribute describes how much work the task indicated by the progress element requires. ...
...aria role progressbar permitted aria roles no role permitted dom interface htmlprogresselement attributes this element includes the global attributes. max this attribute describes how much work the task indicated by the progress element requires. the max attribute, if present, must have a value greater than 0 and be a valid floating point number. the default value is 1. value this attribute specifies how much of the task that has been completed. it must be a valid floating point number between 0 and max, or between 0 and 1 if max is omitted. if there is no value attribute, the progress bar is indeterminate; this indicates that an activity is ongoing with no indication of how long it is expected to take. note: unlike the <meter> element, the minimum va...
...minate; this indicates that an activity is ongoing with no indication of how long it is expected to take. note: unlike the <meter> element, the minimum value is always 0, and the min attribute is not allowed for the <progress> element. note: the :indeterminate pseudo-class can be used to match against indeterminate progress bars. to change the progress bar to indeterminate after giving it a value you must remove the value attribute with element.removeattribute('value'). examples <progress value="70" max="100">70 %</progress> result on windows 7, the resulting progress looks like this: specifications specification status comment html living standardthe definition of '<progress>' in that specification. living standard html5the definiti...
<track>: The Embed Text Track element - HTML: Hypertext Markup Language
Web › HTML › Element › track
attributes this element includes the global attributes. default this attribute indicates that the track should be enabled unless the user's preferences indicate that another track is more appropriate. this may only be used on one track element per media element. kind how the text track is meant to be used. if omitted the default kind is subtitles. if the attribute contains an invalid value, it will use metadata (versions of chrome earlier than 52 treated an invalid value as subtitles). the following keywords are allowed: subtitles subtitles provide translation of content that cannot be understood by the viewer. for example dialogue or text that is not english in an english language film. subtitles may contain additional content, usually extra background information.
... chapter titles are intended to be used when the user is navigating the media resource. metadata tracks used by scripts. not visible to the user. label a user-readable title of the text track which is used by the browser when listing available text tracks. src address of the track (.vtt file). must be a valid url. this attribute must be specified and its url value must have the same origin as the document — unless the <audio> or <video> parent element of the track element has a crossorigin attribute. srclang language of the track text data. it must be a valid bcp 47 language tag. if the kind attribute is set to subtitles, then srclang must be defined. usage notes track data types the type of data that track adds to the media is set in the kind attr...
...igin as the document — unless the <audio> or <video> parent element of the track element has a crossorigin attribute. srclang language of the track text data. it must be a valid bcp 47 language tag. if the kind attribute is set to subtitles, then srclang must be defined. usage notes track data types the type of data that track adds to the media is set in the kind attribute, which can take values of subtitles, captions, descriptions, chapters or metadata. the element points to a source file containing timed text that the browser exposes when the user requests additional data. a media element cannot have more than one track with the same kind, srclang, and label. detecting cue changes the underlying texttrack, indicated by the track property, receives a cuechange event every time the c...
accesskey - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: in the whatwg spec, it says you can specify multiple space-separated characters, and the browser will use the first one it supports. however, this does not work in most browsers. ...
...so adapting to specific languages could cause further prob...
...g key accessibility concerns in addition to poor browser support, there are numerous concerns with the accesskey attribute: an accesskey value can conflict with a system or browser keyboard shortcut, or assistive technology functionality. what may work for one combination of operating system, assistive technology, and browser may not work with other combinations. certain accesskey values may not be present on certain keyboards, especially when internationalization is a concern. so adapting to specific languages could cause further problems. accesskey values that rely on numbers may be confusing to individuals experiencing cognitive concerns, where the number doesn't have a logical association with the functionality it triggers. informing the user that accesskeys are present, ...
id - HTML: Hypertext Markup Language
st be unique in the whole document. its purpose is to identify the element when linking (using a fragment identifier), scripting, or styling (with css). the source for this interactive example is stored in a github repository. if 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 attribute's value is an opaque string: this means that web authors should not rely on it to convey human-readable information (although having your ids somewhat human-readable can be useful for code comprehension, e.g. consider ticket-18659 versus r45tgfe-freds&$@). id's value must not contain whitespace (spaces, tabs etc.). browsers treat non-conforming ids that contain whitespace as if the whitespace is part o...
... note: using characters except ascii letters, digits, '_', '-' and '.' may cause compatibility problems, as they weren't allowed in html 4. ...
... note: using characters except ascii letters, digits, '_', '-' and '.' may cause compatibility problems, as they weren't allowed in html 4. though this restriction has been lifted in html5, an id should start with a letter for compatibility. ...
itemtype - HTML: Hypertext Markup Language
and property names. for example, musicevent indicates a concert performance, with startdate and location properties specifying the concert's key details. in this case, musicevent would be the url used by itemtype, with startdate and location as itemprop's which musicevent defines. note: more about itemtype attributes can be found at http://schema.org/thing the itemtype attribute must have a value that is an unordered set of unique tokens which are case-sensitive, each is a valid and absolute url, and all defined to use the same vocabulary. the attribute's value must have at least one token. the item types must all be types defined in applicable specifications (such as schema.org), and must all be defined to use the same vocabulary. the itemtype attribute can only be specified on element...
...t="executive anvil logo" /><br> <span itemprop="description">sleeker than acme's classic anvil, the executive anvil is perfect for the business traveler looking for something to drop from a height. ...
..._720.png itemprop description sleeker than acme's classic anvil, the executive anvil is perfect for the business traveler looking for something to drop from a height. ...
Link types - HTML: Hypertext Markup Language
the referer http header (unless noreferrer is used as well). note that when noopener is used, nonempty target names other than _top, _self, and _parent are all treated like _blank in terms of deciding whether to open a new window/tab. <a>, <area>, <form> <link> noreferrer prevents the browser, when navigating to another page, to send this page address, or any other value, as referrer via the referer: http header. (in firefox, before firefox 37, this worked only in links found in pages. links clicked in the ui, like "open in a new tab" via the contextual menu, ignored this). <a>, <area>, <form> <link> opener reverts implicit rel="noopener" addition on links with target="_blank" (see related html spec discussion, webkit change, and...
... open a connection to the linked web site in advance, without disclosing any private information or downloading any content, so that when the link is followed the linked content can be fetched more quickly. <link> <a>, <area>, <form> prefetch suggests that the browser fetch the linked resource in advance, as it is likely to be requested by the user. starting with firefox 44, the value of the crossorigin attribute is taken into consideration, making it possible to make anonymous prefetches. note: the link prefetch faq has details on which links can be prefetched and on alternative methods. <link> <a>, <area>, <form> preload tells the browser to download a resource because this resource will be needed later during the current navigation. see preloading...
...e current page and the linked resource. <a>, <area>, <link> <form> specifications specification status comment preloadthe definition of 'preload' in that specification. candidate recommendation added preload. resource hintsthe definition of 'preconnect' in that specification. working draft added dns-prefetch, preconnect, and prerender values. html living standardthe definition of 'link types' in that specification. living standard added opener and made noopener the default behavior for target="_blank" links. html5the definition of 'link types' in that specification. recommendation added tag, search, prefetch, noreferrer, nofollow, icon, and author. renamed copyright to license. removed start, ch...
Common MIME types - HTTP
an unknown file type should use this type. browsers pay a particular care when manipulating these files, attempting to safeguard the user to prevent dangerous behaviors. ...
...an unknown file type should use this type. browsers pay a particular care when manipulating these files, attempting to safeguard the user to prevent dangerous behaviors. ...
...ation/vnd.amazon.ebook .bin any kind of binary data application/octet-stream .bmp windows os/2 bitmap graphics image/bmp .bz bzip archive application/x-bzip .bz2 bzip2 archive application/x-bzip2 .csh c-shell script application/x-csh .css cascading style sheets (css) text/css .csv comma-separated values (csv) text/csv .doc microsoft word application/msword .docx microsoft word (openxml) application/vnd.openxmlformats-officedocument.wordprocessingml.document .eot ms embedded opentype fonts application/vnd.ms-fontobject .epub electronic publication (epub) application/epub+zip .gz gzip compressed archive application/gzip...
Browser detection using the user agent - HTTP
browsers are lying: chrome for example reports both as chrome and safari. so to detect safari you have to check for the safari string and the absence of the chrome string, chromium often reports itself as chrome too or seamonkey sometimes reports itself as firefox. also, pay attention not to use a simple regular expression on the browsername, user agents also contain strings outside the keyword/value syntax. safari & chrome contain the string 'like gecko', for instance. must contain must not contain firefox firefox/xyz seamonkey/xyz seamonkey seamonkey/xyz chrome chrome/xyz chromium/xyz chromium chromium/xyz safari safari/xyz chrome/xyz or chromium/xyz safari gives two vers...
...e, there is absolutely no guarantee that another browser will not hijack some of these things (like chrome hijacked the safari string in the past). that's why browser detection using the user agent string is unreliable and should be done only with the check of the version number (hijacking of past versions is less likely). browser version the browser version is often, but not always, put in the value part of the browsername/versionnumber token in the user agent string. this is of course not the case for internet explorer (which puts the version number right after the msie token), and for opera after version 10, which has added a version/versionnumber token. here again, be sure to take the right token for the browser you are looking for, as there is no guarantee that others will contain a val...
...79 (see 'blink'). blink chrome/xyz rendering engine version most rendering engines put the version number in the renderingengine/versionnumber token, with the notable exception of gecko. gecko puts the gecko version number in the comment part of the user agent after the rv: string. from gecko 14 for the mobile version and gecko 17 for the desktop version, it also puts this value in the gecko/version token (previous version put there the build date, then a fixed date called the geckotrail). os the operating system is given in most user agent strings (although not web-focused platforms like firefox os), but the format varies a lot. it is a fixed string between two semi-colons, in the comment part of the user agent. these strings are specific for each browser. they indica...
HTTP caching - HTTP
Web › HTTP › Caching
urce, saving some bandwidth. here is an example of this process with a shared cache proxy: the freshness lifetime is calculated based on several headers. if a "cache-control: max-age=n" header is specified, then the freshness lifetime is equal to n. if this header is not present, which is very often the case, it is checked if an expires header is present. if an expires header exists, then its value minus the value of the date header determines the freshness lifetime. finally, if neither header is present, look for a last-modified header. if this header is present, then the cache's freshness lifetime is equal to the value of the date header minus the value of the last-modified header divided by 10. the expiration time is computed as follows: expirationtime = responsetime + freshnesslifetim...
...triggered when the user presses the reload button. it is also triggered under normal browsing if the cached response includes the "cache-control: must-revalidate" header. another factor is the cache validation preferences in the advanced->cache preferences panel. there is an option to force a validation each time a document is loaded. etags the etag response header is an opaque-to-the-useragent value that can be used as a strong validator. that means that a http user-agent, such as the browser, does not know what this string represents and can't predict what its value would be. if the etag header was part of the response for a resource, the client can issue an if-none-match in the header of future requests – in order to validate the cached resource. the last-modified response header can be...
... to serve the page from cache. if you are serving different content to mobile users, it can help you to avoid that a cache may mistakenly serve a desktop version of your site to your mobile users. in addition, it can help google and other search engines to discover the mobile version of a page, and might also tell them that no cloaking is intended. vary: user-agent because the user-agent header value is different ("varies") for mobile and desktop clients, caches will not be used to serve mobile content mistakenly to desktop users or vice versa. ...
Using Feature Policy - HTTP
this when implementing feature policy on your website. writing a policy a policy is described using a set of individual policy directives. a policy directive is a combination of a defined feature name, and an allowlist of origins that can use the feature. features within a policy are separated by semicolons. allowlist an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
...ature-policy http header. the allow attribute on <iframe>s. the primary difference between the http header and the allow attribute is that the allow attribute only controls features within an iframe. the header controls features in the response and any embedded content within the page. the feature-policy http header you can send the feature-policy http header with the response of a page. the value of this header is a policy to be enforced by the browser for the given page. it has the following structure. feature-policy: <feature name> <allowlist of origin(s)> for example, to block all content from using the geolocation api across your site: feature-policy: geolocation 'none' several features can be controlled at the same time by sending the http header with a semicolon-separated list o...
Accept-Language - HTTP
guage request http header advertises which languages the client is able to understand, and which locale variant is preferred. (by languages, we mean natural languages, such as english, and not programming languages.) using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the content-language response header. browsers set adequate values for this header according to their user interface language and even if a user can change it, this happens rarely (and is frowned upon as it leads to fingerprinting). this header is a hint to be used when the server has no way of determining the language via another way, like a specific url, that is controlled by an explicit user decision. it is recommended that the server never overrides an exp...
...server cannot serve any matching language, it can theoretically send back a 406 (not acceptable) error code. but, for a better user experience, this is rarely done and more common way is to ignore the accept-language header in this case. header type request header forbidden header name no cors-safelisted request header yes, with the additional restriction that values can only be 0-9, a-z, a-z, space or *,-.;=. syntax accept-language: <language> accept-language: * // multiple types, weighted with the quality value syntax: accept-language: fr-ch, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5 directives <language> a language tag (which is sometimes referred to as a "locale identifier"). this consists of a 2-3 letter base language tag representing the la...
...anguage, optionally followed by additional subtags separated by '-'. the most common extra information is the country or region variant (like 'en-us' or 'fr-ca') or the type of alphabet to use (like 'sr-latn'). other variants like the type of orthography ('de-de-1996') are usually not used in the context of this header. * any language; '*' is used as a wildcard. ;q= (q-factor weighting) any value placed in an order of preference expressed using a relative quality value called weight. examples accept-language: de accept-language: de-ch accept-language: en-us,en;q=0.5 specifications specification title rfc 7231, section 5.3.5: accept-language hypertext transfer protocol (http/1.1): semantics and context bcp 47 tags for the identification of la...
Accept - HTTP
Web › HTTP › Headers › Accept
the accept request http header advertises which content types, expressed as mime types, the client is able to understand. using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the content-type response header. browsers set adequate values for this header depending on the context where the request is done: when fetching a css stylesheet a different value is set for the request than when fetching an image, video or a script. header type request header forbidden header name no cors-safelisted request header yes, with the additional restriction that values can't contain a cors-unsafe request header byte: 0x00-0x1f (except 0x09 (ht)), "():<>?@[\]{}, and 0x7f (del). syntax accept: <mime_...
... header type request header forbidden header name no cors-safelisted request header yes, with the additional restriction that values can't contain a cors-unsafe request header byte: 0x00-0x1f (except 0x09 (ht)), "():<>?@[\]{}, and 0x7f (del). syntax accept: <mime_type>/<mime_subtype> accept: <mime_type>/* accept: */* // multiple types, weighted with the quality value syntax: accept: text/html, application/xhtml+xml, application/xml;q=0.9, image/webp, */*;q=0.8 directives <mime_type>/<mime_subtype> a single, precise mime type, like text/html. <mime_type>/* a mime type, but without any subtype. ...
... weighted with the quality value syntax: accept: text/html, application/xhtml+xml, application/xml;q=0.9, image/webp, */*;q=0.8 directives <mime_type>/<mime_subtype> a single, precise mime type, like text/html. <mime_type>/* a mime type, but without any subtype. image/* will match image/png, image/svg, image/gif and any other image types. */* any mime type ;q= (q-factor weighting) any value used is placed in an order of preference expressed using relative quality value called the weight. examples accept: text/html accept: image/* // general default accept: */* // default for navigation requests accept: text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8 specifications specification title rfc 7231, section 5.3.2: accept hypertext tr...
CSP: connect-src - HTTP
the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content sour...
... <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still ...
...the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
CSP: img-src - HTTP
the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content sour...
... <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still ...
...the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
CSP: prefetch-src - HTTP
the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content sour...
... <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still ...
...the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
CSP: script-src-attr - HTTP
the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content sour...
... <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still ...
...the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
CSP: script-src-elem - HTTP
the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content sour...
... <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still ...
...the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
CSP: script-src - HTTP
the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content sour...
... <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still ...
...the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
CSP: style-src-attr - HTTP
the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content sour...
... <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still ...
...the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
CSP: style-src-elem - HTTP
the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content sour...
... <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still ...
...the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
CSP: style-src - HTTP
the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content sour...
... <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still ...
...the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
Content-Type - HTTP
the content-type entity header is used to indicate the media type of the resource. in responses, a content-type header tells the client what the content type of the returned content actually is. browsers will do mime sniffing in some cases and will not necessarily follow the value of this header; to prevent this behavior, the header x-content-type-options can be set to nosniff. in requests, (such as post or put), the client tells the server what type of data is actually sent. ...
...eader; to prevent this behavior, the header x-content-type-options can be set to nosniff. in requests, (such as post or put), the client tells the server what type of data is actually sent. header type entity header forbidden header name no cors-safelisted response header yes cors-safelisted request header yes, with the additional restriction that values can't contain a cors-unsafe request header byte: 0x00-0x1f (except 0x08 (tab)), "():<>?@[\]{}, and 0x7f (delete). it also needs to have a mime type of its parsed value (ignoring parameters) of either application/x-www-form-urlencoded, multipart/form-data, or text/plain. syntax content-type: text/html; charset=utf-8 content-type: multipart/form-data; boundary=something directives ...
... header boundary is prepended with two dashes and the final boundary has two dashes appended at the end. examples content-type in html forms in a post request, resulting from an html form submission, the content-type of the request is specified by the enctype attribute on the <form> element. ...
Feature-Policy: accelerometer - HTTP
the http feature-policy header accelerometer directive controls whether the current document is allowed to gather information about the acceleration of the device through the accelerometer interface. syntax feature-policy: accelerometer <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src at...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
...in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the default value is 'self'. specifications specification status comment feature policy editor's draft initial definition. accelerometerthe definition of 'accelerometer' in that specification. candidate recommendation ...
Feature-Policy: ambient-light-sensor - HTTP
the http feature-policy header ambient-light-sensor directive controls whether the current document is allowed to gather information about the amount of light in the environment around the device through the ambientlightsensor interface. syntax feature-policy: ambient-light-sensor <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the ...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
...in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the default value is 'self'. specification specification status comment feature policy editor's draft initial definition. ...
Feature-Policy: autoplay - HTTP
promise returned by htmlmediaelement.play() will reject with a domexception. the autoplay attribute on <audio> and <video> elements will be ignored. for more details on autoplay and autoplay blocking, see the article autoplay guide for media and web audio apis. syntax feature-policy: autoplay <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
...in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the default value in google chrome is 'self'. specifications specification status comment feature policy editor's draft initial definition. ...
Feature-Policy: battery - HTTP
the http feature-policy header battery directive controls whether the current document is allowed to gather information about the acceleration of the device through the batterymanager interface obtained via navigator.getbattery(). syntax feature-policy: battery <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the u...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
...in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the default value is 'self'. specifications specification status comment feature policy editor's draft initial definition. battery status apithe definition of 'feature policy integration' in that specification. candidate recommendation ...
Feature-Policy: camera - HTTP
the http feature-policy header camera directive controls whether the current document is allowed to use video input devices. when this policy is enabled, the promise returned by mediadevices.getusermedia() will reject with a notallowederror. syntax feature-policy: camera <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin ...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
...in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the default value is 'self'. specification specification status comment feature policy editor's draft initial definition. ...
Feature-Policy: document-domain - HTTP
http feature-policy header document-domain directive controls whether the current document is allowed to set document.domain. when this policy is enabled, attempting to set document.domain will fail and cause a securityerror domexception to be be thrown. syntax feature-policy: document-domain <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
...in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the default value is *. specifications specification status comment html living standardthe definition of 'document-domain' in that specification. living standard ...
Feature-Policy: fullscreen - HTTP
llscreen attribute are present on an <iframe> element, this directive takes precedence. there was a bug whereby the fullscreen directive didn't work unless the allowfullscreen attribute was also present, but this has been fixed as of firefox 80 (bug 1608358). syntax feature-policy: fullscreen <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
...in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the default value is 'self'. examples general example securecorp inc. wants to disable the fullscreen api within all browsing contexts except for its own origin and those whose origin is https://example.com. it can do so by delivering the following http response header to define a feature policy: feature-policy: fullscreen 'self' https://example.com with an <iframe> element fastcorp inc. wants to disable ful...
Feature-Policy: geolocation - HTTP
ionerror code of permission_denied. by default, the geolocation api can be used within top-level documents and their same-origin child frames. this directive allows or prevents cross-origin frames from accessing geolocation. this includes same-origin frames. syntax feature-policy: geolocation <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
...allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. the default value is 'self'. examples general example securecorp inc. wants to disable the geolocation api within all browsing contexts except for its own origin and those whose origin is https://example.com. it can do so by delivering the following http response header to define a feature policy: feature-policy: geolocation 'self' https://example.com with an <iframe> element fastcorp inc. wants to disable ...
Feature-Policy: gyroscope - HTTP
the http feature-policy header gyroscope directive controls whether the current document is allowed to gather information about the orientation of the device through the gyroscope interface. syntax feature-policy: gyroscope <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'no...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
...llowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. the default value is 'self'. specifications specification status comment feature policy editor's draft initial definition. ...
Feature-Policy: layout-animations - HTTP
the http feature-policy header layout-animations directive controls whether the current document is allowed to show layout animations. syntax feature-policy: layout-animations <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and ne...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
...llowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. the default value is 'self'. specifications specification status comment feature policy editor's draft initial definition. ...
Feature-Policy: legacy-image-formats - HTTP
the http feature-policy header legacy-image-formats directive controls whether the current document is allowed to display images in legacy formats. syntax feature-policy: legacy-image-formats <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in ...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
...llowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. the default value is 'self'. specifications specification status comment feature policy editor's draft initial definition. ...
Feature-Policy: magnetometer - HTTP
the http feature-policy header magnetometer directive controls whether the current document is allowed to gather information about the orientation of the device through the magnetometer interface. syntax feature-policy: magnetometer <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attrib...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
...llowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. the default value is 'self'. specifications specification status comment feature policy editor's draft initial definition. ...
Feature-Policy: microphone - HTTP
the http feature-policy header microphone directive controls whether the current document is allowed to use audio input devices. when this policy is enabled, the promise returned by mediadevices.getusermedia() will reject with a notallowederror. syntax feature-policy: microphone <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes fro...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
...llowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. the default value is 'self'. specifications specification status comment feature policy editor's draft initial definition. ...
Feature-Policy: oversized-images - HTTP
the http feature-policy header oversized-images directive controls whether the current document is allowed to download and display large images. syntax feature-policy: oversized-images <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-lev...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
... allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default value the default value is '*'. specification specification status comment feature policy editor's draft initial definition. ...
Feature-Policy: payment - HTTP
the http feature-policy header field's payment directive controls whether the current document is allowed to use the payment request api. when this policy is disabled, the paymentrequest() constructor will throw a syntaxerror. syntax feature-policy: payment <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as t...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
...ts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the payment feature's default allowlist value is 'self'. specifications specification status comment payment request api candidate recommendation see section 16. feature policy integration. feature policy editor's draft initial definition. ...
Feature-Policy: unoptimized-images - HTTP
the http feature-policy header unoptimized-images directive controls whether the current document is allowed to download and display unoptimized images. syntax feature-policy: unoptimized-images <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled ...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
...llowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. the default value is 'self'. specifications specification status comment feature policy editor's draft initial definition. ...
Feature-Policy: unsized-media - HTTP
the size of media elements after the initial layout is complete. this restriction solves "layout instability" problem caused by providing default dimensions for images whose size is not specified in advance so that image doesn't change size after loading. syntax feature-policy: unsized-media <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
... allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default value the default value for unsized-media is '*', that is unsized media elements are allowed for all origins by default. the page will re-flow every time an image with unknown dimensions is loaded. specifications specification status comment feature policy editor's draft initial definition. ...
Feature-Policy: usb - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. ...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
...in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the default value is 'self'. specifications specification status comment feature policy editor's draft initial definition. webusbthe definition of 'feature-policy integration' in that specification. draft default allow list is 'self'. ...
Feature-Policy: vibrate - HTTP
the http feature-policy header vibrate directive controls whether the current document is allowed to trigger device vibrations via navigator.vibrate() method of vibration api. syntax feature-policy: vibrate <allowlist>; <vibrate> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature ...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
...owed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. the default value is 'self'. specifications specification status comment feature policy editor's draft initial definition. ...
web-share - HTTP
the http feature-policy header web-share directive controls controls whether the current document is allowed to use the navigator.share() of web share api to share text, links, images, and other content to arbitrary destiations of user's choice. syntax feature-policy: web-share <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the sam...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
...in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the default value is 'self'. specifications specification status comment feature policy editor's draft initial definition. web share api draft ...
TE - HTTP
Web › HTTP › Headers › TE
the te request header specifies the transfer encodings the user agent is willing to accept. (you could informally call it accept-transfer-encoding, which would be more intuitive). in http/2 - the te header field is only accepted if the trailers value is set. see also the transfer-encoding response header for more details on transfer encodings. note that chunked is always acceptable for http/1.1 recipients and you don't have to specify "chunked" using the te header. ...
...e header field is only accepted if the trailers value is set. see also the transfer-encoding response header for more details on transfer encodings. note that chunked is always acceptable for http/1.1 recipients and you don't have to specify "chunked" using the te header. however, it is useful for setting if the client is accepting trailer fields in a chunked transfer coding using the "trailers" value. header type request header forbidden header name yes syntax te: compress te: deflate te: gzip te: trailers // multiple directives, weighted with the quality value syntax: te: trailers, deflate;q=0.5 directives compress a format using the lempel-ziv-welch (lzw) algorithm is accepted as a transfer coding name. deflate using the zlib structure is accepted a...
...ed as a transfer coding name. deflate using the zlib structure is accepted as a transfer coding name. gzip a format using the lempel-ziv coding (lz77), with a 32-bit crc is accepted as a transfer coding name. trailers indicates that the client is willing to accept trailer fields in a chunked transfer coding. q when multiple transfer codings are acceptable, the q parameter of the quality value syntax can rank codings by preference. specifications specification title rfc 7230, section 4.3: te hypertext transfer protocol (http/1.1): message syntax and routing ...
Transfer-Encoding - HTTP
encoding used to safely transfer the payload body to the user. http/2 doesn't support http 1.1's chunked transfer encoding mechanism, as it provides its own, more efficient, mechanisms for data streaming. transfer-encoding is a hop-by-hop header, that is applied to a message between two nodes, not to a resource itself. each segment of a multi-node connection can use different transfer-encoding values. if you want to compress data over the whole connection, use the end-to-end content-encoding header instead. when present on a response to a head request that has no body, it indicates the value that would have applied to the corresponding get message. header type response header forbidden header name yes syntax transfer-encoding: chunked transfer-encoding: comp...
...eader instead. when present on a response to a head request that has no body, it indicates the value that would have applied to the corresponding get 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 chun...
...ou 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. compress a format using the lempel-ziv-welch (lzw) algorithm. the value name was taken from the unix compress program, which implemented this algorithm. like the compress program, which has disappeared from most unix distributions, this content-encoding is used by almost no browsers today, partly because of a patent issue (which expired in 2003). deflate using the zlib structure (defined in rfc 1950), with the deflate compression algorithm (defined in rfc 1951). ...
Want-Digest - HTTP
the want-digest http header is primarily used in a http request, to ask the responder to provide a digest of the requested resource using the digest response header. the header contains identifiers for one or more digest algorithms that the sender wishes the responder to use to create the digest. the sender may use quality values to indicate its preference ordering among the choices it offers. if want-digest does not include any digest algorithms that the server supports, the server may respond with: a digest calculated using a different digest algorithm, or a 400 bad request error, and include another want-digest header with that response, listing the algorithms that it does support. see the page for the digest header for more information. header type general header ...
...ng a different digest algorithm, or a 400 bad request error, and include another want-digest header with that response, listing the algorithms that it does support. see the page for the digest header for more information. ...
...equest error, and include another want-digest header with that response, listing the algorithms that it does support. see the page for the digest header for more information. header type general header forbidden header name no syntax want-digest: <digest-algorithm> // multiple algorithms, weighted with the quality value syntax: want-digest: <digest-algorithm><q-value>,<digest-algorithm><q-value> directives <digest-algorithm> supported digest algorithms are defined in rfc 3230 and rfc 5843, and include sha-256 and sha-512. some of the supported algorithms, including unixsum and md5 are subject to collisions and are thus not suitable for applications in which collision-resistance is important. <q-value> the quality value to apply to that option. exampl...
POST - HTTP
Web › HTTP › Methods › POST
post may have additional effects, like passing an order several times. a post request is typically sent via an html form and results in a change on the server. ...
...effects, like passing an order several times. a post request is typically sent via an html form and results in a change on the server. in this case, the content type is selected by putting the adequate string in the enctype attribute of the <form> element or the formenctype attribute of the <input> or <button> elements: application/x-www-form-urlencoded: the keys and values are encoded in key-value tuples separated by '&', with a '=' between the key and the value. non-alphanumeric characters in both keys and values are percent encoded: this is the reason why this type is not suitable to use with binary data (use multipart/form-data instead) multipart/form-data: each value is sent as a block of data ("body part"), with a user agent-defined delimiter ("boundary") separating each part. the ke...
...onse 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 rfc 7231...
Protocol upgrade mechanism - HTTP
do so by using semicolon delineation. for example: sec-websocket-extensions: superspeed, colormode; depth=16 sec-websocket-key provides information to the server which is needed in order to confirm that the client is entitled to request an upgrade to websocket. this header can be used when insecure (http) clients wish to upgrade, in order to offer some degree of protection against abuse. the value of the key is computed using an algorithm defined in the websocket specification, so this does not provide security. instead, it helps to prevent non-websocket clients from inadvertently, or through misuse, requesting a websocket connection. in essence, then, this key simply confirms that "yes, i really mean to open a websocket connection." this header is automatically added by clients that choo...
...o use it; it cannot be added using the xmlhttprequest.setrequestheader() method. sec-websocket-key: key key the key for this request to upgrade. the client adds this if it wishes to do so, and the server will include in the response a key of its own, which the client will validate before delivering the upgrade response to you. the server's response's sec-websocket-accept header will have a value computed based upon the specified key. sec-websocket-protocol the sec-websocket-protocol header specifies one or more websocket protocols that you wish to use, in order of preference. the first one that is supported by the server will be selected and returned by the server in a sec-websocket-protocol header included in the response. you can use this more than once in the header, as well; the re...
...the server. response-only headers the response from the server may include these. sec-websocket-accept included in the response message from the server during the opening handshake process when the server is willing to initiate a websocket connection. it will appear no more than once in the response headers. sec-websocket-accept: hash hash if a sec-websocket-key header was provided, the value of this header is computed by taking the value of the key, concatenating the string "258eafa5-e914-47da-95ca-c5ab0dc85b11" to it, taking the sha-1 hash of that concatenated string, resulting in a 20-byte value. that value is then base64 encoded to obtain the value of this property. references websocket api http specifications and rfcs: rfc 7230 rfc 6455 rfc 7540 ...
HTTP range requests - HTTP
you can check this by issuing a head request with curl, for example. ...
...pg 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 managers disable their pause buttons in that case. curl -i https://www.youtube.com/watch?v=ewtz2xpqwpa http/1.1 200 ok ... accept-ranges: none requesting a specific range from a server if the server supports range requests, you can issue such a request by using the range header. it indicates the part(s) of a document that the server should retur...
...der can be used either with a last-modified validator, or with an etag, but not with both. if-range: wed, 21 oct 2015 07:28:00 gmt partial request responses there are three relevant statuses, when working with range requests: in case of a successful range request, the 206 partial content status is sent back from a server. in case of a range request that is out of bounds (none of the range values overlap the extent of the resource, i.e first-byte-pos of all ranges is greater than the resource length), the server responds with a 416 requested range not satisfiable status. in case of no support of range requests, the 200 ok status is sent back from a server. comparison to chunked transfer-encoding the transfer-encoding header allows chunked encoding, which is useful when larger amounts...
CSS Houdini
t, and composite processes — before applying any style updates found in scripts. in addition, layout, paint, and composite processes are repeated for javascript style updates. houdini code doesn't wait for that first rendering cycle to be complete. rather, it is included in that first cycle — creating renderable, understandable styles. houdini provides an object-based api for working with css values in javascript. houdini's css typed om is a css object model with types and methods, exposing values as javascript objects making for more intuitive css manipulation than previous string based htmlelement.style manipulations. every element and style sheet rule has a style map which is accessible via its stylepropertymap. a feature of css houdini is the worklet. with worklets, you can create mod...
... need guidance in learning how to use them. start by reading houdini, an introduction — this provides a brief history of houdini and an overview of its many features. css parser api an api exposing the css parser more directly, for parsing arbitrary css-like languages into a mildly typed representation. no guide or reference has currently been written for this api. ...
... api exposing the css parser more directly, for parsing arbitrary css-like languages into a mildly typed representation. no guide or reference has currently been written for this api. css properties and values api defines an api for registering new css properties. properties registered using this api are provided with a parse syntax that defines a type, inheritance behaviour, and an initial value. css properties and values api reference css properties and values api guide css typed om converting cssom value strings into meaningfully typed javascript representations and back can incur a significant performance overhead. the css typed om exposes css values as typed javascript objects to allow their performant manipulation. css typed om reference css typed om guide css layout ap...
Unicode property escapes - JavaScript
ode code points. see also regexp.prototype.unicode. note: some unicode properties encompasses much more characters than some character classes (such as \w which matches only latin letters, a to z) but the latter is better supported among browsers (as of january 2020). syntax the following section is also duplicated on this cheatsheet. do not forget to edit it as well, thanks! // non-binary values \p{unicodepropertyvalue} \p{unicodepropertyname=unicodepropertyvalue} // binary and non-binary values \p{unicodebinarypropertyname} // negation: \p is negated \p \p{unicodepropertyvalue} \p{unicodebinarypropertyname} general_category (gc) script (sc) script_extensions (scx) see also propertyvaluealiases.txt unicodebinarypropertyname the name of a binary property. e.g.: ascii, alph...
...ertyvalue} \p{unicodebinarypropertyname} general_category (gc) script (sc) script_extensions (scx) see also propertyvaluealiases.txt unicodebinarypropertyname the name of a binary property. e.g.: ascii, alpha, math, diacritic, emoji, hex_digit, math, white_space, etc. see unicode data proplist.txt for more info. unicodepropertyname the name of a non-binary property: unicodepropertyvalue one of the tokens listed in the values section, below. many values have aliases or shorthand (e.g. the value decimal_number for the general_category property may be written nd, digit, or decimal_number). for most values, the unicodepropertyname part and equals sign may be omitted. if a unicodepropertyname is specified, the value must correspond to the property type given. note: as there are m...
...check out tc39 proposal on unicode property escapes for more info. ...
TypeError: setting getter-only property "x" - JavaScript
while this will be silently ignored in non-strict mode, it will throw a typeerror in strict mode. ...
...while this will be silently ignored in non-strict mode, it will throw a typeerror in strict mode. examples property with no setter the example below shows how to set a getter for a property. it doesn't specify a setter, so a typeerror will be thrown upon trying to set the temperature property to 30. ...
...ou will either need to remove line 16, where there is an attempt to set the temperature property, or you will need to implement a setter for it, for example like this: "use strict"; function archiver() { var temperature = null; var archive = []; object.defineproperty(this, 'temperature', { get: function() { console.log('get!'); return temperature; }, set: function(value) { temperature = value; archive.push({ val: temperature }); } }); this.getarchive = function() { return archive; }; } var arc = new archiver(); arc.temperature; // 'get!' arc.temperature = 11; arc.temperature = 13; arc.getarchive(); // [{ val: 11 }, { val: 13 }] ...
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. ...
... if you are creating an array, using the constructor, you probably want to use the literal notation instead, as the first argument is ...
... if you are creating an array, using the constructor, you probably want to use the literal notation instead, as the first argument is interpreted as the length of the array. ...
TypeError: can't delete non-configurable array element - JavaScript
object created by an array initializer are configurable. however, 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. ...
...configurable. however, 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. ...
... non-configurable properties by default if you haven't specified them as configurable. var arr = []; 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...
TypeError: "x" is not a function - JavaScript
some code expects you to provide a function, but that didn't happen. maybe there is a typo in the function name? maybe the object you are calling the method on does not have this function? for example, javascript objects have no map function, but the javascript array object does. ...
...some code expects you to provide a function, but that didn't happen. maybe there is a typo in the function name? maybe the object you are calling the method on does not have this function? for example, javascript objects have no map function, but the javascript array object does. ...
...some code expects you to provide a function, but that didn't happen. maybe there is a typo in the function name? maybe the object you are calling the method on does not have this function? for example, javascript objects have no map function, but the javascript array object does. ...
TypeError: "x" is (not) "y" - JavaScript
also, certain methods, such as object.create() or symbol.keyfor(), require a specific type, that must be provided. ...
...or: unable to get property {x} of undefined or null reference (edge) typeerror: "x" is (not) "y" (firefox) examples: typeerror: "x" is undefined typeerror: "x" is null typeerror: "undefined" is not an object typeerror: "x" is not an object or null typeerror: "x" is not a symbol error type typeerror. what went wrong? there was an unexpected type. this occurs oftentimes with undefined or null values. also, certain methods, such as object.create() or symbol.keyfor(), require a specific type, that must be provided. examples invalid cases // undefined and null cases on which the substring method won't work var foo = undefined; foo.substring(1); // typeerror: foo is undefined var foo = null; foo.substring(1); // typeerror: foo is null // certain methods might require a specific type var ...
... if (foo !== undefined) { // now we know that foo is defined, we are good to go. } if (typeof foo !== 'undefined') { // the same good idea, but don't use this implementation - it can bring problems // because of the confusion between truly undefined and undeclared variables. } ...
Method definitions - JavaScript
efinitions on objects initializers is introduced. it is a shorthand for a function assigned to the method's name. the source for this interactive example is stored in a github repository. if 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 interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax const obj = { get property() {}, set property(value) {}, property( parameters… ) {}, *generator( parameters… ) {}, async property( parameters… ) {}, async* generator( parameters… ) {}, // with computed keys get [property]() {}, set [property](value) {}, [property]( parameters… ) {}, *[generator]( parameters… ) {}, async [property]( parameters… ) {}, async* [generator]( parameters… ) {}, }; description the shorthand syntax is similar to the getter and setter syntax introduced in ecmascript 2015. given the following code: const obj = { foo: function() { // ... }, bar: function() { // ... } } you are now ...
...nd will throw a syntaxerror. always use yield in conjunction with the asterisk (*). // using a named property const obj2 = { g: function* () { let index = 0 while (true) { yield index++ } } }; // the same object using shorthand syntax const obj2 = { * g() { let index = 0 while (true) { yield index++ } } }; const it = obj2.g() console.log(it.next().value) // 0 console.log(it.next().value) // 1 async methods async methods can also be defined using the shorthand syntax. // using a named property const obj3 = { f: async function () { await some_promise } } // the same object using shorthand syntax const obj3 = { async f() { await some_promise } } async generator methods generator methods can also be async. const obj4 = { ...
setter - JavaScript
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. syntax {set prop(val) { . . . }} {set [expression](val) { . . . }} parameters prop the name of the property to bind to the given function. val an alias for the variable that holds the value attempted to be assigned to prop. expression starting with ecmascript 2015, you can also use expressions for a computed property name to bind to the given function. description in javascript, a setter can be used to execute a function whenever a specified property is attempted to be changed. setters are most often used in conjunction with getters to create a type of pseudo-property. it is no...
... you can also use expressions for a computed property name to bind to the given function. description in javascript, a setter can be used to execute a function whenever a specified property is attempted to be changed. setters are most often used in conjunction with getters to create a type of pseudo-property. it is not possible to simultaneously have a setter on a property that holds an actual value. note the following when working with the set syntax: it can have an identifier which is either a number or a string; it must have exactly one parameter (see incompatible es5 change: literal getter and setter functions must now have exactly zero or one arguments for more information); it must not appear in an object literal with another set or with a data entry for the same property. ( {...
... zero or one arguments for more information); it must not appear in an object literal with another set or with a data entry for the same property. ( { set x(v) { }, set x(v) { } } and { x: ..., set x(v) { } } are forbidden ) examples defining a setter on new objects in object initializers the following example define a pseudo-property current of object language. when current is assigned a value, it updates log with that value: const language = { set current(name) { this.log.push(name); }, log: [] } language.current = 'en'; console.log(language.log); // ['en'] language.current = 'fa'; console.log(language.log); // ['en', 'fa'] note that current is not defined, and any attempts to access it will result in undefined. removing a setter with the delete operator if you want t...
Array.prototype.concat() - JavaScript
) method is used to merge two or more arrays. this method does not change the existing arrays, but instead returns a new 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 const new_array = old_array.concat([value1[, value2[, ...[, valuen]]]]) parameters valuen optional arrays and/or values to concatenate into a new array. if all valuen parameters are omitted, concat returns a shallow copy of the existing array on which it is called. see the description below for more details. return value a new array instance. description the concat method creates a new array consisting of the elements in the ob...
...object): concat copies object references into the new array. both the original and new array refer to the same object. that is, if a referenced object is modified, the changes are visible to both the new and original arrays. this includes elements of array arguments that are also arrays. data types such as strings, numbers and booleans (not string, number, and boolean objects): concat copies the values of strings and numbers into the new array. note: concatenating array(s)/value(s) will leave the originals untouched. furthermore, any operation on the new array (except operations on elements which are object references) will have no effect on the original arrays, and vice versa. examples concatenating two arrays the following code concatenates two arrays: const letters = ['a', 'b', 'c']...
...s: const letters = ['a', 'b', 'c']; const numbers = [1, 2, 3]; letters.concat(numbers); // result in ['a', 'b', 'c', 1, 2, 3] concatenating three arrays the following code concatenates three arrays: const num1 = [1, 2, 3]; const num2 = [4, 5, 6]; const num3 = [7, 8, 9]; const numbers = num1.concat(num2, num3); console.log(numbers); // results in [1, 2, 3, 4, 5, 6, 7, 8, 9] concatenating values to an array the following code concatenates three values to an array: const letters = ['a', 'b', 'c']; const alphanumeric = letters.concat(1, [2, 3]); console.log(alphanumeric); // results in ['a', 'b', 'c', 1, 2, 3] concatenating nested arrays the following code concatenates nested arrays and demonstrates retention of references: const num1 = [[1]]; const num2 = [2, [3]]; const numbers...
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 treate...
...ote 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 as array.length + end. fill is intentionally generic: it does not require that its this value be an array object. fill is a mutator method: it will change the array itself and return it, not a copy of 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('...
...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 = relativeend < 0 ? math.max(len + relativeend, 0) : math.min(relativeend, len); // step 12. while (k < finalvalue) { o[k] = value; k++; } // step 13. return o; } }); } if you need to support truly obsolete javascript engines that don't support object.defineproperty, it's best not to polyfill array.prototype methods at all, a...
Array.prototype.flat() - JavaScript
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. syntax var newarray = arr.flat([depth]); parameters depth optional the depth level specifying how deep a nested array structure should be flattened. defaults to 1. return value a new array with the sub-array elements concatenated into it. alternatives reduce and concat const arr = [1, 2, [3, 4]]; // to flat single level array arr.flat(); // is equivalent to arr.reduce((acc, val) => acc.concat(val), []); // [1, 2, 3, 4] // or with decomposition syntax const flattened = arr => [].concat(...arr); reduce + concat + isarray + recursivity const arr = [1, 2, [3, 4, [5...
...latten use recursion with reduce and concat function flatdeep(arr, d = 1) { return d > 0 ? arr.reduce((acc, val) => acc.concat(array.isarray(val) ? ...
...ep(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* flatten(array, depth)...
Array.prototype.lastIndexOf() - JavaScript
, 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 not be searched. return value the last index of the element in the array; -1 if not found. description lastindexof compares searchelement to elements of the array using strict equality (the same method used by the ===, or triple-equals, operator). polyfill lastindexof was added to the ecma-262 standard in the 5th edition; as such it may not be present in other implementations of the standard. you can work around this by...
...ch it may not be present in other implementations of the standard. you can work around this by inserting the following code at the beginning of your scripts, allowing use of lastindexof in implementations which do not natively support it. this algorithm is exactly the one specified in ecma-262, 5th edition, assuming object, typeerror, number, math.floor, math.abs, and math.min have their original values. // production steps of ecma-262, edition 5, 15.4.4.15 // reference: http://es5.github.io/#x15.4.4.15 if (!array.prototype.lastindexof) { array.prototype.lastindexof = function(searchelement /*, fromindex*/) { 'use strict'; if (this === void 0 || this === null) { throw new typeerror(); } var n, k, t = object(this), len = t.length >>> 0; if (len === 0) {...
... this implementation aims for absolute compatibility with lastindexof in firefox and the spidermonkey javascript engine, including in several cases which are arguably edge cases. if you intend to use this in real-world applications, you may be able to calculate from with less complicated code if you ignore those cases. examples using lastindexof the following example uses lastindexof to locate values in an array. var numbers = [2, 5, 9, 2]; numbers.lastindexof(2); // 3 numbers.lastindexof(7); // -1 numbers.lastindexof(2, 3); // 3 numbers.lastindexof(2, 2); // 0 numbers.lastindexof(2, -2); // 0 numbers.lastindexof(2, -1); // 3 finding all the occurrences of an element the following example uses lastindexof to find all the indices of an element in a given array, using push to add...
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). var namelista = new array(4294967296); //2 to the 32nd power = 4294967296 var namelistc = new array(-100) //negative sign console.log(namelista.length); //rangeerror: invalid array length console.log(namelistc...
...rray now contains 3 elements, which causes the third element to be a non-iterable empty slot. const arr = [1, 2]; console.log(arr); // [ 1, 2 ] arr.length = 5; // set array length to 5 while currently 2. console.log(arr); // [ 1, 2, <3 empty items> ] arr.foreach(element => console.log(element)); // 1 // 2 as you can see, the length property does not necessarily indicate the number of defined values in the array. see also relationship between length and numerical properties. property attributes of array.prototype.length writable yes enumerable no configurable no writable: if this attribute set to false, the value of the property cannot be changed. configurable: if this attribute set to fals...
...rable: if this attribute set to false, any attempts to delete the property or change its attributes (writable, configurable, or enumerable) will fail. enumerable: if this attribute set to true, the property will be iterated over during for or for..in loops. examples iterating over an array in the following example, the array numbers is iterated through by looking at the length property. the value in each element is then doubled. var numbers = [1, 2, 3, 4, 5]; var length = numbers.length; for (var i = 0; i < length; i++) { numbers[i] *= 2; } // numbers is now [2, 4, 6, 8, 10] shortening an array the following example shortens the array numbers to a length of 3 if the current length is greater than 3. var numbers = [1, 2, 3, 4, 5]; if (numbers.length > 3) { numbers.length = 3; } ...
Array.prototype.slice() - JavaScript
ndexed 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 references (and not the actual object), slice copies object references into the new array. both the original and new array refer to the same ...
...ay are copied into the returned array as follows: for object references (and not the actual object), slice copies object references into the new array. both the original and new array refer to the same object. if a referenced object changes, the changes are visible to both the new and original arrays. for strings, numbers and booleans (not string, number and boolean objects), slice copies the values into the new array. changes to the string, number, or boolean in one array do not affect the other array. if a new element is added to either array, the other array is not affected. examples return a portion of an existing array let fruits = ['banana', 'orange', 'lemon', 'apple', 'mango'] let citrus = fruits.slice(1, 3) // fruits contains ['banana', 'orange', 'lemon', 'apple', 'mango'] // ...
...reates a new array, newcar, from mycar. both include a reference to the object myhonda. when the color of myhonda is changed to purple, both arrays reflect the change. // using slice, create newcar from mycar. let myhonda = { color: 'red', wheels: 4, engine: { cylinders: 4, size: 2.2 } } let mycar = [myhonda, 2, 'cherry condition', 'purchased 1997'] let newcar = mycar.slice(0, 2) // display the values of mycar, newcar, and the color of myhonda // referenced from both arrays. console.log('mycar = ' + json.stringify(mycar)) console.log('newcar = ' + json.stringify(newcar)) console.log('mycar[0].color = ' + mycar[0].color) console.log('newcar[0].color = ' + newcar[0].color) // change the color of myhonda. myhonda.color = 'purple' console.log('the new color of my honda is ' + myhonda.color) //...
Atomics.add() - JavaScript
the static atomics.add() method adds a given value at a given position in the array and returns the old value at that position. this atomic operation guarantees that no other write happens until the modified value is written back. the source for this interactive example is stored in a github repository. if 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 atomics.add(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to add a value to. value the number to add. ...
...roject, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.add(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to add a value to. value the number to add. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. ...
...alue the number to add. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using add() const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); atomics.add(ta, 0, 12); // returns 0, the old value atomics.load(ta, 0); // 12 specifications specification ecmascript (ecma-262)the definition of 'atomics.add' in that specification. ...
Atomics.compareExchange() - JavaScript
the static atomics.compareexchange() method exchanges a given replacement value at a given position in the array, if a given expected value equals the old value. it returns the old value at that position whether it was equal to the expected value or not. this atomic operation guarantees that no other write happens until the modified value is written back. the source for this interactive example is stored in a github repository. if 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 atomics.compareexchange(typedarray, index, expectedvalue, replacementvalue) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, b...
...s project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.compareexchange(typedarray, index, expectedvalue, replacementvalue) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to exchange a value. expectedvalue the value to check for equality. replacementvalue the number to exchange. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using compareexchange() const sab = new sharedarraybuffer(1024)...
...e the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using compareexchange() const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); ta[0] = 7; atomics.compareexchange(ta, 0, 7, 12); // returns 7, the old value atomics.load(ta, 0); // 12 specifications specification ecmascript (ecma-262)the definition of 'atomics.compareexchange' in that specification. ...
Atomics.exchange() - JavaScript
the static atomics.exchange() method stores a given value at a given position in the array and returns the old value at that position. this atomic operation guarantees that no other write happens between the read of the old value and the write of the new value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.exchange(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to exchange a value. value the number to exchange. ret...
...se clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.exchange(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to exchange a value. value the number to exchange. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. ...
...r to exchange. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using exchange() const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); atomics.exchange(ta, 0, 12); // returns 0, the old value atomics.load(ta, 0); // 12 specifications specification ecmascript (ecma-262)the definition of 'atomics.exchange' in that specification. ...
Atomics.notify() - JavaScript
gents that are sleeping in the wait queue. note: this operation works with a shared int32array only. it will return 0 on non-shared arraybuffer objects. syntax atomics.notify(typedarray, index, count) parameters typedarray a shared int32array. index the position in the typedarray to wake up on. count optional the number of sleeping agents to notify. defaults to +infinity. return value returns the number of woken up agents. returns 0, if a non-shared arraybuffer object is used. exceptions throws a typeerror, if typedarray is not a int32array. throws a rangeerror, if index is out of bounds in the typedarray. examples using notify given a shared int32array: const sab = new sharedarraybuffer(1024); const int32 = new int32array(sab); a reading thread is sleeping an...
...ray is not a int32array. throws a rangeerror, if index is out of bounds in the typedarray. examples using notify given a shared int32array: const sab = new sharedarraybuffer(1024); const int32 = new int32array(sab); a reading thread is sleeping and waiting on location 0 which is expected to be 0. as long as that is true, it will not go on. ...
...unds in the typedarray. examples using notify given a shared int32array: const sab = new sharedarraybuffer(1024); const int32 = new int32array(sab); a reading thread is sleeping and waiting on location 0 which is expected to be 0. as long as that is true, it will not go on. however, once the writing thread has stored a new value, it will be notified by the writing thread and return the new value (123). atomics.wait(int32, 0, 0); console.log(int32[0]); // 123 a writing thread stores a new value and notifies the waiting thread once it has written: console.log(int32[0]); // 0; atomics.store(int32, 0, 123); atomics.notify(int32, 0, 1); specifications specification ecmascript (ecma-262)the definition of 'atomics.notify' in that specification. ...
Atomics.wait() - JavaScript
the static atomics.wait() method verifies that a given position in an int32array still contains a given value and if so sleeps, awaiting a wakeup or a timeout. it returns a string which is either "ok", "not-equal", or "timed-out". note: this operation only works with a shared int32array and may not be allowed on the main thread. syntax atomics.wait(typedarray, index, value[, timeout]) parameters typedarray a shared int32array. index the position in the typedarray to wait on. value the expected value to test. timeout optional time to wait in milliseconds. infinity, if no time is provided. return value a string which is either "ok", "not-equal", or "timed-out". exceptions throws a typeerror, if typedarray is not a shared int32array. throws a rangeerror, if index is out o...
...not a shared int32array. throws a rangeerror, if index is out of bounds in the typedarray. examples using wait() given a shared int32array: const sab = new sharedarraybuffer(1024); const int32 = new int32array(sab); a reading thread is sleeping and waiting on location 0 which is expected to be 0. as long as that is true, it will not go on. ...
...unds in the typedarray. examples using wait() given a shared int32array: const sab = new sharedarraybuffer(1024); const int32 = new int32array(sab); a reading thread is sleeping and waiting on location 0 which is expected to be 0. as long as that is true, it will not go on. however, once the writing thread has stored a new value, it will be notified by the writing thread and return the new value (123). atomics.wait(int32, 0, 0); console.log(int32[0]); // 123 a writing thread stores a new value and notifies the waiting thread once it has written: console.log(int32[0]); // 0; atomics.store(int32, 0, 123); atomics.notify(int32, 0, 1); specifications specification ecmascript (ecma-262)the definition of 'atomics.wait' in that specification. ...
BigInt() constructor - JavaScript
may be a string or an integer. note: bigint() is not used with the new operator. ...
...may be a string or an integer. note: bigint() is not used with the new operator. ...
...may be a string or an integer. note: bigint() is not used with the new operator. ...
Boolean() constructor - JavaScript
the boolean() constructor is used to create boolean 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 boolean([value]) parameters value optional the initial value of the boolean object. ...
... boolean 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 boolean([value]) parameters value optional the initial value of the boolean object. ...
...and send us a pull request. syntax new boolean([value]) parameters value optional the initial value of the boolean object. examples creating boolean objects with an initial value of false var bnoparam = new boolean(); var bzero = new boolean(0); var bnull = new boolean(null); var bemptystring = new boolean(''); var bfalse = new boolean(false); creating boolean objects with an initial value of true var btrue = new boolean(true); var btruestring = new boolean('true'); var bfalsestring = new boolean('false'); var bsulin = new boolean('su lin'); var barrayproto = new boolean([]); var bobjproto = new boolean({}); specifications specification ecmascript (ecma-262)the definition of 'boolean constructor' in that specification. ...
DataView.prototype.setBigInt64() - JavaScript
the setbigint64() method stores a signed 64-bit integer (long long) value at the specified byte offset from the start of the dataview. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dataview.setbigint64(byteoffset, value [, littleendian]) parameters byteoffset the offset, in bytes, from the start of the view to store the data from. value the value to set as a bigint. the highest possible value that fits in a signed 64-bit integer is 2n ** (64n -1n) - 1n (9223372036854775807n). upon overflow, it will be negative (-9223372036854775808n). littleendian optional indicates whether the 64-bit int is stored...
... errors thrown rangeerror thrown if the byteoffset is set such that it would store beyond the end of the view. ...
... errors thrown rangeerror thrown if the byteoffset is set such that it would store beyond the end of the view. ...
DataView.prototype.setBigUint64() - JavaScript
the setbiguint64() method stores an unsigned 64-bit integer (unsigned long long) value at the specified byte offset from the start of the dataview. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dataview.setbiguint64(byteoffset, value [, littleendian]) parameters byteoffset the offset, in bytes, from the start of the view to store the data from. value the value to set as a bigint. the highest possible value that fits in an unsigned 64-bit integer is 2n ** 64n - 1n (18446744073709551615n). upon overflow, it will be zero (0n). littleendian optional indicates whether the 64-bit int is stored in little-...
... errors thrown rangeerror thrown if the byteoffset is set such that it would store beyond the end of the view. ...
... errors thrown rangeerror thrown if the byteoffset is set such that it would store beyond the end of the view. ...
DataView.prototype.setInt8() - JavaScript
errors thrown rangeerror thrown if the byteoffset is set such as it would store beyond the end of the view. ...
... errors thrown rangeerror thrown if the byteoffset is set such as it would store beyond the end of the view. ...
...the start of the dataview. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dataview.setint8(byteoffset, value) parameters byteoffset the offset, in byte, from the start of the view where to store the data. value the value to set. return value undefined. errors thrown rangeerror thrown if the byteoffset is set such as it would store beyond the end of the view. examples using the setint8 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.setint8(1, 3); dataview.getint8(1); // 3 specifications specification ecmascript (ecma-262)the definit...
DataView.prototype.setUint8() - JavaScript
errors thrown rangeerror thrown if the byteoffset is set such as it would store beyond the end of the view. ...
... errors thrown rangeerror thrown if the byteoffset is set such as it would store beyond the end of the view. ...
...he start of the dataview. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dataview.setuint8(byteoffset, value) parameters byteoffset the offset, in byte, from the start of the view where to store the data. value the value to set. return value undefined. errors thrown rangeerror thrown if the byteoffset is set such as it would store beyond the end of the view. examples using the setuint8 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.setuint8(1, 3); dataview.getuint8(1); // 3 specifications specification ecmascript (ecma-262)the defi...
Date.prototype.setDate() - JavaScript
the setdate() method sets the day of the date object relative to the beginning of the currently set month. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.setdate(dayvalue) parameters dayvalue an integer representing the day of the month. ...
...ect relative to the beginning of the currently set month. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.setdate(dayvalue) parameters dayvalue an integer representing the day of the month. return value the number of milliseconds between 1 january 1970 00:00:00 utc and the given date (the date object is also changed in place). description if the dayvalue is outside of the range of date values for the month, setdate() will update the date object accordingly. for example, if 0 is provided for dayvalue, the date will be set to the last day of the previous month. if a negative number is provide...
...-1 would result in the date being set to 1 day before the last day of the previous month. ...
Date.prototype.setUTCHours() - JavaScript
time, and returns the number of milliseconds since january 1, 1970 00:00:00 utc until the time represented by the updated date instance. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.setutchours(hoursvalue[, minutesvalue[, secondsvalue[, msvalue]]]) parameters hoursvalue an integer between 0 and 23, representing the hour. minutesvalue optional. an integer between 0 and 59, representing the minutes. secondsvalue optional. an integer between 0 and 59, representing the seconds. if you specify the secondsvalue parameter, you must also specify the minutesvalue. msvalue optional. a number betw...
...lue an integer between 0 and 23, representing the hour. minutesvalue optional. an integer between 0 and 59, representing the minutes. secondsvalue optional. an integer between 0 and 59, representing the seconds. if you specify the secondsvalue parameter, you must also specify the minutesvalue. msvalue optional. a number between 0 and 999, representing the milliseconds. if you specify the msvalue parameter, you must also specify the minutesvalue and secondsvalue. return value the number of milliseconds between january 1, 1970 00:00:00 utc and the updated date. description if you do not specify the minutesvalue, secondsvalue, and msvalue parameters, the values returned from the getutcminutes(), getutcseconds(), and getutcmilliseconds() methods are used. if a parameter you specify is ...
... updated date. description if you do not specify the minutesvalue, secondsvalue, and msvalue parameters, the values returned from the getutcminutes(), getutcseconds(), and getutcmilliseconds() methods are used. if a parameter you specify is outside of the expected range, setutchours() attempts to update the date information in the date object accordingly. for example, if you use 100 for secondsvalue, the minutes will be incremented by 1 (minutesvalue + 1), and 40 will be used for seconds. examples using setutchours() var thebigday = new date(); thebigday.setutchours(8); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.setutchours' in that specification. ...
Date.prototype.toString() - JavaScript
the tostring() method returns a string representing the specified date 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 dateobj.tostring() return value a string representing the given date. description date instances inherit their tostring() method from date.prototype, not object.prototype. date.prototype.tostring() returns a string representation of the date in the format specified in ecma-262 which can be summarised as: week day: 3 letter english week day name, e.g. "sat" space month name: 3 letter english month name, e.g. "sep" space date: 2 digit day in month, e.g. "01" space year: 4 d...
... "line islands time" or "lint" right bracket, i.e. ")" e.g. "sat sep 01 2018 14:53:26 gmt+1400 (lint)" until ecmascript 2018 (edition 9), the format of the string returned by date.prototype.tostring was implementation dependent. therefore it should not be relied upon to be in the specified format. the tostring() method is automatically called when a date is to be represented as a text value, e.g. console.log(new date()), or when a date is used in a string concatenation, such as var today = 'today is ' + new date(). tostring() is a generic method, it does not require that its this is a date instance. however, it must have an internal [[timevalue]] property that can't be constructed using native javascript, so it's effectively limited to use with date instances. if called on a non–...
...oday is ' + new date(). tostring() is a generic method, it does not require that its this is a date instance. however, it must have an internal [[timevalue]] property that can't be constructed using native javascript, so it's effectively limited to use with date instances. if called on a non–date instance, a typeerror is thrown. examples using tostring() the following assigns the tostring() value of a date object to myvar: var x = new date(); var myvar = x.tostring(); // assigns a string value to myvar in the same format as: // mon sep 08 1998 14:36:22 gmt-0700 (pdt) specifications specification ecmascript (ecma-262)the definition of 'date.prototype.tostring' in that specification. ...
Function.caller - JavaScript
it's also null for strict, async function and generator function callers. this property replaces the obsolete arguments.caller property of the arguments object. ...
... function myfunc() { if (myfunc.caller == null) { return 'the function was called from the top!'; } else { return 'this function\'s caller was ' + myfunc.caller; } } specifications not part of any standard. ...
... f(1) -> g(0) -> stop() the following is true: stop.caller === g && f.caller === g && g.caller === f so if you tried to get the stack trace in the stop() function like this: var f = stop; var stack = 'stack trace:'; while (f) { stack += '\n' + f.name; f = f.caller; } the loop would never stop. examples checking the value of a function's caller property the following code checks the value a function's caller property. function myfunc() { if (myfunc.caller == null) { return 'the function was called from the top!'; } else { return 'this function\'s caller was ' + myfunc.caller; } } specifications not part of any standard. ...
Function.length - JavaScript
s of function.length writable no enumerable no configurable yes description length is a property of a function object, and indicates how many arguments the function expects, i.e. the number of formal parameters. this number excludes the rest parameter and only includes parameters before the first one with a default value. by contrast, arguments.length is local to a function and 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 l...
... 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. */ console.log((function(...args) {}).length); // 0, rest parameter is not counted console.log((function(a, b = 1, c) {}).length); // 1, only parameters before ...
... ...
Generator.prototype.return() - JavaScript
the return() method returns the given value and finishes the generator. syntax gen.return(value) parameters value the value to return. return value the value that is given as an argument. examples using return() the following example shows a simple generator and the return method. function* gen() { yield 1; yield 2; yield 3; } const g = gen(); g.next(); // { value: 1, done: false } g.return('foo'); // { value: "foo", done: true } g.next(); // { value: undefined, done: true } if return(value) is called on a generator that is already in "completed" state, the generator will remain in "completed" state. if no argument is provided, the value property of returned object is the same as if .next(). ...
...value: 1, done: false } g.return('foo'); // { value: "foo", done: true } g.next(); // { value: undefined, done: true } if return(value) is called on a generator that is already in "completed" state, the generator will remain in "completed" state. if no argument is provided, the value property of returned object is the same as if .next(). if an argument is provided, it will be set to the value of the value property of the returned object. ...
...alue) is called on a generator that is already in "completed" state, the generator will remain in "completed" state. if no argument is provided, the value property of returned object is the same as if .next(). if an argument is provided, it will be set to the value of the value property of the returned object. function* gen() { yield 1; yield 2; yield 3; } const g = gen(); g.next(); // { value: 1, done: false } g.next(); // { value: 2, done: false } g.next(); // { value: 3, done: false } g.next(); // { value: undefined, done: true } g.return(); // { value: undefined, done: true } g.return(1); // { value: 1, done: true } specifications specification ecmascript (ecma-262)the definition of 'generator.prototype.return' in that specification. ...
Intl.Collator.prototype.resolvedOptions() - JavaScript
a new object with properties reflecting the locale and collation options computed during initialization of this collator 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. ...
...om/mdn/interactive-examples and send us a pull request. syntax collator.resolvedoptions() return value a new object with properties reflecting the locale and collation options computed during the initialization of the given collator 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. ...
...given collator 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. usage sensitivity ignorepunctuation the values provided for these properties in the options argument or filled in as defaults. collation the value requested using the unicode extension key "co", if it is supported for locale, or "default". numeric casefirst the values requested for these properties in the options argument or using the unicode extension keys "kn" and "kf" or filled in as defaults. if the implementation does not support t...
Intl.DisplayNames.prototype.resolvedOptions() - JavaScript
the intl.displaynames.prototype.resolvedoptions() method returns a new object with properties reflecting the locale and style formatting options computed during the construction of the current displaynames object. syntax displaynames.resolvedoptions() return value an object with properties reflecting the locale and formatting options computed during the construction of the given displaynames object. ...
...he current displaynames object. syntax displaynames.resolvedoptions() return value an object with properties reflecting the locale and formatting options computed during the construction of the given displaynames object. description the object returned by resolvedoptions() 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 value provided for this property in the options argument of the constructor or the default value ("long"). ...
...perties: 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 value provided for this property in the options argument of the constructor or the default value ("long"). its value is either "long", "short", or "narrow". type the value provided for this property in the options argument of the constructor or the default value ("language"). its value is either "language", "region", "script", or "currency". fallback the value provided for this property in the options argument of the constructor or the default value ("code"). its value is either "code" or "none". examples...
Intl.RelativeTimeFormat.prototype.formatToParts() - JavaScript
od returns an array of objects representing the relative time format in parts that can be used for custom locale-aware formatting. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax relativetimeformat.formattoparts(value, unit) parameters value numeric value to use in the internationalized relative time message. unit unit to use in the relative time internationalized message. possible values are: "year", "quarter", "month", "week", "day", "hour", "minute", "second". plural forms are also permitted. return value an array of objects containing the formatted relative time in parts. description the int...
...ormatted relative time in parts. description the intl.relativetimeformat.prototype.formattoparts method is a version of the format method which it returns an array of objects which represent "parts" of the object, separating the formatted number into its consituent parts and separating it from other surrounding text. these objects have two properties: type a numberformat formattoparts type, and value, which is the string which is the component of the output. if a "part" came from numberformat, it will have a unit property which indicates the unit being formatted; literals which are part of the larger frame will not have this property. examples using formattoparts const rtf = new intl.relativetimeformat("en", { numeric: "auto" }); // format relative time using the day unit rtf.formattopart...
...onent of the output. if a "part" came from numberformat, it will have a unit property which indicates the unit being formatted; literals which are part of the larger frame will not have this property. examples using formattoparts const rtf = new intl.relativetimeformat("en", { numeric: "auto" }); // format relative time using the day unit rtf.formattoparts(-1, "day"); // > [{ type: "literal", value: "yesterday"}] rtf.formattoparts(100, "day"); // > [{ type: "literal", value: "in " }, // > { type: "integer", value: "100", unit: "day" }, // > { type: "literal", value: " days" }] specifications specification status comment ecmascript internationalization api (ecma-402)the definition of 'relativetimeformat.formattoparts()' in that specification. stage 4 ...
Intl.RelativeTimeFormat.prototype.resolvedOptions() - JavaScript
ting the locale and relative time formatting options computed during initialization of this relativetimeformat object. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...and send us a pull request. syntax relativetimeformat.resolvedoptions() return value a new object with properties reflecting the locale and number formatting options computed during the initialization of the given relativetimeformat object. description the resulting object has the following properties: locale the bcp 47 language tag for the locale actually used. if any unicode extension values were requested in the input bcp 47 language tag that led to this locale, the key-value pairs that were requested and are supported for this 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 f...
...ale, 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 have to use numeric values in the output. numberingsystem the value requested using the unicode extension key "nu" or filled in as a default. examples using the resolvedoptions method var de = new intl.relativetimeformat('de-de'); var usedoptions = de.resolvedoptions(); u...
Intl.RelativeTimeFormat - JavaScript
ll request. constructor intl.relativetimeformat.relativetimeformat() creates a new intl.relativetimeformat object. static methods intl.relativetimeformat.supportedlocalesof() returns an array containing those of the provided locales that are supported without having to fall back to the runtime's default locale. instance methods intl.relativetimeformat.prototype.format() formats a value and a unit according to the locale and formatting options of the given intl.relativetimeformat object. intl.relativetimeformat.prototype.formattoparts() returns an array of objects representing the relative time format in parts that can be used for custom locale-aware formatting. intl.relativetimeformat.prototype.resolvedoptions() returns a new object with properties reflecting the locale and...
...m locale-aware formatting. intl.relativetimeformat.prototype.resolvedoptions() returns a new object with properties reflecting the locale and formatting options computed during initialization of the object. examples basic format usage the following example shows how to use a relative time formatter for the english language. // create a relative time formatter in your locale // with default values explicitly passed in. const rtf = new intl.relativetimeformat("en", { localematcher: "best fit", // other values: "lookup" numeric: "always", // other values: "auto" style: "long", // other values: "short" or "narrow" }); // format relative time using negative value (-1). rtf.format(-1, "day"); // > "1 day ago" // format relative time using positive value (1). rtf.format(1, "day")...
..."day"); // > "1 day ago" // format relative time using positive value (1). rtf.format(1, "day"); // > "in 1 day" using formattoparts the following example shows how to create a relative time formatter returning formatted parts const rtf = new intl.relativetimeformat("en", { numeric: "auto" }); // format relative time using the day unit. rtf.formattoparts(-1, "day"); // > [{ type: "literal", value: "yesterday"}] rtf.formattoparts(100, "day"); // > [{ type: "literal", value: "in " }, // > { type: "integer", value: "100", unit: "day" }, // > { type: "literal", value: " days" }] specifications specification status comment ecmascript internationalization api (ecma-402)the definition of 'relativetimeformat' in that specification. ...
Intl - JavaScript
.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, (optionally) one or more variant codes, and (optionally) one or more extension sequences, with all pr...
...n the runtime's default locale is used. the matcher can be selected using a property of the options argument (see below). if the selected language tag had a unicode extension substring, that extension is now used to customize the constructed object or the behavior of the function. each constructor or function supports only a subset of the keys defined for the unicode extension, and the supported values often depend on the language tag. for example, the "co" key (collation) is only supported by collator, and its "phonebk" value is only supported for german. options argument the options argument must be an object with properties that vary between constructors and functions. if the options argument is not provided or is undefined, default values are used for all properties. one property is sup...
...collator, and its "phonebk" value is only supported for german. options argument the options argument must be an object with properties that vary between constructors and functions. if the options argument is not provided or is undefined, default values are used for all properties. one property is supported by all language sensitive constructors and functions: the localematcher property, whose value must be a string "lookup" or "best fit" and which selects one of the locale matching algorithms described above. examples formatting dates and numbers you can use intl to format dates and numbers in a form that's conventional for a specific language and region: const count = 26254.39; const date = new date("2012-05-24"); function log(locale) { console.log( `${new intl.datetimeformat(lo...
Math - JavaScript
y 2.303. math.log2e base-2 logarithm of e; approximately 1.443. math.log10e base-10 logarithm of e; approximately 0.434. math.pi ratio of the a circle's circumference to its diameter; approximately 3.14159. math.sqrt1_2 square root of ½ (or equivalently, 1/√2); approximately 0.707. math.sqrt2 square root of 2; approximately 1.414. static methods math.abs(x) returns the absolute value of x. math.acos(x) returns the arccosine of x. math.acosh(x) returns the hyperbolic arccosine of x. math.asin(x) returns the arcsine of x. math.asinh(x) returns the hyperbolic arcsine of a number. math.atan(x) returns the arctangent of x. math.atanh(x) returns the hyperbolic arctangent of x. math.atan2(y, x) returns the arctangent of the quotient of its arguments. math.cbrt(x) ret...
...x) returns the base-10 logarithm of x. math.log2(x) returns the base-2 logarithm of x. math.max([x[, y[, …]]]) returns the largest of zero or more numbers. math.min([x[, y[, …]]]) returns the smallest of zero or more numbers. math.pow(x, y) returns base x to the exponent power y (that is, xy). math.random() returns a pseudo-random number between 0 and 1. math.round(x) returns the value of the number x rounded to the nearest integer. math.sign(x) returns the sign of the x, indicating whether x is positive, negative, or zero. math.sin(x) returns the sine of x. math.sinh(x) returns the hyperbolic sine of x. math.sqrt(x) returns the positive square root of x. math.tan(x) returns the tangent of x. math.tanh(x) returns the hyperbolic tangent of x. math.trunc(x) returns ...
...riangle if we want to calculate the height of an equalateral triangle, and we know its side length is 100, we can use the formulae length of the adjacent multiplied by the tangent of the angle is equal to the opposite. 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(): function random(min, max) { const num = math.floor(math.random() * (max - min + 1)) + min; return num; } random(1, 10); specifications specification ecmascript (ecma-262)the definition of 'math' in that specification. ...
Number.prototype.toFixed() - JavaScript
a number using fixed-point notation. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax numobj.tofixed([digits]) parameters digits optional the number of digits to appear after the decimal point; this may be a value between 0 and 20, inclusive, and implementations may optionally support a larger range of values. if this argument is omitted, it is treated as 0. return value a string representing the given number using fixed-point notation. exceptions rangeerror if digits is too small or too large. values between 0 and 100, inclusive, will not cause a rangeerror. implementations are allowed to support ...
...inclusive, and implementations may optionally support a larger range of values. if this argument is omitted, it is treated as 0. return value a string representing the given number using fixed-point notation. exceptions rangeerror if digits is too small or too large. values between 0 and 100, inclusive, will not cause a rangeerror. implementations are allowed to support larger and smaller values as chosen. typeerror if this method is invoked on an object that is not a number. description tofixed() returns a string representation of numobj that does not use exponential notation and has exactly digits digits after the decimal place. ...
... 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 . ...
Object.prototype.__lookupSetter__() - JavaScript
the __lookupsetter__ method returns the function bound as a setter to the specified property. syntax obj.__lookupsetter__(sprop) parameters sprop a string containing the name of the property whose setter should be returned. return value the function bound as a setter to the specified property. description if a setter has been defined for an object's property, it was not possible to reference the setter function through that property, because that property refers to the return value of that function. ...
...ossible to reference the setter function through that property, because that property refers to the return value of that function. __lookupsetter__ can be used to obtain a reference to the setter function. it is now possible to do this in a standardized way using object.getownpropertydescriptor(). ...
... setter function through that property, because that property refers to the return value of that function. __lookupsetter__ can be used to obtain a reference to the setter function. it is now possible to do this in a standardized way using object.getownpropertydescriptor(). examples standard-compliant and non-standard ways to get a property setter var obj = { set foo(value) { this.bar = value; } }; // non-standard and deprecated way obj.__lookupsetter__('foo') // (function(value) { this.bar = value; }) // standard-compliant way object.getownpropertydescriptor(obj, 'foo').set; // (function(value) { this.bar = value; }) specifications specification ecmascript (ecma-262)the definition of 'object.prototype.__lookupsetter__()' in that specification. ...
Object.fromEntries() - JavaScript
the object.fromentries() method transforms a list of key-value pairs into an 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 object.fromentries(iterable); parameters iterable an iterable such as array or map or other objects implementing the iterable protocol. return value a new object whose properties are given by the entries of the iterable. description the object.fromentries() method takes a list of key-value pairs and returns a new object whose properties are given by those entries. the iterable argument is expected to be an object that implements an @@iterator method, that returns an it...
... object.fromentries() performs the reverse of object.entries(). ...
... object.fromentries() performs the reverse of object.entries(). ...
Object.getOwnPropertyDescriptors() - JavaScript
the object.getownpropertydescriptors() method returns all own property descriptors of a given object. syntax object.getownpropertydescriptors(obj) parameters obj the object for which to get all own property descriptors. return value an object containing all own property descriptors of an object. might be an empty object, if there are no properties. description this method permits examination of the precise description of all own properties of an object. ...
...npropertydescriptors(obj) parameters obj the object for which to get all own property descriptors. return value an object containing all own property descriptors of an object. might be an empty object, if there are no properties. description this method permits examination of the precise description of all own properties of an object. a property in javascript consists of either a string-valued name or a symbol and a property descriptor. further information about property descriptor types and their attributes can be found in object.defineproperty(). ...
...cription this method permits examination of the precise description of all own properties of an object. a property in javascript consists of either a string-valued name or a symbol and a property descriptor. further information about property descriptor types and their attributes can be found in object.defineproperty(). a property descriptor is a record with some of the following attributes: value the value associated with the property (data descriptors only). writable true if and only if the value associated with the property may be changed (data descriptors only). get a function which serves as a getter for the property, or undefined if there is no getter (accessor descriptors only). set a function which serves as a setter for the property, or undefined if there is no setter (acce...
Object.getOwnPropertyNames() - JavaScript
the object.getownpropertynames() method returns an array of all properties (including non-enumerable properties except for those which use symbol) found directly in a given object. syntax object.getownpropertynames(obj) parameters obj the object whose enumerable and non-enumerable properties are to be returned. return value an array of strings that corresponds to the properties found directly in the given object. description object.getownpropertynames() returns an array whose elements are strings corresponding to the enumerable and non-enumerable properties found directly in a given object obj. the ordering of the enumerable properties in the array is consistent with the ordering exposed by a for...in loop (or by object.keys()) over the properties of the object. the ordering of t...
...5 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. ...
...nsole.log(object.getownpropertynames(obj).sort()); // .sort() is an array method. ...
Object.prototype.hasOwnProperty() - JavaScript
operty as its own property (as opposed to inheriting it). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax obj.hasownproperty(prop) parameters prop the string name or symbol of the property to test. return value a boolean indicating whether or not the object has the specified property as own property. description all descendents of object inherit the hasownproperty method. this method can be used to determine whether an object has the specified property as a direct property of that object; unlike the in operator, this method does not check for a property in the object's prototype chain. if an object i...
...ndents of object inherit the hasownproperty method. this method can be used to determine whether an object has the specified property as a direct property of that object; unlike the in operator, this method does not check for a property in the object's prototype chain. if an object is an array, hasownproperty method can check whether an index exists. note hasownproperty returns true even if the value of the property is null or undefined. o = new object(); o.propone = null; o.hasownproperty('propone'); // returns true o.proptwo = undefined; o.hasownproperty('proptwo'); // returns true examples using hasownproperty to test for a property's existence the following example determines whether the o object contains a property named prop: o = new object(); o.hasownproperty('prop'); // re...
...in loop is already only iterating enumerable items, so one should not assume based on the lack of non-enumerable properties shown in the loop that hasownproperty itself is confined strictly to enumerable items (as with object.getownpropertynames()). var buz = { fog: 'stack' }; for (var name in buz) { if (buz.hasownproperty(name)) { console.log('this is fog (' + name + ') for sure. ...
Object.keys() - JavaScript
d in the same order that a normal loop would. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.keys(obj) parameters obj the object of which the enumerable's own properties are to be returned. return value an array of strings that represent all the enumerable properties of the given object. description object.keys() returns an array whose elements are strings corresponding to the enumerable properties found directly upon object. the ordering of the properties is the same as that given by looping over the properties of the object manually. polyfill to add compatible object.keys support in older...
...ly support it, copy the following snippet: // from /docs/web/javascript/reference/global_objects/object/keys if (!object.keys) { object.keys = (function() { 'use strict'; var hasownproperty = object.prototype.hasownproperty, hasdontenumbug = !({ tostring: null }).propertyisenumerable('tostring'), dontenums = [ 'tostring', 'tolocalestring', 'valueof', 'hasownproperty', 'isprototypeof', 'propertyisenumerable', 'constructor' ], dontenumslength = 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; fo...
... non-object coercion in es5, if the argument to this method is not an object (a primitive), then it will cause a typeerror. from es2015 onwards, a non-object argument will be coerced to an objec...
handler.getPrototypeOf() - JavaScript
in a github repository. if 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 const p = new proxy(obj, { getprototypeof(target) { ... } }); parameters the following parameter is passed to the getprototypeof() method. this is bound to the handler. target the target object. return value the getprototypeof() method must return an object or null. description interceptions this trap can intercept these operations: object.getprototypeof() reflect.getprototypeof() __proto__ object.prototype.isprototypeof() instanceof invariants if the following invariants are violated, the proxy will throw a typeerror: getprototypeof() method must return an object or null. if target...
...terceptions this trap can intercept these operations: object.getprototypeof() reflect.getprototypeof() __proto__ object.prototype.isprototypeof() instanceof invariants if the following invariants are violated, the proxy will throw a typeerror: getprototypeof() method must return an object or null. if target is not extensible, object.getprototypeof(proxy) method must return the same value as object.getprototypeof(target). examples basic usage const obj = {}; const proto = {}; const handler = { getprototypeof(target) { console.log(target === obj); // true console.log(this === handler); // true return proto; } }; const p = new proxy(obj, handler); console.log(object.getprototypeof(p) === proto); // true five ways to trigger the getprototyp...
... ...
handler.ownKeys() - 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 const p = new proxy(target, { ownkeys: function(target) { } }); parameters the following parameter is passed to the ownkeys() method. this is bound to the handler. target the target object. return value the ownkeys() method must return an enumerable object. description the handler.ownkeys() method is a trap for reflect.ownkeys(). interceptions this trap can intercept these operations: object.getownpropertynames() object.getownpropertysymbols() object.keys() reflect.ownkeys() invariants if the following invariants are violated, the proxy will throw a typeerror: the result of ownk...
...re violated, the proxy will throw a typeerror: the result of ownkeys() must be an array. the type of each array element is either a string or a symbol. the result list must contain the keys of all non-configurable own properties of the target object. if the target object is not extensible, then the result list must contain all the keys of the own properties of the target object and no other values. examples trapping of getownpropertynames the following code traps object.getownpropertynames(). const p = new proxy({}, { ownkeys: function(target) { console.log('called'); return ['a', 'b', 'c']; } }); console.log(object.getownpropertynames(p)); // "called" // [ 'a', 'b', 'c' ] the following code violates an invariant. const obj =...
...wnpropertynames(). const p = new proxy({}, { ownkeys: function(target) { console.log('called'); return ['a', 'b', 'c']; } }); console.log(object.getownpropertynames(p)); // "called" // [ 'a', 'b', 'c' ] the following code violates an invariant. ...
handler.setPrototypeOf() - JavaScript
ve examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax const p = new proxy(target, { setprototypeof: function(target, prototype) { } }); parameters the following parameters are passed to the setprototypeof() method. this is bound to the handler. target the target object. prototype the object's new prototype or null. return value the setprototypeof() method returns true if the [[prototype]] was successfully changed, otherwise false. description the handler.setprototypeof() method is a trap for object.setprototypeof(). interceptions this trap can intercept these operations: object.setprototypeof() reflect.setprototypeof() invariants if the following invariants are violated, the proxy will throw a typeerror: ...
...ccessfully changed, otherwise false. description the handler.setprototypeof() method is a trap for object.setprototypeof(). interceptions this trap can intercept these operations: object.setprototypeof() reflect.setprototypeof() invariants if the following invariants are violated, the proxy will throw a typeerror: if target is not extensible, the prototype parameter must be the same value as object.getprototypeof(target). examples if you want to disallow setting a new prototype for your object, your handler's setprototypeof() method can either return false, or it can throw an exception. approach 1: returning false this approach means that any mutating operation that throws an exception on failure to mutate, must create the exception itself. for example, object.setprototypeof...
...1 = new proxy(target, handlerreturnsfalse); object.setprototypeof(p1, newproto); // throws a typeerror reflect.setprototypeof(p1, newproto); // returns false approach 2: throwing an exception the latter approach will cause any operation that attempts to mutate, to throw. this approach is best if you want even non-throwing operations to throw on failure, or you want to throw a custom exception value. const handlerthrows = { setprototypeof(target, newproto) { throw new error('custom error'); } }; const newproto = {}, target = {}; const p2 = new proxy(target, handlerthrows); object.setprototypeof(p2, newproto); // throws new error("custom error") reflect.setprototypeof(p2, newproto); // throws new error("custom error") specifications specification ec...
RangeError() constructor - JavaScript
the rangeerror() constructor creates an error when a value is not in the set or range of allowed values. syntax new rangeerror([message[, filename[, linenumber]]]) parameters message optional human-readable description of the error. ...
...hen a value is not in the set or range of allowed values. syntax new rangeerror([message[, filename[, linenumber]]]) parameters message optional human-readable description of the error. ...
... line number of the code that caused the exception examples using rangeerror (for numeric values) function check(n) { if( !(n >= -500 && n <= 500) ) { throw new rangeerror("the argument must be between -500 and 500.") } } try { check(2000) } catch(error) { if (error instanceof rangeerror) { // handle the error } } using rangeerror (for non-numeric values) function check(value) { if(["apple", "banana", "carrot"].includes(value) === false) { throw new rangeerror('the argument must be an "apple", "banana", or "carrot".') } } try { check("cabbage") } catch(error) { if(error instanceof rangeerror) { // handle the error } } specifications specification ecmascript (ecma-262)the defi...
Reflect.set() - JavaScript
the static reflect.set() method works like setting a property on an 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 reflect.set(target, propertykey, value[, receiver]) parameters target the target object on which to set the property. propertykey the name of the property to set. value the value to set. receiver optional the value of this provided for the call to target if a setter is encountered. return value a boolean indicating whether or not setting the property was successful. exceptions a typeerror, if target is not an object. description the reflect.set method allows you to set...
...ncountered. return value a boolean indicating whether or not setting the property was successful. exceptions a typeerror, if target is not an object. description the reflect.set method 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". ...
...j, '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. ...
String.prototype[@@iterator]() - JavaScript
the [@@iterator]() method returns a new iterator object that iterates over the code points of a string value, returning each code point as a string value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str[symbol.iterator] return value a new iterator object. ...
... interactive example is stored in a github repository. if 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[symbol.iterator] return value a new iterator object. ...
... repository. if 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[symbol.iterator] return value a new iterator object. examples using [@@iterator]() var str = 'a\ud835\udc68'; var striter = str[symbol.iterator](); console.log(striter.next().value); // "a" console.log(striter.next().value); // "\ud835\udc68" using [@@iterator]() with for..of var str = 'a\ud835\udc68b\ud835\udc69c\ud835\udc6a'; for (var v of str) { console.log(v); } // "a" // "\ud835\udc68" // "b" // "\ud835\udc69" // "c" // "\ud835\udc6a" specifications specification ecmascript (ecma-262)the definition of 'string.prototype[@@iterator]()' in that specification. ...
String.prototype.match() - JavaScript
ct, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.match(regexp) parameters regexp a regular expression object. if regexp is a non-regexp object, it is implicitly converted to a regexp by using new regexp(regexp). if you don't give any parameter and use the match() method directly, you will get an array with an empty string: [""]. return value an array whose contents depend on the presence or absence of the global (g) flag, or null if no matches are found. if the g flag is used, all results matching the complete regular expression will be returned, but capturing groups will not. if the g flag is not used, only the first complete match and its related capturing groups are returned. in this case, the returned item will have addition...
...capturing groups will not. if the g flag is not used, only the first complete match and its related capturing groups are returned. in this case, the returned item will have additional properties as described below. additional properties as explained above, some results contain additional properties as described below. groups an object of named capturing groups whose keys are the names and values are the capturing groups or undefined if no named capturing groups were defined. see groups and ranges for more information. index the index of the search at which the result was found. input a copy of the search string. description if the regular expression does not include the g flag, str.match() will return the same result as regexp.exec(). other methods if you need to know if a st...
... chapter 3.4.5.1'; const re = /see (chapter \d+(\.\d)*)/i; const found = str.match(re); console.log(found); // logs [ 'see chapter 3.4.5.1', // 'chapter 3.4.5.1', // '.1', // index: 22, // input: 'for more information, see chapter 3.4.5.1' ] // 'see chapter 3.4.5.1' is the whole match. // 'chapter 3.4.5.1' was captured by '(chapter \d+(\.\d)*)'. // '.1' was the last value captured by '(\.\d)'. // the 'index' property (22) is the zero-based index of the whole match. // the 'input' property is the original string that was parsed. using global and ignore case flags with match() the following example demonstrates the use of the global and ignore case flags with match(). all letters a through e and a through e are returned, each its own element in the array. const s...
String.prototype.substring() - JavaScript
y. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.substring(indexstart[, indexend]) parameters indexstart the index of the first character to include in the returned substring. indexend optional the index of the first character to exclude from the returned substring. return value a new string containing the specified part of the given string. description substring() extracts characters from indexstart up to but not including indexend. in particular: if indexend is omitted, substring() extracts characters to the end of the string. if indexstart is equal to indexend, substring() returns an empty string. if indexstart is greater than indexend, then the effect of subs...
...string() extracts characters from indexstart up to but not including indexend. in particular: if indexend is omitted, substring() extracts characters to the end of the string. if indexstart is equal to indexend, substring() returns an empty string. if 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(anystrin...
...the case. let text = 'mozilla' console.log(text.substring(5, 2)) // => "zil" console.log(text.slice(5, 2)) // => "" if either or both of the arguments are negative or nan, the substring() method treats them as if they were 0. console.log(text.substring(-5, 2)) // => "mo" console.log(text.substring(-5, -2)) // => "" slice() also treats nan arguments as 0, but when it is given negative values it counts backwards from the end of the string to find the indexes. console.log(text.slice(-5, 2)) // => "" console.log(text.slice(-5, -2)) // => "zil" see the slice() page for more examples with negative numbers. replacing a substring within a string the following example replaces a substring within a string. it will replace both individual characters and substrings. the function call a...
String.prototype.toLocaleLowerCase() - JavaScript
the tolocalelowercase() method returns the calling string value converted to lower case, according to any locale-specific case mappings. the source for this interactive example is stored in a github repository. if 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.tolocalelowercase() str.tolocalelowercase(locale) str.tolocalelowercase([locale, locale, ...]) parameters locale optional the locale parameter indicates the locale to be used to convert to lower case according to any locale-specific case mappings. if multiple locales are given in an array, the best available locale is used. ...
...calelowercase() str.tolocalelowercase(locale) str.tolocalelowercase([locale, locale, ...]) parameters locale optional the locale parameter indicates the locale to be used to convert to lower case according to any locale-specific case mappings. if multiple locales are given in an array, the best available locale is used. the default locale is the host environment’s current locale. return value a new string representing the calling string converted to lower case, according to any locale-specific case mappings. exceptions a rangeerror ("invalid language tag: xx_yy") is thrown if a locale argument isn't a valid language tag. a typeerror ("invalid element in locales argument") is thrown if an array element isn't of type string. description the tolocalelowercase() method returns th...
...a new string representing the calling string converted to lower case, according to any locale-specific case mappings. exceptions a rangeerror ("invalid language tag: xx_yy") is thrown if a locale argument isn't a valid language tag. a typeerror ("invalid element in locales argument") is thrown if an array element isn't of type string. description the tolocalelowercase() method returns the value of the string converted to lower case according to any locale-specific case mappings. tolocalelowercase() does not affect the value of the string itself. in most cases, this will produce the same result as tolowercase(), 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. examples using tolocalelowercase...
String.prototype.toLocaleUpperCase() - JavaScript
the tolocaleuppercase() method returns the calling string value converted to upper case, according to any locale-specific case mappings. the source for this interactive example is stored in a github repository. if 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.tolocaleuppercase() str.tolocaleuppercase(locale) str.tolocaleuppercase([locale, locale, ...]) parameters locale optional the locale parameter indicates the locale to be used to convert to upper case according to any locale-specific case mappings. if multiple locales are given in an array, the best available locale is used. ...
...caleuppercase() str.tolocaleuppercase(locale) str.tolocaleuppercase([locale, locale, ...]) parameters locale optional the locale parameter indicates the locale to be used to convert to upper case according to any locale-specific case mappings. if multiple locales are given in an array, the best available locale is used. the default locale is the host environment’s current locale. return value a new string representing the calling string converted to upper case, according to any locale-specific case mappings. exceptions a rangeerror ("invalid language tag: xx_yy") is thrown if a locale argument isn't a valid language tag. a typeerror ("invalid element in locales argument") is thrown if an array element isn't of type string. description the tolocaleuppercase() method returns th...
...a new string representing the calling string converted to upper case, according to any locale-specific case mappings. exceptions a rangeerror ("invalid language tag: xx_yy") is thrown if a locale argument isn't a valid language tag. a typeerror ("invalid element in locales argument") is thrown if an array element isn't of type string. description the tolocaleuppercase() method returns the value of the string converted to upper case according to any locale-specific case mappings. tolocaleuppercase() does not affect the value of the string itself. in most cases, this will produce the same result as touppercase(), but for some locales, such as turkish, whose case mappings do not follow the default case mappings in unicode, there may be a different result. also notice that conversion is no...
TypeError - JavaScript
constructor typeerror() creates a new typeerror object. instance properties typeerror.prototype.message error message. ...
... constructor typeerror() creates a new typeerror object. instance properties typeerror.prototype.message error message. ...
... constructor typeerror() creates a new typeerror object. instance properties typeerror.prototype.message error message. ...
TypedArray.prototype.fill() - JavaScript
the fill() method fills all the elements of a typed array from a start index to an end index with a static value. 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 t...
... 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. ...
... 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. ...
TypedArray.from() - JavaScript
y.from(source[, mapfn[, thisarg]]) where typedarray is one of: int8array uint8array uint8clampedarray int16array uint16array int32array uint32array float32array float64array bigint64array 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() f...
...n 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 working with proxy objects, it calls handler.set to create new elements rather than handler.defineproperty(). when the source parameter is an iterator, the typedarra...
...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 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 inse...
WeakMap() constructor - JavaScript
the weakmap() constructor creates weakmap objects which are a collections of key/value pairs in which the keys are weakly referenced. the keys must be objects and the values can be arbitrary values. you can learn more about weakmaps in the section weakmap object in keyed collections. syntax new weakmap([iterable]) parameters iterable iterable is an array or other iterable object whose elements are key-value pairs (2-element arrays). each key-value pair will be added to the new weakmap. null is treated as undefined. ...
...rray or other iterable object whose elements are key-value pairs (2-element arrays). each key-value pair will be added to the new weakmap. null is treated as undefined. examples using weakmap const wm1 = new weakmap(), wm2 = new weakmap(), wm3 = new weakmap(); const o1 = {}, o2 = function() {}, o3 = window; wm1.set(o1, 37); wm1.set(o2, 'azerty'); wm2.set(o1, o2); // a value can be anything, including an object or a function wm2.set(o3, undefined); wm2.set(wm1, wm2); // keys and values can be any objects. ...
... o2 = function() {}, o3 = window; wm1.set(o1, 37); wm1.set(o2, 'azerty'); wm2.set(o1, o2); // a value can be anything, including an object or a function wm2.set(o3, undefined); wm2.set(wm1, wm2); // keys and values can be any objects. even weakmaps! wm1.get(o2); // "azerty" wm2.get(o2); // undefined, because there is no key for o2 on wm2 wm2.get(o3); // undefined, because that is the set value wm1.has(o2); // true wm2.has(o2); // false wm2.has(o3); // true (even if the value itself is 'undefined') wm3.set(o1, 37); wm3.get(o1); // 37 wm1.has(o1); // true wm1.delete(o1); wm1.has(o1); // false specifications specification ecmascript (ecma-262)the definition of 'weakmap constructor' in that specification. ...
WebAssembly.Table() constructor - JavaScript
initial the initial number of elements of the webassembly table. ...
... initial the initial number of elements of the webassembly table. ...
...callable exported webassembly functions which we can call from js. webassembly.instantiatestreaming(fetch('table2.wasm'), importobject) .then(function(obj) { console.log(tbl.length); console.log(tbl.get(0)()); console.log(tbl.get(1)()); }); note how you've got to include a second function invocation operator at the end of the accessor to actually invoke the referenced function and log the value stored inside it (e.g. get(0)() rather than get(0)) . this example shows that we're creating and accessing the table from javascript, but the same table is visible and callable inside the wasm instance too. specifications specification webassembly javascript interfacethe definition of 'table' in that specification. browser compatibility the compatibility table on...
WebAssembly.Table.prototype.set() - JavaScript
the set() prototype method of the webassembly.table object mutates a reference stored 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. 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 l...
...get(0)() rather than get(0)) . thi...
...get(0)() rather than get(0)) . this example shows that we're creating and accessing the table from javascript, but the same table is visible and callable inside the wasm instance too. specifications specification webassembly javascript interfacethe definition of 'set()' in that specification. ...
parseFloat() - JavaScript
efloat() function parses an argument (converting it to a string first if needed) and returns a floating point number. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax parsefloat(string) parameters string the value to parse. if this argument is not a string, then it is converted to one using the tostring abstract operation. leading whitespace in this argument is ignored. return value a floating point number parsed from the given string. or nan when the first non-whitespace character cannot be converted to a number. description parsefloat is a top-level function and not a method of any object. if pa...
... a second decimal point also stops parsing (characters up to that point will still be parsed). leading and trailing spaces in the argument are ignored. if the argument’s first character can’t be converted to a number (it’s not any of the above characters), parsefloat returns nan. ...
...ll be parsed). leading and trailing spaces in the argument are ignored. if the argument’s first character can’t be converted to a number (it’s not any of the above characters), parsefloat returns nan. parsefloat can also parse and return infinity. parsefloat converts bigint syntax to numbers, losing precision. this happens because the trailing n character is discarded. consider number(value) for stricter parsing, which converts to nan for arguments with invalid characters anywhere. parsefloat will parse non-string objects if they have a tostring or valueof method. the returned value is the same as if parsefloat had been called on the result of those methods. examples parsefloat returning a number the following examples all return 3.14: parsefloat(3.14); parsefloat('3.14'); pars...
Lexical grammar - JavaScript
ents, like this: function comment() { /* this comment spans multiple lines. notice that we don't need to end the comment until we're done. */ console.log('hello world!'); } comment(); you can also use it in the middle of a line, if you wish, although this can make your code harder to read so it should be used with caution: function comment(x) { console.log('hello ' + x /* insert the value of x */ + ' !'); } comment('world'); in addition, you can use it to disable code to prevent it from running, by wrapping code in a comment, like this: function comment() { /* console.log('hello world!'); */ } comment(); in this case, the console.log() call is never issued, since it's inside a comment. any number of lines of code can be disabled this way. hashbang comments a specialized thi...
...ar literally in a string literal except for these closing quote code points: u+005c \ (backslash), u+000d <cr>, and u+000a <lf>. prior to the proposal to make all json text valid ecma-262, u+2028 <ls> and u+2029 <ps>, were also disallowed from appearing unescaped in string literals. any code points may appear in the form of an escape sequence. string literals evaluate to ecmascript string values. when generating these string values unicode code points are utf-16 encoded. 'foo' "bar" hexadecimal escape sequences hexadecimal escape sequences consist of \x followed by exactly two hexadecimal digits representing a code unit or code point in the range 0x0000 to 0x00ff. '\xa9' // "©" unicode escape sequences a unicode escape sequence consists of exactly four hexadecimal digits followi...
...10ffff require two escape sequences representing the two code units (a surrogate pair) used to encode the character; the surrogate pair is distinct from the code point. see also string.fromcharcode() and string.prototype.charcodeat(). '\u00a9' // "©" (u+a9) unicode code point escapes a unicode code point escape consists of \u{, followed by a code point in hexadecimal base, followed by }. the value of the hexadecimal digits must be in the range 0 and 0x10ffff inclusive. code points in the range u+10000 to u+10ffff do not need to be represented as a surrogate pair. code point escapes were added to javascript in ecmascript 2015 (es6). see also string.fromcodepoint() and string.prototype.codepointat(). '\u{2f804}' // cjk compatibility ideograph-2f804 (u+2f804) // the same character represen...
Comma operator (,) - JavaScript
the comma operator (,) evaluates each of its operands (from left to right) and returns the value of the last operand. this lets you create a compound expression in which multiple expressions are evaluated, with the compound expression's final value being the value of the rightmost of its member expressions. this is commonly used to provide multiple parameters to a for loop. the source for this interactive example is stored in a github repository. if 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 expr1, expr2, expr3... parameters expr1, expr2, expr3... one or more expressions, the last of which is returned as the value of the compound expression. usage notes you can use the co...
...pression. the most common usage of this operator is to supply multiple parameters in a for loop. the comma operator is fully different from the comma within arrays, objects, and function arguments and parameters. examples if a is a 2-dimensional array with 10 elements on each side, the following code uses the comma operator to increment i and decrement j at once. ...
...this is due to operator precedence and associativity. ...
Less than (<) - JavaScript
d in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax x < y description the operands are compared using the abstract relational comparison algorithm, which is roughly summarised below: first, objects are converted to primitives using symbol.toprimitive. ...
...teractive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax x < y description the operands are compared using the abstract relational comparison algorithm, which is roughly summarised below: first, objects are converted to primitives using symbol.toprimitive. if both values are strings, they are compared as strings, based on the values of the unicode code points they contain. otherwise javascript attempts to convert non-numeric types to numeric values: boolean values true and false are converted to 1 and 0 respectively. null is converted to 0. undefined is converted to nan. strings are converted based on the values they contain, and are converted as nan if they do not contain numeric values. if either val...
...javascript attempts to convert non-numeric types to numeric values: boolean values true and false are converted to 1 and 0 respectively. null is converted to 0. undefined is converted to nan. strings are converted based on the values they contain, and are converted as nan if they do not contain numeric values. if either value is nan, the operator returns false. otherwise the values are compared as numeric values. examples string to string comparison console.log("a" < "b"); // true console.log("a" < "a"); // false console.log("a" < "3"); // false string to number comparison console.log("5" < 3); // false console.log("3" < 3); // false console.log("3" < 5); // true console.log("hello" < 5); // false console.log(5 < ...
Spread syntax (...) - JavaScript
the source for this interactive example is stored in a github repository. ...
...without spread syntax, this is done as: const arr1 = [0, 1, 2]; const arr2 = [3, 4, 5]; // prepend all items from arr2 onto arr1 array.prototype.unshift.apply(arr1, arr2) // arr1 is now [3, 4, 5, 0, 1, 2] with spread syntax, this becomes: let arr1 = [0, 1, 2]; let arr2 = [3, 4, 5]; arr1 = [...arr2, ...arr1]; // arr1 is now [3, 4, 5, 0, 1, 2] note: u...
...hemselves are not iterable, but they become iterable when used in an array, or with iterating functions such as map(), reduce(), and assign(). when merging 2 objects together with the spread operator, it is assumed 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. ecm...
await - JavaScript
the await operator is used to wait for a promise. it can only be used inside an async function. syntax [rv] = await expression; expression a promise or any value to wait for. rv returns the fulfilled value of the promise, or the value itself if it's not a promise. description the await expression causes async function execution to pause until a promise is settled (that is, fulfilled or rejected), and to resume execution of the async function after fulfillment. when resumed, the value of the await expression is that of the fulfilled promise. if the promise is rejected, the await expression throws the rejected value. if the value of the expression following the await operator is not a promise, it's converted to a resolved promise. an await can split execution flow, allowing the...
...ts function, if this is the first await executed by the function, immediate execution also continues by returning to the function's caller a pending promise for the completion of the await's function and resuming execution of that caller. examples awaiting a promise to be fulfilled if a promise is passed to an await expression, it waits for the promise to be fulfilled and returns the fulfilled value. function resolveafter2seconds(x) { return new promise(resolve => { settimeout(() => { resolve(x); }, 2000); }); } async function f1() { var x = await resolveafter2seconds(10); console.log(x); // 10 } f1(); thenable objects thenable objects will be fulfilled just the same. async function f2() { const thenable = { then: function(resolve, _reject) { resolve(...
...x); }, 2000); }); } async function f1() { var x = await resolveafter2seconds(10); console.log(x); // 10 } f1(); thenable objects thenable objects will be fulfilled just the same. async function f2() { const thenable = { then: function(resolve, _reject) { resolve('resolved!') } }; console.log(await thenable); // resolved! } f2(); conversion to promise if the value is not a promise, it converts the value to a resolved promise, and waits for it. async function f3() { var y = await 20; console.log(y); // 20 } f3(); promise rejection if the promise is rejected, the rejected value is thrown. async function f4() { try { var z = await promise.reject(30); } catch(e) { console.error(e); // 30 } } f4(); handling rejected promises handle rej...
void operator - JavaScript
e void operator evaluates the given expression and then returns undefined. the source for this interactive example is stored in a github repository. if 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 void expression description this operator allows evaluating expressions that produce a value into places where an expression that evaluates to undefined is desired. the void operator is often used merely to obtain the undefined primitive value, usually using "void(0)" (which is equivalent to "void 0"). in these cases, the global variable undefined can be used. it should be noted that the precedence of the void operator should be taken into account and that parentheses can help clarify ...
...n keyword to be treated as an expression instead of a declaration. void function iife() { console.log("executed!"); }(); // output: "executed!" executing the above function without the void keyword will result in an uncaught syntaxerror. javascript uris when a browser follows a javascript: uri, it evaluates the code in the uri and then replaces the contents of the page with the returned value, unless the returned value is undefined. the void operator can be used to return undefined. for example: <a href="javascript:void(0);"> click here to do nothing </a> <a href="javascript:void(document.body.style.backgroundcolor='green');"> click here for green background </a> note: javascript: pseudo protocol is discouraged over other alternatives, such as unobtrusive event handlers. no...
...e for green background </a> note: javascript: pseudo protocol is discouraged over other alternatives, such as unobtrusive event handlers. non-leaking arrow functions arrow functions introduce a short-hand braceless syntax that returns an expression. this can cause unintended side effects by returning the result of a function call that previously returned nothing. to be safe, when the return value of a function is not intended to be used, it can be passed to the void operator to ensure that (for example) changing apis do not cause arrow functions' behaviors to change. button.onclick = () => void dosomething(); this ensures the return value of dosomething changing from undefined to true will not change the behavior of this code. specifications specification ecmascript ...
return - JavaScript
for example, the following function returns the square of its argument, x, where x is a number. ...
...for example, the following function returns the square of its argument, x, where x is a number. ...
...ontribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax return [[expression]]; expression the expression whose value is to be returned. if omitted, undefined is returned instead. description when a return statement is used in a function body, the execution of the function is stopped. if specified, a given value is returned to the function caller. for example, the following function returns the square of its argument, x, where x is a number. function square(x) { return x * x; } var demo = square(3); // demo will equal 9 if the value is omitted, undefined is returned instead. the following return statements all break the function execution: return; return true; return false; return x; return x + y...
with - JavaScript
ts) in f's activation object, where x names the first formal argument. if you forget to define x in the object you pass as the second argument, or if there's some similar bug or confusion, you won't get an error -- just unexpected results. contra: code using with may not be forward compatible, especially when used with something other than a plain object. ...
...es the first formal argument. if you forget to define x in the object you pass as the second argument, or if there's some similar bug or confusion, you won't get an error -- just unexpected results. contra: code using with may not be forward compatible, especially when used with something other than a plain object. ...
...second argument, or if there's some similar bug or confusion, you won't get an error -- just unexpected results. contra: code using with may not be forward compatible, especially when used with something other than a plain object. consider this example: function f(foo, values) { with (foo) { console.log(values); } } if you call f([1,2,3], obj) in an ecmascript 5 environment, then the values reference inside the with statement will resolve to obj. however, ecmascript 2015 introduces a values property on array.prototype (so that it will be available on every array). so, in a javascript environment that supports ecmascript 2015, the values reference inside the with statement could resolve to [1,2,3].values. however, in this particular example, array.prototype has been defined with val...
icons - Web app manifests
s, or to integrate the web application with an os's task switcher and/or system preferences. examples "icons": [ { "src": "icon/lowres.webp", "sizes": "48x48", "type": "image/webp" }, { "src": "icon/lowres", "sizes": "48x48" }, { "src": "icon/hd_hi.ico", "sizes": "72x72 96x96 128x128 256x256" }, { "src": "icon/hd_hi.svg", "sizes": "72x72" } ] values image objects may contain the following values: member description sizes a string containing space-separated image dimensions. src the path to the image file. if src is a relative url, the base url will be the url of the manifest. type a hint as to the media type of the image. the purpose of this member is to allow a user agent to quickly ign...
... a hint as to the media type of the image. the purpose of this member is to allow a user agent to quickly ignore images with media types it does not support. purpose defines the purpose of the image, for example if the image is intended to serve some special purpose in the context of the host os (i.e., for better integration). purpose can have one or more of the following values, separated by spaces: monochrome: a user agent can present this icon where a monochrome icon with a solid fill is needed. the color information in the icon is discarded and only the alpha data is used. the icon can then be used by the user agent like a mask over any solid fill. maskable: the image is designed with icon masks and safe zone in mind, such that any part of the image ...
... is discarded and only the alpha data is used. the icon can then be used by the user agent like a mask over any solid fill. maskable: the image is designed with icon masks and safe zone in mind, such that any part of the image outside the safe zone can safely be ignored and masked away by the user agent. any: the user agent is free to display the icon in any context (this is the default value). specification specification status comment feedback web app manifestthe definition of 'icons' in that specification. working draft initial definition. web app manifest working group drafts ...
<math> - MathML
Web › MathML › Element › math
tance must be wrapped in <math> tags. in addition you must not nest a second <math> element in another, but you can have an arbitrary number of other child elements in it. attributes in addition to the following attributes, the <math> element accepts any attributes of the <mstyle> element. class, id, style provided for use with stylesheets. dir overall directionality of formulas. possible values are either ltr (left to right) or rtl (right to left). href used to set a hyperlink to a specified uri. 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. display this enumerated attribute specifies how the enclosed mathml markup should be rendered. it can have one of the following...
... 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. display this enumerated attribute specifies how the enclosed mathml markup should be rendered. it can have one of the following values: block, which means that this element will be displayed outside the current span of text, as a block that can be positioned anywhere without changing the meaning of the text; inline, which means that this element will be displayed inside the current span of text, and cannot be moved out of it without changing the meaning of that text. if not present, its default value is inline. mod...
... outside the current span of text, as a block that can be positioned anywhere without changing the meaning of the text; inline, which means that this element will be displayed inside the current span of text, and cannot be moved out of it without changing the meaning of that text. if not present, its default value is inline. mode deprecated in favor of the display attribute. possible values are: display (which has the same effect as display="block") and inline. overflow specifies how an expression behaves if it is too long to fit in the allowed width. possible values are: linebreak (default), scroll, elide, truncate, scale. examples html5 notation <!doctype html> <html> <head> <title>mathml in html5</title> </head> <body> <math> <mrow> <mrow> ...
<mfrac> - MathML
Web › MathML › Element › mfrac
the mathml <mfrac> element is used to display fractions. syntax <mfrac>numerator denominator</mfrac> attributes bevelled specifies the way the fraction is displayed. if true, the fraction line is bevelled, which means that numerator and denominator are displayed side by side and separated by a slash (/). otherwise, if set to false (which is the default value), numerator and denominator are on top of each other. this attribute is deprecated and will be removed in the future. use u+2044 (fraction slash) instead. class, id, style 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 ...
...rovided 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. ...
... this attribute is deprecated and will be removed in the future. use css text-align instead. ...
<mn> - MathML
Web › MathML › Element › mn
the mathml <mn> element represents a numeric literal which is normally a sequence of digits with a possible separator (a dot or a comma). however, it is also allowed to have arbitrary text in it which is actually a numeric quantity, for example "eleven". attributes class, id, style provided for use with stylesheets. dir the text direction. possible values are either ltr (left to right) or rtl (right to left). 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 thi...
...normal and big. these will be removed in the future. mathvariant this attribute specifies the logical class of the number which varies in typography. that is, although the names suggest the typographic style for the class, semantically, items with the same class are treated "the same" within an expression, which might or might not involve displaying them with the named typography. ...
... the future. mathvariant this attribute specifies the logical class of the number which varies in typography. that is, although the names suggest the typographic style for the class, semantically, items with the same class are treated "the same" within an expression, which might or might not involve displaying them with the named typography. ...
<mstyle> - MathML
Web › MathML › Element › mstyle
the mathml <mstyle> element is used change the style of its children. it accepts all attributes of all mathml presentation elements with some exceptions and additional attributes listed below. attributes dir overall directionality of formulas. possible values are either ltr (left to right) or rtl (right to left). decimalpoint this attribute is specifying the character for the alignment point within <mstack> and <mtable> columns, if the decimalpoint value is used to specify the alignment. displaystyle a boolean value specifying whether more vertical space is used for displayed equations or, if set to false, a more compact layout is used to display formulas. the main effect is that larger versions of operators are displayed, when displaystyle is set to true. see also largeop and movable...
...le a boolean value specifying whether more vertical space is used for displayed equations or, if set to false, a more compact layout is used to display formulas. the main effect is that larger versions of operators are displayed, when displaystyle is set to true. see also largeop and movablelimits on <mo>. infixlinebreakstyle specifies the default linebreakstyle to use for infix operators. the values before, after and duplicate are allowed. scriptlevel controls mostly the font-size. the higher the scriptlevel, the smaller the font size. this attribute accepts a non-negative integer, as well as a "+" or a "-" sign, which increments or decrements the current value. in addition, the scriptlevel attribute can never reduce the font size below scriptminsize in order to avoid unreadable small fon...
...n-negative integer, as well as a "+" or a "-" sign, which increments or decrements the current value. in addition, the scriptlevel attribute can never reduce the font size below scriptminsize in order to avoid unreadable small font sizes and depends on the multiplier specified in scriptsizemultiplier. scriptminsize specifies a minimum font size allowed due to changes in scriptlevel. the default value is 8pt. scriptsizemultiplier specifies the multiplier to be used to adjust font size due to changes in scriptlevel. the default value is 0.71. the <mstyle> element accepts all attributes of all presentation elements with the following exceptions: height, depth or width do not apply to <mglyph>, <mpadded> or <mtable>. rowalign, columnalign, or groupalign do not apply to <mtr>, <mlabeledtr>...
<mtd> - MathML
Web › MathML › Element › mtd
the mathml <mtd> element represents a cell in a table or a matrix. it may only appear in a <mtr> element. this element is similar to the <td> element of html. attributes class, id, style provided for use with stylesheets. columnalign specifies the horizontal alignment of this cell and overrides values specified by <mtable> or <mtr>. possible values are: left, center and right. columnspan a non-negative integer value that indicates on how many columns does the cell extend. ...
... specifications specification status comment mathml 3.0the definition of 'mtd' in that specification. ...
...how many columns does the cell extend. 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. rowalign specifies the vertical alignment of this cell and overrides values specified by <mtable> or <mtr>. possible values are: axis, baseline, bottom, center and top. rowspan a non-negative integer value that indicates on how many rows does the cell extend. specifications specification status comment mathml 3.0the definition of 'mtd' in that specification. recommendation current specification mathml 2.0the definition of 'mtd' in that specification. recommendation ...
<mtext> - MathML
Web › MathML › Element › mtext
the mathml <mtext> element is used to render arbitrary text with no notational meaning, such as comments or annotations. to display text with notational meaning, use <mi> and <mo> instead. attributes class, id, style provided for use with stylesheets. dir the text direction. possible values are either ltr (left to right) or rtl (right to left). 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 v...
...l 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 displaying them with the named typography. ...
...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 displaying them with the named typography. ...
Web audio codec guide - Web media technologies
may be a noticeable loss of fidelity removing frequency bands means less data to encode, thus smaller encoded files stereo coding simple stereo and mid-side stereo coding don't affect quality; intensity stereo coding introduces loss of detail, however. joint stereo can reduce the size of the encoded audio to some extent the parameters available—and the range of possible values—varies from codec to codec, and even among different encoding utilities for the same codec, so read the documentation that comes with the encoding software you use to learn more. features affecting encoded audio size several factors affect the size of the encoded audio. some of these are a matter of the form of the source audio; others are related to decisions made while encoding the audio. ...
...en in use for decades, is "good enough" for voice applications, and is vital if you may need to interface with a standard telephone network. this codec is required to be supported by all webrtc solutions because it's a simple, easy to implement, and widely-used and compatible codec. typically, most modern applications will use g.711 only as a fallback option, unless the limitations have specific value to their use cases. opus, for example, offers a narrowband encoding at a 40 kbps bit rate. still, g.711 provides a least common denominator which can be fallen back upon when needed. supported bit rates 64 kbps variable bit rate (vbr) support no supported sample formats 14-bit signed integer (µ-law) or 13-bit unsigned integer (a-law); encoded audio is 8 bits ...
...ssion. its audio coding bandwidth is limited to the 50 hz to 7,000 hz range, which covers most of the frequency range of typical human vocalization. this makes it ill-suited for handling any audio that might range outside the human speech range, such as music. g.722 audio is encoded using adaptive differential pulse code modulation (adpcm), in which each sample is represented not by its absolute value, but as a value indicating how much the new sample differs from the previous sample. g.722 is primarily used with webrtc connections, as it's one of the audio codecs mandated by the webrtc specification. supported bit rates g.722: 48 kbps, 56 kbps, and 64 kbps; however, in practice 64 kbps is always used g.722 annex b super wide-band: 64 kbps, 80 kbps, and 96 kbps g.722 anne...
CSS and JavaScript animation performance - Web Performance
tween the current style and an end css state, e.g., a resting button state and a hover state. even if an element is in the middle of a transition, the new transition starts from the current style immediately instead of jumping to the end css state. see using css transitions for more details. css animations, on the other hand, allow developers to make animations between a set of starting property values and a final set rather than between two states. css animations consist of two components: a style describing the css animation, and a set of key frames that indicate the start and end states of the animation's style, as well as possible intermediate points. see using css animations for more details. in terms of performance, there is no difference between implementing an animation with css tran...
... to see what animation method seems better overall. enabling fps tools before going through the example, please enable fps tools first to see the current frame rate: in the url bar, enter about:config; click the i’ll be careful, i promise! button to enter the config screen. in the search bar, search for the layers.acceleration.draw-fps preference. double-click the entry to set the value to true. now you will be able to see three little purple boxes at the upper left corner of the firefox window. the first box represents fps. running the performance test initially in the test seen below, a total of 1000 <div> elements are transformed by css animation. the animation can be switched to requestanimationframe() by clicking the toggle button. try running them both now, comp...
...erty is the css transform. if an element is promoted as a layer, animating transform properties can be done in the gpu, meaning better performance/efficiency, especially on mobile. find out more details in offmainthreadcompositing. to enable the omta (off main thread animation) in firefox, you can go to about:config and search for the layers.offmainthreadcomposition.async-animations. toggle its value to true. after enabling omta, try running the above test again. you should see that the fps of the css animations will now be significantly higher. note: in nightly/developer edition, you should see that omta is enabled by default, so you might have to do the tests the other way around (test with it enabled first, then disable to test without omta.) summary browsers are able to optimize r...
Media - Progressive web apps (PWAs)
information: media the purpose of css is to specify how content is presented to the user. this presentation can take more than one form. for example, you are probably reading this on a device with a display. but you might also want to project it to a big screen for a large audience, or you might want to print it. these different media have different characteristics. ...
...er shapes in your browser: selector selects pointer indicating a link wait indicating that the program cannot accept input progress indicating that the program is working, but can still accept input default the default (usually an arrow) an outline property creates an outline that is often used to indicate keyboard focus. its values are similar to the border property, except that you cannot specify individual sides. some other features of user interfaces are implemented using attributes, in the normal way. for example, an element that is disabled or read-only has the disabled attribute or the readonly attribute. selectors can specify these attributes like any other attributes, by using square brackets: [disabled] or [reado...
...cific style rules to a separate css file. read the @import reference page to find details of how to import the new print-specific css file into your style4.css stylesheet. make the headings turn blue when the mouse pointer is over them. see solutions to these challenges. what next? so far, all the style rules in this tutorial have been specified in files. the rules and their values are fixed. the next page describes how you can change rules dynamically by using a programming language: javascript. ...
The building blocks of responsive design - Progressive web apps (PWAs)
site. but this is increasingly inefficient: browser sniffing is inherently error prone, and maintaining multiple copies of your code can turn out to be a nightmare. it is usually much better to create a single version of your code which doesn't care about what browser or platform is accessing the site, but instead uses feature tests to find out what code features the browser supports or what the values of certain browser features are, and then adjusts the code appropriately. this tends to be termed responsive design or adaptive design, two related but different approaches. this is much more reliable, more maintainable, and more future proof. you don't get caught in the situation of having to bring out more new site versions as more new browsers and platforms come out, and adjust code as featu...
... next up, the font-size of the buttons is set to 6.8vw. why? becau...
...lable solutions are as follows: hisrc a jquery plugin that allows you to create small, medium, and large versions of an image, and then serves the appropriate one according to the browser's resolution and available network speed. mobify.js capturing a very clever technique from mozilla that allows you to capture the source of the page before it's parsed. this way, you can swap out image src values with javascript depending on browser features, circumventing browser preloading issues. this is promising, but doesn't work very well across older browsers. picturefill a javascript-based polyfill for <picture>, which works nicely, but it does require a lot of custom markup. adaptive images a server-side solution, which records the viewport size in a cookie, then resizes images via a combina...
Applying SVG effects to HTML content - SVG: Scalable Vector Graphics
the id #clipping-path-1, then references it in the css. the clip path can be assigned to any element with the target class. you can make changes to the svg in real time and see them immediately affect the rendering of the html. for example, you can resize the circle in the clip path established above: function toggleradius() { var circle = document.getelementbyid("circle"); circle.r.baseval.value = 0.40 - circle.r.baseval.value; } example: filtering this demonstrates applying a filter to html content using svg. it establishes several filters, which are applied with css to three elements in both the normal and mouse hover states. <p class="target" style="background: lime;"> lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et...
...">elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</b> ut enim ad minim veniam. </p> any svg filter can be applied this way. ...
...interpolation-filters:srgb" order="3" kernelmatrix="0 -1 0 -1 4 -1 0 -1 0" preservealpha="true"/> </filter> <filter id="f4"> <fespecularlighting surfacescale="5" specularconstant="1" specularexponent="10" lighting-color="white"> <fepointlight x="-5000" y="-10000" z="20000"/> </fespecularlighting> </filter> <filter id="f5"> <fecolormatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0" style="color-interpolation-filters:srgb"/> </filter> </svg> the five filters are applied using the following css: p.target { filter:url(#f3); } p.target:hover { filter:url(#f5); } b.target { filter:url(#f1); } b.target:hover { filter:url(#f4); } pre.target { filter:url(#...
alignment-baseline - SVG: Scalable Vector Graphics
the alignment-baseline attribute specifies how an object is aligned with respect to its parent. this property specifies which baseline of this element is to be aligned with the corresponding baseline of the parent. for example, this allows alphabetic baselines in roman text to stay aligned across font size changes. it defaults to the baseline with the same name as the computed value of the alignment-baseline property. ...
...cross font size changes. it defaults to the baseline with the same name as the computed value of the alignment-baseline property. note: as a presentation attribute alignment-baseline can be used as a css property. as a presentation attribute, it can be applied to any element but it has effect only on the following four elements: <tspan>, <tref>, <altglyph>, and <textpath> usage notes value auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | top | center | bottom default value auto animatable yes auto the value is the dominant-baseline of the script to which the character belongs - i.e., use the dominant-baseline of the parent. baseline uses t...
...al matches the box’s mathematical baseline to that of its parent. top aligns the top of the aligned subtree with the top of the line box. center aligns the center of the aligned subtree with the center of the line box. bottom aligns the bottom of the aligned subtree with the bottom of the line box. svg 2 introduces some changes to the definition of this property. in particular: the values auto, before-edge, and after-edge have been removed. for backwards compatibility, text-before-edge may be mapped to text-top and text-after-edge to text-bottom. neither text-before-edge nor text-after-edge should be used with the vertical-align property. example <svg width="300" height="120" viewbox="0 0 300 120" xmlns="http://www.w3.org/2000/svg"> <!-- materialisation of anchors -->...
attributeName - SVG: Scalable Vector Graphics
specifications specification status comment svg animations level 2the definition of 'attributename' in that specification. editor's draft no change scalable vector grap...
... specifications specification status comment svg animations level 2the definition of 'attributename' in that specification. editor's draft no change scalable vector graphics (svg) 1.1 (second edition)th...
... html, body, svg { height: 100%; } <svg viewbox="0 0 250 250" xmlns="http://www.w3.org/2000/svg"> <rect x="50" y="50" width="100" height="100"> <animate attributetype="xml" attributename="y" from="0" to="50" dur="5s" repeatcount="indefinite"/> </rect> </svg> usage notes value <name> default value none animatable no <name> this value indicates the name of the css property or attribute of the target element to be animated. specifications specification status comment svg animations level 2the definition of 'attributename' in that specification. editor's draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'attributename' in that specification. reco...
baseFrequency - SVG: Scalable Vector Graphics
example <sv...
... example <svg width="200" height="200" viewbox="0 0 220 220" ...
...e2); transform: translatex(220px);" /> </svg> usage notes value <number-optional-number> default value 0 animatable yes <number-optional-number> if two numbers are provided, the first one represents the base frequency in the horizontal direction and the second one the base frequency in the vertical direction. if one number is provided, then that value is used for both x and y. negative values are forbidden. example <svg width="200" height="200" viewbox="0 0 220 220" xmlns="http://www.w3.org/2000/svg"> <filter id="displacementfilter"> <feturbulence type="turbulence" basefrequency="0.05" numoctaves="2" result="turbulence"/> <fedisplacementmap in2="turbulence" in="sourcegraphic" scale="50" xchannelselector="r" yc...
clipPathUnits - SVG: Scalable Vector Graphics
ill="red" /> <use clip-path="url(#myclip1)" xlink:href="#r2" fill="red" /> <use clip-path="url(#myclip1)" xlink:href="#r3" fill="red" /> <!-- the last rect is clipped with objectboundingbox units --> <use clip-path="url(#myclip2)" xlink:href="#r4" fill="red" /> </svg> clippath for <clippath>, clippathunits define the coordinate system in use for the content of the element. ...
..." fill="red" /> <use clip-path="url(#myclip1)" xlink:href="#r3" fill="red" /> <!-- the last rect is clipped with objectboundingbox units --> <use clip-path="url(#myclip2)" xlink:href="#r4" fill="red" /> </svg> clippath for <clippath>, clippathunits define the coordinate system in use for the content of the element. value userspaceonuse | objectboundingbox default value userspaceonuse animatable yes userspaceonuse this value indicates that all coordinates inside the <clippath> element refer to the user coordinate system 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. i...
... 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. ...
color-interpolation-filters - SVG: Scalable Vector Graphics
the color-interpolation-filters attribute specifies the color space for imaging operations performed via filter effects. notes: this property just has an affect on filter operations. therefore, it has no effect on filter primitives like <feoffset>, <feimage>, <fetile> or <feflood>. color-interpolation-filters has a different initial value than color-interpolation. color-interpolation-filters has an initial value of linearrgb, whereas color-interpolation has an initial value of srgb. thus, in the default case, filter effects operations occur in the linearrgb color space, whereas all other color interpolations occur by default in the srgb color space. it has no affect on filter functions, which operate in the srgb color space. note: as a presentation attribute, color-interpolation can be u...
...this option indicates that the author doesn't require that color interpolation occur in a particular color space. srgb indicates that color interpolation should occur in the srgb color space...
...this option indicates that the author doesn't require that color interpolation occur in a particular color space. srgb indicates that color interpolation should occur in the srgb color space. linearrgb indicates that color interpolation s...
color-rendering - SVG: Scalable Vector Graphics
ation and compositing operations. color-rendering takes precedence over color-interpolation-filters. for example, assume color-rendering: optimizespeed and color-interpolation-filters: linearrgb. in this case, the svg user agent should perform color operations in a way that optimizes performance, which might mean sacrificing the color interpolation precision as specified by through the linearrgb value for color-interpolation-filters. note: as a presentation attribute, color-rendering can be used as a css property. as a presentation attribute, it can be applied to any element but it only has an effect on the following 29 elements: <a>, <animate>, <animatecolor>, <circle>, <clippath>, <defs>, <ellipse>, <foreignobject>, <g>, <glyph>, <image>, <line>, <lineargradient>, <marker>, <mask>, <missin...
... optimizespeed indicates that the user agent shall emphasize rendering speed over quality. for rgb display devices, this option will so...
... optimizespeed indicates that the user agent shall emphasize rendering speed over quality. for rgb display devices, this option will sometimes cause the user agent to perform color interpolation and c...
color - SVG: Scalable Vector Graphics
Web › SVG › Attribute › color
the color attribute is used to provide a potential indirect value, currentcolor, for the fill, stroke, stop-color, flood-color, and lighting-color attributes. note: as a presentation attribute, color can be used as a css property. see css color for further information. as a presentation attribute, it can be applied to any element, but as noted above, it has no direct effect on svg elements. ...
... is used to provide a potential indirect value, currentcolor, for the fill, stroke, stop-color, flood-color, and lighting-color attributes. note: as a presentation attribute, color can be used as a css property. see css color for further information. as a presentation attribute, it can be applied to any element, but as noted above, it has no direct effect on svg elements. ...
...ue, currentcolor, for the fill, stroke, stop-color, flood-color, and lighting-color attributes. note: as a presentation attribute, color can be used as a css property. see css color for further information. as a presentation attribute, it can be applied to any element, but as noted above, it has no direct effect on svg elements. ...
exponent - SVG: Scalable Vector Graphics
working draft no change ...
... working draft no change scalable vector graphics (svg) 1.
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'exponent' in that specification. recommendation initial definition ...
externalResourcesRequired - SVG: Scalable Vector Graphics
, including style sheets, color profiles and fonts specified by a reference using a <font-face> element or a css @font-face specification. in particular, if an element sets externalresourcesrequired="true", then all style sheets must be available since any style sheet might affect the rendering of that element. the externalresourcesrequired attribute is not inheritable (from a sense of attribute value inheritance), but if set on a container element, its value will apply to all elements within the container. because setting externalresourcesrequired="true" on a container element will have the effect of disabling progressive display of the contents of that container, if that container includes elements that reference external resources, authors should avoid simply setting externalresourcesrequi...
...s that reference external resources, authors should avoid simply setting externalresourcesrequired="true" on the outermost <svg> element on a universal basis. instead, it is better to specify externalresourcesrequired="true" on those particular graphics elements or container elements which specifically need the availability of external resources in order to render properly. usage notes value false | true default value false animatable no true this value indicates that resources external to the current document are required. if an external resource is not available, progressive rendering is suspended, the document's svgload event is not fired and the animation timeline does not begin until that resource and all other required resources become avail...
...document rendering can proceed even if external resources are unavailable to the current element and its descendants. ...
flood-color - SVG: Scalable Vector Graphics
scalable vector graphics (svg) 1.1 (second edition)the definiti...
... scalable vector graphics (svg) 1.1 (second edition)the definition of 'flood-color' in that spec...
...dth="200" height="200" style="filter: url(#flood2); transform: translatex(220px);" /> </svg> usage notes value color initial value black animatable yes specifications specification status comment filter effects module level 1the definition of 'flood-color' in that specification. working draft removed the <icccolor> value and aligned the value to the css color value. scalable vector graphics (svg) 1.1 (second edition)the definition of 'flood-color' in that specification. recommendation initial definition ...
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 ...
... 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 edition)the definition of 'font-si...
...tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 200 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-size="smaller">smaller</text> <text x="100" y="20" font-size="2em">2em</text> </svg> usage notes value <absolute-size> | <relative-size> | <length-percentage> default value medium animatable yes for a description of the values, please refer to the css font-size property. 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 edition)the definition of 'font-size' in that specification. recommendation initial definition ...
font-style - SVG: Scalable Vector Graphics
specifications specification status comment css fonts module level 4the definition of 'font-style' in that specification. working draft no change css fonts module level 3the defini...
... specifications specification status comment css fonts module level 4the definition of 'font-style' in that specification. working draft no change css fonts module level 3the definition of 'font-style' in that specification. candi...
... <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 250 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-style="normal">normal font style</text> <text x="150" y="20" font-style="italic">italic font style</text> </svg> usage notes value normal | italic | oblique default value normal animatable yes for a description of the values, please refer to the css font-style property. specifications specification status comment css fonts module level 4the definition of 'font-style' in that specification. working draft no change css fonts module level 3the definition of 'font-style' in that specification. candidate recommendation no change scalable vector graphics (svg) 1.
font-weight - SVG: Scalable Vector Graphics
specifications specification status comment css fonts module level 4the definition of 'font-weight' in that specification. working draft defines font-weight to accept any...
... specifications specification status comment css fonts module level 4the definition of 'font-weight' in that specification. working draft defines font-weight to accept any numbers between 1 and 1000. css fonts module level 3the defi...
...pan> html, body, svg { height: 100%; } <svg viewbox="0 0 200 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-weight="normal">normal text</text> <text x="100" y="20" font-weight="bold">bold text</text> </svg> usage notes value normal | bold | bolder | lighter | <number> default value normal animatable yes for a description of the values, please refer to the css font-weight property. specifications specification status comment css fonts module level 4the definition of 'font-weight' in that specification. working draft defines font-weight to accept any numbers between 1 and 1000. css fonts module level 3the definition of 'font-weight' in that specification. candidate recommendation ...
fx - SVG: Scalable Vector Graphics
Web › SVG › Attribute › fx
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 of...
... 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="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 coincides with the presentational value of cx for the element whether the value for cx was inherited or not. 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"/> ...
fy - SVG: Scalable Vector Graphics
Web › SVG › Attribute › fy
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 of...
... 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="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 coincides with the presentational value of cy for the element whether the value for cy was inherited or not. 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"/> ...
glyphRef - SVG: Scalable Vector Graphics
its format depends on the format of the given font. ...
...its format depends on the format of the given font. ...
...its format depends on the format of the given font. ...
gradientTransform - SVG: Scalable Vector Graphics
specifications specification status comment css transforms level 1the definition of 'surfacescale for <fespec...
... specifications specification status comment css transforms level 1the definition of 'surfacescale for <fespecularlighting>' in that specification.
... <transform-list> a list of transformation functions specifying some additional transformation from the gradient coordinate system onto the target coordinate system. specifications specification status comment css transforms level 1the definition of 'surfacescale for <fespecularlighting>' in that specification. working draft defines the <transformation-list> value. scalable vector graphics (svg) 2the definition of 'gradienttransformation for <lineargradient>' in that specification. candidate recommendation no change scalable vector graphics (svg) 2the definition of 'gradienttransformation for <radialgradient>' in that specification. candidate recommendation no change scalable vector graphics (svg) 1.1 (second edition)...
k1 - SVG: Scalable Vector Graphics
Web › SVG › Attribute › k1
the k1 attribute defines one of the values to be used within the the arithmetic operation of the <fecomposite> filter primitive. the pixel composition is computed using the following formula: result = k1*i1*i2 + k2*i1 + k3*i2 + k4 only one element is using this attribute: <fecomposite> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="composite1" x="0" y="0" width="100%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="1" k2="0" k3="0" k4="0" /> </filter> <filter id="composite2" x="0" y="0" width="100%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="10" k2="0" k3="0" k4="0" /> </filter> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0" y...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'k1' in that specification. recommendation initial definition ...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'k1' in that specification. recommendation initial definition ...
k2 - SVG: Scalable Vector Graphics
Web › SVG › Attribute › k2
the k2 attribute defines one of the values to be used within the the arithmetic operation of the <fecomposite> filter primitive. the pixel composition is computed using the following formula: result = k1*i1*i2 + k2*i1 + k3*i2 + k4 only one element is using this attribute: <fecomposite> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="composite1" x="0" y="0" width="100%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="1" k2="1" k3="0" k4="0" /> </filter> <filter id="composite2" x="0" y="0" width="100%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="1" k2="10" k3="0" k4="0" /> </filter> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0" y...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'k2' in that specification. recommendation initial definition ...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'k2' in that specification. recommendation initial definition ...
k3 - SVG: Scalable Vector Graphics
Web › SVG › Attribute › k3
the k3 attribute defines one of the values to be used within the the arithmetic operation of the <fecomposite> filter primitive. the pixel composition is computed using the following formula: result = k1*i1*i2 + k2*i1 + k3*i2 + k4 only one element is using this attribute: <fecomposite> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="composite1" x="0" y="0" width="100%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="1" k2="0" k3="1" k4="0" /> </filter> <filter id="composite2" x="0" y="0" width="100%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="1" k2="0" k3="10" k4="0" /> </filter> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0" y...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'k3' in that specification. recommendation initial definition ...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'k3' in that specification. recommendation initial definition ...
k4 - SVG: Scalable Vector Graphics
Web › SVG › Attribute › k4
the k4 attribute defines one of the values to be used within the the arithmetic operation of the <fecomposite> filter primitive. the pixel composition is computed using the following formula: result = k1*i1*i2 + k2*i1 + k3*i2 + k4 only one element is using this attribute: <fecomposite> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="composite1" x="0" y="0" width="100%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="1" k2="0" k3="0" k4="0" /> </filter> <filter id="composite2" x="0" y="0" width="100%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="10" k2="0" k3="0" k4="0.3" /> </filter> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0"...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'k4' in that specification. recommendation initial definition ...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'k4' in that specification. recommendation initial definition ...
lighting-color - SVG: Scalable Vector Graphics
scalable vector graphics (svg) 1.1 (second edition)the definition of 'lighting-color' in that specificati...
... scalable vector graphics (svg) 1.1 (second edition)the definition of 'lighting-color' in that specification. recommendation initial...
...ght="200" style="filter: url(#diffuselighting2); transform: translatex(220px);" /> </svg> usage notes value color default value white animatable yes specifications specification status comment filter effects module level 1the definition of 'lighting-color' in that specification. working draft removed the <icccolor> value. scalable vector graphics (svg) 1.1 (second edition)the definition of 'lighting-color' in that specification. recommendation initial definition ...
marker-mid - SVG: Scalable Vector Graphics
if the reference is not valid, then no marker will be drawn. specifications specification status comment ...
...if the reference is not valid, then no marker will be drawn. specifications specification status comment scalable vector graphics (svg) 2the ...
...if the reference is not valid, then no marker will be drawn. ...
maskUnits - SVG: Scalable Vector Graphics
/> <use mask="url(#mymask1)" xlink:href="#r2" fill="red" /> <use mask="url(#mymask1)" xlink:href="#r3" fill="red" /> <!-- the last rect is masked with objectboundingbox units --> <use mask="url(#mymask2)" xlink:href="#r4" fill="red" /> </svg> mask for <mask>, maskunits defines the coordinate system in use for the geometry attributes (x, y, width and height) of the element. ...
... <use mask="url(#mymask1)" xlink:href="#r3" fill="red" /> <!-- the last rect is masked with objectboundingbox units --> <use mask="url(#mymask2)" xlink:href="#r4" fill="red" /> </svg> mask for <mask>, maskunits defines the coordinate system in use for the geometry attributes (x, y, width and height) of the element. ...
... masked with objectboundingbox units --> <use mask="url(#mymask2)" xlink:href="#r4" fill="red" /> </svg> mask for <mask>, maskunits defines the coordinate system in use for the geometry attributes (x, y, width and height) of the element. value userspaceonuse | objectboundingbox default value objectboundingbox animatable yes userspaceonuse this value indicates that all coordinates for the geometry attributes refer to the user coordinate system as defined when the mask was created. objectboundingbox this value indicates that all coordinates for the geometry attributes represent fractions or percentages of the bounding box of the element to which the mask is applied. a bounding box could be considered the same as if the content of the <mask> ...
method - SVG: Scalable Vector Graphics
Web › SVG › Attribute › method
the method attribute indicates the method by which text should be rendered along the path of a <textpath> element. only one element is using this attribute: <textpath> textpath for <textpath>, method indicates the method by which text should be rendered along the path. value align | stretch default value align animatable yes align this value indicates that the characters should be rendered so that they are not stretched or warped. ...
...with this approach, connected characters, such as in cursive fonts, will maintain their connections. specifications specification status comment scalable vector graphics (svg) 2the definition of 'method' in that specification. ...
...character outlines will be converted into paths, and then stretched and possibly warped. with this approach, connected characters, such as in cursive fonts, will maintain their connections. specifications specification status comment scalable vector graphics (svg) 2the definition of 'method' in that specification. candidate recommendation described the stretch value in more detail. scalable vector graphics (svg) 1.1 (second edition)the definition of 'method' in that specification. recommendation initial definition ...
mode - SVG: Scalable Vector Graphics
Web › SVG › Attribute › mode
specifications specification status comment filter effects module level 1the definition of 'mode' in that specification. working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'mode'...
... specifications specification status comment filter effects module level 1the definition of 'mode' in that specification. working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'mode' in that specification. recommendati...
...y_color.png" width="200" height="200" style="filter:url(#blending1);"/> <image xlink:href="//developer.mozilla.org/files/6457/mdn_logo_only_color.png" width="200" height="200" style="filter:url(#blending2); transform:translatex(220px);"/> </svg> usage notes value <blend-mode> default value normal animatable yes for a description of the values, see <blend-mode>. specifications specification status comment filter effects module level 1the definition of 'mode' in that specification. working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'mode' in that specification. recommendation initial definition ...
numOctaves - SVG: Scalable Vector Graphics
example <svg width="200" height="200" viewbox="0 0 220 220" xmlns="http://www.w3.org/2000/svg"> <filter id="displacementfilter"> <feturbulence basefrequency="0.05" numoctaves="3" result="turbulence"/> <fedisplacementmap in2...
... example <svg width="200" height="200" viewbox="0 0 220 220" xmlns="http://www.w3.org/2000/svg"> <filter id="displacementfilter"> <feturbulence basefrequency="0.05" numoctaves="3" result="turbulence"/> <fedisplacementmap in2="turbulence" in="sourcegraphic" ...
...equency="0.025" numoctaves="3" /> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#noise1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#noise2); transform: translatex(220px);" /> </svg> usage notes value <integer> default value 1 animatable yes <integer> defines the number of octaves. negative values are forbidden. example <svg width="200" height="200" viewbox="0 0 220 220" xmlns="http://www.w3.org/2000/svg"> <filter id="displacementfilter"> <feturbulence basefrequency="0.05" numoctaves="3" result="turbulence"/> <fedisplacementmap in2="turbulence" in="sourcegraphic" scale="50" xchannelselector="r" ychannelselector="g"/> </filter> <circle cx="100" cy="10...
patternUnits - SVG: Scalable Vector Graphics
- left square with user space tiles --> <rect x="10" y="10" width="80" height="80" fill="url(#p1)" /> <!-- right square with bounding box tiles --> <rect x="110" y="10" width="80" height="80" fill="url(#p2)" /> </svg> pattern for <pattern>, patternunits defines the coordinate system in use for the geometry properties (x, y, width and height) of the element. ...
..." width="80" height="80" fill="url(#p1)" /> <!-- right square with bounding box tiles --> <rect x="110" y="10" width="80" height="80" fill="url(#p2)" /> </svg> pattern for <pattern>, patternunits defines the coordinate system in use for the geometry properties (x, y, width and height) of the element. ...
...ing box tiles --> <rect x="110" y="10" width="80" height="80" fill="url(#p2)" /> </svg> pattern for <pattern>, patternunits defines the coordinate system in use for the geometry properties (x, y, width and height) of the element. value userspaceonuse | objectboundingbox default value objectboundingbox animatable yes userspaceonuse this value indicates that all coordinates for the geometry properties refer to the user coordinate system as defined when the pattern was applied. objectboundingbox this value indicates that all coordinates for the geometry properties represent fractions or percentages of the bounding box of the element to which the mask is applied. a bounding box could be considered the same as if the content of the <mas...
pointer-events - SVG: Scalable Vector Graphics
browser compatibility the compatibility table on this page is generated from structured data. if you'd li...
... 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. desktopmobilechr...
... browser compatibility the compatibility table on this page is generated from structured data. ...
preserveAlpha - SVG: Scalable Vector Graphics
specifications ...
... specifications specification stat...
...ly_color.png" width="200" height="200" style="filter:url(#convolvematrix1);"/> <image xlink:href="//developer.mozilla.org/files/6457/mdn_logo_only_color.png" width="200" height="200" style="filter:url(#convolvematrix2); transform:translatex(220px);"/> </svg> usage notes default value false value true | false animatable yes true this value indicates that the convolution will only apply to the color channels. in this case, the filter will temporarily unpremultiply the color component values and apply the kernel. false this value indicates that the convolution will apply to all channels, including the alpha channel. specifications specification status comment filter effects module level 1the definitio...
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. ...
... specifications specification status comment filter effects module level 1the definition of 'primitiveunits' in that specification. ...
refX - SVG: Scalable Vector Graphics
Web › SVG › Attribute › refX
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...
...ion of the viewbox and preserveaspectratio attributes. if the attribute is not specified, no horizontal adjustment is made, and the left side of the symbol’s rectangular viewport region (regardless of the viewbox coordinate) is positioned at the x coordinate. ...
...eft side of 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...
refY - SVG: Scalable Vector Graphics
Web › SVG › Attribute › refY
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 o...
...cation of the viewbox and preserveaspectratio attributes. if the attribute is not specified, no vertical adjustment is made, and the top side of the symbol’s rectangular viewport region (regardless of the viewbox coordinate) is positioned at the y coordinate. ...
...top side of 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 bein...
repeatCount - SVG: Scalable Vector Graphics
unti...
...until the document ends). specifications ...
...xml" attributename="y" from="0" to="50" dur="1s" repeatcount="5"/> </rect> <rect x="120" y="0" width="100" height="100"> <animate attributetype="xml" attributename="y" from="0" to="50" dur="1s" repeatcount="indefinite"/> </rect> </svg> usage notes value <number> | indefinite default value none animatable no <number> this value specifies the number of iterations. it can include partial iterations expressed as fraction values. a fractional value describes a portion of the simple duration. values must be greater than 0. indefinite this value indicates that the animation will be repeated indefinitely (i.e. until the document ends). specifications specification status comment svg animations ...
rx - SVG: Scalable Vector Graphics
Web › SVG › Attribute › rx
cy="50" rx="0" ry="25" /> <ellipse cx="150" cy="50" rx="25" ry="25" /> <ellipse 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 re...
...o 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 attribute and the width of the rectangle: if a properly specified value is provided 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 ha...
...nd the width of the rectangle: if a properly specified value is provided 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 defini...
ry - SVG: Scalable Vector Graphics
Web › SVG › Attribute › ry
cy="50" ry="0" rx="25" /> <ellipse cx="150" cy="50" ry="25" rx="25" /> <ellipse 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 re...
...o 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 attribute and the width of the rectangle: if a properly specified value is provided 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 ha...
...nd the width of the rectangle: if a properly specified value is provided 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 defini...
scale - SVG: Scalable Vector Graphics
Web › SVG › Attribute › scale
specifications specification status comment filter effects module level 1the definition of 'scale' in that specification. w...
... specifications specification status comment filter effects module level 1the definition of 'scale' in that specification. working draft no change ...
...lacementmap in2="turbulence" in="sourcegraphic" scale="50"/> </filter> <circle cx="100" cy="100" r="80" style="filter: url(#displacementfilter);""/> <circle cx="100" cy="100" r="80" style="filter: url(#displacementfilter2); transform: translatex(240px);""/> </svg> usage notes value <number> default value none animatable yes <number> this value defines the scale factor for the displacement. when the value of this attribute is 0, this operation has no effect on the source image. specifications specification status comment filter effects module level 1the definition of 'scale' in that specification. working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition o...
side - SVG: Scalable Vector Graphics
Web › SVG › Attribute › side
this effectively reverses the path direction. specifications specification status comment ...
...this effectively reverses the path direction. specifications specification status comment scalable vector graphics (svg) 2the def...
...<text> <textpath href="#circle2" side="right">text right from the path</textpath> </text> <circle id="circle1" cx="100" cy="100" r="70" fill="transparent" stroke="silver"/> <circle id="circle2" cx="320" cy="100" r="70" fill="transparent" stroke="silver"/> </svg> usage notes value left | right default value left animatable yes left this value places the text on the left side of the path (relative to the path direction). right this value places the text on the right side of the path (relative to the path direction). this effectively reverses the path direction. specifications specification status comment scalable vector graphics (svg) 2the definition of 'side' in that specification. candidate recomme...
specularConstant - SVG: Scalable Vector Graphics
the specularconstant attribute controls the ratio of reflection of the specular lighting. it represents the ks value in the phong lighting model. the bigger the value the stronger the reflection. only one element is using this attribute: <fespecularlighting> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="specularlighting1" x="0" y="0" width="100%" height="100%"> <fespecularlighting in="sourcegraphic" specularconstant="1.2"> <fepointlight x="60" y="60" z="20" /> </fespecularlighting> </filter> <filter id="specularlighting2" x="0" y="0" width="100%" height="100%"> <fespecularlighting in="sourcegraphic" specularconstant="0.8"> <fepointlight x="60" y="60" z="20" /> </fespecularlighting> </filt...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'specularconstant' in that specification. recommenda...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'specularconstant' in that specification. recommendation initial definition ...
string - SVG: Scalable Vector Graphics
Web › SVG › Attribute › string
the available types are: "woff", "woff2", "truetype", "opentype", "embedded-opentype", and "svg". ...
... the available types are: "woff", "woff2", "truetype", "opentype", "embedded-opentype", and "svg". ...
... the available types are: "woff", "woff2", "truetype", "opentype", "embedded-opentype", and "svg". ...
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, p...
... 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-com...
... browser compatibility the compatibility table on this page is generated from structured data. ...
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...
... 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. desktopmobilechromeedgefirefo...
..." stroke="green" /> <!-- stroke width as a number --> <circle cx="15" cy="5" r="3" stroke="green" stroke-width="3" /> <!-- stroke width as a percentage --> <circle cx="25" cy="5" r="3" stroke="green" stroke-width="2%" /> </svg> usage notes value <length> | <percentage> default value 1px animatable yes note: a percentage value is always computed as a percentage of the normalized viewbox diagonal length. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfire...
stroke - SVG: Scalable Vector Graphics
Web › SVG › Attribute › stroke
candidate recommendation definition for shapes and texts. adds context-fill and context-stroke. scalable vector graphics (svg) 1.1 (second edition)th...
... candidate recommendation definition for shapes and texts. adds context-fill and context-stroke. scalable vector graphics (svg) 1.1 (second edition)the definition of 'stroke' in that s...
... ...
surfaceScale - SVG: Scalable Vector Graphics
<fepointlight x="60" y="60" z="20" /> </fediffuselighting> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting2); transform: translatex(220px);" /> </svg> fespecularlighting for <fespecularlighting>, surfacescale defines the height of the surface. ...
...0" /> </fediffuselighting> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting2); transform: translatex(220px);" /> </svg> fespecularlighting for <fespecularlighting>, surfacescale defines the height of the surface. ...
...="0" width="200" height="200" style="filter: url(#diffuselighting2); transform: translatex(220px);" /> </svg> fespecularlighting for <fespecularlighting>, surfacescale defines the height of the surface. value <number> default value 1 animatable yes fediffuselighting for <fediffuselighting>, surfacescale defines the height of the surface. value <number> default value 1 animatable yes specifications specification status comment filter effects module level 1the definition of 'surfacescale for <fediffuselighting>' in that specification. working draft no change filter effects module level 1the definition of 'surfacescale for <fespecularlighting>' in that specifica...
writing-mode - SVG: Scalable Vector Graphics
ectional algorithm and properties direction and unicode-bidi.) note: as a presentation attribute, writing-mode can be used as a css property. see the css writing-mode property for more information. as a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> usage notes default value horizontal-tb value horizontal-tb | vertical-rl | vertical-lr animatable yes horizontal-tb this value defines a top-to-bottom block flow direction. both the writing mode and the typographic mode are horizontal. vertical-rl this value defines a right-to-left block flow direction. both the writing mode and the typographic mode are vertical. vertical-lr this ...
...both the writing mode and the typographic mode are vertical. specifications specification status comment css writing modes module level 3the definition of 'writing-mode' in that specification. ...
... css writing modes module level 3the definition of 'writing-mode' in that specification. proposed recommendation definition in css writing modes 3 scalable vector graphics (svg) 2the definition of 'writing-mode' in that specification. candidate recommendation mainly refers to the definition in css writing modes 3 and defines a mapping between the deprecated svg 1.1 values and the new values. scalable vector graphics (svg) 1.1 (second edition)the definition of 'writing-mode' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull ...
x1 - SVG: Scalable Vector Graphics
Web › SVG › Attribute › x1
is attribute: <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. ...
...,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. ...
...dy,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> lineargradient for <lineargradient>, x1 defines the x 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 left bounding limit of the shape it is applied to ...
x2 - SVG: Scalable Vector Graphics
Web › SVG › Attribute › x2
this attribute: <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. ...
...ml,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. ...
...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> lineargradient for <lineargradient>, x2 defines the x 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 100% 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 right bounding limit of the shape it is applied to ...
xlink:arcrole - SVG: Scalable Vector Graphics
specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'xlink:arcrole' in that specification. recommendation initial...
... specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'xlink:arcrole' in that specification. recommendation initial definition ...
... specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'xlink:arcrole' in that specification. recommendation initial definition ...
xlink:show - SVG: Scalable Vector Graphics
the xlink:show attribute indicates how a linked resource should be opened and is meant for xlink-aware processors. in case of a conflict, the target attribute has priority, since it can express a wider range of values. only one element is using this attribute: <a> usage notes value new | replace | embed | other | none default value replace animatable no new this value specifies that the referenced resource is opened in a new window or tab. this is similar to the effect achieved by an html <a> element with target set to _blank. ...
...ider range of values. only one element is using this attribute: <a> usage notes value new | replace | embed | other | none default value replace animatable no new this value specifies that the referenced resource is opened in a new window or tab. this is similar to the effect achieved by an html <a> element with target set to _blank. replace this value specifies that the referenced resource is opened in the same window or tab. this is similar to the effect achieved by an html <a> element with target set to _self. embed this value specifies that instead of linking to the resource it will be loaded and shown within the document. this is similar to the effect achieved by an html <img> element. ...
...get set to _blank. replace this value specifies that the referenced resource is opened in the same window or tab. this is similar to the effect achieved by an html <a> element with target set to _self. embed this value specifies that instead of linking to the resource it will be loaded and shown within the document. this is similar to the effect achieved by an html <img> element. other this value indicates that other markup present in the link, i.e. the target attribute, determines its behavior. none this value specifies that there is no indication for how to refer to the linked resource. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'xlink:show' in that specification. recommendation ...
y1 - SVG: Scalable Vector Graphics
Web › SVG › Attribute › y1
is attribute: <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. ...
...,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. ...
...ody,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> 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...
y2 - SVG: Scalable Vector Graphics
Web › SVG › Attribute › y2
s attribute: <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. ...
...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. ...
...,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> 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 ...
z - SVG: Scalable Vector Graphics
Web › SVG › Attribute › z
"0" width="200" height="200" style="filter: url(#diffuselighting1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting2); transform: translatex(220px);" /> </svg> fepointlight for <fepointlight>, z defines the location along the z-axis for the light source in the coordinate system established by the primitiveunits attribute on the <filter> element. ...
..."filter: url(#diffuselighting1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting2); transform: translatex(220px);" /> </svg> fepointlight for <fepointlight>, z defines the location along the z-axis for the light source in the coordinate system established by the primitiveunits attribute on the <filter> element. ...
...r the light source in the coordinate system established by the primitiveunits attribute on the <filter> element. value <number> default value 1 animatable yes fespotlight for <fespotlight>, z defines the location along the z-axis for the light source in the coordinate system established by the primitiveunits attribute on the <filter> element. value <number> default value 1 animatable yes specifications specification status comment filter effects module level 1the definition of 'z for <fepointlight>' in that specification. working draft no change filter effects module level 1the definition of 'z for <fespotlight>' in that specification. working draft no chang...
<animate> - SVG: Scalable Vector Graphics
Web › SVG › Element › animate
the svg <animate> element provides a way to animate an attribute of an element over time. ...
...e. ...
...:100%; margin:0; padding:0; } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <rect width="10" height="10"> <animate attributename="rx" values="0;5;0" dur="10s" repeatcount="indefinite" /> </rect> </svg> attributes animation attributes animation timing attributes begin, dur, end, min, max, restart, repeatcount, repeatdur, fill animation value attributes calcmode, values, keytimes, keysplines, from, to, by other animation attributes most notably: attributename, additive, accumulate animation event attributes most notably: onbegin, onend, onrepeat global attributes core attributes most notably: id styling attributes class, style event attributes global event attributes, document element event attributes usage notes this element implements the svg...
<feComponentTransfer> - SVG: Scalable Vector Graphics
the colors are modified by changing each channel (r, g, b, and a) to the result of what the children <fefuncr>, <fefuncb>, <fefuncg>, and <fefunca> return. ...
...idth="100%" height="100%"> <fecomponenttransfer> <fefuncr type="identity"></fefuncr> <fefuncg type="identity"></fefuncg> <fefuncb type="identity"></fefuncb> <fefunca type="identity"></fefunca> </fecomponenttransfer> </filter> <filter id="table" x="0" y="0" width="100%" height="100%"> <fecomponenttransfer> <fefuncr type="table" tablevalues="0 0 1 1"></fefuncr> <fefuncg type="table" tablevalues="1 1 0 0"></fefuncg> <fefuncb type="table" tablevalues="0 1 1 0"></fefuncb> </fecomponenttransfer> </filter> <filter id="discrete" x="0" y="0" width="100%" height="100%"> <fecomponenttransfer> <fefuncr type="discrete" tablevalues="0 0 1 1"></fefuncr> <fefuncg type="discrete" tablevalues="1 ...
...levalues="1 1 0 0"></fefuncg> <fefuncb type="table" tablevalues="0 1 1 0"></fefuncb> </fecomponenttransfer> </filter> <filter id="discrete" x="0" y="0" width="100%" height="100%"> <fecomponenttransfer> <fefuncr type="discrete" tablevalues="0 0 1 1"></fefuncr> <fefuncg type="discrete" tablevalues="1 1 0 0"></fefuncg> <fefuncb type="discrete" tablevalues="0 1 1 0"></fefuncb> </fecomponenttransfer> </filter> <filter id="linear" x="0" y="0" width="100%" height="100%"> <fecomponenttransfer> <fefuncr type="linear" slope="0.5" intercept="0"></fefuncr> <fefuncg type="linear" slope="0.5" intercept="0.25"></fefuncg> <fefuncb type="linear" slope="0.5" intercept="0.5"></fefuncb> </fecomponenttransfer> ...
Namespaces crash course - SVG: Scalable Vector Graphics
etnameditem setnameditemns the first parameter for all the dom2 namespace aware methods must be the namespace name (also known as the namespace uri) of the element or parameter in question. for svg elements this is 'http://www.w3.org/2000/svg'. however, note carefully: the namespaces in xml 1.1 recommendation states that the namespace name for parameters without a prefix does not have a value. ...
... not have a value. in other words, although the parameters belong to the namespace of the element, you do not use the tag's namespace name. instead, you must use null as the namespace name for unqualified (prefixless) parameters. so, to create an svg rect element using document.createelementns(), you must write: document.createelementns('http://www.w3.org/2000/svg', 'rect'); but to retrieve the value of the xparameter on an svg rect element, you must write: rect.getattributens(null, 'x'); note that this isn't the case for parameters with a namespace prefix (parameters that don't belong to the same xml dialect as the element). parameters such as xlink:href require the namespace name that was assigned to that prefix (http://www.w3.org/1999/xlink for xlink). ...
...retrieve the value of the xparameter on an svg rect element, you must write: rect.getattributens(null, 'x'); note that this isn't the case for parameters with a namespace prefix (parameters that don't belong to the same xml dialect as the element). parameters such as xlink:href require the namespace name that was assigned to that prefix (http://www.w3.org/1999/xlink for xlink). hence to get the value of the xlink:href parameter of an <a> element in svg you would write: elt.getattributens('http://www.w3.org/1999/xlink', 'href'); for setting parameters that have a namespace, it is recommended (but not required) that you also include their prefix in the second parameter so that the dom can later be more easily converted back to xml (if for instance you want to send it back to the server). for ...
Clipping and masking - SVG: Scalable Vector Graphics
eated might at first sight look contradictory. but when you try to create a semicircle in svg, you will find out the use of the following properties quickly. clipping refers to removing parts of elements defined by other parts. in this case, any half-transparent effects are not possible, it's an all-or-nothing approach. masking on the other hand allows soft edges by taking transparency and grey values of the mask into account. creating clips we create the above mentioned semicircle based on a circle element: <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <clippath id="cut-off-bottom"> <rect x="0" y="0" width="200" height="100" /> </clippath> </defs> <circle cx="100" cy="100" r="100" clip-path="url(#cut-off-botto...
...l="green" /> <rect x="0" y="0" width="200" height="200" fill="red" mask="url(#mask)" /> </svg> you see a green-filled rect at the lowest layer and on top a red-filled rect. the latter has the mask attribute pointing to the mask element. the content of the mask is a single rect element, that is filled with a black-to-white gradient. as a result the pixels of the red rectangle use the luminance value of the mask content as the alpha value (the transparency), and we see a green-to-red gradient as a result: screenshotlive sample transparency with opacity there is a simple possibility to set the transparency for a whole element. it's the opacity attribute: <rect x="0" y="0" width="100" height="100" opacity=".5" /> the above rectangle will be painted half-transparent. for the fill and strok...
...hich leads effectively to a double-color stroke. using well-known css techniques one of the most powerful tools in a web developer's toolbox is display: none. it is therefore little surprise, that it was decided to take this css property into svg as well, together with visibility and clip as defined by css 2. for reverting a previously set display: none it is important to know, that the initial value for all svg elements is inline. « previousnext » ...
Gradients in SVG - SVG: Scalable Vector Graphics
rmixed for the purposes of this example. for instance, this one tells the gradient to start at the color red, change to transparent-black in the middle, and end at the color blue. you can insert as many stop colors as you like to create a blend that's as beautiful or hideous as you need, but the offsets should always increase from 0% (or 0 if you want to drop the % sign) to 100% (or 1). duplicate values will use the stop that is assigned furthest down the xml tree. also, like with fill and stroke, you can specify a stop-opacity attribute to set the opacity at that position (again, in ff3 you can also use rgba values to do this). <stop offset="100%" stop-color="yellow" stop-opacity="0.5"/> to use a gradient, we have to reference it from an object's fill or stroke attributes. this is done the...
...nt isn't given at all, it's assumed to be at the same place as the center point. both linear and radial gradients also take a few other attributes to describe transformations they may undergo. the only other one i want to mention here is the spreadmethod attribute. this attribute controls what happens when the gradient reaches its end, but the object isn't filled yet. it can take on one of three values, "pad", "reflect", or "repeat". "pad" is what you have seen so far. when the gradient reaches its end, the final offset color is used to fill the rest of the object. "reflect" causes the gradient to continue on, but reflected in reverse, starting with the color offset at 100% and moving back to the offset at 0%, and then back up again. "repeat" also lets the gradient continue, but instead of goi...
...15" y="140" fill="white" font-family="sans-serif" font-size="12pt">repeat</text> <text x="125" y="140" fill="white" font-family="sans-serif" font-size="12pt">reflect</text> </svg> screenshotlive sample both gradients also have an attribute named gradientunits, which describes the unit system you're going to use when you describe the size or orientation of the gradient. there are two possible values to use here: userspaceonuse or objectboundingbox. objectboundingbox is the default, so that's what has been shown so far. it essentially scales the gradient to the size of your object, so you only have to specify coordinates in values from zero to one, and they're scaled to the size of your object automatically for you. userspaceonuse essentially takes in absolute units. so you have to know wher...
SVG fonts - SVG: Scalable Vector Graphics
horiz-adv-x="300"><!-- outline of exclam. pt. glyph --></glyph> <glyph unicode="@"><!-- outline of @ glyph --></glyph> <!-- more glyphs --> </font> we start with the <font> element. this bears an id attribute, to enable it to be referenced via a uri (see below). the horiz-adv-x attribute determines how wide a character is on average compared to the path definitions of the single glyphs. ...
...e of exclam. pt. glyph --></glyph> <glyph unicode="@"><!-- outline of @ glyph --></glyph> <!-- more glyphs --> </font> we start with the <font> element. this bears an id attribute, to enable it to be referenced via a uri (see below). the horiz-adv-x attribute determines how wide a character is on average compared to the path definitions of the single glyphs. the value 1000 sets a reasonable value to work with. ...
...the font-weight and font-style attributes have the same purpose as the equivalent descriptors in css. all following attributes are rendering instructions for the font layout engine, for example, how much of the glyphs' overall heights are ascenders. ...
not - XPath
Web › XPath › Functions › not
you can test if an element doesn't have some attribute. ...
...--> </xsl:template> defined xpath 1.0 4.3 gecko support supported. ...
...on that evaluates to true. notes this function should behave similarly to the boolean() function except that it returns the opposite value. you can test if an element doesn't have some attribute. <xsl:for-each match="//a[not(@name and @name = 'badname')]"> <!-- iterates over any <a> element in the document, that either has no 'name' attribute at all, or it has one, but its value is not "badname". --> </xsl:template> defined xpath 1.0 4.3 gecko support supported. ...
Basic Example - XSLT: Extensible Stylesheet Language Transformations
</u> stays mainly in the plains. ...
...l" /> <xsl:template match="/"> <html> <head> <title> <xsl:value-of select="/myns:article/myns:title"/> </title> <style type="text/css"> .mybox {margin:10px 155px 0 50px; border: 1px dotted #639ace; padding:0 5px 0 5px;} </style> </head> <body> <p class="mybox"> <span class="title"> <xsl:value-of select="/myns:article/myns:title"/> </span> <br /> authors: <br /> <xsl:apply-templates select="/myns:article/myns:authors/myns:author"/> </p> <p class="mybox"> <xsl:apply-templates select="//myns:body"/> </p> </body> </html> </xsl:template> <xsl:template match="myns:author"> -- <xsl:value-of select...
...<br /> authors: <br /> <xsl:apply-templates select="/myns:article/myns:authors/myns:author"/> </p> <p class="mybox"> <xsl:apply-templates select="//myns:body"/> </p> </body> </html> </xsl:template> <xsl:template match="myns:author"> -- <xsl:value-of select="." /> <xsl:if test="@company"> :: <b> <xsl:value-of select="@company" /> </b> </xsl:if> <br /> </xsl:template> <xsl:template match="myns:body"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> the example loads using synchronou...
Loading Content Scripts - Archive of obsolete content
and consists only of a static string, don't use contentscript: if you do, you may have problems getting your add-on approved on amo. instead, keep the script in a separate file and load it using contentscriptfile. this makes your code easier to maintain, secure, debug and review. the contentscriptwhen option specifies when the content script(s) should be loaded. it takes one of three possible values: "start" loads the scripts immediately after the document element for the page is inserted into the dom. at this point the dom content hasn't been loaded yet, so the script won't be able to interact with it. "ready" loads the scripts after the dom for the page has been loaded: that is, at the point the domcontentloaded event fires. at this point, content scripts are able to interact ...
...for the page has been loaded: that is, at the point the domcontentloaded event fires. at this point, content scripts are able to interact with the dom content, but externally-referenced stylesheets and images may not have finished loading. "end" loads the scripts after all content (dom, js, css, images) for the page has been loaded, at the time the window.onload event fires. the default value is "end". the contentscriptoptions is a json that is exposed to content scripts as a read only value under self.options property. any kind of jsonable value (object, array, string, etc.) can be used here. ...
base64 - Archive of obsolete content
ng base64 algorithms. var base64 = require("sdk/base64"); var encodeddata = base64.encode("hello, world"); var decodeddata = base64.decode(encodeddata); globals functions encode(data, charset) creates a base-64 encoded ascii string from a string of binary data. parameters data : string the data to encode charset : string the charset of the string to encode (optional). the only accepted value is "utf-8". in order to encode and decode unicode strings, the charset parameter needs to be set: var base64 = require("sdk/base64"); var encodeddata = base64.encode(unicodestring, "utf-8"); returns string : the encoded string decode(data, charset) decodes a string of data which has been encoded using base-64 encoding. parameters data : string the encoded data charset : string the cha...
...in order to encode and decode unicode strings, the charset parameter needs to be set: var base64 = require("sdk/base64"); var decodeddata = base64.decode(encodeddata, "utf-8"); returns string : the decoded string ...
indexed-db - Archive of obsolete content
of the current tab to a database, while the button labeled "list" lists all the titles in the database. the add-on implements helper functions open(), additem() and getitems() to open the database, add a new item to the database, and get all items in the database. ...
...= db.transaction(["items"], "readwrite"); var store = trans.objectstore("items"); var items = new array(); trans.oncomplete = function() { cb(items); } var keyrange = idbkeyrange.lowerbound(0); var cursorrequest = store.opencursor(keyrange); cursorrequest.onsuccess = function(e) { var result = e.target.result; if(!!result == false) return; items.push(result.value.name); result.continue(); }; cursorrequest.onerror = database.onerror; }; function listitems(itemlist) { console.log(itemlist); } open("1"); var add = require("sdk/ui/button/action").actionbutton({ id: "add", label: "add", icon: "./add.png", onclick: function() { additem(require("sdk/tabs").activetab.title); } }); var list = require("sdk/ui/button/action").actionbutto...
l10n - Archive of obsolete content
localize strings appearing in the add-on's javascript code. usage to learn how to use this module to write localizable code, read the localization tutorial. note that you can't currently use localize strings appearing in content scripts or html files, but you can share the localized strings you want by assigning it's values to a json serializable object. globals functions get(identifier, count, placeholder1...n) this function takes a string parameter which it uses as an identifier to look up and return a localized string in the locale currently set for firefox. localized strings are supplied by the add-on developer in .properties files stored in the add-ons "locale" directory. the gettext tools uses "_" for the name of the function that retrieves localized strings. for compatibilit...
...enced by the identifier parameter, it returns the identifier itself. this enables you to write functional, localizable code without localizing any strings - just make the identifiers the default language: var _ = require("sdk/l10n").get; console.log(_("hello!")); however, this will make it more difficult to maintain your code if you have many localizations, because any changes to the identifier values break all your .properties files. if you're supplying different localizations for a string depending on the number of items (that is, whether to use a singular or plural form) then get() takes a second integer parameter which indicates the number of items there are. you can supply one or more placeholders to get(), which are strings, such as proper names, that should not be translated themselv...
system - Archive of obsolete content
ystem').pathfor('tmpd'); // get os desktop path for an active user (~/desktop on linux // or c:\documents and settings\username\desktop on windows). var desktoppath = require('sdk/system').pathfor('desk'); parameters id : string the id of the special directory. returns string : the path to the directory. properties env this object provides access to environment variables. ...
...log("path is set"); } you can set a variable by setting the property: var system = require("sdk/system"); system.env.foo = "bar"; console.log(system.env.foo); you can unset a variable by deleting the property: var system = require("sdk/system"); delete system.env.foo; you can't enumerate environment variables. platform the type of operating system you're running on. this will be one of the values listed as os_target, converted to lower case. var system = require("sdk/system"); console.log("platform = " + system.platform); architecture the type of processor architecture you're running on. this will be one of: "arm"``,"ia32", or"x64"`. var system = require("sdk/system"); console.log("architecture = " + system.architecture); compiler the type of compiler used to build the host applica...
io/text-streams - Archive of obsolete content
rs textreader(inputstream, charset) creates a buffered input stream that reads text from a backing stream using a given text encoding. you can also create textreader objects using io/file's open() function. parameters inputstream : stream the backing stream, an nsiinputstream. it must already be opened. charset : string inputstream is expected to be in the character encoding named by this value. if not specified, "utf-8" is assumed. see nsicharsetconvertermanager.idl for documentation on how to determine other valid values for this. textwriter(outputstream, charset) creates a buffered output stream that writes text to a backing stream using a given text encoding. you can also create textwriter objects using io/file's open() function. parameters outputstream : stream the backing st...
...r(outputstream, charset) creates a buffered output stream that writes text to a backing stream using a given text encoding. you can also create textwriter objects using io/file's open() function. parameters outputstream : stream the backing stream, an nsioutputstream. it must already be opened. charset : string text will be written to outputstream using the character encoding named by this value. if not specified, "utf-8" is assumed. see nsicharsetconvertermanager.idl for documentation on how to determine other valid values for this. textreader methods close() closes both the stream and its backing stream. read(numchars) reads and returns a string from the stream. if the stream is closed, an exception is thrown. parameters numchars : number the number of characters to read. if n...
stylesheet/style - Archive of obsolete content
ray of strings, that represents local uri to stylesheet. source string,array a string, or an array of strings, that contains css rules. those rules are applied after the rules in the stylesheet specified with uri options, if provided. optional options: name type type string the type of the sheet. it accepts the following values: "agent", "user" and "author". if not provided, the default value is "author". style properties source an array of strings that contains the css rule(s) specified in the constructor's option; null if no source option was given to the constructor. this property is read-only. uri an array of strings that contains the stylesheet local uri(s) specified in the constructor's option; nu...
...this property is read-only. ...
system/environment - Archive of obsolete content
access, set and clear environment variables. ...
...ar { env } = require('sdk/system/environment'); you can get the value of an environment variable, by accessing the property with the name of the desired variable: var path = env.path; you can check for the existence of an environment variable by checking whether a property with that variable name exists: console.log('path' in env); // true console.log('foo' in env); // false you can set the value of an environment variable by setting the property: env.foo = 'foo'; env.path += ':/my/path/' you can unset an environment variable by deleting the property: delete env.foo; limitations there is no way to enumerate existing environment variables, also env won't have any enumerable properties: console.log(object.keys(env)); // [] environment variable will be unset, show up as non-existing i...
ui/frame - Archive of obsolete content
the data property of the event is t...
...the data property of the event is the message payload. ...
util/deprecate - Archive of obsolete content
experimental functions to deprecate code. globals functions deprecatefunction(fun, msg) dump to the console the error message given in the second argument, prefixed with "deprecated:", and print the stacktrace; then execute the function passed as first argument and returns its value. it does not raise an exception, but just displays the error message and continues to execute the function. ...
...it does not raise an exception, but just displays the error message and continues to execute the function. this function is mostly used to flag usage of deprecated functions, that are still available but which we intend to remove in a future release. parameters fun : function the function to execute after the error message msg : string the error message to display returns * : the returned value from fun deprecateusage(msg) dump to the console the error message given, prefixed with "deprecated:", and print the stacktrace. it does not raise an exception, but just displays the error message and returns. this function is mostly used to flag usage of deprecated functions that are no longer available. parameters msg : string the error message to display ...
util/object - Archive of obsolete content
properties of all arguments into the first argument. if two or more argument objects have properties with the same name, the property is overwritten with precedence from right to left, implying that properties of the object on the left are overwritten by a same named property of an object on the right. properties are merged with descriptors onto the source object. any argument given with "falsy" values (null, undefined) in case of objects are skipped. let { merge } = require("sdk/util/object"); var a = { jetpacks: "are yes", foo: 10 } var b = merge(a, { foo: 5, bar: 6 }, { foo: 50, location: "sf" }); b === a // true b.jetpacks // "are yes" b.foo // 50 b.bar // 6 b.location // "sf" // merge also translates property descriptors var c = { "type": "addon" }; var d = {}; object.defi...
...e of objects are skipped. let { merge } = require("sdk/util/object"); var a = { jetpacks: "are yes", foo: 10 } var b = merge(a, { foo: 5, bar: 6 }, { foo: 50, location: "sf" }); b === a // true b.jetpacks // "are yes" b.foo // 50 b.bar // 6 b.location // "sf" // merge also translates property descriptors var c = { "type": "addon" }; var d = {}; object.defineproperty(d, "name", { value: "jetpacks", configurable: false }); merge(c, d); var props = object.getownpropertydescriptor(c, "name"); console.log(props.configurable); // true parameters source : object the object that other properties are merged into. arguments : object n amount of additional objects that are merged into source object. returns object : the source object. extend(arguments) returns an object that ...
Creating annotations - Archive of obsolete content
amed "id". the idea here is to make it more likely that the annotator will be able to identify annotated elements correctly later on. if the page element is eligible for annotation, then the selector highlights that element and binds a click handler to it. the click handler sends a message called show back to the main add-on code. the show message contains: the url for the page, the id attribute value, and the text content of the page element. $('*').mouseenter(function() { if (!active || $(this).hasclass('annotated')) { return; } resetmatchedelement(); ancestor = $(this).closest("[id]"); matchedelement = $(this).first(); originalbgcolor = $(matchedelement).css('background-color'); $(matchedelement).css('background-color', 'yellow'); $(matchedelement).bind('click.annotator...
...n the corresponding content script we do two things: handle a message from the add-on code by giving the text area focus listen for the return key and when it is pressed, send the contents of the text area to the add-on. here's the code: var textarea = document.getelementbyid('annotation-box'); textarea.onkeyup = function(event) { if (event.keycode == 13) { self.postmessage(textarea.value); textarea.value = ''; } }; self.on('message', function() { var textarea = document.getelementbyid('annotation-box'); textarea.value = ''; textarea.focus(); }); save this inside data/editor as annotation-editor.js. updating main.js again now we'll update main.js again to create the editor and use it. first, import the panel module: var panels = require('sdk/panel'); then add the...
Bootstrapped extensions - Archive of obsolete content
a, reason ); parameters data a bootstrap data structure. reason one of the reason constants, indicating why the extension is being uninstalled. this will be one of addon_uninstall, addon_upgrade, or addon_downgrade. reason constants the bootstrap functions accept a reason parameter, which explains to the extension why it's being called. the reason constants are: constant value description app_startup 1 the application is starting up. app_shutdown 2 the application is shutting down. addon_enable 3 the add-on is being enabled. addon_disable 4 the add-on is being disabled. (also sent during uninstallation) addon_install 5 the add-on is being installed. addon_uninstall 6 the add-on...
...ve property section, if you had a folder named en-us in locale, the chrome.manifest file should contain: locale name_of_your_addon en-us locale/ here is an example add-on that opens an html page and a xul page on install: github :: l10n-xhtml-xul. here is an example showing how to use a localized html page as an options page: github :: l10n-html-options. you can go to about:config and change the value of the preference general.useragent.locale to en-us and then to en-gb and then reload the open pages to see the localization change. further reading how to convert an overlay extension to restartless a step by step guide. some code samples are provided. the page is based on and expanded from dave garrett's step-by-step guide to convert an old overlay based extension into a restartless addon. ...
Cookies - Archive of obsolete content
reading existing cookies cookies for a given host, represented as nsicookie2 objects, can be enumerated as such: let enum = services.cookies.getcookiesfromhost("example.com"); while (enum.hasmoreelements()) { var cookie = enum.getnext().queryinterface(ci.nsicookie2); dump(cookie.host + ";" + cookie.name + "=" + cookie.value + "\n"); } all cookies, regardless of host, can be enumerated using services.cookies.enumerator rather than getcookiesfromhost(). ...
...m.getnext().queryinterface(ci.nsicookie2); dump(cookie.host + ";" + cookie.name + "=" + cookie.value + "\n"); } all cookies, regardless of host, can be enumerated using services.cookies.enumerator rather than getcookiesfromhost(). setting a cookie the following code demonstrates how to set a cookie in firefox. ...
Downloading Files - Archive of obsolete content
null should be used instead. ...
...ung"; var hardcodedpassword = "foobar"; persist.progresslistener = { queryinterface: xpcomutils.generateqi(["nsiauthprompt"]), // implements nsiauthprompt prompt: function(dialogtitle, text, passwordrealm, savepassword, defaulttext, result) { result.value = hardcodedpassword; return true; }, promptpassword: function(dialogtitle, text, passwordrealm, savepassword, pwd) { pwd.value = hardcodedpassword; return true; }, promptusernameandpassword: function(dialogtitle, text, passwordrealm, savepassword, user, pwd) { user.value = hardcodedusername; pwd.value = hardcodedpassword; return true; } }; persist.saveuri(urltosave, null, null, null, "", nsfileinstance, privacy); the above is going to give you errors about missing nsidownloadprogresslistener meth...
IsDefaultNamespace - Archive of obsolete content
the following is a snippet to get isdefaultnamespace() supported across other browsers. note that all gecko-based browsers (including firefox) support node.isdefaultnamespace. this function is not necessary for gecko-based browsers (though the function will quickly return the standard value for mozilla browsers). // http://www.w3.org/tr/dom-level-3-core/core.html#node3-isdefaultnamespace // http://www.w3.org/tr/dom-level-3-core/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); } ...
...de.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 return isdefaultnamespace(node.parentnode, namespaceuri); } else { return false; // unknown; } case 9: // document_node return isdefault...
Label and description - Archive of obsolete content
the default style for these xul elements includes white-space: wrap;. this reduces all whitespace chunks (including newlines) to single spaces. text is permitted to wrap. ...
...rdless of the css style, but this creates a hard-break that does not change as parent elements resize. <description>i am your father's brother's nephew's cousin's former roommate.<html:br/> what's that make us?<html:br/> absolutely nothing!</description> using labels as anchors its possible to make a label look and act like an html <a> tag: <label class="text-link" href="http://whatever.com" value="click here to go to whatever"/> "text-link" is a built-in, predefined class. note: if running in a xulrunner application add the following preferences to your default preferences file: pref("network.protocol-handler.expose.http", false); pref("network.protocol-handler.warn-external.http", false); change or add additional protocols (https or ftp) as needed. ...
LookupNamespaceURI - Archive of obsolete content
however, due to bug 312019, this method does not work with dynamically assigned namespaces (e.g., those set with node.prefix). ...
...re 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; // unknown } if (att.name === 'xmlns' && prefix == null) { // default namespace if (att.value) { return att.value; ...
Progress Listeners - Archive of obsolete content
freshattempted notifications are optional. the tabbrowser uses a strong reference to your listener object. gecko 2.0 note starting in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1), all events are optional. the tabbrowser only notifies you of the events for which you provide a callback. remember to change mylistener to a unique identifier. example: notification when the value in address bar changes a commonly asked question is how to get notified whenever the url in the address bar (also known as location bar) changes. using the following code, you will get notified when user navigates to another page (by clicking a link, using the back/forward button, by typing an address in the location bar, etc.) and also when user switches tabs. var myextension = { oldurl: n...
...", function() { myextension.init() }, false); window.addeventlistener("unload", function() { myextension.uninit() }, false); note: if you use the same listener for more than one tab/window, use awebprogress.domwindow in the callback methods to obtain the tab/window which triggers the state change or event. example: example of listener for anchor change the above example "notification when the value in address bar changes" fires multiple times, one of which is when the tab is changed. in some cases you want to catch only a location change when the anchor changes. to do this the optional aflags parameter of the onlocationchange listener is used. var myext_urlbarlistener = { onlocationchange: function (aprogress, arequest, auri, aflags) { if (aflags & ci.nsiwebprogresslistener.loc...
Default Preferences - Archive of obsolete content
ar spot: | extension root +--|content +--|skin +--|defaults +--|preferences to add preferences simply drop a .js file into that directory and mozilla will read it and set the appropriate preferences. the actual file, despite having .js extension, is not a javascript file. ...
...es inside of it, nor may do any kind of program flow control (ifs, loops etc.) nor even calculated values (i.e. 3600 * 24 * 5). doing so will cause mozilla to stop processing your preferences file without any notification, warning, error, or exception. think of it more as an .ini file. comments are perfectly acceptable. inside your file you set preferences using the pref() function: pref("name", "value") example: pref('extensions.defaultprefs.example.int', 1); pref('extensions.defaultprefs.example.float', 0.1); pref('extensions.defaultprefs.example.string', 'fadf'); pref('extensions.defaultprefs.example.bool', true); notice that unlike when you're reading preferences, writing default preferences uses the same function no matter the data type of the preference. you simply pass it directly to ...
Chapter 2: Technologies used in developing extensions - Archive of obsolete content
ies. it has a number of useful qualities: it is generic, extensible, and easy to validate as well-formed. some examples of xml-based markup languages include xhtml, which is html redefined on an xml base; svg, for expressing vector images; and mathml, for expressing mathematical formulas. xul, which is used in firefox, is also based on xml. listing 1: xml syntax <elementname someattribute="somevalue"> content </elementname> as shown in listing 1, xml uses elements, which consist of an opening tag, a closing tag, and content. note: elements that take no content can be expressed in compact form as <elementname/>. an element can include other elements as well as text in its content, and all information is structured as a tree. as in all trees, elements can have children (elements contained...
...tag, and content. note: elements that take no content can be expressed in compact form as <elementname/>. an element can include other elements as well as text in its content, and all information is structured as a tree. as in all trees, elements can have children (elements contained within them) and parents (elements that contain them). attributes can also be added to opening tags, each with a value. as the "extensible" part of xml implies, elements from various xml-based languages such as xhtml and svg can be interspersed in one another as a means to extend the language. all elements can carry a "namespace uri" identifier, which is unique for each language. for example, even though xhtml and svg have elements with the same name, these can be distinguished. the namespace uri for xhtml is "h...
Adding sidebars - Archive of obsolete content
l need finer grained control than the one provided by a tabbox. in these cases the « xul reference « and « xul reference « elements are probably what you're looking for. they are extremely useful, and you'll find yourself using them in many situations besides sidebars. a deck is like a tabbbox without the tabs. it only displays one of its child nodes at a time, depending on its selectedindex value. in the following example, the second child will be displayed, not the first which would be the default. <deck selectedindex="2"> <hbox> <!-- content for the first child. --> </hbox> <hbox> <!-- content for the second child. --> </hbox> </deck> note how this is one of the few cases where an attribute of an element is named using camel case instead of all small caps. th...
... you use hbox or vbox elements as children of a deck or stack. the code is easier to read and maintain this way. a deck can be very useful when you have a large piece of xul code that only changes in a small way depending on different circumstances. for instance, you could have a window that is used for two different purposes, and the only difference between the two cases is a label that has a value in one case and something else in another. using a .properties file and a string bundle is a viable option, but it involves a lot of code for something so simple, specially if that's the only case where you need dynamic text. the alternative is to use a deck with the two labels, and change the selected index depending on the purpose of the window. this way you can still use dtd, and the code rema...
Setting Up a Development Environment - Archive of obsolete content
emplates that generate the folder structure for the project, and that's not much help. we recommend komodo edit. it's free, open source, and cross-platform. it's based on the mozilla xulrunner platform, so it has support for some of the particularities in firefox extension development. komodo edit has automatic completion for xul tags and attributes, and it supports mozilla's css extensions (css values and properties beginning with "-moz"). it has an add-on system similar to the one in firefox, and there are some komodo extensions that provide additional help in extension development. that is more than what you can get with most other editors, so we recommend you to give it a try. all of our examples are handled with komodo edit, so if you see a .kpf or .komodoproject file in an example you do...
...e makefile. we use this information to locate the installation path of the extension and overwrite the installed files. if firefox is open at the time you run "make install", you'll have to restart it in order to see the changes. it's still better than installing the xpi all over again. you may need to alter the profile location in your makefile. in order to set the profile location to the right value, you should read the support article on profiles, at the mozilla support site. we'll also delve deeper in this topic later on in this section. to make "make install" work on non-windows systems, you need an extra step. the install process requires using an environment variable called ostype, which is not exported. long story short, if you want to run it from a command line, you need to run: e...
XML data - Archive of obsolete content
esheet uses rules that map tags in the xml document to the display types used by html. example data in an xml document uses <info> tags. you want the document's info elements to be displayed like html paragraphs. ...
... for the full list of display types, see the display property in the css specification. using css alone, the structure of the display must be the same as the structure of the document. ...
Case Sensitivity in class and id Names - Archive of obsolete content
et of class names to an element. any number of elements may be assigned the same class name or names. multiple class names must be separated by white space characters. the marker "[cs]" means "case sensitive," as defined in section 6.1 of the specification. thus, the mozilla team, committed to following open standards as closely as possible, implemented both class and id names as case-sensitive values. as of this writing, netscape 6 is the only browser to honor this defined behavior; other browsers treat both class and id names as case-insensitive. id uniqueness there is a further restriction, however, on the use of id names. section 12.2.1 makes it illegal for the name and id attributes to use values which are a case-insensitive match. an "illegal" example is given in the specification, p...
...legal" example is given in the specification, preceded by the text: "the following example is illegal with respect to uniqueness since the two names are the same except for case." <p><a name="xxx">...</a> <p><a name="xxx">...</a> we could freely substitute id for name and the point would be the same, since name and id share the same name space (see section 12.2.3). thus, even though class and id values are defined to be case-sensitive, there is an aspect of case-insensitivity to the use of id values. recommendation because of the flaws which are present in some existing implementations and the restrictions defined in html 4.01, it is doubly important to ensure that your class and id names are of a consistent case throughout a document, and that you do not attempt to define names which are c...
Localizing an extension - Archive of obsolete content
-us localization is located in the chrome/locale/en-us directory. localizing strings in javascript code if your javascript code contains literal strings that need to be localized, as does our stock watcher sample, we need to make those localizable as well. we can do this by moving the strings into a string bundle. string bundles are created by establishing a property file that maps keys to string values. for a detailed explanation of how this works, see xul tutorial:property files. create a properties file the first thing we do is create a property file for the literal strings used by the javascript code in stockwatcher2.js: changestring=chg: openstring=open: lowstring=low: highstring=high: volumestring=vol: the stockwatcher2.properties file shown above maps five keys (changestring, openstring...
...next step is to modify the stockwatcher2.xul file to reference this property file. we do this by creating a string bundle, using the following code: <stringbundleset id="stringbundleset"> <stringbundle id="string-bundle" src="chrome://stockwatcher2/locale/stockwatcher2.properties"/> </stringbundleset> this establishes a new string bundle, referenced by the id "string-bundle", whose keys and values are to be loaded from the stockwatcher2.properties file we've already created. note: you should use a unique id for each string bundle element for each file you use to avoid conflicts. (e.g. id="myextensionname-filename") update the javascript code now we're ready to revise the javascript code to load the strings from the string bundle instead of using literal strings. this involves rewriting ...
MMgc - Archive of obsolete content
e arrays and other objects of variable size that contain gc pointers or are otherwise desirable to have in managed memory. these flags may be passed to alloc to control the allocation type. /** * flags to be passed as second argument to alloc */ enum allocflags { kzero=1, kcontainspointers=2, kfinalize=4, krcobject=8 }; kzero zeros out the memory. otherwise, the memory contains undefined values. kcontainspointers indicates to the gc that the memory will contain pointers to other gc objects, and thus needs to be scanned by the gc's mark phase. if you know for certain that the objects will not contain gc pointers, leave this flag off; it will make the mark phase faster by excluding your object. kfinalize and krcobject are used internally by the gc; you should not need to set them in your...
...ctor zeroes memory upon free and this was hurting performance. since mmgc must traverse objects to decrement refcounts properly upon destruction, i just made destructors do zeroing too. this mostly applies to non-pointer fields as drcwb smart pointers do this for you. poisoned memory in debug builds, mmgc writes "poison" into deallocated memory as a debugging aid. here's what the different poison values mean: 0xfafafafa uninitialized unmanaged memory 0xedededed unmanaged memory that was freed explicitly 0xbabababa managed memory that was freed by the sweep phase of the garbage collector 0xcacacaca managed memory that was freed by an explicit call to gc::free (including drc reaping) 0xdeadbeef this is written to the 4 bytes just after any object allocated via mmgc. it is used for over...
Creating a Web based tone generator - Archive of obsolete content
les produced in the audio stream. in order to always have samples to play, a buffer of 500 ms is created. the function mozcurrentsampleoffset() is used to know the position of the samples being played so that we can fill a 500 ms buffer of audio samples. <!doctype html> <html> <head> <title>javascript audio write example</title> </head> <body> <input type="text" size="4" id="freq" value="440"><label for="hz">hz</label> <button onclick="start()">play</button> <button onclick="stop()">stop</button> <script type="text/javascript"> function audiodatadestination(samplerate, readfn) { // initialize the audio output. var audio = new audio(); audio.mozsetup(1, samplerate); var currentwriteposition = 0; var prebuffersize = sampl...
... var k = 2* math.pi * frequency / samplerate; for (var i=0, size=sounddata.length; i<size; i++) { sounddata[i] = math.sin(k * currentsoundsample++); } } var audiodestination = new audiodatadestination(samplerate, requestsounddata); function start() { currentsoundsample = 0; frequency = parsefloat(document.getelementbyid("freq").value); } function stop() { frequency = 0; } </script> </body> </html> ...
Images, Tables, and Mysterious Gaps - Archive of obsolete content
ages within a line box, and the placement of a line box within a table cell. first a basic line box containing text, shown in figure 3. the most crucial part of figure 3 is the baseline (represented by the blue line), and its placement within the line box. the baseline's exact placement is dependent on the "default" font for the line box (represented by the red box), which is determined by the value of font-family for the element that contains the line box. it isn't possible for an author to change the baseline's position directly, so wherever it ends up is where it will be. the space below the baseline is referred to as "descender space" since that's where the descenders in lowercase letters like "j", "y", and "q" are drawn. figure 4 shows what happens when we add an image to the mix. no...
...ed to as "descender space" since that's where the descenders in lowercase letters like "j", "y", and "q" are drawn. figure 4 shows what happens when we add an image to the mix. note where the image sits by default: its bottom edge is aligned with the baseline of the line box. this placement can be changed with vertical-align-- we'll talk about that in a bit-- but almost nobody ever changes the value from its default. let's take away the text, and leave only the image, as was done in figure 5. so we have an image sitting on the baseline of a line box that contains only the image. now consider what happens when we put that line in a table cell (figure 6). and there you have it-- spaces opening up where none have ever been seen before. it gets even worse with small images, like ones that ...
No Proxy For configuration - Archive of obsolete content
accessed via the proxy server. due to various limitations, this feature should be used for only the most simple blacklist scenarios. in almost all cases, pac gives better control and flexibility. user interface "no proxy for" is an optional field, part of "manual proxy configuration". the field is relatively short, but can hold reasonably long (2k+ characters) entries. new profiles contain the values "localhost, 127.0.0.1", by default. entry points: preferences | advanced | proxies control-click menu for off line-online icon (network plug) configuration the no proxy list is composed of either domain elements or ipv4 address elements. the elements are separated by either a space (" ") or a comma (","). note for former-ie users: "*" is supported only at the beginning of domain filte...
... all hostnames which have no periods in them. for example: "https://mycompanyintranet/" formats that are not accepted example domain filters with interior wildcards www.*.com ip address string prefixes 127. or 10.0.* ip addresses with wildcards in quads 10.*.*.* preferences name network.proxy.no_proxies_on default value localhost, 127.0.0.1 by default "localhost" and "127.0.0.1" are excluded, since most people assume these should connect to the local system. note: when ipv6 support is added, additional addresses will need to be added and tested. communicator used "network.proxy.none" limitations no ipv6 support - the backend stores ipv4 addresses as ipv6, but ipv6 formats are not supported. sc...
ActiveX Control for Hosting Netscape Plug-ins in IE - Archive of obsolete content
machine, you must register it either through an install script or manually: regsvr32 pluginhostctrl.dll you must have administrator privileges to install a new control on operating systems such as windows nt, 2000 & xp. usage insert some html like this into your content: <object classid="clsid:dbb2de32-61f1-4f7f-beb8-a37f5bc24ee2" width="500" height="300"> <param name="type" value="video/quicktime"/> <param name="src" value="http://www.foobar.com/some_movie.mov"/> <!-- custom arguments --> <param name="loop" value="true"/> </object> the classid attribute tells ie to create an instance of the plug-in hosting control, the width and height specify the dimensions in pixels. you may optionally specify a codebase attribute if you have packaged the control ...
...the plug-in hosting control, the width and height specify the dimensions in pixels. you may optionally specify a codebase attribute if you have packaged the control into a cab file and wish for it to be installed automatically. the following <embed> attributes have <param> tag equivalents: <param name="type" ...> is equivalent to typespecifies the mime type of the plug-in. the control uses this value to determine which plug-in it should create to handle the content. <param name="src" ...> is equivalent to srcspecifies an url for the initial stream of data to feed the plug-in. if you havent't specified a "type" param, the control will attempt to use the mime type of this stream to create the correct plug-in. <param name="pluginspage" ...> is equivalent to pluginspagespecifies a url where the...
Locked config settings - Archive of obsolete content
refs rather than defaults\pref the moz-byteshift.pl script allows to encode...: moz-byteshift.pl -s 13 <mozilla.cfg.txt >mozilla.cfg ... and to decode mozilla.cfg files: moz-byteshift.pl -s -13 <mozilla.cfg >mozilla.cfg.txt example of an unencoded file: mozilla.cfg.txt. the lockpref command puts into place a locked preference, whereas the defaultpref command merely puts into a place a default value (which the user may override in his prefs.js file). note that the file must start with //, or else it is not recognized by mozilla. as the encoding of the file is pretty trivial, the encoding as such does not provide any real security. instead make sure that file protections make this file unmodifiable by the unprivileged user. moreover, some settings (such as mail & news configuration) unfortuna...
...directory, rather than default\pref where all.js resides. ...
Automatically Handle Failed Asserts in Debug Builds - Archive of obsolete content
2004-12-8, it is now possible to automatically handle failed asserts in debug builds of mozilla for windows. the handler receives the assert string, and sequentially attempts to match each word in the string (left to right) to registry dword names from hklm\software\mozilla.org\windbgdlg and hkcu\software\mozilla.org\windbgdlg. at the first match, it will take the action specified by the dword's value. the valid values are: 0x5 automatically ignore 0x4 automatically retry 0x3 automatically abort note that you can also force windbgdlg to prompt, by setting a value of 0xfffffffe. to "comment out" a value, set its value to 0xffffffff. as an example, consider the following failed assertion: assertion: no document: 'mdocument != nsnull', file d:/cvs-1.11.4/mozilla/content/xul/content/src/nsxulele...
...the following failed assertion: assertion: no document: 'mdocument != nsnull', file d:/cvs-1.11.4/mozilla/content/xul/content/src/nsxulelement.cpp, line 3173 (note that i have my source tree in d:/cvs-1.11.4/mozilla) if you have a dword in hkcu\software\mozilla.org\windbgdlg\ named "d:/cvs-1.11.5/mozilla/content/xul/content/src/nsxulelement.cpp," (with the comma - matches are whole-word only) and value 0x5, the assert would automatically be ignored. if you also had a dword named "3173", it would have no effect here because the handler stops comparing values at the first match. note that double quotes which delimit an item (") are ignored in value names and the assertion string, so "silly" and silly will both be matched by a value named silly. "silly", will only be matched by a value named "sill...
Adding the structure - Archive of obsolete content
file. ...
... information. graphical panels (like the one we are creating here that displays an icon) are given the statusbarpanel-iconic class so they can be styled accordingly by the css stylesheet that defines these elements' appearance. the status attribute is not part of the xul definition for the statusbarpanel element, but is used by our extension to store the current tinderbox state. we'll update the value of that attribute each time we retrieve tinderbox's status from the server, and we'll define css rules that change the appearance of the icon depending on the value of that attribute. all xul elements can be given custom attributes in addition to the ones the xul rendering engine recognizes which get ignored by the engine, so adding this custom attribute does not create any problems or modify the...
Making it into a static overlay - Archive of obsolete content
to include this). its next line is the stylesheet reference we previously added to navigator.xul. after that is a xul overlay element. this element is the top-level element in a xul overlay file and serves to identify the file as an overlay. within that element is the script reference we previously added to navigator.xul. then there is a statusbar element containing a statusbarpanel element. the value of the id attribute of the statusbar element in our overlay matches the value of the id attribute of the statusbar element in navigator.xul. when navigator.xul is rendering into the browser's application interface, this causes any attributes or child elements of the statusbar element in the overlay file to be added to the interface's dom and thus show up in the interface as if they were defined o...
...... <statusbar id="status-bar" class="chromeclass-status" ondragdrop="nsdraganddrop.drop(event, contentareadndobserver);"> <statusbarpanel id="component-bar"/> <statusbarpanel id="statusbar-display" label="&statustext.label;" flex="1"/> <statusbarpanel class="statusbarpanel-progress"> <progressmeter class="progressmeter-statusbar" id="statusbar-icon" mode="normal" value="0"/> </statusbarpanel> <statusbarpanel class="statusbarpanel-iconic" id="tinderbox-status" status="none"/> <statusbarpanel class="statusbarpanel-iconic" id="offline-status"/> <statusbarpanel class="statusbarpanel-iconic" id="security-button" onclick="browserpageinfo(null, 'securitytab')"/> </statusbar> ... « previousnext » ...
Dehydra Function Reference - Archive of obsolete content
nt include calls are ignored. this is accomplished by recording every included file into the _includedarray in the current namespace. include example include("map.js") // includes map.js into toplevel var map = {} include("map.js", map) // includes map.js into the map object require({version:, strict:, werror:, gczeal:}) require is used to set runtime execution flags. it also returns the current values of these flags. require supports optional named arguments via javascript object where each parameter is a property. if a property is not specified then it will not be passed to the runtime. version integer: this sets js version similar to version() in js 1.7. strict boolean: controls js strict mode werror boolean: turns js warnings into errors gczeal int: this is a write-only parameter to set t...
...(msg, ...) the low level function called by print(). it does not print the location. read_file(filename) read a file a return it as a string. write_file(filename, data) write a string to a file. builtin objects sys this.sys is a container for miscellaneous properties exposes by dehydra sys.gcc_version is a gcc version string sys.include_path exposes the search path used by include(). the default value is the following directories: the directory of the dehydra script being processed the libs directory next to the gcc_dehydra.so plugin user script may add additional directories sys.aux_base_name exposes the base filename part of the file being compiled sys.frontend exposes the compiler frontend (e.g. "gnu c" or "gnu c++") arguments this.arguments is a javascript array containing command-line...
Drag and Drop Example - Archive of obsolete content
transferdata(); transferdata.data.adddataforflavour("text/unicode", txt); } } one function has been defined, ondragstart, which will be called by the nsdraganddrop object when necessary. the function adds the data to be dragged to the transfer object. the elem attribute is retrieved from the target of the drag event. the target will be the element that had the drag start on. we'll use the value of this attribute as the data of the drag. the boardobserver will need three functions, getsupportedflavours, ondragover and ondrop. the ondrop function will grab the data from the drag session and create a new element of the appropriate type. var boardobserver = { getsupportedflavours : function () { var flavours = new flavourset(); flavours.appendflavour("text/unicode"); return fl...
...unction, so no code is added in its body. the ondrop handler first uses the createelement function to create a new element of the type stored in the drag session. next, appendchild is called to add the new element to the stack, which is the target of the event. finally, we set some attributes on the new element. the position of elements in a stack is determined by the left and top attributes. the values of the pagex and pagey properties store the mouse pointer coordinates on the window where the drop occured. this allows us to place the new element at the position where the mouse button was released. this isn't quite the correct way to do this as we actually need to calculate the coordinates of the event relative to the stack. it works here because the board is at the top-left corner of the win...
Drag and Drop - Archive of obsolete content
it should not start a drag session. because the user generally has only one mouse, only one drag session is in use at a time. note that drag sessions can be created from within mozilla itself or from other applications. mozilla will translate the data being dragged as needed. the list below describes the event handlers that can be called, which may be placed on any element. you only need to put values for the handlers where you need to do something when the event occurs. ondrag called periodically throughout the drag and drop operation. ondraggesture called when the user starts dragging the element, which normally happens when the user holds down the mouse button and moves the mouse. the script in this handler should set up a drag session. ondragstart an alias for ondraggesture; th...
... the state of the drag. the function returns an object that implements nsidragsession. the interface nsidragsession is used to get and set properties of the drag that is currently occuring. the following properties and methods are available: candrop set this property to true if the element the mouse is currently over can accept the object currently being dragged to be dropped on it. set the value to false if it doesn't make sense to drop the object on it. this should be changed in the ondragover and ondragenter event handlers. dragaction set to the current action to be performed, which should be one or more of the constants described earlier. this can be used to provide extra feedback to the user. numdropitems the number of items being dragged. for example, this will be set to 5 if ...
Layout System Overview - Archive of obsolete content
rames that result in changes to content (see discussion above). another important mapping maintained by the frame manager is that of the undisplayed content. when a content element is defined as having no display (via the css property 'display:none') it is noted by a special entry in the undisplayed map. this is important because no frame is generated for these elements yet changes to their style values and to the content elements still need to be handled by layout, in case their display state changes from 'none' to something else. the undisplayed map keeps track of all content and style data for elements that currently have no frames. (note: the original architecture of the layout system included the creation of frames for elements with no display. this changed somewhere along the line, but th...
...tains a list of forms and form controls, as content nodes. this is presumably related to the fact that layout is responsible for form submission, but this is a design flaw that is being corrected by moving form submission into the content world. these collections of forms and form controls should be removed eventually. css frame constructor the frame constructor is responsible for resolving style values for content elements and creating the appropriate frames corresponding to that element. in addition to managing the creation of frames, the frame constructor is responsible for managing changes to the frames. frame construction is generally achieved by the use of stateless methods, but in some cases there is the need to provide context to frames created as children of a container. the frame mana...
Code snippets - Archive of obsolete content
resource.put(old); ...
...resource.put(old); ...
GRE Registration - Archive of obsolete content
tem. this document describes the registration mechanism. windows on windows, gre registration information is kept in the win32 registry under the hkey_local_machine/software/mozilla.org/gre and hkey_current_user/software/mozilla.org/gre keys. each subkey is searched for gre registration information: hklm/software/mozilla.org/gre/1.8_1 version=1.8 grehome=c:\path\to\installed-dir feature=value feature2=value2 hklm/software/mozilla.org/gre/1.8_2 version=1.8 grehome=c:\path\to\second-installation when installing a gre via the mozilla suite gre installer, the installer will blindly overwrite any previous gre information in hklm/software/mozilla.org/gre/<version>. when installing a gre via the command line <tt>xulrunner.exe -register-global</tt>, xulrunner will detect that there is...
..._2 until an available key is found. mac on mac, the only gre is the libxul framework xul.framework. this framework is installed either in /library/frameworks/xul.framework/versions/<version> or in ~/library/frameworks/xul.framework/versions/<version>. linux on linux, registration information is kept in ini-style files of the following form: [1.7.10] gre_path=/usr/lib/mozilla-1.7.10 feature=value feature2=value2 these ini files can be in any of the following locations: /etc/gre.conf /etc/gre.d/*.conf ~/.gre.conf ~/.gre.d/*.conf mozilla has never officially shipped a linux gre based on the mozilla suite. however, some linux distributors including red hat/fedora core ship /etc/gre.d/*.conf files with the mozilla suite rpms. xulrunner rpms/post-install scripts should register xulrunner as a...
Modularization techniques - Archive of obsolete content
pr_atomicdecrement(&glockcnt); } } extern "c" ns_export nsresult nsgetfactory(const nscid &acid, nsifactory **aresult)</strong> { if (aresult == null) { return ns_error_null_pointer; } *aresult = null; nsisupports *inst; <strong>if (acid.equals(ksamplecid)) { inst = new nssamplefactory(); } else { return ns_error_illegal_value; } if (inst == null) { return ns_error_out_of_memory; }</strong> nsresult res = inst->queryinterface(kifactoryiid, (void **) aresult); if (res != ns_ok) { // we didn't get the right interface, so clean up delete inst; } return res; } <strong>extern "c" ns_export prbool nscanunload() { return prbool(ginstancecnt == 0 && glockcnt == 0); }</strong> now, instead of ...
...l copies of that interface pointer are assumed to be in the lifetime of the calling function, and do not need to have addref() called. nsresult tweekfoo(ifoo *afoo1, ifoo *afoo2) { ifoo local = afoo; if (afoo->bar() == ns_ok) { local = afoo2; } return local->boff(); } in-out parameters in-out parameters are used as both in parameters and out parameters. if a function changes the value of an interface in-out parameter, it should call release() on the interface passed in and addref() on the interface passed out. nsresult refreshfoo(ifoo **afoo) { if (afoo == null || *afoo == null) { return ns_error_null_parameter; } if ((*afoo)->stale()) { ns_release(*afoo); *afoo = mfoo; ns_addref(*afoo); } return ns_ok; } global and member variables both global an...
Porting NSPR to Unix Platforms - Archive of obsolete content
orthogonal source code in the thread management, thread synchronization, and i/o area. the pthreads source files are in <tt>mozilla/nsprpub/pr/src/pthreads</tt>. i use the netbsd port i recently received as an example to illustrate the mechanical part of the porting process. there are a few new files you need to add: <tt>mozilla/nsprpub/config/netbsd.mk</tt> the name of this file is the return value of <tt>uname -s</tt> on the platform, plus the file suffix <tt>.mk</tt>. if the return value of <tt>uname -s</tt> is too long or ambiguous, you can modify it in <tt>mozilla/nsprpub/config/arch.mk</tt> (the makefile variable <tt>os_arch</tt>). <tt>mozilla/nsprpub/pr/include/md/_netbsd.cfg</tt> we have a program <tt>mozilla/nsprpub/pr/include/gencfg.c</tt> to help you generate partof this file. y...
...uous, you can modify it in <tt>mozilla/nsprpub/config/arch.mk</tt> (the makefile variable <tt>os_arch</tt>). <tt>mozilla/nsprpub/pr/include/md/_netbsd.cfg</tt> we have a program <tt>mozilla/nsprpub/pr/include/gencfg.c</tt> to help you generate partof this file. you can build the <tt>gencfg</tt> tool as follows: cd mozilla/nsprpub/pr/include gmake gencfg gencfg > foo.bar then you use the macro values in <tt>foo.bar</tt> as a basis for the <tt>_xxxos.cfg</tt> file. <tt>mozilla/nsprpub/pr/include/md/_netbsd.h</tt>: for local threads only version, the main challenge is to figure out how to define the three thread context switch macros. in particular, you need to figure out which element in the <tt>jmp_buf</tt> is the stack pointer. usually <tt>jmp_buf</tt> is an array of integers, and some pl...
Proxy UI - Archive of obsolete content
t any additional needed information in "related" ui. the "ok" button saves the preferences. the preference changes selecting the proxy "mode" all product's proxy preference panels share a basic design: a radio button that selects the proxy mode, then "related proxy mode" ui when needed. for the purposes of this document, "proxy mode" means both: whatever was selected in the ui (as opposed to the value of the network.proxy.type. the underlying behavior. the currently available modes are based on "network.proxy.type". for example, firefox 3: [ ] no proxy [ ] auto-detect proxy settings for this network [ ] manual proxy configuration: [ ] automatic proxy configuration url: behavior default value: "no proxy" is selected all other "type" radio buttons are enabled, but not selected. "related" ui ...
...ay the current proxy mode with a dot. the modes that can have an empty configuration (auto url and manual) will be disabled if the prefs are blank. selecting an enabled item sets the menu selection and the proxy mode (network.proxy.type) selecting a disabled item is not allowed. selecting "proxy configuration..." opens the preferences panel to "advanced > proxies" (tbdescribed: changing the prefs values). unfiled bug: changing proxy mode does not update the menu. mouseover when online, the tooltip will include the current proxy mode: code http://mxr.mozilla.org/seamonkey/sou...ityoverlay.xul bugs bug 243624 reference network.proxy.type ...
String Quick Reference - Archive of obsolete content
& str); handlestring(nsautostring(foo)); new way: wrap with nsdependentstring // foo is a prunichar* string // fix caller to be // void handlestring(const nsastring& str); handlestring(nsdependentstring(foo)); stack-based strings what: use of special stack-oriented classes why: to avoid excess heap allocations and memory leaks wrong: use nsstring/nscstring or raw characters // call getstringvalue(nsastring& out); nsstring value; getstringvalue(value); // call getstringvalue(char** out); char *result; getstringvalue(&result); // don't forget to free result! right: use nsautostring/nscautostring and nsxpidlstring/nsxpidlcstring // call getstringvalue(nsastring& out); nsautostring value; // 64-character buffer on stack getstringvalue(value); // call getstringvalue(char** out); nsxpidlcstr...
...tring value; getstringvalue(value); // call getstringvalue(char** out); char *result; getstringvalue(&result); // don't forget to free result! right: use nsautostring/nscautostring and nsxpidlstring/nsxpidlcstring // call getstringvalue(nsastring& out); nsautostring value; // 64-character buffer on stack getstringvalue(value); // call getstringvalue(char** out); nsxpidlcstring result; getstringvalue(getter_copies(result)); // result will free automatically original document information author: alec flett last updated date: april 30, 2003 copyright information: portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a creative commons license | details. ...
Example Sticky Notes - Archive of obsolete content
ncel this event, * but you may accomplish some last minute clean up. * "this" in this context refers to the bound element. */ // your code goes here ]]></destructor> <field name="priority"><![cdata[ /** * new "real" property for the bound element. * within this block the content is interpreted * as javascript code. the result of this code * evaluation (if any) will be used as initial value. */ "normal"; ]]></field> <property name="innertext"> <!-- new "virtual" property for the bound element. unlike <field> these are really two functions (getter and setter). within the virtual properties you cannot set or get the named property itself. say an attempt to assign this.innertext='something' will lead to circular setter call and stack overflow. --> <getter><![cdata[ var s...
... properties you cannot set or get the named property itself. say an attempt to assign this.innertext='something' will lead to circular setter call and stack overflow. --> <getter><![cdata[ var st = this.innerhtml || ''; if (st != '') { var re = /<\/?[^>]+>/gi; return st.replace(re,''); } else { return ''; } ]]></getter> <setter><![cdata[ // "val" in setter contains the assignment value. // here we simply echoing it back: return val; ]]></setter> </property> <method name="setborder"> <!-- new method for the bound element. unlike virtual property it is called in function context: this.setborder(arg) you also may define any amount of named arguments using <parameter name="argumentname"/> --> <parameter name="arg"/> <body><![cdata[ this.style.border = arg; ]]></bod...
modDateChanged - Archive of obsolete content
y returns whether file has been modified since a certain date. method of file object syntax boolean moddatechanged (filespecobject asourcefolder, number anolddate); parameters the moddatechanged method has the following parameters: asourcefolder a filespecobject representing the file to be queried. anolddate a double representing the date. returns a boolean value indicating whether the file has been modified since the input date or has not. description most often, the date passed in as the second parameter in moddatechanged is the returned value from a moddate on a separate file, as in the following example, in which the dates of two files are compared. example filesource1 = getfolder("program", "file1.txt"); filesource2 = getfolder("program", "file2...
... the dates of two files are compared. example filesource1 = getfolder("program", "file1.txt"); filesource2 = getfolder("program", "file2.txt"); err1 = file.moddate(filesource1); // the baseline returned err2 = file.moddatechanged(filesource1, err1); logcomment("file.moddatechanged should return 'false' = " + err2); // the reason it expects false is we're comparing // the return 'time stamp' value for // file1.txt with the actual file1.txt itself. // thus, no change in 'time stamp' values. err3 = file.moddatechanged(filesource2, err1); logcomment("file.moddatechanged should return 'true' = " + err2); // the reason it expects true is we're comparing // the return 'time stamp' value for // file1.txt with another file, file2.txt, with a different // 'time stamp' value. ...
compareTo - Archive of obsolete content
tallversion object or a string representing version information in the format "4.1.2.1234". returns if the versions are the same, this method returns 0. if this version object represents a smaller (earlier) version than that represented by the version parameter, this method returns a negative number. otherwise, it returns a positive number. in particular, this method returns one of the following values: -4 this version object has a smaller (earlier) major number than version. -3 this version object has a smaller (earlier) minor number than version. -2 this version object has a smaller (earlier) release number than version. -1 this version object has a smaller (earlier) build number than version. 0 the version numbers a...
... this version object has a larger (newer) build number than version. 2 this version object has a larger (newer) release number than version. 3 this version object has a larger (newer) minor number than version. 4 this version object has a larger (newer) major number than version. ...
addDirectory - Archive of obsolete content
e parameter to the initinstall method.this parameter can also be null, in which case the xpisourcepath parameter is used as a relative pathname.note that the registry pathname is not the location of the software on the computer; it is the location of information about the software inside the client version registry. version an installversion object or a string of up to four integer values delimited by periods, such as "1.17.1999.1517". for variants of this method without a version argument the value from initinstall will be used. xpisourcepath a string specifying the location of the directory within the xpi file.an empty string ("") causes the creation of a subdirectory node in the registry without actually unpacking any files, which may be useful when you are updat...
...sing a string representing the directory to the getfolder method. subdir the name of a directory to append to localdirspec, using '/' as the path separator regardless of the platform.if subdir is missing, null, or "", the filenames are appended directly to the folder name specified by localdirspec. flags an optional field; reserved for future use. pass 0 as the default value. returns an integer error code. for a list of possible values, see return codes. in some situations, adddirectory may return other errors. description the adddirectory method puts the files in the specified directory in a temporary location. to move the files and all other subcomponents to their final location, call the performinstall method after you've successfully added all subcomponents. al...
addFile - Archive of obsolete content
e specified in the initinstall method. this parameter can also be null, in which case the xpisourcepath parameter is used as a relative pathname.note that the registry pathname is not the location of the software on the machine; it is the location of information about the software inside the client version registry. version an installversion object or a string of up to four integer values delimited by periods, such as "1.17.1999.1517". for variants or this method without a version argument the value from initinstall will be used. xpisourcepath a string specifying the location of the file within the xpi file. localdirspec an object representing a directory. the file is installed under this directory on the user's machine. you create this object by pass...
...velocalpath a pathname relative to the localdirspec parameter. the file is installed in this location on the user's machine. you must always use forward slashes (/) in this pathname, regardless of the convention of the underlying operating system. if this parameter is blank or null, xpisourcepath is used. flags an optional field; reserved for future use. pass 0 as the default value. returns an integer error code. for a list of possible values, see return codes. description the addfile method puts the file in a temporary location. to move this and all other files to their final location, call the performinstall method after you've successfully added all files. note: if you are installing binary files on a macintosh, be aware that the binary format for those files must be ...
getFolder - Archive of obsolete content
ject syntax filespecobject getfolder ( string foldername); filespecobject getfolder ( string foldername, string subdirectory); filespecobject getfolder ( object localdirspec, string subdirectory); parameters the getfolder method has the following parameters: foldername a string representing one of netscape's standard directories. there are two sets of possible values for this parameter. the first set contains platform-independent locations; the second set contains platform-specific locations. you are encouraged to use the platform-independent locations. see the list in the description section for the two sets of locations. subdirectory a string that specifies the name of a subdirectory. if the specified subdirectory doesn't exist, it is created...
...bject representing a directory obtained by getcomponentfolder or getfolder. returns a filespecobject representing one of netscape's standard directories, or null in case of error or if subdirectory refers to a file that already exists. description the getfolder method obtains an object representing one of netscape's standard directories, for use with the addfile and getwinprofile methods. ...
loadResources - Archive of obsolete content
loadresources loads a properties file. method of install object syntax object loadresources( string xpipath ); parameters the sole input parameter for loadresources is a string representing the path to the properties file in the xpi in which the key/value pairs are defined. returns a javascript object whose property names are the keys from that file and whose values are the strings. description the format of the properties file expected by loadresources is the same as that of the chrome locale .properties files. this method is used to internationalize installation scripts by allowing the installer to retrieve localized string values from a separate file. be aware that the parameter specifies the file within the xpi and not on the file system, as the following example demonstrates. exam...
...llowing the installer to retrieve localized string values from a separate file. be aware that the parameter specifies the file within the xpi and not on the file system, as the following example demonstrates. example given a xpi with this internal structure: install.js bin/res_eg_2.properties bin/somefile.exe bin/... ...
patch - Archive of obsolete content
ed in the initinstall method. this parameter can also be null, in which case the xpisourcepath parameter is used as a relative pathname. note that the registry pathname is not the location of the software on the computer; it is the location of information about the software inside the client version registry. version an installversion object or a string of up to four integer values delimited by periods, such as "1.17.1999.1517". for variants or this method without a version argument the value from initinstall will be used. xpisourcepath a string specifying the location of the differences file within the xpi file. localdirspec an object representing the directory in which the subcomponent that is to be patched resides. you create this object by p...
...o the getfolder method. relativelocalpath a pathname relative to the localdirspec parameter that identifies the subcomponent that is to be patched. you must always use forward slashes (/) in this pathname, regardless of the convention of the underlying operating system. if this parameter is blank or null, xpisourcepath is used. returns an integer error code. for a list of possible values, see return codes. description the patch method to update an existing component by applying a set of differences between two known versions. the set of differences is in gdiff format and is created by the nsdiff utility. a patch can only be applied between two known versions. if the existing version of the file does not match the checksum stored in the gdiff file, patch returns an error with...
Properties - Archive of obsolete content
ugin as an extension. properties archive full local path of the archive after it is downloaded to the platform specific temp folder. (e.g. c:\temp\argstest.xpi) arguments args can be passed in through the triggering apis by attaching a ? and then the rg string to the xpi url: (e.g. startsoftwareupdate("http://webserver/argstest.xpi?argument_string") will result in the value of install.arguments being argument_string #). note that spaces in the arg string are legal. everything after the question mark is treated as one string which becomes the install.arguments property. buildid the application build id in the form 20041231. note that due to branching (different versions of gecko with different feature sets might be built on the same day), using this pro...
...ue to branching (different versions of gecko with different feature sets might be built on the same day), using this property to "detect" the application version may produce false results. additionally, the build id can be 0 for custom builds. jarfile alias for archive platform contains information about the platform xpinstall was compiled for/runs on. for example, the value could begin with "windows", "macintosh" or "x11" (for unix/linux). for more details, see the corresponding code living in the getinstallplatform method of class nsinstall. url the fully qualified url of the xpi (file url, http url, ftp url, etc.) (e.g. http://dolfin/sgehani/zzz/ip.xpi). note, even if triggered using relative urls this will show the full url (after qualification). ...
getString - Archive of obsolete content
getstring retrieves a value from a .ini file. method of winprofile object syntax string getstring ( string section, string key); parameters the method has the following parameters: section section in the file, such as "boot" or "drivers". key the key in that section whose value to return. returns the value of the key or an empty string if none was found. description the getstring method is similar to the windows api function getprivateprofilestring. unlike that function, this method does not support using a null key to return a list of keys in a section. ...
...g if none was found. ...
enumKeys - Archive of obsolete content
yntax string enumkeys ( string key, int subkeyindex ); parameters the enumkeys method has the following parameters: key the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". subkeyindex an integer representing the 0-based index of the subkey being sought. returns the name if it succeeded; null if the referenced value does not exist. description enumkeys can be used to iterate through the subkeys at a given key location. the following example shows how to use enumkeys to find the plugins subdirectory below the various mozilla-based browser installations. var winreg = getwinregistry(); winreg.setrootkey(winreg.hkey_local_machine); var index = 0; var basekey = "software\\mozilla"; while ( (mozillaversion = winre...
...directory below the various mozilla-based browser installations. ...
setRootKey - Archive of obsolete content
y an integer representing a root key in the registry. returns nothing. description the setrootkey changes the root key. when you create a winreg object, it is set to access keys under the hkey_classes_root portion of the registry. if you want to access keys in another portion, you must use this method to change the root key. ...
...y changes the root key. when you create a winreg object, it is set to access keys under the hkey_classes_root portion of the registry. if you want to access keys in another portion, you must use this method to change the root key. on 16-bit windows platforms, hkey_classes_root is the only valid value and this method does nothing. ...
accesskey - Archive of obsolete content
l* on windows, command* on macintosh) and the access key, the element will be focused and/or activated from anywhere in the window. on the macintosh, labels are never underlined, however accesskeys can still be used by pressing the letter combined with the command key. *(these are the keys corresponding to event.ctrlkey and event.metakey respectively when listening to key events) although the value is case insensitive, a letter with the case matching the accesskey attribute will be used if both cases exist in the label. otherwise, if the label has two or more characters which are same as its accesskey, the first of those characters in the label will be underlined. if a label doesn't have the specified character, the character will be appended to the label with parentheses. for example, wh...
...ext will always be appended as described above. for consistency, this occurs for languages such as japanese even if the labels have their accesskey characters. ...
autocompletesearch - Archive of obsolete content
the components are created using the name @mozilla.org/autocomplete/search;1?name= where name is listed in this attribute. search-autocomplete requires seamonkey 2.1 the user's default search engine's suggestions are searched. places-tag-autocomplete requires seamonkey 2.1 the user's places tags are searched. ...
...'s default search engine's suggestions are searched. places-tag-autocomplete requires seamonkey 2.1 the user's places tags are searched. mydomain new in thunderbird 3 requires seamonkey 2.0 the user's email domain is suggested. history requires seamonkey 2.0 the user's url history is searched. form-history requires seamonkey 2.0 search the values that the user has entered into form fields. file (linux only) the local file system is searched. gloda new in thunderbird 3 addrbook new in thunderbird 3 requires seamonkey 2.0 the user's address book is searched. ldap new in thunderbird 25 requires seamonkey 2.22 the user's ldap directory is searched. ...
browser.type - Archive of obsolete content
« xul reference home type type: one of the values below. the type of browser, which can be used to set access of the document loaded inside the browser. if this is not set, the loaded document has the same access as the window containing the browser. more precisely: the document loaded into a chrome window is always of chrome type. subdocuments of chrome documents are of chrome type, unless the container element (one of iframe, browser or editor) has one of the special type attribute values (the common ones are content, content-targetable and content-primary) indicating that the subdocument is of content type. this boundary has a number of special effects, such as making window.top == window (unless the browser is added to a chrome document), and preventing documents from inheriti...
...er is not allowed to access the chrome above it. for instance, in a web browser, this would be the element that displays the web page. the window for the primary content can be retrieved more conveniently using window.content. content-targetable one browser among many for content. the content that is loaded inside the browser is not allowed to access the chrome above it. this is the preferred value for any browser element in an application, which will use multiple browsers of equal privileges, and is unselected at the moment. chrome (default behaviour): a browser, intended to be used for loading privileged content using a chrome:// uri. don't use for content from web, as this may cause serious security problems! see also more information in the xul tutorial and iframe ...
buttons - Archive of obsolete content
this button will also be the default button. cancel: the cancel button which will cancel the operation. help: a help button for displaying help about the dialog. disclosure: a button to show more information. this might be a button or a disclosure triangle. extra1: an optional additional button. ...
...triangle. extra1: an optional additional button. you can set its label with the buttonlabelextra1 attribute and its command with the ondialogextra1 attribute. extra2: a second optional additional button. you can set its label with the buttonlabelextra2 attribute and its command with the ondialogextra2 attribute. note: if you don't want to display any buttons in the dialog box, set the value of this attribute to "," (a single comma). warning: if the accept and cancel buttons are actually shown is system dependent and is mainly controlled by the value of the boolean preference browser.preferences.instantapply. if it is set to true any changes to settings are supposed to be applied immediately. the accept button is therefore unnecessary and is hidden. the cancel button might be shown a...
closemenu - Archive of obsolete content
single the menu the item is contained within is closed, but the parent menus remain open. ...
... single the menu the item is contained within is closed, but the parent menus remain open. ...
completedefaultindex - Archive of obsolete content
...
... ...
curpos - Archive of obsolete content
...
... ...
currentset - Archive of obsolete content
« xul reference home currentset not in seamonkey 1.x type: comma-separated string the current set of displayed items on the toolbar. this will be modified when the user customizes the toolbar. ...
....x type: comma-separated string the current set of displayed items on the toolbar. this will be modified when the user customizes the toolbar. the value of this attribute should be a comma-separated list of item ids from the toolbarpalette or, additionally, any of the following strings: "separator", "spring", "spacer". ...
datepicker.type - Archive of obsolete content
grid a datepicker that displays a calendar grid where one month is shown at a time. popup a datepicker with three entry fields but an additional dropdown button, which, when pressed, will display a popup calendar grid. ...
... grid a datepicker that displays a calendar grid where one month is shown at a time. popup a datepicker with three entry fields but an additional dropdown button, which, when pressed, will display a popup calendar grid. ...
dlgtype - Archive of obsolete content
cancel the cancel button which will cancel the operation. help a help button for displaying help about the dialog. ...
...nly when the button is in a dialog box. you can use this feature to replace the standard dialog box buttons with custom buttons, yet the dialog event methods will still function. for example, if the dlgtype is set to accept, the button will replace the dialog box's accept button, which is usually labeled ok. using this attribute on a button that is not in a dialog box has no effect. the following values can be used as the dialog type: accept the ok button, which will accept the changes when pressed. cancel the cancel button which will cancel the operation. help a help button for displaying help about the dialog. disclosure a button to show more information. this might be a button or a disclosure triangle. extra1 an optional additional button. extra2 a second optional...
editable - Archive of obsolete content
this is rendered as a textbox with a drop-down arrow beside it. ...
...this is rendered as a textbox with a drop-down arrow beside it. ...
editortype - Archive of obsolete content
html an html editor. ...
... html an html editor. ...
ignorecase - Archive of obsolete content
...
... ...
increment - Archive of obsolete content
...
... ...
menuitem.type - Archive of obsolete content
only one menuitem in the same radio group can be checked at once. ...
...only one menuitem in the same radio group can be checked at once. ...
minresultsforpopup - Archive of obsolete content
this can be used to display additional items that are not autocomplete results. ...
...this can be used to display additional items that are not autocomplete results. ...
modifiers - Archive of obsolete content
multiple keys may be separated by spaces or commas. keys will map to other keys on platforms that do not have them. shift: the shift key. alt: the alt key. on the macintosh, this is the option key. on macintosh this can only be used in conjunction with another modifier, since alt+letter combinations are reserved for entering special characters in text. meta: the meta key. on the macintosh, this is the command key. control: the control key. os: windows logo key on windows, super or hyper key on linux. ...
...meta: the meta key. on the macintosh, this is the command key. control: the control key. os: windows logo key on windows, super or hyper key on linux. this shouldn't be specified directly because it may conflict with system wide shortcut key. accel: the key used for keyboard shortcuts on the user's platform, which is control on windows and linux, and command on mac. usually, this would be the value you would use. access: the access key for activating menus and other elements. on windows, this is the alt key, used in conjuction with an element's accesskey. any: indicates that all modifiers preceding it are optional. ...
mousethrough - Archive of obsolete content
always mouse events are transparent to the element. this means that the element will not receive any mouse events due to either clicking or movement. child elements may override this if they specify mousethrough="never". never mouse events are passed to the element as normal. ...
... always mouse events are transparent to the element. this means that the element will not receive any mouse events due to either clicking or movement. child elements may override this if they specify mousethrough="never". never mouse events are passed to the element as normal. ...
newlines - Archive of obsolete content
« xul reference home newlines type: one of the values below how the text box handles pastes with newlines in them. ...
... « xul reference home newlines type: one of the values below how the text box handles pastes with newlines in them. ...
pack - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › pack
start child elements are placed starting from the left or top edge of the box. if the box is larger than the total size of the children, the extra space is placed on the right or bottom side. ...
... where child elements of the box are placed when the box is larger that the size of the children. for boxes with horizontal orientation, it is used to indicate the position of children horizontally. for boxes with vertical orientation, it is used to indicate the position of children vertically. the align attribute is used to specify the position in the opposite direction. you can also specify the value of pack using the style property -moz-box-pack. start child elements are placed starting from the left or top edge of the box. if the box is larger than the total size of the children, the extra space is placed on the right or bottom side. center extra space is split equally along each side of the child elements, resulting the children being placed in the center of the box. end chil...
popupalign - Archive of obsolete content
noneno aligntopleftalign to the top left cornertoprightalign to the top right cornerbottomleftalign to the bottom left cornerbottomrightalign to the bottom right cornersyntax<element popupalign="none | topleft | topright | bottomleft | bottomright"/> example<element id="edit-context" popup="editor-popup" popupanchor="topleft" popupalign="bottomright"/> notesthe popupalign attribute can be used to specify which corner of the popup content is tied to the originating point. if omitted, the default is topleft. ...
...ent comes up directly underneath the mouse event coordinates. ...
popupanchor - Archive of obsolete content
« xul reference homepopupanchortype: one of the values belowpopupanchor is an optional attribute for specifying where popup content should be anchored on the element.noneno anchortopleftanchor to the top left cornertoprightanchor to the top right cornerbottomleftanchor to the bottom left cornerbottomrightanchor to the bottom right cornersyntax<element popupanchor="none | topleft | topright | bottomleft | bottomright" /> example<element id="edit-context" popup="editor-popup" popupanchor="topleft" popupalign="bottomright" /> notesthe popupanchor attribute can be used to specify that the popup content should come up anchored to one of the four corners of the content object (e.g., the button popping up the content). if omitted, no anchoring occurs. instead the popup content comes up ...
...r the mouse or attached to one of the four corners) is called the originating point.by default the popup content appears with its top left point located directly underneath the point at which the user's mouse goes down (on tooltips the content is displaced by the height of the mouse cursor). popupanchor works in conjunction with popupalign to position the popup content on the element. the default value for both popupanchor and popupalign is "none." ...
readonly - Archive of obsolete content
...
... ...
right - Archive of obsolete content
this location is specified with respect to the right edge of the stack prior to the element being evaluated, or added to the stack. placing the element which contains this attribute within the stack may result in the stack changing size. ...
...this location is specified with respect to the right edge of the stack prior to the element being evaluated, or added to the stack. placing the element which contains this attribute within the stack may result in the stack changing size. ...
separator.orient - Archive of obsolete content
horizontal the separator separates vertically placed elements. vertical the separator separates horizontally placed elements. ...
... horizontal the separator separates vertically placed elements. vertical the separator separates horizontally placed elements. ...
sizemode - Archive of obsolete content
normal the window appears in a normal state at the desired size. this attribute is used to save and restore the state of a window (together with the persist attribute) and for css styles (e.g. to hide the resizer grippy on maximized windows). note: when a window is minimized, the sizemode attribute is not updated. this is done so that if a window is closed while minimized, its persisted sizemode attribute wouldn't be minimized. setting this attribute does not change the window state. ...
.... to get the window state from javascript code, use window.windowstate. listen to the sizemodechange event dispatched to the dom window to get notified when the window state changes. note: prior to gecko 13.0, this did not work on mac os x. note: prior to gecko 1.9.2, this was not always reliable. issues with this attribute (at least on firefox 3): sizemode is only updated when the value of the persist attribute on the root element (such as <window>) contains sizemode. ...
state - Archive of obsolete content
collapsed the content either before or after the splitter is collapsed and is not visible. dragging the user is current adjusting the position of the splitter, typically by dragging it with the mouse. ...
... collapsed the content either before or after the splitter is collapsed and is not visible. dragging the user is current adjusting the position of the splitter, typically by dragging it with the mouse. ...
textbox.type - Archive of obsolete content
« xul reference home type type: one of the values below you can set the type attribute to one of the values below for a more specialized type of textbox. don't set the type if you wish to use a regular textbox. autocomplete a textbox that supports autocomplete. for more information about autocomplete textboxes, see the autocomplete documentation (xpfe [thunderbird/seamonkey]) (firefox) number a textbox that only allows the user to enter numbers. in addition, arrow buttons appear next to the textbox to let the user step through values. there are several attributes that allow the number textbox to be configured, including decimalplaces, min, max, increment, wraparound, hidespinbuttons, and textbox.value. password a textbox that hides what is typed, used for entering...
...a listener for the command event should update search results. if the searchbutton attribute is set to true, the command event is only fired if the user presses the search button or presses the enter key. ...
toolbarbutton.type - Archive of obsolete content
« xul reference home type type: string the type of button. if this attribute is not present, a normal button is created. you can set this attribute to the value menu to create a button with a menu popup. this will typically cause the button to be displayed differently. menu: set the type attribute to the value menu to create a button with a menu popup. place a menupopup element inside the button in this case. the user may click anywhere on the button to open and close the menu. menu-button: you can also use the value menu-button to create a button with a menu. unlike the menu type, this type requires the user to press the arrow to open the menu, but a different command may be invoked when the main part of the button is pressed. checkbox: use this type to create a toggle butt...
...press the arrow to open the menu, but a different command may be invoked when the main part of the button is pressed. ...
userAction - Archive of obsolete content
typing the user is typing into the textbox. ...
... typing the user is typing into the textbox. ...
appendItem - Archive of obsolete content
« xul reference home appenditem( label, value ) return type: element creates a new item and adds it to the end of the existing list of items. you may optionally set a value. the function returns the newly created element. ...
... return type: element creates a new item and adds it to the end of the existing list of items. you may optionally set a value. the function returns the newly created element. ...
decrease - Archive of obsolete content
...
... ...
decreasePage - Archive of obsolete content
...
... ...
increase - Archive of obsolete content
...
... ...
increasePage - Archive of obsolete content
...
... ...
insertItemAt - Archive of obsolete content
« xul reference home insertitemat( index, label, value ) return type: element this method creates a new item and inserts it at the specified position. you may optionally set a value. the new item element is returned. ...
...annot insert an item to an index that does not exist, eg: trying to insert an item at the end with element.getrowcount() + 1 example <!-- this example inserts at the selected item or appends, then selects the newly created item --> <script language="javascript"> function insertitemtolist(){ var mylistbox = document.getelementbyid('mylistbox'); // create a date to get some labels and values var somedate = new date(); if(mylistbox.selectedindex == -1){ // no item was selected in list so append to the end mylistbox.appenditem( somedate.tolocaletimestring(), somedate.gettime() ); var newindex = mylistbox.getrowcount() -1 }else{ // item was selected so insert at the selected item var newindex = mylistbox.selectedindex; myli...
menulist.appendItem - Archive of obsolete content
the function returns the new item. ...
...the function returns the new item. ...
Namespaces - Archive of obsolete content
local name "textbox". this distinguishes it from, for example, <foobar:textbox/> which might occur in the same document. the xul and foobar namespaces must be defined at the top of the xml document in which they are used, like so: <foobar:some-element xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:foobar="the-foobar-namespace"> <xul:textbox id="foo" value="bar"/> <foobar:textbox favorite-food="pancakes"/> </foobar:some-element> notice i've mixed two <textboxes/> in the same document. the only way to distinguish that they have different meanings is with namespaces. there's only one other thing to know: "default namespace". every xml element has a "default namespace", and this is used with xul elements all the time. in xul documents, you'll usu...
...ndants of an element. here's a question: what namespace contains the element foo in the xml document below? <foo/> the answer is that it's in no namespace, or alternately, it's in the namespace denoted by the empty string: <foo xmlns=""/> this second example is semantically equivalent to the first. now, a second question: what namespaces are the bar, baz, and quux attributes in? <foo bar="value"> <element xmlns="namespace!" baz="value"> <element quux="value"/> </element> </foo> bar is obviously not in a namespace. what about baz and quux? the answer is that they aren't in a namespace either. in fact no unprefixed attribute is ever in a namespace, primarily because xml originally didn't have namespaces, and all xml from that time had to stay in no namespace. this is a so...
MenuModification - Archive of obsolete content
t.getelementbyid("edit-menu"); menu.appenditem("insert", "insert"); } </script> <menu id="edit-menu"/> <button label="add" oncommand="addtomenu()"/> in this example, the addtomenu function is called when the button is pressed. this function appends a new item to the menu's popup with the label insert. the first argument to appenditem is the label of the menuitem, and the second argument is a value to associate with the item. this value be set as the menuitem's value attribute and can be used for whatever purpose is desired. note how in this example, the menu does not have a child menupopup. the appenditem method will create a menupopup element if it doesn't already exist. if the menu already has a menupopup, the new menuitem will be appended to this existing one. while the appenditem meth...
...method is used to insert a new 'delete' item at the beginning of the menu's popup. the first argument is the index where the new item should be inserted. in this case, 0 is supplied as the index, which means before the first item. indicies are counted starting at 0, so to insert an item before the fourth item pass 3 as the argument. the second and third arguments to insertitemat are the label and value for the new item, as with appenditem. both the appenditem and insertitemat methods return the new menuitem, so you can further modify it, for instance to add an access key, as in the following example: var item = menu.appenditem("insert", "insert"); item.accesskey = "i"; appending submenus there is no built-in method to append submenus to a menu. to do this, we instead need to use the inheri...
amIndicator - Archive of obsolete content
...
... ...
checkState - Archive of obsolete content
...
... ...
editortype - Archive of obsolete content
html an html editor. ...
... html an html editor. ...
eventNode - Archive of obsolete content
...
... ...
pmIndicator - Archive of obsolete content
...
... ...
selectedItem - Archive of obsolete content
a select event will be sent to the controlling container (i.e. ...
...a select event will be sent to the controlling container (i.e. ...
Building Hierarchical Trees - Archive of obsolete content
children as the children in the tree, making the tree display a hierarchy similar to that in the xml document. or, with more complex xpath expressions, a template could display a tree where the hierarchy wasn't directly like the xml document. if a node is a container, the tree item becomes a container, and the user may open the row by double-clicking it. note that this test is done on the member value not the reference value. for instance, in the photo example, we have a container 'http://www.xulplanet.com/rdf/myphotos' with three photos. three results will be generated from a simple rule with no extra conditions. it is the result, or the photo, that will be checked, not the container of photos. since a photo isn't a container, the tree rows will not become containers, so you will not be able ...
... rows inside it are removed, such that they will have to be generated again the next time the row is opened. if you want to put rows inside the photo rows, you will either need to make each photo resource a container (for this rdf datasource, this will usually be an rdf seq), or use the containment attribute to specify additional properties that indicate containership. if a particular photo had a value for one of the properties listed in the containment attribute, it would be accepted as a container, and the user could open the row. when the user opens the row, the template will be re-examined for results using the photo as the starting point instead of the top level ref value. here is an example for the streets datasource: <tree flex="1" datasources="template-guide-streets.rdf" ref="htt...
Containment Properties - Archive of obsolete content
very first example again. it doesn't have any containers, but we may want to iterate over the relateditem predicate using the simple query syntax. we can add the containment attribute to do this. <vbox datasources="template-guide-ex1.rdf" ref="http://www.xulplanet.com/rdf/a" containment="http://www.xulplanet.com/rdf/relateditem"> <template> <rule> <label uri="rdf:*" value="rdf:*"/> </rule> </template> </vbox> instead of iterating over a container, this example iterates over a specific predicate. this attribute is useful when the rdf data is structured in such a way that an rdf container isn't used. the builder treats the predicate in the containment attribute as an indicator that an element is a container. if the starting node (or ref) has that predicate as...
...lowing is equivalent to the previous example, except that the full query syntax is used. <vbox datasources="template-guide-ex3.rdf" ref="http://www.xulplanet.com/rdf/a" containment="http://www.xulplanet.com/rdf/relateditem"> <template> <query> <content uri="?start"/> <member container="?start" child="?child"/> </query> <action> <label uri="?child" value="?child"/> </action> </template> </vbox> try this example. what happens is that the builder generates additional possible values for the ?child variable, so it creates an additional result for each one. « previousnext » ...
Introduction - Archive of obsolete content
next » a xul template is a means of producing a block of content for each result from some query or query-like operation. a good analogy is to the results of a database query. for each result returned from the query, generate some content. the template syntax allows for different rules to generate different content based on particular criteria as well as set attribute values from returned results. some other systems call this databinding. effectively, xul templates are the xul way of doing databinding. each template retrieves its data from a datasource. several types of datasources are supported by default, rdf, xml and sqlite databases, however, processors may be written to support other types of datasources. in xul, the datasource is specified by placing the datasources attrib...
...l this databinding. effectively, xul templates are the xul way of doing databinding. each template retrieves its data from a datasource. several types of datasources are supported by default, rdf, xml and sqlite databases, however, processors may be written to support other types of datasources. in xul, the datasource is specified by placing the datasources attribute on an element. typically, the value will be a uri that identifies the location of the data. for example, for an xml datasource, the url of an xml file is specified. when the xul parser sees an element with this attribute, it constructs a template builder for the element and attaches it to the element. it is expected that there will be a template inside the element. the template builder loads the datasource, performs a query on the ...
Template and Tree Listeners - Archive of obsolete content
makes use of the getresourceatindex and getindexofresource methods. these two methods are available for tree builders and will convert between an index in the tree and the associated member resource for the item at the index. naturally, we can't store the index as the item may have moved its position. or, the resource may no longer be part of the results, which is why we need to check the return value of the getindexofresource method. (as this example uses the rdf resources directly, it requires elevated privileges so you will need a chrome url to test it.) you might also guess that the builder's root property, which is used above, refers to the tree. in a content builder, it will return the element with the datasources attribute, which in the template builder is referred to as the root elemen...
... tree.builder.queryinterface (components.interfaces.nsixultreebuilder) .addobserver(treebuilderobserver); the candropbeforeafter method returns false since we do not want to allow before and after drops. the candropon method returns true however. the candrop method is there for compatibility with older versions; this function checks the orientation and returns the opposite. this works as the 'on' value is 0 and the 'between' values are -1 and 1. obviously, this code is much simpler than what we would really want to use -- we should be checking what is being dragged to make sure that it is compatible with the tree. or, we might want to allow dropping on specific rows only; the drop methods are supplied with an index argument so we can check for this. « previousnext » ...
Things I've tried to do with XUL - Archive of obsolete content
a frame for it, and the xbl doesn't get attached... a workaround for that is to create the element, insert it in the document and set its style attribute with a -moz-binding property, all of that from c++ instead of js. multi-column listboxes when adding items to multi-column listboxes, you can't use the appenditem api: // auto-create and attach 1st cell var row = mylistbox.appenditem( label, value ); // create and attach 2nd cell var cell = document.createelement('listcell'); cell.setattribute('label', label2 ); cell.setattribute('value', value2 ); row.appendchild( cell ); // etc // ... while this works at first, after a number of rows have been added it breaks and stops displaying the first cell (the one specified by the appenditem call). instead, you must build up your own listitem full...
...t breaks and stops displaying the first cell (the one specified by the appenditem call). instead, you must build up your own listitem full of listcells, and then add that listitem to the listbox, using generic dom calls: var row = document.createelement('listitem'); // create and attach 1st cell var cell = document.createelement('listcell'); cell.setattribute('label', label ); cell.setattribute('value', value ); row.appendchild( cell ); // create and attach 2nd cell cell = document.createelement('listcell'); cell.setattribute('label', label2 ); cell.setattribute('value', value2 ); row.appendchild( cell ); // etc // ... // attach row mylistbox.appendchild( row ); ...
Anonymous Content - Archive of obsolete content
uitem label="2000"/> </menupopup> <textbox flex="1"/> <button src="chrome://global/skin/images/dropbox.jpg"/> </menu> includes attribute in some cases, you may wish to only include specific types of content and not others. or, you may wish to place different types of content in different places. the includes attribute can be used to allow only certain elements to appear in the content. its value should be set to a single tag name, or to a list of tags separated by vertical bars (the | symbol). <children includes="button"/> this line will add all buttons that are children of the bound element in place of the children tag. other elements will not match this tag. you can place multiple children elements in a binding to place different types of content in different places. if an element in ...
...ne location and other elements placed in another. by adding a includes attribute and setting it to a vertical bar-separated list of tags, you can make only elements in that list be placed at that location. for example, the following xbl will cause text labels and buttons to appear in a different location than other elements: source <binding id="navbox"> <content> <xul:vbox> <xul:label value="labels and buttons"/> <children includes="label|button"/> </xul:vbox> <xul:vbox> <xul:label value="other elements"/> <children/> </xul:vbox> </content> </binding> the first children element only grabs the label and button elements, as indicated by its includes attribute. the second children element, because it has no includes attribute, grabs all of the remaining...
Broadcasters and Observers - Archive of obsolete content
ers because they observe the state of the broadcaster. to make an element an observer, add an observes attribute to it. this is analogous to using the command attribute when attaching an element to a command element. for example, to make a button an observer of the broadcaster above: <button id="offline_button" observes="isoffline"/> the observes attribute has been placed on the button and its value has been set to the value of the id on the broadcaster to observe. here the button will observe the broadcaster which has the id isoffline, which is the one defined earlier. if the value of the label attribute on the broadcaster changes, the observers will update the values of their label attributes also. we could continue with additional elements. as many elements as you want can observe a sing...
...oolbarbutton" observes="offline_command"/> in this example, both the label and the accesskey will be forwarded from the broadcaster to the key, menu item and the toolbar button. the key won't use any of the received attributes for anything, but it will be disabled when the broadcaster is disabled. you can use a broadcaster to observe any attribute that you wish. the observers will grab all the values of any attributes from the broadcasters whenever they change. whenever the value of any of the attributes on the broadcaster changes, the observers are all notified and they update their own attributes to match. attributes of the observers that the broadcaster doesn't have itself are not modified. the only attributes that are not updated are the id and persist attributes; these attributes are ne...
Content Panels - Archive of obsolete content
strict the web page to only getting access to the web page content. you might note that a mozilla browser window has xul content for the toolbars and statusbar and so forth with a tabbrowser forming the main area. this inner area displays a web page, but the web page cannot access the xul around it. this is because it uses the second type of browser, specified by setting the type attribute to the value content. this prevents the content from traversing up to the xul window. an example: <browser src="http://www.mozilla.org" type="content" flex="1" /> important: you must set the type attribute correctly if you are going to be displaying remote web sites inside the browser element. the tabbrowser sets the content type automatically on all tabbed browsers that it creates. so you don't have to s...
...s that it creates. so you don't have to set this explicitly for tabbed browsers. the third type is used when your window contains multiple browser elements, for example if you have a sidebar displaying some extra content. set the type attribute on the main browser element to content-primary to indicate that its content will be the primary content inside the window. this acts just like the content value except that the content inside is accessible using the xul window's 'content' property. this makes it easy to access the content of the main browser using a script. the tabbrowser automatically sets the type attribute of whichever browser is currently visible to content-primary, which means that you will always be able to access the currently visible content in this way. next, we'll look at how t...
Creating a Wizard - Archive of obsolete content
tomatically. ...
...elp you select the type of dog that is best for you." </description> <label value="why do you want a dog?"/> <menulist> <menupopup> <menuitem label="to scare people away"/> <menuitem label="to get rid of a cat"/> <menuitem label="i need a best friend"/> </menupopup> </menulist> </wizardpage> <wizardpage description="dog details"> <label value="provide additional details about the dog you would like:"/> <radiogroup> <caption label="size"/> <radio value="small" label="small"/> <radio value="large" label="large"/> </radiogroup> <radiogroup> <caption label="gender"/> <radio value="male" label="male"/> <radio value="female" label="female"/> </radiogroup> </wizardpage> </wizard> thi...
Cross Package Overlays - Archive of obsolete content
ew elements for entering a filename and directory to search. call the file foverlay.xul and add it to the findfile directory along with findfile.xul. ...
...findfile directory along with findfile.xul. our foverlay.xul example source <?xml version="1.0"?> <overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <toolbox id="browser-toolbox"> <toolbar id="findfile_toolbar"> <label control="findfile_filename" value="search for files named:"/> <textbox id="findfile_filename"/> <label control="findfile_dir" value="directory:"/> <textbox id="findfile_dir"/> <button label="browse..."/> </toolbar> </toolbox> </overlay> you can view this by changing the overlay to a window. the only thing that is special here is the id used on the toolbox. this value (browser-toolbox) is the same as the identifier of the toolbox in the browser window (navigator.xul). this means that the overlay will apply to the...
Introduction to RDF - Archive of obsolete content
url url to link to description http://home.netscape.com/nc-rdf#description bookmark description last visited http://home.netscape.com/web-rdf#lastvisitdate date of last visit these are generated by taking a namespace name and appending the field name. in the next section, we'll look at how we can use these to fill in the field values automatically. note that the last visited date has a slightly different namespace than the other three. rdf/xml file example below, a sample rdf/xml file is shown, listing a table with three records and three fields. <rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:animals="http://www.some-fictitious-zoo.com/rdf#"> <rdf:seq about="http://www.some-fictitious-zoo.
...ass field might conflict with that used for styles. the seq and li elements are used to specify that the records are in a list. this is much like how html lists are declared. the seq element is used to indicate that the elements are ordered, or in sequence. instead of the seq element, you can also use bag to indicate unordered data, and alt to indicate data where each record specifies alternative values (such as mirror urls). the resources can be referred to in a xul file by combining the namespace url followed by the field name. in the example above, the following uris are generated which can be used to refer to the specific fields: name http://www.some-fictitious-zoo.com/rdf#name species http://www.some-fictitious-zoo.com/rdf#species ...
More Event Handlers - Archive of obsolete content
the user holds down a mouse button and drags the mouse around. those events are described in drag and drop. mouse button event properties when a mouse button event occurs, a number of additional properties are available to determine which mouse buttons were pressed and the location of the mouse pointer. the event's button property can be used to determine which button was pressed, where possible values are 0 for the left button, 1 for the middle button and 2 for the right button. if you've configured your mouse differently, these values may be different. the detail property holds the number of times the button has been clicked quickly in sequence. this allows you to check for single, double or triple clicks. of course, if you just want to check for double clicks, you can also use the dblclick ...
...s the screenx and screeny properties and are relative to the top left corner of the screen. the second set, clientx and clienty, are relative to the top left corner of the document. here is an example which displays the current mouse coordinates: example 4 : source view <script> function updatemousecoordinates(e){ var text = "x:" + e.clientx + " y:" + e.clienty; document.getelementbyid("xy").value = text; } </script> <label id="xy"/> <hbox width="400" height="400" onmousemove="updatemousecoordinates(event);"/> in this example, the size of the box has been set explicitly so the effect is easier to see. the event handler gets the clientx and clienty properties and creates a string from them. this string is then assigned to the value property of the label. note that the event argument must ...
More Menu Features - Archive of obsolete content
ar id="options-menubar"> <menu id="options_menu" label="options"> <menupopup> <menuitem id="backups" label="make backups" type="checkbox"/> <menuitem id="email" label="email administrator" type="checkbox" checked="true"/> </menupopup> </menu> </menubar> </toolbox> the type attribute has been added which is used to make the menu item checkable. by setting its value to checkbox, the menu item can be checked on and off by selecting the menu item. menu with radios in addition to standard checks, you can create the radio style of checks by setting the type to a value of radio. a radio check is used when you want a group of menu items where only one item can be checked at once. an example might be a font menu where only one font can be selected at a time. when a...
...ing the type to a value of radio. a radio check is used when you want a group of menu items where only one item can be checked at once. an example might be a font menu where only one font can be selected at a time. when another item is selected, the previously selected item is unchecked. in order to group a set of menu items together, you need to put a name attribute on each one to group. set the value to the same string. the example below demonstrates this: example 3 : source view <toolbox> <menubar id="planets-menubar"> <menu id="planet-menu" label="planet"> <menupopup> <menuitem id="jupiter" label="jupiter" type="radio" name="ringed"/> <menuitem id="saturn" label="saturn" type="radio" name="ringed" checked="true"/> <menuitem id="uranus" label="uranus" type...
Persistent Data - Archive of obsolete content
e that it works with mozilla user profiles, so that each user can have different settings. xul allows you to save the state of any element. you will typically want to save toolbar states, window positions and whether certain panels are displayed or not, but you can save almost anything. persist attribute to allow the saving of state, you simply add a persist attribute to the element which holds a value you want to save. the persist attribute should be set to a space-separated list of attributes of the element that you want to save. the element must also have an id attribute in order to identify it. for example, to save the size of a window, you would do the following: <window id="somewindow" width="200" height="300" persist="width height" . . . the two attributes of the window el...
...uld do the following: <window id="somewindow" width="200" height="300" persist="width height" . . . the two attributes of the window element, the width and the height will be saved. you could add additional attributes by adding a space and another attribute name to the persist attribute. you can add the persist attribute to any element and store any attribute. you might use unusual values if you adjust attributes using a script. our find files example let's add the persist attribute to some of the elements in the find files dialog. to save the position of the window. to do this, we need to modify the window. <window id="findfile-window" title="find files" persist="screenx screeny width height" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/t...
Property Files - Archive of obsolete content
get parsed for entities. in addition, you may wish to display a message which is generated from a script, if, for example, you do not know the exact text to be displayed. for this purpose, property files can be used. a property file contains a set of strings. you will find property files alongside the dtd files with a .properties extension. properties in the file are declared with the syntax name=value. an example is shown below: notfoundalert=no files were found matching the criteria. deletealert=click ok to have all your files deleted. resultmessage=%2$s files found in the %1$s directory. here, the property file contains three properties. these would be read by a script and displayed to the user. a property file can also include comments. a line that begins with a hash sign ('#') is treated ...
... properties. the first is getstring which can be used in a script to read a string from the bundle. var strbundle = document.getelementbyid("strings"); var nofilesfound=strbundle.getstring("notfoundalert"); alert(nofilesfound); this example first gets a reference to the bundle using its id then, it looks up the string 'notfoundalert' in the property file. the function getstring() returns the value of the string or null if the string does not exist. finally, the string is displayed in an alert box. text formatting the next method is getformattedstring(). this method also gets a string with the given key name from the bundle. in addition, each occurrence of formatting code (e.g. %s) is replaced by each successive element in the supplied array. var dir = "/usr/local/document"; var count = 1...
Styling a Tree - Archive of obsolete content
ree rows inside the treechildren element as pseudo-elements. the style sets style rules for particular parts of what it displays. this style rule means, inside a treechildren element, set the background color to blue for all tree rows that have the 'makeitblue' property. the text '::-moz-tree-row' specifies what content area is desired, which in this case is a row. you can also use the following values: ::-moz-tree-cell: a cell. use this to set borders and background colors. ::-moz-tree-cell-text: the text in a cell. use this to set the font and text color. ::-moz-tree-twisty: the appearance of the twisty used to expand and collapse child rows. ::-moz-tree-image: the image for a cell. you can set the image with the list-style-image property. ::-moz-tree-row: a row. use this to set the b...
...s. progressnone this property is set for non-progress meter cells. the properties are set for rows or cells in rows with the necessary state. for columns and cells, one additional property, the id of the column or column the cell is in will be set. setting properties for the rdf-built trees for rdf-built trees, you can use the same syntax. however, you will often set the properties based on values in the datasource. setting properties for the custom view for trees with a custom view script, you can set properties by supplying the functions getrowproperties(), getcolumnproperties() and getcellproperties() in the view. these return information about an individual row, column and cell. arguments to these functions indicate which row and/or column. prior to gecko 22 the last argument to ea...
XBL Inheritance - Archive of obsolete content
ies, methods and event handlers. the child binding will have all the features it defines in addition to the features from the binding it inherits from (and any that binding inherits from and so on up the tree). to extend an existing binding, add an extends attribute on to the binding tag. for example, the following binding creates a textbox which adds the text 'http://www' to the beginning of its value when the f4 key is pressed. example 1 : source <binding id="textboxwithhttp" extends="chrome://global/content/bindings/textbox.xml#textbox"> <handlers> <handler event="keypress" keycode="vk_f4"> this.value="http://www"+value; </handler> </handlers> </binding> the xbl here extends from the xul textbox element. the url given in the extends attribute above is the url of t...
...dling so that when a url is typed, a menu will pop up with possible completions. you can use it in your own applications too. just create a textbox with two extra attributes. <textbox type="autocomplete" searchsessions="history"/> set the type to autocomplete to add the autocomplete feature to an existing textbox. set the searchsessions to indicate what type of data to look up. in this case, the value history is used, which looks up urls in the history. (you can also use the value addrbook to look up addresses in the address book.) firefox uses a different autocomplete mechanism than the mozilla suite, see xul:textbox (firefox autocomplete) in the next section, we'll see an example xbl-defined widget. « previousnext » ...
XPCOM Interfaces - Archive of obsolete content
ts own registry. a particular user can install new components as needed. it works much like plug-ins. mozilla provides a file component, that is, a component that implements nsilocalfile. this component can be referred to using the string '@mozilla.org/file/local;1'. this string is called a contract id. the syntax of a contract id is: @<internetdomain>/module[/submodule[...]];<version>[?<name>=<value>[&<name>=<value>[...]]] other components can be referred to in a similar way. the contract id of the component can be used to get the component. you can get a component using javascript code like that below: var afile = components.classes["@mozilla.org/file/local;1"].createinstance(); the file component is retrieved and stored in the afile variable. components in the example above refers to...
... some component related functions. here, we get a component class from the classes property. the classes property is an array of all of the available components. to get a different component, just replace the contract id inside the square brackets with the contract id of the component you want to use. finally, an instance is created with the createinstance() function. you should check the return value of createinstance() to ensure that it is not null, which would indicate that the component does not exist. however, at this point, we only have a reference to the file component itself. in order to call the functions of it we need to get one of its interfaces, in this case nsilocalfile. a second line of code needs to be added as follows: var afile = components.classes["@mozilla.org/file/local;1...
XUL Changes for Firefox 1.5 - Archive of obsolete content
ting back and forward does not reload the page, making navigation much more efficient. the pageshow and pagehide events are used when switching from a page in the cache, while the load and unload events are used only when the page is loaded or unloaded. for more information see using firefox 1.5 caching. tabindex the tabindex property is now applied to most elements. <radiogroup> setting the value property on the <radiogroup> element selects the <radio> element in the group with the corresponding value. dialog: defaultbutton property the <dialog> binding now supports the defaultbutton property. setting this property changes the default button of the dialog. it can be set either to one of the buttons of the <dialog> binding (using their names); or to none - in which case no button is set ...
...t can be set either to one of the buttons of the <dialog> binding (using their names); or to none - in which case no button is set to be the default. button: icon property the icon property on a button may be used to set stock icons on a button, used on some platforms. for instance <button icon="help"> will create a button with a help icon. this is used typically on gnome systems where possible values are: accept, cancel, help, open, save, find, clear, yes, no, apply, close, print, add, remove, refresh, go-forward, go-back, properties, select-font, select-color, network. <menulist> items in a <menulist> support the description attribute to allow for extra descriptive text to appear beside an item's label. the menulist modification methods appenditem and insertitemat take an extra descriptio...
XUL accessibility guidelines - Archive of obsolete content
...> form labels labels are not automatically associated to form elements. use the control attribute to bind a text label (from a label element) to a form element. screen readers will then read aloud the label when entering a form field. for labels that may wrap to a second line, do not use the description element. instead, use the text of a label enclosed in the label tags, and do not use the value attribute, as shown below for the password field. <label control="login-username" value="username:"/> <textbox id="login-username"/> <label control="login-password">password:</label> <textbox id="login-password" type="password"/> larger forms can be difficult to layout and structure. while there are many ways to visually structure forms, always provide a text label for every form element. for...
...h the standard xul attributes. for example, the first item in the privacy panel in the firefox option dialog (discussed and shown above) is [checkbox] remember visited pages for the last [textbox] days. the difficulty here arises from the fact that the correct label for the checkbox ("remember visited pages for the last x days.") includes three different pieces, the second of which is the current value entered into the textbox. the correct label for textbox is actually the same, but we don't want assistive technologies to read or show it twice. we need a way of specifying in the source that the checkbox, editbox, and nearby text labels are all part of a single entity, and that they essentially label each other. to solve this problem, we use the aria-labelledby attribute on both controls (note ...
XML - Archive of obsolete content
about these four cardinal rules of xul: all events and attributes must be written in lowercase. unlike html, xul is very sensitive to case. all of the events and attributes -- even the javascript event listeners normally formatted in the javascript world with uppercase verbs (e.g., onclick, onload) -- must be lowercase or they are invalid. all strings must be double quoted. all of the values for all of the attributes declared in xul are strings. when an attribute is assigned a value (e.g., flex="1" or "onload='dointerestingstartupthing()'") that value must be double-quoted. every xul widget must use close tags to be well-formed. html allows some elements, such as <br> and <hr>, to be neither closed nor matched with a closing element. in xul, elements must either be of the form ...
... xul is made out of xml you don't need to know all about xml in order to use xul, but you may want to read through this article to get a sense of xul's pedigree as a specialized markup language. xul is based upon xml, so it inherits a lot of the rules and syntax described above from this "meta-language," as you will see. ...
attribute.align - Archive of obsolete content
the box is larger than the total size of the children. for boxes that have horizontal orientation, it specifies how its children will be aligned vertically. for boxes that have vertical orientation, it is used to specify how its children are algined horizontally. the pack attribute is related to the alignment but is used to specify the position in the opposite direction. you can also specify the value of align using the style property -moz-box-align. parameters start child elements are aligned starting from the left or top edge of the box. if the box is larger than the total size of the children, the extra space is placed on the right or bottom side. center extra space is split equally along each side of the child elements, resulting the children being placed in the center of the box. end c...
...e children, the extra space is placed on the right or bottom side. center extra space is split equally along each side of the child elements, resulting the children being placed in the center of the box. end child elements are placed on the right or bottom edge of the box. if the box is larger than the total size of the children, the extra space is placed on the left or top side. baseline this value applies to horizontally oriented boxes only. it causes the child elements to be aligned so that their text labels are lined up. stretch the child elements are stretched to fit the size of the box. for a horizontal box, the children are stretched to be the height of the box. for a vertical box, the children are stretched to be the width of the box. if the size of the box changes, the children str...
commandset - Archive of obsolete content
u commands such as undo and cut based on when an event occurs. for example, since the cut command is only valid when something is selected, a command updater might be used when the select event occurs. events type: comma-separated list a comma-separated list of event names that the command updater will update upon. if this attribute is not specified, or you set it to the value '*', all events are valid. valid events are listed below, or you can use your own events. you can send a custom event by calling the updatecommands method of the command dispatcher. focus: occurs when the focused element changes. select: occurs when the selected text changed. clipboard: occurs when the clipboard is changed. undo: occurs when the undo buffer is changed...
...s changed. oncommandupdate type: script code this event occurs when a command update occurs. you would use this to update the disabled status of items. targets type: comma-separated list of element ids a comma-separated list of element ids that the command updater will update upon. if this attribute is not specified, or you set it to the value '*', all elements are valid. the command update will only occur when the event occurs to one of the specified elements. properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , ob...
deck - Archive of obsolete content
Archive › Mozilla › XUL › deck
« xul reference home [ examples | attributes | properties | methods | related ] an element that displays only one of its children at a time. the selectedindex attribute determines which child is displayed. more information is available in the xul tutorial. attributes selectedindex properties selectedindex, selectedpanel examples <deck selectedindex="2"> <description value="this is the first page"/> <button label="this is the second page"/> <box> <description value="this is the third page"/> <button label="this is also the third page"/> </box> </deck> attributes selectedindex type: integer gets and sets the index of the currently selected panel. the first item is at index 0. inherited from xul element align, allowevents, allownegativea...
... currently selected item. you may select an item by assigning its index to this property. by assigning -1 to this property, all items will be deselected. returns -1 if no items are selected do not hide panels; the deck element only understands visible panels. selectedpanel type: element holds a reference to the currently selected panel within a deck element. assigning a value to this property will modify the selected panel. inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, ...
grid - Archive of obsolete content
Archive › Mozilla › XUL › grid
displayed on top; commonly the columns element appears in the grid first. more information is available in the xul tutorial. example <!-- groupbox containing a grid. ...
...on is available in the xul tutorial. example <!-- groupbox containing a grid. ...
image - Archive of obsolete content
Archive › Mozilla › XUL › image
element when the image has finished loading. this applies whether the image is applied via the src attribute or the list-style-image style property. if you change the image, the event will fire again when the new image loads. this event will not bubble up the element tree. src type: uri the uri of the content to appear in the element. validate type: one of the values below this attribute indicates whether to load the image from the cache or not. this would be useful if the images are stored remotely or you plan on swapping the image frequently. the following values are accepted, or leave out the attribute entirely for default handling: always the image is always checked to see whether it should be reloaded. never the image will be loaded from th...
...be useful if the images are stored remotely or you plan on swapping the image frequently. the following values are accepted, or leave out the attribute entirely for default handling: always the image is always checked to see whether it should be reloaded. never the image will be loaded from the cache if possible. properties accessibletype type: integer a value indicating the type of accessibility object for the element. src type: url gets and sets the value of the src attribute. inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observe...
listhead - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheigh...
..., popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties accessibletype type: integer a value indicating the type of accessibility object for the element. disabled type: boolean gets and sets the value of the disabled attribute. inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, to...
listheader - Archive of obsolete content
nd to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update additional state. 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. 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, minheig...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , ,...
progressmeter.max - Archive of obsolete content
...
... ...
resizer - Archive of obsolete content
left resized to the left. right resized to the right. top resized up. bottom resized down. bottomstart resized down and toward the start of the line (toward the left for left-to-right locales, toward the right for right-to-left locales). bottomend resized down and toward the end of the line (toward the right for left-...
...d the right for left-to-right locales, toward the left for right-to-left locales). bottomleft resized down and to the left. bottomright resized down and to the right. topleft resized up and to the left. topright resized up and to the right. element type: element to resize the id of the element that should be resized by the resizer. typetype: stringset this to the value "window" for a resizing grip that appears in the bottom corner of the window, used for resizing the window. as some platforms provide this resizing grip automatically, this type of resizer element will be hidden and ensure that the window does not get an extra resizer. inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, ...
statusbar - Archive of obsolete content
examples | attributes | properties | methods | related ] an element used to create a status bar, usually placed along the bottom of a window. it is virtually equivalent to a standard box, but may be rendered differently. contains statusbarpanels. ...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , ,...
stringbundle - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] an element which can be used to load localized resources from property files. stringbundles should be placed inside a stringbundleset element. a property file is a list of property key-value pairs each on a separate line. the key and value is separated with an equals sign. for example, the following defines two properties: message.displayerror=an error occured trying to display this message message.namealreadyused=the name %s is already being used by another account. more information is available in the xul tutorial. the "src" attribute accepts only absolute chrome:// urls (see bugs 133698, 26291) attributes src properties applocale , src, stringbundle, strings methods getfor...
... ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties applocale obsolete since gecko 1.9.1 type: nsilocale returns the xpcom object which holds information about the user's locale. this is an object which implements nsilocale. src type: url gets and sets the value of the src attribute. stringbundle type: nsistringbundle returns the xpcom string bundle object which implements nsistringbundle. strings type: nsisimpleenumerator an enumeration of all of the strings in the string bundle. the enumeration contains nsipropertyelement objects. methods getformattedstring( key, strarray ) return type: string looks up the format string for the giv...
toolbox - Archive of obsolete content
ns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="toolbox example" width="300"> <toolbox> <toolbar> <toolbarbutton label="back"/> <toolbarbutton label="forward"/> <toolbarbutton label="home"/> </toolbar> <toolbar> <toolbarbutton label="stop"/> <toolbarbutton label="reload"/> </toolbar> </toolbox> <textbox multiline="true" value="we have two toolbars inside of one toolbox above." width="20"/> </window> attributes inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidt...
...s(), setuserdata appendcustomtoolbar( name, currentset ) firefox only return type: element adds a custom toolbar to the toolbox with the given name. you can supply a comma-separated list of toolbar item ids as the second argument to add some items by default. the method returns the dom element for the created toolbar. collapsetoolbar( toolbar ) not in firefox return type: no return value collapse the given toolbar which should be contained within the toolbox. expandtoolbar( toolbar ) not in firefox return type: no return value expand the given toolbar which should be contained in the toolbox. related elements toolbar, toolbarbutton, toolbargrippy, toolbaritem, toolbarpalette, toolbarseparator, toolbarset, toolbarspacer, toolbarspring interfaces nsiaccessibleprov...
vbox - Archive of obsolete content
Archive › Mozilla › XUL › vbox
« xul reference home [ examples | attributes | properties | methods | related ] a container element which can contain any number of child elements. this is equivalent to the box element, except it defaults to vertical orientation. more information is available in the xul tutorial. ...
... « xul reference home [ examples | attributes | properties | methods | related ] a container element which can contain any number of child elements. this is equivalent to the box element, except it defaults to vertical orientation. more information is available in the xul tutorial. ...
Creating XULRunner Apps with the Mozilla Build System - Archive of obsolete content
options to use in configuring build options. the third section contains options for building xulrunner. you shouldn't have to change this. finally, the final section contains options specific to your application. make sure you change the application name (following ac_add_app_options to that of your app. do the same with the name that follows --enable-application. you shouldn't have to change the value of --with-libxul-sdk if you are building your own xulrunner. you can also add other options to this section if you want them to apply to your app only. building your application if you decided that you needed a custom-built xulrunner and read the previous section then you're way ahead of the game. you simply need to place your application's root directory directly under the mozilla root on your d...
...ls it where to start building your app. don't think to hard about this, just copy mccoy's file and adapt accordingly. confvars.sh - some basic configuration options. you should be able to use the mccoy version, changing just your application name and version. makefiles.sh - you don't absolutely need this file since the build system will generate makefiles as need by walking the tree (based on the value of dirs). you will need it if you want to generate a makefile but keep it out of the main build, which is what mccoy does with installer/makefile. in addition, builds are faster when you include all makefiles in this file since they can be generated with a single shell invocation. and that's all there is to it. now that wasn't so bad, was it? well, actually there are still a bunch of subdirector...
How to enable locale switching in a XULRunner application - Archive of obsolete content
code to update the locale user preference and restart the application mozill...
... which is fired when the user clicks on the button to change the locale. it saves the new locale to the user application preferences (thereby overriding the default prefs.js above) and then asks xulrunner to restart. function changelocale() { try { // which locale did the user select? var localelistbox = document.getelementbyid("locale-listbox"); var newlocale = localelistbox.selecteditem.value; // write preferred locale to local user config var prefs = components.classes["@mozilla.org/preferences-service;1"]. getservice(components.interfaces.nsiprefbranch); prefs.setcharpref("general.useragent.locale", newlocale); // restart application var appstartup = components.classes["@mozilla.org/toolkit/app-startup;1"] .getservice(componen...
XUL Explorer - Archive of obsolete content
e a user snippet file. the snippets are merged with the built-in snippets at startup. double-click or drag-and-drop to insert a snippet file > new allows user to pick any “template” snippet, as well as blank. simple xul checker can be used to ‘validate’ the xul snippet. it checks for legal element and attribute names, including allowed attributes for a given element. ...
...uilt-in snippets at startup. double-click or drag-and-drop to insert a snippet file > new allows user to pick any “template” snippet, as well as blank. simple xul checker can be used to ‘validate’ the xul snippet. it checks for legal element and attribute names, including allowed attributes for a given element. ...
2006-09-29 - Archive of obsolete content
wstate(computeblockboxdata, initconstraints) and nsimageframe::getdesiredsize which uses ns_inrinsicsize, into the following method: /** * compute the size that a frame will occupy. called while * constructing the nshtmlreflowstate to be used to reflow the frame, * in order to fill its mcomputedwidth and mcomputedheight member * variables. ...
... |height| member of the return value may be * ns_unconstrainedsize, but the |width| member must not be. * * @param aavailwidth the available width into which the element is * being placed (i.e., the width of its containing * block). * @param amargin the sum of the left and right margins of the * frame, including actual values resulting from * percentages, but not including actual values * resulting from 'auto'. * @param aborder the sum of the left and right border widths of the * frame. * @param apadding the sum of the left and right margins of the * frame, including actual values resulting from * percentages. ...
NPClass - Archive of obsolete content
efault called by npn_invokedefault() to invoke the default method (if available) on a given npobject. returns true if invocation succeeded or false if an error occurred. hasproperty called by npn_hasproperty() to check whether a given property exists on a given npobject. returns true if the specified property exists, otherwise returns false. getproperty called by npn_getproperty() to get the value of the specified property on a given npobject. returns true if the value was successfully retrieved, otherwise returns false. setproperty called by npn_setproperty() to set the value of the specified property on a given npobject. returns true if the value was successfully set, otherwise returns false. removeproperty called by npn_removeproperty() to remove a given property from a specified np...
... npvariant *result); typedef bool (*nphaspropertyfunctionptr)(npobject *npobj, npidentifier name); typedef bool (*npgetpropertyfunctionptr)(npobject *npobj, npidentifier name, npvariant *result); typedef bool (*npsetpropertyfunctionptr)(npobject *npobj, npidentifier name, const npvariant *value); typedef bool (*npremovepropertyfunctionptr)(npobject *npobj, npidentifier name); typedef bool (*npenumerationfunctionptr)(npobject *npobj, npidentifier **value, uint32_t *count); typedef bool (*npconstructfunctionptr)(npobject *npobj, const npvariant *args, ...
NPN_DestroyStream - Archive of obsolete content
e, npstream* stream, nperror reason); parameters the function has the following parameters: instance pointer to current plug-in instance. stream pointer to current stream, initiated by either the browser or the plug-in. reason reason the stream was stopped so the application can give the user appropriate feedback. values: npres_done (most common): stream completed normally; all data was sent by the plug-in to the browser. npres_user_break: plug-in is terminating the stream due to a user request. npres_network_err: stream failed due to network problems. returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code...
...done (most common): stream completed normally; all data was sent by the plug-in to the browser. npres_user_break: plug-in is terminating the stream due to a user request. npres_network_err: stream failed due to network problems. returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. description the plug-in calls the npn_destroystream() function to close and delete a stream. this stream can be either a stream that the browser created and passed to the plug-in in npp_newstream(), or a stream created by the plug-in through a call to npn_newstream(). see also npp_destroystream() npn_newstream() npp_newstream() npstream npp ...
NPN_GetAuthenticationInfo - Archive of obsolete content
he 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 successful, the function returns nperr_no_error. if unsuccessful, the function returns an error code. for possible values, see error codes. description plugin which implement their own http networking stack (such as the java plugin) may want to use the standard http auth prompts and password managed of the browser. this function allows the plugin to ask the browser for http authentication information for a domain. unless the plugin has special networking needs, it is recommended to use the standard network apis, s...
...ir own http networking stack (such as the java plugin) may want to use the standard http auth prompts and password managed of the browser. this function allows the plugin to ask the browser for http authentication information for a domain. unless the plugin has special networking needs, it is recommended to use the standard network apis, such as npn_geturlnotify/npn_posturlnotify. see also npn_setvalueforurl, npn_getvalueforurl ...
NPN_GetProperty - Archive of obsolete content
« gecko plugin api reference « scripting plugins summary gets the value of a property on the specified npobject. syntax #include <npruntime.h> bool npn_getproperty(npp npp, npobject *npobj, npidentifier propertyname, npvariant *result); parameters the function has the following parameters: <tt>npp</tt> the npp indicating which plugin instance's is making the request. <tt>npobj</tt> the object from which a value is to be retrieved. <tt>propertyname</tt> a string identifier indicating the name of the property whose value is to be retrieved. <tt>result</tt> on return, contains the value of the specified property. ...
...ameters the function has the following parameters: <tt>npp</tt> the npp indicating which plugin instance's is making the request. <tt>npobj</tt> the object from which a value is to be retrieved. <tt>propertyname</tt> a string identifier indicating the name of the property whose value is to be retrieved. <tt>result</tt> on return, contains the value of the specified property. returns true if the value was retrieved successfully, otherwise false. note: the caller must call npn_releasevariantvalue() to release the returned value when it's no longer needed. ...
NPN_GetURL - Archive of obsolete content
ance, const char* url, const char* target); parameters the function has the following parameters: instance pointer to the current plug-in instance. url pointer to the url of the request. can be of any type, such as http, ftp, news, or mailto. target name of the target window or frame, or one of the following special target names. values: _blank or _new: load the link in a new blank unnamed window. safest target, even though, when used with a mailto or news url, this creates an extra blank the browser instance. _self or _current: load the link into the same window the plug-in instance occupies. not recommended; if target refers to the window or frame containing the instance, the instance is destroyed and the plug-in may...
...arget is null, the browser creates a new stream and delivers the data to the current instance regardless of the mime type of the url. in general, if a url works in the location box of the browser, it works here, except for the _self target. returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. description npn_geturl() is used to load a url into the current window or another target or stream. plug-ins can use this capability to provide hyperlinks to other documents or to retrieve data from anywhere on the network. this is especially useful for enabling an existing application to operate on the web. for http urls, the browser resolves this method as the http server me...
NPN_IntFromIdentifier - Archive of obsolete content
returns an integer corresponding to the specified <tt>identifier</tt>. ...
... returns an integer corresponding to the specified <tt>identifier</tt>. ...
NPN NewStream - Archive of obsolete content
npapi.h> nperror npn_newstream(npp instance, npmimetype type, const char* target, npstream** stream); parameters the function has the following parameters: instance pointer to current plug-in instance. type mime type of the stream. target name of the target window or frame, or one of several special target names. for values, see npn_geturl. stream stream to be created by the browser. returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. description npn_newstream creates a new stream of data produced by the plug-in and consumed by the browser. the mime parameter is the mime type of the ...
...he stream is returned in the stream parameter. the plug-in can use this object in subsequent calls to npn_write to write data into the stream. when the plug-in has written all of its data into the stream, npn_destroystream terminates the stream and deallocates the npstream object. the target parameter is the name of the target window or frame, or one of several special target names. for parameter values and information about how to use them, see npn_geturl. if the new stream has the target of _self, this function should return an invalid_param np error. see also npp_newstream, npp_write, npp_destroystream, npstream, npp ...
NPN_PostURL - Archive of obsolete content
2 len, const char *buf, 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. ...
...g-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: post the raw data in buf. returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. description npn_posturl works si...
NPP_DestroyStream - Archive of obsolete content
stream is about to be closed or destroyed. syntax #include <npapi.h> nperror npp_destroystream(npp instance, npstream* stream, npreason reason); parameters the function has the following parameters: instance pointer to current plug-in instance. stream pointer to current stream. reason reason the stream was destroyed. values: npres_done (most common): completed normally; all data was sent to the instance. npres_user_break: user canceled stream directly by clicking the stop button or indirectly by some action such as deleting the instance or initiating higher-priority network operations. npres_network_err: stream failed due to problems with network, disk i/o, lack of memory, or other problems. returns ...
...rectly by clicking the stop button or indirectly by some action such as deleting the instance or initiating higher-priority network operations. npres_network_err: stream failed due to problems with network, disk i/o, lack of memory, or other problems. returns if successful, the plug-in should return nperr_no_error. if unsuccessful, the plug-in should return an error code. for possible values, see error codes. description the browser calls the npp_destroystream function when a data stream sent to the plug-in is finished, either because it has completed successfully or terminated abnormally. after this, the browser deletes the npstream object. you should delete any private data allocated in stream->pdata at this time, and should not make any further references to the stream object...
NPP_HandleEvent - Archive of obsolete content
plug-in api summary delivers a platform-specific window event to the instance. for windowed plug-ins: currently used only on mac os. for windowless plug-ins: all platforms. syntax #include <npapi.h> int16 npp_handleevent(npp instance, void* event); parameters the function has the following parameters: instance pointer to the current plug-in instance. event platform-specific value representing the event handled by the function. values: ms windows: pointer to npevent structure mac os: pointer to a standard mac os eventrecord unix/x11: pointer to a standard xlib xevent for a list of possible events, see npevent. returns if the plug-in handles the event, the function should return true. if the plug-in ignores the event, the function returns false. descrip...
... xevent for a list of possible events, see npevent. returns if the plug-in handles the event, the function should return true. if the plug-in ignores the event, the function returns false. description the browser calls npp_handleevent to tell the plug-in when events take place in the plug-in's window or drawable area. the plug-in either handles or ignores the event, depending on the value given in the event parameter of this function. for a list of event types the application is responsible for delivering to the plug-in, see the npevent structure. ms windows the browser gives each windowed plug-in its own native window, often a child window of the browser window, to draw into. the plug-in has complete control over drawing and event handling within that window. mac os the brows...
NPP_Write - Archive of obsolete content
of bytes accepted. buf buffer of data, delivered by the stream, that contains len bytes of data offset bytes from the start of the stream. the buffer is allocated by the browser and is deleted after returning from the function, so the plug-in should make a copy of the data it needs to keep. returns the plug-in should return the number of bytes written (consumed by the instance). if the return value is smaller than the size of the buffer, the browser sends the remaining data to the plug-in through subsequent calls to npp_writeready and npp_write. if unsuccessful, the function signals an error by returning a negative value. the browser will destroy the stream by calling npp_destroystream. description the browser calls the npp_write function to deliver the data specified in a previous npp_writ...
...npp_writeready and npp_write. if the plug-in requested a seekable stream, the npn_requestread function requests reads of a specified byte range that results in a series of calls to npp_writeready and npp_write. the plug-in can use the offset parameter to track the bytes that are written. this gives you different information depending in the type of stream. in a normal-mode stream., the parameter value increases as the each buffer is written. the buf parameter is not persistent, so the plug-in must process data immediately or allocate memory and save a copy of it. in a seekable stream with byte range requests, you can use this parameter to track npn_requestread requests.see also npp_destroystream, npp_newstream, npp_writeready, npstream, npp ...
NPStream - Archive of obsolete content
lug-in, or produced by the plug-in and consumed by the browser. syntax typedef struct _npstream { void* pdata; /* plug-in private data */ void* ndata; /* netscape private data */ const char* url; uint32 end; uint32 lastmodified; void* notifydata; const char *headers; } npstream; fields the data structure has the following fields: plug-in-private value that the plug-in can use to store a pointer to private data associated with the instance; not modified by the browser. ndata browser-private value that can store data associated with the instance; should not be modified by the plug-in. url the 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 byte...
... 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 request. for these streams, notifydata is set to the value of the notifydata parameter to npn_geturlnotify or npn_posturlnotify. for other streams, notifydata is null. headers the response headers from the host. this field is only available if the np version is greater than or equal to npvers_has_response_headers. this field is used only for http and is null for other types of streams. the plug-in should copy this data before making use of it. the hea...
SAX - Archive of obsolete content
er.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='" + localname + "', qname='" + qname + "'"); }, characters: function(value) { print("...
...} print("startelement: namespace='" + uri + "', localname='" + localname + "', qname='" + qname + "', attributes={" + attrs.join(",") + "}"); }, endelement: function(uri, localname, qname) { print("endelement: namespace='" + uri + "', localname='" + localname + "', qname='" + qname + "'"); }, characters: function(value) { print("characters: " + value); }, processinginstruction: function(target, data) { print("processinginstruction: target='" + target + "', data='" + data + "'"); }, ignorablewhitespace: function(whitespace) { // don't care }, startprefixmapping: function(prefix, uri) { // don't care }, endprefixmapping: function(prefix) { // don't care }, // nsisupports queryinterface: funct...
Building a Theme - Archive of obsolete content
</description> </em:targetapplication> <!-- front end metadata --> <em:name>my theme</em:name> <em:internalname>sample</em:internalname> <em:description>a test extension</em:description> <em:creator>your name here</em:creator> <em:homepageurl>http://www.example.com/</em:homepageurl> </description> </rdf> sample@example.net - the id of the extension. this is a value you come up with to identify your extension in email address format (note that it should not be your email). make it unique. you could also use a guid. note: this parameter must be in the format of an email address, although it does not have to be a valid email address. (example.example.example) 4 - the type of the add-on. '4' declares that it is installing a theme. if you were to install an ext...
...extension's source folder hierarchy. add in this code: skin browser sample chrome/browser/ skin communicator sample chrome/communicator/ skin global sample chrome/global/ skin mozapps sample chrome/mozapps/ don't forget the trailing slash, "/"! without it, the package won't be registered. the third column needs to match your theme's internalname value from the install manifest above. this maps skin directories to locations within your theme. for example, the line skin browser sample skin/browser/ means "when the user has the sample theme selected, use the directory browser/ to look up skins for the browser package." more concisely, this means that the url chrome://browser/skin/some/path/file.css will look for a file browser/some/path/file.css...
Theme changes in Firefox 3 - Archive of obsolete content
u can use this information as a starting point for figuring out the changes you need to make. all file list all platforms file description of change browser/themes/*/browser/browser.css the width of the drag and drop indicator is no longer calculated during the drag (tabbrowser.xml). instead a '-moz-margin-start' property must be added to .tab-drop-indicator-bar, with a value that is half of the width of the indicator image. also, the visibility of the indicator is now controlled by setting collapsed in tabbrowser.xml. as a result, the 'display' property should be removed from .tab-drop-indicator-bar (including for dragging="true"). mac os x file description of change browser/themes/pinstripe/browser/tabbrowser/tabdragindicator.png remo...
...e://global/skin/icons/warning-16.png used when displaying warnings. images to remove the following images were removed: chrome://mozapps/skin/extensions/question.png no longer used. mac os x mac os x themes for firefox 3 should add these two rules to the end of chrome://global/skin/wizard.css: .wizard-buttons-btm { padding:xpx; } .wizard-label-box { display: none; } the numeric value ofx, the number of pixels of padding in .wizard-buttons-btm, should be the same as the value of the margin for .wizard-buttons-box-2. image changes chrome://global/skin/icons/loading_16.gif was replaced with chrome://global/skin/icons/loading_16.png . changes in mozapps see also theme changes in firefox 2 ...
Using workers in extensions - Archive of obsolete content
this code (in lines 26-35) is executed. it starts by setting up an interval handler (in lines 26-28) that calls refreshinformation() every 10 minutes. then it sets the worker's onmessage event handler to a function which looks at the event passed into it, and does one of two things: if there is a data field on the event, the stock symbol being tracked is set to the upper case version of that value. this is used to initialize the worker, and to change which stock is being monitored. if there is no data field, the refreshinformation() method is called to fetch the latest information about the stock and pass it back to the main thread. this provides a way for the main thread to specifically request that the worker update the stock information at once. the refreshinformation() method is fai...
...t) { self.onworkermessage.call(self, event); }; this.worker.postmessage(this.tickersymbol); }, the worker is set up and configured here in lines 13-22: line 13 instantiates a new worker, specifying the uri of the ticker_worker.js file. lines 17-20 change the definition of the worker's onmessage handler so that when the worker calls back to the main thread, the main thread's value of this is correctly the main thread's object instead of the worker's. line 22 sends a message to the ticker thread to tell it what symbol to monitor. the observe() method this method's job is to update which stock is being monitored when the user changes the preferences. it needs to be updated to post a message to the worker to tell it which stock symbol to track. observe: function(subjec...
-moz-stack-sizing - Archive of obsolete content
-moz-stack-sizing is an extended css property. normally, a <xul:stack> will change its size so that all of its child elements are completely visible. for example, moving a child of the stack far to the right will widen the stack so the child remains visible. /* keyword values */ -moz-stack-sizing: auto; -moz-stack-sizing: ignore; /* global values */ -moz-stack-sizing: inherit; -moz-stack-sizing: initial; -moz-stack-sizing: unset; if you wish to prevent the stack from resizing automatically to accommodate its children, you can set -moz-stack-sizing to ignore on the child element. the property is set not on the stack itself, but on the stack's children. this lets you ignore certain children, but not others. note: in previous versions of gecko it was possible to work around the pro...
...ts you ignore certain children, but not others. note: in previous versions of gecko it was possible to work around the problem by setting very large negative bottom and right margins on the stack element and equally large positive bottom and right margins on the children whose size you didn't want to ignore. (the problem does not affect children moved above or to the left of the stack.) initial valuestretch-to-fitapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values stretch-to-fit the child will influence the stack's size. ignore the stack won't consider this child when calculating its size. formal syntax ignore | stretch-to-fit examples .mainsheet { -moz-stack-sizing: ignore; } ...
-ms-block-progression - Archive of obsolete content
top-to-bottom block flow. layout is horizontal. rl right-to-left block flow. layout is vertical. bt bottom-to-top block flow. layout is horizontal. lr left-to-right block flow. layout is vertical. formal syntax tb | rl | bt | lr specifications not part of any specification. remarks in vertical layout, text lines are rotated 90° clockwise. images are not rotated, but tables are. ...
... | rl | bt | lr specifications not part of any specification. remarks in vertical layout, text lines are rotated 90° clockwise. images are not rotated, but tables are. box layout in vertical orientations is exactly analogous to layout in the horizontal orientation: width, height, top, bottom, right, and left do not rotate with the text. only one block progression is active at a time; these values cannot be combined. this property is based on the block-progression property of the css3 text layout module. ...
-ms-content-zoom-snap-type - Archive of obsolete content
indicates that zooming is unaffected by any defined snap-points. after the contact is picked up, the content will continue to move with inertia. proximity indicates that the motion of the content after the contact is picked up may be adjusted if the content would normally stop "close enough" to a snap-point. ...
...indicates that zooming is unaffected by any defined snap-points. after the contact is picked up, the content will continue to move with inertia. proximity indicates that the motion of the content after the contact is picked up may be adjusted if the content would normally stop "close enough" to a snap-point. ...
-ms-hyphenate-limit-chars - Archive of obsolete content
the -ms-hyphenate-limit-chars css property is a microsoft extension that specifies one to three values indicating the minimum number of characters in a hyphenated word. if the word does not meet the required minimum number of characters in the word, before the hyphen, or after the hyphen, then the word is not hyphenated. initial valueautoapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values auto corresponds to a value of 5 2 2, indicating a 5-character word limit, 2 characters required before a hyphenation break, and 2 characters required following a hyphenation break. ...
...r after the hyphen, then the word is not hyphenated. initial valueautoapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values auto corresponds to a value of 5 2 2, indicating a 5-character word limit, 2 characters required before a hyphenation break, and 2 characters required following a hyphenation break. <integer>{1,3} one to three integer values, corresponding to the word limit, the minimum number of characters required before a hyphenation break, and the minimum number of characters required following a hyphenation break, respectively. if the third value is missing it is equal to the second. if the second and third values are missing they are given a value of auto. negative values are not allowed. formal syntax auto | <int...
-ms-hyphenate-limit-lines - Archive of obsolete content
the -ms-hyphenate-limit-lines css property is a microsoft extension specifying the maximum number of consecutive lines in an element that may be ended with a hyphenated word. initial valueno-limitapplies toblock container elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values no-limit indicates that hyphenation is not limited based on the number of consecutive hyphenated lines. in the flow above the consecutive hyphenated lines limit would be an infinitely large positive number. <integer> indicates the maximum number of successive hyphenated lines. ...
...nsecutive hyphenated lines. in the flow above the consecutive hyphenated lines limit would be an infinitely large positive number. <integer> indicates the maximum number of successive hyphenated lines. for instance, if 2, then no more than 2 successive lines may end with a hyphenated word. if 0 then no lines may end with a hyphenated word. (hyphenation is effectively disabled.) negative values are not allowed. formal syntax no-limit | <integer> specifications not part of any specification. ...
-ms-scroll-snap-x - Archive of obsolete content
the -ms-scroll-snap-x css shorthand property is a microsoft extension that specifies values for the -ms-scroll-snap-type and -ms-scroll-snap-points-x properties. initial valueas each of the properties of the shorthand:-ms-scroll-snap-type: none-ms-scroll-snap-points-x: snapinterval(0px, 100%)applies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas each of the properties of the shorthand:-ms-scroll-snap-type: as specified-ms-scroll-snap-points-x: as specifiedanimation typediscrete syntax values the -ms-scroll-snap-x shorthand property is specified as one or both of the following values, in order and separated by spaces. -ms-scroll-snap-type the value of the -ms-scroll-snap-type property. -ms-scroll-snap-points-x the ...
... formal syntax <'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-x'> examples the -ms-scroll-snap-x property is a shorthand property. the two selectors in the following example have the same effect. ...
-ms-scroll-snap-y - Archive of obsolete content
the -ms-scroll-snap-x css shorthand property is a microsoft extension that specifies values for the -ms-scroll-snap-type and -ms-scroll-snap-points-y properties. initial valueas each of the properties of the shorthand:-ms-scroll-snap-type: none-ms-scroll-snap-points-y: snapinterval(0px, 100%)applies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas each of the properties of the shorthand:-ms-scroll-snap-type: as specified-ms-scroll-snap-points-y: as specifiedanimation typediscrete syntax values the -ms-scroll-snap-y shorthand property is specified as one or both of the following values, in order and separated by spaces. -ms-scroll-snap-type the value of the -ms-scroll-snap-type property. -ms-scroll-snap-points-y the ...
... formal syntax <'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-y'> examples the -ms-scroll-snap-y property is a shorthand property. the two selectors in the following example have the same effect. ...
-ms-scroll-translation - Archive of obsolete content
the -ms-scroll-translation css property is a microsoft extension that specifies whether vertical-to-horizontal scroll wheel translation occurs on the specified element. initial valuenoneapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values vertical-to-horizontal vertical to horizontal translation, as described in remarks, will take place when appropriate. none no scroll wheel translation takes place. inherit the initial value. the value is inherited from the element's parent element. formal syntax none | vertical-to-horizontal specifications not part of any specification. remarks this property requires windows 8 or later. this property has no effect on non-scrollable elements. if your javascript is listenin...
...larly, the events that occur when the user scrolls horizontally will always be horizontal scroll events. this property enables you to change this behavior for vertical scroll events. by setting the -ms-scroll-translation property to vertical-to-horizontal, you are specifying that vertical scroll events should be interpreted as their corresponding horizontal scroll events. this property's initial value is inherit on all elements, except the <html> element, where it defaults to none. this property has no effect on keyboard interaction. the default css templates for windows apps using javascript, "ui-light.css" and "ui-dark.css", set this property to vertical-to-horizontal by default on the <html> element. ...
-ms-text-autospace - Archive of obsolete content
ideograph-alpha creates extra spacing between runs of ideographic and non-ideographic text, such as latin-based, cyrillic, greek, arabic, or hebrew text. ideograph-numeric creates extra spacing between runs of ideographic text and numeric characters. ...
... ideograph-alpha creates extra spacing between runs of ideographic and non-ideographic text, such as latin-based, cyrillic, greek, arabic, or hebrew text. ideograph-numeric creates extra spacing between runs of ideographic text and numeric characters. ...
-ms-wrap-through - Archive of obsolete content
its descendant inline content wraps around exclusions defined outside the element. none the exclusion element does not inherit its parent node's wrapping context. its descendants are only subject to exclusion shapes defined inside the element. ...
...its descendant inline content wraps around exclusions defined outside the element. none the exclusion element does not inherit its parent node's wrapping context. its descendants are only subject to exclusion shapes defined inside the element. ...
::-ms-clear - Archive of obsolete content
this pseudo-element is non-standard, supported only in internet explorer 10, internet explorer 11, and microsoft edge. the clear button is only shown on focused, non-empty text controls. this includes inputs that appear text-like or fall back to type="text". ...
...round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width syntax ::-ms-clear example html <form> <label for="firstname">first name:</label> <input t...
::-ms-fill-lower - Archive of obsolete content
a slider control is one possible representation of <input type="range">. allowable properties only the following css properties can be used in a rule with ::-ms-fill-lower in its selector. other properties are ignored. ...
...round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width specifications not...
::-ms-fill-upper - Archive of obsolete content
a slider control is one possible representation of <input type="range">. allowable properties only the following css properties can be used in a rule with ::-ms-fill-upper in its selector. other properties are ignored. ...
...round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width syntax ::-ms-fil...
::-ms-reveal - Archive of obsolete content
the password reveal button is usually displayed at the edge of the password field. the ::-ms-reveal pseudo-element is specific to internet explorer 10 and later. allowable properties only the following css properties can be used in a rule with ::-ms-reveal in its selector. other properties are ignored. ...
...round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width syntax ::-ms-revea...
::-ms-thumb - Archive of obsolete content
a slider control is one possible representation of <input type="range">. allowable properties only the following css properties can be used in a rule with ::-ms-thumb in its selector. other properties are ignored. ...
...round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width syntax ::-ms-thu...
-moz-windows-theme - Archive of obsolete content
e firefox 58, this media feature is no longer available to web content — it is only available internally (e.g. to xul / chrome code). see bug 1396066 for more details. ...
...ent — it is only available internally (e.g. to xul / chrome code). see bug 1396066 for more details. ...
display-inside - Archive of obsolete content
the display-inside css property specifies the inner display type of the box generated by an element, dictating how its contents lay out inside the box. /* keyword values */ display-inside: auto; display-inside: block; display-inside: table; display-inside: flex; display-inside: grid; display-inside: ruby; /* global values */ display-inside: inherit; display-inside: initial; display-inside: unset; value not found in db! syntax one of the keyword values listed below. ...
...enerated by an element, dictating how its contents lay out inside the box. /* keyword values */ display-inside: auto; display-inside: block; display-inside: table; display-inside: flex; display-inside: grid; display-inside: ruby; /* global values */ display-inside: inherit; display-inside: initial; display-inside: unset; value not found in db! syntax one of the keyword values listed below. values auto if the element's computed <display-outside> value is inline-level, the element is an inline element, and lays out its contents using inline layout. if the element's computed <display-outside> value is an layout-specific internal type, this elements acts as normal for its given <display-outside> value. otherwise, this value computes to block. block the element lays out its contents usi...
Accessing XML children - Archive of obsolete content
rators provide access to the child nodes of an e4x element. var element1 = <foo> <bar/> </foo>; var element2 = <baz/>; element1.bar.appendchild(element2); element1["bar"].appendchild(<quux/>); adds a child to the "bar" child node of element1. this gives an xml document of <foo> <bar> <baz/> <quux/> </bar> </foo> note, however, that assigning a non-xml value to a child element that doesn't exist will create that element. var element1 = <foo/> element1.bar = 1; produces <foo> <bar>1</bar> </foo> if the child node already exists, the . operator allows you to change its value. var elem = <foo> <bar>1</bar> </foo> elem.bar = 2; will replace the previous value of 1 with 2. you can remove a child node by using the delete comman...
...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 <foo bar="2"/> « previousnext » ...
Introduction - Archive of obsolete content
dom can be used in e4x. the most basic is appendchild var element1 = <foo/>; var element2 = <bar/>; element1.appendchild(element2); which produces exactly the xml document you'd expect <foo> <bar/> </foo> javascript variables the true power of e4x only begins to come to light, however, when the xml document can interact closely with other javascript. with special syntax, we can assign the value of a javascript variable to be the value of an e4x element. this is done with brace ({}) notation. var a = 2; var b = <foo>{a}</foo>; creates an xml document that reads <foo>2</foo>. you can also use brace notation on attributes of elements (their names or values). for example, var a = 2; var b = 'bar'; var c = <foo {b}={a}>"hi"</foo>; creates a slightly different xml document: <foo bar="2...
...ith brace ({}) notation. var a = 2; var b = <foo>{a}</foo>; creates an xml document that reads <foo>2</foo>. you can also use brace notation on attributes of elements (their names or values). for example, var a = 2; var b = 'bar'; var c = <foo {b}={a}>"hi"</foo>; creates a slightly different xml document: <foo bar="2">"hi"</foo>. note, however, that xml elements can only have text as their value. what really happens with the {} notation is that the variables' tostring method is called, and the returned value is placed in the element. for instance var a = {foo: 1}; var b = <bar>{a}</bar>; actually produces a document that reads <bar>[object object]</bar>. use of inline functions in content although the brackets are restricted to single statements for evaluation, one might provide an an...
Array.observe() - Archive of obsolete content
on called each time changes are made, with the following argument: changes an array of objects each representing a change. the properties of these change objects are: name: the name of the property which was changed. object: the changed array after the change was made. type: a string indicating the type of change taking place. one of "add", "update", "delete", or "splice". oldvalue: only for "update" and "delete" types. the value before the change. index: only for the "splice" type. the index at which the change occurred. removed: only for the "splice" type. an array of the removed elements. addedcount: only for the "splice" type. the number of elements added. description the callback function is called each time a change is made to arr, with an array ...
...ne 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'); // [{type: 'splice', object: <arr>, index: 1, removed: ['b', 'c'], addedcount: 3}] specifications strawman proposal specification. ...
ActiveXObject - Archive of obsolete content
on providing the object. typename the type or class of the object to create. location optional the name of the network server where the object is to be created. remarks automation servers provide at least one type of object. for example, a word-processing application may provide an application object, a document object, and a toolbar object. you may be able to identify servername.typename values on a host pc in the hkey_classes_root registry key. for example, here are a few examples of values you may find there, depending on which programs are installed: excel.application excel.chart scripting.filesystemobject wscript.shell word.document important: activex objects may present security issues. to use the activexobject, you may need to adjust security se...
... defined. in the following example, you access properties and methods of the new object using the object variable excelsheet and other excel objects, including the application object and the activesheet.cells collection. // make excel visible through the application object. excelsheet.application.visible = true; // place some text in the first cell of the sheet. excelsheet.activesheet.cells(1,1).value = "this is column a, row 1"; // save the sheet. excelsheet.saveas("c:\\test.xls"); // close excel with the quit method on the application object. excelsheet.application.quit(); requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, internet explorer 10 standards,...
Debug.msUpdateAsyncCallbackRelation - Archive of obsolete content
the debug.msupdateasynccallbackrelation function updates the relationship status between a synchronous work item and the associated asynchronous operation. syntax debug.msupdateasynccallbackrelation(relatedasyncoperationid, relationtype) parameters relatedasyncoperationid the id associated with the asynchronous operation. relationtype optional the value that specifies the relationship status. ...
...ers relatedasyncoperationid the id associated with the asynchronous operation. relationtype optional the value that specifies the relationship status. remarks the synchronous work item is typically the callback function for the asynchronous operation. this function may be called when an asynchronous operation is aborted, when a join operation is used, or in other scenarios. the possible values for relationtype include: debug.ms_async_callback_status_assign_delegate debug.ms_async_callback_status_join debug.ms_async_callback_status_chooseany debug.ms_async_callback_status_cancel debug.ms_async_callback_status_error for more information, see debug constants. note: some debugging tools do not display the information sent to the debugger by this funct...
Debug.write - Archive of obsolete content
ds strings to the immediate window of a script debugger at run time. if the script is not being debugged, the debug.write function has no effect. the debug.write function is almost identical to the debug.writeln function. the only difference is that the debug.writeln function sends a newline character after the strings are sent. ...
...also supported in store apps (windows 8 and windows phone 8.1). ...
Debug.writeln - Archive of obsolete content
ediate window of the microsoft script debugger at run time. if the script is not being debugged, the debug.writeln function has no effect. the debug.writeln function is almost identical to the debug.write function. the only difference is that the debug.write function does not send a newline character after sending the strings. example this example uses the debug.writeln function to display the value of the variable in the immediate window of the microsoft script debugger. note: to run this example, you must have a script debugger installed and the script must run in debug mode. internet explorer 8 includes the javascript debugger. if you are using an earlier version of internet explorer, see how to: enable and start script debugging from internet explorer. var counter = 42; debug.writel...
... variable in the immediate window of the microsoft script debugger. note: to run this example, you must have a script debugger installed and the script must run in debug mode. internet explorer 8 includes the javascript debugger. if you are using an earlier version of internet explorer, see how to: enable and start script debugging from internet explorer. var counter = 42; debug.writeln("the value of counter is " + counter); requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, internet explorer 10 standards, internet explorer 11 standards. also supported in store apps (windows 8 and windows phone 8.1). applies to: debug ...
Error.number - Archive of obsolete content
the upper 16-bit word is the facility code, and the lower word is the error code. ...
...the upper 16-bit word is the facility code, and the lower word is the error code. to determine the error code, use the & (bitwise and) operator to combine the number property with the hexadecimal number 0xffff. ...
VBArray - Archive of obsolete content
non-standard. do not use! this object is a microsoft extension and is only supported in internet explorer. the vbarray object provides access to visual basic safe arrays. syntax varname = new vbarray(safearray) parameters varname the variable name to which the vbarray is assigned. safearray a vbarray value. remarks vbarrays are read-only, and cannot be created directly. the safearray argument must have obtained a vbarray value before being passed to the vbarray constructor. this can only be done by retrieving the value from an existing activex or other object. vbarrays can have multiple dimensions. the indices of each dimension can be different. the dimensions method retrieves the number of dimensions in the array; the lbound and ubound methods retrieve the range of indices used ...
...) { document.writeln(b[i]); } } --> </script> </head> <body> <script type="text/javascript"> <!-- vbarraytest(createvbarray()); --> </script> </body> properties the vbarray object has no properties. methods vbarray.dimensions returns the number of dimensions in a vbarray. vbarray.getitem returns the item at the specified location. vbarray.lbound returns the lowest index value used in the specified dimension of a vbarray. vbarray.toarray returns a standard javascript array converted from a vbarray. vbarray.ubound returns the highest index value used in the specified dimension of the vbarray. requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explore...
New in JavaScript 1.1 - Archive of obsolete content
r version of the browser with javascript support. javascript versions netscape navigator 3.0 also introduced javascript language versions. <script language="javascript"> <!-- javascript for navigator 2.0. --> <script language="javascript1.1"> <!-- javascript for navigator 3.0. --> new features in javascript 1.1 new objects array boolean function number new properties number.max_value number.min_value nan number.negative_infinity number.positive_infinity new methods array.prototype.join() array.prototype.reverse() array.prototype.sort() array.prototype.split() new operators typeof void other new features <noscript> liveconnect. communication between java and javascript. changed functionality in javascript 1.1 "object deletion". you can remove an ob...
...object by setting its object reference to null. constructor and prototype properties on objects added. eval() is now a method of every object (was previously a built-in function); it evaluates a string of javascript code in the context of the specified object. math.random() now works on every platform. tostring(): added radix parameter, which specifies the base to use for representing numeric values. isnan() now works on every platform (not only unix anymore) parsefloat() and parseint() now return nan on all platforms, if the first character of the specified string cannot be converted to a number; in previous releases, it returned nan on solaris and irix and zero on all other platforms. ...
New in JavaScript 1.8 - Archive of obsolete content
ve to create a custom function which would have a yield in it, but this addition allows you to use array comprehension-like syntax to create an identical generator statement. array.prototype.reduce() array.prototype.reduceright() changed functionality in javascript 1.8 changes in destructuring for..in one change that occurred in the release of javascript 1.8 was a bug fix related to the key/value destructuring of arrays introduced in javascript 1.7. previously it was possible to destructure the keys/values of an array by using for ( var [key, value] in array ). however, that made it impossible to destructure the values of an array - that were arrays (i.e., when an iterator returns an array of the current key-value pair). this has been resolved now. (bug 366941). one can, however, use for...
...g of arrays introduced in javascript 1.7. previously it was possible to destructure the keys/values of an array by using for ( var [key, value] in array ). however, that made it impossible to destructure the values of an array - that were arrays (i.e., when an iterator returns an array of the current key-value pair). this has been resolved now. (bug 366941). one can, however, use for ( var [key, value] in iterator(array)). ...
Object.prototype.watch() - Archive of obsolete content
d unwatch()! these two methods were implemented only in firefox prior to version 58, they're deprecated and removed in firefox 58+. in addition, using watchpoints has a serious negative impact on performance, which is especially true when used on global objects, such as window. you can usually use setters and getters or proxies instead. the watch() method watches for a property to be assigned a value and runs a function when that occurs. syntax obj.watch(prop, handler) parameters prop the name of a property of the object on which you wish to monitor changes. handler a function to call when the specified property's value changes. return value undefined. description watches for assignment to a property named prop in this object, calling handler(prop, oldval, newval) whenever prop ...
... occurs. syntax obj.watch(prop, handler) parameters prop the name of a property of the object on which you wish to monitor changes. handler a function to call when the specified property's value changes. return value undefined. description watches for assignment to a property named prop in this object, calling handler(prop, oldval, newval) whenever prop is set and storing the return value in that property. a watchpoint can filter (or nullify) the value assignment, by returning a modified newval (or by returning oldval). if you delete a property for which a watchpoint has been set, that watchpoint does not disappear. if you later recreate the property, the watchpoint is still in effect. to remove a watchpoint, use the unwatch() method. by default, the watch method is inherited by...
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
the fish. here's a typical (and short) example. <div class="card"> <img src="thumb_clown_trigger.jpg" alt="clown trigger" border="0" width="150" height="115"> <h3>clown trigger</h3> <p> our clown trigger is a bold little fish, though for a few weeks he slept a lot and didn't look well in general. he's much better now. </p> </div> basically, that's all that was needed. the reason for the class value being card is that the original idea was to style each fish's description like a trading card. although this design approach was abandoned fairly quickly, the class name stuck, kind of like a barnacle. giving the fish some style with the markup all set, it was time to style. the idea was to have the fish listed in a side-by-side arrangement, sort of like a two-column table, only without the tab...
...etely covered up by the image. the text of the h3 was basically touching the right side of the floated image... ...or it would have been, except in some browsers the heading was drawn over the floated image, in contradiction to the css specification. getting the image back on top of the heading turned out to be a matter of relatively positioning the floated image, and then giving it a z-index value. in order to create visual appeal, i decided to offset the top let corners of the fish image and fish name. with just a few simple margin and padding changes, this was possible. div.card {float: left; width: 45%; margin: 1em 2% 0 2%;} div.card img {float: left; position: relative; z-index: 10; margin: 4px 0 0 0; border: 1px solid #339;} div.card h3 {margin: 0 0 0 4px; padding: 0.2em 0 1px 150p...
forEach - Archive of obsolete content
w 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 will be watching changes closely. jswisher 01 october 2011 <hr> there is some mistype in array.prototype.foreach: kvalue = o[ pk ]; should be kvalue = o[ k ]; <hr> this page has been the target of a revert war, and so write access to it has been restricted. if you wish to make changes, and especially if you wish to revert another user's changes, please either add a comment here, or post to dev-mdc@lists.mozila.org, explaining the change you desire. jswisher 15 aug 2011 <hr> is this a from _core_ of javascript 1.5...
..., or post to dev-mdc@lists.mozila.org, explaining the change you desire. jswisher 15 aug 2011 <hr> is this a from _core_ of javascript 1.5? if so, is js 1.5 gecko only? those extra features like foreach are gecko only, and it should be mentioned that they should *_not_* be used on web pages. --gandalf 07:18, 31 may 2005 (pdt) is there a way to make foreach make use of break? [1].foreach(function(value, index, array){ print(value); //break? if (value>1){ return false;//we could have some way to break when we return false } }); //woulld print 1 2 --porfirio 11:17, 22-06-2008 another option would be to throw stopiteration and catch it within foreach(). --bencollver 11:18, 13-08-2008 ...
XForms Output Element - Archive of obsolete content
introduction serves to show the instance data that the element is bound to in a read-only manner (see the spec). to see how they work you can try an xhtml example or a xul example. attributes ui common appearance - the value of this attribute gives a hint to the xforms processor as to which type of widget(s) to use to represent this control accesskey - used to specify the keyboard shortcut for focusing this control single-node binding special value - xpath expression whose evaluation result is used as the output's value. if binding attributes are present on the control then the value attribute is is ignored. type restrictions the output element can be bound to a node containing simple content of any data type. representations the xforms output element can be represented by...
...below). analogous widgets are <xhtml:span/> and <xul:description/> calendar a form author may notice a xforms output element represented by a calendar widget in the mozilla xforms processor if the control meets the following criteria (xhtml/xul). characteristics the bound instance node is of type xsd:date or a type derived from it in addition, the appearance attribute must also contain the value "full" firefox 2.0 doesn't currently have any similar widgets available for use with xhtml or xul. image if the bound instance node contains an image then you are free to use this representation to show the image instead of the byte sequence of the image data (fx 3.0 only, xhtml/xul). characteristics the bound instance node is of type xsd:anyuri, xsd:base64binary or a type derived from it ...
XForms Secret Element - Archive of obsolete content
introduction used for inputting passwords or other sensitive text. each character typed by the user is represented by an asterisk on the screen (see the spec). attributes ui common appearance - isn't supported. accesskey - used to specify the keyboard shortcut for focusing this control. single-node binding special inputmode - isn't supported. incremental - supported. the default value is false. type restrictions the secret element can be bound to a node containing simple content of any data type except xsd:base64binary, xsd:hexbinray or any data type derived from these. representations the xforms secret element is represented by a password field. the password field is a text field, the value of which is hidden by asterisks (xhtml/xul). characteristics analogous widgets ...
...xsd:base64binary, xsd:hexbinray or any data type derived from these. representations the xforms secret element is represented by a password field. the password field is a text field, the value of which is hidden by asterisks (xhtml/xul). characteristics analogous widgets are <xhtml:input type="password"/> and <xul:textbox type="password"/> if the incremental attribute is present and has the value true, then the bound instance node is updated on every user input. please keep in mind that the instance data will hold exactly what the user gave as input. any other xform control bound to that data will show that data 'as is'. ...
Window: devicelight event - Archive of obsolete content
fired when fresh data is available from a light sensor. note: this event has been disabled by default in firefox 62, behind the device.sensors.ambientlight.enabled preference (bug 1462308). bubbles no cancelable no interface sensorcallback target defaultview (window) other properties property type description value read only double (float) the sensor data for ambient light in lux. min read only double (float) the minimum value in the range the sensor detects (if available, 0 otherwise). max read only double (float) the maximum value in the range the sensor detects (if available, 0 otherwise). examples window.addeventlistener('devicelight', function(event) { c...
...uble (float) the sensor data for ambient light in lux. min read only double (float) the minimum value in the range the sensor detects (if available, 0 otherwise). max read only double (float) the maximum value in the range the sensor detects (if available, 0 otherwise). examples window.addeventlistener('devicelight', function(event) { console.log(event.value); }); specifications specification status comment ambient light sensorthe definition of 'ambient light events' in that specification. candidate recommendation removed from specification ...
Correctly Using Titles With External Stylesheets - Archive of obsolete content
hether a particular stylesheet always affects a document, or if it is only used under certain circumstances. there are three kinds of stylesheets that are possible: persistent, preferred, and alternate stylesheets. authors will be most familiar with persistent stylesheets, of which any number may be applied to a document at once. a persistent stylesheet is one which has no title attribute and a value of stylesheet supplied for the rel attribute. a document may refer to one or more persistent stylesheets, all of which are used in the presentation of the document. a preferred stylesheet, on the other hand, is one that has a value of stylesheet supplied for the rel attribute, and any value at all for the title attribute. here are two examples: <link type="text/css" rel="stylesheet" title="basi...
...e specification does not supply a procedure to decide which one should be used, so user agents are free to make whatever choice they like. therefore, any link to a stylesheet that includes a title attribute cannot be persistent, and is likely to be ignored by the web browser. any link element referring to a stylesheet with a title attribute must be either preferred or alternate, depending on the value of the rel attribute. in a document that refers to alternate stylesheets, the preferred stylesheet will be used so long as none of the alternate stylesheets are selected by the user. thus, when the document is loaded, the browser will use all of the persistent stylesheets and one preferred stylesheet (but remember, there should only be one preferred stylesheet). once the user selects one of the ...
Fixing Table Inheritance in Quirks Mode - Archive of obsolete content
ing the behavior of old browsers. this only happens when gecko is in "quirks" mode; in "standards" mode, all styles are inherited by tables as permitted by the css specification. in those cases where it is necessary to author documents in "quirks" mode, but the breaking of table inheritance is not desired, authors can use gecko's standards support to overcome the table-font rule shown above. the value -moz-initial is a proprietary value used to apply the user's (or browser's) default setting for a given property to an element. because it is not actually part of css, it is marked with the prefix -moz- in order to avoid confusion about what is or isn't part of css. overcoming legacy behavior all that is needed is a rule that overrides the -moz-initial values with the css2 value inherit. this v...
...y the user's (or browser's) default setting for a given property to an element. because it is not actually part of css, it is marked with the prefix -moz- in order to avoid confusion about what is or isn't part of css. overcoming legacy behavior all that is needed is a rule that overrides the -moz-initial values with the css2 value inherit. this value is used to force an element to use the same value as its parent element for a given property. /* rule to fix quirks-mode inheritance behavior */ table, caption { font-size: inherit; font-weight: inherit; font-style: inherit; font-variant: inherit; } this rule will override the rule in quirk.css and thus allow the author to have reliable inheritance of font styles into tables when in "quirks" mode. it is also fully valid css2 and so wil...
Anatomy of a video game - Game development
ous events. while we are on the topic of budgeting time, many web browsers have a tool called high resolution time. the date object is no longer the recognised method for timing events because it is very imprecise and can be modified by the system clock. high resolution time, on the other hand, counts the number of milliseconds since navigationstart (when the previous document is unloaded). this value is returned as a decimal number accurate to a thousandth of a millisecond. it is known as a domhighrestimestamp but, for all intents and purposes, consider it a floating point number. note: systems (hardware or software) that are not capable of microsecond accuracy are allowed to provide millisecond accuracy as a minimum. they should provide 0.001ms accuracy if they are capable of it, however. ...
...urned as a decimal number accurate to a thousandth of a millisecond. it is known as a domhighrestimestamp but, for all intents and purposes, consider it a floating point number. note: systems (hardware or software) that are not capable of microsecond accuracy are allowed to provide millisecond accuracy as a minimum. they should provide 0.001ms accuracy if they are capable of it, however. this value is not too useful alone, since it is relative to a fairly uninteresting event, but it can be subtracted from another timestamp to accurately and precisely determine how much time elapsed between those two points. to acquire one of these timestamps, you can call window.performance.now() and store the result as a variable. var tnow = window.performance.now(); back to the topic of the main loop. ...
Game promotion - Game development
d. honesty is key and you should be authentic, because nobody likes boring press releases or pushy advertisements. when the time comes your community will help you spread the word about your shiny little game. you should use at least twitter and facebook and be active on appropriate forums — the most popular one is html5gamedevs.com. share your gamedev news and answer questions, so people will value what you're doing and will know that you're ok. remember to not be too pushy on telling everyone about your games — you're not a walking advertisement. grow your fanbase by talking to them, sharing tips, offering discounts, giving away prizes in competitions, or just complaining at the weather or buggy browser you have to deal with. act cool, be generous, be yourself and be there for others, a...
... can find youtube and twitch.tv influencers at gameinfluencer.com to help promote your game. events if you've gone through all the options listed above you can still find new, creative ways to promote your game — events are another good example. attending events, both local and global, gives you the ability to meet your fans face to face, as well as other members of the development community. value the fact that they spent their time seeing you. conferences there are many conferences where you can give a talk explaining some technical difficulties you overcame, or how you implemented specific apis; again — use your games as examples for that. it's important to focus on the knowledge part and tone down the marketing — devs are sensitive on this matter and you may end up with an angry c...
Building up a basic demo with A-Frame - Game development
e scene is done by adding a simple <a-box> element inside the <a-scene> element. add it now: <a-box color="#0095dd" position="0 1 0" rotation="20 40 0"> </a-box> it contains a few parameters already defined: color, position and rotation — these are fairly obvious, and define the base color of the cube, the position inside the 3d scene, and the rotation of the cube. note: the distance values (e.g. for the cube y position) are unitless, and can basically be anything you deem suitable for your scene — milimeters, meters, feet, or miles — it's up to you. adding a background: sky box a sky box is a background for the 3d world, represented by an <a-sky> element. in our case we will use a simple color, but it could also be an image, etc. looking around would give an impression of b...
...nimation> to change the position of the third shape, or we could use javascript instead. add this code at the end of the <script> tag: var t = 0; function render() { t += 0.01; requestanimationframe(render); cylinder.setattribute('position', '3 '+(math.sin(t*2)+1)+' 0'); } render(); we're using the render() function to update the cylinder's position on every frame. try changing the given values on the y axis and see how it affects the movement. conclusion everything is rendered properly and animating — congratulations on building your first a-frame scene! here's how the final version looks and works: if you have a vr device available, now is a good time to try out your scene with it too. note: you can also check it out on github. that was easier than you thought, right? a-fr...
Square tilemaps implementation: Static maps - Game development
s we make use of the drawimage() method in a canvas 2d context. we need to supply the atlas image, the coordinates and dimensions of the tile inside the atlas, and the target coordinates and size (a different tile size in here would scale the tile.) so, for instance, to draw the tree tile, which is the third in the atlas, at the screen coordinates (128, 320), we would call drawimage() with these values: context.drawimage(atlasimage, 192, 0, 64, 64, 128, 320, 64, 64); in order to support atlases with multiple rows and columns, you would need to know how many rows and columns there are to be able to compute the source x and y. the tilemap data structure to store that map data, we can use a plain object or a custom class. for the sake of simplicity, in the example code a plain object has been...
...tile(): a helper method that gets the tile index in a certain position. tiles contains the actual visual map data. we are representing the tiles with indices, assigned to the tiles dependant on their position in the atlas (e.g. 0 for the left-most tile.) however, we must account for empty tiles, since they are crucial for implementing layers — empty tiles are usually assigned a negative index value, 0, or a null value. in these examples, empty tiles will be represented by index 0, so we will shift the indices of the atlases by one (and thus the first tile of the atlas will be assigned index 1, the second index 2, etc.) the gettile() helper method returns the tile contained at the specified column and row. if tiles were a 2d matrix, then the returned value would just be tiles[column][row]. ...
Bounce off the walls - Game development
us on the top one first. we need to check, on every frame, whether the ball is touching the top edge of the canvas — if yes, we'll reverse the ball movement so it will start to move in the opposite direction and stay within the visible boundaries. remembering that the coordinate system starts from the top left, we can come up with something like this: if(y + dy < 0) { dy = -dy; } if the y value of the ball position is lower than zero, change the direction of the movement on the y axis by setting it equal to itself, reversed. if the ball was moving upwards with a speed of 2 pixels per frame, now it will be moving "up" with a speed of -2 pixels, which actually equals to moving down at a speed of 2 pixels per frame. the code above would deal with the ball bouncing off the top edge, so now...
...f 2 pixels per frame, now it will be moving "up" with a speed of -2 pixels, which actually equals to moving down at a speed of 2 pixels per frame. the code above would deal with the ball bouncing off the top edge, so now let's think about the bottom edge: if(y + dy > canvas.height) { dy = -dy; } if the ball's y position is greater than the height of the canvas (remember that we count the y values from the top left, so the top edge starts at 0 and the bottom edge is at 320 pixels, the canvas' height), then bounce it off the bottom edge by reversing the y axis movement as before. we could merge those two statements into one to save on code verbosity: if(y + dy > canvas.height || y + dy < 0) { dy = -dy; } if either of the two statements is true, reverse the movement of the ball. bou...
Create the Canvas and draw on it - Game development
an example piece of code that prints a red square on the canvas. add this below your previous lines of javascript, then load your index.html in a browser to try it out. ctx.beginpath(); ctx.rect(20, 40, 50, 50); ctx.fillstyle = "#ff0000"; ctx.fill(); ctx.closepath(); all the instructions are between the beginpath() and closepath() methods. we are defining a rectangle using rect(): the first two values specify the coordinates of the top left corner of the rectangle on the canvas, while the second two specify the width and height of the rectangle. in our case the rectangle is painted 20 pixels from the left side of the screen and 40 pixels from the top side, and is 50 pixels wide and 50 pixels high, which makes it a perfect square. the fillstyle property stores a color that will be used by the ...
...ters: x and y coordinates of the arc's center arc radius start angle and end angle (what angle to start and finish drawing the circle, in radians) direction of drawing (false for clockwise, the default, or true for anti-clockwise.) this last parameter is optional. the fillstyle property looks different than before. this is because, just as with css, color can be specified as a hexadecimal value, a color keyword, the rgba() function, or any of the other available color methods. instead of using fill() and filling the shapes with colors, we can use stroke() to only colour the outer stroke. try adding this code to your javascript too: ctx.beginpath(); ctx.rect(160, 10, 100, 40); ctx.strokestyle = "rgba(0, 0, 255, 0.5)"; ctx.stroke(); ctx.closepath(); the code above prints a blue-stroked...
Mouse controls - Game development
sed on the pointer coordinates — the following handler function will do exactly that. add the following function to your code, below the previous line you added: function mousemovehandler(e) { var relativex = e.clientx - canvas.offsetleft; if(relativex > 0 && relativex < canvas.width) { paddlex = relativex - paddlewidth/2; } } in this function we first work out a relativex value, which is equal to the horizontal mouse position in the viewport (e.clientx) minus the distance between the left edge of the canvas and left edge of the viewport (canvas.offsetleft) — effectively this is equal to the distance between the canvas left edge and the mouse pointer. if the relative x pointer position is greater than zero and lower than the canvas width, the pointer is within the canv...
...he left edge of the canvas and left edge of the viewport (canvas.offsetleft) — effectively this is equal to the distance between the canvas left edge and the mouse pointer. if the relative x pointer position is greater than zero and lower than the canvas width, the pointer is within the canvas boundaries, and the paddlex position (anchored on the left edge of the paddle) is set to the relativex value minus half the width of the paddle, so that the movement will actually be relative to the middle of the paddle. the paddle will now follow the position of the mouse cursor, but since we're restricting the movement to the size of the canvas, it won't disappear completely off either side. compare your code this is the latest state of the code to compare against: exercise: adjust the boundari...
Player paddle and controls - Game development
rget, at this point you should grab the paddle graphic from github, and save it in your /img folder. rendering the paddle, with physics next up, we will init our paddle by adding the following add.sprite() call inside the create() function — add it right at the bottom: paddle = game.add.sprite(game.world.width*0.5, game.world.height-5, 'paddle'); we can use the world.width and world.height values to position the paddle exactly where we want it: game.world.width*0.5 will be right in the middle of the screen. in our case the world is the same as the canvas, but for other types of games, like side-scrollers for example, the world will be bigger, and you can tinker with it to create interesting effects. as you'll notice if you reload your index.html at this point, the paddle is currently no...
...ttle offset from the bottom. to place it exactly as we want it we will set the anchor to the exact middle of the ball. find the existing ball = game.add.sprite( ... ) line, and replace it with the following two lines: ball = game.add.sprite(game.world.width*0.5, game.world.height-25, 'ball'); ball.anchor.set(0.5); the velocity stays almost the same — we're just changing the second parameter's value from 150 to -150, so the ball will start the game by moving up instead of down. find the existing ball.body.velocity.set( ... ) line and update it to the following: ball.body.velocity.set(150, -150); now the ball will start right from the middle of the paddle. compare your code you can check the finished code for this lesson in the live demo below, and play with it to understand better how i...
Boolean - MDN Web Docs Glossary: Definitions of Web-related terms
for example, in javascript, boolean conditionals are often used to decide which sections of code to execute (such as in if statements) or repeat (such as in for loops). below is some javascript pseudocode (it's not truly executable code) demonstrating this concept. ...
... learn more general knowledge boolean on wikipedia technical reference the javascript global object: boolean javascript data types and data structures ...
CORS-safelisted request header - MDN Web Docs Glossary: Definitions of Web-related terms
a cors-safelisted request header is one of the following http headers: accept, accept-language, content-language, content-type. when containing only these headers (and values that meet the additional requirements laid out below), a requests doesn't need to send a preflight request in the context of cors. you can safelist more headers using the access-control-allow-headers header and also list the above headers there to circumvent the following additional restrictions: additional restrictions cors-safelisted headers must also fulfill the following requirements in order to be a cors-safelisted request header: for accept-language and content-language: can only have values consisting of 0-9, a-z, a-z, space or *,-.;=. for accept and content-type: can't contain a cors-unsafe r...
...also fulfill the following requirements in order to be a cors-safelisted request header: for accept-language and content-language: can only 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 ...
Delta - MDN Web Docs Glossary: Definitions of Web-related terms
the term delta refers to the difference between two values or states. the name originates from the greek letter Δ (delta), which is equivalent to the letter d in the roman alphabet. delta simply refers to the use of the letter Δ as a shorthand for difference. the term delta is commonly used when communicating changes in speed, position, or acceleration of a physical or virtual object. it's also used when describing changes in the volume or frequency of sound waves. for example, when describing how far an object on the screen moves left-to-right, one might use the term delta x or Δx. ...
... letter Δ as a shorthand for difference. the term delta is commonly used when communicating changes in speed, position, or acceleration of a physical or virtual object. it's also used when describing changes in the volume or frequency of sound waves. for example, when describing how far an object on the screen moves left-to-right, one might use the term delta x or Δx. likewise, given the new value of x and its old value, you might compute the delta like this: let deltax = newx - oldx; more commonly, you receive the delta and use it to update a saved previous condition: let newx = oldx + deltax; learn more technical reference mouse wheel events (wheelevent offer the amount the wheel moved since the last event in its deltax, deltay, and deltaz properties, for example. ...
Descriptor (CSS) - MDN Web Docs Glossary: Definitions of Web-related terms
a css descriptor defines the characteristics of an at-rule. at-rules may have one or multiple descriptors. ...
... a css descriptor defines the characteristics of an at-rule. at-rules may have one or multiple descriptors. ...
Falsy - MDN Web Docs Glossary: Definitions of Web-related terms
a falsy (sometimes written falsey) value is a value that is considered false when encountered in a boolean context. javascript uses type conversion to coerce any value to a boolean in contexts that require it, such as conditionals and loops. there are 8 falsy values: false the keyword false 0 the number zero -0 the number negative zero 0n bigint, when used as a boolean, follows the same rule as a number. 0n is falsy. "" empty string value null null - the absence of any value undefined undefined - the primitive value nan nan - not a number objects are falsy if and only if they have the [[ishtmldda]] internal slot. this slot only exists in document.all and cannot be set usin...
...rule as a number. 0n is falsy. "" empty string value null null - the absence of any value undefined undefined - the primitive value nan nan - not a number objects are falsy if and only if they have the [[ishtmldda]] internal slot. this slot only exists in document.all and cannot be set using javascript. ...
First-class Function - MDN Web Docs Glossary: Definitions of Web-related terms
a programming language is said to have first-class functions when functions in that language are treated like any other variable. for example, in such a language, a function can be passed as an argument to other functions, can be returned by another function and can be assigned as a value to a variable. example | assign a function to a variable javascript const foo = function() { console.log("foobar"); } // invoke it using the variable foo(); we assigned an anonymous function in a variable, then we used that variable to invoke the function by adding parentheses () at the end. even if your function was named, you can use the variable name to invoke it. naming it will be helpful when debugging your code. but it won't affect the way we invoke it. example | pass a function as an...
... | pass a function as an argument javascript function sayhello() { return "hello, "; } function greeting(hellomessage, name) { console.log(hellomessage() + name); } // pass `sayhello` as an argument to `greeting` function greeting(sayhello, "javascript!"); we are passing our sayhello() function as an argument to the greeting() function, this explains how we are treating the function as a value. the function that we pass as an argument to another function, is called a callback function. sayhello is a callback function. example | return a function javascript function sayhello() { return function() { console.log("hello!"); } } in this example; we need to return a function from another function - we can return a function because we treated function in javascript as a va...
Hoisting - MDN Web Docs Glossary: Definitions of Web-related terms
irst, before the function is written, the code still works. this is because of how context execution works in javascript. hoisting works well with other data types and variables. the variables can be initialized and used before they are declared. only declarations are hoisted javascript only hoists declarations, not initializations. if a variable is declared and initialized after using it, the value will be undefined. for example: console.log(num); // returns undefined, as only declaration was hoisted, no initialization has happened at this stage var num; // declaration num = 6; // initialization the example below only has initialization. no hoisting happens so trying to read the variable results in referenceerror exception. console.log(num); // throws referenceerror exception num = 6; //...
...o read the variable results in referenceerror exception. console.log(num); // throws referenceerror exception num = 6; // initialization below are more examples demonstrating hoisting. // example 1 // only y is hoisted x = 1; // initialize x, and if not already declared, declare it - but no hoisting as there is no var in the statement. console.log(x + " " + y); // '1 undefined' // this prints value of y as undefined as javascript only hoists declarations var y = 2; // declare and initialize y // example 2 // no hoisting, but since initialization also causes declaration (if not already declared), variables are available. a = 'cran'; // initialize a b = 'berry'; // initialize b console.log(a + "" + b); // 'cranberry' technical reference var statement — mdn function statement — mdn...
Null - MDN Web Docs Glossary: Definitions of Web-related terms
in computer science, a null value represents a reference that points, generally intentionally, to a nonexistent or invalid object or address. the meaning of a null reference varies among language implementations. in javascript, null is marked as one of the primitive values, because its behaviour is seemingly primitive. ...
...ll value represents a reference that points, generally intentionally, to a nonexistent or invalid object or address. the meaning of a null reference varies among language implementations. in javascript, null is marked as one of the primitive values, because its behaviour is seemingly primitive. ...
Type - MDN Web Docs Glossary: Definitions of Web-related terms
type is a characteristic of a value affecting what kind of data it can store, and the structure that the data will adhere to. for example, a boolean data type can hold only a true or false value at any given time, whereas a string has the ability to hold a string or a sequence of characters, a number can hold numerical values of any kind, and so on. a value's data type also affects the operations that are valid on that value. for example, a value of type number can be multiplied by another number, but not by a string - even if that string contains only a number, such as the string "2". types also provides us with useful knowledge about the comparison between different values. comparison between structured types is not always an easy assumption, as even if the previous data structure i...
...by a string - even if that string contains only a number, such as the string "2". types also provides us with useful knowledge about the comparison between different values. comparison between structured types is not always an easy assumption, as even if the previous data structure is the same, there could be inherited structures inside of the prototype chain. if you are unsure of the type of a value, you can use the typeof operator. ...
Array - MDN Web Docs Glossary: Definitions of Web-related terms
each item in an array has a number attached to it, called a numeric index, that allows you to access it. in javascript, arrays start at index zero and can be manipulated with various methods. ...
... each item in an array has a number attached to it, called a numeric index, that allows you to access it. in javascript, arrays start at index zero and can be manipulated with various methods. ...
Type, class, and ID selectors - Learn web development
e space between them. you'll see that the last <div> doesn't get any styling applied, as it only has the danger class; it needs notebox as well to get anything applied. id selectors an id selector begins with a # rather than a full stop character, but is basically used in the same way as a class selector. an id however can be used only once per document, and elements can only have a single id value applied to them. it can select an element that has the id set on it, and you can precede the id with a type selector to only target the element if both the element and id match. you can see both of these uses in the following example: warning: using the same id multiple times in a document may appear to work for styling purposes, but don't do this. it results in invalid code, and will cause s...
...rticle we'll continue exploring selectors by looking at attribute selectors. ...
Test your skills: sizing - Learn web development
note: you can try out solutions in the interactive editors below, however, it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. task one in this task, you have two boxes. ...
...all, so that content will overflow if there is too much. try updating the live code below to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. task two this task has a box, which contains another box. your task is to make the inner box 60% of the width of the outer box. the value of the box-sizing property is set to border-box, which means that the total width includes any padding and border. you should also give the inner box padding of 10% using the width (or inline size) as the size from which that percentage is calculated. try updating the live code below to recreate the example as displayed in the image: for assessment or further work purposes, download the st...
Beginner's guide to media queries - Learn web development
sizes. for example, to change the body text color to red if the viewport is exactly 600 pixels, you would use the following media query. @media screen and (width: 600px) { body { color: red; } } open this example in the browser, or view the source. the width (and height) media features can be used as ranges, and therefore be prefixed with min- or max- to indicate that the given value is a minimum, or a maximum. for example, to make the color blue if the viewport is narrower than 600 pixels, use max-width: @media screen and (max-width: 600px) { body { color: blue; } } open this example in the browser, or view the source. in practice, using minimum or maximum values is much more useful for responsive design so you will rarely see width or height used alone. ...
...oes not hover. @media (hover: hover) { body { color: rebeccapurple; } } open this example in the browser, or view the source. if we know the user cannot hover, we could display some interactive features by default. for users who can hover, we might choose to make them available when a link is hovered over. also in level 4 is the pointer media feature. this takes three possible values, none, fine and coarse. a fine pointer is something like a mouse or trackpad. it enables the user to precisely target a small area. a coarse pointer is your finger on a touchscreen. the value none means the user has no pointing device; perhaps they are navigating with the keyboard only or with voice commands. using pointer can help you to design better interfaces that respond to the type of int...
CSS layout - Learn web development
uides these articles will provide instruction on the fundamental layout tools and techniques available in css. at the end of the lessons is an assessment to help you check your understanding of layout methods, by laying out a webpage. introduction to css layout this article will recap some of the css layout features we've already touched upon in previous modules — such as different display values — and introduce some of the concepts we'll be covering throughout this module. normal flow elements on webpages lay themselves out according to normal flow - until we do something to change that. this article explains the basics of normal flow as a grounding for learning how to change it. flexbox flexbox is a one-dimensional layout method for laying out items in rows or columns. items flex...
...webpages. with the advent of flexbox and grid it has now returned to its original purpose, as this article explains. positioning positioning allows you to take elements out of the normal document layout flow, and make them behave differently, for example sitting on top of one another, or always remaining in the same place inside the browser viewport. this article explains the different position values, and how to use them. multiple-column layout the multiple-column layout specification gives you a method of laying content out in columns, as you might see in a newspaper. this article explains how to use this feature. responsive design as more diverse screen sizes have appeared on web-enabled devices, the concept of responsive web design (rwd) has appeared: a set of practices that allows we...
How CSS works - Learn web development
re not using the latest version of a browser. given that css is being developed all the time, and is therefore ahead of what browsers can recognise, you might wonder what happens if a browser encounters a css selector or declaration it doesn't recognise. the answer is that it does nothing, and just moves on to the next bit of css! if a browser is parsing your rules, and encounters a property or value that it doesn't understand, it ignores it and moves on to the next declaration. it will do this if you have made an error and misspelled a property or value, or if the property or value is just too new and the browser doesn't yet support it. similarly, if a browser encounters a selector that it doesn't understand, it will just ignore the whole rule and move on to the next one. in the example be...
...error will occur if it is not understood — the browser will either get the new feature or not. coupled with the way that the cascade works, and the fact that browsers will use the last css they come across in a stylesheet when you have two rules with the same specificity you can also offer alternatives for browsers that don't support new css. this works particularly well when you want to use a value that is quite new and not supported everywhere. for example, some older browsers do not support calc() as a value. i might give a fallback width for a box in pixels, then go on to give a width with a calc() value of 100% - 50px. old browsers will use the pixel version, ignoring the line about calc() as they don't understand it. new browsers will interpret the line using pixels, but then override ...
Using CSS generated content - Learn web development
iate language versions of your doucment. this issue does not arise if the content you specify consists of symbols or images that apply in all languages and cultures. examples text content css can insert text content before or after an element. to specify this, make a rule and add ::before or ::after to the selector. in the declaration, specify the content property with the text content as its value. html a text where i need to <span class="ref">something</span> css .ref::before { font-weight: bold; color: navy; content: "reference "; } output the character set of a stylesheet is utf-8 by default, but it can also be specified in the link, in the stylesheet itself, or in other ways. for details, see 4.4 css style sheet representation in the css specification. individual charac...
...acters can also be specified by an escape mechanism that uses backslash as the escape character. for example, "\265b" is the chess symbol for a black queen ♛. for details, see referring to characters not represented in a character encoding and characters and case in the css specification. image content to add an image before or after an element, you can specify the url of an image file in the value of the content property. this rule adds a space and an icon after every link that has the class glossary: html <a href="developer.mozilla.org" class="glossary">developer.mozilla.org</a> css a.glossary::after { content: " " url("https://mdn.mozillademos.org/files/16322/glossary-icon.gif"); } ...
Web fonts - Learn web development
fonts — they are placed first to fix a couple of bugs in older versions of ie whereby it will try to use the first thing it finds, even if it can't actually use the font. font-weight/font-style: these lines specify what weight the font has, and whether it is italic or not. if you are importing multiple weights of the same font, you can specify what their weight/style is and then use different values of font-weight/font-style to choose between them, rather than having to call all the different members of the font family different names. @font-face tip: define font-weight and font-style to keep your css simple by roger johansson shows what to do in more detail. note: you can also specify particular font-variant and font-stretch values for your web fonts. in newer browsers, you can also spe...
...-style to choose between them, rather than having to call all the different members of the font family different names. @font-face tip: define font-weight and font-style to keep your css simple by roger johansson shows what to do in more detail. note: you can also specify particular font-variant and font-stretch values for your web fonts. in newer browsers, you can also specify a unicode-range value, which is a specific range of characters you want to use out of the web font — in supporting browsers, only the specified characters will be downloaded, saving unnecessary downloading. creating custom font stacks with unicode-range by drew mclellan provides some useful ideas on how to make use of this. variable fonts there is a newer font technology available in browsers called variable font...
What is a URL? - Learn web development
.mozilla.org https://developer.mozilla.org/docs/learn/ https://developer.mozilla.org/search?q=url any of those urls can be typed into your browser's address bar to tell it to load the associated page (resource). a url is composed of different parts, some mandatory and others optional. let's see the most important parts using the following url: http://www.example.com:80/path/to/myfile.html?key1=value1&key2=value2#somewhereinthedocument http is the protocol. the first part of the url indicates which protocol the browser must use. a protocol is a set method for exchanging or transferring data around a computer network. usually for websites it is the http protocol or its secured version, https. the web requires one of these two, but browsers also know how to handle other protocols such as m...
...ndard ports of the http protocol (80 for http and 443 for https) to grant access to its resources. otherwise it is mandatory. /path/to/myfile.html is the path to the resource on the web server. in the early days of the web, a path like this represented a physical file location on the web server. nowadays, it is mostly an abstraction handled by web servers without any physical reality. ?key1=value1&key2=value2 are extra parameters provided to the web server. those parameters are a list of key/value pairs separated with the & symbol. the web server can use those parameters to do extra stuff before returning the resource. each web server has its own rules regarding parameters, and the only reliable way to know if a specific web server is handling parameters is by asking the web server owner.
Example 3 - Learn web development
this is the third example that explain how to build custom form widgets. ...
....5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #f0f0f0; background : -webkit-linear-gradient(90deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "▼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : ce...
CSS property compatibility table for form controls - Learn web development
the following compatibility tables try to summarize the state of css support for html forms. due to the complexity of css and html forms, these tables can't be considered a perfect reference. however, they will give you good insight into what can and can't be done, which will help you learn how to do things. how to read the tables values for each property, there are four possible values: yes there's reasonably consistent support for the property across browsers. you may still face strange side effects in certain edge cases. partial while the property works, you may frequently face strange side effects or inconsistencies. you should probably avoid these properties unless you master those side effects first. no the property simply doesn't work or is so inconsistent that it's not relia...
... background yes yes border-radius yes[1] yes[1] on opera the border-radius property is applied only if an explicit border is set. box-shadow no partial[1] ie9 does not support this property. number see the number input type. there is no standard way to change the style of spinners used to change the value of the field, with the spinners on safari being outside the field. property n t note css box model width yes yes height partial[1] partial[1] on opera, the spinners are zoomed in, which can hide the content of the field. border yes yes margin yes yes padding p...
Using data attributes - Learn web development
x is simple. any attribute on any element whose attribute name starts with data- is a data attribute. say you have an article and you want to store some extra information that doesn’t have any visual representation. just use data attributes for that: <article id="electric-cars" data-columns="3" data-index-number="12314" data-parent="cars"> ... </article> javascript access reading the values of these attributes out in javascript is also very simple. you could use getattribute() with their full html name to read them, but the standard defines a simpler way: a domstringmap you can read out via a dataset property. to get a data attribute through the dataset object, get the property by the part of the attribute name after data- (note that dashes are converted to camelcase). const arti...
... working together in this jsbin example. data attributes can also be stored to contain information that is constantly changing, like scores in a game. using the css selectors and javascript access here this allows you to build some nifty effects without having to write your own display routines. see this screencast for an example using generated content and css transitions (jsbin example). data values are strings. number values must be quoted in the selector for the styling to take effect. issues do not store content that should be visible and accessible in data attributes, because assistive technology may not access them. in addition, search crawlers may not index data attributes' values. the main issues to consider are internet explorer support and performance. internet explorer 11+ prov...
Creating hyperlinks - Learn web development
ail to an address of their choosing. specifying details in addition to the email address, you can provide other information. in fact, any standard mail header fields can be added to the mailto url you provide. the most commonly used of these are "subject", "cc", and "body" (which is not a true header field, but allows you to specify a short content message for the new email). ...
...u to specify a short content message for the new email). each field and its value is specified as a query term. here's an example that includes a cc, bcc, subject and body: <a href="mailto:nowhere@mozilla.org?cc=name2@rapidtables.com&bcc=name3@rapidtables.com&subject=the%20subject%20of%20the%20email&body=the%20body%20of%20the%20email"> send mail with cc, bcc, subject and body </a> note: the values of each field must be url-encoded, that is with non-printing characters (invisible characters like tabs, carriage returns, and page breaks) and spaces percent-escaped. also note the use of the question mark (?) to separate the main url from the field values, and ampersands (&) to separate each field in the mailto: url. this is standard url query notation. read the get method to understand what u...
Debugging HTML - Learn web development
ent has no closing tag. this is a bit more problematic, as it isn't easy to tell where the element is supposed to end. in fact, the whole of the rest of the text has been strongly emphasised. this section is badly nested: <strong>strong <em>strong emphasised?</strong> what is this?</em>. it is not easy to tell how this has been interpreted because of the previous problem. the href attribute value is missing a closing double quote. this seems to have caused the biggest problem — the link has not rendered at all. now let's look at the markup the browser has rendered, as opposed to the markup in the source code. to do this, we can use the browser developer tools. if you are not familiar with how to use your browser's developer tools, take a few minutes to review discover browser deve...
...is a good enough clue to see what is wrong. "unclosed element strong": this is really easy to understand — a <strong> element is unclosed, and the line/column information points right to where it is. "end tag strong violates nesting rules": this points out the incorrectly nested elements, and the line/column information points out where they are. "end of file reached when inside an attribute value. ignoring tag": this one is rather cryptic; it refers to the fact that there is an attribute value not properly formed somewhere, possibly near the end of the file because the end of the file appears inside the attribute value. the fact that the browser doesn't render the link should give us a good clue as to what element is at fault. "end of file seen and there were open elements": this is a bi...
Document and website structure - Learn web development
<nav> <ul> <li><a href="#">home</a></li> <li><a href="#">our team</a></li> <li><a href="#">projects</a></li> <li><a href="#">contact</a></li> </ul> <!-- a search form is another commmon non-linear way to navigate through a website. --> <form> <input type="search" name="q" placeholder="search query"> <input type="submit" value="go!"> </form> </nav> <!-- here is our page's main content --> <main> <!-- it contains an article --> <article> <h2>article heading</h2> <p>lorem ipsum dolor sit amet, consectetur adipisicing elit. donec a diam lectus. set sit amet ipsum mauris. maecenas congue ligula as quam viverra nec consectetur ant hendrerit. donec et mollis dolor. praesent ...
...elate to the main content of the page (you want it viewable from anywhere). it doesn't even particularly warrant using a <section>, as it isn't part of the main content of the page. so a <div> is fine in this case. we've included a heading as a signpost to aid screenreader users in finding it. warning: divs are so convenient to use that it's easy to use them too much. as they carry no semantic value, they just clutter your html code. take care to use them only when there is no better semantic solution and try to reduce their usage to the minimum otherwise you'll have a hard time updating and maintaining your documents. line breaks and horizontal rules two elements that you'll use occasionally and will want to know about are <br> and <hr>: <br> creates a line break in a paragraph; it is t...
Responsive images - Learn web development
let's run through the contents of each now: srcset defines the set of images we will allow the browser to choose between, and what size each image is. each set of image information is separated from the previous one by a comma. for each one, we write: an image filename (elva-f...
... code): <img srcset="elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w" sizes="(max-width: 600px) 480px, 800px" src="elva-fairy-800w.jpg" alt="elva dressed as a fairy"> the srcset and sizes attributes look complicated, but they're not too hard to understand if you format them as shown above, with a different part of the attribute value on each line. each value contains a comma-separated list, and each part of those lists is made up of three sub-parts. let's run through the contents of each now: srcset defines the set of images we will allow the browser to choose between, and what size each image is. each set of image information is separated from the previous one by a comma. for each one, we write: an image filename (elva-fairy-480w.jpg) a space ...
HTML table advanced features and accessibility - Learn web development
hich looks something like this: title1 title2 title3 cell1 cell2 cell3 cell2 cell3 cell4 cell5 cell6 tables for visually impaired users let's recap briefly on how we use data tables. a table can be a handy tool, for giving us quick access to data and allowing us to look up different values. for example, it takes only a short glance at the table below to find out how many rings were sold in gent last august. to understand its information we make visual associations between the data in this table and its column and/or row headers. items sold august 2016 clothes accessories trousers skirts dresses bracelets rings belgium ...
...thead> and each row could have a header defined like this (if we added row headers as well as column headers): <tr> <th scope="row">haircut</th> <td>hairdresser</td> <td>12/09</td> <td>great idea</td> <td>30</td> </tr> screenreaders will recognize markup structured like this, and allow their users to read out the entire column or row at once, for example. scope has two more possible values — colgroup and rowgroup. these are used for headings that sit over the top of multiple columns or rows. if you look back at the "items sold august 2016" table at the start of this section of the article, you'll see that the "clothes" cell sits above the "trousers", "skirts", and "dresses" cells. all of these cells should be marked up as headers (<th>), but "clothes" is a heading that sits over...
Choosing the right approach - Learn web development
7 full support 6.1prefixed prefixed implemented with the vendor prefix: webkitsamsung internet android full support 1.5 full support 1.5 full support 1.0prefixed prefixed implemented with the vendor prefix: webkitreturn valuechrome full support 23edge full support 12firefox full support 11ie full support 10opera full support 15safari full support 6.1web...
...}); } // call the fetchanddecode() method to fetch the images and the text, and store their promises in variables let coffee = fetchanddecode('coffee.jpg', 'blob'); let tea = fetchanddecode('tea.jpg', 'blob'); let description = fetchanddecode('description.txt', 'text'); // use promise.all() to run code only when all three function calls have resolved promise.all([coffee, tea, description]).then(values => { console.log(values); // store each value returned from the promises in separate variables; create object urls from the blobs let objecturl1 = url.createobjecturl(values[0]); let objecturl2 = url.createobjecturl(values[1]); let desctext = values[2]; // display the images in <img> elements let image1 = document.createelement('img'); let image2 = document.createelement('img');...
Introducing asynchronous JavaScript - Learn web development
all callbacks are async — some run synchronously. an example is when we use array.prototype.foreach() to loop through the items in an array (see it live, and the source): const gods = ['apollo', 'artemis', 'ares', 'zeus']; gods.foreach(function (eachname, index){ console.log(index + '. ' + eachname); }); in this example we loop through an array of greek gods and print the index numbers and values to the console. the expected parameter of foreach() is a callback function, which itself takes two parameters, a reference to the array name and index values. however, it doesn't wait for anything — it runs immediately. promises promises are the new style of async code that you'll see used in modern web apis. a good example is the fetch() api, which is basically like a modern, more efficient...
....log() call to the following: console.log ('all done! ' + image.src + 'displayed.'); you should now get an error in your console instead of the third message: typeerror: image is undefined; can't access its "src" property this is because at the time the browser tries to run the third console.log() statement, the fetch() block has not finished running so the image variable has not been given a value. note: for security reasons, you can't fetch() files from your local filesystem (or run other such operations locally); to run the above example locally you'll have to run the example through a local webserver. active learning: make it all async! to fix the problematic fetch() example and make the three console.log() statements appear in the desired order, you could make the third console.lo...
Test your skills: Functions - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. ...
...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). dom manipulation: considered useful some of the questions below require you to write some dom manipulation code to complete them — such as creating new html elements, setting their text contents to equal specific string values, and nesting them inside existing elements on the page — all via javascript. we haven't explicitly taught this yet in the course, but you'll have seen some examples that make use of it, and we'd like you to do some research into what dom apis you need to successfully answer the questions. a good starting place is our manipulating documents tutorial. functions 1 for the first task, you have ...
Test your skills: variables - Learn web development
ection at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version). variables 1 in this task we want you to: declare a variable called myname. ...
...lts 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). variables 1 in this task we want you to: declare a variable called myname. initialize myname with a suitable value, on a separate line (you can use your actual name, or something else). declare a variable called myage and initialize it with a value, on the same line. 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. variables 2 in this task you need to add a new line to correct the value stored in the existing myname variable to your own name. try updating the live code below to recreate the finished example: download ...
Object-oriented JavaScript for beginners - Learn web development
ipt's version of a class. notice that it has all the features you'd expect in a function, although it doesn't return anything or explicitly create an object — it basically just defines properties and methods. notice also the this keyword being used here as well — it is basically saying that whenever one of these object instances is created, the object's name property will be equal to the name value passed to the constructor call, and the greeting() method will use the name value passed to the constructor call too. note: a constructor function name usually starts with a capital letter — this convention is used to make constructor functions easier to recognize in code. so how do we call a constructor to create some objects? add the following lines below your previous code addition: ...
...o new objects on the page, each of which is stored under a different namespace — when you access their properties and methods, you have to start calls with person1 or person2; the functionality contained within is neatly packaged away so it won't clash with other functionality. they do, however, have the same name property and greeting() method available. note that they are using their own name value that was assigned to them when they were created; this is one reason why it is very important to use this, so each one uses its own value, and not some other value. let's look at the constructor calls again: let person1 = new person('bob'); let person2 = new person('sarah'); in each case, the new keyword is used to tell the browser we want to create a new object instance, followed by the funct...
Properly configuring server MIME types - Learn web development
lp guide a web browser in how the content is to be processed and displayed. examples of mime types are: text/html for normal web pages text/plain for plain text text/css for cascading style sheets text/javascript for scripts application/octet-stream meaning "download this file" application/x-java-applet for java applets application/pdf for pdf documents technical background registered values for mime types are available in iana | mime media types. the http specification defines a superset of mime which is used to describe the media types used on the web. why are correct mime types important? if the web server or application reports an incorrect mime type for content, a web browser has no way, according to the http specification, of knowing that the author actually intended the co...
...the mime type such as <meta http-equiv="content-type" content="text/html"> should be ignored if there's a content-type line in the header. instead of looking for this line in the html source, use the above techniques to determine the mime type sent by the server. how to determine the correct mime type for your content there are several steps which you can take to determine the correct mime type value to be used for your content. if your content was created using a vendor's software application, read the vendor's documentation to see what mime types should be reported for different media types. look in the iana | mime media types registry which contains all registered mime types. if the media type is displayed using a plug-in in netscape gecko, install the plug-in and then look in the hel...
Client-Server Overview - Learn web development
new one if it doesn't exist). delete: delete the specified resource. trace, options, connect, patch: these verbs are for less common/advanced tasks, so we won't cover them here. additional information can be encoded with the request (for example, html form data). information can be encoded as: url parameters: get requests encode data in the url sent to the server by adding name/value pairs onto the end of it — for example http://mysite.com?name=fred&age=11. you always have a question mark (?) separating the rest of the url from the url parameters, an equals sign (=) separating each name from its associated value, and an ampersand (&) separating each pair. url parameters are inherently "insecure" as they can be changed by users and then resubmitted. as a result url parameter...
...# example: /best/junior/ url(r'^junior/$', views.junior), ] note: the first parameters in the url() functions may look a bit odd (e.g. r'^junior/$') because they use a pattern matching technique called "regular expressions" (regex, or re). you don't need to know how regular expressions work at this point, other than that they allow us to match patterns in the url (rather than the hard coded values above) and use them as parameters in our view functions. as an example, a really simple regex might say "match a single uppercase letter, followed by between 4 and 7 lower case letters." the web framework also makes it easy for a view function to fetch information from the database. the structure of our data is defined in models, which are python classes that define the fields to be stored in ...
Introduction to the server side - Learn web development
pertext transfer protocol (http). when you click a link on a web page, submit a form, or run a search, an http request is sent from your browser to the target server. the request includes a url identifying the affected resource, a method that defines the required action (for example to get, delete, or post the resource), and may include additional information encoded in url parameters (the field-value pairs sent via a query string), as post data (data sent by the http post method), or in associated cookies. web servers wait for client request messages, process them when they arrive, and reply to the web browser with an http response message. the response contains a status line indicating whether or not the request succeeded (e.g. "http/1.1 200 ok" for success). the body of a successful resp...
...mazon or some other e-commerce site. search for a number of keywords and note how the page structure doesn't change, even though the results do. open two or three different products. note again how they have a common structure and layout, but the content for different products has been pulled from the database. for a common search term ("fish", say) you can see literally millions of returned values. using a database allows these to be stored and shared efficiently, and it allows the presentation of the information to be controlled in just one place. customised user experience servers can store and use information about clients to provide a convenient and tailored user experience. for example, many sites store credit cards so that details don't have to be entered again. sites like google...
Ember Interactivity: Footer functionality, conditional rendering - Learn web development
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. note that here we need this.incomplete.length, not this.todos.incomplete.length, because we are doing this inside the se...
...o-data') todos; } next, go back again to our todo-data.js service file and add the following action just below the previous ones, which will allow us to toggle a completion state for each todo: @action togglecompletion(todo) { todo.iscompleted = !todo.iscompleted; } updating the template to show completed state finally, we will edit the todo.hbs template such that the checkbox's value is now bound to the iscompleted property on the todo, and so that on change, the togglecompletion() method on the todo service is invoked. in todo.hbs, first find the following line: <li> and replace it with this — you'll notice that here we're using some more conditional content to add the class value if appropriate: <li class="{{ if @todo.iscompleted 'completed' }}"> next...
Beginning our React todo list - Learn web development
for example: <button type="button" classname="btn toggle-btn" aria-pressed="true"> <span classname="visually-hidden">show </span> <span>all</span> <span classname="visually-hidden"> tasks</span> </button> here, aria-pressed tells assistive technology (like screen readers) that the button can be in one of two states: pressed or unpressed. think of these as analogs for on and off. setting a value of true means that the button is pressed by default. the class visually-hidden has no effect yet, because we have not included any css. once we have put our styles in place, though, any element with this class will be hidden from sighted users and still available to screen reader users — this is because these words are not needed by sighted users; they are there to provide more information abo...
...ngs into our browser console relating to handling events on the checkbox, which we want to avoid. don't worry too much about this for now — we will cover this later on when we get to using events. the htmlfor attribute corresponds to the for attribute used in html. we cannot use for as an attribute in jsx because for is a reserved word, so react uses htmlfor instead. notes: to use boolean values (true and false) in jsx attributes, you must enclose them in curly braces. if you write defaultchecked="true", the value of defaultchecked will be "true" — a string literal. remember — this is actually javascript, not html! the aria-pressed attribute used in our earlier code snippet has a value of true because aria-pressed is not a true boolean attribute in the way checked is. implementin...
Starting our Svelte Todo list app - Learn web development
me unusual attributes here. for example: <button class="btn toggle-btn" aria-pressed="true"> <span class="visually-hidden">show</span> <span>all</span> <span class="visually-hidden">tasks</span> </button> here, aria-pressed tells assistive technology (like screen readers) that the button can be in one of two states: pressed or unpressed. think of these as analogs for on and off. setting a value of true means that the button is pressed by default. the class visually-hidden has no effect yet, because we have not included any css. once we have put our styles in place, though, any element with this class will be hidden from sighted users and still available to screen reader users — this is because these words are not needed by sighted users; they are there to provide more information abo...
...s are not needed by sighted users; they are there to provide more information about what the button does for screenreader users that do not have the extra visual context to help them. further down, you can find the following <ul> element: <ul role="list" classname="todo-list stack-large" aria-labelledby="list-heading"> the role attribute helps assistive technology explain what kind of semantic value an element has — or what its purpose is. a <ul> is treated like a list by default, but the styles we're about to add will break that functionality. this role will restore the "list" meaning to the <ul> element. if you want to learn more about why this is necessary, you can check out scott o'hara’s article, “fixing lists”. the aria-labelledby attribute tells assistive technologies that w...
Adding phishing protection data providers
a data provider for phishing protection, it's necessary to set a series of preferences to provide details about the provider. each data provider has a unique id number. the data provider with the id number 0 is the default data provider shipped with firefox. when installing a new provider, you should use the next unused number. to find an id number to use, you can build a loop that requests the value of browser.safebrowsing.provider.0.name, then browser.safebrowsing.provider.1.name, and so forth until no value is returned. then you can use that value. you can find examples of how to read and write preferences in the article adding preferences to an extension. required preferences browser.safebrowsing.provider.idnum.name a human-readable name for the data provider. browser.safebrowsi...
...rrectly being reported as a phishing site. browser.safebrowsing.provider.idnum.reportphishurl an url to which the user is directed in order to report a phishing site that isn't detected by the phishing protection system. determining the currently-selected data provider if you need to determine the id number of the currently selected anti-phishing data provider, you can look at the current value of the preference browser.safebrowsing.dataprovider. ...
Command line options
y pressing shift + f2. syntax rules but first, let's describe the syntax rules that apply for all options. command parameters containing spaces must be enclosed in quotes, such as "joel user". command actions are case insensitive. command parameters, except profile names, are case insensitive. blank spaces ( ) separate commands and parameters. each message option follows the syntax field=value, for example: to=foo@nowhere.net subject=cool page attachment=www.mozilla.org attachment='file:///c:/test.txt' body=check this page or also in thunderbird 52 and newer: body=c:\path\to\file.txt separate multiple message options by comma (,), for example: "to=foo@nowhere.net,subject=cool page" . comma separators must not follow or precede spaces ( ). to assign multiple val...
...nowhere.net subject=cool page attachment=www.mozilla.org attachment='file:///c:/test.txt' body=check this page or also in thunderbird 52 and newer: body=c:\path\to\file.txt separate multiple message options by comma (,), for example: "to=foo@nowhere.net,subject=cool page" . comma separators must not follow or precede spaces ( ). to assign multiple values to a field, enclose the values in single quotes ('), for example: "to='foo@nowhere.net,foo@foo.de',subject=cool page" . using command line options command line options follow the command to start the application. if the option contains arguments, enter the argument after the option. some options have abbreviations, for example, "-editor" can be abbreviated as "-edit" (available abbreviations are described in the text below...
Creating Sandboxed HTTP Connections
face(components.interfaces.nsihttpchannel); cookies are actually part of the http header, nsihttpchannel provides four methods for working with headers: two for getting and setting request headers, and two for getting and setting response headers. the cookie header for requests is called "cookie", while for responses it is "set-cookie". ...
...ually part of the http header, nsihttpchannel provides four methods for working with headers: two for getting and setting request headers, and two for getting and setting response headers. the cookie header for requests is called "cookie", while for responses it is "set-cookie". getrequestheader(aheader) - returns the request header value for the requested header. setrequestheader(aheader, avalue, amerge) - sets the request header's value. if amerge is true, the new value is appened, otherwise the old value is overwritten. getresponseheader(aheader) - returns the response header value for the requested header. setresponseheader(aheader, avalue, amerge) - sets the response header's value. if amerge is true, the new value is appened, otherwise the old value is overwritten. these metho...
Debugging on Mac OS X
file for debugging purposes" below. select the "arguments" tab in the scheme editor, and click the '+' below the "arguments passed on launch" field. add "-p profilename", where profilename is the name of a profile you created previously. repeat that to also add the argument "-no-remote". also in the "arguments" panel, you may want to add an environment variable moz_debug_child_process set to the value 1 to help with debugging e10s. select "build" from the left of the scheme editor window, and check that there is nothing listed under targets (otherwise it may cause problems when you try to run the executable for debugging since you will get build errors). click "close" to close the scheme editor. at this point you can run the application from xcode, and when you pause or hit breakpoints it ...
...me/.lldbinit: # this automatically sources the mozilla project's .lldbinit as soon as lldb # starts or attaches to a mozilla app (that's in an object directory). # # this is mainly a workaround for xcode not providing a way to specify that # lldb should be run from a given directory. (xcode always runs lldb from "/", # regardless of what directory xcode was started from, and regardless of the # value of the "custom working directory" field in the scheme's run options. # therefore setting `settings set target.load-cwd-lldbinit true` can't help us # without xcode providing that functionality.) # # the following works by setting a one-shot breakpoint to break on a function # that we know will both run early (which we want when we start first start the # app) and run frequently (which we want so ...
Configuring Build Options
el compilation note: the build system automatically makes an intelligent guess for how many cpu cores to use when building. the option below is typically not needed. most modern systems have multiple cores or cpus, and they can be optionally used concurrently to make the build faster. the -j flag controls how many parallel builds will run concurrently. you will see (diminishing) returns up to a value approximately 1.5× to 2.0× the number of cores on your system. mk_add_options moz_make_flags="-j4" if your machine is overheating, you might want to try a lower value, e.g. -j1. choose an application the --enable-application=application flag is used to select an application to build. firefox is the default. choose one of the following options to add to your mozconfig file: browser (fir...
...d with extra debugging macros. there are many options recognized by the configure script which are special-purpose options intended for embedders or other special situations, and should not be used to build the full suite/xul applications. the full list of options can be obtained by running ./configure --help. warning: do not use a configure option unless you know what it does. the default values are usually the right ones. each additional option you add to your mozconfig file reduces the chance that your build will compile and run correctly. the following build options are very common: optimization ac_add_options --enable-optimize enables the default compiler optimization options note: this is enabled by default ac_add_options --enable-optimize=-o2 chooses particular ...
Makefile - variables
python_unit_tests list of python scripts to check exit status for make check xpc_shell_tests no_xpcshell_manifest_check inhibit validating manifest files when running xpcshell tests. compiler variable descripti...
...file_rule [pending] inhibit makefile.in deps that would allow $obj/makefile to be generated. no_submakefile_rule [pending/redundant?] inhibit makefile generation within subdirectories. no_ variable description no_profile_guided_optimize inhibit pgo builds no_dist_install note: values will be appended to the export variable when present. os_ variable description os_arch platform type os_target target binary type if building on an intermediate platform(building mobile binaries on gnu/linux). host_ variable description host_cmsrcs a list of .m sources...
How Mozilla's build system works
easons until this entire page is rewritten. makefile basics makefiles can be quite complicated, but mozilla provides a number of built-in rules that should enable most makefiles to be simpler. complete documentation for make is beyond the scope of this document but is available here. one concept you will need be familiar with is variables in make. variables are defined by the syntax variable = value, and the value of a variable is referenced by writing $(variable). all variables are strings. all makefile.in files in mozilla have the same basic format: depth = ../../../.. topsrcdir = @top_srcdir@ srcdir = @srcdir@ vpath = @srcdir@ include $(depth)/config/autoconf.mk # ... main body of makefile goes here ... include $(topsrcdir)/config/rules.mk # ...
... without worrying about whether the last line has an ending backslash or not. makefile examples standard makefile header installing headers using exports compiling interfaces using xpidlsrcs installing a javascript component building a component dll building a static library building a dynamic library makefiles - best practices and suggestions makefile - targets makefile - variables, values makefile - *.mk files & user config building libraries there are three main types of libraries that are built in mozilla: components are shared libraries (except in static builds), which are installed to dist/bin/components. components are not linked against by any other library. non-component shared libraries include libraries such as libxpcom and libmozjs. these libraries are installed...
Commenting IDL for better documentation
int. writers will expand upon your documentation if necessary. keep in mind that people for whom english is not their native language will be reading your comments (as well as the generated documentation), so try to avoid slang and abbreviations when possible. if possible, avoid putting comments in the middle of the definitions of apis. if an interface is used as a parameter or as the type of the value returned by a method, please use the full name of the interface in the description of the method. this will help the tools generate proper links to help make the documentation easier to read and browse through. special commands you can use special commands in your doxygen comments; the ones listed below are interpreted by our tools. using these will help generate much higher quality documentatio...
... /** * the cookie is really, really yummy. */ const integer cookie_extremely_yummy = 3; /** * omg this is the best cookie evar!1!!1. */ const integer cookie_omg_yummy = 4; /** * the cookie monster's name. */ readonly attribute astring name; /** * the cookie monster's favorite kind of cookie. must be one of the * cookie_flavor_* constants. */ attribute integer favoritecookie; /** * a value from 0-100 indicating how hungry the cookie monster is. * 0 means "stuffed to the brim with cookies" and 100 means "i'm so empty of * cookies! feed me now!" */ attribute integer hungerlevel; /** * feeds a cookie to the cookie monster. * @param cookietoeat the nsicookie to eat. */ void eatcookie(in nsicookie cookietoeat); /** * sings the song "c is for cookie." */ void sing(); /** * re...
mozbrowsercaretstatechanged
available (true) or not (false.) cancut: a boolean indicating whether the cut command is available (true) or not (false.) cancopy: a boolean indicating whether the copy command is available (true) or not (false.) canpaste: a boolean indicating whether the paste command is available (true) or not (false.) reason a domstring that defines the reason for the state being changed. possible values are visibilitychange, updateposition, longpressonemptycontent, taponcaret, presscaret, and releasecaret. zoomfactor a number defining the current zoom factor in the browser <iframe>. collapsed a boolean indicating whether the current selection is collapsed (true) or not (false.) caretvisible a boolean indicating whether the caret is currently visible (true) or not (false.) selectionvisibl...
...ible a boolean indicating whether the current selection is visible (true) or not (false.) selectioneditable a boolean indicating whether the current selection is editable (true) or not (false.) selectedtextcontext a domstring containing the currently-selected text content. senddocommandmsg a method allowing you to issue a command via an anonymouse function, i.e. function(command). possible values are cut, copy, paste and selectall. examples var browser = document.queryselector("iframe"); browser.addeventlistener("mozbrowsercaretstatechanged", function( event ) { // do stuff with event.details }); related events mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mo...
mozbrowserloadend
t normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. detail the detail property returns an anonymous javascript object with the following properties: backgroundcolor a domstring representing the main background color of the browser <iframe> content, expressed as an rgb value. can be used to make the theme of the surrounding ui complement the theme of the currently loaded content, for example. example in this example the mozbrowserloadstart and mozbrowserloadend events are used to change the icon shown on the stop/reload button between stop (x) and reload (r), as appropriate. in addition, the background of the controls ui bar is changed to the background color of t...
...ozbrowserloadend events are used to change the icon shown on the stop/reload button between stop (x) and reload (r), as appropriate. in addition, the background of the controls ui bar is changed to the background color of the site that has just loaded, to provide a more integrated experience. when the front page of https://developer.mozilla.org is loaded, for example, the e.detail.backgroundcolor value reported is rgb(0, 83, 159). var browser = document.queryselector("iframe"); browser.addeventlistener('mozbrowserloadend',function(e) { stopreload.textcontent = 'r'; console.log(e.detail.backgroundcolor); controls.style.background = e.detail.backgroundcolor; }); browser.addeventlistener('mozbrowserloadend',function() { stopreload.textcontent = 'r'; }); related events mozbrowserasyn...
mozbrowsermetachange
nt. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following properties: name a domstring representing the <meta> name attribute value. ...
...r the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following properties: name a domstring representing the <meta> name attribute value. this can be viewmode, theme-color, theme-group, or application-name. content a domstring representing the <meta> content attribute value, i.e. the content of the meta tag. type a domstring representing the type of meta change that this event object represents. this can be added, changed, removed, or undefined. lang optional a domstring representing the <meta> name attribute value, if included. if not included, the value returned is undefined. example var browser = document.queryselector("iframe"); browser.addeventlistener(...
mozbrowsersecuritychange
s read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following properties: state a domstring representing the current state of ssl security. possible values are: broken: indicates an unknown security state. this may mean that the request is being loaded as part of a page in which some content was received over an insecure channel. secure: indicates that the data corresponding to the request was received over a secure channel. insecure: indicates that the data corresponding to the request was received over an insecure channel. trackingst...
... is being loaded as part of a page in which some content was received over an insecure channel. secure: indicates that the data corresponding to the request was received over a secure channel. insecure: indicates that the data corresponding to the request was received over an insecure channel. trackingstate a domstring representing the current loading state of tracking content. possible values are: loaded_tracking_content: indicates that the tracking content has been loaded. blocked_tracking_content: indicates that the tracking content has been blocked from loading. mixedstate a domstring representing the current loading state of mixed active content. possible values are: loaded_mixed_active_content: indicates that the mixed active content has been loaded. blocked_mi...
mozbrowsershowmodalprompt
n whether the event is cancellable or not. details read only object a custom object. details the details property is an anonymous javascript object with the following properties: prompttype a domstring defining the type of the prompt. it can be alert, confirm, or prompt. title a domstring representing the title of the prompt. message a domstring representing the value passed to the window.alert(), window.confirm(), or window.prompt() methods within the browser <iframe>'s content. returnvalue a domstring representing the return value for the window.prompt() methods. this should be set by the embedder. unblock() a function to be called when the iframe is unblocked. note that if the embedder calls preventdefault() on this event, the iframe is blocked until un...
...urn value for the window.prompt() methods. this should be set by the embedder. unblock() a function to be called when the iframe is unblocked. note that if the embedder calls preventdefault() on this event, the iframe is blocked until unblock() is called. obsolete properties of details msg_name a string representing the type of message. for that event, it's always showmodalprompt. initialvalue a string representing the initial value for the window.prompt() methods. example var browser = document.queryselector("iframe"); browser.addeventlistener("mozbrowsershowmodalprompt", function( event ) { console.log("asking for prompt:" + json.stringify(event.detail)); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange...
overflow-clip-box-block
the overflow-clip-box-block css property specifies relative to which box the clipping happens when there is an overflow — in the block direction. /* keyword values */ overflow-clip-box-block: padding-box; overflow-clip-box-block: content-box; /* global values */ overflow-clip-box-block: inherited; overflow-clip-box-block: initial; overflow-clip-box-block: unset; note: on gecko, by default, padding-box is used everywhere, but <input type="text"> and similar use the value content-box. note that this property is activated by default only in the ua stylesheet and chrome contexts. value not found in db! syntax values padding-box this keyword makes the clipping be related to the padding box. content-box this keyword makes the clipping be related to the content box. formal s...
...t-box. note that this property is activated by default only in the ua stylesheet and chrome contexts. value not found in db! ...
overflow-clip-box-inline
the overflow-clip-box-inline css property specifies relative to which box the clipping happens when there is an overflow — in the inline direction. /* keyword values */ overflow-clip-box-inline: padding-box; overflow-clip-box-inline: content-box; /* global values */ overflow-clip-box-inline: inherited; overflow-clip-box-inline: initial; overflow-clip-box-inline: unset; note: on gecko, by default, padding-box is used everywhere, but <input type="text"> and similar use the value content-box. note that this property is activated by default only in the ua stylesheet and chrome contexts. value not found in db! syntax values padding-box this keyword makes the clipping be related to the padding box. content-box this keyword makes the clipping be related to the content box. f...
...t-box. note that this property is activated by default only in the ua stylesheet and chrome contexts. value not found in db! ...
MozScrolledAreaChanged
the mozscrolledareachanged event is fired when the document view has been scrolled or resized. note: while you can poll the values of document.scrollwidth and document.scrollheight to watch for changes to the document size, reading these properties can trigger document reflow, which can make them computationally expensive. this event, introduced in gecko 1.9.2, is fired whenever either or both of these values change. specification mozilla specific interface uievent bubbles yes cancelable yes target defaultview, document default action none properties property type description targetread only eventtarget the event target (the topmost target in the dom tree). typeread o...
... the height of the visible region of the document. ...
Gecko Keypress Event
ed without any modifier keys (ctrl/alt(option)/meta(win/command)), then the properties of the event are the same as they were in gecko1.8.1. that is, when the currently selected keyboard layout produces a unicode character (according to the current state of capslock and numlock), the charcode property contains that character. when the keypress event includes modifier keys, sometimes the charcode value is replaced with an ascii character according to the following rules. the accel key depends on the platform. ctrl is the accel key on windows and linux, while meta (i.e. command) is the accel key on mac. when the accel key is down, the charcode of a keypress event may be replaced with a character from a latin keyboard layout only when the original character is not an ascii character. this beha...
... character from a latin keyboard layout only when the original character is not an ascii character. this behavior helps the internationalization of web applications that have custom shortcut keys. if gecko doesn't replace the charcode with an ascii character, the web application developers would need to consider all non-latin keyboard layouts (arabic, greek, hebrew, russian, etc.). the charcode value depends on the state of capslock and numlock (except they are currently ignored if alt (option) is down on mac - see bug 432953). there are also some differences between the platforms, as described in the following sections. windows the charcode is replaced only when ctrl is down but alt is not down. if the os-provided character cannot be entered without using the ctrl key, then, gecko does no...
Extending a Protocol
{ return nullptr; } // message passing magic will happen here! return echopromise.forget(); } ok, let's ./mach build and make sure everything is compiling ok. once it's compiled, ./mach run and you should be able to spin up the developer console and type: navigator.echo("hi!"); that will return a pending promise that never settles. our goal is now to get that to settle with the value we sent in. ipdl basics while you are compiling, let's cover some ipdl basics. in ipdl there two kinds of "actors" - a "parent" and "child" - these actors are literally implemented as c++ classes, so they are more than just abstract ideas. usually, a child wants to send messages to the parent to do something off main thread for us. and we generally want the parent to let a child know when s...
...y state that pwindowglobal is our manager. parent: - these are the messages that the parent is able to recieve. note that the child doesn't need to receive any messages. this is because of "async" and "returns" forms a mozpromise. async echo(nscstring data) returns (nscstring aresult); - the "returns" here translates to a mozpromise, with a resolver that will settle a promise with the expected value. async __delete__(); - this is called when an instance is deleted. it lets you do cleanup if needed. ok, if we now try to compile this (./mach build), it will say: |manager| declaration in protocol `pecho' does not match any |manages| declaration in protocol `pwindowglobal' that's good! it means the syntax is correct, and now we need to pwindowglobal.ipdl to manage our pecho protocol. updat...
UpdateCheckListener
...
...when the update check completed successfully. void onupdatecheckcomplete( in updateinfo results[] ) parameters results an array of updateinfo objects representing the available add-on versions onupdatecheckerror() called when the update check fails. void onupdatecheckerror( in integer status ) parameters status a value representing the type of failure; see the range of possible values. ...
AsyncShutdown.jsm
l: "some service: some action in progress" - for instance "os.file: flushing all pending i/o". condition a condition blocking the completion of the phase. generally, this is a function returning a promise. this function is evaluated during the phase and the phase is guaranteed to not terminate until the resulting promise is either resolved or rejected. if condition is not a function but another value v, it behaves as if it were a function returning v. info optionally, a function returning information about the current state of the blocker as an object. used for providing more details when logging errors or crashing. removeblocker () remove the blocker for a condition. if several blockers have been registered for the same condition, remove all these blockers. if no blocker has been regist...
... blocker for a condition. if several blockers have been registered for the same condition, remove all these blockers. if no blocker has been registered for this condition, this is a noop. boolean removeblocker( in function|promise|* condition ) arguments condition a condition blocking the completion of the phase. this must be the same condition as was passed to addblocker prior. return value returns true if a blocker has been removed, or false otherwise. note that a result of false may mean either that the blocker has never been installed or that the phase has completed and the blocker has already been resolved. examples asyncshutdown.profilebeforechange.addblocker("module: just a promise", promise); // profilebeforechange will not complete until // promise is ...
DeferredTask.jsm
f whether it is currently running. isrunning boolean indicates whether the task is currently running. this is always true when read from code inside the task function, but can also be true when read from external code, in case the task is an asynchronous generator function. methods ispending obsolete since gecko 28 check the current task state. bool ispending(); return value returns true if pending, false otherwise. start obsolete since gecko 28 start (or postpone) task. void start(); flush obsolete since gecko 28 perform any postponed task immediately. void flush(); cancel obsolete since gecko 28 cancel any pending task. void cancel(); arm request the execution of the task after the delay specified on construction. multiple calls don't introduce ...
..., for example using a try/catch/finally clause in the task. the "finalize" method can be used in the common case of waiting for completion on shutdown. void arm(); disarm cancel any request for a delayed execution of the task, though the task itself cannot be canceled in case it is already running. this method stops any currently running timer, thus the delay will restart from its original value in case the "arm" method is called again. void disarm(); finalize ensure that any pending task is executed from start to finish, while preventing any attempt to arm the timer again. if the task is running and the timer is armed, then one last execution from start to finish will happen again, immediately after the current execution terminates; then the returned promise will be resolved. ...
FxAccountsOAuthClient.jsm
countsoauthclient object. fxaccountsoauthclient fxaccountsoauthclient( object options object parameters string client_id string state string oauth_uri string content_uri [optional] string scope [optional] string action [optional] string authorizationendpoint ); parameters client_id - oauth id returned from client registration. state - oauth state value that will be returned to the client as-is upon redirection. oauth_uri - the fxa oauth api server uri, versioned. example: "https://oauth.accounts.firefox.com/v1" content_uri - the fxa content server uri. example: "https://accounts.firefox.com" [optional] scope - a colon-separated list of scopes that the user has authorized. [optional] action - if provided, should be either "signup" or "signin...
...: "https://accounts.firefox.com" [optional] scope - a colon-separated list of scopes that the user has authorized. [optional] action - if provided, should be either "signup" or "signin". parameters set of parameters to initialize the firefox accounts oauth flow. authorizationendpoint optional optional authorization endpoint for the oauth server. default: /authorization return value a newly created fxaccountsoauthclient object implementing the methods described in this article. methods launchwebflow() opens a new tab at the firefox accounts oauth authorization url. registers a webchannel listener and sets up a callback if needed. parameters none teardown() call this function to manually release all channels and callbacks that are in use by this client. parameters ...
Interfacing with the Add-on Repository
starting a request to start a search of the repository, you can use either of the following methods: searchaddons() queries the add-on repository for add-ons matching given search criteria. retrieverecommendedadd...
..."; } if (recurl == "") { prefbranch.setcharpref("getaddons.recommended.url", "https://services.addons.mozilla.org/%locale%/%app%/api/%api_version%/list/recommended/all/%max_results%/%os%/%version%?src=firefox"); prefsservice.savepreffile(null); } this fetches the value of the extensions.getaddons.recommended.url preference, and, if the preference doesn't exist or has no value, sets the value of the preference to the correct one for the amo site. starting a request to start a search of the repository, you can use either of the following methods: searchaddons() queries the add-on repository for add-ons matching given search criteria. retrieverecommendedaddons() retrieves a list of recommended add-ons, as determined by the amo site administrators. this example ...
JavaScript OS.Constants
the local applications directory. os.constants.libc constants for interacting with libc. useful mostly for using js-ctypes to interact with the following platforms: macos x; android; linux; other variants of unix. os.constants.libc is available on all platforms, although some constants are not defined everywhere. before using a constant, you should check that it is defined. ...
...en files on the system enoent no such file or directory enomem cannot allocate memory enospc no space on device enotdir is not a directory enxio device no configured or does not support operation eopnotsupp (not always available under windows) operation not supported. eoverflow (not always available under windows) value too large to be stored in datatype. eperm operation not permitted erange result too large etimedout (not always available under windows) operation timed out. ewouldblock (not always available under windows) operation would block. exdev cross-device link opening files unix access rights defined on all platforms but meaningful ...
Using JavaScript code modules
lert(bar.size + 3); // displays "6" bar.size = 10; scope 2: components.utils.import("resource://app/my_module.jsm"); alert(foo()); // displays "foo" alert(bar.size + 3); // displays "13" this sharing behavior can be used to create singleton objects that can share data across windows and between xul script and xpcom components. note: each scope that imports a module receives a by-value copy of the exported symbols in that module. changes to the symbol's value will not propagate to other scopes (though an object's properties will be manipulated by reference). scope 1: components.utils.import("resource://app/my_module.jsm"); bar = "foo"; alert(bar); // displays "foo" scope 2: components.utils.import("resource://app/my_module.jsm"); alert(bar); // displays "...
...always put variables in a wrapper class and export the wrapper (such as bar in the above example). unloading code modules requires gecko 7.0(firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) components.utils.unload() allows you to unload a previously imported code module. ...
Writing localizable code
u about best practices and guidelines when dealing with ui code with respect to localization. it is aimed at mozilla and extension developers. for technical details please also look at xul_tutorial:localization. about localizers a few notes about localizers for developers who rarely deal with them: localizers like tools, and they don't like editors, localization tools are often based on key-value pairs, at least some localizers have their talents focused on language skills and are not savvy in programming, or even building applications. guidelines thus, there are a few guidelines you should follow to make localization of your code easier: choose good key names the names chosen for your keys (regardless of whether that's a dtd or a properties file) should be descriptive. think of t...
...endif or #expand is strongly discouraged. there are few exceptions to this rule, but in general, the localized file should comply with standards and should not require build tools to be transformed. if you want to add build processing to localized files, be sure to request feedback from l10n@. in most cases, you can just as well put the processing into the content code and reference different key-value pairs in l10n. use a good source directory structure be sure to put the localizable files in the right place. the addition of new top-level directories is a compromise between module ownership in the cvsroot repository and the ease of localization. use a good chrome directory structure for a particular module mod, a target path jar:ab-cd.jar!/locale/ab-cd/mod/foo.dtd has been widely teste...
gettext
ion of a string with plurals takes three arguments: the singular form of the english string, the plural form of the english string, and the number basing on which the function will return the correct (singular or plural) form of the string. consider the following code snippet: <?php $num = 1; printf(ngettext("%d user likes this.", "%d users like this.", $num), $num); ?> depending on the value of the $num variable, this code will either use the singular ("user likes) or the plural ("users like") form of the string. notice that you need to pass the $num variable twice. first in the ngettext() call, where it will be used to determine which form of the string will be returned. in the above example, $num equals 1, so the string returned (for english) will be %d user likes this. the second ...
... form of the string will be returned. in the above example, $num equals 1, so the string returned (for english) will be %d user likes this. the second time the $num variable is passed in the printf() call, which at this point of interpretation looks something like printf("%d user likes this.", $num);. the %d in the first argument (which is the string returned by gettext) will be replaced with the value of $num. for english, the above code will produce the following output: 1 user likes this. the string definition in the messages.po file will look like this: #: file.php:3 #, php-format msgid "%d user likes this." msgid_plural "%d users like this." msgstr[0] "" msgstr[1] "" depending on the localizer's target language and its rules for creating plural forms, there might be another field for tran...
Mozilla Framework Based on Templates (MFBT)
at must customize the types underlying the fixed-size integer types.) types.h includes standardinteger.h and further provides size_t. checkedint.h implements checked integers. they behave like integers, but safely check for integer overflow and divide-by-zero. useful for input validation. floatingpoint.h provides various operations for examining and working upon double-precision floating point values, and for producing various special floating point values. core types.h further provides macros to define imported and exported c symbols. attributes.h implements various function and class attribute macros. the function macros control inlining, note whether a function returns, and enforce various c++-related restrictions on inheritance and use. the class macros permit controlling the inherita...
...s, so that any attempt to create an unnamed temporary for it will assert. (an unnamed temporary lives for a shorter period of time than the scope where it's found, so it usually isn't what was desired.) data structures linkedlist.h implements a type-safe doubly-linked list class. most new code should use this rather than prclist. rangedptr.h implements rangedptr, a smart pointer template whose value may be manipulated only within a range specified at construction time, and which may be dereferenced only at valid locations in that range. this pointer is a useful way to expose access to values within an array. refptr.h implements various smart pointer templates to simplify reference counting of values of particular classes. scoped.h implements scope-based resource management, to simplify th...
Extras
mfrac> </mrow> </math> </p> css content math.cue *[title] { color: blue; } mixing with other markups html content <math display="block"> <mrow> <mi>a</mi> <mo>=</mo> <mo>[</mo> <mtable> <mtr> <mtd><mn>1</mn></mtd> <mtd> <mtext> <img width="16" height="16" src="https://udn.realityripple.com/samples/3f/9341cbddc0.png" alt="mozilla-16" /> </mtext> </mtd> </mtr> <mtr> <mtd> <mtext><input value="type" size="4"/></mtext> </mtd> <mtd><mn>4</mn></mtd> </mtr> </mtable> <mo>]</mo> </mrow> </math> <math display="block"> <msqrt> <mpadded width="30px" height="15px" depth="15px" voffset="-15px"> <mtext> <svg width="30px" height="30px"> <defs> <radialgradient id="radgrad1" cx="50%" cy="50%" r="50%" fx="50%" fy="50%"> <stop offset="0%" style="stop-c...
...o>)</mo> </mrow> </math> </foreignobject> <text>rotation matrix</text> </switch> </g></g></g> <g> <animatemotion path="m 32,69 c 64,121 100,27 152,42 203,56 239,257 275,161 295,109 144,221 88,214 -2,202 11,35 32,69 z" begin="0s" dur="20s" repeatcount="indefinite"/> <animatetransform attributename="transform" attributetype="xml" type="scale" values="1;2;.5;1" keytimes="0;.25;.75;1" dur="20s" repeatcount="indefinite"/> <circle fill="url(#grad3)" r="30"/> <g transform="translate(-30,-30)"> <switch> <foreignobject width="60" height="60" requiredextensions="http://www.w3.org/1998/math/mathml"> <math display="block"> <mrow> <munderover> <mo>∑</mo> <mrow> <mi>n</mi> <mo>=</mo> <mn>0</mn> </mrow> <mrow> <mo>+</mo> <mi>∞</mi> </mro...
Memory reporting
age. this is most obviously used in about:memory and telemetry. this document describes things that you should know when writing a memory reporter. memory reporters a memory reporter makes one or more memory measurements (a.k.a. reports). each reporter implements a collectreports function which takes a nsimemoryreportercallback argument; for each measurement the reporter must pass in several values, including: a path (which identifies the report); an amount (the most important thing); a unit (most commonly bytes, but sometimes a unitless count or percentage); a description of what is measured. see the nsimemoryreporter documentation and nsimemoryreporter.idl for full details. making measurements nsimemoryreporter provides the high-level interface for a memory reporter, but the he...
...t: struct foobarsizes { size_t mfoo; size_t mbar; foobarsizes() { mozilla::podzero(this); } } void foobar::addsizeofexcludingthis(nsmallocsizeoffun amallocsizeof, foobarsizes* asizes) const { asizes->mfoo += ...; asizes->mbar += ...; } note the add prefix that makes this incrementing behaviour clear. obviously, if you increment you have to zero the values at some point. when using a struct, its constructor is the obvious place for this. you could even put the nsmallocsizeoffun in foobarsizes to reduce the number of arguments. sometimes it's difficult and/or not worth measuring every member of an object of in a foo::sizeofexcludingthis method. this is ok, but it's worth adding a comment explaining this to the method. occasionally you do w...
Profiling with the Firefox Profiler
ses settings that can be configured with the environment variables moz_profiler_startup_entries, moz_profiler_startup_interval and moz_profiler_startup_filters: if it looks like the buffer is not large enough, you can tweak the buffer size with the env var moz_profiler_startup_entries. this defaults to 1000000, which is 9mb. if you want 90mb use 10000000, and 20000000 for 180mb, which are good values to debug long startups. if you'd like a coarser resolution, you can also choose a different interval using moz_profiler_startup_interval, which defaults to 1 (unit is millisecond). you can't go below 1 ms but you can use e.g. 10 ms. if the default threads to be profiled are insufficient, you can choose which threads to profile using moz_profiler_startup_filters, which is a comma separated list...
...elow 1 ms but you can use e.g. 10 ms. if the default threads to be profiled are insufficient, you can choose which threads to profile using moz_profiler_startup_filters, which is a comma separated list. description of all available environment variables may be printed by starting firefox with moz_profiler_help=1 set. if you want to profile firefox for android, you have to set this environment values by --es option of am command to launch firefox. this example is for firefox nightly (package name is org.mozilla.fennec_aurora), and you have to allow storage access on permission settings before launching it. adb shell am start -n org.mozilla.fennec_aurora/.app \ --es env0 moz_profiler_startup=1 \ --es env1 moz_profiler_shutdown=/sdcard/download/profiler.json then, if you select quit men...
powermetrics
the com.apple.terminal coalition.) google chrome. safari. the grouping of parent and child processes (in coalitions) is obvious. the meaning of the columns is as follows. name: coalition/process name. process names within coalitions are indented. id: coalition/process id number. cpu ms/s: cpu time used by the coalition/process, per second, during the sample period. the sum of the process values typically exceeds the coalition value slightly, for unknown reasons. user%: percentage of that cpu time spent in user space (as opposed to kernel mode.) deadlines (<2 ms, 2-5 ms): these two columns count how many "short" timers woke up threads in the process, per second, during the sample period. high frequency timers, which typically have short time-to-deadlines, can cause high power consumpt...
...se measurements. there is some overlap between the two "deadlines" columns and the two "wakeups" columns. for example, firing a single sub-2ms deadline can also cause a package idle exit wakeup. many of these measurements are also obtainable by passing the task_power_info flag and a task_power_info struct to the task_info function. by default, the coalitions/processes are sorted by a composite value computed from several factors, though this can be changed via command-line options. other measurements powermetrics can also report measurements of backlight usage, network activity, disk activity, interrupt distribution, device power states, c-state residency, p-state residency, quality of service classes, and thermal pressure. these are less likely to be useful for profiling firefox, however...
browser.urlbar.trimURLs
if the address starts with http:// and neither starts with a ftp. ...
...if the address starts with http:// and neither starts with a ftp. ...
ui.alertNotificationOrigin
ui.alertnotificationorigin controls the position and direction from which popup notifications invoked by nsialertsservice are sliding in. ...
...position and direction from which popup notifications invoked by nsialertsservice are sliding in. ...
ui.textSelectBackground
ui.textselectbackground saves the color in which the background of a text selection in the user interface or in content will be styled. ...
... ui.textselectbackground saves the color in which the background of a text selection in the user interface or in content will be styled. ...
ui.textSelectForeground
ui.textselectforeground saves the color in which the text of a text selection in the user interface or the content will be styled. ...
... ui.textselectforeground saves the color in which the text of a text selection in the user interface or the content will be styled. ...
Patches and pushes
for references on how each tag functions, visit the opensearch wiki page and the mozsearch wiki page. the pages are old (i mean, f...
...for references on how each tag functions, visit the opensearch wiki page and the mozsearch wiki page. the pages are old (i mean, firefox 2???), but still accurate. each plu...
L20n HTML Bindings
, sup), attributes (e.g. title) and entities can be used in translations. in addition to the pre-defined whitelists, any element found in the original source html is allowed in the translation as well. consider the following source html: <p data-l10n-id="save"> <input type="submit"> <a href="/main" class="btn-cancel"></a> </p> assume the following malicious translation: <save """ <input value="save" type="text"> or <a href="http://myevilwebsite.com" onclick="alert('pwnd!')" title="back to the homepage">cancel</a>. """> the result will be: <p data-l10n-id="back"> <input value="save" type="submit"> or <a href="/main" class="btn-cancel" title="back to the homepage">cancel</a>. </p> the input element is not on the default whitelist but since it's present in the so...
...similarly, href and onclick attributes are not allowed in translations and they are not inserted in the final dom. however, the title attribute is safe. ...
Midas
nt.execcommand executes the given command. document.querycommandenabled determines whether the given command can be executed on the document in its current state. document.querycommandindeterm determines whether the current selection is in an indetermined state. document.querycommandstate determines whether the given command has been executed on the current selection. document.querycommandvalue determines the current value of the document, range, or current selection for the given command. supported commands command value description backcolor a color code. this command will set the background color of the document. bold if there is no selection, the insertion point will set bold for subsequently typed characters. if there is a selec...
...hen this command will have no effect. note: the shortcut key will automatically trigger this command (typically accel-z) unlink if the insertion point is within a link or if the current selection contains a link, the link will be removed and the text will remain. readonly this command has been replaced with contentreadonly. it takes the same values as contentreadonly, but the meaning of true and false are inversed. usecss this command has been replaced with stylewithcss. it takes the same values as stylewithcss, but the meaning of true and false are inversed. ...
Date and Time
absolute time representation treats time instants as points along the time line. a time instant is represented by its position on the time line relative to the origin, called the epoch. nspr defines the epoch to be midnight (00:00:00) 1 january 1970 utc (coordinated universal time). ...
... a few times. therefore, a callback function is used to determine time zone information. ...
Logging
this chapter describes the global functions you use to perform logging. nspr provides a set of logging functions that conditionally write printf() style strings to the console or to a log file. nspr uses this facility itself for its own development debugging purposes. you can select events to be logged by module or level. a module is a user-defined class of log events. a level is a numeric value that indicates the seriousness of the event to be logged. you can combine module and level criteria to get highly selective logging. nspr also provides "assert"-style macros and functions to aid in application debugging. conditional compilation and execution log types and variables logging functions and macros use example conditional compilation and execution nspr's logging facility is condi...
...bles logging functions and macros use example conditional compilation and execution nspr's logging facility is conditionally compiled in and enabled for applications using it. these controls are platform dependent. logging is not compiled in for the win16 platform. logging is compiled into the nspr debug builds; logging is not compiled into the nspr optimized builds. the compile time #define values debug or force_pr_log enable nspr logging for application programs. to enable nspr logging and/or the debugging aids in your application, compile using the nspr debug build headers and runtime. set one of the compile-time defines when you build your application. execution-time control of nspr's logging uses two environment variables. these variables control which modules and levels are logged ...
PL_HashTableAdd
add a new entry with the specified key and value to the hash table. syntax #include <plhash.h> plhashentry *pl_hashtableadd( plhashtable *ht, const void *key, void *value); parameters the function has the following parameters: ht a pointer to the the hash table to which to add the entry. key a pointer to the key for the entry to be added. value a pointer to the value for the entry to be added. returns a pointer to the new entry. description add a new entry with the specified key and value to the hash table. if an entry with the same key already exists in the table, the freeentry function is invoked with the ht_free_value flag. you can write your freeentry function to free the value of the specified entry if the old value should be freed. the default freeentry function...
...rns a pointer to the new entry. description add a new entry with the specified key and value to the hash table. if an entry with the same key already exists in the table, the freeentry function is invoked with the ht_free_value flag. you can write your freeentry function to free the value of the specified entry if the old value should be freed. the default freeentry function does not free the value of the entry. pl_hashtableadd returns null if there is not enough memory to create a new entry. it doubles the number of buckets if the table is overloaded. ...
PRIntervalTime
al.h> typedef pruint32 printervaltime; #define pr_interval_min 1000ul #define pr_interval_max 100000ul #define pr_interval_no_wait 0ul #define pr_interval_no_timeout 0xfffffffful description the units of printervaltime are platform-dependent. they are chosen to be appropriate for the host os, yet provide sufficient resolution and period to be useful to clients. the increasing interval value represented by printervaltime wraps. it should therefore never be used for intervals greater than approximately 6 hours. interval times are accurate regardless of host processing requirements and are very cheap to acquire. the constants pr_interval_min and pr_interval_max define a range in ticks per second. these constants bound both the period and the resolution of a printervaltime object. the...
...me object. the reserved constants pr_interval_no_wait and pr_interval_no_timeout have special meaning for nspr. they indicate that the process should wait no time (return immediately) or wait forever (never time out), respectively. important note the counters used for interval times are allowed to overflow. since the sampling of the counter used to define an arbitrary epoch may have any 32-bit value, some care must be taken in the use of interval times. the proper coding style to test the expiration of an interval is as follows: if ((printervaltime)(now - epoch) > interval) <... interval has expired ...> as long as the interval and the elapsed time (now - epoch) do not exceed half the namespace allowed by a printervaltime (231-1), the expression shown above provides the expected result ...
PRLinger
cket option to specify the time interval (in printervaltime units) to linger on closing a socket if any data remain in the socket send buffer. syntax #include <prio.h> typedef struct prlinger { prbool polarity; printervaltime linger; } prlinger; fields the structure has the following fields: polarity polarity of the option's setting: pr_false means the option is off, in which case the value of linger is ignored. pr_true means the option is on, and the value of linger will be used to determine how long pr_close waits before returning. linger time (in printervaltime units) to linger before closing if any data remain in the socket send buffer. description by default, pr_close returns immediately, but if there are any data remaining in the socket send buffer, the system attempts to d...
...inger will be used to determine how long pr_close waits before returning. linger time (in printervaltime units) to linger before closing if any data remain in the socket send buffer. description by default, pr_close returns immediately, but if there are any data remaining in the socket send buffer, the system attempts to deliver the data to the peer. the pr_sockopt_linger socket option, with a value represented by a structure of type prlinger, makes it possible to change this default as follows: if polarity is set to pr_false, pr_close returns immediately, but if there are any data remaining in the socket send buffer, the runtime attempts to deliver the data to the peer. if polarity is set to pr_true and linger is set to 0 (pr_interval_no_wait), the runtime aborts the connection when it i...
PRSocketOptionData
mcast_ttl ip multicast time-to-live. tos ip type-of-service and precedence. non_blocking nonblocking (network) i/o. reuse_addr allow local address reuse. keep_alive periodically test whether connection is still alive. mcast_loopback ip multicast loopback. no_delay disable nagle algor...
...n't delay send to coalesce packets. max_segment tcp maximum segment size. recv_buffer_size receive buffer size. send_buffer_size send buffer size. linger time to linger on close if data are present in socket send buffer. add_member join an ip multicast group. drop_member leave an ip multicast group. mcast_if ip multicast interface address. description prsocketoptiondata is a name-value pair for a socket option. the option field (of enumeration type prsockoption) specifies the name of the socket option, and the value field (a union of all possible values) specifies the value of the option. ...
PR_CWait
address the address of the protected object--the same address previously passed to pr_centermonitor. timeout the amount of time (in printervaltime units) that the thread is willing to wait for an explicit notification before being rescheduled. if you specify pr_interval_no_timeout, the function returns if and only if the object is notified. ...
...while the thread is waiting, it exits the monitor (just as if it had called pr_cexitmonitor as many times as it had called pr_centermonitor). ...
PR_CreateThread
parameters: type specifies that the thread is either a user thread (pr_user_thread) or a system thread (pr_system_thread). start a pointer to the thread's root function, which is called as the root of the new thread. returning from this function is the only way to terminate a thread. arg a pointer to the root function's only parameter. nspr does not assess the type or the validity of the value passed in this parameter. priority the initial priority of the newly created thread. scope specifies your preference for making the thread local (pr_local_thread), global (pr_global_thread) or global bound (pr_global_bound_thread). however, nspr may override this preference if necessary. state specifies whether the thread is joinable (pr_joinable_thread) or unjoinable (pr_unjoinable_thread)...
...if necessary. state specifies whether the thread is joinable (pr_joinable_thread) or unjoinable (pr_unjoinable_thread). stacksize specifies your preference for the size of the stack, in bytes, associated with the newly created thread. if you pass zero in this parameter, pr_createthread chooses the most favorable machine-specific stack size. returns the function returns one of the following values: if successful, a pointer to the new thread. this pointer remains valid until the thread returns from its root function. if unsuccessful, (for example, if system resources are unavailable), null. description if you want the thread to start up waiting for the creator to do something, enter a lock before creating the thread and then have the thread's root function enter and exit the same lo...
PR EnumerateAddrInfo
#include <prnetdb.h> void *pr_enumerateaddrinfo( void *enumptr, const praddrinfo *addrinfo, pruint16 port, prnetaddr *result); parameters the function has the following parameters: enumptr the index pointer of the enumeration. to begin an enumeration, this argument is set to null. to continue an enumeration (thereby getting successive addresses from the praddrinfo structure), the value should be set to the function's last returned value. the enumeration is complete when a value of null is returned. addrinfo a pointer to a praddrinfo structure returned by pr_getaddrinfobyname. port the port number to be assigned as part of the prnetaddr structure. this parameter is not checked for validity. result on input, a pointer to a prnetaddr structure. on output, this structure is f...
...ull is returned. addrinfo a pointer to a praddrinfo structure returned by pr_getaddrinfobyname. port the port number to be assigned as part of the prnetaddr structure. this parameter is not checked for validity. result on input, a pointer to a prnetaddr structure. on output, this structure is filled in by the runtime if the result of the call is not null. returns the function returns the value you should specify in the enumptr parameter for the next call of the enumerator. if the function returns null, the enumeration is ended. description pr_enumerateaddrinfo is a stateless enumerator. the principle input, the praddrinfo structure, is not modified. ...
PR_EnumerateHostEnt
tax #include <prnetdb.h> printn pr_enumeratehostent( printn enumindex, const prhostent *hostent, pruint16 port, prnetaddr *address); parameters the function has the following parameters: enumindex the index of the enumeration. to begin an enumeration, this argument is set to zero. to continue an enumeration (thereby getting successive addresses from the host entry structure), the value should be set to the function's last returned value. the enumeration is complete when a value of zero is returned. hostent a pointer to a prhostent structure obtained from pr_gethostbyname or pr_gethostbyaddr. port the port number to be assigned as part of the prnetaddr structure. this parameter is not checked for validity. address on input, a pointer to a prnetaddr structure. on output, th...
...a prhostent structure obtained from pr_gethostbyname or pr_gethostbyaddr. port the port number to be assigned as part of the prnetaddr structure. this parameter is not checked for validity. address on input, a pointer to a prnetaddr structure. on output, this structure is filled in by the runtime if the result of the call is greater than 0. returns the function returns one of the following values: if successful, the function returns the value you should specify in the enumindex parameter for the next call of the enumerator. if the function returns 0, the enumeration is ended. if unsuccessful, the function returns -1. you can retrieve the reason for the failure by calling pr_geterror. description pr_enumeratehostent is a stateless enumerator. the principle input, the prhostent stru...
PR_NewThreadPrivateIndex
eadprivateindex has the following parameters: newindex on output, an index that is valid for all threads in the process. you use this index with pr_setthreadprivate and pr_getthreadprivate. destructor specifies a destructor function prthreadprivatedtor for the private data associated with the index. this function can be specified as null. returns the function returns one of the following values: if successful, pr_success. if the total number of indices exceeds 128, pr_failure. description if pr_newthreadprivateindex is successful, every thread in the same process is capable of associating private data with the new index. until the data for an index is actually set, the value of the private data at that index is null. you pass this index to pr_setthreadprivate and pr_getthreadpri...
...ve data associated with the index. when you allocate the index, you may also register a destructor function of type prthreadprivatedtor. if a destructor function is registered with a new index, it will be called at one of two times, as long as the private data is not null: when replacement private data is set with pr_setthreadprivate when a thread exits the index maintains independent data values for each binding thread. a thread can get access only to its own thread-specific data. there is no way to deallocate a private data index once it is allocated. ...
PR_OpenSemaphore
creates or opens a named semaphore with the specified name. syntax #include <pripcsem.h> #define pr_sem_create 0x1 /* create if not exist */ #define pr_sem_excl 0x2 /* fail if already exists */ nspr_api(prsem *) pr_opensemaphore( const char *name, printn flags, printn mode, pruintn value ); parameters the function has the following parameters: name the name to be given the semaphore. flags how to create or open the semaphore. mode unix style file mode to be used when creating the semaphore. value the initial value assigned to the semaphore. returns a pointer to a prsem structure or null/code> on error. description if the named semaphore doesn't exist and the pr_sem_create flag is specified, the named semaphore is created. the created semaphore needs to be remove...
...ion if the named semaphore doesn't exist and the pr_sem_create flag is specified, the named semaphore is created. the created semaphore needs to be removed from the system with a pr_deletesemaphore call. if pr_sem_create is specified, the third argument is the access permission bits of the new semaphore (same interpretation as the mode argument to pr_open) and the fourth argument is the initial value of the new semaphore. if pr_sem_create is not specified, the third and fourth arguments are ignored. ...
PR_Poll
pds a pointer to the first element of an array of prpolldesc structures. npds the number of elements in the pds array. if this parameter is zero, pr_poll is equivalent to pr_sleep with a timeout. timeout amount of time the call will block waiting for i/o to become ready. if this time expires without any i/o becoming ready, pr_poll returns zero. returns the function returns one of these values: if successful, the function returns a positive number indicating the number of prpolldesc structures in pds that have events. the value 0 indicates the function timed out. the value -1 indicates the function failed. the reason for the failure can be obtained by calling pr_geterror. description this function returns as soon as i/o is ready on one or more of the underlying socket objects.
... the i/o events (readable, writable, exception, or some combination) that the caller is interested in. on successful return, the out_flags field of the prpolldesc data structure is set to indicate what kind of i/o is ready on the respective descriptor. pr_poll uses the out_flags fields as scratch variables during the call. if pr_poll returns 0 or -1, the out_flags fields do not contain meaningful values and must not be used. the prpolldesc structure is defined as follows: struct prpolldesc { prfiledesc* fd; print16 in_flags; print16 out_flags; }; typedef struct prpolldesc prpolldesc; the structure has the following fields: fd a pointer to a prfiledesc object representing a socket or a pollable event. this field can be set to null to indicate to pr_poll that this prfiledesc object...
PR_PushIOLayer
tity id, prfiledesc *layer); parameters the function has the following parameters: stack a pointer to a prfiledesc object representing the stack. id a prdescidentity object for the layer on the stack above which the new layer is to be added. layer a pointer to a prfiledesc object representing the new layer to be added to the stack. returns the function returns one of the following values: if the layer is successfully pushed onto the stack, pr_success. if the layer is not successfully pushed onto the stack, pr_failure. use pr_geterror to get additional information regarding the reason for the failure. description a file descriptor for a layer (possibly allocated using pr_createiolayerstub) may be pushed onto an existing stack of file descriptors at any time. the new layer ...
...to get additional information regarding the reason for the failure. description a file descriptor for a layer (possibly allocated using pr_createiolayerstub) may be pushed onto an existing stack of file descriptors at any time. the new layer is inserted into the stack just above the layer with the identity specified by id. even if the id parameter indicates the topmost layer of the stack, the value of the file descriptor describing the original stack will not change. in other words, stack continues to point to the top of the stack after the function returns. caution keeping the pointer to the stack even as layers are pushed onto the top of the stack is accomplished by swapping the contents of the file descriptor being pushed and the stack's current top layer file descriptor. the intent i...
PR_Seek
moves the current read-write file pointer by an offset expressed as a 32-bit integer. deprecated in favor of pr_seek64. syntax #include <prio.h> print32 pr_seek( prfiledesc *fd, print32 offset, prseekwhence whence); parameters the function has the following parameters: fd a pointer to a prfiledesc object. offset a value, in bytes, used with the whence parameter to set the file pointer. a negative value causes seeking in the reverse direction. whence a value of type prseekwhence that specifies how to interpret the offset parameter in setting the file pointer associated with the fd parameter. the value for the whence parameter can be one of the following: pr_seek_set. sets the file pointer to the value of the offset parameter. pr_seek_cur. sets the file pointer to it...
...s seeking in the reverse direction. whence a value of type prseekwhence that specifies how to interpret the offset parameter in setting the file pointer associated with the fd parameter. the value for the whence parameter can be one of the following: pr_seek_set. sets the file pointer to the value of the offset parameter. pr_seek_cur. sets the file pointer to its current location plus the value of the offset parameter. pr_seek_end. sets the file pointer to the size of the file plus the value of the offset parameter. returns the function returns one of the following values: if the function completes successfully, it returns the resulting file pointer location, measured in bytes from the beginning of the file. if the function fails, the file pointer remains unchanged and the ...
PR_Wait
the function has the following parameter: mon a reference to an existing structure of type prmonitor. the monitor object referenced must be one for which the calling thread currently holds the lock. ticks the amount of time (in printervaltime units) that the thread is willing to wait for an explicit notification before being rescheduled. returns the function returns one of the following values: pr_success means the thread is being resumed from the pr_wait call either because it was explicitly notified or because the time specified by the parameter ticks has expired. pr_failure means pr_wait encountered a system error (such as an invalid monitor reference) or the thread was interrupted by another thread. description a call to pr_wait causes the thread to release the monitor's lo...
...ata only when the expression is true. the boolean expression must be evaluated while in the monitor and within a loop. in pseudo-code, the sequence is as follows: pr_entermonitor(&ml); while (!expression) wait; ... act on the state change ... pr_exitmonitor(&ml); a thread can be resumed from a wait for a variety of reasons. the most obvious is that it was notified by another thread. if the value of timeout is not pr_interval_no_timeout, pr_wait resumes execution after the specified interval has expired. if a timeout value is used, the boolean expression must include elapsed time as part of the monitored data. resuming from the wait is merely an opportunity to evaluate the expression, not an assertion that the expression is true. ...
PR_WaitCondVar
waits on a condition. syntax #include <prcvar.h> prstatus pr_waitcondvar( prcondvar *cvar, printervaltime timeout); parameters pr_waitcondvar has the following parameters: cvar the condition variable on which to wait. timeout the value pr_interval_no_timeout requires that a condition be notified (or the thread interrupted) before it will resume from the wait. the value pr_interval_no_wait causes the thread to release the lock, possibly causing a rescheduling within the runtime, then immediately attempt to reacquire the lock and resume. returns the function returns one of the following values: if successful, pr_success. if unsuccessful (for example, if the caller has not locked the lock associated with the condition variable or the thread was interrupted with pr_interrupt...
...nd the thread is blocked in a "waiting on condition" state until another thread notifies the condition or a caller-specified amount of time expires. when the condition variable is notified, a thread waiting on that condition moves from the "waiting on condition" state to the "ready" state. when scheduled, the thread attempts to reacquire the lock that it held when pr_waitcondvar was called. any value other than pr_interval_no_timeout or pr_interval_no_wait for the timeout parameter will cause the thread to be rescheduled due to either explicit notification or the expiration of the specified interval. the latter must be determined by treating time as one part of the monitored data being protected by the lock and tested explicitly for an expired interval. to detect the expiration of the specifi...
PR_strtod
string to the nearest double-precision floating point number. syntax #include <prdtoa.h> prfloat64 pr_strtod(const char *s00, char **se); parameters the function has these parameters: s00 the input string to be scanned. se a pointer that, if not null, will be assigned the address of the last character scanned in the input string. ...
...if the answer would overflow, a properly signed huge_val (infinity) is returned. if the answer would underflow, a properly signed 0 is returned. in both cases, pr_geterror() returns the error code pr_range_error. ...
Building NSS
s/build.sh this builds both nspr and nss. build with make alternatively, there is a make target called "nss_build_all", which produces a similar result. this supports some alternative options, but can be a lot slower. make -c nss nss_build_all use_64=1 the make-based build system for nss uses a variety of variables to control the build. below are some of the variables, along with possible values they may be set to. build_opt 0 build a debug (non-optimized) version of nss. this is the default. 1 build an optimized (non-debug) version of nss. use_64 0 build for a 32-bit environment/abi. this is the default. 1 build for a 64-bit environment/abi. this is recommended. use_asan 0 do not create an addresssanitizer build. this is the default. 1 c...
... addresssanitizer build. this is the default. 1 create an addresssanitizer build. unit testing nss contains extensive unit tests. scripts to run these are found in the tests directory. run the standard suite by: host=localhost domsuf=localdomain use_64=1 nss/tests/all.sh unit test configuration nss tests are configured using environment variables. the scripts will attempt to infer values for host and domsuf, but can fail. replace localhost and localdomain with the hostname and domain suffix for your host. you need to be able to connect to $host.$domsuf. if you don't have a domain suffix you can add an entry to /etc/hosts (on windows, c:\windows\system32\drivers\etc\hosts) as follows: 127.0.0.1 localhost.localdomain validate this opening a command shell and typing: ping localh...
Certificate functions
3.2.1 and later cert_createsubjectcertlist mxr 3.4 and later cert_createvalidity mxr 3.5 and later cert_crlcacherefreshissuer mxr 3.7 and later cert_decodealtnameextension mxr 3.10 and later cert_decodeauthinfoaccessextension mxr 3.10 and later cert_decodeauthkeyid mxr 3.10 and later cert_decodeavavalue mxr 3.4 and later cert_decodebasicconstraintvalue mxr 3.2 and later cert_decodecertfrompackage mxr 3.4 and later cert_decodecertificatepoliciesextension mxr 3.2 and later cert_decodecertpackage mxr 3.2 and later cert_decodecrldistributionpoints mxr 3.10 and later cert_decodedercrl mxr 3.2 and later ...
... mxr 3.5 and later cert_dupcertificate mxr 3.2 and later cert_dupcertlist mxr 3.2 and later cert_enableocspchecking mxr 3.2 and later cert_encodealtnameextension mxr 3.7 and later cert_encodeandaddbitstrextension mxr 3.5 and later cert_encodeauthkeyid mxr 3.5 and later cert_encodebasicconstraintvalue mxr 3.5 and later cert_encodecertpoliciesextension mxr 3.12 and later cert_encodecrldistributionpoints mxr 3.5 and later cert_encodegeneralname mxr 3.4 and later cert_encodeinfoaccessextension mxr 3.12 and later cert_encodeinhibitanyextension mxr 3.12 and later cert_encodenoticereference mxr 3.12 and l...
4.3 Release Notes
ory path passed to configdir parameter for crypomanager.initialize method or using the nss environment variable nss_default_db_type. ...
...sha384, and hmacsha512 (see hmactest.java) support for all nss 3.12 initialization options (see initializationvalues) new ssl error codes (see http://mxr.mozilla.org/security/sour...util/sslerrs.h) ssl_error_unsupported_extension_alert ssl_error_certificate_unobtainable_alert ssl_error_unrecognized_name_alert ssl_error_bad_cert_status_response_alert ssl_error_bad_cert_hash_value_alert new tls cipher suites (see http://mxr.mozilla.org/security/sour...sslsocket.java): tls_rsa_with_camellia_128_cbc_sha tls_dhe_dss_with_camellia_128_cbc_sha tls_dhe_rsa_with_camellia_128_cbc_sha tls_rsa_with_camellia_256_cbc_sha tls_dhe_dss_with_camellia_256_cbc_sha tls_dhe_rsa_with_camellia_256_cbc_sha note: the following tls cipher suites are declared b...
NSS 3.12.5 release_notes
al variable, the fix provided by these patches will have no effect and the application may become vulnerable to the issue. this default setting can also be changed within the application by using the following existing api functions: secstatus ssl_optionset(prfiledesc *fd, print32 option, prbool on) secstatus ssl_optionsetdefault(print32 option, prbool on) there is now a new value for "option", which is: ssl_enable_renegotiation the corresponding new values for ssl_enable_renegotiation are: ssl_renegotiate_never: never renegotiate at all (default). ssl_renegotiate_unrestricted: renegotiate without restriction, whether or not the peer's client hello bears the renegotiation info extension (as we always did in the past). unsafe. tls compression ...
... parameters have been slightly changed ("des" became "desc"). deprecated headers the header file key.h is deprecated. please use keyhi.h instead. additional documentation in pk11pub.h: the caller of pk11_derencodepublickey should free the returned secitem with a secitem_freeitem(..., pr_true) call. pk11_readrawattribute allocates the buffer for returning the attribute value. the caller of pk11_readrawattribute should free the data buffer pointed to by item using a secitem_freeitem(item, pr_false) or port_free(item->data) call. in secasn1.h: if both pool and dest are null, the caller should free the returned secitem with a secitem_freeitem(..., pr_true) call. if pool is null but dest is not null, the caller should free the data buffer pointed to by dest w...
NSS_3.12_release_notes.html
ote: sec_oid_ansix962_ecdsa_signature_with_sha1_digest is also kept for compatibility reasons. ...
...mf_encode_popoprivkey bug 395080: double backslash in sysdir filenames causes problems on os/2 bug 341371: certutil lacks a way to request a certificate with an existing key bug 382292: add support for camellia to cmd/symkeyutil bug 385642: add additional cert usage(s) for certutil's -v -u option bug 175741: strict aliasing bugs in mozilla/dbm bug 210584: cert_asciitoname doesn't accept all valid values bug 298540: vfychain usage option should be improved and documented bug 323570: make dbck debug mode work with softoken bug 371470: vfychain needs option to verify for specific date bug 387621: certutil's random noise generator isn't very efficient bug 390185: signtool error message wrongly uses the term database bug 391651: need config.mk file for windows vista bug 396322: fix secutil's code an...
NSS 3.15.1 release notes
ha-1. note the following limitations. the hash function used in the signature for tls 1.2 client authentication must be the hash function of the tls 1.2 prf, which is always sha-256 in nss 3.15.1. aes gcm cipher suites are not yet supported. new functions none. new types in sslprot.h ssl_library_version_tls_1_2 - the protocol version of tls 1.2 on the wire, value 0x0303. tls_dhe_rsa_with_aes_256_cbc_sha256, tls_rsa_with_aes_256_cbc_sha256, tls_ecdhe_ecdsa_with_aes_128_cbc_sha256, tls_ecdhe_rsa_with_aes_128_cbc_sha256, tls_dhe_rsa_with_aes_128_cbc_sha256, tls_rsa_with_aes_128_cbc_sha256, tls_rsa_with_null_sha256 - new tls 1.2 only hmac-sha256 cipher suites. in sslerr.h ssl_error_unsupported_hash_algorithm, ssl_error_digest_failur...
..._ecdhe_rsa_with_aes_128_cbc_sha256, tls_dhe_rsa_with_aes_128_cbc_sha256, tls_rsa_with_aes_128_cbc_sha256, tls_rsa_with_null_sha256 - new tls 1.2 only hmac-sha256 cipher suites. in sslerr.h ssl_error_unsupported_hash_algorithm, ssl_error_digest_failure, ssl_error_incorrect_signature_algorithm - new error codes for tls 1.2. in sslt.h ssl_hmac_sha256 - a new value in the sslmacalgorithm enum type. ssl_signature_algorithms_xtn - a new value in the sslextensiontype enum type. new pkcs #11 mechanisms none. notable changes in nss 3.15.1 bug 856060 - enforce name constraints on the common name in libpkix when no subjectaltname is present. bug 875156 - add const to the function arguments of sec_certnicknameconflict. bug 877798 - fix ssltap...
NSS 3.16.1 release notes
k11pub.h pk11_exportderprivatekeyinfo and pk11_exportprivkeyinfo - exports a private key in a der-encoded asn.1 privatekeyinfo type or a seckeyprivatekeyinfo structure. only rsa private keys are supported now. in secmod.h secmod_internaltopubmechflags - converts from nss-internal to public representation of mechanism flags. ...
...tprivkeyinfo - exports a private key in a der-encoded asn.1 privatekeyinfo type or a seckeyprivatekeyinfo structure. only rsa private keys are supported now. in secmod.h secmod_internaltopubmechflags - converts from nss-internal to public representation of mechanism flags. new types in sslt.h ssl_padding_xtn - the value of this enum constant changed from the experimental value 35655 to the iana-assigned value 21. . new macros in secmod.h public_mech_ecc_flag - a public mechanism flag for elliptic curve cryptography (ecc) operations. in utilmodt.h secmod_ecc_flag - an nss-internal mechanism flag for elliptic curve cryptography (ecc) operations. this macro has the same numeric value as public_mech_ecc_flag. notable changes in nss 3.16.1 ...
NSS 3.16.2.3 release notes
ns are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_16_2_3_rtm/src/ new in nss 3.16.2.3 this patch release fixes a bug and contains a backport of the tls_fallback_scsv feature, which was originally made available in nss 3.17.1. ...
... notable changes in nss 3.16.2.3 bug 1057161: check that an imported elliptic curve public key is valid. previously nss would only validate the peer's public key before performing ecdh key agreement. now ec public keys are validated at import time. ...
NSS 3.17.1 release notes
a bug that caused nss to accept forged rsa signatures. a new symbol, _sgn_verifypkcs1digestinfo is exported in this release. as with all exported nss symbols that have a leading underscore '_', this is an internal symbol for nss use only. applications that use or depend on these symbols can and will break in future nss releases. ...
... notable changes in nss 3.17.1 signature algorithms now use sha-256 instead of sha-1 by default. added support for linux on little-endian powerpc64. ...
NSS 3.52 release notes
other releases are available in nss releases. notable changes in nss 3.52 bug 1603628 - update nss to support pkcs #11 v3.0. note: this change modifies the ck_gcm_params struct to include the ulivbits field which, prior to pkcs #11 v3.0, was ambiguously defined and not included in the nss definition. if an application is recompiled with nss 3.52+, this field must be initialized to a value corresponding to ulivlen. alternatively, defining nss_pkcs11_2_0_compat will yield the old definition. see the bug for more information. bug 1623374 - support new pkcs #11 v3.0 message interface for aes-gcm and chachapoly. bug 1612493 - integrate avx2 chacha20, poly1305, and chacha20poly1305 from hacl*. bugs fixed in nss 3.52 bug 1633498 - fix unused variable 'getauxval' error on ios ...
...sionticket. bug 1618739 - don't assert fuzzer behavior in ssl_parsesessionticket. bug 1617968 - update delegated credentials implementation to draft-07. bug 1617533 - update hacl* dependencies for libintvector.h bug 1613238 - add vector accelerated sha2 for power 8+. bug 1612493 - integrate avx2 chacha20, poly1305, and chacha20poly1305 from hacl*. bug 1612281 - maintain pkcs11 c_getattributevalue semantics on attributes that lack nss database columns. bug 1612260 - add wycheproof rsa test vectors. bug 1608250 - broken fipstest handling of ki_len. bug 1608245 - consistently handle null slot/session. bug 1603801 - avoid dcache pollution from sdb_measureaccess(). bug 1603628 - update nss to support pkcs #11 v3.0. bug 1561637 - tls 1.3 does not work in fips mode. bug 1531906 - fix over...
NSS API Guidelines
only to this object file. size is the expected number of pointers of type classname. secport_decl_global_ptr_class(classname, size) - same as above except classname can be used in other object files. secport_add_pointer(classname, pointer) - add pointer as a valid pointer for classclassname. this is usually called by a create function. secport_verify_pointer(classname, pointer, secerror, returnvalue)- check if a given pointer really belongs to the requested class. if it doesn't set the error secerror and return the value returnvalue. secport_remove_pointer(classname, pointer) - remove a pointer from the valid list. usually called by a destroy function. finally, error logging should be added an documented when debug is turned on. interfaces for these are in nspr. thread safety code dev...
... make sure adding, removing, accessing, and destroying these objects are all safe operations. there are a number of strategies, and entire books about how to safely access data on lists. some simple strategies and their issues: use hash tables: hash table lookups are usually quite fast, limiting the contention on the lock. this is best for large lists of objects. be sure to calculate the hash value first, then only lock over the hash table value itself. be sure to increment the reference count, on the returned object, before unlocking. examples of hash tables can be found in security/nss/lib/certdb/pcertdb.c lock over the entire search: for small linked listed, queues, or arrays, you can lock over the entire search. this strategy is best when lists are short, or even better if lists are re...
NSS Config Options
future key words (not yet implemented): enable: turn on ciphersuites by default. disable: turn off ciphersuites by default without disallowing them by policy. flags: turn on the following flags: ssl-lock: turn off the ability for applications to change policy with the ssl_setcipherpolicy ...
... future key words (not yet implemented): enable: turn on ciphersuites by default. disable: turn off ciphersuites by default without disallowing them by policy. flags: turn on the following flags: ssl-lock: turn off the ability for applications to change policy with the ssl_setcipherpolicy (or ssl_setpolicy). policy-lock: tu...
FC_DigestKey
name fc_digestkey - add the digest of a key to a multi-part digest operation. syntax ck_rv fc_digestkey( ck_session_handle hsession, ck_object_handle hkey ); parameters hsession [in] session handle. hkey [in] handle of the key to be digested. ...
...n, ck_object_handle hkey ); parameters hsession [in] session handle. hkey [in] handle of the key to be digested. description fc_digestkey continues a multi-part digest operation by digesting the value of a secret key. the digest for the entire message is returned by a call to fc_digestfinal. ...
FC_Initialize
rs pinitargs points to a ck_c_initialize_args structure. description fc_initialize initializes the nss cryptographic module for the fips mode of operation. in addition to creating the internal data structures, it performs the fips software integrity test and power-up self-tests. the pinitargs argument must point to a ck_c_initialize_args structure whose members should have the following values: createmutex should be null. destroymutex should be null. lockmutex should be null. unlockmutex should be null. flags should be ckf_os_locking_ok. libraryparameters should point to a string that contains the library parameters. preserved should be null. the library parameters string has this format: "configdir='dir' certprefix='prefix1' keyprefix='prefix2' secmod='file' flags= " here a...
...ic crypto services' dbtokendescription='software security device' cryptoslotdescription='psm internal cryptographic services' dbslotdescription='psm private keys' fipsslotdescription='psm internal fips-140-1 cryptographic services' fipstokendescription='psm fips-140-1 user private key services' minps=0" see pkcs #11 module specs for complete documentation of the library parameters string. return value fc_initialize returns the following return codes. ckr_ok: library initialization succeeded. ckr_arguments_bad pinitargs is null. pinitargs->libraryparameters is null. only some of the lock functions were provided by the application. ckr_cant_lock: the ckf_os_locking_ok flag is not set in pinitargs->flags. the nss cryptographic module always uses os locking and doesn't know ho...
NSS tools : ssltab
description the ssl debugging tool ssltap is an ssl-aware command-line proxy. it watches tcp connections and displays the data going by. if a connection is ssl, the data display includes interpreted ssl records and handshaking options -v print a version string for the tool. -h turn on hex/ascii printing. instead of outputting raw data, the command interprets each record as a numbered line of hex values, followed by the same data as ascii characters. the two parts are separated by a vertical bar. nonprinting characters are replaced by dots. -f turn on fancy printing. output is printed in colored html. data sent from the client to the server is in blue; the server's reply is in red. when used with looping mode, the different connections are separated with horizontal lines. you can use this optio...
...th = 160 (0xa0) < encrypted > } ] <-- [ sslrecord { 0: 17 03 00 00 df |....ß type = 23 (application_data) version = { 3,0 } length = 223 (0xdf) < encrypted > } sslrecord { 0: 15 03 00 00 12 |..... type = 21 (alert) version = { 3,0 } length = 18 (0x12) < encrypted > } ] server socket closed. example 2 the -s option turns on ssl parsing. because the -x option is not used in this example, undecoded values are output as raw data. the output is routed to a text file. $ ssltap -s -p 444 interzone.mcom.com:443 > s.txt output connected to interzone.mcom.com:443 --> [ alloclen = 63 bytes [ssl2] clienthellov2 { version = {0x03, 0x00} cipher-specs-length = 36 (0x24) sid-length = 0 (0x00) challenge-length = 16 (0x10) cipher-suites = { (0x010080) ssl2/rsa/rc4-128/md5 (0x020080) ssl2/rsa/rc4-40/md5 (0x03008...
NSS tools : ssltap
description the ssl debugging tool ssltap is an ssl-aware command-line proxy. it watches tcp connections and displays the data going by. if a connection is ssl, the data display includes interpreted ssl records and handshaking options -v print a version string for the tool. -h turn on hex/ascii printing. instead of outputting raw data, the command interprets each record as a numbered line of hex values, followed by the same data as ascii characters. the two parts are separated by a vertical bar. nonprinting characters are replaced by dots. -f turn on fancy printing. output is printed in colored html. data sent from the client to the server is in blue; the server's reply is in red. when used with looping mode, the different connections are separated with horizontal lines. you can use this optio...
...th = 160 (0xa0) < encrypted > } ] <-- [ sslrecord { 0: 17 03 00 00 df |....ß type = 23 (application_data) version = { 3,0 } length = 223 (0xdf) < encrypted > } sslrecord { 0: 15 03 00 00 12 |..... type = 21 (alert) version = { 3,0 } length = 18 (0x12) < encrypted > } ] server socket closed. example 2 the -s option turns on ssl parsing. because the -x option is not used in this example, undecoded values are output as raw data. the output is routed to a text file. $ ssltap -s -p 444 interzone.mcom.com:443 > s.txt output connected to interzone.mcom.com:443 --> [ alloclen = 63 bytes [ssl2] clienthellov2 { version = {0x03, 0x00} cipher-specs-length = 36 (0x24) sid-length = 0 (0x00) challenge-length = 16 (0x10) cipher-suites = { (0x010080) ssl2/rsa/rc4-128/md5 (0x020080) ssl2/rsa/rc4-40/md5 (0x03008...
NSS tools : ssltap
Mozilla › Projects › NSS › tools › ssltap
sl-aware command-line proxy. it watches tcp connections and displays the data going by. if a connection is ssl, the data display includes interpreted ssl records and handshaking options -v print a version string for the tool. -h turn on hex/ascii printing. instead of outputting raw data, the command interprets each record as a numbered line of hex values, followed by the same data as ascii characters. the two parts are separated by a vertical bar. nonprinting characters are replaced by dots. -f turn on fancy printing. output is printed in colored html. data sent from the client to the server is in blue; the server's reply is in red. when used with looping mode, the different ...
...rsion = { 3,0 } length = 223 (0xdf) < encrypted > } sslrecord { 0: 15 03 00 00 12 |..... type = 21 (alert) version = { 3,0 } length = 18 (0x12) < encrypted > } ] server socket closed. example 2 the -s option turns on ssl parsing. because the -x option is not used in this example, undecoded values are output as raw data. the output is routed to a text file. $ ssltap -s -p 444 interzone.mcom.com:443 > s.txt output connected to interzone.mcom.com:443 --> [ alloclen = 63 bytes [ssl2] clienthellov2 { version = {0x03, 0x00} cipher-specs-length = 36 (0x24) sid-length = 0 (0x00) challenge-length = 16 (0x10) ciphe...
Rhino Debugger
to return from a function or script. moving up and down the stack the lower-left (dockable) pane in the debugger main window contains a combo-box labeled "context:" which displays the current stack of the executing script. you may move up and down the stack by selecting an entry in the combo-box. when you select a stack frame the variables and watch windows are updated to reflect the names and values of the variables visible at that scope. setting and clearing breakpoints the main desktop of the debugger contains file windows which display the contents of each script you are debugging. you may set a breakpoint in a script by doing one of the following: place the cursor on the line at which you want to set a breakpoint and right-click with the mouse. this action will display a pop-up me...
...d to show its sub-properties. the locals table is updated each time control returns to the debugger or when you change the stack location in the context: window watch window you may enter arbitrary javascript expressions in the watch: table located in the lower-right (dockable) pane in the debugger main window. the expressions you enter are re-evaluated in the current scope and their current values displayed each time control returns to the debugger or when you change the stack location in the context: window. evaluation window the evaluate pane located in the lower-right (dockable) pane in the debugger main window contains an editable command line where you may enter arbitrary javascript code. the code is evaluated in the context of the current stack frame. the window maintains a hist...
Rhino overview
he property file org/mozilla/javascript/resources/messages.properties. if other properties files with extensions corresponding to the current locale exist, they will be used instead. javascript language versions some behavior in the javascript engine is dependent on the language version. in browser embeddings, this language version is selected using the language attribute of the script tag with values such as "javascript1.2". version 1.3 and greater are ecma conformant. operators == and != version 1.2 only uses strict equality for the == and != operators. in version 1.3 and greater, == and != have the same meanings as ecma. the operators === and !== use strict equality in all versions. toboolean boolean(new boolean(false)) is false for all versions before 1.3. it is true (and thus ecma c...
... the javascript code they execute may ignore the security features. embeddings that run untrusted javascript code must do two things to enable the security features. first, every context that is created must be supplied an instance of an object that implements the securitysupport interface. this will provide rhino the support functionality it needs to perform security-related tasks. second, the value of the property security.requiresecuritydomain should be changed to true in the resource bundle org.mozilla.javascript.resources.security. the value of this property can be determined at runtime by calling the issecuritydomainrequired method of context. setting this property to true requires that any calls that compile or evaluate javascript must supply a security domain object of any object type...
Rhino requirements and limitations
requirements recent versions of rhino have only been tested with jdk 1.4 and greater. older versions support jdks as early as 1.1. to use the javaadapter feature or an optimization level of 0 or greater, rhino must be running under a security manager that allows the definition of class loaders. ...
...at allows the definition of class loaders. limitations liveconnect if a javaobject's field's name collides with that of a method, the value of that field is retrieved lazily, and can be counter-intuitively affected by later assignments: javaobj.fieldandmethod = 5; var field = javaobj.fieldandmethod; javaobj.fieldandmethod = 7; // now, field == 7 you can work around this by forcing the field value to be converted to a javascript type when you take its value: javaobj.fieldandmethod = 5; var field = javaobj.fieldandmethod + 0; // force conversion now javaobj.fieldandmethod = 7; // now, field == 5 jsobject rhino does not support the netscape.javascript.jsobject class. ...
Rhino scopes and contexts
setprototypemethod to set the prototype to the shared object, and the parent of the new scope to null: scriptable newscope = cx.newobject(sharedscope); newscope.setprototype(sharedscope); newscope.setparentscope(null); the call to newobject simply creates a new javascript object with no properties. it uses thesharedscope passed in to initialize the prototype with the standard object.prototype value. we can now use newscope as a scope for calls to evaluate scripts. let's call this scope the instance scope. any top-level functions or variables defined in the script will end up as properties of the instance scope. uses of standard objects like function, string, or regexp will find the definitions in the shared scope. multiple instance scopes can be defined and have their own variables for scr...
...nctions. then after a custom initialization is done, one can seal the shared scope by callingscriptableobject.sealobject(): sealedsharedscope.sealobject(); note that currently one needs to explicitly seal any additional properties he adds to the sealed shared scope since although after calling sealedsharedscope.sealobject(); it would no be possible to set the additional properties to different values, one still would be able to alter the objects themselves. note that currently in order to use java classes (liveconnect) from a sealed shared scope you need to pre-load a number of objects needed for liveconnect into the scope before it gets sealed. these objects would normally be lazy loaded but the lazy loading fails if the scope is sealed. scriptableobject sealedsharedscope = cx.initstanda...
Creating JavaScript jstest reftests
js/src/tests/shell.js for every test. additionally, it loads every shell.js and broswer.js file in the subdirectories on the path from js/src/tests to the location of your test. if you have functionality several tests share in a given folder, you can add the functionality to the shell.js or broswer.js file in the directory. asserteq asserteq(v1, v2[, message]) checks that v1 and v2 are the same value. if they're not, throw an exception (which will cause the test to fail). reportcompare reportcompare(expected, actual, description) is somewhat like asserteq(actual, expected, description) except that the first two arguments are swapped, failures are reported via stdout rather than by throwing exceptions, and the matching is fuzzy in an unspecified way. for example, reportcompare sometimes cons...
...r example, reportcompare sometimes considers numbers to be the same if they are "close enough" to each other, even if the == operator would return false. expected = 3; actual = 1 + 2; reportcompare(expected, actual, '3==1+2'); comparesource comparesource(expected, actual, description) is used to test if the decompilation of a javascript object (conversion to source code) matches an expected value. note that tests which use comparesource should be located in the decompilation sub-suite of a suite. for example, to test the decompilation of a simple function you could write: var f = (function () { return 1; }); expect = 'function () { return 1; }'; actual = f + ''; comparesource(expect, actual, 'decompile simple function'); handling shell or browser specific features jstests run both in...
Creating JavaScript tests
js/src/jit-test/tests/basic or one of the other appropriate subdirectories of jit-test/tests. jit-tests run only in the shell. jit-tests do not load extra test functionality automatically. writing a new test file have a look at the existing files and follow what they do. all tests, in both suite, can use the asserteq function. asserteq(v1, v2[, message]) check that v1 and v2 are the same value. if they're not, throw an exception (which will cause the test to fail). if you are writing a jstests, additional testing functionality is provided for you in shell.js files. you can read about them here. performance testing and general advice do not attempt to test the performance of engine features in the test suite. please keep in mind that the javascript test suite is run on a wide varie...
...rms, from phones all the way up to servers. even tests that check for polynomial time complexity will start to fail in a few years when they have sped up enough to run faster than the granularity of the os scheduler or when run on platforms with higher latencies than your development workstation. these tests will also show up as infrequent oranges on our heavily loaded test machines, lowering the value of our test suite for everyone. just don't do it, it's never worth it. do not add performance tests to the test suite. it is not generally even possible to tell if the speed of any particular feature is going to be important in the real world without running a real-world benchmark. it is very hard to write a good real-world benchmark. for this reason, the best place to find out if a change is p...
GCIntegration - SpiderMonkey Redirect 1
o they don't need a write barrier. many other xpconnect pointers are also traced in this way. see xpcjsruntime::traceblackjs and xpcjsruntime::tracegrayjs. if a pointer doesn't fit one of these categories, then it probably requires a write barrier. before the pointer is modified (except initializing writes, which don't need a barrier), you should call incrementalreferencebarrier() or incrementalvaluebarrier(), passing it the value the pointer held before the write. there are several examples of this usage in xpconnect. the js::objectptr class is intended to serve as a drop-in replacement for jsobject *. it has an assignment operator that automatically invokes a write barrier. so far, though, there hasn't been much use for this class—there aren't many places outside of spidermonkey where a ...
...d set entries. there are three simplifications, similar to the ones for incremental write barriers, that will allow us to avoid write barriers in some cases. only strings and objects without finalizers will be stored in the nursery, at least initially. consequently, if the thing being stored is known to have a finalizer, then there is no need for a write barrier. note that what matters is the value being written—if the object being written to has a finalizer, a write barrier may still be required. if a pointer is not traced, as by js_call_tracer, then there is no need for a write barrier. if a pointer is a root, then that pointer will be scanned during every nursery collection, so there is no need for a write barrier. as above, this means that classes governed by ns_decl_cycle_collectio...
Bytecodes
hen emits stack-based bytecodes from that ast as a part of the jsscript data structure. bytecodes can reference atoms and objects (typically by array index) which are also contained in the jsscript data structure. within the engine, all bytecode execute within a stack frame -- even global (top-level) and eval code has a stack frame associated with it. a frame on the stack has space for javascript values (the tagged value format) in a few different categories. the space for a single javascript value is called a "slot", so the categories are: argument slots: holds the actual arguments passed to the current frame. local slots: holds the local variables used by the current code. expression slots: holds the temporary space that you need to calculate expressions on a stack. for example, in (a + b...
...e current frame. local slots: holds the local variables used by the current code. expression slots: holds the temporary space that you need to calculate expressions on a stack. for example, in (a + b) + c you would push a, then push b, then add, then push c, then add, which requires a maximum depth of two expression slots. there are also some slots reserved for dedicated functionality, holding values like this and the callee / return value. there is always a "top of stack" (tos) that corresponds to the latest value pushed onto the expression stack. all bytecodes implicitly operate in terms of this location. bytecode listing all opcodes are annotated with a [-popcount, +pushcount] to represent the overall stack-effects their execution. bytecode listing was moved to spidermonkey internals: byt...
Functions
ts child can read locals and variables from the next enclosing function, and so on. the compiler detects these cases and makes such functions null closures too. flat closures. suppose a function reads some variables from enclosing functions but is not algol-like. if the function does not assign to any closed-on vars/args, and it only reads closed-on local variables and arguments that never change value after the function is created, then the function can be implemented as a flat closure. when a flat closure is created, all the closed-on values are copied from the stack into reserved slots of the function object. to evaluate a name, instead of walking the scope chain, we just take the value from the reserved slot. the function object's parent is the global object. flat closures and null closures...
...ns. there are also combo instructions jsop_{inc,dec}gvar and jsop_gvar{inc,dec}. name instructions. in the worst case we emit jsop_{,set,call}name. these are totally general. they can still be optimized via the property cache; in the worst case we walk the scope chain. in some cases, the jit can optimize a jsop_name instruction that refers to a variable in an enclosing scope to pull the value directly out of the call object's dslots. for the expression delete name we always emit jsop_delname. it's not worth optimizing. ...
JIT Optimization Outcomes
different order than others). inconsistentfixedslot the property being accessed is not stored at a known location in the object. this can occur if the operation is polymorphic on different object types and one or more of the object types contain the property at a different slot than the others. notobject optimization failed because the stored in the property could potentially be a non-object value. since only objects can be uniquely typed, the optimization strategy fails in this case. notstruct the object holding the property is not a typed struct object. notunboxed the object whose property is being accessed is not formatted as an unboxed object. unboxedconvertedtonative the object whose property is being accessed was previously unboxed but was deoptimized and converted to a native ...
... call. the interpreted callee function is being debugged by the debugger api. cantinlineunknownprops unable to inline function call. the engine knows nothing definite about the type of the callee function object. cantinlineunreachable unable to inline function call. the call site has not been observed to have ever been executed. it lacks observed type information for its arguments, its return value, or both. cantinlinebound unable to inline function call. the interpreted callee is a bound function generated from function.prototype.bind that failed some sub-checks. (expand) cantinlinenativenospecialization unable to inline function call. ion does not have built-in specialization for the native (implemented in c++) callee function. cantinlinenativebadform unable to inline function call.
BOOLEAN_TO_JSVAL
obsolete since jsapi 42this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. cast a c integer to a boolean js::value without any type checking or error handling. please use js::booleanvalue/js::truevalue/js::falsevalue instead in spidermonkey 45 or later. syntax jsval boolean_to_jsval(bool b); name type description b bool c integer value to be converted to a boolean jsval. ...
...y 45 or later. syntax jsval boolean_to_jsval(bool b); name type description b bool c integer value to be converted to a boolean jsval. description boolean_to_jsval converts a bool argument, b, to a boolean jsval. if b is false, the result is jsval_false. ...
INT_FITS_IN_JSVAL
obsolete since javascript 1.8.5this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. determines if a specified c integer is safe to pass to int_to_jsval. syntax #define int_fits_in_jsval(i) /* ... */ name type description i jsint the c integer value to check. description determines if a specified c integer value, i, lies within the range allowed for integer jsvals. if so, int_fits_in_jsval returns true, and i can be cast to jsval by calling int_to_jsval(i). otherwise, int_fits_in_jsval returns false. in this case, the application can still convert i to a jsval using js_newnumbervalue. warning: the type of the argument i must be jsint, but the c/...
...e range allowed for integer jsvals. if so, int_fits_in_jsval returns true, and i can be cast to jsval by calling int_to_jsval(i). otherwise, int_fits_in_jsval returns false. in this case, the application can still convert i to a jsval using js_newnumbervalue. warning: the type of the argument i must be jsint, but the c/c++ compiler does not enforce type safety here. if i is an unsigned or 64-bit value, int_fits_in_jsval can silently give the wrong answer. starting in spidermonkey 1.8.5, jsval can store a full 32-bit integer, so this check isn't needed any longer for 32-bit integers. example the following code snippet illustrates how a c variable, item, is conditionally tested in an if statement to see if it is a legal jsval integer value. if (int_fits_in_jsval(item)) { /* ... */ } else...
JS::MutableHandle
tparams. syntax bool somefunction(jscontext *cx, js::mutablehandle<t> outparam) { ... } methods here, ptr represents the private member of js::mutablehandle<t>, typed with t *. method description const t &get() const returns *ptr. operator const t&() const t operator->() const t *address() returns ptr. void set(t v) sets the value of *ptr to v. description js::mutablehandle<t> is a non-const reference to js::rooted&lt;t&gt;. it is used in the same way as js::handle&lt;t&gt; and includes a |set(const t &v)| method to allow updating the value of the referenced js::rooted&lt;t&gt;. a js::mutablehandle<t> can be created from a js::rooted&lt;t&gt; by using |js::rooted<t>::operator&()|. if you want to add additional met...
...ailable for the main types: namespace js { typedef mutablehandle<jsfunction*> mutablehandlefunction; typedef mutablehandle<jsid> mutablehandleid; typedef mutablehandle<jsobject*> mutablehandleobject; typedef mutablehandle<jsscript*> mutablehandlescript; typedef mutablehandle<jsstring*> mutablehandlestring; typedef mutablehandle<js::symbol*> mutablehandlesymbol; typedef mutablehandle<value> mutablehandlevalue; } see also mxr id search for js::mutablehandle mxr id search for js::mutablehandlefunction mxr id search for js::mutablehandleid mxr id search for js::mutablehandleobject mxr id search for js::mutablehandlescript mxr id search for js::mutablehandlestring mxr id search for js::mutablehandlesymbol mxr id search for js::mutablehandlevalue js::rooted js::handl...
JS::ToInt32
this article covers features introduced in spidermonkey 17 convert any javascript value to a signed 32bit integer. syntax bool js::toint32(jscontext *cx, js::handlevalue v, int32_t *out); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handlevalue the value to convert. out int32_t * out parameter. on success, *out receives the converted floating-point value. description js::toint32 converts a javascript value to a signed 32bit integer. it implements the toint32 operator described in ecma 262-3 §9.5. on success, js::toint32 stores the converted value in *out and returns true. o...
...e to convert. out int32_t * out parameter. on success, *out receives the converted floating-point value. description js::toint32 converts a javascript value to a signed 32bit integer. it implements the toint32 operator described in ecma 262-3 §9.5. on success, js::toint32 stores the converted value in *out and returns true. on error or exception, it returns false, and the value left in *out is undefined. see also mxr id search for js::toint32 bug 739541 ...
JS::ToInt64
this article covers features introduced in spidermonkey 17 convert any javascript value to a signed 64bit integer. syntax bool js::toint64(jscontext *cx, js::handlevalue v, int64_t *out); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handlevalue the value to convert. out int64_t * out parameter. on success, *out receives the converted floating-point value. description js::toint64 converts a javascript value to a signed 64bit integer. ...
...onversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handlevalue the value to convert. out int64_t * out parameter. on success, *out receives the converted floating-point value. description js::toint64 converts a javascript value to a signed 64bit integer. on success, js::toint64 stores the converted value in *out and returns true. on error or exception, it returns false, and the value left in *out is undefined. see also mxr id search for js::toint64 bug 742188 ...
JS::ToNumber
this article covers features introduced in spidermonkey 17 convert any javascript value to a double. syntax bool js::tonumber(jscontext *cx, js::handlevalue v, double *out); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handlevalue the value to convert. out double * out parameter. on success, *out receives the converted floating-point value. description js::tonumber converts a javascript value to a number. it implements the tonumber operator described in ecma 262-3 §9.3. on success, js::tonumber stores the converted value in *out and returns true. on error or exception, it r...
... the value to convert. out double * out parameter. on success, *out receives the converted floating-point value. description js::tonumber converts a javascript value to a number. it implements the tonumber operator described in ecma 262-3 §9.3. on success, js::tonumber stores the converted value in *out and returns true. on error or exception, it returns false, and the value left in *out is undefined. see also mxr id search for js::tonumber bug 739541 ...
JS::ToUint16
this article covers features introduced in spidermonkey 17 convert any javascript value to an unsigned 16bit integer. syntax bool js::touint16(jscontext *cx, js::handlevalue v, uint16_t *out); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handlevalue the value to convert. out uint16_t * out parameter. on success, *out receives the converted floating-point value. description js::toint16 converts a javascript value to an unsigned 16bit integer. ...
... be in a request on this jscontext. v js::handlevalue the value to convert. out uint16_t * out parameter. on success, *out receives the converted floating-point value. description js::toint16 converts a javascript value to an unsigned 16bit integer. it implements the toint16 operator described in ecma 262-3 §9.7. on success, js::toint16 stores the converted value in *out and returns true. on error or exception, it returns false, and the value left in *out is undefined. see also mxr id search for js::touint16 bug 779601 ...
JS::ToUint32
this article covers features introduced in spidermonkey 17 convert any javascript value to an unsigned 32bit integer. syntax bool js::touint32(jscontext *cx, js::handlevalue v, int32_t *out); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handlevalue the value to convert. out int32_t * out parameter. on success, *out receives the converted floating-point value. description js::touint32 converts a javascript value to an unsigned 32bit integer. ...
...e in a request on this jscontext. v js::handlevalue the value to convert. out int32_t * out parameter. on success, *out receives the converted floating-point value. description js::touint32 converts a javascript value to an unsigned 32bit integer. it implements the touint32 operator described in ecma 262-3 §9.5. on success, js::touint32 stores the converted value in *out and returns true. on error or exception, it returns false, and the value left in *out is undefined. see also mxr id search for js::touint32 bug 739541 ...
JS::ToUint64
this article covers features introduced in spidermonkey 17 convert any javascript value to an unsigned 64bit integer. syntax bool js::touint64(jscontext *cx, js::handlevalue v, uint64_t *out); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handlevalue the value to convert. out uint64_t * out parameter. on success, *out receives the converted floating-point value. description js::toint64 converts a javascript value to an unsigned 64bit integer. ...
...rsion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handlevalue the value to convert. out uint64_t * out parameter. on success, *out receives the converted floating-point value. description js::toint64 converts a javascript value to an unsigned 64bit integer. on success, js::toint64 stores the converted value in *out and returns true. on error or exception, it returns false, and the value left in *out is undefined. see also mxr id search for js::touint64 bug 742188 ...
JSClass
ved[n]; /* sizeof 'reserved' depends on version */ }; name type description name const char * class name flags uint32_t class flags. this field is the bitwise or of one or more of the jsclass_* constants described in jsclass.flags. addproperty jspropertyop a hook called just after adding a new property. may modify the new property value. use null or js_propertystub (spidermonkey 31 or older) for default behavior. delproperty jsdeletepropertyop a hook called when deleting a property. may veto. use null or js_deletepropertystub (spidermonkey 31 or older) for default behavior. getproperty jspropertyop a hook called when getting a property. this is the default getter for the ...
...ull or js_resolvestub (spidermonkey 31 or older) for default behavior. obsolete since jsapi 36 the jsclass_new_resolve flag instructs spidermonkey to call this as a jsnewresolveop. obsolete since jsapi 16the jsclass_new_resolve_gets_start flag further affects this hook. convert jsconvertop this hook specifies how objects of this class are converted to a primitive value. it implements the object's [[defaultvalue]] hook, which is invoked by javascript when the object must be converted to a string, number, or primitive value. obsolete since jsapi 44 use null or js_convertstub (spidermonkey 31 or older) for default behavior, which is equivalent to that defined by ecmascript in §8.12.8. finalize jsfinalizeop the object finalizer hook. ...
JSFunctionSpec
uint16_t flags; const char *selfhostedname; }; typedef 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 wi...
...n object. an application typically has an array of jsfunctionspec to define all the functions for an object and calls js_definefunctions or js_initclass to create the functions and assign them to an object. jsfunctionspec can also be used to define an array element rather than a named property. array elements are actually individual properties. to define an array element, cast the element's index value to const char*, initialize the name field with it, and specify the jsprop_index attribute in flags. to define an array of jspropertyspec, use js_fs, js_fn, js_sym_fn, js_fninfo, js_self_hosted_fn, js_self_hosted_sym_fn, js_sym_fnspec, js_fnspec, and js_fs_end. see also mxr id search for jsfunctionspec jspropertyspec jsnative js_fs js_fn js_sym_fn js_fninfo js_self_hosted_fn js_self_host...
JSVAL_LOCK
obsolete since jsapi 18this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. locks a js value to prevent garbage collection on it. syntax jsval_lock(cx,v) description jsval_lock is a deprecated feature that is supported only for backward compatibility with existing applications. to lock a value, use local roots with js_addroot. jsval_lock locks a js value, v, to prevent the value from being garbage collected. v is a js object, string, or double value. ...
...ection on it. syntax jsval_lock(cx,v) description jsval_lock is a deprecated feature that is supported only for backward compatibility with existing applications. to lock a value, use local roots with js_addroot. jsval_lock locks a js value, v, to prevent the value from being garbage collected. v is a js object, string, or double value. jsval_lock determines if v is an object, string, or double value, and if it is, it locks the value. if locking is successful, or v already cannot be garbage collected because it is not an object, string, or double value, jsval_lock evaluates to true. otherwise, it evaluates to false. see also jsval_is_gcthing jsval_to_gcthing jsval_unlock js_addroot js_lockgcthing bug 787580 ...
JSVAL_UNLOCK
obsolete since jsapi 18this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. unlocks a js value, enabling garbage collection on it. syntax jsval_unlock(cx,v) description jsval_unlock is a deprecated feature that is supported only for backward compatibility with existing applications. to unlock a value, use local roots with js_removeroot. jsval_unlock unlocks a previously locked js value, v, so it can be garbage collected. v is a js object, string, or double value. ...
... syntax jsval_unlock(cx,v) description jsval_unlock is a deprecated feature that is supported only for backward compatibility with existing applications. to unlock a value, use local roots with js_removeroot. jsval_unlock unlocks a previously locked js value, v, so it can be garbage collected. v is a js object, string, or double value. jsval_unlock determines if v is an object, string, or double value, and if it is, it unlocks the value. if unlocking is successful, or v not affected by garbage collection because it is not an object, string, or double value, jsval_unlock evaluates to true. otherwise, it evaluates to false. see also jsval_is_gcthing jsval_to_gcthing jsval_lock js_addroot js_lockgcthing bug 787580 ...
JSVersion
the values of the jsversion enumerated type stand for particular versions of the javascript run-time. the functions js_getversion, js_setversion, js_stringtoversion, and js_versiontostring use these values. description the jsversion enumerated type includes the following values. each version has a name, which is a string used by js_stringtoversion and js_versiontostring. ...
... the values of the jsversion enumerated type stand for particular versions of the javascript run-time. the functions js_getversion, js_setversion, js_stringtoversion, and js_versiontostring use these values. description the jsversion enumerated type includes the following values. each version has a name, which is a string used by js_stringtoversion and js_versiontostring. ...
JS_CompileFunctionForPrincipals
ng compilation. on success, js_compilefunctionforprincipals and js_compileucfunctionforprincipals return a pointer to the newly compiled function. on error or exception, they return null. ...
...r or exception, they return null. ...
JS_ContextIterator
t any time. try to avoid using it. cycles through the js contexts associated with a particular jsruntime. syntax jscontext * js_contextiterator(jsruntime *rt, jscontext **iterp); name type description rt jsruntime * the runtime to walk. iterp jscontext * in-out parameter. on input, *iterp must be null or point to a context in rt. on success, the value of *iterp is modified so that repeated calls cycle through all the contexts in rt. description js_contextiterator steps through the set of contexts associated with the runtime rt. each call to js_contextiterator returns the next context in the cycle. iterp must point to a variable of type jscontext *. if *iterp is null, js_contextiterator modifies it to point to the first jscontext in th...
...ntextiterator returns the next context in the cycle. iterp must point to a variable of type jscontext *. if *iterp is null, js_contextiterator modifies it to point to the first jscontext in the list. otherwise *iterp must point to an existing context in rt, and js_contextiterator modifies it to point to the next context in the list, if any, and null otherwise. js_contextiterator returns the new value of *iterp. example the following code snippet illustrates how to cycle through the contexts for a given runtime: jscontext *acx; jscontext *iterp = null; int i = 0; while ((acx = js_contextiterator(rt, &iterp)) != null) { printf("%d ", ++i); } see also mxr id search for js_contextiterator ...
JS_ConvertArgumentsVA
obsolete since jsapi 38this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. converts a series of js values, passed in a va_list, to their corresponding jsapi types. syntax bool js_convertargumentsva(jscontext *cx, const js::callargs &args, const char *format, va_list ap); bool js_convertargumentsva(jscontext *cx, unsigned argc, jsval *argv, const char *format, va_list ap); name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. args const js::callargs...
... the number of arguments to convert. obsolete since jsapi 30 argv jsval * pointer to the vector of arguments to convert. obsolete since jsapi 30 format const char * character array containing the recognized format to which to convert. ap va_list the list of pointers into which to store the converted types. there should be one pointer for each converted value. the type va_list is a standard feature of the c programming language. it is defined in <stdarg.h>. description js_convertargumentsva is to js_convertarguments as vprintf is to printf. see js_convertarguments for further information. if js_convertargumentsva successfully converts all arguments, it returns true. otherwise it returns false. see also mxr id search for js_convertargument...
JS_DecompileFunction
es not make a native c call, then the text created by js_decompilefunction is a complete function declaration suitable for re-parsing. ...
...unction that makes a native c call, the body of the function contains the text "native code'" and cannot be re-parsed. ...
JS_DecompileFunctionBody
t providing the function's declaration. if you decompile a function that makes a native c call, the body of the function only contains the text "[native code]". ...
...e code]". notes to decompile a complete function, including its body and declaration, call js_decompilefunction instead. ...
JS_DefineProperties
operties. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * the object on which to define new properties. ps const jspropertyspec * pointer to the first element of an array containing names, ids, flags, and getproperty and setproperty method for the properties to create. the last array element must contain 0-valued members. in spidermonkey versions prior to spidermonkey 24, the last argument to js_definepropeties was not const. description js_defineproperties creates properties on a specified object, obj. ps is a pointer to the first element of an array of jspropertyspec structures. each array element defines a single property: its name, attributes, getter, and setter. the name field of the last a...
... first element of an array of jspropertyspec structures. each array element defines a single property: its name, attributes, getter, and setter. the name field of the last array element must be null. js_defineproperties creates one property for each element in the array before the element with a null name field. each property is defined as though by calling js_defineproperties. the initial stored value of each property created is undefined. on success, js_defineproperties returns true, indicating it has created all properties listed in the array. otherwise it returns false. see also mxr id search for js_defineproperties js_defineconstdoubles js_defineelement js_definefunction js_definefunctions js_defineobject js_defineproperty js_initclass bug 855582 ...
JS_DeleteElement2
wise. description js_deleteelement2 removes a specified element or numeric property, index, from an object, obj. if an object references an element belonging to a prototype, the element reference is removed from the object, but the prototype's element is not deleted. if deletion is successful, js_deleteelement2 stores true to *succeeded and returns true. otherwise it returns false and the value of *succeeded is undefined. notes per the ecma standard, js_deleteelement2 removes read-only properties from objects as long as they are not also permanent. for javascript 1.2 and earlier, if deletion fails because the property is permanent, js_deleteelement2 reports the error and returns false. for javascript 1.3, the attempt is silently ignored. in both these cases, *succeeded will receive...
...ed is undefined. notes per the ecma standard, js_deleteelement2 removes read-only properties from objects as long as they are not also permanent. for javascript 1.2 and earlier, if deletion fails because the property is permanent, js_deleteelement2 reports the error and returns false. for javascript 1.3, the attempt is silently ignored. in both these cases, *succeeded will receive the stored value of the property that was not deleted. to remove all properties from an object, call js_clearscope. see also mxr id search for js_deleteelement2 bug 1113369 -- added result parameter ...
JS_DoubleIsInt32
this article covers features introduced in spidermonkey 17 compare double value and int32_t value. syntax bool js_doubleisint32(double d, int32_t *ip); name type description d double a double value to compare ip int32_t * a pointer to int32_t value to compare description js_doubleisint32 returns true if d i sequal to *ip. ...
... we should definitely fix this (bug 744965), but as apparently it "works" in practice, it's not a pressing concern now. ...
JS_EnterLocalRootScope
functions, getter/setters, etc. to avoid calling js_addroot and js_removeroot to manage global roots temporarily. js_addroot roots a variable, ensuring that whatever the variable points to at any given moment is protected from gc. by contrast, local root scopes protect newly-created objects, doubles, and strings. there is no need to tell the js engine about each variable that may point to such a value. calling js_enterlocalrootscope and js_leavelocalrootscope around the body of the native hook protects each object, double, and string created using the same jscontext from gc. for example: jsbool my_getproperty(jscontext *cx, jsobject *obj, jsval id, jsval *vp) { jsbool ok; if (!js_enterlocalrootscope(cx)) return js_false; // this function doesn't need to bother rooting any...
...ach object, double, and string created using the same jscontext from gc. for example: jsbool my_getproperty(jscontext *cx, jsobject *obj, jsval id, jsval *vp) { jsbool ok; if (!js_enterlocalrootscope(cx)) return js_false; // this function doesn't need to bother rooting any new objects, // strings, or doubles it creates using cx. even if js_gc is // called, these new values will not be collected. ok = my_getpropertybody(cx, obj, id, vp); // when we leave the local root scope, this protection ends. new // items created in this local root scope become subject to gc. js_leavelocalrootscope(cx); return ok; } note: js_leavelocalrootscope or js_leavelocalrootscopewithresult must be called once for every prior successful call to js_enterlocalrootscop...
JS_EvaluateScriptForPrincipals
cute. length unsigned int the length of src, in characters. filename const char * name of file or url containing the script. used to report filename or url in error messages. lineno unsigned int line number. used to report the offending line in the file or url if an error occurs. rval jsval * out parameter. on success, *rval receives the value from the last-executed expression statement in the script. version jsversion javascript version for the script. description js_evaluatescriptforprincipals compiles and executes a script in the specified scope, obj. js_evaluateucscriptforprincipals is the unicode version of the function. principals is a pointer to the jsprincipals structure that contains the security inform...
...ext of the script. length is the length of the script, in characters. filename is the name of the file (or url) containing the script. this information is used in messages if an error occurs during compilation. similarly, lineno is used to report the line number of the script or file where an error occurred during compilation. if the script compiles and executes successfully, *rval receives the value from the last-executed expression statement processed in the script, and js_evaluatescriptforprincipals or js_evaluateucscriptforprincipals returns js_true. otherwise it returns js_false, and the value left in *rval is undefined. see also js::evaluate js_compilefile js_compilescriptforprincipals js_evaluatescript bug 980180 ...
JS_ExecuteScriptVersion
of the three cases in ecma 262-3 §10.2. instead: the scope chain is initialized to contain obj, followed by its parent, then its parent's parent, etc. until null is reached. variable initialization is performed. if the jsoption_varobjfix option is in effect (recommended), then the last object in the scope chain is used as the variable object. otherwise obj is used. the this value is obj. script jsobject * the compiled script to execute. rval jsval * out parameter. on success, *rval receives the value from the last executed expression statement processed in the script. version jsversion version for the script. description js_executescript executes a previously-compiled script, script. if the script executes suc...
...ipt jsobject * the compiled script to execute. rval jsval * out parameter. on success, *rval receives the value from the last executed expression statement processed in the script. version jsversion version for the script. description js_executescript executes a previously-compiled script, script. if the script executes successfully, *rval receives the value from the last executed expression statement processed in the script, and js_executescript returns true. otherwise it returns false, and the value left in *rval is unspecified. to execute a script that has not been compiled, use js::evaluate instead. see also js::compile js_executescript js::evaluate bug 1095660 ...
JS_GetElement
find a specified numeric property of an object and return its current value. syntax bool js_getelement(jscontext *cx, js::handleobject obj, uint32_t index, js::mutablehandlevalue vp); name type description cx jscontext * the context in which to perform the property lookup. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to search for the element. index uint32_t index of the element to look up. vp js::mutablehandlevalue out parameter. on success, *vp receives the current value of the element, if it exists, and undefined otherwise. description js_getelement examines a specified js object, obj, and its prototype ...
...ex of the element to look up. vp js::mutablehandlevalue out parameter. on success, *vp receives the current value of the element, if it exists, and undefined otherwise. description js_getelement examines a specified js object, obj, and its prototype chain, for an element or numeric property numbered index. if the element exists, js_getelement sets *vp to the element's current value. if not, it sets *vp to undefined and returns true (to indicate no error occurred). if the search fails with an error or exception, js_getelement returns false, and the value left in *vp is undefined. see also mxr id search for js_getelement js_defineelement js_deleteelement js_getarraylength js_isarrayobject js_lookupelement js_newarrayobject js_setarraylength js_setelement ...
JS_GetPropertyAttributes
e 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 left in *foundp is unspecified. description js_getpropertyattributes retrieves the property attributes of the property with the given name on a given object, obj. js_getucpropertyattributes is the unicode version of the function. if an error occurs, the return value is js_false, and the values left in *attrsp and *foundp are unspecified. if obj does not have the specified property, or i...
...he property with the given name on a given object, obj. js_getucpropertyattributes is the unicode version of the function. if an error occurs, the return value is js_false, and the values left in *attrsp and *foundp are unspecified. if obj does not have the specified property, or if it inherits it from some other object (on its prototype chain, for example), then *foundp is set to js_false. the value left in *attrsp is unspecified. the return value is js_true (to indicate that no error occurred). if the property exists and belongs to obj, then *foundp is set to js_true, *attrsp is set to the logical or of zero or more property attributes flags, and the function returns js_true. see also property attributes bug 893186 ...
JS_GetSecurityCallbacks
pointe to the function which returns whether the first principal subsumes the second. use null is not needed. description js_setsecuritycallbacks sets the runtime's security callbacks to callbacks. it allows the embedding to control certain aspects of js code execution based on security settings of the global object the code is executed in. if callbacks is null, it sets callbacks to default value. ...
... description js_setsecuritycallbacks sets the runtime's security callbacks to callbacks. it allows the embedding to control certain aspects of js code execution based on security settings of the global object the code is executed in. if callbacks is null, it sets callbacks to default value. js_getsecuritycallbacks returns the runtime's current security callbacks. ...
JS_GetStringBytes
a context. str jsstring * string to retrieve bytes from. description js_getstringbytes and js_getstringbytesz convert the specified javascript string, str, to a c string (an array of 8-bit chars). if js_cstringsareutf8 is true, then the returned string is utf-8, and the conversion is lossless. otherwise the high byte is simply dropped from each 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_getstringencodinglength, js_encodestringtobuffer. the array returned ...
...te 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_getstringchars to access the 16-bit characters of a javascript string without conversions or copying. see also js_encodestring js_encodestringtoutf8 js_getstringencodinglength js_encodestringtobuffer js_comparestrings js_getstringlength js_valuetostring bug 607292 ...
JS_HasInstance
jsapi method equivalent to the instanceof operator in javascript. syntax bool js_hasinstance(jscontext *cx, js::handle<jsobject*> obj, js::handle<js::value> v, bool *bp); 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::handle&lt;jsobject*&gt; constructor/prototype to test. v js::handle&lt;js::value&gt; the value to test. bp bool * out parameter. on success, *bp receives the result of the test. description js_hasinstance determines if a specified js value, v, is an instance of js object, obj. this function is equivalent to v instanceof obj test in...
... bp bool * out parameter. on success, *bp receives the result of the test. description js_hasinstance determines if a specified js value, v, is an instance of js object, obj. this function is equivalent to v instanceof obj test in javascript. on success, js_hasinstance stores the result of the instanceof test in *bp and returns true. on error or exception, it returns false, and the value left in *bp is undefined. when providing a prototype as obj, the prototype's jsclass must have its hasinstance method set. otherwise js_hasinstance returns false. see also mxr id search for js_hasinstance js_instanceof ...
JS_InitClass
class consists of a jsclass structure, a constructor, a prototype object, and properties and functions. the jsclass is an internal data structure that is not exposed outside the javascript engine. it specifies the name of the class, its flags, and its property access functions. these include native c functions for instance finalization, adding and deleting properties, getting and setting property values, and enumerating, converting, and resolving properties. the jsapi provides reasonable default behavior for all of these; ordinarily you don't want to overload any of them. after a successful call to js_initclass, javascript code can see and manipulate the class's constructor and prototype just as if it were an ordinary javascript function with a prototype property. javascript code can create new...
...s. if you provide a constructor for the class, then you should also pass an object to parent_proto. js_initclass uses parent_proto to build a prototype object for the class. the prototype object inherits properties and methods from the parent_proto object you provide. once the constructor or prototype is created, js_initclass defines a property on obj. the name of the property is clasp->name. its value is the constructor function if constructor is non-null, and the prototype object otherwise. the property has the stub getter and setter and no property attributes. (if your constructor function requires property attributes, such as jsprop_enumerate, use js_setpropertyattributes to modify the attributes of the property created by js_initclass.) after building the constructor and prototype, js_init...
JS_IsArrayObject
determine if a specified object is an array. syntax bool js_isarrayobject(jscontext *cx, js::handlevalue value, bool *isarray); bool js_isarrayobject(jscontext *cx, js::handleobject obj, bool *isarray); // obsolete since jsapi 44 bool js_isarrayobject(jscontext *cx, js::handlevalue value); bool js_isarrayobject(jscontext *cx, js::handleobject obj); name type description cx jscontext * a context. value js::handlevalue the value to examine. obj js::handleobject the object to examine. isarray bool whether the value/object is an array. description js_isarrayobject determines if a specified object, obj or value, is an array object. on success, returns true and sets isarray indicating whether obj is an arra...
...ct to examine. isarray bool whether the value/object is an array. description js_isarrayobject determines if a specified object, obj or value, is an array object. on success, returns true and sets isarray indicating whether obj is an array object or a wrapper around one. otherwise returns false on failure. ...
JS_IsIdentifier
g to test. length size_t the length of chars. isidentifier bool * out parameter. on success, *isidentifier receives whether str is an identifier or not. ...
... 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_IsStopIteration
this article covers features introduced in spidermonkey 31 determine whether the value is a stopiteration exception or not. syntax // added in spidermonkey 42 bool js_isstopiteration(js::value v); // obsolete since spidermonkey 42 bool js_isstopiteration(jsval v); name type description v js::value the value to check. description js_isstopiteration returns true if v is stopiteration, otherwise false. ...
..._isstopiteration(js::value v); // obsolete since spidermonkey 42 bool js_isstopiteration(jsval v); name type description v js::value the value to check. description js_isstopiteration returns true if v is stopiteration, otherwise false. ...
JS_New
this article covers features introduced in spidermonkey 1.8 create an object as though by using the new keyword and a javascript function. syntax jsobject * js_new(jscontext *cx, js::handleobject ctor, const js::handlevaluearray& args); // added in jsapi 32 jsobject * js_new(jscontext *cx, jsobject *ctor, unsigned argc, jsval *argv); // obsolete since jsapi 32 name type description cx jscontext * the context in which to create the new object. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ctor js::handleobject the constructor function object. args js::handlevaluearray &amp; an array of argument values to pass to the constructor. added in spidermonkey 38 argc uns...
...if argc is 0, this may be null. obsolete since jsapi 32 description js_new creates a new object as though by using the new operator, as described in ecma 262-3 §11.2.2. ...
JS_NewContext
ion rt jsruntime * parent runtime for the new context. javascript objects, functions, strings, and numbers may be shared among the contexts in a jsruntime, but they cannot be shared across jsruntimes. stackchunksize size_t the size, in bytes, of each "stack chunk". this is a memory management tuning parameter which most users should not adjust. 8192 is a good default value. description js_newcontext creates a new jscontext in the runtime rt. on success, it returns a pointer to the new context. otherwise it returns null. for more details about contexts, see jscontext. for sample code that creates and initializes a jscontext, see jsapi user guide. the stackchunksize parameter does not control the javascript stack size. (the jsapi does not provide a way to ad...
...etails about contexts, see jscontext. for sample code that creates and initializes a jscontext, see jsapi user guide. the stackchunksize parameter does not control the javascript stack size. (the jsapi does not provide a way to adjust the stack depth limit.) passing a large number for stackchunksize is a mistake. in a debug build, large chunk sizes can degrade performance dramatically. the usual value of 8192 is recommended. the application must call js_destroycontext when it is done using the context. before a jsruntime may be destroyed, all the jscontexts associated with it must be destroyed. the new jscontext initially has no global object. the new jscontext is associated with the calling thread. no other thread may use it or destroy it. see also mxr id search for js_newcontext js_...
JS_NewStringCopyN
d into the new string like any other character. ...
...an use js_newstringcopyn to copy binary data or to copy only a certain portion of a c string into a javascript string. on success, js_newstringcopyn and js_newucstringcopyn return a pointer to the new js string. otherwise they return null. see also mxr id search for js_newstringcopyn mxr id search for js_newucstringcopyn js_getemptystringvalue js_newstringcopyz js_newucstringcopyz js_valuetostring ...
JS_NewStringCopyZ
y, s, into the new string. ...
...ringcopyz returns a pointer to the new javascript string. ...
JS_ObjectIsFunction
function tests whether obj is a function object (faster than comparing obj's class name to function, but equivalent unless someone has overwritten the function identifier with a different constructor and then created instances using that constructor that might be passed in as obj). ...
...might be passed in as obj). js_objectisfunction returns true if obj is a function and false otherwise. if js_objectisfunction returns true, js_valuetofunction will always return non-null. js_objectisfunction always succeeds. ...
JS_ParseJSON
this article covers features introduced in spidermonkey 1.8.6 parse a string using the json syntax described in ecmascript 5 and return the corresponding value. syntax jsbool js_parsejson(jscontext *cx, const jschar *chars, uint32 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 ...
...uires 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 rules applied by these methods are exactly those specified by ecmascript 5. various json extensions like trailing commas, unquoted property names, more generous number parsing, and so on are n...
JS_PushArguments
r each argument described in format. ap va_list (in js_pushargumentsva) the list of arguments to be converted to jsvals. there must be one argument for each argument described in format. the type va_list is a standard feature of the c programming language. it is defined in <stdarg.h>. description js_pusharguments provides a convenient way to translate a series of native c/c++ values to jsvals with a single function call. cx is the context for the call. markp points to a void * to hold the internally allocated stack frame pointer to pass back to js_poparguments. format is a sequential character array, where each element of the array indicates the js type into which to convert the next c/c++ argument. format can contain one or more instances of the following characters, as ap...
...any asterisks (*) in format are ignored. this function also takes in consideration any additional custom types defined in cx using js_addargumentformatter. for example, if format is "biob", ...
JS_SetNativeStackQuota
size_t trustedscriptstacksize = 0, size_t untrustedscriptstacksize = 0); name type description rt jsruntime * the runtime. systemcodestacksize size_t the desired stack quota setting, in bytes. trustedscriptstacksize size_t the desired stack quota setting, in bytes for trusted script. if omitted, it uses the value of systemcodestacksize. added in spidermonkey 31 untrustedscriptstacksize size_t the desired stack quota setting, in bytes for untrusted script. if omitted, it uses the value of trustedscriptstacksize. added in spidermonkey 31 description js_setnativestackquota sets the size of the native stack that should not be exceeded. to disable stack size checking, pass 0. spidermonk...
...y js_settrustedprincipals), and untrusted script. each kind of code may have a different stack quota, allowing embedders to keep higher-priority machinery running in the face of scripted stack exhaustion by something else. the stack quotas for each kind of code should be monotonically descending, and may be specified with this function. if 0 is passed for a given kind of code, it defaults to the value of the next-highest-priority kind. this function may only be called immediately after the runtime is initialized and before any code is executed and/or interrupts requested. see also mxr id search for js_setnativestackquota js_settrustedprincipals bug 516832 bug 732665 bug 723021 ...
JS_StrictlyEqual
this article covers features introduced in spidermonkey 1.8.1 determine whether two javascript values are equal in the sense of the === operator. syntax // added in spidermonkey 45 bool js_strictlyequal(jscontext *cx, js::handle<js::value> v1, js::handle<js::value> v2, bool *equal); // obsolete since jsapi 39 bool js_strictlyequal(jscontext *cx, jsval v1, jsval v2, bool *equal); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v1, v2 js::handle&lt;js::value&gt; / jsval the value to compare. equal bool * out parameter. receives the comparison result. description js_...
...§11.9.6. ...
JS_StringToVersion
returns a jsversion value representing the version string. syntax jsversion js_stringtoversion(const char *string); name type description string const char * version string to convert. description js_stringtoversion attempts to convert the version string to a jsversion value. ...
... returns a jsversion value representing the version string. syntax jsversion js_stringtoversion(const char *string); name type description string const char * version string to convert. description js_stringtoversion attempts to convert the version string to a jsversion value. ...
JS_SuspendRequest
quest, if any, to allow the thread to block or perform time-consuming calculations. syntax jsrefcount js_suspendrequest(jscontext *cx); void js_resumerequest(jscontext *cx, jsrefcount 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_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 other threads to access objects that the calling thread had locked. the return value is the number of nested requests that were suspended. it may be 0. js_resumerequest resumes the previously suspended requests. the savedepth argument must be the value returned by the matching js_suspendrequest call. if savedepth is nonzero and garbage collection is underway, js_resumerequest blocks until the garbage collector is done. jsapi 1.7 and earlier js_suspendrequest and js_resumereques...
JS_THREADSAFE
= recv(socket, buf, size, flags); js_resumerequest(cx, rc); ... } garbage collection requests help make garbage collection safe when multiple threads are using the jsapi. for each thread that is in a request: almost any call into the jsapi may trigger garbage collection; but garbage collection does not happen at any other time (such as, for example, at the moment before the return value of js_newobject is assigned to a rooted variable). these are actually the same rules that apply to single-threaded jsapi programs. but in multithreaded programs, if you break the rules, your program is more likely to crash. this is because in single-threaded programs, a random call into the jsapi is actually pretty unlikely to trigger gc, especially if the calling thread has not been using up a...
...es that can be safely written to disk, sent to another process or even another machine, or just passed to another thread. then use js_readstructuredclone on the other side to turn the serialized data back into javascript objects, strings, and so on. sharing native functions and private data among threads in a js_threadsafe build, spidermonkey's internal data structures that represent javascript values are single-thread-only. in a debug build, this is enforced with assertions. however, spidermonkey does not protect the application's data structures. jsnatives and other callback functions can be called concurrently by multiple threads. multiple threads can end up accessing private data or c/c++ global variables at the same time. it is up to the application to practice safe threading. sharing ...
JS_VersionToString
returns a string representation of a jsversion value. syntax const char * js_versiontostring(jsversion version); name type description version jsversion version value to convert. description js_versiontostring attempts to convert the version to a const char * string representation. ...
... returns a string representation of a jsversion value. syntax const char * js_versiontostring(jsversion version); name type description version jsversion version value to convert. description js_versiontostring attempts to convert the version to a const char * string representation. ...
PRIVATE_TO_JSVAL
syntax jsval private_to_jsval(void *ptr); void * jsval_to_private(jsval v); // obsoleted since jsapi 32 description with private_to_jsval(), an application can store a private data pointer, p, as a jsval. ...
... but the pointer must be two-byte-aligned (that is, (int) p must be even). private data is managed entirely by the application. the javascript engine itself never uses a private data pointer. private data is not garbage collected. it is the application's responsibility to determine when it is safe to dereference a private data pointer. see also mxr id search for private_to_jsval js::privatevalue bug 952650 bug 1177892 -- removed ...
STRING_TO_JSVAL
obsolete since jsapi 42this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. casts a specified js string to a js value. please use js::stringvalue instead in spidermonkey 45 or later. syntax jsval string_to_jsval(jsstring *str) name type description obj jsstring * a pointer to a js string to convert to a jsval. ...
...idermonkey 45 or later. ...
jsid
a jsid is a javascript identifier for a property or method of an object. jsid is either a 31-bit signed integer, interned string or object. a few jsapi functions use jsids instead of js::values for property names: js_nextproperty, js_enumerate, and all functions with names ending in byid. also, there is an additional jsid value, jsid_void, which does not occur in js scripts but may be used to indicate the absence of a valid jsid. a void jsid is not a valid id and only arises as an exceptional api return value, such as in js_nextproperty. ...
...to indicate the absence of a valid jsid. a void jsid is not a valid id and only arises as an exceptional api return value, such as in js_nextproperty. embeddings must not pass jsid_void into jsapi entry points expecting a jsid and do not need to handle jsid_void in hooks receiving a jsid except when explicitly noted in the api contract. a jsid is not implicitly convertible to or from a jsval; js_valuetoid or js_idtovalue must be used instead. ...
SpiderMonkey 1.8
engine no longer calls jsclass.resolve callbacks repeatedly, as it did in previous versions. specifically, if a property lookup first calls a resolve hook which does not define the property, then finds the property on a prototype, that result can be cached. future lookups for the same property on the same sort of object may bypass the resolve hook. js_newdouble is now deprecated. use js_newdoublevalue. the security apis js_setcheckobjectaccesscallback, js_setprincipalstranscoder, and js_setobjectprincipalsfinder are still present but are deprecated in this release. in spidermonkey 1.8.1 they will be removed and replaced with a new set of apis (js_getsecuritycallbacks and friends, bug 451729). js.mak, an old windows-specific nmake file, has been deleted. it hasn't worked for a long time. it i...
...asier to reproduce, reveals gc problems that you may not have noticed before, and causes gc-safety bugs to surface much closer to their cause. js_dumpheap dumps parts of the gc heap and can help detect leaks. a new gc parameter, jsgc_stackpool_lifespan, controls how eagerly spidermonkey returns unused memory back to the system. the new function js_setextragcroots provides another way to protect values from garbage collection. there is a new set of apis for integrating spidermonkey's garbage collector with other memory management systems. these apis are undocumented but fairly stable. the apis include the new jstraceop callback. new javascript shell functions there are a few new built-in functions in the javascript shell, mostly useful for testing. countheap, dumpheap, gcparam, gczeal, an...
SpiderMonkey 24
are easy to detect and updating the code is a fairly straightforward job. here is a list of the most significant changes. many of the garbage collector changes require type signature changes to jsapi methods: specifically introducing js::rooted, js::handle, and js::mutablehandle types. these types, with the appropriate parametrizations, can roughly be substituted for plain types of gc things (values, string/object pointers, etc.). these and other changes are explained in detail below. new javascript language features javascript 24 includes significant updates to language features, yo. typedef changes the fixed-size integer types introduced in spidermonkey 17 are defined in one of the following ways (xxx update for msvc<10 deprecation): if the environment variable moz_custom_stdint_...
...ong run we anticipate removing the environment variable-based overriding when we drop support for versions of visual studio prior to 2010. in the meantime moz_custom_stdint_h is intended to function as a bridge to always using the standard header. for more information on the fixed-size integer types changes, see this blog post. new c apis js_getarrayprototype provides access to the original value of array.prototype. new c++ helpers while jsapi remains a c api, the engine is now implemented in c++. some c++ helpers have been introduced into the api, to help embedders writing c++ projects. please note that spidermonkey reserves the js:: namespace for itself (and the js:: namespace for internal use). ...list new c++ helpers here... obsolete apis ...list obsolete methods/structs/a...
SpiderMonkey 45
y (bug 1211607) js::newfunctionfromspec (bug 1054756) js::compilefornonsyntacticscope (bug 1165486) js_checkforinterrupt (bug 1058695) js::mapdelete (bug 1159469) js::mapforeach (bug 1159469) js::newsetobject (bug 1159469) js::setsize (bug 1159469) js::sethas (bug 1159469) js::setdelete (bug 1159469) js::setadd (bug 1159469) js::setclear (bug 1159469) js::setkeys (bug 1159469) js::setvalues (bug 1159469) js::setentries (bug 1159469) js::setforeach (bug 1159469) js::exceptionstackornull (bug 814497) js::copyasyncstack (bug 1160307) js::getsavedframesource (bug 1216819) js::getsavedframeline (bug 1216819) js::getsavedframecolumn (bug 1216819) js::getsavedframefunctiondisplayname (bug 1216819) js::getsavedframeasynccause (bug 1216819) js::getsavedframeasyncparent (bug 121681...
...pinstringn (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_idarraylength js_idarrayget js_destroyidarray js_defaultvalue js_getparent js_setparent js::parsepropertydescriptorobject js_deleteproperty2 js_deletepropertybyid2 js_deleteucproperty2 js_deleteelement2 js_newfunctionbyid js_bindcallable js_decompilefunctionbody js_getlatin1internedstringchars js_gettwobyteinternedstringchars js_newdateobjectmsec js_cleardatecaches changed apis js_init has moved from jsapi.h to js/initialization.h js_shu...
TPS History Lists
es of history asset lists, one used for adding/modiyfing/verifying history, and the other for deleting history. the history list used for operations other than delete has the following properties: uri: required. title: optional. the page title for this uri. visits: required. an array of objects representing visits to the page, each object has the following properties: type: required. an integer value from one of the transition types listed at https://developer.mozilla.org/en/nsinavhistoryservice#constants. date: required. an integer representing when the visit took place, expressed in hours from the present. for example, 0 is now, -24 is 24 hours in the past. for example: var history_initial = [ { uri: "http://www.google.com/", title: "google", visits: [ { type: 1, date: 0 ...
...ects, each of which represents a type of history to delete. ...
TPS Tests
ts.stage.mozaws.net" // possibly more preferences... }, // ... } note that in this example, the foobar@restmail.net account must be registered on stage, otherwise authentication will fail (and the whole test will fail as well. you can sign up for an fxa account on stage or dev by creating an fxa account after adding the identity.fxaccounts.autoconfig.uri preference (with the appropriate value) to about:config. additionally, note that the config file must parse as valid json, and so you can't have comments in it (sorry, i know this is annoying). one alternative is to put underscores before the "disabled" preferences, e.g. "_identity.fxaccounts.autoconfig.uri": "...". writing tps tests each tps test is run as a series of "phases". a phase runs in some firefox profile, and contains som...
...tion on asset lists; there are also some additional built-in functions. built-in functions sync(options) initiates a sync operation. if no options are passed, a default sync operation is performed. otherwise, a special sync can be performed if one of the following are passed: sync_wipe_server, sync_wipe_client, sync_reset_client. this will cause tps to set the firstsync pref to the relevant value before syncing, so that the described actionwill take place logger.loginfo(msg) logs the given message to the tps log. logger.asserttrue(condition, msg) asserts that condition is true, otherwise an exception is thrown and the test fails. logger.assertequal(val1, val2, msg) asserts that val1 is equal to val2, otherwise an exception is thrown and the test fails. custom functions you can als...
WebReplayRoadmap
using a corpus of several normal recordings (or buggy recordings) would reduce false positives due to incidental differences between the recordings. aggregate call graph and data flow (not yet implemented) when developing a complex web app it is often hard to find where a function is called, the callees at a call site, where some data in an object came from or where it is used, or what type a value has. these questions can be answered by analyzing one or more recordings to study their behavior in detail. if the debugger could perform this analysis then it could show this information to developers and help them understand the app even when they are not actively debugging a particular recording. static type integration (not yet implemented) static type systems like flow and typescript are...
...would be to provide seed information for automatically populating the types in an app that is being converted to use flow or typescript. type profiling (not yet implemented) the types that appear in practice have a large effect on how well the associated code can be optimized by jits. while different jits optimize code in different ways, for peak performance they all require code to operate on values of consistent types: primitive types, including int32 vs. doubles, or objects that have the same set of properties. if js performance is a bottleneck, recordings can be analyzed for code regions that are both very hot and have inconsistent types. these are good candidates for optimization, and as with static type integration above, points where unexpected types appear can be seeked to in the d...
Gecko Roles
ole_combobox represents a combo box; an edit control with an associated list box that provides a set of predefined choices. role_droplist represents the calendar control. role_progressbar represents a progress bar, dynamically showing the user the percent complete of an operation in progress. role_dial represents a dial or knob whose purpose is to allow a user to set a value. ...
...er the percent complete of an operation in progress. role_dial represents a dial or knob whose purpose is to allow a user to set a value. role_hotkeyfield represents a hot-key field that allows the user to enter a combination or sequence of keystrokes. role_slider represents a slider, which allows the user to adjust a setting in given increments between minimum and maximum values. role_spinbutton represents a spin box, which is a control that allows the user to increment or decrement the value displayed in a separate "buddy" control associated with the spin box. role_diagram represents a graphical image used to diagram data. role_animation represents an animation control, which contains content that changes over time, such as a control that displa...
The Places database
laces schema looks like so: core url table moz_places: this is the main table of uris and is managed by the history service (see also history service design). any time a places component wants to reference a url, whether visited or not, it refers to this table. each entry has an optional reference to the moz_favicon table to identify the favicon of the page. no two entries may have the same value in the url column. moz_hosts: one entry in this table is created each time you visit a new host. it contains the host url, frequency of access, if typed or not, and it's prefix (https://, ftp://, etc). history tables moz_historyvisits: one entry in this table is created each time you visit a page. it contains the date, referrer, and other information specific to that visit. it contains a re...
... moz_keywords: this table is a unique list of keywords. the moz_bookmarks table has a keyword_id column that maps to a record in moz_keywords table. see manipulating bookmarks using places for more information. annotation tables moz_anno_attributes: contains the names of all the annotations in the system and a name id. there should be relatively few unique names. moz_annos: contains the values of page annotations. it maps a page (reference to moz_places) and an annotation name (reference to moz_anno_attributes) to the value of the annotation. moz_items_annos: contains the values of bookmark item annotations. it maps a bookmark, folder or separator (reference to moz_bookmarks) and an annotation name (reference to moz_anno_attributes) to the value of the annotation. favicon table ...
History Service Design
tabase creation, maintenance and initialization: all services rely on a common shared database called places.sqlite. history service checks for database existance and coherence, and initializes the connection through the storage service. history management: provides basic and advanced apis to store and modify visits and page details. relevance calculation: maintain and expire frecency values for pages. history expiration: expire old visits and invalid informations from the database. queries creation: allows the creation for complex queries. queries results maintenance: allows easy access to queries results. charset for pages: allows setting and reading charset for each page. database maintenance at startup the service creates an exclusive storage connect...
...ing mode. only the first level of a node is usually filled, internal nodes or queries will populate themselves when opened. an implementer working on a ui can then associate a viewer with the result, so that it will be notified when the result tree changes. queries can act on a variety of datas, coming from all dependant services, so it is possible to query history, bookmarks or both, also with values coming from other services like tags, annotations. result nodes can be simple uri nodes with page attributes or complete visit attributes, or can be containers (folders, other queries, dynamic containers and so on). see querying places for deeper knowledge on the actual implementation. expiration expiration is an important part of data management for two reasons: privacy: expiring data bas...
Places Developer Guide
a batch of changes are about to occur. // observers can use this to suspend updates to the user-interface, for example // while a batch change is occurring. }, onendupdatebatch: function() { this._inbatch = false; }, onitemadded: function(id, folder, index) { }, onitemremoved: function(id, folder, index) { }, onitemchanged: function(id, property, isannotationproperty, value) { // isannotationproperty is a boolean value that is true of the changed property is an annotation. // you can access a bookmark item's annotations with the <code>nsiannotationservice</code>. }, onitemvisited: function(id, visitid, time) { // the visit id can be used with the history service to access other properties of the visit. // the time is the time at which the visit o...
... getservice(ci.nsinavhistoryservice); let observer = { onbeginupdatebatch: function() { }, onendupdatebatch: function() { }, onvisit: function(auri, avisitid, atime, asessionid, areferringid, atransitiontype) { }, ontitlechanged: function(auri, apagetitle) { }, ondeleteuri: function(auri) { }, onclearhistory: function() { }, onpagechanged: function(auri, awhat, avalue) { }, onpageexpired: function(auri, avisittime, awholeentry) { }, queryinterface: function(iid) { if (iid.equals(components.interfaces.nsinavhistoryobserver) || iid.equals(components.interfaces.nsisupports)) { return this; } throw cr.ns_error_no_interface; } }; history.addobserver(observer, false); new tagging service the tagging of uris is provided by nsitag...
Places Expiration
expiration is handled in toolkit/components/places/nsplacesexpiration.js. algorithm expiration is based on hardware specs, specifically on memory size and available disk space. this means on mobile and old systems expiration will be more aggressive than on high-end hardware, to try keep the database size at a reasonable (and performant) value. all of expiration uses the storage async api, that ensures i/o is in a separate thread, plus it won't block any read thanks to the use of the wal journaling system. common expiration runs on a timer, every 3 minutes and uses a simple adaptive algorithm: if the last step was unable to expire enough entries the next one will expire more entries, otherwise if the previous step completed the cleanup the next step will be delayed. this ensures expi...
...ce, since adaptive behavior should satisfy each need, though in case of unexpected issues it's possible to act on some hidden preferences: places.history.expiration.interval_seconds: minimum number of seconds between expiration steps. default is 180 seconds. places.history.expiration.max_pages: the maximum number of pages that may be retained in the database before starting to expire. default value is calculated on startup and put into the places.history.expiration.transient_current_max_pages preference. this transient version of the preference is just mirroring the current value used by expiration, setting it won't have any effect. ...
Using the Places history service
serhistory.lastpagevisited: contains the uri of the last page visited. this is used when the preference is set that causes the last page in new windows. nsibrowserhistory.count: the number of pages in history. this is used by the "clear history" button to determine if there are any pages in history. because actually counting all the pages in history is expensive,navhistory will always return the value 0 or 1. 0 is returned when there is no history, 1 is returned when there are one or more pages in history.deprecated, use hashistoryentries instead. nsinavhistoryservice.hashistoryentries: exactly the same as nsibrowserhistory.count, except with a better name and actually returning a boolean. preferred over "count". nsinavhistory.canadduri: determines whether the given uri will be stored by the...
... by the history system. many types of uris, such as "chrome:" uris, are not stored when adduri is called. this function allows you to determine whether it will be or not. advanced querying see querying places for more detailed examples on how to used the advanced querying functionality of navhistory. nsinavhistoryservice.getnewquery: returns a new query object initialized to the default values. you can pass this to executequeries(). nsinavhistoryservice.getnewqueryoptions: returns a new query options object initialized to the default values. you can pass this to executequeries(). nsinavhistoryservice.executequery: runs a query with a single query object and options. all the parameters set on the query object will be anded together. nsinavhistoryservice.executequeries: runs multiple...
extIApplication
bookmarkroots the root bookmarks object for the application. windows readonly attribute nsivariant an array of browser windows within the application. activewindow readonly attribute fueliwindow the currently active browser window. methods quit() attempts to shutdown the application. it is possible for the shutdown to be canceled. boolean quit() return value boolean value indicating whether the shutdown was successful. restart() attempts to restart the application. it is possible for the restart to be canceled. boolean restart() return value boolean value indicating whether the restart was successful. getextensions(acallback) calls acallback with the list of installed extensions. void getextensions(extiextensionscallback acallback) return...
... xpcom although the application object is preloaded into xul scripts, it is not preloaded into javascript xpcom code. ...
Creating a Python XPCOM component
as the python loader modifies sys.path. then you can import xpcom in any python module (mostly, in your component). defining the interface make a file named "nsipysimple.idl" to define the interface: #include "nsisupports.idl" [scriptable, uuid(2b324e9d-a322-44a7-bd6e-0d8c83d94883)] interface nsipysimple : nsisupports { attribute string yourname; void write( ); void change(in string avalue); }; this is the same as the nsisimple interface used here. theoretically, because several components can share an interface, the same file could be used. pay special attention to types here - python and javascript are both loosely-typed, so it's fairly easy to pass information from one to the other. note: there are exceptions; see this discussion for information on the use of string and wstring...
... file as a script with the interface name as a param. for example: % cd c:\mozilla\bin\python\xpcom % python xpt.py nsisample class nsisample: _com_interfaces_ = xpcom.components.interfaces.nsisample # if this object needs to be registered, the following 2 are also needed. # _reg_clsid_ = "{a new clsid generated for this object}" # _reg_contractid_ = "the.object.name" def get_value( self ): # result: string pass def set_value( self, param0 ): # result: void - none # in: param0: string pass as you can see, the output is valid python code, with basic signatures and useful comments for each of the methods. testing it to see this work, you will have to start firefox from the command line, since that'll be where the stuff will be prin...
Building the WebLock UI
we can do a check on the string and verify that it's a valid url. in this tutorial, focusing as it is on the weblock functionality (rather than the ui), we'll assume the strings we get from the ui itself are urls we actually want to write to the white list: function addthissite() { var tf = document.getelementbyid("dialog.input"); // weblock is global and declared above weblock.addsite(tf.value); } this javascript function can be called directly from the xul widget, where the input string is retrieved as the value property of the textbox element. you also need to create the function that displays the weblock window itself when the user clicks the weblock icon in the statusbar. that function uses the opendialog method from the window object and takes the url to the xul file in which t...
...ogether creates the toggling ui by requiring that one or another of the elements be selected, but not both. the xul that defines the radiogroup in the web lock manager dialog is this: <radiogroup> <radio label="lock"/> <radio label="unlock" selected="true"/> </radiogroup> since the weblock component always starts up in the unlocked position, you can add the selected="true" attribute and value on the unlock radio button and reset it dynamically as the user takes action. site adding ui the next step is to create that part of the user interface that lets you add a new site to the white list. there are other, more sophisticated ways to do this; you may also want to include some ui that lets you view the white list or edit it as a list. in this part of the tutorial, however, we only prov...
Components.Exception
summary components.exception is a javascript constructor to create nsixpcexception objects. these exception objects may be thrown when implementing xpcom interfaces in javascript, and they can provide better diagnostics in the error console if not caught than simply throwing an nsresult's value will. see also nsixpcexception. ...
...error console if not caught than simply throwing an nsresult's value will. see also nsixpcexception. ...
Components.returnCode
note that components.returncode is currently non-functional due to bug 287107. this problem was introduced in mozilla 1.4. usage components.returncode is a property that can be used to indicate to an xpcom caller of the javascript method that the method is returning a specific nsresult code. generally, xpconnect does a fine job of making it unnecessary for javascript code to worry about nsresult codes. by default the successful completion of the javascript method will cause xpconnect to return a result code of ns_ok to the caller. ...
...nnect does a fine job of making it unnecessary for javascript code to worry about nsresult codes. by default the successful completion of the javascript method will cause xpconnect to return a result code of ns_ok to the caller. if the javascript code needs to signal failure then that is done by throwing an exception. however, there are a very few xpcom interfaces that specify success code return values. components.returncode exists in order to make it possible to implement these rare interfaces in javascript. example var foo = { bar: function(i) { if (yada_yada) components.returncode = 5; return i * 2; } }; ...
Components.utils.exportFunction
t to attach the function to. this does not have to be the global window object: it could be any other object in the target window, or an object created by the caller. options : object optional parameter that supplies additional options. the following options are currently defined: defineas: determines the name of the function in targetscope. if this is omitted, you need to assign the return value of exportfunction() to an object in the target scope. allowcallbacks: deprecated/redundant from firefox 34. this option allows the exported function to accept callbacks as arguments. boolean, defaulting to false. this option is new in firefox 33. from firefox 34 onwards this option has no effect: the exported function is always able to accept callbacks as arguments. allowcrossoriginarguments: d...
...ching the function to the target's global window object, the caller can attach it to any other object in the target context. suppose the content window defines a local variable bar: // page-script.js var bar = {}; now the add-on script can attach the function to bar: // addon-script.js components.utils.exportfunction(greetme, contentwindow.bar, {defineas: "greetme"}); // page-script.js var value = bar.greetme("bob"); console.log(value); // "hello bob" ...
Components.utils
) schedules a garbage collection cycle for some time in the future at which no javascript code is running. this lets you specify a callback so you can be notified once the garbage collection cycle has been performed. setgczeal() sets the level of garbage collection level for full garbage collection. see js_setgczeal for details; this method calls through to that with the specified value as the zeal value. unwaivexrays() undoes waivexrays(): reapplies the xray filtering protection. waivexrays() removes the filtering provided by an xray. properties property type description sandbox nsixpccomponents_utils_sandbox creates sandbox objects for use with evalinsandbox(). ion boolean read only. strict...
...vexrays(): reapplies the xray filtering protection. waivexrays() removes the filtering provided by an xray. properties property type description sandbox nsixpccomponents_utils_sandbox creates sandbox objects for use with evalinsandbox(). ion boolean read only. strict boolean strict mode is enabled. this reflects the value of the javascript environment's option by the same name. read only. strict_mode boolean read only. werror boolean warnings should be treated as errors. this reflects the value of the javascript environment's option by the same name. read only. ...
XPCShell Reference
d, it is executed before any other js files specified. -g this option specifies which gecko runtime environment directory (gredir) to use for xpcom. -i this option turns on the "interactive" mode -s this option toggles the javascript strict option on and off. by default it is off. -v version this allows you to specify a specific version of js to use, and should be set to an integral value specified by the jsversion enumerated type. for instance, specifying -v 180 will set the interpreter to use javascript version 1.8. -w (lower case) this option turns on javascript warnings. -w (upper case) this turns off javascript warnings. the last option listed is the one that takes effect. -x this option toggles the xml option on and off. by default it is off. [scriptfile] th...
...ld produce the following output: $ xpcshell test.js this is a test 0=this 1=is 2=a 3=test xpcshell extensions once you execute xpcshell without a script you'll be at the js> command line. the following are some useful functions that can be invoked from the command line: clear(object) clear() removes all properties from an object. for example, if you created anobject with a property named value and then called clear(anobject), the property value would no longer exist. gc(heapdumpfilename) gc() will invoke garbage collection. it takes an optional argument that can be used to dump the heap to. if specified, it should equate to a valid filename. load(scriptfilename) load() allows you to load and run a script from the command line. for example, load("myscript.js") will execute the...
XPCshell Test Manifest Expressions
xpcshell unit tests are run by specifying them in a manifest file. you can add conditions to tests in order to control when tests get run. the conditions accept a simple boolean expression syntax, described here. operators in order of decreasing precedence: () == != && || literal values booleans: the literal strings true and false. integers: a series of contiguous digits. only decimal integers are supported. ...
...tiguous digits. only decimal integers are supported. strings: any series of characters enclosed in double quotes " or single quotes '. no escape sequences are supported. variables variables are supported as a series of letters, digits or underscores beginning with a letter or an underscore. there are a fixed set of variables provided by the test harness via mozinfo.py, with many of the values initialized at configure time by writemozinfo.py which writes mozinfo.json into the root of the build directory. see also the official docs for this set of variables. note that it currently seems like neither this list nor the one on the official docs is exhaustive, so if you need something and it's not here, best check the source code! os - the operating system on which the test is being run...
NS_InitXPCOM2
« xpcom api reference summary the ns_initxpcom2 function initiates use of xpcom in the calling process. #include "nsxpcom.h" nsresult ns_initxpcom2( nsiservicemanager** aresult, nsifile* abindirectory, nsidirectoryserviceprovider* aappfilelocationprovider ); parameters aresult [out] the resulting xpcom service manager. you may pass null if you are not interested in this return value. the service manager may alternatively be accessed by calling ns_getservicemanager. the resulting interface pointer is addref'd upon return and must either be release'd explicitly or passed to ns_shutdownxpcom when the application is finished with xpcom. abindirectory [in] the directory containing the component registry and runtime libraries. pass null to specify that the current working direc...
...s finished with xpcom. abindirectory [in] the directory containing the component registry and runtime libraries. pass null to specify that the current working directory should be used. aappfilelocationprovider [in] the object to be used by xpcom to locate application specific directories and files (e.g., the user profile, the component registry, etc.). this parameter may be nsnull. return values the ns_initxpcom2 function returns ns_ok if successful. otherwise, it returns an error code. some of the possible errors are documented below: ns_error_not_initialized indicates that static globals were not yet initialized, which may happen if this method is called before xpcom's static initialization code executes. this error may also occur if xpcom is being initialized after ns_shutdownxpc...
NS_InitXPCOM3
statically defined xpcom modules. #include "nsxpcom.h" nsresult ns_initxpcom3( nsiservicemanager** aresult, nsifile* abindirectory, nsidirectoryserviceprovider* aappfilelocationprovider, nsstaticmoduleinfo const* astaticmodules, pruint32 astaticmodulecount ); parameters aresult [out] the resulting xpcom service manager. you may pass null if you are not interested in this return value. the service manager may alternatively be accessed by calling ns_getservicemanager. the resulting interface pointer is addref'd upon return and must either be release'd explicitly or passed to ns_shutdownxpcom when the application is finished with xpcom. abindirectory [in] the directory containing the component registry and runtime libraries. pass null to specify that the current working direc...
... the object to be used by xpcom to locate application specific directories and files (e.g., the user profile, the component registry, etc.). this parameter may be nsnull. astaticmodules [in] an array of nsstaticmoduleinfo objects. passing null causes the default (built-in) static modules to be registered, if present. astaticmodulecount [in] the number of elements in astaticmodules. return values the ns_initxpcom3 function returns ns_ok if successful. otherwise, it returns an error code. some of the possible errors are documented below: ns_error_not_initialized indicates that static globals were not yet initialized, which may happen if this method is called before xpcom's static initialization code executes. this error may also occur if xpcom is being initialized after ns_shutdownxpc...
Core XPCOM functions
...
... ...
NS_ConvertASCIItoUTF16
arinset(const nsstring&, print32) const - source parameters nsstring& astring print32 aoffset equalsignorecase prbool equalsignorecase(const char*, print32) const - source parameters char* astring print32 acount tofloat float tofloat(print32*) const - source perform string to float conversion. ...
...e string. replacechar void replacechar(prunichar, prunichar) - source swaps occurence of 1 string for another parameters prunichar aoldchar prunichar anewchar void replacechar(const char*, prunichar) - source parameters char* aset prunichar anewchar replacesubstring void replacesubstring(const nsstring&, const nsstring&) - source parameters nsstring& atarget nsstring& anewvalue void replacesubstring(const prunichar*, const prunichar*) - source parameters prunichar* atarget prunichar* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing...
NS_ConvertUTF16toUTF8
en string and this string. @param astring is the string to check @param aignorecase tells us how to treat case @param acount tells us how many chars to compare @return boolean parameters char* astring print32 acount tofloat float tofloat(print32*) const - source perform string to float conversion. ...
...s whitespace throughout the string. replacechar void replacechar(char, char) - source swaps occurence of 1 string for another parameters char aoldchar char anewchar void replacechar(const char*, char) - source parameters char* aset char anewchar replacesubstring void replacesubstring(const nscstring&, const nscstring&) - source parameters nscstring& atarget nscstring& anewvalue void replacesubstring(const char*, const char*) - source parameters char* atarget char* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequo...
NS_ConvertUTF8toUTF16
arinset(const nsstring&, print32) const - source parameters nsstring& astring print32 aoffset equalsignorecase prbool equalsignorecase(const char*, print32) const - source parameters char* astring print32 acount tofloat float tofloat(print32*) const - source perform string to float conversion. ...
...e string. replacechar void replacechar(prunichar, prunichar) - source swaps occurence of 1 string for another parameters prunichar aoldchar prunichar anewchar void replacechar(const char*, prunichar) - source parameters char* aset prunichar anewchar replacesubstring void replacesubstring(const nsstring&, const nsstring&) - source parameters nsstring& atarget nsstring& anewvalue void replacesubstring(const prunichar*, const prunichar*) - source parameters prunichar* atarget prunichar* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing...
NS_LossyConvertUTF16toASCII
en string and this string. @param astring is the string to check @param aignorecase tells us how to treat case @param acount tells us how many chars to compare @return boolean parameters char* astring print32 acount tofloat float tofloat(print32*) const - source perform string to float conversion. ...
...s whitespace throughout the string. replacechar void replacechar(char, char) - source swaps occurence of 1 string for another parameters char aoldchar char anewchar void replacechar(const char*, char) - source parameters char* aset char anewchar replacesubstring void replacesubstring(const nscstring&, const nscstring&) - source parameters nscstring& atarget nscstring& anewvalue void replacesubstring(const char*, const char*) - source parameters char* atarget char* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequo...
operator+=
« xpcom api reference summary this operator+= is a shortcut for the append family of functions. self_type& operator+=( const self_type& astring ); parameters astring [in] a nsastring to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. self_type& operator+=( const char_type* adata ); parameters adata [in] a raw character array to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. self_type& operator+=( char_type achar ); parameters achar [in] a character to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. s...
...rator returns a reference back to the object being modified to allow operator chaining. self_type& operator+=( char_type achar ); parameters achar [in] a character to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. see also append parameters astring [in] a nsastring to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. see also append ...
nsAString
lement of the string's internal buffer. endreading the endreading function returns a const char_type pointer to the element just beyond the last element of the string's internal buffer. length the length function returns the number of storage units in the string's internal buffer (not including the null-terminator if present). assign the assign family of functions sets the value of a string's internal buffer. replace the replace family of functions sets the value of a string's internal buffer. append the append family of functions appends a value to the end of a string's internal buffer. insert the insert family of functions inserts a value into a string's internal buffer. cut the cut function removes a section of the string's internal buf...
... not imply a particular character encoding. that is, it may be used to store utf-16 characters, ucs-2 characters, or any random double-byte data. the character encoding in use for a particular nsastring instance depends on the context in which it is used. if used with xpidl, then the character encodings of the corresponding xpidl data types applies. nsastring may even hold data with embedded null values. thus, the length of 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. see, for example, ns_stringgetdata. see also nsastring::length, endreading, ns_stringgetdata, nsembedstring ...
nsAutoString
arinset(const nsstring&, print32) const - source parameters nsstring& astring print32 aoffset equalsignorecase prbool equalsignorecase(const char*, print32) const - source parameters char* astring print32 acount tofloat float tofloat(print32*) const - source perform string to float conversion. ...
...e string. replacechar void replacechar(prunichar, prunichar) - source swaps occurence of 1 string for another parameters prunichar aoldchar prunichar anewchar void replacechar(const char*, prunichar) - source parameters char* aset prunichar anewchar replacesubstring void replacesubstring(const nsstring&, const nsstring&) - source parameters nsstring& atarget nsstring& anewvalue void replacesubstring(const prunichar*, const prunichar*) - source parameters prunichar* atarget prunichar* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing...
nsCAutoString
this string. @param astring is the string to check @param aignorecase tells us how to treat case @param acount tells us how many chars to compare @return boolean parameters char* astring print32 acount tofloat float tofloat(print32*) const - source perform string to float conversion. ...
...ng. replacechar void replacechar(char, char) - source swaps occurence of 1 string for another parameters char aoldchar char anewchar void replacechar(const char*, char) - source parameters char* aset char anewchar replacesubstring void replacesubstring(const nscstring&, const nscstring&) - source parameters nscstring& atarget nscstring& anewvalue void replacesubstring(const char*, const char*) - source parameters char* atarget char* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @para...
nsCString
en string and this string. @param astring is the string to check @param aignorecase tells us how to treat case @param acount tells us how many chars to compare @return boolean parameters char* astring print32 acount tofloat float tofloat(print32*) const - source perform string to float conversion. ...
...s whitespace throughout the string. replacechar void replacechar(char, char) - source swaps occurence of 1 string for another parameters char aoldchar char anewchar void replacechar(const char*, char) - source parameters char* aset char anewchar replacesubstring void replacesubstring(const nscstring&, const nscstring&) - source parameters nscstring& atarget nscstring& anewvalue void replacesubstring(const char*, const char*) - source parameters char* atarget char* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequo...
nsFixedCString
en string and this string. @param astring is the string to check @param aignorecase tells us how to treat case @param acount tells us how many chars to compare @return boolean parameters char* astring print32 acount tofloat float tofloat(print32*) const - source perform string to float conversion. ...
...s whitespace throughout the string. replacechar void replacechar(char, char) - source swaps occurence of 1 string for another parameters char aoldchar char anewchar void replacechar(const char*, char) - source parameters char* aset char anewchar replacesubstring void replacesubstring(const nscstring&, const nscstring&) - source parameters nscstring& atarget nscstring& anewvalue void replacesubstring(const char*, const char*) - source parameters char* atarget char* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequo...
nsFixedString
arinset(const nsstring&, print32) const - source parameters nsstring& astring print32 aoffset equalsignorecase prbool equalsignorecase(const char*, print32) const - source parameters char* astring print32 acount tofloat float tofloat(print32*) const - source perform string to float conversion. ...
...e string. replacechar void replacechar(prunichar, prunichar) - source swaps occurence of 1 string for another parameters prunichar aoldchar prunichar anewchar void replacechar(const char*, prunichar) - source parameters char* aset prunichar anewchar replacesubstring void replacesubstring(const nsstring&, const nsstring&) - source parameters nsstring& atarget nsstring& anewvalue void replacesubstring(const prunichar*, const prunichar*) - source parameters prunichar* atarget prunichar* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing...
nsPromiseFlatCString
en string and this string. @param astring is the string to check @param aignorecase tells us how to treat case @param acount tells us how many chars to compare @return boolean parameters char* astring print32 acount tofloat float tofloat(print32*) const - source perform string to float conversion. ...
...s whitespace throughout the string. replacechar void replacechar(char, char) - source swaps occurence of 1 string for another parameters char aoldchar char anewchar void replacechar(const char*, char) - source parameters char* aset char anewchar replacesubstring void replacesubstring(const nscstring&, const nscstring&) - source parameters nscstring& atarget nscstring& anewvalue void replacesubstring(const char*, const char*) - source parameters char* atarget char* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequo...
nsPromiseFlatString
arinset(const nsstring&, print32) const - source parameters nsstring& astring print32 aoffset equalsignorecase prbool equalsignorecase(const char*, print32) const - source parameters char* astring print32 acount tofloat float tofloat(print32*) const - source perform string to float conversion. ...
...e string. replacechar void replacechar(prunichar, prunichar) - source swaps occurence of 1 string for another parameters prunichar aoldchar prunichar anewchar void replacechar(const char*, prunichar) - source parameters char* aset prunichar anewchar replacesubstring void replacesubstring(const nsstring&, const nsstring&) - source parameters nsstring& atarget nsstring& anewvalue void replacesubstring(const prunichar*, const prunichar*) - source parameters prunichar* atarget prunichar* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing...
nsString
arinset(const nsstring&, print32) const - source parameters nsstring& astring print32 aoffset equalsignorecase prbool equalsignorecase(const char*, print32) const - source parameters char* astring print32 acount tofloat float tofloat(print32*) const - source perform string to float conversion. ...
...e string. replacechar void replacechar(prunichar, prunichar) - source swaps occurence of 1 string for another parameters prunichar aoldchar prunichar anewchar void replacechar(const char*, prunichar) - source parameters char* aset prunichar anewchar replacesubstring void replacesubstring(const nsstring&, const nsstring&) - source parameters nsstring& atarget nsstring& anewvalue void replacesubstring(const prunichar*, const prunichar*) - source parameters prunichar* atarget prunichar* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing...
nsXPIDLCString
en string and this string. @param astring is the string to check @param aignorecase tells us how to treat case @param acount tells us how many chars to compare @return boolean parameters char* astring print32 acount tofloat float tofloat(print32*) const - source perform string to float conversion. ...
...s whitespace throughout the string. replacechar void replacechar(char, char) - source swaps occurence of 1 string for another parameters char aoldchar char anewchar void replacechar(const char*, char) - source parameters char* aset char anewchar replacesubstring void replacesubstring(const nscstring&, const nscstring&) - source parameters nscstring& atarget nscstring& anewvalue void replacesubstring(const char*, const char*) - source parameters char* atarget char* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequo...
nsXPIDLString
arinset(const nsstring&, print32) const - source parameters nsstring& astring print32 aoffset equalsignorecase prbool equalsignorecase(const char*, print32) const - source parameters char* astring print32 acount tofloat float tofloat(print32*) const - source perform string to float conversion. ...
...e string. replacechar void replacechar(prunichar, prunichar) - source swaps occurence of 1 string for another parameters prunichar aoldchar prunichar anewchar void replacechar(const char*, prunichar) - source parameters char* aset prunichar anewchar replacesubstring void replacesubstring(const nsstring&, const nsstring&) - source parameters nsstring& atarget nsstring& anewvalue void replacesubstring(const prunichar*, const prunichar*) - source parameters prunichar* atarget prunichar* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing...
IAccessibleComponent
get] hresult foreground([out] ia2color foreground ); [propget] hresult locationinparent([out] long x, [out] long y ); methods background() returns the background color of this object. [propget] hresult background( [out] ia2color background ); parameters background the returned color is the background color of this object or, if that is not supported, the default background color. return value s_ok. foreground() returns the foreground color of this object. [propget] hresult foreground( [out] ia2color foreground ); parameters foreground the returned color is the foreground color of this object or, if that is not supported, the default foreground color. return value s_ok. locationinparent() returns the location of the upper left corner of the object's bounding box relative to the im...
...as no parent. if the object is not on any screen the returned position is (0,0). [propget] hresult locationinparent( [out] long x, [out] long y ); parameters x the x coordinate of the upper left corner of the object's bounding box relative to the immediate parent object. y the y coordinate of the upper left corner of the object's bounding box relative to the immediate parent object. return value s_ok. ...
IAccessibleImage
tr description ); [propget] hresult imageposition([in] enum ia2coordinatetype coordinatetype, [out] long x, [out] long y ); [propget] hresult imagesize([out] long height, [out] long width ); methods description() returns the localized description of the image. [propget] hresult description( [out] bstr description ); parameters description the localized description of the image. return value s_false if there is nothing to return, [out] value is null. s_ok. imageposition() returns the coordinates of the image. [propget] hresult imageposition( [in] enum ia2coordinatetype coordinatetype, [out] long x, [out] long y ); parameters coordinatetype specifies whether the returned coordinates should be relative to the screen or the parent object. x the x coordinate. y the y coordinate. ...
... if there is nothing to return, [out] value is null. s_ok. imageposition() returns the coordinates of the image. [propget] hresult imageposition( [in] enum ia2coordinatetype coordinatetype, [out] long x, [out] long y ); parameters coordinatetype specifies whether the returned coordinates should be relative to the screen or the parent object. x the x coordinate. y the y coordinate. return value s_ok. imagesize() returns the size of the image in units specified by parent's coordinate system. [propget] hresult imagesize( [out] long height, [out] long width ); parameters height the height of the image. width the width of the image. return value s_ok. ...
amIWebInstallListener
n onwebinstallblocked( in nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstalls, in pruint32 acount optional ); parameters awindow the window that triggered the installs. auri the uri of the site that triggered the installs. ainstalls the addoninstalls that were blocked. acount optional the number of addoninstalls. return value true if the caller should start the installs. onwebinstalldisabled() called when installation by websites is currently disabled. void onwebinstalldisabled( in nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstalls, in pruint32 acount optional ); parameters awindow the window that triggered the installs. auri the uri of the site that trigge...
... ...
amIWebInstaller
-ons to be installed. ahashes the hashes for the add-ons to be installed. anames the names for the add-ons to be installed. aicons the icons for the add-ons to be installed. acallback optional an optional callback to notify about installation success and failure. ainstallcount optional an optional argument including the number of add-ons to install. ...
... add-ons to install. return value true if the installation was successfully started. isinstallenabled() checks if installation is enabled for a web page. boolean isinstallenabled( in astring amimetype, in nsiuri areferer ); parameters amimetype the mime type for the add-on to be installed. areferer the uri of the web page for which to see if installation is allowed. return value true if installation is enabled. ...
mozISpellCheckingEngine
copyright wstring a string indicating the copyright of the engine. not currently used. read only. dictionary wstring the name of the current dictionary used by check() and suggest(). this will be either element from the array returned by getdictionarylist() or an empty string if no dictionary is selected. note: setting this value to a value that doesn't match an existing dictionary throws a ns_error_file_not_found exception. when this attribute's value is changed, a "spellcheck-dictionary-update" notification is sent. if the dictionary was set to "no dictionary" (that is, by specifying an empty string), the observer may select another dictionary before returning. language wstring ...
...irectory( nsifile dir ); parameters dir an nsifile object indicating the directory from which to add dictionaries. check() checks a word to determine if it's spelled correctly. when this changes, the spell checker sends a "spellcheck-dictionary-update" notification. boolean check( in wstring word ); parameters word a word to check for correct spelling. return value returns true if word is spelled correctly according to the dictionary attribute, and returns false if word is 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 b...
mozIStorageStatementCallback
back.idlscriptable 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 handlecompletion(in unsigned short areason); void handleerror(in mozistorageerror aerror); void handleresult(in mozistorageresultset aresultset); constants constant value description reason_finished 0 the statement has finished executing normally. reason_canceled 1 the statement stopped executing because it was canceled. reason_error 2 the statement stopped executing because an error occurred. methods handlecompletion() called when a statement finishes executing. void handlecompletion( in unsigned short are...
...ason_canceled 1 the statement stopped executing because it was canceled. reason_error 2 the statement stopped executing because an error occurred. methods handlecompletion() called when a statement finishes executing. void handlecompletion( in unsigned short areason ); parameters areason the reason the statement stopped executing; see the list of possible values in the constants section. handleerror() called when an error occurs while executing a statement. this function may be called more than once with a different storageierror each time for any given asynchronous statement, and handlecompletion will be called once the statement is complete. void handleerror( in mozistorageerror aerror ); parameters aerror a mozistorageerror object des...
mozIStorageStatementWrapper
initialize(in mozistoragestatement astatement); void reset(); boolean step(); void execute(); attributes attribute type description statement mozistoragestatement the statement that is wrapped. row mozistoragestatementrow the current row. throws an exception if no row is currently available. useful only from script. the value of this is only valid while the statement is still executing, and is still on the appropriate row. params mozistoragestatementparams the parameters; these can be set in lieu of using the call notation on this. methods initialize() this method initializes this wrapper with astatement. void initialize( in mozistoragestatement astatement ); parameters astatement t...
...l notation on this. methods initialize() this method initializes this wrapper with astatement. void initialize( in mozistoragestatement astatement ); parameters astatement the statement to be initialized. reset() this method resets the wrapped statement. void reset(); parameters none. step() this method steps the wrapped statement. boolean step(); parameters none. return value returns true if the stepping the wrapped statement was successful, otherwise returns false. execute() this method executes the wrapped statement. void execute(); parameters none. see also storage mozistoragestatement mozistoragestatementrow mozistoragestatementparams ...
mozIStorageVacuumParticipant
method overview boolean onbeginvacuum(); void onendvacuum(in boolean asucceeded); attributes attribute type description databaseconnection mozistorageconnection a connection to the database file to be vacuumed. expecteddatabasepagesize long the expected page size, in bytes, for the database. the vacuum manager will try to correct the page size when the browser is idle, using this value as a target. valid page sizes are in the range 512 to 65,536. the recommended value is mozistorageconnection::default_page_size. note: if the database is using the wal journal node and the current page size is not the expected one, the journal node will be changed to truncate because wal doesn't allow page size changes. the vacuum manager will try to restore wal mode, but this will only work reli...
...try to restore wal mode, but this will only work reliably if the participant properly resets statements. if the attempt to restore the journal node fails, it will remain truncate. methods onbeginvacuum() called when a vacuum operation begins. once you receive this notification, you should avoid using the database until onendvacuum() is called. boolean onbeginvacuum(); parameters none. return value return true to allow the vacuum operation to proceed, or false if you don't want the database to be vacuumed. you may wish to return false, for example, if you're in the middle of an operation that you don't want to (or can't) interrupt. onendvacuum() called when a vacuum operation ends. void onendvacuum( in boolean asucceeded ); parameters asucceeded true if the vacuum operation was successf...
nsIAboutModule
this interface is implemented to add an 'about:' page. the contract id ends with a parameter that corresponds to the name of the about page. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview unsigned long geturiflags(in nsiuri auri); nsichannel newchannel(in nsiuri auri); constants constant value description uri_safe_for_untrusted_content (1 << 0) a flag that indicates whether a uri is safe for untrusted content. if it is, web pages and so forth will be allowed to link to this about: uri. otherwise, only chrome will be able to link to it. allow_script (1 << 1) a flag that indicates whether script should be enabled for the given about: uri even if it's dis...
...t indicates whether this about: uri doesn't want to be listed in about:about, especially if it's not useful without a query string. methods geturiflags() a method to get the flags that apply to a given about: uri. the uri passed in is guaranteed to be one of the uris that this module registered to deal with. unsigned long geturiflags( in nsiuri auri ); parameters auri return value a combination of the flags above corresponding to the appropriate flags for this about uri. newchannel() constructs a new channel for the about protocol module. nsichannel newchannel( in nsiuri auri ); parameters auri the uri of the new channel. return value a fully constructed channel that will load the about uri. see also on this page is seen how to make a custom about page. the s...
nsIAccessible
3.1 / fennec 1.0) overview this section provides short overview of methods and attributes of this interface. all methods and attributes are grouped by categories. role, states and name these includes main properties used to describe the accessible. nsiaccessible.role to get the role of the accessible nsiaccessible.getstate() to get states of the accessibe nsiaccessible.name, nsiaccessible.value to get the name and the value of the accessible tree navigation you can navigate through the accessible tree by the following methods and attributes. nsiaccessible.parent to get the parent accessible nsiaccessible.nextsibling, nsiaccessible.previoussibling to get sibling accessibles nsiaccessible.firstchild, nsiaccessible.lastchild to get first and last child nsiaccessible.children, nsi...
...d last child in accessible tree. children array of all this element's children. childcount number of accessible children. indexinparent the 0-based index of this accessible in its parent's list of children, or -1 if this accessible does not have a parent. name accessible name -- the main text equivalent for this node. value accessible value -- a number or a secondary text equivalent for this node. widgets that use role attribute can force a value using the valuenow attribute. description accessible description -- long text associated with this node. keyboardshortcut provides localized string of accesskey name, such as alt+d. the modifier may be affected by user and platform pre...
nsIAccessibleDocument
ible parent of a dom node. guaranteed not to return null if the dom node is in a document. nsiaccessible getaccessibleinparentchain( in nsidomnode adomnode, in boolean acancreate ); parameters adomnode the dom node we need an accessible for. acancreate if true, this method can create a new accessible. otherwise, it will return the first cached accessible in the parent chain. return value the first nsiaccessible found by crawling up the dom node to the document root. native code only!getcachedaccessnode obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. returns the access node cached by this document. ...
... feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. returns the access node cached by this document. nsiaccessnode getcachedaccessnode( in voidptr auniqueid ); parameters auniqueid the unique id used to cache the node. this matches up with the uniqueid attribute on nsiaccessnode. return value the nsiaccessnode cached for this particular unique id. getnamespaceuriforid() the namespace for each id that is handed back. astring getnamespaceuriforid( in short namespaceid ); parameters namespaceid the id of the name space. return value the name space for given id. see also nsiaccessible nsiaccessibleevent nsiaccessnode ...
nsIAccessibleEvent
ent the nsiaccessibledocument that the event target nsiaccessible resides in. this can be used to get the dom window, the dom document and the window handler, among other things. read only. domnode nsidomnode the nsidomnode associated with the event. may return null if accessible for event has been shut down. read only. eventtype unsigned long the type of event, based on the enumerated event values defined in this interface. read only. isfromuserinput boolean returns true if the event was caused by explicit user input, as opposed to purely originating from a timer or mouse movement. constants constant gecko version description 1.7 - 1.8.1 1.9 - 1.9.2 2.0 event_show 0x8002 0x0001 an object has been created. event_hide 0x8003 0x0002 an object has been destroyed. event_re...
...0x0008 0x0005 an object has received the keyboard focus. event_state_change 0x800a 0x0009 0x0006 an object's state has changed. event_location_change 0x800b 0x000a 0x0007 an object has changed location, shape, or size. event_name_change 0x800c 0x000b 0x0008 an object's name property has changed. event_description_change 0x000c 0x0009 an object's description property has changed. event_value_change 0x800e 0x000d 0x000a an object's value property has changed. event_help_change 0x000e 0x000b an object's help has changed. event_defaction_change 0x000f 0x000c an object's default action has changed. event_action_change 0x0010 0x000d an object's action has changed. event_accelerator_change 0x0011 0x000e an object's keyboard shortcut has changed. event_selection 0x8006 0x0...
nsIAccessibleRelation
unsigned long index); nsiarray gettargets(); attributes attribute type description relationtype unsigned long returns the type of the relation. read only. targetscount unsigned long returns the number of targets for this relation. read only. constants constant value description relation_nul 0x00 relation_controlled_by 0x01 some attribute of this object is affected by a target object. relation_controller_for 0x02 this object is interactive and controls some attribute of a target object. relation_label_for 0x03 this object is label for a targ...
...et object. relation_default_button 0x4000 part of a form/dialog with a related default button. it is used for msaa only, no for ia2 nor atk/at-spi. methods gettarget() returns accessible relation target at the given index. nsiaccessible gettarget( in unsigned long index ); parameters index zero-based index of relation target. return value returns an nsiaccessible object. exceptions thrown ns_error_invalid_arg indicates the given index is out of range. gettargets() returns an array of accessible relation targets. nsiarray gettargets(); parameters none. return value an nsiarray object, each item in the array implements an nsiaccessible. ...
nsIAccessibleStateChangeEvent
...
... ...
nsIAccessibleStates
accessible/public/nsiaccessiblestates.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) prior to gecko 1.9, these constants were implemented in nsiaccessible. constants state constants msaa state flags - used for bitfield. more than 1 allowed. constant value description state_unavailable 0x00000001 the object is unavailable, that is disabled. state_selected 0x00000002 the object is selected, that is it indicates this object is the child of an object that allows its children to be selected and that this child is one of those children that has been selected. state_focused 0x00000004 the object is focused. state_pressed 0x00000008 the object is pressed. stat...
...nome's role* atk_role_passwd_text, nothing for java? state_haspopup 0x40000000 new in msaa 2.0. state_required state_alert_low state_important state_alert_medium currently unused. state_invalid state_alert_high indicates a validation failure. state_checkable state_marqueed extended state constants extended state flags (for now non-msaa, for java and gnome/atk support) constant value description ext_state_supports_autocompletion 0x00000001 for editable areas that have any kind of auto completion. ext_state_defunct 0x00000002 object no longer exists. ext_state_selectable_text 0x00000004 for text which is selectable, object must implement nsiaccessibletext. ext_state_editable 0x00000008 implements nsiaccessibleeditabletext. ext_state_active 0x00000010 this window is c...
nsIAlertsService
ener callbacks. alertlistener optional an object to receive callbacks from the alert; may be null if you don't care about callbacks. it must implement an observe() method that accepts three parameters: subject: always null. topic: "alertfinished" when the alert disappears, "alertclickcallback" if the user clicks the text or "alertshow" (since gecko 22) when the alert is shown. data: the value of the cookie parameter passed into the showalertnotification method. name optional a name for the notification; this is not displayed in the alert. however, certain notification systems (such as growl on mac os x) allow the user to disable alerts by name. this name is used in that configuration panel. on android the name is hashed and used as a notification id. dir optional bidi overri...
... passed into the showalertnotification method. name optional a name for the notification; this is not displayed in the alert. however, certain notification systems (such as growl on mac os x) allow the user to disable alerts by name. this name is used in that configuration panel. on android the name is hashed and used as a notification id. dir optional bidi override for the title. valid values are "auto", "ltr" or "rtl". only available on supported platforms. lang optional language of title and text of the alert. only available on supported platforms. data optional the value of the cookie parameter passed to showalertnotification. principal optional the principal of the page that created the alert. used for ipc security checks, and to determine whether the alert is actionable. ...
nsIAnnotationObserver
is empty, then all annotations for the given item have been deleted. this is not called when annotations are expired (normally happens when the application exits). void onitemannotationremoved( in long long aitemid, in autf8string aname ); parameters aitemid the item whose annotation is to be deleted. aname the annotation name. onitemannotationset() this method is called when an annotation value is set for an item. it could be a new annotation, or it could be a new value for an existing annotation. void onitemannotationset( in long long aitemid, in autf8string aname ); parameters aitemid the item on which the annotation is to be set. aname the annotation name. onpageannotationremoved() called when an annotation is deleted for a uri. if aname is empty, then all annotations for the ...
.... if aname is empty, then all annotations for the given uri have been deleted. this is not called when annotations are expired (normally happens when the application exits). void onpageannotationremoved( in nsiuri auri, in autf8string aname ); parameters auri the uri whose annotation is to be deleted. aname the annotation name. onpageannotationset() this method is called when an annotation value is set for a uri. it could be a new annotation, or it could be a new value for an existing annotation. void onpageannotationset( in nsiuri apage, in autf8string aname ); parameters apage the uri on which the annotation is to be set. aname the annotation name. see also places using the places annotation service using the places favicon service nsiannotationservice ...
nsIApplicationCache
r this application cache. clients can open a session with nsicacheservice.createsession() using this client id and a storage policy of store_offline to access this cache. read only. groupid acstring the group id for this cache group. this is the uri of the cache manifest file. read only. usage unsigned long the disk usage of the application cache, in bytes. read only. constants constant value description item_manifest 1 this item is the application manifest. item_explicit 2 this item was explicitly listed in the application manifest. item_implicit 4 this item was navigated to in a top level browsing context, and named this cache's group as its manifest. item_dynamic 8 this item was added to the cache using the dynamic scripting api. item_foreign 16 this item was listed in th...
...t on return, indicates how many matching entries were found. keys an array of the keys matching one or more of the types indicated by typebits. getmatchingnamespace() returns the most specific namespace matching a given key. nsiapplicationcachenamespace getmatchingnamespace( in acstring key ); parameters key the key for the cache entry whose most specific namespace is to be returned. return value an nsiapplicationcachenamespace object describing the most specific namespace matching the given key. gettypes() gets the types for a given entry in the cache. unsigned long gettypes( in acstring key ); parameters key the key for the cache entry whose types you wish to retrieve. return value a bit field indicating the entry's types. see constants for a list of types. initashandle() init this...
nsIApplicationCacheChannel
m: nsiapplicationcachecontainer last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void markofflinecacheentryasforeign(); attributes attribute type description chooseapplicationcache boolean when true, the channel will choose an application cache if one was not explicitly provided and none is available from the notification callbacks. the default value is false. this attribute will not be transferred through a redirect. exceptions thrown ns_error_already_opened if set after calling asyncopen() on the channel. inheritapplicationcache boolean true if the channel will ask its notification callbacks for an application cache if one is not explicitly provided. the default value is true. exceptions thrown ns_error_already_opened if set after ca...
...read only. ...
nsIApplicationCacheService
in nsiapplicationcache cache, in acstring key ); parameters cache the cache in which the entry is currently cached. key the cache entry's key. chooseapplicationcache() tries to find the best application cache to serve a specified resource. nsiapplicationcache chooseapplicationcache( in acstring key ); parameters key the cache entry key for which to select an application cache. return value the nsiapplicationcache best able to serve the resource indicated by the key parameter. createapplicationcache() creates a new, empty application cache for the specified cache group. nsiapplicationcache createapplicationcache( in acstring group ); parameters group the cache group for which to create an application cache. return value the newly-created nsiapplicationcache. deactivategroup() d...
...up() deactivates the currently active cache object for the specified cache group. void deactivategroup( in acstring group ); parameters group the cache group to deactivate. getactivecache() returns the currently active cache object for a cache group. nsiapplicationcache getactivecache( in acstring group ); parameters group the cache group for which to return an application cache. return value the currently active cache object for the cache group. getapplicationcache() returns the nsiapplicationcache object for the specified client id. nsiapplicationcache getapplicationcache( in acstring clientid ); parameters clientid the client id for which to return the application cache object. return value the application cache object for the specified client id. getgroups() returns the list ...
nsIApplicationUpdateService
at will be notified of state and progress information as the update is downloaded. downloadupdate() starts downloading a software update. astring downloadupdate( in nsiupdate update, in boolean background ); parameters update an nsiupdate object indicating the update to download. background true to download the update in the background or false to download it in the foreground. return value a string indicating the status of the update upon return: "downloading" the update is being downloaded. "pending" the update is ready to be applied. "applying" the update is in the process of being applied. "succeeded" the update has been installed successfully. "download-failed" the update failed to be downloaded. "failed" installing the update failed. pausedownload() pauses the currently acti...
...r ); parameters listener the listener object to remove. selectupdate() selects the best update to install from a provided list of available updates. nsiupdate selectupdate( [array, size_is(updatecount)] in nsiupdate updates, in unsigned long updatecount ); parameters updates an array of updates that are available to install. updatecount the number of updates in the updates array. return value an nsiupdate object indicating the most appropriate update to install. see also nsiupdate nsiupdatechecklistener nsiupdatechecker nsiupdatepatch nsiupdatemanager nsiupdateprompt nsiupdatetimermanager ...
nsIAsyncStreamCopier
init( in nsiinputstream asource, in nsioutputstream asink, in nsieventtarget atarget, in boolean asourcebuffered, in boolean asinkbuffered, in unsigned long achunksize, in boolean aclosesource, in boolean aclosesink ); parameters asource contains the data to be copied. asink specifies the destination for the data. atarget specifies the thread on which the copy will occur. ...
...aclosesource true if asource should be closed after copying. aclosesink true if asink should be closed after copying. ...
nsICacheService
cifies the name of the client using the cache. storagepolicy limits the storage policy for all entries accessed via the returned session. as a result, devices excluded by the storage policy will not be searched when opening entries from the returned session. streambased indicates whether or not the data being cached can be represented as a stream. the storagepolicy must be consistent with the value of this field. for example, a non-stream-based cache entry can only have a storage policy of store_in_memory. return value returns a new cache session. createtemporaryclientid() obsolete since gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to ...
...s method creates and returns a unique, temporary cache client id. this is used by the offline cache. the offline cache lets clients accumulate entries in a temporary client and merge them in as a group using nsiofflinecachesession.mergetemporaryclient(). acstring createtemporaryclientid( in nscachestoragepolicy storagepolicy ); parameters storagepolicy the cache storage policy. return value returns a newly created unique, temporary cache client id. exceptions thrown ns_error_not_implemented this method is deprecated. evictentries() this method evicts all entries in all devices implied by the storage policy. note: this function may evict some items but will throw if it fails to evict everything. void evictentries( in nscachestoragepolicy storagepolicy ); parameters ...
nsICacheSession
stener to be notified (may be null). evictentries() this method evicts all entries for this session's clientid according to its storagepolicy. void evictentries(); parameters none. isstorageenabled() this method checks if the cache devices implied by the session storage policy are currently enabled for instantiation if they don't already exist. prbool isstorageenabled(); parameters none. return value returns whether any of the cache devices implied by the session storage policy are currently enabled for instantiation or not, depending on their existence. opencacheentry() this method gives a synchronous cache access. it returns a unique descriptor each time it is called, even if the same key is specified. when called by multiple threads for write access, only one writable descriptor will be gr...
...ptor with write access to a given cache entry at a time. until the client calls markvalid on its descriptor, other attempts to open the same cache entry will block. nsicacheentrydescriptor opencacheentry( in acstring key, in nscacheaccessmode accessrequested, in boolean blockingmode ); parameters key the key for cache entry. accessrequested the requested access. blockingmode true or false value to turn blocking mode for calling the thread to on/off respectively. return value returns a unique descriptor each time it is called. see also nsicache nsicacheentrydescriptor nsicachelistener nsicacheservice ...
nsICacheVisitor
in nsicachedeviceinfo deviceinfo); boolean visitentry(in string deviceid, in nsicacheentryinfo entryinfo); methods visitdevice() this method is called to provide information about a cache device. boolean visitdevice( in string deviceid, in nsicachedeviceinfo deviceinfo ); parameters deviceid specifies the device being visited. deviceinfo specifies information about this device. ...
...eturn value returns true to start visiting all entries for this device, otherwise returns false to advance to the next device. visitentry() this method is called to provide information about a cache entry. boolean visitentry( in string deviceid, in nsicacheentryinfo entryinfo ); parameters deviceid specifies the device being visited. entryinfo specifies information about this entry. return value returns true to visit the next entry on the current device, or if the end of the device has been reached, advance to the next device, otherwise returns false to advance to the next device. see also nsicache nsicachedeviceinfo nsicacheentryinfo ...
nsIChannelEventSink
uses a callback to handle redirects asynchronously. method overview void asynconchannelredirect(in nsichannel oldchannel, in nsichannel newchannel, in unsigned long flags, in nsiasyncverifyredirectcallback callback); void onchannelredirect(in nsichannel oldchannel, in nsichannel newchannel, in unsigned long flags); obsolete since gecko 2.0 constants constant value description redirect_temporary 1 << 0 this is a temporary redirect. new requests for this resource should continue to use the uri of the old channel. the new uri may be identical to the old one. redirect_permanent 1 << 1 this is a permanent redirect. new requests for this resource should use the uri of the new channel (this might be an http 301 repon...
.... it is important to understand that oldchannel will continue loading as if it received a response of http 200, which includes notifying observers and possibly display or process content attached to the http response. if the sink wants to prevent this loading it must explicitly deal with it, e.g. by calling oldchannel->cancel() there is a certain freedom in implementing this method: if the return-value indicates success, a callback on callback is required. this callback can be done from within asynconchannelredirect() (effectively making the call synchronous) or at some point later (making the call asynchronous). if the return value indicates that an error occurred, in which case an exception is thrown, the redirect is vetoed and no callback must be done. void asynconchannelredirect( in nsich...
nsICollection
pruint32 index, in nsisupports item); methods appendelement() appends a new item to the collection. void appendelement( in nsisupports item ) parameters item nsisupports item to be appended to the list. clear() removes all items from the collection. void clear(); parameters none. count() returns the number of items in the collection. pruint32 count(); parameters none. return value number of items in the list. enumerate() returns an nsienumerator that lets you iterate over the items in the collection. nsienumerator enumerate(); parameters none. return value an nsienumerator. getelementat() returns the element at the specified index into the collection. nsisupports getelementat( in pruint32 index ); parameters index the index position of the item to be returned.
...queryelementat() performs a queryinterface on the item at the specified index into the collection. ...
nsICommandLineHandler
dlinehandler.idlscriptable handles arguments on the command line of a xul application. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) each command line handler is registered in the category "command-line-handler". ...
...(firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) each command line handler is registered in the category "command-line-handler". the entries in this category are read in alphabetical order, and each category value is treated as a service contract id implementing this interface. by convention, handlers with ordinary priority should begin with "m". ...
nsIContentSniffer
ially, 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(alength)] in octet adata, in unsigned long alength ); parameters arequest the request where this data came from. may be null. adata data to check. alength length of the data. ...
...in octet adata, in unsigned long alength ); parameters arequest the request where this data came from. may be null. adata data to check. alength length of the data. return value the content type. example how to read content from adata. ...
nsIContentView
nscontentviewid id that can be used in conjunction with nsidomwindowutils to change the actual document, instead of just how it is transformed; this is a 64-bit unsigned integer. read only. scrollx float horizontal scroll offset in chrome-document css pixels. when this view is active (that is it is being painted because it's in the visible region of the screen), this value is at first lined up with the content's scroll offset. note: when this view becomes inactive, the new content view will have scroll values that are reset to the default. read only. scrolly float horizontal scroll offset in chrome-document css pixels. read only. viewportheight float height of the viewport in chrome-document css pixels. read only. ...
...y. viewportwidth float width of the viewport in chrome-document css pixels. read only. methods scrollby() scrolls the content view by the specified number of chrome-document css pixels along each axis. fails if the view isn't valid. void scrollby( in float dxpx, in float dypx ); parameters dxpx the number of css pixels to scroll on the x axis; specify a positive value to scroll to the right or a negative value to scroll to the left. dypx the number of css pixels to scroll on the y axis; specify a positive value to scroll down or a negative value to scroll up. scrollto() scrolls the content view to the specified position, in chrome-document css pixels. fails if the view isn't valid. void scrollto( in float xpx, in float ypx ); parameters xpx the...
nsIController
mentation should execute the command with the specified name. void docommand( in string command ); parameters command the name of the command to execute. iscommandenabled() implement this method to indicate whether or not the specified command is enabled. boolean iscommandenabled( in string command ); parameters command the name of the command whose availability is to be checked. return value return true if the specified command is currently available to be used; otherwise, it should return false. onevent() implement this method to process the event with the specified name. void onevent( in string eventname ); parameters eventname the name of the event to process. supportscommand() implement this method to report whether or not the command with the specified name is supported. bo...
...rocess the event with the specified name. void onevent( in string eventname ); parameters eventname the name of the event to process. supportscommand() implement this method to report whether or not the command with the specified name is supported. boolean supportscommand( in string command ); parameters command the name of the command to determine whether or not it is supported. return value true if the specified command is supported; otherwise false. see also nsicommandcontroller nsicontrollers xul tutorial/commands ...
nsICookiePromptService
o accept the cookie. extensions/cookie/nsicookiepromptservice.idlscriptable please add a summary to this article. last changed in gecko 1.9 (firefox 3) inherits from: nsisupports method overview long cookiedialog(in nsidomwindow parent, in nsicookie cookie, in acstring hostname, in long cookiesfromhost, in boolean changingcookie, out boolean rememberdecision); constants constant value description deny_cookie 0 holds the value for a denying the cookie. accept_cookie 1 holds the value for accepting the cookie. accept_session_cookie 2 holds the value for accepting the session cookie. methods cookiedialog() opens a dialog that asks for permission to accept a cookie. long cookiedialog( in nsidomwindow parent, in nsicookie cookie, in acstring hostname, in long ...
... parameters parent the parent window for the dialog. cookie the cookie about which permission is being requested. hostname the host that wants to set the cookie, not the domain; this is part of the cookie. cookiesfromhost the number of cookies there are already for this host. changingcookie are we changing this cookie? rememberdecision should we set the matching permission for this host? return value returns 0 for denying a cookie, 1 for accepting a cookie, and 2 for accepting cookie for the current session only. see also nsicookie nsicookie2 nsicookiemanager nsicookiemanager2 ...
nsIDNSRecord
erits from: nsisupports last changed in gecko 1.7 method overview prnetaddr getnextaddr(in pruint16 aport); native code only! acstring getnextaddrasstring(); boolean hasmore(); void rewind(); attributes attribute type description canonicalname acstring for example, www.mozilla.org --> rheet.mozilla.org. read only. methods native code only!getnextaddr this function copies the value of the next ip address into the given prnetaddr struct and increments the internal address iterator. prnetaddr getnextaddr( in pruint16 aport ); parameters aport a port number to initialize the prnetaddr with. return value the value of the next ip address. getnextaddrasstring() this function returns the value of the next ip address as a string and increments the internal address iterator. ac...
... and increments the internal address iterator. prnetaddr getnextaddr( in pruint16 aport ); parameters aport a port number to initialize the prnetaddr with. return value the value of the next ip address. getnextaddrasstring() this function returns the value of the next ip address as a string and increments the internal address iterator. acstring getnextaddrasstring(); parameters none. return value the value of the next ip address as a string. hasmore() this method checks if there is another address in the record. boolean hasmore(); parameters none. return value true if there is another address in the record. rewind() this function resets the internal address iterator to the first address in the record. void rewind(); parameters none. ...
nsIDOMChromeWindow
cription browserdomwindow nsibrowserdomwindow the related nsibrowserdomwindow instance which provides access to yet another layer of utility functions by chrome script. it will be null for domwindows not corresponding to browsers. messagemanager nsichromeframemessagemanager read only. title domstring obsolete since gecko 1.9.1 windowstate unsigned short returns current window state, the value is one of state_* constants. read only. constants constant value description state_maximized 1 the window is maximized. state_minimized 2 the window is minimized. state_normal 3 the window is normal. state_fullscreen 4 the window is in full screen mode. methods beginwindowmove() on some operating systems, we must allow the window manager to handle window dragging. this method te...
...ion of the window. void restore(); parameters none. setcursor() sets the mouse cursor to the specified cursor. the mouse cursor is locked to the specified cursor if it's not "auto". at that time, the cursor has been never changed by cursor moving. after you call this method with "auto", the cursor will be unlocked. void setcursor( in domstring cursor ); parameters cursor you can specify same values of css cursor property (including -moz- prefixed values). and there are special values: "grab", "grabbing" and "spinning". but they might be dropped in the future version, if you use the values, you should use -moz-* value instead. ...
nsIDOMHTMLAudioElement
ot use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. returns the current offset of the audio stream, specified as the number of samples that have played since the beginning of the stream. unsigned long long mozcurrentsampleoffset(); parameters none. return value an unsigned 64-bit value indicating how many audio samples have been played since the stream began playing. mozsetup() non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future...
...ream should use. specify 1 for mono or 2 for stereo. rate the sampling rate to use on the stream, in samples per second. for example, specify 44100 for 44.1khz. mozwriteaudio() writes samples to the audio stream. unsigned long mozwriteaudio( in jsval data ); parameters data the samples to write into the audio stream, specified either as a javascript array or as a numeric typed array. return value the actual number of bytes written to the stream. exceptions thrown ns_error_dom_invalid_state_err the stream has not been initialized for writing by a call to mozsetup(). ns_error_dom_type_mismatch_err the data isn't a valid data type (an array or typed array of numeric values). ns_error_dom_index_size_err the number of samples specified doesn't divide evenly across the number of channels; you ...
nsIDOMHTMLSourceElement
criptable please add a summary to this article. last changed in gecko 1.9.1.2 inherits from: nsidomhtmlelement the source element allows authors to specify multiple media resources for media elements. it does not specify anything on its own. attributes attribute type description src domstring the src attribute gives the address of the media resource. the value must be a valid url. this attribute must be present. note that dynamically manipulating this value after the page has loaded has no effect on the containing element; instead, change the src attribute of that element (audio or video) instead. type domstring the type attribute gives the type of the media resource, to help the user agent determine if it can play this media resource be...
... must be present. note that dynamically manipulating this value after the page has loaded has no effect on the containing element; instead, change the src attribute of that element (audio or video) instead. type domstring the type attribute gives the type of the media resource, to help the user agent determine if it can play this media resource before fetching it. if specified, its value must be a valid mime type. the codecs parameter may be specified and might be necessary to specify exactly how the resource is encoded. media unimplemented domstring the media attribute gives the intended media type of the media resource, to help the user agent determine if this media resource is useful to the user before fetching it. its value must be a valid media query. e...
nsIDOMHTMLTimeRanges
); 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 the timeline represented by the object. exceptions thrown index_size_err the specified index is not valid. start() returns the time offset to the start of the specified time range. float start( in unsigned long index ); parameters index the index to the time range whose start time is to be returned. retur...
...he time at which the specified range ends, in seconds measured from the beginning of the timeline represented by the object. exceptions thrown index_size_err the specified index is not valid. start() returns the time offset to the start of the specified time range. float start( in unsigned long index ); parameters index the index to the time range whose start time is to be returned. return value the time at which the specified range starts, in seconds measured from the beginning of the timeline represented by the object. exceptions thrown index_size_err the specified index is not valid. ...
nsIDOMParser
tionally, call parser.init(principal, documenturi, baseuri); principals, document and base uri note: this section covers changes introduced to domparser in gecko 1.9. (this section is only relevant to firefox extensions--not to web content.) to create a document, the parser needs to specify a principal (see security check basics), a base uri (see document.baseuriobject), and a documenturi. these values are automatically determined as defined below, but if you work with domparser from privileged code, you can override the defaults by providing arguments to the domparser constructor or calling parser.init(). usually you don't need to do that. if you come across a situation when these matter, feel free to ask questions in mozilla.dev.tech.dom and update this documentation to mention these cases. ...
...rmally inherited. the second parameter is the documenturi to use. the third parameter is the baseuri to use. if you instantiate a domparser by calling createinstance(), and you don't call the domparser's init() method, attempting to initiate a parsing operation will automatically call init() on the domparser with a null principal and null pointers for documenturi and baseuri. cases where these values matter: if you don't specify the document uri by calling init() after creating the parser via createinstance() the created documents will use a moz-nullprincipal:{<guid>} uri, which will show in the error console in parsing errors, in particular. supposedly, if you want to create objects that some particular set of unprivileged code will be able to access (see discussion in bug 565480). parsin...
nsIDOMProgressEvent
ize of the transfer is known. read only. loaded unsigned long long the number of bytes transferred since the beginning of the operation. this doesn't include headers and other overhead, but only the content itself. read only. total unsigned long long the total number of bytes of content that will be transferred during the operation. if the total size is unknown, this value is zero. read only. methods initprogressevent() deprecated since gecko 22.0 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. void initprogressevent( in domstring typearg, in boolean canbubblearg, in boolean cancel...
...f "abort", "error", "load", "loadstart", or "progress". canbubblearg specifies whether or not the created event will bubble. cancelablearg specifies whether or not the created event can be canceled. lengthcomputablearg if the size of the data to be transferred is known, this should be true. otherwise, specify false. loadedarg the number of bytes already transferred. must be a non-negative value. totalarg the total number of bytes to be transferred. if lengthcomputable is false, this must be zero. see also using xmlhttprequest xmlhttprequest nsixmlhttprequesteventtarget nsixmlhttprequest ...
nsIDOMStorageManager
ocalstorageforprincipal() returns the instance of the localstorage object for auri's origin. this is used to ensure that only one local storage area exists for a given origin. nsidomstorage getlocalstorageforprincipal( nsiprincipal aprincipal, domstring adocumenturi ); parameters aprincipal the principal for which to return the local storage object. adocumenturi the document's uri. ...
... storage object. adocumenturi the document's uri. return value the local storage object for the specified principal. getusage() returns the amount of disk space used by a domain. usage is checked against the domain of the page that set the key (the owner domain), not the domain of the storage object. long getusage( astring aownerdomain ); parameters aownerdomain the domain to check. ...
nsIDeviceMotionData
uced gecko 1.9.2 inherits from: nsisupports last changed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) note: this interface was named nsidevicemotiondata prior to gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3). ...
...efox 6.0 / thunderbird 6.0 / seamonkey 2.3). attributes attribute type description type unsigned long the type of motion data reported by this object; see motion type constants for possible values. read only. x double the amount of tilt along the x axis. read only. y double the amount of tilt along the y axis. read only. z double the amount of tilt along the z axis. read only. the values of x, y, and z can range from -1 to 1, where 0 means the device is balanced on that axis. see accelerometer values explained for details. constants motion type constants constant value description type_acceleration 0 the motion data describes device acceleration. type_orientation 1 the motion data describes a device orientation chang. see also mozorientation nsidomorientationevent n...
nsIDialogParamBlock
( in print32 inindex, in wstring instring); attributes attribute type description objects nsimutablearray a place where you can store an nsimutablearray to pass nsisupports. methods getint() get a previously set integer. print32 getint( in print32 inindex ); parameters inindex the index of the integer to get. must be in the range 0..7. ...
...setint() void setint( in print32 inindex, in print32 inint ); parameters inindex the index of the integer to set. must be in the range 0..7. ...
nsIDragService
dragdrop_action_copy 1 the drag and drop operation should copy the object. dragdrop_action_move 2 the drag and drop operation should move the object. dragdrop_action_link 4 the drag and drop operation should link the object. dragdrop_action_uninitialized 64 the action is not...
...vailable only from native code since gecko 43. [noscript] void firedrageventatsource( in mozilla::eventmessage aeventmessage ); parameters aeventmessage one of the event messages between edragdropeventfirst and edragdropeventlast defined in widget/eventmessagelist.h getcurrentsession() returns the current nsidragsession. nsidragsession getcurrentsession(); parameters none. return value the current drag session, or null if no drag is in progress. invokedragsession() starts a modal drag session with an array of transferables void invokedragsession( in nsidomnode adomnode, in nsisupportsarray atransferables, in nsiscriptableregion aregion, in unsigned long aactiontype ); parameters adomnode the source node on which the drag gesture was started. atransferables a...
nsIEditorMailSupport
nserttextwithquotations(in domstring astringtoinsert); void pasteascitedquotation(in astring acitation, in long aselectiontype); void pasteasquotation(in long aselectiontype); void rewrap(in boolean arespectnewlines); void stripcites(); methods getembeddedobjects() get a list of img and object tags in the current document. nsisupportsarray getembeddedobjects(); parameters none. return value an nsisupportsarray containing the img and object tags of the current document. insertascitedquotation() insert a string as quoted text (whose representation is dependent on the editor type), replacing the selected text (if any), including, if possible, a "cite" attribute. nsidomnode insertascitedquotation( in astring aquotedtext, in astring acitation, in boolean ainserthtml ); parameters ...
...se representation is dependent on the editor type), replacing the selected text (if any), including, if possible, a "cite" attribute. nsidomnode insertascitedquotation( in astring aquotedtext, in astring acitation, in boolean ainserthtml ); parameters aquotedtext the actual text to be quoted. acitation the "mid" url of the source message. ainserthtml insert as html? (vs plaintext) return value the nsidomnode which was inserted. insertasquotation() insert a string as quoted text (whose representation is dependent on the editor type), replacing the selected text (if any). nsidomnode insertasquotation( in astring aquotedtext ); parameters aquotedtext the actual text to be quoted. return value the nsidomnode which was inserted. inserttextwithquotations() inserts a plain text string at...
nsIErrorService
module); void unregistererrorstringbundlekey(in nsresult error); methods geterrorstringbundle() retrieves a string bundle url for an error module. string geterrorstringbundle( in short errormodule ); parameters errormodule the module for which the string bundle is registered. error modules are obtained from nsresult code with ns_error_get_module. return value the url of the string bundle registered for that module. geterrorstringbundlekey() retrieves a key in a string bundle for an nsresult error code. if no key is registered for the specified nsresult, then the caller should use the nsresult's code (obtained with ns_error_get_code) instead. string geterrorstringbundlekey( in nsresult error ); parameters error the nsresult for which ...
...module. geterrorstringbundlekey() retrieves a key in a string bundle for an nsresult error code. if no key is registered for the specified nsresult, then the caller should use the nsresult's code (obtained with ns_error_get_code) instead. string geterrorstringbundlekey( in nsresult error ); parameters error the nsresult for which the string bundle key is to be retrieved. return value the key to use to retrieve the error string from the nsresult's module's string bundle. registererrorstringbundle() registers a string bundle url for an error module. void registererrorstringbundle( in short errormodule, in string stringbundleurl ); parameters errormodule the module for which the string bundle is to be registered. should be one of the modules listed in xpcom/b...
nsIEventListenerInfo
is in capture mode. read only. insystemeventgroup boolean indicates whether or not the event listener is in the system event group. read only. type astring the type of the event for which the listener was added. read only. methods getdebugobject() returns the debugger object if the debug service is active. nsisupports getdebugobject(); parameters none. return value if jsdidebuggerservice is active and the listener is implemented in js, this returns the listener as a jsdivalue. otherwise null. this is the method you should use if you want to get access to the actual listener, but the debugger service must be already active, which significantly slows down script execution. accordingly, this should probably only be used by real debuggers. this approach is nece...
...ly slows down script execution. accordingly, this should probably only be used by real debuggers. this approach is necessary because event listeners added with addeventlistener won't necessarily be nsieventlisteners; the dom code will fix up ordinary javascript functions to act as listeners. tosource() tries to serialize the event listener to a string. astring tosource(); parameters none. return value returns a string describing the event listener, or null if serialization isn't possible (for example, if the listener was written in c++). remarks nsieventlistenerinfo was introduced with bug 448602. see also nsieventlistenerservice nsieventtarget ...
nsIEventTarget
when this flag is specified, dispatch() returns immediately after the event is queued. dispatch_sync 1 this flag specifies the synchronous mode of event dispatch, in which the dispatc...
...ptions thrown ns_error_unexpected indicates that the thread is shutting down and has finished processing events, so this event would never run and has not been dispatched. ns_error_invalid_arg indicates that event is null. isoncurrentthread() check to see if this event target is associated with the current thread. boolean isoncurrentthread(); parameters none. return value returns true if events dispatched to this event target will run on the current thread (that is, the thread calling this method). if events dispatched to this target will be processed on another thread, returns false. native code only!postevent obsolete since gecko 1.9 (firefox 3)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be remov...
nsIExternalHelperAppService
determines whether or not data whose filename has the specified extension should be decoded from the specified encoding type before being saved or delivered to helper applications. boolean applydecodingforextension( in autf8string aextension, in acstring aencodingtype ); parameters aextension the filename extension to check. aencodingtype the encoding type to check. return value true if data from urls with the specified extension and encoding should be decoded prior to saving the file or delivering it to a helper application; otherwise false. docontent() binds an external helper application to a stream listener. the caller should pump data into the returned stream listener. when the onstoprequest is issued, the stream listener implementation will launch the helper app wi...
...ontent type of the incoming data. arequest the request corresponding to the incoming data. awindowcontext use nsiservicemanager.getinterface() to retrieve properties like the dom window or parent window; the service might need this in order to bring up dialogs. aforcesave true to always save this content to disk, regardless of nsimimeinfo and other such influences. return value a nsistreamlistener which the caller should pump the data into. ...
nsIFeed
ch entry in the array is the name of one day of the week to skip. for example, to skip fetching on mondays, a feed that does not want to be fetched on mondays would specify "monday" in this array. note: this field is rarely implemented. skiphours nsiarray an array of the hours of the day during which the feed should not be fetched. the hours are represented as integer values from 0 (midnight) to 23 (11:00 pm), and are always indicated using utc. note: this field is rarely implemented. subtitle nsifeedtextconstruct returns a subtitle for the feed, based on its description, subtitle, and appropriate extensions. textinput nsiwritablepropertybag2 information about a text box that can be displayed along with the feed by aggrega...
...n about a text box that can be displayed along with the feed by aggregators that support it, to allow the reader to send a response back to the source of the feed. note: this field is almost never used, and is incompatible with many aggregators. type unsigned long indicates the type of content presented by a feed. see constants. note: you should consider this a bit mask of values; at some point, the type may include more than one of these values ored together. read only. constants constant value description type_feed 0 a standard text-based feed. type_audio 1 an audio feed, such as a podcast. type_image 2 an image feed, such as a photocast. type_video 4 a video feed, such as a videocast. ...
nsIFileInputStream
netwerk/base/nsifilestreams.idlscriptable an input stream that allows you to read from a file. inherits from: nsiinputstream last changed in gecko 1.7 method overview void init(in nsifile file, in long ioflags, in long perm, in long behaviorflags); constants constant value description delete_on_close 1<<1 if this is set, the file will be deleted by the time the stream is closed. it may be removed before the stream is closed if it is possible to delete it and still read from it. if open_on_read is defined, and the file was recreated after the first delete, the file will be deleted again when it is closed again. close_on_eof 1<<2 if this is set, the file will close automatically when the end of the file is reached. ...
... behaviorflags flags specifying various behaviors of the class (see enumerations in the class). see also nsifileoutputstream ...
nsIFileStreams
the nsifilestreams interface is an input stream that allows you to read from a file. netwerk/base/public/nsifilestreams.idlscriptable please add a summary to this article. last changed in gecko 1.9 (firefox 3) inherits from: nsisupports method overview void init(in nsifile file, in long ioflags, in long perm, in long behaviorflags); constants constants value description delete_on_close 1<<1 if this is set, the file will be deleted by the time the stream is closed. it may be removed before the stream is closed if it is possible to delete it and still read from it. if open_on_read is defined, and the file was recreated after the first delete, the file will be deleted again when it is closed again. close_on_eof 1<<2 if this is set, the file will close automatically when the ...
... behaviorflags flags specifying various behaviors of the class (see enumerations in the class). see also nsifileoutputstream ...
nsIFrameMessageListener
a frame should implement this interface in order to receive messages. method overview void receivemessage(); methods receivemessage() note: this method is for javascript only. called to deliver a message to the frame handling process; called with one parameter, which has the following properties: name the name of the message. ...
...void receivemessage(); parameters none. ...
nsIHTTPHeaderListener
: the plugin author must provide an instance to {geturl,posturl}() that implements both nsipluginstreamlistener and nsihttpheaderlistener. this instance is passed in through {geturl,posturl}()'s streamlistener parameter. the browser will then qi this streamlistener to see if it implements nsihttpheaderlistener. ...
...tance is passed in through {geturl,posturl}()'s streamlistener parameter. the browser will then qi this streamlistener to see if it implements nsihttpheaderlistener. method overview void newresponseheader(in string headername, in string headervalue); void statusline(in string line); methods newresponseheader() called for each http response header. note: you must copy the values of the params. void newresponseheader( in string headername, in string headervalue ); parameters headername headervalue statusline() called once for the http response status line. value does not include a terminating newline. note: you must copy this value. void statusline( in string line ); parameters line ...
nsIHapticFeedback
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 las...
... ...
nsIJSID
string read only. the name of the jsid, if it was set. number string read only. the string representation of the internal nsid. valid boolean read only. returns true if the jsid has been initialised. methods equals() this method determines if this nsijsid has the same nsid as another nsijsid. boolean equals( in nsijsid other ); parameters other the other nsijsid to compare to. return value true if the nsijsid's are valid and have the same nsid, otherwise false. violates the xpcom interface guidelines getid() const nsid* getid(); parameters none. return value a pointer to the internal nsid structure. initialize() initializes the jsid. void initialize( in string idstring ); parameters idstring the number to initialize the jsid, in string format, e.g. {00000000-0000-0000-c...
...rn value a pointer to the internal nsid structure. initialize() initializes the jsid. void initialize( in string idstring ); parameters idstring the number to initialize the jsid, in string format, e.g. {00000000-0000-0000-c000-000000000046}. a jsid can only be initialized once. tostring() this methods returns a string representation of the object. string tostring(); parameters none. return value the name of the jsid if it has one, otherwise the string representation of its nsid. ...
nsIJumpListItem
list items (an audio file, an email message, etc.). to add types, create the specific interface here, add an implementation class to winjumplistitem, and add support to addlistbuild and removed items processing. method overview boolean equals(in nsijumplistitem item); attributes attribute type description type short retrieves the jump list item type. read only. constants constant value description jumplist_item_empty 0 empty list item. jumplist_item_separator 1 separator. jumplist_item_link 2 web link item. jumplist_item_shortcut 3 application shortcut. methods equals() compare this item to another. compares the type and other properties specific to this item's type: separator - type link - type, uri, title shortcut - type, handler application boolean equals( in ...
...or. jumplist_item_link 2 web link item. ...
nsILoginManagerCrypto
intext); attributes attribute type description isloggedin boolean current login state of the token used for encryption. if the user is not logged in, performing a crypto operation will result in a master password prompt. read only. uibusy boolean true when a master password prompt is being displayed. read only. methods decrypt() decrypts the specified string, returning the plain text value. can throw if the user cancels entry of their master password, or if the ciphertext value can not be successfully decrypted (for example, if it was encrypted with some other key). astring decrypt( in astring ciphertext ); parameters ciphertext the string to be decrypted. return value the decrypted string. encrypt() encrypts the specified string, returning the ciphertext value. note: the cur...
...ypt() encrypts the specified string, returning the ciphertext value. note: the current implemention of this inferface simply uses nss/psm's "secret decoder ring" service. it is not recommended for general purpose encryption/decryption. can throw if the user cancels entry of their master password. astring encrypt( in astring plaintext ); parameters plaintext the string to be encrypted. return value the encrypted string. ...
nsIMicrosummaryGenerator
into the urns of the generators they create. methods calculateupdateinterval() calculates the interval until the microsummary should be updated for the next time, depending on the page content. if the generator doesn't specify an interval, null is returned. long calculateupdateinterval( in nsidomnode apagecontent ); parameters apagecontent the content of the page being summarized. return value the interval in milliseconds until the next update request. equals() microsummary-generator equivalence test. generators are considered equal if their canonical locations (uri attribute) are equal. boolean equals( in nsimicrosummarygenerator aother ); parameters aother the generator to compare against. return value a boolean indicating if the two generators are equal. generatemicrosummary() ...
...generatemicrosummary() generate a microsummary by processing the generator template against the page content. if a generator doesn't need content, pass null as the parameter to this method. note: in the future, this may be expanded to support rich text content. astring generatemicrosummary( in nsidomnode apagecontent ); parameters apagecontent the content of the page being summarized. return value the text result of processing the template. see also microsummary topics creating a microsummary ...
nsIMsgAccount
nsimsgaccount mailnews/base/public/nsimsgaccount.idlscriptable an account consists of an incoming server and one or more outgoing identities. inherits from: nsisupports last changed in gecko 1.7 method overview void addidentity(in nsimsgidentity identity); void clearallvalues(); void init(); void removeidentity(in nsimsgidentity identity); astring tostring(); attributes attribute type description defaultidentity nsimsgidentity identities nsisupportsarray read only. outgoing identity list (array of nsimsgidentity's) incomingserver nsimsgincomingserver incoming server stuff key acstring internal key identifying itself methods addidentity() adds a new identity to this account. void addidentity( in nsimsgidentity identity ); parameters identity the ...
... defaultidentity nsimsgidentity identities nsisupportsarray read only. outgoing identity list (array of nsimsgidentity's) incomingserver nsimsgincomingserver incoming server stuff key acstring internal key identifying itself methods addidentity() adds a new identity to this account. void addidentity( in nsimsgidentity identity ); parameters identity the identity to add. clearallvalues() clear all user preferences associated with an account. void clearallvalues(); parameters none. init() initializes an account. void init(); parameters none. exceptions thrown ns_error_already_opened if it is called more then once removeidentity() removes an identity from this account. void removeidentity( in nsimsgidentity identity ); parameters identity the identity to remove. ...
nsINavHistoryResultViewObserver
drop_on 0 the drag operation wishes to drop the dragged item onto the indicated row. drop_after 1 the drag operation wishes to insert the dragged item after the indicated row. methods candrop() implement this method to report whether or no...
...ms themselves instead of on the pane as a whole, always return false when the orientation isn't drop_on. warning: do not change the content of the observer list. boolean candrop( in long index, in long orientation ); parameters index the item over which the drag is currently located. orientation whether the drag target is before, after, or on the indicated row. return value return true if the drop is permitted or false if it isn't. ondrop() called when the user drops something onto the view being observed. void ondrop( in long row, in long orientation ); parameters row the row at which the drop occurred. orientation drop_before, drop_on, or drop_after, indicating whether the drop destination is before, on, or after the target row. ontoggle...
nsIPrefBranch2
thods addobserver() add a preference change observer. on preference changes, the following arguments will be passed to nsiobserver.observe(): asubject - the nsiprefbranch object (this). atopic - the string defined by ns_prefbranch_prefchange_topic_id adata - the name of the preference which has changed, relative to the "root" of the asubject branch. asubject.get*pref(adata) will get the new value of the modified preference. for example, if your observer is registered with addobserver("bar.", ...) on a branch with root "foo.", modifying the preference "foo.bar.baz" will trigger the observer, and adata parameter will be "bar.baz". void addobserver( in string adomain, in nsiobserver aobserver, in boolean aholdweak ); parameters adomain the preference on which to listen for chang...
...reviously registered with addobserver. remarks registering as a preference observer can open an object to potential cyclical references which will cause memory leaks. these cycles generally occur because an object both registers itself as an observer (causing the branch to hold a reference to the observer) and holds a reference to the branch object for the purpose of getting/setting preference values. there are 3 approaches which have been implemented in an attempt to avoid these situations: the nsprefbranch object supports nsisupportsweakreference. any consumer may hold a weak reference to it instead of a strong one. the nsprefbranch object listens for xpcom-shutdown and frees all of the objects currently in its observer list. this ensures that long lived objects (services for example) ...
nsIPrivateBrowsingService
al storage databases start out empty. extensions that record potentially private information should use this interface to detect whether private browsing mode is enabled, and if it is, avoid saving that information. for details on how to do this, see the article supporting private browsing mode. similarly, plug-ins can detect whether or not private browsing mode is in effect by using the npn_getvalue() function to check the current value of the npnvprivatemodebool variable. implemented by: @mozilla.org/privatebrowsing;1. to get access to the service from javascript, use: var pbs = components.classes["@mozilla.org/privatebrowsing;1"] .getservice(components.interfaces.nsiprivatebrowsingservice); c++ callers should use the contract id @mozilla.org/privatebrowsing-wrapper;1 in...
... indicates whether or not the last private browsing mode transition was performed on the command line (using either the -private or -private-toggle switches) rather than the user interface. read only. privatebrowsingenabled boolean indicates whether or not private browsing mode is currently enabled. you may also turn private browsing mode on and off by setting the value of this attribute. changing this value while handling one of the notifications generated by the private browsing service throws an ns_error_failure exception. methods removedatafromdomain() removes all data stored for the specified domain, including its subdomains. void removedatafromdomain( in autf8string adomain ); parameters adomain the domain for which data should ...
nsIProgressEventSink
request. void onprogress( in nsirequest arequest, in nsisupports acontext, in unsigned long long aprogress, in unsigned long long aprogressmax ); parameters arequest the request being observed (may qi to nsichannel). acontext if arequest is a channel, then this parameter is the listener context passed to nsichannel.asyncopen(). aprogress numeric value in the range 0 to aprogressmax indicating the number of bytes transfered thus far. aprogressmax numeric value indicating maximum number of bytes that will be transfered (or 0xffffffffffffffff if total is unknown). onstatus() called to notify the event sink with a status message for the given request. void onstatus( in nsirequest arequest, in nsisupports acontext, in nsresult ...
...us status code (not necessarily an error code) indicating the state of the channel (usually the state of the underlying transport). see nsisockettransport for socket specific status codes. astatusarg status code argument to be used with the string bundle service to convert the status message into localized, human readable text. the meaning of this parameter is specific to the value of the status code. for socket status codes, this parameter indicates the host:port associated with the status code. ...
nsIProperties
xpcom/ds/nsiproperties.idlscriptable this interface provides methods to access a map of named xpcom object values. inherits from: nsisupports last changed in gecko 1.2 implemented by: @mozilla.org/file/directory_service;1. to get an instance, use: var properties = components.classes["@mozilla.org/file/directory_service;1"] .getservice(components.interfaces.nsiproperties); method overview void get(in string prop, in nsiidref iid, [iid_is(iid),retval] out nsqiresult result); void getkeys(out pruint32 count, [array, size_is(count), retval] out string keys); boolean has(in string prop); void set(in string prop, in nsisupports value); void undefine(in string prop); methods get() gets the xpcom object associated with a particular name. void get( in st...
...es 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. value the xpcom object value to associate with prop. undefine() undefines a property. void undefine( in string prop ); parameters prop the property name. remarks this inter...
nsIProtocolProxyCallback
lable(in nsicancelable arequest, in nsiuri auri, in nsiproxyinfo aproxyinfo, in nsresult astatus); methods onproxyavailable() this method is called when proxy info is available or when an error in the proxy resolution occurs. void onproxyavailable( in nsicancelable arequest, in nsiuri auri, in nsiproxyinfo aproxyinfo, in nsresult astatus ); parameters arequest the value returned from asyncresolve. auri the uri passed to asyncresolve. aproxyinfo the resulting proxy info or null if there is no associated proxy info for auri. as with the result of nsiprotocolproxyservice's resolve method, a null result implies that a direct connection should be used. astatus the status of the callback. this is a failure code if the request ...
... the uri passed to asyncresolve. aproxyinfo the resulting proxy info or null if there is no associated proxy info for auri. as with the result of nsiprotocolproxyservice's resolve method, a null result implies that a direct connection should be used. astatus the status of the callback. this is a failure code if the request could not be satisfied, in which case the value of astatus indicates the reason for the failure and aproxyinfo will be null. the value returned from asyncresolve. see also nsicancelable nsiuri nsiproxyinfo nsiprotocolproxyservice ...
nsIRadioInterfaceLayer
domstring dtmfchar); void stoptone(); void unregistercallback(in nsiriltelephonycallback callback); void unregisterdatacallcallback(in nsirildatacallback callback); attributes attribute type description currentstate jsval read only. obsolete since gecko 13.0 microphonemuted bool radiostate jsval read only. ...
...rown missing exception missing description getdatacalllist() void getdatacalllist(); parameters none. exceptions thrown missing exception missing description getnumberofmessagesfortext() returns the number of multi-part sms needed for a given text (160 characters for one sms). unsigned short getnumberofmessagesfortext( in domstring text ); parameters text the body text of an sms. return value unsigned short. number of sms needed. hangup() void hangup( in unsigned long callindex ); parameters callindex missing description exceptions thrown missing exception missing description registercallback() void registercallback( in nsiriltelephonycallback callback ); parameters callback missing description exceptions thrown missing exception missing description registerdatacallcallb...
nsISHistory
tory. read only. index long the index of the current document in session history. read only. maxlength 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 all the documents stored in session history. the enumerator object thus returned by this method can be traversed using nsisimpleenumerator. to access individual history entries of the enumerator, perform the following steps: call getshistoryenumerator() to obtain ...
...and nssupportsweakreference. void addshistorylistener( in nsishistorylistener alistener ); parameters alistener listener object to be notified for all page loads that initiate in session history. getentryatindex() called to obtain handle to the history entry at a given index. nsishentry getentryatindex( in long index, in boolean modifyindex ); parameters index the index value whose entry is requested. modifyindex a boolean flag that indicates if the current index of session history should be modified to the parameter index. exceptions thrown ns_ok history entry for the index is obtained successfully. ns_error_failure error in obtaining history entry for the given index. purgehistory() called to purge older documents from history. documents can be removed from...
nsIScreenManager
native code only!screenfornativewidget returns the nsiscreen instance for the native widget pointer. this pointer's definition is specific to the platform's native widget implementation, and is typically of the same type as ns_native_window. nsiscreen screenfornativewidget( in voidptr nativewidget ); parameters nativewidget the native widget for which to obtain an nsiscreen instance. return value the nsiscreen instance for the native widget pointer. screenforrect() returns the nsiscreen containing the specified rectangle. if the rectangle overlaps multiple screens, the screen containing the majority of the rectangle's area is selected and returned. the coordinates must be specified using global (screen) coordinates, and are in pixels. nsiscreen screenforrect( in long left, in long top...
...ority of the rectangle's area is selected and returned. the coordinates must be specified using global (screen) coordinates, and are in pixels. nsiscreen screenforrect( in long left, in long top, in long width, in long height ); parameters left the left edge of the rectangle. top the top edge of the rectangle. width the width of the rectangle. height the height of the rectangle. return value the nsiscreen containing the majority of the rectangle's area. see also nsiscreen ...
nsIScriptError
rcename astring the url of the file in which the error occurred. this will be a hyperlink in the javascript console, so you should use a real url. you may pass null if it's not applicable. read only. timestamp long long elapsed time, in milliseconds, from a platform-specific zero time to the time the message was created. read only. flag constants constant value description errorflag 0x0 error messages. a pseudo-flag for the default, error case. warningflag 0x1 warning messages. exceptionflag 0x2 an exception was thrown for this case - exception-aware hosts can ignore this. strictflag 0x4 one of the flags declared in nsiscripterror. infoflag 0x8 just a log message method...
...age. there are quite a few category strings and they aren't listed in a single place, so you may need to search the firefox code to find the one you want. see categories for a partial list. innerwindowid the id of the inner window associated with the error. tostring() outputs a string representing the error message described by the object. autf8string tostring(); parameters none. return value a string representing the error message described by the nsiscripterror object. examples logging a message with additional information in this example nsiscripterror, which implements nsiconsolemessage, is used to log information to the console including information about the source file and line number of the error. function mylogtoconsole(amessage, asourcename, asourceline, alinenumber, ...
nsIScriptableUnescapeHTML
a string of html or xml source to parse as a fragment. isxml set this to true if the fragment is an xml string; otherwise set it to false. baseuri pointer to the base uri against which to resolve any uris included in the fragment. this parameter is ignored if isxml is false. element the nsidomelement to be used as the context node for the purposes of the fragment parsing algorithm. return value an nsidomdocumentfragment of the element with the new text appended. exceptions thrown ns_error_failure unable to append the text to the element. unescape() convents html source into plain text. this is equivalent to calling nsiparserutils::converttoplaintext(src, nsidocumentencoder::outputselectiononly | nsidocumentencoder::outputabsolutelinks, 0). you should call nsiparserutils::conve...
...pe() convents html source into plain text. this is equivalent to calling nsiparserutils::converttoplaintext(src, nsidocumentencoder::outputselectiononly | nsidocumentencoder::outputabsolutelinks, 0). you should call nsiparserutils::converttoplaintext() instead of calling this method. astring unescape( in astring src ); parameters src the html string to convert into plain text. return value the result of the plain text conversion. exceptions thrown ns_error_failure unable to convert the string. see also nsidomdocumentfragment nsiuri nsidomelement ...
nsIScriptableUnicodeConverter
converttoinputstream(in astring astring); attributes attribute type description charset string current character set. throws ns_error_uconv_noconv if the requested charset is not supported. methods convertfromunicode() converts the data from unicode to one charset. returns the converted string. after converting, finish should be called and its return value appended to this return value. acstring convertfromunicode( in astring asrc ); finish() returns the terminator string. should be called after convertfromunicode() and appended to that function's return value. acstring finish(); converttounicode() converts the data from one charset to unicode. astring converttounicode( in acstring asrc ); convertfrombytearray() converts an array of...
... adata ); converttoinputstream() converts a unicode string to an input stream. the bytes in the stream are encoded according to the charset attribute. the returned stream is non-blocking. nsiinputstream converttoinputstream( in astring astring ); parameters astring the text to encode to the stream. the text is encoded into the character set specified by the charset attribute. return value an nsiinputstream that will present the text specified in astring as its data. examples see reading textual data and writing textual data for examples. ...
nsISelection
ion. if partlycontained is set to pr_false, the function only returns true when the entire node is part of the selection. boolean containsnode( in nsidomnode node, in boolean partlycontained ); parameters node the nsidomnode to look for partlycontained if partlycontained is set to pr_false, the function only returns true when the entire node is part of the selection. return value whether or not the range contains the requested noe. deletefromdocument() deletes this selection from the document the nodes belong to. void deletefromdocument(); extend() extends the selection by moving the selection end to the specified nsidomnode and offset, preserving the selection begin position. the new selection end result will always be from the anchornode to the new focusnode, regardles...
...the node where the selection will be extended to. offset where in the node to place the offset in the new selection end. native code only!extendnative void extendnative( in nsinode parentnode, in long offset ); parameters parentnode offset getrangeat() returns the nsidomrange at the specified index. nsidomrange getrangeat( in long index ); parameters index return value the nsidomrange requested modify() modifies the selection. note that the parameters are case-insensitive. void modify( in domstring alter, in domstring direction, in domstring granularity ); parameters alter can be one of { "move", "extend()" } "move" collapses the selection to the end of the selection and applies the movement direction/granularity to the collapsed() selecti...
nsIServiceManager
_factory_not_registered indicates that the specified class is not registered. isserviceinstantiated() this method tests whether or not a xpcom service, identified by classid, has been instantiated. boolean isserviceinstantiated( in nscidref aclass, in nsiidref aiid ); parameters aclass the classid of the service that is being tested. aiid the interface type to be tested. return value true if the service has already been created. exceptions thrown ns_error_service_not_available indicates that the service hasn't been instantiated. ns_nointerface indicates that the iid given isn't supported. isserviceinstantiatedbycontractid() this method tests whether or not a xpcom service, identified by contractid, has been instantiated. boolean isserviceinstantiatedbycontractid( ...
...ates that the iid given isn't supported. isserviceinstantiatedbycontractid() this method tests whether or not a xpcom service, identified by contractid, has been instantiated. boolean isserviceinstantiatedbycontractid( in string acontractid, in nsiidref aiid ); parameters acontractid the contractid of the service that is being tested. aiid the interface type to be tested. return value true if the service has already been created. exceptions thrown ns_error_service_not_available indicates that the service hasn't been instantiated. ns_nointerface indicates that the iid given isn't supported. remarks the service manager depends on the repository to find and instantiate factories to obtain services. because services are instantiated lazily, methods are provided to test...
nsISessionStartup
g restored; this will be one of the session type constants. read only. state jsval the session state, as a javascript object. read only. note: prior to gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5), this was a string. it was changed in order to improve performance, which was suffering due to the need to parse and stringify the data. constants session type constants constant value description no_session 0 there's no data available from the previous session. recover_session 1 the last session crashed. it will either be restored or about:sessionrestore will be displayed. resume_session 2 the previous session should be restored at startup. defer_session 3 the previous session is viable but shouldn't be restored without explicit action (with the exception of app tab...
...restore will be displayed. resume_session 2 the previous session should be restored at startup. defer_session 3 the previous session is viable but shouldn't be restored without explicit action (with the exception of app tabs, which are always restored in this case). methods dorestore() determines whether or not there is a session to restore. boolean dorestore(); parameters none. return value true if the session should be restored, otherwise false. ...
nsISimpleEnumerator
isupports getnext(); boolean hasmoreelements(); methods getnext() called to retrieve the next element in the enumerator. the "next" element is the first element upon the first call. must be preceded by a call to hasmoreelements() which returns pr_true. this method is generally called within a loop to iterate over the elements in the enumerator. nsisupports getnext(); parameters none. return value ns_ok if the call succeeded in returning a non-null value through the out parameter. ns_error_failure if there are no more elements to enumerate. hasmoreelements() called to determine whether or not the enumerator has any elements that can be returned via getnext(). this method is generally used to determine whether or not to initiate or continue iteration over the enumerator, though it can be ca...
...merate. hasmoreelements() called to determine whether or not the enumerator has any elements that can be returned via getnext(). this method is generally used to determine whether or not to initiate or continue iteration over the enumerator, though it can be called without subsequent getnext() calls. does not affect internal state of enumerator. boolean hasmoreelements(); parameters none. return value pr_true if there are remaining elements in the enumerator. pr_false if there are no more elements in the enumerator. remarks this interface was frozen for gecko 0.9.6. see bug 154047 for details. from gecko 2.0 interfaces are no longer frozen. see also code example of nsisimpleenumerator ...
nsISmsDatabaseService
abody a domstring containing the body text of the message. adate the timestamp of the message. savesentmessage() void savesen...
...number representing the id of the request. processid optional a number representing the id of the process. clearmessagelist() void getnextmessageinlist( in long listid, ); parameters listid a number representing the id of the message list. markmessageread() requires gecko 15.0(firefox 15.0 / thunderbird 15.0 / seamonkey 2.12) void markmessageread( in long messageid, in boolean value, in long requestid, [optional] in unsigned long long processid ); parameters messageid a number representing the id of the message. value a boolean indicating whether a message is read or unread. requestid a number representing the id of the request. processid optional a number representing the id of the process. ...
nsISmsRequestManager
failed(in long arequestid, in long aerror); void notifysmsdeleted(in long arequestid, in bool adeleted); void notifysmsdeletefailed(in long arequestid, in long aerror); void notifysmssendfailed(in long arequestid, in long aerror); void notifysmssent(in long arequestid, in nsidommozsmsmessage amessage); constants all sms related errors that could apply to smsrequest objects. constant value description success_no_error 0 no_signal_error 1 not_found_error 2 unknown_error 3 internal_error 4 methods addrequest() track an already existing request object. long addrequest( in nsidommozsmsrequest arequest ); parameters arequest an smsrequest. return value the request id. createrequest() create a new request object. long createrequest( in nsidommozsmsmanager am...
...notifycreatemessagelist() void notifycreatemessagelist( in long arequestid, in long alistid, in nsidommozsmsmessage amessage ); parameters arequestid a number representing the id of the request. ...
nsIStringBundleOverride
oad. method overview nsisimpleenumerator enumeratekeysinbundle(in autf8string url); astring getstringfromname(in autf8string url, in acstring key); methods enumeratekeysinbundle() get all override keys for a given string bundle. nsisimpleenumerator enumeratekeysinbundle( in autf8string url ); parameters url the url of the original string bundle whose keys are to be overridden. return value an enumeration of nsipropertyelement objects for the keys that are overridden in the given string bundle. note that these keys may not exist in the original string bundle. getstringfromname() get the override value for a particular key in a particular string bundle. astring getstringfromname( in autf8string url, in acstring key ); parameters url the url of the original string bundle whose k...
...are overridden in the given string bundle. note that these keys may not exist in the original string bundle. getstringfromname() get the override value for a particular key in a particular string bundle. astring getstringfromname( in autf8string url, in acstring key ); parameters url the url of the original string bundle whose keys are to be overridden. key the key to be overridden. return value the override value. an exception is thrown if the key has not been overridden. however, no exception is thrown if the original string bundle did not have the key. ...
nsIStringEnumerator
thod overview astring getnext(); boolean hasmore(); methods getnext() called to retrieve the next string in the enumerator. the "next" element is the first string upon the first call. must be preceded by a call to hasmoreelements() which returns pr_true. this method is generally called within a loop to iterate over the strings in the enumerator. astring getnext(); parameters none. return value the next string in the enumerator. throws an exception if there are no more strings. hasmore() called to determine whether or not the enumerator has any strings that can be returned via getnext(). this method is generally used to determine whether or not to initiate or continue iteration over the enumerator, though it can be called without subsequent getnext() calls. does not affect internal stat...
...ere are no more strings. hasmore() called to determine whether or not the enumerator has any strings that can be returned via getnext(). this method is generally used to determine whether or not to initiate or continue iteration over the enumerator, though it can be called without subsequent getnext() calls. does not affect internal state of enumerator. boolean hasmore(); parameters none. return value true if there are remaining strings in the enumerator. false if there are no more strings in the enumerator. ...
nsIStyleSheetService
a user sheet loaded via this api will come before usercontent.css and userchrome.css in the cascade (so th...
...ned long type ); parameters sheeturi uri of the stylesheet to load and register. type one of the type constants. sheetregistered() check if a stylesheet has been registered boolean sheetregistered( in nsiuri sheeturi, in unsigned long type ); parameters sheeturi uri of the stylesheet to check. type one of the type constants. return value returns true if a style sheet at sheeturi has previously been added to the list of style sheets specified by type. unregistersheet() remove the style sheet at sheeturi from the list of style sheets specified by type. the removal takes effect immediately, even for already-loaded documents. void unregistersheet( in nsiuri sheeturi, in unsigned long type ); parameters sheeturi ur...
nsISupports
);violates the xpcom interface guidelines void queryinterface(in nsiidref uuid, [iid_is(uuid),retval] out nsqiresult result); nsrefcnt release();violates the xpcom interface guidelines methods violates the xpcom interface guidelines addref() notifies the object that an interface pointer has been duplicated. nsrefcnt addref(); parameters none. return value an integer value that is generally ignored. queryinterface() the queryinterface method provides runtime type discovery. note: the interface pointer, aresult, returned by queryinterface must be released by a call to release() when it is no longer needed. queryinterface is a symmetric, transitive, and reflexive operator. void queryinterface( in nsiidref uuid, [iid_is(uuid),retval] out nsqir...
...rface result the resulting interface pointer. exceptions thrown ns_error_no_interface the requested interface is not available. violates the xpcom interface guidelines release() notifies the object that an interface pointer has been destroyed and any resources the object held on behalf of the client can be released. nsrefcnt release(); parameters none. return value an integer value that is generally ignored. remarks the method descriptions above were taken from essential com by don box. the point of those descriptions is to highlight the fact that addref() and release() do not necessarily correspond to incrementing and decrementing a counter, respectively, even though that is how they are usually implemented. on win32 systems, nsisupports is abi-compatible ...
nsISupportsPriority
1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) this interface does not strictly define what happens when the priority of an object is changed. an implementation of this interface is free to define the side-effects of changing the priority of an object. ...
... side-effects of changing the priority of an object. in some cases, changing the priority of an object may be disallowed (resulting in an exception being thrown) or may simply be ignored. method overview void adjustpriority(in long delta); attributes attribute type description priority long the object's priority. it can be modified to change the priority of the object. typical priority values are defined in the idl file as priority_highest ... priority_lowest. the implementation is free to truncate a given priority value to whatever limits are appropriate. typically this attribute is initialized to priority_normal, but implementations may choose to assign a different initial value. constants constant value description priority_highest -20 the highest priority. priority_high...
nsITaggingService
i are ignored. void untaguri( in nsiuri auri, in nsivariant atags ); parameters auri the url to un-tag. atags array of tags to unset. pass null to remove 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...
...see also places using the places tagging service ...
nsITaskbarWindowPreview
utes attribute type description enablecustomdrawing boolean if true, the nsitaskbarpreviewcontroller object's nsitaskbarpreviewcontroller.drawpreview() and nsitaskbarpreviewcontroller.drawthumbnail() methods will be called to draw the preview. if false, the operating system draws these for you. constants constant value description num_toolbar_buttons 7 the maximum number of toolbar buttons supported by the windows taskbar api. methods getbutton() returns the specified button from the preview's toolbar. note: by default, all buttons are hidden. you must fetch and configure each button that you want to make visible. nsitaskbarpreviewbutton getbutton( in unsigned long i...
... windows taskbar api. methods getbutton() returns the specified button from the preview's toolbar. note: by default, all buttons are hidden. you must fetch and configure each button that you want to make visible. nsitaskbarpreviewbutton getbutton( in unsigned long index ); parameters index the index into the button array for the nsitaskbarpreviewbutton to retrieve. this value must be at least 0 (the leftmost button) and less than num_toolbar_buttons. return value an nsitaskbarpreviewbutton describing the requested button. see also nsitaskbarpreview nsitaskbarpreviewcontroller nsitaskbartabpreview nsitaskbarpreviewbutton nsiwintaskbar ...
nsITextInputProcessorNotification
amonkey 2.35) this interface tells details of a request or notification to ime. when gecko supports new notification to ime, this interface may have some new attributes. so, nsitextinputprocessorcallback won't be changed for keeping backward compatibility. attributes attribute type description type acstring the type of request or notification to ime. see type values below. types "request-to-commit" this is required to be handled. when this is requested, the callback should commit composition synchronously, i.e., nsitextinputprocessor.commitcomposition() should be called. if the callback doesn't want to commit the composition synchronously, it's okay to commit it later (i.e., asynchronously). however, gecko will commit the composition with the las...
...mposition synchronously, i.e., nsitextinputprocessor.commitcomposition() should be called. if the callback doesn't want to commit the composition synchronously, it's okay to commit it later (i.e., asynchronously). however, gecko will commit the composition with the last composing string internally. this is typically notified when user clicks somewhere, focus is moved, or web contents modify the value of the editor during composition. "request-to-cancel" this is required to be handled. when this is requested, the callback should cancel composition synchronously, i.e., nsitextinputprocessor.cancelcomposition() should be called. if the callback doesn't want to cancel the composition synchronously, it's okay to cancel it later (i.e., asynchronously). however, gecko will cancel the composition...
nsITransaction
. methods dotransaction() executes the transaction. void dotransaction(); parameters none. merge() attempts to merge a transaction into "this" transaction. both transactions must be in their undo state, dotransaction() methods already called. the transaction manager calls this method to coalesce a new transaction with the transaction on the top of the undo stack. this method returns a boolean value that indicates the merge result. a true value indicates that the transactions were merged successfully, a false value if the merge was not possible or failed. if true, the transaction manager will release() the new transaction instead of pushing it on the undo stack. boolean merge( in nsitransaction atransaction ); parameters atransaction the previously executed transaction to merge. return ...
...can only be called on a transaction that was previously undone. in most cases, the redotransaction method will actually call the dotransaction() method to execute the transaction again. void redotransaction(); parameters none. ...
nsIURL
if no commonality is found, the entire uri spec is returned. if they are identical, "" is returned. filename, query, and so forth are always returned except when uris are identical. autf8string getrelativespec( in nsiuri auritocompare ); parameters ...
...d takes a uri and returns a substring of this if it can be made relative to the uri passed in. ...
nsIURLFormatter
le%/ method overview astring formaturl(in astring aformat); astring formaturlpref(in astring apref); methods formaturl() formats a string url. the set of known variables is predefined. if a variable is unknown, it is left unchanged and a non-fatal error is reported. astring formaturl( in astring aformat ); parameters aformat unformatted url as a string. ...
...string apref); methods formaturl() formats a string url. the set of known variables is predefined. if a variable is unknown, it is left unchanged and a non-fatal error is reported. astring formaturl( in astring aformat ); parameters aformat unformatted url as a string. return value the formatted url. formaturlpref() formats a string url stored in a preference. if the preference value cannot be retrieved, a fatal error is reported and the "about:blank" url is returned. astring formaturlpref( in astring apref ); parameters apref a string representing the name of the preference from which to fetch the url to format. return value the formatted url returned by formaturl(), or "about:blank". ...
nsIUTF8ConverterService
ii / utf-8 so that astring has to go through the conversion. skipping asciiness/utf8ness check. the most common case is the input is in 7bit non-ascii character sets like iso-2022-jp, hz or utf-7 (in its original form or a modified form used in imap folder names). aallowsubstitution when true, allow the decoder to substitute invalid input sequences by replacement characters. return value the converted string in utf-8. exceptions thrown ns_error_uconv_noconv when there is no decoder for acharset or error code of nsiunicodedecoder in case of conversion failure. converturispectoutf8() ensure that aspec (after url-unescaping it) is encoded in utf-8. if not, convert it to utf-8, assuming it's encoded in acharset, and return the result. make sure that all characters outs...
...ndication that your input spec is in unescaped utf-8 and it will be returned without further processing. no valid spec going around in mozilla code would break this assumption. autf8string converturispectoutf8( in acstring aspec, in string acharset ); parameters aspec an url-escaped uri spec to ensure its utf8ness. acharset the character set to convert from if aspec is not in utf-8. return value the converted spec in utf-8. exceptions thrown ns_error_uconv_noconv when there is no decoder for acharset or error code of nsiunicodedecoder in case of conversion failure. ...
nsIUTF8StringEnumerator
o 1.7 method overview autf8string getnext(); boolean hasmore(); methods getnext() returns the next string in the enumerator. the "next" element is the first string upon the first call. must be preceded by a call to hasmore(), which returns pr_true. this method is generally called within a loop to iterate over the strings in the enumerator. autf8string getnext(); parameters none. return value the next string in the enumerator. throws an exception if there are no more strings. hasmore() reports whether or not the enumerator has any strings that can be returned via getnext(). this method is generally used to determine whether or not to initiate or continue iteration over the enumerator, athough it can be called without subsequent getnext() calls. calling this method doesn't affect the i...
...strings. hasmore() reports whether or not the enumerator has any strings that can be returned via getnext(). this method is generally used to determine whether or not to initiate or continue iteration over the enumerator, athough it can be called without subsequent getnext() calls. calling this method doesn't affect the internal state of the enumerator. boolean hasmore(); parameters none. return value true if there are remaining strings in the enumerator, otherwise false. ...
nsIUpdate
us, which also links to the release notes. displayversion astring the string to display in the user interface for the version. if you want a real version number use appversion. errorcode long a numeric error code that conveys additional information about the state of a failed update or failed certificate attribute check during an update check. if the update is not in the "failed" state, this value is zero. ok (0) no error. mem_error (1) a memory error occurred. usage_error (3) a usage error occurred; this needs to be described in more detail. crc_error (4) a checksum error occurred. parse_error (5) an error occurred while parsing the patch. read_error (6) an error occurred while reading the patch. write_error (7) an error occurred while writing the patched application. unexpected_error (8...
...pe astring the type of patch represented by the object: "major" a major new version of the application. "minor" a minor update, such as a security update. version astring the application version of the update.obsolete since gecko 2.0 methods getpatchat() retrieves a patch. nsiupdatepatch getpatchat( in unsigned long index ); parameters index the index of the patch to retrieve. return value an nsiupdatepatch object describing the specified patch. serialize() serializes the update object into a dom element. nsidomelement serialize( in nsidomdocument updates ); parameters updates the dom document into which to serialize the update. return value the patch object serialized into an nsidomelement. see also nsiupdatepatch nsiupdatechecklistener nsiupdatechecker nsiapplicationupdates...
nsIUpdateChecker
is interface describes an object that knows how to check for software updates. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview void checkforupdates(in nsiupdatechecklistener listener, in boolean force); void stopchecking(in unsigned short duration); constants constant value description current_check 1 constant for the stopchecking() method indicating that only the current update check should be stopped. current_session 2 constant for the stopchecking() method indicating that all update checks during the current session should be stopped. any_checks 3 constant for the stopchecking() method indicating that all update checking should be stopped. this disables the...
...e checking preferences. methods checkforupdates() checks for available updates, notifying a listener of the results. void checkforupdates( in nsiupdatechecklistener listener, in boolean force ); parameters listener an object implementing nsiupdatechecklistener to be notified of the results of an update check. force if true, the update checker checks for updates, regardless of the current value of the user's update settings. this is used by any user interface that offers the user the opportunity to check for updates immediately. the force option doesn't work if the system administrator has locked the app.update.enabled preference. stopchecking() ends any pending update check. void stopchecking( in unsigned short duration ); parameters duration one of the constants indicating the se...
nsIUpdatePatch
inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview nsidomelement serialize(in nsidomdocument updates); attributes attribute type description finalurl astring the final url this patch was being downloaded from. hashfunction astring the hash function to use when determining the integrity of the patch file. hashvalue astring the value of the hash function named in hashfunction that should be computed if the file is not corrupt. selected boolean true if this patch is currently selected as the patch to be downloaded and installed for this update transaction. false if another update is selected. size unsigned long the size of the patch file in bytes. state astring the state of this patch. type astring th...
...e between two application versions. "complete" a complete patch containing all the replacement files to update to the new version. url astring the url from which the patch was downloaded. methods serialize() serializes the patch object into a dom element. nsidomelement serialize( in nsidomdocument updates ); parameters updates the dom document into which to serialize the patch. return value the patch object serialized into an nsidomelement. see also nsiupdate nsiupdatechecklistener nsiupdatechecker nsiapplicationupdateservice nsiupdatemanager nsiupdateprompt nsiupdatetimermanager ...
nsIUploadChannel2
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 acontentlength, in acstring amethod, in boolean astreamhasheaders ); parameters astream the stream to be up...
...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 acontentlength, 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. acontentlength a value of -1 indicates that the length of the stream should be determined by calling the stream's available method. amethod the http request method to set on the stream. astreamhasheaders true if the stream already contains headers for the http request. ...
nsIVersionComparator
ents.classes["@mozilla.org/xpcom/version-comparator;1"] .getservice(components.interfaces.nsiversioncomparator); method overview long compare(in acstring a, in acstring b); methods compare() compare two version strings. long compare( in acstring a, in acstring b ); parameters a the first version. b the second version. ...
... .getservice(components.interfaces.nsiversioncomparator); method overview long compare(in acstring a, in acstring b); methods compare() compare two version strings. long compare( in acstring a, in acstring b ); parameters a the first version. b the second version. ...
nsIWebPageDescriptor
nother window without refetching it from the network. inherits from: nsisupports last changed in gecko 1.7 method overview void loadpage(in nsisupports apagedescriptor, in unsigned long adisplaytype); attributes attribute type description currentdescriptor nsisupports retrieves the page descriptor for the current document. read only. constants display type constants constant value description display_as_source 0x0001 generates an optionally syntax-highlighted (for xml/html documents) source of the original page. display_normal 0x0002 just refetches the existing page. note that if the descriptor is that of the source of another page, this keeps the source view, but uses the current syntax highlighting preference. methods loadpage() tells the object to load the page s...
... ...
nsIWebProgress
loaded in the context of this nsiwebprogress instance. read only. constants the following flags may be combined to form the anotifymask parameter for the addprogresslistener() method. they limit the set of events that are delivered to an nsiwebprogresslistener instance. these flags indicate the state transistions to observe, corresponding to nsiwebprogresslistener.onstatechange(). constant value description notify_state_request 0x00000001 only receive the nsiwebprogresslistener.onstatechange() event if the astateflags parameter includes nsiwebprogresslistener::state_is_request. notify_state_document 0x00000002 only receive the nsiwebprogresslistener.onstatechange() event if the astateflags parameter includes nsiwebprogresslistener::state_is_document. notify_state_network 0x00000004...
...otify_state_window 0x00000008 only receive the nsiwebprogresslistener.onstatechange() event if the astateflags parameter includes nsiwebprogresslistener::state_is_window. notify_state_all 0x0000000f receive all nsiwebprogresslistener.onstatechange() events. these flags indicate the other events to observe, corresponding to the other four methods defined on nsiwebprogresslistener. constant value description notify_progress 0x00000010 receive nsiwebprogresslistener.onprogresschange() events. notify_status 0x00000020 receive nsiwebprogresslistener.onstatuschange() events. notify_security 0x00000040 receive nsiwebprogresslistener.onsecuritychange() events. notify_location 0x00000080 receive nsiwebprogresslistener.onlocationchange() events. notify_refresh 0x00000100 receive nsiwebp...
nsIWebProgressListener2
fication that the progress has changed for one of the requests associated with awebprogress. progress totals are reset to zero when all requests in awebprogress complete (corresponding to onstatechange being called with astateflags including the state_stop and state_is_window flags). this function is identical to nsiwebprogresslistener.onprogresschange(), except that this function supports 64-bit values. note: if any progress value is unknown, then its value is replaced with -1. void onprogresschange64( in nsiwebprogress awebprogress, in nsirequest arequest, in long long acurselfprogress, in long long amaxselfprogress, in long long acurtotalprogress, in long long amaxtotalprogress ); parameters awebprogress the nsiwebprogress instance that fired the notification. arequest the nsir...
...false if the refresh should be aborted. ...
nsIWritablePropertyBag
xpcom/ds/nsiwritablepropertybag.idlscriptable please add a summary to this article. 1.0 66 introduced gecko 1.8 inherits from: nsipropertybag last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview void deleteproperty(in astring name); void setproperty(in astring name, in nsivariant value); methods deleteproperty() delete a property with the given name. ...
... overview void deleteproperty(in astring name); void setproperty(in astring name, in nsivariant value); methods deleteproperty() delete a property with the given name. void deleteproperty( in astring name ); parameters name property to delete. exceptions thrown ns_error_failure if a property with that name doesn't exist. setproperty() set a property with the given name to the given value. if a property already exists with the given name, it is overwritten. void setproperty( in astring name, in nsivariant value ); parameters name property to set the value of. value value to set the property to. ...
nsIZipReaderCache
ry); obsolete since gecko 10 nsizipreader getzip(in nsifile zipfile); void init(in unsigned long cachesize); methods getinnerzip() returns a (possibly shared) cached nsizipreader for a zip inside another zip. nsizipreader getinnerzip( in nsifile zipfile, in autf8string zipentry ); parameters zipfile the zip file. zipentry the zip entry. return value the nsizipreader for the given zip file. getzip() returns a (possibly shared) cached nsizipreader for a zip file. if the zip reader for the given file is not in the cache, a new nsizipreader is opened (see nsizipreader.open()). otherwise the previously created nsizipreader is returned. note: if nsizipreader.close has been called on the shared nsizipreader, this method will return the closed nsizi...
... zip file. if the zip reader for the given file is not in the cache, a new nsizipreader is opened (see nsizipreader.open()). otherwise the previously created nsizipreader is returned. note: if nsizipreader.close has been called on the shared nsizipreader, this method will return the closed nsizipreader nsizipreader getzip( in nsifile zipfile ); parameters zipfile the zip file. return value the nsizipreader for the given zip file. init() initializes a new zip reader cache. void init( in unsigned long cachesize ); parameters cachesize the number of released entries to maintain before beginning to throw some out. the number of outstanding entries can be much greater than this number, this is the count for those otherwise unused entries. see also nsizipreader ...
nsIZipWriter
currently open zip file. exceptions thrown ns_error_not_initialized if no zip file has been opened. file nsifile the zip file being written to. read only. inqueue boolean true if operations are being performed in the background queue, or false if background operations are not in progress. read only. constants constant value description compression_none 0 do not compress the file. compression_fastest 1 use the fastest compression method when adding the file to the archive. compression_default 6 use the default compression method when adding the file to the archive. compression_best 9 use the best compression method when adding the file to the archive. ...
...d no zip file is open. ns_error_in_progress the zip writer is already performing another operation. other errors may be thrown if a failure to complete the zip file occurs. getentry() returns a specified entry or null if there is no such entry in the current zip file. nsizipentry getentry( in autf8string azipentry ); parameters azipentry the path of the file entry to get. return value an nsizipentry object describing the specified entry, or null if there is no such entry. hasentry() determines whether or not a specific entry exists in the zip file. boolean hasentry( in autf8string azipentry ); parameters azipentry the path of the file entry to check for. return value true if there is an entry with the given path in the zip file, otherwise returns false. open() ...
nsMsgSearchScope
defined in comm-central/ mailnews/ base/ search/ public/ nsmsgsearchcore.idl [scriptable, uuid(6e893e59-af98-4f62-a326-0f00f32147cd)] interface nsmsgsearchscope { const nsmsgsearchscopevalue offlinemail = 0; const nsmsgsearchscopevalue offlinemailfilter = 1; const nsmsgsearchscopevalue onlinemail = 2; const nsmsgsearchscopevalue onlinemailfilter = 3; /// offline news, base table, no body or junk const nsmsgsearchscopevalue localnews = 4; const nsmsgsearchscopevalue news = 5; const nsmsgsearchscopevalue newsex = 6; const nsmsgsearchscopevalue ldap = 7; const nsmsgsearchscopevalue localab = 8; const nsmsgsearchscopevalue allsearchablegroups = 9; const nsmsgsearchscopevalue newsfilter = 10; const nsmsgsearchscopevalue localaband = 11; const nsmsgsearchscopeval...
...ews = 5; const nsmsgsearchscopevalue newsex = 6; const nsmsgsearchscopevalue ldap = 7; const nsmsgsearchscopevalue localab = 8; const nsmsgsearchscopevalue allsearchablegroups = 9; const nsmsgsearchscopevalue newsfilter = 10; const nsmsgsearchscopevalue localaband = 11; const nsmsgsearchscopevalue ldapand = 12; // imap and news, searched using local headers const nsmsgsearchscopevalue onlinemanual = 13; /// local news + junk const nsmsgsearchscopevalue localnewsjunk = 14; /// local news + body const nsmsgsearchscopevalue localnewsbody = 15; /// local news + junk + body const nsmsgsearchscopevalue localnewsjunkbody = 16; }; ...
NS ENSURE SUCCESS
summary macro returns return-value if ns_failed(nsresult) evaluates to true, and shows a warning on stderr in that case. ...
... summary macro returns return-value if ns_failed(nsresult) evaluates to true, and shows a warning on stderr in that case. ...
XPCOM primitive
also, certain apis, such as nsitransferable.settransferdata(), require primitives. ...
...also, certain apis, such as nsitransferable.settransferdata(), require primitives. ...
NS_CStringContainerInit2
e string object. this parameter may be null. adatalength [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 bit-field that modifies how the string object is initialized. if this value is zero, then the array referenced by adata (if any) will be copied. flag values are defined below. flag values the aflags parameter is a bit-wise combination of the following values: ns_cstring_container_init_depend data passed into ns_cstringcontainerinit2 is not copied. instead, the string references the passed in data pointer directly. the caller must ensure that the data is valid for t...
...ata passed into ns_cstringcontainerinit2 is not copied. instead, the string takes ownership over the data pointer. the caller must have allocated the data array using the xpcom memory allocator. this flag should not be combined with ns_cstring_container_init_depend. ns_cstring_container_init_substring data passed into ns_cstringcontainerinit2 is a substring that is not null-terminated. return values the ns_cstringcontainerinit function returns ns_ok if successful. otherwise, it returns an error code. remarks after a nscstringcontainer object has been initialized via ns_cstringcontainerinit2, it may be used as an ordinary nsacstring object. when the string object is no longer needed, it should be passed to ns_cstringcontainerfinish to free any extra memory that the string object may have...
NS_CStringInsertData
« xpcom api reference summary the ns_cstringinsertdata function appends data to the existing value of a nsacstring instance. this is a low-level api. #include "nsstringapi.h" nsresult ns_cstringinsertdata( nsacstring& astring, pruint32 aoffset, const char* adata, pruint32 adatalength = pr_uint32_max ); parameters astring [in] a nsacstring instance to be modified. aoffset [in] an offset into the string's internal buffer specifying where to place the given characters. adata [in] a raw character array to copy into this string. adatalength [in] the length of adata, measured in storage units. ...
...in] a nsacstring instance to be modified. aoffset [in] an offset into the string's internal buffer specifying where to place the given characters. adata [in] a raw character array to copy into this string. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. return values the ns_cstringinsertdata function returns ns_ok if successful. otherwise, it returns an error code. remarks this function is defined inline as a wrapper around ns_cstringsetdatarange. example code nscstringcontainer str; ns_cstringcontainerinit(str); ns_cstringsetdata(str, "hello"); ns_cstringinsertdata(str, 5, " world"); const char* data; ns_cstringgetdata(str, &data); printf...
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 adatalength = pr_uint32_max ); parameters astring [in] a nsacstring instance to be modified. aoffset [in] an offset into the string's internal buffer specifying where to place the given characters. adata [in] a raw character array to copy into this string. adatalength [in] the length of adata, measured in storage units. ...
...a nsacstring instance to be modified. aoffset [in] an offset into the string's internal buffer specifying where to place the given characters. adata [in] a raw character array to copy into this string. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. return values the ns_stringinsertdata function returns ns_ok if successful. otherwise, it returns an error code. remarks this function is defined inline as a wrapper around ns_stringsetdatarange . note: gcc requires the -fshort-wchar option to compile this example since prunichar is an unsigned short. this example should compile by default under msvc. example code nsstringcontainer str; ns_stringco...
NS_UTF16ToCString
« xpcom api reference summary the ns_utf16tocstring function converts the value of a nsastring instance from utf-16 to the specified multi-byte encoding and stores the result in a nsacstring instance. #include "nsstringapi.h" nsresult ns_utf16tocstring( const nsastring& asrc, nscstringencoding adestencoding, nsacstring& adest ); parameters asrc [in] a nsastring instance containing the source utf-16 string to be converted. the source string should be encoded using the host byte order. adestencoding [in] the character encoding of the destination string. see nscstringencoding for the set of values that can be passed for this parameter. ...
...otherwise, it returns an error code. ...
nsMsgViewSortOrder
the nsmsgviewsortorder interface contains constants used for sort direction in thunderbird. this interface isn't ever implemented. it is only used to store constants. ...
...ins constants used for sort direction in thunderbird. this interface isn't ever implemented. it is only used to store constants. ...
nsMsgViewSortType
the nsmsgviewsorttype interface contains constants used for sorting the thunderbird threadpane. this interface isn't ever implemented. it is only used to store constants. for example to sort by date you would pass a function the value: components.interfaces.nsmsgviewsorttype.bydate mailnews/base/public/nsimsgdbview.idlscriptable please add a summary to this article. ...
...ns constants used for sorting the thunderbird threadpane. this interface isn't ever implemented. it is only used to store constants. for example to sort by date you would pass a function the value: components.interfaces.nsmsgviewsorttype.bydate mailnews/base/public/nsimsgdbview.idlscriptable please add a summary to this article. ...
Frequently Asked Questions
other issues printf("%x\n", mynscomptr); can cause the program to crash on sigill (illegal instruction), and not on the line with the printf, which can make it tricky to figure out. for debugging purposes you can write printf("%x\n", mynscomptr.get()); how do i... initialize an nscomptr? release an nscomptr before it goes out of scope? assign 0 into it. ...
...scomptr); can cause the program to crash on sigill (illegal instruction), and not on the line with the printf, which can make it tricky to figure out. for debugging purposes you can write printf("%x\n", mynscomptr.get()); how do i... initialize an nscomptr? release an nscomptr before it goes out of scope? assign 0 into it. whenever an nscomptr takes on a new value, it always releases its old value, if any. assigning in the value 0 is just like assigning in a raw pointer that happens to be null. the old referent will be released. [see initialization and assignment for more details] you should note, though, that there is a small performance penalty for this. the nscomptr will still exercize logic in its destructor to attempt to release the value it has at that time. the optimal solution is ...
Using nsISimpleEnumerator
using nsisimpleenumerator <stringbundle>.strings var enumerator = document.getelementbyid('astringbundleid').strings; var s = ""; while (enumerator.hasmoreelements()) { var property = enumerator.getnext().queryinterface(components.interfaces.nsipropertyelement); s += property.key + ' = ' + property.value + ';\n'; } alert(s); example using javascript 1.7 features // creates a generator iterating over enum's values function generatorfromsimpleenumerator(enum, interface) { while (enum.hasmoreelements()) { yield enum.getnext().queryinterface(interface); } } var b = document.getelementbyid("stringbundleset").firstchild var props = generatorfromenumerator(b.strings, components.interfaces.nsipropertyelement); var s = ""; for (let property in props) { s += property.key + '...
...r enum's values function generatorfromsimpleenumerator(enum, interface) { while (enum.hasmoreelements()) { yield enum.getnext().queryinterface(interface); } } var b = document.getelementbyid("stringbundleset").firstchild var props = generatorfromenumerator(b.strings, components.interfaces.nsipropertyelement); var s = ""; for (let property in props) { s += property.key + ' = ' + property.value + ';\n'; } alert(s); links code based on using_nsipasswordmanager nsisimpleenumerator xul:property:strings ...
Using the clipboard
d to get the data from the clipboard: services.clipboard.getdata(trans, services.clipboard.kglobalclipboard); var str = {}; var strlength = {}; trans.gettransferdata("text/unicode", str, strlength); the first line performs the opposite of setdata. the data currently on the system clipboard is placed into the transferable. next we create two javascript objects which will hold the return values from gettransferdata. then we use gettransferdata to retrieve the data from the transferable. we specify the flavor we would like to get. the data will be converted if it is not available in the desired flavor, and a conversion from an available flavor is possible. if you originally copied data of multiple flavors onto the clipboard, you can retrieve the data in the best format necessary. for e...
... you can retrieve the data in the best format necessary. for example, a textbox would accept "text/unicode" (or "text/plain") while a composer window might accept html and image data. the variable str now holds the data from the clipboard. we need to convert the data back into a javascript string from an xpcom object. the code below can be used for this purpose: if (str) { var pastetext = str.value.queryinterface(ci.nsisupportsstring).data; } because the data from the transferable is an nsisupportsstring, we need to convert it into a javascript string. the property value of the object filled in by gettransferdata, which is str in this case, provides the actual value of the object. we assign the string to the variable pastetext. we can then put that into a textbox or other location as nece...
Gloda examples
instead you need to do two queries, first to get the "identity" object for an email address and then to get the messages. this requires two chained asynchronous calls: //first take an email address and turn it into an identity object id_...
...ear to be any way of going directly from an email address to email addresses that it involves. instead you need to do two queries, first to get the "identity" object for an email address and then to get the messages. ...
Index
ation file autoconfiguration, thunderbird authoritative definition 14 autoconfiguration in thunderbird moved to autoconfiguration 15 buddy icons in mail seth spitzer mozilla is now able to show icons in the message header area and the addressbook card pane. ...
... if there is no card matching the email, the icon will not appear. if there is a card, but no screenname, the icon will not appear. and finally, if there is no icon, the icon will not appear. ...
MailNews fakeserver
if not present. it will also properly queue all messages sent in pipelining mode and will present lines without any eol characters. in addition, it uses utf-8 as the transmission medium. the server presents the following api to the handler: <caption> server api </caption> name arguments returns description closesocket none nothing closes the socket and stops the test. setmultiline the new value of multiline nothing the value is a boolean, with true invoking multiline mode. it is off by default. extending a handler to provide different mechanisms is a process not defined here; please check the documentation of the corresponding handler for instructions. using fakeserver in xpcshell tests since there are three different components of fakeserver, a total of four objects need to be set ...
...(next key to use for new articles) getgroupstats group name array of [size, min, max] the size is an estimate if nntp_real_length is not specified in the daemon flags. 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 modification except added headers. ...
Building a Thunderbird extension 3: install manifest
<em:maxversion>5.0.*</em:maxversion> </description> </em:targetapplication> </description> </rdf> the following items (shown in bold) should be customized for your application: <em:id>myfirstext@jen.zed</em:id>: this is the id of the extension. the first portion is the short name of the extension and must be in lowercase; the last portion is a two-part period-delimited value such as your first and last name or the top-level domain of your website. while this value is in email address format, it is not an email address. it should, however, be a unique value so that it does not conflict with other extensions. <em:name>my first extension</em:name>: the extension name is displayed in the thunderbird add-on manager. <em:version>1.0</em:version>: this is the version num...
...ame>my first extension</em:name>: the extension name is displayed in the thunderbird add-on manager. <em:version>1.0</em:version>: this is the version number of your extension. it must be updated each time you release a new version of your extension. it is not the thunderbird version number (which is stored in the minversion and maxversion fields). <em:creator>jenzed</em:creator>: this optional value is used to store the extension author's name. <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>: this element contains the version id of the application that this add on is developed for. it is defined by mozilla. a list of valid application ids can be found here. normally the id does not change and is always the same even for different versions of thunderbird. <em:minversion>1.5</em:minver...
Using tab-modal prompts
with a checkbox: var window = gbrowser.contentwindow; var promptfact = components.classes['@mozilla.org/prompter;1'].getservice(components.interfaces.nsipromptfactory); var prompt = promptfact.getprompt(window, components.interfaces.nsiprompt); var promptbag = prompt.queryinterface(components.interfaces.nsiwritablepropertybag2); promptbag.setpropertyasbool('allowtabmodal', true); var check = {value: false}; //initial state of checkbox, however if no text is supplied the checkbox is not shown var input = {value: 'pre filled value'}; var ok = prompt.prompt.apply(null, ['title - but not shown in tab modal', 'text goes here', input, 'check text, if no text, checkbox is not shown', check]); //this here is just an alert, showing the values of the prompt prompt.alert.apply(null, ['title not shown...
...ied the checkbox is not shown var input = {value: 'pre filled value'}; var ok = prompt.prompt.apply(null, ['title - but not shown in tab modal', 'text goes here', input, 'check text, if no text, checkbox is not shown', check]); //this here is just an alert, showing the values of the prompt prompt.alert.apply(null, ['title not shown in modal', 'user clicked ok: ' + ok + '\n' + 'checked: ' + check.value + '\ninput value: ' + input.value]); note: because the prompts are shown in a tab, if the tab is closed while the prompt is open it will throw an exception. /* exception: prompt aborted by user undefined:425 */ ...
Using the Mozilla symbol server
tly: you must add it to the symbol path of your debugging tool. in the examples below, a local cache directory is used to avoid repeatedly fetching the pdb from the server. replace c:\users\bsmedberg\symbols with an appropriate cache directory on your machine. using the symbol server in microsoft visual c++ using the symbol server in windbg the windbg symbol path is configured with a string value delimited with asterisk characters. to use only the mozilla symbol server, add the following entry to your symbol path (note: you can replace c:\symcache\ with any writable directory on your computer, if you'd prefer a different location for downloaded symbols): srv*c:\symcache\*https://symbols.mozilla.org/ set this string as _nt_symbol_path in the environment, using the windbg menus, or by ty...
...tware that uses symbols. note that the symbol file for the xul library is very large and takes some time to download. this may make it appear as if the script has gotten stuck, but it will continue. symbol indices are named like so: symbols.mozilla.org/{lowercased:name}/{lowercased:name}-{version}-{platform}-{buildid}-symbols.txt. the platform is either 'darwin' (for mac) or 'linux'. the rest of values are based on the contents of the application.ini file under the [app] heading: for example, the thunderbird 3.1b2 release with name=thunderbird, version=3.1b2, buildid=20100430125415 would have a filename of "thunderbird-3.1b2-linux-20100430125415-symbols.txt" under the thunderbird directory at symbols.mozilla.org. its contents are a list of paths to files, all relative to the directory the bla...
Declaring and Calling Functions
functions are declared using the library object's declare() method. once declared, functions can be called using standard function syntax. prerequiste understanding see abi. example: no input parameters in this example, we declare the libc clock() function, which returns the elapsed time since system startup, then fetch and output that value. const clock = lib.declare("clock", ctypes.default_abi, ctypes.unsigned_long); console.log("clocks since startup: " + clock()); the clock() function requires no input parameters; it simply returns an unsigned long. example: multiple input parameters this example declares the libc asctime() function, which converts a time structure into a string. const asctime = lib.declare("asctime", ctypes.default_abi, ctypes.char.ptr, struct_tm.ptr); for a mo...
...t simply returns an unsigned long. example: multiple input parameters this example declares the libc asctime() function, which converts a time structure into a string. const asctime = lib.declare("asctime", ctypes.default_abi, ctypes.char.ptr, struct_tm.ptr); for a more complete version of this example (including the implementation of the struct_tm type), see the structures example. returned values if the return type can fit into a javascript number without loss (that is, it's a number 32 bits or smaller, or is a double or float), then the function just return a javascript number. for everything else it returns a ctypes object representing the return value (including 64-bit integers). ...
js-ctypes reference
s a new type describing a c function. data these are instances of types, represented by cdata objects and instantiated by calling ctype objects as functions. these distinctions are crucial, and understanding them will alleviate much of the confusion surrounding js-ctypes. calling a type constructor will return a ctype. calling a ctype will return a cdata. you declare the arguments and return value of a native function with ctype objects. you call a native function with cdata objects. other features error-handling js-ctypes supports both errno (on all platforms) and getlasterror (on windows platforms). callbacks you can pass regular javascript functions as callbacks to native functions. see the callbacks page for details. 64-bit integer handling because javascript number objects can'...
...a native function with cdata objects. other features error-handling js-ctypes supports both errno (on all platforms) and getlasterror (on windows platforms). callbacks you can pass regular javascript functions as callbacks to native functions. see the callbacks page for details. 64-bit integer handling because javascript number objects can't directly represent every possible 64-bit integer value, js-ctypes provides new types for these. see int64 and uint64. ...
Flash Activation: Browser Comparison - Plugins
using a script callback to determine when a plugin is activated similarly, a site's script shouldn't attempt to script a plugin immediately upon creation. instead, the plugin object should call into a javascript function upon creation. that function can...
... instead, the plugin object should call into a javascript function upon creation. that function can then issue the call into the plugin, knowing that everything is set up and ready to go. ...
Browser Side Plug-in API - Plugins
eam. npn_forceredraw forces a paint message for a windowless plug-in. npn_getauthenticationinfo this function is called by plug-ins to get http authentication information from the browser. npn_geturl asks the browser to create a stream for the specified url. npn_geturlnotify requests creation of a new stream with the contents of the specified url; gets notification of the result. npn_getvalue allows the plug-in to query the browser for information. npn_getvalueforurl provides information to a plug-in which is associated with a given url, for example the cookies or preferred proxy. npn_invalidaterect invalidates specified drawing area prior to repainting or refreshing a windowless plug-in. npn_invalidateregion invalidates specified drawing region prior to repainting or refreshi...
...n was initiated). npn_poppopupsenabledstate pops the popups-enabled state. npn_posturl posts data to a url. npn_posturlnotify posts data to a url, and receives notification of the result. npn_pushpopupsenabledstate pushes the popups-enabled state. npn_reloadplugins reloads all plug-ins in the plugins directory. npn_requestread requests a range of bytes for a seekable stream. npn_setvalue sets windowless plug-in as transparent or opaque. npn_setvalueforurl allows a plug-in to change the stored information associated with a url, in particular its cookies. npn_status displays a message on the status line of the browser window. npn_useragent returns the browser's user agent field. npn_version returns version information for the plug-in api. npn_write pushes data into a st...
Plug-in Side Plug-in API - Plugins
nteract, see the how plug-ins work and overview of plug-in structure sections in the introduction. plugin method summary npp_destroy deletes a specific instance of a plug-in. npp_destroystream tells the plug-in that a stream is about to be closed or destroyed. np_getentrypoints undocumented. np_getmimedescription registers the mime types supported by the plug-in (unix, mac os). npp_getvalue allows the browser to query the plug-in for information. np_getvalue allows the browser to query the plug-in for information. npp_handleevent delivers a platform-specific window event to the instance. np_initialize provides global initialization for a plug-in. npp_new creates a new instance of a plug-in. npp_newstream notifies a plug-in instance of a new data stream. npp_print reques...
...wser to query the plug-in for information. npp_handleevent delivers a platform-specific window event to the instance. np_initialize provides global initialization for a plug-in. npp_new creates a new instance of a plug-in. npp_newstream notifies a plug-in instance of a new data stream. npp_print requests a platform-specific print operation for an embedded or full-screen plug-in. npp_setvalue sets information about the plug-in. npp_setwindow tells the plug-in when a window is created, moved, sized, or destroyed. np_shutdown provides global deinitialization for a plug-in. npp_streamasfile provides a local file name for the data from a stream. npp_urlnotify notifies the instance of the completion of a url request. npp_write delivers data to a plug-in instance. npp_writeready...
Version, UI, and Status Information - Plugins
ering version numbers may mean that the current plug-in api and the browser versions are incompatible. changes to the minor version numbers indicate a smaller difference than changes to the major version. changes to the major version numbers probably indicate incompatibility. the plug-in calls the npn_version method to check for changes in major and minor plug-in api version numbers. it gets the values from the plug-in rather than from the browser. void npn_version(int *plugin_major, int *plugin_minor, int *netscape_major, int *netscape_minor); this function returns the plug-in version number in plugin_major, the plug-in point release number in plugin_minor, the browser version number in netscape_major, and the browser point release number in netscape_minor. this code declares var...
...indowless support */ return true; } detecting windowless support on other platforms browser implementations on other platforms did not have windowless plug-in support at the time it was added to ms windows and mac os x, so a different method must be used to detect whether the browser provides support. bool has_windowless() { npbool supportswindowless = false; nperror ret = npn_getvalue(instance, npnvsupportswindowless, &supportswindowless); return ret == nperr_no_error && supportswindowless; } reloading a plug-in when the browser starts up, it loads all the plug-ins it finds in the plugins directory for the platform. if you call npn_reloadplugins, the browser reloads all plug-ins in the plugins directory without restarting. this causes the browser to install a new plug-i...
Set a logpoint - Firefox Developer Tools
rather than sprinkle console.log() statements throughout your code, you can use a special type of breakpoint, the logpoint. logpoints print a message to the console panel instead of pausing code execution. the logpoint is especially useful in cases where breaking the execution breaks testing procedures, such as when you are debugging popup windows, or executing focus-related logic. to create a logpoint: right click on a line number in the debugger panel and pick add log action from the context menu. create an expression inline. the result is logged in the console panel every time the line with the logpoint executes. ...
...ogged to the console. you can make it easier to see the message by opening a split console under the debugger. (either press esc or select the elipsis menu (...) and then click show split console.) when should you use logpoints? when you want to know that a specific line in your code has executed, but you don’t want to break code execution, set a logpoint. logpoints are useful to log the value of a variable at a specific point in the code. it’s faster than changing the underlying source code itself to add calls to the console.log method. if you need to execute additional logic related to the source code and you can’t change the source code itself, you can use a logpoint. note that you can use logpoints with source-mapped code, as well as with your unmapped source files. ...
The Firefox JavaScript Debugger - Firefox Developer Tools
set a logpoint set watch expressions reference keyboard shortcuts source map errors ...
... set a logpoint set watch expressions reference keyboard shortcuts source map errors ...
CSS Flexbox Inspector: Examine Flexbox layouts - Firefox Developer Tools
. ...
...w details about that element: this view shows information about the calculations for the size of the selected flex item: a diagram visualizing the sizing of the flex item content size - the size of the component without any restraints imposed on it by its parent flexibility - how much a flex item grew or shrunk based on its flex-grow value when there is extra free space or its flex-shrink value when there is not enough space minimum size (only appears when an item is clamped to its minimum size) - the minimum content size of a flex item when there is no more free space in the flex container final size - the size of the flex item after all sizing constraints imposed on it have been applied (based on the values of flex-grow, flex-shrink and flex-basis) at the top of the section is a d...
Storage Inspector - Firefox Developer Tools
u'll also have buttons available to add a new storage entry or refresh the view of the currently viewed storage type where applicable (you can't add new entries to indexeddb or cache): sidebar when you select any row in the storage table widget, the sidebar is shown with details about that row. if a cookie is selected, it will list all the details about that cookie. ...
...hown with details about that row. if a cookie is selected, it will list all the details about that cookie. the sidebar can parse the value of the cookie or local storage item or an indexeddb item and convert it into a meaningful object instead of just a string. for example: a stringified json like '{"foo": "bar"}' is shown as the origin json: {foo: "bar"}. a string containing a key separated value, like "1~2~3~4" or "1=2=3=4" is shown like an array: [1, 2, 3, 4]. a string containing key-value pairs, like "id=1234:foo=bar" is shown as json: {id:1234, foo: "bar"}. the shown values can also be filtered using the search box at the top of the sidebar. working with the storage inspector the following articles cover different aspects of using the network monitor: cookies local storage / ...
Tips - Firefox Developer Tools
ector icon () next to any selector to highlight all elements that match it. click the inspector icon () next to the element{} rule to lock the highlighter on the current element. right-click any property and select "show mdn docs" to view the mdn docs for this property. click on the filter icon () next to an overridden property to find which other property overrides it. right-click on a name, value, or rule to copy anything from the name, the value, the declaration or the whole rule to your clipboard. web console in all panels: esc opens the split console; useful when debugging, or inspecting nodes in the command line: $0 references the currently selected node. $() is a shortcut to document.queryselector(). $$() returns an array with the results from document.queryselectorall()...
...ch caused the request. check "disable http cache (when toolbox is open)" in the settings to disable the network cache while debugging network issues. storage inspector right-click the column headers to open a menu allowing to toggle the display of the columns. right-click an entry and click "delete name" to delete it or "delete all" to delete all entries. select an entry to see the parsed value of it in the sidebar. ...
Web Console Helpers - Firefox Developer Tools
l example of recursion, it brings you to this page. inspect() given an object, generates rich output for that object. once you select the object in the output area, you can use the arrow keys to navigate the object. keys() given an object, returns a list of the keys (or property names) on that object. this is a shortcut for object.keys. pprint() obsolete since gecko 74 formats the specified value in a readable way; this is useful for dumping the contents of objects and arrays. :screenshot creates a screenshot of the current page with the supplied filename. if you don't supply a filename, the image file will be named with the following format: screen shot yyy-mm-dd at hh.mm.ss.png the command has the following optional parameters: command type description ...
... the css query selector for a single element on the page. when supplied, only this element will be included in the screenshot. :unblock (starting in firefox 80) followed by an unquoted string, removes blocking for urls containing that string. in the network monitor, the string is removed from the request blocking sidebar. no error is given if the string was not previously blocked. values() given an object, returns a list of the values on that object; serves as a companion to keys(). please refer to the console api for more information about logging from content. variables tempn the "use in console" option in the inspector generates a variable for a node named temp0, temp1, temp2, etc. referencing the node. examples looking at the contents of a dom node let's say you ...
ANGLE_instanced_arrays.drawArraysInstancedANGLE() - Web APIs
webgl api renders primitives from array data like the gl.drawarrays() method. in addition, it can execute multiple instances of the range of elements. note: when using webgl2, this method is available as gl.drawarraysinstanced() by default. syntax void ext.drawarraysinstancedangle(mode, first, count, primcount); parameters mode a glenum specifying the type primitive to render. possible values are: gl.points: draws a single dot. gl.line_strip: draws a straight line to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. first a glint specifying the sta...
...ines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. first a glint specifying the starting index in the array of vector points. count a glsizei specifying the number of indices to be rendered. primcount a glsizei specifying the number of instances of the range of elements to execute. return value none. exceptions if mode is not one of the accepted values, a gl.invalid_enum error is thrown. if first, count or primcount are negative, a gl.invalid_value error is thrown. if gl.current_program is null, a gl.invalid_operation error is thrown. examples var ext = gl.getextension('angle_instanced_arrays'); ext.drawarraysinstancedangle(gl.points, 0, 8, 4); specifications speci...
AbstractRange.collapsed - Web APIs
a collapsed range is one in which the start and end positions are the same, resulting in a zero-character-long range.. ...
...a collapsed range is one in which the start and end positions are the same, resulting in a zero-character-long range.. ...
AesGcmParams - Web APIs
properties name a domstring. this should be set to aes-gcm. ...
...1. the additionaldata property is optional and may be omitted without compromising the security of the encryption operation. taglength optional a number. this determines the size in bits of the authentication tag generated in the encryption operation and used for authentication in the corresponding decryption. according to the web crypto specification this must have one of the following values: 32, 64, 96, 104, 112, 120, or 128. the aes-gcm specification recommends that it should be 96, 104, 112, 120 or 128, although 32 or 64 bits may be acceptable in some applications: appendix c of the specification provides additional guidance here. taglength is optional and defaults to 128 if it is not specified. examples see the examples for subtlecrypto.encrypt() and subtlecrypto.decrypt(...
Ambient Light Events - Web APIs
tevent event that provides information about the exact light intensity (in lux units). this event can be captured at the window object level by using the addeventlistener method (using the devicelight event name) or by attaching an event handler to the window.ondevicelight property. ...
...(using the devicelight event name) or by attaching an event handler to the window.ondevicelight property. once captured, the event object gives access to the light intensity expressed in lux through the devicelightevent.value property. ...
AnalyserNode.getByteFrequencyData() - Web APIs
the getbytefrequencydata() method of the analysernode interface copies the current frequency data into a uint8array (unsigned byte array) passed into it. the frequency data is composed of integers on a scale from 0 to 255. each item in the array represents the decibel value for a specific frequency. the frequencies are spread linearly from 0 to 1/2 of the sample rate. for example, for 48000 sample rate, the last item of the array 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); // uin...
...r = 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 has more elements than needed, excess elements are ignored. return value none. example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect frequency data repeatedly and draw a "winamp ...
AnalyserNode.maxDecibels - Web APIs
the maxdecibels property of the analysernode interface is a double value representing the maximum power value in the scaling range for the fft analysis data, for conversion to unsigned byte/float values — basically, this specifies the maximum value for the range of results when using getfloatfrequencydata() or getbytefrequencydata(). syntax var curvalue = analysernode.maxdecibels; analysernode.maxdecibels = newvalue; value a double, representing the maximum decibel value for scaling the fft analysis data, where 0 db is the loudest possible sound, -10 db is a 10th of that, etc. the default value is -30 db. when getting data from getfloatfrequencydata() or getbytefrequencydata(), any frequencies with an amplitude of maxdecibels or higher will be returned as +1.0 or 255, respectively. no...
... example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input. ...
AnalyserNode.minDecibels - Web APIs
the mindecibels property of the analysernode interface is a double value representing the minimum power value in the scaling range for the fft analysis data, for conversion to unsigned byte/float values — basically, this specifies the minimum value for the range of results when using getfloatfrequencydata() or getbytefrequencydata(). syntax var curvalue = analysernode.mindecibels; analysernode.mindecibels = newvalue; value a double, representing the minimum decibel value for scaling the fft analysis data, where 0 db is the loudest possible sound, -10 db is a 10th of that, etc. the default value is -100 db. when getting data from getfloatfrequencydata() or getbytefrequencydata(), any frequencies with an amplitude of mindecibels or lower will be returned as 0.0 or 0, respectively. note...
... example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input. ...
Animation.startTime - Web APIs
the animation.starttime property of the animation interface is a double-precision floating-point value which indicates the scheduled time when an animation's playback should begin. an animation’s start time is the time value of its documenttimeline when its target keyframeeffect is scheduled to begin playback. an animation’s start time is initially unresolved (meaning that it's null because it has no value). syntax var animationstartedwhen = animation.starttime; animation.starttime = newstarttime; value a floating-point number representing the current time in milliseconds, or null if no time is set. you can read this value to determine what the start time is currently set at, and you can change this value to make the animation start at a different time. examples in the running o...
...d by default and defaults to 20us in firefox 59; in 60 it will be 2ms. // reduced time precision (2ms) in firefox 60 animation.starttime; // 23.404 // 24.192 // 25.514 // ... // reduced time precision with `privacy.resistfingerprinting` enabled animation.starttime; // 49.8 // 50.6 // 51.7 // ... in firefox, you can also enabled privacy.resistfingerprinting, the precision will be 100ms or the value of privacy.resistfingerprinting.reducetimerprecision.microseconds, whichever is larger. specifications specification status comment web animationsthe definition of 'animation.starttime' in that specification. working draft editor's draft. ...
Animation.updatePlaybackRate() - Web APIs
rate() the animation's playbackrate is not immediately updated. it will be updated once the animation's ready promise is resolved. syntax animation.updateplaybackrate(2); parameters playbackrate the new speed to set. this may be a positive number (to speed up or slow down the animation), a negative number (to make it play backwards), or zero (to effectively pause the animation). ...
...a positive number (to speed up or slow down the animation), a negative number (to make it play backwards), or zero (to effectively pause the animation). return value none. examples a speed selector component would benefit from smooth updating of updateplaybackrate(), as demonstrated below: speedselector.addeventlistener('input', evt => { cartoon.updateplaybackrate(parsefloat(evt.target.value)); cartoon.ready.then(() => { console.log(`playback rate set to ${cartoon.playbackrate}`); }); }); specifications specification status comment web animationsthe definition of 'updateplaybackrate()' in that specification. working draft ...
Animation - Web APIs
Web › API › Animation
the animation interface of the web animations api represents a single animation player and provides playback controls and a timeline for an animation node or source. constructor animation() creates a new animation object instance. properties animation.currenttime the current time value of the animation in milliseconds, whether running or paused. if the animation lacks a timeline, is inactive or hasn't been played yet, its value is null. animation.effect gets and sets the animationeffectreadonly associated with this animation. this will usually be a keyframeeffect object. animation.finished read only returns the current finished promise for this animation. animation.id gets and sets the string used to identify the animation. animation.pending read only indicates wheth...
...bject. animation.finished read only returns the current finished promise for this animation. animation.id gets and sets the string used to identify the animation. animation.pending read only indicates whether the animation is currently waiting for an asynchronous operation such as initiating playback or pausing a running animation. animation.playstate read only returns an enumerated value describing the playback state of an animation. animation.playbackrate gets or sets the playback rate of the animation. animation.ready read only returns the current ready promise for this animation. animation.replacestate returns the replace state of the animation. this will be active if the animation has been replaced, or persisted if animation.persist() has been invoked on it. ...
AnimationEvent - Web APIs
ospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">animationevent</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constructor animationevent() creates an animationevent event with the given parameters. properties also inherits properties from its parent event. ...
... animationevent.pseudoelement read only is a domstring, starting with '::', containing the name of the pseudo-element the animation runs on. ...
AnimationPlaybackEvent.currentTime - Web APIs
reduced time precision to offer protection against timing attacks and fingerprinting, the precision of playbackevent.currenttime might get rounded depending on browser settings. ...
... and defaults to 20us in firefox 59; in 60 it will be 2ms. // reduced time precision (2ms) in firefox 60 playbackevent.currenttime; // 23.404 // 24.192 // 25.514 // ... // reduced time precision with `privacy.resistfingerprinting` enabled playbackevent.currenttime; // 49.8 // 50.6 // 51.7 // ... in firefox, you can also enabled privacy.resistfingerprinting, the precision will be 100ms or the value of privacy.resistfingerprinting.reducetimerprecision.microseconds, whichever is larger. specifications specification status comment web animationsthe definition of 'animationplaybackevent.currenttime' in that specification. working draft editor's draft. ...
AnimationTimeline.currentTime - Web APIs
reduced time precision to offer protection against timing attacks and fingerprinting, the precision of animationtimeline.currenttime might get rounded depending on browser settings. ...
...faults to 20us in firefox 59; in 60 it will be 2ms. // reduced time precision (2ms) in firefox 60 animationtimeline.currenttime; // 23.404 // 24.192 // 25.514 // ... // reduced time precision with `privacy.resistfingerprinting` enabled animationtimeline.currenttime; // 49.8 // 50.6 // 51.7 // ... in firefox, you can also enable privacy.resistfingerprinting; the precision will be 100ms or the value of privacy.resistfingerprinting.reducetimerprecision.microseconds, whichever is larger. specifications specification status comment web animationsthe definition of 'currenttime' in that specification. working draft editor's draft. ...
AudioBuffer.duration - Web APIs
the duration property of the audiobuffer interface returns a double representing the duration, in seconds, of the pcm data stored in the buffer. syntax var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.samplerate); myarraybuffer.duration; value a double. ...
... audioctx.samplerate); myarraybuffer.duration; value a double. ...
AudioBuffer.getChannelData() - Web APIs
32array containing the pcm data associated with the channel, defined by the channel parameter (with 0 representing the first channel). syntax var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.samplerate); var nowbuffering = myarraybuffer.getchanneldata(channel); parameters channel the channel property is an index representing the particular channel to get data for. an index value of 0 represents the first channel. if the channel index value is greater than of equal to audiobuffer.numberofchannels, an index_size_err exception will be thrown. return value a float32array. example in the following example we create a two second buffer, fill it with white noise, and then play it via an audiobuffersourcenode. the comments should clearly explain what is going on. you can...
...t = document.queryselector('script'); pre.innerhtml = myscript.innerhtml; // 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.getchanneldata(channel); for (var i = 0; i < framecount; i++) { // math.random() is in [0; 1.0] // audio needs to be in [-1.0; 1.0] nowbuffering[i] = math.random() * 2 - 1; } } // get an audio...
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. ...
... audioctx.samplerate); myarraybuffer.length; value an integer. ...
AudioBuffer.numberOfChannels - Web APIs
the numberofchannels property of the audiobuffer interface returns an integer representing the number of discrete audio channels described by the pcm data stored in the buffer. syntax var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.samplerate); myarraybuffer.numberofchannels; value an integer. ...
...samplerate); myarraybuffer.numberofchannels; value an integer. ...
AudioBuffer.sampleRate - Web APIs
the samplerate property of the audiobuffer interface returns a float representing the sample rate, in samples per second, of the pcm data stored in the buffer. syntax var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.samplerate); myarraybuffer.samplerate; value a floating-point value indicating the current sample rate of the buffers data, in samples per second. ...
... current sample rate of the buffers data, in samples per second. ...
AudioBufferSourceNode.buffer - Web APIs
the buffer property of the audiobuffersourcenode interface provides the ability to play back audio using an audiobuffer as the source of the sound data. if the buffer property is set to the value null, the node generates a single channel containing silence (that is, every sample is 0). syntax audiobuffersourcenode.buffer = soundbuffer; value an audiobuffer which contains the data representing the sound which the node will play. example for a full working example, see this code running live, or view the source. ...
...tax audiobuffersourcenode.buffer = soundbuffer; value an audiobuffer which contains the data representing the sound which the node will play. example for a full working example, see this code running live, or view the source. ...
AudioContextLatencyCategory - Web APIs
the audiocontextlatencycategory type is an enumerated set of strings which are used to select one of a number of default values for acceptable maximum latency of an audio context. by using these strings rather than a numeric value when specifying a latency to a audiocontext, you can allow the user agent to select an appropriate latency for your use case that makes sense on the device on which your content is being used. audiocontextlatencycategory can be used when constructing a new audiocontext by passing one of these values as the latencyhint option in the audiocontext() constructor's options dictionary. values value description "balanced" the user agent should balance audio output latency and power consumption when selecting a latency value. "in...
... "playback" the user agent should select a latency that will maximize playback time by minimizing power consumption at the expense of latency. useful for non-interactive playback, such as playing music. ...
AudioNode.channelCountMode - Web APIs
the channelcountmode property of the audionode interface represents an enumerated value describing the way channels must be matched between the node's inputs and outputs. the possible values of channelcountmode and their meanings are: value description the following audionode children default to this value max the number of channels is equal to the maximum number of channels of all connections. in this case, channelcount is ignored and only up-mixing happens. gainnode, delaynode, scriptprocessornode, channelmergernode, biquadfilternode, waveshapernode clamped-max the number of channels is equal to the maximum number of channels of all connections, clamped to the value of channelcount. pannernode, convolvernode, dynamicscompressornode ...
... is ignored and only up-mixing happens. gainnode, delaynode, scriptprocessornode, channelmergernode, biquadfilternode, waveshapernode clamped-max the number of channels is equal to the maximum number of channels of all connections, clamped to the value of channelcount. pannernode, convolvernode, dynamicscompressornode explicit the number of channels is defined by the value of channelcount. audiodestinationnode, analysernode, channelsplitternode in older versions of the spec, the default for a channelsplitternode was max. syntax var oscillator = audioctx.createoscillator(); oscillator.channelcountmode = 'explicit'; value a enumerated value representing a channelcountmode. example var audiocontext = window.audiocontext || window.webkitaudiocontext;...
AudioNode.channelInterpretation - Web APIs
this interpretation will define how audio up-mixing and down-mixing will happen. when the number of channels doesn't match between an input and an output, up- or down-mixing happens according the following rules. this can be somewhat controlled by setting the audionode.channelinterpretation property to speakers or discrete: interpretation input channels output channels mixing rules speakers 1 (mono) 2 (stereo) up-mix from mono to stereo. the m input channel is used for both output channels (l and r). ...
... no corresponding input channels are left silent. any (x) any (y) where x>y down-mix discrete channels. fill each output channel with its input counterpart, that is the input channel with the same index. input channels with no corresponding output channels are dropped. syntax var oscillator = audioctx.createoscillator(); oscillator.channelinterpretation = 'discrete'; value an enumerated value representing a channelinterpretation. example var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); var oscillator = audioctx.createoscillator(); var gainnode = audioctx.creategain(); oscillator.connect(gainnode); gainnode.connect(audioctx.destination); oscillator.channelinterpretation = 'discrete'; specifications ...
AudioNodeOptions - Web APIs
syntax var audionodeoptions = { "channelcount" : 2, "channelcountmode" : "max", "channelinterpretation" : "discrete" } properties channelcount optional represents an integer used to determine how many channels are used when up-mixing and down-mixing connections to any inputs to the node. (see audionode.channelcount for more information.) its usage and precise definition depend on the value of audionodeoptions.channelcountmode. channelcountmode optional represents an enumerated value describing the way channels must be matched between the node's inputs and outputs. (see audionode.channelcountmode for more information including default values.) channelinterpretation optional represents an enumerated value describing the meaning of the channels. this interpretation will define how...
...ional represents an enumerated value describing the way channels must be matched between the node's inputs and outputs. (see audionode.channelcountmode for more information including default values.) channelinterpretation optional represents an enumerated value describing the meaning of the channels. this interpretation will define how audio up-mixing and down-mixing will happen. the possible values are "speakers" or "discrete". (see audionode.channelcountmode for more information including default values.) specifications specification status comment web audio apithe definition of 'audionodeoptions' in that specification. working draft initial definition. ...
AudioScheduledSourceNode.start() - Web APIs
the start() method on audioscheduledsourcenode schedules a sound to begin playback at the specified time. if no time is specified, then the sound begins playing immediately. syntax audioscheduledsourcenode.start([when [, offset [, duration]]]); parameters when optional the time, in seconds, at which the sound should begin to play. this value is specified in the same time coordinate system as the audiocontext is using for its currenttime attribute. a value of 0 (or omitting the when parameter entirely) causes the sound to start playback immediately. offset optional a floating-point number indicating the offset, in seconds, into the audio buffer where playback should begin. if 0 is passed then the playback will start from the beginning. duration optional a floating-point number indic...
...te. a value of 0 (or omitting the when parameter entirely) causes the sound to start playback immediately. offset optional a floating-point number indicating the offset, in seconds, into the audio buffer where playback should begin. if 0 is passed then the playback will start from the beginning. duration optional a floating-point number indicating the duration, in seconds, to be played. if no value is passed then the duration will be equal to the length of the audio buffer minus the offset value return value undefined exceptions 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 oscill...
AudioTrack - Web APIs
id read only a domstring which uniquely identifies the track within the media. ...
... id read only a domstring which uniquely identifies the track within the media. ...
AudioTrackList: change event - Web APIs
ple by changing the track's enabled property. ...
... living standard ...
AudioTrackList.length - Web APIs
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(). ...
...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(). ...
AudioWorkletGlobalScope.registerProcessor - Web APIs
audioworkletglobalscope interface registers a class constructor derived from audioworkletprocessor interface under a specified name. syntax audioworkletglobalscope.registerprocessor(name, processorctor); parameters name a string representing the name under which the processor will be registered. processorctor the constructor of a class derived from audioworkletprocessor. ...
...registering the same name twice is not allowed. ...
AudioWorkletNode() - Web APIs
ions dictionary, which contains zero or more optional properties to configure the new node. the result of the structured clone algorithm applied to the object is also internally passed into the associated audioworkletprocessor() constructor — this allows custom initialization of an underlying user-defined audioworkletprocessor. available properties are as follows: numberofinputs optional the value to initialize the numberofinputs property to. defaults to 1. numberofoutputs optional the value to initialize the numberofoutputs property to. defaults to 1. outputchannelcount optional an array defining the number of channels for each output. for example, outputchannelcount: [n, m] specifies the number of channels in the first output to be n and the second output to be m. the array length mu...
...nal 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 newly constructed audioworkletnode instance. exceptions notsupportederror the specified...
AudioWorkletProcessor - Web APIs
audioworkletprocessor interface doesn't respond to any events. usage notes deriving classes to define custom audio processing code you have to derive a class from the audioworkletprocessor interface. although not defined on the interface, the deriving class must have the process method. this method gets called for each block of 128 sample-frames and takes input and output arrays and calculated values of custom audioparams (if they are defined) as parameters. you can use inputs and audio parameter values to fill the outputs array, which by default holds silence. optionally, if you want custom audioparams on your node, you can supply a parameterdescriptors property as a static getter on the processor. the array of audioparamdescriptor-based objects returned is used internally to create the au...
... audioparams on your node, you can supply a parameterdescriptors property as a static getter on the processor. the array of audioparamdescriptor-based objects returned is used internally to create the audioparams during the instantiation of the audioworkletnode. the resulting audioparams reside in the parameters property of the node and can be automated using standard methods such as linearramptovalueattime. their calculated values will be passed into the process() method of the processor for you to shape the node output accordingly. processing audio an example algorithm of creating a custom audio processing mechanism is: create a separate file; in the file: extend the audioworkletprocessor class (see "deriving classes" section) and supply your own process() method in it; regist...
AuthenticatorAssertionResponse.authenticatorData - Web APIs
the authenticatordata property of the authenticatorassertionresponse 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.bytelength 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 w...
...ations. the credential is "credentialidlength" 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. ...
AuthenticatorAssertionResponse.signature - Web APIs
tor does possess the private key which was used for the credential's generation. note: an authenticatorassertionresponse instance is available on publickeycredential.response after calling navigator.credentials.get(). note: this property may only be used in top-level contexts and will not be available in an <iframe> for example. ...
...ponse.signature value an arraybuffer object which the signature of the authenticator (using its private key) for both authenticatorassertionresponse.authenticatordata and a sha-256 hash given by the client for its data (the challenge, the origin, etc. and available from authenticatorassertionresponse.clientdatajson). ...
AuthenticatorAttestationResponse.getTransports() - Web APIs
tor is not removable from the device). note: an authenticatorattestationresponse instance is available on publickeycredential.response after calling navigator.credentials.create(). note: this method may only be used in top-level contexts and will not be available in an <iframe> for example. syntaxe arrtransports = authenticatorattestationresponse.gettransports() parameters none. ...
...n an <iframe> for example. syntaxe arrtransports = authenticatorattestationresponse.gettransports() parameters none. return value an array containing the different transports supported by the authenticator or nothing if this information is not available.of the processing of the different extensions by the client. the elements of this array are supposed to be in lexicographical order. their values may be : "usb": the authenticator can be contacted via a removable usb link "nfc": the authenticator may be used over nfc (near field communication) "ble": the authenticator may be used over ble (bluetooth low energy) "internal": the authenticator is specifically bound to the client device (cannot be removed). examples var publickey = { challenge: /* from the server */, rp: { na...
AuthenticatorResponse.clientDataJSON - Web APIs
lient data that was passed to credentialscontainer.create() or credentialscontainer.get(). this property is only accessed on one of the child objects of authenticatorresponse, specifically authenticatorattestationresponse or authenticatorassertionresponse. syntax var arraybuffer = authenticatorattestationresponse.clientdatajson; var arraybuffer = authenticatorassertionresponse.clientdatajson; value an arraybuffer. properties after the clientdatajson object is converted from an arraybuffer to a javascript object, it will have the following properties: type a string which is either "webauthn.get" when an existing credential is retrieved or "webauthn.create" when a new credential is created. challenge the base64url encoded version of the cryptographic challenge sent from the relying p...
...s after the clientdatajson object is converted from an arraybuffer to a javascript object, it will have the following properties: type a string which is either "webauthn.get" when an existing credential is retrieved or "webauthn.create" when a new credential is created. challenge the base64url encoded version of the cryptographic challenge sent from the relying party's server. the original value is passed via publickeycredentialrequestoptions.challenge or publickeycredentialcreationoptions.challenge. origin the fully qualified origin of the requester which has been given by the client/browser to the authenticator. we should expect the relying party's id to be a suffix of this value. tokenbindingid optional an object describing the state of the token binding protocol for the communi...
BaseAudioContext.createBiquadFilter() - Web APIs
working draft ...
... working draft ...
BaseAudioContext.createDelay() - Web APIs
working draft ...
... working draft ...
BaseAudioContext.createGain() - Web APIs
the creategain() method of the baseaudiocontext interface creates a gainnode, which can be used to control the overall gain (or volume) of the audio graph. syntax var gainnode = audiocontext.creategain(); return value a gainnode which takes as input one or more audio sources and outputs audio whose volume has been adjusted in gain (volume) to a level specified by the node's gainnode.gain a-rate parameter. example the following example shows basic usage of an audiocontext to create a gainnode, which is then used to mute and unmute the audio when a mute button is clicked by changing the gain property value. the below snippet wouldn't work as is — for a complete working example, check out our voice-change-o-matic demo (view source.) <div> <button class="mute">mute button</button> </...
... ); } else { console.log('getusermedia not supported on your browser!'); } source.connect(gainnode); gainnode.connect(audioctx.destination); ... mute.onclick = voicemute; function voicemute() { if(mute.id == "") { // 0 means mute. if you still hear something, make sure you haven't // connected your source into the output in addition to using the gainnode. gainnode.gain.setvalueattime(0, audioctx.currenttime); mute.id = "activated"; mute.innerhtml = "unmute"; } else { gainnode.gain.setvalueattime(1, audioctx.currenttime); mute.id = ""; mute.innerhtml = "mute"; } } specifications specification status comment web audio apithe definition of 'creategain()' in that specification. working draft ...
BaseAudioContext.createIIRFilter() - Web APIs
the createiirfilter() method of the baseaudiocontext interface creates 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. ...
...neral 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. exceptions invalidstateerror all of the ...
BasicCardRequest - Web APIs
mple below) contains a data property that has to conform to the structure defined by the basiccardrequest dictionary. ...
...y. var supportedinstruments = [{ supportedmethods: 'basic-card', data: { supportednetworks: ['visa', 'mastercard', 'amex', 'jcb', 'diners', 'discover', 'mir', 'unionpay'] } }]; var details = { total: {label: 'donation', amount: {currency: 'usd', value: '65.00'}}, displayitems: [ { label: 'original donation amount', amount: {currency: 'usd', value: '65.00'} } ], shippingoptions: [ { id: 'standard', label: 'standard shipping', amount: {currency: 'usd', value: '0.00'}, selected: true } ] }; var options = {requestshipping: true}; try { var request = new paymentrequest(supportedinstruments, details, options); // add event listeners here. // call show() to trigger the browser's payment flow. r...
BatteryManager - Web APIs
the batterymanager interface provides ways to get information about the system's battery charge level. the navigator.getbattery() method returns a battery promise that is resolved in a batterymanager interface which you can use to interact with the battery status api. properties batterymanager.charging read only a boolean value indicating whether or not the battery is currently being charged. batterymanager.chargingtime read only a number representing the remaining time in seconds until the battery is fully charged, or 0 if the battery is already fully charged. batterymanager.dischargingtime read only a number representing the remaining time in seconds until the battery is completely discharged and the system will suspend. batterymanager.level read only a number representing ...
...mber representing the remaining time in seconds until the battery is fully charged, or 0 if the battery is already fully charged. batterymanager.dischargingtime read only a number representing the remaining time in seconds until the battery is completely discharged and the system will suspend. batterymanager.level read only a number representing the system's battery charge level scaled to a value between 0.0 and 1.0. event handlers batterymanager.onchargingchange a handler for the chargingchange event; this event is sent when the battery charging state is updated. batterymanager.onchargingtimechange a handler for the chargingtimechange event; this event is sent when the battery charging time is updated batterymanager.ondischargingtimechange a handler for the dischargingtimechang...
Blob() - Web APIs
Web › API › Blob › Blob
the blob() constructor returns a new blob object. the content of the blob consists of the concatenation of the values given in the parameter array. syntax var newblob = new blob(array, options); parameters array an array of arraybuffer, arraybufferview, blob, usvstring objects, or a mix of any of such objects, that will be put inside the blob. usvstring objects are encoded as utf-8. options optional an optional object of type blobpropertybag which may specify any of the following properties: type optional the mime type of the data that will be stored into the blob. the default value is the empty string, (""). ...
...usvstring objects are encoded as utf-8. options optional an optional object of type blobpropertybag which may specify any of the following properties: type optional the mime type of the data that will be stored into the blob. the default value is the empty string, (""). endings optional how to interpret newline characters (\n) within the contents, if the data is text. the default value, transparent, copies newline characters into the blob without changing them. to convert newlines to the host system's native convention, specify the value native. return value a new blob object containing the specified data. example var afileparts = ['<a id="a"><b id="b">hey!</b></a>']; // an array consisting of a single domstring var omyblob = new blob(afileparts, {type : 'text/html'});...
CSSPseudoElement.type - Web APIs
the type read-only property of the csspseudoelement interface returns the type of the pseudo-element as a string, represented in the form of a css selector. ...
... the type read-only property of the csspseudoelement interface returns the type of the pseudo-element as a string, represented in the form of a css selector. ...
CSSStyleDeclaration.removeProperty() - Web APIs
the cssstyledeclaration.removeproperty() method interface removes a property from a css style declaration object. syntax var oldvalue = style.removeproperty(property); parameters property is a domstring representing the property name to be removed. note that multi-word property names are hyphenated and not camel-cased. return value oldvalue is a domstring equal to the value of the css property before it was removed. exceptions domexception no_modification_allowed_err: if the property or declaration block is read only. ...
...ot camel-cased. return value oldvalue is a domstring equal to the value of the css property before it was removed. exceptions domexception no_modification_allowed_err: if the property or declaration block is read only. example the following javascript code removes the background-color css property from a selector rule: var declaration = document.stylesheets[0].rules[0].style; var oldvalue = declaration.removeproperty('background-color'); specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration.removeproperty()' in that specification. working draft document object model (dom) level 2 style specificationthe definition of 'cssstyledeclaration' in that specification. obsolete ...
CSSStyleDeclaration - Web APIs
. cssstyledeclaration.parentruleread only the containing cssrule. css properties cssstyledeclaration.cssfloat special alias for the float css property. cssstyledeclaration named properties dashed and camel-cased attributes for all supported css properties. methods cssstyledeclaration.getpropertypriority() returns the optional priority, "important". cssstyledeclaration.getpropertyvalue() returns the property value given a property name. cssstyledeclaration.item() returns a css property name by its index, or the empty string 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. cssstyledeclaration.removeproperty() removes a property from...
...ve to accessing nodelist[i] (which instead returns undefined when i is out-of-bounds). this is mostly useful for non-javascript dom implementations. cssstyledeclaration.removeproperty() removes a property from the css declaration block. cssstyledeclaration.setproperty() 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 ...
CSSStyleRule - Web APIs
specifications specification status comment css object model (cssom)the definition of 'cssstylerule' in that specification. ...
... specifications specification status comment css object model (cssom)the definition of 'cssstylerule' in that specification. ...
Using dynamic styling information - Web APIs
er</div> <button onclick="stilo()">click here to change text color</button> <button onclick="resetstyle()">reset text color</button> </body> </html> the media and type of the style may or may not be given. using the setattribute method note that you can also change style of an element by getting a reference to it and then use its setattribute method to specify the css property and its value. ...
...ethod to specify the css property and its value. var el = document.getelementbyid('some-element'); el.setattribute('style', 'background-color:darkblue;'); be aware, however, that setattribute removes all other style properties that may already have been defined in the element's style object. if the some-element element above had an in–line style attribute of say style="font-size: 18px", that value would be removed by the use of setattribute. ...
CSS Painting API - Web APIs
the css painting api — part of the css houdini umbrella of apis — allows developers to write javascript functions that can draw directly into an element's background, border, or content. concepts and usage essentially, the css painting api contains functionality allowing developers to create custom values for paint(), a css <image> function. you can then apply these values to properties like background-image to set complex custom backgrounds on an element. for example: aside { background-image: paint(mypaintedimage); } the api defines paintworklet, a worklet that can be used to programmatically generate an image that responds to computed style changes. to find out more about how this is used, consult using the css painting api. interfaces paintworklet programmatically generates...
...rklet programmatically generates an image where a css property expects a file. access this interface through css.paintworklet. paintworkletglobalscope the global execution context of the paintworklet. paintrenderingcontext2d implements a subset of the canvasrenderingcontext2d api. it has an output bitmap that is the size of the object it is rendering to. paintsize returns the read-only values of the output bitmap's width and height. dictionaries paintrenderingcontext2dsettings a dictionary providing a subset of canvasrenderingcontext2d settings. examples to draw directly into an element's background using javascript in our css, we define a paint worklet using the registerpaint() function, tell the document to include the worklet using the paintworklet addmodule() method, the...
Cache.delete() - Web APIs
Web › API › Cache › delete
ry has been deleted if found }); parameters request the request you are looking to delete. this can be a request object or a url. options optional an object whose properties control how matching is done in the delete operation. the available options are: ignoresearch: a boolean that specifies whether the matching process should ignore the query string in the url. if set to true, the ?value=bar part of http://foo.com/?value=bar would be ignored when performing a match. it defaults to false. ignoremethod: a boolean that, when set to true, prevents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false. ignorevary: a boolean that, when set to true, tells the matching operation not to perform vary header matching. ...
...se. ignorevary: a boolean that, when set to true, tells the matching operation not to perform vary header matching. in other words, if the url matches you will get a match regardless of whether the response object has a vary header. it defaults to false. cachename: a domstring that represents a specific cache to search within. note that this option is ignored by cache.delete(). return value a promise that resolves to true if the cache entry is deleted, or false otherwise. examples caches.open('v1').then(function(cache) { cache.delete('/images/image.png').then(function(response) { someuiupdatefunction(); }); }) specifications specification status comment service workersthe definition of 'cache: delete' in that specification. working draft in...
Cache.keys() - Web APIs
Web › API › Cache › keys
ts }); parameters request optional the request want to return, if a specific key is desired. this can be a request object or a url. options optional an object whose properties control how matching is done in the keys operation. the available options are: ignoresearch: a boolean that specifies whether the matching process should ignore the query string in the url. if set to true, the ?value=bar part of http://foo.com/?value=bar would be ignored when performing a match. it defaults to false. ignoremethod: a boolean that, when set to true, prevents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false. ignorevary: a boolean that, when set to true, tells the matching operation not to perform vary header matching. ...
...alse. ignorevary: a boolean that, when set to true, tells the matching operation not to perform vary header matching. in other words, if the url matches you will get a match regardless of whether the response object has a vary header. it defaults to false. cachename: a domstring that represents a specific cache to search within. note that this option is ignored by cache.keys(). return value a promise that resolves to an array of cache keys. examples caches.open('v1').then(function(cache) { cache.keys().then(function(keys) { keys.foreach(function(request, index, array) { cache.delete(request); }); }); }) specifications specification status comment service workersthe definition of 'cache: keys' in that specification. working draft i...
Cache.match() - Web APIs
Web › API › Cache › match
// do something with the response }); parameters request the request for which you are attempting to find responses in the cache. this can be a request object or a url. options optional an object that sets options for the match operation. the available options are: ignoresearch: a boolean that specifies whether to ignore the query string in the url. for example, if set to true the ?value=bar part of http://foo.com/?value=bar would be ignored when performing a match. it defaults to false. ignoremethod: a boolean that, when set to true, prevents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false. ignorevary: a boolean that when set to true tells the matching operation not to perform vary header matching —...
...t to true, prevents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false. ignorevary: a boolean that when set to true tells the matching operation not to perform vary header matching — i.e. if the url matches you will get a match regardless of whether the response object has a vary header. it defaults to false. return value a promise that resolves to the first response that matches the request or to undefined if no match is found. note: cache.match() is basically identical to cache.matchall(), except that rather than resolving with an array of all matching responses, it resolves with the first matching response only (that is, response[0]). examples this example is taken from the custom offline page example (li...
Cache.matchAll() - Web APIs
Web › API › Cache › matchAll
ache. this can be a request object or a url. if this argument is omitted, you will get a copy of all responses in this cache. options optional an options object allowing you to set specific control options for the matching performed. the available options are: ignoresearch: a boolean that specifies whether the matching process should ignore the query string in the url. if set to true, the ?value=bar part of http://foo.com/?value=bar would be ignored when performing a match. it defaults to false. ignoremethod: a boolean that, when set to true, prevents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false. ignorevary: a boolean that when set to true tells the matching operation not to perform vary header matching —...
...to true, prevents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false. ignorevary: a boolean that when set to true tells the matching operation not to perform vary header matching — i.e. if the url matches you will get a match regardless of the response object having a vary header or not. it defaults to false. return value a promise that resolves to an array of all matching responses in the cache object. note: cache.match() is basically identical to cache.matchall(), except that rather than resolving with an array of all matching responses, it resolves with the first matching response only (that is, response[0]). examples caches.open('v1').then(function(cache) { cache.matchall('/images/').then(function(resp...
Cache.put() - Web APIs
Web › API › Cache › put
the put() method of the cache interface allows key/value pairs to be added to the current cache object. often, you will just want to fetch() one or more requests, then add the result straight to your cache. in such cases you are better off using cache.add()/cache.addall(), as they are shorthand functions for one or more of these operations. fetch(url).then(function(response) { if (!response.ok) { throw new typeerror('bad response status'); } return cache.put(url, response); }) note: put() will overwrite any key/value pair previously stored in the cache that matches the request. note: cache.add/cache.addall do not cache responses with response.status values that are not in the 200 range, whereas cache.put lets you store any request/response pair. as a result, cache.add/cache.
... any request/response pair. as a result, cache.add/cache.addall can't be used to store opaque responses, whereas cache.put can. syntax cache.put(request, response).then(function() { // request/response pair has been added to the cache }); parameters request the request object or url that you want to add to the cache. response the response you want to match up to the request. return value a promise that resolves with undefined. note: the promise will reject with a typeerror if the url scheme is not http or https. examples this example is from the mdn sw-test example (see sw-test running live). here we wait for a fetchevent to fire. we construct a custom response like so: check whether a match for the request is found in the cachestorage using cachestorage.match(). if so, ...
Cache - Web APIs
Web › API › Cache
isk space, but it may delete the cache storage for an origin. the browser will generally delete all of the data for an origin or none of the data for an origin. make sure to version caches by name and use the caches only from the version of the script that they can safely operate on. see deleting old caches for more information. note: the key matching algorithm depends on the vary header in the value. so matching a new key requires looking at both key and value for entries in the cache. note: the caching api doesn't honor http caching headers. methods cache.match(request, options) returns a promise that resolves to the response associated with the first matching request in the cache object. cache.matchall(request, options) returns a promise that resolves to an array of all matching...
...t is performing. var cache_version = 1; var current_caches = { font: 'font-cache-v' + cache_version }; self.addeventlistener('activate', function(event) { // delete all caches that aren't named in current_caches. // while there is only one cache in this example, the same logic will handle the case where // there are multiple versioned caches. var expectedcachenamesset = new set(object.values(current_caches)); event.waituntil( caches.keys().then(function(cachenames) { return promise.all( cachenames.map(function(cachename) { if (!expectedcachenamesset.has(cachename)) { // if this cache name isn't present in the set of "expected" cache names, then delete it. console.log('deleting out of date cache:', cachename); return c...
CanvasPattern.setTransform() - Web APIs
e you could replace the svgmatrix in the above example with the following: const matrix = new dommatrix([1, .2, .8, 1, 0, 0]); edit the code below and see your changes update live in the canvas: playable code <canvas id="canvas" width="400" height="200" class="playable-canvas"></canvas> <svg id="svg1" style="display:none"></svg> <div class="playable-buttons"> <input id="edit" type="button" value="edit" /> <input id="reset" type="button" value="reset" /> </div> <textarea id="code" class="playable-code" style="height:120px"> var img = new image(); img.src = 'https://mdn.mozillademos.org/files/222/canvas_createpattern.png'; img.onload = function() { var pattern = ctx.createpattern(img, 'repeat'); pattern.settransform(matrix.rotate(-45).scale(1.5)); ctx.fillstyle = pattern; ctx.fil...
...reatepattern(img, 'repeat'); pattern.settransform(matrix.rotate(-45).scale(1.5)); ctx.fillstyle = pattern; ctx.fillrect(0, 0, 400, 400); };</textarea> var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); var textarea = document.getelementbyid('code'); var reset = document.getelementbyid('reset'); var edit = document.getelementbyid('edit'); var code = textarea.value; var svg1 = document.getelementbyid('svg1'); var matrix = svg1.createsvgmatrix(); function drawcanvas() { ctx.clearrect(0, 0, canvas.width, canvas.height); eval(textarea.value); } reset.addeventlistener('click', function() { textarea.value = code; drawcanvas(); }); edit.addeventlistener('click', function() { textarea.focus(); }) textarea.addeventlistener('input', drawcanvas); windo...
CanvasRenderingContext2D.arcTo() - Web APIs
byid('canvas'); const ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.moveto(180, 90); ctx.arcto(180,130, 110,130, 130); ctx.lineto(110, 130); ctx.stroke(); result live demo more sophisticated demo of the method. you can play around with range input to see how arc changes. ...
... value=50> <label for="radius" id="radius-output">50</label> </div> <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const controlout = document.getelementbyid('radius-output'); const control = document.getelementbyid('radius'); control.oninput = () => { controlout.textcontent = r = control.value; }; const mouse = { x: 0, y: 0 }; let r = 100; // radius const p0 = { 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 ...
CanvasRenderingContext2D.currentTransform - Web APIs
examples manually changing the matrix this example uses the currenttransform property to set a transformation matrix. a rectangle is then drawn using that transformation. ...
... examples manually changing the matrix this example uses the currenttransform property to set a transformation matrix. a rectangle is then drawn using that transformation. ...
CanvasRenderingContext2D.fillStyle - Web APIs
vasrenderingcontext2d.fillstyle property of the canvas 2d api specifies the color, gradient, or pattern to use inside shapes. the default style is #000 (black). for more examples of fill and stroke styles, see applying styles and color in the canvas tutorial. syntax ctx.fillstyle = color; ctx.fillstyle = gradient; ctx.fillstyle = pattern; options color a domstring parsed as css <color> value. gradient a canvasgradient object (a linear or radial gradient). pattern a canvaspattern object (a repeating image). examples changing the fill color of a shape this example applies a blue fill color to a rectangle. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.fillstyle = 'blue'; ctx.fillrect...
...yid('canvas'); const ctx = canvas.getcontext('2d'); ctx.fillstyle = 'blue'; ctx.fillrect(10, 10, 100, 100); result creating multiple fill colors using loops in this example, we use two for loops to draw a grid of rectangles, each having a different fill color. to achieve this, we use the two variables i and j to generate a unique rgb color for each square, and only modify the red and green values. (the blue channel has a fixed value.) by modifying the channels, you can generate all kinds of palettes. <canvas id="canvas" width="150" height="150"></canvas> const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); for (let i = 0; i < 6; i++) { for (let j = 0; j < 6; j++) { ctx.fillstyle = `rgb( ${math.floor(255 - 42.5 * i)}, ${math.flo...
CanvasRenderingContext2D.lineCap - Web APIs
"round" the ends of lines are rounded. ...
...xample rounds the end caps of a straight line. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.moveto(20, 20); ctx.linewidth = 15; ctx.linecap = 'round'; ctx.lineto(100, 100); ctx.stroke(); result comparison of line caps in this example three lines are drawn, each with a different value for the linecap property. two guides to see the exact differences between the three are added. each of these lines starts and ends exactly on these guides. the line on the left uses the default "butt" option. it's drawn completely flush with the guides. the second is set to use the "round" option. this adds a semicircle to the end that has a radius half the width of the line. the line on the rig...
CanvasRenderingContext2D.lineJoin - Web APIs
ed segments have the same direction, because no joining area will be added in this case. degenerate segments with a length of zero (i.e., with all endpoints and control points at the exact same position) are also ignored. note: lines can be drawn with the stroke(), strokerect(), and stroketext() methods. syntax ctx.linejoin = "bevel" || "round" || "miter"; options there are three possible values for this property: "round", "bevel", and "miter". the default is "miter". "round" rounds off the corners of a shape by filling an additional sector of disc centered at the common endpoint of connected segments. the radius for these rounded corners is equal to the line width. "bevel" fills an additional triangular area between the common endpoint of connected segments, and the separate ou...
...he line width. "bevel" fills an additional triangular area between the common endpoint of connected segments, and the separate outside rectangular corners of each segment. "miter" connected segments are joined by extending their outside edges to connect at a single point, with the effect of filling an additional lozenge-shaped area. this setting is affected by the miterlimit property. default value. examples changing the joins in a path this example applies rounded line joins to a path. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.linewidth = 20; ctx.linejoin = 'round'; ctx.beginpath(); ctx.moveto(20, 20); ctx.lineto(190, 100); ctx.lineto(280, 20); ctx.lineto(280, 150); ctx.stroke(); resu...
CanvasRenderingContext2D.scrollPathIntoView() - Web APIs
anvas'); const ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.fillrect(10, 10, 30, 30); ctx.scrollpathintoview(); edit the code below to see your changes update live in the canvas: playable code <canvas id="canvas" width="400" height="200" class="playable-canvas"> <input id="button" type="range" min="1" max="12"> </canvas> <div class="playable-buttons"> <input id="edit" type="button" value="edit" /> <input id="reset" type="button" value="reset" /> </div> <textarea id="code" class="playable-code"> ctx.beginpath(); ctx.rect(10, 10, 30, 30); ctx.scrollpathintoview();</textarea> var canvas = document.getelementbyid("canvas"); var ctx = canvas.getcontext("2d"); var textarea = document.getelementbyid("code"); var reset = document.getelementbyid("reset"); var edit = document.getelemen...
...="button" value="reset" /> </div> <textarea id="code" class="playable-code"> ctx.beginpath(); ctx.rect(10, 10, 30, 30); ctx.scrollpathintoview();</textarea> var canvas = document.getelementbyid("canvas"); var ctx = canvas.getcontext("2d"); var textarea = document.getelementbyid("code"); var reset = document.getelementbyid("reset"); var edit = document.getelementbyid("edit"); var code = textarea.value; function drawcanvas() { ctx.clearrect(0, 0, canvas.width, canvas.height); eval(textarea.value); } reset.addeventlistener("click", function() { textarea.value = code; drawcanvas(); }); edit.addeventlistener("click", function() { textarea.focus(); }) textarea.addeventlistener("input", drawcanvas); window.addeventlistener("load", drawcanvas); specifications specificatio...
CanvasRenderingContext2D.textBaseline - Web APIs
the canvasrenderingcontext2d.textbaseline property of the canvas 2d api specifies the current text baseline used when drawing text. syntax ctx.textbaseline = "top" || "hanging" || "middle" || "alphabetic" || "ideographic" || "bottom"; options possible values: "top" the text baseline is the top of the em square. "hanging" the text baseline is the hanging baseline. (used by tibetan and other indic scripts.) "middle" the text baseline is the middle of the em square. "alphabetic" the text baseline is the normal alphabetic baseline. default value. "ideographic" the text baseline is the ideographic baseline; this is the bottom of the body of the characters, if the main body of characters protrudes beneath the alphabetic baseline. (used by chinese, japanese, and korean scripts.) "bo...
... text baseline is the ideographic baseline; this is the bottom of the body of the characters, if the main body of characters protrudes beneath the alphabetic baseline. (used by chinese, japanese, and korean scripts.) "bottom" the text baseline is the bottom of the bounding box. this differs from the ideographic baseline in that the ideographic baseline doesn't consider descenders. the default value is "alphabetic". examples comparison of property values this example demonstrates the various textbaseline property values. html <canvas id="canvas" width="550" height="500"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const baselines = ['top', 'hanging', 'middle', 'alphabetic', 'ideographic', 'bottom']; ctx.font = '36px seri...
Transformations - Web APIs
more complex drawings. save() saves the entire state of the canvas. restore() restores the most recently saved canvas state. canvas states are stored on a stack. every time the save() method is called, the current drawing state is pushed onto the stack. a drawing state consists of the transformations that have been applied (i.e. translate, rotate and scale – see below). the current values of the following attributes: strokestyle, fillstyle, globalalpha, linewidth, linecap, linejoin, miterlimit, linedashoffset, shadowoffsetx, shadowoffsety, shadowblur, shadowcolor, globalcompositeoperation, font, textalign, textbaseline, direction, imagesmoothingenabled. the current clipping path, which we'll see in the next section. you can call the save() method as many times as you like. eac...
...rectangle. <canvas id="canvas" width="300" height="200"></canvas> draw(); screenshotlive sample scaling the next transformation method is scaling. we use it to increase or decrease the units in our canvas grid. this can be used to draw scaled down or enlarged shapes and bitmaps. scale(x, y) scales the canvas units by x horizontally and by y vertically. both parameters are real numbers. values that are smaller than 1.0 reduce the unit size and values above 1.0 increase the unit size. values of 1.0 leave the units the same size. using negative numbers you can do axis mirroring (for example using translate(0,canvas.height); scale(1,-1); you will have the well-known cartesian coordinate system, with the origin in the bottom left corner). by default, one unit on the canvas is exactly o...
ChannelMergerNode - Web APIs
el of the output. this is useful for accessing each channels separately, e.g. for performing channel mixing where gain must be separately controlled on each channel. if channelmergernode has one single output, but as many inputs as there are channels to merge; the number of inputs is defined as a parameter of its constructor and the call to audiocontext.createchannelmerger. in the case that no value is given, it will default to 6. using a channelmergernode, it is possible to create outputs with more channels than the rendering hardware is able to process. in that case, when the signal is sent to the audiocontext.listener object, supernumerary channels will be ignored. number of inputs variable; default to 6. number of outputs 1 channel count mode "max" ...
...d the index of the channel to connect to. var ac = new audiocontext(); ac.decodeaudiodata(somestereobuffer, function(data) { var source = ac.createbuffersource(); source.buffer = data; var splitter = ac.createchannelsplitter(2); source.connect(splitter); var merger = ac.createchannelmerger(2); // reduce the volume of the left channel only var gainnode = ac.creategain(); gainnode.gain.setvalueattime(0.5, ac.currenttime); splitter.connect(gainnode, 0); // connect the splitter back to the second input of the merger: we // effectively swap the channels, here, reversing the stereo image. gainnode.connect(merger, 0, 1); splitter.connect(merger, 1, 0); var dest = ac.createmediastreamdestination(); // because we have used a channelmergernode, we now have a stereo // mediastream we ...
ChannelSplitterNode - Web APIs
nels of an audio source into a set of mono outputs. this is useful for accessing each channel separately, e.g. for performing channel mixing where gain must be separately controlled on each channel. if your channelsplitternode always has one single input, the amount of outputs is defined by a parameter on its constructor and the call to audiocontext.createchannelsplitter(). in the case that no value is given, it will default to 6. if there are fewer channels in the input than there are outputs, supernumerary outputs are silent. number of inputs 1 number of outputs variable; default to 6. channel count mode "explicit" older implementations, as per earlier versions of the spec use "max". channel count fixed to the number of outputs. older implem...
...d the index of the channel to connect to. var ac = new audiocontext(); ac.decodeaudiodata(somestereobuffer, function(data) { var source = ac.createbuffersource(); source.buffer = data; var splitter = ac.createchannelsplitter(2); source.connect(splitter); var merger = ac.createchannelmerger(2); // reduce the volume of the left channel only var gainnode = ac.creategain(); gainnode.gain.setvalueattime(0.5, ac.currenttime); splitter.connect(gainnode, 0); // connect the splitter back to the second input of the merger: we // effectively swap the channels, here, reversing the stereo image. gainnode.connect(merger, 0, 1); splitter.connect(merger, 1, 0); var dest = ac.createmediastreamdestination(); // because we have used a channelmergernode, we now have a stereo // mediastream we ...
Client.type - Web APIs
Web › API › Client › type
the type read-only property of the client interface indicates the type of client the service worker is controlling. syntax var myclienttype = client.type; value a string, representing the client type. the value can be one of "window" "worker" "sharedworker" example // service worker client (e.g. a document) function sendmessage(message) { return new promise(function(resolve, reject) { // note that this is the serviceworker.postmessage version navigator.serviceworker.controller.postmessage(message); window.serviceworker.onmessage = function(e) { resolve(e.data); }; }); } // controlling service worker self.addeventlistener("message", function(e) { // e.source is a client object e.source.postmessage("hello! your message was: " + e.data); // let's also ...
... working draft initial definition. ...
Clipboard.write() - Web APIs
Web › API › Clipboard › write
the active tab. note: browser support for the asynchronous clipboard apis is still in the process of being implemented. be sure to check the compatibility table as well as clipboard availability in clipboard for more information. syntax var promise = navigator.clipboard.write(data) parameters data an array of clipboarditem objects containing data to be written to the clipboard. return value a promise which is resolved when the data has been written to the clipboard. the promise is rejected if the clipboard is unable to complete the clipboard access. example this example function replaces the current contents of the clipboard with a specified string. function setclipboard(text) { let data = [new clipboarditem({ "text/plain": text })]; navigator.clipboard.write(data).then(fun...
...rd(text) { let data = [new clipboarditem({ "text/plain": text })]; navigator.clipboard.write(data).then(function() { /* success */ }, function() { /* failure */ }); } the code begins by creating a new clipboarditem object into which the text will be placed for sending to the clipboard. the key of the object passed to the clipboarditem constructor indicates the content type, the value indicates the content. the content could be a text or even a blob (e.g. for copying images to the clipboard). then write() is called, specifying both a fulfilment function and an error function. example of copying canvas contents to the clipboard function copycanvascontentstoclipboard(canvas, ondone, onerror) { canvas.toblob(function (blob) { let data = [new clipboarditem({ [blob.type]: b...
CloseEvent.initCloseEvent() - Web APIs
events initialized in this way must have been created with the document.createevent() method. this method must be called to set the event before it is dispatched, using eventtarget.dispatchevent(). once dispatched, it doesn't do anything anymore. do not use this method anymore as it is deprecated. instead use specific event constructors, like closeevent(). the page on creating and triggering events gives more information about the way to use these. ...
... page on creating and triggering events gives more information about the way to use these. syntax event.initmouseevent(type, canbubble, cancelable, wasclean, reasoncode, reason); parameters type the string to set the event's type to. possible types for mouse events include: click, mousedown, mouseup, mouseover, mousemove, mouseout. canbubble whether or not the event can bubble. sets the value of event.bubbles. cancelable whether or not the event's default action can be prevented. sets the value of event.cancelable. wasclean whether or not the connection was cleanly closed. reasoncode the reason of the close. reason a domstring describing the reason of the close in shuman-readable way. specifications this is no part of any specifications, though it was in some early draft...
CloseEvent - Web APIs
to clients using websockets when the connection is closed. this is delivered to the listener indicated by the websocket object's onclose attribute. constructor closeevent() creates a new closeevent. properties this interface also inherits properties from its parent, event. closeevent.code read only returns an unsigned short containing the close code sent by the server. the following values are permitted status codes. the following definitions are sourced from the iana website [ref]. note that the 1xxx codes are only websocket-internal and not for the same meaning by the transported data (like when the application-layer protocol is invalid). the only permitted codes to be specified in firefox are 1000 and 3000 to 4999 [source, bug]. status code name description...
...vent.reason read only returns a domstring indicating the reason the server closed the connection. this is specific to the particular server and sub-protocol. closeevent.wasclean read only returns a boolean that indicates whether or not the connection was cleanly closed. methods this interface also inherits methods from its parent, event. closeevent.initcloseevent() initializes the value of a closeevent created. if the event has already being dispatched, this method does nothing. do not use this method anymore, use the closeevent() constructor instead. specifications specification status comment html living standardthe definition of 'closeevent' in that specification. living standard initial definition. ...
Console.timeLog() - Web APIs
Web › API › Console › timeLog
see timers in the documentation for details and examples. note: this feature is available in web workers. syntax console.timelog(label); parameters label the name of the timer to log to the console. return if no label parameter included: default: 1042ms if an existing label is included: timer name: 1242ms exceptions if there is no running timer, timelog() returns the warning: timer “default” doesn’t exist. if a label parameter is included, but there is no corresponding timer: timer “timer name” doesn’t exist. ...
...in addition, the call to timeend() has the additional information, "timer ended" to make it obvious that the timer is no longer tracking time. specifications specification status comment console apithe definition of 'console.timelog()' in that specification. living standard initial definition ...
Console API - Web APIs
concepts and usage the console api started as a largely proprietary api, with different browsers implementing it, albeit it in inconsistent ways. the console api spec was created to define consistent behavior, and all modern browsers eventually settled on implementing this behavior — although some implementations still have their own additional proprietary functions. ...
...al proprietary functions. find out about these at: google chrome devtools implementation safari devtools implementation usage is very simple — the console object — available via window.console, or workerglobalscope.console in workers; accessible using just console — contains many methods that you can call to perform rudimentary debugging tasks, generally focused around logging various values to the browser's web console. by far the most commonly-used method is console.log, which is used to log the current value contained inside a specific variable. interfaces console provides rudimentary debugging functionality, including logging, stack traces, timers, and counters. examples let mystring = 'hello world'; // output "hello world" to the console console.log(mystring) see the...
ConstrainBoolean - Web APIs
the constrainboolean dictionary is used to specify a constraint for a property whose value is a boolean value. you can specify an exact value which must be matched, an ideal value that should be matched if at all possible, and a fallback value to attempt to match once all more specific constraints have been applied. properties exact a boolean which indicates a value the property must have. ideal a boolean value indicating the ideal, but not required, value the property should ideally have. if possible, this value will be used, but the user agent will use the other value if it needs to in order to come up with a workable configuration. ...
... specific constraints have been applied. properties exact a boolean which indicates a value the property must have. ideal a boolean value indicating the ideal, but not required, value the property should ideally have. if possible, this value will be used, but the user agent will use the other value if it needs to in order to come up with a workable configuration. you can also specify the value of the property as simply true or false, in which case the user agent will use that value if possible once all efforts have been made to match the exact and ideal values for other properties. specifications specification status comment media capture and streamsthe definition of 'constrainboolean' in that specification. candidate recommendation initial definition ...
ConstrainDOMString - Web APIs
the constraindomstring dictionary is used to specify a constraint for a property whose value is a string. it allows you to specify one or more exact string values from which one must be the parameter's value, or a set of ideal values which should be used if possible. you can also specify a single string (or an array of strings) which the user agent will do its best to match once all more stringent constraints have been applied. properties the value of a constraindomstring can be any of the following: a single domstring an array of domstring objects an object with one or both of the following properties: exact either a single domstring which must be the value of the property, or an array of domstring objects one of which must be the property's value. if the property can't be set to ...
... applied. properties the value of a constraindomstring can be any of the following: a single domstring an array of domstring objects an object with one or both of the following properties: exact either a single domstring which must be the value of the property, or an array of domstring objects one of which must be the property's value. if the property can't be set to one of the listed values, matching will fail. ideal either a single domstring or an arrray of domstrings specifying ideal values for the property. if possible, one of the listed values will be used, but if it's not possible, the user agent will use the closest possible match. specifications specification status comment media capture and streamsthe definition of 'constraindomstring' in that s...
CryptoKey - Web APIs
Web › API › CryptoKey
the cryptokey interface of the web crypto api represents a cryptographic key obtained from one of the subtlecrypto methods generatekey(), derivekey(), importkey(), or unwrapkey(). for security reasons, the cryptokey interface can only be used in a secure context. properties cryptokey.type string which may take one of the following values: "secret": this key is a secret key for use with a symmetric algorithm. "private": this key is the private half of an asymmetric algorithm's cryptokeypair. "public": this key is the public half of an asymmetric algorithm's cryptokeypair. cryptokey.extractable boolean indicating whether or not the key may be extracted using subtlecrypto.exportkey() or subtlecrypto.wrapkey(). true: the key may be extracted. false the key...
...y can be used and any associated extra parameters. aeskeygenparams if the algorithm is any of the aes variants. rsahashedkeygenparams if the algorithm is any of the rsa variants. eckeygenparams if the algorithm is any of the ec variants. hmackeygenparams if the algorithm is hmac. cryptokey.usages an array of strings, indicating what can be done with the key. possible values for array elements are: "encrypt": the key may be used to encrypt messages. "decrypt": the key may be used to decrypt messages. "sign": the key may be used to sign messages. "verify": the key may be used to verify signatures. "derivekey": the key may be used in deriving a new key. "derivebits": the key may be used in deriving bits. "wrapkey": the key may be used to wrap a key. ...
DOMPoint.fromPoint() - Web APIs
adonly. you can also create a new dompoint object using the new dompoint() constructor. although this interface is based on dompointreadonly, it is not read-only; the properties within may be changed at will. syntax var point = dompoint.frompoint(sourcepoint); properties sourcepoint a dompointinit-compliant object, which includes both dompoint and dompointreadonly, from which to take the values of the new point's properties. return value a new dompoint object whose coordinate and perspective values are identical to those in the source point. the point's properties are mutable and may be changed at any time. examples creating a mutable point from a read-only point if you have a dompointreadonly object, you can easily create a mutable copy of that point: var mutablepoint = dompoin...
...those in the source point. the point's properties are mutable and may be changed at any time. examples creating a mutable point from a read-only point if you have a dompointreadonly object, you can easily create a mutable copy of that point: var mutablepoint = dompoint.frompoint(readonlypoint); creating a 2d point this sample creates a 2d point, specifying an inline object that includes the values to use for x and y. the z and w properties are allowed to keep their default values (0 and 1 respectively). var center = dompoint.frompoint({x: 75, y: -50, z: -55, w: 0.25}); specifications specification status comment geometry interfaces module level 1the definition of 'frompoint()' in that specification. candidate recommendation initial definition ...
DOMPointInit.w - Web APIs
Web › API › DOMPointInit › w
the dompointinit dictionary's w property is used to specify the w perspective value of a point in space when either creating or serializing to json a dompoint or dompointreadonly object. syntax var dompointinit = { w: wperspective }; dompointinit.w = wperspective; var wperspective = dompointinit.w; value a double-precision floating-point value indicating the point's w perspective value. this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity). there are two methods which use dompointinit: the static function dompointreadonly.frompoint() takes an object that complies with dompointinit as its sole input parameter, to specify the coordinates and perspective value of the new point to be created. this method is, by in...
...ies with dompointinit as its sole input parameter, to specify the coordinates and perspective value of the new point to be created. this method is, by inheritance, also available as dompoint.frompoint(). the dompointreadonly.tojson() method returns a dompointinit object that describes the same point as the original point. by inheritance, this method is also available as dompoint.tojson(). this value is assumed to be 1 by default if not included in the dompointinit object passed into frompoint(). specifications specification status comment geometry interfaces module level 1the definition of 'w' in that specification. candidate recommendation initial definition ...
DOMPointReadOnly.toJSON() - Web APIs
example this example creates a dompoint object representing the top-left corner of the current window, in screen coordinates, then converts that to json. ...
... example this example creates a dompoint object representing the top-left corner of the current window, in screen coordinates, then converts that to json. ...
DOMTokenList.entries() - Web APIs
the domtokenlist.entries() method returns an iterator allowing you to go through all key/value pairs contained in this object. the values are domstring objects, each representing a single token. syntax tokenlist.entries(); return value returns an iterator. examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist. we when retrieve an iterator containing the key/value pairs using entries(), then iterate through each one using a for...of loop, writing them to the <span>'s node.textcontent. ...
...omtokenlist using element.classlist. we when retrieve an iterator containing the key/value pairs using entries(), then iterate through each one using a for...of loop, writing them 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 iterator = classes.entries(); for (let value of iterator) { span.textcontent += value + ' ++ '; } the output looks like this: specifications specification status comment domthe definition of 'entries() (as iterable<node>)' in that specification. living standard initial definition. ...
DOMTokenList.keys() - Web APIs
Web › API › DOMTokenList › keys
the keys() method of the domtokenlist interface returns an iterator allowing to go through all keys contained in this object. the keys are of type unsigned integer. syntax tokenlist.keys(); parameters none. return value returns an iterator. examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist. we when retrieve an iterator containing the keys using values(), then iterate through those keys using a for ... of loop, writing each one to the <span>'s node.textcontent. ...
...t as a domtokenlist using element.classlist. we when retrieve an iterator containing the keys using values(), then iterate through those keys using a for ... of loop, writing each one to the <span>'s node.textcontent. first, the html: <span class="a b c"></span> now the javascript: var span = document.queryselector("span"); var classes = span.classlist; var iterator = classes.keys(); for(var value of iterator) { span.textcontent += value + ' ++ '; } the output looks like this: specifications specification status comment domthe definition of 'keys() (as iterable<node>)' in that specification. living standard initial definition ...
DataTransfer.effectAllowed - Web APIs
n is used to indicate that the data being dragged will be moved, and the link operation is used to indicate that some form of relationship or connection will be created between the source and drop locations. this property should be set in the dragstart event to set the desired drag effect for the drag source. within the dragenter and dragover event handlers, this property will be set to whatever value was assigned during the dragstart event, thus effectallowed may be used to determine which effect is permitted. assigning a value to effectallowed in events other than dragstart has no effect. syntax datatransfer.effectallowed; values a domstring representing the drag operation that is allowed. the possible values are: none the item may not be dropped. copy a copy of the source item m...
...ped. copy a copy of the source item may be made at the new location. copylink a copy or link operation is permitted. copymove a copy or move operation is permitted. link a link may be established to the source at the new location. linkmove a link or move operation is permitted. move an item may be moved to a new location. all all operations are permitted. uninitialized the default value when the effect has not been set, equivalent to all. assigning any other value to effectallowed has no effect and the old value is retained. internet explorer will change the value to be lowercased; thus, linkmove will become linkmove, and so on. example this example shows the use of the effectallowed and dropeffect properties. <!doctype html> <html lang=en> <title>examples of datatransfer.
DataTransfer.setDragImage() - Web APIs
t the custom image to be used. the image will typically be an <image> element but it can also be a <canvas> or any other visible element. the method's x and y coordinates define how the image should appear relative to the mouse pointer. these coordinates define the offset into the image where the mouse cursor should be. for instance, to display the image so that the pointer is at its center, use values that are half the width and height of the image. this method must be called in the dragstart event handler. syntax void datatransfer.setdragimage(img | element, xoffset, yoffset); arguments img | element an image element element to use for the drag feedback image. if element is an img element, then set the drag data store bitmap to the element's image (at its intrinsic size); otherwise...
...ent is an img element, then set the drag data store bitmap to the element's image (at its intrinsic size); otherwise, set the drag data store bitmap to an image generated from the given element (the exact mechanism for doing so is not currently specified). xoffset a long indicating the horizontal offset within the image. yoffset a long indicating the vertical offset within the image. return value void example this example shows how to use the setdragimage() method. note the example refers to an image file named example.gif. if that file is present, it will be used as the drag image and if that file is not present, the browser will use its default drag image. demo <!doctype html> <html lang=en> <title>example of datatransfer.setdragimage()</title> <meta name="viewport" content="w...
DataTransfer - Web APIs
ata types. for more information about drag and drop, see html drag and drop api. this object is available from the datatransfer property of all drag events. constructor datatransfer() creates and returns a new datatransfer object. properties standard properties datatransfer.dropeffect gets the type of drag-and-drop operation currently selected or sets the operation to a new type. the value must be none, copy, link or move. datatransfer.effectallowed provides all of the types of operations that are possible. must be one of none, copy, copylink, copymove, link, linkmove, move, all or uninitialized. datatransfer.files contains a list of all the local files available on the data transfer. if the drag operation doesn't involve dragging files, this property is an empty list. datatra...
...that were set in the dragstart event. gecko properties note: all of the properties in this section are gecko-specific. datatransfer.mozcursor gives the drag cursor's state. this is primarily used to control the cursor during tab drags. datatransfer.mozsourcenode read only the node over which the mouse cursor was located when the button was pressed to initiate the drag operation. this value is null for external drags or if the caller can't access the node. datatransfer.mozusercancelled read only this property applies only to the dragend event, and is true if the user canceled the drag operation by pressing escape. it will be false in all other cases, including if the drag failed for any other reason, for instance due to a drop over an invalid location. deprecated properties ...
DataTransferItem.getAsFile() - Web APIs
example this example shows the use of the getasfile() method in a drop event handler. ...
... recommendation snapshot of the html whatwg document ...
DataTransferItem.kind - Web APIs
'string' if the kind of drag data item is a plain unicode string. example this example shows the use of the kind property. ...
... 'string' if the kind of drag data item is a plain unicode string. example this example shows the use of the kind property. ...
DedicatedWorkerGlobalScope.postMessage() - Web APIs
the postmessage() method of the dedicatedworkerglobalscope interface sends a message to the main thread that spawned it. this accepts a single parameter, which is the data to send to the worker. the data may be any value or javascript object handled by the structured clone algorithm, which includes cyclical references. the main scope that spawned the worker can send back information to the thread that spawned it using the worker.postmessage method. syntax postmessage(amessage, transferlist); parameters amessage the object to deliver to the main thread; this will be in the data field in the event delivered to the worker.onmessage handler. this may be any value or javascript object handled by the structured clone algorithm, which includes cyclical references. transferlist optional an o...
...in the main script, onmessage would have to be called on a worker object, whereas inside the worker script you just need onmessage because the worker is effectively the global scope (dedicatedworkerglobalscope). for a full example, see ourbasic dedicated worker example (run dedicated worker). note: postmessage() can only send a single object at once. as seen above, if you want to pass multiple values you can send an array. specifications specification status comment html living standardthe definition of 'dedicatedworkerglobalscope.postmessage()' in that specification. living standard ...
DelayNode - Web APIs
Web › API › DelayNode
working draft ...
... working draft ...
DisplayMediaStreamConstraints.audio - Web APIs
more precise control over the audio data may be exercised by instead providing a mediatrackconstraints object, which is used to process the audio prior to adding it to the stream. ...
...should be. this is left up to the user agent to decide. likely sources are the computer's system audio output and the user's microphone, but there is no way to specify which source to use. syntax displaymediastreamconstraints.audio = allowaudioflag; displaymediastreamconstraints.audio = mediatrackconstraints; displaymediastreamconstraints = { audio: allowaudioflag|mediatrackconstraints; } value the value may be either a boolean or a mediatrackconstraints object. if a boolean is specified, a value of true indicates that an audio track should be included in the stream returned by getdisplaymedia(), if an appropriate audio source exists and the user agent supports audio on display media. a value of false—the default—indicates that no audio track is to be included in the stream. if a...
Document.bgColor - Web APIs
Web › API › Document › bgColor
document.bgcolor is deprecated in dom level 2 html. ...
... document.bgcolor is deprecated in dom level 2 html. ...
Document.createAttribute() - Web APIs
creates a new attribute node, and returns it. the object created a node implementing the attr interface. the dom does not enforce what sort of attributes can be added to a particular element in this manner. the string given in parameter is converted to lowercase. syntax attribute = document.createattribute(name) parameters name is a string containing the name of the attribute. ...
...n in parameter is converted to lowercase. syntax attribute = document.createattribute(name) parameters name is a string containing the name of the attribute. return value a attr node. exceptions invalid_character_err if the parameter contains invalid characters for xml attribute. example var node = document.getelementbyid("div1"); var a = document.createattribute("my_attrib"); a.value = "newval"; node.setattributenode(a); console.log(node.getattribute("my_attrib")); // "newval" specifications specification status comment domthe definition of 'document.createattribute()' in that specification. living standard precised behavior with uppercase characters document object model (dom) level 3 core specificationthe definition of 'document.cre...
Document.createTouch() - Web APIs
the documenttouch mixin. the document.createtouch() method creates and returns a new touch object. syntax var touch = documenttouch.createtouch(view, target, identifier, pagex, pagey, screenx, screeny); parameters note: all parameters are optional. view the window in which the touch occurred. target the eventtarget for the touch. identifier the value for touch.identifier. pagex the value for touch.pagex. pagey the value for touch.pagey. screenx the value for touch.screenx. screeny the value for touch.screeny. note: previous versions of this method included the following additional parameters but those parameters are not included in either of the standards listed below. consequently, these parameters should be considered deprecated a...
... the value for touch.pagex. pagey the value for touch.pagey. screenx the value for touch.screenx. screeny the value for touch.screeny. note: previous versions of this method included the following additional parameters but those parameters are not included in either of the standards listed below. consequently, these parameters should be considered deprecated and not used. clientx the value for touch.clientx. clienty the value for touch.clienty. radiusx the value for touch.radiusx. radiusy the value for touch.radiusy. rotationangle the value for touch.rotationangle. force the value for touch.force. return value touch a touch object configured as described by the input parameters. example this example illustrates using the document.createtouch() method to create to...
Document.createTreeWalker() - Web APIs
rameters root a root node of this treewalker traversal. typically this will be an element owned by the document. whattoshow optional a unsigned long representing a bitmask created by combining the constant properties of nodefilter. it is a convenient way of filtering for certain types of node. it defaults to 0xffffffff representing the show_all constant. constant numerical value description nodefilter.show_all -1 (that is the max value of unsigned long) shows all nodes. nodefilter.show_attribute 2 shows attribute attr nodes. this is meaningful only when creating a treewalker with an attr node as its root; in this case, it means that the attribute node will appear in the first position of the iteration or traversal. since attr...
...t 4 shows text nodes. filter optional a nodefilter, that is an object with a method acceptnode, which is called by the treewalker to determine whether or not to accept a node that has passed the whattoshow check. entityreferenceexpansion optional a boolean flag indicating if when discarding an entityreference its whole sub-tree must be discarded at the same time. return value a new treewalker object. example the following example goes through all nodes in the body, reduces the set of nodes to elements, simply passes through as acceptable each node (it could reduce the set in the acceptnode() method instead), and then makes use of tree walker iterator that is created to advance through the nodes (now all elements) and push them into an array. var treewalker = docum...
Document.domain - Web APIs
Web › API › Document › domain
the domain property of the document interface gets/sets the domain portion of the origin of the current document, as used by the same origin policy. if this property is successfully set, the port part of the origin is also set to null. syntax const domainstring = document.domain document.domain = domainstring value the domain portion of the current document's origin. ...
...set to null. syntax const domainstring = document.domain document.domain = domainstring value the domain portion of the current document's origin. exceptions securityerror an attempt has been made to set domain under one of the following conditions: the document is inside a sandboxed <iframe> the document has no browsing context the document's effective domain is null the given value is not equal to the document's effective domain (or it is not a registerable domain suffix of it) the document-domain feature-policy is enabled examples getting the domain for the uri http://developer.mozilla.org/docs/web, this example sets currentdomain to the string "developer.mozilla.org". const currentdomain = document.domain; closing a window if a document, such as www.example.x...
Document.evaluate() - Web APIs
Web › API › Document › evaluate
would be more wasteful.) see introduction to using xpath in javascript for more information. notes xpath expressions can be evaluated on html and xml documents. while using document.evaluate() works in ff2, in ff3 one must use somexmldoc.evaluate() if evaluating against something other than the current document. result types (merge with template:xpathresultconstants? these are supported values for the resulttype parameter of the evaluate method: result type value description any_type 0 whatever type naturally results from the given expression. number_type 1 a result set containing a single number. useful, for example, in an xpath expression using the count() function. string_type 2 a result set containing a single string. ...
...useful, for example, an an xpath expression using the not() function. unordered_node_iterator_type 4 a result set containing all the nodes matching the expression. the nodes in the result set are not necessarily in the same order they appear in the document. ordered_node_iterator_type 5 a result set containing all the nodes matching the expression. ...
Document.fullscreenEnabled - Web APIs
is available only for a page that has no windowed plug-ins in any of its documents, and if all <iframe> elements which contain the document have their allowfullscreen attribute set. although this property is read-only, it will not throw if it is modified (even in strict mode); the setter is a no-operation and it will be ignored. ...
...y for a page that has no windowed plug-ins in any of its documents, and if all <iframe> elements which contain the document have their allowfullscreen attribute set. although this property is read-only, it will not throw if it is modified (even in strict mode); the setter is a no-operation and it will be ignored. syntax var isfullscreenavailable = document.fullscreenenabled; value a boolean value which is true if the document and the elements within can be placed into full-screen mode by calling element.requestfullscreen(). if full-screen mode isn't available, this value is false. example in this example, before attempting to request full-screen mode for a <video> element, the value of fullscreenenabled is checked, in order to avoid making the attempt when not available. function reque...
Document: fullscreenchange event - Web APIs
itches into or out of full-screen mode. bubbles yes cancelable no interface event event handler property onfullscreenchange the event is sent to the element that is transitioning into or out of full-screen mode, and this event then bubbles up to the document. to find out whether the element is entering or exiting full-screen mode, check the value of documentorshadowroot.fullscreenelement: if this value is null then the element is exiting full-screen mode, otherwise it is entering full-screen mode. examples in this example, a handler for the fullscreenchange event is added to the document. document.addeventlistener('fullscreenchange', (event) => { // document.fullscreenelement will point to the element that // is in fullscreen mode ...
... if (document.fullscreenelement) { console.log(`element: ${document.fullscreenelement.id} entered full-screen mode.`); } else { console.log('leaving full-screen mode.'); } }); see element: fullscreenchange event for another example. ...
Document.getElementById() - Web APIs
get access to a specific element quickly. if you need to get access to an element which doesn't have an id, you can use queryselector() to find the element using any selector. syntax var element = document.getelementbyid(id); parameters id the id of the element to locate. the id is case-sensitive string which is unique within the document; only one element may have any given id. return value an element object describing the dom element object matching the specified id, or null if no matching element was found in the document. example html <html> <head> <title>getelementbyid example</title> </head> <body> <p id="para">some text here</p> <button onclick="changecolor('blue');">blue</button> <button onclick="changecolor('red');">red</button> </body> </html> javascript funct...
...me of this method must be correct for the code to function; getelementbyid() is not valid and will not work, however natural it may seem. unlike some other element-lookup methods such as document.queryselector() and document.queryselectorall(), getelementbyid() is only available as a method of the global document object, and not available as a method on all element objects in the dom. because id values must be unique throughout the entire document, there is no need for "local" versions of the function. example <!doctype html> <html> <head> <meta charset="utf-8"> <title>document</title> </head> <body> <div id="parent-id"> <p>hello word1</p> <p id="test1">hello word2</p> <p>hello word3</p> <p>hello word4</p> </div> <script> var parent...
Document.getElementsByClassName() - Web APIs
ents that have a class of 'test', inside of an element that has the id of 'main': document.getelementbyid('main').getelementsbyclassname('test') get the first element with a class of 'test', or undefined if there is no matching element: document.getelementsbyclassname('test')[0] we can also use methods of array.prototype on any htmlcollection by passing the htmlcollection as the method's this value. here we'll find all div elements that have a class of 'test': var testelements = document.getelementsbyclassname('test'); var testdivs = array.prototype.filter.call(testelements, function(testelement){ return testelement.nodename === 'div'; }); get the first element whose class is 'test' this is the most commonly used method of operation. <html> <body> <div id="parent-id"> <p>h...
... living standard ...
Document.getElementsByName() - Web APIs
the getelementsbyname() method of the document object returns a nodelist collection of elements with a given name in the document. syntax var elements = document.getelementsbyname(name); elements is a live nodelist collection, meaning it automatically updates as new elements with the same name are added to/removed from the document. name is the value of the name attribute of the element(s). example <!doctype html> <html lang="en"> <title>example: using document.getelementsbyname</title> <input type="hidden" name="up"> <input type="hidden" name="down"> <script> var up_names = document.getelementsbyname("up"); console.log(up_names[0].tagname); // displays "input" </script> </html> notes the name attribute can only be applied in (x)html documents. the returned nodelist collect...
... notes the name attribute can only be applied in (x)html documents. the returned nodelist collection contains all elements with the given name, such as <meta>, <object>, and even elements which do not support the name attribute at all. the getelementsbyname method works differently in ie10 and below. there, getelementsbyname() also returns elements that have an id attribute with the specified value. be careful not to use the same string as both a name and an id. the getelementsbyname method works differently in ie. there, getelementsbyname() does not return all elements which may not have a name attribute (such as <span>). both ie and edge return an htmlcollection, not a nodelist specifications specification status comment html living standardthe definit...
Document.importNode() - Web APIs
urrent document. deep optional a boolean which controls whether to include the entire dom subtree of the externalnode in the import. if deep is set to true, then externalnode and all of its descendants are copied. if deep is set to false, then only externalnode is imported — the new node has no children. note: in the dom4 specification, deep was an optional argument with a default value of true. this default has changed in the latest spec! the new default value is false. best practice: though it's still an optional argument, you should always provide the deep argument for backward and forward compatibility. with gecko 28.0 (firefox 28 / thunderbird 28 / seamonkey 2.25 / firefox os 1.3), the console warns developers not to omit the argument. starting with gecko 29.0 (f...
...s still an optional argument, you should always provide the deep argument for backward and forward compatibility. with gecko 28.0 (firefox 28 / thunderbird 28 / seamonkey 2.25 / firefox os 1.3), the console warns developers not to omit the argument. starting with gecko 29.0 (firefox 29 / thunderbird 29 / seamonkey 2.26)), a shallow clone is defaulted instead of a deep clone. return value the copied importednode in the scope of the importing document. note: importednode's node.parentnode is null, since it has not yet been inserted into the document tree! example const iframe = document.queryselector("iframe"); const oldnode = iframe.contentwindow.document.getelementbyid("mynode"); const newnode = document.importnode(oldnode, true); document.getelementbyid("container").appen...
Document: keydown event - Web APIs
bubbles yes cancelable yes interface keyboardevent event handler property onkeydown the keydown and keyup events provide a code indicating which key is pressed, while keypress indicates which character was entered. for example, a lowercase "a" will be reported as 65 by keydown and keyup, but as 97 by keypress. an uppercase "a" is reported as 65 by all events. ...
...an uppercase "a" is reported as 65 by all events. since firefox 65, the keydown and keyup events are now fired during ime composition, to improve cross-browser compatibility for cjkt users (bug 354358, also see keydown and keyup events are now fired during ime composition for more useful details). to ignore all keydown events that are part of composition, do something like this (229 is a special value set for a keycode relating to an event that has been processed by an ime): eventtarget.addeventlistener("keydown", event => { if (event.iscomposing || event.keycode === 229) { return; } // do something }); examples addeventlistener keydown example this example logs the keyboardevent.code value whenever you press down a key. <p>focus the iframe first (e.g. by clicking in it), then ...
Document: keyup event - Web APIs
t event handler property onkeyup the keydown and keyup events provide a code indicating which key is pressed, while keypress indicates which character was entered. for example, a lowercase "a" will be reported as 65 by keydown and keyup, but as 97 by keypress. an uppercase "a" is reported as 65 by all events. note: if you're looking for a way to react to changes in an input's value, you should use the input event. some changes are not detectable by keyup, for example pasting text from the context menu in a text input. since firefox 65, the keydown and keyup events are now fired during ime composition, to improve cross-browser compatibility for cjkt users (bug 354358, also see keydown and keyup events are now fired during ime composition for more useful details). to ignore...
...asting text from the context menu in a text input. since firefox 65, the keydown and keyup events are now fired during ime composition, to improve cross-browser compatibility for cjkt users (bug 354358, also see keydown and keyup events are now fired during ime composition for more useful details). to ignore all keyup events that are part of composition, do something like this (229 is a special value set for a keycode relating to an event that has been processed by an ime): eventtarget.addeventlistener("keyup", event => { if (event.iscomposing || event.keycode === 229) { return; } // do something }); examples this example logs the keyboardevent.code value whenever you release a key. addeventlistener keyup example <p>focus the iframe first (e.g. by clicking in it), then try pre...
Document.querySelectorAll() - Web APIs
g selectors to identify elements. multiple selectors may be specified by separating them using commas. note: characters which are not part of standard css syntax must be escaped using a backslash character. since javascript also uses backslash escaping, special care must be taken when writing string literals using these characters. see escaping special characters for more information. return value a non-live nodelist containing one element object for each element that matches at least one of the specified selectors or an empty nodelist in case of no matches. note: if the specified selectors include a css pseudo-element, the returned list is always empty. exceptions syntaxerror the syntax of the specified selectors string is not valid. examples obtaining a list of matches to ob...
...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 co...
Document.requestStorageAccess() - Web APIs
ins the requesting origin has storage access to is decremented by one. note: if the requesting origin is not classified as a tracking origin, the access request is automatically given an ephemeral storage access grant, which will go away when the page is reloaded. the user is never shown a prompt in this case, and calling requeststorageaccess() won’t have any side effects besides changing the value returned by document.hasstorageaccess(). debugging the storage access grant threshold may make it more difficult to test your website under the condition where firefox prompts the user for access. to make testing easier, we have added two preferences in about:config that control prompting upon requeststorageaccess() calls: dom.storage_access.auto_grants can be set to false to disable the au...
...ageaccess() by origins classified as trackers will trigger a prompt. dom.storage_access.max_concurrent_auto_grants controls the threshold number of storage access grants at which users will begin to receive prompts. for example, if you want to configure firefox to automatically grant access on the first site where requeststorageaccess() is called and then prompt afterwards, you should adjust the value of the dom.storage_access.max_concurrent_auto_grants preference to 1. syntax var promise = document.requeststorageaccess(); parameters none. return value a promise that fulfills with undefined if the access to first-party storage was granted, and rejects if access was denied. when the promise gets resolved, the resolve handler will run as if a user gesture is being processed, whether the ...
Document.timeline - Web APIs
Web › API › Document › timeline
the timeline readonly property of the document interface represents the default timeline of the current document. this timeline is a special instance of documenttimeline that is automatically created on page load. this timeline is unique to each document and persists for the lifetime of the document including calls to document.open(). the time values for this timeline are calculated as a fixed offset from the global clock such that the zero time corresponds to the navigationstart moment plus a signed delta known as the origin time. prior to establishing the navigationstart moment, the document timeline is inactive. note: a document timeline that is associated with a non-active document is also considered to be inactive. syntax var pagetimeline = document.timeline; var thismoment = p...
...such that the zero time corresponds to the navigationstart moment plus a signed delta known as the origin time. prior to establishing the navigationstart moment, the document timeline is inactive. note: a document timeline that is associated with a non-active document is also considered to be inactive. syntax var pagetimeline = document.timeline; var thismoment = pagetimeline.currenttime; value a documenttimeline object. specifications specification status comment web animationsthe definition of 'document.timeline' in that specification. working draft editor's draft. ...
Document.title - Web APIs
Web › API › Document › title
the document.title property gets or sets the current title of the document. syntax var doctitle = document.title; doctitle is a string containing the document's title. if the title was overridden by setting document.title, it contains that value. otherwise, it contains the title specified in the markup (see the notes below). document.title = newtitle; newtitle is the new title of the document. the assignment affects the return value of document.title, the title displayed for the document (e.g. in the titlebar of the window or tab), and it also affects the dom of the document (e.g. the content of the <title> element in an html document). example <!doctype html> <html> <head> <title>hello world!</title> </head> <body> <script> alert(document.title); // displays "hello world!" ...
...l document). example <!doctype html> <html> <head> <title>hello world!</title> </head> <body> <script> alert(document.title); // displays "hello world!" document.title = "goodbye world!"; alert(document.title); // displays "goodbye world!" </script> </body> </html> notes this property applies to html, svg, xul, and other documents in gecko. for html documents the initial value of document.title is the text content of the <title> element. for xul it's the value of the title attribute of the <xul:window> or other top-level xul element. in xul, accessing document.title before the document is fully loaded has undefined behavior: document.title may return an empty string and setting document.title may have no effect. specifications specification status com...
Document.visibilityState - Web APIs
in practice this means that the page is the foreground tab of a non-minimized window. 'hidden' the page content is not visible to the user. ...
... the page content is not visible to the user. in practice this means that the document is either a background tab or part of a minimized window, or the os screen lock is active. 'prerender' the page content is being prerendered and is not visible to the user (considered hidden for purposes of document.hidden). the document may start in this state, but will never transition to it from another value. note: this was removed from the standard. check compatibility table for details. when the value of this property changes, the visibilitychange event is sent to the document. typical use of this can be to prevent the download of some assets when the document is solely prerendered, or stop some activities when the document is in the background or minimized. syntax var string = document.visibi...
DocumentOrShadowRoot.activeElement - Web APIs
current configuration. for example, on macos systems, elements that aren't text input elements are not typically focusable by default. note: focus (which element is receiving user input events) is not the same thing as selection (the currently highlighted part of the document). you can get the current selection using window.getselection(). syntax element = documentorshadowroot.activeelement value the element which currently has focus, <body> or null if there is no focused element. example html <p>select some text from one of the text areas below:</p> <form> <textarea name="ta-example-one" id="ta-example-one" rows="7" cols="40">this is text area one. lorem ipsum dolor sit amet, consectetur adipiscing elit. donec tincidunt, lorem a porttitor molestie, odio nibh iaculis libero, et acc...
...his is text area two. fusce ullamcorper, nisl ac porttitor adipiscing, urna orci egestas libero, ut accumsan orci lacus laoreet diam. ...
DocumentOrShadowRoot.fullscreenElement - Web APIs
adowroot.fullscreenelement read-only property returns the element that is currently being presented in full-screen mode in this document, or null if full-screen mode is not currently in use. although this property is read-only, it will not throw if it is modified (even in strict mode); the setter is a no-operation and it will be ignored. ...
...or null if full-screen mode is not currently in use. although this property is read-only, it will not throw if it is modified (even in strict mode); the setter is a no-operation and it will be ignored. syntax var element = document.fullscreenelement; return value the element object that's currently in full-screen mode; if full-screen mode isn't currently in use by the document>, the returned value is null. example this example presents a function, isvideoinfullscreen(), which looks at the value returned by fullscreenelement; if the document is in full-screen mode (fullscreenelement isn't null) and the full-screen element's nodename is video, indicating a <video> element, the function returns true, indicating that the video is in full-screen mode. function isvideoinfullscreen() { if (d...
Events and the DOM - Web APIs
pport this method, offering a similar eventtarget.attachevent api instead. for cross-browser compatibility, use one of the many javascript libraries available. more details can be found on the eventtarget.addeventlistener reference page. html attribute <button onclick="alert('hello world!')"> the javascript code in the attribute is passed the event object via the event parameter. the return value is treated in a special way, described in the html specification. warning: this method should be avoided! it inflates the markup, and makes it less readable. concerns of content/structure and behavior are not well-separated, making a bug harder to find. dom element properties // assuming mybutton is a button element mybutton.onclick = function(event){alert('hello world')} the function can ...
...l specification. warning: this method should be avoided! it inflates the markup, and makes it less readable. concerns of content/structure and behavior are not well-separated, making a bug harder to find. dom element properties // assuming mybutton is a button element mybutton.onclick = function(event){alert('hello world')} the function can be defined to take an event parameter. the return value is treated in a special way, described in the html specification. the problem with this method is that only one handler can be set per element and per event. accessing event interfaces event handlers may be attached to various objects (including dom elements, document, the window object, etc.). when an event occurs, an event object is created and passed sequentially to the event listeners. th...
EXT_frag_depth - Web APIs
the ext_frag_depth extension is part of the webgl api and enables to set a depth value of a fragment from within the fragment shader. webgl extensions are available using the webglrenderingcontext.getextension() method. for more information, see also using extensions in the webgl tutorial. availability: this extension is only available to webgl1 contexts. in webgl2, the functionality of this extension is available on the webgl2 context by default. it requires glsl #version 300 es. ...
...e information, see also using extensions in the webgl tutorial. availability: this extension is only available to webgl1 contexts. in webgl2, the functionality of this extension is available on the webgl2 context by default. it requires glsl #version 300 es. examples enable the extension: gl.getextension('ext_frag_depth'); now the output variable gl_fragdepthext is available to set a depth value of a fragment from within the fragment shader: <script type="x-shader/x-fragment"> void main() { gl_fragcolor = vec4(1.0, 0.0, 1.0, 1.0); gl_fragdepthext = 0.5; } </script> specifications specification status comment ext_frag_depththe definition of 'ext_frag_depth' in that specification. recommendation initial definition. ...
EffectTiming.endDelay - Web APIs
finishes an iteration (its initial delay, animationeffecttimingreadonly.delay, plus its duration,duration, plus its end delay. this is useful for sequencing animations based on the end time of another animation; note, however, that many of the sequence effectst that will benefit most from this property have not been defined in the specification yet. for now, its main purpose is to represent the value of the svg min attribute. element.animate(), keyframeeffectreadonly(), and keyframeeffect() all accept an object of timing properties including enddelay. the value of enddelay corresponds directly to animationeffecttimingreadonly.enddelay in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. syntax var timingproperties = { enddelay: delayinmilli...
...readonly(), and keyframeeffect() all accept an object of timing properties including enddelay. the value of enddelay corresponds directly to animationeffecttimingreadonly.enddelay in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. syntax var timingproperties = { enddelay: delayinmilliseconds } timingproperties.enddelay = delayinmilliseconds; value a number representing the end delay, specified in milliseconds. the default value is 0. specifications specification status comment web animationsthe definition of 'enddelay' in that specification. working draft editor's draft. ...
EffectTiming - Web APIs
ards (normal), backwards (reverse), switches direction after each iteration (alternate), or runs backwards and switches direction after each iteration (alternate-reverse). defaults to "normal". duration optional the number of milliseconds each iteration of the animation takes to complete. defaults to 0. although this is technically optional, keep in mind that your animation will not run if this value is 0. easing optional the rate of the animation's change over time. accepts the pre-defined values "linear", "ease", "ease-in", "ease-out", and "ease-in-out", or a custom "cubic-bezier" value like "cubic-bezier(0.42, 0, 0.58, 1)". defaults to "linear". enddelay optional the number of milliseconds to delay after the end of an animation. this is primarily of use when sequencing animations based...
...ptional dictates whether the animation's effects should be reflected by the element(s) prior to playing ("backwards"), retained after the animation has completed playing ("forwards"), or both. defaults to "none". iterationstart optional describes at what point in the iteration the animation should start. 0.5 would indicate starting halfway through the first iteration for example, and with this value set, an animation with 2 iterations would end halfway through a third iteration. defaults to 0.0. iterations optional the number of times the animation should repeat. defaults to 1, and can also take a value of infinity to make it repeat for as long as the element exists. specifications specification status comment web animationsthe definition of 'effecttiming' in tha...
Element.attributes - Web APIs
the element.attributes property returns a live collection of all attribute nodes registered to the specified node. it is a namednodemap, not an array, so it has no array methods and the attr nodes' indexes may differ among browsers. to be more specific, attributes is a key/value pair of strings that represents any information regarding that attribute. syntax var attr = element.attributes; example basic examples // get the first <p> element in the document var para = document.getelementsbytagname("p")[0]; var atts = para.attributes; enumerating elements attributes numerical indexing is useful for going through all of an element's attributes. the following example runs through the attribute nodes for the element in the document with id "paragraph", and prints each attribute's value. <!
...ttributes() { 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="listattributes();"> <input id="result" type="text" value=""> </p> </form> </body...
Element.clientTop - Web APIs
Web › API › Element › clientTop
er of an element in pixels. it is a read-only, integer property of element. as it happens, all that lies between the two locations (offsettop and client area top) is the element's border. this is because the offsettop indicates the location of the top of the border (not the margin) while the client area starts immediately below the border, (client area includes padding.) therefore, the clienttop value will always equal the integer portion of the .getcomputedstyle() value for "border-top-width". (actually might be math.round(parsefloat()).) for example, if the computed "border-top-width" is zero, then clienttop is also zero. note: this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). gecko-based applications support clienttop ...
...clientrect(). gecko-based applications support clienttop starting with gecko 1.9 (firefox 3, implemented in bug 111207). this property is not supported in firefox 2 and earlier. syntax var top = element.clienttop; example in the following illustration, the client area is show in white. (the segments labeled "top", "right", etc. have no significance regarding the client area.) the clienttop value is the distance from where the margin (yellow) area ends and the padding and content areas (white) begin. padding-top lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in v...
Element: fullscreenchange event - Web APIs
rty onfullscreenchange this event is sent to the element which is transitioning into or out of full-screen mode. examples in this example, a handler for the fullscreenchange event is added to the element whose id is fullscreen-div. if the user clicks on the "toggle fullscreen mode" button, the click handler will toggle full-screen mode for the div. if document.fullscreenelement has a value it will exit full-screen mode. if not, the div will be placed into full-screen mode. remember that by the time the fullscreenchange event is handled, the status of the element has already changed. so if the change is to full-screen mode, document.fullscreenelement will point to the element that is now in full-screen mode. on the other hand, if document.fullscreenelement is null, full-screen mode...
...to leave full-screen mode. html <h1>fullscreenchange event example</h1> <div id="fullscreen-div"> <button id="toggle-fullscreen">toggle fullscreen mode</button> </div> javascript document.getelementbyid('fullscreen-div').addeventlistener('fullscreenchange', (event) => { // document.fullscreenelement will point to the element that // is in fullscreen mode if there is one. if not, the value // of the property is null. if (document.fullscreenelement) { console.log(`element: ${document.fullscreenelement.id} entered fullscreen mode.`); } else { console.log('leaving full-screen mode.'); } }); document.getelementbyid('toggle-fullscreen').addeventlistener('click', (event) => { if (document.fullscreenelement) { // exitfullscreen is only available on the document obje...
Element.getAnimations() - Web APIs
bjects affecting this element or which are scheduled to do so in future. it can optionally return animation objects for descendant elements too. note: this array includes css animations, css transitions, and web animations. ...
...st animations = element.getanimations(options); parameters options optional an options object containing the following property: subtree a boolean value which, if true, causes animations that target descendants of element to be returned as well. this includes animations that target any css pseudo-elements attached to element or one of its descendents. defaults to false. return value an array of animation objects, each representing an animation currently targetting the element on which this method is called, or one of its descendant elements if { subtree: true } is specified. examples the following code snippet will wait for all animations on elem and its descendants to finish before removing the element from the document. promise.all( elem.getanimations({ subtree: true...
Element.getAttributeNames() - Web APIs
mes of the element as an array of strings. if the element has no attributes it returns an empty array. using getattributenames() along with getattribute(), is a memory-efficient and performant alternative to accessing element.attributes. ...
...t has no attributes it returns an empty array. using getattributenames() along with getattribute(), is a memory-efficient and performant alternative to accessing element.attributes. ...
Element.getAttributeNode() - Web APIs
returns the specified attribute of the specified element, as an attr node. syntax var attrnode = element.getattributenode(attrname); attrnode is an attr node for the attribute. attrname is a string containing the name of the attribute. example // html: <div id="top" /> let t = document.getelementbyid("top"); let idattr = t.getattributenode("id"); alert(idattr.value == "top") notes when called on an html element in a dom flagged as an html document, getattributenode lower-cases its argument before proceeding. the attr node inherits from node, but is not considered a part of the document tree. common node attributes like parentnode, previoussibling, and nextsibling are null for an attr node. you can, however, get the element to which the attribute belongs with the ownerelement prop...
...ode lower-cases its argument before proceeding. the attr node inherits from node, but is not considered a part of the document tree. common node attributes like parentnode, previoussibling, and nextsibling are null for an attr node. you can, however, get the element to which the attribute belongs with the ownerelement property. getattribute is usually used instead of getattributenode to get the value of an element's attribute. dom methods dealing with element's attributes: not namespace-aware, most commonly used methods namespace-aware variants (dom level 2) dom level 1 methods for dealing with attr nodes directly (seldom used) dom level 2 namespace-aware methods for dealing with attr nodes directly (seldom used) setattribute (dom 1) setattributens setattributenode setattributenodens ...
Element.getClientRects() - Web APIs
each domrect object contains read-only left, top, right and bottom properties describing the border box, in pixels, with the top-left relative to the top-left of the viewport. ...
...each domrect object contains read-only left, top, right and bottom properties describing the border box, in pixels, with the top-left relative to the top-left of the viewport. ...
Element.getElementsByClassName() - Web APIs
nt element which has the specified class name or names. the method getelementsbyclassname() on the document interface works essentially the same way, except it acts on the entire document, starting at the document root. syntax var elements = element.getelementsbyclassname(names); parameters names a domstring containing one or more class names to match on, separated by whitespace. return value an htmlcollection providing a live-updating list of every element which is a member of every class in names. usage notes as always, the returned collection is live, meaning that it always reflects the current state of the dom tree rooted at the element on which the function was called. as new elements that match names are added to the subtree, they immediately appear in the collection. similar...
...emove('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.prototype on any htmlcollection by passing the htmlcollection as the method's this value. here we'll find all <div> elements that have a class of test: var testelements = document.getelementsbyclassname('test'); var testdivs = array.prototype.filter.call(testelements, function(testelement) { return testelement.nodename === 'div'; }); specifications specification status comment domthe definition of 'element.getelementsbyclassname()' in that specification. ...
Element.getElementsByTagNameNS() - Web APIs
start. note that only the descendants of this element are included in the search, not the node itself. namespaceuri is the namespace uri of elements to look for (see element.namespaceuri and attr.namespaceuri). for example, if you need to look for xhtml elements, use the xhtml namespace uri, http://www.w3.org/1999/xhtml. localname is either the local name of elements to look for or the special value "*", which matches all elements (see element.localname and attr.localname). example // check the alignment on a number of cells in a table in an xhtml document. var table = document.getelementbyid("forecast-table"); var cells = table.getelementsbytagnamens("http://www.w3.org/1999/xhtml", "td"); for (var i = 0; i < cells.length; i++) { var axis = cells[i].getattribute("axis"); if (axis...
....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 specificationthe definition of 'element.getelementsbytagnamens()' in that specification. obsolete no change from document object model (dom) level 2 core specification. document object model (dom) level 2 core specificationthe definition of 'element.getelementsbytagnamens()' in that specification. ...
Element.hasAttribute() - Web APIs
name is a string representing the name of the attribute. ...
... name is a string representing the name of the attribute. ...
Element.hasAttributeNS() - Web APIs
hasattributens returns a boolean value indicating whether the current element has the specified attribute. syntax result = element.hasattributens(namespace,localname) result is the boolean value true or false. namespace is a string specifying the namespace of the attribute. localname is the name of the attribute. ...
... hasattributens returns a boolean value indicating whether the current element has the specified attribute. syntax result = element.hasattributens(namespace,localname) result is the boolean value true or false. namespace is a string specifying the namespace of the attribute. localname is the name of the attribute. ...
Element.insertAdjacentText() - Web APIs
domstring representing the position relative to the element; must be one of the following strings: 'beforebegin': before the element itself. 'afterbegin': just inside the element, before its first child. 'beforeend': just inside the element, after its last child. 'afterend': after the element itself. element a domstring representing the text to be inserted into the tree. return value void. exceptions exception explanation syntaxerror the position specified is not a recognised value. visualization of position names <!-- beforebegin --> <p> <!-- afterbegin --> foo <!-- beforeend --> </p> <!-- afterend --> note: the beforebegin and afterend positions work only if the node is in a tree and has an element parent. example beforebtn.ad...
... position specified is not a recognised value. visualization of position names <!-- beforebegin --> <p> <!-- afterbegin --> foo <!-- beforeend --> </p> <!-- afterend --> note: the beforebegin and afterend positions work only if the node is in a tree and has an element parent. example beforebtn.addeventlistener('click', function() { para.insertadjacenttext('afterbegin',textinput.value); }); afterbtn.addeventlistener('click', function() { para.insertadjacenttext('beforeend',textinput.value); }); have a look at our insertadjacenttext.html demo on github (see the source code too.) here we have a simple paragraph. you can enter some text into the form element, then press the insert before and insert after buttons to insert it before or after the existing paragraph text using i...
Element: keydown event - Web APIs
bubbles yes cancelable yes interface keyboardevent event handler property onkeydown the keydown and keyup events provide a code indicating which key is pressed, while keypress indicates which character was entered. for example, a lowercase "a" will be reported as 65 by keydown and keyup, but as 97 by keypress. an uppercase "a" is reported as 65 by all events. ...
... contenteditable attribute or with tabindex="-1". since firefox 65, the keydown and keyup events are now fired during ime composition, to improve cross-browser compatibility for cjkt users (bug 354358, also see keydown and keyup events are now fired during ime composition for more useful details). to ignore all keydown events that are part of composition, do something like this (229 is a special value set for a keycode relating to an event that has been processed by an ime): eventtarget.addeventlistener("keydown", event => { if (event.iscomposing || event.keycode === 229) { return; } // do something }); examples addeventlistener keydown example this example logs the keyboardevent.code value whenever you press down a key inside the <input> element. <input placeholder="click here...
Element.localName - Web APIs
Web › API › Element › localName
the element.localname read-only property returns the local part of the qualified name of an element. in previous dom specifications this api was defined within the node interface. syntax name = element.localname return value a domstring representing the local part of the element's qualified name. ...
...the element's qualified name. ...
Element.matches() - Web APIs
Web › API › Element › matches
exceptions syntax_err the specified selector string is invalid. ...
... polyfill for browsers that do not support element.matches() or element.matchesselector(), but include support for document.queryselectorall(), a polyfill exists: if (!element.prototype.matches) { element.prototype.matches = element.prototype.matchesselector || element.prototype.mozmatchesselector || element.prototype.msmatchesselector || element.prototype.
Element.onfullscreenchange - Web APIs
the element interface's onfullscreenchange property is an event handler for the fullscreenchange event that is fired when the element has transitioned into or out of full-screen mode. syntax targetdocument.onfullscreenchange = fullscreenchangehandler; value an event handler for the fullscreenchange event, indicating that the element has changed in or out of full-screen mode. example this example establishes a fullscreenchange event handler, handlefullscreenchange(). ...
... into or out of full-screen mode. syntax targetdocument.onfullscreenchange = fullscreenchangehandler; value an event handler for the fullscreenchange event, indicating that the element has changed in or out of full-screen mode. example this example establishes a fullscreenchange event handler, handlefullscreenchange(). this function determines which element it was called on by checking the value of event.target, then compares the document's fullscreenelement value to the element to see if they're the same node. this gives us a value, isfullscreen, which we pass into a function called adjustmycontrols(), which we imagine to be a function that makes adjustments to the app's user interface to present itself optimally when it's in full-screen mode versus being displayed in a window. functi...
Element.querySelectorAll() - Web APIs
g selectors to identify elements. multiple selectors may be specified by separating them using commas. note: characters which are not part of standard css syntax must be escaped using a backslash character. since javascript also uses backspace escaping, special care must be taken when writing string literals using these characters. see escaping special characters for more information. return value a non-live nodelist containing one element object for each descendant node that matches at least one of the specified selectors. note: if the specified selectors include a css pseudo-element, the returned list is always empty. exceptions syntaxerror the syntax of the specified selectors string is not valid. examples dataset selector & attribute selectors <section class="box" id="sect...
...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 ...
Element.scrollBy() - Web APIs
Web › API › Element › scrollBy
- or - options is a scrolltooptions dictionary. ...
... - or - options is a scrolltooptions dictionary. ...
Element.scrollIntoView() - Web APIs
if false, the bottom of the element will be aligned to the bottom of the visible area of the scrollable ancestor. corresponds to scrollintoviewoptions: {block: "end", inline: "nearest"}. scrollintovie...
... if false, the bottom of the element will be aligned to the bottom of the visible area of the scrollable ancestor. corresponds to scrollintoviewoptions: {block: "end", inline: "nearest"}. ...
Element.scrollLeft - Web APIs
gets or sets the number of pixels that an element's content is scrolled from its left edge. if the element's direction is rtl (right-to-left), then scrollleft is 0 when the scrollbar is at its rightmost position (at the start of the scrolled content), and then increasingly negative as you scroll towards the end of the content. on systems using display scaling, scrollleft may give you a decimal value. syntax getting the value // get the number of pixels scrolled var sleft = element.scrollleft; sleft is an integer representing the number of pixels that element has been scrolled from the left edge. setting the value // set the number of pixels scrolled element.scrollleft = 10; scrollleft can be specified as any integer value. however: if the element can't be scrolled (e.g., it has ...
...s scrolled var sleft = element.scrollleft; sleft is an integer representing the number of pixels that element has been scrolled from the left edge. setting the value // set the number of pixels scrolled element.scrollleft = 10; scrollleft can be specified as any integer value. however: if the element can't be scrolled (e.g., it has no overflow), scrollleft is set to 0. if specified as a value less than 0 (greater than 0 for right-to-left elements), scrollleft is set to 0. if specified as a value greater than the maximum that the content can be scrolled, scrollleft is set to the maximum. example html <div id="container"> <div id="content">click the button to slide right!</div> </div> <button id="slide" type="button">slide right</button> css #container { width: 100px; heig...
Element: select event - Web APIs
cted. bubbles yes cancelable no interface uievent if generated from a user interface, event otherwise event handler property onselect the event is not available for all elements in all languages. for example, in html, select events can be dispatched only on form <input type="text"> and <textarea> elements. ...
...lect the event is not available for all elements in all languages. for example, in html, select events can be dispatched only on form <input type="text"> and <textarea> elements. ...
Element.shadowRoot - Web APIs
(see element.attachshadow() for further details). examples the following snippets are taken from our life-cycle-callbacks example (see it live also), which creates an element that displays a square of a size and color specified in the element's attributes. ...
...> element's class definition we include some life cycle callbacks that make a call to an external function, updatestyle(), which actually applies the size and color to the element. you'll see that we are passing it this (the custom element itself) as a parameter. connectedcallback() { console.log('custom square element added to page.'); updatestyle(this); } attributechangedcallback(name, oldvalue, newvalue) { console.log('custom square element attributes changed.'); updatestyle(this); } in the updatestyle() function itself, we get a reference to the shadow dom using element.shadowroot. from here we use standard dom traversal techniques to find the <style> element inside the shadow dom and then update the css found inside it: function updatestyle(elem) { const shadow = elem.shadowr...
Element.tagName - Web APIs
Web › API › Element › tagName
the tagname read-only property of the element interface returns the tag name of the element on which it's called. for example, if the element is an <img>, its tagname property is "img" (for html documents; it may be cased differently for xml/xhtml documents). syntax elementname = element.tagname; value a string indicating the element's tag name. ...
...n the document type: for dom trees which represent html documents, the returned tag name is always in the canonical upper-case form. for example, tagname called on a <div> element returns "div". the tag names of elements in an xml dom tree are returned in the same case in which they're written in the original xml file. if an xml document includes a tag "<sometag>", then the tagname property's value is "sometag". for element objects, the value of tagname is the same as the value of the nodename property the element object inherits from node. example html <span id="born">when i was born...</span> javascript var span = document.getelementbyid("born"); console.log(span.tagname); in xhtml (or any other xml format), the original case will be maintained, so "span" would be output in case...
Element.toggleAttribute() - Web APIs
n attribute (removing it if it is present and adding it if it is not present) on the given element. syntax element.toggleattribute(name [, force]); parameters name a domstring specifying the name of the attribute to be toggled. the attribute name is automatically converted to all lower-case when toggleattribute() is called on an html element in an html document. force optional a boolean value to determine whether the attribute should be added or removed, no matter whether the attribute is present or not at the moment. return value true if attribute name is eventually present, and false otherwise. exceptions invalidcharactererror the specified attribute name contains one or more characters which are not valid in attribute names. example in the following example, toggleattrib...
...hether the attribute is present or not at the moment. return value true if attribute name is eventually present, and false otherwise. exceptions invalidcharactererror the specified attribute name contains one or more characters which are not valid in attribute names. example in the following example, toggleattribute() is used to toggle the readonly attribute of a <input>. ...
Event.composedPath() - Web APIs
the composedpath() method of the event interface returns the event’s path which is an array of the objects on which listeners will be invoked. this does not include nodes in shadow trees if the shadow root was created with its shadowroot.mode closed. syntax var composed = event.composedpath(); parameters none. return value an array of eventtarget objects representing the objects on which an event listener will be invoked. examples in our composed-composed-path example (see it live), we define two trivial custom elements, <open-shadow> and <closed-shadow>, both of which take the contents of their text attribute and insert them into the element's shadow dom as the text content of a <p> element. the only difference between the two is that their shadow roots are attached with their modes...
...ment.queryselector('html').addeventlistener('click',function(e) { console.log(e.composed); console.log(e.composedpath()); }); when you click on the <open-shadow> element and then the <closed-shadow> element, you'll notice two things. first, the composed property returns true beause the click event is always able to propagate across shadow boundaries. second, you'll notice a difference in the value of composedpath for the two elements. the <open-shadow> element's composed path is this: array [ p, shadowroot, open-shadow, body, html, htmldocument https://mdn.github.io/web-components-examples/composed-composed-path/, window ] whereas the <closed-shadow> element's composed path is a follows: array [ closed-shadow, body, html, htmldocument https://mdn.github.io/web-components-examples/compos...
Event.initEvent() - Web APIs
Web › API › Event › initEvent
events initialized in this way must have been created with the document.createevent() method. this method must be called to set the event before it is dispatched, using eventtarget.dispatchevent(). once dispatched, it doesn't do anything anymore. do not use this method anymore as it is deprecated. instead use specific event constructors, like event(). the page on creating and triggering events gives more information about the way to use these. syntax event.initevent(type, bubbles, cancelable); type is a domstring defining the type of event. ...
...cific event constructors, like event(). the page on creating and triggering events gives more information about the way to use these. syntax event.initevent(type, bubbles, cancelable); type is a domstring defining the type of event. bubbles is a boolean deciding whether the event should bubble up through the event chain or not. once set, the read-only property event.bubbles will give its value. cancelable is a boolean defining whether the event can be canceled. once set, the read-only property event.cancelable will give its value. example // create the event. var event = document.createevent('event'); // create a click event that bubbles up and // cannot be canceled event.initevent('click', true, false); // listen for the event. elem.addeventlistener('click', function (e) { /...
EventTarget() - Web APIs
the eventtarget() constructor creates a new eventtarget object instance. syntax var myeventtarget = new eventtarget(); parameters none. return value an instance of the eventtarget object. ...
...arget() constructor creates a new eventtarget object instance. syntax var myeventtarget = new eventtarget(); parameters none. return value an instance of the eventtarget object. examples class myeventtarget extends eventtarget { constructor(mysecret) { super(); this._secret = mysecret; } get secret() { return this._secret; } }; let myeventtarget = new myeventtarget(5); let value = myeventtarget.secret; // == 5 myeventtarget.addeventlistener("foo", function(e) { this._secret = e.detail; }); let event = new customevent("foo", { detail: 7 }); myeventtarget.dispatchevent(event); let newvalue = myeventtarget.secret; // == 7 specifications specification status comment domthe definition of 'eventtarget() constructor' in that specification. livin...
FetchEvent.respondWith() - Web APIs
ng of private data. you can only return response objects of type "opaqueredirect" if the fetchevent.request object's mode is "manual". you cannot return response objects of type "cors" if the fetchevent.request object's mode is "same-origin". specifying the final url of a resource from firefox 59 onwards, when a service worker provides a response to fetchevent.respondwith(), the response.url value will be propagated to the intercepted network request as the final resolved url. if the response.url value is the empty string, then the fetchevent.request.url is used as the final url. in the past the fetchevent.request.url was used as the final url in all cases. the provided response.url was effectively ignored. this means, for example, if a service worker intercepts a stylesheet or worker ...
...igations ends up using the request url for the resulting window.location. this means sites can still provide an "alternate" view of a web page when offline without changing the user-visible url. syntax fetchevent.respondwith( // promise that resolves to a response. ​); parameters a response or a promise that resolves to a response. otherwise, a network error is returned to fetch. return value undefined. exceptions exception notes networkerror a network error is triggered on certain combinations of fetchevent.request.mode and response.type values, as hinted at in the "global rules" listed above. invalidstateerror the event has not been dispatched or respondwithwith() has already been invoked. examples this fetch event tries to return ...
Fetch basic concepts - Web APIs
ous resource requests. because the main components of http are abstracted as javascript objects, it is easy for other apis to make use of such functionality. service workers is an example of an api that makes heavy use of fetch. fetch takes the asynchronous nature of such requests one step further. the api is completely promise-based. guard guard is a feature of headers objects, with possible values of immutable, request, request-no-cors, response, or none, depending on where the header is used. when a new headers object is created using the headers() constructor, its guard is set to none (the default). when a request or response object is created, it has an associated headers object whose guard is set as summarized below: new object's type creating constructor guard settin...
... guard is response and the header name isn't a forbidden response header name . ...
Using files from web applications - Web APIs
input"); inputelement.addeventlistener("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 info...
...ing example shows a possible use of the size property: <!doctype html> <html> <head> <meta charset="utf-8"> <title>file(s) size</title> </head> <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"...
File.lastModified - Web APIs
Web › API › File › lastModified
the file.lastmodified read-only property provides the last modified date of the file as the number of milliseconds since the unix epoch (january 1, 1970 at midnight). files without a known last modified date return the current date. syntax const time = instanceoffile.lastmodified; value a number that represents the number of milliseconds since the unix epoch. example reading from file input <input type="file" multiple id="fileinput"> const fileinput = document.queryselector('#fileinput'); fileinput.addeventlistener('change', (event) => { // files is a filelist object (similar to nodelist) const files = event.target.files; for (let file of files) { const date = new date(file.lastmodified); console.log(`${file.name} has a last modified date of ${date}`); } }); try th...
...60 it will be 2ms. // reduced time precision (2ms) in firefox 60 somefile.lastmodified; // 1519211809934 // 1519211810362 // 1519211811670 // ... // reduced time precision with `privacy.resistfingerprinting` enabled somefile.lastmodified; // 1519129853500 // 1519129858900 // 1519129864400 // ... in firefox, you can also enabled privacy.resistfingerprinting, the precision will be 100ms or the value of privacy.resistfingerprinting.reducetimerprecision.microseconds, whichever is larger. specifications specification status comment file apithe definition of 'lastmodified' in that specification. working draft initial definition. ...
File.lastModifiedDate - Web APIs
the file.lastmodifieddate read-only property returns the last modified date of the file. files without a known last modified date returns the current date . 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() migh...
...ced time precision (2ms) in firefox 60 somefile.lastmodifieddate.gettime(); // 1519211809934 // 1519211810362 // 1519211811670 // ... // reduced time precision with `privacy.resistfingerprinting` enabled somefile.lastmodifieddate.gettime(); // 1519129853500 // 1519129858900 // 1519129864400 // ... in firefox, you can also enable privacy.resistfingerprinting, the precision will be 100ms or the value of privacy.resistfingerprinting.reducetimerprecision.microseconds, whichever is larger. specifications though present in early draft of the file api spec, this property has been removed from it and is now non-standard. use file.lastmodified instead. ...
File.type - Web APIs
Web › API › File › type
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 reliab...
...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 reliable only for common file types like images, html documents, audio and video. uncommon file extensions would return an empty string. client configuration (for instance, the windows registry) may result in unexpected values even for common types. developers are advised not to rely on this property as a sole validation scheme. specifications specification status comment file apithe definition of 'type' in that specification. working draft initial definition. ...
FileReader.readyState - Web APIs
none of the read methods called yet. 1 loading a read method has been called. 2 done the operation is complete. empty the filereader has been created, but no readas method was called yet. loading a readas method was invoked. a file or blob is being read, and no error has occurred yet. done the read operation is complete. ...
...ead into memory, a file read error occurred, or abort() was called and the read was cancelled. example var reader = new filereader(); console.log('empty', reader.readystate); // readystate will be 0 reader.readastext(blob); console.log('loading', reader.readystate); // readystate will be 1 reader.onloadend = function () { console.log('done', reader.readystate); // readystate will be 2 }; value a number which is one of the three possible state constants define for the filereader api. specifications specification status comment file apithe definition of 'readystate' in that specification. working draft initial definition ...
FileReader.result - Web APIs
Web › API › FileReader › result
the result types are described below. ...
... the result types are described below. ...
FileSystemEntry.toURL() - Web APIs
the filesystementry interface's method tourl() creates and returns a string containing a url which can be used to identify the file system entry. this is done by exposing a new url scheme—filesystem:—that can be used as the value of src and href attributes. syntax filesystementry.tourl([mimetype]); parameters mimetype optional an optional string specifying the mime type to use when interpreting the file. this can be used to help deal with files whose types aren't recognized automatically by the user agent. ...
... example if you have a filesystemfileentry corresponding to an image file in a file system available to your web site or app, you can call tourl() to get its url for use in html. ...
FileHandle API - Web APIs
buildhandle.onsuccess = function(){ var myfilehandle = this.result; console.log('handle', myfilehandle); }; }; mozcreatefilehandle() takes two arguments: a name and an optional type. both of these are just descriptive and are not used by the database. however, they are important for the filehandle object as it can generate file objects which inherit their own name and type from those values. that said, as the name does not match any real filename it can be an empty string, for example, and it doesn't even have to be unique. note: the above code only creates a "temporary file" that exists only while you hold the filehandle instance. if you want a file to survive a page refresh/app relaunch, you need to store the handle in a more permanent location, like the database itself. see fi...
...it is a good idea to monitor the operation to provide feedback to the user. such monitoring can be done using the filerequest.onprogress event handler. var progress = document.queryselector('progress'); var myfile = myfilehandle.open('readonly'); // let's read a 1gb file var action = myfile.readasarraybuffer(1000000000); action.onprogress = function (event) { if (progress) { progress.value = event.loaded; progress.max = event.total; } } action.onsuccess = function () { console.log('yeah \o/ just read a 1gb file'); } action.onerror = function () { console.log('oups :( unable to read a 1gb file') } file storage when a file handle is created, the associated file only exists as a "temporary file" as long as you hold the filehandle instance. if you want a file to surviv...
File and Directory Entries API - Web APIs
on is not currently on a standards track, it's important to keep in mind that not all browsers implement it, and those that do may implement only small portions of it. check the browser compatibility section for details. two very similar apis exist depending on whether you desire asynchronous or synchronous behavior. the synchronous api is intended to be used inside a worker and will return the values you desire. the asynchronous api will not block and functions and the api will not return values; instead, you will need to supply a callback function to handle the response whenever it arrives. the firefox implementation of the file and directory entries api is very limited; there is no support for creating files. only for accessing files which are selected by the user in a file <input> eleme...
...erfaces which represent files or directories. filesystemfileentry represents a single file in a file system. filesystemdirectoryentry represents a single directory in a file system. filesystemdirectoryreader created by calling filesystemdirectoryentry.createreader(), this interface provides the functionality which lets you read the contents of a directory. filesystemflags defines a set of values which are used when specifying option flags when calling certain methods in the file and directory entries api. fileerror represents an error which is generated by asynchronous file system calls. there are also two global functions (which are not part of the specification at this time and are implemented only by google chrome). they're available on the window object and implemented in loca...
FontFace.FontFace() - Web APIs
Web › API › FontFace › FontFace
source the font source. this can be either: a url binary font data descriptors optional a set of optional descriptors passed as an object. ...
... source the font source. this can be either: a url binary font data descriptors optional a set of optional descriptors passed as an object. ...
FormData.get() - Web APIs
Web › API › FormData › get
the get() method of the formdata interface returns the first value associated with a given key from within a formdata object. if you expect multiple values and want all of them, use the getall() method instead. note: this method is available in web workers. syntax formdata.get(name); parameters name a usvstring representing the name of the key you want to retrieve. return value a formdataentryvalue containing the value. if the key doesn't exist, the method returns null. ...
...ad. note: this method is available in web workers. syntax formdata.get(name); parameters name a usvstring representing the name of the key you want to retrieve. return value a formdataentryvalue containing the value. if the key doesn't exist, the method returns null. example the following line creates an empty formdata object: var formdata = new formdata(); if we add two username values using formdata.append: formdata.append('username', 'chris'); formdata.append('username', 'bob'); the following get() function will only return the first username value appended: formdata.get('username'); // returns "chris" specifications specification status comment xmlhttprequestthe definition of 'get()' in that specification. living standard ...
FormData.getAll() - Web APIs
Web › API › FormData › getAll
the getall() method of the formdata interface returns all the values associated with a given key from within a formdata object. note: this method is available in web workers. syntax formdata.getall(name); parameters name a usvstring representing the name of the key you want to retrieve. returns an array of formdataentryvalues whose key matches the value passed in the name parameter. if the key doesn't exist, the method returns an empty list. ...
... syntax formdata.getall(name); parameters name a usvstring representing the name of the key you want to retrieve. returns an array of formdataentryvalues whose key matches the value passed in the name parameter. if the key doesn't exist, the method returns an empty list. example the following line creates an empty formdata object: var formdata = new formdata(); if we add two username values using formdata.append: formdata.append('username', 'chris'); formdata.append('username', 'bob'); the following getall() function will return both username values in an array: formdata.getall('username'); // returns ["chris", "bob"] specifications specification status comment xmlhttprequestthe definition of 'getall()' in that specification. living standard ...
FormDataEvent() - Web APIs
formeventinit optional a formeventinit dictionary, which can take the following optional fields: bubbles: a boolean indicating whether the event bubbles. the default is false. cancelable: a boolean indicating whether the event can be cancelled. the default is false. composed: a boolean indicating whether the event will trigger listeners outside of a shadow root (see event.composed for more details). the default is false. ...
...he event will trigger listeners outside of a shadow root (see event.composed for more details). the default is false. formdata: a formdata object to pre-populate the formdataevent with. this would then be accessed through the formdataevent.formdata property. examples let fd = new formdata(); fd.append('test', 'test'); let fdev = new formdataevent('formdata', { formdata: fd }); for (let value of fdev.formdata.values()) { console.log(value); } specifications specification status comment html living standardthe definition of 'formdataevent' in that specification. living standard initial definition ...
GainNode.gain - Web APIs
Web › API › GainNode › gain
the gain property of the gainnode interface is an a-rate audioparam representing the amount of gain to apply. syntax var audioctx = new audiocontext(); var gainnode = audioctx.creategain(); gainnode.gain.value = 0.5; value an audioparam. note: though the audioparam returned is read-only, the value it represents is not. example the following example shows basic usage of an audiocontext to create a gainnode, which is then used to mute and unmute the audio when a mute button is clicked by changing the gain property value. the below snippet wouldn't work as is — for a complete working example, check out our voice-change-o-matic demo (view source.) <div> <button class="mute">mute button</button> </div> var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var g...
... ); } else { console.log('getusermedia not supported on your browser!'); } source.connect(gainnode); gainnode.connect(audioctx.destination); ... mute.onclick = voicemute; function voicemute() { if(mute.id == "") { // 0 means mute. if you still hear something, make sure you haven't // connected your source into the output in addition to using the gainnode. gainnode.gain.setvalueattime(0, audioctx.currenttime); mute.id = "activated"; mute.innerhtml = "unmute"; } else { gainnode.gain.setvalueattime(1, audioctx.currenttime); mute.id = ""; mute.innerhtml = "mute"; } } specifications specification status comment web audio apithe definition of 'gain' in that specification. working draft ...
GeolocationCoordinates.longitude - Web APIs
the geolocationcoordinates interface's read-only longitude property is a double-precision floating point value which represents the longitude of a geographical position, specified in decimal degrees. together with a domtimestamp indicating a time of measurement, the geolocationcoordinates object is part of the geolocationposition interface, which is the object type returned by geolocation api functions that obtain and return a geographical position. syntax let longitude = geolocationcoordinatesinstance.longitude value the value in longitude is the geographical longitude of the location on earth described by the coordinates object, in decimal degrees. the value is defined by the world geodetic system 1984 specification (wgs 84). note: the zero meridian (also known as the prime ...
...this is an asynchronous request, so we provide a callback which receives as in put a geolocationposition object describing the determined position. from the geolocationposition object, we obtain the user's latitude and longitude using position.coords.latitude and position.coords.longitude so we can update the displayed coordinates. the two <span> elements are updated to display the corresponding values after being converted to a value with two decimal places. html the html used to present the results looks like this: <p> your location is <span id="latitude">0.00</span>° latitude by <span id="longitude">0.00</span>° longitude. </p> <button id="get-location"> get my location </button> result take this example for a test drive here: specifications specification status...
Using the Geolocation API - Web APIs
urrentposition(), can be called repeatedly. note: you can use watchposition() without an initial getcurrentposition() call. const watchid = navigator.geolocation.watchposition((position) => { dosomething(position.coords.latitude, position.coords.longitude); }); the watchposition() method returns an id number that can be used to uniquely identify the requested position watcher; you use this value in tandem with the clearwatch() method to stop watching the user's location. navigator.geolocation.clearwatch(watchid); fine tuning the response both getcurrentposition() and watchposition() accept a success callback, an optional error callback, and an optional positionoptions object. this object allows you to specify whether to enable high accuracy, a maximum age for the returned position v...
...osition() and watchposition() accept a success callback, an optional error callback, and an optional positionoptions object. this object allows you to specify whether to enable high accuracy, a maximum age for the returned position value (up until this age it will be cached and reused if the same position is requested again; after this the browser will request fresh position data), and a timeout value that dictates how long the browser should attempt to get the position data for, before it times out. a call to watchposition could look like: function success(position) { dosomething(position.coords.latitude, position.coords.longitude); } function error() { alert('sorry, no position available.'); } const options = { enablehighaccuracy: true, maximumage: 30000, timeout: 27000 }; con...
GlobalEventHandlers.onblur - Web APIs
the onblur property of the globaleventhandlers mixin is the eventhandler for processing blur events. it's available on element, document, and window. the blur event is raised when an element loses focus. note: the opposite of onblur is onfocus. syntax target.onblur = functionref; value functionref is a function name or a function expression. the function receives a focusevent object as its sole argument. example this example uses onblur and onfocus to change the text within an <input> element. ...
..., and window. the blur event is raised when an element loses focus. note: the opposite of onblur is onfocus. syntax target.onblur = functionref; value functionref is a function name or a function expression. the function receives a focusevent object as its sole argument. example this example uses onblur and onfocus to change the text within an <input> element. html <input type="text" value="click here"> javascript let input = document.queryselector('input'); input.onblur = inputblur; input.onfocus = inputfocus; function inputblur() { input.value = 'focus has been lost'; } function inputfocus() { input.value = 'focus is here'; } result try clicking in and out of the form field, and watch its contents change accordingly. specifications specification status...
GlobalEventHandlers.onfocus - Web APIs
he globaleventhandlers mixin is an eventhandler that processes focus events on the given element. the focus event is raised when the user sets focus on an element. for onfocus to fire on non-input elements, they must be given the tabindex attribute (see building keyboard accessibility back in for more details). note: the opposite of onfocus is onblur. ...
...ute (see building keyboard accessibility back in for more details). note: the opposite of onfocus is onblur. syntax target.onfocus = functionref; value functionref is a function name or a function expression. the function receives a focusevent object as its sole argument. example this example uses onblur and onfocus to change the text within an <input> element. html <input type="text" value="click here"> javascript let input = document.queryselector('input'); input.onblur = inputblur; input.onfocus = inputfocus; function inputblur() { input.value = 'focus has been lost'; } function inputfocus() { input.value = 'focus is here'; } result try clicking in and out of the form field, and watch its contents change accordingly. specifications specification status...
GlobalEventHandlers.oninput - Web APIs
the oninput property of the globaleventhandlers mixin is an eventhandler that processes input events on the <input>, <select>, and <textarea> elements. it also handles these events on elements where contenteditable or designmode are turned on. note: unlike oninput, the onchange event handler is not necessarily called for each alteration to an element's value. syntax target.oninput = functionref; value functionref is a function name or a function expression. the function receives an inputevent object as its sole argument. example this example logs the number of characters in an <input> element, every time you modify its contents. html <input type="text" placeholder="type something here to see its length." size="50"> <p id="log"></p> javascript let input = document.queryselector('in...
... this example logs the number of characters in an <input> element, every time you modify its contents. html <input type="text" placeholder="type something here to see its length." size="50"> <p id="log"></p> javascript let input = document.queryselector('input'); let log = document.getelementbyid('log'); input.oninput = handleinput; function handleinput(e) { log.textcontent = `the field's value is ${e.target.value.length} character(s) long.`; } result specifications specification status comment html living standardthe definition of 'oninput' in that specification. living standard initial definition ...
GlobalEventHandlers.onpointerdown - Web APIs
ue to user activity with a mouse or mouse-compatible device. if the pointerdown event isn't canceled through a call to preventdefault(), most user agents will fire a mousedown event, so that sites not using pointer events will work. you can also use addeventlistener() to add a listener for pointerdown events. syntax target.onpointerdown = downhandler; var downhandler = target.onpointerdown; value a function to handle the pointerdown event for the target element, document, or window. it receives as input the pointerevent describing the pointerdown event. example this example demonstrates how to watch for and act upon pointerdown events using onpointerdown. you could also use addeventlistener(), of course. javascript first, let's look at the javascript code that handles the pointerdown...
... break; case "touch": action = "touching"; break; default: action = "interacting with"; break; } targetbox.innerhtml = "<strong>thanks for " + action + " me!</strong>"; evt.preventdefault(); } this simply uses onpointerdown to establish the function handledown() as the event handler for pointer down events. the handledown() function, in turn, looks at the value of pointertype to determine what kind of pointing device was used, then uses that information to customize a string to replace the contents of the target box. then the event's preventdefault() method is called to ensure that the mousedown event isn't triggered, potentially causing events to be handled twice if we had a handler for those events in case pointer event support is missing. we also h...
GlobalEventHandlers.onselect - Web APIs
the onselect property of the globaleventhandlers mixin is an eventhandler that processes select events. the select event only fires after text inside an <input type="text"> or <textarea> is selected. syntax target.onselect = functionref; value functionref is a function name or a function expression. the function receives a uievent object as its sole argument. examples this example logs the text you select inside a <textarea> element. ...
...ionref is a function name or a function expression. the function receives a uievent object as its sole argument. examples this example logs the text you select inside a <textarea> element. html <textarea>try selecting some text in this element.</textarea> <p id="log"></p> javascript function logselection(event) { const log = document.getelementbyid('log'); const selection = event.target.value.substring(event.target.selectionstart, event.target.selectionend); log.textcontent = `you selected: ${selection}`; } const textarea = document.queryselector('textarea'); textarea.onselect = logselection; result specification specification status comment html living standardthe definition of 'onselect' in that specification. living standard ...
HTMLAnchorElement - Web APIs
vents: all;} properties inherits properties from its parent, htmlelement, and implements those from htmlhyperlinkelementutils. element.accesskey is a domstring representing a single character that switches input focus to the hyperlink. htmlanchorelement.download is a domstring indicating that the linked resource is intended to be downloaded rather than displayed in the browser. the value represent the proposed name of the file. if the name is not a valid filename of the underlying os, browser will adapt it. htmlhyperlinkelementutils.hash is a usvstring representing the fragment identifier, including the leading hash mark ('#'), if any, in the referenced url. htmlhyperlinkelementutils.host is a usvstring representing the hostname and port (if it's not the default port) in the ...
...its parent, htmlelement, and implements those from htmlhyperlinkelementutils. htmlelement.blur() removes the keyboard focus from the current element. htmlelement.focus() gives the keyboard focus to the current element. htmlhyperlinkelementutils.tostring() returns a usvstring containing the whole url. it is a synonym for htmlhyperlinkelementutils.href, though it can't be used to modify the value. the blur() and focus() methods are inherited from htmlelement from html5 on, but were defined on htmlanchorelement in dom level 2 html and earlier specifications. specifications specification status comment html living standardthe definition of 'htmlanchorelement' in that specification. living standard the following property has been added: download. technic...
HTMLAreaElement - Web APIs
reaelement.alt is a domstring that reflects the alt html attribute, containing alternative text for the element. htmlareaelement.coords is a domstring that reflects the coords html attribute, containing coordinates to define the hot-spot region. htmlareaelement.download is a domstring indicating that the linked resource is intended to be downloaded rather than displayed in the browser. the value represent the proposed name of the file. if the name is not a valid filename of the underlying os, browser will adapt it. htmlhyperlinkelementutils.hash is a usvstring containing the fragment identifier (including the leading hash mark (#)), if any, in the referenced url. htmlhyperlinkelementutils.host is a usvstring containing the hostname and port (if it's not the default port) in the refer...
...e rel html attribute, indicating relationships of the current document to the linked resource, as a list of tokens. htmlhyperlinkelementutils.search is a usvstring containing the search element (including leading question mark '?'), if any, of the referenced url. htmlareaelement.shape is a domstring that reflects the shape html attribute, indicating the shape of the hot-spot, limited to known values. htmlelement.tabindex is a long containing the element's position in the tabbing order. htmlareaelement.target is a domstring that reflects the target html attribute, indicating the browsing context in which to open the linked resource. htmlareaelement.type is a domstring that reflects the type html attribute, indicating the mime type of the linked resource. htmlhyperlinkelementutils.user...
Audio() - Web APIs
the audio() constructor creates and returns a new htmlaudioelement which can be either attached to a document for the user to interact with and/or listen to, or can be used offscreen to manage and play audio. syntax audioobj = new audio(url); parameters url optional an optional domstring containing the url of an audio file to be associated with the new audio element. return value a new htmlaudioelement object, configured to be used for playing back the audio from the file specified by url.the new object's preload property is set to auto and its src property is set to the specified url or null if no url is given. if a url is specified, the browser begins to asynchronously load the media resource before returning the new object. usage notes you can also use other element-creation ...
...rowser begins to asynchronously load the media resource before returning the new object. usage notes you can also use other element-creation methods, such as the document object's createelement() method, to construct a new htmlaudioelement. determining when playback can begin there are three ways you can tell when enough of the audio file has loaded to allow playback to begin: check the value of the readystate property. if it's htmlmediaelement.have_future_data, there's enough data available to begin playback and play for at least a short time. if it's htmlmediaelement.have_enough_data, then there's enough data available that, given the current download rate, you should be able to play the audio through to the end without interruption. listen for the canplay event. it is sent to the ...
HTMLCanvasElement.height - Web APIs
this is one of the two properties, the other being htmlcanvaselement.width, that controls the size of the canvas. ...
... this is one of the two properties, the other being htmlcanvaselement.width, that controls the size of the canvas. ...
HTMLCanvasElement.toBlob() - Web APIs
back, mimetype, qualityargument); parameters callback a callback function with the resulting blob object as a single argument. mimetype optional a domstring indicating the image format. the default type is image/png. qualityargument optional a number between 0 and 1 indicating image quality if the requested type is image/jpeg or image/webp. if this argument is anything else, the default values 0.92 and 0.80 are used for image/jpeg and image/webp respectively. other arguments are ignored. return value none. exceptions securityerror the canvas's bitmap is not origin clean; at least some of its contents come from secure examples getting a file representing the canvas once you have drawn content into a canvas, you can convert it into a file of any supported image format. the c...
...pecify the image type. for example, to get the image in jpeg format: canvas.toblob(function(blob){...}, 'image/jpeg', 0.95); // jpeg at 95% quality a way to convert a canvas to an ico (mozilla only) this uses -moz-parse to convert the canvas to ico. windows xp doesn't support converting from png to ico, so it uses bmp instead. a download link is created by setting the download attribute. the value of the download attribute is the name it will use as the file name. var canvas = document.getelementbyid('canvas'); var d = canvas.width; ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.moveto(d / 2, 0); ctx.lineto(d, d); ctx.lineto(0, d); ctx.closepath(); ctx.fillstyle = 'yellow'; ctx.fill(); function blobcallback(iconname) { return function(b) { var a = document.createelement('a'); ...
HTMLCanvasElement.toDataURL() - Web APIs
the htmlcanvaselement.todataurl() method returns a data uri containing a representation of the image in the format specified by the type parameter (defaults to png). the returned image is in a resolution of 96 dpi. if the height or width of the canvas is 0 or larger than the maximum canvas size, the string "data:," is returned. if the requested type is not image/png, but the returned value starts with data:image/png, then the requested type is not supported. chrome also supports the image/webp type. syntax canvas.todataurl(type, encoderoptions); parameters type optional a domstring indicating the image format. the default format type is image/png. encoderoptions optional a number between 0 and 1 indicating the image quality to use for image formats that use lossy compression su...
...rts the image/webp type. syntax canvas.todataurl(type, encoderoptions); parameters type optional a domstring indicating the image format. the default format type is image/png. encoderoptions optional a number between 0 and 1 indicating the image quality to use for image formats that use lossy compression such as image/jpeg and image/webp. if this argument is anything else, the default value for image quality is used. the default value is 0.92. other arguments are ignored. return value a domstring containing the requested data uri. exceptions securityerror the canvas's bitmap is not origin clean; at least some of its contents have or may have been loaded from a site other than the one from which the document itself was loaded. examples given this <canvas> element: <canvas...
HTMLCanvasElement.width - Web APIs
this is one of the two properties, the other being htmlcanvaselement.height, that controls the size of the canvas. ...
... this is one of the two properties, the other being htmlcanvaselement.height, that controls the size of the canvas. ...
HTMLCanvasElement - Web APIs
dale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlcanvaselement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlcanvaselement.height the height html attribute of the <canvas> element is a positive integer reflecting the number of logical pixels (or rgba values) going down one column of the canvas. when the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 150 is used. if no [separate] css height is assigned to the <canvas>, then this value will also be used as the height of the canvas in the length-unit css pixel. htmlcanvaselement.width the width html attribute of the <canvas> element is a positi...
...s not specified, or if it is set to an invalid value, like a negative, the default value of 150 is used. if no [separate] css height is assigned to the <canvas>, then this value will also be used as the height of the canvas in the length-unit css pixel. htmlcanvaselement.width the width html attribute of the <canvas> element is a positive integer reflecting the number of logical pixels (or rgba values) going across one row of the canvas. when the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 300 is used. if no [separate] css width is assigned to the <canvas>, then this value will also be used as the width of the canvas in the length-unit css pixel. htmlcanvaselement.mozopaque is a boolean reflecting the moz-opaque html attribute o...
HTMLDialogElement.open - Web APIs
the open property of the htmldialogelement interface is a boolean reflecting the open html attribute, indicating whether the dialog is available for interaction. syntax dialoginstance.open = true; var myopenvalue = dialoginstance.open; value a boolean representing the state of the open html attribute. true means it is set, and therefore the dialog is shown. false means it not set, and therefore the dialog is not shown. the property is now read only — it is possible to set the value to programmatically show or hide the dialog. examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the showmodal() method. from there you can click the cancel button to close the dialog (via the htmldialogelement.close() method), or sub...
...utton> <button type="submit">confirm</button> </menu> </form> </dialog> <menu> <button id="updatedetails">update details</button> </menu> <script> (function() { var updatebutton = document.getelementbyid('updatedetails'); var cancelbutton = document.getelementbyid('cancel'); var dialog = document.getelementbyid('favdialog'); dialog.returnvalue = 'favanimal'; function opencheck(dialog) { if(dialog.open) { console.log('dialog open'); } else { console.log('dialog closed'); } } // update button opens a modal dialog updatebutton.addeventlistener('click', function() { dialog.showmodal(); opencheck(dialog); }); // form cancel button closes the d...
HTMLDialogElement.show() - Web APIs
examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the show() method. from there you can click the cancel button to close the dialog (via the htmldialogelement.close() method), or submit the form via the submit button. ...
...utton> <button type="submit">confirm</button> </menu> </form> </dialog> <menu> <button id="updatedetails">update details</button> </menu> <script> (function() { var updatebutton = document.getelementbyid('updatedetails'); var cancelbutton = document.getelementbyid('cancel'); var dialog = document.getelementbyid('favdialog'); dialog.returnvalue = 'favanimal'; function opencheck(dialog) { if(dialog.open) { console.log('dialog open'); } else { console.log('dialog closed'); } } // update button opens a modal dialog updatebutton.addeventlistener('click', function() { dialog.showmodal(); opencheck(dialog); }); // form cancel button closes the d...
HTMLDialogElement.showModal() - Web APIs
the showmodal() method of the htmldialogelement interface displays the dialog as a modal, over the top of any other dialogs that might be present. it displays into the top layer, along with a ::backdrop pseudo-element. interaction outside the dialog is blocked and the content outside it is rendered inert. syntax dialoginstance.showmodal(); parameters none. return value void. exceptions if the dialog is already open (i.e. if the open attribute is already set on the <dialog> element), an invalidstateerror is thrown. examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the showmodal() method. from there you can click the cancel button to close the dialog (via the htmldialogelement.close() method), or submit the form via the su...
...utton> <button type="submit">confirm</button> </menu> </form> </dialog> <menu> <button id="updatedetails">update details</button> </menu> <script> (function() { var updatebutton = document.getelementbyid('updatedetails'); var cancelbutton = document.getelementbyid('cancel'); var dialog = document.getelementbyid('favdialog'); dialog.returnvalue = 'favanimal'; function opencheck(dialog) { if(dialog.open) { console.log('dialog open'); } else { console.log('dialog closed'); } } // update button opens a modal dialog updatebutton.addeventlistener('click', function() { dialog.showmodal(); opencheck(dialog); }); // form cancel button closes the d...
HTMLDialogElement - Web APIs
o,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmldialogelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmldialogelement.open a boolean reflecting the open html attribute, indicating whether the dialog is available for interaction. htmldialogelement.returnvalue a domstring that sets or returns the return value for the dialog. methods inherits methods from its parent, htmlelement. htmldialogelement.close() closes the dialog. an optional domstring may be passed as an argument, updating the returnvalue of the the dialog. htmldialogelement.show() displays the dialog modelessly, i.e. still allowing interaction with content outside of the dialog. h...
...utton> <button type="submit">confirm</button> </menu> </form> </dialog> <menu> <button id="updatedetails">update details</button> </menu> <script> (function() { var updatebutton = document.getelementbyid('updatedetails'); var cancelbutton = document.getelementbyid('cancel'); var dialog = document.getelementbyid('favdialog'); dialog.returnvalue = 'favanimal'; function opencheck(dialog) { if(dialog.open) { console.log('dialog open'); } else { console.log('dialog closed'); } } // update button opens a modal dialog updatebutton.addeventlistener('click', function() { dialog.showmodal(); opencheck(dialog); }); // form cancel button closes the d...
HTMLElement.dir - Web APIs
Web › API › HTMLElement › dir
t element. browsers might allow users to change the directionality of <input> and <textarea>s in order to assist with authoring content. chrome and safari provide a directionality option in the contextual menu of input fields while internet explorer and edge use the key combinations ctrl + left shift and ctrl + right shift. firefox uses ctrl/cmd + shift + x but does not update the dir attribute value. ...
...ight shift. firefox uses ctrl/cmd + shift + x but does not update the dir attribute value. syntax var currentwritingdirection = elementnodereference.dir; elementnodereference.dir = newwritingdirection; currentwritingdirection is a string variable representing the text writing direction of the current element. newwritingdirection is a string variable representing the text writing direction value. possible values for dir are ltr, for left-to-right, rtl, for right-to-left, and auto for specifying that the direction of the element must be determined based on the contents of the element. example var parg = document.getelementbyid("para1"); parg.dir = "rtl"; // change the text direction on a paragraph identified as "para1" specifications specification status comment ...
HTMLElement.lang - Web APIs
Web › API › HTMLElement › lang
the htmlelement.lang property gets or sets the base language of an element's attribute values and text content. the language code returned by this property is defined in the tags for identifying languages (bcp47) ietf document. common examples include "en" for english, "ja" for japanese, "es" for spanish and so on. the default value of this attribute is unknown. note that this attribute, though valid at the individual element level described here, is most often specified for the root element of the document. this also only works with the lang attribute and not with xml:lang. ...
...de "en" for english, "ja" for japanese, "es" for spanish and so on. the default value of this attribute is unknown. note that this attribute, though valid at the individual element level described here, is most often specified for the root element of the document. this also only works with the lang attribute and not with xml:lang. syntax var languageused = elementnodereference.lang; // get the value of lang elementnodereference.lang = newlanguage; // set new value for lang languageused is a string variable that gets the language in which the text of the current element is written. newlanguage is a string variable with its value setting the language in which the text of the current element is written. example // this snippet compares the base language and // redirects to another url based...
HTMLElement.offsetHeight - Web APIs
pseudo-elements such as ::before or ::after. for the document body object, the measurement includes total linear content height instead of the element's css height. floated elements extending below other linear content are ignored. if the element is hidden (for example, by setting style.display on the element or one of its ancestors to "none"), then 0 is returned. this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). syntax var intelemoffsetheight = element.offsetheight; intelemoffsetheight is a variable storing an integer corresponding to the offsetheight pixel value of the element. the offsetheight property is read-only. example the example image above shows a scrollbar and an offsetheight which fits on ...
...ientrect(). syntax var intelemoffsetheight = element.offsetheight; intelemoffsetheight is a variable storing an integer corresponding to the offsetheight pixel value of the element. the offsetheight property is read-only. example the example image above shows a scrollbar and an offsetheight which fits on the window. however, non-scrollable elements may have large offsetheight values, much larger than the visible content. these elements are typically contained within scrollable elements; consequently, these non-scrollable elements may be completely or partly invisible, depending on the scrolltop setting of the scrollable container. specification specification status comment css object model (cssom) view modulethe definition of 'offsetheight' in ...
HTMLFontElement.size - Web APIs
the obsolete htmlfontelement.size property is a domstring that reflects the size html attribute. it contains either an integer number in the range of 1-7 or a relative value to increase/decrease the value of the size attribute of the <basefont> element. ...
...e of 1-7 or a relative value to increase/decrease the value of the size attribute of the <basefont> element. ...
HTMLFormElement.elements - Web APIs
n 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. syntax nodelist = htmlformelement.elements value an htmlformcontrolscollection containing all non-image controls in the 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.
...ets 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. ...
HTMLFormElement: formdata event - Web APIs
lem.addeventlistener('submit', (e) => { // on form submission, prevent default e.preventdefault(); // construct a formdata object, which fires the formdata event new formdata(formelem); }); // formdata handler to retrieve data formelem.addeventlistener('formdata', (e) => { console.log('formdata fired'); // get the form data from the event object let data = e.formdata; for (var value of data.values()) { console.log(value); } // submit the data via xhr var request = new xmlhttprequest(); request.open("post", "/formhandler"); request.send(data); }); the onformdata version would look like this: formelem.onformdata = (e) => { console.log('formdata fired'); // get the form data from the event object let data = e.formdata; for (var value of data.values()) ...
... { console.log(value); } // submit the data via xhr var request = new xmlhttprequest(); request.open("post", "/formhandler"); request.send(data); }); the onformdata version would look like this: formelem.onformdata = (e) => { console.log('formdata fired'); // get the form data from the event object let data = e.formdata; for (var value of data.values()) { console.log(value); } // submit the data via xhr var request = new xmlhttprequest(); request.open("post", "/formhandler"); request.send(data); }; specifications specification status comment html living standardthe definition of 'formdata' in that specification. unknown ...
HTMLImageElement.align - Web APIs
es how to position the image relative to its container. you should instead use the css propertiy vertical-align, which does in fact also work on images despite its name. you can also use the float property to float the image to the left or right margin. the align property reflects the html align content attribute. syntax htmlimageelement.align = alignmode; alignmode = htmlimageelement.align; value a domstring specifying one of the following strings which set the alignment mode for the image. baseline alignment these three values specify the alignment of the element relative to the text baseline. these should be replaced by using the css vertical-align property. bottom the bottom edge of the image is to be aligned vertically with the current text baseline. default value. middle the...
...al-align property. bottom the bottom edge of the image is to be aligned vertically with the current text baseline. default value. middle the center of the object should be aligned vertically with the current baseline. top the top edge of the object should be aligned vertically with the current baseline. it may be worth noting that vertical-align offers several additional options for its value; you may wish to consider these when changing your code to use it. floating images horizontally the left and right properties don't affect the baseline-relative alignment. instead, they cause the image to "float" to the left or right margin, allowing the following text to flow around the image. you should instead use the css float property, specifying as the value either left or right. left ...
HTMLImageElement.border - Web APIs
you should not use this property! instead, you should use css to style the border. the border property or its longhand properties to not only set the thickness of the border but to potentially apply a wide variety of other styling options to it. the width, specifically, is controlled using the writing-mode aware border-block-start-width, border-block-end-width, border-inline-start-width, and border-inline-end-width properties. ...
...aware border-block-start-width, border-block-end-width, border-inline-start-width, and border-inline-end-width properties. for compatibility (or perhaps other) reasons, you can use the older properties instead (or in addition): border-top-width, border-right-width, border-bottom-width, and border-left-width. syntax htmlimageelement.border = thickness; let thickness = htmlimageelement.border; value a domstring containing an integer value specifying the thickness of the border that should surround the image, in css pixels. a value of 0, or an empty string, indicates that there should be no border drawn. the default value of border is 0 usage notes do not use border. it is obsolete. instead, use the css border property and its longhand properties to establish borders around images. for e...
HTMLImageElement.crossOrigin - Web APIs
the htmlimageelement interface's crossorigin attribute is a string which specifies the cross-origin resource sharing (cors) setting to use when retrieving the image. syntax htmlimageelement.crossorigin = crossoriginmode; let crossoriginmode = htmlimageelement.crossorigin; value a domstring of a keyword specifying the cors mode to use when fetching the image resource. if you don't specify crossorigin, the image is fetched without cors (the fetch no-cors mode). permitted values are: anonymous requests by the <img> element have their mode set to cors and their credentials mode set to same-origin. this means that cors is enabled and credentials are sent if the image is fetched from the same origin from which the document was loaded. use-credentials requests by the htmlimageelement will ...
...y-created image. const imageurl = "https://mdn.mozillademos.org/files/16797/clock-demo-400px.png"; const container = document.queryselector(".container"); function loadimage(url) { const image = new image(200, 200); image.addeventlistener("load", () => container.prepend(image) ); image.addeventlistener("error", () => { const errmsg = document.createelement("output"); errmsg.value = `error loading image at ${url}`; container.append(errmsg); }); image.crossorigin = "anonymous"; image.alt = ""; image.src = url; } loadimage(imageurl); html <div class="container"> <p>here's a paragraph. it's a very interesting paragraph. you are captivated by this paragraph. keep reading this paragraph. okay, now you can stop reading this paragraph. thanks for reading m...
HTMLImageElement.decoding - Web APIs
async: decode the image asynchronously to reduce delay in presenting other content. auto: default mode, which indicates no preference for the decoding mode. the browser decides what is best for the user. ...
... async: decode the image asynchronously to reduce delay in presenting other content. auto: default mode, which indicates no preference for the decoding mode. the browser decides what is best for the user. ...
HTMLImageElement.isMap - Web APIs
the htmlimageelement proeprty ismap is a boolean value which indicates that the image is to be used by a server-side image map. this may only be used on images located within an <a> element. note: for accessibility reasons, you should generally avoid using server-side image maps, as they require the use of a mouse. use a client-side image map instead. syntax htmlimageelement.ismap = true|false; let ismap = htmlimageelement.ismap; value a boolean value which is true if the image is being used for a server-side image map; otherwise, the value is false. usage notes when an image marked as being part of a server-side image map is clicked, the browser constructs the string "?x,y", where x and y indicate the coordinates at which the mouse was clicked as offsets from the top-left corner of ...
... unlike server-side image maps, client-side image maps don't cause the <img> element to adopt interactive content mode. specifications specification status comment html living standardthe definition of 'htmlimageelement.ismap' in that specification. ...
HTMLImageElement.referrerPolicy - Web APIs
"origin" meaning that the referrer will be the origin of the page, that is roughly the scheme, the host and the port. ...
... "origin" meaning that the referrer will be the origin of the page, that is roughly the scheme, the host and the port. ...
HTMLInputElement: search event - Web APIs
g enter while the <input> is focused, or, if the incremental attribute is present, after a ua-defined timeout elapses since the most recent keystroke (with new keystrokes resetting the timeout so the firing of the event is debounced). current ua implementations of <input type="search"> have an additional control to clear the field. using this control also fires the search event. ...
...mplementations of <input type="search"> have an additional control to clear the field. using this control also fires the search event. in that case the value of the <input> element will be the empty string. examples // addeventlistener version const input = document.queryselector('input[type="search"]'); input.addeventlistener('search', () => { console.log("the term searched for was " + input.value); }) // onsearch version const input = document.queryselector('input[type="search"]'); input.onsearch = () => { console.log("the term searched for was " + input.value); }) specifications this event is not part of any specification. ...
HTMLInputElement.select() - Web APIs
the htmlinputelement.select() method selects all the text in a <textarea> element or in an <input> element that includes a text field. syntax element.select(); example click the button in this example to select all the text in the <input> element. ...
...pt function selecttext() { const input = document.getelementbyid('text-box'); input.focus(); input.select(); } result notes calling element.select() will not necessarily focus the input, so it is often used with htmlelement.focus(). in browsers where it is not supported, it is possible to replace it with a call to htmlinputelement.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.setRangeText() - Web APIs
the htmlinputelement.setrangetext() method replaces a range of text in an <input> or <textarea> element with a new string. syntax element.setrangetext(replacement); element.setrangetext(replacement, start, end [, selectmode]); parameters replacement the string to insert. start optional the 0-based index of the first character to replace. defaults to the current selectionstart value (the start of the user's current selection). end optional the 0-based index of the character after the last character to replace. defaults to the current selectionend value (the end of the user's current selection). selectmode optional a string defining how the selection should be set after the text has been replaced. possible values: "select" selects the newly inserted text. "start"moves the sel...
...tart"moves the selection to just before the inserted text. "end" moves the selection to just after the inserted text. "preserve" attempts to preserve the selection. this is the default. example click the button in this example to replace part of the text in the text box. the newly inserted text will be highlighted (selected) afterwards. ...
HTMLMediaElement.autoplay - Web APIs
toplay can be useful when creating media elements whose source will be set at a later time, under user control. for a much more in-depth look at autoplay, autoplay blocking, and how to respond whena autoplay is blocked by the user's browser, see our article autoplay guide for media and web audio apis. syntax htmlmediaelement.autoplay = true | false; var autoplay = htmlmediaelement.autoplay; value a boolean whose value is true if the media element will begin playback as soon as enough content has loaded to allow it to do so without interruption. note: some browsers offer users the ability to override autoplay in order to prevent disruptive audio or video from playing without permission or in the background. do not rely on autoplay actually starting playback and instead use play event. ...
...tive audio or video from playing without permission or in the background. do not rely on autoplay actually starting playback and instead use play event. examples ... <video id="video" controls> <source src="https://player.vimeo.com/external/250688977.sd.mp4?s=d14b1f1a971dde13c79d6e436b88a6a928dfe26b&profile_id=165"> </video> *** disable autoplay (recommended) *** false is the default value document.queryselector('#video').autoplay = false; specifications specification status comment html living standardthe definition of 'htmlmediaelement.autoplay' in that specification. living standard no change from html5 html5the definition of 'htmlmediaelement.autoplay' in that specification. recommendation initial definition. ...
HTMLMediaElement.currentTime - Web APIs
the htmlmediaelement interface's currenttime property specifies the current playback time in seconds. changing the value of currenttime this value seeks the media to the new time. syntax var currenttime = htmlmediaelement.currenttime; htmlmediaelement.currenttime = 35; value a double-precision floating-point value indicating the current playback time in seconds. if the media is not yet playing, the value of currenttime indicates the time position within the media at which playback will begin once the play() method is called. setting currenttime 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 f...
...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 html living standardthe definition of 'htmlmediaelement.currenttime' in that specification. living standard no change from html5 html5the definition of 'htmlmediaelement.currenttime' in that specification. recommendation initial definition. ...
HTMLMediaElement.playbackRate - Web APIs
the htmlmediaelement.playbackrate property sets the rate at which the media is being played back. this is used to implement user controls for fast forward, slow motion, and so forth. the normal playback rate is multiplied by this value to obtain the current rate, so a value of 1.0 indicates normal speed. if playbackrate is negative, the media is not played backwards. the audio is muted when the fast forward or slow motion is outside a useful range (for example, gecko mutes the sound outside the range 0.25 to 5.0). the pitch of the audio is corrected by default and is the same for every speed. some browsers implement the non-standard htmlmediaelement.preservespitch property to control this. syntax // video video.playbackrate = 1.5; // audio audio.playbackrate = 1.0; value a double. 1.
...on is outside a useful range (for example, gecko mutes the sound outside the range 0.25 to 5.0). the pitch of the audio is corrected by default and is the same for every speed. some browsers implement the non-standard htmlmediaelement.preservespitch property to control this. syntax // video video.playbackrate = 1.5; // audio audio.playbackrate = 1.0; value a double. 1.0 is "normal speed," values lower than 1.0 make the media play slower than normal, higher values make it play faster. (default: 1.0) example var obj = document.createelement('video'); console.log(obj.playbackrate); // expected output: 1 specifications specification status comment html living standardthe definition of 'htmlmediaelement.playbackrate' in that specification. living standard ...
HTMLMeterElement.labels - Web APIs
the htmlmeterelement.labels read-only property returns a nodelist of the <label> elements associated with the <meter> element. syntax var labelelements = meter.labels; return value a nodelist containing the <label> elements associated with the <meter> element. ...
... the htmlmeterelement.labels read-only property returns a nodelist of the <label> elements associated with the <meter> element. syntax var labelelements = meter.labels; return value a nodelist containing the <label> elements associated with the <meter> element. ...
HTMLOListElement - Web APIs
stroke="#d4dde4" stroke-width="2px" /><text x="411" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlolistelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlolistelement.reversed is a boolean value reflecting the reversed and defining if the numbering is descending, that is its value is true, or ascending (false). htmlolistelement.start is a long value reflecting the start and defining the value of the first number of the first element of the list. htmlolistelement.type is a domstring value reflecting the type and defining the kind of marker to be used to display. it can have the follow...
...lecting the reversed and defining if the numbering is descending, that is its value is true, or ascending (false). htmlolistelement.start is a long value reflecting the start and defining the value of the first number of the first element of the list. htmlolistelement.type is a domstring value reflecting the type and defining the kind of marker to be used to display. ...
HTMLObjectElement.setCustomValidity - Web APIs
the setcustomvalidity() method of the htmlobjectelement interface sets a custom validity message for the element. syntax htmlobjectelement.setcustomvalidity(message); parameters error the message to use for validity errors. return value undefined exceptions none. examples in this example, we pass the id of an input element, and set different error messages depending on whether the value is missing, too low or too high. additionally you must call the reportvalidity method on the same element or nothing will happen. ...
...les in this example, we pass the id of an input element, and set different error messages depending on whether the value is missing, too low or too high. additionally you must call the reportvalidity method on the same element or nothing will happen. ...
HTMLOrForeignElement.dataset - Web APIs
ii lowercase letter a to z; the prefix data- is added; any ascii uppercase letter a to z is transformed into a dash, followed by its lowercase counterpart; other characters are left unchanged. the restriction in the rules above ensures that the two transformations are the inverse one of the other. for example, the attribute named data-abc-def corresponds to the key abcdef. ...
...the attribute named data-abc-def corresponds to the key abcdef. accessing values attributes can be set and read by using the camelcase name (the key) like an object property of the dataset, as in element.dataset.keyname attributes can also be set and read using the bracket syntax, as in element.dataset[keyname] the in operator can be used to check whether a given attribute exists. setting values when an attribute is set, its value is always converted into a string. for example: null is converted into the string "null". to remove an attribute, you can use the delete operator. syntax const dataattrmap = element.dataset value a domstringmap. examples <div id="user" data-id="1234567890" data-user="johndoe" data-date-of-birth>john doe</div> const el = d...
HTMLElement.focus() - Web APIs
s on the specified element, if it can be focused. the focused element is the element which will receive keyboard and similar events by default. syntax element.focus(options); // object parameter parameters options optional an optional object providing options to control aspects of the focusing process. this object may contain the following property: preventscroll optional a boolean value indicating whether or not the browser should scroll the document to bring the newly-focused element into view. a value of false for preventscroll (the default) means that the browser will scroll the element into view after focusing it. if preventscroll is set to true, no scrolling will occur. examples focus on a text field javascript focusmethod = function getfocus() { docume...
...cused element into view. a value of false for preventscroll (the default) means that the browser will scroll the element into view after focusing it. if preventscroll is set to true, no scrolling will occur. ...
HTMLProgressElement.labels - Web APIs
the htmlprogresselement.labels read-only property returns a nodelist of the <label> elements associated with the <progress> element. syntax var labelelements = progress.labels; return value a nodelist containing the <label> elements associated with the <progress> element. ...
... the htmlprogresselement.labels read-only property returns a nodelist of the <label> elements associated with the <progress> element. syntax var labelelements = progress.labels; return value a nodelist containing the <label> elements associated with the <progress> element. ...
HTMLProgressElement - Web APIs
stroke="#d4dde4" stroke-width="2px" /><text x="396" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlprogresselement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. ...
...ndale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlprogresselement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlprogresselement.max is a double value reflecting the content attribute of the same name, limited to numbers greater than zero. its default value is 1.0. htmlprogresselement.positionread only returns a double value returning the result of dividing the current value (value) by the maximum value (max); if the progress bar is an indeterminate progress bar, it returns -1. htmlprogresselement.value is a double value that reflects the current value; if the progress bar is an indeterminate progress bar, it returns 0. htmlprogresselement.lab...
HTMLScriptElement.referrerPolicy - Web APIs
no referrer information is sent along with requests. ...
...end the origin when the protocol security level stays the same (e.g. https→https), and send no header to a less secure destination (e.g. https→http). unsafe-url send a full url when performing a same-origin or cross-origin request. this policy will leak origins and paths from tls-protected resources to insecure origins. carefully consider the impact of this setting. note: an empty string value ("") is both the default value, and a fallback value if referrerpolicy is not supported. if referrerpolicy is not explicitly specified on the <script> element, it will adopt a higher-level referrer policy, i.e. one set on the whole document or domain. if a higher-level policy is not available, the empty string is treated as being equivalent to no-referrer-when-downgrade. examples var scriptele...
HTMLSelectElement.autofocus - Web APIs
ually the first such element on the page, get the initial focus. setting this property doesn't set the focus to the associated <select> element: it merely tells the browser to focus to it when the element is inserted in the document. setting it after the insertion, that is most of the time after the document load, has no visible effect. ...
... setting this property doesn't set the focus to the associated <select> element: it merely tells the browser to focus to it when the element is inserted in the document. setting it after the insertion, that is most of the time after the document load, has no visible effect. ...
HTMLSelectElement.selectedOptions - Web APIs
telement property selectedoptions contains a list of the <option> elements contained within the <select> element that are currently selected. the list of selected options is an htmlcollection object with one entry per currently selected option. an option is considered selected if it has an htmloptionelement.selected attribute. syntax var selectedcollection = htmlselectelement.selectedoptions; value 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...
...empty and returns a length of 0. example in this example, a <select> element with a number of options is used to let the user order various food items. html the html that creates the selection box and the <option> elements representing each of the food choices looks like this: <label for="foods">what do you want to eat?</label><br> <select id="foods" name="foods" size="7" multiple> <option value="1">burrito</option> <option value="2">cheeseburger</option> <option value="3">double bacon burger supreme</option> <option value="4">pepperoni pizza</option> <option value="5">taco</option> </select> <br> <button name="order" id="order"> order now </button> <p id="output"> </p> the <select> element is set to allow multiple items to be selected, and it is 7 rows tall. note also the <bu...
HTMLTableElement.frame - Web APIs
this is the default. ...
...this is the default. ...
HTMLTrackElement - Web APIs
s,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmltrackelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmltrackelement.kind is a domstring that reflects the kind html attribute, indicating how the text track is meant to be used. possible values are: subtitles, captions, descriptions, chapters, or metadata. htmltrackelement.src is a domstring that reflects the src html attribute, indicating the address of the text track data. htmltrackelement.srclang is a domstring that reflects the srclang html attribute, indicating the language of the text track data. htmltrackelement.label is a domstring that reflects the label html attribute, ...
...attribute, indicating a user-readable title for the track. htmltrackelement.default a boolean reflecting the default attribute, indicating that the track is to be enabled if the user's preferences do not indicate that another track would be more appropriate. htmltrackelement.readystate read only returns an unsigned short that show the readiness state of the track: constant value description none 0 indicates that the text track's cues have not been obtained. loading 1 indicates that the text track is loading and there have been no fatal errors encountered so far. further cues might still be added to the track by the parser. loaded 2 indicates that the text track has been loaded with no fatal errors. ...
HTMLVideoElement.getVideoPlaybackQuality() - Web APIs
the htmlvideoelement method getvideoplaybackquality() creates and returns a videoplaybackquality object containing metrics including how many frames have been lost. the data returned can be used to evaluate the quality of the video stream. syntax videopq = videoelement.getvideoplaybackquality(); return value a videoplaybackquality object providing information about the video element's current playback quality. ...
...st. the data returned can be used to evaluate the quality of the video stream. syntax videopq = videoelement.getvideoplaybackquality(); return value a videoplaybackquality object providing information about the video element's current playback quality. example this example updates an element to indicate the total number of video frames that have elapsed so far in the playback process. ...
HTMLVideoElement - Web APIs
tmlmediaelement, and htmlelement. htmlvideoelement.height is a domstring that reflects the height html attribute, which specifies the height of the display area, in css pixels. htmlvideoelement.poster is a domstring that reflects the poster html attribute, which specifies an image to show while no video data is available. htmlvideoelement.videoheight read only returns an unsigned integer value indicating the intrinsic height of the resource in css pixels, or 0 if no media is available yet. htmlvideoelement.videowidth read only returns an unsigned integer value indicating the intrinsic width of the resource in css pixels, or 0 if no media is available yet. htmlvideoelement.width is a domstring that reflects the width html attribute, which specifies the width of the display area, in...
...t is flipped horizontally in the display. htmlvideoelement.msinsertvideoeffect() inserts the specified video effect into the media pipeline. htmlvideoelement.msislayoutoptimalforplayback read only indicates whether the video can be rendered more efficiently. htmlvideoelement.msisstereo3d read only determines whether the system considers the loaded video source to be stereo 3-d or not. value set to true indicates source is stereo 3d. htmlvideoelement.mszoom controls whether the video frame is trimmed to fit the video display. methods inherits methods from its parent, htmlmediaelement, and from its ancestor htmlelement. htmlvideoelement.getvideoplaybackquality() returns a videoplaybackquality object that contains the current playback metrics. this information includes thi...
HTML Drag and Drop API - Web APIs
event (such as touch events or pointer events). for more information, see: specifying drop targets handle the drop effect the handler for the drop event is free to process the drag data in an application-specific way. typically, an application uses the getdata() method to retrieve drag items and then process them accordingly. additionally, application semantics may differ depending on the value of the dropeffect and/or the state of modifier keys. the following example shows a drop handler getting the source element's id from the drag data, and then using the id to move the source element to the drop element: <script> function dragstart_handler(ev) { // add the target element's id to the data transfer object ev.datatransfer.setdata("application/my-app", ev.target.id); ev.datatransfe...
...arget" ondrop="drop_handler(event)" ondragover="dragover_handler(event)">drop zone</div> for more information, see: performing a drop drag end at the end of a drag operation, the dragend event fires at the source element — the element that was the target of the drag start. this event fires regardless of whether the drag completed or was canceled. the dragend event handler can check the value of the dropeffect property to determine if the drag operation succeeded or not. for more information about handling the end of a drag operation, see: finishing a drag interoperability as can be seen in the datatransferitem interface's browser compatibility table, drag-and-drop interoperability is relatively broad among desktop browsers (except the datatransferitem and datatransferitemlist ...
Headers.append() - Web APIs
Web › API › Headers › append
the append() method of the headers interface appends a new value onto an existing header inside a headers object, or adds the header if it does not already exist. the difference between set() and append() is that if the specified header already exists and accepts multiple values, set() will overwrite the existing value with the new one, whereas append() will append the new value onto the end of the set of values. for security reasons, some headers can only be controlled by the user agent. these headers include the forbidden header names and forbidden response header names. syntax myheaders.append(name, value); parameters name the name of the http header you want to add to the headers object. value the value of the http header you want to add. returns void. example creating an e...
...ect. value the value of the http header you want to add. returns void. example creating an empty headers object is simple: var myheaders = new headers(); // currently empty you could add a header to this using append(): myheaders.append('content-type', 'image/jpeg'); myheaders.get('content-type'); // returns 'image/jpeg' if the specified header already exists, append() will change its value to the specified value. if the specified header already exists and accepts multiple values, append() will append the new value to the end of the value set: myheaders.append('accept-encoding', 'deflate'); myheaders.append('accept-encoding', 'gzip'); myheaders.get('accept-encoding'); // returns 'deflate, gzip' to overwrite the old value with a new one, use headers.set. specifications s...
Headers.entries() - Web APIs
Web › API › Headers › entries
the headers.entries() method returns an iterator allowing to go through all key/value pairs contained in this object. the both the key and value of each pairs are bytestring objects. note: this method is available in web workers. syntax headers.entries(); return value returns an iterator. ...
...alue pairs contained in this object. the both the key and value of each pairs are bytestring objects. note: this method is available in web workers. syntax headers.entries(); return value returns an iterator. ...
History.state - Web APIs
Web › API › History › state
the history.state property returns a value representing the state at the top of the history stack. this is a way to look at the state without having to wait for a popstate event. syntax const currentstate = history.state value the state at the top of the history stack. the value is null until the pushstate() or replacestate() method is used. examples the code below logs the value of history.state before using the pushstate() method to push a value to the history. the next line logs the value to the console again, showing that history.state now has a value. // should be null because we haven't modified the history stack yet console.log(`history.state before pushstate: ${history.state}`); // now push something on the stack history.pushstate({name: 'example'}, "pushstate example", 'page3.
...console.log(`history.state after pushstate: ${history.state}`); specificationse specification status comment html living standardthe definition of 'history.state' in that specification. living standard html5the definition of 'history.state' in that specification. ...
History - Web APIs
Web › API › History
gth read only 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. scrollrestoration allows web applications to explicitly set default scroll restoration behavior on history navigation. this property can be either auto or manual. state read only returns an any value representing the state at the top of the history stack. this is a way to look at the state without having to wait for a popstate event. methods the history interface doesn't inherit any methods. back() this asynchronous method goes to the previous page in session history, the same action as when the user clicks the browser's back button. equivalent to history.go(-1). calling this method t...
...s forward button; this is equivalent to history.go(1). calling this method to go forward beyond the most recent page in the session history has no effect and doesn't raise an exception. go() asynchronously loads a page from the session history, identified by its relative location to the current page, for example -1 for the previous page or 1 for the next page. if you specify an out-of-bounds value (for instance, specifying -1 when there are no previously-visited pages in the session history), this method silently has no effect. calling go() without parameters or a value of 0 reloads the current page. internet explorer lets you specify a string, instead of an integer, to go to a specific url in the history list. pushstate() pushes the given data onto the session history stack with the spe...
IDBCursor.continuePrimaryKey() - Web APIs
ey parameter. a typical use case, is to resume the iteration where a previous cursor has been closed, without having to compare the keys one by one. calling this method more than once before new cursor data has been loaded - for example, calling continueprimarykey() twice from the same onsuccess handler - results in an invalidstateerror being thrown on the second call because the cursor’s got value flag has been unset. this method is only valid for cursors coming from an index. using it for cursors coming from an object store will throw an error. note: this feature is available in web workers. syntax cursor.continueprimarykey(key, primarykey); parameters key the key to position the cursor at. primarykey the primary key to position the cursor at. exceptions this method may rais...
... recommendation ...
IDBCursorSync - Web APIs
overview bool continue (in optional any key); void remove () raises (idbdatabaseexception); attributes attribute type description count readonly unsigned long long the total number of objects that share the current key. direction readonly unsigned short the direction of traversal of the cursor. see constants for possible values. key readonly any the key for the record at the cursor's position. value any the value for the record at the cursor's position. setting this attribute can raise an idbdatabaseexception with the following codes: data_err if the underlying object store uses in-line keys and the property at the key path does not match the key in this cursor's posit...
...ed_err if the underlying index or object store does not support updating the record because it is open in the read_only or snapshot_read mode, or if an index record cannot be changed because the underlying index is auto-populated. serial_err if the data being stored could not be serialized by the internal structured cloning algorithm. constants constant value description next 0 this cursor includes duplicates, and its direction is monotonically increasing in the order of keys. next_no_duplicate 1 this cursor does not include duplicates, and its direction is monotonically increasing in the order of keys. prev 2 this cursor includes duplicates, and its direction is monotonically decreasing in the order...
IDBFactory.open() - Web APIs
Web › API › IDBFactory › open
l be opened without changing its version. if the version is not provided and the database does not exist, then it will be created with version 1. experimental gecko options object options (version and storage) optional in gecko, since version 26, you can include a non-standard options object as a parameter of idbfactory.open that contains the version number of the database, plus a storage value that specifies whether you want to use persistent or temporary storage. warning: the storage attribute is deprecated and will soon be removed from gecko. you should use storagemanager.persist() to get persistent storage instead. note: you can find out more information on the different available storage types, and how firefox handles client-side data storage, at browser storage limits and ev...
...u want to use persistent or temporary storage. warning: the storage attribute is deprecated and will soon be removed from gecko. you should use storagemanager.persist() to get persistent storage instead. note: you can find out more information on the different available storage types, and how firefox handles client-side data storage, at browser storage limits and eviction criteria. return value a idbopendbrequest object on which subsequent events related to this request are fired. exceptions this method may raise a domexception of the following types: exception description typeerror the value of version is zero or a negative number or not a number. example example of calling open with the current specification's version parameter: var request = w...
IDBIndex.getAll() - Web APIs
Web › API › IDBIndex › getAll
the getall() method of the idbindex interface retrieves all objects that are inside the index. there is a performance cost associated with looking at the value property of a cursor, because the object is created lazily. to use a feature like getall(), the browser has to create all the objects at once. if you are just interested in looking at each of the keys, for instance, it is more efficient to use a cursor. if you are trying to get an array of all the objects in an object store, though, you should use getall(). ...
... it is more efficient to use a cursor. if you are trying to get an array of all the objects in an object store, though, you should use getall(). syntax var getallkeysrequest = idbindex.getall(); var getallkeysrequest = idbindex.getall(query); var getallkeysrequest = idbindex.getall(query, count); parameters query optional a key or an idbkeyrange identifying the records to retrieve. if this value is null or missing, the browser will use an unbound key range. count optional the number records to return. if this value exceeds the number of records in the query, the browser will only retrieve the first item. if it is lower than 0 or greater than 232-1 a typeerror exception will be thrown. return value an idbrequest object on which subsequent events related to this operation are fired. ...
IDBIndex.openKeyCursor() - Web APIs
hen the result property of the event is set to the new idbcursor object; the key property of the cursor object is set to the found key and the primarykey property is set to the the corresponding primary key of the found record. if no keys match the key range, then then the result property of the event is set to null. note: cursors returned by openkeycursor() do not make the referenced value available as idbindex.opencursor does. this makes obtaining a list of keys much more efficient. note: this feature is available in web workers. syntax var request = myindex.openkeycursor(); var request = myindex.openkeycursor(range); var request = myindex.openkeycursor(range, direction); parameters range optional a key or idbkeyrange to use as the cursor's range. if nothing is passed, th...
...est = myindex.openkeycursor(); var request = myindex.openkeycursor(range); var request = myindex.openkeycursor(range, direction); parameters range optional a key or idbkeyrange to use as the cursor's range. if nothing is passed, this will default to a key range that selects all the records in this object store. direction optional the cursor's direction. see idbcursor constants for possible values. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbindex's transaction is inactive. typeerror the value for the direction parameter is invalid. dataerror ...
IDBKeyRange.includes() - Web APIs
the includes() method of the idbkeyrange interface returns a boolean indicating whether a specified key is inside the key range. note: this feature is available in web workers. syntax var isincluded = mykeyrange.includes(key) parameters key the key you want to check for in your key range. this can be any type. return value a boolean. ...
...s feature is available in web workers. syntax var isincluded = mykeyrange.includes(key) parameters key the key you want to check for in your key range. this can be any type. return value a boolean. exceptions this method may raise a domexception of the following type: attribute description dataerror the supplied key was not a valid key. example var keyrangevalue = idbkeyrange.bound('a', 'k', false, false); var myresult = keyrangevalue.includes('f'); // returns true var myresult = keyrangevalue.includes('w'); // returns false polyfill the includes() method was added in the second edition of the indexed db specification. for browsers that do not support it, the following polyfill can be used. idbkeyrange.prototype.includes = idbkeyrange.prototype.inc...
IDBObjectStore.count() - Web APIs
umber of records that match the provided key or idbkeyrange. if no arguments are provided, it returns the total number of records in the store. note: this feature is available in web workers. syntax var request = objectstore.count(); var request = objectstore.count(query); parameters query optional a key or idbkeyrange object that specifies a range of records you want to count. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror this idbobjectstore has been deleted. transactioninactiveerror this idbobjectstore's transaction is inactive. dataerror the specified key o...
...error this idbobjectstore has been deleted. transactioninactiveerror this idbobjectstore's transaction is inactive. dataerror the specified key or key range is invalid. example in this simple fragment we create a transaction, retrieve an object store, then count the number of records in the store using count() — when the success handler fires, we log the count value (an integer) to the console. var transaction = db.transaction(['fthings'], 'readonly'); var objectstore = transaction.objectstore('fthings'); var countrequest = objectstore.count(); countrequest.onsuccess = function() { console.log(countrequest.result); } specification specification status comment indexed database api 2.0the definition of 'count()' in that speci...
IDBObjectStore.createIndex() - Web APIs
th an empty name. keypath the key path for the index to use. note that it is possible to create an index with an empty keypath, and also to pass in a sequence (array) as a keypath. objectparameters optional an idbindexparameters object, which can include the following properties: attribute description unique if true, the index will not allow duplicate values for a single key. multientry if true, the index will add an entry in the index for each array element when the keypath resolves to an array. if false, it will add one single entry containing the array. locale currently firefox-only (43+), this allows you to specify a locale for the index. any sorting operations performed on the data via key ranges will then ...
...y in the index for each array element when the keypath resolves to an array. if false, it will add one single entry containing the array. locale currently firefox-only (43+), this allows you to specify a locale for the index. any sorting operations performed on the data via key ranges will then obey sorting rules of that locale (see locale-aware sorting.) you can specify its value in one of three ways: string: a string containing a specific locale code, e.g. en-us, or pl. auto: the platform default locale will be used (may be changed by user agent settings.) null or undefined: if no locale is specified, normal javascript sorting will be used — not locale-aware. return value an idbindex object: the newly created index. ex...
IDBObjectStore.getAll() - Web APIs
the getall() method of the idbobjectstore interface returns an idbrequest object containing all objects in the object store matching the specified parameter or all objects in the store if no parameters are given. if a value is successfully found, then a structured clone of it is created and set as the result of the request object. this method produces the same result for: a record that doesn't exist in the database a record that has an undefined value to tell these situations apart, you either call the opencursor() method with the same key. that method provides a cursor if the record exists, and no cursor if it does not. the count() method with the same key, which will return 1 if the row exists and 0 if it doesn't. syntax var request = objectstore.getall(); var request = obje...
...ll return 1 if the row exists and 0 if it doesn't. syntax var request = objectstore.getall(); var request = objectstore.getall(query); var request = objectstore.getall(query, count); parameters query optional a key or idbkeyrange to be queried. if nothing is passed, this will default to a key range that selects all the records in this object store. count optional specifies the number of values to return if more than one is found. if it is lower than 0 or greater than 232-1 a typeerror exception will be thrown. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbobjectstore's...
IDBObjectStore.getAllKeys() - Web APIs
the getallkeys() method of the idbobjectstore interface returns an idbrequest object retrieves record keys for all objects in the object store matching the specified parameter or all objects in the store if no parameters are given. if a value is successfully found, then a structured clone of it is created and set as the result of the request object. this method produces the same result for: a record that doesn't exist in the database a record that has an undefined value to tell these situations apart, you need to call the opencursor() method with the same key. that method provides a cursor if the record exists, and no cursor if it does not. syntax var request = objectstore.getallkeys(); var request = objectstore.getallkeys(query); var request = objectstore.getallkeys(query, count);...
...tabase a record that has an undefined value to tell these situations apart, you need to call the opencursor() method with the same key. that method provides a cursor if the record exists, and no cursor if it does not. syntax var request = objectstore.getallkeys(); var request = objectstore.getallkeys(query); var request = objectstore.getallkeys(query, count); parameters query optional a value that is or resolves to an idbkeyrange. count optional specifies the number of values to return if more than one is found. if it is lower than 0 or greater than 232-1 a typeerror exception will be thrown. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: e...
IDBObjectStore.keyPath - Web APIs
example in the following code snippet, we open a read/write transaction on our database and add some data to an object store using add(). ...
... example in the following code snippet, we open a read/write transaction on our database and add some data to an object store using add(). ...
IDBObjectStore.openKeyCursor() - Web APIs
est = objectstore.openkeycursor(query, direction); parameters query optional the key range to be queried. if a single valid key is passed, this will default to a range containing only that key. if nothing is passed, this will default to a key range that selects all the records in this object store. direction optional an idbcursordirection telling the cursor what direction to travel. valid values are "next", "nextunique", "prev", and "prevunique". the default is "next". return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror this idbobjectstore or idbindex has been deleted. transactionin...
... recommendation indexed database api draftthe definition of 'openkeycursor()' in that sp...
IDBRequest.readyState - Web APIs
the readystate read-only property of the idbrequest interface returns the state of the request. every request starts in the pending state. the state changes to done when the request completes successfully or when an error occurs. note: this feature is available in web workers. syntax var currentreadystate = request.readystate; value the idbrequestreadystate of the request, which takes one of the following two values: value meaning pending the request is pending. done the request is done. example the following example requests a given record title, onsuccess gets the associated record from the idbobjectstore (made available as objectstoretitlerequest.result), updates one property of the record, and then puts the updated record back ...
... up a transaction as usual var objectstore = db.transaction(['todolist'], "readwrite").objectstore('todolist'); // get the to-do list object that has this title as it's title var objectstoretitlerequest = objectstore.get(title); objectstoretitlerequest.onsuccess = function() { // grab the data object returned as the result var data = objectstoretitlerequest.result; // update the notified value in the object to "yes" data.notified = "yes"; // create another request that inserts the item // back into the database var updatetitlerequest = objectstore.put(data); // log the source of this request console.log("the readystate of this request is " + updatetitlerequest.readystate); // when this new request succeeds, run the displaydata() // function again to update the displa...
IDBRequest.result - Web APIs
Web › API › IDBRequest › result
the result read-only property of the idbrequest interface returns the result of the request. if the request failed and the result is not available, an invalidstateerror exception is thrown. note: this feature is available in web workers. syntax var myresult = request.result; value any example the following example requests a given record title, onsuccess gets the associated record from the idbobjectstore (made available as objectstoretitlerequest.result), updates one property of the record, and then puts the updated record back into the object store. for a full working example, see our to-do notifications app (view example live.) var title = "walk dog"; // open up a transaction as usual var objectstore = db.transaction(['todolist'], "readwrite").objectstore('todolist'); // get the ...
... up a transaction as usual var objectstore = db.transaction(['todolist'], "readwrite").objectstore('todolist'); // get the to-do list object that has this title as it's title var objectstoretitlerequest = objectstore.get(title); objectstoretitlerequest.onsuccess = function() { // grab the data object returned as the result var data = objectstoretitlerequest.result; // update the notified value in the object to "yes" data.notified = "yes"; // create another request that inserts the item // back into the database var updatetitlerequest = objectstore.put(data); // when this new request succeeds, run the displaydata() // function again to update the display updatetitlerequest.onsuccess = function() { displaydata(); }; }; specifications specification stat...
IDBRequest.source - Web APIs
Web › API › IDBRequest › source
the source read-only property of the idbrequest interface returns the source of the request, such as an index or an object store. if no source exists (such as when calling indexeddb.open), it returns null. note: this feature is available in web workers. syntax var idbindex = request.source; var idbcursor = request.source; var idbobjectstore = request.source; value an object representing the source of the request, such as an idbindex, idbobjectstore or idbcursor. example the following example requests a given record title, onsuccess gets the associated record from the idbobjectstore (made available as objectstoretitlerequest.result), updates one property of the record, and then puts the updated record back into the object store in another request. the source of the 2nd request is logg...
...n up a transaction as usual var objectstore = db.transaction(['todolist'], "readwrite").objectstore('todolist'); // get the to-do list object that has this title as its title var objectstoretitlerequest = objectstore.get(title); objectstoretitlerequest.onsuccess = function() { // grab the data object returned as the result var data = objectstoretitlerequest.result; // update the notified value in the object to "yes" data.notified = "yes"; // create another request that inserts the item // back into the database var updatetitlerequest = objectstore.put(data); // log the source of this request console.log("the source of this request is " + updatetitlerequest.source); // when this new request succeeds, run the displaydata() // function again to update the display updat...
IDBRequest.transaction - Web APIs
database then during the upgradeneeded event handler the transaction property will be an idbtransaction with mode equal to "versionchange", and can be used to access existing object stores and indexes, or abort the the upgrade. following the upgrade, the transaction ​property will again be null. note: this feature is available in web workers. syntax var mytransaction = request.transaction; value an idbtransaction. example the following example requests a given record title, onsuccess gets the associated record from the idbobjectstore (made available as objectstoretitlerequest.result), updates one property of the record, and then puts the updated record back into the object store in another request. the source of the requests is logged to the developer console — both originate from t...
... up a transaction as usual var objectstore = db.transaction(['todolist'], "readwrite").objectstore('todolist'); // get the to-do list object that has this title as it's title var objectstoretitlerequest = objectstore.get(title); objectstoretitlerequest.onsuccess = function() { // grab the data object returned as the result var data = objectstoretitlerequest.result; // update the notified value in the object to "yes" data.notified = "yes"; // create another request that inserts the item back // into the database var updatetitlerequest = objectstore.put(data); // log the transaction that originated this request console.log("the transaction that originated this request is " + updatetitlerequest.transaction); // when this new request succeeds, run the displaydata() // fu...
IDBTransaction.error - Web APIs
in chrome 48+/firefox 58+ this property returns a domexception because domerror has been removed from the dom standard. the exact error is one of serveral possibilities. ...
... full support 14safari ios full support 8samsung internet android full support 1.5 full support 1.5 no support 1.5 — 7.0prefixed prefixed implemented with the vendor prefix: webkitdomexception value instead of domerrorchrome full support 48edge full support ≤18firefox full support 58ie no support noopera full support yessafari no support ...
ImageCapture.getPhotoCapabilities() - Web APIs
example the following example, extracted from chrome's image capture / photo resolution sample, uses the results from getphotocapabilities() to modify the size of an input range. ...
... working draft initial definition. ...
ImageCapture.getPhotoSettings() - Web APIs
the getphotosettings() method of the imagecapture interface returns a promise that resolves with a photosettings object containing the current photo configuration settings. syntax const settingspromise = imagecapture.getphotosettings() return value a promise that resolves with a photosettings object containing the following properties: filllightmode: the flash setting of the capture device, one of "auto", "off", or "on". imageheight: the desired image height as an integer. the user agent selects the closest width value to this setting if it only supports discrete heights. imagewidth: the desired image width as an integer. the user agent selects the closest width value to this setting if it only supports discrete widths. redeyereduction: a boolean indicating whether the red-eye reduc...
... working draft initial definition. ...
InputEvent.inputType - Web APIs
for a complete list of the available input types, see the attributes section of the input events level 1 spec. ...
...for a complete list of the available input types, see the attributes section of the input events level 1 spec. ...
install - Web APIs
rray of files to be installed (see example below). callbackfunc an optional callback function invoked when the installation is complete (see example below). firefox 3 note in firefox 3 the callback is no longer invoked unless the website performing the installation is whitelisted. returns install returns true if the function succeeded and false if it did not, but these values are not always reliable as a determinant of the success of the operation. to surface detail about the status of the installation, use the optional callback function and its status parameter, as in the example below. description in the example below, a special javascript object constructor is used to create an object that can be passed to the install() method. the { } constructor takes a comma...
...e as a determinant of the success of the operation. to surface detail about the status of the installation, use the optional callback function and its status parameter, as in the example below. description in the example below, a special javascript object constructor is used to create an object that can be passed to the install() method. the { } constructor takes a comma-delimited set of label/value pairs. for installations, these pairs are the xpinstall confirm dialog display name and the path of the xpi, respectively. in the example below, a single installation object is created, but you can use this approach to create multiple installations to pass to a single install. as with the older startsoftwareupdate method, xpis installed with this method must have their own install.js files in ...
IntersectionObserver.rootMargin - Web APIs
en if a certain number of pixels worth of width or height is clipped away, or treat the target as partially hidden if an edge is too close to the edge of the root's bounding box. see the root element and root margin in intersection observer api for a more in-depth look at the root margin and how it works with the root's bounding box. syntax var marginstring = intersectionobserver.rootmargin; value a string, formatted similarly to the css margin property's value, which contains offsets for one or more sides of the root's bounding box. these offsets are added to the corresponding values in the root's bounding box before the intersection between the resulting rectangle and the target element's bounds. the string returned by this property may not match the one specified when the intersection...
...e, which contains offsets for one or more sides of the root's bounding box. these offsets are added to the corresponding values in the root's bounding box before the intersection between the resulting rectangle and the target element's bounds. the string returned by this property may not match the one specified when the intersectionobserver was instantiated. the browser is permitted to alter the values if rootmargin isn't specified when the object was instantiated, it defaults to the string "0px 0px 0px 0px", meaning that the intersection will be computed between the root element's unmodified bounds rectangle and the target's bounds. the root element and root margin in intersection observer api describes how the rootmargin is used in more detail. specifications specification st...
IntersectionObserver.thresholds - Web APIs
the intersectionobserver interface's read-only thresholds property returns the list of intersection thresholds that was specified when the observer was instantiated with intersectionobserver(). if only one threshold ratio was provided when instanitating the object, this will be an array containing that single value. see thresholds in intersection observer api to learn how thresholds work. syntax var thresholds = intersectionobserver.thresholds; value an array of intersection thresholds, originally specified using the threshold property when instantiating the observer. if only one observer was specified, without being in an array, this value is a one-entry array containing that threshold. regardless of the order your original threshold array was in, this one is always sorted in ...
... be careful! although the options object you can specify when creating an intersectionobserver has a field named threshold, this property is called thresholds. confusing? yes. ...
Keyboard - Web APIs
Web › API › Keyboard
properties none. methods keyboard.getlayoutmap() returns a promise that resolves with an instance of keyboardlayoutmap which is a map-like object with functions for retrieving the strings associated with specific physical keys. ...
... properties none. methods keyboard.getlayoutmap() returns a promise that resolves with an instance of keyboardlayoutmap which is a map-like object with functions for retrieving the strings associated with specific physical keys. ...
KeyboardEvent.charCode - Web APIs
the charcode read-only property of the keyboardevent interface returns the unicode value of a character key pressed during a keypress event. do not use this property, as it is deprecated. use the key property instead. syntax var code = event.charcode; return value a number that represents the unicode value of the character key that was pressed. example html <p>type anything into the input box below to log a <code>charcode</code>.</p> <input type="text" /> <p id="log"></p> javascript let input = document.queryselector('input'); let log = document.queryselector('#log'); input.addeventlistener('keypress', function(e) { log.innertext = `key pressed: ${string.fromcharcode(e.charcode)}\ncharcode: ${e.charcode}`; }); result notes in a keypress event, the unicode valu...
...charcode, query the which property. characters entered through an ime do not register through keycode or charcode. actually with the chinese ime i'm using, entering the ime results in a keypress event with keycode = 229 and no other key events fire until the ime exits (which may happen after multiple characters are inputted). i'm not sure if other ime's work this way. for a list of the charcode values associated with particular keys, run example 7: displaying event object properties and view the resulting html table. specifications specification status comment document object model (dom) level 3 events specificationthe definition of 'keyboardevent.charcode' in that specification. obsolete initial definition; specified as deprecated ...
KeyboardEvent.initKeyboardEvent() - Web APIs
blearg, viewarg, chararg, keyarg, locationarg, modifierslistarg, repeat) parameters typearg the type of keyboard event; this will be one of keydown, keypress, or keyup. canbubblearg whether or not the event can bubble. cancelablearg whether or not the event can be canceled. viewarg the windowproxy it is associated to. chararg the value of the char attribute. keyarg the value of the key attribute. locationarg the value of the location attribute. modifierslistarg a whitespace-delineated list of modifier keys that should be considered to be active on the event's key. for example, specifying "control shift" indicates that the user was holding down the control and shift keys when pressing the key described by the event. repea...
...ar attribute. keyarg the value of the key attribute. locationarg the value of the location attribute. modifierslistarg a whitespace-delineated list of modifier keys that should be considered to be active on the event's key. for example, specifying "control shift" indicates that the user was holding down the control and shift keys when pressing the key described by the event. repeatarg the value of the repeat attribute. ...
KeyboardEvent.keyCode - Web APIs
you should avoid using this if possible; it's been deprecated for some time. instead, you should use keyboardevent.code, if it's implemented. unfortunately, some browsers still don't have it, so you'll have to be careful to make sure you use one which is supported on all target browsers. ...
... you should avoid using this if possible; it's been deprecated for some time. instead, you should use keyboardevent.code, if it's implemented. unfortunately, some browsers still don't have it, so you'll have to be careful to make sure you use one which is supported on all target browsers. ...
KeyboardLayoutMap - Web APIs
the keyboardlayoutmap interface of the the keyboard api is a map-like object with functions for retrieving the string associated with specific physical keys. a list of valid keys is found in the ui events keyboardevent code values specification. properties keyboardlayoutmap.entries read only 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). ...
..., in the same order as that provided by a for...in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well). keyboardlayoutmap.keys read only returns a new array iterator object that contains the keys for each index in the array. keyboardlayoutmap.size read only returns the number of elements in the keyboardlayoutmap object. keyboardlayoutmap.values read only returns a new array iterator object that contains the values for each index in the keyboardlayoutmap object. methods keyboardlayoutmap.foreach() read only executes a provided function once for each element of keyboardlayoutmap. keyboardlayoutmap.get() returns the element with the given key from the keyboardlayoutmap object. keyboardlayoutmap.has() returns a boolean...
LargestContentfulPaint - Web APIs
id the id of the element. this property returns an empty string when there is no id. largestcontentfulpaint.url if the element is an image, the request url of the image. methods largestcontentfulpaint.tojson() returns the above properties as json. examples the following example shows how to create a performanceobserver that listens for largest-contentful-paint entries and logs the lcp value to the console. this example also demonstrates how to include buffered entries (those that ocurred before observer() was called), which is done by setting 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=20921...
... 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 server. addeventlistener('visibilitychange',...
LayoutShift - Web APIs
layoutshift.hadrecentinput returns true if there was a user input in the past 500 milliseconds. layoutshift.lastinputtime returns the time of the most recent user input. ...
...catch errors since some browsers throw when using the new `type` option. // https://bugs.webkit.org/show_bug.cgi?id=209216 try { let cumulativelayoutshiftscore = 0; const observer = new performanceobserver((list) => { for (const entry of list.getentries()) { // only count layout shifts without recent user input. if (!entry.hadrecentinput) { cumulativelayoutshiftscore += entry.value; } } }); observer.observe({type: 'layout-shift', buffered: true}); document.addeventlistener('visibilitychange', () => { if (document.visibilitystate === 'hidden') { // force any pending records to be dispatched. observer.takerecords(); observer.disconnect(); console.log('cls:', cumulativelayoutshiftscore); } }); } catch (e) { // do nothing if the browser do...
LocalFileSystem - Web APIs
persistent 1 storage that stays in the browser unless the user or the app expunges it. the user must grant permission before the app can use this type of storage. methods requestfilesystem() requests a file system where data should be stored. yo...
...requests a file system where data should be stored. you access a sandboxed file system by requesting a localfilesystem object using this global method, window.requestfilesystem(). void requestfilesystem( in unsigned short type, in unsigned long long size, in filesystemcallback successcallback, in errorcallback errorcallback ); parameters type the storage type of the file system. the values can be either temporary or persistent. size the storage space—in bytes—that you need for your app. successcallback the success callback that is called when the browser provides a file system. its argument is the filesystem object with two properties: name - the unique name assigned by the browser to the file system. root - the read-only directoryentry object representing the root o...
LocalFileSystemSync - Web APIs
requestfilesystemsync(temporary, 1024*1024 /*1mb*/); because you are using a synchronous api, you don't need success and error callbacks. method overview filesystemsync requestfilesystemsync (in unsigned short type, in long long size) raises fileexception; entrysync resolvelocalfilesystemsyncurl (in domstring url) raises fileexception; constants constant value description temporary 0 transient storage that can be be removed by the browser at its discretion. persistent 1 storage that stays in the browser unless the user or the app expunges it. methods requestfilesystemsync() requests a file system where data should be stored. you access a sandboxed file system by requesting a localfilesystemsync obj...
...esystemsync() requests a file system where data should be stored. you access a sandboxed file system by requesting a localfilesystemsync object from within a web worker using this global method, window.requestfilesystemsync(). [ research ] filesystemsync requestfilesystemsync( in unsigned short type, in unsigned long long size ); parameters type the storage type of the file system. the values can be either temporary or persistent. size the storage space—in bytes—that you need for your app. returns filesystemsync an object that represents the file system. exceptions this method can raise an fileexception with the following code: exception description security_error the application does not have permission to access the file system interface. for...
LockManager.request() - Web APIs
lock). this is known as the readers-writer pattern. in the indexeddb api, this is exposed as "readonly" and "readwrite" transactions which have the same semantics. syntax lockmanager.request(var promise = name[, {options}], callback) parameters name an identifier for the lock you want to request. options optional an object describing characteristics of the lock you want to create. valid values are: mode optional: either "exclusive" or "shared". the default value is "exclusive". ifavailable optional: if true, the lock request will only be granted if it is not already held. if it cannot be granted, the callback will be invoked with null instead of a lock instance. the default value is false. steal optional: if true, then any held locks with the same name will be released, and th...
... "exclusive". ifavailable optional: if true, the lock request will only be granted if it is not already held. if it cannot be granted, the callback will be invoked with null instead of a lock instance. the default value is false. steal optional: if true, then any held locks with the same name will be released, and the request will be granted, preempting any queued requests for it. the default value is false. signal optional: an abortsignal (the signal property of an abortcontroller); if specified and the abortcontroller is aborted, the lock request is dropped if it was not already granted. callback … return value a promise that resolves with undefined when the request is granted. examples general example the following example shows the basic use of the request() method with ...
MSGestureEvent - Web APIs
erits properties of its parents, uievent and event. msgestureevent.expansion read only the diameter of the gesture area. for example, the distance between fingers. msgestureevent.gestureobject read only returns the msgesture object for this gesture event. msgestureevent.rotation read only amount of rotation (in radians) since the previous msgestureevent of the current gesture. positive values indicate clockwise rotation; negative values indicate anticlockwise rotation. msgestureevent.scale read only the difference in scale (for zoom gestures) from the previous msgestureevent of the current gesture. msgestureevent.translationx read only distance traversed along the x-axis since the previous msgestureevent of the current gesture msgestureevent.translationy read only distance t...
... msgestureevent.velocityexpansion read only the velocity of the expansion of the gesture area. msgestureevent.velocityx read only velocity along the direction of the x-axis. msgestureevent.velocityy read only velocity along the direction of the y-axis. methods this interface also inherits methods of its parents, uievent and event. msgestureevent.initgestureevent() initializes the value of an msgestureevent. if the event has already being dispatched, this method does nothing. this method is deprecated as of microsoft edge. gesture event types msgesturestart msgestureend msgesturetap msgesturehold msgesturechange msinertiastart specifications not part of any specification. microsoft has a description on msdn. browser compatibility the compatibility table on this pa...
MediaCapabilities.decodingInfo() - Web APIs
hether decoding the media described would be supported, smooth, and powerefficient. syntax mediacapabilities.decodinginfo(mediadecodingconfiguration) parameters mediadecodingconfiguration a valid mediadecodingconfiguration dictionary containing a valid media decoding type of file or media-source and a valid media configuration: either an audioconfiguration or a videoconfiguration. ...
...eturn value a promise fulfilling with a mediacapabilitiesinfo interface containing three boolean attributes: supported smooth powerefficient exceptions a typeerror is raised if the mediaconfiguration passed to the decodinginfo() method is invalid, either because the type is not video or audio, the contenttype is not a valid codec mime type, the media decoding configuration is not a valid value for the media decoding type, or any other error in the media configuration passed to the method, including omitting values required in the media decoding configuration. example //create media configuration to be tested const mediaconfig = { type : 'file', // or 'media-source' audio : { contenttype : "audio/ogg", // valid content type channels : 2, // audi...
MediaDeviceInfo.groupId - Web APIs
the groupid readonly property of the mediadeviceinfo interface returns a domstring that is a group identifier. two devices have the same group identifier if they belong to the same physical device; for example, a monitor with both a built-in camera and microphone. syntax var groupid = mediadeviceinfo.groupid; value a domstring which uniquely identifies the group of related devices to which this device belongs. specifications specification status comment media capture and streamsthe definition of 'groupid' in that specification. candidate recommendation initial definition. examples in this example, we assemble a list of the devices which are part of the same group as a given device. this might be used to produce a user interface that gathers associate...
... if its groupid matches the main device's groupid, we push the mediadeviceinfo object onto the list. finally, the list, which now contains a mediadeviceinfo object for each device in the same group, is returned to the caller. this could be altered easily to either leave out the passed-in device from the returned list, or to place it at the top of the list, by comparing the two objects' deviceid values, only pushing the device onto the result list if it doesn't match. this version of the example puts the passed-in device at the top of the result list, then adds any other members of the group that are found: const getdevicegroup = maindevinfo => { let devlist = [maindevinfo]; navigator.mediadevices.enumeratedevices() .then(devices => { devices.foreach(device => { if ((device.
MediaDevices.ondevicechange - Web APIs
rty is an eventhandler which specifies a function to be called when the devicechange event occurs on a mediadevices instance. this happens whenever the set of media devices available to the user agent and, by extension, to the web site or app has changed. you can at any time use enumeratedevices() to get the updated list of available devices. syntax mediadevices.ondevicechange = eventhandler; value a function you provide which accepts as input a event object describing the devicechange event that occurred. there is no information about the change included in the event object; to get the updated list of devices, you'll have to use enumeratedevices(). example in this example, we create a function called updatedevicelist(), which is called once when mediadevices.getusermedia() successfully ...
...eviceinfo objects, each describing one media input or output device. a foreach() loop is used to scan through all the devices. for each device, we create a new <li> object to be used to display it to the user. the line let [kind, type, direction] = device.kind.match(/(\w+)(input|output)/i); deserves special notice. this uses destructuring assignment (a new feature of ecmascript 6) to assign the values of the first three items in the array returned by string.match() to the variables kind, type, and direction. we do this because the value of mediadeviceinfo.kind is a single string that includes both the media type and the direction the media flows, such as "audioinput" or "videooutput". this line, then, pulls out the type ("audio" or "video") and direction ("input" or "output") so they can be u...
MediaError - Web APIs
iaelement, such as <audio> or <video>. a mediaerror object describes the error in general terms using a numeric code categorizing the kind of error, and a message, which provides specific diagnostics about what went wrong. properties this interface doesn't inherit any properties. mediaerror.code a number which represents the general type of error that occurred, as follows: name value description media_err_aborted 1 the fetching of the associated resource was aborted by the user's request. media_err_network 2 some kind of network error occurred which prevented the media from being successfully fetched, despite having previously been available. media_err_decode 3 despite having previously been determined to be usable, an error...
...to help the reader understand the error condition which occurred; specifically, it isn't simply a summary of what the error code means, but actual diagnostic information to help in understanding what exactly went wrong. this text and its format is not defined by the specification and will vary from one user agent to another. if no diagnostics are available, or no explanation can be provided, this value is an empty string (""). methods this interface doesn't implement or inherit any methods, and has none of its own. specifications specification status comment html living standardthe definition of 'mediaerror' in that specification. living standard ...
MediaKeySession - Web APIs
ns a promise signaling when a mediakeysession closes. this promise can only be fulfilled and is never rejected. closing a session means that licenses and keys associated with it are no longer valid for decrypting media data. mediakeysession.expiration read only the time after which the keys in the current session can no longer be used to decrypt media data, or nan if no such time exists. this value is determined by the cdm and measured in milliseconds since january 1, 1970, utc. this value may change during a session lifetime, such as when an action triggers the start of a window. mediakeysession.keystatuses read only contains a reference to a read-only mediakeystatusmap of the current session's keys and their statuses. mediakeysession.sessionid read only contains a unique string gene...
...n. methods mediakeysession.close() returns a promise after notifying the current media session is no longer needed and that the cdm should release any resources associated with this object and close it. mediakeysession.generaterequest() returns a promise after generating a media request based on initialization data. mediakeysession.load() returns a promise that resolves to a boolean value after loading data for a specified session object. mediakeysession.remove() returns a promise after removing any session data associated with the current object. mediakeysession.update() returns a promise after loading messages and licenses to the cdm. examples // tbd specifications specification status comment encrypted media extensionsthe definition of 'mediake...
MediaRecorder.mimeType - Web APIs
file may not work reliably if at all when you try to play it back. see our media type and format guide for information about container and codec support across browsers. note: the term "mime type" is officially considered to be historical; these strings are now officially known as media types. mdn web docs content uses the terms interchangeably. syntax var mimetype = mediarecorder.mimetype value the mime media type which describes the format of the recorded media, as a domstring. this string may include the codecs parameter, giving details about the codecs and the codec configurations used by the media recorder. the media type strings are standardized by the internet assigned numbers authority (iana). for their official list of defined media type strings, see the article media types on...
... console.log(error.message); }); changing line 14 to the following causes mediarecorder to try to use avc constrained baseline profile level 4 for video and aac-lc (low complexity) for audio, which is good for mobile and other possible resource-constrained situations. mimetype: 'video/mp4; codecs="avc1.424028, mp4a.40.2"' assuming this configuration is acceptable to the user agent, the value returned later by m.mimetype would then be video/mp4; codecs="avc1.424028, mp4a.40.2". specifications specification status comment mediastream recordingthe definition of 'mediarecorder.mimetype' in that specification. working draft initial definition ...
MediaRecorder.state - Web APIs
recording recording has been started and the ua is capturing data. paused recording has been started, then paused, but not yet stopped or resumed. example ... ...
... recording recording has been started and the ua is capturing data. paused recording has been started, then paused, but not yet stopped or resumed. example ... ...
MediaRecorder - Web APIs
. mediarecorder.requestdata() requests a blob containing the saved data received thus far (or since the last time requestdata() was called. after calling this method, recording continues, but in a new blob. mediarecorder.resume() resumes recording of media after having been paused. mediarecorder.start() begins recording media; this method can optionally be passed a timeslice argument with a value in milliseconds. if this is specified, the media will be captured in separate chunks of that duration, rather than the default behavior of recording the media in a single large chunk. mediarecorder.stop() stops recording, at which point a dataavailable event containing the final blob of saved data is fired. no more recording occurs. static methods mediarecorder.istypesupported() a static ...
...ecified, the media will be captured in separate chunks of that duration, rather than the default behavior of recording the media in a single large chunk. mediarecorder.stop() stops recording, at which point a dataavailable event containing the final blob of saved data is fired. no more recording occurs. static methods mediarecorder.istypesupported() a static method which returns a boolean value indicating if the given mime media type is supported by the current user agent. event handlers mediarecorder.ondataavailable called to handle the dataavailable event, which is periodically triggered each time timeslice milliseconds of media have been recorded (or when the entire media has been recorded, if timeslice wasn't specified). the event, of type blobevent, contains the recorded med...
MediaSession.playbackState - Web APIs
paused the browser's media session is currently paused. playback may be resumed. ...
... paused the browser's media session is currently paused. playback may be resumed. ...
MediaSessionActionDetails.fastSeek - Web APIs
the boolean property fastseek in the mediasessionactiondetails dictionary is an optional value which, when specified and true, indicates that the requested seekto operation is part of an ongoing series of seekto operations. your handler should take steps to return as quickly as possible by skipping any steps of its operation which are only necessary when the seek operation is complete. once fastseek is false or not present, the repeating series of seekto actions is complete and you can finalize the state of your web app or content. ...
...ickly as possible by skipping any steps of its operation which are only necessary when the seek operation is complete. once fastseek is false or not present, the repeating series of seekto actions is complete and you can finalize the state of your web app or content. syntax let mediasessionactiondetails = { fastseek: shouldfastseek }; let shouldfastseek = mediasessionactiondetails.fastseek; value a boolean which is true if the action is part of an ongoing series of seek actions which should be treated as part of an overall seek operation. if the value is false or this property isn't present, the seek is final. specifications specification status comment media session standardthe definition of 'mediasessionactiondetails.fastseek' in that specification. draft ...
MediaSessionActionDetails.seekTime - Web APIs
the mediasessionactiondetails dictionary's seektime property is always included when a seekto action is sent to the action handler callback. its value is the absolute time, in seconds, to move the current play position to. to change the time by an offset rather than moving to an absolute time, the seekforward or seekbackward actions should be used instead. syntax let mediasessionactiondetails = { seektime: abstimeinseconds }; let abstime = mediasessionactiondetails.seektime; value a floating-point value indicating the absolute time in seconds into the media to which to move the current play position. ...
...details = { seektime: abstimeinseconds }; let abstime = mediasessionactiondetails.seektime; value a floating-point value indicating the absolute time in seconds into the media to which to move the current play position. usage notes to perform a "fast" seek (such as when issuing multiple seekto actions in sequence while handling a scrubbing operation, the details object's fastseek property's value is set to true, indicating that you should minimize or eliminate anything you do while handling the action that is only necessary at the final step. if the value of fastseek is false, or fastseek is missing, the action should be treated as the final action of the operation, and you should finalize any details that need to be handled. specifications specification status comment ...
MediaSettingsRange - Web APIs
the mediasettingsrange interface of the the mediastream image capture api provides the possible range and value size of photocapabilities.imageheight and photocapabilities.imagewidth. a photocapabilities object can be retrieved by calling imagecapture.photocapabilities(). properties mediasettingsrange.max returns the maximum value of this settings. mediasettingsrange.min returns the minimum value of this setting. mediasettingsrange.step returns the minimum difference between consecutive values of this setting. example the following example, extracted from chrome's image capture / photo resolution sample, uses the results from getphotocapabilities().imagewidth to modify the size of an input range. const input = document.queryselector('input[type="range"]'); var imagecaptur...
... working draft initial definition. ...
MediaSource.endOfStream() - Web APIs
this can be used create a custom error handler related to media streams. ...
...the ui, and maybe retry the network request immediately or wait until the network is back up (via some kind of polling.) decode: terminates playback and signals that a decoding error has occured. this can be used to indicate that a parsing error has occured while fetching media data; maybe the data is corrupt, or is encoded using a codec that the browser doesn't know how to decode. return value undefined exceptions exception explanation invalidstateerror mediasource.readystate is not equal to open, or one or more of the sourcebuffer objects in mediasource.sourcebuffers are being updated (i.e. their sourcebuffer.updating property is true.) example the following snippet is from a simple example written by nick desaulniers (view the full demo live, or...
MediaSource.isTypeSupported() - Web APIs
the mediasource.istypesupported() static method returns a boolean value which is true if the given mime type is likely to be supported by the current user agent. that is, if it can successfully create sourcebuffer objects for that mime type. if the returned value is false, then the user agent is certain that it cannot access media of the specified format. syntax var isitsupported = mediasource.istypesupported(mimetype); parameters mimetype the mime media type that you want to test support for in the current browser. this may include the codecs parameter to provide added details about the codecs used within the file. return value a boolean which is true if the browser feels that it can probably play media of the specified type. this is not a guarantee, however, and your code must be p...
... all web apis that work with media files use a "no/maybe/probably" approach (or, in this case, "no or probably") when determining if a media type can be used. ...
MediaSource.setLiveSeekableRange() - Web APIs
at the user can seek to in the media element. syntax mediasource.setliveseekablerange(start, end) parameters start the start of the seekable range to set in seconds measured from the beginning of the source. if the duration of the media source is positive infinity, then the timeranges object returned by the htmlmediaelement.seekable property will have a start timestamp no greater than this value. ...
...eranges object returned by the htmlmediaelement.seekable property will have a start timestamp no greater than this value. end the end of the seekable range to set in seconds measured from the beginning of the source. if the duration of the media source is positive infinity, then the timeranges object returned by the htmlmediaelement.seekable property will have an end timestamp no less than this value. return value undefined example // tbd specifications specification status comment media source extensionsthe definition of 'setliveseekablerange()' in that specification. recommendation initial definition. ...
MediaStreamConstraints.video - Web APIs
the mediastreamconstraints dictionary's video property is used to indicate what kind of video track, if any, should be included in the mediastream returned by a call to getusermedia(). to learn more about how constraints work, see capabilities, constraints, and settings. syntax var videoconstraints = true | false | mediatrackconstraints; value the value of the video property can be specified as either of two types: boolean if a boolean value is specified, it simply indicates whether or not a video track should be included in the returned stream; if it's true, a video track is included; if no video source is available or if permission is not given to use the video source, the call to getusermedia() will fail. if false, no video track is included. mediatrackconstraints a constrain...
...is specified, it simply indicates whether or not a video track should be included in the returned stream; if it's true, a video track is included; if no video source is available or if permission is not given to use the video source, the call to getusermedia() will fail. if false, no video track is included. mediatrackconstraints a constraints dictionary detailing the preferable and/or required values or ranges of values for the track's constrainable properties. if you specify constraints, a video track meeting these constraints is required. examples using a boolean value in this example, we provide a simple value of true for the video property. this tells getusermedia() that we require a video track, but we don't care about any specifics beyond that. html content <p>click the start bu...
MediaStreamTrack.muted - Web APIs
when possible, avoid polling muted to monitor the track's muting status. instead, add event listeners for the mute and unmute events. ...
... when possible, avoid polling muted to monitor the track's muting status. instead, add event listeners for the mute and unmute events. example this example counts the number of tracks in an array of mediastreamtrack objects which are currently muted. ...
MediaStream Recording API - Web APIs
ble to an event handler for the dataavailable event; this will be called whenever data is available for you. once the source media is playing and you've reached the point where you're ready to record video, call mediarecorder.start() to begin recording. your dataavailable event handler gets called every time there's data ready for you to do with as you will; the event has a data attribute whose value is a blob that contains the media data. you can force a dataavailable event to occur, thereby delivering the latest sound to you so you can filter it, save it, or whatever. recording stops automatically when the source media stops playing. you can stop recording at any time by calling mediarecorder.stop(). note: individual blobs containing slices of the recorded media will not necessarily be...
...te <option> elements that are then added to a <select> element representing an input source picker. navigator.mediadevices.enumeratedevices() .then(function(devices) { devices.foreach(function(device) { let menu = document.getelementbyid("inputdevices"); if (device.kind == "audioinput") { let item = document.createelement("option"); item.innerhtml = device.label; item.value = device.deviceid; menu.appendchild(item); } }); }); code similar to this can be used to let the user restrict the set of devices they wish to use. for more information to learn more about using the mediastream recording api, see using the mediastream recording api, which shows how to use the api to record audio clips. a second article, recording a media element, describes how to r...
MediaTrackConstraints.width - Web APIs
the mediatrackconstraints dictionary's width property is a constrainlong describing the requested or mandatory constraints placed upon the value of the width constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.width as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { width: constraint }; constraintsobject.width = constraint; value if this value is a number, the user agent will attempt to obtain media whose width is as close as possible to this number given the capabilities of the hardware and the other constraints specified. other...
...cessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { width: constraint }; constraintsobject.width = constraint; value if this value is a number, the user agent will attempt to obtain media whose width is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constrainlong will guide the user agent in its efforts to provide an exact match to the required width (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment m...
MediaTrackSettings.aspectRatio - Web APIs
the mediatracksettings dictionary's aspectratio property is a double-precision floating-point number indicating the aspect ratio of the mediastreamtrack as currently configured. this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.aspectratio property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.aspectratio as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var aspectratio = mediatracks...
...the aspect ratio is computed by taking the track's width, dividing by its height, and rounding the result to ten decimal places. ...
MediaTrackSettings.displaySurface - Web APIs
the windows are aggragated into a single video track, with any empty space filled with a backdrop; that backdrop is selected by the user agent. ...
...the windows are aggragated into a single video track, with any empty space filled with a backdrop; that backdrop is selected by the user agent. ...
MediaTrackSettings.facingMode - Web APIs
the mediatracksettings dictionary's facingmode property is a domstring indicating the direction in which the camera producing the video track represented by the mediastreamtrack is currently facing. this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.facingmode property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.facingmode as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn'...
...upportedconstraints.facingmode as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. syntax var facingmode = mediatracksettings.facingmode; value a domstring whose value is one of the strings in videofacingmodeenum. videofacingmodeenum the following strings are permitted values for the facing mode. these may represent separate cameras, or they may represent directions in which an adjustable camera can be pointed. "user" the video source is facing toward the user; this includes, for example, the front-facing camera on a smartphone. ...
MediaTrackSettings.frameRate - Web APIs
the mediatracksettings dictionary's framerate property is a double-precision floating-point number indicating the frame rate, in frames per second, of the mediastreamtrack as currently configured. this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.framerate property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.framerate as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var framerate ...
... example see example: constraint exerciser in capabilities, constraints, and settings for an example. ...
MediaTrackSettings.latency - Web APIs
the mediatracksettings dictionary's latency property is a double-precision floating-point number indicating the estimated latency (specified in seconds) of the mediastreamtrack as currently configured. this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.latency property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). this is, of course, an approximation, since latency can vary for many reasons including cpu, transmission, and storage overhead. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.latency as returned by a call to mediadevices.getsupportedconstraints(). howeve...
...diatracksupportedconstraints.latency as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. syntax var latency = mediatracksettings.latency; value a double-precision floating-point number indicating the estimated latency, in seconds, of the audio track as currently configured. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media capture and streamsthe definition of 'latency' in that specification. candidate r...
MediaTrackSettings.logicalSurface - Web APIs
roperty indicates whether or not the display area being captured is a logical surface. logical surfaces are those which are not necessarily entirely onscreen, or may even be off-screen, such as windows' backing buffers (where only part of the buffer is visible without scrolling the containing window) and offscreen rendering contexts. syntax islogicalsurface = mediatracksettings.logicalsurface; value a boolean value which is true if the video track in the stream of captured video is taken from a logical display surface. the most common scenario in which a display surface may be a logical one is if the selected surface contains the entire content area of a window which is too large to display onscreen at once. since the window that contains the surface has to be scrolled to show the rest of ...
...ns the surface has to be scrolled to show the rest of the contents, the surface is a logical one. a visible display surface (that is, a surface for which logicalsurface returns false) is the portion of a logical display surface which is currently visible onscreen. for example, a user agent may choose to allow the user to choose whether to share the entire document (a browser with logicalsurface value of true), or just the currently visible portion of the document (where the logicalsurface of the browser surface is false). specifications specification status comment screen capturethe definition of 'mediatracksettings.logicalsurface' in that specification. working draft initial definition ...
MediaTrackSettings.volume - Web APIs
the mediatracksettings dictionary's volume property is a double-precision floating-point number indicating the volume of the mediastreamtrack as currently configured, as a value from 0.0 (silence) to 1.0 (maximum supported volume for the device). this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.volume property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.volume as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints th...
...astreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.volume as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var volume = mediatracksettings.volume; value a double-precision floating-point number indicating the volume, from 0.0 to 1.0, of the audio track as currently configured. example see example: constraint exerciser in capabilities, constraints, and settings for an example. ...
MediaTrackSupportedConstraints.aspectRatio - Web APIs
the mediatracksupportedconstraints dictionary's aspectratio property is a read-only boolean value which is present (and set to true) in the object returned by mediadevices.getsupportedconstraints() if and only if the user agent supports the aspectratio constraint. if the constraint isn't supported, it's not included in the list, so this value will never be false. you can access the supported constraints dictionary by calling navigator.mediadevices.getsupportedconstraints(). syntax aspectconstraintsupported = supportedconstraintsdictionary.aspectratio; value this property is present in the dictionary (and its value is always true) if the user agent supports the aspectratio constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you...
...ices.getsupportedconstraints(). syntax aspectconstraintsupported = supportedconstraintsdictionary.aspectratio; value this property is present in the dictionary (and its value is always true) if the user agent supports the aspectratio constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. example html content <div id="result"> </div> css content #result { font: 14px "arial", sans-serif; } javascript content let result = document.getelementbyid("result"); if (navigator.mediadevices.getsupportedconstraints().aspectratio) { result.innerhtml = "supported!"; } else { result.innerhtml = "not supported!"; } result specifications specification status ...
MediaTrackSupportedConstraints.channelCount - Web APIs
the mediatracksupportedconstraints dictionary's channelcount property is a read-only boolean value which is present (and set to true) in the object returned by mediadevices.getsupportedconstraints() if and only if the user agent supports the channelcount constraint. if the constraint isn't supported, it's not included in the list, so this value will never be false. you can access the supported constraints dictionary by calling navigator.mediadevices.getsupportedconstraints(). syntax channelcountconstraintsupported = supportedconstraintsdictionary.channelcount; value this property is present in the dictionary (and its value is always true) if the user agent supports the channelcount constraint. if the property isn't present, this property is missing from the supported constraints dictionar...
...supportedconstraints(). syntax channelcountconstraintsupported = supportedconstraintsdictionary.channelcount; value this property is present in the dictionary (and its value is always true) if the user agent supports the channelcount constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. example html content <div id="result"> </div> css content #result { font: 14px "arial", sans-serif; } javascript content let result = document.getelementbyid("result"); if (navigator.mediadevices.getsupportedconstraints().channelcount) { result.innerhtml = "supported!"; } else { result.innerhtml = "not supported!"; } result specifications specification status ...
MediaTrackSupportedConstraints.deviceId - Web APIs
the mediatracksupportedconstraints dictionary's deviceid property is a read-only boolean value which is present (and set to true) in the object returned by mediadevices.getsupportedconstraints() if and only if the user agent supports the deviceid constraint. if the constraint isn't supported, it's not included in the list, so this value will never be false. you can access the supported constraints dictionary by calling navigator.mediadevices.getsupportedconstraints(). syntax deviceidconstraintsupported = supportedconstraintsdictionary.deviceid; value this property is present in the dictionary (and its value is always true) if the user agent supports the deviceid constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get un...
...adevices.getsupportedconstraints(). syntax deviceidconstraintsupported = supportedconstraintsdictionary.deviceid; value this property is present in the dictionary (and its value is always true) if the user agent supports the deviceid constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. example html content <div id="result"> </div> css content #result { font: 14px "arial", sans-serif; } javascript content let result = document.getelementbyid("result"); if (navigator.mediadevices.getsupportedconstraints().deviceid) { result.innerhtml = "supported!"; } else { result.innerhtml = "not supported!"; } result specifications specification status comm...
MediaTrackSupportedConstraints.echoCancellation - Web APIs
the mediatracksupportedconstraints dictionary's echocancellation property is a read-only boolean value which is present (and set to true) in the object returned by mediadevices.getsupportedconstraints() if and only if the user agent supports the echocancellation constraint. if the constraint isn't supported, it's not included in the list, so this value will never be false. you can access the supported constraints dictionary by calling navigator.mediadevices.getsupportedconstraints(). syntax echocancellationconstraintsupported = supportedconstraintsdictionary.echocancellation; value this property is present in the dictionary (and its value is always true) if the user agent supports the echocancellation constraint. if the property isn't present, this property is missing from the supported c...
...straints(). syntax echocancellationconstraintsupported = supportedconstraintsdictionary.echocancellation; value this property is present in the dictionary (and its value is always true) if the user agent supports the echocancellation constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. example html content <div id="result"> </div> css content #result { font: 14px "arial", sans-serif; } javascript content let result = document.getelementbyid("result"); if (navigator.mediadevices.getsupportedconstraints().echocancellation) { result.innerhtml = "supported!"; } else { result.innerhtml = "not supported!"; } result specifications specification status...
MediaTrackSupportedConstraints.facingMode - Web APIs
the mediatracksupportedconstraints dictionary's facingmode property is a read-only boolean value which is present (and set to true) in the object returned by mediadevices.getsupportedconstraints() if and only if the user agent supports the facingmode constraint. if the constraint isn't supported, it's not included in the list, so this value will never be false. you can access the supported constraints dictionary by calling navigator.mediadevices.getsupportedconstraints(). syntax facingmodeconstraintsupported = supportedconstraintsdictionary.facingmode; value this property is present in the dictionary (and its value is always true) if the user agent supports the facingmode constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you...
...es.getsupportedconstraints(). syntax facingmodeconstraintsupported = supportedconstraintsdictionary.facingmode; value this property is present in the dictionary (and its value is always true) if the user agent supports the facingmode constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. example html <div id="result"> </div> css #result { font: 14px "arial", sans-serif; } javascript let result = document.getelementbyid("result"); if (navigator.mediadevices.getsupportedconstraints().facingmode) { result.innerhtml = "supported!"; } else { result.innerhtml = "not supported!"; } result specifications specification status comment m...
MediaTrackSupportedConstraints.frameRate - Web APIs
the mediatracksupportedconstraints dictionary's framerate property is a read-only boolean value which is present (and set to true) in the object returned by mediadevices.getsupportedconstraints() if and only if the user agent supports the framerate constraint. if the constraint isn't supported, it's not included in the list, so this value will never be false. the framerate constraint can be used to establish acceptable upper and lower bounds on the video frame rate for a new video track, or to specify an exact frame rate that must be provided for the request to succeed. checking the value of this property lets you determine if the user agent allows constraining the video track configuration by frame rate. see the example to see how this can be used. syntax framerateconstraintsupported = sup...
...ds on the video frame rate for a new video track, or to specify an exact frame rate that must be provided for the request to succeed. checking the value of this property lets you determine if the user agent allows constraining the video track configuration by frame rate. see the example to see how this can be used. syntax framerateconstraintsupported = supportedconstraintsdictionary.framerate; value this property is present in the dictionary if the user agent supports the framerate constraint. if the property isn't present, the user agent doesn't allow specifying limits on the frame rate for video tracks. if this property is present, its value is always true. example this simple example looks to see if your browser supports constraining the frame rate when requesting video tracks. jav...
MediaTrackSupportedConstraints.groupId - Web APIs
the mediatracksupportedconstraints dictionary's groupid property is a read-only boolean value which is present (and set to true) in the object returned by mediadevices.getsupportedconstraints() if and only if the user agent supports the groupid constraint. if the constraint isn't supported, it's not included in the list, so this value will never be false. you can access the supported constraints dictionary by calling navigator.mediadevices.getsupportedconstraints(). syntax groupidconstraintsupported = supportedconstraintsdictionary.groupid; value this property is present in the dictionary (and its value is always true) if the user agent supports the groupid constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefin...
...ediadevices.getsupportedconstraints(). syntax groupidconstraintsupported = supportedconstraintsdictionary.groupid; value this property is present in the dictionary (and its value is always true) if the user agent supports the groupid constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. example html content <div id="result"> </div> css content #result { font: 14px "arial", sans-serif; } javascript content let result = document.getelementbyid("result"); if (navigator.mediadevices.getsupportedconstraints().groupid) { result.innerhtml = "supported!"; } else { result.innerhtml = "not supported!"; } result specifications specification status comme...
MediaTrackSupportedConstraints.height - Web APIs
the mediatracksupportedconstraints dictionary's height property is a read-only boolean value which is present (and set to true) in the object returned by mediadevices.getsupportedconstraints() if and only if the user agent supports the height constraint. if the constraint isn't supported, it's not included in the list, so this value will never be false. you can access the supported constraints dictionary by calling navigator.mediadevices.getsupportedconstraints(). syntax heightconstraintsupported = supportedconstraintsdictionary.height; value this property is present in the dictionary (and its value is always true) if the user agent supports the height constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if...
...r.mediadevices.getsupportedconstraints(). syntax heightconstraintsupported = supportedconstraintsdictionary.height; value this property is present in the dictionary (and its value is always true) if the user agent supports the height constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. example html content <div id="result"> </div> css content #result { font: 14px "arial", sans-serif; } javascript content let result = document.getelementbyid("result"); if (navigator.mediadevices.getsupportedconstraints().height) { result.innerhtml = "supported!"; } else { result.innerhtml = "not supported!"; } result specifications specification status commen...
MediaTrackSupportedConstraints.latency - Web APIs
the mediatracksupportedconstraints dictionary's latency property is a read-only boolean value which is present (and set to true) in the object returned by mediadevices.getsupportedconstraints() if and only if the user agent supports the latency constraint. if the constraint isn't supported, it's not included in the list, so this value will never be false. you can access the supported constraints dictionary by calling navigator.mediadevices.getsupportedconstraints(). syntax latencyconstraintsupported = supportedconstraintsdictionary.latency; value this property is present in the dictionary (and its value is always true) if the user agent supports the latency constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefin...
...ediadevices.getsupportedconstraints(). syntax latencyconstraintsupported = supportedconstraintsdictionary.latency; value this property is present in the dictionary (and its value is always true) if the user agent supports the latency constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. example html content <div id="result"> </div> css content #result { font: 14px "arial", sans-serif; } javascript content let result = document.getelementbyid("result"); if (navigator.mediadevices.getsupportedconstraints().latency) { result.innerhtml = "supported!"; } else { result.innerhtml = "not supported!"; } result specifications specification status comme...
MediaTrackSupportedConstraints.sampleRate - Web APIs
the mediatracksupportedconstraints dictionary's samplerate property is a read-only boolean value which is present (and set to true) in the object returned by mediadevices.getsupportedconstraints() if and only if the user agent supports the samplerate constraint. if the constraint isn't supported, it's not included in the list, so this value will never be false. you can access the supported constraints dictionary by calling navigator.mediadevices.getsupportedconstraints(). syntax samplerateconstraintsupported = supportedconstraintsdictionary.samplerate; value this property is present in the dictionary (and its value is always true) if the user agent supports the samplerate constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you...
...es.getsupportedconstraints(). syntax samplerateconstraintsupported = supportedconstraintsdictionary.samplerate; value this property is present in the dictionary (and its value is always true) if the user agent supports the samplerate constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. example html content <div id="result"> </div> css content #result { font: 14px "arial", sans-serif; } javascript content let result = document.getelementbyid("result"); if (navigator.mediadevices.getsupportedconstraints().samplerate) { result.innerhtml = "supported!"; } else { result.innerhtml = "not supported!"; } result specifications specification status co...
MediaTrackSupportedConstraints.sampleSize - Web APIs
the mediatracksupportedconstraints dictionary's samplesize property is a read-only boolean value which is present (and set to true) in the object returned by mediadevices.getsupportedconstraints() if and only if the user agent supports the samplesize constraint. if the constraint isn't supported, it's not included in the list, so this value will never be false. you can access the supported constraints dictionary by calling navigator.mediadevices.getsupportedconstraints(). syntax samplesizeconstraintsupported = supportedconstraintsdictionary.samplesize; value this property is present in the dictionary (and its value is always true) if the user agent supports the samplesize constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you...
...es.getsupportedconstraints(). syntax samplesizeconstraintsupported = supportedconstraintsdictionary.samplesize; value this property is present in the dictionary (and its value is always true) if the user agent supports the samplesize constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. example html content <div id="result"> </div> css content #result { font: 14px "arial", sans-serif; } javascript content let result = document.getelementbyid("result"); if (navigator.mediadevices.getsupportedconstraints().samplesize) { result.innerhtml = "supported!"; } else { result.innerhtml = "not supported!"; } result specifications specification status co...
MediaTrackSupportedConstraints.volume - Web APIs
the mediatracksupportedconstraints dictionary's volume property is a read-only boolean value which is present (and set to true) in the object returned by mediadevices.getsupportedconstraints() if and only if the user agent supports the volume constraint. if the constraint isn't supported, it's not included in the list, so this value will never be false. you can access the supported constraints dictionary by calling navigator.mediadevices.getsupportedconstraints(). syntax volumeconstraintsupported = supportedconstraintsdictionary.volume; value this property is present in the dictionary (and its value is always true) if the user agent supports the volume constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined ...
...r.mediadevices.getsupportedconstraints(). syntax volumeconstraintsupported = supportedconstraintsdictionary.volume; value this property is present in the dictionary (and its value is always true) if the user agent supports the volume constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. example html content <div id="result"> </div> css content #result { font: 14px "arial", sans-serif; } javascript content let result = document.getelementbyid("result"); if (navigator.mediadevices.getsupportedconstraints().volume) { result.innerhtml = "supported!"; } else { result.innerhtml = "not supported!"; } result ...
MediaTrackSupportedConstraints.width - Web APIs
the mediatracksupportedconstraints dictionary's width property is a read-only boolean value which is present (and set to true) in the object returned by mediadevices.getsupportedconstraints() if and only if the user agent supports the width constraint. if the constraint isn't supported, it's not included in the list, so this value will never be false. you can access the supported constraints dictionary by calling navigator.mediadevices.getsupportedconstraints(). syntax widthconstraintsupported = supportedconstraintsdictionary.width; value this property is present in the dictionary (and its value is always true) if the user agent supports the width constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you ...
...ator.mediadevices.getsupportedconstraints(). syntax widthconstraintsupported = supportedconstraintsdictionary.width; value this property is present in the dictionary (and its value is always true) if the user agent supports the width constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. example html content <div id="result"> </div> css content #result { font: 14px "arial", sans-serif; } javascript content let result = document.getelementbyid("result"); if (navigator.mediadevices.getsupportedconstraints().width) { result.innerhtml = "supported!"; } else { result.innerhtml = "not supported!"; } result specifications specification status comment...
Media Source API - Web APIs
offered have really only been useful for playing single whole tracks. we can't, for example, combine/split arraybuffers. streaming media has up until recently been the domain of flash, with technologies like flash media server serving video streams using the rtmp protocol. the mse standard with media source extensions (mse), this is changing. mse allows us to replace the usual single track src value fed to media elements with a reference to a mediasource object, which is a container for information like the ready state of the media for being played, and references to multiple sourcebuffer objects that represent the different chunks of media that make up the entire stream. mse gives us finer grained control over how much and how often content is fetched, and some control over memory usage det...
...ault provides a sourcebuffer with kind, label, and language information for tracks that do not contain this information in the initialization segments of a media chunk. trackdefaultlist a simple container list for multiple trackdefault objects. extensions to other interfaces url.createobjecturl() creates an object url pointing to a mediasource object that can then be specified as the src value of an html media element to play a media stream. htmlmediaelement.seekable when a mediasource object is played by an html media element, this property will return a timeranges object that contains the time ranges that the user is able to seek to. htmlvideoelement.getvideoplaybackquality() returns a videoplaybackquality object for the currently played video. audiotrack.sourcebuffer, videotrac...
MerchantValidationEvent.methodName - Web APIs
see merchant validation in payment processing concepts for more information on the process. ...
...see merchant validation in payment processing concepts for more information on the process. ...
MerchantValidationEvent.validationURL - Web APIs
once this has been loaded, it should be passed into complete(), either directly or using a promise. see merchant validation in payment processing concepts for more information on the merchant validation process. ...
...once this has been loaded, it should be passed into complete(), either directly or using a promise. see merchant validation in payment processing concepts for more information on the merchant validation process. ...
MouseEvent.offsetX - Web APIs
early versions of the spec defined this as an integer. ...
...early versions of the spec defined this as an integer. ...
MouseEvent.offsetY - Web APIs
early versions of the spec defined this as an integer. ...
...early versions of the spec defined this as an integer. ...
MouseEvent.screenX - Web APIs
early versions of the spec defined this as an integer referring to the number of pixels. see the "browser compatibility" section for details. example this example displays your mouse's coordinates whenever you trigger the mousemove event. ...
...early versions of the spec defined this as an integer referring to the number of pixels. see the "browser compatibility" section for details. example this example displays your mouse's coordinates whenever you trigger the mousemove event. ...
MouseEvent.screenY - Web APIs
early versions of the spec defined this as an integer referring to the number of pixels. see the "browser compatibility" section for details. example this example displays your mouse's coordinates whenever you trigger the mousemove event. ...
...early versions of the spec defined this as an integer referring to the number of pixels. see the "browser compatibility" section for details. example this example displays your mouse's coordinates whenever you trigger the mousemove event. ...
MouseEvent - Web APIs
nly the y coordinate of the mouse pointer in global (screen) coordinates. mouseevent.shiftkey read only returns true if the shift key was down when the mouse event was fired. mouseevent.which read only the button being pressed when the mouse event was fired. mouseevent.mozpressure read only the amount of pressure applied to a touch or tablet device when generating the event; this value ranges between 0.0 (minimum pressure) and 1.0 (maximum pressure). instead of using this deprecated (and non-standard) property, you should instead use pointerevent and look at its pressure property. mouseevent.mozinputsource read only the type of device that generated the event (one of the moz_source_* constants listed below). this lets you, for example, determine whether a mouse event was g...
...sary for a normal click mouseevent.webkit_force_at_force_mouse_down read only minimum force necessary for a force click methods this interface also inherits methods of its parents, uievent and event. mouseevent.getmodifierstate() returns the current state of the specified modifier key. see the keyboardevent.getmodifierstate() for details. mouseevent.initmouseevent() initializes the value of a mouseevent created. if the event has already being dispatched, this method does nothing. example this example demonstrates simulating a click (that is programmatically generating a click event) on a checkbox using dom methods. html <p><label><input type="checkbox" id="checkbox"> checked</label> <p><button id="button">click me</button> javascript function simulateclick() { var evt = ...
msPlayToSource - Web APIs
b: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. msplaytosource is a read-only property which gets the source associated with the media element for use by the playtomanager. this proprietary property is specific to internet explorer and microsoft edge. syntax ptr = object.msplaytosource; value playto is a means through which an app can connect local playback/display for audio, video, and img elements to a remote device. for more information, see the windows.media.playto apis. msplaytosource is used in the sourcerequested handler -- get the playtosource object from an audio, video, or img element using the msplaytosource property and pass it to e.setsource, then set the playtosource.n...
...o, and img elements to a remote device. for more information, see the windows.media.playto apis. msplaytosource is used in the sourcerequested handler -- get the playtosource object from an audio, video, or img element using the msplaytosource property and pass it to e.setsource, then set the playtosource.next property to the msplaytosource of another element for continual playing. the property value for msplaytosource is the source associated with the media element. example <video id="videoplayer" src="http://www.contoso.com/clip.mp4" controls autoplay /> <script type="text/javascript"> // step 1: obtain playtomanager object for app’s current view. var ptm = windows.media.playto.playtomanager.getforcurrentview(); // step 2: register for the sourcerequested event (user swipes de...
msSetMediaProtectionManager - Web APIs
...
... ...
MutationObserver.observe() - Web APIs
ll mutationobserver.disconnect(). syntax mutationobserver.observe(target, options) parameters target a dom node (which may be an element) within the dom tree to watch for changes, or to be the root of a subtree of nodes to be watched. options a mutationobserverinit object providing options that describe which dom mutations should be reported to mutationobserver’s callback. ...
...ibe which dom mutations should be reported to mutationobserver’s callback. return value undefined. exceptions typeerror thrown in any of the following circumstances: the options are configured such that nothing will actually be monitored. (for example, if mutationobserverinit.childlist, mutationobserverinit.attributes, and mutationobserverinit.characterdata are all false.) the value of options.attributes is false (indicating that attribute changes are not to be monitored), but attributeoldvalue is true and/or attributefilter is present. the characterdataoldvalue option is true but mutationobserverinit.characterdata is false (indicating that character changes are not to be monitored). usage notes reusing mutationobservers you can call observe() multiple times on the...
MutationObserverInit.subtree - Web APIs
the mutationobserverinit dictionary's optional subtree property can be set to true to monitor the targeted node and all of its descendants. the default value, false, indicates only the target node itself is to be monitored for changes. subtree can be used in concert with the other options to extend monitoring of attributes, text content, and child lists to the entire subtree rooted at the target node. syntax var options = { subtree: true | false } value a boolean value. the default, false, indicates that only the target node specified when calling mutationobserver.observe() is to be monitored for changes. changing this value to true causes the entire subtree rooted at the specified target node to be monitored for the changes indicated by the other options. for example, to watch the ta...
...erve() is to be monitored for changes. changing this value to true causes the entire subtree rooted at the specified target node to be monitored for the changes indicated by the other options. for example, to watch the target node only for attribute changes, the mutationobserverinit passed into mutationobserver() can be: var options = { attributes: true, subtree: false }; since the default value of subtree is false, line 3 is optional. to monitor the entire subtree for attribute changes, simply set subtree to true: var options = { attributes: true, subtree: true }; example specifications specification status comment domthe definition of 'mutationobserverinit.subtree' in that specification. living standard ...
NavigationPreloadManager - Web APIs
navigationpreloadmanager interface of the the service worker api provides methods for managing the preloading of resources with a service worker. methods navigationpreloadmanager.enable() enables navigation preloading and returns a promise that resolves. navigationpreloadmanager.disable() disables navigation preloading and returns a promise that resolves. navigationpreloadmanager.setheadervalue() sets the value of the service-worker-navigation-preload header and returns an empty promise. navigationpreloadmanager.getstate() returns a promise that resolves to an object with properties indicating whether preload is enabled and the contents of the service-worker-navigation-preload. examples feature detecting and enabling navigation preloading addeventlistener('activate', event => { ...
...firefox android no support nonotes no support nonotes notes implementation tracked in bug 1290958opera android full support 46safari ios ? samsung internet android full support 8.0setheadervalue experimentalchrome full support 62edge full support 18firefox no support nonotes no support nonotes notes implementation tracked in bug 1290958ie ? opera full support ...
Using Navigation Timing - Web APIs
he current time the time at which the navigation whose timing was recorded began (performance.timing.navigationstart), and outputs that information to the screen by inserting it into an element. html <div class="output"> </div> css .output { border: 1px solid #bbb; font: 16px "open sans", "helvetica", "arial", sans-serif; } in tandem with appropriate html and css, the result is: the values listed are for the <iframe> in which the sample is presented above. for a list of the available timing values you can look for in performancetiming, see the performancetiming interface's properties section. determining navigation type to put the timing information obtained from performancetiming into the correct perspective, you need to know more about what sort of load operation occurred. in...
...the navigation from performance.navigation.redirectcount. this information is output to the screen just like the page load time was previously: by inserting it into the element with class "output". html <div class="output"> </div> css .output { border: 1px solid #bbb; font: 16px "open sans", "helvetica", "arial", sans-serif; } with this code in place, the result looks like this: the values listed are for the <iframe> in which the sample is presented. ...
Navigator.oscpu - Web APIs
Web › API › Navigator › oscpu
the navigator.oscpu property returns a string that identifies the current operating system. syntax oscpuinfo = navigator.oscpu value a domstring providing a string which identifies the operating system on which the browser is running. operating system oscpuinfo string format os/2 os/2 warp x (either 3, 4 or 4.5) windows ce windowsce x.y1 windows 64-bit (64-bit build) windows nt x.y; win64; x64 windows 64-bit (32-bit build) windows nt x.y; wow64 windows 32-bit windows nt x.y mac os x (ppc build) powerpc mac os x version x.y mac os x (i386/x64 build) intel mac os x or macos version x.y linux 64-bit (32-bit build) output of uname -s plus "i686 on x86_64" linux output of un...
... specifications specification status comment html living standardthe definition of 'navigatorid: oscpu' in that specification. living standard initial definition ...
Web-based protocol handlers - Web APIs
the url. so, using the above examples, the browser would perform a get on this url: http://www.google.co.uk/?uri=web+burger:cheeseburger server side code can extract the query string parameters and perform the desired action. note:the server side code is passed the entire contents of the href. this means the server side code will have to parse out the protocol from the data. example <?php $value = ""; if ( isset ( $_get["value"] ) ) { $value = $_get["value"]; } ?> <!doctype html public "-//w3c//dtd html 4.01//en"> <html lang="en"> <head> <title>web protocol handler sample</title> </head> <body> <h1>web protocol handler sample - handler</h1> <p>this web page is called when handling a <code>web+burger:</code> protocol action. the data sent:</p> <textarea> <?php echo(htmlspecia...
...f ( isset ( $_get["value"] ) ) { $value = $_get["value"]; } ?> <!doctype html public "-//w3c//dtd html 4.01//en"> <html lang="en"> <head> <title>web protocol handler sample</title> </head> <body> <h1>web protocol handler sample - handler</h1> <p>this web page is called when handling a <code>web+burger:</code> protocol action. the data sent:</p> <textarea> <?php echo(htmlspecialchars($value, ent_quotes, 'utf-8')); ?> </textarea> </body> </html> references http://www.w3.org/tr/2011/wd-html5-20110525/timers.html#custom-handlers see also window.navigator.registercontenthandler nsiprotocolhandler (xul only) registerprotocolhandler enhancing the federated web at mozilla webdev register a custom protocolhandler at google developers. ...
Navigator.vendor - Web APIs
Web › API › Navigator › vendor
specifications specification status comment html living standardthe definition of 'navigatorid: vendor' in that specification. ...
... specifications specification status comment html living standardthe definition of 'navigatorid: vendor' in that specification. ...
navigator.hardwareConcurrency - Web APIs
note: this feature is available in web workers. the navigator.hardwareconcurrency read-only property returns the number of logical processors available to run threads on the user's computer. syntax logicalprocessors = window.navigator.hardwareconcurrency value a number indicating the number of logical processor cores. modern computers have multiple physical processor cores in their cpu (two or four cores is typical), but each physical core is also usually able to run more than one thread at a time using advanced scheduling techniques. so a four-core cpu may offer eight logical processor cores, for example. the number of logical processor cores can be used to measure the number of threads which can effectively be run at once without them having to context switch. the browser may, howeve...
...rt a lower number of logical cores in order to represent more accurately the number of workers that can run at once, so don't treat this as an absolute measurement of the number of cores in the user's system. examples in this example, one worker is created for each logical processor reported by the browser and a record is created which includes a reference to the new worker as well as a boolean value indicating whether or not we're using that worker yet; these objects are, in turn, stored into an array for later use. this creates a pool of workers we can use to process requests later. let workerlist = []; for (let i = 0; i < window.navigator.hardwareconcurrency; i++) { let newworker = { worker: new worker('cpuworker.js'), inuse: false }; workerlist.push(newworker); } specific...
NavigatorID.appVersion - Web APIs
returns either "4.0" or a string representing version information about the browser. note: do not rely on this property to return the correct browser version. syntax window.navigator.appversion value either "4.0" or a string representing version information about the browser. example alert('your browser version is reported as ' + navigator.appversion); notes the window.navigator.useragent property may also contain the version number (for example "mozilla/5.0 (windows; u; win98; en-us; rv:0.9.2) gecko/20010725 netscape 6/6.1"), but you should be aware of how easy it is to change the user agent string and "spoof" other browsers, platforms, or user agents, and also how cavalier the browser vendor themselves are with these properties. the window.navigator.appversion, window.navigator.a...
... agents, and also how cavalier the browser vendor themselves are with these properties. the window.navigator.appversion, window.navigator.appname and window.navigator.useragent properties have been used in "browser sniffing" code: scripts that attempt to find out what kind of browser you are using and adjust pages accordingly. this lead to the current situation, where browsers had to return fake values from these properties in order not to be locked out of some websites. specifications specification status comment html living standardthe definition of 'navigatorid.appversion' in that specification. living standard initial definition ...
NavigatorID.userAgent - Web APIs
the navigatorid.useragent read-only property returns the user agent string for the current browser. the specification asks browsers to provide as little information via this field as possible. never assume that the value of this property will stay the same in future versions of the same browser. try not to use it at all, or only for current and past versions of a browser. new browsers may start using the same ua, or part of it, as an older browser: you really have no guarantee that the browser agent is indeed the one advertised by this property. also keep in mind that users of a browser can change the value of this field if they want (ua spoofing). browser identification based on detecting the user agent string is unreliable and is not recommended, as the user agent string is user configu...
...tp header that gets sent, and doesn't affect browser detection performed by javascript code. opera 6+ allows users to set the browser identification string via a menu. microsoft internet explorer uses the windows registry. safari and icab allow users to change the browser user agent string to predefined internet explorer or netscape strings via a menu. syntax var ua = navigator.useragent; value a domstring specifying the complete user agent string the browser provides both in http headers and in response to this and other related methods on the navigator object. the user agent string is built on a formal structure which can be decomposed into several pieces of info. each of these pieces of info comes from other navigator properties which are also settable by the user. gecko-based brow...
Navigator.onLine - Web APIs
returns the online status of the browser. the property returns a boolean value, with true meaning online and false meaning offline. the property sends updates whenever the browser's ability to connect to the network changes. the update occurs when the user follows links or when a script requests a remote page. for example, the property should return false when users click links soon after they lose internet connection. browsers implement this property differently. in chrome and safari, if the browser is not able to connect to a local area network (lan) or a router, it is offline; all other conditions return true. so while you can assume that the browser is offline when it returns a false value, you cannot assume that a true value necessarily means that the browser can access the internet. yo...
...here the computer is running a virtualization software that has virtual ethernet adapters that are always "connected." therefore, if you really want to determine the online status of the browser, you should develop additional means for checking. to learn more, see the html5 rocks article, working off the grid. in firefox and internet explorer, switching the browser to offline mode sends a false value. until firefox 41, all other conditions return a true value; testing actual behavior on nightly 68 on windows shows that it only looks for lan connection like chrome and safari giving false positives. you can see changes in the network state by listening for the events on window.ononline and window.onoffline. syntax online = window.navigator.online; value online is a boolean true or false. ...
NetworkInformation - Web APIs
bandwidth estimate in megabits per second, rounded to the nearest multiple of 25 kilobits per seconds. networkinformation.downlinkmax read only returns the maximum downlink speed, in megabits per second (mbps), for the underlying connection technology. networkinformation.effectivetype read only returns the effective type of the connection meaning one of 'slow-2g', '2g', '3g', or '4g'. this value is determined using a combination of recently observed round-trip time and downlink values. networkinformation.rtt read only returns the estimated effective round-trip time of the current connection, rounded to the nearest multiple of 25 milliseconds. networkinformation.savedata read only returns true if the user has set a reduced data usage option on the user agent. networkinformation.typ...
... returns the estimated effective round-trip time of the current connection, rounded to the nearest multiple of 25 milliseconds. networkinformation.savedata read only returns true if the user has set a reduced data usage option on the user agent. networkinformation.type read only returns the type of connection a device is using to communicate with the network. it will be one of the following values: bluetooth cellular ethernet none wifi wimax other unknown event handlers networkinformation.onchange the event that's fired when connection information changes and the change is fired on this object. methods this interface also inherits methods of its parent, eventtarget. specifications specification status comment network information...
Node.cloneNode() - Web APIs
Web › API › Node › cloneNode
ild text nodes). deep has no effect on empty elements (such as the <img> and <input> elements). *note: in the dom4 specification (since gecko 13.0 (firefox 13 / thunderbird 13 / seamonkey 2.10)), the optional deep argument defaults to true. this behavior has been changed in the latest spec! although deep it still optional, it now defaults to false. you should always provide an explicit value for backward and forward compatibility. with gecko 28.0 (firefox 28 / thunderbird 28 / seamonkey 2.25 / firefox os 1.3)), the console warned developers not to omit the argument. starting with gecko 29.0 (firefox 29 / thunderbird 29 / seamonkey 2.26)), a shallow clone is defaulted instead of a deep clone. example let p = document.getelementbyid("para1") let p_prime = p.clonenode(tr...
...fox 28 / thunderbird 28 / seamonkey 2.25 / firefox os 1.3)), the console warned developers not to omit the argument. starting with gecko 29.0 (firefox 29 / thunderbird 29 / seamonkey 2.26)), a shallow clone is defaulted instead of a deep clone. example let p = document.getelementbyid("para1") let p_prime = p.clonenode(true) notes cloning a node copies all of its attributes and their values, including intrinsic (inline) listeners. it does not copy event listeners added using addeventlistener() or those assigned to element properties (e.g., node.onclick = somefunction). additionally, for a <canvas> element, the painted image is not copied. warning: clonenode() may lead to duplicate element ids in a document! if the original node has an id attribute, and the clone will be placed i...
Node.compareDocumentPosition() - Web APIs
the node.comparedocumentposition() method reports the position of the given node relative to another node in any document — not just the given node’s document. the return value is a bitmask of the following values: name value document_position_disconnected 1 document_position_preceding 2 document_position_following 4 document_position_contains 8 document_position_contained_by 16 document_position_implementation_specific 32 syntax comparemask = node.comparedocumentposition(othernode) parameters othernode the other node with which to compare the first node’s document position. return value an integer value whose bits represent the othernode's relationship to the calling node. more th...
...ition. return value an integer value whose bits represent the othernode's relationship to the calling node. more than one bit is set if multiple scenarios apply. for example, if othernode is located earlier in the document and contains the node on which comparedocumentposition() was called, then both the document_position_contains and document_position_preceding bits would be set, producing a value of 10 (0x0a). example const head = document.head; const body = document.body; if (head.comparedocumentposition(body) & node.document_position_following) { console.log('well-formed document'); } else { console.error('<head> is not before <body>'); } note: because the result returned by comparedocumentposition() is a bitmask, the bitwise and operator must be used for meaningful results. ...
Node.namespaceURI - Web APIs
Web › API › Node › namespaceURI
ippet, a node is being examined for its node.localname and its namespaceuri. if the namespaceuri returns the xul namespace and the localname returns "browser", then the node is understood to be a xul <browser/>. if (node.localname == "browser" && node.namespaceuri == "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul") { // this is a xul browser } notes this is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. the namespace uri of a node is frozen at the node creation time. in firefox 3.5 and earlier, the namespace uri for html elements in html documents is null. in later versions, in compliance with html5, it is https://www.w3.org/1999/xhtml as in xhtml. for nodes of any node.nodetype other than...
...okup based on an examination of the namespace declarations in scope. the namespace uri of a node is frozen at the node creation time. in firefox 3.5 and earlier, the namespace uri for html elements in html documents is null. in later versions, in compliance with html5, it is https://www.w3.org/1999/xhtml as in xhtml. for nodes of any node.nodetype other than element_node and attribute_node the value of namespaceuri is always null. you can create an element with the specified namespaceuri using the dom level 2 method document.createelementns and attributes with the method element.setattributens. per the namespaces in xml specification, an attribute does not inherit its namespace from the element it is attached to. if an attribute is not explicitly given a namespace, it has no namespace. th...
Node.nodeType - Web APIs
Web › API › Node › nodeType
the read-only node.nodetype property is an integer that identifies what the node is. it distinguishes different kind of nodes from each other, such as elements, text and comments. syntax var type = node.nodetype; returns an integer which specifies the type of the node. possible values are listed in node type constants. constants node type constants constant value description node.element_node 1 an element node like <p> or <div>. node.text_node 3 the actual text inside an element or attr. node.cdata_section_node 4 a cdatasection, such as <!cdata[[ … ]]>. node.processing_instruction_node 7 a processinginstruction of an xml document, such as <?xml-stylesheet … ?>. node.comment_node 8 a comment...
... 8 a comment node, such as <!-- … -->. node.document_node 9 a document node. node.document_type_node 10 a documenttype node, such as <!doctype html>. node.document_fragment_node 11 a documentfragment node. deprecated node type constants the following constants have been deprecated and should not be used anymore. constant value description node.attribute_node 2 an attribute of an element. attributes no longer implement the node interface as of dom4. node.entity_reference_node 5 an xml entity reference node, such as &foo;. removed in dom4. node.entity_node 6 an xml <!entity …> node. removed in dom4. node.notation_node 12 an xml <!notation …> node. removed...
NodeFilter.acceptNode() - Web APIs
the nodefilter.acceptnode() method returns an unsigned short that will be used to tell if a given node must be accepted or not by the nodeiterator or treewalker iteration algorithm. this method is expected to be written by the user of a nodefilter. possible return values are: constant description nodefilter.filter_accept value returned by the nodefilter.acceptnode() method when a node should be accepted. ...
... be used to tell if a given node must be accepted or not by the nodeiterator or treewalker iteration algorithm. this method is expected to be written by the user of a nodefilter. possible return values are: constant description nodefilter.filter_accept value returned by the nodefilter.acceptnode() method when a node should be accepted. nodefilter.filter_reject value to be returned by the nodefilter.acceptnode() method when a node should be rejected. the children of rejected nodes are not visited by the nodeiterator or treewalker object; this value is treated as "skip this node and all its children". nodefilter.filter_skip value to be returned by nodefilter.acceptnode() for nodes to be skipped by the nodeiterator or treewalker object. the children...
NodeFilter - Web APIs
jects. properties this interface neither implements nor inherits any properties. methods this interface doesn't inherit any methods. nodefilter.acceptnode() returns an unsigned short that will be used to tell if a given node must be accepted or not by the nodeiterator or treewalker iteration algorithm. this method is expected to be written by the user of a nodefilter. possible return values are: constant description filter_accept value returned by the nodefilter.acceptnode() method when a node should be accepted. filter_reject value to be returned by the nodefilter.acceptnode() method when a node should be rejected. for treewalker, child nodes are also rejected. for nodeiterator, this flag is synonymous with filter_s...
... the children of skipped nodes are still considered. this is treated as "skip this node but not its children". ...
Notification.Notification() - Web APIs
r the notification, which is shown at the top of the notification window. options optional an options object containing any custom settings that you want to apply to the notification. the possible options are: dir: the direction in which to display the notification. it defaults to auto, which just adopts the browser's language setting behavior, but you can override that behaviour by setting values of ltr and rtl (although most browsers seem to ignore these settings.) lang: the notification's language, as specified using a domstring representing a bcp 47 language tag. see the sitepoint iso 2 letter language codes page for a simple reference. badge: a usvstring containing the url of the image used to represent the notification when there isn't enough space to display the notification it...
... for the device's vibration hardware to emit with the notification. renotify: a boolean specifying whether the user should be notified after a new notification replaces an old one. the default is false, which means they won't be notified. requireinteraction: indicates that a notification should remain active until the user clicks or dismisses it, rather than closing automatically. the default value is false. actions: an array of notificationactions representing the actions available to the user when the notification is presented. these are options the user can choose among in order to act on the action within the context of the notification itself. the action's name is sent to the service worker notification handler to let it know the action was selected by the user. silent: a boolean s...
Notification.dir - Web APIs
Web › API › Notification › dir
rtl : right to left. ...
... rtl : right to left. ...
OscillatorNode.start() - Web APIs
nterface specifies the exact time to start playing the tone. its parameter is optional and default to 0. syntax oscillator.start(when); // start playing oscillator at the point in time specified by when parameters when optional an optional double representing the time (in seconds) when the oscillator should start, in the same coordinate system as audiocontext's currenttime attribute. if a value is not included or is less than currenttime, the oscillator starts playing immediately. example the following example shows basic usage of an audiocontext to create an oscillator node. for an applied example, check out our violent theremin demo (see app.js for relevant code). // create web audio api context var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); // create os...
... example shows basic usage of an audiocontext to create an oscillator node. for an applied example, check out our violent theremin demo (see app.js for relevant code). // create web audio api context var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); // create oscillator node var oscillator = audioctx.createoscillator(); oscillator.type = 'square'; oscillator.frequency.setvalueattime(3000, audioctx.currenttime); // value in hertz oscillator.start(); specifications specification status comment web audio apithe definition of 'start' in that specification. working draft ...
PaintWorklet.registerPaint - Web APIs
the paintworklet.registerpaint() method of the paintworklet interface registers a class programmatically generate an image where a css property expects a file. syntax registerpaint(name, class); parameters name the name of the worklet class to register. class a reference to the class that implements the worklet. return value undefined exceptions typeerror thrown when one of the arguments is invalid or missing. invalidmodificationerror thrown when the a worklet already exists with the specified name. examples the following shows registering an example worklet module. this should be in a separate js file. note that registerpaint() is called without a reference to paintworklet. the file itself is loaded through css.paintworklet.addmodule() (documented here on the p...
...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 the css.paintworklet.addmodule() method: <script> css.paintworklet.addmodule('checkboardworklet.js'); </script> you can then use the paint() css function in your css anywhere an <image> value is valid. li { background-image: paint(checkerboard); } specifications specification status comment css painting api level 1the definition of 'paintworklet.registerpaint' in that specification. working draft initial definition. ...
PannerNode.PannerNode() - Web APIs
s 0.) orientationx: the pannernode.orientationx you want the pannernode to have (the default is 1.) orientationy: the pannernode.orientationy you want the pannernode to have (the default is 0.) orientationz: the pannernode.orientationz you want the pannernode to have (the default is 0.) refdistance: the pannernode.refdistance you want the pannernode to have. the default is 1, and negative values are not allowed. maxdistance: the pannernode.maxdistance you want the pannernode to have. the default is 10000, and non-positive values are not allowed. rollofffactor: the pannernode.rollofffactor you want the pannernode to have. the default is 1, and negative values are not allowed. coneinnerangle: the pannernode.coneinnerangle you want the pannernode to have (the default is 360.) coneo...
...or you want the pannernode to have. the default is 1, and negative values are not allowed. coneinnerangle: the pannernode.coneinnerangle you want the pannernode to have (the default is 360.) coneouterangle: the pannernode.coneouterangle you want the pannernode to have (the default is 360.) coneoutergain: the pannernode.coneoutergain you want the pannernode to have. the default is 0, and its value can be in the range 0–1. return value a new pannernode object instance. exceptions rangeerror the refdistance, maxdistance, or rollofffactor properties have been given a value that is outside the accepted range. invalidstateerror the coneoutergain property has been given a value outside the accepted range (0–1). example var ctx = new audiocontext(); var options = { positio...
PannerNode.positionX - Web APIs
the sound (as specified using the attributes coneinnerangle, coneouterangle, and codeoutergain), the orientation of the sound may alter the perceived volume of the sound as it's being played. if the sound is pointing toward the listener, it will be louder than if the sound is pointed away from the listener. the audioparam contained by this property is read only; however, you can still change the value of the parameter by assigning a new value to its audioparam.value property. syntax var positionx = pannernode.positionx; pannernode.positionx.value = newpositionx; value an audioparam whose value is the x coordinate of the audio source's position, in 3d cartesian coordinates. the default value is 0. example the following example starts an oscillator, and pans it to the left after 1 secon...
...coordinate of the audio source's position, in 3d cartesian coordinates. the default value is 0. example the following example starts an oscillator, and pans it to the left after 1 second, to the right after 2 seconds, and back to the center after 3 seconds. const context = new audiocontext(); const osc = new oscillatornode(context); const panner = new pannernode(context); panner.positionx.setvalueattime(-1, context.currenttime + 1); panner.positionx.setvalueattime(1, context.currenttime + 2); panner.positionx.setvalueattime(0, context.currenttime + 3); osc.connect(panner) .connect(context.destination); osc.start(0); specifications specification status comment web audio apithe definition of 'positionx' in that specification. working draft ...
PannerNode.positionY - Web APIs
the sound (as specified using the attributes coneinnerangle, coneouterangle, and codeoutergain), the orientation of the sound may alter the perceived volume of the sound as it's being played. if the sound is pointing toward the listener, it will be louder than if the sound is pointed away from the listener. the audioparam contained by this property is read only; however, you can still change the value of the parameter by assigning a new value to its audioparam.value property. syntax var positiony = pannernode.positiony; pannernode.positiony.value = newpositiony; value an audioparam whose value is the y coordinate of the audio source's position, in 3d cartesian coordinates. example the following example starts an oscillator and pans it above the listener after 1 second, below the liste...
...s it above the listener after 1 second, below the listener after 2 seconds, and back to the center after 3 seconds. note that in this case, the change will mainly affect the timbre of the oscillator, as it's a simple mono wave. const context = new audiocontext(); const osc = new oscillatornode(context); const panner = new pannernode(context); panner.panningmodel = 'hrtf'; panner.positiony.setvalueattime(1, context.currenttime + 1); panner.positiony.setvalueattime(-1, context.currenttime + 2); panner.positiony.setvalueattime(0, context.currenttime + 3); osc.connect(panner) .connect(context.destination); osc.start(0); specifications specification status comment web audio apithe definition of 'positiony' in that specification. working draft ...
PannerNode.positionZ - Web APIs
the sound (as specified using the attributes coneinnerangle, coneouterangle, and codeoutergain), the orientation of the sound may alter the perceived volume of the sound as it's being played. if the sound is pointing toward the listener, it will be louder than if the sound is pointed away from the listener. the audioparam contained by this property is read only; however, you can still change the value of the parameter by assigning a new value to its audioparam.value property. syntax var positionz = pannernode.positionz; pannernode.positionz.value = newpositionz; value an audioparam whose value is the z coordinate of the audio source's position, in 3d cartesian coordinates. example the following example starts an oscillator and moves it in front of the listener after 1 second, behind t...
...front of the listener after 1 second, behind the listener after 2 seconds, and back to the listener's position after 3 seconds. note that in this case, the change will mainly affect the timbre and perceived volume of the sound. const context = new audiocontext(); const osc = new oscillatornode(context); const panner = new pannernode(context); panner.panningmodel = 'hrtf'; panner.positionz.setvalueattime(1, context.currenttime + 1); panner.positionz.setvalueattime(-1, context.currenttime + 2); panner.positionz.setvalueattime(0, context.currenttime + 3); osc.connect(panner) .connect(context.destination); osc.start(0); specifications specification status comment web audio apithe definition of 'positionz' in that specification. working draft ...
ParentNode.append() - Web APIs
Web › API › ParentNode › append
the parentnode.append() method inserts a set of node objects or domstring objects after the last child of the parentnode. domstring objects are inserted as equivalent text nodes. differences from node.appendchild(): parentnode.append() allows you to also append domstring objects, whereas node.appendchild() only accepts node objects. parentnode.append() has no return value, whereas node.appendchild() returns the appended node object. parentnode.append() can append several nodes and strings, whereas node.appendchild() can only append one node. syntax // [throws, unscopable] parentnode.append(...nodesordomstrings) // returns undefined parameters nodes a set of node or domstring objects to insert. exceptions hierarchyrequesterror: node cannot be inserted at the specified point ...
...argitem : document.createtextnode(string(argitem))); }); this.appendchild(docfrag); } }); }); })([elem...
ParentNode.prepend() - Web APIs
r domstring objects before the first child of the parentnode. domstring objects are inserted as equivalent text nodes. syntax parentnode.prepend(...nodestoprepend); parameters nodestoprepend one or more nodes to insert before the first child node currently in the parentnode. each node can be specified as either a node object or as a string; strings are inserted as new text nodes. return value undefined. exceptions hierarchyrequesterror: node cannot be inserted at the specified point in the hierarchy. examples prepending an element var parent = document.createelement("div"); var p = document.createelement("p"); var span = document.createelement("span"); parent.append(p); parent.prepend(span); console.log(parent.childnodes); // nodelist [ <span>, <p> ] prepending text var p...
...argitem : document.createtextnode(string(argitem))); }); this.insertbefore(docfrag, this.firstchild); } ...
ParentNode.querySelectorAll() - Web APIs
g selectors to identify elements. multiple selectors may be specified by separating them using commas. note: characters which are not part of standard css syntax must be escaped using a backslash character. since javascript also uses backslash escaping, special care must be taken when writing string literals using these characters. see escaping special characters for more information. return value a non-live nodelist containing one element object for each descendant node that matches at least one of the specified selectors. note: if the specified selectors include a css pseudo-element, the returned list is always empty. exceptions syntaxerror the syntax of the specified selectors string is not valid. examples to obtain a nodelist of all of the <p> elements in the document: var...
... html consider this html, with its three nested <div> blocks. <div class="outer"> <div class="select"> <div class="inner"> </div>...
PasswordCredential.additionalData - Web APIs
l interface takes one of a formdata instance, a urlsearchparams instance, or null. the data in the objects will be added to the request body and sent to the remote endpoint with the credentials. syntax passwordcredential.additionaldata = formdata formdata = passwordcredential.additionaldata passwordcredential.additionaldata = urlsearchparams ulrsearchparams = passwordcredential.additionaldata value one of a formdata instance, a urlsearchparams instance, or null. example the following example creates a formdata object with an appended csrf token. it then stores the form object in the additionaldata parameter, before sending it to server in a call to fetch. //the options object was previously created. navigator.credentials.get(options).then(function(creds) { if (creds.type == 'password'...
...ample creates a formdata object with an appended csrf token. it then stores the form object in the additionaldata parameter, before sending it to server in a call to fetch. //the options object was previously created. navigator.credentials.get(options).then(function(creds) { if (creds.type == 'password') { var form = new formdata(); var csrf_token = document.queryselector('csrf_token').value; form.append('csrf_token', csrf_token); creds.additionaldata = form; fetch('https://www.example.com', { method: 'post', credentials: creds }); }; }); specifications specification status comment credential management level 1 working draft initial definition. ...
PaymentCurrencyAmount.currency - Web APIs
the paymentcurrencyamount property currency is a string which specifies the currency in which the value is specified. the value is always specified using the 3-letter codes defined by the iso 4127 standard. syntax currency = paymentcurrencyamount.currency; value a domstring specifying the canonical, three-character currency identification code defined by the iso 4217 standard. this is the currency in which the payment's value is given. all currency values must include the currency system in this property. example this example represents the price of $42.95 in us dollars. ...
... = paymentcurrencyamount.currency; value a domstring specifying the canonical, three-character currency identification code defined by the iso 4217 standard. this is the currency in which the payment's value is given. all currency values must include the currency system in this property. example this example represents the price of $42.95 in us dollars. let itemprice = { currency: "usd", value: "42.95" }; specifications specification status comment payment request apithe definition of 'paymentcurrencyamount.currency' in that specification. candidate recommendation ...
PaymentCurrencyAmount - Web APIs
yen, etc.), and is part of the payment request api. this is used to specify the prices of both line items on a payment, using paymentitem objects, and to provide the cost of a shipping option, using paymentshippingoption. properties all properties are required. currency a string containing a valid 3-letter iso 4217 currency identifier (iso 4217) indicating the currency used for the payment value. value a string containing a valid decimal value representing the mount of currency constituting the payment amount. this string must only contain an optional leading "-" to indicate a negative value, then one or more digits from 0 to 9, and an optional decimal point (".", regardless of locale) followed by at least one more digit. no whitespace is permitted. obsolete properties these propert...
...n optional decimal point (".", regardless of locale) followed by at least one more digit. no whitespace is permitted. obsolete properties these properties have been removed from the specification and should no longer be used. currencysystem optional a string describing the standard or specification as well as the currency system identifier within that system which was used to provide the value. this has been removed; instead of allowing sites to choose the standard to use, iso 4217 is always used for the currency identifier now. specifications specification status comment payment request apithe definition of 'paymentcurrencyamount' in that specification. candidate recommendation initial definition. ...
PaymentDetailsUpdate.shippingAddressErrors - Web APIs
for each property in paymentaddress, a property by the same name is found in shippingaddresserrors if and only if a validation error occurred for that property. ...
...for each property in paymentaddress, a property by the same name is found in shippingaddresserrors if and only if a validation error occurred for that property. ...
PaymentMethodChangeEvent - Web APIs
the paymentmethodchangeevent interface of the payment request api describes the paymentmethodchange event which is fired by some payment handlers when the user switches payment instruments (e.g., a user selects a "store" card to make a purchase while using apple pay). constructor paymentmethodchangeevent() creates and returns a new paymentmethodchangeevent object, optionally initialized with values taken from a given paymentmethodchangeeventinit dictionary. properties in addition to the properties below, this interface includes properties inherited from paymentrequestupdateevent. methoddetails read only secure context an object containing payment method-specific data useful when handling a payment method change. if no such information is available, this value is null. methodname r...
... methods this interface includes methods inherited from paymentrequestupdateevent. ...
PaymentRequest.canMakePayment() - Web APIs
e). syntax paymentrequest.canmakepayment() .then( canpay => { ... }) .catch( error => { ... }) canpay = await paymentrequest.canmakepayment(); returns a promise to a boolean that resolves to true if the user agent supports any of the payment methods supplied when instantiating the request using the paymentrequest constructor. if the payment can't be processed, the promise receives a value of false. note: if you call this too often, the browser may reject the returned promise with a domexception. parameters none examples in the following example, is excerpted from a demo that asynchronously builds a paymentrequest object for both apple pay and credit cards. it wraps the call to canmakepayment() in feature detection, and calls an appropriate callback depending on the resoluti...
...mple, is excerpted from a demo that asynchronously builds a paymentrequest object for both apple pay and credit cards. it wraps the call to canmakepayment() in feature detection, and calls an appropriate callback depending on the resolution of the promise. async function initpaymentrquest() { const details = { total: { label: "total", amount: { currency: "usd", value: "0.00", }, }, }; const supportsapplepay = new paymentrequest( [{ supportedmethods: "https://apple.com/apple-pay" }], details ).canmakepayment(); // supports apple pay? if (await supportsapplepay) { // show apple pay logo, for instance return; } // otherwise... let's see if we can use basic card const supportsbasiccard = await new paymentrequest( [...
PaymentRequest.onshippingoptionchange - Web APIs
efore the call to show(). // initialization of paymentrequest arguments are excerpted for clarity. ...
...ntlistener('shippingaddresschange', e => { e.updatewith(((details, addr) => { var shippingoption = { id: '', label: '', amount: { currency: 'usd', value: '0.00' }, selected: true }; // shipping to us is supported if (addr.country === 'us') { shippingoption.id = 'us'; shippingoption.label = 'standard shipping in us'; shippingoption.amount.value = '0.00'; details.total.amount.value = '55.00'; // shipping to jp is supported } else if (addr.country === 'jp') { shippingoption.id = 'jp'; shippingoption.label = 'international shipping'; shippingoption.amount.value = '10.00'; details.total.amount.value = '65.00'; // shipping to elsewhere is unsupported } else { // empty array indicates reject...
PaymentRequest: shippingoptionchange event - Web APIs
culates the total charge for the payment based on the selected shipping option. for example, if there are three options (such as "free ground shipping", "2-day air", and "next day"), each time the user chooses one of those options, this event handler is called to recalculate the total based on the changed shipping option. paymentrequest.addeventlistener("shippingoptionchange", event => { const value = calculatenewtotal(paymentrequest.shippingoption); const total = { currency: "eur", label: "total due", value, }; event.updatewith({ total }); }, false); after caling a custom function, calculatenewtotal(), to compute the updated total based on the newly-selected shipping option as specified by the shippingoption. the revised total is submitted back to the payment request by ...
...ute the updated total based on the newly-selected shipping option as specified by the shippingoption. the revised total is submitted back to the payment request by calling the event's updatewith() method. you can also create an event handler for shippingoptionchange using its corresponding event handler property, onshippingoptionchange: paymentrequest.onshippingoptionchange = event => { const value = calculatenewtotal(paymentrequest.shippingoption); const total = { currency: "eur", label: "total due", value, }; event.updatewith({ total }); }; specifications specification status comment payment request apithe definition of 'shippingoptionchange' in that specification. candidate recommendation initial definition. ...
PaymentResponse.onpayerdetailchange - Web APIs
the paymentresponse object's onpayerdetailchange property is an event handler which is called to handle the payerdetailchange event, which is sent to the paymentresponse when the user makes changes to their personal information while filling out a payment request form. syntax paymentresponse.onpayerdetailchange = eventhandlerfunction; value an event handler function which is called to handle the payerdetailchange event when the user makes changes to their personal information while editing a payment request form. examples in the example below, onpayerdetailchange is used to set up a listener for the payerdetailchange event in order to validate the information entered by the user, requesting that any mistakes be corrected // options for paymentrequest(), indicating that shippi...
...quest.show(); // get the data from the response let { payername: oldpayername, payeremail: oldpayeremail, payerphone: oldpayerphone, } = response; // set up a handler for payerdetailchange events, to // request corrections as needed. response.onpayerdetailchange = async ev => { const promisestovalidate = []; const { payername, payeremail, payerphone } = response; // validate each value which changed by calling a function // that validates each type of data, returning a promise which // resolves if the data is valid. if (oldpayername !== payername) { promisestovalidate.push(validatename(payername)); oldpayername = payername; } if (oldpayeremail !== payeremail) { promisestovalidate.push(validateemail(payeremail)); oldpayeremail = payeremail; } if (o...
PaymentResponse.shippingOption - Web APIs
revity. ...
... var othershippingoption; if (shippingoption === 'standard') { selectedshippingoption = details.shippingoptions[0]; othershippingoption = details.shippingoptions[1]; details.total.amount.value = '55.00'; } else if (shippingoption === 'express') { selectedshippingoption = details.shippingoptions[1]; othershippingoption = details.shippingoptions[0]; details.total.amount.value = '67.00'; } else { reject('unknown shipping option \'' + shippingoption + '\''); return; } selectedshippingoption.selected = true; othershippingoption.selected = false; details.displayitems.splice(2, 1, selectedshippingoption); resolve(details); } specifications specification status comment payment request api candidate recommendation initial ...
performance.measure() - Web APIs
ntry buffer between marks, the navigation start time, or the current time. when measuring between two marks, there is a start mark and end mark, respectively. the named timestamp is referred to as a measure. the measure can be retrieved by one of the performance interfaces: (getentries(), getentriesbyname() or getentriesbytype()). the measure's performance entry will have the following property values: entrytype - set to "measure". name - set to the "name" given when the measure was created. starttime - set to the start mark timestamp. duration - set to a domhighrestimestamp that is the duration of the measure (typically, the end mark timestamp minus the start mark timestamp). note: this feature is available in web workers. syntax performance.measure(name); performance.measure(name,...
...k optional a domstring representing the name of the measure's starting mark. may also be the name of a performancetiming property. if it is omitted, then the start time will be the navigation start time. endmark optional a domstring representing the name of the measure's ending mark. may also be the name of a performancetiming property. if it is omitted, then the current time is used. return value void example the following example shows how measure() is used to create a new measure performance entry in the browser's performance entry buffer. const markernamea = "example-marker-a" const markernameb = "example-marker-b" // run some nested timeouts, and create a performancemark for each. performance.mark(markernamea); settimeout(function() { performance.mark(markernameb); setti...
PerformanceEntry.duration - Web APIs
the duration property returns a timestamp that is the duration of the performance entry. note: this feature is available in web workers. the value returned by this property depends on the performance entry's type: "frame" - returns a timestamp indicating the difference between the starttimes of two successive frames. "mark" - returns "0" (a mark has no duration). "measure" - returns the timestamp that is the duration of the measure. "navigation" - returns the timestamp that is the difference between the performancenavigationtiming.loadeventend and performanceentry.starttime properties, respectively. ...
...ns the timestamp that is the duration of the measure. "navigation" - returns the timestamp that is the difference between the performancenavigationtiming.loadeventend and performanceentry.starttime properties, respectively. "resource" - returns the difference between the resource's responseend timestamp and its starttime timestamp. this property is read only . syntax entry.duration; return value a domhighrestimestamp representing the duration of the performance entry. if the duration concept doesn't apply for a particular performance metric, the browser may choose to return a duration of 0. note: if the performance entry has an entrytype of "resource" (i.e. the entry is a performanceresourcetiming object), this property returns the difference between the performanceentry.responseend an...
PerformanceResourceTiming.initiatorType - Web APIs
the initiatortype read-only property is a string that represents the type of resource that initiated the performance event. the value of this string is as follows: if the initiator is a element, the property returns the element's localname. if the initiator is a css resource, the property returns "css". if the initiator is a xmlhttprequest object, the property returns "xmlhttprequest". if the initiator is a performancenavigationtiming object, the property returns an empty string (""). note: this feature is available in web workers. syntax resource.initiatortype; return value a string representing the type of resource that initiated the performance event, as specified above. example function print_performanceentries() { // use getentriesbytype() to just get the "resource" even...
...source that initiated the performance event, as specified above. example function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = performance.getentriesbytype("resource"); for (var i=0; i < p.length; i++) { print_initiatortype(p[i]); } } function print_initiatortype(perfentry) { // print this performance entry object's initiatortype value var value = "initiatortype" in perfentry; if (value) console.log("... initiatortype = " + perfentry.initiatortype); else console.log("... initiatortype = not supported"); } specifications specification status comment resource timing level 1the definition of 'initiatortype' in that specification. candidate recommendation initial definition. ...
PerformanceResourceTiming.nextHopProtocol - Web APIs
work protocol used to fetch the resource, as identified by the alpn protocol id (rfc7301). when a proxy is used, if a tunnel connection is established, this property returns the alpn protocol id of the tunneled protocol. otherwise, this property returns the alpn protocol id of the first hop to the proxy. note: this feature is available in web workers. syntax resource.nexthopprotocol; return value a string representing the network protocol used to fetch the resource, as identified by the alpn protocol id (rfc7301). example the following example uses the nexthopprotocol property. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = performance.getentriesbytype("resource"); for (var i=0; i < p.length; i++) { print_nexthopprot...
...rce, as identified by the alpn protocol id (rfc7301). example the following example uses the nexthopprotocol property. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = performance.getentriesbytype("resource"); for (var i=0; i < p.length; i++) { print_nexthopprotocol(p[i]); } } function print_nexthopprotocol(perfentry) { var value = "nexthopprotocol" in perfentry; if (value) console.log("nexthopprotocol = " + perfentry.nexthopprotocol); else console.log("nexthopprotocol = not supported"); } specifications specification status comment resource timing level 2the definition of 'nexthopprotocol' in that specification. working draft initial definition. ...
Using the Performance API - Web APIs
additionally, there must be a way to create a timestamp for a specific point in time; this is done with the now() method. web performance interfaces are defined in a suite of standards. the base interface for these standards is the performance interface and its methods and properties are extended by different standards. ...
...e extended by different standards. this guide describes how to use the performance interfaces that are defined in the high-resolution time standard. other web performance guides (listed in the see also section) describe how to use additional methods and properties of the performance interface. high precision timing high precision timing is achieved by using the domhighrestimestamp type for time values. the unit is milliseconds and should be accurate to 5 µs (microseconds). however, if the browser is unable to provide a time value accurate to 5 microseconds (because of hardware or software constraints, for example), the browser can represent the value as a time in milliseconds accurate to a millisecond. the following code example shows the use of domhighrestimestamp and the performance.now()...
PhotoCapabilities - Web APIs
the photocapabilities interface of the the mediastream image capture api provides available configuration options for an attached photographic device. a photocapabilities object is retrieved by calling imagecapture.getphotocapabilities(). properties photocapabilities.redeyereduction read only returns one of "never", "always", or "controllable". the "controllable" value means the device's read-eye reduction is controllable by the user. photocapabilities.imageheight read only returns a mediasettingsrange object indicating the image height range supported by the user agent. photocapabilities.imagewidth read only returns a mediasettingsrange object indicating the image width range supported by the user agent. photocapabilities.filllightmode read only returns an array of available fi...
... working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd ...
PointerEvent.pointerId - Web APIs
example the following code snippet compares a previously saved pointerid with the one of the pointerdown event that was just fired. ...
... example the following code snippet compares a previously saved pointerid with the one of the pointerdown event that was just fired. ...
PointerEvent.pointerType - Web APIs
the pointertype read-only property of the pointerevent interface indicates the device type (mouse, pen, or touch) that caused a given pointer event. syntax var ptype = pointerevent.pointertype; return value ptype the event's pointer type. the supported values are the following strings: "mouse" the event was generated by a mouse device. "pen" the event was generated by a pen or stylus device. "touch" the event was generated by a touch, such as a finger. if the device type cannot be detected by the browser, the value can be an empty string (""). ...
...d values are the following strings: "mouse" the event was generated by a mouse device. "pen" the event was generated by a pen or stylus device. "touch" the event was generated by a touch, such as a finger. if the device type cannot be detected by the browser, the value can be an empty string (""). if the browser supports pointer device types other than those listed above, the value should be vendor-prefixed to avoid conflicting names for different types of devices. example this example illustrates using the value of the pointertype property to call the appropriate pointer type processing function. targetelement.addeventlistener('pointerdown', function(event) { // call the appropriate pointer type handler switch (event.pointertype) { case 'mouse': process_po...
PositionOptions - Web APIs
is able to provide a more accurate 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. ...
...ption (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 the device cannot use a cached position and must attempt to retrieve the real current position. if set to i...
PublicKeyCredentialCreationOptions.attestation - Web APIs
attestation is an optional property of the publickeycredentialcreationoptions dictionary. this is a string whose value indicates the preference regarding the attestation transport, between the authenticator, the client and the relying party. the attestation is a mean for the relying party to verify the origin of the authenticator with an attestation certificate authority. the information contained in the attestation may thus disclose some information about the user (e.g. which device they are using). syntax attestation = publickeycredentialcreationoptions.attestation value a string which may be "none": the relying party is not interested in this attestation. this avoids making a check with the attestation certificate authority and asking the user consent for sharing identifying infor...
...publickeycredentialcreationoptions.attestation value a string which may be "none": the relying party is not interested in this attestation. this avoids making a check with the attestation certificate authority and asking the user consent for sharing identifying information. "indirect": the client may change the assertion from the authenticator (for instance, using an anonymization ca). this value is used when the relying party wishes to verify the attestation. "direct": the relying party wants to receive the attestation as generated by the authenticator. the default value is "none". examples var publickey = { attestation: "indirect", challenge: new uint8array(26) /* this actually is given from the server */, rp: { name: "example corp", id : "login.example.com" }, u...
PublicKeyCredentialCreationOptions.excludeCredentials - Web APIs
excludecredentials, an optional property of the publickeycredentialcreationoptions dictionary, is an array whose elements are descriptors for the public keys already existing for a given user. this is provided by the relying party's server if it wants to prevent creation of new credentials for an existing user. syntax excludecredentials = publickeycredentialcreationoptions.excludecredentials value an array whose elements are objects with the following properties: type a string describing type of public-key credential to be created. as of this writing (march 2019), only "public-key" may be used. id a buffersource matching an existing public key credential identifier (publickeycredential.rawid). this identifier is generated during the creation of the publickeycredential instance. tra...
...edential to be created. as of this writing (march 2019), only "public-key" may be used. id a buffersource matching an existing public key credential identifier (publickeycredential.rawid). this identifier is generated during the creation of the publickeycredential instance. transports optional an array of strings describing the possible transports between the client and the authenticator. the value of the strings may be: "usb": the authenticator can be contacted via a removable usb link "nfc": the authenticator may be used over nfc (near field communication) "ble": the authenticator may be used over ble (bluetooth low energy) "internal": the authenticator is specifically bound to the client device (cannot be removed). if the authenticator already contains one of such a publi...
PublicKeyCredentialRequestOptions.allowCredentials - Web APIs
an array of credential descriptors. note: publickeycredentialcreationoptions.excludecredentials may be used during the creation of the credentials in order to avoid creating new credentials for an existing user with existing public key credential. contrary to allowcredentials, it is used to filter out credentials. syntax allowcredentials = publickeycredentialrequestoptions.allowcredentials value an array whose elements are objects with the following properties: type a string describing type of public-key credential to be created. as of this writing (march 2019), only "public-key" may be used. id a buffersource matching an existing public key credential identifier (publickeycredential.rawid). this identifier is generated during the creation of the publickeycredential instance. tra...
...edential to be created. as of this writing (march 2019), only "public-key" may be used. id a buffersource matching an existing public key credential identifier (publickeycredential.rawid). this identifier is generated during the creation of the publickeycredential instance. transports optional an array of strings describing the possible transports between the client and the authenticator. the value of the strings may be: "usb": the authenticator can be contacted via a removable usb link "nfc": the authenticator may be used over nfc (near field communication) "ble": the authenticator may be used over ble (bluetooth low energy) "internal": the authenticator is specifically bound to the client device (cannot be removed). if the authenticator does not contain any of these public...
PublicKeyCredentialRequestOptions.rpId - Web APIs
the rpid property, of the publickeycredentialrequestoptions dictionary, is an optional property which indicates the relying party's identifier as a usvstring. its value can only be a suffix of the current origin's domain. for example, if you are browsing on foo.example.com, the rpid value may be "example.com" but not "bar.org" or "baz.example.com". this property is optional. if it is not explicitely provided, the user agent will use the value of the current origin's domain. ...
... "example.com" but not "bar.org" or "baz.example.com". this property is optional. if it is not explicitely provided, the user agent will use the value of the current origin's domain. note: an analogous option exists for the creation operation (navigators.credentials.create()), see the id property of publickeycredentialcreationoptions.rp. syntax rpid = publickeycredentialrequestoptions.rpid value a usvstring for the identifier of the relying party. its value can only be a suffix of the current origin's domain. examples var options = { challenge: new uint8array([/* bytes sent from the server */]), rpid: "example.com" // will only work if the current domain // is something like foo.example.com }; navigator.credentials.get({ "publickey": options }) .then(fun...
PushManager.permissionState() - Web APIs
note: as of firefox 44, the permissions for notifications and push have been merged. if permission is granted for notifications, push will also be enabled. syntax pushmanager.permissionstate(options).then(function(pushmessagingstate) { ... }); parameters options optional an object containing optional configuration parameters. ...
...; parameters options optional an object containing optional configuration parameters. it can have the following properties: uservisibleonly: a boolean indicating that the returned push subscription will only be used for messages whose effect is made visible to the user. applicationserverkey: a public key your push server will use to send messages to client apps via a push server. this value is part of a signing key pair generated by your application server and usable with elliptic curve digital signature (ecdsa) over the p-256 curve. returns a promise that resolves to a domstring with a value of 'prompt', 'denied', or 'granted'. specifications specification status comment push apithe definition of 'permissionstate()' in that specification. workin...
RTCConfiguration.bundlePolicy - Web APIs
the rtcconfiguration dictionary's bundlepolicy property is a string value indicating which sdp bundling policy, if any, to use for the underlying rtp streams used by an rtcpeerconnection. the configuration object is used as an input to the rtcpeerconnection() constructor. syntax let rtcconfiguration = { bundlepolicy: policy }; rtcconfiguration.bundlepolicy = policy; value a domstring identifying the sdp bundling policy to use for the rtp streams used by the rtcpeerconnection. this string, which must be a member of the rtcbundlepolicy enumeration, has the following possible values: balanced the ice agent begins by creating one rtcdtlstransport to handle each type of content added: one for audio, one for video, and one for the rtc data channel, if applicable. if the remote peer isn'...
...ling but will fall back to not bundling if the remote peer can't handle it. max-bundle the ice agent starts by creating a single rtcdtlstransport to handle all of the connection's media. if the remote peer isn't bundle-compatible, only one media track is negotiated and the rest are ignored. this maximizes bundling at the risk of losing tracks if the remote peer can't do bundling. if any other value is specified, no configuration is specified when creating the rtcpeerconnection, or if the bundlepolicy property isn't included in the rtcconfiguration object specified when creating the connection, balanced is assumed. description the bundlepolicy configuration option for an rtcpeerconnection specifies how the ice agent should handle negotiation if the remote peer isn't compatible with the sdp...
RTCConfiguration.certificates - Web APIs
the rtcconfiguration dictionary's optional certificates property is an array of rtccertificate objects providing the security certificates available for use when authenticating duing the connection process. syntax let rtcconfiguration = { certificates: certificatelist }; let rtcconfiguration.certificates = [ cert1... ]; let certificates = rtcconfiguration.certificates; value an array of rtccertificate objects, each specifying one security certificate available for use when connecting to a remote peer. if this property isn't specified, the browser will automatically generate and use a certificate to secure the connection. see using certificates below for more information on why you might want to—or not to—explicitly provide certificates. description if this property isn't includ...
...s may simply choose the first listed certificate and ignore the rest of the list; others may take a different approach. using certificates when you wish to provide your own certificates for use by an rtcpeerconnection instead of having the rtcpeerconnection generate them automatically, you do so by calling the static rtcpeerconnection.generatecertificate() function. the certificates property's value cannot be changed once it's first specified. if it's included in the configuration passed into a call to a connection's setconfiguration(), it is ignored. this attribute supports providing multiple certificates because even though a given dtls connection uses only one certificate, providing multiple certificates allows support for multiple encryption algorithms. the implementation of rtcpeerconn...
RTCDTMFSender.insertDTMF() - Web APIs
ender.insertdtmf(tones[, duration[, intertonegap]]); parameters tones a domstring containing the dtmf codes to be transmitted to the recipient. specifying an empty string as the tones parameter clears the tone buffer, aborting any currently queued tones. a "," character inserts a two second delay. duration optional the amount of time, in milliseconds, that each dtmf tone should last. ...
... 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 the characters in tones is not valid dtmf. example tbd specifications specific...
RTCDataChannel.binaryType - Web APIs
the property binarytype on the rtcdatachannel interface is a domstring which specifies the type of javascript object which should be used to represent binary data received on the rtcdatachannel. values allowed by the websocket.binarytype property are also permitted here: "blob" if blob objects are being used or "arraybuffer" if arraybuffer objects are being used. the default is "blob". when a binary message is received on the data channel, the resulting message event's messageevent.data property is an object of the type specified by the binarytype. syntax var type = adatachannel.binarytype; adatachannel.binarytype = type; value a domstring that can have one of these values: "blob" received binary messages' contents will be contained in blob objects. "arraybuffer" received binar...
... "blob" received binary messages' contents will be contained in blob objects. "arraybuffer" received binary messages' contents will be contained in arraybuffer objects. example this code configures a data channel to receive binary data in arraybuffer objects, and establishes a listener for message events which constructs a string representing the received data as a list of hexadecimal byte values. var dc = peerconnection.createdatachannel("binary"); dc.binarytype = "arraybuffer"; dc.onmessage = function(event) { let bytearray = new uint8array(event.data); let hexstring = ""; bytearray.foreach(function(byte) { hexstring += byte.tostring(16) + " "; }); }; specifications specification status comment webrtc 1.0: real-time communication between br...
RTCDataChannel.bufferedAmountLowThreshold - Web APIs
the rtcdatachannel property bufferedamountlowthreshold is used to specify the number of bytes of buffered outgoing data that is considered "low." the default value is 0. when the number of buffered outgoing bytes, as indicated by the bufferedamount property, falls to or below this value, a bufferedamountlow event is fired. this event may be used, for example, to implement code which queues more messages to be sent whenever there's room to buffer them. listeners may be added with onbufferedamountlow or addeventlistener(). the user agent may implement the process of actually sending data in any way it chooses; this may be done periodically during the event loop or truly asynchronously. as messages are actually sent, this value is reduced accordingly. bufferedamountlow events are not fired a...
...he process of actually sending data in any way it chooses; this may be done periodically during the event loop or truly asynchronously. as messages are actually sent, this value is reduced accordingly. bufferedamountlow events are not fired after the data channel is closed. syntax var threshold = adatachannel.bufferedamountlowthreshold; adatachannel.bufferedamountlowthreshold = threshold; value the number of queued outgoing data bytes below which the buffer is considered to be "low." example in this snippet of code, bufferedamountlowthreshold is set to 64kb, and a handler for the bufferedamountlow event is established by setting the rtcdatachannel.onbufferedamountlow property to a function which should send more data into the buffer by calling send(). var dc = peerconnection.created...
RTCDataChannel: error event - Web APIs
error is an extension of the domexception interface. the error's name is rtcerror and the message is an error string specified by the webrtc layer. error information is output to the console using console.error(). the message string is always output, as is information about the source file's name, line number, and column number at which the error occurred. in addition, however, depending on the value of errordetail, additional information may be output. each error type has a different set of information output. for example, an sdp syntax error displays the line number of the error within the sdp, and an sctp error displays a message corresponding to the sctp cause code. other error types similarly output appropriate information. you can also set up an event handler for error events using the...
...ror within the sdp, and an sctp error displays a message corresponding to the sctp cause code. other error types similarly output appropriate information. you can also set up an event handler for error events using the rtcdatachannel interface's onerror event handler property: dc.onerror = ev => { const err = ev.error; /* ... */ } note: since rtcerror is not one of the legacy errors, the value of rtcerror.code is always 0. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'error event' in that specification. candidate recommendation initial specification. ...
RTCDataChannel.readyState - Web APIs
rtcdatachannelstate enum the rtcdatachannelstate enum defines string constants which reflect the current status of the rtcdatachannel's underlying data connection. ...
... rtcdatachannelstate enum the rtcdatachannelstate enum defines string constants which reflect the current status of the rtcdatachannel's underlying data connection. ...
RTCIceCandidate.address - Web APIs
the rtcicecandidate interface's read-only address property is a string providing the address of the device which is the source of the candidate. address is null by default if not otherwise specified. the address field's value is set when the rtcicecandidate() constructor is used. you can't specify the address in the options object, but the address is automatically extracted from the candidate a-line, if it's formatted properly. syntax var address = rtcicecandidate.address; value a domstring providing the ip address from which the candidate comes. note: if port is null — and port is supported by the user agent — passing the candidate to addicecandidate() will fail, throwing an operationerror exception. security notes it's important to note here that although webrtc does not requir...
...'s own ip address) are left out of the pool of candidates, as are any other candidates which aren't relay candidates. usage notes consider this sdp attribute line (a-line) which describes an ice candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the fifth field, "192.168.0.56" is the ip address in this candidate's a-line string. example this code snippet uses the value of address to implement an ip address based ban feature. if (ipbanlist.includes(candidate.address)) { rejectcandidate(candidate); } else { acceptcandidate(candidate); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate: address' in that specification. candidate recommendation ini...
RTCIceCandidate.candidate - Web APIs
the read-only property candidate on the rtcicecandidate interface returns a domstring describing the candidate in detail. most of the other properties of rtcicecandidate are actually extracted from this string. this property can be configured by specifying the value of the candidate property when constructing the new candidate object using rtcicecandidate(). syntax var candidate = rtcicecandidate.candidate; value a domstring describing the properties of the candidate, taken directly from the sdp attribute "candidate". the candidate string specifies the network connectivity information for the candidate. if the candidate is an empty string (""), the end of the candidate list has been reached; this candidate is known as the "end-of-candidates" marker. the syntax of the candidate string is ...
...the candidate. if the candidate is an empty string (""), the end of the candidate list has been reached; this candidate is known as the "end-of-candidates" marker. the syntax of the candidate string is described in rfc 5245, section 15.1. for an a-line (attribute line) that looks like this: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the corresponding candidate string's value will be "candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host". the user agent always prefers candidates with the highest priority, all else being equal. in the example above, the priority is 2043278322. the attributes are all separated by a single space character, and are in a specific order. the complete list of attributes for this example candidate is: foundation = 4234997325 ...
RTCIceCandidate.component - Web APIs
the read-only component property on the rtcicecandidate interface is a string which indicates whether the candidate is an rtp or an rtcp candidate. if a candidate represents both rtp and rtcp multiplexed together, it is reported as an rtp candidate. syntax var component = rtcicecandidate.component; value a domstring which is "rtp" for rtp (or rtp and rtcp multiplexed together) candidates or "rtcp" for rtcp candidates. ...
...tcicecandidate.component; value a domstring which is "rtp" for rtp (or rtp and rtcp multiplexed together) candidates or "rtcp" for rtcp candidates. usage notes consider this sdp attribute line (a-line): a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host this is an ice candidate a-line, whose foundation is 4234997325. the next field on the a-line, "1", is the component id. a value of "1" indicates rtp, which is recorded in the component property as "rtp". if this value were instead "2", the a-line would be describing an rtcp candidate, and compoment would be "rtcp". example this code snippet examines a candidate's component type and dispatches the candidate to different handlers depending on the value. if (candidate.component == "rtp") { handlertpcandidate(candidate);...
RTCIceCandidate.port - Web APIs
the rtcicecandidate interface's read-only port property contains the port number on the device at the address given by ip at which the candidate's peer can be reached. as is the case with most of rtcicecandidate's properties, the value of port is extracted from the candidate a-line string specified when creating the rtcicecandidate. the a-line string is obtained either from the rtcicecandidateinit property candidate or from a-line string passed into the constructor upon using new rtcicecandidate(). syntax var port = rtcicecandidate.port; value a 16-bit number indicating the port number on the device at the address indicated by ip at which the candidate's peer can be reached. port is initialized to null if it is not specified in the candidate, or if the candidate string can't be parsed pr...
...port is null, passing the candidate to addicecandidate() will fail, throwing an operationerror exception. this applies only if the candidate implements port. usage notes consider this sdp attribute line (a-line) which describes an ice candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the port number is found in the sixth field, which is "44323". in this case, the value of port will be 44323. example this code snippet fetches the ip address and port number of the candidate, storing them into an object for future use. var candidateloc = { address: candidate.ip, port: candidate.port } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.port' in that spe...
RTCIceCandidate.relatedAddress - Web APIs
the rtcicecandidate interface's read-only relatedaddress property is a string indicating the related address of a relay or reflexive candidate. if the candidate is a host candidate (that is, its ip is in fact the real ip address of the remote peer), relatedaddress is null. the relatedaddress field's value is set when the rtcicecandidate() constructor is used. you can't specify the value of relatedaddress in the options object, but the address is automatically extracted from the candidate a-line, if it's formatted properly, being taken from its rel-address field. the related address and port (relatedport) are not used at all by ice itself; they are provided for analysis and diagnostic purposes only, and their inclusion may be blocked by security systems, so do not rely on them having non-null...
...ess in the options object, but the address is automatically extracted from the candidate a-line, if it's formatted properly, being taken from its rel-address field. the related address and port (relatedport) are not used at all by ice itself; they are provided for analysis and diagnostic purposes only, and their inclusion may be blocked by security systems, so do not rely on them having non-null values. syntax var reladdress = rtcicecandidate.relatedaddress; value a domstring which contains the candidate's related address. for both peer and server reflexive candidates, the related address (and related port) are the base for that server or peer reflexive candidate. for relay candidates, the related address and port are set to the mapped address selected by the turn server. for host candida...
RTCIceCandidate.relatedPort - Web APIs
the rtcicecandidate interface's read-only relatedport property indicates the port number of reflexive or relay candidates. if the candidate is a host candidate (that is, its ip is in fact the real ip address of the remote peer), relatedport is null. the relatedport field's value is set when the rtcicecandidate() constructor is used. you can't specify the value of relatedport in the options object, but the address is automatically extracted from the candidate a-line, if it's formatted properly, being taken from its rel-port field. the related address (relatedaddress) and port are not used at all by ice itself; they are provided for analysis and diagnostic purposes only, and their inclusion may be blocked by security systems, so do not rely on them having non-null values. syntax var relport ...
...xtracted from the candidate a-line, if it's formatted properly, being taken from its rel-port field. the related address (relatedaddress) and port are not used at all by ice itself; they are provided for analysis and diagnostic purposes only, and their inclusion may be blocked by security systems, so do not rely on them having non-null values. syntax var relport = rtcicecandidate.relatedport; value an unsigned 16-bit value containing the candidate's related port number, if any. for both peer and server reflexive candidates, the related address and port describe the base for that candidate. for relay candidates, the related address and port provide the mapped address selected by the turn server. for host candidates, relatedport is null, meaning the field is not included in the candidate's ...
RTCIceCandidate.sdpMLineIndex - Web APIs
the read-only sdpmlineindex property on the rtcicecandidate interface is a zero-based index of the m-line describing the media associated with the candidate. this value is specified when creating the rtcicecandidate by setting the corresponding sdpmlineindex value in the rtcicecandidateinit object when creating a new candidate with new rtcicecandidate(). if you instead call rtcicecandidate() with a string parameter containing the candidate m-line text, the value of sdpmlineindex is extracted from the m-line. syntax var sdpmlineindex = rtcicecandidate.sdpmlineindex; value a number containing a 0-based index into the set of m-lines providing media descriptions, indicating which media source is associated with the candidate, or null if no such association is available. note: attempting to...
... example ... specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.sdpmlineindex' in that specification. candidate recommendation initial definition. ...
RTCIceCandidateInit - Web APIs
properties candidate optional the ice candidate-attribute. ...
...hich the candidate is associated, or null if no such associated exists. the default is null. usernamefragment optional a domstring containing a string which uniquely identifies the remote peer. this string is generated by webrtc at the beginning of the session, and at least 24 bits worth of the string contain random data. the string may be up to 256 characters long. this property has no default value and is not present unless set explicitly. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidateinit' in that specification. candidate recommendation initial definition. ...
RTCIceCandidatePairStats.firstRequestTimestamp - Web APIs
the rtcicecandidatepairstats property firstrequesttimestamp specifies the time at which the first stun request was sent on the described candidate pair. syntax firstrequesttimestamp = rtcicecandidatepairstats.firstrequesttimestamp; value a domhighrestimestamp object indicating the timestamp at which the first stun request was sent on the connection described by the described pair of candidates. ...
...airstats property firstrequesttimestamp specifies the time at which the first stun request was sent on the described candidate pair. syntax firstrequesttimestamp = rtcicecandidatepairstats.firstrequesttimestamp; value a domhighrestimestamp object indicating the timestamp at which the first stun request was sent on the connection described by the described pair of candidates. ...
RTCIceCandidatePairStats.lastRequestTimestamp - Web APIs
the rtcicecandidatepairstats property lastrequesttimestamp indicates the time at which the most recent stun request was sent on the described candidate pair. syntax lastrequesttimestamp = rtcicecandidatepairstats.lastrequesttimestamp; value a domhighrestimestamp object indicating the timestamp at which the last (most recent) stun request was sent on the connection indicated by the described pair of candidates. ...
...y lastrequesttimestamp indicates the time at which the most recent stun request was sent on the described candidate pair. syntax lastrequesttimestamp = rtcicecandidatepairstats.lastrequesttimestamp; value a domhighrestimestamp object indicating the timestamp at which the last (most recent) stun request was sent on the connection indicated by the described pair of candidates. ...
RTCIceCandidatePairStats.priority - Web APIs
the obsolete rtcicecandidatepairstats property priority reports the priority of the candidate pair as an integer value. the higher the value, the more likely the webrtc layer is to select the candidate pair when the time comes to establish (or re-establish) a connection between the two peers. syntax pairpriority = rtcicecandidatepairstats.priority; value an integer value indicating the priority of this pair of candidates as compared to other pairs on the same peer connection. the higher this value, the better the webrtc layer thinks this pair of candidates is compared to the others, and the more likely a pair is to be selelcted for use. note: this property was removed from the specification as its value cannot be guaranteed to be accurately represented in a javascript number. you can c...
...f candidates as compared to other pairs on the same peer connection. the higher this value, the better the webrtc layer thinks this pair of candidates is compared to the others, and the more likely a pair is to be selelcted for use. note: this property was removed from the specification as its value cannot be guaranteed to be accurately represented in a javascript number. you can calculcate its value using the algorithm described in rfc 5245, section 5.7.2 if you need this information and can accept the risk that the result may not be entirely accurate. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.priority' in that specification. candidate recommendation initial specification...
RTCIceCandidatePairStats.requestsSent - Web APIs
note: the reported number of requests does not include retransmissions. ...
... note: the reported number of requests does not include retransmissions. ...
RTCIceCandidatePairStats.selected - Web APIs
in any other browser, you can determine the selected candidate pair by looking for a stats object of type transport, which is an rtctransportstats object. ...
... in any other browser, you can determine the selected candidate pair by looking for a stats object of type transport, which is an rtctransportstats object. ...
RTCIceCandidateStats.deleted - Web APIs
the rtcicecandidatestats dictionary's deleted property indicates whether or not the candidate has been deleted or released. syntax isdeleted = rtcicecandidatestats.deleted; value a boolean value indicating whether or not the candidate has been deleted or released. if this value is true, the candidate described by the rtcicecandidatestats object is no longer under consideration. dthe exact meaning varies depending on the type of candidate: local candidate a value of true means the candidate has been deleted as described by rfc 5245: 8.3. ...
...ted; value a boolean value indicating whether or not the candidate has been deleted or released. if this value is true, the candidate described by the rtcicecandidatestats object is no longer under consideration. dthe exact meaning varies depending on the type of candidate: local candidate a value of true means the candidate has been deleted as described by rfc 5245: 8.3. host candidate a value of true indicates that the candidate's network resources have been released. this generally mean sthat any associated socket(s) have been closed and released. remote (turn) candidate a value of true means the candidate's turn allocation is no longer active. the net result is the same; the candidate is no longer under consideration if this value is true. example in this example, setinterval(...
RTCIceCandidateStats.networkType - Web APIs
onary's networktype property specifies the type of network used by a local candidate to communicate with a remote peer. note: the networktype property is only included in rtcicecandidatestats objects for local candidates (that is, candidates generated locally and included in an sdp offer or answer that has been sent to the remote peer). syntax networktype = rtcicecandidatestats.networktype; value a domstring whose value is taken from the rtcnetworktype enumerated type. the string indicates the type of network connection that the described candidate would use to communicate with the other peer. the permitted values are: bluetooth a bluetooth connection is used by the described connection. cellular the connection uses a cellular data service to connect. this includes all cellular da...
...e, which is not discernible. unknown the user's browser is unable or unwilling to identify the underlying connection technology used by the described connection. this may be because the browser isn't able to determine the network type for some reason or it may be intentionally getting obscured for security reasons, such as to avoid device fingerprinting. note: keep in mind that the specified value only reflects the initial connection between the local peer and the next hop along the network toward reaching the remote peer. for example, if the networktype is wifi but the user is connected using a cellular hotspot, the connection will be bottlenecked by the underlying cellular network (and any other networks between the two peers). example this example sets up a periodic function using se...
RTCIceCandidateStats.priority - Web APIs
the rtcicecandidatestats dictionary's priority property is a positive integer value indicating the priority (or desirability) of the described candidate. during ice negotiation while setting up a webrtc peer connection, the priority values reported to the remote peer by a user agent are used to determine which candidates are considered "more desirable". the higher the value, the more desirable the candidate is. syntax priority = rtcicecandidatestats.priority; value a positive integer indicating the priority of the rtcicecandidate described by the rtcicecandidatestats object. the value may be anywhere from 1 to 2,147,483,647. determining priority the ice specification describes how user agents and other software using webrtc should calculate the priority. the priority of a candidate is ca...
... specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatestats.port' in that specification. candidate recommendation initial specification. ...
RTCIceCandidateStats.protocol - Web APIs
the tcptype property provides additional information about the kind of tcp candidate represented by the object. udp the candidate will use the udp transport protocol for its data. ...
...the tcptype property provides additional information about the kind of tcp candidate represented by the object. udp the candidate will use the udp transport protocol for its data. ...
RTCIceRole - Web APIs
"controlled" the transport is the controlled agent. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicerole' in that specification. ...
... "controlled" the transport is the controlled agent. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicerole' in that specification. ...
RTCIceTransport.state - Web APIs
the read-only rtcicetransport property state returns the current state of the ice transport, so you can determine the state of ice gathering in which the ice agent currently is operating. this differs from the gatheringstate, which only indicates whether or not ice gathering is currently underway. syntax icestate = icetransport.state; value a domstring, whose value is one of those found in the enumerated type rtcicetransportstate, which indicates the stage of ice gathering that's currently underway. its value will be one of the following: "new" the rtcicetransport is currently gathering local candidates, or is waiting for the remote device to begin to transmit the remote candidates, or both. in this state, checking of candidates to look for those which might be acceptable has not yet...
...e remote peer that no more candidates will be sent. in addition, all candidate pairs have been considered and a pair has been selected for use. if consent checks fail on all successful candidate pairs, the transport state will change to "failed". "disconnected" the ice agent has determined that connectivity has been lost for this rtcicetransport. this is not a failure state (that's "failed"). a value of "disconnected" means that a transient issue has occurred that has broken the connection, but that should resolve itself automatically without your code having to take any action. see the disconnected state for additional details. "failed" the rtcicetransport has finished the gathering process, has received the "no more candidates" notification from the remote peer, and has finished checking ...
RTCIceTransportState - Web APIs
in this state, checking of candidates to look for those which might be acceptable has not yet begun. "checking" at least one remote candidate has been received, and the rtcicetransport has begun examining pairings of remote and local candidates in order to attempt to identify viable pairs that could be used to establish a connection. ...
...e remote peer that no more candidates will be sent. in addition, all candidate pairs have been considered and a pair has been selected for use. if consent checks fail on all successful candidate pairs, the transport state will change to "failed". "disconnected" the ice agent has determined that connectivity has been lost for this rtcicetransport. this is not a failure state (that's "failed"). a value of "disconnected" means that a transient issue has occurred that has broken the connection, but that should resolve itself automatically without your code having to take any action. see the disconnected state for additional details. "failed" the rtcicetransport has finished the gathering process, has received the "no more candidates" notification from the remote peer, and has finished checking ...
RTCInboundRtpStreamStats.fecPacketsReceived - Web APIs
ceived property of the rtcinboundrtpstreamstats dictionary indicates how many forward error correction (fec) packets have been received by this rtp receiver from the remote peer. an fec packet provides parity information which can be used to attempt to reconstruct rtp data packets which have been corrupted in transit. syntax var fecpacketsreceived = rtcinboundrtpstreamstats.fecpacketsreceived; value an unsigned integer value which indicates the total number of fec packets which have been recieved from the remote peer during this rtp session. forward error correction uses an exclusive-or method to perform parity checks on the received data. by using the fec parity information to attempt to reconstruct damaged packets, it is possible to avoid the need to retransmit damaged packets, which in ...
...ead of being used. this can happen if the packets covered by the fec packets have already been received successfully or have already been reconstructed using a previously-received fec packet. this may also happen if the fec packet arrives outside the window of time in which the client will attempt to use it. if you wish to know how many of the received packets were discarded, you can examine the value of fecpacketsdiscarded. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcinboundrtpstreamstats.fecpacketsreceived' in that specification. candidate recommendation initial definition. ...
RTCInboundRtpStreamStats.framesDecoded - Web APIs
this represents the number of frames that would have been displayed assuming no frames were skipped. ...
...this represents the number of frames that would have been displayed assuming no frames were skipped. ...
RTCInboundRtpStreamStats.packetsDuplicated - Web APIs
the packetsduplicated property of the rtcinboundrtpstreamstats dictionary indicates the total number of packets discarded because they were duplicates of previously-received packets. these packets are not counted by the packetsdiscarded property. syntax var packetsduplicated = rtcinboundrtpstreamstats.packetsduplicated; value an integer value which specifies how many duplcate packets have been received by the local end of this rtp stream so far. ...
...sduplicated; value an integer value which specifies how many duplcate packets have been received by the local end of this rtp stream so far. these duplicate packets are not included in the packetsdiscarded property. usage notes duplicate packets are detected when a packet has the same rtp sequence number as another packet that has previously been processed. each time a packet is repeated, the value of packetsduplicated is incremented, even if the same packet is received more than twice. you can get a more accurate tally of how many packets have been lost on the stream by adding packetsduplicated to packetslost. the resulting value will be positive, although it will not match the count as computed in rfc 3660. specifications specification status comment identifiers...
RTCInboundRtpStreamStats.perDscpPacketsReceived - Web APIs
the perdscppacketsreceived property of the rtcinboundrtpstreamstats dictionary is a record comprised of key/value pairs in which each key is a string representation of a differentiated services code point and the value is the number of packets received for that dcsp. note: not all operating systems make data available on a per-dscp basis, so this property shouldn't be relied upon on those systems. syntax var perdscppacketsreceived = rtcinboundrtpstreamstats.perdscppacketsreceived; value a record comprised of string/value pairs. each key is the string representation of a single differentiated services code point (dscp)'s id number. ...
...dn't be relied upon on those systems. syntax var perdscppacketsreceived = rtcinboundrtpstreamstats.perdscppacketsreceived; value a record comprised of string/value pairs. each key is the string representation of a single differentiated services code point (dscp)'s id number. note: due to network bleaching and remapping, the numbers seen on this record are not necessarily going to match the values as they were when the data was sent. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcinboundrtpstreamstats.perdscppacketsreceived' in that specification. candidate recommendation initial definition. ...
RTCOfferAnswerOptions.voiceActivityDetection - Web APIs
the voiceactivitydetection property of the rtcofferansweroptions dictionary is used to specify whether or not to use automatic voice detection for the audio on an rtcpeerconnection. the default value, true, indicates that voice detection should be used and that if possible, the user agent should automatically disable or mute outgoing audio when the audio source is not sensing a human voice. syntax var options = { voiceactivitydetection: trueorfalse }; value a boolean value indicating whether or not the connection should use voice detection once running. ...
...n. the default value, true, indicates that voice detection should be used and that if possible, the user agent should automatically disable or mute outgoing audio when the audio source is not sensing a human voice. syntax var options = { voiceactivitydetection: trueorfalse }; value a boolean value indicating whether or not the connection should use voice detection once running. the default value, true, indicates that the user agent should monitor the audio coming from the microphone or other audio source and automatically cease transmitting data or mute when the user isn't speaking into the microphone, a value of false indicates that the audio should continue to be transmitted regardless of whether or not speech is detected. ...
RTCOfferOptions.iceRestart - Web APIs
the icerestart property of the rtcofferoptions dictionary is a boolean value which, when true, tells the rtcpeerconnection to start ice renegotiation. note: rather than manually creating and submitting an offer with icerestart set to true, you should consider calling the rtcpeerconnection method restartice() instead. syntax var options = { icerestart: trueorfalse }; value a boolean value indicating whether or not the rtcpeerconnection should generate new values for the connection's ice-ufrag and ice-pwd values, which will trigger ice renegotiation on the next message sent to the remote peer. usage notes when the rtcpeerconnection object's ice connection state changes to failed, you should try to trigger an ice restart. you should ideally do this by calling the rtcpeerconnection's r...
...it watches for the ice connection state to transition to "failed", which indicates that an ice restart should be tried in order to attempt to bring the connection back up. ...
RTCOutboundRtpStreamStats.framesEncoded - Web APIs
note: this property is only valid for video streams. ...
... note: this property is only valid for video streams. ...
RTCPeerConnection.addTrack() - Web APIs
h the track should be added. the specified track doesn't necessarily have to already be part of any of the specified streams. instead, the streams are simply a way to group tracks together on the receiving end of the connection, making sure they are synchronized. any tracks that are added to the same stream on the local end of the connection will be on the same stream on the remote end. return value the rtcrtpsender object which will be used to transmit the media data. note: every rtcrtpsender is paired with an rtcrtpreceiver to make up an rtcrtptransceiver. the associated receiver is muted (indicating that it is not able to deliver packets) until and unless one or more streams are added to the receiver by the remote peer. exceptions invalidaccesserror the specified track (or all of...
...ia are met, the sender gets reused, which results in these changes occurring to the existing rtcrtpsender and its rtcrtptransceiver: the rtcrtpsender's track is set to the specified track. the sender's set of associated streams is set to the list of streams passed into this method, stream.... the associated rtcrtptransceiver has its currentdirection updated to include sending; if its current value is "recvonly", it becomes "sendrecv", and if its current value is "inactive", it becomes "sendonly". new senders if no existing sender exists that can be reused, a new one is created. this also results in the creation of the associated objects that must exist. the process of creating a new sender results in these changes: the new rtcrtpsender is created with the specified track and set of s...
RTCPeerConnection.canTrickleIceCandidates - Web APIs
r answer has already been sent to the other peer. this property is only set after having called rtcpeerconnection.setremotedescription(). ideally, your signaling protocol provides a way to detect trickling support, so that you don't need to rely on this property. a webrtc browser will always support trickle ice. if trickling isn't supported, or you aren't able to tell, you can check for a falsy value for this property and then wait until the value of icegatheringstate changes to "completed" before creating and sending the initial offer. that way, the offer contains all of the candidates. syntax var cantrickle = rtcpeerconnection.cantrickleicecandidates; value a boolean that is true if the remote peer can accept trickled ice candidates and false if it cannot. if no remote peer has been es...
...ty and then wait until the value of icegatheringstate changes to "completed" before creating and sending the initial offer. that way, the offer contains all of the candidates. syntax var cantrickle = rtcpeerconnection.cantrickleicecandidates; value a boolean that is true if the remote peer can accept trickled ice candidates and false if it cannot. if no remote peer has been established, this value is null. note: this property's value is determined once the local peer has called rtcpeerconnection.setremotedescription(); the provided description is used by the ice agent to determine whether or not the remote peer supports trickled ice candidates. example var pc = new rtcpeerconnection(); // the following code might be used to handle an offer from a peer when // it isn't known whether it...
RTCPeerConnection.connectionState - Web APIs
the read-only connectionstate property of the rtcpeerconnection interface indicates the current state of the peer connection by returning one of the string values specified by the enum rtcpeerconnectionstate. when this property's value changes, a connectionstatechange event is sent to the rtcpeerconnection instance. syntax var connectionstate = rtcpeerconnection.connectionstate; value the current state of the connection, as a value from the enum rtcpeerconnectionstate. rtcpeerconnectionstate enum the rtcpeerconnectionstate enum defines string constants which describe states in which the rtcpeerconnection may be. these values are returned by the connectionstate property. this state essentially represents the aggregate state of all ice transports (which are of type rtcicetransport or rtcd...
...er "connected" or "completed". "disconnected" at least one of the ice transports for the connection is in the "disconnected" state and none of the other transports are in the state "failed", "connecting", or "checking". "failed" one or more of the ice transports on the connection is in the "failed" state. "closed" the rtcpeerconnection is closed. this value was in the rtcsignalingstate enum (and therefore found by reading the value of the signalingstate) property until the may 13, 2016 draft of the specification. example var pc = new rtcpeerconnection(configuration); /* ... */ var connectionstate = pc.connectionstate; specifications specification status comment webrtc 1.0: real-time communication between b...
RTCPeerConnection.createAnswer() - Web APIs
ingle domexception object explaining why the request to create an answer failed. options optional an optional rtcofferoptions object providing options requested for the answer. exceptions notreadableerror the identity provider wasn't able to provide an identity assertion. operationerror generation of the sdp failed for some reason; this is a general failure catch-all exception. return value a promise whose fulfillment handler is called with an object conforming to the rtcsessiondescriptioninit dictionary which contains the sdp answer to be delivered to the other peer. example here is a segment of code taken from the code that goes with the article signaling and video calling. this code comes from the handler for the message sent to carry an offer to another peer across the signal...
...h the article signaling and video calling. this code comes from the handler for the message sent to carry an offer to another peer across the signaling channel. keep in mind that this is part of the signaling process, the transport layer for which is an implementation detail that's entirely up to you. in this case, a websocket connection is used to send a json message with a type field with the value "video-answer" to the other peer, carrying the answer to the device which sent the offer to connect. the contents of the object being passed to the sendtoserver() function, along with everything else in the promise fulfillment handler, depend entirely on your design pc.createanswer().then(function(answer) { return pc.setlocaldescription(answer); }) .then(function() { // send the answer to t...
RTCPeerConnection.currentLocalDescription - Web APIs
e the rtcpeerconnection finished negotiating and connecting to a remote peer. also included is a list of any ice candidates that may already have been generated by the ice agent since the offer or answer represented by the description was first instantiated. ...
... by the description was first instantiated. to change the currentlocaldescription, call rtcpeerconnection.setlocaldescription(), which triggers a series of events which leads to this value being set. for details on what exactly happens and why the change isn't necessarily instantaneous, see pending and current descriptions in webrtc connectivity. unlike rtcpeerconnection.localdescription, this value represents the actual current state of the local end of the connection; localdescription may specify a description which the connection is currently in the process of switching over to. syntax sessiondescription = rtcpeerconnection.currentlocaldescription; return value the current description of the local end of the connection, if one has been set. if none has been successfully set, this val...
RTCPeerConnection.getConfiguration() - Web APIs
via setconfiguration(), or if setconfiguration() hasn't been called, the configuration the rtcpeerconnection was constructed with. the configuration includes a list of the ice servers used by the connection, information about transport policies, and identity information. syntax var configuration = rtcpeerconnection.getconfiguration(); 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. let configuration = mypeerconnection.getconfiguration(); if ((configuration.certificates != undefined) && (!configuration.certificates.length)) { rtcpeerconnection.generatecertificate({ name: '...
... 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 connectio...
RTCPeerConnection: icegatheringstatechange event - Web APIs
the icegatheringstatechange event is sent to the onicegatheringstatechange event handler on an rtcpeerconnection when the state of the ice candidate gathering process changes. this signifies that the value of the connection's icegatheringstate property has changed. when ice firststarts to gather connection candidates, the value changes from new to gathering to indicate that the process of collecting candidate configurations for the connection has begun. when the value changes to complete, all of the transports that make up the rtcpeerconnection have finished gathering ice candidates. bubbles no cancelable no interface event event handler onicegatheringstatechange note: while you can determine that ice candidate gathering is complete by ...
...alue changes to complete, all of the transports that make up the rtcpeerconnection have finished gathering ice candidates. bubbles no cancelable no interface event event handler onicegatheringstatechange note: while you can determine that ice candidate gathering is complete by watching for icegatheringstatechange events and checking for the value of icegatheringstate to become complete, you can also simply have your handler for the icecandidate event look to see if its candidate property is null. this also indicates that collection of candidates is finished. examples this example creates a handler for icegatheringstatechange events. pc.onicegatheringstatechange = ev => { let connection = ev.target; switch(connection.icegatherings...
RTCPeerConnection.onicegatheringstatechange - Web APIs
he icegatheringstatechange event is sent to an rtcpeerconnection instance. this happens when the ice gathering state—that is, whether or not the ice agent is actively gathering candidates—changes. you don't need to watch for this event unless you have specific reasons to want to closely monitor the state of ice gathering. ...
...nges. you don't need to watch for this event unless you have specific reasons to want to closely monitor the state of ice gathering. syntax rtcpeerconnection.onicegatheringstatechange = eventhandler; value a function you provide which is passed a single parameter: an event object containing the icegatheringstatechange event. you can determine the new state of ice gathering by looking at the value of the rtcpeerconnection.icegatheringstate property. example this example updates status information presented to the user to let them know what's happening by examining the current value of the icegatheringstate property each time it changes and changing the contents of a status display based on the new information. the status is simply presented as text in a <div> element: <div id="icestatu...
RTCPeerConnection.setRemoteDescription() - Web APIs
take effect. instead, the current connection configuration remains in place until negotiation is complete. only then does the agreed-upon configuration take effect. syntax apromise = rtcpeerconnection.setremotedescription(sessiondescription); parameters sessiondescription an rtcsessiondescriptioninit or rtcsessiondescription which specifies the remote peer's current offer or answer. this value is an offer or answer received from the remote peer through your implementation of the sessiondescription parameter is technically of type rtcsessiondescriptioninit, but because rtcsessiondescription serializes to be indistinguishable from rtcsessiondescriptioninit, you can also pass in an rtcsessiondescription. this lets you simplify code such as the following: mypeerconnection.setremotedesc...
...ion)) .then(function () { return createmystream(); }) to simply be: mypeerconnection.setremotedescription(description) .then(function () { return createmystream(); }) using async/await syntax, you can further simplify this to: await mypeerconnection.setremotedescription(description); createmystream(); since it's unnecessary, the rtcsessiondescription() constructor is deprecated. return value a promise which is fulfilled once the value of the connection's remotedescription is successfully changed or rejected if the change cannot be applied (for example, if the specified description is incompatible with one or both of the peers on the connection). the promise fulfillment handler receives no input parameters. note: the process of changing descriptions actually involves intermediary s...
RTCPeerConnectionIceErrorEvent.address - Web APIs
the rtcpeerconnectioniceerrorevent property address is a string which indicates the local ip address being used to communicate with the stun or turn server during negotiations. the error which occurred involved this address. syntax let address = rtcpeerconnectioniceerrorevent.address; value a domstring which specifies the local ip address of the network connection to the ice server with which negotiations were occurring when the error occurred. this address identifies the network interface on the local device which is being used to attempt to establish the connection to the remote peer. this can be useful on multi-homed systems—devices with more than one network connection—to determine which network interface is being used. for example, on a mobile phone, there are typically at least ...
...lish the connection to the remote peer. this can be useful on multi-homed systems—devices with more than one network connection—to determine which network interface is being used. for example, on a mobile phone, there are typically at least two network interfaces available: the cellular connection and a wifi connection. if the local ip address isn't exposed as part of a local candidate, the value of address is null. examples this example creates a handler for icecandidateerror events which creates human readable messages describing the local network interface for the connection as well as the ice server that was being used to try to open the connection, then calls a function to display those as well as the event's errortext property's contents. pc.addeventlistener("icecandidateerror", ...
RTCPeerConnectionIceErrorEvent - Web APIs
rrorevent interface includes the properties found on the event interface, as well as the following properties: address read only a domstring providing the local ip address used to communicate with the stun or turn server being used to negotiate the connection, or null if the local ip address has not yet been exposed as part of a local ice candidate. errorcode read only an unsigned integer value stating the numeric stun error code returned by the stun or turn server. if no host candidate can reach the server, this property is set to the number 701, which is outside the range of valid stun error codes. the 701 error is fired only once per server url, and only while the is icegatheringstate is gathering. errortext read only a domstring containing the stun reason text returned by the stu...
...r codes. the 701 error is fired only once per server url, and only while the is icegatheringstate is gathering. errortext read only a domstring containing the stun reason text returned by the stun or turn server. if communication with the stun or turn server couldn't be established at all, this string will be a browser-specific string explaining the error. port read only an unsigned integer value giving the port number over which communication with the stun or turn server is taking place, using the ip address given in address. null if the connection hasn't been established (that is, if address is null). url read only a domstring indicating the url of the stun or turn server with which the error occurred. methods rtcpeerconnectioniceerrorevent has no methods other than any provided b...
RTCPeerConnectionIceEvent() - Web APIs
one or more of the following fields: "candidate" (optional, default is null): a rtcicecandidate representing the ice candidate being concerned by the event. if null, the event indicates the end of candidate gathering. "url" (optional, default is null): the url of the stun or turn server which was used to gather the candidate. ...
...d to gather the candidate. if the candidate was not gathered by a stun or turn server, this value must be null. "bubbles" (optional, default is false): inherited from eventinit(), this boolean option indicates whether or not the event must bubble. "cancelable" (optional, default is false, inherited from eventinit(), this boolean indicates whether or not the event can be canceled. return value a newly-created rtcpeerconnectioniceevent, configured as specified in the provided options. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnectioniceevent()' in that specification. candidate recommendation initial definition. ...
RTCRtpCapabilities - Web APIs
codeccapability. each of these objects describes a single codec and its basic capabilities. its properties are: the browser will only report distinct capability combinations separately. if two sets of capabilities can be described as one, they will be. that means that, for instance, if there are two entries for the h.264 codec (as identified by the mimetype being "video/h264"), there are other values in the capabilities objects indicating how they're different in some way. the mime type strings used by rtp differ from those used elsewhere. see rfc 3555, section 4 for the complete iana registry of these types. there are three special entries that should always be present, representing underlying components of the transport. those components are: red (redundant audio data) the media ty...
...eo/fwdred. the base red standard can be found in rfc 2198. there may be multiple entries for red if different forms are supported; each will have a unique media type in that case. fec (forward error correction) an fec component handles error correction data; its media type may also vary due to there being advanced versions of the standard available, but it will always end with fec. one possible value is video/ulpfec (a generic error connection model). there may also be multiple fec entries if more than one form is supported. rtx (retransmission) this component is responsible for retransmission of data; it's media type should be video/rtx. there will only be one entry for rtx, and it will not have an sdpfmtpline property. don't be surprised to see these show up ijn the list; be prepared to...
RTCRtpCodecCapability - Web APIs
clockrate an unsigned long integer specifying the codec's clock rate in hertz (hz). the iana maintains a list of codecs and their parameters, including their clock rates. mimetype a domstring indicating the codec's mime media type and subtype. ...
... clockrate an unsigned long integer specifying the codec's clock rate in hertz (hz). the iana maintains a list of codecs and their parameters, including their clock rates. mimetype a domstring indicating the codec's mime media type and subtype. ...
RTCRtpContributingSource - Web APIs
the rtcrtpcontributingsource dictionary of the the webrtc api is used by getcontributingsources() to provide information about a given contributing source (csrc), including the most recent time a packet that the source contributed was played out. the information provided is based on the last ten seconds of media received. ...
...he source contributed was played out. the information provided is based on the last ten seconds of media received. properties audiolevel optional a double-precision floating-point value between 0 and 1 specifying the audio level contained in the last rtp packet played from this source. rtptimestamp optional the rtp timestamp of the media played out at the time indicated by timestamp. this value is a source-generated time value which can be used to help with sequencing and synchronization. source optional a 32-bit unsigned integer value specifying the csrc identifier of the contributing source. timestamp optional a domhighrestimestamp indicating the most recent time at which a frame originating from this source was delivered to the receiver's mediastreamtrack specifications ...
RTCRtpEncodingParameters.maxBitrate - Web APIs
the rtcrtpencodingparameters dictionary's maxbitrate property specifies the maximum number of bits per second to allow a track encoded with this encoding to use. syntax rtpencodingparameters.maxbitrate = maxbitspersecond; rtpencodingparameters = { maxbitrate: maxbitspersecond }; maxbitspersecond = rtpencodingparameters.maxbitrate; value an unsigned long integer value specifying the maximum bandwidth this encoding is permitted to use for a track of media it encodes in terms of bits per second. other parameters may further reduce the bandwidth used by the track; for example, maxframerate will, if set low enough, constrain the bandwidth as well. in addition, there's no guarantee that the network interface can support the specified bandwidth, in which case the actual bandwidth will be lo...
...s encoding is permitted to use for a track of media it encodes in terms of bits per second. other parameters may further reduce the bandwidth used by the track; for example, maxframerate will, if set low enough, constrain the bandwidth as well. in addition, there's no guarantee that the network interface can support the specified bandwidth, in which case the actual bandwidth will be lower. this value is computed using the standard transport independent application specific maximum (tias) bandwidth as defined by rfc 3890, section 6.2.2; this is the maximum bandwidth needed without considering protocol overheads from ip, tcp or udp, and so forth. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpenc...
RTCRtpSendParameters - Web APIs
ctionary is used to specify the parameters for an rtcrtpsender when calling its setparameters() method. properties in addition to the properties below, rtcrtpsendparameters inherits the properties from the rtcrtpparameters interface. degradationpreference specifies the preferred way the webrtc layer should handle optimizing bandwidth against quality in constrained-bandwidth situations; the value comes from the rtcdegradationpreference enumerated string type, and the default is balanced. encodings an array of rtcrtpencodingparameters objects, each specifying the parameters for a single codec that could be used to encode the track's media. priority a string from the rtcprioritytype enumerated type which indicates the encoding's priority. the default value is low. transactionid a stri...
...e default is balanced. encodings an array of rtcrtpencodingparameters objects, each specifying the parameters for a single codec that could be used to encode the track's media. priority a string from the rtcprioritytype enumerated type which indicates the encoding's priority. the default value is low. transactionid a string containing a unique id for the last set of parameters applied; this value is used to ensure that setparameters() can only be called to alter changes made by a specific previous call to getparameters(). specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpsendparameters' in that specification. candidate recommendation initial definition. ...
RTCRtpStreamStats.pliCount - Web APIs
the plicount property of the rtcrtpstreamstats dictionary states the number of times the stream's receiving end sent a picture loss indication (pli) packet to the sender. a pli packet indicates that some amount of encoded video data has been lost for one or more frames. syntax var plicount = rtcrtpstreamstats.plicount; value an integer value indicating the number of times a pli packet was sent by the stream's receiver to the sender. a pli message is used by video decoders (running on the receiving end of the stream) to notify the encoder (the sender) that an undefined amount of coded video data, which may span frame boundaries, has been lost. this may trigger the sender to send a full frame in order to allow the receiver to re-synchronize, since lost data may be an irrecoverable situatio...
...ow the receiver to re-synchronize, since lost data may be an irrecoverable situation for decoding media. however, the primary purpose of this message is to allow the sender to consider techniques to mitigate network performance issues. this is often achieved by methods such as increasing the compression, lowering resolution, or finding other ways to reduce the bit rate of the stream. note: this value is only available on the receiver, and only for video media. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcinboundrtpstreamstats: plicount' in that specification. candidate recommendation initial definition. identifiers for webrtc's statistics apithe definition of 'rtcoutboundrtpstreamstats: plico...
RTCRtpTransceiver.currentDirection - Web APIs
the read-only rtcrtptransceiver property currentdirection is a string which indicates the current directionality of the transceiver. its value is one of the strings defined by the rtcrtptransceiverdirection enumeration. you can examine and set the transceiver's preferred directionality using direction property. syntax var direction = rtcrtptransceiver.currentdirection value a domstring whose value is one of the strings which are a member of the rtcrtptransceiverdirection enumerated type. the rtcrtptransceiverdirection type is an enumeration of string values. ...
... offers to receive rtp data, and does so if the other peer accepts. ...
RTCSessionDescription.type - Web APIs
"answer", the description is the definitive choice in an offer/answer exchange. "pranswer", the description is a provisional answer and may be changed when the definitive choice will be given. "rollback", the description rolls back to offer/answer state to the last stable state. ...
... "answer", the description is the definitive choice in an offer/answer exchange. "pranswer", the description is a provisional answer and may be changed when the definitive choice will be given. "rollback", the description rolls back to offer/answer state to the last stable state. ...
RTCSessionDescription - Web APIs
iption.type read only an enum of type rtcsdptype describing the session description's type. rtcsessiondescription.sdp read only a domstring containing the sdp describing the session. constants rtcsdptype this enum defines strings that describe the current state of the session description, as used in the type property. the session description's type will be specified using one of these values. value description answer the sdp contained in the sdp property is the definitive choice in the exchange. in other words, this session description describes the agreed-upon configuration, and is being sent to finalize negotiation. offer the session description object describes the initial proposal in an offer/answer exchange. the session negotiation proce...
...nswer. it is usually employed by legacy hardware. rollback this special type with an empty session description is used to roll back to the previous stable state. methods the rtcsessiondescription doesn't inherit any methods. rtcsessiondescription() this constructor returns a new rtcsessiondescription. the parameter is a rtcsessiondescriptioninit dictionary containing the values to assign the two properties. rtcsessiondescription.tojson() returns a json description of the object. the values of both properties, type and sdp, are contained in the generated json. example signalingchannel.onmessage = function (evt) { if (!pc) start(false); var message = json.parse(evt.data); if (message.sdp) pc.setremotedescription(new rtcsessiondescriptio...
RTCStats.type - Web APIs
Web › API › RTCStats › type
the string comes from the rtcstatstype enum and corrsponds to one of the rtcstats-based statistic object types. ...
...the string comes from the rtcstatstype enum and corrsponds to one of the rtcstats-based statistic object types. ...
RTCStatsIceCandidatePairState - Web APIs
a failure can occur either because no response was received or because the response indicated that an unrecoverable error occurred. frozen no check has been performed yet for this candidate pair, and performing the check is blocked until another check is successful. ...
...a failure can occur either because no response was received or because the response indicated that an unrecoverable error occurred. frozen no check has been performed yet for this candidate pair, and performing the check is blocked until another check is successful. ...
RTCStatsReport - Web APIs
e (csrc) that contributed to an inbound rtp stream. data-channel an rtcdatachannelstats object which contains statistics about each rtcdatachannel on the connection. inbound-rtp an rtcinboundrtpstreamstats object providing statistics about inbound data being received from remote peers. since this only provides statistics related to inbound data, without considering the local peer's state, any values that require knowledge of both, such as round-trip time, is not included. this report isn't available if there are no connected peers. local-candidate an rtcicecandidatestats object giving statistics about an ice local candidate; these candidates are found in the output from rtcicetransport.getlocalcandidates(). outbound-rtp the report is an rtcoutboundrtpstreamstats object providing statist...
...found in the output from rtcicetransport.getlocalcandidates(). outbound-rtp the report is an rtcoutboundrtpstreamstats object providing statistics based on the local peer's outgoing data being sent to its peers. this information considers only the outbound rtp stream, so any data which requires information about the state of the remote peers (such as round-trip time) is unavailable, since those values can't be computed without knowing about the other peers' states. peer-connection a rtcpeerconnectionstats object provides statistics related to the overall peer connection's rtcpeerconnection. receiver provides statistics about a specific rtcrtpreceiver. the statistics object is an rtcaudioreceiverstats object if kind is audio; if kind is video, the object is an rtcvideoreceiverstats object.
Range.compareBoundaryPoints() - Web APIs
parameters how a constant describing the comparison method: range.end_to_end compares the end boundary-point of sourcerange to the end boundary-point of range. ...
... boundary-point of sourcerange to the end boundary-point of range. range.end_to_start compares the end boundary-point of sourcerange to the start boundary-point of range. range.start_to_end compares the start boundary-point of sourcerange to the end boundary-point of range. range.start_to_start compares the start boundary-point of sourcerange to the start boundary-point of range. if the value of the parameter is invalid, a domexception with a notsupportederror code is thrown. sourcerange a range to compare boundary points with the range. example var range, sourcerange, compare; range = document.createrange(); range.selectnode(document.getelementsbytagname("div")[0]); sourcerange = document.createrange(); sourcerange.selectnode(document.getelementsbytagname("div")[1]); compare ...
Range.comparePoint() - Web APIs
the range.comparepoint() method returns -1, 0, or 1 depending on whether the referencenode is before, the same as, or after the range. if the reference node is a node of type text, comment, or cdatasection, then offset is the number of characters from the start of reference node. for other node types, offset is the number of child nodes between the start of the reference node. ...
...f child nodes between the start of the reference node. syntax returnvalue = range.comparepoint(referencenode, offset) parameters referencenode the node to compare with the range. offset an integer greater than or equal to zero representing the offset inside the referencenode. example range = document.createrange(); range.selectnode(document.getelementsbytagname('div').item(0)); returnvalue = range.comparepoint(document.getelementsbytagname('p').item(0), 1); specification specification status comment domthe definition of 'range.comparepoint()' in that specification. living standard initial specification. ...
ReadableStream.cancel() - Web APIs
re are chunks enqueued waiting to be read. that data is lost after cancel is called, and the stream is not readable any more. to read those chunks still and not completely get rid of the stream, you'd use readablestreamdefaultcontroller.close(). syntax var promise = readablestream.cancel(reason); parameters reason a domstring providing a human-readable reason for the cancellation. return value a promise, which fulfills with the value given in the reason parameter. exceptions typeerror the stream you are trying to cancel is not a readablestream, or it is locked. examples in jake archibald's cancelling a fetch example, a stream is used to fetch the whatwg html spec chunk by chunk; each chunk is searched for the string "service workers". when the search terms is found, cancel() i...
...nse.body.getreader(); var tomatch = caseinsensitive ? searchterm.tolowercase() : searchterm; var buffersize = math.max(tomatch.length - 1, contextbefore); var bytesreceived = 0; var buffer = ''; var matchfoundat = -1; return reader.read().then(function process(result) { if (result.done) { console.log('failed to find match'); return; } bytesreceived += result.value.length; console.log(`received ${bytesreceived} bytes of data so far`); buffer += decoder.decode(result.value, {stream: true}); // already found match & just context-gathering? if (matchfoundat === -1) { matchfoundat = (caseinsensitive ? buffer.tolowercase() : buffer).indexof(tomatch); } if (matchfoundat === -1) { buffer = buffer.slice(-buffersize); } ...
Request() - Web APIs
Web › API › Request › Request
ontaining the direct url of the resource you want to fetch. a request object, effectively creating a copy. note the following behavioural updates to retain security while making the constructor less likely to throw exceptions: if this object exists on another origin to the constructor call, the request.referrer is stripped out. if this object has a request.mode of navigate, the mode value is converted to same-origin. init optional an options object containing any custom settings that you want to apply to the request. the possible options are: method: the request method, e.g., get, post. the default is get. headers: any headers you want to add to your request, contained within a headers object or an object literal with bytestring values. body: any body that you...
... request credentials you want to use for the request: omit, same-origin, or include. the default is same-origin. cache: the cache mode you want to use for the request. redirect: the redirect mode to use: follow, error, or manual. the default is follow. referrer: a usvstring specifying no-referrer, client, or a url. the default is about:client. integrity: contains the subresource integrity value of the request (e.g., sha256-bpfbw7ivv8q2jlit13fxdyae2tjllusrsz273h2nfse=). errors type description typeerror since firefox 43, request() will throw a typeerror if the url has credentials, such as http://user:password@example.com. example in our fetch request example (see fetch request live) we create a new request object using the constructor, then fetc...
Request.destination - Web APIs
the destination is used by the user agent to, for example, help determine which set of rules to follow for cors purposes, or how to navigate any complicated code paths that affect how specific types of request get handled. these destinations vary substantially in how they operate. ...
...ter. others are script-based, in which case the received data is delivered to a script by calling it and passing the data along. script-based destinations include <script> elements, as well as any of the worklet-based destinations (including audioworklet and paintworklet), and the worker-based destinations, including serviceworker and sharedworker. syntax var destination = request.destination; value a string from the requestdestination enumerated type which indicates the type of content the request is asking for. this type is much broader than the usual document type values (such as "document" or "manifest"), and may include contextual cues such as "image" or "worker" or "audioworklet". example in the following snippet, we create a new request using the request() constructor (for an image...
Request - Web APIs
Web › API › Request
(e.g., omit, same-origin, include). the default is same-origin. request.destination read only returns a string from the requestdestination enum describing the request's destination. this is a string indicating the type of content being requested. request.headers read only contains the associated headers object of the request. request.integrity read only contains the subresource integrity value of the request (e.g., sha256-bpfbw7ivv8q2jlit13fxdyae2tjllusrsz273h2nfse=). request.method read only contains the request's method (get, post, etc.) request.mode read only contains the mode of the request (e.g., cors, no-cors, same-origin, navigate.) request.redirect read only contains the mode for how redirects are handled. it may be one of follow, error, or manual. request.referrer re...
...y. body.text() returns a promise that resolves with an usvstring (text) representation of the request body. note: the body functions can be run only once; subsequent calls will resolve with empty strings/arraybuffers. ...
ResizeObserver - Web APIs
sizeobserver.disconnect() unobserves all observed element targets of a particular observer. resizeobserver.observe() initiates the observing of a specified element. resizeobserver.unobserve() ends the observing of a specified element. examples in the resize-observer-text.html (see source) example, we use the resize observer to change the font-size of a header and paragraph as a slider’s value is changed causing the containing <div> to change width. this shows that you can respond to changes in an element’s size, even if they have nothing to do with the viewport. we also provide a checkbox to turn the observer off and on. if it is turned off, the text will not change in response to the <div>'s width changing. the javascript looks like so: const h1elem = document.queryselector('h1'...
...ascript looks like so: const h1elem = document.queryselector('h1'); const pelem = document.queryselector('p'); const divelem = document.queryselector('body > div'); const slider = document.queryselector('input[type="range"]'); const checkbox = document.queryselector('input[type="checkbox"]'); divelem.style.width = '600px'; slider.addeventlistener('input', () => { divelem.style.width = slider.value + 'px'; }) const resizeobserver = new resizeobserver(entries => { for (const entry of entries) { if (entry.contentboxsize) { h1elem.style.fontsize = math.max(1.5, entry.contentboxsize.inlinesize / 200) + 'rem'; pelem.style.fontsize = math.max(1, entry.contentboxsize.inlinesize / 600) + 'rem'; } else { h1elem.style.fontsize = math.max(1.5, entry.contentrect.width / 200...
ResizeObserverEntry.target - Web APIs
examples the following snippet is taken from the resize-observer-border-radius.html (see source) example. this example includes a green box, sized as a percentage of the viewport size. ...
...ewport size. when the viewport size is changed, the box's rounded corners change in proportion to the size of the box. we could just implement this using border-radius with a percentage, but that quickly leads to ugly-looking elliptical corners; this solution gives you nice square corners that scale with the box size. to grab a reference to the observed element so we can update its border-radius value after each change, we make use of the target property of each entry — entry.target.style.borderradius. const resizeobserver = new resizeobserver(entries => { for (let entry of entries) { if(entry.contentboxsize) { entry.target.style.borderradius = math.min(100, (entry.contentboxsize.inlinesize/10) + (entry.contentboxsize.blocks...
Response() - Web APIs
Web › API › Response › Response
the response() constructor creates a new response object. syntax var myresponse = new response(body, init); parameters body optional an object defining a body for the response. this can be null (which is the default value), or one of: blob buffersource formdata readablestream urlsearchparams usvstring init optional an options object containing any custom settings that you want to apply to the response, or an empty object (which is the default value). the possible options are: status: the status code for the reponse, e.g., 200. ...
...ining any custom settings that you want to apply to the response, or an empty object (which is the default value). the possible options are: status: the status code for the reponse, e.g., 200. statustext: the status message associated with the status code, e.g., ok. headers: any headers you want to add to your response, contained within a headers object or object literal of bytestring key/value pairs (see http headers for a reference). examples in our fetch response example (see fetch response live) we create a new response object using the constructor, passing it a new blob as a body, and an init object containing a custom status and statustext: var myblob = new blob(); var init = { "status" : 200 , "statustext" : "supersmashinggreat!" }; var myresponse = new response(myblob,in...
SVGAnimatedEnumeration - Web APIs
svg animated enumeration interface the svganimatedenumeration interface is used for attributes whose value must be a constant from a particular enumeration and which can be animated. interface overview also implement none methods none properties unsigned short baseval readonly unsigned short animval normative document svg 1.1 (2nd edition) properties name type description baseval unsigned short the base value of the given attribute before applying any animations. animval unsigned short if the given attribute or property is being animated, contains the current animated value of the attribute or property. if the given attribute or property is not currently being an...
... methods the svganimatedenumeration interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. ...
SVGAnimatedPoints - Web APIs
additionally, the points attribute on the original element accessed via the xml dom (e.g., using the getattribute() method call) will reflect any changes made to the svganimatedpoints.points attribut. ...
...t svg 1.1 (2nd edition) properties name type description points svgpointlist provides access to the base (i.e., static) contents of the points attribute. animatedpoints svgpointlist provides access to the current animated contents of the points attribute. if the given attribute or property is being animated, contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated, contains the same value as points. methods the svganimatedpoints interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/brow...
SVGEllipseElement - Web APIs
candidate recommendation no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgellipseelement' in that s...
... candidate recommendation no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgellipseelement' in that specification. recommendation initial definition ...
SVGFEConvolveMatrixElement - Web APIs
svg_edgemode_none 3 corresponds ...
...x" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgfeconvolvematrixelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constants name value description svg_edgemode_unknown 0 the type is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_edgemode_duplicate 1 corresponds to the duplicate value. svg_edgemode_wrap 2 corresponds to the wrap value. svg_edgemode_none 3 corresponds to none value. properties this interface also inherits properties from its parent interface, svgelement, and also implements properti...
SVGFEDisplacementMapElement - Web APIs
svg_...
...x" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgfedisplacementmapelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constants name value description svg_channel_unknown 0 the type is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_channel_r 1 corresponds to the r value. svg_channel_g 2 corresponds to the g value. svg_channel_b 3 corresponds to the b value. svg_channel_a 4 corresponds to the a value. properties this interface also inherits properties from its parent interface, svgeleme...
SVGFEMorphologyElement - Web APIs
properties thi...
...-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgfemorphologyelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constants name value description svg_morphology_operator_unknown 0 the type is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_morphology_operator_erode 1 corresponds to the erode value. svg_morphology_operator_dilate 2 corresponds to dilate value. properties this interface also inherits properties from its parent interface, svgelement, and also implements properties of svgfilterprimitivestandardattributes. s...
SVGGeometryElement - Web APIs
interface also inherits properties from its parent, svggraphicselement. svggeometryelement.pathlength read only this property reflects the pathlength attribute. methods this interface also inherits methods from its parent, svggraphicselement. svggeometryelement.ispointinfill() determines whether a given point is within the fill shape of an element. normal hit testing rules apply; the value of the pointer-events property on the element determines whether a point is considered to be within the fill. svggeometryelement.ispointinstroke() determines whether a given point is within the stroke shape of an element. normal hit testing rules apply; the value of the pointer-events property on the element determines whether a point is considered to be within the stroke. svggeometryelement.g...
... svggeometryelement.getpointatlength() returns the point at a given distance along the path. ...
SVGGradientElement - Web APIs
svg_spreadmethod_repeat 3 correspo...
..."12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svggradientelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constants name value description svg_spreadmethod_unknown 0 the type is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_spreadmethod_pad 1 corresponds to value pad. svg_spreadmethod_reflect 2 corresponds to value reflect. svg_spreadmethod_repeat 3 corresponds to value repeat. properties this interface also inherits properties from its parent, svgelement, and implements those of svgurirefere...
SVGImageElement.decoding - Web APIs
async: decode the image asynchronously to reduce delay in presenting other content. auto: default mode, which indicates no preference for the decoding mode. the browser decides what is best for the user. ...
... async: decode the image asynchronously to reduce delay in presenting other content. auto: default mode, which indicates no preference for the decoding mode. the browser decides what is best for the user. ...
SVGNumber - Web APIs
Web › API › SVGNumber
methods this interface doesn't provide any specific methods. ...
... methods this interface doesn't provide any specific methods. ...
SVGPoint - Web APIs
Web › API › SVGPoint
an svgpoint represents a 2d or 3d point in the svg coordinate system. syntax retobject = svgsvgelement.createsvgpoint() value the returned value is an svgpoint object. ...
... an svgpoint represents a 2d or 3d point in the svg coordinate system. syntax retobject = svgsvgelement.createsvgpoint() value the returned value is an svgpoint object. ...
SVGStringList - Web APIs
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 corresponds to a read only attribute or when ...
...elf is read only. initialize(in domstring newitem) domstring clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter. if the inserted item is already in a list, it is removed from its previous list before it is inserted into this list. the inserted item is the item itself and not a copy. the return value is the item inserted into the list. exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. getitem(in unsigned long index) domstring returns the specified item from the list. the returned item is the item itself and not a copy. any changes mad...
SVGStylable - Web APIs
svg stylable interface the svgstylable interface is implemented on all objects corresponding to svg elements that can have style, class and presentation attributes specified on them. interface overview also implement none methods cssvalue getpresentationattribute(in domstring name) properties readonly svganimatedstring classname readonly cssstyledeclaration style normative document svg 1.1 (2nd edition) properties name type description classname svganimatedstring corresponds to attribute class on the given element. style cssstyledeclaration corresponds to attribute style on the given element. methods name & arguments return...
...g 1.1 (2nd edition) properties name type description classname svganimatedstring corresponds to attribute class on the given element. style cssstyledeclaration corresponds to attribute style on the given element. methods name & arguments return description getpresentationattribute(in domstring name) cssvalue returns the base (i.e., static) value of a given presentation attribute as an object of type cssvalue. the returned object is live; changes to the objects represent immediate changes to the objects to which the cssvalue is attached. 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 htt...
SVGStyleElement - Web APIs
a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent interface, svgelement and implements properties from linkstyle. svgstyleelement.type a domstring corresponding to the type attribute of the given element. svg 1.1 defined that a domexception is raised with code no_modification_allowed_err on an attempt to change the value of a read-only attribute. this restriction was removed in svg 2. svgstyleelement.media a domstring corresponding to the media attribute of the given element. svg 1.1 defined that a domexception is raised with code no_modification_allowed_err on an attempt to change the value of a read-only attribute. this restriction was removed in svg 2. svgstyleelement.title a domstring corresponding t...
...this restriction was removed in svg 2. methods this interface doesn't implement any specific methods, but inherits methods from its parent interface, svgelement and implements methods from linkstyle. ...
SVGTransformList - Web APIs
read only. initialize(in svgtransform newitem) svgtransform clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter. if the inserted item is already in a list, it is removed from its previous list before it is inserted into this list. the inserted item is the item itself and not a copy. the return value is the item inserted into the list. exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. getitem(in unsigned long index) svgtransform returns the specified item from the list. the returned item is the item itself and not a copy. any changes ...
...s the item itself and not a copy. exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. createsvgtransformfrommatrix(in svgmatrix) svgtransform creates an svgtransform object which is initialized to transform of type svg_transform_matrix and whose values are the given matrix. the values from the parameter matrix are copied, the matrix parameter is not adopted as svgtransform::matrix. consolidate() svgtransform consolidates the list of separate svgtransform objects by multiplying the equivalent transformation matrices together to result in a list consisting of a single svgtransform object of type svg_transform_matrix. the cons...
SVGUnitTypes - Web APIs
p...
...ont-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgunittypes</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constants name value description svg_unit_type_unknown 0 the type is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_unit_type_userspaceonuse 1 corresponds to the value userspaceonuse. svg_unit_type_objectboundingbox 2 corresponds to the value objectboundingbox. properties this interface doesn't implement any specific properties. methods this interface doesn't implement any specific methods. specifi...
SVGZoomAndPan - Web APIs
properties svgzoomandpan.zoom...
...t-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgzoomandpan</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constants name value description svg_zoomandpan_unknown 0 the type is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_zoomandpan_disable 1 corresponds to the value disable. svg_zoomandpan_magnify 2 corresponds to the value magnify. properties svgzoomandpan.zoomandpan an unsigned short representing the value of the zoomandpan attribute. methods this interface doesn't implement any specific methods.
Selection.type - Web APIs
Web › API › Selection › type
caret: the selection is collapsed (i.e. the caret is placed on some text, but no range has been selected). range: a range has been selected. example in this example, the event handler will fire each time a new selection is made. ...
... caret: the selection is collapsed (i.e. the caret is placed on some text, but no range has been selected). range: a range has been selected. example in this example, the event handler will fire each time a new selection is made. ...
ServiceWorker - Web APIs
s the serviceworker interface inherits properties from its parent, worker. serviceworker.scripturl read only returns the serviceworker serialized script url defined as part of serviceworkerregistration. the url must be on the same origin as the document that registers the serviceworker. serviceworker.state read only returns the state of the service worker. it returns one of the following values: installing, installed, activating, activated, or redundant. event handlers serviceworker.onstatechange read only an eventlistener property called whenever an event of type statechange is fired; it is basically fired anytime the serviceworker.state changes. methods the serviceworker interface inherits methods from its parent, worker, with the exception of worker.terminate — this shou...
...cally fired anytime the serviceworker.state changes. methods the serviceworker interface inherits methods from its parent, worker, with the exception of worker.terminate — this should not be accessible from service workers. examples this code snippet is from the service worker registration-events sample (live demo). the code listens for any change in the serviceworker.state and returns its value. if ('serviceworker' in navigator) { navigator.serviceworker.register('service-worker.js', { scope: './' }).then(function (registration) { var serviceworker; if (registration.installing) { serviceworker = registration.installing; document.queryselector('#kind').textcontent = 'installing'; } else if (registration.waiting) { ...
ServiceWorkerContainer.register() - Web APIs
ile needs to have a valid javascript mime type. options optional an object containing registration options. currently available options are: scope: a usvstring representing a url that defines a service worker's registration scope; that is, what range of urls a service worker can control. this is usually a relative url. it is relative to the base url of the application. by default, the scope value for a service worker registration is set to the directory where the service worker script is located. see the examples section for more information on how it works. return value a promise that resolves with a serviceworkerregistration object. examples the examples described here should be taken together to get a better understanding of how service workers scope applies to a page. the fo...
...the service worker code in this case, if included in example.com/index.html, will control example.com/index.html, as well as pages underneath it, like example.com/product/description.html. ...
Slottable: assignedSlot - Web APIs
the assignedslot read-only property of the slottable interface returns an htmlslotelement representing the <slot> element the node is inserted in. syntax var slotelement = elementinstance.assignedslot value an htmlslotelement instance, or null if the element is not assigned to a slot, or if the associated shadow root was attached with its mode set to closed (see element.attachshadow for further details). examples in our simple-template example (see it live), we create a trivial custom element example called <my-paragraph> in which a shadow root is attached and then populated using the contents of a template that contains a slot named my-text. when <my-paragraph> is used in the document, the slot is populated by a slottable element by including it inside the element with a slot attribute...
...xamples in our simple-template example (see it live), we create a trivial custom element example called <my-paragraph> in which a shadow root is attached and then populated using the contents of a template that contains a slot named my-text. when <my-paragraph> is used in the document, the slot is populated by a slottable element by including it inside the element with a slot attribute with the value my-text. here is one such example: <my-paragraph> <span slot="my-text">let's have some different text!</span> </my-paragraph> in our javascript file we get a reference to the <span> shown above, then log a reference to the original <slot> element the <span> was inserted in. let slottedspan = document.queryselector('my-paragraph span') console.log(slottedspan.assignedslot); // logs '<slot nam...
SourceBuffer.appendWindowEnd - Web APIs
the appendwindowend property of the sourcebuffer interface controls the timestamp for the end of the append window, a timestamp range that can be used to filter what media data is appended to the sourcebuffer. coded media frames with timestamps wthin this range will be appended, whereas those outside the range will be filtered out. the default value of appendwindowend is positive infinity. ...
...he append window, a timestamp range that can be used to filter what media data is appended to the sourcebuffer. coded media frames with timestamps wthin this range will be appended, whereas those outside the range will be filtered out. the default value of appendwindowend is positive infinity. syntax var myappendwindowend = sourcebuffer.appendwindowend; sourcebuffer.appendwindowend = 120.0; value a double, indicating the end time of the append window, in seconds. exceptions the following exceptions may be thrown when setting a new value for this property. exception explanation invalidaccesserror an attempt was made to set the value to less than or equal to sourcebuffer.appendwindowstart, or nan. invalidstateerror this sourcebuffer object is bein...
SourceBuffer - Web APIs
s of whether they can be appended in any order, or they have to be kept in a strict sequence. sourcebuffer.texttracks read only a list of the text tracks currently contained inside the sourcebuffer. sourcebuffer.timestampoffset controls the offset applied to timestamps inside media segments that are subsequently appended to the sourcebuffer. sourcebuffer.trackdefaults specifies the default values to use if kind, label, and/or language information is not available in the initialization segment of the media to be appended to the sourcebuffer. sourcebuffer.updating read only a boolean indicating whether the sourcebuffer is currently being updated — i.e. whether an sourcebuffer.appendbuffer(), sourcebuffer.appendstream(), or sourcebuffer.remove() operation is currently in progress. sou...
...cebuffer.onupdate fired whenever sourcebuffer.appendbuffer() method or the sourcebuffer.remove() completes. sourcebuffer.updating changes from true to false. this event is fired before onupdateend. sourcebuffer.onupdateend fired whenever sourcebuffer.appendbuffer() method or the sourcebuffer.remove() has ended. this event is fired after onupdate. sourcebuffer.onupdatestart fired whenever the value of sourcebuffer.updating transitions from false to true. methods inherits methods from its parent interface, eventtarget. sourcebuffer.abort() aborts the current segment and resets the segment parser. sourcebuffer.appendbuffer() appends media segment data from an arraybuffer or arraybufferview object to the sourcebuffer. sourcebuffer.appendbufferasync() starts the process of asynchro...
SpeechRecognition.lang - Web APIs
examples this code is excerpted from our speech color changer example. ...
... examples this code is excerpted from our speech color changer example. ...
SpeechRecognition.maxAlternatives - Web APIs
examples this code is excerpted from our speech color changer example. ...
... examples this code is excerpted from our speech color changer example. ...
SpeechSynthesisErrorEvent.error - Web APIs
possible codes are: canceled a speechsynthesis.cancel method call caused the speechsynthesisutterance to be removed from the queue before it had begun being spoken. interrupted a speechsynthesis.cancel method call caused the speechsynthesisutterance to be interrupted after it had begun being spoken and before it completed. ...
...tterance.volume property was not valid. examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... ...
SpeechSynthesisUtterance.lang - Web APIs
the lang property of the speechsynthesisutterance interface gets and sets the language of the utterance. if unset, the app's (i.e. the <html> lang value) lang will be used, or the user-agent default if that is unset too. syntax var mylang = speechsynthesisutteranceinstance.lang; speechsynthesisutteranceinstance.lang = 'en-us'; value a domstring representing a bcp 47 language tag. examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... ...
...ring representing a bcp 47 language tag. examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... ...
SpeechSynthesisUtterance.pitch - Web APIs
the pitch property of the speechsynthesisutterance interface gets and sets the pitch at which the utterance will be spoken at. if unset, a default value of 1 will be used. syntax // default 1 speechsynthesisutteranceinstance.pitch = 1.5; value a float representing the pitch value. it can range between 0 (lowest) and 2 (highest), with 1 being the default pitch for the current platform or voice. some speech synthesis engines or voices may constrain the minimum and maximum rates further. if ssml is used, this value will be overridden by prosody tags in the markup. examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getv...
...verridden by prosody tags in the markup. examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... ...
SpeechSynthesisUtterance.rate - Web APIs
the rate property of the speechsynthesisutterance interface gets and sets the speed at which the utterance will be spoken at. if unset, a default value of 1 will be used. syntax var myrate = speechsynthesisutteranceinstance.rate; speechsynthesisutteranceinstance.rate = 1.5; value a float representing the rate value. it can range between 0.1 (lowest) and 10 (highest), with 1 being the default pitch for the current platform or voice, which should correspond to a normal speaking rate. other values act as a percentage relative to this, so for example 2 is twice as fast, 0.5 is half as fast, etc. some speech synthesis engines or voices may constrain the minimum and maximum rates further. if ssml is used, this value will be overridden by prosody tags in the markup. examples var sy...
...verridden by prosody tags in the markup. examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... ...
SpeechSynthesisUtterance.text - Web APIs
property of the speechsynthesisutterance interface gets and sets the text 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.onsubmi...
... 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(); ... ...
SpeechSynthesisUtterance.voice - Web APIs
e utterance. this should be set to one of the speechsynthesisvoice objects returned by speechsynthesis.getvoices(). if not set by the time the utterance is spoken, the voice used will be the most suitable default voice available for the utterance's lang setting. ...
... value a speechsynthesisvoice object. examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... inputform.onsubmit = function(event) { event.preventdefault(); var utterthis = new speechsynthesisutterance(inputtxt.value); var selectedoption = voiceselect.selectedoptions[0].getattribute('data-name'); for(i = 0; i < voices.length ; i++) { if(voices[i].name === selectedoption) { utterthis.voice = voices[i]; } } synth.speak(utterthis); inputtxt.blur(); } specifications specification status comment web speech apithe definition of 'voice' in that specification. draf...
SpeechSynthesisUtterance.volume - Web APIs
the volume property of the speechsynthesisutterance interface gets and sets the volume that the utterance will be spoken at. if not set, the default value 1 will be used. syntax var myvolume = speechsynthesisutteranceinstance.volume; speechsynthesisutteranceinstance.volume = 0.5; value a float that represents the volume value, between 0 (lowest) and 1 (highest.) if ssml is used, this value will be overridden by prosody tags in the markup. examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... inputform.onsubmit = function(event) { event.preventdefault(); var utterthis = new speechsynthesisutte...
...verridden by prosody tags in the markup. examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... ...
StaticRange.collapsed - Web APIs
a collapsed range is one in which the start and end positions are the same, resulting in a zero-character-long range.. ...
...a collapsed range is one in which the start and end positions are the same, resulting in a zero-character-long range.. ...
Storage.getItem() - Web APIs
Web › API › Storage › getItem
the getitem() method of the storage interface, when passed a key name, will return that key's value, or null if the key does not exist, in the given storage object. syntax var avalue = storage.getitem(keyname); parameters keyname a domstring containing the name of the key you want to retrieve the value of. return value a domstring containing the value of the key. if the key does not exist, null is returned. example the following function retrieves three data items from local storage, then uses them to set custom styles on a page. ...
... the key. if the key does not exist, null is returned. example the following function retrieves three data items from local storage, then uses them to set custom styles on a page. function setstyles() { var currentcolor = localstorage.getitem('bgcolor'); var currentfont = localstorage.getitem('font'); var currentimage = localstorage.getitem('image'); document.getelementbyid('bgcolor').value = currentcolor; document.getelementbyid('font').value = currentfont; document.getelementbyid('image').value = currentimage; htmlelem.style.backgroundcolor = '#' + currentcolor; pelem.style.fontfamily = currentfont; imgelem.setattribute('src', currentimage); } note: to see this used within a real world example, see our web storage demo. specifications specification stat...
Storage.key() - Web APIs
Web › API › Storage › key
the key() method of the storage interface, when passed a number n, returns the name of the nth key in a given storage object. the order of keys is user-agent defined, so you should not rely on it. syntax var akeyname = 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. ...
... specifications specification status comment html living standardthe definition of 'storage.key' in that specification. ...
StorageEstimate.quota - Web APIs
the storageestimate dictionary's quota property is a conservative approximation of how much storage is allotted to the origin or web app that called storagemanager.estimate(); there may be more space available, but there will not be less. this value is an estimate to help prevent its use for fingerprinting—that is, identifying a device using an amalgamation of the values of seemingly innocuous properties. syntax quota = storageestimate.quota; value a numeric value specifying an approximation of the total amount of storage space available for use by the application. example in this example, we obtain the usage estimates and present the percentage of storage capacity currently used to the user. html content <label> you’re currently using about <output id="percent"> </o...
...or use by the application. example in this example, we obtain the usage estimates and present the percentage of storage capacity currently used to the user. html content <label> you’re currently using about <output id="percent"> </output>% of your available storage. </label> javascript content navigator.storage.estimate().then(function(estimate) { document.getelementbyid("percent").value = (estimate.usage / estimate.quota * 100).tofixed(2); }); result specifications specification status comment storagethe definition of 'quota' in that specification. living standard initial definition ...
StorageEstimate.usage - Web APIs
the storageestimate dictionary's usage property is a conservative approximation of how much storage is allotted to the origin or web app that called storagemanager.estimate(); there may be more space available, but there will not be less. the value is an estimate because the user agent may use compression, duplication prevention techniques, and other methods to improve storage efficiency. syntax usage = storageestimate.usage; value a numeric value specifying an approximation of the total amount of storage space available for use by the application. example in this example, we obtain the usage estimates and present the percentage of storage capacity currently used to the user. html content <label> you’re currently using about <output id="percent"> </output>% of your ava...
...or use by the application. example in this example, we obtain the usage estimates and present the percentage of storage capacity currently used to the user. html content <label> you’re currently using about <output id="percent"> </output>% of your available storage. </label> javascript content navigator.storage.estimate().then(function(estimate) { document.getelementbyid("percent").value = (estimate.usage / estimate.quota * 100).tofixed(2); }); result specifications specification status comment storagethe definition of 'usage' in that specification. living standard initial definition ...
StorageEstimate - Web APIs
the storageestimate dictionary is used by the storagemanager to provide estimates of the size of a site's or application's data store and how much of it is in use. the estimate() method returns an object that conforms to this dictionary when its promise resolves. these values are only estimates for several reasons, including both performance and preventing storage capacity data from being used for fingerprinting purposes. see the individual property pages for details. properties quota secure context a numeric value in bytes which provides a conservative approximation of the total storage the user's device or computer has available for the site origin or web app. it's possible that there's more than this amount of space available though you can't rely on that being the case. us...
...unit is byte. usagedetails secure context a dictionary containing a breakdown of usage by storage system. ...
StorageManager.estimate() - Web APIs
r how much storage the current origin takes up (usage), and how much space is available (quota). this method operates asynchronously, so it returns a promise which resolves once the information is available. the promise's fulfillment handler is called with a storageestimate containing the usage and quota data. syntax const estimatepromise = storagemanager.estimate(); parameters none. return value a promise that resolves to an object which conforms to the storageestimate dictionary. this dictionary contains estimates of how much space is available to the origin in storageestimate.quota, as well as how much is currently used in storageestimate.usage. the returned values are not exact; between compression, deduplication, and obfuscation for security reasons, they will be imprecise. you ...
...epting push notifications example in this example, we obtain the usage estimates and present the percentage of storage capacity currently used to the user. html content <label> you’re currently using about <output id="percent"> </output>% of your available storage. </label> javascript content navigator.storage.estimate().then(function(estimate) { document.getelementbyid("percent").value = (estimate.usage / estimate.quota * 100).tofixed(2); }); result specifications specification status comment storagethe definition of 'estimate()' in that specification. living standard initial definition. ...
Storage API - Web APIs
hes" or "clear recent history" option. the user will be asked specifically for permission to remove persistent site storage units. quotas and usage estimates the user agent determines, using whatever mechanism it chooses, the maximum amount of storage a given site can use. this maximum is the origin's quota. the amount of this space which is in use by the site is called its usage. both of these values are estimates; there are several reasons why they're not precise: user agents are encouraged to obscure the exact size of the data used by a given origin, to prevent these values from being used for fingerprinting purposes. de-duplication, compression, and other methods to reduce the physical size of the stored data may be used. quotas are conservative estimates of the space available for t...
...d. quotas are conservative estimates of the space available for the origin's use, and should be less than the available space on the device to help prevent overruns. user agents may use any method they choose to determine the size of origins' quotas, and are encouraged by the specification to provide popular or frequently-used sites with extra space. to determine the estimated quota and usage values for a given origin, use the navigator.storage.estimate() method, which returns a promise that, when resolved, receives a storageestimate that contains these figures. for example: navigator.storage.estimate().then(estimate => { // estimate.quota is the estimated quota // estimate.usage is the estimated number of bytes used }); specifications specification status comment ...
Stylesheet.href - Web APIs
Web › API › StyleSheet › href
this property is read-only in firefox, opera, google chrome, and safari, and it is read/write in internet explorer. specifications specification status comment css object model (cssom)the definition of 'stylesheet: href' in that specification. working draft ...
...xt/css" /> <script> function sref() { alert(document.stylesheets[0].href); } </script> </head> <body> <div class="thunder">thunder</div> <button onclick="sref()">ss</button> </body> </html> // returns "file:////c:/windows/desktop/example.css notes if the style sheet is a linked style sheet, the value of its attribute is its location. for inline style sheets, the value of this attribute is null. this property is read-only in firefox, opera, google chrome, and safari, and it is read/write in internet explorer. specifications specification status comment css object model (cssom)the definition of 'stylesheet: href' in that specification. working draft ...
SubtleCrypto.deriveKey() - Web APIs
bject. for aes-ctr, aes-cbc, aes-gcm, or aes-kw: pass an aeskeygenparams object. extractable is a boolean indicating whether it will be possible to export the key using subtlecrypto.exportkey() or subtlecrypto.wrapkey(). keyusages is an array indicating what can be done with the derived key. note that the key usages must be allowed by the algorithm set in derivedkeyalgorithm. possible values of the array are: encrypt: the key may be used to encrypt messages. decrypt: the key may be used to decrypt messages. sign: the key may be used to sign messages. verify: the key may be used to verify signatures. derivekey: the key may be used in deriving a new key. "derivebits": the key may be used in deriving bits. "wrapkey": the key may be used to wrap a key. "unwrap...
... encrypt messages. decrypt: the key may be used to decrypt messages. sign: the key may be used to sign messages. verify: the key may be used to verify signatures. derivekey: the key may be used in deriving a new key. "derivebits": the key may be used in deriving bits. "wrapkey": the key may be used to wrap a key. "unwrapkey": the key may be used to unwrap a key. return value result is a promise that fulfills with a cryptokey. exceptions the promise is rejected when one of 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 o...
SubtleCrypto.digest() - Web APIs
the digest() method of the subtlecrypto interface generates a digest of the given data. a digest is a short fixed-length value derived from some variable-length input. 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. supported values are: sha-1 (but don't use this in cryptographic applications) sha-256 sha-384 sha-512. data is an arraybuffer or arraybufferview containing the d...
...romise 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. supported values are: sha-1 (but don't use this in cryptographic applications) sha-256 sha-384 sha-512. data is an arraybuffer or arraybufferview containing the data to be digested. return value digest is a promise that fulfills with an arraybuffer containing the digest. supported algorithms digest algorithms, also known as cryptographic hash functions, transform an arbitrarily large block of data into a fixed-size output, usually much shorter than the input. they have a variety of applications in cryptography. sha-1 this algorithm is specified in fips 180-4, section 6.1, and pro...
SubtleCrypto.generateKey() - Web APIs
r ecdh: pass an eckeygenparams object. for hmac: pass an hmackeygenparams object. for aes-ctr, aes-cbc, aes-gcm, or aes-kw: pass an aeskeygenparams object. extractable is a boolean indicating whether it will be possible to export the key using subtlecrypto.exportkey() or subtlecrypto.wrapkey(). keyusages is an array indicating what can be done with the newly generated key. possible values for array elements are: encrypt: the key may be used to encrypt messages. decrypt: the key may be used to decrypt messages. sign: the key may be used to sign messages. verify: the key may be used to verify signatures. derivekey: the key may be used in deriving a new key. derivebits: the key may be used in deriving bits. wrapkey: the key may be used to wrap a key. unwra...
...sed to encrypt messages. decrypt: the key may be used to decrypt messages. sign: the key may be used to sign messages. verify: the key may be used to verify signatures. derivekey: the key may be used in deriving a new key. derivebits: the key may be used in deriving bits. wrapkey: the key may be used to wrap a key. unwrapkey: the key may be used to unwrap a key. return value result is a promise that fulfills with a cryptokey (for symmetric algorithms) or a cryptokeypair (for public-key algorithms). exceptions the promise is rejected when the following exception is encountered: syntaxerror raised when the result is a cryptokey of type secret or private but keyusages is empty. syntaxerror raised when the result is a cryptokeypair and its privatekey.usages a...
SubtleCrypto - Web APIs
ithm, and key given as parameters. subtlecrypto.decrypt() returns a promise that fulfills with the clear data corresponding to the encrypted text, algorithm, and key given as parameters. subtlecrypto.sign() returns a promise that fulfills with the signature corresponding to the text, algorithm, and key given as parameters. subtlecrypto.verify() returns a promise that fulfills with a boolean value indicating if the signature given as a parameter matches the text, algorithm, and key that are also given as parameters. subtlecrypto.digest() returns a promise that fulfills with a digest generated from the algorithm and text given as parameters. subtlecrypto.generatekey() returns a promise that fulfills with a newly-generated cryptokey, for symmetrical algorithms, or a cryptokeypair, contai...
...ographic 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 generatekey() and derivekey() functions both create a new cryptokey object. the difference is that generatekey() will generate a new distinct key value each time you call it, while derivekey() derives a key from some initial keying material. if you provide the same keying material to two separate calls to derivekey(), you will get two cryptokey objects that have the same underlying value. this is useful if, for example, you want to derive an encryption key from a password and later derive the same key from the same password to decrypt the data. ...
TextTrackList.length - Web APIs
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(). ...
...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(). ...
Touch.identifier - Web APIs
Web › API › Touch › identifier
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. ...
... 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. ...
Touch.radiusY - Web APIs
Web › API › Touch › radiusY
summary returns the y radius of the ellipse that most closely circumscribes the area of contact with the touch surface. the value is in css pixels of the same scale as touch.screenx. this value, in combination with touch.radiusx and touch.rotationangle constructs an ellipse that approximates the size and shape of the area of contact between the user and the screen. this may be a large ellipse representing the contact between a fingertip and the screen or a small one representing the tip of a stylus, for example. note: this attribute has not been formally standardized. ...
... a large ellipse representing the contact between a fingertip and the screen or a small one representing the tip of a stylus, for example. note: this attribute has not been formally standardized. it is specified in the touch events – level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. syntax var yradius = touchitem.radiusy; return value yradius the y radius of the ellipse that most closely circumscribes the area of contact with the screen. example the touch.radiusx example includes an example of this property's usage. specifications specification status comment touch events – level 2 draft non-stable version. ...
Touch.rotationAngle - Web APIs
summary returns the rotation angle, in degrees, of the contact area ellipse defined by touch.radiusx and touch.radiusy. the value may be between 0 and 90. together, these three values describe an ellipse that approximates the size and shape of the area of contact between the user and the screen. this may be a relatively large ellipse representing the contact between a fingertip and the screen or a small area representing the tip of a stylus, for example. note: this attribute has not been formally standardized. it is specified in the touch events – level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. ...
...rge ellipse representing the contact between a fingertip and the screen or a small area representing the tip of a stylus, for example. note: this attribute has not been formally standardized. it is specified in the touch events – level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. syntax var angle = touchitem.rotationangle; return value angle the number of degrees of rotation to apply to the described ellipse to align with the contact area between the user and the touch surface. example the touch.radiusx example includes an example of this property's usage. specifications specification status comment touch events – level 2 draft non-stable version. ...
TouchEvent.altKey - Web APIs
Web › API › TouchEvent › altKey
example this example illustrates how to access the touchevent key modifier properties: touchevent.altkey, touchevent.ctrlkey, touchevent.metakey and touchevent.shiftkey. in following code snippet, the touchstart event handler logs the state of the event's modifier keys. ...
... example this example illustrates how to access the touchevent key modifier properties: touchevent.altkey, touchevent.ctrlkey, touchevent.metakey and touchevent.shiftkey. in following code snippet, the touchstart event handler logs the state of the event's modifier keys. ...
TouchEvent.ctrlKey - Web APIs
example the touchevent.altkey example includes an example of this property's usage. specifications specification status comment touch events – level 2 draft non-stable version. ...
... example the touchevent.altkey example includes an example of this property's usage. specifications specification status comment touch events – level 2 draft non-stable version. ...
TouchEvent.metaKey - Web APIs
example the touchevent.altkey example includes an example of this property's usage. specifications specification status comment touch events – level 2 draft non-stable version. ...
... example the touchevent.altkey example includes an example of this property's usage. specifications specification status comment touch events – level 2 draft non-stable version. ...
TouchEvent.shiftKey - Web APIs
example the touchevent.altkey example includes an example of this property's usage. specifications specification status comment touch events – level 2 draft non-stable version. ...
... example the touchevent.altkey example includes an example of this property's usage. specifications specification status comment touch events – level 2 draft non-stable version. ...
TrackDefault.TrackDefault() - Web APIs
n an initialization segment does not contain label information for a new track. kinds an array (sequence) of domstrings specifying default kinds for the sourcebuffer to use when an initialization segment does not contain kind information for a new track. bytestreamtrackid optional a domstring specifying the id of the specific track that the sourcebuffer should apply to. ...
...ck that the sourcebuffer should apply to. if not specified, this value will be an empty string and the sourcebuffer can contain any tracks of the specified type. errors when this constructor is invoked, the following errors can occur: error explanation invalidaccesserror the supplied language is not a valid language code, e.g. en-us. typeerror there are values specified in the kinds array that do not apply to the specified type. example tbd ...
TransformStream - Web APIs
m() creates and returns a transform stream object from the given handlers. properties transformstream.readable read only the readable end of a transformstream. transformstream.writable read only the writable end of a transformstream. methods none examples anything-to-uint8array stream in the following example, a transform stream passes through all chunks it receives as uint8array values. const transformcontent = { start() {}, // required. async transform(chunk, controller) { chunk = await chunk switch (typeof chunk) { case 'object': // just say the stream is done i guess if (chunk === null) controller.terminate() else if (arraybuffer.isview(chunk)) controller.enqueue(new uint8array(chunk.buffer, chunk.byteoffset, chunk.bytele...
...async transform(chunk, controller) { chunk = await chunk switch (typeof chunk) { case 'object': // just say the stream is done i guess if (chunk === null) controller.terminate() else if (arraybuffer.isview(chunk)) controller.enqueue(new uint8array(chunk.buffer, chunk.byteoffset, chunk.bytelength)) else if (array.isarray(chunk) && chunk.every(value => typeof value === 'number')) controller.enqueue(new uint8array(chunk)) else if ('function' === typeof chunk.valueof && chunk.valueof() !== chunk) this.transform(chunk.valueof(), controller) // hack else if ('tojson' in chunk) this.transform(json.stringify(chunk), controller) break case 'symbol': controller.error("cannot send a symbol as ...
TransitionEvent() - Web APIs
elapsedtime : afloat, pseudoelement: apseudoelementname}); arguments the transitionevent() constructor also inherits arguments from event(). type is a domstring representing the name of the type of the transitionevent. it is case-sensitive and can only be: 'transitionend'. ...
...it defaults to 0.0. pseudoelement optional is a domstring, starting with "::", containing the name of the pseudo-element the animation runs on. if the animation doesn't run on a pseudo-element but on the element, an empty string: "". ...
TransitionEvent.initTransitionEvent() - Web APIs
progress of been removed from most implementation. do not use it anymore, use the standard constructor, transitionevent(), to create a synthetic transitionevent syntax transitionevent.inittransitionevent(typearg, canbubblearg, cancelablearg, transitionnamearg, elapsedtimearg); parameters typearg is a domstring identifying the specific type of transition event that occurred. the following value is allowed: value meaning transitionend the transition completed. 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). transitionnamearg is a domstring containing the name of the css property ass...
... meaning transitionend the transition completed. 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). transitionnamearg is a domstring containing the name of the css property associated with the transition. this value is not affected by the transition-delay property. elapsedtimearg is float giving the amount of time the transition has been running, in seconds, when this event fired. specifications this method is non-standard and not part of any specification, though it was present in early drafts of css transitions. ...
UIEvent() - Web APIs
Web › API › UIEvent › UIEvent
uievent.detail lists the semantic for standard events. view: optional and defaulting to null, of type windowproxy, that is the window associated with the event . ...
...uievent.detail lists the semantic for standard events. view: optional and defaulting to null, of type windowproxy, that is the window associated with the event . ...
URL - Web APIs
Web › API › URL
ll of them, beginning with the leading ? character. searchparams read only a urlsearchparams object which can be used to access the individual query parameters found in search. username a usvstring containing the username specified before the domain name. methods tostring() returns a usvstring containing the whole url. it is a synonym for url.href, though it can't be used to modify the value. tojson() returns a usvstring containing the whole url. it returns the same string as the href property. static methods createobjecturl() returns a domstring containing a unique blob url, that is a url with blob: as its scheme, followed by an opaque string uniquely identifying the object in the browser. revokeobjecturl() revokes an object url previously created using url.createobjecturl...
... // "http://www.example.com/d%c3%a9monstration.html" the urlsearchparams interface can be used to build and manipulate the url query string. to get the search params from the current window's url, you can do this: // https://some.site/?id=123 const parsedurl = new url(window.location.href); console.log(parsedurl.searchparams.get("id")); // "123" the tostring() method of url just returns the value of the href property, so the constructor can be used to normalize and encode a url directly. const response = await fetch(new url('http://www.example.com/démonstration.html')); specifications specification status comment file apithe definition of 'url' in that specification. working draft added the static methods url.createobjecturl() and url.revokeobjecturl(...
URLSearchParams.getAll() - Web APIs
examples let url = new url('https://example.com?foo=1&bar=2'); let params = new urlsearchparams(url.search.slice(1)); //add a second foo parameter. params.append('foo', 4); console.log(params.getall('foo')) //prints ["1","4"]. ...
... examples let url = new url('https://example.com?foo=1&bar=2'); let params = new urlsearchparams(url.search.slice(1)); //add a second foo parameter. params.append('foo', 4); console.log(params.getall('foo')) //prints ["1","4"]. ...
URLSearchParams.sort() - Web APIs
the urlsearchparams.sort() method sorts all key/value pairs contained in this object in place and returns undefined. the sort order is according to unicode code points of the keys. this method uses a stable sorting algorithm (i.e. the relative order between key/value pairs with equal keys will be preserved). note: this feature is available in web workers. syntax searchparams.sort(); parameters none. return value undefined. ...
...points of the keys. this method uses a stable sorting algorithm (i.e. the relative order between key/value pairs with equal keys will be preserved). note: this feature is available in web workers. syntax searchparams.sort(); parameters none. return value undefined. examples // create a test urlsearchparams object var searchparams = new urlsearchparams("c=4&a=2&b=3&a=1"); // sort the key/value pairs searchparams.sort(); // display the sorted query string console.log(searchparams.tostring()); the result is: a=2&a=1&b=3&c=4 specifications specification status comment urlthe definition of 'sort()' in that specification. living standard initial definition ...
USBAlternateInterface - Web APIs
usbalternateinterface.alternatesettingread only returns the alternate setting number of this interface. this is equal to the balternatesetting field of the interface descriptor defining this interface. usbalternateinterface.interfaceclassread only returns the class of this interface. this is equal to the binterfaceclass field of the interface descriptor defining this interface. standardized values for this field are defined by the usb implementers forum. a value of 0xff indicates a vendor-defined interface. usbalternateinterface.interfacesubclassread only returns the subclass of this interface. this is equal to the binterfacesubclass field of the interface descriptor defining this interface. the meaning of this value depends on the interfaceclass field. usbalternateinterface.interface...
... this interface. this is equal to the binterfacesubclass field of the interface descriptor defining this interface. the meaning of this value depends on the interfaceclass field. usbalternateinterface.interfaceprotocolread only returns the protocol supported by this interface. this is equal to the binterfaceprotocol field of the interface descriptor defining this interface. the meaning of this value depends on the interfaceclass and interfacesubclass fields. usbalternateinterface.interfacenameread only returns the name of the interface, if one is provided by the device. this is the value of the string descriptor with the index specified by the iinterface field of the interface descriptor defining this interface. usbalternateinterface.endpointsread only returns an array containing insta...
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. leng...
...". recipient: specifices the target of the transfer on the device, one of "device", "interface", "endpoint", or "other". request: a vendor-specific command. value: vender-specific request parameters. index: the interface number of the recipient. length the maximum number of bytes to read from the device. the actual data is in the usbintransferresult in the resolved promise. return value promise that resolves with a usbintransferresult. specifications specification status comment webusbthe definition of 'controltransferin()' in that specification. draft initial definition. ...
USBDevice.controlTransferOut() - Web APIs
the controltransferout() method of the usbdevice interface returns a promise that resolves with a usbouttransferresult when a command or status operation has been transmitted to the usb device. syntax var promise = usbdevice.controltransferout(setup, data) 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. data a typedar...
...t: specifices the target of the transfer on the device, one of "device", "interface", "endpoint", or "other". request: a vendor-specific command. value: vender-specific request parameters. index: the interface number of the recipient. data a typedarray containing the data that will be transfered to the device. not all commands require data; some commands can send data just through the value parameter. check with your device to see what the specific request requires. return value a promise that resolves with a usbouttransferresult. specifications specification status comment webusbthe definition of 'controltransferout()' in that specification. draft initial definition. ...
USBDevice.opened - Web APIs
Web › API › USBDevice › opened
example this example is for a hypothetical usb device with a multi-colored led. it shows how to test that a device is open before calling usbdevice.controltransferout to set a specified led color. ...
...w it is passed is particular and unique to each device. async setdevicecolor(usbdevice, r, g, b) { if (device.opened) { // this hypothetical usb device requires that the data passed to // it be in a uint8array. let payload = new uint8array([r, g, b]); await usbdevice.controltransferout({ requesttype: 'vendor', recipient: 'device', request: 1, value: 0, index: 0, }, payload); } } specifications specification status comment webusbthe definition of 'opened' in that specification. draft initial definition. ...
USVString - Web APIs
Web › API › USVString
usvstring is equivalent to domstring except for not allowing unpaired surrogate codepoints. unpaired surrogate codepoints present in usvstring are converted by the browser to unicode 'replacement character' u+fffd, (�). ...
...usvstring is equivalent to domstring except for not allowing unpaired surrogate codepoints. unpaired surrogate codepoints present in usvstring are converted by the browser to unicode 'replacement character' u+fffd, (�). ...
UserDataHandler - Web APIs
t, in its third argument, a handler which will be called when the object is cloned, imported, deleted, renamed, or adopted. per the specification, exceptions should not be thrown in a userdatahandler. in both document.importnode() and node.clonenode(), although user data is not copied over, the handler will be called. properties none. methods handle (operation, key, data, src, dst) (no return value) this method is a callback which will be called if a node is being cloned, imported, renamed and as well, if deleted or adopted. operation (unsigned short) is an operation type integer (see below). key (domstring) is the user key. data (domuserdata) is the user data. src (node) is the source node (null if being deleted). dst (node) is the destination node (if any, or null). constants ...
...callback which will be called if a node is being cloned, imported, renamed and as well, if deleted or adopted. operation (unsigned short) is an operation type integer (see below). key (domstring) is the user key. data (domuserdata) is the user data. src (node) is the source node (null if being deleted). dst (node) is the destination node (if any, or null). ...
User Timing API - Web APIs
performance mark is a named performance entry that is created by the application. the mark is a timestamp in the browser's performance timeline. creating a performance mark the performance.mark() method is used to create a performance mark. the method takes one argument, the name of the mark (for example performance.mark("mark-1")). the mark's performance entry will have the following property values: entrytype - set to "mark". name - set to the "name" given when the mark was created. starttime - set to the timestamp when mark() was called. duration - set to "0" (a mark has no duration). retrieving performance marks the performance interface has three methods that can be used to retrieve a mark: performance.getentries() returns all performance entries in the performance timeline...
... two marks. creating a performance measure a measure is created by calling performance.measure(measurename, startmarkname, endmarkname) where measurename is the measure's name and startmarkname and endmarkname are the start and end names, respectively, of the marks the measure will be placed between (in the performance timeline). the measure's performance entry will have the following property values: entrytype - set to "measure". name - set to the "name" given when the measure was created. starttime - set to the timestamp when measure() was called. duration - set to a domhighrestimestamp that is the duration of the measure (typically, the end mark timestamp minus the start mark timestamp). retrieving performance measures the performance interface has three methods that can be used ...
VideoPlaybackQuality.corruptedVideoFrames - Web APIs
the videoplaybackquality interface's read-only corruptedvideoframes property the number of corrupted video frames that have been received since the <video> element was last loaded or reloaded. syntax corruptframefount = videoplaybackquality.corruptedvideoframes; value the number of corrupted video frames that have been received since the <video> element was last loaded or reloaded. it is up to the user agent to determine whether or not to display a corrupted video frame. ...
...r of corrupted video frames that have been received since the <video> element was last loaded or reloaded. it is up to the user agent to determine whether or not to display a corrupted video frame. if a corrupted frame is dropped, then both corruptedvideoframes and droppedvideoframes are incremented. example this example determines the percentage of frames which have been corrupted, and if the value is greater than 5%, calls a funciton called downgradevideo() that would be implemented to switch to a different video that might tax the network less. var videoelem = document.getelementbyid("my_vid"); var quality = videoelem.getvideoplaybackquality(); if (quality.corruptedvideoframes/quality.totalvideoframes > 0.05) { downgradevideo(videoelem); } specifications specification s...
VideoPlaybackQuality.creationTime - Web APIs
for details on how the time is determined, see performance.now(). ...
... for details on how the time is determined, see performance.now(). ...
VideoPlaybackQuality.droppedVideoFrames - Web APIs
the read-only droppedvideoframes property of the videoplaybackquality interface returns the number of video frames which have been dropped rather than being displayed since the last time the media was loaded into the htmlvideoelement. syntax value = videoplaybackquality.droppedvideoframes; value an unsigned 64-bit value indicating the number of frames that have been dropped since the last time the media in the <video> element was loaded or reloaded. this information can be used to determine whether or not to downgrade the video stream to avoid dropping frames. frames are typically dropped either before or after decoding them, when it's determined that it will not be possible to draw them to the screen at the correct time. example this example calls getvideoplaybackquality() t...
...hether or not to downgrade the video stream to avoid dropping frames. frames are typically dropped either before or after decoding them, when it's determined that it will not be possible to draw them to the screen at the correct time. example this example calls getvideoplaybackquality() to obtain a videoplaybackquality object, then determines what percentage of frames have been dropped. that value is then presented in an element for the user's reference. var videoelem = document.getelementbyid("my_vid"); var percentelem = document.getelementbyid("percent"); var quality = videoelem.getvideoplaybackquality(); var droppercent = (quality.droppedvideoframes/quality.totalvideoframes)*100; percentelem.innertext = math.trunc(droppercent).tostring(10); specifications specification ...
VideoTrack.selected - Web APIs
only a single video track can be active at any given time, so setting this property to true for one track while another track is active will make that other track inactive. ...
...only a single video track can be active at any given time, so setting this property to true for one track while another track is active will make that other track inactive. ...
VideoTrackList: change event - Web APIs
le by changing the track's selected property. ...
... living standard ...
VideoTrackList.length - Web APIs
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(). ...
...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(). ...
WEBGL_draw_buffers.drawBuffersWEBGL() - Web APIs
tten. this method is part of the webgl_draw_buffers extension. note: when using webgl2, this method is available as gl.drawbuffers() by default and the constants are named gl.color_attachment1 etc. without the "webgl" suffix. syntax void gl.getextension('webgl_draw_buffers').drawbufferswebgl(buffers); parameters buffers an array of glenum constants defining drawing buffers. possible values: gl.none: the fragment shader is not written to any color buffer. gl.back: the fragment shader is written to the back color buffer. ext.color_attachment0_webgl the fragment shader is written the the nth color attachment of the framebuffer. ext.color_attachment1_webgl ext.color_attachment2_webgl ext.color_attachment3_webgl ext.color_attachment4_webgl ext.color_attachment5_webgl ...
... examples see webgl_draw_buffers for more context with this example code. ext.drawbufferswebgl([ ext.color_attachment0_webgl, // gl_fragdata[0] ext.color_attachment1_webgl, // gl_fragdata[1] ext.color_attachment2_webgl, // gl_fragdata[2] ext.color_attachment3_webgl // gl_fragdata[3] ]); specifications specification status comment webgl_draw_buffersthe d...
WakeLockSentinel.type - Web APIs
prevents devices from dimming or locking the screen. examples this example shows an asynchronous function that acquires a wakelocksentinel, then logs the type to the console. ...
...prevents devices from dimming or locking the screen. examples this example shows an asynchronous function that acquires a wakelocksentinel, then logs the type to the console. ...
WebGL2RenderingContext.clearBuffer[fiuv]() - Web APIs
the webgl2renderingcontext.clearbuffer[fiuv]() methods of the webgl 2 api clear buffers from the currently bound framebuffer. syntax void gl.clearbufferfv(buffer, drawbuffer, values, optional srcoffset); void gl.clearbufferiv(buffer, drawbuffer, values, optional srcoffset); void gl.clearbufferuiv(buffer, drawbuffer, values, optional srcoffset); void gl.clearbufferfi(buffer, drawbuffer, depth, stencil); parameters buffer a glenum specifying the buffer to clear. possible values are: gl.color: color buffer. gl.depth: depth buffer. gl.stencil: stencil buffer. ...
...alues, optional srcoffset); void gl.clearbufferfi(buffer, drawbuffer, depth, stencil); parameters buffer a glenum specifying the buffer to clear. possible values are: gl.color: color buffer. gl.depth: depth buffer. gl.stencil: stencil buffer. gl.depth_stencil: clears depth and stencil buffers (used with clearbufferfi). drawbuffer a glint specifying the draw buffer to clear. values an array of glint, gluint or glfloat values or an int32array, uint32array or float32array specifying the values to clear to. depth a glfloat specifying the value to clear a depth render buffer to. stencil a glint specifying the value to clear the stencil render buffer to. return value none. examples gl.clearbufferiv(gl.color, 0, new int32array([r, g, b, a])); gl.clearbufferuiv(gl.colo...
WebGL2RenderingContext.copyBufferSubData() - Web APIs
the webgl2renderingcontext.copybuffersubdata() method of the webgl 2 api copies part of the data of a buffer to another buffer. syntax void gl.copybuffersubdata(readtarget, writetarget, readoffset, writeoffset, size); parameters readtarget writetarget a glenum specifying the binding point (target) from whose data store should be read or written. 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 (provided specifically for copy operations). gl.copy_write_buffer: buffer for copying from one buffer object to another (provided specifically for cop...
... storing uniform blocks. gl.pixel_pack_buffer: buffer used for pixel transfer operations. gl.pixel_unpack_buffer: buffer used for pixel 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. 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(...
WebGL2RenderingContext.copyTexSubImage3D() - Web APIs
the webgl2renderingcontext.copytexsubimage3d() method of the webgl api copies pixels from the current webglframebuffer into an existing 3d texture sub-image. syntax void gl.copytexsubimage3d(target, level, xoffset, yoffset, zoffset, x, y, width, height); 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 within the texture image. yoffset a glint specifying the y offset within the texture image. zoffset a glint specifying the z offset within the te...
...offset within the texture image. zoffset a glint specifying the z offset within the texture image. x a glint specifying the x coordinate of the lower left corner where to start copying. y a glint specifying the y coordinate of the lower left corner where to start copying. width a glsizei specifying the width of the texture. height a glsizei specifying the height of the texture. return value none. examples gl.copytexsubimage3d(gl.texture_3d, 0, 0, 0, 0, 0, 0, 16, 16); specifications specification status comment webgl 2.0the definition of 'copytexsubimage3d' in that specification. editor's draft initial definition. opengl es 3.0the definition of 'glcopytexsubimage3d' in that specification. standard man page of the (similar) opengl api...
WebGL2RenderingContext.drawArraysInstanced() - Web APIs
bgl 2 api renders primitives from array data like the gl.drawarrays() method. in addition, it can execute multiple instances of the range of elements. note: when using webgl 1, the angle_instanced_arrays extension can provide this method, too. syntax void gl.drawarraysinstanced(mode, first, count, instancecount); parameters mode a glenum specifying the type primitive to render. possible values are: gl.points: draws a single dot. gl.line_strip: draws a straight line to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. first a glint specifying the sta...
...: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. first a glint specifying the starting index in the array of vector points. count a glsizei specifying the number of indices to be rendered. instancecount a glsizei specifying the number of instances of the range of elements to execute. return value none. examples gl.drawarraysinstanced(gl.points, 0, 8, 4); specifications specification status comment webgl 2.0the definition of 'drawarraysinstanced' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'gldrawarraysinstanced' in that specification. standard man page of the (similar) opengl api. ...
WebGL2RenderingContext.drawBuffers() - Web APIs
ntext.drawbuffers() method of the webgl 2 api defines draw buffers to which fragment colors are written into. the draw buffer settings are part of the state of the currently bound framebuffer or the drawingbuffer if no framebuffer is bound. syntax void gl.drawbuffers(buffers); parameters buffers an array of glenum specifying the buffers into which fragment colors will be written. ...
...s buffers an array of glenum specifying the buffers into which fragment colors will be written. possible values are: gl.none: fragment shader output is not written into any color buffer. gl.back: fragment shader output is written into the back color buffer. gl.color_attachment{0-15}: fragment shader output is written in the nth color attachment of the current framebuffer. return value none. exceptions if buffers contains not one of the accepted values, a gl.invalid_enum error is thrown. examples gl.drawbuffers([gl.none, gl.color_attachment1]); specifications specification status comment webgl 2.0the definition of 'drawbuffers' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'gl...
WebGL2RenderingContext.getActiveUniformBlockParameter() - Web APIs
pi retrieves information about an active uniform block within a webglprogram. syntax any gl.getactiveuniformblockparameter(program, uniformblockindex, pname); parameters program a webglprogram containing the active uniform block. uniformblockindex a gluint specifying the index of the active uniform block within the program. pname a glenum specifying which information to query. possible values: gl.uniform_block_binding: returns a gluint indicating the uniform buffer binding point. gl.uniform_block_data_size: returns a gluint indicating the minimum total buffer object size. gl.uniform_block_active_uniforms: returns a gluint indicating the number of active uniforms in the uniform block. gl.uniform_block_active_uniform_indices: returns a uint32array indicating the list of activ...
..._uniform_indices: returns a uint32array indicating the list of active uniforms in the uniform block. gl.uniform_block_referenced_by_vertex_shader: returns a glboolean indicating whether the uniform block is referenced by the vertex shader. gl.uniform_block_referenced_by_fragment_shader: returns a glboolean indicating whether the uniform block is referenced by the fragment shader. return value depends on which information is requested using the pname parameter. if an error occurs, null is returned. examples var blocksize = gl.getactiveuniformblockparameter(program, blockindex, gl.uniform_block_data_size); specifications specification status comment webgl 2.0the definition of 'getactiveuniformblockparameter' in that specification. ed...
WebGL2RenderingContext.getActiveUniforms() - Web APIs
euniforms() method of the webgl 2 api retrieves information about active uniforms within a webglprogram. syntax any gl.getactiveuniforms(program, uniformindices, pname); parameters program a webglprogram containing the active uniforms. uniformindices an array of gluint specifying the indices of the active uniforms to query. pname a glenum specifying which information to query. possible values: gl.uniform_type: returns an array of glenum indicating the types of the uniforms. gl.uniform_size: returns an array of gluint indicating the sizes of the uniforms. gl.uniform_block_index: returns an array of glint indicating the block indices of the uniforms. gl.uniform_offset: returns an array of glint indicating the uniform buffer offsets. gl.uniform_array_stride: returns an array...
...form buffer offsets. gl.uniform_array_stride: returns an array of glint indicating the strides between the elements. gl.uniform_matrix_stride: returns an array of glint indicating the strides between columns of a column-major matrix or a row-major matrix. gl.uniform_is_row_major: returns an array of glboolean indicating whether each of the uniforms is a row-major matrix or not. return value depends on which information is requested using the pname parameter. examples var uniformindices = gl.getuniformindices(program, ['ubored', 'ubogreen', 'uboblue']); var uniformoffsets = gl.getactiveuniforms(program, uniformindices, gl.uniform_offset); specifications specification status comment webgl 2.0the definition of 'getactiveuniforms' in that specification. e...
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 operatio...
...xel_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.bytelength 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 active. examples var buffer = gl.createbuffer(); gl...
WebGL2RenderingContext.getInternalformatParameter() - Web APIs
the webgl2renderingcontext.getinternalformatparameter() method of the webgl 2 api returns information about implementation-dependent support for internal formats. syntax any gl.getinternalformatparameter(target, internalformat, pname); parameters target a glenum specifying the target renderbuffer object. possible values: gl.renderbuffer: buffer data storage for single images in a renderable internal format. internalformat a glenum specifying the internal format about which to retrieve information (must be a color-renderable, depth-renderable or stencil-renderable format). pname a glenum specifying the type of information to query. possible values: gl.samples: returns a int32array containing sample counts supported for internalformat in descending order. r...
...it is an int32array if pname is gl.samples. ...
WebGL2RenderingContext.getSyncParameter() - Web APIs
the webgl2renderingcontext.getsyncparameter() method of the webgl 2 api returns parameter information of a webglsync object. syntax any gl.getsyncparameter(sync, pname); parameters sync a webglsync object. pname a glenum specifying which information to return. possible values: gl.object_type: returns a glenum indicating the type of the sync object (always gl.sync_fence). gl.sync_status: returns a glenum indicating the status of the sync object (gl.signaled or gl.unsignaled). ...
...bject (always gl.sync_fence). gl.sync_status: returns a glenum indicating the status of the sync object (gl.signaled or gl.unsignaled). gl.sync_condition: returns a glenum indicating the sync objects' condition (always gl.sync_gpu_commands_complete). gl.sync_flags: returns a glenum indicating the flags with which the sync object was created (always 0 as no flags are supported). return value depends on the pname parameter, either a glenum or a glbitfield. examples var sync = gl.fencesync(gl.sync_gpu_commands_complete, 0); gl.getsyncparameter(sync, gl.sync_status); specifications specification status comment webgl 2.0the definition of 'getsyncparameter' in that specification. editor's draft initial definition for webgl. opengl es 3.0the def...
WebGL2RenderingContext.invalidateFramebuffer() - Web APIs
the webgl2renderingcontext.invalidateframebuffer() method of the webgl 2 api invalidates the contents of attachments in a framebuffer. syntax void gl.invalidateframebuffer(target, attachments); parameters target a glenum specifying the binding point (target). possible values: gl.framebuffer: collection buffer data storage of color, alpha, depth and stencil buffers used to render an image. gl.draw_framebuffer: equivalent to gl.framebuffer. gl.read_framebuffer: used as a source for reading operations. attachments an array of glenum specifying the attachment points to invalidate. possible values: gl.color_attachment{0-15}: invalidates one of the framebuffer's color buffers. gl.depth_attachment: invalidates the framebuffer's depth buffer. gl.stencil_attachmen...
... examples gl.invalidateframebuffer(gl.read_framebuffer, [gl.color_attachment0, gl.color_attachment1]); specifications specification status comment webgl 2.0the definition of 'invalidateframebuffer' in that specification. editor's draft initial definition for webgl. ...
WebGL2RenderingContext.invalidateSubFramebuffer() - Web APIs
the webgl2renderingcontext.invalidatesubframebuffer() method of the webgl 2 api invalidates portions of the contents of attachments in a framebuffer. syntax void gl.invalidatesubframebuffer(target, attachments, x, y, width, height); parameters target a glenum specifying the binding point (target). possible values: gl.framebuffer: collection buffer data storage of color, alpha, depth and stencil buffers used to render an image. gl.draw_framebuffer: equivalent to gl.framebuffer. gl.read_framebuffer: used as a source for reading operations. attachments an array of glenum specifying the attachment points to invalidate. possible values: gl.color_attachment{0-15}: invalidates one of the framebuffer's color buffers. gl.depth_attachment: invalidates the framebuffer...
...l_attachment: invalidates both the framebuffer's depth and stencil buffer. x a glint specifying the left origin of the pixel rectangle to invalidate. y a glint specifying the bottom origin of the pixel rectangle to invalidate. width a glsizei specifying the width of the pixel rectangle to invalidate. height a glsizei specifying the height of the pixel rectangle to invalidate. return value none. examples gl.invalidatesubframebuffer(gl.read_framebuffer, [gl.color_attachment0, gl.color_attachment1], 0, 0, 256, 256); specifications specification status comment webgl 2.0the definition of 'invalidatesubframebuffer' in that specification. editor's draft initial definition for webgl. openg...
WebGL2RenderingContext.uniform[1234][uif][v]() - Web APIs
ui stands for unsigned integer, i for integer, f for float, and v for vector. not all combinations are valid: u cannot be combined with f. see the syntax table below. ...
...t, optional srclength); void gl.uniform2uiv(location, data, optional srcoffset, optional srclength); void gl.uniform3uiv(location, data, optional srcoffset, optional srclength); void gl.uniform4uiv(location, data, optional srcoffset, optional srclength); parameters location a webgluniformlocation object containing the location of the uniform attribute to modify. data, v0, v1, v2, v3 a new value to be used for the uniform variable. possible types: a number for unsigned integer values (methods with ui), for integer values (methods with i), or for floats (methods with f). a uint32array for unsigned integer vector methods (methods with uiv). return value none. specifications specification status comment webgl 2.0the definition of 'uniform' in that spec...
WebGL2RenderingContext.uniformMatrix[234]x[234]fv() - Web APIs
there are no 2x2, 3x3, and 4x4 versions of this method. they are abbreviated in 2, 3, and 4, respectively. see the syntax below. ...
...rix3x4fv(location, transpose, data, optional srcoffset, optional srclength); void gl.uniformmatrix4fv(location, transpose, data, optional srcoffset, optional srclength); parameters location a webgluniformlocation object containing the location of the uniform attribute to modify. transpose a glboolean specifying whether to transpose the matrix. must be false. data a float32array of float values. return value none. examples gl.uniformmatrix2x3fv(loc, false, [1, 2, 3, 4, 5, 6]); specifications specification status comment webgl 2.0the definition of 'uniformmatrix' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'gluniformmatrix' in that specification. standard man page of the (similar) ...
WebGLRenderingContext.bindBuffer() - Web APIs
the webglrenderingcontext.bindbuffer() method of the webgl api binds a given webglbuffer to a target. syntax void gl.bindbuffer(target, buffer); 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 another. gl.copy_write_buffer: buffer for copying from one buffer object to another. gl.transform_feedback_buffer: buffer for transform feedback operations. gl.uniform_buffer: buffer used for storing uniform ...
..._write_buffer: buffer for copying from one buffer object to another. gl.transform_feedback_buffer: buffer for transform feedback operations. gl.uniform_buffer: buffer used for storing uniform blocks. gl.pixel_pack_buffer: buffer used for pixel transfer operations. gl.pixel_unpack_buffer: buffer used for pixel transfer operations. buffer a webglbuffer to bind. return value none. exceptions only one target can be bound to a given webglbuffer. an attempt to bind the buffer to another target will throw an invalid_operation error and the current buffer binding will remain the same. a webglbuffer which has been marked for deletion with deletebuffer cannot be (re-)bound. an attempt to do so will generate an invalid_operation error, and the current binding will remain...
WebGLRenderingContext.bufferSubData() - Web APIs
ethod 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 another. gl.copy_write_buffer: buffer for cop...
...ions. 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.createbuffer(); gl.bindbuffer(gl.array_buffer, buffer)...
WebGLRenderingContext.clear() - Web APIs
the webglrenderingcontext.clear() method of the webgl api clears buffers to preset values. the preset values can be set by clearcolor(), cleardepth() or clearstencil(). the scissor box, dithering, and buffer writemasks can affect the clear() method. syntax void gl.clear(mask); parameters mask a glbitfield bitwise or mask that indicates the buffers to be cleared. possible values are: gl.color_buffer_bit gl.depth_buffer_bit gl.stencil_buffer_bit return value none. exceptions if mask is not one of the listed possible values, a gl.invalid_enum error is thrown. examples the clear() method accepts multiple values. ...
...rs to be cleared. possible values are: gl.color_buffer_bit gl.depth_buffer_bit gl.stencil_buffer_bit return value none. exceptions if mask is not one of the listed possible values, a gl.invalid_enum error is thrown. examples the clear() method accepts multiple values. gl.clear(gl.depth_buffer_bit); gl.clear(gl.depth_buffer_bit | gl.color_buffer_bit); to get the current clear values, query the color_clear_value, depth_clear_value, and stencil_clear_value constants. gl.getparameter(gl.color_clear_value); gl.getparameter(gl.depth_clear_value); gl.getparameter(gl.stencil_clear_value); specifications specification status comment webgl 1.0the definition of 'clear' in that specification. recommendation initial definition. opengl es 2.0th...
WebGLRenderingContext.copyTexSubImage2D() - Web APIs
the webglrenderingcontext.copytexsubimage2d() method of the webgl api copies pixels from the current webglframebuffer into an existing 2d texture sub-image. syntax void gl.copytexsubimage2d(target, level, xoffset, yoffset, x, y, width, height); parameters target a glenum specifying the binding point (target) of the active texture. possible values: gl.texture_2d: a two-dimensional texture. gl.texture_cube_map_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-mapped texture. gl.texture_cube_map_negative_y: negative y face for a cube-mapped texture. gl.texture_cube_map_positive_z: positive z face for a cube-mapped texture. gl.texture_cu...
...within the texture image. yoffset a glint specifying the vertical offset within the texture image. x a glint specifying the x coordinate of the lower left corner where to start copying. y a glint specifying the y coordinate of the lower left corner where to start copying. width a glsizei specifying the width of the texture. height a glsizei specifying the height of the texture. return value none. examples gl.copytexsubimage2d(gl.texture_2d, 0, 0,0, 0, 0, 16, 16); specifications specification status comment webgl 1.0the definition of 'copytexsubimage2d' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glcopytexsubimage2d' in that specification. standard man page of the (similar) opengl api. ...
WebGLRenderingContext.depthMask() - Web APIs
examples gl.depthmask(false); to get the current depth mask, query the depth_writemask constant which returns a boolean. ...
... examples gl.depthmask(false); to get the current depth mask, query the depth_writemask constant which returns a boolean. ...
WebGLRenderingContext.depthRange() - Web APIs
lrenderingcontext.depthrange() method of the webgl api specifies the depth range mapping from normalized device coordinates to window or viewport coordinates. syntax void gl.depthrange(znear, zfar); parameters znear a glclampf specifying the mapping of the near clipping plane to window or viewport coordinates. clamped to the range 0 to 1 and must be less than or equal to zfar. the default value is 0. zfar a glclampf specifying the mapping of the far clipping plane to window or viewport coordinates. clamped to the range 0 to 1. the default value is 1. return value none. examples gl.depthrange(0.2, 0.6); to check the current depth range, query the depth_range constant which returns a float32array gl.getparameter(gl.depth_range); // float32array[0.2, 0.6] specifications ...
...additionally, znear must be less than or equal to zfar. opengl es 2.0the definition of 'gldepthrangef' in that specification. standard man page of the opengl api. ...
WebGLRenderingContext.drawArrays() - Web APIs
the webglrenderingcontext.drawarrays() method of the webgl api renders primitives from array data. syntax void gl.drawarrays(mode, first, count); parameters mode a glenum specifying the type primitive to render. possible values are: gl.points: draws a single dot. gl.line_strip: draws a straight line to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. first a glint specifying the starting index in the array of vector points. count a glsizei specifying the number of indices to be rendered. return value none. exceptions if mode is not one of t...
...ertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. first a glint specifying the starting index in the array of vector points. count a glsizei specifying the number of indices to be rendered. return value none. exceptions if mode is not one of the accepted values, a gl.invalid_enum error is thrown. if first or count are negative, a gl.invalid_value error is thrown. if gl.current_program is null, a gl.invalid_operation error is thrown. examples gl.drawarrays(gl.points, 0, 8); specifications specification status comment webgl 1.0the definition of 'drawarrays' in that specification. recommendation initial definition. ...
WebGLRenderingContext.enableVertexAttribArray() - Web APIs
these are only available to the javascript code and the vertex shader. attributes are referenced by an index number into the list of attributes maintained by the gpu. ...
...ods can be used to access the attribute, including vertexattribpointer(), vertexattrib*(), and getvertexattrib(). syntax void gl.enablevertexattribarray(index); parameters index a gluint specifying the index number that uniquely identifies the vertex attribute to enable. if you know the name of the attribute but not its index, you can get the index by calling getattriblocation(). return value undefined. errors to check for errors after calling enablevertexattribarray(), call geterror(). webglrenderingcontext.invalid_value the specified index is invalid; that is, it's greater than or equal to the maximum number of entries permitted in the context's vertex attribute list, as indicated by the value of webglrenderingcontext.max_vertex_attribs. example this code — a snippet tak...
WebGLRenderingContext.getUniform() - Web APIs
the webglrenderingcontext.getuniform() method of the webgl api returns the value of a uniform variable at a given location. syntax any gl.getuniform(program, location); parameters program a webglprogram containing the uniform attribute. location a webgluniformlocation object containing the location of the uniform attribute to get. ...
... the webglrenderingcontext.getuniform() method of the webgl api returns the value of a uniform variable at a given location. syntax any gl.getuniform(program, location); parameters program a webglprogram containing the uniform attribute. location a webgluniformlocation object containing the location of the uniform attribute to get. ...
WebGLRenderingContext.sampleCoverage() - Web APIs
the webglrenderingcontext.samplecoverage() method of the webgl api specifies multi-sample coverage parameters for anti-aliasing effects. syntax void gl.samplecoverage(value, invert); parameters value a glclampf which sets a single floating-point coverage value clamped to the range [0,1]. the default value is 1.0. invert a glboolean which sets whether or not the coverage masks should be inverted. the default value is false. return value none. examples multi-sampling is disabled by default. ...
... sets whether or not the coverage masks should be inverted. the default value is false. return value none. examples multi-sampling is disabled by default. to enable or disable multi-sampling, use the enable() and disable() methods with the argument gl.sample_coverage and gl.sample_alpha_to_coverage. gl.enable(gl.sample_coverage); gl.samplecoverage(0.5, false); to check the sample coverage values, query the sample_coverage_value and sample_coverage_invert constants. gl.getparameter(gl.sample_coverage_value); // 0.5 gl.getparameter(gl.sample_coverage_invert); // false specifications specification status comment webgl 1.0the definition of 'samplecoverage' in that specification. recommendation initial definition. opengl es 2.0the definition of 'gl...
WebGLRenderingContext.viewport() - Web APIs
the webglrenderingcontext.viewport() method of the webgl api sets the viewport, which specifies the affine transformation of x and y from normalized device coordinates to window coordinates. syntax void gl.viewport(x, y, width, height); parameters x a glint specifying the horizontal coordinate for the lower left corner of the viewport origin. default value: 0. ...
...rt, which specifies the affine transformation of x and y from normalized device coordinates to window coordinates. syntax void gl.viewport(x, y, width, height); parameters x a glint specifying the horizontal coordinate for the lower left corner of the viewport origin. default value: 0. y a glint specifying the vertical coordinate for the lower left corner of the viewport origin. default value: 0. width a non-negative glsizei specifying the width of the viewport. default value: width of the canvas. height a non-negative glsizei specifying the height of the viewport. default value: height of the canvas. return value none. errors thrown if either width or height is a negative value, a gl.invalid_value error is thrown. examples when you first create a webgl context, the size of...
Color masking - Web APIs
t rendering is done every second, using the timer. the color mask state of webgl is preserved, so we do not need to call colormask() every frame to set up the color mask. this is an important aspect of the webgl state machine. it allows us to setup webgl in a single initialization phase, and then just execute drawing commands for each frame. color masking gives you fine control of updating pixel values on the screen. by limiting the color channels that are written by each drawing command, you can use each channel, for example, to store a different grayscale image. alternatively, you may use the rgb components for color, but the alpha component for some custom pixel data of your invention. finally, color masking teaches us that webgl is not only a state machine, it is also a graphics pipeline.
...y use the rgb components for color, but the alpha component for some custom pixel data of your invention. finally, color masking teaches us that webgl is not only a state machine, it is also a graphics pipeline. this means that graphics operations in webgl are done in a certain order, where the output of each operation serves as the input of the next. so, for example, clearing operation sets the value of each pixel to the chosen clear color. masking occurs later in the pipeline, and modifies the pixel color value, so the final result on the screen is that of the clear color, tinted by the color mask. <p>tinting the displayed colors with color masking.</p> <canvas>your browser does not seem to support html5 canvas.</canvas> <button id="red-toggle">on</button> <button id="green-toggle">on...
Animating objects with WebGL - Web APIs
square when drawing it. after translating to the initial drawing position for the square, we apply the rotation like this: mat4.rotate(modelviewmatrix, // destination matrix modelviewmatrix, // matrix to rotate squarerotation, // amount to rotate in radians [0, 0, 1]); // axis to rotate around this rotates the modelviewmatrix by the current value of squarerotation, around the z axis. to actually animate, we need to add code that changes the value of squarerotation over time. we can do that by creating a new variable to track the time at which we last animated (let's call it then), then adding the following code to the end of the main function var then = 0; // draw the scene repeatedly function render(now) { now *= 0.001; // ...
...frame passes us the time in milliseconds since the page loaded. we convert that to seconds and then subtract from it the last time to compute deltatime which is the number of second since the last frame was rendered. at the end of drawscene we add the code to update squarerotation. squarerotation += deltatime; this code uses the amount of time that's passed since the last time we updated the value of squarerotation to determine how far to rotate the square. view the complete code | open this demo on a new page « previousnext » ...
Using shaders to apply color in WebGL - Web APIs
then a new webgl buffer is allocated to store these colors, and the array is converted into floats and stored into the buffer. to use these colors, the vertex shader needs to be updated to pull the appropriate color from the color buffer: const vssource = ` attribute vec4 avertexposition; attribute vec4 avertexcolor; uniform mat4 umodelviewmatr...
... the key difference here is that for each vertex, we pass its color using a varying to the fragment shader. coloring the fragments as a refresher, here's what our fragment shader looked like previously: const fssource = ` void main() { gl_fragcolor = vec4(1.0, 1.0, 1.0, 1.0); } `; in order to pick up the interpolated color for each pixel, we need to change this to fetch the value from the vcolor varying: const fssource = ` varying lowp vec4 vcolor; void main(void) { gl_fragcolor = vcolor; } `; each fragment receives the interpolated color based on its position relative to the vertex positions instead of a fixed value. drawing using the colors next, it's necessary to add code to look up the attribute location for the colors and setup that attrib...
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
ain one stream, at index 0, because we passed one stream into addtrack() earlier. we add an unmute event handler to the track, because the track will become unmuted once it starts receiving packets. we put the remainder of our reception code in there. if we already have video coming in from the remote peer (which we can see if the remote view's <video> element's srcobject property already has a value), we do nothing. otherwise, we set srcobject to the stream at index 0 in the streams array. the perfect negotiation logic now we get into the true perfect negotiation logic, which functions entirely independently from the rest of the application. handling the negotiationneeded event first, we implement the rtcpeerconnection event handler onnegotiationneeded to get a local description and send...
... the current signalingstate. the set description is either an answer to the most recent offer from the remote peer or a freshly-created offer if there's no negotiation underway. here, it will be always be an offer, because the negotiationneeded event is only fired in stable state. we set a boolean variable, makingoffer to true to mark that we're preparing an offer. to avoid races, we'll use this value later instead of the signaling state to determine whether or not an offer is being processed because the value of signalingstate changes asynchronously, introducing a glare opportunity. once the offer has been created, set and sent (or an error occurs), makingoffer gets set back to false. handling incoming ice candidates next, we need to handle the rtcpeerconnection event icecandidate, which i...
Signaling and video calling - Web APIs
input, a mediastream object representing the stream with audio from the user's microphone and video from their webcam. note: we could restrict the set of permitted media inputs to a specific device or set of devices by calling navigator.mediadevices.enumeratedevices() to get a list of devices, filtering the resulting list based on our desired criteria, then using the selected devices' deviceid values in the deviceid field of the the mediaconstraints object passed into getusermedia(). in practice, this is rarely if ever necessary, since most of that work is done for you by getusermedia(). we attach the incoming stream to the local preview <video> element by setting the element's srcobject property. since the element is configured to automatically play incoming video, the stream begins playi...
... if they're behind a firewall or using nat. note: you should always use stun/turn servers which you own, or which you have specific authorization to use. this example is using a known public stun server but abusing these is bad form. each object in iceservers contains at least a urls field providing urls at which the specified server can be reached. it may also provide username and credential values to allow authentication to take place, if needed. after creating the rtcpeerconnection, we set up handlers for the events that matter to us. the first three of these event handlers are required; you have to handle them to do anything involving streamed media with webrtc. the rest aren't strictly required but can be useful, and we'll explore them. there are a few other events available that we'...
A simple RTCDataChannel sample - Web APIs
} } the handlereceivechannelstatuschange() method receives as an input parameter the event which occurred; this will be an rtcdatachannelevent. sending messages when the user presses the "send" button, the sendmessage() method we've established as the handler for the button's click event is called. that method is simple enough: function sendmessage() { var message = messageinputbox.value; sendchannel.send(message); messageinputbox.value = ""; messageinputbox.focus(); } first, the text of the message is fetched from the input box's value attribute. this is then sent to the remote peer by calling sendchannel.send(). that's all there is to it! the rest of this method is just some user experience sugar -- the input box is emptied and re-focused so the user can immedia...
...then all the saved references to these objects are set to null to avoid accidental reuse, and the user interface is updated to reflect the fact that the connection has been closed. next steps you should try out this example and take a look at the webrtc-si...
Writing WebSocket servers - Web APIs
dealt with them. tip: all browsers send an origin header. you can use this header for security (checking for same origin, automatically allowing or denying, etc.) and send a 403 forbidden if you don't like what you see. however, be warned that non-browser agents can send a faked origin. most applications reject requests without this header. if any header is not understood or has an incorrect value, the server should send a 400 ("bad request")} response and immediately close the socket. as usual, it may also give the reason why the handshake failed in the http response body, but the message may never be displayed (browsers do not display it). if the server doesn't understand that version of websockets, it should send a sec-websocket-version header back that contains the version(s) it does u...
... and return the base64 encoding of that hash. note: this seemingly overcomplicated process exists so that it's obvious to the client whether the server supports websockets. this is important because security issues might arise if the server accepts a websockets connection but interprets the data as a http request. so if the key was "dghlihnhbxbszsbub25jzq==", the sec-websocket-accept header's value is "s3pplmbitxaq9kygzzhzrbk+xoo=". once the server sends these headers, the handshake is complete and you can start swapping data! note: the server can send other headers like set-cookie, or ask for authentication or redirects via other status codes, before sending the reply handshake. keeping track of clients this doesn't directly relate to the websocket protocol, but it's worth mentioning ...
Functions and classes available to Web Workers - Web APIs
0.1 filereader this api allows asynchronous read of blob and file objects. 46 (46) no support (yes) no support filereadersync this api allows synchronous read of blob and file objects. this is an api that works only in workers. 8 (8) no support no support no support formdata formdata objects provide a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the xmlhttprequest send() method. ? (should be in 39 (39)) ? (yes) ? imagedata the underlying pixel data of an area of a canvas element. manipulating such data can be a complex task better suited to be delegated to a web worker. 25 (25) no support no support no support ...
... can then be easily sent using the xmlhttprequest send() method. ? (should be in 39 (39)) ? (yes) ? imagedata the underlying pixel data of an area of a canvas element. manipulating such data can be a complex task better suited to be delegated to a web worker. 25 (25) no support no support no support indexeddb database to store records holding simple values and hierarchical objects. 37 (37), 42 (42) for idbcursorwithvalue. 10.0 (yes) 10.1 network information api provides information about the system's connection in terms of general connection type (e.g., 'wifi', 'cellular', etc.). 53.0 (53) only on mobile (yes) only on mobile no support no support notifications allows web pages to control the display...
WheelEvent - Web APIs
mplemented the non-standard and non-cross-browser-compatible mousewheelevent and mousescrollevent interfaces. use this interface and avoid the non-standard ones. do not confuse the wheel event with the scroll event: the default action of a wheel event is implementation-defined. thus, a wheel event doesn't necessarily dispatch a scroll event. even when it does, that doesn't mean that the delta* values in the wheel event necessarily reflect the content's scrolling direction. therefore, do not rely on delta* properties to get the content's scrolling direction. instead, detect value changes to scrollleft and scrolltop of the target in the scroll event. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-ali...
...mouseevent, uievent, and event. wheelevent.deltaxread only returns a double representing the horizontal scroll amount. wheelevent.deltayread only returns a double representing the vertical scroll amount. wheelevent.deltazread only returns a double representing the scroll amount for the z-axis. wheelevent.deltamoderead only returns an unsigned long representing the unit of the delta* values' scroll amount. permitted values are: constant value description wheelevent.dom_delta_pixel 0x00 the delta* values are specified in pixels. wheelevent.dom_delta_line 0x01 the delta* values are specified in lines. wheelevent.dom_delta_page 0x02 the delta* values are specified in pages. methods thi...
window.cancelIdleCallback() - Web APIs
example see our complete example in the article cooperative scheduling of background tasks api. specifications specification status comment cooperative scheduling of background tasks proposed recommendation initial definition. ...
... example see our complete example in the article cooperative scheduling of background tasks api. specifications specification status comment cooperative scheduling of background tasks proposed recommendation initial definition. ...
Window.crypto - Web APIs
Web › API › Window › crypto
s object allows web pages access to certain cryptographic related services. although the property itself is read-only, all of its methods (and the methods of its child object, subtlecrypto) are not read-only, and therefore vulnerable to attack by polyfill. although window.crypto is available on all windows, the returned crypto object only has one usable feature in insecure contexts: the getrandomvalues() method. in general, you should use this api only in secure contexts. syntax var cryptoobj = window.crypto || window.mscrypto; // for ie 11 value an instance of the crypto interface, providing access to general-purpose cryptography and a strong random-number generator. example this example uses the window.crypto property to access the getrandomvalues() method. javascript genrandomnumbe...
... = window.crypto || window.mscrypto; // for ie 11 value an instance of the crypto interface, providing access to general-purpose cryptography and a strong random-number generator. example this example uses the window.crypto property to access the getrandomvalues() method. ...
Window.event - Web APIs
Web › API › Window › event
in addition, window.event is not accurate for events dispatched within shadow trees. ...
...in addition, window.event is not accurate for events dispatched within shadow trees. specifications specification status comment domthe definition of 'window.event' in that specification. living standard initial definition. browser compatibility the compatibility table on this page is generated from structured data. ...
Window.getSelection() - Web APIs
when cast to string, either by appending an empty string ("") or using selection.tostring(), this object returns the text selected. when called on an <iframe> that is not displayed (eg. where display: none is set) firefox will return null, whereas other browsers will return a selection object with selection.type set to none. ...
... to none. examples function foo() { var selobj = window.getselection(); alert(selobj); var selrange = selobj.getrangeat(0); // do stuff with the range } notes string representation of the selection object in javascript, when an object is passed to a function expecting a string (like window.alert() or document.write()), the object's tostring() method is called and the returned value is passed to the function. this can make the object appear to be a string when used with other functions 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 i...
Window.openDialog() - Web APIs
Web › API › Window › openDialog
ers will then get packed into a property named arguments of type array, and this property gets added to the newly opened dialog window. to access these extra parameters from within dialog code, use the following scheme: var food = window.arguments[0]; var price = window.arguments[1]; note that you can access this property from within anywhere in the dialog code. (another example). ...
...r food = window.arguments[0]; var price = window.arguments[1]; note that you can access this property from within anywhere in the dialog code. (another example). returning values from the dialog since window.close() erases all properties associated with the dialog window (i.e. the variables specified in the javascript code which gets loaded from the dialog), it is not possible to pass return values back past the close operation using globals (or any other constructs). to be able to pass values back to the caller, you have to supply some object via the extra parameters. you can then access this object from within the dialog code and set properties on it, containing the values you want to return or preserve past the window.close() operation. var retvals = { address: null, delivery: null };...
Window: popstate event - Web APIs
tate(), set the entry's title to the string returned by its document.title attribute. if the browser has state information it wishes to store with the current-entry before navigating away from it, it then does so. the entry is now said to have "persisted user state." this information the browser might add to the history session entry may include, for instance, the document's scroll position, the values of form inputs, and other such data. if new-entry has a different document object than current-entry, the browsing context is updated so that its document property refers to the document referred to by new-entry, and the context's name is updated to match the context name of the now-current document. each form control within new-entry's document that has autocomplete configured with its autofi...
...rom the history stack. if the new-entry doesn't have persisted user state and its url's fragment is non-null, the document is scrolled to that fragment. next, current-entry is set to new-entry. the destination entry is now considered to be current. if new-entry has serialized state information saved with it, that information is deserialized into history.state; otherwise, state is null. if the value of state changed, the popstate event is sent to the document. any persisted user state is restored, if the browser chooses to do so. if the original and new entry's shared the same document, but had different fragments in their urls, send the hashchange event to the window. as you can see, the popstate event is nearly the last thing done in the process of navigating pages in this way. exampl...
window.requestIdleCallback() - Web APIs
elapses. you can call requestidlecallback() within an idle callback function to schedule another callback to take place no sooner than the next pass through the event loop. a timeout option is strongly recommended for required work, as otherwise it's possible multiple seconds will elapse before the callback is fired. syntax var handle = window.requestidlecallback(callback[, options]) return value an id which can be used to cancel the callback by passing it into the window.cancelidlecallback() method. parameters callback a reference to a function that should be called in the near future, when the event loop is idle. the callback function is passed an idledeadline object describing the amount of time available and whether or not the callback has been run because the timeout period exp...
...hould be called in the near future, when the event loop is idle. the callback function is passed an idledeadline object describing the amount of time available and whether or not the callback has been run because the timeout period expired. options optional contains optional configuration parameters. currently only one property is defined: timeout: if timeout is specified and has a positive value, and the callback has not already been called by the time timeout milliseconds have passed, the callback will be called during the next idle period, even if doing so risks causing a negative performance impact. example see our complete example in the article cooperative scheduling of background tasks api. specifications specification status comment cooperative sch...
Window.scrollBy() - Web APIs
Web › API › Window › scrollBy
- or - options is a scrolltooptions dictionary. ...
... - or - options is a scrolltooptions dictionary. ...
Window.scrollY - Web APIs
Web › API › Window › scrollY
the read-only scrolly property of the window interface returns the number of pixels that the document is currently scrolled vertically. this value is subpixel precise in modern browsers, meaning that it isn't necessarily a whole number. you can get the number of pixels the document is scrolled horizontally from the scrollx property. syntax var y = window.scrolly value in practice, the returned value is a double-precision floating-point value indicating the number of pixels the document is currently scrolled vertically from the origin, where a positive value means the content is scrolled to upward. if the document is rendered on a subpixel-precise device, then the returned value is also subpixel-precise and may contain a decimal component. if the document isn't scrolled at all up or down, t...
...ue indicating the number of pixels the document is currently scrolled vertically from the origin, where a positive value means the content is scrolled to upward. if the document is rendered on a subpixel-precise device, then the returned value is also subpixel-precise and may contain a decimal component. if the document isn't scrolled at all up or down, then scrolly is 0. if you need an integer value, you can use math.round() to round it off. in more technical terms, scrolly returns the y coordinate of the top edge of the current viewport. if there is no viewport, the returned value is 0. example // make sure and go down to the second page if (window.scrolly) { window.scroll(0, 0); // reset the scroll position to the top left of the document. } window.scrollbypages(1); notes use thi...
Window.speechSynthesis - Web APIs
examples in our basic speech synthesiser demo, we first grab a reference to the speechsynthesis controller using window.speechsynthesis. ...
...tion.setattribute('data-lang', voices[i].lang); option.setattribute('data-name', voices[i].name); voiceselect.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]; } } synth.speak(utterthis); inputtxt.blur(); } specifications specification status comment web speech apithe definition of 'speechsynthesis' in that specificatio...
Worker() - Web APIs
Web › API › Worker › Worker
ers. syntax var myworker = new worker(aurl, options); parameters aurl a usvstring representing the url of the script the worker will execute. it must obey the same-origin policy. options optional an object containing option properties that can be set when creating the object instance. available properties are as follows: type: a domstring specifying the type of worker to create. the value can be classic or module. if not specified, the default used is classic. credentials: a domstring specifying the type of credentials to use for the worker. the value can be omit, same-origin, or include. if not specified, or if type is classic, the default used is omit (no credentials required). name: a domstring specifying an identifying name for the dedicatedworkerglobalscope representing t...
...rkerror is raised if the mime type of the worker script is incorrect. it should always be text/javascript. a syntaxerror is raised if aurl cannot be parsed. examples the following code snippet shows creation of a worker object using the worker() constructor and subsequent usage of the object: var myworker = new worker('worker.js'); first.onchange = function() { myworker.postmessage([first.value,second.value]); console.log('message posted to worker'); } for a full example, see our basic dedicated worker example (run dedicated worker). specifications specification status comment html living standardthe definition of 'worker()' in that specification. living standard ...
WritableStreamDefaultWriter.desiredSize - Web APIs
exceptions typeerror the writer’s lock is released. ...
... exceptions typeerror the writer’s lock is released. ...
XDomainRequest.onload - Web APIs
...
... ...
XDomainRequest.send() - Web APIs
...
...request which has previously been opened calling xdomainrequest.open(). syntax xdr.send(data); parameters data the form data to be sent with the request. this parameter is optional for get requests. example var xdr = new xdomainrequest(); xdr.open("post", "http://example.com/api/method"); xdr.onload = function(){ //handle response with xdr.responsetext } xdr.send("param1=value1&param2=value2"); specification not part of any specification. ...
How to check the security state of an XMLHTTPRequest over SSL - Web APIs
let nsserr = math.abs(nsinsserrorsservice.nss_sec_error_base) - (status & 0xffff); switch (nsserr) { case 11: // sec_error_expired_certificate,...
..._cert) { errtype = 'securitycertificate'; } else { errtype = 'securityprotocol'; } // nss_sec errors (happen below the base value because of negative vals) if ((status & 0xffff) < math.abs(nsinsserrorsservice.nss_sec_error_base)) { // the bases are actually negative, so in our positive numeric space, we // need to subtract the base off our value. let nsserr = math.abs(nsinsserrorsservice.nss_sec_error_base) - (status & 0xffff); switch (nsserr) { case 11: // sec_error_expired_certificate, sec(11) errname = 'securityexpiredcertificateerror'; break; case 12: // sec_error_revoked_certificate, sec(12) errname = 'securityrevokedcertificateerror'; break; // ...
Sending and Receiving Binary Data - Web APIs
the response property will contain the entity body according to responsetype, as an arraybuffer, blob, document, json, or string. this is null if the request is not complete or was not successful. this example reads an image as a binary file and creates an 8-bit unsigned integer array from the raw bytes. ...
... binary content asynchronously, using the post method, and firefox's non-standard sendasbinary(). var req = new xmlhttprequest(); req.open("post", url, true); // set headers and mime-type appropriately req.setrequestheader("content-length", 741); req.sendasbinary(abody); line 4 sets the content-length header to 741, indicating that the data is 741 bytes long. obviously you need to change this value based on the actual size of the data being sent. line 5 uses the sendasbinary() method to initiate the request. note: this non-standard sendasbinary method is considered deprecated as of gecko 31 (firefox 31 / thunderbird 31 / seamonkey 2.28) and will be removed soon. the standard send(blob data) method can be used instead as explained above. you can also send binary content by passing an inst...
XMLHttpRequest.open() - Web APIs
xmlhttprequest.open(method, url[, async[, user[, password]]]) parameters method the http request method to use, such as "get", "post", "put", "delete", etc. ignored for non-http(s) urls. url a domstring representing the url to send the request to. async optional an optional boolean parameter, defaulting to true, indicating whether or not to perform the operation asynchronously. if this value is false, the send() method does not return until the response is received. if true, notification of a completed transaction is provided using event listeners. this must be true if the multipart attribute is true, or an exception will be thrown. note: synchronous requests on the main thread can be easily disruptive to the user experience and should be avoided; in fact, many browsers have depreca...
...rue, or an exception will be thrown. note: synchronous requests on the main thread can be easily disruptive to the user experience and should be avoided; in fact, many browsers have deprecated synchronous xhr support on the main thread entirely. synchronous requests are permitted in workers. user optional the optional user name to use for authentication purposes; by default, this is the null value. password optional the optional password to use for authentication purposes; by default, this is the null value. specifications specification status comment xmlhttprequestthe definition of 'open()' in that specification. living standard whatwg living standard ...
XMLHttpRequest.response - Web APIs
the xmlhttprequest response property returns the response's body content as an arraybuffer, blob, document, javascript object, or domstring, depending on the value of the request's responsetype property. syntax var body = xmlhttprequest.response; value an appropriate object based on the value of responsetype. you may attempt to request the data be provided in a specific format by setting the value of responsetype after calling open() to initialize the request but before calling send() to send the request to the server. ...
... the response types are described below. ...
XMLHttpRequest.responseText - Web APIs
the read-only xmlhttprequest property responsetext returns the text received from a server following a request being sent. syntax var resulttext = xmlhttprequest.responsetext; value a domstring which contains either the textual data received using the xmlhttprequest or null if the request failed or "" if the request has not yet been sent by calling send(). while handling an asynchronous request, the value of responsetext always has the current content received from the server, even if it's incomplete because the data has not been completely received yet. you know the entire content has been received when the value of readystate becomes xmlhttprequest.done (4), and status becomes 200 ("ok"). exceptions invalidstateerror the xmlhttprequest.responsetype is not set to either...
...it's incomplete because the data has not been completely received yet. you know the entire content has been received when the value of readystate becomes xmlhttprequest.done (4), and status becomes 200 ("ok"). exceptions invalidstateerror the xmlhttprequest.responsetype is not set to either the empty string or "text". since the responsetext property is only valid for text content, any other value is an error condition. example var xhr = new xmlhttprequest(); xhr.open('get', '/server', true); // if specified, responsetype must be empty string or "text" xhr.responsetype = 'text'; xhr.onload = function () { if (xhr.readystate === xhr.done) { if (xhr.status === 200) { console.log(xhr.response); console.log(xhr.responsetext); } } }; xhr.sen...
XMLHttpRequest.setRequestHeader() - Web APIs
each time you call setrequestheader() after the first time you call it, the specified text is appended to the end of the existing header's content. if no accept header has been set using this, an accept header with the type "*/*" is sent with the request when send() is called. for security reasons, some headers can only be controlled by the user agent. these headers include the forbidden header names and forbidden response header names. ...
...lude the forbidden header names and forbidden response header names. note: for your custom fields, you may encounter a "not allowed by access-control-allow-headers in preflight response" exception when you send requests across domains. in this situation, you need to set up the access-control-allow-headers in your response header at server side. syntax xmlhttprequest.setrequestheader(header, value) parameters header the name of the header whose value is to be set. value the value to set as the body of the header. return value undefined. specifications specification status comment xmlhttprequestthe definition of 'setrequestheader()' in that specification. living standard whatwg living standard ...
XMLHttpRequest.withCredentials - Web APIs
at indicates whether or not cross-site access-control requests should be made using credentials such as cookies, authorization headers or tls client certificates. setting withcredentials has no effect on same-site requests. in addition, this flag is also used to indicate when cookies are to be ignored in the response. the default is false. xmlhttprequest from a different domain cannot set cookie values for their own domain unless withcredentials is set to true before making the request. the third-party cookies obtained by setting withcredentials to true will still honor same-origin policy and hence can not be accessed by the requesting script through document.cookie or from response headers. note: this never affects same-site requests. note: xmlhttprequest responses from a different domai...
...in unless withcredentials is set to true before making the request. the third-party cookies obtained by setting withcredentials to true will still honor same-origin policy and hence can not be accessed by the requesting script through document.cookie or from response headers. note: this never affects same-site requests. note: xmlhttprequest responses from a different domain cannot set cookie values for their own domain unless withcredentials is set to true before making the request, regardless of access-control- header values. example var xhr = new xmlhttprequest(); xhr.open('get', 'http://example.com/', true); xhr.withcredentials = true; xhr.send(null); specifications specification status comment xmlhttprequest living standard whatwg living standard ...
XMLHttpRequest - Web APIs
herits properties of xmlhttprequesteventtarget and of eventtarget. xmlhttprequest.onreadystatechange an eventhandler that is called whenever the readystate attribute changes. xmlhttprequest.readystate read only returns an unsigned short, the state of the request. xmlhttprequest.response read only returns an arraybuffer, blob, document, javascript object, or a domstring, depending on the value of xmlhttprequest.responsetype, that contains the response entity body. xmlhttprequest.responsetext read only returns a domstring that contains the response to the request as text, or null if the request was unsuccessful or has not yet been sent. xmlhttprequest.responsetype is an enumerated value that defines the response type. xmlhttprequest.responseurl read only returns the serialized u...
...se has not yet been received or the header doesn't exist in the response. xmlhttprequest.open() initializes a request. xmlhttprequest.overridemimetype() overrides the mime type returned by the server. xmlhttprequest.send() sends the request. if the request is asynchronous (which is the default), this method returns as soon as the request is sent. xmlhttprequest.setrequestheader() sets the value of an http request header. you must call setrequestheader()after open(), but before send(). non-standard methods xmlhttprequest.init() initializes the object for use from c++ code. warning: this method must not be called from javascript. xmlhttprequest.openrequest() initializes a request. this method is to be used from native code; to initialize a request from javascript code, use open...
XMLHttpRequestEventTarget.onload - Web APIs
the context) is the same xmlhttprequest this callback is related to. ...
...the context) is the same xmlhttprequest this callback is related to. ...
XMLHttpRequestResponseType - Web APIs
arraybuffer the response is a javascript arraybuffer containing binary data. blob the response is a blob object containing the binary data. document the response is an html document or xml xmldocument, as appropriate based on the mime type of the received data. ...
...in xmlhttprequest to learn more about using xhr to fetch html content. json the response is a javascript object created by parsing the contents of received data as json. text the response is a text in a domstring object. ms-stream the response is part of a streaming download; this response type is only allowed for download requests, and is only supported by internet explorer. deprecated values moz-chunked-arraybuffer a firefox-only value which instructs xmlhttprequest to deliver arraybuffer objects containing chunks of the incoming data. accessing response during a progress event returns the data received so far. outside the progress event handler, the value of response is always null. you shouldn't use this non-standard (and, as of firefox 68, entirely removed) api; instead, ...
XPathResult.resultType - Web APIs
the read-only resulttype property of the xpathresult interface represents the type of the result, as defined by the type constants. note: this feature is available in web workers. syntax var resulttype = result.resulttype; return value an integer value representing the type of the result, as defined by the type constants. constants result type defined constant value description any_type 0 a result set containing whatever type naturally results from evaluation of the expression. note that if the result is a node-set then unordered_node_iterator_type is always the resulting type. number_type 1 a result containing a single number. this is useful for example, in an xpath expression using the count() function. string_type 2 a r...
... of the expression. note that if the result is a node-set then unordered_node_iterator_type is always the resulting type. number_type 1 a result containing a single number. this is useful for example, in an xpath expression using the count() function. string_type 2 a result containing a single string. boolean_type 3 a result containing a single boolean value. this is useful for example, in an xpath expression using the not() function. unordered_node_iterator_type 4 a result node-set containing all the nodes matching the expression. the nodes may not necessarily be in the same order that they appear in the document. ordered_node_iterator_type 5 a result node-set containing all the nodes matching the expression. the nodes ...
XPathResult.snapshotLength - Web APIs
exceptions type_err in case xpathresult.resulttype is not unordered_node_snapshot_type or ordered_node_snapshot_type, an xpathexception of type type_err is thrown. example the following example shows the use of the snapshotlength property. ...
... exceptions type_err in case xpathresult.resulttype is not unordered_node_snapshot_type or ordered_node_snapshot_type, an xpathexception of type type_err is thrown. example the following example shows the use of the snapshotlength property. ...
XRInputSource.gripSpace - Web APIs
ad-only xrinputsource property gripspace returns an xrspace whose native origin tracks the pose used to render virtual objects so they appear to be held in (or part of) the user's hand. for example, if a user were holding a virtual straight rod, the native origin of this xrspace would be located at the approximate center of mass of the user's fist. syntax var xrspace = xrinputsource.gripspace; value an xrspace object representing the position and orientation of the input device in virtual space, suitable for rendering an image of the device into the scene. gripspace is null if the input source is inherently untrackable. for example, only inputs whose targetraymode is tracked-pointer provide a gripspace. imagine that the controller is shaped like a straight rod, held in the user's fist. the...
...ce is used to render a mesh that represents the position and orieintation of the controller in the virtual environment. for (let source in xrsession.inputsources) { if (source.gripspace) { let grippose = frame.getpose(source.gripspace, xrrefspace); if (grippose) { mydrawmeshusingtransform(controllermesh, grippose.transform.matrix); } } } for each input source which has a value for gripspace, this loop obtains the xrpose representing the position and orientation that are described by gripspace. if a valid pose is returned, a method mydrawmeshusingtransform() is called to draw the controller's mesh transformed using the grip pose's transform matrix. specifications specification status comment webxr device apithe definition of 'xrinputsource.gri...
XRInputSource.targetRayMode - Web APIs
the read-only xrinputsource property targetraymode indicates the method by which the target ray for the input source should be generated and how it should be presented to the user. syntax let raymode = xrinputsource.targetraymode; value a domstring taken from the xrtargetraymode enumerated type, indicating which method to use when generating and presenting the target ray to the user. the possible values are: gaze the user is using a gaze-tracking system (or gaze input) which detects the direction in which the user is looking. the target ray will be drawn originating at the viewer's eyes and will follow the direction in which they're looking. screen the direction of the target ray is indicated using a tap on a touch screen, mouse, or other tactile input device. tracked-pointer tar...
...ng the user is pointing their index finger straight out from their hand. usage notes the input source's targetrayspace indicates the position and orientation of the target ray, and can be used to determine where to render the ray. example this fragment of code shows part of a function to be called once every frame. it looks for inputs which have a non-null targetrayspace. inputs which have a value for this property represent inputs that project a target ray outward from the user. for each such input, this example looks for inputs whose targetraymode is tracked-pointer, indicating that the input is in fact intended to represent a targeting device rather than a gazing device, screen tap, or mouse click. for tracked pointers, a function myrendertargetrayasbeam() is called to render a beam fr...
XRInputSource - Web APIs
ic to the platform being used, but provides the direction in which it is being aimed and optionally may generate events if the user triggers performs actions using the device. properties gamepad read only a gamepad object describing the state of the buttons and axes on the xr input source, if it is a gamepad or comparable device. if the device isn't a gamepad-like device, this property's value is null. note: while xrinputsource uses the gamepad interface from the gamepad api, this input device is strictly associated with the webxr hardware and is not a general-purpose gaming device. gripspaceread only an xrspace whose origin tracks the pose which is used to render objects which should appear as if they're held in the hand indicated by handedness. the orientation of this space in...
...der objects which should appear as if they're held in the hand indicated by handedness. the orientation of this space indicates the angle at which the hand is gripping the object. read on in the main article on gripspace for more details on how to use this space. handednessread only a domstring that indicates which hand the device represented by this xrinputsource is being used in, if any. the value will be left, right, or none. profilesread only an array of domstring objects, each specifying the name of an input profile describing the preferred visual representation and behavior of this input source. targetraymoderead only a domstring indicating the methodology used to produce the target ray: gaze, tracked-pointer, or screen. targetrayspaceread only an xrspace object defining t...
XRInputSourceArray.entries() - Web APIs
the xrinputsourcearray interface's entries() method returns a javascript iterator which can then be used to iterate over the key/value pairs in the input source array. each item in the array is an xrinputsource object. most frequently, you will use this in tandem with statements such as for...of. syntax let inputsourceiterator = xrinputsourcearray.entries(); for (let entry of xrinputsourcearray.entries()) { /* ... */ } parameters none. return value an iterator which can be used to walk through the list of xrinputsource objects included in the input source array. examples this example snippet gets the list of inputs for a session and tries to handle each type of input device it supports using. let sources = xrsession.inputsources; for (let input of sources.entries()) { if (in...
...od. specifications specification status comment webxr device apithe definition of 'xrinputsourcearray' in that specification.1 working draft xrinputsourcearray interface [1] see iterator-like methods in information contained in a webidl file for information on how an iterable declaration in an interface definition causes entries(), foreach(), keys(), and values() methods to be exposed from objects that implement the interface. ...
XRInputSourceArray.keys() - Web APIs
the keys() method in the xrinputsourcearray interface returns a javascript iterator which can then be used to iterate over the keys used to reference each item in the array of input sources. syntax xrinputsourcearray.keys(); parameters none. return value a javascript iterator that can be used to walk through the keys for each entry in the list of input sources. the values returned by the iterator are the indexes of each entry in the list; that is, the numbers 0, 1, 2, and so forth through the index of the last item in the list. examples this example snippet gets the list of inputs for a session and tries to handle each type of input device it supports using. for (const inputidx of xrsession.inputsources.keys()) { /* the keys are the indexes into the list of inputs */ checkinput...
...x]. specifications specification status comment webxr device apithe definition of 'xrinputsourcearray' in that specification.1 working draft xrinputsourcearray interface [1] see iterator-like methods in information contained in a webidl file for information on how an iterable declaration in an interface definition causes entries(), foreach(), keys(), and values() methods to be exposed from objects that implement the interface. ...
XRInputSourceArray - Web APIs
each entry is an xrinputsource representing one input device connected to the webxr system. in addition to being able to access the input sources in the list using standard array notation (that is, with index numbers insize square brackets), methods are available to allow the use of iterators and the foreach() method is also available. properties the following properties are available on xrinputsourcearray objects. length read only the number of xrinputsource objects in the list. ...
...ors 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 index. foreach() iterates over each item in the list, in order from first to last. keys() a list of the keys corresponding to the entries in the input source list. values() returns an iterator you can use to go through all the values in the list. each item is ...
XRPermissionStatus.granted - Web APIs
the webxr device api's xrpermissionstatus interface's granted property is an array of strings, each identifying one of the webxr features for which permission has been granted as of the time at which the permission api's navigator.permissions.query() method was called. syntax grantedfeatures = xrpermissionstatus.granted; value an array of domstring objects, each identifying a single webxr feature which the app or site has been granted permission to use. currently, all of these strings come from the xrreferencespacetype enumerated type. the types of reference space are listed in the table below, with brief information about their use cases and which interface is used to implement them. xrreferencespacetype description interface bounded-floor similar to ...
...t all beyond their starting position, and tracking is optimized for this use case. for devices with six degrees of freedom (6dof) tracking, the local reference space tries to keep the origin stable relative to the environment. xrreferencespace local-floor similar to the local type, except the starting position is placed in a safe location for the viewer to stand, where the value of the y axis is 0 at floor level. if that floor level isn't known, the user agent will estimate the floor level. if the estimated floor level is non-zero, the browser is expected to round it such a way as to avoid fingerprinting (likely to the nearest centimeter). xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely l...
XRPose.transform - Web APIs
Web › API › XRPose › transform
this is the same pose that's returned by the frame's getpose() method. ...
...s xrpose is aligned. this is the same pose that's returned by the frame's getpose() method. example this handler for the xrsession event select handles events for tracked pointers. it determines the targeted object by passing the event frame's pose into a function called findtargetusingray(), then dispatches the event differently depending on the user's handedness; this is done by comparing the value of the xrinputsource property handedness to a value in the variable user.handedness. if the source is a controller in the user's primary hand, a function is called on the targeted object called primaryaction(); otherwise, it calls the targeted object's offhandaction() function. xrsession.addeventlistener("select", event => { let source = event.inputsource; let frame = event.frame; let targ...
XRPose - Web APIs
Web › API › XRPose
m a source other than the xr device, such as keyboard or mouse inputs. see the article movement, orientation, and motion for further details and an example with thorough explanations of what's going on. properties xrpose.transform read only a xrrigidtransform which provides the position and orientation of the pose relative to the base xrspace. xrpose.emulatedposition read only a boolean value which is false if the position and orientation given by transform is obtained directly from a full six degree of freedom (6dof) xr device (that is, a device which tracks not only the pitch, yaw, and roll of the head but also the forward, backward, and side-to-side motion of the viewer). if any component of the transform is computed or created artificially (such as by using mouse or keyboard contr...
...nd orientation given by transform is obtained directly from a full six degree of freedom (6dof) xr device (that is, a device which tracks not only the pitch, yaw, and roll of the head but also the forward, backward, and side-to-side motion of the viewer). if any component of the transform is computed or created artificially (such as by using mouse or keyboard controls to move through space), this value is instead true, indicating that the transform is in part emulated in software. example <<<--- todo: needs example --->>> specifications specification status comment webxr device apithe definition of 'xrpose' in that specification. working draft initial definition. ...
XRReferenceSpaceEvent - Web APIs
the webxr device api interface xrreferencespaceevent represents an event sent to an xrreferencespace. currently, the only event that uses this type is the reset event. constructor xrreferencespaceevent() returns a new xrreferencespaceevent with the specified type and configured using the values in the given xrreferencespaceeventinit dictionary. properties in addition to inheriting the properties available on the parent interface, event, xrreferencespaceevent objects include the following properties: referencespace read only an xrreferencespace indicating the reference space that generated the event. transform read only an xrrigidtransform object indicating the position and orientation of the specified referencespace's native origin after the event, defined relative to the co...
...ferencespaceevent does not define any methods, it inherits the methods of its parent interface, event. event types reset the reset event is sent to a reference space when its native origin is changed due to a discontinuity, recalibration, or device reset. this is an opportunity for your app to update any stored transforms, position/orientation information, or the like—or to dump any cached values based on the reference's space's origin so you can recompute them as needed. specifications specification status comment webxr device apithe definition of 'xrreferencespaceevent' in that specification. working draft initial definition. ...
XRReferenceSpaceEventInit.referenceSpace - Web APIs
examples this simple snippet calls the constructor to create a new reference space event of type reset. ...
... examples this simple snippet calls the constructor to create a new reference space event of type reset. ...
XRReferenceSpaceType - Web APIs
the "interface" column in the table below indicates which of the two types is returned for each reference space type constant.. ...
...t all beyond their starting position, and tracking is optimized for this use case. for devices with six degrees of freedom (6dof) tracking, the local reference space tries to keep the origin stable relative to the environment. xrreferencespace local-floor similar to the local type, except the starting position is placed in a safe location for the viewer to stand, where the value of the y axis is 0 at floor level. if that floor level isn't known, the user agent will estimate the floor level. if the estimated floor level is non-zero, the browser is expected to round it such a way as to avoid fingerprinting (likely to the nearest centimeter). xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely l...
XRRigidTransform() - Web APIs
which specifies the coordinates at which the point or object is located. these dimensions are specified in meters. if this parameter is left out or is not compatible with dompointinit, the position used is assumed to be {x: 0, y: 0, z: 0, w: 1}. w must always be 1. orientation optional an object conforming to dompointinit which specifies the direction in which the object is facing. the default value for orientation is {x: 0, y: 0, z: 0, w: 1}. the specified orientation gets normalized if it's not already. return value a new xrrigidtransform object which has been initialized to represent a transform matrix that would adjust the position and orientation of an object from the origin to the specified position and facing in the direction indicated by orientation. exceptions typeerror the ...
... for orientation is {x: 0, y: 0, z: 0, w: 1}. the specified orientation gets normalized if it's not already. return value a new xrrigidtransform object which has been initialized to represent a transform matrix that would adjust the position and orientation of an object from the origin to the specified position and facing in the direction indicated by orientation. exceptions typeerror the value of the w coordinate in the specified position is not 1.0. examples in this example, the beginning of the animation of a scene is shown, starting with a request for a reference space of a given type, then shifting the coordinate system based on a transform before requesting the first animation frame. let animationframerequestid = 0; xrsession.requestreferencespace("local-floor") .then((refspa...
XRRigidTransform.matrix - Web APIs
the read-only xrrigidtransform property matrix returns the transform matrix represented by the object. the returned matrix can then be premultiplied with a column vector to rotate the vector by the 3d rotation specified by the orientation, then translate it by the position. syntax let matrix = xrrigidtransform.matrix; value a float32array containing 16 entries which represents the 4x4 transform matrix which is described by the position and orientation properties. usage notes matrix format all 4x4 transform matrices used in webgl are stored in 16-element float32arrays. the values are stored into the array in column-major order; that is, each column is written into the array top-down before moving to the right one column and writing the next column into the array. thus, for an arra...
... 0 & 0 & 1 \end{bmatrix} this is a transform that will not change either the orientation or position of any point, vector, or object to which it's applied. next, the position is placed into the right-hand column, like this, resulting in a translation matrix that will transform a coordinate system by the specified distance in each dimension, with no rotational change. here px, py, and pz are the values of the x, y, and z members of the dompointreadonly position. [100px010py001pz0001]\begin{bmatrix} 1 & 0 & 0 & x\\ 0 & 1 & 0 & y\\ 0 & 0 & 1 & z\\ 0 & 0 & 0 & 1 \end{bmatrix} then a rotation matrix is created by computing a column-vector rotation matrix from the unit quaternion specified by orientation: [1-2(qy2+qz2)2(qxqy-qzqw)2(qxqz+qyqw)02(qxqy+qzqw)1-2(qx2+qz2)2(qyqz-qxqw)02(qxqz-qyqw)2(qy...
XRSession.cancelAnimationFrame() - Web APIs
usage notes this function has no effect if the specified handle cannot be found. ...
... usage notes this function has no effect if the specified handle cannot be found. ...
XRSession.end() - Web APIs
Web › API › XRSession › end
you can use the promise to do things like update ui elements to reflect the shut down connection, trigger application shut down, or whatever else you might need to do. ...
...you can use the promise to do things like update ui elements to reflect the shut down connection, trigger application shut down, or whatever else you might need to do. ...
XRSession.inputSources - Web APIs
ch are expressly associated with the xr device and are currently available. these controllers may include handheld controllers, xr-equipped gloves, optically tracked hands, and gaze-based input methods. keyboards, gamepads, and mice are not considered webxr input sources. note: traditional gamepad controllers are supported using the gamepad api. syntax inputsources = xrsession.inputsources; value an xrinputsourcearray object listing all of the currently-connected input controllers which are linked specifically to the xr device currently in use. the returned object is live; as devices are connected to and removed from the user's system, the list's contents update to reflect the changes. usage notes you can add a handler for the xrsession event inputsourceschange to be advised when the c...
...rs which are linked specifically to the xr device currently in use. the returned object is live; as devices are connected to and removed from the user's system, the list's contents update to reflect the changes. usage notes you can add a handler for the xrsession event inputsourceschange to be advised when the contents of the session's connected devices list changes. you can then either get the value of inputsources to examine the list, or you can refer to a reference to the list that you've previously saved. specifications specification status comment webxr device apithe definition of 'xrsession.inputsources' in that specification. working draft initial definition. ...
XRSession.onsqueezeend - Web APIs
ely after the squeeze event, which announces the successful completion of the squeeze action. the squeezeend event handler is where you handle closing out a squeeze action whether it was successfully completed or not. to learn more about how the sequence of squeeze events works, see primary squeeze actions in inputs and input sources. syntax xrsession.onsqueezeend = squeezeendhandlerfunction; value a function to be invoked whenever the xrsession receives a squeezestart event, indicating the ending of a primary squeeze action. examples this snippet of code adds a simple handler for the squeezeend event, which responds only to events on the user's dominant hand. in response to the end of the squeeze operation, this code looks to see if there is an object currently being held by the user by...
...ose(event.inputsource.targetrayspace, myrefspace; if (user.heldobject) { cancelobjectdrag(user.heldobject); } } }; this code presumes that if the user actually intentionally completed the drag, user.heldobject will be null here. that's because (in this example, at least) the handler for the squeeze event has already dropped the object into its new location and then cleared the value of heldobject to indicate that the user is no longer holding anything. specifications specification status comment webxr device apithe definition of 'xrsession.onsqueezeend' in that specification. working draft initial definition. ...
XRSession.requestReferenceSpace() - Web APIs
t all beyond their starting position, and tracking is optimized for this use case. for devices with six degrees of freedom (6dof) tracking, the local reference space tries to keep the origin stable relative to the environment. xrreferencespace local-floor similar to the local type, except the starting position is placed in a safe location for the viewer to stand, where the value of the y axis is 0 at floor level. if that floor level isn't known, the user agent will estimate the floor level. if the estimated floor level is non-zero, the browser is expected to round it such a way as to avoid fingerprinting (likely to the nearest centimeter). xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely l...
...e user can physically move around, and is supported by all instances of xrsession, both immersive and inline, though it's most useful for inline sessions. it's particularly useful when determining the distance between the viewer and an input, or when working with offset spaces. otherwise, typically, one of the other reference space types will be used more often. xrreferencespace return value a promise that resolves with an xrreferencespace object. exceptions rather than throwing true exceptions, requestreferencespace() rejects the returned promise with a domexception whose name is found in the list below: notsupportederror the requested reference space is not supported. specifications specification status comment webxr device apithe definition of 're...
XRSessionEvent() - Web APIs
nevent object. these objects represent events announcing state changes in an xrsession representing an augmented or virtual reality session. syntax newxrsessionevent = new xrsessionevent(type, eventinitdict); parameters type a domstring indicating which of the events represented by objects of type xrsessionevent this particular object represents. see event types for a list of the permitted values. eventinitdict an object conforming to the xrsessioneventinit dictionary which contains values to be applied to the newly-created event object. permitted values are: session the xrsession to which the event is to be delivered. return value a newly-created xrsessionevent object representing an object of the specfied type and configured as described by the eventinitdict parameter. ...
... end fired at the session when it has ended, after being terminated by the application or the user agent. visibilitychange fired at the session whenever its visibility state changes. examples this example creates a listiener that watches for the visibility state of the session to change. ...
XRSessionEvent - Web APIs
the webxr device api's xrsessionevent interface describes an event which indicates the change of the state of an xrsession. these events occur, for example, when the session ends or the visibility of its context changes. constructor xrsessionevent() creates and returns a new xrsessionevent object configured using the specified xrsessioneventinit object's values as available. ...
...rties in addition to properties inherited from its parent interface, event, xrsessionevent provides the folllowing: session read only the xrsession to which the event refers. methods while xrsessionevent defines no methods, it inherits methods from its parent interface, event. session event types the following events are represented using the xrsessionevent interface, and are permitted values for its type property. end fired at the session when it has ended, after being terminated by the application or the user agent. visibilitychange fired at the session whenever its visibility state changes. examples this example creates a listiener that watches for the visibility state of the session to change. it reacts by calling a function mysessionvisible() with a boolean indicating w...
XRSystem: requestSession() - Web APIs
m interface's requestsession() method returns a promise which resolves to an xrsession object through which you can manage the requested type of webxr session. while only one immersive vr session can be active at a time, multiple inline sessions can be in progress at once. syntax var sessionpromise = xr.requestsession(sessionmode, sessioninit) parameters sessionmode a domstring whose value is one of those included in the xrsessionmode enum. the supported modes are: immersive-ar the session's output will be given exclusive access to the immersive device, but the rendered content will be blended with the real-world environment. the session's environmentblendmode indicates the method to be used to blend the content together. important: the immersive-ar mode is defined by t...
...an be presented in either mono or stereo mode, and may or may not have viewer tracking available. inline sessions don't require special hardware and should be avalable on any user agent offering webxr api support. sessioninit optional a xrsessioninit object providing options to configure the new xrsession. see specifying session options for details on how to configure a webxr session. return value a promise that resolves with an xrsession object if the device and user agent support the requested mode and features. exceptions this method doesn't throw true exceptions; instead, it rejects the returned promise, passing into it a domexception whose name is one of the following: invalidstateerror the requested session mode is immersive-vr but there is already an immersive vr session eith...
XRTargetRayMode - Web APIs
as is the method for indicating the endpoint of the ray. the targeted point or object might be indicated by drawing a shape or highlighting the targeted surface or object. a target ray emitted by a hand controller. the target ray can be anything from a simple line (ideally fading over distance) to an animated effect, such as the science-fiction "phaser" style shown in the screenshot above. values gaze the user is using a gaze-tracking system (or gaze input) which detects the direction in which the user is looking. the target ray will be drawn originating at the viewer's eyes and will follow the direction in which they're looking. screen the direction of the target ray is indicated using a tap on a touch screen, mouse, or other tactile input device. tracked-pointer targeting is be...
...he hand) in the targeted direction. the direction is determined using platform-specific rules, though if no such rules exist, the direction is chosen by assuming the user is pointing their index finger straight out from their hand. examples this fragment of code shows part of a function to be called once every frame. it looks for inputs which have a non-null targetrayspace. inputs which have a value for this property represent inputs that project a target ray outward from the user. for each such input, this example looks for inputs whose targetraymode is tracked-pointer, indicating that the input is in fact intended to represent a targeting device rather than a gazing device, screen tap, or mouse click. for tracked pointers, a function myrendertargetrayasbeam() is called to render a beam fr...
XRView - Web APIs
Web › API › XRView
t views the world. a 3d frame will involve two views, one for each eye, separated by an appropriate distance which approximates the distance between the viewer's eyes. this allows the two views, when projected in isolation into the appropriate eyes, to simulate a 3d world. properties eye read only which of the two eyes (left) or (right) for which this xrview represents the perspective. this value is used to ensure that any content which is pre-rendered for presenting to a specific eye is distributed or positioned correctly. the value can also be none if the xrview is presenting monoscopic data (such as a 2d image, a full-screen view of text. or a close-up view of something that doesn't need to appear in 3d). projectionmatrix read only the projection matrix that will transform the scene...
... mat4.copy(mousematrix, newtransform.matrix); // create a new reference space that transforms the object to the new // position and orientation, returning the new reference space. return refspace.getoffsetreferencespace(newtransform); } this code is broken into four sections. in the first, the quaternion inverseorientation is computed. this represents the rotation of the object given the values of mousepitch (rotation around the object's reference's space's x axis) and mouseyaw (rotation around the object's y axis). the second section computes the "up" vector for the object. this vector indicates the direction which is "up" in the scene overall, but in the object's reference space. the third section creates the new xrrigidtransform, specifying a point providing the offsets along the ...
XRViewport - Web APIs
rigin of the viewport to the bottom edge of the viewport; webgl's coordinate system places (0, 0) at the bottom left corner of the surface. usage notes currently, the only type of surface available is the xrwebgllayer. the precise orientation of the coordinate system may vary with other surface types, but in webgl, the origin (0, 0) is located at the bottom-left corner of the surface. ...
...nly type of surface available is the xrwebgllayer. the precise orientation of the coordinate system may vary with other surface types, but in webgl, the origin (0, 0) is located at the bottom-left corner of the surface. thus the values specified in an xrviewport define a rectangle whose bottom-left corner is at (x, y) and which extends width pixels toward the left and height pixels upward. these values may be passed directly into the webglrenderingcontext.viewport() method: let xrviewport = xrwebgllayer.getviewport(xrview); gl.viewport(xrviewport.x, xrviewport.y, xrviewport.width, xrviewport.height); example this example sets up an animation frame callback using requestanimationframe(). after initial setup, it iterates over each of the views within the viewer's pose, configuring the viewpor...
XRVisibilityState - Web APIs
input controllers are not being handled for the session. visible the virtual scene rendered by the xrsession is currently visible to the user and is the primary focus of the user's attention. ...
...input controllers are not being handled for the session. visible the virtual scene rendered by the xrsession is currently visible to the user and is the primary focus of the user's attention. ...
XRWebGLLayer.antialias - Web APIs
the read-only xrwebgllayer property antialias is a boolean value which is true if the rendering layer's frame buffer supports antialiasing. otherwise, this property's value is false. the specific antialiasing technique used is left to the user agent's discretion and cannot be specified by the web site or web app. syntax let antialiasingsupported = xrwebgllayer.antialias; value a boolean value which is true if the webgl rendering layer's frame buffer is configured to support antialiasing. otherwise, this property is false. when the webxr compositor is enabled, this value corresponds to the value of the antialias property on the object returned by the webgl context's getcontentattributes() method. usage notes since this is a read-only property, you can set the antialiasing mode only whe...
... let gllayer = xrsession.renderstate.baselayer; gl.bindframebuffer(gl.framebuffer, gllayer.framebuffer); /* .. ...
XRWebGLLayer.framebuffer - Web APIs
the read-only xrwebgllayer property framebuffer is an opaque webglframebuffer which is used to buffer the rendered image if the xr compositor is being used. otherwise, this property's value is null. the opaque framebuffer is functionally nearly the same as a standard webgl framebuffer, except for the differences covered in the section how opaque framebuffers are special below. syntax let framebuffer = xrwebgllayer.framebuffer; value a webglframebuffer object representing the framebuffer into which the 3d scene is being rendered, or null if the xr compositor is disabled for the session. usage notes how opaque framebuffers are special the framebuffer represented by the framebuffer property is opaque. as such, its behavior is different in several ways from a standard webgl context. these...
...ha context attribute is set. note: the depth and stencil properties are not required to be supported in order for a browser to be construed as having full webgl support. the default configuration of a new framebuffer upon creating a new xrwebgllayer, its new framebuffer is initialized just like the default framebuffer for any webgl interface: the color buffer is configured with its clear value set to the color (0, 0, 0, 0) (meaning transparent black). the depth buffer's clear value is the number 1.0. the stencil buffer is filled with 0. examples this example gets the xrwebgllayer for a session and then passes its framebuffer into the webgl context's bindframebuffer() function. let gllayer = xrsession.renderstate.baselayer; gl.bindframebuffer(gl.framebuffer, gllayer.framebuffer); ...
XRWebGLLayer - Web APIs
gl, it's entirely possible that future updates to the webxr specification may allow for other layer types and corresponding image sources. constructor new xrwebgllayer() creates and returns a new xrwebgllayer object for use by the specified xrsession, using a particular webglrenderingcontext or webgl2renderingcontext as the destination context. properties antialias read only a boolean value indicating whether or not the webgl context's framebuffer supports anti-aliasing. the specific type of anti-aliasing is determined by the user agent. framebuffer read only returns a webglframebuffer suitable for passing into the bindframebuffer() method. framebufferwidth read only returns the width of the xrwebgllayer's framebuffer. framebufferheight read only returns the height of the l...
...ebgl context's framebuffer supports anti-aliasing. the specific type of anti-aliasing is determined by the user agent. framebuffer read only returns a webglframebuffer suitable for passing into the bindframebuffer() method. framebufferwidth read only returns the width of the xrwebgllayer's framebuffer. framebufferheight read only returns the height of the layer's framebuffer. ignoredepthvalues read only a boolean which indicates whether or not the webxr compositor should make use of the contents of the layer's depth buffer while compositing the scene. methods getviewport() returns a new xrviewport instance representing the position, width, and height to which the webgl context's viewport must be set to contain drawing to the area of the framebuffer designated for the specified...
XRWebGLLayerInit.framebufferScaleFactor - Web APIs
the xrwebgllayerinit dictionary's framebufferscalefactor property, when specified upon instantiating a new xrwebgllayer using its constructor, xrwebgllayer(), specifies the scaling factor to use when determining the size of the frame buffer to use when rendering the scene, relative to the default xr device display resolution. for example, a value of 1.0 indicates that the frame buffer should be the same resolution as the actual display, while a value of 0.5 indicates that the frame buffer should be half the resolution of the display. a value of 2.0, on the other hand, creates a frame buffer whose resolution is double that of the actual display buffer. there are valid use cases for all of these kinds of scaling. see managing rendering quality in webxr performance guide for more information.
...an determine the scaling factor that you would need to apply to match the default frame buffer resolution by using the xrwebgllayer.getnativeframebufferscalefactor() static function. syntax let layerinit = { framebufferscalefactor: scalefactor }; let gllayer = new xrwebgllayer(xrsession, gl, layerinit); let gllayer = new xrwebgllayer(xrsession, gl, { framebufferscalefactor: scalefactor }); value a floating-point value indicating a multiplier to apply to the default frame buffer resolution in order to determine the resolution of the frame buffer for the xrwebgllayer. example in this example, a new xrwebgllayer is created for a webxr session, xrsession, with a frame buffer whose resolution is half that of the default display resolution of the xr device. xrsession.updaterenderstate({ ...
msRegionOverflow - Web APIs
not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the msregionoverflow read-only property determines if content fully fits into the region or not. this proprietary property is specific to internet explorer. syntax string = object.msregionoverflow values type:domstring overflow: the region element's content overflows the region's content box. note that the region's overflow property value can be used to control the visibility of the overflowing content. this means that the region is the last one in the region chain and not able to fit the remaining content from the named flow. fit: the region element's content fits into the region's content...
...region chain, that means the named flow content is further fitted in subsequent regions. in particular, in this last case, that means the region may have received no content from the named flow (for example if the region is too small to accommodate any content). empty: the region element has no content and is empty. all content from the named flow was fitted in regions with a lower content-order value. undefined: the element is not a region. when the region is an actual element, msregionoverflow provides the ability to find out if content fully fits into the region or not. however, it is only available to regions that are document elements and not to regions that are pseudo-elements. see also microsoft api extensions ...
Using the alert role - Accessibility
ve technology. the alert role is used to communicate an important and usually time-sensitive message to the user. when this role is added to an element, the browser will send out an accessible alert event to assistive technology products which can then notify the user about it. the alert role is most useful for information that requires the user's immediate attention, for example: an invalid value was entered into a form field the user's login session is about to expire the connection to the server was lost, local changes will not be saved because of its intrusive nature, the alert role must be used sparingly and only in situations where the user's immediate attention is required. dynamic changes that are less urgent should use a less aggressive method, such as aria-live="polite" or o...
... an account.</p>").appendto(document.body); example 3: adding alert role to an existing element sometimes it's useful to add an alert role to an element that is already visible on the page rather than creating a new element. this allows the developer to reiterate information that has become more relevant or urgent to the user. for example, a form control may have instruction about the expected value. if a different value is entered, role="alert can be added to the instruction text so that the screen reader announces it as an alert. the pseudo code snippet below illustrates this approach: <p id="forminstruction">you must select at least 3 options</p> // when the user tries to submit the form with less than 3 checkboxes selected: document.getelementbyid("forminstruction").setattribute("role...
Using the aria-labelledby attribute - Accessibility
list multiple element ids in a space delimited fashion. this idea is similar to how the "for" attribute is used to link a label to an input. assistive technology, such as screen readers, use this attribute to catalog the objects in a document so that users can navigate between them. without an element id, the assistive technology cannot catalog the object. ...
...ns, and other types of objects. the examples section below provides more information on how to use the attribute this way. to improve compatibility with user agents that do not support aria, you can use aria-labelledby with the <label> element (using the for attribute). this attribute can be used with any typical html form element; it is not limited to elements that have an aria role assigned. value a space-separated list of element ids possible effects on user agents and assistive technology when user agents compute the accessible name property of elements that have both an aria-labelledby attribute and an aria-label attribute, the user agents give precedence to aria-labelledby. examples example 1: multiple labels in the example below, each input field is labelled by both its own ind...
ARIA: timer role - Accessibility
emaining time until an end point. <div role="timer" id="eggtimer">0</div> this defines this div element as a timer with no remaining time. description the timer role indicates to assistive technologies that this part of the web content is a live region containing a timer listing the time remaining or elapsed time. a timer's inner text should be an updating current time measurement. while the value does not necessarily need to be machine parsable, it should continuously update at regular intervals unless the timer is paused or reaches its end-point. associated wai-aria roles, states, and properties aria-label used to provide the name of the timer. aria-live elements with the role timer have an implicit aria-live value of off. aria-describedby used to indicate the idref of an elemen...
...be localized. keyboard interactions keyboard interaction is xxx. focus is being managed via xxx. the tab , space and enter keys, as well as escape , must be handled by the application. the one exception is if focus xxx. required javascript features keypress used to handle keyboard input and control the focus click, touch handle as appropriate for your widget as well changing attribute values aria-activedescendant is used to manage the focus inside the application container. set in response to keyboard or other application events that change focus or point of interaction. the timer role does not have a related html widget and xxx. the author of the timer must take full responsibility for not letting users get stuck in a focus limbo or trap focus inside something the user cannot e...
ARIA: form role - Accessibility
<form id="send-comment" aria-label="add a comment"> .... </form> accessibility concerns use sparingly landmark roles are intended to identify larger overall sections of the document. using too many landmark roles can create "noise" in screen readers, making it difficult to understand the overall layout of the page. ...
...he overall layout of the page. inputs are not forms you do not need to declare role="form" on every form element (inputs, text areas, selects, etc.). it should be declared on the html element that wraps the form elements. ideally, use the <form> element as the wrapping element and do not declare role="form". search if a form is used to search, you should use the more specialized role="search" value. labeling landmarks each <form> element and form role that needs to be exposed as a landmark must be given an accessible name. this name will allow an assitive technology user to be able to quickly understand the purpose of the form landmark. use an aria-labelledby, aria-label or title on the same element that was given the role="form" to provide it an accessible name. using role="form" <di...
ARIA: dialog role - Accessibility
ent outside of the dialog while the dialog is showing. note that for non-modal dialogs there will have to be a global keyboard shortcut that allows focus to be moved between opened dialogs and the main page. for more information see the managing modal and non modal dialogs guide. associated aria roles, states, and properties aria-labelledby use this attribute to label the dialog. often, the value of the aria-labelledby attribute will be the id of the element used to title the dialog. aria-describedby use this attribute to describe the contents of the dialog. possible effects on user agents and assistive technology when the dialog role is used, the user agent should do the following: expose the element as a dialog in the operating system's accessibility api. when the dialog is c...
...it is important for developers to ensure that content outside of the modal dialog is...
ARIA: heading role - Accessibility
istive technologies which part of the page structure this heading represents. a level 1 heading usually indicates the main heading of a page, a level 2 heading the first subsection, a level 3 is a subsection of that, and so on. associated wai-aria roles, states, and properties aria-level the aria-level attribute specifies the heading level in the document structure. if no level is present, a value of 2 is the default. keyboard interactions this role does not require any special keyboard navigation. as with any heading, giving it an id ensures it can be referenced from anchor links, making it accessible via the keyboard. required javascript features required event handlers none. changing attribute values usually not required, unless dynamically inserting content. in that case, the...
...e does not require any special keyboard navigation. as with any heading, giving it an id ensures it can be referenced from anchor links, making it accessible via the keyboard. required javascript features required event handlers none. changing attribute values usually not required, unless dynamically inserting content. in that case, the newly-added headings need aria-level attributes whose values are consistent with the rest of the document structure. instead of using a <div> or <span> with a heading role and aria-level, consider using a native <h1> through <h6> element instead to indicate that this text is a heading, and what part of the structure it represents. examples the following shows a typical page structure. <div id="container"> <div role="heading" aria-level="1">the main...
WAI-ARIA Roles - Accessibility
logo, company name, search icon, photo related to the page, or slogan.aria: button rolethe button role should be used for clickable elements that trigger a response when activated by the user. adding role="button" will make an element appear as a button control to a screen reader. this role can be used in combination with the aria-pressed attribute to create toggle buttons.aria: cell rolethe cell value of the aria role attribute identifies an element as being a cell in a tabular container that does not contain column or row header information. to be supported, the cell must be nested in an element with the role of row.aria: checkbox rolethe checkbox role is used for checkable interactive controls. elements containing role="checkbox" must also include the aria-checked attribute to expose the che...
...aria: timer rolethe timer role indicat...
Web accessibility for seizures and physical reactions - Accessibility
on-count: 1 !important; /* hat tip nick/cssremedy (https://css-tricks.com/revisiting-prefers-reduced-motion-the-reduced-motion-media-query/#comment-1700170) */ transition-duration: 0.001ms !important; } } from w3.org's page on media queries 4: the update media feature is used to query the ability of the output device to modify the appearance of content once it has been rendered. it has the values of "none", "slow", and "fast". developmental & experimental features mdn navigator​.donottrack from the documentation: "returns the user's do-not-track setting. this is "1" if the user has requested not to be tracked by web sites, content, or advertising" media queries level 5 environmentmq (planned in media queries level 5) light-level has three valid values: dim, normal, and washed. i...
... the page, overriding the author's chosen colors. from w3c's draft document, media queries level 5 section on forced-colors: "the forced-colors media feature is used to detect if the user agent has enabled a forced colors mode where it enforces a user-chosen limited color palette on the page". the user will need to be made aware of this ability, and it will need to play nice with the appropriate value for the prefers-color-scheme media query. light-level from w3c's draft document, media queries level 5 section on light-level: "the light-level media feature is used to query about the ambient light-level in which the device is used, to allow the author to adjust style of the document in response." this will be a godsend to those who have motor-skills problems, or for some with cognitive diffic...
Text labels and names - Accessibility
which can be a time consuming and potentially confusing process. examples the title for the reference article about the <title> element is as follows: <title>&lt;title&gt;: the document title element - html: hypertext markup language</title> another example might look like so: <title>fill in your details to register — mygov services</title> to help the user, you can update the page title value to reflect significant page state changes (such as form validation problems): <title>2 errors — fill in your details to register — mygov services</title> see also <title> embedded content must be labeled make sure that elements that embed content have a title attribute that describes the embedded content. this includes the <embed> and <object> elements. these elements are often used ...
...ems, as well as <button>, <output>, <select>, <textarea>, <progress> and <meter> elements, as well as any element with the switch aria role. the form element can be placed inside the <label>, in which case the association between the form element and the label is obvious from the structure. or, you can create an association between a <label> and a form element by specifying the form element's id value as the value of the label's for attribute. example <label>i agree to the terms and conditions. <input type="checkbox" id="terms"> </label> <input type="checkbox" id="emailoptin"> <label for="emailoptin">yes, please send me news about this product.</label> form elements should have a visible text label in addition to having a <label> for every form element, those labels should be visible, ...
-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. ...
...he 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 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 par...
-webkit-line-clamp - CSS: Cascading Style Sheets
when applied to anchor elements, the truncating can happen in the middle of the text, not necessarily at the end. note: this property was originally implemented in webkit and has some issues. it got standardized for legacy support. the css overflow module level 3 specification also defines a line-clamp property, which is meant to replace this property and avoid its issues. syntax /* keyword value */ -webkit-line-clamp: none; /* <integer> values */ -webkit-line-clamp: 3; -webkit-line-clamp: 10; /* global values */ -webkit-line-clamp: inherit; -webkit-line-clamp: initial; -webkit-line-clamp: unset; none this value specifies that the content wonʼt be clamped. <integer> this value specifies the number of lines after which the content will be clamped. it must be greater than 0. for...
...none; /* <integer> values */ -webkit-line-clamp: 3; -webkit-line-clamp: 10; /* global values */ -webkit-line-clamp: inherit; -webkit-line-clamp: initial; -webkit-line-clamp: unset; none this value specifies that the content wonʼt be clamped. <integer> this value specifies the number of lines after which the content will be clamped. it must be greater than 0. formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax none | <integer> examples truncating a paragraph html <p> in this example the <code>-webkit-line-clamp</code> property is set to <code>3</code>, which means the text is clamped after three lines. an ellipsis will be shown at the point where the text is clamped. </p> css p {...
-webkit-mask-attachment - CSS: Cascading Style Sheets
if a -webkit-mask-image is specified, -webkit-mask-attachment determines whether the mask image's position is fixed within the viewport, or scrolls along with its containing block. /* keyword values */ -webkit-mask-attachment: scroll; -webkit-mask-attachment: fixed; -webkit-mask-attachment: local; /* multiple values */ -webkit-mask-attachment: scroll, local; -webkit-mask-attachment: fixed, local, scroll; /* global values */ -webkit-mask-attachment: inherit; -webkit-mask-attachment: initial; -webkit-mask-attachment: unset; syntax values scroll if scroll is specified, the mask image scrolls within the viewport along with the block that contains the mask image. fixed if fixed is specified, the mask image does not scroll with its containing element, instead remaining stationa...
...achment: inherit; -webkit-mask-attachment: initial; -webkit-mask-attachment: unset; syntax values scroll if scroll is specified, the mask image scrolls within the viewport along with the block that contains the mask image. fixed if fixed is specified, the mask image does not scroll with its containing element, instead remaining stationary within the viewport. formal definition initial valuescrollapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <attachment>#where <attachment> = scroll | fixed | local examples fixing a mask image to the viewport body { -webkit-mask-image: url('images/mask.png'); -webkit-mask-attachment: fixed; } specifications not part of any standard. ...
-webkit-overflow-scrolling - CSS: Cascading Style Sheets
the -webkit-overflow-scrolling css property controls whether or not touch devices use momentum-based scrolling for a given element. syntax values auto use "regular" scrolling, where the content immediately ceases to scroll when you remove your finger from the touchscreen. touch use momentum-based scrolling, where the content continues to scroll for a while after finishing the scroll gesture and removing your finger from the touchscreen. the speed and duration of the continued scrolling is proportional to how vigorous the scroll gesture was. also creates a new stacking context. ...
... scroll when you remove your finger from the touchscreen. touch use momentum-based scrolling, where the content continues to scroll for a while after finishing the scroll gesture and removing your finger from the touchscreen. the speed and duration of the continued scrolling is proportional to how vigorous the scroll gesture was. also creates a new stacking context. formal definition initial valueautoapplies toscrolling boxesinheritedyescomputed valueas specifiedanimation typediscrete formal syntax auto | touch examples html <div class="scroll-touch"> <p> this paragraph has momentum scrolling </p> </div> <div class="scroll-auto"> <p> this paragraph does not. </p> </div> css div { width: 100%; overflow: auto; } p { width: 200%; background: #f5f9fa; border: ...
-webkit-print-color-adjust - CSS: Cascading Style Sheets
the -webkit-print-color-adjust property is a non-standard css extension that can be used to force printing of background colors and images in browsers based on the webkit engine. /* keyword values */ -webkit-print-color-adjust: economy; -webkit-print-color-adjust: exact; /* global values */ -webkit-print-color-adjust: inherit; -webkit-print-color-adjust: initial; -webkit-print-color-adjust: unset; syntax the -webkit-print-color-adjust property is specified as one of the keyword values listed below. values economy normal behavior. background colors and images are only printed if the user explicitly allows it in their browser's print settings dialog. exact background colors and images of the element to which this rule is applied are always printed, user's print settings ar...
...t-color-adjust property is specified as one of the keyword values listed below. values economy normal behavior. background colors and images are only printed if the user explicitly allows it in their browser's print settings dialog. exact background colors and images of the element to which this rule is applied are always printed, user's print settings are overridden. formal definition value not found in db! formal syntax syntax not found in db! examples forcing white-on-black printing article { -webkit-print-color-adjust: exact; background: #222; color: #eee; } specifications not part of any standard, though there is a proposal in the csswg wiki to standardize it. ...
:-moz-ui-invalid - CSS: Cascading Style Sheets
the :-moz-ui-invalid css pseudo-class represents any validated form element whose value isn't valid based on their validation constraints, in certain circumstances. this pseudo-class is applied according to the following rules: if the control does not have focus, and the value is invalid, apply this pseudo-class. if the control has focus, and the value was valid (including empty) when it gained focus, do not apply the pseudo-class. if the control has focus, and the value was invalid when it gained focus, re-validate on every keystroke. if the element is required, the preceding rules apply only if the user has changed the value or attempted to submit the form. the result is that if the control was valid when the user started interacting with it, the validity styling is changed...
...cus, re-validate on every keystroke. if the element is required, the preceding rules apply only if the user has changed the value or attempted to submit the form. the result is that if the control was valid when the user started interacting with it, the validity styling is changed only when the user shifts focus to another control. however, if the user is trying to correct a previously-flagged value, the control shows immediately when the value becomes valid. required items have the pseudo-class applied only if the user changes them or attempts to submit an unchanged valid value. by default, gecko applies a style that creates a red "glow" (using the box-shadow property) around items, which have this pseudo-class applied. see the :invalid pseudo-class for an example that shows how to overrid...
:-moz-ui-valid - CSS: Cascading Style Sheets
the :-moz-ui-valid css pseudo-class represents any validated form element whose value validates correctly based on its validation constraints. this pseudo-class is applied according to the following rules: if the control does not have focus, and the value is valid, apply this pseudo-class. if the control has focus, and the value was valid (including empty) when it gained focus, apply this pseudo-class. if the control has focus, and the value was invalid when it gained focus, re-validate on every keystroke. if the element is required, the preceding rules apply only if the user has changed the value or attempted to submit the form. the result is that if the control was valid when the user started interacting with it, the validity styling is changed only when the user shifts fo...
...cus, re-validate on every keystroke. if the element is required, the preceding rules apply only if the user has changed the value or attempted to submit the form. the result is that if the control was valid when the user started interacting with it, the validity styling is changed only when the user shifts focus to another control. however, if the user is trying to correct a previously-flagged value, the control shows immediately when the value becomes valid. required items are flagged as invalid only if the user changes them or attempts to submit an unchanged invalid value. syntax syntax not found in db! specifications not part of any standard. ...
::-webkit-progress-bar - CSS: Cascading Style Sheets
the ::-webkit-progress-bar css pseudo-element represents the entire bar of a <progress> element. normally it's only visible as the unfilled portion of the bar, since by default it's rendered below the ::-webkit-progress-value pseudo-element. it is a child of the ::-webkit-progress-inner-element pseudo-element and the parent of the ::-webkit-progress-value pseudo-element. note: for ::-webkit-progress-value to take effect, appearance needs to be set to none on the <progress> element. ...
...kit-progress-inner-element pseudo-element and the parent of the ::-webkit-progress-value pseudo-element. note: for ::-webkit-progress-value to take effect, appearance needs to be set to none on the <progress> element. syntax ::-webkit-progress-bar examples css content progress { -webkit-appearance: none; } ::-webkit-progress-bar { background-color: orange; } html content <progress value="10" max="50"> result result screenshot if you're not using a webkit or blink browser, the code above results in a progress bar that looks like this: specifications not part of any standard. ...
::-webkit-progress-inner-element - CSS: Cascading Style Sheets
the ::-webkit-progress-inner-element css pseudo-element represents the outermost container of the <progress> element. it is the parent of the ::-webkit-progress-bar pseudo-element. note: in order to let ::-webkit-progress-value take effect, -webkit-appearance needs to be set to none on the <progress> element. syntax ::-webkit-progress-inner-element examples these examples work only on blink and webkit. adding a black border around the progress bar in this example, a 2px black border is added around the progress bar. ...
...kit-progress-bar pseudo-element. note: in order to let ::-webkit-progress-value take effect, -webkit-appearance needs to be set to none on the <progress> element. syntax ::-webkit-progress-inner-element examples these examples work only on blink and webkit. adding a black border around the progress bar in this example, a 2px black border is added around the progress bar. html <progress value="10" max="50"> css progress { -webkit-appearance: none; } ::-webkit-progress-inner-element { border: 2px solid black; } result result screenshot if you're not using a blink or webkit browsear, the above code resuls in a progress bar looking like this: specifications not part of any standard. ...
:checked - CSS: Cascading Style Sheets
Web › CSS › :checked
browser to browser. ...
... examples basic example html <div> <input type="radio" name="my-input" id="yes"> <label for="yes">yes</label> <input type="radio" name="my-input" id="no"> <label for="no">no</label> </div> <div> <input type="checkbox" name="my-checkbox" id="opt-in"> <label for="opt-in">check me!</label> </div> <select name="my-select" id="fruit"> <option value="opt1">apples</option> <option value="opt2">grapes</option> <option value="opt3">pears</option> </select> css div, select { margin: 8px; } /* labels for checked inputs */ input:checked + label { color: red; } /* radio element, when checked */ input[type="radio"]:checked { box-shadow: 0 0 0 3px orange; } /* checkbox element, when checked */ input[type="checkbox"]:checked { box-shadow: 0 0 0 3px hotpink; } /* option e...
:dir() - CSS: Cascading Style Sheets
Web › CSS › :dir
the :dir() css pseudo-class matches elements based on the directionality of the text contained in them. /* selects any element with right-to-left text */ :dir(rtl) { background-color: red; } the :dir() pseudo-class uses only the semantic value of the directionality, i.e., the one defined in the document itself. it doesn't account for styling directionality, i.e., the directionality set by css properties such as direction. note: be aware that the behavior of the :dir() pseudo-class is not equivalent to the [dir=…] attribute selectors. ...
... for styling directionality, i.e., the directionality set by css properties such as direction. note: be aware that the behavior of the :dir() pseudo-class is not equivalent to the [dir=…] attribute selectors. the latter match the html dir attribute, and ignore elements that lack it — even if they inherit a direction from their parent. (similarly, [dir=rtl] and [dir=ltr] won't match the auto value.) in contrast, :dir() will match the value calculated by the user agent, even if inherited. note: in html, the direction is determined by the dir attribute. other document types may have different methods. syntax the :dir() pseudo-class requires one parameter, representing the text directionality you want to target. parameters ltr target left-to-right elements. rtl target right-to-le...
:enabled - CSS: Cascading Style Sheets
Web › CSS › :enabled
lects any enabled <input> */ input:enabled { color: blue; } syntax :enabled examples the following example makes the color of text and button <input>s green when enabled, and gray when disabled. this helps the user understand which elements can be interacted with. ...
... the color of text and button <input>s green when enabled, and gray when disabled. this helps the user understand which elements can be interacted with. html <form action="url_of_form"> <label for="firstfield">first field (enabled):</label> <input type="text" id="firstfield" value="lorem"><br> <label for="secondfield">second field (disabled):</label> <input type="text" id="secondfield" value="ipsum" disabled="disabled"><br> <input type="button" value="submit"> </form> css input:enabled { color: #2b2; } input:disabled { color: #aaa; } result specifications specification status comment html living standardthe definition of ':enabled' in that specification. living standard no change. html5the definition of ':enabled' in that spe...
:is() (:matches(), :any()) - CSS: Cascading Style Sheets
Web › CSS › :is
subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!<combinator> = '>' | '+' | '~' | [ '|' ]where <type-selector> = <wq-name> | <ns-prefix>? '*'<subclass-selector> = <id-selector> | <class-selector> | <attribute-selector> | <pseudo-class-selector><pseudo-element-selector> = ':' <pseudo-class-selector><pseudo-class-selector> = ':' <ident-token> | ':' <function-token> <any-value> ')'where <wq-name> = <ns-prefix>? <ident-token><ns-prefix> = [ <ident-token> | '*' ]? | <id-selector> = <hash-token><class-selector> = '.' <ident-token><attribute-selector> = '[' <wq-name> ']' | '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'where <attr-matcher> = [ '~' | | | '^' | '$' | '*' ]? '='<attr-modifier> = i | s examples cross-browser example <...
...which don't support :unsupported, whereas: :valid, :unsupported { ... } will be ignored in browsers which don't support :unsupported even if they support :valid. difference between :is() and :where() the diffference between the two is that :is() counts towards the specificity of the overall selector (it takes the specificity of its most specific argument), whereas :where() has a specificity value of 0. this is demonstrated by the example on the :where() reference page. specifications specification status comment selectors level 4the definition of ':is()' in that specification. working draft initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, ple...
:nth-child() - CSS: Cascading Style Sheets
on in a group of siblings. /* selects the second <li> element in a list */ li:nth-child(2) { color: lime; } /* selects every fourth element among any group of siblings */ :nth-child(4n) { color: lime; } syntax the nth-child pseudo-class is specified with a single argument that describes a pattern for matching element indices in a list of siblings. element indices are 1-based. keyword values odd represents elements whose numeric position in a series of siblings is odd: 1, 3, 5, etc. even represents elements whose numeric position in a series of siblings is even: 2, 4, 6, etc. functional notation <an+b> represents elements in a list whose indices match those found in a custom pattern of numbers, defined by an+b, where: a is an integer step size, b is an integer offset, ...
...subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!<combinator> = '>' | '+' | '~' | [ '|' ]where <type-selector> = <wq-name> | <ns-prefix>? '*'<subclass-selector> = <id-selector> | <class-selector> | <attribute-selector> | <pseudo-class-selector><pseudo-element-selector> = ':' <pseudo-class-selector><pseudo-class-selector> = ':' <ident-token> | ':' <function-token> <any-value> ')'where <wq-name> = <ns-prefix>? <ident-token><ns-prefix> = [ <ident-token> | '*' ]? | <id-selector> = <hash-token><class-selector> = '.' <ident-token><attribute-selector> = '[' <wq-name> ']' | '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'where <attr-matcher> = [ '~' | | | '^' | '$' | '*' ]? '='<attr-modifier> = i | s examples example selectors tr...
:visited - CSS: Cascading Style Sheets
Web › CSS › :visited
fill and stroke. the alpha component of the allowed styles will be ignored. the alpha component of the element's non-:visited state will be used instead, except when that component is 0, in which case the style set in :visited will be ignored entirely. ...
...lie and always return the value of the non-:visited color. note: for more information on these limitations and the reasons behind them, see privacy and the :visited selector. syntax :visited examples properties that would otherwise have no color or be transparent cannot be modified with :visited. of the properties that can be set with this pseudo-class, your browser probably has a default value for color and column-rule-color only. thus, if you want to modify the other properties, you'll need to give them a base value outside the :visited selector. html <a href="#test-visited-link">have you visited this link yet?</a><br> <a href="">you've already visited this link.</a> css a { /* specify non-transparent defaults to certain properties, allowing them to be styled with the :visi...
unicode-range - CSS: Cascading Style Sheets
the unicode-range css descriptor sets the specific range of characters to be used from a font defined by @font-face and made available for use on the current page. if the page doesn't use any character in this range, the font is not downloaded; if it uses at least one, the whole font is downloaded. syntax /* <unicode-range> values */ unicode-range: u+26; /* single codepoint */ unicode-range: u+0-7f; unicode-range: u+0025-00ff; /* codepoint range */ unicode-range: u+4??; /* wildcard range */ unicode-range: u+0025-00ff, u+4??; /* multiple values */ values single codepoint a single unicode character code point, for example u+26. codepoint range a range of unicode code points. so for example, u+0025-00ff means include all characters in the range u+0025 t...
...eeds to download the font resource needed for the text content of a particular page. for example, a site with many localizations could provide separate font resources for english, greek and japanese. for users viewing the english version of a page, the font resources for greek and japanese fonts wouldn't need to be downloaded, saving bandwidth. formal definition related at-rule@font-faceinitial valueu+0-10ffffcomputed valueas specified formal syntax <unicode-range># examples using a different font for a single character in this example we create a simple html containing a single <div> element, including an ampersand, that we want to style with a different font. to make it obvious, we will use a sans-serif font, helvetica, for the text, and a serif font, times new roman, for the ampersand...
-ms-high-contrast - CSS: Cascading Style Sheets
s a specialized display mode that prioritizes making content as legible as possible by dynamically replacing foreground and background colors with a user-specified theme. for web content, theme colors are mapped to content types. this media feature applies to bitmap media types. it does not accept min/max prefixes. syntax the -ms-high-contrast media feature is specified as one of the following values. values none ... no longer supported as of microsoft edge 18. active indicates that the subsequent styling rules will be applied when the system is placed in high contrast mode with any color variation. black-on-white indicates that the subsequent styling rules will be applied when the system is placed in high contrast mode with a black-on-white color variation. white-on-bla...
...ls the color of text content. highlighttext: controls the color of selected text. highlight: controls the background color of selected text. buttonface: controls the color of a <button> element's text. window: controls the color of the background. the <a> element controls the color of links. because high contrast mode themes are dynamic, use these color keywords in place of other css color values. this will ensure that content will always be able to be perceived. content if at all possible, prefer updating html markup over modifying content using css2 system color keywords. this helps keep the content more predictable. specifications not part of any standard. remarks as of microsoft edge 18, -ms-high-contrast: none is no longer supported. microsoft edge versions 18 and higher will ...
color-index - CSS: Cascading Style Sheets
the color-index css media feature can be used to test the number of entries in the output device's color lookup table. syntax the color-index feature is specified as an <integer> value representing the number of entries in the output device's color lookup table. (this value is zero if the device does not use such a table.) it is a range feature, meaning that you can also use the prefixed min-color-index and max-color-index variants to query minimum and maximum values, respectively. examples basic example html <p>this is a test.</p> css p { color: black; } @media (color-index) { p { color: red; } } @media (min-color-index: 15000) { p { color: #1475ef; } } result custom stylesheet this html will apply a special stylesheet for devices that have at least 256 color...
...r devices that have at least 256 colors. <link rel="stylesheet" href="http://foo.bar.com/base.css" /> <link rel="stylesheet" media="all and (min-color-index: 256)" href="http://foo.bar.com/color-stylesheet.css" /> specifications specification status comment media queries level 4the definition of 'color-index' in that specification. candidate recommendation the value can now be negative, in which case it computes to false. media queriesthe definition of 'color-index' in that specification. recommendation initial definition. the value must be nonnegative. ...
device-height - CSS: Cascading Style Sheets
examples this html applies a special stylesheet for devices that are shorter than 800 pixels. ...
... examples this html applies a special stylesheet for devices that are shorter than 800 pixels. ...
device-width - CSS: Cascading Style Sheets
examples this html applies a special stylesheet for devices that are narrower than 800 pixels. ...
... examples this html applies a special stylesheet for devices that are narrower than 800 pixels. ...
forced-colors - CSS: Cascading Style Sheets
the forced-colors css media feature is used to detect if the user agent has enabled a forced colors mode where it enforces a user-chosen limited color palette on the page. note: this feature is not supported by any user agent and its specifics are subject to change. syntax the forced-colors media feature indicates whether or not the browser is currently in forced-colors mode. values none forced colors mode is not active; the page’s colors are not being forced into a limited palette. active indicates that forced colors mode is active. the browser provides the color palette to authors through the css system color keywords and, if appropriate, it triggers the appropriate value of prefers-color-scheme so that authors can adapt the page. usage notes properties affected by forced-co...
...ge’s colors are not being forced into a limited palette. active indicates that forced colors mode is active. the browser provides the color palette to authors through the css system color keywords and, if appropriate, it triggers the appropriate value of prefers-color-scheme so that authors can adapt the page. usage notes properties affected by forced-color mode in forced colors mode, the values of the following properties are treated as if they have no author-level values specified. that is, user-specified values (if any) or browser-specified values are used instead. color fill stroke text-decoration-color text-emphasis-color border-color outline-color column-rule-color scrollbar-color -webkit-tap-highlight-color box-shadow text-shadow you can use system color keywords ...
orientation - CSS: Cascading Style Sheets
the orientation css descriptor controls the orientation of a document defined by @viewport. /* keyword values */ orientation: auto; orientation: portrait; orientation: landscape; for a ua/device where the orientation is changed upon tilting the device, an author can use this descriptor to inhibit the orientation change. syntax values auto the user agent will set the document's orientation automatically, typically based on the device's orientation as determined by an accelerometer (if the device has such a hardware sensor), although there is often a user-controlled, os-level "lock orientation" setting that will trump the accelerometer reading. portrait the document should be locked into portrait orientation. landscape the document should be locked into landscape orientation. form...
...entation as determined by an accelerometer (if the device has such a hardware sensor), although there is often a user-controlled, os-level "lock orientation" setting that will trump the accelerometer reading. portrait the document should be locked into portrait orientation. landscape the document should be locked into landscape orientation. formal definition related at-rule@viewportinitial valueautopercentagesrefer to the size of bounding boxcomputed valueas specified formal syntax auto | portrait | landscape examples setting viewport orientation @viewport { orientation: landscape; } specifications specification status comment css device adaptationthe definition of '"orientation" descriptor' in that specification. working draft initial definitio...
user-zoom - CSS: Cascading Style Sheets
the user-zoom css descriptor controls whether or not the user can change the zoom factor of a document defined by @viewport. /* keyword values */ user-zoom: zoom; user-zoom: fixed; syntax values zoom the user can zoom in or out. fixed the user cannot zoom in or out. accessibility concerns disabling zooming capabilities prevents people experiencing low vision conditions from being able to read and understand page content. ...
...e user can zoom in or out. fixed the user cannot zoom in or out. accessibility concerns disabling zooming capabilities prevents people experiencing low vision conditions from being able to read and understand page content. mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.4 | understanding wcag 2.0 formal definition related at-rule@viewportinitial valuezoompercentagesrefer to the size of bounding boxcomputed valueas specified formal syntax zoom | fixed examples disabling user zoom @viewport { user-zoom: fixed; } specifications specification status comment css device adaptationthe definition of '"user-zoom" descriptor' in that specification. working draft initial definition ...
viewport-fit - CSS: Cascading Style Sheets
contain the viewport is scaled to fit the largest rectangle inscribed within the display. cover the viewport is scaled to fill the device display. it is highly recommended to make use of the safe area inset variables to ensure that important content doesn't end up outside the display. ...
...tant content doesn't end up outside the display. this descriptor hasn't been added to https://github.com/mdn/data/blob/master/css/at-rules.json yet. accessibility concerns when using the viewport-fit descriptor, one must keep in mind that not all device displays are rectangular, and should therefore make use of the safe area inset variables. formal definition related at-rule@viewportinitial valueautocomputed valueas specified formal syntax auto | contain | cover examples scaling viewport to fit device display @viewport { viewport-fit: cover; } specifications specification status comment css round display level 1the definition of '"viewport-fit" descriptor' in that specification. working draft initial definition. ...
Box alignment for block, absolutely positioned and table layout - CSS: Cascading Style Sheets
is requested then the fallback alignment will be used, as the content is treated as a single alignment subject. justify-self the justify-self property is used to align an item inside its containing block on the inline axis. this property does not apply to floated elements or table cells. absolutely positioned elements the alignment container is the positioned block, accounting for the offset values of top, left, bottom, and right. the normal keyword resolves to stretch, unless the positioned item is a replaced element, in which case it resolves to start. align-self the align-self property does not apply to block-level boxes (including floats), because there is more than one item in the block axis. it also does not apply to table cells. absolutely positioned elements the alignment conta...
...solves to stretch, unless the positioned item is a replaced element, in which case it resolves to start. align-self the align-self property does not apply to block-level boxes (including floats), because there is more than one item in the block axis. it also does not apply to table cells. absolutely positioned elements the alignment container is the positioned block, accounting for the offset values of top, left, bottom, and right. the normal keyword resolves to stretch, unless the positioned item is a replaced element, in which case it resolves to start. aligning in these layout methods today as we do not currently have browser support for box alignment in block layout, your options for alignment are either to use one of the existing alignment methods or, to make even a single item insid...
Box alignment in grid layout - CSS: Cascading Style Sheets
of box alignment across layout methods. basic example in this example using grid layout, there is extra space in the grid container after laying out the fixed width tracks on the inline (main) axis. this space is distributed using justify-content. on the block (cross) axis the alignment of the items inside their grid areas is controlled with align-items. the first item overrides the align-items value set on the group by setting align-self to center. grid axes as a two-dimensional layout method, when working with grid layout we always have two axes on which to align our items. we have access to all of the box alignment properties to help us achieve this. the inline axis is the axis that corresponds to the direction that words in a sentence would run in the writing mode used. therefore, in...
...it is placed into. the properties align-items and justify-items are applied to the grid container and set the align-self and justify-self properties as a group. this means that you can set alignment for all of your grid items at once, then override any items that need a different alignment by applying the align-self or justify-self property to the rules for the individual grid items. the initial value for align-self and justify-self is stretch so the item will stretch over the entire grid area. the exception to this rule is where the item has an intrinsic aspect ratio, for example an image. in this case the item will be aligned to start in both dimensions in order that the image is not distorted. content alignment justify-content align-content place-content these properties deal with a...
Box alignment in Multi-column Layout - CSS: Cascading Style Sheets
while specified for multicol, may not be supported in browsers. align-content and justify-content the align-content property applies to the block axis and justify-content to the inline axis. any spacing added to the columns due to use of space distribution will be added to the gap between the columns, therefore making the gap larger than might be specified by the column-gap property. using a value of justify-content other than normal or stretch will cause column boxes to display at the column-width specified on the multicol container, and the remaining space distributed according to the value of justify-content. column-gap the column-gap property was specified in earlier versions of the multiple-column layout specification, and has now been unified with the gap properties for other layou...
...to display at the column-width specified on the multicol container, and the remaining space distributed according to the value of justify-content. column-gap the column-gap property was specified in earlier versions of the multiple-column layout specification, and has now been unified with the gap properties for other layout methods in box alignment. while other layout methods treat the initial value of column-gap as 0 multicol treats it as 1em, as in general you would not want to have no gap between columns. reference css properties justify-content align-content column-gap glossary entries alignment subject alignment container fallback alignment ...
Backwards Compatibility of Flexbox - CSS: Cascading Style Sheets
display: -webkit-flex; display: -ms-flexbox; display: flex; } autoprefixer online is a useful way to see which prefixes are recommended, depending on how many versions you wish to go back with browser support. you can also check can i use for information about when prefixes were removed in browsers to make your decision. useful fallback techniques given that flexbox usage is initiated with value of the display property, when needing to support very old browsers which do not support flexbox at all, fallbacks can be created by overwriting one layout method with another. the specification defines what happens if you use other layout methods on an element which then becomes a flex item. floated items “float and clear do not create floating or clearance of flex item, and do not take it o...
...epresent the html table row, and a second one to represent the table element itself, you can’t see or style these anonymous boxes; they are there purely to fix up the tree. if you then declare display: flex on the parent item, these anonymous boxes do not get created and so your item remains a direct child and can become a flex item — losing any of the table display features. “note: some values of display normally trigger the creation of anonymous boxes around the original box. if such a box is a flex item, it is blockified first, and so anonymous box creation will not happen. for example, two contiguous flex items with display: table-cell will become two separate display: block flex items, instead of being wrapped into a single anonymous table.” - 4. flex items the vertical-alig...
Typical use cases of Flexbox - CSS: Cascading Style Sheets
n flexbox, and the justify-content property. you can read more about this property in aligning items in a flex container, which deals with aligning items on the main axis. in the below live example we display the items at their natural size and by using justify-content: space-between make equal amounts of space between the items. you can change how the space is distributed using the space-around value, or where supported, space-evenly. you could also use flex-start to place the space at the end of the items, flex-end to place it before them, or center to centre the navigation items. space distributed within the items a different pattern for navigation would be to distribute the available space within the items themselves, rather than create space between them. in this case we would use the...
...t flex item to flex: 1. as with our column layout card pattern above, using flex: 1 means this part of the card can grow. some things that you might want to try in this live example relate to the different ways you might want to constrain the media object in your design. to prevent the image growing too large, add a max-width to the image. as that side of the media object is using the initial values of flexbox it can shrink but not grow, and uses a flex-basis of auto. any width or max-width applied to the image will become the flex-basis. .image img { max-width: 100px; } you could also allow both sides to grow and shrink in proportion. if you set both sides to flex: 1, they will grow and shrink from a flex-basis of 0, so you will end up with two equal-sized columns. you could either ta...
In Flow and Out of Flow - CSS: Cascading Style Sheets
argin to the item, in order to push the line boxes away from it. you cannot apply anything to the following in-flow content to achieve that. absolute positioning giving an item position: absolute or position: fixed removes it from flow, and any space that it would have taken up is removed. in the next example i have three paragraph elements, the second element has position absolute, with offset values of top: 30px and right: 30px. it has been removed from document flow. using position: fixed also removes the item from flow, however the offsets are based on the viewport rather than the containing block. when taking an item out of flow with positioning, you will need to manage the possibility of content overlapping. out of flow essentially means that the other elements on your page no longe...
... taking an item out of flow with positioning, you will need to manage the possibility of content overlapping. out of flow essentially means that the other elements on your page no longer know that element exists so will not respond to it. relative positioning and flow if you give an item relative positioning with position: relative it remains in flow, however you are then able to use the offset values to push it around. the space that it would have been placed in normal flow is reserved however, as you can see in the example below. when you do anything to remove, or shift an item from where it would be placed in normal flow, you can expect to need to do some managing of the content and the content around it to prevent overlaps. whether that involves clearing floats, or ensuring that an ele...
Introduction to formatting contexts - CSS: Cascading Style Sheets
a bfc contains everything inside it, float...
...ller than the content alongside it, the border of the <div> now runs through the float. as explained in the guide to in-flow and out of flow elements, the float has been taken out of flow so the background and border of the div only contain the content and not the float. creating a new bfc would contain the float. a typical way to do this in the past has been to set overflow: auto or set other values than the initial value of overflow: visible. setting overflow: auto created a new bfc containing the float. our <div> now becomes a mini-layout inside our layout. any child element will be contained inside it. the problem with using overflow to create a new bfc is that the overflow property is meant for telling the browser how you wish to deal with overflowing content. there are some occasio...
Basic Concepts of grid layout - CSS: Cascading Style Sheets
w grid items. in a web browser, you won’t see any difference to how these items are displayed before turning them into a grid, as grid has created a single column grid for the items. at this point, you may find it useful to work with the grid inspector, available as part of firefox's developer tools. if you view this example in firefox and inspect the grid, you will see a small icon next to the value grid. click this and then the grid on this element will be overlaid in the browser window. as you learn and then work with the css grid layout this tool will give you a better idea of what is happening with your grids visually. if we want to start making this more grid-like we need to add column tracks. grid tracks we define rows and columns on our grid with the grid-template-columns and gr...
...columns we may want to give tracks a minimum size, but also ensure they expand to fit any content that is added. for example, i may want my rows to never collapse smaller than 100 pixels, but if my content stretches to 300 pixels in height, then i would like the row to stretch to that height. grid has a solution for this with the minmax() function. in this next example i am using minmax() in the value of grid-auto-rows. this means automatically created rows will be a minimum of 100 pixels tall, and a maximum of auto. using auto means that the size will look at the content size and will stretch to give space for the tallest item in a cell, in this row. .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: minmax(100px, auto); } * {box-sizing: border-box;} .
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
layout for the circumstance of having enough screen real estate to show two columns. @media (min-width: 500px) { .wrapper { grid-template-columns: 1fr 3fr; grid-template-areas: "header header" "nav nav" "sidebar content" "ad footer"; } nav ul { display: flex; justify-content: space-between; } } you can see the layout taking shape in the value of grid-template-areas. the header spans over two column tracks, as does the nav. in the third row track we have the sidebar alongside the content. in the fourth row track i have chosen to place my ad content – so it appears under the sidebar, then the footer next to it under the content. i’m using a flexbox on the navigation to display it in a row spaced out. i can now add a final breakpoin...
...if i am just aligning or distributing something in a single dimension, that’s a flexbox use case. this is all looking fairly complete now, however we sometimes have these cards which contain far more content than the others. it might be nice to cause those to span two tracks, and then they won’t be so tall. i have a class of wide on my larger item, and i add a rule grid-column-end with a value of span 2. now when grid encounters this item, it will assign it two tracks. at some breakpoints, this means that we'll get a gap in the grid – where there isn’t space to lay out a two-track item. i can cause a grid to backfill those gaps by setting grid-auto-flow: dense on the grid container. take care when doing this however as it does take items away from their logical source order. yo...
Consistent list indentation - CSS: Cascading Style Sheets
important part here. what's key is that the markers are placed outside the "principal box" of the <li> elements, not the <ul>. they're sort of like appendages to the list items, hanging outside the content-area of the <li> but still attached to the <li>. this is why, in every browser except internet explorer for windows, markers are placed outside any border set for an <li> element, assuming the value of list-style-position is outside. if it's changed to inside, then the markers are brought inside the <li>'s content, as though they're an inline box placed at the very beginning of the <li>. indenting it twice so how will all this appear in a document? at the moment, we have a situation analogous to these styles: ul, li {margin-left: 0; padding-left: 0;} if we dropped this list into a docume...
...o set both the left margin and left padding of the <ul> element. we can ignore <li> altogether for these purposes. if you want to reproduce the default display in netscape 6.x, you write: ul {margin-left: 0; padding-left: 40px;} if you're more interested in following the internet explorer/opera model, then: ul {margin-left: 40px; padding-left: 0;} of course, you can fill in your own preferred values. set both to 1.25em, if you like -- there's no reason why you have to stick with pixel-based indentation. if you want to reset lists to have no indentation, then you still have to zero out both padding and margin: ul {margin-left: 0; padding-left: 0;} remember, though, that in so doing, you'll have the bullets hanging outside the list and its parent element. if the parent is the body, there's ...
Using z-index - CSS: Cascading Style Sheets
if you are not familiar with the z-axis, imagine the page as a stack of layers, each one having a number. ...
...erical order, with larger numbers above smaller numbers. bottom layer (farthest from the observer) ... layer -3 layer -2 layer -1 layer 0 (default rendering layer) layer 1 layer 2 layer 3 ... top layer (closest to the observer) notes: when no z-index property is specified, elements are rendered on the default rendering layer 0 (zero). if several elements share the same z-index value (i.e., they are placed on the same layer), stacking rules explained in the section stacking without the z-index property apply. in the following example, the layers' stacking order is rearranged using z-index. the z-index of element #5 has no effect since it is not a positioned element. source code for the example html <div id="abs1"> <b>div #1</b> <br />position: absolute; <br />z-...
Stacking context example 3 - CSS: Cascading Style Sheets
menu is absolutely positioned inside the parent element. in order to put it above all first-level menus, a z-index is used. the problem is that for each second-level menu, a stacking context is created and each third-level menu belongs to the context of its parent. so a third-level menu will be stacked under the following second-level menus, because all second-level menus share the same z-index value and the default stacking rules apply. to better understand the situation, here is the stacking context hierarchy: root stacking context level #1 level #2 (z-index: 1) level #3 ... level #3 level #2 (z-index: 1) ... level #2 (z-index: 1) level #1 ... level #1 this problem can be avoided by removing...
...cking context hierarchy: root stacking context level #1 level #2 (z-index: 1) level #3 ... level #3 level #2 (z-index: 1) ... level #2 (z-index: 1) level #1 ... level #1 this problem can be avoided by removing overlapping between different level menus, or by using individual (and different) z-index values assigned through the id selector instead of class selector, or by flattening the html hierarchy. note: in the source code you will see that second-level and third level menus are made of several divs contained in an absolutely positioned container. this is useful to group and position all of them at once. example source code <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http...
Using the :target pseudo-class in selectors - CSS: Cascading Style Sheets
ou can use some simple css to draw attention to the target of a url and improve the user's experience. picking a target the pseudo-class :target is used to style the target element of a url containing a fragment identifier. for example, the url http://developer.mozilla.org/en/docs/using_the_:target_selector#example contains the fragment identifier #example. in html, identifiers are found as the values of either id or name attributes, since the two share the same namespace. thus, the example url would point to the heading "example" in this document. suppose you wish to style any h2 element that is the target of a url, but do not want any other kind of element to get a target style. this is simple enough: h2:target { font-weight: bold; } it's also possible to create styles that are specific ...
...he example url would point to the heading "example" in this document. suppose you wish to style any h2 element that is the target of a url, but do not want any other kind of element to get a target style. this is simple enough: h2:target { font-weight: bold; } it's also possible to create styles that are specific to a particular fragment of the document. this is done using the same identifying value that is found in the uri. thus, to add a border to the #example fragment, we would write: #example:target { border: 1px solid black; } targeting all elements if the intent is to create a "blanket" style that will apply to all targeted elements, then the universal selector comes in handy: :target { color: red; } example in the following example, there are five links that point to elements i...
CSS Shapes - CSS: Cascading Style Sheets
for the level 1 specification, css shapes can be applied to floating elements. the specification defines a number of different ways 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. ...
... 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 with css shapes how to use css shapes in your web design how to get started with css shapes what i learned in one weekend with css shapes css vs. svg: shapes and arbitrarily-shaped ui components speci...
Inline formatting context - CSS: Cascading Style Sheets
inline direction are respected. in the example below you can see how the margin, border, and padding on the inline <span> element are added. note: i am using the logical, flow-relative properties — padding-inline-start rather than padding-left — so that they work in the inline dimension whether the text is horizontal or vertical. read more about these properties in logical properties and values. alignment in the block direction inline boxes may be aligned in the block direction in different ways, using the vertical-align property, which will align on the block axis in vertical writing modes (therefore not vertically at all!). in the example below the large text is making the line box of the first sentence larger, therefore the vertical-align property can be used to align the inline ...
...line boxes may be aligned in the block direction in different ways, using the vertical-align property, which will align on the block axis in vertical writing modes (therefore not vertically at all!). in the example below the large text is making the line box of the first sentence larger, therefore the vertical-align property can be used to align the inline boxes either side of it. i have used the value top, try changing it to middle, bottom, or baseline. alignment in the inline direction if there is additional space in the inline direction, the text-align property can be used to align the inline boxes within their line box. try changing the value of text-align below to end. effect of floats line boxes usually have the same size in the inline direction, therefore the same width if workin...
Testing media queries programmatically - CSS: Cascading Style Sheets
iaquerylist object representing the query. to do this, use the window.matchmedia method. ...
...chanism, but a standard event listener setup, passing an event object of type mediaquerylistevent as the argument to the callback function. ...
Privacy and the :visited selector - CSS: Cascading Style Sheets
information about the user's identity. to mitigate this problem, browsers have limited the amount of information that can be obtained from visited links. little white lies to preserve users' privacy, firefox and other browsers will lie to web applications under certain circumstances: the window.getcomputedstyle method, and similar functions such as element.queryselector, will always return values indicating that a user has never visited any of the links on a page. if you use a sibling selector such as :visited + span, the adjacent element (span in this example) will be styled as if the link were unvisited. in rare scenarios, if you're using nested link elements and the element being matched is different from the link whose presence in history is being tested, the element will be render...
... the fill and stroke attributes in addition, even for the above styles, you won't be able to change the transparency between unvisited and visited links, as you otherwise would be able to using rgba(), hsla(), or the transparent keyword. here is an example of how to use styles with the aforementioned restrictions: :link { outline: 1px dotted blue; background-color: white; /* the default value of background-color is `transparent`. you need to specify a different value, otherwise changes on :visited won't apply. */ } :visited { outline-color: orange; /* visited links have an orange outline */ background-color: green; /* visited links have a green background */ color: yellow; /* visited links have yellow colored text */ } impact on web developers overall, th...
Scaling of SVG backgrounds - CSS: Cascading Style Sheets
; 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; here, the width is determined using the background area's width per rule 4, while the height is the 140px specified in the css. source: one specified dimension with no intrinsic ratio if the image has one specified dimension but no intrinsic ratio, that specified dimension is used per rule 3 i...
...ratio then determines the height for the auto case. source: no specified dimensions with intrinsic ratio if no dimensions are specified in the svg, the specified dimension in the css is applied, then the intrinsic ratio is used to select the other dimension, per rule 2. background: url(no-dimensions-1x1-ratio.svg); background-size: 150px auto; the width is set by the css to 150px. the auto value for the height is computed using that width and the 1:1 aspect ratio to be 150px as well, resulting in the image above. ...
Viewport concepts - CSS: Cascading Style Sheets
s were taken on a browser with an address bar and bookmarks bar totalling 100px in height, but no chrome on the left or right of the window. 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 /...
...like the following: <meta name="viewport" content="width=device-width"> the width property controls the size of the viewport. it should preferably be set to device-width, which is the width of the screen in css pixels at a scale of 100%. there are other properties, including maximum-scale, minimum-scale, and user-scalable, which control whether users can zoom the page in or out, but the default values are the best for accessibility and user experience, so these can be omitted. see also @viewport css at-rule visual viewport api <meta>, specifically <meta name="viewport"> using the viewport meta tag to control layout on mobile browsers ...
WebKit CSS extensions - CSS: Cascading Style Sheets
-webkit-transition -webkit-transition-delay -webkit-transition-duration -webkit-transition-property -webkit-transition-timing-function u -webkit-user-select *supported with -moz- and -webkit- prefix in firefox, but not supported without a prefix. microsoft edge and ie mobile support this property with the -webkit- prefix, rather than -ms- for interopability reasons as well. ** these values are supported even though they are not standard and are not on track to becoming standard. *** use flex-box properties instead. deprecated -webkit- properties the following properties were once supported with the -webkit- prefix but are no longer supported in evergreen browsers, with or without the -webkit- prefix. -webkit-alt* -webkit-color-correction -webkit-flow-from -webkit-flow-in...
...edia-controls-panel ::-webkit-media-controls-play-button ::-webkit-media-controls-timeline ::-webkit-media-controls-time-remaining-display ::-webkit-media-controls-toggle-closed-captions-button ::-webkit-media-controls-volume-control-container ::-webkit-media-controls-volume-control-hover-background ::-webkit-media-controls-volume-slider ::-webkit-meter-bar ::-webkit-meter-even-less-good-value ::-webkit-meter-inner-element ::-webkit-meter-optimum-value ::-webkit-meter-suboptimum-value -webkit-media-text-track-container ::-webkit-outer-spin-button ::-webkit-progress-bar ::-webkit-progress-inner-element ::-webkit-progress-value ::-webkit-search-cancel-button ::-webkit-search-results-button ::-webkit-slider-runnable-track ::-webkit-slider-thumb note: generally, if there is...
backface-visibility - CSS: Cascading Style Sheets
the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. an element's back face is a mirror image of its front face. though invisible in 2d, the back face can become visible when a transformation causes the element to be rotated in 3d space. (this property has no effect on 2d transforms, which have no perspective.) syntax /* keyword values */ backface-visibility: visible; backface-visibility: hidden; /* global values */ backface-visibility: inherit; backface-visibility: initial; backface-visibility: unset; the backface-visibility property is specified as one of the keywords listed below. values visible the back face is visible when turned towards the user. hidden the back face is hidden, effectively making the element inv...
...global values */ backface-visibility: inherit; backface-visibility: initial; backface-visibility: unset; the backface-visibility property is specified as one of the keywords listed below. values visible the back face is visible when turned towards the user. hidden the back face is hidden, effectively making the element invisible when turned away from the user. formal definition initial valuevisibleapplies totransformable elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax visible | hidden examples cube with transparent and opaque faces this example shows a cube with transparent faces, and one with opaque faces. html <table> <tr> <th><code>backface-visibility: visible;</code></th> <th><code>backface-visibility: hidden;</code></th> </tr>...
column-fill - CSS: Cascading Style Sheets
the column-fill css property controls how an element's contents are balanced when broken into columns. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ column-fill: auto; column-fill: balance; column-fill: balance-all; /* global values */ column-fill: inherit; column-fill: initial; column-fill: unset; the column-fill property is specified as one of the keyword values listed below. the initial value is balance so the content will be balanced across the columns. values auto columns are filled sequentially. content takes up only the room it needs, this may result in some columns remai...
... result in some columns remaining empty. balance content is equally divided between columns. in fragmented contexts, such as paged media, only the last fragment is balanced. therefore in paged media, only the last page would be balanced. balance-all content is equally divided between columns. in fragmented contexts, such as paged media, all fragments are balanced. formal definition initial valuebalanceapplies tomulticol elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | balance | balance-all examples splitting text evenly across columns html <p class="content-box"> this is a bunch of text split into multiple columns. the css `column-fill` property is used to spread the contents evenly across all the columns. </p> css .content-box { ...
column-rule-width - CSS: Cascading Style Sheets
the column-rule-width css property sets the width 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. syntax /* keyword values */ column-rule-width: thin; column-rule-width: medium; column-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. i...
...dth: 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 used to change the width of the line that is drawn between columns. don't you...
column-span - CSS: Cascading Style Sheets
the column-span css property makes it possible for an element to span across all columns when its value is set to all. /* keyword values */ column-span: none; column-span: all; /* global values */ column-span: inherit; column-span: initial; column-span: unset; an element that spans more than one column is called a spanning element. syntax the column-span property is specified as one of the keyword values listed below. values none the element does not span multiple columns. all the element spans across all columns. content in the normal flow that appears before the element is automatically balanced across all columns before the element appears. ...
... column-span property is specified as one of the keyword values listed below. values none the element does not span multiple columns. all the element spans across all columns. content in the normal flow that appears before the element is automatically balanced across all columns before the element appears. the element establishes a new block formatting context. formal definition initial valuenoneapplies toin-flow block-level elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax none | all examples making a heading span columns in this example, the heading is made to span across all the columns of the article. html <article> <h2>header spanning all of the columns</h2> <p> the h2 should span all the columns. the rest of the text should be...
<dimension> - CSS: Cascading Style Sheets
Web › CSS › dimension
e>), frequencies (<frequency>), resolutions (<resolution>), and other quantities. syntax the syntax of <dimension> is a <number> immediately followed by a unit which is an identifier. unit identifiers are case insensitive. examples valid dimensions 12px 12 pixels 1rem 1 rem 1.2pt 1.2 points 2200ms 2200 milliseconds 5s 5 seconds 200hz 200 hertz 200hz 200 hertz (values are case insensitive) invalid dimensions 12 px the unit must come immediately after the number. 12"px" units are identifiers and therefore unquoted. 3sec the seconds unit is abbreviated "s" not "sec". specifications specification status comment css values and units module level 4the definition of '<dimension>' in that specification. editor's...
... the unit must come immediately after the number. 12"px" units are identifiers and therefore unquoted. 3sec the seconds unit is abbreviated "s" not "sec". specifications specification status comment css values and units module level 4the definition of '<dimension>' in that specification. editor's draft adds cap, ic, lh, rlh, vi, vb css values and units module level 3the definition of '<dimension>' in that specification. candidate recommendation adds ch, rem, vw, vw, vmin, vmax, q css level 2 (revision 1)the definition of '<dimension>' in that specification. recommendation defined under numbers and length css level 1the definition of '<dimension>' in that specification. recommendation initial defini...
direction - CSS: Cascading Style Sheets
Web › CSS › direction
cells flow within a table row. unlike the dir attribute in html, the direction property is not inherited from table columns into table cells, since css inheritance follows the document tree, and table cells are inside of rows but not inside of columns. the direction and unicode-bidi properties are the two only properties which are not affected by the all shorthand property. syntax /* keyword values */ direction: ltr; direction: rtl; /* global values */ direction: inherit; direction: initial; direction: unset; values ltr text and other elements go from left to right. this is the default value. rtl text and other elements go from right to left. for the direction property to have any effect on inline-level elements, the unicode-bidi property's value must be embed or override. form...
...rection: rtl; /* global values */ direction: inherit; direction: initial; direction: unset; values ltr text and other elements go from left to right. this is the default value. rtl text and other elements go from right to left. for the direction property to have any effect on inline-level elements, the unicode-bidi property's value must be embed or override. formal definition initial valueltrapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax ltr | rtl examples setting right-to-left direction blockquote { direction: rtl; } specifications specification status comment css writing modes module level 3the definition of 'direction' in that specification. proposed recommendation no change. c...
<display-internal> - CSS: Cascading Style Sheets
table-header-group these elements behave like <thead> html elements. table-footer-group these elements behave like <tfoot> html elements. table-row these elements behave like <tr> html elements. ...
... table-header-group these elements behave like <thead> html elements. table-footer-group these elements behave like <tfoot> html elements. table-row these elements behave like <tr> html elements. ...
<display-legacy> - CSS: Cascading Style Sheets
css 2 used a single-keyword syntax for the display property, requiring separate keywords for block-level and inline-level variants of the same layout mode. this page details those values. syntax valid <display-legacy> values: inline-block the element generates a block element box that will be flowed with surrounding content as if it were a single inline box (behaving much like a replaced element would). it is equivalent to inline flow-root. inline-table the inline-table value does not have a direct mapping in html. it behaves like an html <table> element, but as an inline box, rather than a block-level box. inside the table box is a block-level context. it is equivalent to inline table. inline-flex the element behaves like an inline element and lays out its content according ...
...to the grid model. it is equivalent to inline grid. examples in the below example, we are creating an inline flex container with the legacy keyword inline-flex. html <div class="container"> <div>flex item</div> <div>flex item</div> </div> not a flex item css .container { display: inline-flex; } result in the new syntax the inline flex container would be created using two values, inline for the outer display type, and flex for the inner display type. .container { display: inline flex; } specifications specification status css display module level 3the definition of 'display-legacy' in that specification. candidate recommendation ...
drop-shadow() - CSS: Cascading Style Sheets
) 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. parameters offset-x offset-y (required) two <length> values that determine the shadow offset. offset-x specifies the horizontal distance, where negative values place the shadow to the left of the element. offset-y specifies the vertical distance, where negative values place the shadow above the element. if both values are 0, the shadow is placed directly behind the element. blur-radius (optional) the shadow's blur radius, specified as a <length>. the l...
...ermine the shadow offset. offset-x specifies the horizontal distance, where negative values place the shadow to the left of the element. offset-y specifies the vertical distance, where negative values place the shadow above the element. if both values are 0, the shadow is placed directly behind the element. blur-radius (optional) the shadow's blur radius, specified as a <length>. 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. examples setting a drop shadow using pixel offsets and blur radius /* black shadow with 10px blur */ drop-shadow(16p...
font-optical-sizing - CSS: Cascading Style Sheets
the font-optical-sizing css property sets whether text rendering is optimized for viewing at different sizes. the source for this interactive example is stored in a github repository. if 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 */ font-optical-sizing: none; font-optical-sizing: auto; /* default */ /* global values */ font-optical-sizing: inherit; font-optical-sizing: initial; font-optical-sizing: unset; values none the browser will not modify the shape of glyphs for optimal viewing. auto the browser will modify the shape of glyphs for optimal viewing. description optical sizing is enabled by default for fonts that have an optical size variation axi...
...s enabled by default for fonts that have an optical size variation axis. the optical size variation axis is represented by opsz in font-variation-settings. when optical sizing is used, small text sizes are often rendered with thicker strokes and larger serifs, whereas larger text is often rendered more delicately with more contrast between thicker and thinner strokes. formal definition initial valueautoapplies toall elements. it also applies to ::first-letter and ::first-line.inheritedyescomputed valueas specifiedanimation typediscrete formal syntax auto | none examples disabling optical sizing <p class="optical-sizing">this paragraph is optically sized. this is the default across browsers.</p> <p class="no-optical-sizing">this paragraph is not optically sized. you should see a diffe...
<frequency> - CSS: Cascading Style Sheets
Web › CSS › frequency
0hz, 10000hz. khz represents a frequency in kilohertz. examples: 0khz, 1.5khz, 10khz. note: although the number 0 is always the same regardless of unit, the unit may not be omitted. in other words, 0 is invalid and does not represent 0hz or 0khz. though the units are case-insensitive, it is good practice to use a capital "h" for hz and khz, as specified in the si. examples valid frequency values 12hz positive integer 4.3hz non-integer 14khz the unit is case-insensitive, though non-si capitalization is not recommended. +0hz zero, with a leading + and a unit -0khz zero, with a leading - and a unit invalid frequency values 12.0 this is a <number>, not an <frequency>, because it is missing a unit. 7 hz no space is allowed between the number and the unit. 0 ...
... 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 voice. ...
hyphens - CSS: Cascading Style Sheets
Web › CSS › hyphens
the language is determined by the lang attribute, and browsers will hyphenate only if this attribute is present and the appropriate hyphenation dictionary is available. in xml, the xml:lang attribute must be used. note: the rules defining how hyphenation is performed are not explicitly defined by the specification, so the exact hyphenation may vary from browser to browser. syntax /* keyword values */ hyphens: none; hyphens: manual; hyphens: auto; /* global values */ hyphens: inherit; hyphens: initial; hyphens: unset; the hyphens property is specified as a single keyword value chosen from the list below. values none words are not broken at line breaks, even if characters inside the words suggest line break points. lines will only wrap at whitespace. manual words are broken for li...
... line is not actually broken at that point, the hyphen is still rendered. u+00ad (shy) an invisible, "soft" hyphen. this character is not rendered visibly; instead, it marks a place where the browser should break the word if hyphenation is necessary. in html, use &shy; to insert a soft hyphen. when the html <wbr> element leads to a line break, no hyphen is added. formal definition initial valuemanualapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax none | manual | auto examples specifying text hyphenation this example uses three classes, one for each possible configuration of the hyphens property. html <dl> <dt><code>none</code>: no hyphen; overflow if needed</dt> <dd lang="en" class="none">an extreme&shy;ly long english word</dd...
inherit - CSS: Cascading Style Sheets
Web › CSS › inherit
it can be applied to any css property, including the css shorthand all. for inherited properties, this reinforces the default behavior, and is only needed to override another rule. for non-inherited properties, this specifies a behavior that typically makes relatively little sense and you may consider using initial instead, or unset on the all property. inheritance is always from the parent element in the document tree, even when the parent element is not the containing block. ...
...the sidebar might be different colors. for example, if one of them were the child of a div matched by the rule ... div#current { color: blue; } ... it would be blue. specifications specification status comment css cascading and inheritance level 4the definition of 'inherit' in that specification. candidate recommendation no changes from level 3. css values and units module level 3the definition of 'inherit' in that specification. candidate recommendation no significant change from css level 2 (revision 1). css level 2 (revision 1)the definition of 'inherit' in that specification. recommendation initial definition. ...
isolation - CSS: Cascading Style Sheets
Web › CSS › isolation
rty determines whether an element must create a new stacking context. the source for this interactive example is stored in a github repository. if 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 is especially helpful when used in conjunction with mix-blend-mode. syntax /* keyword values */ isolation: auto; isolation: isolate; /* global values */ isolation: inherit; isolation: initial; isolation: unset; the isolation property is specified as one of the keyword values listed below. values auto a new stacking context is created only if one of the properties applied to the element requires it. isolate a new stacking context must be created. formal definition initial va...
...is specified as one of the keyword values listed below. values auto a new stacking context is created only if one of the properties applied to the element requires it. isolate a new stacking context must be created. formal definition initial valueautoapplies toall elements. ...
<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. html <p>you can use percentages and lengths in so many places.</p> css p { /* length-percentage examples */ width: 75%; height: 200px; margin: 3rem; padding: 1%; border-radius: 10px 10%; font-size: 250%; line-height: 1.5em; /* length examples */ text-shadow: 1px 1px 1px red; border: 5px solid red; letter-spacing: 3px; /* percentage example */ text-size-adjust: 20%; } result use in calc() wher...
...e-height: 1.5em; /* length examples */ text-shadow: 1px 1px 1px red; border: 5px solid red; letter-spacing: 3px; /* percentage example */ text-size-adjust: 20%; } result use in calc() where a <length-percentage> is specified as an allowable type, this means that the percentage resolves to a length and therefore can be used in a calc() expression. therefore, all of the following values are acceptable for width: width: 200px; width: 20%; width: calc(100% - 200px); specifications specification status comment css values and units module level 4the definition of '<length-percentage>' in that specification. editor's draft css values and units module level 3the definition of '<length-percentage>' in that specification. candidate rec...
margin-trim - CSS: Cascading Style Sheets
ner’s edges. syntax none margins are not trimmed by the container. in-flow for in-flow boxes contained by this box, block-axis margins adjacent to the box's edges are truncated to zero. it also truncates any margins collapsed with such a margin. all trims the margins of in-flow boxes and floats whose margins coincide with the container's content edge. ...
...s margins adjacent to the box's edges are truncated to zero. it also truncates any margins collapsed with such a margin. all trims the margins of in-flow boxes and floats whose margins coincide with the container's content edge. formal definition initial valuenoneapplies toblock containers and multi-column containers. ...
offset - CSS: Cascading Style Sheets
Web › CSS › offset
00 l 200 300 z'); offset: url(arc.svg); /* offset path with distance and/or rotation */ offset: url(circle.svg) 100px; offset: url(circle.svg) 40%; offset: url(circle.svg) 30deg; offset: url(circle.svg) 50px 20deg; /* including offset anchor */ offset: ray(45deg closest-side) / 40px 20px; offset: url(arc.svg) 2cm / 0.5cm 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 proper...
...ffset-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 properties of the shorthand:offset-position: a positionoffset-path: as <angle>, <basic-shape> or <path()>offset-distance: a length, percentage or calc();...
orphans - CSS: Cascading Style Sheets
Web › CSS › orphans
the orphans css property sets the minimum number of lines in a block container that must be shown at the bottom of a page, region, or column. /* <integer> values */ orphans: 2; orphans: 3; /* global values */ orphans: inherit; orphans: initial; orphans: unset; in typography, an orphan is the first line of a paragraph that appears alone at the bottom of a page. (the paragraph continues on a following page.) syntax values <integer> the minimum number of lines that can stay by themselves at the bottom of a fragment before a fragmentation break. the value must be positive. ...
...ans: inherit; orphans: initial; orphans: unset; in typography, an orphan is the first line of a paragraph that appears alone at the bottom of a page. (the paragraph continues on a following page.) syntax values <integer> the minimum number of lines that can stay by themselves at the bottom of a fragment before a fragmentation break. the value must be positive. formal definition initial value2applies toblock container elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax <integer> examples setting a minimum orphan size of three lines html <div> <p>this is the first paragraph containing some text.</p> <p>this is the second paragraph containing some more text than the first one. it is used to demonstrate how orphans work.</p> <p>this is the third...
Guide to scroll anchoring - CSS: Cascading Style Sheets
ple overlay on top of the anchor node. if one node doesn't seem appropriate to be an anchor, you can exclude it using overflow-anchor, as described below. what if i need to disable it? the specification provides a new property, overflow-anchor, which can be used to disable scroll anchoring on all or part of the document. it's essentially a way to opt out of the new behavior. the only possible values are auto or none: auto is the initial value; as long as the user has a supported browser the scroll anchoring behavior will happen, and they should see fewer content jumps. none means that you have explicitly opted the document, or part of the document, out of scroll anchoring. to opt out the entire document, you can set it on the <body> element: body { overflow-anchor: none; } to opt ...
...et overflow-anchor: auto elsewhere in the document to turn it back on for a subsection. suppression triggers the specification also details some suppression triggers, which will disable scroll anchoring in places where it might be problematic. if any of the triggers happen on the anchor node, or an ancestor of it, anchoring is suppressed. these suppression triggers are changes to the computed value of any of the following properties: top, left, right, or bottom margin or padding any width or height-related properties transform additionally, position changes anywhere inside the scrolling box also disable scroll anchoring. in bug 1584285 the layout.css.scroll-anchoring.suppressions.enabled flag was added to firefox nightly in order to allow the disabling of these triggers further ...
overscroll-behavior-block - CSS: Cascading Style Sheets
the overscroll-behavior-block css property sets the browser's behavior when the block direction boundary of a scrolling area is reached. see overscroll-behavior for a full explanation. /* keyword values */ overscroll-behavior-block: auto; /* default */ overscroll-behavior-block: contain; overscroll-behavior-block: none; /* global values */ overscroll-behavior-block: inherit; overscroll-behavior-block: initial; overscroll-behavior-block: unset; syntax the overscroll-behavior-block property is specified as a keyword chosen from the list of values below. values auto the default scroll overflow behavior occurs as normal. contain default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occurs to ne...
...curs as normal. contain default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occurs to neighbouring scrolling areas, e.g. underlying elements will not scroll. none no scroll chaining occurs to neighbouring scrolling areas, and default scroll overflow behavior is prevented. formal definition initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax contain | none | auto examples preventing block overscrolling in this demo we have two block-level boxes, one inside the other. the outer box has a large height set on it so the page will scroll vertically. the inner box has a small wi...
overscroll-behavior-inline - CSS: Cascading Style Sheets
the overscroll-behavior-inline css property sets the browser's behavior when the inline direction boundary of a scrolling area is reached. see overscroll-behavior for a full explanation. /* keyword values */ overscroll-behavior-inline: auto; /* default */ overscroll-behavior-inline: contain; overscroll-behavior-inline: none; /* global values */ overscroll-behavior-inline: inherit; overscroll-behavior-inline: initial; overscroll-behavior-inline: unset; syntax the overscroll-behavior-inline property is specified as a keyword chosen from the list of values below. values auto the default scroll overflow behavior occurs as normal. contain default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occ...
...curs as normal. contain default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occurs to neighbouring scrolling areas, e.g. underlying elements will not scroll. none no scroll chaining occurs to neighbouring scrolling areas, and default scroll overflow behavior is prevented. formal definition initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax contain | none | auto examples preventing inline overscrolling in this demo we have two block-level boxes, one inside the other. the outer box has a large width set on it so the page will scroll horizontally. the inner box has a small ...
overscroll-behavior-x - CSS: Cascading Style Sheets
the overscroll-behavior-x css property sets the browser's behavior when the horizontal boundary of a scrolling area is reached. see overscroll-behavior for a full explanation. /* keyword values */ overscroll-behavior-x: auto; /* default */ overscroll-behavior-x: contain; overscroll-behavior-x: none; /* global values */ overscroll-behavior-x: inherit; overscroll-behavior-x: initial; overscroll-behavior-x: unset; syntax the overscroll-behavior-x property is specified as a keyword chosen from the list of values below. values auto the default scroll overflow behavior occurs as normal. contain default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occurs to neighbouring scrolling areas, e.g. unde...
...curs as normal. contain default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occurs to neighbouring scrolling areas, e.g. underlying elements will not scroll. none no scroll chaining occurs to neighbouring scrolling areas, and default scroll overflow behavior is prevented. formal definition initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax contain | none | auto examples preventing an underlying element from scrolling horizontally in our simple overscroll-behavior-x example (see source code also), we have two block-level boxes, one inside the other. the outer box has a la...
<resolution> - CSS: Cascading Style Sheets
syntax the <resolution> data type consists of a strictly positive <number> followed by one of the units listed below. as with all css dimensions, there is no space between the unit literal and the number. units dpi represents the number of dots per inch. ...
...sent 0dpi, 0dpcm, or 0dppx. examples use in a media query @media print and (min-resolution: 300dpi) { ... } valid resolutions 96dpi 50.82dpcm 3dppx invalid resolutions 72 dpi spaces are not allowed between the number and the unit. ten dpi the number must use digits only. 0 the unit is required. specifications specification status comment css values and units module level 4the definition of '<resolution>' in that specification. editor's draft adds the x unit. css values and units module level 3the definition of '<resolution>' in that specification. candidate recommendation adds the dppx unit. media queriesthe definition of '<resolution>' in that specification. recommendation initial definition. ...
scroll-margin-block - CSS: Cascading Style Sheets
mension. the source for this interactive example is stored in a github repository. if 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 snapport. th...
... 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 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-snap-stop - CSS: Cascading Style Sheets
the scroll-snap-stop css property defines whether the scroll container is allowed to "pass over" possible snap positions. /* keyword values */ scroll-snap-stop: normal; scroll-snap-stop: always; /* global values */ scroll-snap-type: inherit; scroll-snap-type: initial; scroll-snap-type: unset; syntax values normal when the visual viewport of this element's scroll container is scrolled, it may "pass over" possible snap positions. always the scroll container must not "pass over" a possible snap position; and must snap to the first of this elements' snap positions. ...
...alues */ scroll-snap-type: inherit; scroll-snap-type: initial; scroll-snap-type: unset; syntax values normal when the visual viewport of this element's scroll container is scrolled, it may "pass over" possible snap positions. always the scroll container must not "pass over" a possible snap position; and must snap to the first of this elements' snap positions. formal definition initial valuenormalapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax normal | always examples snapping in different axes this example is duplicated from scroll-snap-type with minor variances. css /* setup */ :root, body { height: 100%; display: flex; align-items: center; justify-content: space-between; flex-flow: column nowrap; font-family: monos...
scroll-snap-type-x - CSS: Cascading Style Sheets
the scroll-snap-type-x css property defines how strictly snap points are enforced on the horizontal axis of the scroll container in case there is one. specifying any precise animations or physics used to enforce those snap points is not covered by this property but instead left up to the user agent. /* keyword values */ scroll-snap-type-x: none; scroll-snap-type-x: mandatory; scroll-snap-type-x: proximity; /* global values */ scroll-snap-type-x: inherit; scroll-snap-type-x: initial; scroll-snap-type-x: unset; syntax values none when the visual viewport of this scroll container is scrolled horizontally, it must ignore snap points. mandatory the visual viewport of this scroll container will rest on a snap point if it isn't currently scrolled horizontally. that means it snaps on tha...
...et will be adjusted to maintain the resting on that snap point. proximity the visual viewport of this scroll container may come to rest on a snap point if it isn't currently scrolled horizontally considering the user agent's scroll parameters. if content is added, moved, deleted or resized the scroll offset may be adjusted to maintain the resting on that snap point. formal definition initial valuenoneapplies toscroll containersinheritednocomputed valueas specifiedanimation typediscrete formal syntax none | mandatory | proximity specifications not part of any standard. ...
scroll-snap-type-y - CSS: Cascading Style Sheets
the scroll-snap-type-y css property defines how strictly snap points are enforced on the vertical axis of the scroll container in case there is one. specifying any precise animations or physics used to enforce those snap points is not covered by this property but instead left up to the user agent. /* keyword values */ scroll-snap-type-y: none; scroll-snap-type-y: mandatory; scroll-snap-type-y: proximity; /* global values */ scroll-snap-type-y: inherit; scroll-snap-type-y: initial; scroll-snap-type-y: unset; syntax values none when the visual viewport of this scroll container is scrolled vertically, it must ignore snap points. mandatory the visual viewport of this scroll container will rest on a snap point if it isn't currently scrolled vertically. that means it snaps on that poin...
...fset will be adjusted to maintain the resting on that snap point. proximity the visual viewport of this scroll container may come to rest on a snap point if it isn't currently scrolled vertically considering the user agent's scroll parameters. if content is added, moved, deleted or resized the scroll offset may be adjusted to maintain the resting on that snap point. formal definition initial valuenoneapplies toscroll containersinheritednocomputed valueas specifiedanimation typediscrete formal syntax none | mandatory | proximity specifications not part of any standard. ...
<string> - CSS: Cascading Style Sheets
Web › CSS › string
g, and the backslash itself. for example, \\ will create a single backslash. to output new lines, you must escape them with a line feed character such as \a or \00000a. in your code, however, strings can span multiple lines, in which case each new line must be escaped with a \ as the last character of the line. however, to get new lines, you must also set the white-space property to appropriate value. note: html entities (such as &nbsp; or &#8212;) cannot be used in a css <string>. examples /* simple strings */ "this string is demarcated by double quotes." 'this string is demarcated by single quotes.' /* character escaping */ "this is a string with \" an escaped double quote." "this string also has \22 an escaped double quote." 'this is a string with \' an escaped single quote.' 'this s...
... candidate recommendation no significant change from css level 2 (revision 1). css level 2 (revision 1)the definition of '<string>' in that specification. recommendation explicit definition; allows 6-digit unicode escaped characters. css level 1the definition of '<string>' in that specificati...
symbols() - CSS: Cascading Style Sheets
Web › CSS › symbols
the symbols() css function lets you define counter styles inline, directly as the value of a property such as list-style. unlike @counter-style, symbols() is anonymous (i.e., it can only be used once). although less powerful, it is shorter and easier to write than @counter-style. syntax symbols() = symbols( <symbols-type>? [ <string> | <image> ]+ ); <symbols-type> can be one of the following: cyclic: the system cycles through the given values in the order of their definition, and returns to the start when it reaches the end. numeric: the system interprets the given values as the successive units of a place-value numbering system. alphabetic: the system interprets the given values as the digits of an alphabetic numbering system, like a place-value numbering system but without 0. symbo...
...e given values in the order of their definition, and returns to the start when it reaches the end. numeric: the system interprets the given values as the successive units of a place-value numbering system. alphabetic: the system interprets the given values as the digits of an alphabetic numbering system, like a place-value numbering system but without 0. symbolic: the system cycles through the values, printing them an additional time at each cycle (one time for the first cycle, two times for the second, etc.). fixed: the system cycles through the given values once, then falls back to arabic numerals. examples html <ol> <li>one</li> <li>two</li> <li>three</li> <li>four</li> <li>five</li> </ol> css ol { list-style: symbols(cyclic "*" "†" "‡"); } result specificatio...
table-layout - CSS: Cascading Style Sheets
the table-layout css property sets the algorithm used to lay out <table> cells, rows, and columns. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ table-layout: auto; table-layout: fixed; /* global values */ table-layout: inherit; table-layout: initial; table-layout: unset; values auto by default, most browsers use an automatic table layout algorithm. the widths of the table and its cells are adjusted to fit the content. fixed table and column widths are set by the widths of table and col elements or by the width of the first row of cells. cells in subsequent rows do not affect c...
... once the first table row has been downloaded and analyzed. this can speed up rendering time over the "automatic" layout method, but subsequent cell content might not fit in the column widths provided. cells use the overflow property to determine whether to clip any overflowing content, but only if the table has a known width; otherwise, they won't overflow the cells. formal definition initial valueautoapplies totable and inline-table elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | fixed examples fixed-width tables with text-overflow this example uses a fixed table layout, combined with the width property, to restrict the table's width. the text-overflow property is used to apply an ellipsis to words that are too long to fit. if the table layout ...
text-emphasis-position - CSS: Cascading Style Sheets
the text-emphasis-position css property sets where emphasis marks are drawn. like ruby text, if there isn't enough room for emphasis marks, the line height is increased. /* initial value */ text-emphasis-position: over right; /* keywords value */ text-emphasis-position: over left; text-emphasis-position: under right; text-emphasis-position: under left; text-emphasis-position: left over; text-emphasis-position: right under; text-emphasis-position: left under; /* global values */ text-emphasis-position: inherit; text-emphasis-position: initial; text-emphasis-position: unset; syntax values over draw marks over the text in horizontal writing mode. under draw marks under the text in horizontal writing mode. right draws marks to the right of the text in vertical writing mode. left ...
...sis mark and ruby position language preferred position illustration horizontal vertical japanese over right korean mongolian chinese under right note: the text-emphasis-position cannot be set, and therefore are not reset either, using the text-emphasis shorthand property. formal definition initial valueover rightapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax [ over | under ] && [ right | left ] examples preferring ruby over emphasis marks some editors prefer to hide emphasis marks when they conflict with ruby. in html, this can be done with the following style rule: ruby { text-emphasis: none; } preferring emphasis marks over ruby some...
text-justify - CSS: Cascading Style Sheets
the text-justify css property sets what type of justification should be applied to text when text-align: justify; is set on an element. text-justify: none; text-justify: auto; text-justify: inter-word; text-justify: inter-character; text-justify: distribute; /* deprecated value */ syntax the text-justify property is specified as a single keyword chosen from the list of values below. values none the text justification is turned off. this has the same effect as not setting text-align at all, although it is useful if you need to turn justification on and off for some reason. auto the browser chooses the best type of justification for the current situation based on a balance between performance and quality, but also on what is most appropriate for the language of the text (e.g., english...
...by adding space between words (effectively varying word-spacing), which is most appropriate for languages that separate words using spaces, like english or korean. inter-character the text is justified by adding space between characters (effectively varying letter-spacing), which is most appropriate for languages like japanese. distribute exhibits the same behaviour as inter-character; this value is kept for backwards compatibility. formal definition initial valueautoapplies toinline-level and table-cell elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax auto | inter-character | inter-word | none examples <p class="none"><code>text-justify: none</code> —<br>lorem ipsum dolor sit amet, consectetur adipiscing elit. nunc ornare maximus vehicula. duis...
<time-percentage> - CSS: Cascading Style Sheets
syntax refer to the documentation for <time> and <percentage> for details of the individual syntaxes allowed by this type. examples use in calc() where a <time-percentage> is specified as an allowable type, this means that the percentage resolves to a time and therefore can be used in a calc() expression. ...
...ero with a leading + and a unit -0ms zero with a leading - and a unit invalid times 0 although unitless zero is allowed for <length>s, it's invalid for <time>s. 12.0 this is a <number>, not a <time>, because it's missing a unit. 7 ms no space is allowed between the number and the unit. specifications specification status comment css values and units module level 4the definition of '<time-percentage>' in that specification. editor's draft css values and units module level 3the definition of '<time-percentage>' in that specification. candidate recommendation defines <time-percentage>. adds calc() ...
<time> - CSS: Cascading Style Sheets
Web › CSS › time
it is used in animation, transition, and related properties. syntax the <time> data type consists of a​ ​​​​​​<number> followed by one of the units listed below. optionally, it may be preceded by a single + or - sign. as with all dimensions, there is no space between the unit literal and the number. note: although the number 0 is always the same regardless of unit, the unit may not be omitted. in other words, 0 is invalid and does not represent 0s or 0ms. units s represents a time in seconds. examples: 0s, 1.5s, -60s. ms represents a time in milliseconds. examples: 0ms, 150.25ms, -60000ms. ...
...ero with a leading + and a unit -0ms zero with a leading - and a unit invalid times 0 although unitless zero is allowed for <length>s, it's invalid for <time>s. 12.0 this is a <number>, not a <time>, because it's missing a unit. 7 ms no space is allowed between the number and the unit. specifications specification status comment css values and units module level 4the definition of '<time>' in that specification. editor's draft css values and units module level 3the definition of '<time>' in that specification. candidate recommendation normative definition of s and ms. css level 2 (revision 1)the definition of '<time>' in that specification. recommendation informal definition of s and ms. ...
matrix() - CSS: Cascading Style Sheets
the matrix() css function defines a homogeneous 2d transformation 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 ...
... a b c d are <number>s describing the linear transformation. tx ty are <number>s describing the translation to apply. ...
perspective() - CSS: Cascading Style Sheets
r would be if the 2-dimensional interface were 3-dimensional. 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. 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 i...
...ffers 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 <length> representing the distance from the user to the z=0 plane. if it is 0 or a negative value, no perspective transform is applied. cartesian coordinates on ℝ2 homogeneo...
scale3d() - CSS: Cascading Style Sheets
clone https://github.com/mdn/interactive-examples and send us a pull request. this scaling transformation is characterized by a three-dimensional vector. its coordinates define how much scaling is done in each direction. if all three coordinates are equal, the scaling is uniform (isotropic) and the aspect ratio of the element is preserved (this is a homothetic transformation). ...
...define how much scaling is done in each direction. if all three coordinates are equal, the scaling is uniform (isotropic) and the aspect ratio of the element is preserved (this is a homothetic transformation). when a coordinate value is outside the [-1, 1] range, the element grows along that dimension; when inside, it shrinks. if it is negative, the result a point reflection in that dimension. a value of 1 has no effect. syntax the scale3d() function is specified with three values, which represent the amount of scaling to be applied in each direction. scale3d(sx, sy, sz) values sx is a <number> representing the abscissa of the scaling vector. sy is a <number> representing the ordinate of the scaling vector. sz is a <number> representing the z-component of the scaling vector. ...
unset - CSS: Cascading Style Sheets
Web › CSS › unset
the unset css keyword resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not. in other words, it behaves like the inherit keyword in the first case, when the property is an inherited property, and like the initial keyword in the second case, when the property is a non-inherited property. unset can be applied to any css property, including the css shorthand all. ...
... the first case, when the property is an inherited property, and like the initial keyword in the second case, when the property is a non-inherited property. unset can be applied to any css property, including the css shorthand all. ...
<url> - CSS: Cascading Style Sheets
Web › CSS › url
candidate recommendation no significant change from css level 2 (revision 1). css level 2 (revision 1)the definition of '<uri>' in that specification. recommendation no significant change f...
...erty>: url(http://mysite.example.com/mycursor.png) examples .topbanner { background: url("topbanner.png") #00d no-repeat fixed; } ul { list-style: square url(http://www.example.com/redball.png); } specifications specification status comment css values and units module level 4the definition of '<url>' in that specification. editor's draft css values and units module level 3the definition of '<url>' in that specification. candidate recommendation no significant change from css level 2 (revision 1). css level 2 (revision 1)the definition of '<uri>' in that specification. recommendation no significant change from css level 1. css level 1the definition of '<url>' in that specification. recommendation initial ...
widows - CSS: Cascading Style Sheets
Web › CSS › widows
the widows css property sets the minimum number of lines in a block container that must be shown at the top of a page, region, or column. /* <integer> values */ widows: 2; widows: 3; /* global values */ widows: inherit; widows: initial; widows: unset; in typography, a widow is the last line of a paragraph that appears alone at the top of a page. (the paragraph is continued from a prior page.) syntax values <integer> the minimum number of lines that can stay by themselves at the top of a new fragment after a fragmentation break. the value must be positive. ...
.../ widows: inherit; widows: initial; widows: unset; in typography, a widow is the last line of a paragraph that appears alone at the top of a page. (the paragraph is continued from a prior page.) syntax values <integer> the minimum number of lines that can stay by themselves at the top of a new fragment after a fragmentation break. the value must be positive. formal definition initial value2applies toblock container elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax <integer> examples controlling column widows html <div> <p>this is the first paragraph containing some text.</p> <p>this is the second paragraph containing some more text than the first one. it is used to demonstrate how widows work.</p> <p>this is the third paragraph. it has a...
CSS: Cascading Style Sheets
Web › CSS
e common problems this module provides links to sections of content explaining how to use css to solve common problems when creating a web page. reference css reference: this exhaustive reference for seasoned web developers describes every property and concept of css. ...
... reference css reference: this exhaustive reference for seasoned web developers describes every property and concept of css. css key concepts: the syntax and forms of the language specificity, inheritance and the cascade css units and values box model and margin collapse the containing block stacking and block-formatting contexts initial, computed, used, and actual values css shorthand properties css flexible box layout css grid layout media queries animation cookbook the css layout cookbook aims to bring together recipes for common layout patterns, things you might need to implement in your sites. in addition to providing code you can use as a starting point in your projects, these recipes highlight the different ways layout specifications...
Web Audio playbackRate explained - Developer guides
to the original rate.) a complete example let's create a <video> element first, and set up video and playback rate controls in html: <video id="myvideo" controls> <source src="https://udn.realityripple.com/samples/6f/08625b424a.m4v" type='video/mp4' /> <source src="https://udn.realityripple.com/samples/5b/8cd6da9c65.webm" type='video/webm' /> </video> <form> <input id="pbr" type="range" value="1" min="0.5" max="4" step="0.1" > <p>playback rate <span id="currentpbr">1</span></p> </form> and apply some javascript to it: window.onload = function () { var v = document.getelementbyid("myvideo"); var p = document.getelementbyid("pbr"); var c = document.getelementbyid("currentpbr"); p.addeventlistener('input',function(){ c.innerhtml = p.value; v.playbackrate = p.value; ...
...ome (android) ✖ mobile firefox 24+ ✔ ie mobile ✖ mobile safari 6+ (ios) ✔ opera mobile ✖ notes most browsers stop playing audio outside playbackrate bounds of 0.5 and 4, leaving the video playing silently. for most applications, it's recommended that you limit the range to between 0.5 and 4. the pitch of the audio track does not change when playbackrate is altered. negative values will not cause the media to play in reverse. ie9+ switches to the default playback rate when an ended event is fired. firefox generates a ratechange event when the media source is substituted. on ios 7 you can only affect the playbackrate when the media is paused (not while it's playing). see also hyperaudio's playback rate test htmlmediaelement reference ...
Challenge solutions - Developer guides
ible solutions. the sections below correspond to the titles of the tutorial sections. why use css colors challenge without looking up a reference, find five more color names that work in your stylesheet. solution css supports common color names like orange, yellow, blue, green, or black. it also supports some more exotic color names like chartreuse, fuschia, or burlywood. see css color value for a complete list as well as other ways of specifying colors. how css works dom inspector challenge in domi, click on a strong node. use domi's right-hand pane to find out where the node's color is set to red, and where its appearance is made bolder than normal text. solution in the menu above the right-hand pane, choose css rules. you see two items listed, one that references an inte...
...font. solution add the following style declaration to the strong rule: font: 200% serif; if you use separate declarations for font-size and font-family, then the font-style setting on the first paragraph is not overridden. color three-digit color codes challenge in your css file, change all the color names to 3-digit color codes without affecting the result. ...
Creating and triggering events - Developer guides
t, and have an ancestor catch it; optionally, with data: <form> <textarea></textarea> </form> const form = document.queryselector('form'); const textarea = document.queryselector('textarea'); // create a new event, allow bubbling, and provide any data you want to pass to the "detail" property const eventawesome = new customevent('awesome', { bubbles: true, detail: { text: () => textarea.value } }); // the form element listens for the custom "awesome" event and then consoles the output of the passed text() method form.addeventlistener('awesome', e => console.log(e.detail.text())); // as the user types, the textarea inside the form dispatches/triggers the event to fire, and uses itself as the starting point textarea.addeventlistener('input', e => e.target.dispatchevent(eventawesome));...
...view the example in action. function simulateclick() { const event = new mouseevent('click', { view: window, bubbles: true, cancelable: true }); const cb = document.getelementbyid('checkbox'); const cancelled...
Orientation and motion data explained - Developer guides
this article provides details about the coordinate systems at play and how you use them. about coordinate frames a coordinate frame is a system whereby the orientation of the three axes (x, y, and z) are defined in reference to an object. there are two coordinate frames to consider when using orientation and motion events: earth coordinate frame the earth coordinate frame is the coordinate frame fixed on the center of the earth; that is, the axes are aligned based on the pull of gravity and the standard magnetic north orientation. ...
... ground plane, perpendicular to the y axis and positive toward the east (and therefore negative toward the west). the y axis follows along the ground plane, and is positive toward true north (that is, the north pole, not magnetic north) and negative toward true south. the z axis is perpendicular to the ground plane; think of it as a line drawn between the device and the center of the earth. the value of the z coordinate is positive upward (away from the center of the earth) and negative downward (toward the center of the earth). device coordinate frame the device coordinate frame is the coordination frame fixed on the center of the device. we use lower-case letters ("x", "y", and "z") to describe the axes of the device coordinate frame. the x axis is in the plane of the screen and is ...
Index - Developer guides
Web › Guide › Index
have already read the announcement on the web audio api coming to firefox, and are totally excited and ready to make your until-now-webkit-only sites work with firefox, which uses the unprefixed version of the spec. 16 audio and video manipulation audio, canvas, examples, guide, html5, media, video, web audio api, webgl, developer recommendation the ability to read the pixel values from each frame of a video can be very useful. 17 event developer guide dom, event, guide, needsupdate, events events refers both to a design pattern used for the asynchronous handling of various incidents which occur in the lifetime of a web page and to the naming, characterization, and use of a large number of incidents of different types. 18 creating and trigge...
... guide mutation events provide a mechanism for a web page or an extension to get notified about changes made to the dom. use mutation observers instead if possible. 23 orientation and motion data explained intermediate, mobile, motion, needscontent, orientation, páginas_a_traducir, rotation when using orientation and motion events, it's important to understand what the values you're given by the browser mean. this article provides details about the coordinate systems at play and how you use them. 24 overview of events and handlers beginner, dom, example, javascript, needsbeginnerupdate, needsupdate, events this overview of events and event handling explains the code design pattern used to react to incidents occurring when a browser accesses a web...
Writing forward-compatible websites - Developer guides
change behavior in future releases. once a browser has shipped a feature unprefixed, however, you can use the prefixed version to target old releases by making sure to always use the unprefixed version of the feature when available. a good example, for a browser vendor using the -vnd css prefix that has shipped an unprefixed implementation of the make-it-pretty property, with a behavior for the value "sometimes" that differs from the prefixed version: <style> .pretty-element { -vnd-make-it-pretty: sometimes; make-it-pretty: sometimes; } </style> the order of the declarations in the rule above is important: the unprefixed one needs to come last. don't use unprefixed versions of css properties or apis until at least one browser supports them until there's decently widespread su...
... are present. missing those can lead to unexpected situations due to a following tag name being treated as an attribute on a previous tag. this can work for a bit, then break if a specification attaches a meaning to that attribute. here's an example that works in browsers without html5 support but breaks in a browser supporting html5: <form action="http://www.example.com"> <input type="submit" value="submit the form" </form> due to the missing > on the input tag. don't leave experiments that didn't work in your code if you try using a css property to do something you want, but it has no effect, remove it. it might start doing something you don't expect in the future ...
HTML attribute: accept - HTML: Hypertext Markup Language
the accept property is an attribute of the file <input> type. it was supported on the <form> element, but was removed in favor of file in html5. because a given file type may be identified in more than one manner, it's useful to provide a thorough set of type specifiers when you need files of specific type, or use the wild card to denote a type of any format is acceptable. ...
...file type specifier may take one of the following forms: a valid case-insensitive filename extension, starting with a period (".") character. for example: .jpg, .pdf, or .doc. a valid mime type string, with no extensions. the string audio/* meaning "any audio file". the string video/* meaning "any video file". the string image/* meaning "any image file". the accept attribute takes as its value a string containing one or more of these unique file type specifiers, separated by commas. for example, a file picker that needs content that can be presented as an image, including both standard image formats and pdf files, might look like this: <input type="file" accept="image/*,.pdf"> using file inputs a basic example <form method="post" enctype="multipart/form-data"> <div> <label for=...
HTML attribute: crossorigin - HTML: Hypertext Markup Language
ments, provides support for cors, defining how the element handles crossorigin requests, thereby enabling the configuration of the cors requests for the element's fetched data. depending on the element, the attribute can be a cors settings attribute. the crossorigin content attribute on media elements is a cors settings attribute. these attributes are enumerated, and have the following possible values: keyword description anonymous cors requests for this element will have the credentials flag set to 'same-origin'. use-credentials cors requests for this element will have the credentials flag set to 'include'. "" setting the attribute name to an empty value, like crossorigin or crossorigin="", is the same as anonymous. by default (that is,...
...ng will be handled as the anonymous keyword. example: crossorigin with the script element you can use the following <script> element to tell a browser to execute the https://example.com/example-framework.js script without sending user-credentials. <script src="https://example.com/example-framework.js" crossorigin="anonymous"></script> example: webmanifest with credentials the use-credentials value must be used when fetching a manifest that requires credentials, even if the file is from the same origin. <link rel="manifest" href="/app.webmanifest" crossorigin="use-credentials"> specifications specification status comment html living standardthe definition of 'cors settings attributes' in that specification. living standard html living standardt...
HTML attribute: minlength - HTML: Hypertext Markup Language
the minlength attribute defines the minimum number of characters (as utf-16 code units) the user can enter into an <input> or <textarea>. this must be an integer value 0 or higher. if no minlength is specified, or an invalid value is specified, the input has no minimum length. this value must be less than or equal to the value of maxlength, otherwise the value will never be valid, as it is impossible to meet both criteria. the input will fail constraint validation if the length of the text value of the field is less than minlength utf-16 code units long, with validitystate.tooshort returning true. constraint validation is only applied when the value is changed by the user. once submission fails, some browsers will display an error message indicating the minimum length required and the ...
...raint validation if the length of the text value of the field is less than minlength utf-16 code units long, with validitystate.tooshort returning true. constraint validation is only applied when the value is changed by the user. once submission fails, some browsers will display an error message indicating the minimum length required and the current length. examples by adding minlength="5", the value must either be empty or five characters or longer to be valid. <label for="fruit">enter a fruit name that is at least 5 letters long</label> <input type="text" minlength="5" id="fruit"> we can use pseudoclasses to style the element based on whether the value is valid. the value will be valid as long as it is either null (empty) or five or more characters long. lime is invalid, lemon is valid. ...
HTML attribute: size - HTML: Hypertext Markup Language
Web › HTML › Attributes › size
if css targets the element with properties impacting the width, css takes precedence. the size attribute has no impact on constraint validation. ...
...if css targets the element with properties impacting the width, css takes precedence. the size attribute has no impact on constraint validation. ...
<applet>: The Embed Java Applet element - HTML: Hypertext Markup Language
Web › HTML › Element › applet
param> elements, then transparent. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts embedded content. dom interface htmlappletelement attributes align this attribute is used to position the applet on the page relative to content that might flow around it. the html 4.01 specification defines values of bottom, left, middle, right, and top, whereas microsoft and netscape also might support absbottom, absmiddle, baseline, center, and texttop. alt this attribute causes a descriptive text alternate to be displayed on browsers that do not support java. page designers should also remember that content enclosed within the <applet> element may also be rendered as alternative text. archive this ...
...or the applet. the meaning and use is unclear and not part of the html standard. vspace this attribute specifies additional vertical space, in pixels, to be reserved above and below the applet. width this attribute specifies in pixels the width that the applet needs. example html <applet code="game.class" align="left" archive="game.zip" height="250" width="350"> <param name="difficulty" value="easy"> <b>sorry, you need java to play this game.</b> </applet> specifications specification status comment html 5.2the definition of '<applet>' in that specification. recommendation html 5.1the definition of '<applet>' in that specification. recommendation html5the definition of '<applet>' in that specification. recommendatio...
<data> - HTML: Hypertext Markup Language
Web › HTML › Element › data
rmitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmldataelement attributes this element's attributes include the global attributes. ...
... permitted aria roles any dom interface htmldataelement attributes this element's attributes include the global attributes. value this attribute specifies the machine-readable translation of the content of the element. examples the following example displays product names but also associates each name with a product number. <p>new products</p> <ul> <li><data value="398">mini ketchup</data></li> <li><data value="399">jumbo ketchup</data></li> <li><data value="400">mega jumbo ketchup</data></li> </ul> specifications specification status comment html living standardthe definition of '<data>' in that specification. living standard no change from html5 html5the definition of '<data>' in that specification. reco...
<dd>: The Description Details element - HTML: Hypertext Markup Language
Web › HTML › Element › dd
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none. permitted content flow content. tag omission the start tag is required. the end tag may be omitted if the <dd> element is immediately followed by another <dd> element or a <dt> element, or if there is no more content in the parent element. ...
...tent in the parent element. permitted parents <dl> or (in whatwg html) a <div> that is inside a <dl>. previous sibling <dt> or another <dd> element. implicit aria role definition permitted aria roles no role permitted dom interface htmlelement attributes this element's attributes include the global attributes. nowrap if the value of this attribute is set to yes, the definition text will not wrap. the default value is no. example for an example, see <dl> examples. specifications specification status comment html living standardthe definition of '<dd>' in that specification. living standard html5the definition of '<dd>' in that specification. recommendation ht...
<dfn>: The Definition element - HTML: Hypertext Markup Language
Web › HTML › Element › dfn
attributes this element's attributes include the global attributes. in html5, the title attribute has special meaning, as noted below. usage notes there are some not-entirely-obvious aspects to using the <dfn> element. we examine those here. ...
... otherwise, the text content of the <dfn> element is the term being defined. this is shown in the first example below. if the <dfn> element has a title attribute, it must contain the term being defined and no other text. ...
<embed>: The Embed External Content element - HTML: Hypertext Markup Language
Web › HTML › Element › embed
tted parents any element that accepts embedded content. implicit aria role no corresponding role permitted aria roles application, document, img, none, presentation dom interface htmlembedelement attributes this element's attributes include the global attributes. height the displayed height of the resource, in css pixels. this must be an absolute value; percentages are not allowed. src the url of the resource being embedded. type the mime type to use to select the plug-in to instantiate. width the displayed width of the resource, in css pixels. this must be an absolute value; percentages are not allowed. usage notes you can use the object-position property to adjust the positioning of the embedded object within the element's frame, and...
...property to control how the object's size is adjusted to fit within the frame. examples <embed type="video/quicktime" src="movie.mov" width="640" height="480" title="title of my video"> accessibility concerns use the title attribute on an embed element to label its content so that people navigating with assistive technology such as a screen reader can understand what it contains. the title's value should concisely describe the embedded content. without a title, they may not be able to determine what its embedded content is. this context shift can be confusing and time-consuming, especially if the embed element contains interactive content like video or audio. specifications specification status comment html living standardthe definition of '<embed>' in that sp...
<li> - HTML: Hypertext Markup Language
Web › HTML › Element › li
nu> element. though not a conforming usage, the obsolete <dir> can also be a parent. implicit aria role listitem when child of an ol, ul or menu permitted aria roles menuitem, menuitemcheckbox, menuitemradio, option, none, presentation, radio, separator, tab, treeitem dom interface htmllielement attributes this element includes the global attributes. value this integer attribute indicates the current ordinal value of the list item as defined by the <ol> element. the only allowed value for this attribute is a number, even if the list is displayed with roman numerals or letters. list items that follow this one continue numbering from the value set. the value attribute has no meaning for unordered lists (<ul>) or for menus (<menu>). note: this attri...
...ppercase roman numerals 1: numbers this type overrides the one used by its parent <ol> element, if any. note: this attribute has been deprecated; use the css list-style-type property instead. examples for more detailed examples, see the <ol> and <ul> pages. ordered list <ol> <li>first item</li> <li>second item</li> <li>third item</li> </ol> ordered list with a custom value <ol type="i"> <li value="3">third item</li> <li>fourth item</li> <li>fifth item</li> </ol> unordered list <ul> <li>first item</li> <li>second item</li> <li>third item</li> </ul> specifications specification status comment html living standardthe definition of '<li>' in that specification. living standard html5the defin...
<menu> - HTML: Hypertext Markup Language
Web › HTML › Element › menu
htmlmenuelement attributes this element includes the global attributes. label the name of the menu as shown to the user. used within nested menus, to provide a label through which the submenu can be accessed. must only be specified when the parent element is a <menu> in the context menu state. type this attribute indicates the kind of menu being declared, and can be one of two values. context : indicates the popup menu state, which represents a group of commands activated through another element. this might be as a button menu referenced by a menu attribute of a <button> element, or as context menu for an element with a contextmenu attribute. this value is the default if the attribute is missing and the parent element is also a <menu> element. toolbar: indicates the ...
... usage notes the <menu> and <ul> elements both represent an unordered list of items. the key difference is that <ul> primarily contains items for display, whilst <menu> is intended for interactive items, to act on. an html menu can be used to create context menus (typically activated by right-clicking another element) or toolbars. ...
<source>: The Media or Image Source element - HTML: Hypertext Markup Language
Web › HTML › Element › source
s 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> element. src required for <audio> and <video>, address of the media resource. the value of this attribute is ignored when the <source> element is placed inside a <picture> element. srcset a list of one or more strings separated by commas indicating a set...
... the <source> element is placed inside a <picture> element. srcset a list of one or more strings separated by commas indicating a set of possible images represented by the source for the browser to use. each string is composed of: one url specifying an image. a width descriptor, which consists of a string containing a positive integer directly followed by "w", such as 300w. the default value, if missing, is the infinity. a pixel density descriptor, that is a positive floating number directly followed by "x". the default value, if missing, is 1x. each string in the list must have at least a width descriptor or a pixel density descriptor to be valid. among the list, there must be only one string containing the same tuple of width descriptor and pixel density descriptor. the brows...
<spacer> - HTML: Hypertext Markup Language
Web › HTML › Element › spacer
ithout actually using an image. however, <spacer> no longer supported by any major browser and the same effects can now be achieved using simple css. firefox, which is the descendant of netscape's browsers, removed support for <spacer> in version 4. attributes like all other html elements, this element supports the global attributes. type this attribute determines type of spacer. possible values are horizontal, vertical and block. size this attribute can be used for defining size of spacer in pixels when type is horizontal or vertical. width this attribute can be used for defining width of spacer in pixels when type is block. height this attribute can be used for defining height of spacer in pixels when type is block. align this attribute determines alignment of spacer. possible...
... are horizontal, vertical and block. size this attribute can be used for defining size of spacer in pixels when type is horizontal or vertical. width this attribute can be used for defining width of spacer in pixels when type is block. height this attribute can be used for defining height of spacer in pixels when type is block. align this attribute determines alignment of spacer. possible values are left, right and center. example <span>just a text node</span> <spacer type="horizontal" size="10"></spacer> <span>just another text node</span> <spacer type="block" width="10" height="10"></spacer> specification not part of any specification. ...
<style>: The Style Information element - HTML: Hypertext Markup Language
Web › HTML › Element › style
attributes that contain media queries, allowing you to selectively apply internal stylesheets to your document depending on media features such as viewport width. attributes this element includes the global attributes. type this attribute defines the styling language as a mime type (charset should not be specified). this attribute is optional and defaults to text/css if it is not specified; values other than the empty string or text/css are not used. note: there is very little reason to include this attribute in modern web documents. media this attribute defines which media the style should be applied to. its value is a media query, which defaults to all if the attribute is missing. nonce a cryptographic nonce (number used once) used to whitelist inline styles in a style-src content-s...
...it is critical to provide a nonce that cannot be guessed as bypassing a resource’s policy is otherwise trivial. title this attribute specifies alternative style sheet sets. ...
<title>: The Document Title element - HTML: Hypertext Markup Language
Web › HTML › Element › title
re your titles are as unique as possible within your own site. duplicate—or near-duplicate—titles can contribute to inaccurate search results. example <title>awesome interesting stuff</title> this example establishes a page whose title (as displayed at the top of the window or in the window's tab) as "awesome interesting stuff". accessibility concerns it is important to provide a title value that describes the page's purpose. a common navigation technique for users of assistive technology is to read the page title and infer the content the page contains. this is because navigating into a page to determine its content can be a time consuming and potentially confusing process. example <title>menu - blue house chinese food - foodyum: online takeout today!</title> to help the user,...
...e's purpose. a common navigation technique for users of assistive technology is to read the page title and infer the content the page contains. this is because navigating into a page to determine its content can be a time consuming and potentially confusing process. example <title>menu - blue house chinese food - foodyum: online takeout today!</title> to help the user, update the page title value to reflect significant page state changes (such as form validation problems). example <title>2 errors - your order - blue house chinese food - foodyum: online takeout today!</title> mdn understanding wcag, guideline 2.4 explanations understanding success criterion 2.4.2 | w3c understanding wcag 2.0 specifications specification status comment html living stand...
autocapitalize - HTML: Hypertext Markup Language
the autocapitalize global attribute is an enumerated attribute that controls whether and how text input is automatically capitalized as it is entered/edited by the user. the attribute must take one of the following values: off or none: no autocapitalization is applied (all letters default to lowercase) on or sentences: the first letter of each sentence defaults to a capital letter; all other letters default to lowercase words: the first letter of each word defaults to a capital letter; all other letters default to lowercase characters: all letters should default to uppercase the autocapitalize attribute doesn’t affect behavior when typing on a physical keyboard. instead, it affects the behavior of other input mechanisms, such as virtual keyboards on mobile devices and voice input. th...
...s, such as virtual keyboards on mobile devices and voice input. the behavior of such mechanisms is that they often assist users by automatically capitalizing the first letter of sentences. the autocapitalize attribute enables authors to override that behavior per-element. the autocapitalize attribute never causes autocapitalization to be enabled for an <input> element with a type attribute whose value is url, email, or password. specifications specification status comment html living standardthe definition of 'autocapitalize' in that specification. living standard ...
contenteditable - HTML: Hypertext Markup Language
attribute indicating if the element should be editable by the user. if so, the browser modifies its widget to allow editing. the source for this interactive example is stored in a github repository. if 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 a github repository. if 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 attribute must take one of the following values: true or an empty string, which indicates that the element is editable. false, which indicates that the element is not editable. if the attribute is given without a value, like <label contenteditable>example label</label>, its value is treated as an empty string. if this attribute is missing or its value is invalid, its value is inherited from its parent element: so the element is editable if its parent is editable. note that although its allowed values include true and false, this attribute is an enumerated one and not a boolean one. you can set the color used...
inputmode - HTML: Hypertext Markup Language
decimal fractional numeric input keyboard containing the digits and decimal separator for the user's locale (typically . or ,). devices may or may not show a minus key (-). ...
... decimal fractional numeric input keyboard containing the digits and decimal separator for the user's locale (typically . or ,). devices may or may not show a minus key (-). ...
lang - HTML: Hypertext Markup Language
the lang global attribute helps define the language of an element: the language that non-editable elements are written in, or the language that the editable elements should be written in by the user. the attribute contains a single “language tag” in the format defined in tags for identifying languages (bcp47). the default value of lang is unknown, therefore it is recommended to always specify this attribute with the appropriate value. ...
... language tag syntax the full bcp47 syntax is in-depth enough to mark extremely specific language dialects, but most usage is much simpler. ...
slot - HTML: Hypertext Markup Language
for examples, see our using templates and slots guide. ...
... for examples, see our using templates and slots guide. ...
spellcheck - HTML: Hypertext Markup Language
the spellcheck global attribute is an enumerated attribute defines whether the element may be checked for spelling errors. the source for this interactive example is stored in a github repository. if 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 may have the following values: true, which indicates that the element should be, if possible, checked for spelling errors; false, which indicates that the element should not be checked for spelling errors. note: the spellcheck attribute is an enumerated one and not a boolean one. this means that the explicit usage of one of the values true or false is mandatory, and that a shorthand like <textarea spellcheck></textarea> is not allowed. th...
...t the element should not be checked for spelling errors. note: the spellcheck attribute is an enumerated one and not a boolean one. this means that the explicit usage of one of the values true or false is mandatory, and that a shorthand like <textarea spellcheck></textarea> is not allowed. the correct usage is <textarea spellcheck="true"></textarea>. if this attribute is not set, its default value is element-type and browser-defined. this default value may also be inherited, which means that the element content will be checked for spelling errors only if its nearest ancestor has a spellcheck state of true. this attribute is merely a hint for the browser: browsers are not required to check for spelling errors. typically non-editable elements are not checked for spelling errors, even if the...
translate - HTML: Hypertext Markup Language
"no", which indicates that the element must not be translated. although not all browsers recognize this attribute, it is respected by automatic translation systems such as google translate, and may also be respected by tools used by human translators. ...
... "no", which indicates that the element must not be translated. although not all browsers recognize this attribute, it is respected by automatic translation systems such as google translate, and may also be respected by tools used by human translators. ...
HTML reference - HTML: Hypertext Markup Language
this html reference describes all elements and attributes of html, including global attributes that apply to all elements. html element reference this page lists all the html elements, which are created using tags. html attribute reference elements in html have attributes; these are additional values that configure the elements or adjust their behavior in various ways to meet the criteria the users want. global attributes global attributes are attributes common to all html elements; they can be used on all elements, though they may have no effect on some elements. link types in html, the following link types indicate the relationship between two documents, in which one links to the other using an <a>, <area>, or <link> element. content categories every html element is a member of o...
...ing link types indicate the relationship between two documents, in which one links to the other using an <a>, <area>, or <link> element. content categories every html element is a member of one or more content categories — these categories group elements that share common characteristics. date and time formats used in html certain html elements allow you to specify dates and/or times as the value or as the value of an attribute. these include the date and time variations of the <input> element as well as the <ins> and <del> elements. ...
Using the application cache - HTML: Hypertext Markup Language
mpt to load the requested resource. if the attempt fails, due to either a network failure or a server error of some kind, the browser loads the file example.html instead. cache states each application cache has a state, which indicates the current condition of the cache. caches that share the same manifest uri share the same cache state, which can be one of the following: uncached a special value that indicates that an application cache object is not fully initialized. idle the application cache is not currently in the process of being updated. checking the manifest is being fetched and checked for updates. downloading resources are being downloaded to be added to the cache, due to a changed resource manifest. updateready there is a new version of the application cache available. ...
... version!'); } window.applicationcache.addeventlistener('updateready', onupdateready); if(window.applicationcache.status === window.applicationcache.updateready) { onupdateready(); } to manually start testing for a new manifest file, you can use window.applicationcache.update(). gotchas never access cached files by using traditional get parameters (like other-cached-page.html?parametername=value). this will make the browser bypass the cache and attempt to get it from network. to link to cached resources that have parameters parsed in javascript use parameters in the hash part of the link, such as other-cached-page.html#whatever?parametername=value. when applications are cached, simply updating the resources (files) that are used in a web page is not enough to update the files that have ...
HTML: Hypertext Markup Language
Web › HTML
be loaded from foreign origins and used in a <canvas> element as if they were being loaded from the current origin. cors settings attributes some html elements that provide support for cors, such as <img> or <video>, have a crossorigin attribute (crossorigin property), which lets you configure the cors requests for the element's fetched data. preloading content with rel="preload" the preload value of the <link> element's rel attribute allows you to write declarative fetch requests in your html <head>, specifying resources that your pages will need very soon after loading, which you therefore want to start preloading early in the lifecycle of a page load, before the browser's main rendering machinery kicks in. this ensures that they are made available earlier and are less likely to block th...
...formance improvements. this article provides a basic guide to how preload works. references html reference html consists of elements, each of which may be modified by some number of attributes. html documents are connected to each other with links. html element reference browse a list of all html elements. html attribute reference elements in html have attributes. these are additional values that configure the elements or adjust their behavior in various ways. global attributes global attributes may be specified on all html elements, even those not specified in the standard. this means that any non-standard elements must still permit these attributes, even though those elements make the document html5-noncompliant. inline elements and block-level elements html elements are usual...
Identifying resources on the Web - HTTP
//developer.mozilla.org https://developer.mozilla.org/docs/learn/ https://developer.mozilla.org/search?q=url any of those urls can be typed into your browser's address bar to tell it to load the associated page (resource). a url is composed of different parts, some mandatory and others are optional. a more complex example might look like this: http://www.example.com:80/path/to/myfile.html?key1=value1&key2=value2#somewhereinthedocument urns a uniform resource name (urn) is a uri that identifies a resource by name in a particular namespace. urn:isbn:9780141036144 urn:ietf:rfc:7230 the two urns correspond to the book nineteen eighty-four by george orwell, the ietf specification 7230, hypertext transfer protocol (http/1.1): message syntax and routing. syntax of uniform resource identi...
...http protocol (80 for http and 443 for https) to grant access to its resources. otherwise it is mandatory. path /path/to/myfile.html is the path to the resource on the web server. in the early days of the web, a path like this represented a physical file location on the web server. nowadays, it is mostly an abstraction handled by web servers without any physical reality. query ?key1=value1&key2=value2 are extra parameters provided to the web server. those parameters are a list of key/value pairs separated with the & symbol. the web server can use those parameters to do extra stuff before returning the resource to the user. each web server has its own rules regarding parameters, and the only reliable way to know how a specific web server is handling parameters is by asking the web ...
Resource URLs - HTTP
age could run internal scripts and inspect internal resources of firefox, including the default preferences, which could be a serious security and privacy issue. for example, a script on browserleaks highlights what firefox reveals when queried by a simple script running on the site (you can find the code in https://browserleaks.com/firefox#more). ...
... solution in order to fix this problem, mozilla changed the behavior of loading resource: uris in bug 863246, which landed in firefox 57 (quantum). ...
Reason: expected ‘true’ in CORS header ‘Access-Control-Allow-Credentials’ - HTTP
reason reason: expected ‘true’ in cors header ‘access-control-allow-credentials’ what went wrong? the cors request requires that the server permit the use of credentials, but the server's access-control-allow-credentials header's value isn't set to true to enable their use. to fix this problem on the client side, revise the code to not request the use of credentials. if the request is being issued using xmlhttprequest, make sure you're not setting withcredentials to true. if using server-sent events, make sure eventsource.withcredentials is false (it's the default value). if using the fetch api, make sure request.credentials is "omit". to eliminate this error by changing the server's configuration, adjust the server's configuration to set the access-control-allow-credentials...
...d using xmlhttprequest, make sure you're not setting withcredentials to true. if using server-sent events, make sure eventsource.withcredentials is false (it's the default value). if using the fetch api, make sure request.credentials is "omit". to eliminate this error by changing the server's configuration, adjust the server's configuration to set the access-control-allow-credentials header's value to true. ...
Reason: CORS header 'Access-Control-Allow-Origin' missing - HTTP
at went wrong? the response to the cors request is missing the required access-control-allow-origin header, which is used to determine whether or not the resource can be accessed by content operating within the current origin. if the server is under your control, add the origin of the requesting site to the set of domains permitted access by adding it to the access-control-allow-origin header's value. for example, to allow a site at https://amazing.site to access the resource using cors, the header should be: access-control-allow-origin: https://amazing.site you can also configure a site to allow any site to access it by using the * wildcard. you should only use this for public apis. private apis should never use *, and should instead have a specific domain or domains set. in addition, the...
...card only works for requests made with the crossorigin attribute set to anonymous, and it prevents sending credentials like cookies in requests. access-control-allow-origin: * warning: using the wildcard to allow all sites to access a private api is a bad idea. to allow any site to make cors requests without using the * wildcard (for example, to enable credentials), your server must read the value of the request's origin header and use that value to set access-control-allow-origin, and must also set a vary: origin header to indicate that some headers are being set dynamically depending on the origin. the exact directive for setting headers depends on your web server. in apache, add a line such as the following to the server's configuration (within the appropriate <directory>, <location>, ...
Reason: Credential is not supported if the CORS header ‘Access-Control-Allow-Origin’ is ‘*’ - HTTP
reason reason: credential is not supported if the cors header ‘access-control-allow-origin’ is ‘*’ what went wrong? the cors request was attempted with the credentials flag set, but the server is configured using the wildcard ("*") as the value of access-control-allow-origin, which doesn't allow the use of credentials. to correct this problem on the client side, simply ensure that the credentials flag's value is false when issuing your cors request. if the request is being issued using xmlhttprequest, make sure you're not setting withcredentials to true. if using server-sent events, make sure eventsource.withcredentials is false (it's the default value). if using the fetch api, make sure request.credentials is "omit". if, instead, you need to adjust the server's behavior, yo...
...false when issuing your cors request. if the request is being issued using xmlhttprequest, make sure you're not setting withcredentials to true. if using server-sent events, make sure eventsource.withcredentials is false (it's the default value). if using the fetch api, make sure request.credentials is "omit". if, instead, you need to adjust the server's behavior, you'll need to change the value of access-control-allow-origin to grant access to the origin from which the client is loaded. ...
Configuring servers for Ogg media - HTTP
he 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 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 alternati...
...ht: 360 vorbis: serialno 0708996688 4531 packets in 167 pages, 27.1 packets/page, 1.408% ogg overhead audio-samplerate: 44100 hz audio-channels: 2 note that you can't simply serve up the reported content-duration line reported by oggz-info, because it's reported in hh:mm:ss format. you'll need to convert it to seconds only, then serve that as your x-content-duration value. just parse out the hh, mm, and ss into numbers, then do (hh*3600)+(mm*60)+ss to get the value you should report. it's important to note that it appears that oggz-info makes a read pass of the media in order to calculate its duration, so it's a good idea to store the duration value in order to avoid lengthy delays while the value is calculated for every http request of your ogg media. ...
Connection management in HTTP/1.x - HTTP
t in http applies to the connection between two consecutive nodes, which is hop-by-hop and not end-to-end. the model used in connections between a client and its first proxy may differ from the model between a proxy and the destination server (or any intermediate proxies). the http headers involved in defining the connection model, like connection and keep-alive, are hop-by-hop headers with their values able to be changed by intermediary nodes. a related topic is the concept of http connection upgrades, wherein an http/1.1 connection is upgraded to a different protocol, such as tls/1.0, websocket, or even http/2 in cleartext. this protocol upgrade mechanism is documented in more detail elsewhere. short-lived connections the original model of http, and the default one in http/1.0, is short-li...
...ke itself is time-consuming, but a tcp connection adapts to its load, becoming more efficient with more sustained (or warm) connections. short-lived connections do not make use of this efficiency feature of tcp, and performance degrades from optimum by persisting to transmit over a new, cold connection. this model is the default model used in http/1.0 (if there is no connection header, or if its value is set to close). in http/1.1, this model is only used when the connection header is sent with a value of close. unless dealing with a very old system, which doesn't support a persistent connection, there is no compelling reason to use this model. persistent connections short-lived connections have two major hitches: the time taken to establish a new connection is significant, and performanc...
Accept-Charset - HTTP
the accept-charset request http header advertises which character encodings the client understands. using content negotiation, the server selects one of the encodings, uses it, and informs the client of its choice within the content-type response header, usually in a charset= parameter. browsers usually don't send this header, as the default value for each resource is usually correct and transmitting it would allow fingerprinting. if the server cannot serve any character encoding from this request header, it can theoretically send back a 406 not acceptable error code. but for a better user experience, this is rarely done and the accept-charset header is ignored. in early versions of http/1.1, a default character encoding was defined: iso-8859-1. this is no longer recommended, and now each c...
...referred character encoding. to guarantee better privacy through less configuration-based entropy, all browsers omit the accept-charset header: internet explorer 8+, safari 5+, opera 11+, firefox 10+ and chrome 27+ no longer send it. header type request header forbidden header name yes syntax accept-charset: <charset> // multiple types, weighted with the quality value syntax: accept-charset: utf-8, iso-8859-1;q=0.5 directives <charset> a character encoding name, like utf-8 or iso-8859-15. * any charset not mentioned elsewhere in the header; * is used as a wildcard. ;q=<weight> any encoding is placed in an order of preference, expressed using a relative quality value called the weight. examples accept-charset: iso-8859-1 accept-charset: utf-8, iso-...
Access-Control-Allow-Credentials - HTTP
the access-control-allow-credentials response header tells browsers whether to expose the response to frontend javascript code when the request's credentials mode (request.credentials) is include. when a request's credentials mode (request.credentials) is include, browsers will only expose the response to frontend javascript code if the access-control-allow-credentials value is true. credentials are cookies, authorization headers or tls client certificates. when used as part of a response to a preflight request, this indicates whether or not the actual request can be made using credentials. note that simple get requests are not preflighted, and so if a request is made for a resource with credentials, if this header is not returned with the resource, the response is ignored by the browser an...
...script code, both the server (using the access-control-allow-credentials header) and the client (by setting the credentials mode for the xhr, fetch, or ajax request) must indicate that they’re opting in to including credentials. header type response header forbidden header name no syntax access-control-allow-credentials: true directives true the only valid value for this header is true (case-sensitive). if you don't need credentials, omit this header entirely (rather than setting its value to false). examples allow credentials: access-control-allow-credentials: true using xhr with credentials: var xhr = new xmlhttprequest(); xhr.open('get', 'http://example.com/', true); xhr.withcredentials = true; xhr.send(null); using fetch with credentials: fet...
Access-Control-Expose-Headers - HTTP
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 exposed. * (wildcard) the value "*" only counts as a special wildcard value for requests without credentials (requests without http cookies or http authentication information). in requests with credentials, it is treated as the literal header name "*" without special semantics. note that the authorization header can't be wildcarded and always needs to be listed explicitly. examples to expose a non-cors-safelisted request he...
... needs to be listed explicitly. examples to expose a non-cors-safelisted request header, you can specify: access-control-expose-headers: content-length to additionally expose a custom header, like x-kuma-revision, you can specify multiple headers separated by a comma: access-control-expose-headers: content-length, x-kuma-revision in requests without credentials, you can also use a wildcard value: access-control-expose-headers: * however, this won't wildcard the authorization header, so if you need to expose that, you will need to list it explicitly: access-control-expose-headers: *, authorization specifications specification status comment fetchthe definition of 'access-control-expose-headers' in that specification. living standard ...
Cache-Control - HTTP
tore prevents. expiration max-age=<seconds> the maximum amount of time a resource is considered fresh. unlike expires, this directive is relative to the time of the request. s-maxage=<seconds> overrides max-age or the expires header, but only for shared caches (e.g., proxies). ignored by private caches. max-stale[=<seconds>] indicates the client will accept a stale response. ...
...e response. an optional value in seconds indicates the upper limit of staleness the client will accept. min-fresh=<seconds> indicates the client wants a response that will still be fresh for at least the specified number of seconds. stale-while-revalidate=<seconds> indicates the client will accept a stale response, while asynchronously checking in the background for a fresh one. the seconds value indicates how long the client will accept a stale response. see "keeping things fresh with stale-while-revalidate" for more information. stale-if-error=<seconds> indicates the client will accept a stale response if the check for a fresh one fails. the seconds value indicates how long the client will accept the stale response after the initial expiration. revalidation and reloading must-r...
Content-Encoding - HTTP
it lets the client know how to decode in order to obtain the media-type referenced by the content-type header. the recommendation is to compress data as much as possible and therefore to use this field, but some types of resources, such as jpeg images, are already compressed. sometimes, using additional compression doesn't reduce payload size and can even make the payload longer. ...
...entity content-encoding: deflate, gzip directives gzip a format using the lempel-ziv coding (lz77), with a 32-bit crc. this is the original format of the unix gzip program. the http/1.1 standard also recommends that the servers supporting this content-encoding should recognize x-gzip as an alias, for compatibility purposes. compress a format using the lempel-ziv-welch (lzw) algorithm. the value name was taken from the unix compress program, which implemented this algorithm. like the compress program, which has disappeared from most unix distributions, this content-encoding is not used by many browsers today, partly because of a patent issue (it expired in 2003). deflate using the zlib structure (defined in rfc 1950) with the deflate compression algorithm (defined in rfc 1951). identi...
CSP: child-src - HTTP
lements or javascript: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be...
...the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
CSP: font-src - HTTP
lements or javascript: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be...
...the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
CSP: frame-src - HTTP
lements or javascript: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be...
...the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
CSP: manifest-src - HTTP
lements or javascript: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be...
...the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
CSP: media-src - HTTP
lements or javascript: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be...
...the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
CSP: object-src - HTTP
lements or javascript: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be...
...the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
CSP: trusted-types - HTTP
this directive declares a white-list of trusted type policy names created with trustedtypes.createpolicy from trusted types api. ...
...this directive declares a white-list of trusted type policy names created with trustedtypes.createpolicy from trusted types api. ...
CSP: worker-src - HTTP
lements or javascript: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be...
...the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
Content-Security-Policy - HTTP
fying server origins and script endpoints. this helps guard against cross-site scripting attacks (xss). for more information, see the introductory article on content security policy (csp). header type response header forbidden header name no syntax content-security-policy: <policy-directive>; <policy-directive> where <policy-directive> consists of: <directive> <value> with no internal punctuation. directives fetch directives fetch directives control the locations from which certain resource types may be loaded. child-src defines the valid sources for web workers and nested browsing contexts loaded using elements such as <frame> and <iframe>. instead of child-src, if you want to regulate nested browsing contexts and workers, you should use the fra...
... from a page. use the referrer-policy header instead. require-sri-for requires the use of sri for scripts or styles on the page. require-trusted-types-for enforces trusted types at the dom xss injection sinks. trusted-types used to specify an allow-list of trusted types policies. trusted types allows applications to lock down dom xss injection sinks to only accept non-spoofable, typed values in place of strings. upgrade-insecure-requests instructs user agents to treat all of a site's insecure urls (those served over http) as though they have been replaced with secure urls (those served over https). this directive is intended for web sites with large numbers of insecure legacy urls that need to be rewritten. csp in workers workers are in general not governed by the content se...
Cross-Origin-Embedder-Policy - HTTP
the http cross-origin-embedder-policy (coep) response header prevents a document from loading any cross-origin resources that don't explicitly grant the document permission (using corp or cors). header type response header forbidden header name no syntax cross-origin-embedder-policy: unsafe-none | require-corp directives unsafe-none this is the default value. allows the document to fetch cross-origin resources without giving explicit permission through the cors protocol or the cross-origin-resource-policy header. require-corp a document can only load resources from the same origin, or resources explicitly marked as loadable from another origin. if a cross origin resource supports cors, the crossorigin attribute or the cross-origin-resource-policy heade...
...her origin. if a cross origin resource supports cors, the crossorigin attribute or the cross-origin-resource-policy header must be used to load it without being blocked by coep. examples certain features depend on cross-origin isolation you can only access certain features like sharedarraybuffer objects or performance.now() with unthrottled timers, if your document has a coep header with the value require-corp value set. cross-origin-embedder-policy: require-corp cross-origin-opener-policy: same-origin see also the cross-origin-opener-policy header which you'll need to set as well. to check if cross origin isolation has been successful, you can test against the crossoriginisolated property available to window and worker contexts: if (crossoriginisolated) { // post sharedarraybuffer ...
Cross-Origin-Opener-Policy - HTTP
dow.opener property of the new window will be null. this allows you to have more control over references to a window than rel=noopener, which only affects outgoing navigations. header type response header forbidden header name no syntax cross-origin-opener-policy: unsafe-none | same-origin-allow-popups | same-origin directives unsafe-none this is the default value. allows the document to be added to its opener's browsing context group unless the opener itself has a coop of same-origin or same-origin-allow-popups. same-origin-allow-popups retains references to newly opened windows or tabs which either don't set coop or which opt out of isolation by setting a coop of unsafe-none. same-origin isolates the browsing context exclusively to same-origin docume...
...setting a coop of unsafe-none. same-origin isolates the browsing context exclusively to same-origin documents. cross-origin documents are not loaded in the same browsing context. examples certain features depend on cross-origin isolation certain features like sharedarraybuffer objects or performance.now() with unthrottled timers are only available if your document has a coop header with the value same-origin value set. cross-origin-opener-policy: same-origin cross-origin-embedder-policy: require-corp see also the cross-origin-embedder-policy header which you'll need to set as well. to check if cross-origin isolation has been successful, you can test against the crossoriginisolated property available to window and worker contexts: if (crossoriginisolated) { // post sharedarraybuffer...
Digest - HTTP
Web › HTTP › Headers › Digest
the digest response http header provides a digest of the requested resource. in rfc 7231 terms this is the selected representation of a resource. the selected representation depends on the content-type and content-encoding header values: so a single resource may have multiple different digest values. the digest is calculated over the entire representation. ...
...entation. the representation itself may be: fully contained in the response message body not at all contained in the message body (for example, in a response to a head request) partially contained in the message body (for example, in a response to a range request). header type response header forbidden header name no syntax digest: <digest-algorithm>=<digest-value> digest: <digest-algorithm>=<digest-value>,<digest-algorithm>=<digest-value> directives <digest-algorithm> supported digest algorithms are defined in rfc 3230 and rfc 5843, and include sha-256 and sha-512. some of the supported algorithms, including unixsum and md5 are subject to collisions and are thus not suitable for applications in which collision-resistance is important. <digest-valu...
Feature-Policy: display-capture - HTTP
ols whether or not the document is permitted to use screen capture api, i.e.,getdisplaymedia() to capture the screen's contents. if display-capture is disabled in a document, the document will not be able to initiate screen capture via getdisplaymedia(). syntax feature-policy: display-capture <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
Feature-Policy: encrypted-media - HTTP
ader encrypted-media directive controls whether the current document is allowed to use the encrypted media extensions api (eme). when this policy is enabled, the promise returned by navigator.requestmediakeysystemaccess() will reject with a domexception. syntax feature-policy: encrypted-media <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
Feature-Policy: midi - HTTP
the http feature-policy header midi directive controls whether the current document is allowed to use the web midi api. when this policy is enabled, the promise returned by navigator.requestmidiaccess() will reject with a domexception. syntax feature-policy: midi <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
Feature-Policy: picture-in-picture - HTTP
the http feature-policy header picture-in-picture directive controls whether the current document is allowed to play a video in a picture-in-picture mode via the corresponding api. syntax feature-policy: picture-in-picture <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'non...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
Feature-Policy: publickey-credentials-get - HTTP
cument is allowed to access web authentcation api to create new public-key credentials, i.e, via navigator.credentials.get({publickey: ..., ...}). when this policy is enabled, any attempt to query public key credentials will result in an error. syntax feature-policy: publickey-credentials-get <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
Feature-Policy: screen-wake-lock - HTTP
cy header screen-wake-lock directive controls whether the current document is allowed to use screen wake lock api to indicate that device should not dim or turn off the screen. note: in earlier specification drafts this directive was called wake-lock. syntax feature-policy: screen-wake-lock <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
Feature-Policy: sync-xhr - HTTP
the http feature-policy header sync-xhr directive controls whether the current document is allowed to make synchronous xmlhttprequest requests. syntax feature-policy: sync-xhr <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and ne...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
Feature-Policy: wake-lock - HTTP
e http feature-policy header wake-lock directive controls whether the current document is allowed to use wake lock api to indicate that device should not enter power-saving mode. note: latest drafts of screen wake lock api defines screen-wake-lock directive. syntax feature-policy: wake-lock <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
Feature-Policy: xr-spatial-tracking - HTTP
navigator.xr.requestsession() can return xrsession that requires spatial tracking and whether user agent can indicate support for sessions supporting spatial tracking via navigator.xr.issessionsupported() and devicechange event on navigator.xr object. syntax feature-policy: xr-spatial-tracking <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
Feature-Policy - HTTP
n, see the main feature policy article. header type response header forbidden header name yes syntax feature-policy: <directive> <allowlist> <directive> the feature policy directive to apply the allowlist to. see directives below for a list of the permitted directive names. <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes...
...an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsi...
If-Match - HTTP
Web › HTTP › Headers › If-Match
prevent the lost update problem. it can check if the modification of a resource that the user wants to upload will not override another change that has been done since the original resource was fetched. if the request cannot be fulfilled, the 412 (precondition failed) response is returned. header type request header forbidden header name no syntax if-match: <etag_value> if-match: <etag_value>, <etag_value>, … directives <etag_value> entity tags uniquely representing the requested resources. they are a string of ascii characters placed between double quotes (like "675af34563dc-tr34"). they may be prefixed by w/ to indicate that they are "weak", i.e. that they represent the resource semantically, but not byte-for-byte. however, in an if-match header, weak...
...etag_value> entity tags uniquely representing the requested resources. they are a string of ascii characters placed between double quotes (like "675af34563dc-tr34"). they may be prefixed by w/ to indicate that they are "weak", i.e. that they represent the resource semantically, but not byte-for-byte. however, in an if-match header, weak entity tags will never match. * the asterisk is a special value representing any resource. examples if-match: "bfc13a64729c4290ef5b2c2730249c88ca92d82d" if-match: "67ab43", "54ed21", "7892dd" if-match: * specifications specification title rfc 7232, section 3.1: if-match hypertext transfer protocol (http/1.1): conditional requests ...
Keep-Alive - HTTP
e prohibited in http/2. chrome and firefox ignore them in http/2 responses, but safari conforms to the http/2 spec requirements and won’t load any response which contains them. header type general header forbidden header name yes syntax keep-alive: parameters directives parameters a comma-separated list of parameters, each consisting of an identifier and a value separated by the equal sign ('='). the following identifiers are possible: timeout: indicating the minimum amount of time an idle connection has to be kept opened (in seconds). note that timeouts longer than the tcp timeout may be ignored if no keep-alive tcp message is set at the transport level. max: indicating the maximum number of requests that can be sent on this connection before clos...
... sign ('='). the following identifiers are possible: timeout: indicating the minimum amount of time an idle connection has to be kept opened (in seconds). note that timeouts longer than the tcp timeout may be ignored if no keep-alive tcp message is set at the transport level. max: indicating the maximum number of requests that can be sent on this connection before closing it. unless 0, this value is ignored for non-pipelined connections as another request will be sent in the next response. an http pipeline can use it to limit the pipelining. examples a response containing a keep-alive header: http/1.1 200 ok connection: keep-alive content-encoding: gzip content-type: text/html; charset=utf-8 date: thu, 11 aug 2016 15:23:13 gmt keep-alive: timeout=5, max=1000 last-modified: mon, 25...
Link - HTTP
Web › HTTP › Headers › Link
parameters the link header contains parameters, which are separated with ; and are equivalent to attributes of the <link> element. ...
... parameters the link header contains parameters, which are separated with ; and are equivalent to attributes of the <link> element. ...
SameSite cookies - HTTP
the samesite attribute of the set-cookie http response header allows you to declare if your cookie should be restricted to a first-party or same-site context. values the samesite attribute accepts three values: lax cookies are allowed to be sent with top-level navigations and will be sent along with get request initiated by third party website. this is the default value in modern browsers. strict cookies will only be sent in a first-party context and not be sent along with requests initiated by third party websites. none cookies will be sent in all contexts, i.e sending cross-origin is allowed. none used to be the default value, but recent browser versions made lax the default value to have reasonably robust defense against some classes of cross-site request forgery (csrf) attacks. ...
...x recent versions of modern browsers provide a more secure default for samesite to your cookies and so the following message might appear in your console: some cookies are misusing the “samesite“ attribute, so it won’t work as expected. cookie “mycookie” has “samesite” policy set to “lax” because it is missing a “samesite” attribute, and “samesite=lax” is the default value for this attribute. the warning appears because the samesite policy for a cookie has not specified explicitly: set-cookie: flavor=choco while you could rely on modern browsers to apply samesite=lax automatically, you should rather specify it explicitly to clearly communicate your intent which samesite policy applies to your cookie. this will also improve the experience across browsers as not ...
HTTP Messages - HTTP
Web › HTTP › Messages
imple asterisk ('*') is used with options, representing the server as a whole. options * http/1.1 the http version, which defines the structure of the remaining message, acting as an indicator of the expected version to use for the response. headers http headers from a request follow the same basic structure of an http header: a case-insensitive string followed by a colon (':') and a value whose structure depends upon the header. the whole header, including the value, consist of one single line, which 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), b...
...r failure of the request. common status codes are 200, 404, or 302 a status text. a brief, purely informational, textual description of the status code to help a human understand the http message. a typical status line looks like: http/1.1 404 not found. headers http headers for responses follow the same structure as any other header: a case-insensitive string followed by a colon (':') and a value whose structure depends upon the type of the header. the whole header, including its value, presents as a single line. there are numerous response headers available. these can be divided into several groups: general headers, like via, apply to the whole message. response headers, like vary and accept-ranges, give additional information about the server which doesn't fit in the status line. ...
Network Error Logging - HTTP
nds (in a similar way to e.g. hsts policies are time-restricted). the referenced reporting group should have a lifetime at least as long as the nel policy. include_subdomains if true, the policy applies to all subdomains under the origin that the policy header is set. the reporting group should also be set to include subdomains, if this option is to be enabled. success_fraction floating point value between 0 and 1 which specifies the proportion of successful network requests to report. defaults to 0, so that no successful network requests will be reported if the key is not present in the json payload. failure_fraction floating point value between 0 and 1 which specifies the proportion of failed network requests to report. defaults to 1, so that all failed network requests will be reported...
... dns.failed request to the dns server failed due to reasons not covered by previous errors (e.g. servfail) dns.address_changed for security re...
HTTP Public Key Pinning (HPKP) - HTTP
ng the ca certificate is recommended. apache adding a line similar to the following to your webserver's config will enable hpkp on your apache. this requires mod_headers enabled. header always set public-key-pins "pin-sha256=\"base64+primary==\"; pin-sha256=\"base64+backup==\"; max-age=5184000; includesubdomains" nginx adding the following line and inserting the appropriate pin-sha256="..." values will enable hpkp on your nginx. this requires the ngx_http_headers_module. add_header public-key-pins 'pin-sha256="base64+primary=="; pin-sha256="base64+backup=="; max-age=5184000; includesubdomains' always; lighttpd the following line with your relevant key information (pin-sha256="..." fields) will enable hpkp on lighttpd. setenv.add-response-header = ( "public-key-pins" => "pin-sha256=\"...
...=\"base64+backup==\"; max-age=5184000; includesubdomains") note: this requires the mod_setenv server.module loaded which can be included by the following if not already loaded. server.modules += ( "mod_setenv" ) iis add the following line to the web.config file to send the public-key-pins header: <system.webserver> ... <httpprotocol> <customheaders> <add name="public-key-pins" value="pin-sha256=&quot;base64+primary==&quot;; pin-sha256=&quot;base64+backup==&quot;; max-age=5184000; includesubdomains" /> </customheaders> </httpprotocol> ... </system.webserver> specifications specification title rfc 7469, section 2.1: public-key-pins public key pinning extension for http ...
Concurrency model and the event loop - JavaScript
message into several messages. adding messages in web browsers, messages are added anytime an event occurs and there is an event listener attached to it. if there is no listener, the event is lost. so a click on an element with a click event handler will add a message—likewise with any other event. the function settimeout is called with 2 arguments: a message to add to the queue, and a time value (optional; defaults to 0). the time value represents the (minimum) delay after which the message will actually be pushed into the queue. if there is no other message in the queue, and the stack is empty, the message is processed right after the delay. however, if there are messages, the settimeout message will have to wait for other messages to be processed. for this reason, the second argument i...
...red for the runtime to process the request (not a guaranteed time). basically, the settimeout needs to wait for all the code for queued messages to complete even though you specified a particular time limit for your settimeout. ...
JavaScript modules - JavaScript
vironment already, or if you aren't but you know what you are doing and have access (i.e. you can configure your server to set the correct content-type for .mjs files). it could however cause confusion if you don't control the server you are serving files from, or are publishing files for public use, as we are here. for learning and portability purposes, we decided to keep to .js. if you really value the clarity of using .mjs for modules versus using .js for "normal" javascript files, but don't want to run into the problem described above, you could always use .mjs during development and convert them to .js during your build step. it is also worth noting that: some tools may never support .mjs, such as typescript. the <script type="module"> attribute is used to denote when a module is be...
...ortarea(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 cannot modify the binding unlike const. applying the module to your html now we just need to apply the main.js module to our html page. this is very similar to how we apply a regular script to a page, with a few notable differences. first of all, you need to include type="module" in the <script> element, to declare this script as a module. to import the main.js script, we use this...
RangeError: radix must be an integer - JavaScript
ed and is not between 2 and 36. message rangeerror: invalid argument (edge) rangeerror: radix must be an integer at least 2 and no greater than 36 (firefox) rangeerror: tostring() radix argument must be between 2 and 36 (chrome) error type rangeerror what went wrong? the optional radix parameter of the number.prototype.tostring() or the bigint.prototype.tostring() method was specified. ...
...o greater than 36 (firefox) rangeerror: tostring() radix argument must be between 2 and 36 (chrome) error type rangeerror what went wrong? the optional radix parameter of the number.prototype.tostring() or the bigint.prototype.tostring() method was specified. its value must be an integer (a number) between 2 and 36, specifying the base of the number system to be used for representing numeric values. for example, the decimal (base 10) number 169 is represented in hexadecimal (base 16) as a9. why is this parameter's value limited to 36? a radix that is larger than 10 uses alphabetical characters as digits; therefore, the radix can't be larger than 36, since the latin alphabet (used by english and many other languages) only has 26 characters. the most common radixes: 2 for binary numbers...
TypeError: can't access property "x" of "y" - JavaScript
the javascript exception "can't access property" occurs when property access was operated on undefined or null values. message typeerror: unable to get property {x} of undefined or null reference (edge) typeerror: can't access property {x} of {y} (firefox) typeerror: {y} is undefined, can't access property {x} of it (firefox) typeerror: {y} is null, can't access property {x} of it (firefox) examples: typeerror: x is undefined, can't access property "prop" of it typeerror: x is null, can't access property "prop" of it typeerror: can't access property "prop" of undefined typeerror: can't access property "prop" of null error type typeerror. what went wrong? the property access was operated on undefined or null value. examples invalid cases // undefined and null cases on which the subst...
...erated on undefined or null value. examples invalid cases // undefined and null cases on which the substring method won't work var foo = undefined; foo.substring(1); // typeerror: x is undefined, can't access property "substring" of it var foo = null; foo.substring(1); // typeerror: x is null, can't access property "substring" of it fixing the issue to fix null pointer to undefined or null values, you can use the typeof operator, for example. if (typeof foo !== 'undefined') { // now we know that foo is defined, we are good to go. } ...
SyntaxError: JSON.parse: bad parsing - JavaScript
cted syntaxerror: json.parse: expected ',' or ']' after array element syntaxerror: json.parse: end of data when property name was expected syntaxerror: json.parse: expected double-quoted property name syntaxerror: json.parse: end of data after property name when ':' was expected syntaxerror: json.parse: expected ':' after property name in object syntaxerror: json.parse: end of data after property value in object syntaxerror: json.parse: expected ',' or '}' after property value in object syntaxerror: json.parse: expected ',' or '}' after property-value pair in object literal syntaxerror: json.parse: property names must be double-quoted strings syntaxerror: json.parse: expected property name or '}' syntaxerror: json.parse: unexpected character syntaxerror: json.parse: unexpected non-whitespace ch...
...'. json.parse("{'foo': 1}"); // syntaxerror: json.parse: expected property name or '}' // at line 1 column 2 of the json data instead write "foo": json.parse('{"foo": 1}'); leading zeros and decimal points you cannot use leading zeros, like 01, and decimal points must be followed by at least one digit. ...
TypeError: "x" is not a non-null object - JavaScript
the javascript exception "is not a non-null object" occurs when an object is expected somewhere and wasn't provided. null is not an object and won't work. message typeerror: invalid descriptor for property {x} (edge) typeerror: "x" is not a non-null object (firefox) typeerror: property description must be an object: "x" (chrome) typeerror: invalid value used in weak set (chrome) error type typeerror what went wrong? an object is expected somewhere and wasn't provided. null is not an object and won't work. you must provide a proper object in the given situation. examples property descriptor expected when methods like object.create() or object.defineproperty() and object.defineproperties() are used, the optional descriptor parameter expects a property descriptor object. providing no ob...
...used, the optional descriptor parameter expects a property descriptor object. providing no object (like just a number), will throw an error: object.defineproperty({}, 'key', 1); // typeerror: 1 is not a non-null object object.defineproperty({}, 'key', null); // typeerror: null is not a non-null object a valid property descriptor object might look like this: object.defineproperty({}, 'key', { value: 'foo', writable: false }); weakmap and weakset objects require object keys weakmap and weakset objects store object keys. you can't use other types as keys. var ws = new weakset(); ws.add('foo'); // typeerror: "foo" is not a non-null object use objects instead: ws.add({foo: 'bar'}); ws.add(window); ...
InternalError: too much recursion - JavaScript
ursion in this case). when there are too many function calls, or a function is missing a base case, javascript will throw this error. examples this recursive function runs 10 times, as per the exit condition. function loop(x) { if (x >= 10) // "x >= 10" is the exit condition return; // do stuff loop(x + 1); // the recursive call } loop(0); setting this condition to an extremely high value, won't work: function loop(x) { if (x >= 1000000000000) return; // do stuff loop(x + 1); } loop(0); // internalerror: too much recursion this recursive function is missing a base case. as there is no exit condition, the function will call itself infinitely. function loop(x) { // the base case is missing loop(x + 1); // recursive call } loop(0); // internalerror: too much recursi...
...on, the function will call itself infinitely. function loop(x) { // the base case is missing loop(x + 1); // recursive call } loop(0); // internalerror: too much recursion class error: too much recursion class person{ constructor(){} set name(name){ this.name = name; // recursive call } } const tony = new person(); tony.name = "tonisha"; // internalerror: too much recursion when a value is assigned to the property name (this.name = name;) javascript needs to set that property. when this happens, the setter function is triggered. set name(name){ this.name = name; // recursive call } in this example when the setter is triggered, it is told to do the same thing again: to set the same property that it is meant to handle. this causes the function to call itself, again and again,...
ReferenceError: assignment to undeclared variable "x" - JavaScript
in other words, there was an assignment without the var keyword. there are some differences between declared and undeclared variables, which might lead to unexpected results and that's why javascript presents an error in strict mode. ...
...in other words, there was an assignment without the var keyword. there are some differences between declared and undeclared variables, which might lead to unexpected results and that's why javascript presents an error in strict mode. ...
JavaScript error reference - JavaScript
error: test for equality (==) mistyped as assignment (=)?syntaxerror: unterminated string literaltypeerror: "x" has no propertiestypeerror: "x" is (not) "y"typeerror: "x" is not a constructortypeerror: "x" is not a functiontypeerror: "x" is not a non-null objecttypeerror: "x" is read-onlytypeerror: 'x' is not iterabletypeerror: more arguments neededtypeerror: reduce of empty array with no initial valuetypeerror: x.prototype.y called on incompatible typetypeerror: can't access dead objecttypeerror: can't access property "x" of "y"typeerror: can't assign to property "x" on "y": not an objecttypeerror: can't define property "x": "obj" is not extensibletypeerror: can't delete non-configurable array elementtypeerror: can't redefine non-configurable property "x"typeerror: cannot use "in" operator to ...
...e typetypeerror: can't access dead objecttypeerror: can't access property "x" of "y"typeerror: can't assign to property "x" on "y": not an objecttypeerror: can't define property "x": "obj" is not extensibletypeerror: can't delete non-configurable array elementtypeerror: can't redefine non-configurable property "x"typeerror: cannot use "in" operator to search for "x" in "y"typeerror: cyclic object valuetypeerror: invalid "instanceof" operand "x"typeerror: invalid array.prototype.sort argumenttypeerror: invalid argumentstypeerror: invalid assignment to const "x"typeerror: property "x" is non-configurable and can't be deletedtypeerror: setting getter-only property "x"typeerror: variable "x" redeclares argumenturierror: malformed uri sequencewarning: 08/09 is not a legal ecma-262 octal constantwarn...
arguments.callee - JavaScript
for example: [1, 2, 3, 4, 5].map(function factorial(n) { ...
... e) { return a ? b * c : d * e; } if the javascript interpreter cannot guarantee that all the provided arguments are numbers at the point that the call is made, it needs to either insert checks for all the arguments before the inlined code, or it cannot inline the function. now in this particular case a smart interpreter should be able to rearrange the checks to be more optimal and not check any values that would not be used. however in many cases that's just not possible and therefore it becomes impossible to inline. examples using arguments.callee in an anonymous recursive function a recursive function must be able to refer to itself. typically, a function refers to itself by its name. however, an anonymous function (which can be created by a function expression or the function constructo...
Array.prototype[@@unscopables] - JavaScript
the @@unscopable symbol property contains property names that were not included in the ecmascript standard prior to the es2015 version. these properties are excluded from with statement bindings. description the default array properties that are excluded from with bindings are: copywithin() entries() fill() find() findindex() includes() keys() values() see symbol.unscopables for how to set unscopables for your own objects. property attributes of array.prototype[@@unscopables] writable no enumerable no configurable yes examples use in with environments the following code works fine in es5 and below. however, in ecmascript 2015 and later, the array.prototype.keys() method was introdu...
.... this is where now the built-in @@unscopables array.prototype[@@unscopables] symbol property comes into play and prevents that some of the array methods are being scoped into the with statement. var keys = []; with (array.prototype) { keys.push('something'); } object.keys(array.prototype[symbol.unscopables]); // ["copywithin", "entries", "fill", "find", "findindex", // "includes", "keys", "values"] specifications specification ecmascript (ecma-262)the definition of 'array.prototype[@@unscopables]' in that specification. ...
Array.prototype.copyWithin() - JavaScript
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 intentionally gen...
...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 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...
Array.prototype.flatMap() - JavaScript
t() of depth 1, but flatmap() is often quite useful, as merging both into one method is slightly more efficient. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax var new_array = arr.flatmap(function callback(currentvalue[, index[, array]]) { // return element for new_array }[, thisarg]) parameters callback function that produces an element of the new array, taking three arguments: currentvalue the current element being processed in the array. indexoptional the index of the current element being processed in the array. arrayoptional the array map was called upon. thisargoptional val...
... description see array.prototype.map() for a detailed description of the callback function. ...
Array.prototype.splice() - JavaScript
in that many elements from the end of the array. (in this case, the origin -1, meaning -n is the index of the nth last element, and is therefore equivalent to the index of array.length - n.) if array.length + start is less than 0, it will begin from index 0. deletecount optional an integer indicating the number of elements in the array to remove from start. if deletecount is omitted, or if its value is equal to or larger than array.length - start (that is, if it is equal to or greater than the number of elements left in the array, starting at start), then all the elements from start to the end of the array will be deleted. note: in ie8, it won't delete all when deletecount is omitted. if deletecount is 0 or negative, no elements are removed. in this case, you should specify at leas...
...will be deleted. note: in ie8, it won't delete all when deletecount is omitted. if deletecount is 0 or negative, no elements are removed. in this case, you should specify at least one new element (see below). item1, item2, ... optional the elements to add to the array, beginning from start. if you do not specify any elements, splice() will only remove elements from the array. return value an array containing the deleted elements. if only one element is removed, an array of one element is returned. if no elements are removed, an empty array is returned. description if the specified number of elements to insert differs from the number of elements being removed, the array's length will be changed. examples remove 0 (zero) elements before index 2, and insert "drum" let myfish ...
Array.prototype.toSource() - JavaScript
this method is usually called internally by javascript and not explicitly in code. you can call tosource while debugging to examine the contents of an array. ...
... this method is usually called internally by javascript and not explicitly in code. you can call tosource while debugging to examine the contents of an array. ...
Array.prototype.toString() - JavaScript
the tostring() method returns a string representing the specified array and its elements. syntax arr.tostring() return value a string representing the elements of the array. description the array object overrides the tostring method of object. for array objects, the tostring method joins the array and returns one string containing each array element separated by commas. javascript calls the tostring method automatically when an array is to be represented as a text value or when an array is referred to in a string concatenation. ...
... calls the tostring method automatically when an array is to be represented as a text value or when an array is referred to in a string concatenation. ecmascript 5 semantics starting in javascript 1.8.5 (firefox 4), and consistent with ecmascript 5th edition semantics, the tostring() method is generic and can be used with any object. object.prototype.tostring() will be called, and the resulting value will be returned. examples using tostring const array1 = [1, 2, 'a', '1a']; console.log(array1.tostring()); // expected output: "1,2,a,1a" specifications specification ecmascript (ecma-262)the definition of 'array.prototype.tostring' in that specification. ...
Array.prototype.unshift() - JavaScript
unshift is intentionally generic. this method can be called or applied to objects resembling arrays. ...
... unshift is intentionally generic. this method can be called or applied to objects resembling arrays. ...
Atomics.load() - JavaScript
exceptions throws a typeerror, if typedarray is not one of the allowed integer types. ...
...ntribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.load(typedarray, index) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to load from. return value the value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using load const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); atomics.add(ta, 0, 12); atomics.load(ta, 0); // 12 specifications specification...
BigInt.asIntN() - JavaScript
examples staying in 64-bit ranges the bigint.asintn() method can be useful to stay in the range of 64-bit arithmetic. ...
...or this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax bigint.asintn(width, bigint); parameters width the amount of bits available for the integer size. bigint the integer to clamp to fit into the supplied bits. returns the value of bigint modulo 2width as a signed integer. examples staying in 64-bit ranges the bigint.asintn() method can be useful to stay in the range of 64-bit arithmetic. const max = 2n ** (64n - 1n) - 1n; bigint.asintn(64, max); // ↪ 9223372036854775807n bigint.asintn(64, max + 1n); // ↪ -9223372036854775807n // negative because of overflow specifications specification ...
BigInt.asUintN() - JavaScript
examples staying in 64-bit ranges the bigint.asuintn() method can be useful to stay in the range of 64-bit arithmetic. ...
...r this interactive example is stored in a github repository. if 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 bigint.asuintn(width, bigint); parameters width the amount of bits available for the integer size. bigint the integer to clamp to fit into the supplied bits. returns the value of bigint modulo 2width as an unsigned integer. examples staying in 64-bit ranges the bigint.asuintn() method can be useful to stay in the range of 64-bit arithmetic. const max = 2n ** 64n - 1n; bigint.asuintn(64, max); // ↪ 18446744073709551615n bigint.asuintn(64, max + 1n); // ↪ 0n // zero because of overflow specifications specification ecmascript (ecma-262)th...
Boolean.prototype.toString() - JavaScript
the tostring() method returns a string representing the specified boolean 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 bool.tostring() return value a string representing the specified boolean object. description the boolean object overrides the tostring method of the object object; it does not inherit object.prototype.tostring(). for boolean objects, the tostring method returns a string representation of the object. javascript calls the tostring() method automatically when a boolean is to be represented as a text value or when a boolean is referred to in a string concatenation. for boolean ob...
... the boolean object overrides the tostring method of the object object; it does not inherit object.prototype.tostring(). for boolean objects, the tostring method returns a string representation of the object. javascript calls the tostring() method automatically when a boolean is to be represented as a text value or when a boolean is referred to in a string concatenation. for boolean objects and values, the built-in tostring() method returns the string "true" or "false" depending on the value of the boolean object. examples using tostring() in the following code, flag.tostring() returns "true": var flag = new boolean(true); var myvar = flag.tostring(); specifications specification ecmascript (ecma-262)the definition of 'boolean.prototype.tostring' in that specification...
DataView() constructor - JavaScript
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. bytelength 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 dataview object representing the specified data buffer. (that probably wasn't a very helpful description.) you can think of the returned object as an "interpreter" of the array buffer of bytes — it knows how to convert numbers to fit within the buffer correctly, both when reading and writing to it. this means handling integer and float conversion, endianness, and other details of repres...
...ion.) you can think of the returned object as an "interpreter" of the array buffer of bytes — it knows how to convert numbers to fit within the buffer correctly, both when reading and writing to it. this means handling integer and float conversion, endianness, and other details of representing numbers in binary form. exceptions rangeerror thrown if the byteoffset or bytelength parameter values result in the view extending past the end of the buffer. for example, if the buffer is 16 bytes long, the byteoffset is 8, and the bytelength is 10, this error is thrown because the resulting view tries to extend 2 bytes past the total length of the buffer. examples using dataview var buffer = new arraybuffer(16); var view = new dataview(buffer, 0); view.setint16(1, 42); view.getint16(1...
Date.prototype[@@toPrimitive] - JavaScript
the [@@toprimitive]() method converts a date object to a primitive value. syntax date()[symbol.toprimitive](hint); return value the primitive value of the given date object. depending on the argument, the method can return either a string or a number. description the [@@toprimitive]() method of the date object returns a primitive value, that is either of type number or of type string. if hint is "string" or "default", [@@toprimitive]() tries to call the tostring method. if the tostring property does not exist, it tries to call the valueof method and if the valueof does not exist either, [@@toprimitive]() throws a typeerror. if hint is "number", [@@toprimitive]() first tries to call valueof, and if that fails, it calls tostring. javascript calls the [@@toprimitive]() method to convert...
...[@@toprimitive]() tries to call the tostring method. if the tostring property does not exist, it tries to call the valueof method and if the valueof does not exist either, [@@toprimitive]() throws a typeerror. if hint is "number", [@@toprimitive]() first tries to call valueof, and if that fails, it calls tostring. javascript calls the [@@toprimitive]() method to convert an object to a primitive value. you rarely need to invoke the [@@toprimitive]() method yourself; javascript automatically invokes it when encountering an object where a primitive value is expected. examples returning date primitives const testdate = new date(1590757517834); // "date fri may 29 2020 14:05:17 gmt+0100 (british summer time)" testdate[symbol.toprimitive]('string'); // returns "date fri may 29 2020 14:05:17 gmt...
Date.UTC() - JavaScript
al an integer between 0 and 23 representing the hours. if omitted, defaults to 0. minute optional an integer between 0 and 59 representing the minutes. if omitted, defaults to 0. second optional an integer between 0 and 59 representing the seconds. if omitted, defaults to 0. millisecond optional an integer between 0 and 999 representing the milliseconds. if omitted, defaults to 0. return value a number representing the number of milliseconds for the given date since january 1, 1970, 00:00:00, utc. description utc() takes comma-delimited date and time parameters and returns the number of milliseconds between january 1, 1970, 00:00:00, universal time and the specified date and time. years between 0 and 99 are converted to a year in the 20th century (1900 + year). for example, 95 is c...
...eturns the number of milliseconds between january 1, 1970, 00:00:00, universal time and the specified date and time. years between 0 and 99 are converted to a year in the 20th century (1900 + year). for example, 95 is converted to the year 1995. the utc() method differs from the date constructor in two ways: date.utc() uses universal time instead of the local time. date.utc() returns a time value as a number instead of creating a date object. if a parameter is outside of the expected range, the utc() method updates the other parameters to accommodate the value. for example, if 15 is used for month, the year will be incremented by 1 (year + 1) and 3 will be used for the month. utc() is a static method of date, so it's called as date.utc() rather than as a method of a date instance. exa...
Date.prototype.getFullYear() - JavaScript
etfullyear() method returns the year of the specified date according to local time. use this method instead of the getyear() method. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.getfullyear() return value a number corresponding to the year of the given date, according to local time. description the value returned by getfullyear() is an absolute number. for dates between the years 1000 and 9999, getfullyear() returns a four-digit number, for example, 1995. use this function to make sure a year is compliant with years after 2000. examples using getfullyear() the following example assigns the f...
... corresponding to the year of the given date, according to local time. description the value returned by getfullyear() is an absolute number. for dates between the years 1000 and 9999, getfullyear() returns a four-digit number, for example, 1995. use this function to make sure a year is compliant with years after 2000. examples using getfullyear() the following example assigns the four-digit value of the current year to the variable year. var today = new date(); var year = today.getfullyear(); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getfullyear' in that specification. ...
Date.prototype.getTime() - JavaScript
unix epoch. * javascript uses milliseconds as the unit of measurement, whereas unix time is in seconds. gettime() always uses utc for time representation. for example, a client browser in one timezone, gettime() will be the same as a client browser in any other timezone. you can use this method to help assign a date and time to another date object. this method is functionally equivalent to the valueof() method. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.gettime() return value a number representing the milliseconds elapsed between 1 january 1970 00:00:00 utc and the given date. reduced time ...
...in 60 it will be 2ms. // reduced time precision (2ms) in firefox 60 new date().gettime(); // 1519211809934 // 1519211810362 // 1519211811670 // ... // reduced time precision with `privacy.resistfingerprinting` enabled new date().gettime(); // 1519129853500 // 1519129858900 // 1519129864400 // ... in firefox, you can also enable privacy.resistfingerprinting, the precision will be 100ms or the value of privacy.resistfingerprinting.reducetimerprecision.microseconds, whichever is larger. examples using gettime() for copying dates constructing a date object with the identical time value. // since month is zero based, birthday will be january 10, 1995 var birthday = new date(1994, 12, 10); var copy = new date(); copy.settime(birthday.gettime()); measuring execution time subtracting two s...
Date.prototype.getTimezoneOffset() - JavaScript
the gettimezoneoffset() method returns the time zone difference, in minutes, from current locale (host system settings) to utc. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.gettimezoneoffset() return value a number representing the time-zone offset, in minutes, from the date based on current host system settings to utc. description the time-zone offset is the difference, in minutes, from local time to utc. note that this means that the offset is positive if the local timezone is behind utc, and negative if it is ahead. for example, for time zone utc+10:00 (australian eastern standard time, vlad...
...the time-zone offset is the difference, in minutes, from local time to utc. note that this means that the offset is positive if the local timezone is behind utc, and negative if it is ahead. for example, for time zone utc+10:00 (australian eastern standard time, vladivostok time, chamorro standard time), -600 will be returned. current locale utc-8 utc utc+3 return value 480 0 -180 the time zone offset returned is the one that applies for the date that it's called on. if the host system is configured for daylight saving, the offset will change depending on the date and time that the date represents and that daylight saving applies. examples using gettimezoneoffset() // get current timezone offset for host device let x = new date(); let current...
Date.prototype.getUTCMonth() - JavaScript
0 for january, 1 for february, 2 for march, and so on. ...
...0 for january, 1 for february, 2 for march, and so on. examples using getutcmonth() the following example assigns the month portion of the current date to the variable month. ...
Date.now() - JavaScript
polyfill this method was standardized in ecma-262 5th edition. ...
...20µs in firefox 59; in 60 it will be 2ms. // reduced time precision (2ms) in firefox 60 date.now() // 1519211809934 // 1519211810362 // 1519211811670 // ... // reduced time precision with `privacy.resistfingerprinting` enabled date.now(); // 1519129853500 // 1519129858900 // 1519129864400 // ... in firefox, you can also enable privacy.resistfingerprinting, the precision will be 100ms or the value of privacy.resistfingerprinting.reducetimerprecision.microseconds, whichever is larger. specifications specification ecmascript (ecma-262)the definition of 'date.now' in that specification. ...
Date.prototype.setUTCMonth() - JavaScript
the setutcmonth() method sets the month for a specified date according to universal time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.setutcmonth(monthvalue[, dayvalue]) parameters monthvalue an integer between 0 and 11, representing the months january through december. dayvalue optional. an integer from 1 to 31, representing the day of the month. return value the number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if you do not specify the dayvalue parameter, the value returned from the getutcdate() method is used. if a parameter you specify i...
... examples using setutcmonth() var thebigday = new date(); thebigday.setutcmonth(11); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.setutcmonth' in that specification. ...
Date.prototype.setUTCSeconds() - JavaScript
the setutcseconds() method sets the seconds for a specified date according to universal time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.setutcseconds(secondsvalue[, msvalue]) parameters secondsvalue an integer between 0 and 59, representing the seconds. msvalue optional. a number between 0 and 999, representing the milliseconds. return value the number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if you do not specify the msvalue parameter, the value returned from the getutcmilliseconds() method is used. if a parameter you specify is outside ...
... the number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if you do not specify the msvalue parameter, the value returned from the getutcmilliseconds() method is used. if a parameter you specify is outside of the expected range, setutcseconds() attempts to update the date information in the date object accordingly. for example, if you use 100 for secondsvalue, the minutes stored in the date object will be incremented by 1, and 40 will be used for seconds. examples using setutcseconds() var thebigday = new date(); thebigday.setutcseconds(20); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.setutcseconds' in that specification. ...
Date.prototype.toISOString() - JavaScript
dthh:mm:ss.sssz or ±yyyyyy-mm-ddthh:mm:ss.sssz, respectively). the timezone is always zero utc offset, as denoted by the suffix "z". the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.toisostring() return value a string representing the given date in the iso 8601 format according to universal time. polyfill this method was standardized in ecma-262 5th edition. engines which have not been updated to support this method can work around the absence of this method using the following shim: if (!date.prototype.toisostring) { (function() { function pad(number) { if (number < 10) { re...
... specifications specification ecmascript (ecma-262)the definition of 'date.prototype.toisostring' in that specification. ...
Date.prototype.toUTCString() - JavaScript
the toutcstring() method converts a date to a string, using the utc time zone. based on rfc7231 and modified according to ecma-262 toutcstring, it can have negative values in the 2021 version the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.toutcstring() return value a string representing the given date using the utc time zone. description the value returned by toutcstring() is a string in the form www, dd mmm yyyy hh:mm:ss gmt, where: format sring description www day of week, as three letters (e.g. sun, mon, ...) dd day of month, as two digits with leading...
...ed mmm month, as three letters (e.g. jan, feb, ...) yyyy year, as four or more digits with leading zeroes if required hh hour, as two digits with leading zero if required mm minute, as two digits with leading zero if required ss seconds, as two digits with leading zero if required prior to ecmascript 2018, the format of the return value varied according to the platform. the most common return value was an rfc-1123 formatted date stamp, which is a slightly updated version of rfc-822 date stamps. examples using toutcstring() let today = new date('wed, 14 jun 2017 00:00:00 pdt'); let utcstring = today.toutcstring(); // wed, 14 jun 2017 07:00:00 gmt specifications specification ecmascript (ecma-262)the de...
Error() constructor - JavaScript
defaults to the line number containing the error() constructor invocation. ...
...defaults to the line number containing the error() constructor invocation. ...
Error.prototype.toString() - JavaScript
the tostring() method returns a string representing the specified error object. syntax e.tostring() return value a string representing the specified error object. description the error object overrides the object.prototype.tostring() method inherited by all objects. ...
... the tostring() method returns a string representing the specified error object. syntax e.tostring() return value a string representing the specified error object. description the error object overrides the object.prototype.tostring() method inherited by all objects. ...
Function() constructor - JavaScript
roject, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax new function([arg1 [, arg2 [, ...argn]] ,] functionbody) parameters arg1, arg2, ... argn names to be used by the function as formal argument names. each must be a string that corresponds to a valid javascript identifier, or a list of such strings separated with a comma. for example: "x", "thevalue"—or "x,thevalue". functionbody a string containing the javascript statements comprising the function definition. description function objects created with the function constructor are parsed when the function is created. this is less efficient than declaring a function with a function expression or function statement and calling it within your code because such functions are parsed with th...
...his is less efficient than declaring a function with a function expression or function statement and calling it within your code because such functions are parsed with the rest of the code. all arguments passed to the function are treated as the names of the identifiers of the parameters in the function to be created, in the order in which they are passed. omitting an argument will result in the value of that parameter being undefined. invoking the function constructor as a function (without using the new operator) has the same effect as invoking it as a constructor. examples specifying arguments with the function constructor the following code creates a function object that takes two arguments. // example can be run directly in your javascript console // create a function that takes two...
Function.displayName - JavaScript
...
... ...
Function.prototype.toString() - JavaScript
the tostring() method returns a string representing the source code of 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. syntax function.tostring() return value a string representing the source code of the function. description the function object overrides the tostring method inherited from object; it does not inherit object.prototype.tostring. for user-defined function objects, the tostring method returns a string containing the source text segment which was used to define the function. javascript calls the tostring method automatically when a function is to be represented as a text value, e.g. wh...
...the tostring method returns a string containing the source text segment which was used to define the function. javascript calls the tostring method automatically when a function is to be represented as a text value, e.g. when a function is concatenated with a string. the tostring() method will throw a typeerror exception ("function.prototype.tostring called on incompatible object"), if its this value object is not a function object. function.prototype.tostring.call('foo'); // typeerror if the tostring() method is called on built-in function objects or a function created by function.prototype.bind, tostring() returns a native function string which looks like "function () {\n [native code]\n}" if the tostring() method is called on a function created by the function constructor, tostrin...
Generator.prototype.throw() - JavaScript
the throw() method resumes the execution of a generator by throwing an error into it and returns an object with two properties done and value. syntax gen.throw(exception) parameters exception the exception to throw. for debugging purposes, it is useful to make it an instanceof error. return value an object with two properties: done (boolean) has the value true if the iterator is past the end of the iterated sequence. in this case value optionally specifies the return value of the iterator. has the value false if the iterator was able to produce the next value in the sequence. this is equivalent of not specifying the done property altogether. value any javascript value returned by the iterator. can be omitted when done is true. examples using throw() the following...
...turned by the iterator. can be omitted when done is true. examples using throw() the following example shows a simple generator and an error that is thrown using the throw method. an error can be caught by a try...catch block as usual. function* gen() { while(true) { try { yield 42; } catch(e) { console.log('error caught!'); } } } const g = gen(); g.next(); // { value: 42, done: false } g.throw(new error('something went wrong')); // "error caught!" // { value: 42, done: false } specifications specification ecmascript (ecma-262)the definition of 'generator.prototype.throw' in that specification. ...
Generator - JavaScript
turned by a generator function and it conforms to both the iterable protocol and the iterator protocol. constructor this object cannot be instantiated directly. instead, a generator instance can be returned from a generator function: function* generator() { yield 1; yield 2; yield 3; } const gen = generator(); // "generator { }" instance methods generator.prototype.next() returns a value yielded by the yield expression. generator.prototype.return() returns the given value and finishes the generator. generator.prototype.throw() throws an error to a generator (also finishes the generator, unless caught from within that generator). examples an infinite iterator function* infinite() { let index = 0; while (true) { yield index++; } } const generator = inf...
...urn() returns the given value and finishes the generator. generator.prototype.throw() throws an error to a generator (also finishes the generator, unless caught from within that generator). examples an infinite iterator function* infinite() { let index = 0; while (true) { yield index++; } } const generator = infinite(); // "generator { }" console.log(generator.next().value); // 0 console.log(generator.next().value); // 1 console.log(generator.next().value); // 2 // ... specifications specification ecmascript (ecma-262)the definition of 'generator objects' in that specification. ...
GeneratorFunction - JavaScript
ed by evaluating the following code. object.getprototypeof(function*(){}).constructor syntax new generatorfunction ([arg1[, arg2[, ...argn]],] functionbody) parameters arg1, arg2, ... argn names to be used by the function as formal argument names. each must be a string that corresponds to a valid javascript identifier or a list of such strings separated with a comma; for example "x", "thevalue", or "a,b". functionbody a string containing the javascript statements comprising the function definition. description generator function objects created with the generatorfunction constructor are parsed when the function is created. this is less efficient than declaring a generator function with a function* expression and calling it within your code, because such functions are parsed with t...
... invoking the generatorfunction constructor as a function (without using the new operator) has the same effect as invoking it as a constructor. examples creating a generator function from a generatorfunction() constructor var generatorfunction = object.getprototypeof(function*(){}).constructor var g = new generatorfunction('a', 'yield a * 2'); var iterator = g(10); console.log(iterator.next().value); // 20 specifications specification ecmascript (ecma-262)the definition of 'generatorfunction' in that specification. ...
Infinity - JavaScript
the global property infinity is a numeric value representing infinity. property attributes of infinity writable no enumerable no configurable no the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. description infinity is a property of the global object. in other words, it is a variable in global scope. the initial value of infinity is number.positive_infinity. the value infinity (positive infinity) is greater than any other number. ...
.... if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. description infinity is a property of the global object. in other words, it is a variable in global scope. the initial value of infinity is number.positive_infinity. the value infinity (positive infinity) is greater than any other number. this value behaves slightly differently than mathematical infinity; see number.positive_infinity for details. as defined by the ecmascript 5 specification, infinity is read-only (implemented in javascript 1.8.5 / firefox 4). examples using infinity console.log(infinity ); /* infinity */ console.log(infinity + 1 ); /* infinity */ console.log(math.pow(10, 1000)); /* infinity */ console.log(m...
Intl.DateTimeFormat.prototype.format() - JavaScript
passed directly to array.prototype.map(). var a = [new date(2012, 08), new date(2012, 11), new date(2012, 03)]; var options = { year: 'numeric', month: 'long' }; var datetimeformat = new intl.datetimeformat('pt-br', options); var formatted = a.map(datetimeformat.format); console.log(formatted.join('; ')); // → "setembro de 2012; dezembro de 2012; abril de 2012" avoid comparing formatted date values to static values most of the time, the formatting returned by format() is consistent. however, this might change in the future and isn't guaranteed for all the languages — output variations are by design and allowed by the specification. most notably, the ie and edge browsers insert bidirectional control characters around dates, so the output text will flow properly when concatenated with oth...
... might change in the future and isn't guaranteed for all the languages — output variations are by design and allowed by the specification. most notably, the ie and edge browsers insert bidirectional control characters around dates, so the output text will flow properly when concatenated with other text. ...
Intl.DisplayNames() constructor - JavaScript
hub.com/mdn/interactive-examples and send us a pull request. syntax new intl.displaynames([locales[, options]]) parameters locales optional a string with a bcp 47 language tag, or an array of such strings. for the general form and interpretation of the locales argument, see the intl page. the following unicode extension key is allowed: nu the numbering system to be used. ...
...for information about this option, see the intl page. style the formatting style to use, the default is "long". "narrow" "short" "long" type the type to use, the default is "language". ...
Intl.ListFormat() constructor - JavaScript
a pull request. syntax new intl.listformat([locales[, options]]) parameters locales optional. a string with a bcp 47 language tag, or an array of such strings. for the general form and interpretation of the locales argument, see the intl page. options optional. an object with some or all of the following properties: localematcher the locale matching algorithm to use. possible values are "lookup" and "best fit"; the default is "best fit". for information about this option, see the intl page. type the 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). styl...
...t 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 intl.listformat('en-gb', { style: 'long', ...
Intl.Locale.prototype.maximize() - JavaScript
description sometimes, it is convenient to be able to identify the most likely locale language identifier subtags based on an incomplete langauage id. ...
... description sometimes, it is convenient to be able to identify the most likely locale language identifier subtags based on an incomplete langauage id. the add likely subtags algorithm gives us this functionality. ...
Intl.PluralRules.prototype.resolvedOptions() - JavaScript
the intl.pluralrules.prototype.resolvedoptions() method returns a new object with properties reflecting the locale and plural formatting options computed during initialization of this pluralrules object. syntax pluralrule.resolvedoptions() return value a new object with properties reflecting the locale and plural formatting options computed during the initialization of the given pluralrules 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. pluralcategories an array of plural categories used by the give...
... requested and are supported for this locale are included in locale. pluralcategories an array of plural categories used by the given locale, seleced from the list "zero", "one", "two", "few", "many" and "other". type the type used (cardinal or ordinal). only one of the following two groups of properties is included: minimumintegerdigits minimumfractiondigits maximumfractiondigits the values provided for these properties in the options argument or filled in as defaults. these properties are present only if neither minimumsignificantdigits nor maximumsignificantdigits was provided in the options argument. minimumsignificantdigits maximumsignificantdigits the values provided for these properties in the options argument or filled in as defaults. these properties are present only if ...
Map.prototype.entries() - JavaScript
the entries() method returns a new iterator object that contains the [key, value] pairs for each element in the map object in insertion order. the source for this interactive example is stored in a github repository. if 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 mymap.entries() return value a new map iterator object. ...
...epository. if 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 mymap.entries() return value a new map iterator object. examples using entries() let mymap = new map() mymap.set('0', 'foo') mymap.set(1, 'bar') mymap.set({}, 'baz') let mapiter = mymap.entries() console.log(mapiter.next().value) // ["0", "foo"] console.log(mapiter.next().value) // [1, "bar"] console.log(mapiter.next().value) // [object, "baz"] specifications specification ecmascript (ecma-262)the definition of 'map.prototype.entries' in that specification. ...
Map.prototype.keys() - JavaScript
the keys() method returns a new iterator object that contains the keys for each element in the map object in insertion order. the source for this interactive example is stored in a github repository. if 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 mymap.keys() return value a new map iterator object. ...
...ub repository. if 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 mymap.keys() return value a new map iterator object. examples using keys() var mymap = new map(); mymap.set('0', 'foo'); mymap.set(1, 'bar'); mymap.set({}, 'baz'); var mapiter = mymap.keys(); console.log(mapiter.next().value); // "0" console.log(mapiter.next().value); // 1 console.log(mapiter.next().value); // object specifications specification ecmascript (ecma-262)the definition of 'map.prototype.keys' in that specification. ...
Math.abs() - JavaScript
description because abs() is a static method of math, you always use it as math.abs(), rather than as a method of a math object you created (math is not a constructor). ...
...name{math.abs}(z)}} = {|z|} = \begin{cases} x & \text{if} \quad x \geq 0 \\ x & \text{if} \quad x < 0 \end{cases} the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.abs(x) parameters x a number. return value the absolute value of the given number. description because abs() is a static method of math, you always use it as math.abs(), rather than as a method of a math object you created (math is not a constructor). examples behavior of math.abs() passing an empty object, an array with more than one member, a non-numeric string or undefined/empty variable returns nan. passing null, an empty string...
Math.acos() - JavaScript
unique } \; y \in [0; \pi] \, \text{such that} \; \cos(y) = x the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.acos(x) parameters x a number representing a cosine, where x is between -1 and 1. return value the arccosine (angle in radians) of the given number if it's between -1 and 1; otherwise, nan. description the math.acos() method returns a numeric value between 0 and π radians for x between -1 and 1. if the value of x is outside this range, it returns nan. because acos() is a static method of math, you always use it as math.acos(), rather than as a method of a math object you created (math...
... range, it returns nan. because acos() is a static method of math, you always use it as math.acos(), rather than as a method of a math object you created (math is not a constructor). examples using math.acos() math.acos(-2); // nan math.acos(-1); // 3.141592653589793 math.acos(0); // 1.5707963267948966 math.acos(0.5); // 1.0471975511965979 math.acos(1); // 0 math.acos(2); // nan for values less than -1 or greater than 1, math.acos() returns nan. specifications specification ecmascript (ecma-262)the definition of 'math.acos' in that specification. ...
Math.acosh() - JavaScript
math.acosh}(x)} = \operatorname{arcosh}(x) = \text{ the unique } \; y \geq 0 \; \text{such that} \; \cosh(y) = x the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.acosh(x) parameters x a number. return value the hyperbolic arc-cosine of the given number. if the number is less than 1, nan. description because acosh() is a static method of math, you always use it as math.acosh(), rather than as a method of a math object you created (math is no constructor). polyfill for all x≥1x \geq 1, we have arcosh(x)=ln(x+x2-1)\operatorname {arcosh} (x) = \ln \left(x + \sqrt{x^{2} - 1} \right) and so this ca...
... specifications specification ecmascript (ecma-262)the definition of 'math.acosh' in that specification. ...
Math.asin() - JavaScript
n(x) = \text{ the unique } \; y \in \left[-\frac{\pi}{2}; \frac{\pi}{2}\right] \, \text{such that} \; \sin(y) = x the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.asin(x) parameters x a number. return value the arcsine (in radians) of the given number if it's between -1 and 1; otherwise, nan. description the math.asin() method returns a numeric value between -π2-\frac{\pi}{2} and π2\frac{\pi}{2} radians for x between -1 and 1. if the value of x is outside this range, it returns nan. because asin() is a static method of math, you always use it as math.asin(), rather than as a method of a math o...
...s nan. because asin() is a static method of math, you always use it as math.asin(), rather than as a method of a math object you created (math is not a constructor). examples using math.asin() math.asin(-2); // nan math.asin(-1); // -1.5707963267948966 (-pi/2) math.asin(0); // 0 math.asin(0.5); // 0.5235987755982989 math.asin(1); // 1.5707963267948966 (pi/2) math.asin(2); // nan for values less than -1 or greater than 1, math.asin() returns nan. specifications specification ecmascript (ecma-262)the definition of 'math.asin' in that specification. ...
Math.atanh() - JavaScript
rname{math.atanh}(x)} = \operatorname{arctanh}(x) = \text{ the unique } \; y \; \text{such that} \; \tanh(y) = x the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.atanh(x) parameters x a number. return value the hyperbolic arctangent of the given number. description because atanh() is a static method of math, you always use it as math.atanh(), rather than as a method of a math object you created (math is not a constructor). polyfill for |x|<1\left|x\right| < 1, we have artanh(x)=12ln(1+x1-x)\operatorname {artanh} (x) = \frac{1}{2}\ln \left( \frac{1 + x}{1 - x} \right) so this can be emulated by...
... specifications specification ecmascript (ecma-262)the definition of 'math.atanh' in that specification. ...
Math.hypot() - JavaScript
)=∑i=1nvi2=v12+v22+…+vn2\mathtt{\operatorname{math.hypot}(v_1, v_2, \dots, v_n)} = \sqrt{\sum_{i=1}^n v_i^2} = \sqrt{v_1^2 + v_2^2 + \dots + v_n^2} the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.hypot([value1[, value2[, ...]]]) parameters value1, value2, ... 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 length...
...ions 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 overflow/underflow problems if the magnitude of your numbers is very large. the largest number you can represent in js is number.max_value, which is around 10308. if your numbers are larger than about 10154, taking the square of them will result in infinity. for example, math.sqrt(1e200*1e200 + 1e200*1e200) = infinity . if you use hypot() instead, you get better answer: math.hypot(1e200, 1e200) = 1.4142...e+200 . this is also true with very small numbers. math.sqrt(1e-200*1e-200 + 1e-200*1e-200) = 0, but math.hypot(1e-200, 1e-200)...
Math.imul() - JavaScript
ns the result of the c-like 32-bit multiplication of the two parameters. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax var product = math.imul(a, b); parameters a first number. b second number. return value the result of the c-like 32-bit multiplication of the given arguments. description math.imul() allows for 32-bit integer multiplication with c-like semantics. this feature is useful for projects like emscripten. because imul() is a static method of math, you always use it as math.imul(), rather than as a method of a math object you created (math is not a constructor). if you use normal javascr...
...only potential circumstance where math.imul may prove performant in current browsers. polyfill this can be emulated with the following function: if (!math.imul) math.imul = function(a, b) { var ahi = (a >>> 16) & 0xffff; var alo = a & 0xffff; var bhi = (b >>> 16) & 0xffff; var blo = b & 0xffff; // the shift by 0 fixes the sign on the high part // the final |0 converts the unsigned value into a signed value return ((alo * blo) + (((ahi * blo + alo * bhi) << 16) >>> 0) | 0); }; however, the following function is more performant because it is likely that browsers in which this polyfill would be used do not optimize with an internal integer type in javascript, instead using floating points for all numbers. if (!math.imul) math.imul = function(opa, opb) { opb |= 0; // ensure th...
Math.log1p() - JavaScript
number, that is ∀x>-1,math.log1p(x)=ln(1+x)\forall x > -1, \mathtt{\operatorname{math.log1p}(x)} = \ln(1 + x) the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.log1p(x) parameters x a number. return value the natural logarithm (base e) of 1 plus the given number. if the number is less than -1, nan is returned. description for very small values of x, adding 1 can reduce or eliminate precision. the double floats used in js give you about 15 digits of precision. 1 + 1e-15 = 1.000000000000001, but 1 + 1e-16 = 1.000000000000000 and therefore exactly 1.0 in that arithmetic, because digits past 15 a...
...111111e-15. instead, you will end up taking the logarithm of 1.00000000000000111022 (the roundoff is in binary so sometimes it gets ugly), so you get the answer 1.11022...e-15, with only 3 correct digits. if, instead, you calculate math.log1p(1.1111111111e-15) you will get a much more accurate answer 1.1111111110999995e-15 with 15 correct digits of precision (actually 16 in this case). if the value of x is less than -1, the return value is always nan. because log1p() is a static method of math, you always use it as math.log1p(), rather than as a method of a math object you created (math is not a constructor). polyfill this can be emulated with the following function: math.log1p = math.log1p || function(x) { x = number(x); if (x < -1 || x !== x) return nan; if (x === 0 || x ===...
Math.log2() - JavaScript
l x > 0, \mathtt{\operatorname{math.log2}(x)} = \log_2(x) = \text{the unique} \; y \; \text{such that} \; 2^y = x the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.log2(x) parameters x a number. return value the base 2 logarithm of the given number. if the number is negative, nan is returned. description if the value of x is less than 0, the return value is always nan. because log2() is a static method of math, you always use it as math.log2(), rather than as a method of a math object you created (math is not a constructor). this function is the equivalent of math.log(x) / math.log(2). for log2...
... value is always nan. because log2() is a static method of math, you always use it as math.log2(), rather than as a method of a math object you created (math is not a constructor). this function is the equivalent of math.log(x) / math.log(2). for log2(e) use the constant math.log2e which is 1 / math.ln2. polyfill this polyfill emulates the math.log2 function. note that it returns imprecise values on some inputs (like 1 << 29), wrap into math.round() if working with bit masks. if (!math.log2) math.log2 = function(x) { return math.log(x) * math.log2e; }; examples using math.log2() math.log2(3); // 1.584962500721156 math.log2(2); // 1 math.log2(1); // 0 math.log2(0); // -infinity math.log2(-2); // nan math.log2(1024); // 10 specifications specification ...
Math.tan() - JavaScript
the math.tan() function returns the tangent of a number. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.tan(x) parameters x a number representing an angle in radians. return value the tangent of the given number. description the math.tan() method returns a numeric value that represents the tangent of the angle. because tan() is a static method of math, you always use it as math.tan(), rather than as a method of a math object you created (math is not a constructor). examples using math.tan() math.tan(1); // 1.5574077246549023 because the math.tan() function accepts radians, but it is ofte...
... function gettandeg(deg) { var rad = deg * math.pi/180; return math.tan(rad); } specifications specification ecmascript (ecma-262)the definition of 'math.tan' in that specification. ...
Number.MAX_SAFE_INTEGER - JavaScript
b repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of number.max_safe_integer writable no enumerable no configurable no description the max_safe_integer constant has a value of 9007199254740991 (9,007,199,254,740,991 or ~9 quadrillion). the reasoning behind that number is that javascript uses double-precision floating-point format numbers as specified in ieee 754 and can only safely represent numbers between -(253 - 1) and 253 - 1. safe in this context refers to the ability to represent integers exactly and to correctly compare them. for example, number.max_safe_int...
...ts existence, such as math.max(number.max_safe_integer, 2), will yield undesired results such as nan. because max_safe_integer is a static property of number, you always use it as number.max_safe_integer, rather than as a property of a number object you created. polyfill if (!number.max_safe_integer) { number.max_safe_integer = 9007199254740991; // math.pow(2, 53) - 1; } examples return value of max_safe_integer number.max_safe_integer; // 9007199254740991 numbers higher than safe integer this returns 2 because in floating points, the value is actually the decimal trailing "1" except for in subnormal precision cases such as zero. number.max_safe_integer * number.epsilon; // 2 specifications specification ecmascript (ecma-262)the definition of 'number.max_...
Number.isNaN() - JavaScript
the number.isnan() method determines whether the passed value is nan and its type is number. it is a more robust version of the original, global isnan(). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax number.isnan(value) parameters value the value to be tested for nan. return value true if the given value is nan and its type is number; otherwise, false. description due to both equality operators, == and ===, evaluating to false when checking if nan is nan, the function number.isnan() has become necessary. this situation is unlike all other possible value comparisons in javascript. in comparison to...
...ion due to both equality operators, == and ===, evaluating to false when checking if nan is nan, the function number.isnan() has become necessary. this situation is unlike all other possible value comparisons in javascript. in comparison to the global isnan() function, number.isnan() doesn't suffer the problem of forcefully converting the parameter to a number. this means it is now safe to pass values that would normally convert to nan, but aren't actually the same value as nan. this also means that only values of the type number, that are also nan, return true. polyfill the following works because nan is the only value in javascript which is not equal to itself. number.isnan = number.isnan || function isnan(input) { return typeof input === 'number' && input !== input; } examples us...
Number.prototype.toExponential() - JavaScript
a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax numobj.toexponential([fractiondigits]) parameters fractiondigits optional. an integer specifying the number of digits after the decimal point. defaults to as many digits as necessary to specify the number. return value a string representing the given number object in exponential notation with one digit before the decimal point, rounded to fractiondigits digits after the decimal point. exceptions rangeerror if fractiondigits is too small or too large. values between 0 and 20, inclusive, will not cause a rangeerror. implementations are allowed to support larger and smaller values as well. typeerror if thi...
... if you use the toexponential() method for a numeric literal and the numeric literal has no exponent and no decimal point, leave whitespace(s) before the dot that precedes the method call to prevent the dot from being interpreted as a decimal point. ...
Number.prototype.toPrecision() - JavaScript
the toprecision() method returns a string representing the number object to the specified precision. syntax numobj.toprecision([precision]) parameters precision optional an integer specifying the number of significant digits. return value a string representing a number object in fixed-point or exponential notation rounded to precision significant digits. see the discussion of rounding in the description of the number.prototype.tofixed() method, which also applies to toprecision(). if the precision argument is omitted, behaves as number.prototype.tostring(). if the precision argument is a non-integer value, it is rounded to the nearest integer. exceptions rangeerror if precision is not between 1 and 100 (inclusive), a rangeerror is thrown. implementations are allowed to suppor...
...ecma-262 only requires a precision of up to 21 significant digits. ...
Object.prototype.constructor - JavaScript
description all objects (with the exception of objects created with object.create(null)) will have a constructor property. objects created without the explicit use of a constructor function (such as object- and array-literals) will have a constructor property that points to the fundamental object constructor type for that object. ...
...he constructor property for the object thetree. function tree(name) { this.name = name } let thetree = new tree('redwood') console.log('thetree.constructor is ' + thetree.constructor) this example displays the following output: thetree.constructor is function tree(name) { this.name = name } changing the constructor of an object the following example shows how to modify the constructor value of generic objects. only true, 1, and "test" will not be affected (as they have read-only native constructors). this example shows that it is not always safe to rely on the constructor property of an object. function type () {} let types = [ new array(), [], new boolean(), true, // remains unchanged new date(), new error(), new function(), function () {}, math, ...
Object.getPrototypeOf() - JavaScript
if there are no inherited properties, null is returned. ...
...the internal [[prototype]] property) of the specified 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 object.getprototypeof(obj) parameters obj the object whose prototype is to be returned. return value the prototype of the given object. if there are no inherited properties, null is returned. examples using getprototypeof var proto = {}; var obj = object.create(proto); object.getprototypeof(obj) === proto; // true non-object coercion in es5, it will throw a typeerror exception if the obj parameter isn't an object. in es2015, the parameter will be coerced to an object. object.getprototype...
Object.preventExtensions() - JavaScript
object (i.e. prevents future extensions to the 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 object.preventextensions(obj) parameters obj the object which should be made non-extensible. return value the object being made non-extensible. description an object is extensible if new properties can be added to it. object.preventextensions() marks an object as no longer extensible, so that it will never have properties beyond the ones it had at the time it was marked as non-extensible. note that the properties of a non-extensible object, in general, may still be deleted. attempting to add new p...
...ible by default. var empty = {}; object.isextensible(empty); // === true // ...but that can be changed. object.preventextensions(empty); object.isextensible(empty); // === false // object.defineproperty throws when adding // a new property to a non-extensible object. var nonextensible = { removable: true }; object.preventextensions(nonextensible); object.defineproperty(nonextensible, 'new', { value: 8675309 }); // throws a typeerror // in strict mode, attempting to add new properties // to a non-extensible object throws a typeerror. function fail() { 'use strict'; // throws a typeerror nonextensible.newproperty = 'fail'; } fail(); a non-extensible object's prototype is immutable: var fixed = object.preventextensions({}); // throws a 'typeerror'. fixed.__proto__ = { oh: 'hai' }; n...
Object.prototype.toLocaleString() - JavaScript
ethod returns a string representing the object. this method is meant to be overridden by derived objects for locale-specific purposes. the source for this interactive example is stored in a github repository. if 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 obj.tolocalestring() return value a string representing the object. description object's tolocalestring returns the result of calling tostring(). this function is provided to give objects a generic tolocalestring method, even though not all may use it. see the list below. objects overriding tolocalestring array: array.prototype.tolocalestring() number: number.prototype.tolocalestring() date: date.prototype.tolocalestrin...
...ot all may use it. see the list below. ...
Object.prototype.toSource() - JavaScript
you can call tosource() while debugging to examine the contents of an object. ...
... you can call tosource() while debugging to examine the contents of an object. ...
Promise.prototype.finally() - JavaScript
provides a way for code to be run whether the promise was fulfilled successfully or rejected once the promise has been dealt with. this helps to avoid duplicating code in both the promise's then() and catch() handlers. syntax p.finally(onfinally); p.finally(function() { // settled (fulfilled or rejected) }); parameters onfinally a function called when the promise is settled. return value returns a promise whose finally handler is set to the specified function, onfinally. description the finally() method can be useful if you want to do some processing or cleanup once the promise is settled, regardless of its outcome. the finally() method is very similar to calling .then(onfinally, onfinally) however there are a couple of differences: when creating a function inline, you can...
...couple of differences: when creating a function inline, you can pass it once, instead of being forced to either declare it twice, or create a variable for it a finally callback will not receive any argument, since there's no reliable means of determining if the promise was fulfilled or rejected. this use case is for precisely when you do not care about the rejection reason, or the fulfillment value, and so there's no need to provide it. so for example: unlike promise.resolve(2).then(() => {}, () => {}) (which will be resolved with undefined), promise.resolve(2).finally(() => {}) will be resolved with 2. similarly, unlike promise.reject(3).then(() => {}, () => {}) (which will be fulfilled with undefined), promise.reject(3).finally(() => {}) will be rejected with 3. note: a t...
handler.construct() - JavaScript
send us a pull request. syntax const p = new proxy(target, { construct: function(target, argumentslist, newtarget) { } }); parameters the following parameters are passed to the construct() method. this is bound to the handler. target the target object. argumentslist the list of arguments for the constructor. newtarget the constructor that was originally called, p above. return value the construct method must return an object. description the handler.construct() method is a trap for the new operator. interceptions this trap can intercept these operations: new proxy(...args) reflect.construct() invariants if the following invariants are violated, the proxy will throw a typeerror: the result must be an object. examples trapping the new operator the following ...
......args) reflect.construct() invariants if the following invariants are violated, the proxy will throw a typeerror: the result must be an object. examples trapping the new operator the following code traps the new operator. const p = new proxy(function() {}, { construct: function(target, argumentslist, newtarget) { console.log('called: ' + argumentslist.join(', ')); return { value: argumentslist[0] * 10 }; } }); console.log(new p(1).value); // "called: 1" // 10 the following code violates the invariant. const p = new proxy(function() {}, { construct: function(target, argumentslist, newtarget) { return 1; } }); new p(); // typeerror is thrown the following code improperly initializes the proxy. the target in proxy initialization...
handler.getOwnPropertyDescriptor() - JavaScript
s://github.com/mdn/interactive-examples and send us a pull request. syntax const p = new proxy(target, { getownpropertydescriptor: function(target, prop) { } }); parameters the following parameters are passed to the getownpropertydescriptor() method. this is bound to the handler. target the target object. prop the name of the property whose description should be retrieved. return value the getownpropertydescriptor() method must return an object or undefined. description the handler.getownpropertydescriptor() method is a trap for object.getownpropertydescriptor(). interceptions this trap can intercept these operations: object.getownpropertydescriptor() reflect.getownpropertydescriptor() invariants if the following invariants are violated, the proxy will throw a typee...
...escriptor(target) can be applied to the target object using object.defineproperty() and will not throw an exception. examples trapping of getownpropertydescriptor the following code traps object.getownpropertydescriptor(). const p = new proxy({ a: 20}, { getownpropertydescriptor: function(target, prop) { console.log('called: ' + prop); return { configurable: true, enumerable: true, value: 10 }; } }); console.log(object.getownpropertydescriptor(p, 'a').value); // "called: a" // 10 the following code violates an invariant. const obj = { a: 10 }; object.preventextensions(obj); const p = new proxy(obj, { getownpropertydescriptor: function(target, prop) { return undefined; } }); object.getownpropertydescriptor(...
handler.isExtensible() - JavaScript
a github repository. if 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 const p = new proxy(target, { isextensible: function(target) { } }); parameters the following parameter is passed to the isextensible() method. this is bound to the handler. target the target object. ...
... interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax const p = new proxy(target, { isextensible: function(target) { } }); parameters the following parameter is passed to the isextensible() method. this is bound to the handler. target the target object. return value the isextensible() method must return a boolean value. description the handler.isextensible() method is a trap for object.isextensible(). interceptions this trap can intercept these operations: object.isextensible() reflect.isextensible() invariants if the following invariants are violated, the proxy will throw a typeerror: object.isextensible(proxy) must return the same value as object.isextensible(target). examples trapping of ise...
Reflect.apply() - JavaScript
et function with arguments as specified. the source for this interactive example is stored in a github repository. if 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 reflect.apply(target, thisargument, argumentslist) parameters target the target function to call. thisargument the value of this provided for the call to target. argumentslist an array-like object specifying the arguments with which target should be called. return value the result of calling the given target function with the specified this value and arguments. exceptions a typeerror, if the target is not callable. description in es5, you typically use the function.prototype.apply() method to call a functi...
... function.prototype.apply.call(math.floor, undefined, [1.75]); with reflect.apply() this becomes less verbose and easier to understand. ...
Reflect.defineProperty() - JavaScript
teractive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax reflect.defineproperty(target, propertykey, attributes) parameters target the target object on which to define the property. propertykey the name of the property to be defined or modified. attributes the attributes for the property being defined or modified. return value a boolean indicating whether or not the property was successfully defined. exceptions a typeerror, if target is not an object. description the reflect.defineproperty method allows precise addition to or modification of a property on an object. for more details, see the object.defineproperty which is similar. one key difference: object.defineproperty returns the object or throws a typeerror...
..., see the object.defineproperty which is similar. one key difference: object.defineproperty returns the object or throws a typeerror if the property has not been successfully defined. reflect.defineproperty, however, simply returns a boolean indicating whether or not the property was successfully defined. examples using reflect.defineproperty() let obj = {} reflect.defineproperty(obj, 'x', {value: 7}) // true obj.x // 7 checking if property definition has been successful with object.defineproperty, which returns an object if successful, or throws a typeerror otherwise, you would use a try...catch block to catch any error that occurred while defining a property. ] because reflect.defineproperty returns a boolean success status, you can just use ...
Reflect.getPrototypeOf() - JavaScript
the static reflect.getprototypeof() method is almost the same method as object.getprototypeof(). it returns the prototype (i.e. the value of the internal [[prototype]] property) of the specified 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 reflect.getprototypeof(target) parameters target the target object of which to get the prototype. return value the prototype of the given object. if there are no inherited properties, null is returned. ...
...eractive-examples and send us a pull request. syntax reflect.getprototypeof(target) parameters target the target object of which to get the prototype. return value the prototype of the given object. if there are no inherited properties, null is returned. exceptions a typeerror, if target is not an object. description the reflect.getprototypeof method returns the prototype (i.e. the value of the internal [[prototype]] property) of the specified object. examples using reflect.getprototypeof() reflect.getprototypeof({}) // object.prototype reflect.getprototypeof(object.prototype) // null reflect.getprototypeof(object.create(null)) // null compared to object.getprototypeof() // same result for objects object.getprototypeof({}) // object.prototype reflect.g...
Reflect - JavaScript
e option to specify a different prototype. reflect.defineproperty(target, propertykey, attributes) similar to object.defineproperty(). returns a boolean that is true if the property was successfully defined. reflect.deleteproperty(target, propertykey) the delete operator as a function. equivalent to calling delete target[propertykey]. reflect.get(target, propertykey[, receiver]) returns the value of the property. works like getting a property from an object (target[propertykey]) as a function. reflect.getownpropertydescriptor(target, propertykey) similar to object.getownpropertydescriptor(). returns a property descriptor of the given property if it exists on the object, undefined otherwise. reflect.getprototypeof(target) same as object.getprototypeof(). reflect.has(target, propertyk...
...ction. reflect.isextensible(target) same as object.isextensible(). returns a boolean that is true if the target is extensible. reflect.ownkeys(target) returns an array of the target object's own (not inherited) property keys. reflect.preventextensions(target) similar to object.preventextensions(). returns a boolean that is true if the update was successful. reflect.set(target, propertykey, value[, receiver]) a function that assigns values to properties. returns a boolean that is true if the update was successful. reflect.setprototypeof(target, prototype) a function that sets the prototype of an object. returns a boolean that is true if the update was successful. examples detecting whether an object contains certain properties const duck = { name: 'maurice', color: 'white', g...
RegExp.prototype[@@matchAll]() - JavaScript
d returns all matches of the regular expression against a 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 regexp[symbol.matchall](str) parameters str a string that is a target of the match. return value an iterator. description this method is called internally in string.prototype.matchall(). for example, the following two examples return same result. 'abc'.matchall(/a/); /a/[symbol.matchall]('abc'); this method exists for customizing the behavior of matchall() in regexp subclasses. examples direct call this method can be used in almost the same way as string.prototype.matchall(), except...
...cription this method is called internally in string.prototype.matchall(). for example, the following two examples return same result. 'abc'.matchall(/a/); /a/[symbol.matchall]('abc'); this method exists for customizing the behavior of matchall() in regexp subclasses. examples direct call this method can be used in almost the same way as string.prototype.matchall(), except for the different value of this and the different order of arguments. let re = /[0-9]+/g; let str = '2016-01-02'; let result = re[symbol.matchall](str); console.log(array.from(result, x => x[0])); // ["2016", "01", "02"] using @@matchall in subclasses subclasses of regexp can override the [@@matchall]() method to modify the default behavior. for example, to return an array instead of an iterator: class myregexp e...
RegExp() constructor - JavaScript
send us a pull request. syntax literal, constructor, and factory notations are possible: /pattern/flags new regexp(pattern[, flags]) regexp(pattern[, flags]) parameters pattern the text of the regular expression. as of es5, this can also be another regexp object or literal (for the two regexp constructor notations only). ...
... flags may contain any combination of the following characters: g (global match) find all matches rather than stopping after the first match. i (ignore case) if u flag is also enabled, use unicode case folding. m (multiline) treat beginning and end characters (^ and $) as working over multiple lines. ...
RegExp.prototype.toString() - JavaScript
the tostring() method returns a string representing the regular expression. the source for this interactive example is stored in a github repository. if 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 regexobj.tostring(); return value a string representing the given object. ...
...equest. syntax regexobj.tostring(); return value a string representing the given object. description the regexp object overrides the tostring() method of the object object; it does not inherit object.prototype.tostring(). for regexp objects, the tostring() method returns a string representation of the regular expression. ...
RegExp - JavaScript
instead. when using the constructor function, the normal string escape rules (preceding special characters with \ when included in a string) are necessary. for example, the following are equivalent: let re = /\w+/ let re = new regexp('\\w+') perl-like regexp properties note that several of the regexp properties have both long and short (perl-like) names. both names always refer to the same value. (perl is the programming language from which javascript modeled its regular expressions.). see also deprecated regexp properties. constructor regexp() creates a new regexp object. static properties get regexp[@@species] the constructor function that is used to create derived objects. regexp.lastindex the index at which to start the next match. instance properties regexp.prototy...
...123 456', groups: undefined ] and re.lastindex 3 // ... and no more match. with the global flag g, all 6 digits would be matched, not just 3. regular expression and unicode characters \w and \w only matches ascii based characters; for example, a to z, a to z, 0 to 9, and _. to match characters from other languages such as cyrillic or hebrew, use \uhhhh, where hhhh is the character's unicode value in hexadecimal. this example demonstrates how one can separate out unicode characters from a word. let text = 'Образец text на русском языке' let regex = /[\u0400-\u04ff]+/g let match = regex.exec(text) console.log(match[0]) // logs 'Образец' console.log(regex.lastindex) // logs '7' let match2 = regex.exec(text) console.log(match2[0]) // logs 'на' [d...
Set.prototype[@@iterator]() - JavaScript
the initial value of the @@iterator property is the same function object as the initial value of the values property. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax myset[symbol.iterator] return value the set iterator function, which is the values() function by default. ...
...ctive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax myset[symbol.iterator] return value the set iterator function, which is the values() function by default. examples using [@@iterator]() const myset = new set(); myset.add('0'); myset.add(1); myset.add({}); const setiter = myset[symbol.iterator](); console.log(setiter.next().value); // "0" console.log(setiter.next().value); // 1 console.log(setiter.next().value); // object using [@@iterator]() with for..of const myset = new set(); myset.add('0'); myset.add(1); myset.add({}); for (const v of myset) { console.log(v); } specifications specification ecmascript (ecma-262)the definition of 'set.prototype[@@iterator]' in that specification. ...
Set.prototype.entries() - JavaScript
the entries() method returns a new iterator object that contains an array of [value, value] for each element in the set object, in insertion order. for set objects there is no key like in map objects. however, to keep the api similar to the map object, each entry has the same value for its key and value here, so that an array [value, value] is returned. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax myset.entries() return value a new iterator object that contains an array of [value, value] for each element in the given set, in insertion order. examples using entries() var myset = new set(); myset.add('f...
...clone https://github.com/mdn/interactive-examples and send us a pull request. syntax myset.entries() return value a new iterator object that contains an array of [value, value] for each element in the given set, in insertion order. examples using entries() var myset = new set(); myset.add('foobar'); myset.add(1); myset.add('baz'); var setiter = myset.entries(); console.log(setiter.next().value); // ["foobar", "foobar"] console.log(setiter.next().value); // [1, 1] console.log(setiter.next().value); // ["baz", "baz"] specifications specification ecmascript (ecma-262)the definition of 'set.prototype.entries' in that specification. ...
SharedArrayBuffer - JavaScript
rdized to re-enable shared memory. with a few security measures, postmessage() will no longer throw for sharedarraybuffer objects and shared memory across threads will be available: as a baseline requirement, your document needs to be in a secure context. ...
...hrow for sharedarraybuffer objects and shared memory across threads will be available: as a baseline requirement, your document needs to be in a secure context. ...
String.prototype.charAt() - JavaScript
if 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 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 rang...
...atically (if the character warrants it in being a surrogate pair). ...
String.fromCodePoint() - JavaScript
eated by using the specified sequence of code points. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax string.fromcodepoint(num1[, ...[, numn]]) parameters num1, ..., numn a sequence of code points. return value a string created by using the specified sequence of code points. exceptions a rangeerror is thrown if an invalid unicode code point is given (e.g. "rangeerror: nan is not a valid code point"). description this method returns a string (and not a string object). because fromcodepoint() is a static method of string, you must call it as string.fromcodepoint(), rather than as a method of a st...
...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)); examples using fromcodepoint() valid input: string.fromcodepoint(42); // "*" string.fromcodepoint(65, 90); // "az" string.fromcodepoint(0x404); // "\u0404" == "Є" string.fromcodepoint(0x2f804); // "\ud87e\udc04" string.from...
String length - JavaScript
ntains 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 string, length is 0. the static property stri...
...mystring.length = 4; console.log(mystring); // expected output: "bluebells" console.log(mystring.length); // expected output: 9 specifications specification ecmascript (ecma-262) ...
String.prototype.normalize() - JavaScript
s interactive example is stored in a github repository. if 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.normalize([form]) parameters form optional one of "nfc", "nfd", "nfkc", or "nfkd", specifying the unicode normalization form. if omitted or undefined, "nfc" is used. these values have the following meanings: "nfc" canonical decomposition, followed by canonical composition. "nfd" canonical decomposition. "nfkc" compatibility decomposition, followed by canonical composition. "nfkd" compatibility decomposition. return value a string containing the unicode normalization form of the given string. errors thrown rangeerror a rangeerror is thrown i...
...nings: "nfc" canonical decomposition, followed by canonical composition. "nfd" canonical decomposition. "nfkc" compatibility decomposition, followed by canonical composition. "nfkd" compatibility decomposition. return value a string containing the unicode normalization form of the given string. errors thrown rangeerror a rangeerror is thrown if form isn't one of the values specified above. description unicode assigns a unique numerical value, called a code point, to each character. for example, the code point for "a" is given as u+0041. however, sometimes more than one code point, or sequence of code points, can represent the same abstract character — the character "ñ" for example can be represented by either of: the single code point u+00f1. the code po...
String.prototype.padEnd() - JavaScript
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(targetlength [, padstring]) parameters targetlength the length of the resulting string once the current str has been padded. ...
...he 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 targetlength, 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 targetlength with the padstring applied at the end of the current str. examples using padend 'abc'.padend(10); // "abc " 'abc'.padend(10, "foo"); // "abcfoofoof" 'abc'.padend(6, "123456"); // "abc123" 'abc'.padend(1); // "abc" specifications specification ecmascript ...
String.raw() - JavaScript
cal; see explanations in this issue.) it's used to get the raw string form of template strings, that is, substitutions (e.g. ${foo}) are processed, but escapes (e.g. \n) are not. syntax string.raw(callsite, ...substitutions) string.raw`templatestring` parameters callsite well-formed template call site object, like { raw: ['foo', 'bar', 'baz'] }. ...substitutions contains substitution values. templatestring a template string, optionally with substitutions (${...}). return value the raw string form of a given template string. exceptions typeerror a typeerror is thrown if the first argument is not a well-formed object. description in most cases, string.raw() is used with template strings. the first syntax mentioned above is only rarely used, because the javascript engine ...
...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' property, // whose value is an iterable representing the separated strings // in the template literal. // the rest of the arguments are the substitutions. // the first argument’s 'raw' value can be any iterable, even a string! // for example, 'test' is treated as ['t', 'e', 's', 't']. // the following is equivalent to // `t${0}e${1}s${2}t`: string.raw({ raw: 'test' }, 0, 1, 2); // 't0e1s2t' specifications ...
String.prototype.search() - JavaScript
interactive example is stored in a github repository. if 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.search(regexp) parameters regexp a regular expression object. if a non-regexp object regexp is passed, it is implicitly converted to a regexp with new regexp(regexp). return value the index of the first match between the regular expression and the given string, or -1 if no match was found. description when you want to know whether a pattern is found, and also know its index within a string, use search(). (if you only want to know if it exists, use the similar test() method on the regexp prototype, which returns a boolean.) for more information (but slower execution) u...
... within a string, use search(). (if you only want to know if it exists, use the similar test() method on the regexp prototype, which returns a boolean.) for more information (but slower execution) use match() (similar to the regular expression exec() method). examples using search() the following example searches a string with two different regex objects to show a successful search (positive value) vs. an unsuccessful search (-1) let str = "hey jude" let re = /[a-z]/g let redot = /[.]/g console.log(str.search(re)) // returns 4, which is the index of the first capital letter "j" console.log(str.search(redot)) // returns -1 cannot find '.' dot punctuation specifications specification ecmascript (ecma-262)the definition of 'string.prototype.search' in that specificatio...
String.prototype.split() - JavaScript
xamples and send us a pull request. syntax str.split([separator[, limit]]) parameters separator optional the pattern describing where each split should occur. the separator can be a simple string or it can be a regular expression. the simplest case is when separator is just a single character; this is used to split a delimited string. for example, a string containing tab separated values (tsv) could be parsed by passing a tab character as the separator, like this: mystring.split("\t"). if separator contains multiple characters, that entire character sequence must be found in order to split. if separator is omitted or does not occur in str, the returned array contains one element consisting of the entire string. if separator appears at the beginning (or end) of the string, ...
...ed, splits the string at each occurrence of the specified separator, but stops when limit entries have been placed in the array. any leftover text is not included in the array at all. the array may contain fewer entries than limit if the end of the string is reached before the limit is reached. if limit is 1, str.split(separator)[0] is returned if limit is 0, [] is returned. return value an array of strings, split at each point where the separator occurs in the given string. description when found, separator is removed from the string, and the substrings are returned in an array. if separator is a regular expression with capturing parentheses, then each time separator matches, the results (including any undefined results) of the capturing parentheses are spliced into the outp...
String.prototype.startsWith() - JavaScript
ike to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.startswith(searchstring[, position]) parameters searchstring the characters to be searched for at the start of this string. position optional the position in this string at which to begin searching for searchstring. defaults to 0. return value true if the given characters are found at the beginning of the string; otherwise, false. description this method lets you determine whether or not a string begins with another string. this method is case-sensitive. polyfill this method has been added to the ecmascript 2015 specification and may not be available in all javascript implementations yet. however, you can polyfill string.prototype...
...not a string begins with another string. this method is case-sensitive. polyfill this method has been added to the ecmascript 2015 specification and may not be available in all javascript implementations yet. however, you can polyfill string.prototype.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 q...
String.prototype.toUpperCase() - JavaScript
the touppercase() method returns the calling string value converted to uppercase (the value will be converted to a string if it isn't one). the source for this interactive example is stored in a github repository. if 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.touppercase() return value a new string representing the calling string converted to upper case. exceptions typeerror when called on null or undefined, for example, string.prototype.touppercase.call(undefined). description the touppercase() method returns the value of the string converted to uppercase. this method does not affect the value of the string itself since javascript strings are immutable. examples ...
...r when called on null or undefined, for example, string.prototype.touppercase.call(undefined). description the touppercase() method returns the value of the string converted to uppercase. this method does not affect the value of the string itself since javascript strings are immutable. examples basic usage console.log('alphabet'.touppercase()); // 'alphabet' conversion of non-string this values to strings this method will convert any non-string value to a string, when you set its this to a value that is not a string: const a = string.prototype.touppercase.call({ tostring: function tostring() { return 'abcdef'; } }); const b = string.prototype.touppercase.call(true); // prints out 'abcdef true'. console.log(a, b); specifications specification ecmascript ...
Symbol() constructor - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax symbol([description]) parameters description optional a string. a description of the symbol which can be used for debugging but not to access the symbol itself. ...
...de creates three new symbols. note that symbol("foo") does not coerce the string "foo" into a symbol. it creates a new symbol each time: symbol('foo') === symbol('foo') // false new symbol(...) the following syntax with the new operator will throw a typeerror: let sym = new symbol() // typeerror this prevents authors from creating an explicit symbol wrapper object instead of a new symbol value and might be surprising as creating explicit wrapper objects around primitive data types is generally possible (for example, new boolean, new string and new number). if you really want to create a symbol wrapper object, you can use the object() function: let sym = symbol('foo'); let symobj = object(sym); typeof sym // => "symbol" typeof symobj // => "object" specifications spe...
Symbol.for() - JavaScript
l registry with this key. the source for this interactive example is stored in a github repository. if 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 symbol.for(key); parameters key string, required. the key for the symbol (and also used for the description of the symbol). return value an existing symbol with the given key if found; otherwise, a new symbol is created and returned. description in contrast to symbol(), the symbol.for() function creates a symbol available in a global symbol registry list. symbol.for() does also not necessarily create a new symbol on every call, but checks first if a symbol with the given key is already present in the registry. in that case, tha...
...t checks first if a symbol with the given key is already present in the registry. in that case, that symbol is returned. if no symbol with the given key is found, symbol.for() will create a new global symbol. global symbol registry the global symbol registry is a list with the following record structure and it is initialized empty: a record in the global symbol registry field name value [[key]] a string key used to identify a symbol. [[symbol]] a symbol that is stored globally. examples using symbol.for symbol.for('foo'); // create a new global symbol symbol.for('foo'); // retrieve the already created symbol // same global symbol, but not locally symbol.for('bar') === symbol.for('bar'); // true symbol('bar') === symbol('bar'); // false // the k...
Symbol.unscopables - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. description the @@unscopables symbol (symbol.unscopables) can be defined on any object to exclude property names from being exposed as lexical variables in with with environment bindings. note that if using strict mode, with statements are not available and will likely also not need this symbol. ...
...copables symbol was introduced. a built-in unscopables setting is implemented as array.prototype[@@unscopables] to prevent that some of the array methods are being scoped into the with statement. var keys = []; with (array.prototype) { keys.push('something'); } object.keys(array.prototype[symbol.unscopables]); // ["copywithin", "entries", "fill", "find", "findindex", // "includes", "keys", "values"] unscopables in objects you can also set unscopables for your own objects. var obj = { foo: 1, bar: 2 }; obj[symbol.unscopables] = { foo: false, bar: true }; with (obj) { console.log(foo); // 1 console.log(bar); // referenceerror: bar is not defined } specifications specification ecmascript (ecma-262)the definition of 'symbol.unscopables' in that specifica...
TypedArray.prototype[@@iterator]() - JavaScript
the initial value of the @@iterator property is the same function object as the initial value of the values property. syntax arr[symbol.iterator]() return value the array iterator function, which is the values() function by default. ...
... function, which is the values() function by default. examples iteration using for...of loop var arr = new uint8array([10, 20, 30, 40, 50]); // your browser must support for..of loop // and let-scoped variables in for loops for (let n of arr) { console.log(n); } alternative iteration var arr = new uint8array([10, 20, 30, 40, 50]); var earr = arr[symbol.iterator](); console.log(earr.next().value); // 10 console.log(earr.next().value); // 20 console.log(earr.next().value); // 30 console.log(earr.next().value); // 40 console.log(earr.next().value); // 50 specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype[@@iterator]()' in that specification. ...
TypedArray.prototype.entries() - JavaScript
the entries() method returns a new array iterator object that contains the key/value pairs for each 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. syntax arr.entries() return value a new array iterator object. ...
...e a new array iterator object. examples iteration using for...of loop var arr = new uint8array([10, 20, 30, 40, 50]); var earray = arr.entries(); // your browser must support for..of loop // and let-scoped variables in for loops for (let n of earray) { console.log(n); } alternative iteration var arr = new uint8array([10, 20, 30, 40, 50]); var earr = arr.entries(); console.log(earr.next().value); // [0, 10] console.log(earr.next().value); // [1, 20] console.log(earr.next().value); // [2, 30] console.log(earr.next().value); // [3, 40] console.log(earr.next().value); // [4, 50] specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype.entries()' in that specification. ...
TypedArray.prototype.join() - JavaScript
like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.join([separator = ',']); parameters separator optional. specifies a string to separate each element. the separator is converted to a string if necessary. if omitted, the typed array elements are separated with a comma (","). ...
..., the typed array elements are separated with a comma (","). return value a string with all array elements joined. polyfill since there is no global object with the name typedarray, polyfilling must be done on an "as needed" basis. // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.join if (!uint8array.prototype.join) { object.defineproperty(uint8array.prototype, 'join', { value: array.prototype.join }); } if you need to support truly obsolete javascript engines that don't support object.defineproperty, it's best not to polyfill array.prototype methods at all, as you can't make them non-enumerable. examples using join var uint8 = new uint8array([1,2,3]); uint8.join(); // '1,2,3' uint8.join(' / '); // '1 / 2 / 3' uint8.join(''); // '123' specifications ...
TypedArray.prototype.keys() - JavaScript
the keys() method returns a new array iterator object that contains the keys for each 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. syntax arr.keys() return value a new array iterator object. ...
...n value a new array iterator object. examples iteration using for...of loop var arr = new uint8array([10, 20, 30, 40, 50]); var earray = arr.keys(); // your browser must support for..of loop // and let-scoped variables in for loops for (let n of earray) { console.log(n); } alternative iteration var arr = new uint8array([10, 20, 30, 40, 50]); var earr = arr.keys(); console.log(earr.next().value); // 0 console.log(earr.next().value); // 1 console.log(earr.next().value); // 2 console.log(earr.next().value); // 3 console.log(earr.next().value); // 4 specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype.keys()' in that specification. ...
TypedArray.prototype.set() - JavaScript
the set() method stores multiple values in the typed array, reading input values from a specified 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 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...
...the source array plus the offset exceeds the length of the target array, in which case an exception is thrown. typedarray if the source array is a typed array, the two arrays may share the same underlying arraybuffer; the javascript engine will intelligently copy the source range of the buffer to the destination range. offset optional the offset into the target array at which to begin writing values from the source array. if this value is omitted, 0 is assumed (that is, the source array will overwrite values in the target array starting at index 0). exceptions a rangeerror, if the offset is set such as it would store beyond the end of the typed array. examples using set() var buffer = new arraybuffer(8); var uint8 = new uint8array(buffer); uint8.set([1, 2, 3], 3); console.log(uint8)...
TypedArray.prototype.slice() - JavaScript
ot 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 (!uint8array.prot...
...ce 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 (!uint8array.prototype.slice) { object.defineproperty(uint8array.prototype, 'slice', { value: function (begin, end) { return new uint8array(array.prototype.slice.call(this, begin, end)); } }); } if you need to support truly obsolete javascript engines that don't support object.defineproperty, it's best not to polyfill array.prototype methods at all, as you can't make them non-enumerable. examples return a portion of an existing typed array const uint8 = new uint...
TypedArray.prototype.toString() - JavaScript
and its elements. this method has the same algorithm as array.prototype.tostring(). 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.tostring() return value a string representing the elements of the typed array. examples the typedarray objects override the tostring method of object. for typedarray objects, the tostring method joins the array and returns one string containing each typed array element separated by commas. for example, the following code creates a typed array and uses tostring to convert the array to a string. var numbers = new uint...
...tring method joins the array and returns one string containing each typed array element separated by commas. for example, the following code creates a typed array and uses tostring to convert the array to a string. var numbers = new uint8array([2, 5, 8, 1, 4]) numbers.tostring(); // "2,5,8,1,4" javascript calls the tostring method automatically when a typed array is to be represented as a text value or when an array is referred to in a string concatenation. compatibility if a browser doesn't support the typedarray.prototype.tostring() method yet, javascript will call the tostring method of object: var numbers = new uint8array([2, 5, 8, 1, 4]) numbers.tostring(); // "[object uint8array]" specifications specification ecmascript (ecma-262)the definition of 'array.prototy...
Uint8ClampedArray() constructor - JavaScript
the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). ...
...(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 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 ...
WeakSet.prototype.add() - JavaScript
the add() method appends a new object to the end of a weakset 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 ws.add(value); parameters value required. the object to add to the weakset collection. return value the weakset object. ...
...ractive-examples and send us a pull request. syntax ws.add(value); parameters value required. the object to add to the weakset collection. return value the weakset object. examples using add var ws = new weakset(); ws.add(window); // add the window object to the weakset ws.has(window); // true // weakset only takes objects as arguments ws.add(1); // results in "typeerror: invalid value used in weak set" in chrome // and "typeerror: 1 is not a non-null object" in firefox specifications specification ecmascript (ecma-262)the definition of 'weakset.prototype.add' in that specification. ...
WeakSet - JavaScript
the weakset object lets you store weakly held objects in a collection. description weakset objects are collections of objects. just as with sets, each object in a weakset may occur only once; all objects in a weakset's collection are unique. the main differences to the set object are: weaksets are collections of objects only. they cannot contain arbitrary values of any type, as sets can. the weakset is weak, meaning references to objects in a weakset are held weakly. if no other references to an object stored in the weakset exist, those objects can be garbage collected. note: this also means that there is no list of current objects stored in the collection. weaksets are not enumerable. use case: detecting circular references functions that call themselv...
... passed along with every subsequent function call (using the internal _refs parameter). the number of objects or their traversal order is immaterial, so a weakset is more suitable (and performant) than a set for tracking object references, especially if a very large number of objects is involved. constructor weakset() creates a new weakset object. instance methods weakset.prototype.add(value) appends value to the weakset object. weakset.prototype.delete(value) removes value from the weakset. weakset.prototype.has(value) will return false afterwards. weakset.prototype.has(value) returns a boolean asserting whether value is present in the weakset object or not. examples using the weakset object const ws = new weakset(); const foo = {}; const bar = {}; ws.add(foo); ws.add(bar...
WebAssembly.Memory() constructor - JavaScript
embly pages. maximum optional the maximum size the webassembly memory is allowed to grow to, in units of webassembly pages. when present, the maximum parameter acts as a hint to the engine to reserve memory up front. however, the engine may ignore or clamp this reservation request. unshared webassembly memories don't need to set a maximum, but shared memories do. shared optional a boolean value that defines whether the memory is a shared memory or not. if set to true, it is a shared memory. the default is false. note: a webassembly page has a constant size of 65,536 bytes, i.e., 64kib. exceptions if memorydescriptor is not of type object, a typeerror is thrown. if maximum is specified and is smaller than initial, a rangeerror is thrown. examples creating a new memory ins...
...ssembly.memory({initial:10, maximum:100}); the second way to get a webassembly.memory object is to have it exported by a webassembly module. the following example (see memory.html on github, and view it live also) fetches and instantiates the loaded memory.wasm byte code using the webassembly.instantiatestreaming() method, while importing the memory created in the line above. it then stores some values in that memory, then exports a function and uses it to sum some values. webassembly.instantiatestreaming(fetch('memory.wasm'), { js: { mem: memory } }) .then(obj => { var i32 = new uint32array(memory.buffer); for (var i = 0; i < 10; i++) { i32[i] = i; } var sum = obj.instance.exports.accumulate(0, 10); console.log(sum); }); creating a shared memory by default, webassembly memori...
WebAssembly.Memory.prototype.grow() - JavaScript
the grow() protoype method of the memory object increases the size of the memory instance by a specified number of webassembly pages. syntax memory.grow(number); parameters number the number of webassembly pages you want to grow the memory by (each one is 64kib in size). return value the previous size of the memory, in units of webassembly pages. examples using grow the following example creates a new webassembly memory instance with an initial size of 1 page (64kib), and a maximum size of 10 pages (640kib). var memory = new webassembly.memory({initial:1, maximum:10}); we can then grow the instance by one page like so: const bytesperpage = 64 * 1024; console.log(memory.buffer.bytelength / bytesperpage); // "1" console.log(memory.grow(1)); // "1" cons...
...4kib), 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.bytelength / bytesperpage); // "1" console.log(memory.grow(1)); // "1" console.log(memory.buffer.bytelength / bytesperpage); // "2" note the return value of grow() here is the previous number of webassembly pages. specifications specification webassembly javascript interfacethe definition of 'grow()' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data ...
WebAssembly.Table.prototype.get() - JavaScript
exceptions if index is greater than or equal to table.prototype.length, a rangeerror is thrown. ...
...iatestreaming() method. it then retrieves the references stored in the exported table. webassembly.instantiatestreaming(fetch('table.wasm')) .then(function(obj) { var tbl = obj.instance.exports.tbl; console.log(tbl.get(0)()); // 13 console.log(tbl.get(1)()); // 42 }); note how you've got to include a second function invocation operator at the end of the accessor to actually retrieve the value stored inside the reference (e.g. get(0)() rather than get(0)) — it is a function rather than a simple value. specifications specification webassembly javascript interfacethe definition of 'get()' 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 ch...
WebAssembly.Table - JavaScript
ct. instance properties table.prototype.length returns the length of the table, i.e. the number of elements. instance methods table.prototype.get() accessor function — gets the element stored at a given index. table.prototype.grow() increases the size of the table instance by a specified number of elements. table.prototype.set() sets an element stored at a given index to a given value. examples creating a new webassembly table instance the following example (see table2.html 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({...
...callable exported webassembly functions which we can call from js. webassembly.instantiatestreaming(fetch('table2.wasm'), importobject) .then(function(obj) { console.log(tbl.length); console.log(tbl.get(0)()); console.log(tbl.get(1)()); }); note how you've got to include a second function invocation operator at the end of the accessor to actually invoke the referenced function and log the value stored inside it (e.g. get(0)() rather than get(0)) . this example shows that we're creating and accessing the table from javascript, but the same table is visible and callable inside the wasm instance too. specifications specification webassembly javascript interfacethe definition of 'table' in that specification. browser compatibility the compatibility table on...
WebAssembly.instantiate() - JavaScript
n one step, directly from the raw bytecode, so doesn't require conversion to an arraybuffer. syntax primary overload — taking wasm binary code promise<resultobject> webassembly.instantiate(buffersource, importobject); parameters buffersource a typed array or arraybuffer containing the binary code of the .wasm module you want to compile. importobject optional an object containing the values to be imported into the newly-created instance, such as functions or webassembly.memory objects. there must be one matching property for each declared import of the compiled module or else a webassembly.linkerror is thrown. return value a promise that resolves to a resultobject which contains two fields: module: a webassembly.module object representing the compiled webassembly module. this...
...e promise rejects with a webassembly.compileerror, webassembly.linkerror, or webassembly.runtimeerror, depending on the cause of the failure. secondary overload — taking a module object instance promise<webassembly.instance> webassembly.instantiate(module, importobject); parameters module the webassembly.module object to be instantiated. importobject optional an object containing the values to be imported into the newly-created instance, such as functions or webassembly.memory objects. there must be one matching property for each declared import of module or else a webassembly.linkerror is thrown. return value a promise that resolves to an webassembly.instance object. exceptions if either of the parameters are not of the correct type or structure, a typeerror is thrown. if ...
globalThis - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of globalthis writable yes enumerable no configurable yes description historically, accessing the global object has required different syntax in different javascript environments. on the web you can use window, self, or frames - but in web workers only self will work. ...
...nstead use global. the this keyword could be used inside functions running in non–strict mode, but this will be undefined in modules and inside functions running in strict mode. you can also use function('return this')(), but environments that disable eval(), like csp in browsers, prevent use of function in this way. the globalthis property provides a standard way of accessing the global this value (and hence the global object itself) across environments. unlike similar properties such as window and self, it's guaranteed to work in window and non-window contexts. in this way, you can access the global object in a consistent manner without having to know which environment the code is being run in.to help you remember the name, just remember that in global scope the this value is globalthis. ...
Standard built-in objects - JavaScript
global object, including inherited properties, if any. other objects in the global scope are either created by the user script or provided by the host application. the host objects available in browser contexts are documented in the api reference. for more information about the distinction between the dom and core javascript, see javascript technologies overview. standard objects by category value properties these global properties return a simple value. they have no properties or methods. infinity nan undefined globalthis function properties these global functions—functions which are called globally, rather than on an object—directly return their results to the caller. eval() uneval() isfinite() isnan() parsefloat() parseint() encodeuri() encodeuricomponent() ...
... rangeerror referenceerror syntaxerror typeerror urierror numbers and dates these are the base objects representing numbers, dates, and mathematical calculations. number bigint math date text processing these objects represent strings and support manipulating them. string regexp indexed collections these objects represent collections of data which are ordered by an index value. this includes (typed) arrays and array-like constructs. array int8array uint8array uint8clampedarray int16array uint16array int32array uint32array float32array float64array bigint64array biguint64array keyed collections these objects represent collections which use keys. the iterable collections (map and set) contain elements which are easily iterated in the order of insert...
Assignment (=) - JavaScript
if 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 you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
Inequality (!=) - JavaScript
...
... ...
Logical OR assignment (||=) - JavaScript
f the logical operation would evaluate the right-hand side. in other words, x ||= y is equivalent to: x || (x = y); and not equivalent to the following which would always perform an assignment: x = x || y; note that this behavior is different to mathematical and bitwise assignment operators. examples setting default content if the "lyrics" element is empty, set the innerhtml to a default value: document.getelementbyid('lyrics').innerhtml ||= '<i>no lyrics.</i>' here the short-circuit is especially beneficial, since the element will not be updated unnecessarily and won't cause unwanted side-effects such as additional parsing or rendering work, or loss of focus, etc. note: pay attention to the value returned by the api you're checking against. if an empty string is returned (a falsy v...
...especially beneficial, since the element will not be updated unnecessarily and won't cause unwanted side-effects such as additional parsing or rendering work, or loss of focus, etc. note: pay attention to the value returned by the api you're checking against. if an empty string is returned (a falsy value), ||= must be used, otherwise you want to use the ??= operator (for null or undefined return values). specifications specification logical assignment operatorsthe definition of 'assignment operators' in that specification. ...
Pipeline operator (|>) - JavaScript
parameters expression any valid expression. function any function. examples chaining function calls the pipeline operator can improve readability when chaining several functions. ...
... parameters expression any valid expression. function any function. examples chaining function calls the pipeline operator can improve readability when chaining several functions. ...
Right shift (>>) - JavaScript
hence the name "sign-propagating". the source for this interactive example is stored in a github repository. ...
...e to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax a >> b description this operator shifts the first operand the specified number of bits to the right. excess bits shifted off to the right are discarded. copies of the leftmost bit are shifted in from the left. since the new leftmost bit has the same value as the previous leftmost bit, the sign bit (the leftmost bit) does not change. hence the name "sign-propagating". for example, 9 >> 2 yields 2: . 9 (base 10): 00000000000000000000000000001001 (base 2) -------------------------------- 9 >> 2 (base 10): 00000000000000000000000000000010 (base 2) = 2 (base 10) likewise, -9 >> 2 yields -3, because the sign is preserved: . ...
Unary plus (+) - JavaScript
tps://github.com/mdn/interactive-examples and send us a pull request. syntax operator: +x description although unary negation (-) also can convert non-numbers, unary plus is the fastest and preferred way of converting something into a number, because it does not perform any other operations on the number. it can convert string representations of integers and floats, as well as the non-string values true, false, and null. integers in both decimal and hexadecimal (0x-prefixed) formats are supported. negative numbers are supported (though not for hex). using the operator on bigint values throws a typeerror. if it cannot parse a particular value, it will evaluate to nan. examples usage with numbers const x = 1; const y = -1; console.log(+x); // 1 console.log(+y); // -1 usage with non-numb...
...ported (though not for hex). using the operator on bigint values throws a typeerror. if it cannot parse a particular value, it will evaluate to nan. examples usage with numbers const x = 1; const y = -1; console.log(+x); // 1 console.log(+y); // -1 usage with non-numbers +true // 1 +false // 0 +null // 0 +function(val){ return val } // nan +1n // throws typeerror: cannot convert bigint value to number specifications specification ecmascript (ecma-262)the definition of 'unary plus operator' in that specification. ...
in operator - JavaScript
prototype chain) contains the property with specified name (prop). examples basic usage the following examples show some uses of the in operator. ...
... returns true let trees = new array('redwood', 'bay', 'cedar', 'oak', 'maple') trees[3] = undefined 3 in trees // returns true the in operator will return false for empty array slots. even if accessing it directly returns undefined. let empties = new array(3) empties[2] // returns undefined 2 in empties // returns false to avoid this, make sure a new array is always filled with non-empty values or not write to indexes past the end of array. let empties = new array(3).fill(undefined) 2 in empties // returns true inherited properties the in operator returns true for properties in the prototype chain. (if you want to check for only non-inherited properties, use object.prototype.hasownproperty() instead.) 'tostring' in {} // returns true specifications specification ...
instanceof - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object instanceof constructor parameters object the object to test. constructor function to test against description the instanceof operator tests the presence of constructor.prototype in object's prototype chain. ...
...it can also be changed by changing an object's prototype using object.setprototypeof. it is also possible using the non-standard __proto__ property. instanceof and multiple context (e.g. frames or windows) different scopes have different execution environments. this means that they have different built-...
super - JavaScript
sample (live demo). here super() is called to avoid duplicating the constructor parts' 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'. le...
... a referenceerror. class base { constructor() {} foo() {} } class derived extends base { constructor() {} delete() { delete super.foo; // this is bad } } new derived().delete(); // referenceerror: invalid delete involving 'super'. super.prop cannot overwrite non-writable properties when defining non-writable properties with e.g. object.defineproperty, super cannot overwrite the value of the property. class x { constructor() { object.defineproperty(this, 'prop', { configurable: true, writable: false, value: 1 }); } } class y extends x { constructor() { super(); } foo() { super.prop = 2; // cannot overwrite the value. } } var y = new y(); y.foo(); // typeerror: "prop" is read-only console.log(y.prop); // 1 using super.prop in...
for...in - JavaScript
ypes further away from the object in its prototype chain). deleted, added, or modified properties a for...in loop iterates over the properties of an object in an arbitrary order (see the delete operator for more on why one cannot depend on the seeming orderliness of iteration, at least in a cross-browser setting). if a property is modified in one iteration and then visited at a later time, its value in the loop is its value at that later time. a property that is deleted before it has been visited will not be visited later. properties added to the object over which iteration is occurring may either be visited or omitted from iteration. in general, it is best not to add, modify, or remove properties from the object during iteration, other than the property currently being visited. there is no...
...ect properties, not recommended for use with arrays, and options like array.prototype.foreach() and for...of exist, what might be the use of for...in at all? it may be most practically used for debugging purposes, being an easy way to check the properties of an object (by outputting to the console or otherwise). although arrays are often more practical for storing data, in situations where a key-value pair is preferred for working with data (with properties acting as the "key"), there may be instances where you want to check if any of those keys hold a particular value. examples using for...in the for...in loop below iterates over all of the object's enumerable, non-symbol properties and logs a string of the property names and their values. var obj = {a: 1, b: 2, c: 3}; for (const prop in...
import - JavaScript
file located in /modules/my-module.js. import * as mymodule from '/modules/my-module.js'; here, accessing the exports means using the module name ("mymodule" in this case) as a namespace. for example, if the module imported above includes an export doalltheamazingthings(), you would call it like this: mymodule.doalltheamazingthings(); import a single export from a module given an object or value named myexport which has been exported from the module my-module either implicitly (because the entire module is exported) or explicitly (using the export statement), this inserts myexport into the current scope. import {myexport} from '/modules/my-module.js'; import multiple exports from module this inserts both foo and bar into the current scope. import {foo, bar} from '/modules/my-module.j...
...le exports during import import multiple exports from a module with convenient aliases. import { reallyreallylongmoduleexportname as shortname, anotherlongmodulename as short } from '/modules/my-module.js'; import a module for its side effects only import an entire module for side effects only, without importing anything. this runs the module's global code, but doesn't actually import any values. import '/modules/my-module.js'; this works with dynamic imports as well: (async () => { if (somethingistrue) { // import module for side effects await import('/modules/my-module.js'); } })(); if your project uses packages that export esm, you can also import them for side effects only. this will run the code in the package entry point file (and any files it imports) only. imp...
orientation - Web app manifests
type string mandatory no the orientation member defines the default orientation for all the website's top-level browsing contexts. note: orientation and/or its specific values might not be supported by a user agent on various display modes because supporting them does not make sense for the particular context. note: the orientation can be changed at runtime via the screen orientation api. ...
... mandatory no the orientation member defines the default orientation for all the website's top-level browsing contexts. note: orientation and/or its specific values might not be supported by a user agent on various display modes because supporting them does not make sense for the particular context. note: the orientation can be changed at runtime via the screen orientation api. values orientation can take one of the following values: any natural landscape landscape-primary landscape-secondary portrait portrait-primary portrait-secondary examples "orientation": "portrait-primary" specification specification status comment feedback web app manifestthe definition of 'orientation' in that specification. working dra...
serviceworker - Web app manifests
type object mandatory no the serviceworker member describes a service worker that the developer intends to install to control the pwa. examples "serviceworker": { "src": "./serviceworker.js", "scope": "/app", "type": "", "update_via_cache": "none" } values service worker contain the following values (only src is required): member description src the url to download the service worker script from. ...
...escription src the url to download the service worker script from. this is the only required member of the serviceworker member. scope a string representing a url that defines a service worker's registration scope; that is, what range of urls a service worker can control. this is usually a relative url, relative to the base url of the application. by default, the scope value for a service worker registration is set to the directory where the service worker script is located. type ? update_via_cache whether the user agent cache should be bypassed when fetching the service worker. ...
<maction> - MathML
the mathml <maction> element provides a possibility to bind actions to (sub-) expressions. the action itself is specified by the actiontype attribute, which accepts several values. to specify which child elements are addressed by the action, you can make use of the selection attribute. attributes actiontype the action which specifies what happens for this element. possible values are: statusline: if there is a click on the expression or the reader moves the pointer over it, the message is sent to the browser's status line. the syntax is: <maction actiontype="statusline"> expression message </maction>. toggle: when there is a click on the subexpression, the rendering alternates the display of selected subexpressions. therefore each click increments the selection value. the syntax...
...essage </maction>. 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 and also the fraction line color. you can use #rgb, #rrggbb and html color names. selection the child element which is addressed by the action. the default value is 1, which is the first child element. examples the following example uses the "toggle" actiontype: <math> <maction actiontype="toggle"> <mfrac> <mn>6</mn> <mn>8</mn> </mfrac> <mfrac> <mrow> <mn>3</mn> <mo>&sdot;</mo> <mn>2</mn> </mrow> <mrow> <mn>4</mn> <mo>&sdot;</mo> <mn>2</mn> </mrow> </mfrac> <mfrac> <mn>3</mn...
<mfenced> - MathML
ossibility to add custom opening and closing parentheses (such as brackets) and separators (such as commas or semicolons) to an expression. it has been removed from the latest mathml standard and modern browsers no longer support it. use the <mrow> and <mo> elements instead. attributes class, id, style provided for use with stylesheets. close a string for the closing delimiter. the default value is ")" and any white space is trimmed. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color and also the fraction line color. you can use #rgb, #rrggbb and html color names. open a string for the opening delimiter. the default value is "(" and any white space is trimmed. separators ...
...by specifying more than one character, it is possible to set different separators for each argument in the expression. if there are too many separators, all excess is ignored. ...
<mlabeledtr> - MathML
e on the <mtable> element). child elements of <mlabeledtr> must be <mtd> elements. the first child is the label whereas all other children are representing row contents and are treated identically to children of <mtr> elements. attributes class, id, style provided for use with stylesheets. columnalign overrides the horizontal alignment of cells specified by <mtable> for this row. ...
...ed by <mtable> for this row. possible values are: left, center and right. groupalign 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. rowalign overrides the vertical alignment of cells specified by <mtable> for this row. possible values are: axis, baseline, bottom, center and top. examples rendering: <math> <mtable> <mlabeledtr> <mtd><mn>1</mn></mtd> <!-- label --> <mtd><mi>a</mi></mtd> <mtd><mi>b</mi></mtd> </mlabeledtr> <mtr> <mtd><mi>c</mi></mtd> <mtd><mi>d</mi></mtd> <mtd><mi>e</mi></mtd> </mtr> </mtable> </math> specifications specification sta...
<mover> - MathML
Web › MathML › Element › mover
this attribute is deprecated and will be removed in the future. use css text-align instead. ...
... this attribute is deprecated and will be removed in the future. use css text-align instead. ...
<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 an...
... 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 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 "-") . pseudo-units it is possible to use the keywords "depth", "height", and "width" as a pseudo-unit for the attributes depth, height, lspace, voffset, and width. they represent each length of t...
<munder> - MathML
Web › MathML › Element › munder
this attribute is deprecated and will be removed in the future. use css text-align instead. ...
... this attribute is deprecated and will be removed in the future. use css text-align instead. ...
MathML documentation index - MathML
Web › MathML › Index
mula. 5 proving the pythagorean theorem beginner, example, guide, html5 math, math education, mathml, 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 ...
...ave arbitrary text in it which is actually a numeric quantity, for example "eleven". 21 <mo> mathml, mathml reference, mathml:element, mathml:token elements the mathml <mo> element represents an operator in a broad sense. besides operators in strict mathematical meaning, this element also includes "operators" like parentheses, separators like comma and semicolon, or "absolute value" bars. 22 <mover> mathml, mathml reference, mathml:element, mathml:script and limit schemata the mathml <mover> element is used to attach an accent or a limit over an expression. use the following syntax: <mover> base overscript </mover> 23 <mpadded> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <mpadded> element is u...
Populating the page: how browsers work - Web Performance
he first 14 kilobytes. but before anything is rendered to the screen, the html, css, and javascript have to be parsed. building the dom tree we describe five steps in the critical rendering path. the first step is processing the html markup and building the dom tree. html parsing involves tokenization and tree construction. html tokens include start and end tags, as well as attribute names and values. if the document is well-formed, parsing it is straightforward and faster. the parser parses tokenized input into the document, building up the document tree. the dom tree describes the content of the document. the <html> element is the first tag and root node of the document tree. the tree reflects the relationships and hierarchies between different tags. tags nested within other tags are chil...
..., the browser needs to convert the received css rules into something it can work with. hence, it repeats the html-to-object process, but for the css. the cssom tree includes styles from the user agent style sheet. the browser begins with the most general rule applicable to a node and recursively refines the computed styles by applying more specific rules. in other words, it cascades the property values. building the cssom is very, very fast and is not displayed in a unique color in current developer tools. rather, the "recalculate style" in developer tools shows the total time it takes to parse css, construct the cssom tree, and recursively calculate computed styles. in terms of web performance optimization, there are lower hanging fruit, as the total time to create the cssom is generally les...
Lazy loading - Web Performance
ce 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 strategies. general code splitting javascript, css and html can be split into smaller chunks. this enables sending the minimal code required to provide value upfront, improving page-load times. the rest can be loaded on demand. entry point splitting: separates code by entry point(s) in the app dynamic splitting: separates code where dynamic import() statements are used javascript script type module any script tag with type="module" is treated like a javascript module and is deferred by default. css by default, css is treated ...
..."image.jpg" loading="lazy" alt="..." /> <iframe src="video-player.html" loading="lazy"></iframe> the load event fires when the eagerly-loaded content has all been loaded; at that time, it's entirely possible (or even likely) that there may be lazily-loaded images that are within the visual viewport that haven't yet loaded. you can determine if a given image has finished loading by examining the value of its boolean complete property. polyfill include this polyfill to provide support for older and currently incompatible browsers: loading-attribute-polyfill intersection observer api intersection observers allow the user to know when an observed element enters or exits the browser’s viewport. event handlers when browser compatibility is crucial, there are a few options: polyfill inte...
How to make PWAs re-engageable using Notifications and Push - Progressive web apps (PWAs)
ing fetch. ...
... 'content-type': 'application/json' }, body: json.stringify({ subscription: subscription }), }); then the globaleventhandlers.onclick function on the subscribe button is defined: document.getelementbyid('doit').onclick = function() { const payload = document.getelementbyid('notification-payload').value; const delay = document.getelementbyid('notification-delay').value; const ttl = document.getelementbyid('notification-ttl').value; fetch('./sendnotification', { method: 'post', headers: { 'content-type': 'application/json' }, body: json.stringify({ subscription: subscription, payload: payload, delay: delay, ttl: ttl, }), }); }; when the button is cli...
SVG Conditional Processing Attributes - SVG: Scalable Vector Graphics
ntrol whether or not the element on which it appears should be rendered. externalresourcesrequired requiredextensions requiredfeatures systemlanguage attributes externalresourcesrequired deprecated since svg 2 if set to true, it indicates that the browser must wait for all the external resources necessary to render that element to be loaded before processing the associated element. ...
...ourcesrequired deprecated since svg 2 if set to true, it indicates that the browser must wait for all the external resources necessary to render that element to be loaded before processing the associated element. value: false|true; animatable: no requiredextensions list all the browser specific capabilities that must be supported by the borwser to be allowed to render the associated element. value: a list of space-separated uri; animatable: no requiredfeatures deprecated since svg 2 list all the features, as defined is the svg 1.1 specification, that must be supported by the borwser to be allowed to render the associated element.. value: a list of space-separated uri; animatable: no systemlanguage indicates which language the user must have chosen to render the associated element. va...
SVG Styling Attributes - SVG: Scalable Vector Graphics
Web › SVG › Attribute › Styling
the svg styling attributes are all the attributes that can be specified on any svg element to apply css styling effects. ...
...he attributes that can be specified on any svg element to apply css styling effects. class style attributes class assigns a class name or set of class names to an element. ...
accumulate - SVG: Scalable Vector Graphics
the accumulate attribute controls whether or not an animation is cumulative. it is frequently useful for repeated animations to build upon the previous results, accumulating with each iteration. this attribute said to the animation if the value is added to the previous animated attribute's value on each iteration. ...
... an animation is cumulative. it is frequently useful for repeated animations to build upon the previous results, accumulating with each iteration. this attribute said to the animation if the value is added to the previous animated attribute's value on each iteration. four elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, and <animatetransform> usage notes value none | sum default value none animatable no sum specifies that each repeat iteration after the first builds upon the last value of the previous iteration. none specifies that repeat iterations are not cumulative. this attribute is ignored if the target attribute value does not support addition, or if the animation element does not repeat. this attribute w...
additive - SVG: Scalable Vector Graphics
the additive attribute controls whether or not an animation is additive. it is frequently useful to define animation as an offset or delta to an attribute's value, rather than as absolute values. four elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, and <animatetransform> usage notes value replace | sum default value replace animatable no sum specifies that the animation will add to the underlying value of the attribute and other lower priority animations. ...
...ts are using this attribute: <animate>, <animatecolor>, <animatemotion>, and <animatetransform> usage notes value replace | sum default value replace animatable no sum specifies that the animation will add to the underlying value of the attribute and other lower priority animations. replace specifies that the animation will override the underlying value of the attribute and other lower priority animations. this is the default, however the behavior is also affected by the animation value attributes by and to, as described in smil animation: how from, to and by attributes affect additive behavior. specifications specification status comment svg animations level 2the definition of 'additive' in that specification. ...
attributeType - SVG: Scalable Vector Graphics
the attributetype attribute specifies the namespace in which the target attribute and its associated values are defined. ...
... elements are using this attribute: <animate>, <animatecolor>, <animatetransform>, and <set> html, body, svg { height: 100%; } <svg viewbox="0 0 250 250" xmlns="http://www.w3.org/2000/svg"> <rect x="50" y="50" width="100" height="100"> <animate attributetype="xml" attributename="y" from="0" to="50" dur="5s" repeatcount="indefinite"/> </rect> </svg> usage notes value css | xml | auto default value auto animatable no css this value specifies that the value of attributename is the name of a css property defined as animatable. xml this value specifies that the value of attributename is the name of an xml attribute defined as animatable in the default xml namespace for the target element. auto this value specifies that the...
azimuth - SVG: Scalable Vector Graphics
Web › SVG › Attribute › azimuth
working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'azimuth' in that specification. recommendation initial de...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'azimuth' in that specification. recommendation initial definition ...
by - SVG: Scalable Vector Graphics
Web › SVG › Attribute › by
the by attribute specifies a relative offset value for an attribute that will be modified during an animation. the starting value for the attribute is either indicated by specifying it as value for the attribute given in the attributename or the from attribute. ...
...ename or the from attribute. four elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, and <animatetransform> html, body, svg { height: 100%; } <svg viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" width="100" height="100"> <animate attributename="width" fill="freeze" by="50" dur="3s"/> </rect> </svg> usage notes value see below default value none animatable no the exact value type for this attribute depends on the value of the attribute that will be animated. when a list of values is defined via the values attribute, the by attribute is ignored. specifications specification status comment svg animations level 2the definition of 'by' in that speci...
calcMode - SVG: Scalable Vector Graphics
the calcmode attribute specifies the interpolation mode for the animation. the default mode is linear, however if the attribute does not support linear interpolation (e.g. for strings), the calcmode attribute is ignored and discrete interpolation is used. four elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, and <animatetransform> usage notes value discrete | linear | paced | spline default value linear animatable no discrete this specifies that the animation function will jump from one value to the next without any interpolation. linear simple linear interpolation between values is used to calculate the animation function. except for <animatemotion>, this is the default value. paced defines interpolation to pr...
...le no discrete this specifies that the animation function will jump from one value to the next without any interpolation. linear simple linear interpolation between values is used to calculate the animation function. except for <animatemotion>, this is the default value. paced defines interpolation to produce an even pace of change across the animation. this is only supported for values that define a linear numeric range, and for which some notion of "distance" between points can be calculated (e.g. position, width, height, etc.). if paced is specified, any keytimes or keysplines will be ignored. for <animatemotion>, this is the default value. spline interpolates from one value in the values list to the next according to a time function defined by a cubic bézier spline. the ...
class - SVG: Scalable Vector Graphics
Web › SVG › Attribute › class
me or names to any number of elements, however, multiple class names must be separated by whitespace characters. an element's class name serves two key roles: as a style sheet selector, for when an author assigns style information to a set of elements. for general use by the browser. you can use this class to style svg content using css. usage context categories none value <list-of-class-names> animatable yes normative document svg 1.1 (2nd edition): the class attribute list-of-ts <list-of-ts> (where t is some type.) a list consists of a separated sequence of values. unless explicitly described differently, lists within svg's xml attributes can be either comma-separated (with optional white space before or after the comma), o...
...ter the comma), or white space-separated. white space in lists is defined as one or more of the following consecutive characters: "space" (u+0020), "tab" (u+0009), "line feed" (u+000a), "carriage return" (u+000d), and "form-feed" (u+000c). the following is a template for an ebnf grammar describing the <list-of-ts> syntax: list-of-ts ::= t | t, list-of-ts within the svg dom, values of a <list-of-ts> type are represented by an interface specific for the particular type t. for example, a <list-of-lengths> is represented in the svg dom using an svglengthlist or svganimatedlengthlist 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...
clip-path - SVG: Scalable Vector Graphics
y="11" width="8" height="8" stroke="green" clip-path="circle() stroke-box" /> <!-- bottom-right: apply a css basic shape on a view-box geometry. ...
...e-box" /> <!-- bottom-right: apply a css basic shape on a view-box geometry. this is the same as having a custom clipping path with a clippathunits set to userspaceonuse --> <rect x="11" y="11" width="8" height="8" stroke="green" clip-path="circle() view-box" /> </svg> usage notes value <url> | [ <basic-shape> || <geometry-box> ] | none default value none animatable yes <geometry-box> an extra information to tell how a <basic-shape> is applied to an element: fill-box indicates to use the object bounding box; stroke-box indicates to use the object bounding box extended with the stroke; view-box indicates to use the nearest svg viewport as the reference box. note: for more details on the clip-path syntax, see the css ...
direction - SVG: Scalable Vector Graphics
the direction attribute specifies the inline-base direction of a <text> or <tspan> element. it defines the start and end points of a line of text as used by the text-anchor and inline-size properties. it also may affect the direction in which characters are positioned if the unicode-bidi property's value is either embed or bidi-override. it applies only to glyphs oriented perpendicular to the inline-base direction, which includes the usual case of horizontally-oriented latin or arabic text and the case of narrow-cell latin or arabic characters rotated 90 degrees clockwise relative to a top-to-bottom inline-base direction. in many cases, the bidirectional unicode algorithm produces the desired result automatically, so this attribute doesn't need to be specified in those cases. for other cases...
...nly has effect on shapes and text context elements, including: <altglyph>, <textpath>, <text>, <tref>, and <tspan>. html, body, svg { height: 100%; } <svg viewbox="0 0 600 72" xmlns="http://www.w3.org/2000/svg" direction="rtl" lang="fa"> <text x="300" y="50" text-anchor="middle" font-size="36">داستان svg 1.1 se طولا ني است.</text> </svg> usage notes value ltr | rtl default value ltr animatable yes specifications specification status comment css writing modes module level 3the definition of 'direction' in that specification. proposed recommendation definition in css scalable vector graphics (svg) 2the definition of 'direction' in that specification. candidate recommend...
elevation - SVG: Scalable Vector Graphics
working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'elevation' in that specification. recommendation initia...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'elevation' in that specification. recommendation initial definition ...
filterRes - SVG: Scalable Vector Graphics
the filterres attribute indicates the width and height of the intermediate images in pixels of a filter primitive. take care when assigning a non-default value to this attribute. too small of a value may result in unwanted pixelation in the result. too large of a value may result in slow processing and large memory usage. note that negative values or zero values disable the rendering of the element which referenced the filter. ...
...ive. take care when assigning a non-default value to this attribute. too small of a value may result in unwanted pixelation in the result. too large of a value may result in slow processing and large memory usage. note that negative values or zero values disable the rendering of the element which referenced the filter. only one element is using this attribute: <filter> usage notes value <number-optional-number> default value none animatable yes <number-optional-number> this value takes one or two values, the first one outlining the resolution in horizontal direction, the second one in vertical direction. if only one value is specified, it is used for both directions. specifications specification status comment s...
font-family - SVG: Scalable Vector Graphics
specifications specification status comment css fo...
...0 200 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-family="arial, helvetica, sans-serif">sans serif</text> <text x="100" y="20" font-family="monospace">monospace</text> </svg> usage notes value [ <family-name> | <generic-family> ]#where <family-name> = <string> | <custom-ident>+<generic-family> = serif | sans-serif | cursive | fantasy | monospace default value depends on user agent animatable yes for a description of the values, please refer to the css font-family property. specifications specification status comment css fonts module level 4the definition of 'generic font families' in that specification. working draft adds new generic font families, specifically: system-ui, emoji, math, and fang...
font-size-adjust - SVG: Scalable Vector Graphics
note: as a presentation attribute, font-size-adjust can be used as a css property. see the css font-size-adjust property for more information. ...
.... </text> <text y="40" font-family="verdana, sans-serif" font-size="10px"> this text uses the verdana font (10px), which has relatively large lowercase letters. </text> <text y="60" font-family="times, serif" font-size="10px" font-size-adjust="0.58"> this is the 10px times, but now adjusted to the same aspect ratio as the verdana. </text> </svg> usage notes default value none value none | <number> animatable yes none choose the size of the font based only on the font-size property. <number> choose the size of the font so that its lowercase letters (as determined by the x-height of the font) are the specified number times the font-size. the number specified should generally be the aspect ratio (ratio of x-height to font s...
font-stretch - SVG: Scalable Vector Graphics
unt of condensing or expansion in the glyphs used to render the text. note: as a presentation attribute, font-stretch can be used as a css property. see the css font-stretch property for more information. ...
...ibute, it can be applied to any element but it has effect only on the following eight elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> usage notes value <font-stretch-absolute>where <font-stretch-absolute> = normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | <percentage> default value normal animatable yes specifications specification status comment css fonts module level 4the definition of 'font-stretch' in that specification. working draft adds the <percentage> syntax for variable fonts. css fonts module level 3the definition of 'font-stretch' in that specification. candidate recommendation initial defin...
font-variant - SVG: Scalable Vector Graphics
n be applied to any element but it has effect only on the following eight elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 250 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-variant="normal">normal text</text> <text x="100" y="20" font-variant="small-caps">small-caps text</text> </svg> usage notes value normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> || stylistic( <feature-value-name> ) || historical-forms || styleset( <feature-value-name># ) || character-variant( <feature-value-name># ) || swash( <feature-value-name> ) || ornaments( <feature-value-name> ) || annotation( <feature-value-name> ) || [ small-caps | all...
...l-lig-values> || <contextual-alt-values> || stylistic( <feature-value-name> ) || historical-forms || styleset( <feature-value-name># ) || character-variant( <feature-value-name># ) || swash( <feature-value-name> ) || ornaments( <feature-value-name> ) || annotation( <feature-value-name> ) || [ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ] || <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero || <east-asian-variant-values> || <east-asian-width-values> || ruby ] default value normal animatable yes for a description of the values, please refer to the css font-variant property. specifications specification status comment css fonts module l...
format - SVG: Scalable Vector Graphics
Web › SVG › Attribute › format
the format attribute indicates the format of the given font. two elements are using this attribute: <altglyph> and <glyphref> context notes value <string> default value none animatable no <string> this value specifies the format of the given font. ...
... the format attribute indicates the format of the given font. two elements are using this attribute: <altglyph> and <glyphref> context notes value <string> default value none animatable no <string> this value specifies the format of the given font. ...
from - SVG: Scalable Vector Graphics
Web › SVG › Attribute › from
the from attribute indicates the initial value of the attribute that will be modified during the animation. when used with the to attribute, the animation will change the modified attribute from the from value to the to value. when used with the by attribute, the animation will change the attribute relatively from the from value by the value specified in by. ...
...y the value specified in by. four elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, and <animatetransform> html, body, svg { height: 100%; } <svg viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" height="100"> <animate attributename="width" fill="freeze" from="100" to="150" dur="3s"/> </rect> </svg> usage notes value see below default value none animatable no the exact value type for this attribute depends on the value of the attribute that will be animated. when a list of values is defined via the values attribute, the from attribute is ignored. specifications specification status comment svg animations level 2the definition of 'from' in that s...
glyph-orientation-vertical - SVG: Scalable Vector Graphics
e horizontal metrics of the glyph. this attribute is applied only to text written in a vertical writing-mode. note: as a presentation attribute, glyph-orientation-vertical can be used as a css property. as a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <altglyph>, <textpath>, <text>, <tref>, and <tspan> context notes value auto | <angle> default value auto animatable no auto fullwidth ideographic and fullwidth latin text will be set with a glyph orientation of 0 degrees. ideographic punctuation and other ideographic characters having alternate horizontal and vertical forms will use the vertical form of the glyph. text which is not fullwidth will be set with a glyph orientation...
...reordering common to the language and script. (this presentation form does not disable auto-ligature formation or similar context-driven variations.) the determination of which characters should be auto-rotated may vary across user agents. the determination is based on a complex interaction between country, language, script, character properties, font, and character context. <angle> the value of the angle is restricted to 0, 90, 180, and 270 degrees. if another angle is specified, it is rounded to the closest of the permitted values. a value of 0deg indicates that all glyphs are set with the top of the glyphs oriented towards the reference orientation. a value of 90deg indicates an orientation of 90 degrees clockwise from the reference orientation. specifications speci...
horiz-adv-x - SVG: Scalable Vector Graphics
the horiz-adv-x attribute indicates the horizontal advance after rendering a glyph in horizontal orientation. three elements are using this attribute: <font>, <glyph>, and <missing-glyph> font for <font> elements, horiz-adv-x specifies the default horizontal advance of a glyph in horizontal orientation. value <number> default value none animatable no <number> this value indicates the horizontal advance of the glyph. ...
...ecifies the default horizontal advance of a glyph in horizontal orientation. value <number> default value none animatable no <number> this value indicates the horizontal advance of the glyph. glyph, missing-glyph for <glyph> and <missing-glyph> elements, horiz-adv-x specifies the horizontal advance of the glyph in horizontal orientation. value <number> default value <font>ʼs horiz-adv-x value animatable no <number> this value indicates the horizontal advance of the glyph. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'horiz-adv-x for <glyph> and <missing-glyph>' in that specification. recommendation...
intercept - SVG: Scalable Vector Graphics
working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'intercept' in that specification. recommendation initia...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'intercept' in that specification. recommendation initial definition ...
kernelMatrix - SVG: Scalable Vector Graphics
the number of entries in the list must equal to <orderx> by <ordery> as defined in the order attribute. ...
...1 0 0 0 0 0 0 0 1"/> </filter> <image xlink:href="//developer.mozilla.org/files/6457/mdn_logo_only_color.png" width="200" height="200" style="filter:url(#convolvematrix1);"/> <image xlink:href="//developer.mozilla.org/files/6457/mdn_logo_only_color.png" width="200" height="200" style="filter:url(#convolvematrix2); transform:translatex(220px);"/> </svg> usage notes value <list of numbers> default value none animatable yes <list of numbers> the list of <number>s that make up the kernel matrix for the convolution. values are separated by space characters and/or a comma. the number of entries in the list must equal <orderx> times <ordery>. if the result of orderx * ordery is not equal to the the number of entries in the value...
limitingConeAngle - SVG: Scalable Vector Graphics
working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'limitingconeangle' in that specification. recommen...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'limitingconeangle' in that specification. recommendation initial definition ...
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 ...
... scalable vector graphics (svg) 1.1 (second edition)the definition of 'markerheight' in that specification. ...
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 comme...
... scalable vector graphics (svg) 1.1 (second edition)the definition of 'markerwidth' in that specification. ...
maskContentUnits - SVG: Scalable Vector Graphics
" xlink:href="#r1" fill="red" /> <use mask="url(#mymask1)" xlink:href="#r2" fill="red" /> <use mask="url(#mymask1)" xlink:href="#r3" fill="red" /> <!-- the last rect is masked with objectboundingbox units --> <use mask="url(#mymask2)" xlink:href="#r4" fill="red" /> </svg> mask for <mask>, maskcontentunits defines the coordinate system in use for the content of the element. ...
...xlink:href="#r2" fill="red" /> <use mask="url(#mymask1)" xlink:href="#r3" fill="red" /> <!-- the last rect is masked with objectboundingbox units --> <use mask="url(#mymask2)" xlink:href="#r4" fill="red" /> </svg> mask for <mask>, maskcontentunits defines the coordinate system in use for the content of the element. value userspaceonuse | objectboundingbox default value userspaceonuse animatable yes userspaceonuse this value indicates that all coordinates inside the <mask> element refer to the user coordinate system as defined when the mask was created. objectboundingbox this value indicates that all coordinates inside the <mask> element are relative to the bounding box of the element the mask is applied to. a bounding box could be con...
onclick - SVG: Scalable Vector Graphics
Web › SVG › Attribute › onclick
candidate recommendation no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'onclick' in that specification. recommenda...
... candidate recommendation no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'onclick' in that specification. recommendation initial definition ...
path - SVG: Scalable Vector Graphics
Web › SVG › Attribute › path
75,50"> quick brown fox jumps over the lazy dog. </textpath> </text> </svg> animatemotion for <animatemotion>, path defines the motion path, expressed in the same format and interpreted the same way as the d geometric property for the <path> element. the effect of a motion path animation is a translation along the x- and y-axes of the current user coordinate system by the x and y values computed over time. value <path-data> default value none animatable no <path-data> this value defines the motion path along which the referenced element is animated. for detailed information about the commands that can be used, see the explanation for the d attribute. textpath for <textpath>, path defines the path onto which the glyphs of a <text...
...e. textpath for <textpath>, path defines the path onto which the glyphs of a <text> element will be rendered. an empty string indicates that there is no path data for the element. this means that the text within the <textpath> element does not render or contribute to the bounding box of the <text> element. if the attribute is not specified, the path specified in href is used instead. value <path-data> default value path specified in href animatable yes <path-data> this value defines the text path along which the glyphs of the <text> element are aligned. for detailed information about the commands that can be used, see the explanation for the d attribute. specifications specification status comment scalable vector g...
pointsAtX - SVG: Scalable Vector Graphics
working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'pointsatx' in that specification. recommendation initial defini...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'pointsatx' in that specification. recommendation initial definition ...
pointsAtY - SVG: Scalable Vector Graphics
working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'pointsaty' in that specification. recommendation initial defini...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'pointsaty' in that specification. recommendation initial definition ...
pointsAtZ - SVG: Scalable Vector Graphics
working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'pointsatz' in that specification. recommendation initial defini...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'pointsatz' in that specification. recommendation initial definition ...
r - SVG: Scalable Vector Graphics
Web › SVG › Attribute › r
<circle cx="150" cy="50" r="25"/> <circle cx="250" cy="50" r="50"/> <rect x="20" 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 gradien...
...e> 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 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. cand...
requiredExtensions - SVG: Scalable Vector Graphics
the requiredextensions attribute defines a list of required language extensions. language extensions are capabilities within a user agent that go beyond the feature set defined in this specification. each extension is identified by an url reference. usage notes value <list-of-extensions> default value none animatable no <list-of-extensions> the value is a list of references (iri references in svg 1, url references in svg 2) which identify the required extensions, with the individual values separated by white space. determines whether all of the named extensions are supported by the user agent. if all of the given extensions are supported, then the attribute evaluates to true; otherwise, the current element and its children are skipped and thus ...
...element or not. note: if several extension reference objects are enclosed in a <switch> and none of them matches, this may lead to situations where no content is displayed. it is thus recommended to include a "catch-all" choice at the end of such a <switch> which is acceptable in all cases. if the attribute is not present, then it implicitly evaluates to "true". if a null string or empty string value is given, the attribute evaluates to "false". the iri names for the extension should include versioning information, such as "http://example.org/svgextensionxyz/1.0", so that script writers can distinguish between different versions of a given extension. specifications specification status comment scalable vector graphics (svg) 2the definition of 'requiredextensions...
restart - SVG: Scalable Vector Graphics
Web › SVG › Attribute › restart
after the active end). attempts to restart the animation during its active duration are ignored. never this val...
...0" to="100" dur="5s" repeatcount="1" restart="whennotactive"/> </rect> <a id="restart"><text y="20">restart animation</text></a> </svg> document.getelementbyid("restart").addeventlistener("click", evt => { document.queryselectorall("animate").foreach(element => { element.beginelement(); }); }); usage notes value always | whennotactive | never default value always animatable no always this value indicates that the animation can be restarted at any time. whennotactive this value indicates that the animation can only be restarted when it is not active (i.e. after the active end). attempts to restart the animation during its active duration are ignored. never this value indicates that the animation cannot be restarted for t...
shape-rendering - SVG: Scalable Vector Graphics
has effect only on the following seven elements: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, and <rect> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <circle cx="100" cy="100" r="100" shape-rendering="geometricprecision"/> <circle cx="320" cy="100" r="100" shape-rendering="crispedges"/> </svg> usage notes value auto | optimizespeed | crispedges | geometricprecision default value auto animatable yes auto this value indicates that the user agent shall make appropriate tradeoffs to balance speed, crisp edges and geometric precision, but with geometric precision given more importance than speed and crisp edges. optimizespeed this value indicates that the user agent sha...
...nt shall make appropriate tradeoffs to balance speed, crisp edges and geometric precision, but with geometric precision given more importance than speed and crisp edges. optimizespeed this value indicates that the user agent shall emphasize rendering speed over geometric precision and crisp edges. this option will sometimes cause the user agent to turn off shape anti-aliasing. crispedges this value indicates that the user agent shall attempt to emphasize the contrast between clean edges of artwork over rendering speed and geometric precision. to achieve crisp edges, the user agent might turn off anti-aliasing for all lines and curves or possibly just for straight lines which are close to vertical or horizontal. also, the user agent might adjust line positions and line widths to align edges ...
specularExponent - SVG: Scalable Vector Graphics
the specularexponent attribute controls the focus for the light source. the bigger the value the brighter the light. two elements are using this attribute: <fespecularlighting> and <fespotlight> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="diffuselighting1" x="0" y="0" width="100%" height="100%"> <fespecularlighting in="sourcegraphic" specularexponent="1"> <fepointlight x="60" y="60" z="20" /> </fespecularlighting> </filter> <filter id="diffuselighting2" x="0" y="0" width="100%" height="100%"> <fespecularlighting in="sourcegraphic" specularexponent="5"> <fepointlight x="60" y="60" z="20" /> </fespecularlighting> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#...
...nent="5"> <fepointlight x="60" y="60" z="20" /> </fespecularlighting> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting2); transform: translatex(220px);" /> </svg> fespecularlighting for <fespecularlighting>, specularexponent defines the exponent value for the specular term. value <number> default value 1 animatable yes fespotlight for <fespotlight>, specularexponent defines the exponent value controlling the focus for the light source. value <number> default value 1 animatable yes specifications specification status comment fil...
startOffset - SVG: Scalable Vector Graphics
troke="red" 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 ...
... 0 animatable yes <length-percentage> a length represents a distance along the path measured in the current user coordinate system for the <textpath> element. if a percentage is given, then the start offset represents a percentage distance along the entire path. thus, 0% indicates the start point of the path and 100% indicates the end point of the path. <number> this value indicates a distance along the path measured in the current user coordinate system for the <textpath> element. note: negative values and values larger than the path length (e.g. 150%) are allowed. specifications specification status comment scalable vector graphics (svg) 2the definition of 'startoffset' in that specification. candidate recommendation no cha...
stdDeviation - SVG: Scalable Vector Graphics
width="160%" height="160%"> <fegaussianblur stddeviation="10" /> </filter> <circle cx="100" cy="100" r="50" style="filter: url(#gaussianblur1);" /> <circle cx="100" cy="100" r="50" style="filter: url(#gaussianblur2); transform: translatex(140px);" /> <circle cx="100" cy="100" r="50" style="filter: url(#gaussianblur3); transform: translatex(280px);" /> </svg> usage notes value <number-optional-number> default value 0 animatable yes <number-optional-number> if two numbers are provided, the first number represents a standard deviation value along the x-axis. the second value represents a standard deviation along the y-axis. if one number is provided, then that value is used for both x and y. a negative value is forbidden. a value o...
... specifications specification status comment filter effects module level 1the definition of 'stddeviation' in that specification. ...
stitchTiles - SVG: Scalable Vector Graphics
rm: translate(220px, 0);" /> <rect x="0" y="0" width="100" height="100" style="filter: url(#noise2); transform: translate(320px, 0);" /> <rect x="0" y="0" width="100" height="100" style="filter: url(#noise2); transform: translate(220px, 100px);" /> <rect x="0" y="0" width="100" height="100" style="filter: url(#noise2); transform: translate(320px, 100px);" /> </svg> usage notes value nostitch | stitch default value nostitch animatable yes nostitch this value indicates that no attempt is made to achieve smooth transitions at the border of tiles which contain a turbulence function. sometimes the result will show clear discontinuities at the tile borders. stitch this value indicates that the user agent will automatically adjust the x and y ...
... nostitch | stitch default value nostitch animatable yes nostitch this value indicates that no attempt is made to achieve smooth transitions at the border of tiles which contain a turbulence function. sometimes the result will show clear discontinuities at the tile borders. stitch this value indicates that the user agent will automatically adjust the x and y values of the base frequency such that the <feturbulence> node’s width and height (i.e., the width and height of the current subregion) contain an integral number of the tile width and height for the first octave. specifications specification status comment filter effects module level 1the definition of 'stitchtiles' in that specification. working draft no change ...
stop-color - SVG: Scalable Vector Graphics
the stop-color attribute indicates what color to use at a gradient stop. note: with respect to gradients, svg treats the transparent keyword differently than css. svg does not calculate gradients in pre-multiplied space, so transparent really means transparent black. so, specifying a stop-color with the value transparent is equivalent to specifying a stop-color with the value black and a stop-opacity with the value 0. ...
...means transparent black. so, specifying a stop-color with the value transparent is equivalent to specifying a stop-color with the value black and a stop-opacity with the value 0. note: as a presentation attribute, stop-color can be used as a css property. as a presentation attribute, it can be applied to any element but it has effect only on the following element: <stop> usage notes value currentcolor | <color> <icccolor> default value black animatable yes currentcolor this keyword denotes the current fill color and can be specified in the same manner as within a <paint> specification for the fill and stroke attributes. <color> this value indicates a color value. <icccolor> this value refers to an icc color profile. specifications ...
stop-opacity - SVG: Scalable Vector Graphics
the stop-opacity attribute defines the opacity of a given color gradient stop. the opacity value used for the gradient calculation is the product of the value of stop-opacity and the opacity of the value of the stop-color attribute. for stop-color values that donʼt include explicit opacity information, the opacity is treated as 1. note: as a presentation attribute, stop-opacity can be used as a css property. as a presentation attribute, it can be applied to any element but it has effect only on the following element: <stop> usage notes value <opacity-value> default value 1 animatable yes <opacity-value> this value is either a <number> between 0 and 1 or a <percentage> value specifying the opacity of the color gradient stop. specifications ...
... scalable vector graphics (svg) 1.1 (second edition)the definition of 'stop-opacity' in that specification. ...
target - SVG: Scalable Vector Graphics
Web › SVG › Attribute › target
ref="https://developer.mozilla.org" target="_self"> <text x="0" y="20">open link within iframe</text> </a> <a href="https://developer.mozilla.org" target="_blank"> <text x="0" y="60">open link in new tab or window</text> </a> <a href="https://developer.mozilla.org" target="_top"> <text x="0" y="100">open link in this tab or window</text> </a> </svg> usage notes value _self | _parent | _top | _blank | <xml-name> default value _self animatable yes _replace the current svg image is replaced by the linked content in the same rectangular area in the same frame as the current svg image. note: this value was never well implemented, and the distinction between _replace and _self has been made redundant by changes in the ht...
... a name). the name must be a valid xml name [xml11], and should not start with an underscore (u+005f low line character), to meet the requirements of a valid browsing context name from html. specifications specification status comment scalable vector graphics (svg) 2the definition of 'target' in that specification. candidate recommendation removed the _replace value. scalable vector graphics (svg) 1.1 (second edition)the definition of 'target' in that specification. recommendation initial definition ...
text-rendering - SVG: Scalable Vector Graphics
tation attribute, it can be applied to any element but it has effect only on the following element: <text> html, body, svg { height: 100%; } <svg viewbox="0 0 140 40" xmlns="http://www.w3.org/2000/svg"> <text y="15" text-rendering="geometricprecision">geometric precision</text> <text y="35" text-rendering="optimizelegibility">optimized legibility</text> </svg> usage notes value auto | optimizespeed | optimizelegibility | geometricprecision default value auto animatable yes auto this value indicates that the user agent shall make appropriate tradeoffs to balance speed, legibility and geometric precision, but with legibility given more importance than speed and geometric precision. optimizespeed this value indicates that the user age...
...ll make appropriate tradeoffs to balance speed, legibility and geometric precision, but with legibility given more importance than speed and geometric precision. optimizespeed this value indicates that the user agent shall emphasize rendering speed over legibility and geometric precision. this option will sometimes cause some user agents to turn off text anti-aliasing. optimizelegibility this value indicates that the user agent shall emphasize legibility over rendering speed and geometric precision. the user agent will often choose whether to apply anti-aliasing techniques, built-in font hinting or both to produce the most legible text. geometricprecision this value indicates that the user agent shall emphasize geometric precision over legibility and rendering speed. this option will usua...
transform - SVG: Scalable Vector Graphics
d to use it: <a>, <circle>, <clippath>, <defs>, <ellipse>, <foreignobject>, <g>, <image>, <line>, <path>, <polygon>, <polyline>, <rect>, <switch>, <text>, and <use>). also, as a legacy from svg 1.1, <lineargradient> and <radialgradient> support the gradienttransform attribute, and <pattern> supports the patterntransform attribute, both of which act exactly like the transform attribute. value <transform-list> default value none animatable yes transform functions the following transform functions can be used by the transform attribute <transform-list> warning: as per the spec, you should be able to also use css transform functions. however, the compatibility isn't guaranteed. matrix the matrix(<a> <b> <c> <d> <e> <f>) transform function specifies a...
...nimatable yes transform functions the following transform functions can be used by the transform attribute <transform-list> warning: as per the spec, you should be able to also use css transform functions. however, the compatibility isn't guaranteed. matrix the matrix(<a> <b> <c> <d> <e> <f>) transform function specifies a transformation in the form of a transformation matrix of six values. matrix(a,b,c,d,e,f) is equivalent to applying the transformation matrix:(acebdf001)\begin{pmatrix} a & c & e \\ b & d & f \\ 0 & 0 & 1 \end{pmatrix} which maps coordinates from a previous coordinate system into a new coordinate system by the following matrix equalities:(xnewcoordsysynewcoordsys1)=(acebdf001)(xprevcoordsysyprevcoordsys1)=(axprevcoordsys+cyprevcoordsys+ebxprevcoordsys+dyprevcoord...
u1 - SVG: Scalable Vector Graphics
Web › SVG › Attribute › u1
to the description of the unicode attribute of the <glyph> element for a description of how to express individual unicode characters) and/or ranges of unicode characters, which identify a set of possible first glyphs in a kerning pair. if a given unicode character within the set has multiple corresponding <glyph> elements (i.e., there are multiple <glyph> elements with the same unicode attribute value but different glyph-name values), then all such glyphs are included in the set. comma is the separator character; thus, to kern a comma, specify the comma as part of a range of unicode characters or as a glyph name using the g1 attribute. the total set of possible first glyphs in the kerning pair is the union of glyphs specified by the u1 and g1 attributes. two elements are using this attribute:...
...ch glyphs are included in the set. comma is the separator character; thus, to kern a comma, specify the comma as part of a range of unicode characters or as a glyph name using the g1 attribute. the total set of possible first glyphs in the kerning pair is the union of glyphs specified by the u1 and g1 attributes. two elements are using this attribute: <hkern> and <vkern> context notes value [ <character> | <urange> ]# default value none animatable no [ <character> | <urange> ]# this value indicates a comma-separated sequence of unicode characters and/or ranges of unicode characters, which identify a set of possible first glyphs in a kerning pair. specifications specification status comment scalable vector graphi...
u2 - SVG: Scalable Vector Graphics
Web › SVG › Attribute › u2
o the description of the unicode attribute of the <glyph> element for a description of how to express individual unicode characters) and/or ranges of unicode characters, which identify a set of possible second glyphs in a kerning pair. if a given unicode character within the set has multiple corresponding <glyph> elements (i.e., there are multiple <glyph> elements with the same unicode attribute value but different glyph-name values), then all such glyphs are included in the set. comma is the separator character; thus, to kern a comma, specify the comma as part of a range of unicode characters or as a glyph name using the g2 attribute. the total set of possible second glyphs in the kerning pair is the union of glyphs specified by the u2 and g2 attributes. two elements are using this attribute...
...h glyphs are included in the set. comma is the separator character; thus, to kern a comma, specify the comma as part of a range of unicode characters or as a glyph name using the g2 attribute. the total set of possible second glyphs in the kerning pair is the union of glyphs specified by the u2 and g2 attributes. two elements are using this attribute: <hkern> and <vkern> context notes value [ <character> | <urange> ]# default value none animatable no [ <character> | <urange> ]# this value indicates a comma-separated sequence of unicode characters and/or ranges of unicode characters, which identify a set of possible second glyphs in a kerning pair. specifications specification status comment scalable vector graph...
xChannelSelector - SVG: Scalable Vector Graphics
g this keyword specifies that the green color channel of the input image defined in in2 will be used to displace the pixels of the input image...
... g this keyword specifies that the green color channel of the input image defined in in2 will be used to displace the pixels of the input image defined in in along the x-axis. b thi...
xml:lang - SVG: Scalable Vector Graphics
mark up the natural human language that an element contains. there is also a lang attribute (without namespace). if both of them are defined, the one with namespace is used and the one without is ignored. all elements are using this attribute. ...
...n element contains. there is also a lang attribute (without namespace). if both of them are defined, the one with namespace is used and the one without is ignored. all elements are using this attribute. <svg viewbox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> <text xml:lang="en-us">this is some english text</text> </svg> usage notes value <language-tag> default value none animatable no <language-tag> this value specifies the language used for the element. the syntax of this value is defined in the bcp 47 specification. the most common syntax is a value formed by a lowercase two-character part for the language and an uppercase two-character part for the region or country, separated by a minus sign, e.g. en-us for us english or de-a...
yChannelSelector - SVG: Scalable Vector Graphics
g this keyword specifies that the green color channel of the input image defined in in2 will be used to displace the pixels of the input image...
... g this keyword specifies that the green color channel of the input image defined in in2 will be used to displace the pixels of the input image defined in in along the y-axis. b thi...
zoomAndPan - SVG: Scalable Vector Graphics
recommendation initial definition ...
... recommendation initial definition ...
SVG Attribute reference - SVG: Scalable Vector Graphics
Web › SVG › Attribute
ing slope spacing specularconstant specularexponent speed spreadmethod startoffset 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 textlength 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...
...-opacity, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, text-anchor, text-decoration, text-rendering, transform, transform-origin, unicode-bidi, vector-effect, visibility, word-spacing, writing-mode filters attributes filter primitive attributes height, result, width, x, y transfer function attributes type, tablevalues, slope, intercept, amplitude, exponent, offset animation attributes animation attribute target attributes attributetype, attributename animation timing attributes begin, dur, end, min, max, restart, repeatcount, repeatdur, fill animation value attributes calcmode, values, keytimes, keysplines, from, to, by, autoreverse, accelerate, decelerate animation addition attributes additive, accu...
<clipPath> - SVG: Scalable Vector Graphics
Web › SVG › Element › clipPath
d of the referencing element) must remain the same as if it were not clipped. by default, pointer-events are not dispatched on clipped regions. for example, a circle with a radius of 10 which is clipped to a circle with a radius of 5 will not receive "click" events outside the smaller radius. attributes clippathunits defines the coordinate system for the contents of the <clippath> element. ...
...f it were not clipped. by default, pointer-events are not dispatched on clipped regions. for example, a circle with a radius of 10 which is clipped to a circle with a radius of 5 will not receive "click" events outside the smaller radius. attributes clippathunits defines the coordinate system for the contents of the <clippath> element. ...
<feFlood> - SVG: Scalable Vector Graphics
Web › SVG › Element › feFlood
scalable vector graphics (svg) 1.1 (second edition)the definition of '<feflood>' in that specification. recommendation initial definition ...
...ity="0.5"/> </filter> </defs> <use style="filter: url(#floodfilter);"/> </svg> result specifications specification status comment filter effects module level 1the definition of '<feflood>' in that specification. working draft removed <icccolor> value from flood-color property and defined that the alpha channel of it gets multiplied with the computed value of the flood-opacity property. clarified value of flood-opacity property. scalable vector graphics (svg) 1.1 (second edition)the definition of '<feflood>' in that specification. recommendation initial definition ...
<polyline> - SVG: Scalable Vector Graphics
Web › SVG › Element › polyline
example of a polyline with the default fill --> <polyline points="0,100 50,25 50,75 100,0" /> <!-- example of the same polyline shape with stroke and no fill --> <polyline points="100,100 150,25 150,75 200,0" fill="none" stroke="black" /> </svg> attributes points this attribute defines the list of points (pairs of x,y absolute coordinates) required to draw the polyline value type: <number>+ ; default value: ""; animatable: yes pathlength this attribute lets specify the total length for the path, in user units. value type: <number> ; default value: none; animatable: yes global attributes core attributes most notably: id, tabindex styling attributes class, style conditional processing attributes most notably: requiredextensions, systemlanguage event attri...
...bed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<polyline>' in that specification. ...
SVG animation with SMIL - SVG: Scalable Vector Graphics
ng an svg element like <animate> inside the svg element to animate. below are examples for the four different ways. animating attributes of an element the following example animates the cx attribute of a circle. to do so, we add an <animate> element inside the <circle> element. the important attributes for <animate> are: attributename the name of the attribute to animate. from the initial value of the attribute. to the final value. dur the duration of the animation (for example, write '5s' for 5 seconds). if you want to animate more attributes inside the same element, just add more <animate> elements. <svg width="300" height="100"> <title>attribute animation with smil</title> <rect x="0" y="0" width="300" height="100" stroke="black" stroke-width="1" /> <circle cx="0" cy="50...
... and over again, indefinitely. the animation here is handled by the <animatemotion> element. in this case, we're establishing a path consisting of a moveto command to establish the starting point for the animation, then the horizontal-line command to move the circle 300 pixels to the right, followed by the z command, which closes the path, establishing a loop back to the beginning. by setting the value of the repeatcount attribute to indefinite, we indicate that the animation should loop forever, as long as the svg image exists. <svg xmlns="http://www.w3.org/2000/svg" width="300" height="100"> <title>svg smil animate with path</title> <rect x="0" y="0" width="300" height="100" stroke="black" stroke-width="1" /> <circle cx="0" cy="50" r="15" fill="blue" stroke="black" stroke-width="1"> ...
Texts - SVG: Scalable Vector Graphics
Web › SVG › Tutorial › Texts
section of the tutorial, while we will focus completely on the first part: bringing text into an svg image. basics we have seen in the introducing example, that the text element can be used to put arbitrary text in svg documents: <text x="10" y="10">hello world!</text> the x and y attributes determine, where in the viewport the text will appear. the attribute text-anchor, which can have the values "start", "middle", "end" or "inherit", decides in which direction the text flows from this point. the attribute dominant-baseline decides the vertical alignment. like with the shape elements text can be colorized with the fill attribute and given a stroke with the stroke attribute. both may also refer to gradients or patterns, which makes simple coloring text in svg very powerful compared to cs...
...the following custom attributes: x set a new absolute x coordinate for the containing text. this overwrites the default current text position. the attribute may also contain a list of numbers, that are one by one applied to the single characters of the tspan element. dx start drawing the text with a horizontal offset dx from the default current position. here, too, you may provide a list of values that are applied to consecutive characters, hence piling up the offset over time. likewise, there are y and dy for vertical displacement. rotate rotate all characters by this degree. a list of numbers makes each character rotate to its respective value, with remaining characters rotating according to the last value. textlength this is a more obscure attribute giving the calculated length ...
Same-origin policy - Web security
n limitations are not applied. port ie doesn't include port into same-origin checks. therefore, https://company.com:81/index.html and https://company.com/index.html are considered the same origin and no restrictions are applied. these exceptions are nonstandard and unsupported in any other browser. changing origin a page may change its own origin, with some limitations. a script can set the value of document.domain to its current domain or a superdomain of its current domain. if set to a superdomain of the current domain, the shorter superdomain is used for same-origin checks. for example, assume a script from the document at http://store.company.com/dir/other.html executes the following: document.domain = "company.com"; afterward, the page can pass the same-origin check with http://c...
...nt.domain = document.domain, causes the port number to be overwritten with null. therefore, one cannot make company.com:8080 talk to company.com by only setting document.domain = "company.com" in the first. it has to be set in both so their port numbers are both null. note: when using document.domain to allow a subdomain to access its parent securely, you need to set document.domain to the same value in both the parent domain and the subdomain. this is necessary even if doing so is simply setting the parent domain back to its original value. failure to do this may result in permission errors. cross-origin network access the same-origin policy controls interactions between two different origins, such as when you use xmlhttprequest or an <img> element. these interactions are typically placed...
How to turn off form autocompletion - Web security
are usually enabled by default, but they can be a privacy concern for users, so browsers can let users disable them. however, some data submitted in forms either are not useful in the future (for example, a one-time pin) or contain sensitive information (for example, a unique government identifier or credit card security code). as website author, you might prefer that the browser not remember the values for such fields, even if the browser's autocomplete feature is enabled. note that the wcag 2.1 success criterion 1.3.5: identify input purpose does not require that autocomplete/autofill actually work - merely that form fields that relate to specific personal user information are programmatically identified. this means that the criterion can be passed (by adding the relevant autocomplete attrib...
...fter setting autocomplete to off, then you have to change the name attribute of the input element. the autocomplete attribute and login fields modern browsers implement integrated password management: when the user enters a username and password for a site, the browser offers to remember it for the user. when the user visits the site again, the browser autofills the login fields with the stored values. additionally, the browser enables the user to choose a master password that the browser will use to encrypt stored login details. even without a master password, in-browser password management is generally seen as a net gain for security. since users do not have to remember passwords that the browser stores for them, they are able to choose stronger passwords than they would otherwise. for t...
Transport Layer Security - Web security
versions to help with working towards a more modern, more secure web, tls 1.0 and 1.1 support will be removed from all major browsers in q1 2020. you'll need to make sure your web server supports tls 1.2 or 1.3 going forward. from version 74 onwards, firefox will return a secure connection failed error when connecting to servers using the older tls versions (bug 1606734). ...
...iled error when connecting to servers using the older tls versions (bug 1606734). tls handshake timeout values if the tls handshake starts to become slow or unresponsive for some reason, the user's experience can be affected significantly. to mitigate this problem, modern browsers have implemented handshake timeouts: since version 58, firefox implements a tls handshake timeout with a default value of 30 seconds. the timeout value can be varied by editing the network.http.tls-handshake-timeout pref in about:config. ...
Using custom elements - Web Components
back() { console.log('custom square element removed from page.'); } adoptedcallback() { console.log('custom square element moved to new page.'); } the attributechangedcallback() callback is run whenever one of the element's attributes is changed in some way. ...
...'); } the attributechangedcallback() callback is run whenever one of the element's attributes is changed in some way. as you can see from its properties, it is possible to act on attributes individually, looking at their name, and old and new attribute values. in this case however, we are just running the updatestyle() function again to make sure that the square's style is updated as per the new values: attributechangedcallback(name, oldvalue, newvalue) { console.log('custom square element attributes changed.'); updatestyle(this); } note that to get the attributechangedcallback() callback to fire when an attribute changes, you have to observe the attributes. this is done by specifying a static get observedattributes() method inside custom element class - this should return an array cont...
lang - XPath
Web › XPath › Functions › lang
ches the given language and returns boolean true or false. syntax lang(string ) arguments string the language code or localization (language and country) code to be matched. returns true if the context node matches the given languages. otherwise, false. notes a node's language is determined by its xml:lang attribute. if the current node does not have an xml:lang attribute, then the value of the xml:lang attribute of the nearest ancestor that has an xml:lang attribute will determine the current node's language. if the language cannot be determined (no ancestor has an xml:lang attribute), this function will return false. if the given string does not specify a country code, this function will match nodes of that language with any country code. the converse is not true. given t...
...ng attribute), this function will return false. if the given string does not specify a country code, this function will match nodes of that language with any country code. the converse is not true. given this fragment of xml: <p xml:lang="en">i went up a floor.</p> <p xml:lang="en-gb">i took the lift.</p> <p xml:lang="en-us">i rode the elevator.</p> and this part of an xsl template: <xsl:value-of select="count(//p[lang('en')])" /> <xsl:value-of select="count(//p[lang('en-gb')])" /> <xsl:value-of select="count(//p[lang('en-us')])" /> <xsl:value-of select="count(//p[lang('de')])" /> the output might be: 3 1 1 0 defined xpath 1.0 4.3 gecko support supported. ...
<xsl:attribute> - XSLT: Extensible Stylesheet Language Transformations
but it may be after or inside elements that won't be part of the output (like <xsl:choose> or <xsl:apply-templates> etc.). ...
...but it may be after or inside elements that won't be part of the output (like <xsl:choose> or <xsl:apply-templates> etc.). ...
<xsl:output> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › output
as expected. syntax <xsl:output method="xml" | "html" | "text" version=string encoding=string omit-xml-declaration="yes" | "no" standalone="yes" | "no" doctype-public=string doctype-system=string cdata-section-elements=list-of-names indent="yes" | "no" media-type=string /> required attributes none. optional attributes method specifies output format. version specifies the value of the version attribute of the xml or html declaration in the output document. this attribute is only used when method="html" or method="xml". encoding specifies the value of the encoding attribute in the output document. omit-xml-declaration indicates whether or not to include an xml declaration in the output. acceptable values are "yes" or "no". standalone (not supported.) if pr...
...s only used when method="html" or method="xml". encoding specifies the value of the encoding attribute in the output document. omit-xml-declaration indicates whether or not to include an xml declaration in the output. acceptable values are "yes" or "no". standalone (not supported.) if present, indicates that a standalone declaration should occur in the output document and gives its value. acceptable values are "yes" or "no". doctype-public specifies the value of the public attribute of the doctype declaration in the output document. doctype-system specifies the value of the system attribute of the doctype declaration in the output document. cdata-section-elements lists elements whose text contents should be written as cdata sections. elements should be whitespace s...
<xsl:stylesheet> - XSLT: Extensible Stylesheet Language Transformations
exclude-result-prefixes specifies any namespace used in this document that should not be sent to the output document. the list is whitespace separated. extension-element-prefixes specifies a space-separated list of any namespace prefixes for extension elements in this document. default-collation specifies the default collation used by all xpath expressions appearing in attributes or text value templates that have the element as an ancestor, unless overridden by another default-collation attribute on an inner element. it also determines the collation used by certain xslt constructs (such as <xsl:key> and xsl:for-each-group) within its scope. default-mode defines the default value for the mode attribute of all <xsl:template> and <xsl:apply-templates> elements within its scope. default...
...as an ancestor, unless overridden by another default-collation attribute on an inner element. it also determines the collation used by certain xslt constructs (such as <xsl:key> and xsl:for-each-group) within its scope. default-mode defines the default value for the mode attribute of all <xsl:template> and <xsl:apply-templates> elements within its scope. default-validation defines the default value of the validation attribute of all relevant instructions appearing within its scope. expand-text determines whether descendant text nodes of the element are treated as text value templates. id specifies an id for this stylesheet. this is most often used when the stylesheet is embedded in another xml document. input-type-annotations specifies whether type annotations are stripped from the el...
<xsl:with-param> - XSLT: Extensible Stylesheet Language Transformations
if the element contains a template, this attribute is ignored. ...
...if the element contains a template, this attribute is ignored. ...
Exported WebAssembly functions - WebAssembly
tions it references via tbl.get() and log the result of invoking each one to the console. next, we use set() to make the othertable table contain references to the same functions as the tbl table. to prove this, we then retrieve these references back from othertable and print their results to console too, which gives the same results. they are real functions in the previous example, the return value of each table.prototype.get() call is an exported webassembly function — exactly what we have been talking about. it is worth noting that these are real javascript functions, in addition to being wrappers for webassembly functions. if you load the above example in a webassembly-supporting browser, and run the following lines in your console: var testfunc = othertable.get(0); typeof testfunc; ...
...} this gives you more of an idea of its wrapper-type nature. some other particulars to be aware of with exported webassembly functions: their length property is the number of declared arguments in the wasm function signature. their name property is the tostring() result of the function's index in the wasm module. if you try to call a exported wasm function that takes or returns an i64 type value, it currently throws an error because javascript currently has no precise way to represent an i64. this may well change in the future though — a new int64 type is being considered for future standards, which could then be used by wasm. ...
2015 MDN Fellowship Program - Archive of obsolete content
and spoken english. mentor information chris mills, senior technology writer, mozilla developer network. github: chrisdavidmills twitter: @chrisdavidmills why increase the reach and impact of your expertise grow your skills beyond coding and managing to educating and communicating build something used by hundreds of thousands (or more) developers worldwide directly impact and grow the value of the open web when application deadline: april 1, 2015 orientation: early june (dates tbd) graduation: august 11-12, 2015 where orientation: a mozilla location (tbd). core program: conducted at your normal workspace. the fine print mozilla will provide coaching, direction and training on teaching best practices. subject to mozilla’s travel reimbursement policies, mozilla will cover ...
Navigator.mozNotification - Archive of obsolete content
notification object that can be used to display the specified message with an optional url. notification createnotification( in domstring title, in domstring description, in domstring iconurloptional ); parameters title the notification title. description the text to display in the notification. iconurl optional a url identifying the image to display in the notification. return value a new notification object. permissions when using notifications in an open web app, be sure to add the desktop-notification permission in your manifest file: "permissions": { "desktop-notification": {} } usage notes in firefox 22+, the instantiation of a new notification should be done with the notification object by calling new notification(title, options). nick desaulniers has writ...
Window: deviceproximity event - Archive of obsolete content
sensors.proximity.enabled preference (bug 1462308). bubbles no cancelable no interface deviceproximityevent target defaultview (window) default action none event handler property window.ondeviceproximity specification proximity sensor other properties property type description value read only double (float) the measured proximity of the distant device (distance in centimetres). min read only double (float) the minimum value in the range the sensor detects (if available, 0 otherwise). max read only double (float) the maximum value in the range the sensor detects (if available, 0 otherwise). related events userproximity ...
Communicating With Other Scripts - Archive of obsolete content
elf = require("sdk/self"); var pageurl = self.data.url("page.html") var pagemod = mod.pagemod({ include: pageurl, contentscriptfile: self.data.url("content-script.js"), contentscriptwhen: "ready" }) tabs.open(pageurl); the target web page "page.html" includes a button and a page script: <html> <head> <meta charset="utf-8"> </head> <body> <input id="message" type="button" value="send a message"/> <script type="text/javascript" src="page-script.js"></script> </body> </html> the content script "content-script.js" adds an event listener to the button, that sends a custom event containing a message: var messenger = document.getelementbyid("message"); messenger.addeventlistener("click", sendcustomevent, false); function sendcustomevent() { var greeting = {"greetin...
Cross-domain Content Scripts - Archive of obsolete content
suppose your content script includes a line like: // content-script.js: unsafewindow.mycustomapi = function () {}; if you have included the "cross-domain-content" key, when the page script tries to access mycustomapi this will result in a "permission denied" exception. ...
self - Archive of obsolete content
his is an older api than the api provided by port, and for most purposes the port api is a better choice. the exception is the context-menu module, which still uses postmessage. postmessage() send a message from a content script to a listener in the main add-on code: self.postmessage(contentscriptmessage); this takes a single parameter, the message payload, which may be any json-serializable value. on() start listening to messages from the main add-on code: self.on("message", function(addonmessage) { // handle the message }); this takes two parameters: the name of the event, and the handler function. the handler function is passed the message payload. once() exactly like on(), but stop listening after the first message is received. removelistener() remove a listener to an event. ...
Communicating using "postMessage" - Archive of obsolete content
rt port, so to send messages from a content script to the add-on via a context menu object, you must use message events. handling message events in the content script to send a message from a content script, you use the postmessage function of the global self object: self.postmessage(contentscriptmessage); this takes a single parameter, the message payload, which may be any json-serializable value. to receive a message from the add-on script, use self's on function: self.on("message", function(addonmessage) { // handle the message }); like all event-registration functions, this takes two parameters: the name of the event, and the handler function. the handler function is passed the message payload. handling message events in the add-on script to send a message to a content script, ...
Content Processes - Archive of obsolete content
that the window object inside the sandbox is actually a wrapper to the real object. a potential problem with the content script having access to the window object is that a malicious page could override methods on the window object that it knows are being used by the add-on, in order to trick the add-on into doing something it does not expect. similarly, if the content script defines any values on the window object, a malicious page could potentially steal that information. to avoid problems like this, content scripts should always see the built-in properties of the window object, even when they are overridden by another script. conversely, other scripts should not see any properties added to the window object by the content script. this is where xray wrappers come in. xray wrappers ...
Modules - Archive of obsolete content
ganize your project hierarchically. a more serious problem with the loadscript function, however, is that it evaluates all scripts in the scope of the same global object. this becomes a problem when two scripts try to define the same property: // index.js: loadscript("www.foo.com/a.js"); loadscript("www.foo.com/b.js"); foo; // => 5 // a.js: foo = 3; // b.js: foo = 5; in the above example, the value of foo depends on the order in which the subscripts are loaded: there is no way to access the property foo defined by "a.js", since it is overwritten by "b.js". to prevent scripts from interfering with each other, loadscript should evaluate each script to be loaded in the scope of their own global object, and then return the global object as its result. in effect, any properties defined by the sc...
Private Properties - Archive of obsolete content
thumbnail object, so they will never be freed, even when their corresponding image has gone out of scope. this is a memory leak waiting to happen. the above two problems are exactly what weakmaps were designed to solve. ...
Contributor's Guide - Archive of obsolete content
data members are properties that allow each instance to have their own state, whereas member functions are properties that allow instances to have behavior. inheritance allows classes to inherit state and behavior from an existing classes, known as the base class. ...
Program ID - Archive of obsolete content
tall manifest. the id is used for a variety of purposes. for example: addons.mozilla.org uses it to distinguish between new add-ons and updates to existing add-ons, and the simple-storage module uses it to figure out which stored data belongs to which add-on. when you create an xpi with jpm xpi: if the package.json does not include an id field, then the id written into the install.rdf is the value of the name field prepended with "@". if the package.json does include an id field, and it contains "@", then this is written into the install.rdf as the add-on id. if the package.json does include an id field, and it does not contain "@", then jpm xpi raises an error and the xpi will not be built. ...
SDK API Lifecycle - Archive of obsolete content
balance these competing demands. it has two main components: a stability index that defines how stable each module is a deprecation process that defines when and how stable sdk apis can be changed or removed from future versions of the sdk while giving developers enough time to update their code. stability index the stability index is adopted from node.js. the sdk uses only four of the six values defined by node.js: experimental the module is not yet stabilized. you can try it out and provide feedback, but we may change or remove it in future versions without having to pass through a formal deprecation process. unstable the api is in the process of settling, but has not yet had sufficient real-world testing to be considered stable. backwards-compatibility will be...
Working with Events - Archive of obsolete content
an event type and are documented with the event emitter. for example, the following add-on registers a listener with the tabs module to listen for the ready event, and logs a string to the console reporting the event: var tabs = require("sdk/tabs"); tabs.on("ready", function () { console.log("tab loaded"); }); it is not possible to enumerate the set of listeners for a given event. the value of this in the listener function is the object that emitted the event. listening to all events you can pass the wildcard "*" as the type argument. if you do this, the listener will be called for any event emitted by that object, and its argument will be the name of the event: var ui = require("sdk/ui"); var panels = require("sdk/panel"); var self = require("sdk/self"); var panel = panels.pane...
XUL Migration Guide - Archive of obsolete content
tabs/utils module gives you direct access to the tabbrowser object and the xul tab objects it contains. ...
hotkeys - Archive of obsolete content
his can only be used in conjunction with another modifier, since alt-letter combinations are reserved for entering special characters in text. meta: the meta key. on the macintosh, this is the command key. control: the control key. accel: the key used for keyboard shortcuts on the user's platform, which is control on windows and linux, and command on mac. usually, this would be the value you would use. pageup: the page up key. pagedown: the page down key. onpress function function that is invoked when the key combination hotkey is pressed. hotkey methods destroy() stops this instance of hotkey from reacting to the key combinations. once destroyed a hotkey can no longer be used. ...
notifications - Archive of obsolete content
display as the message's title. text string a string to display as the body of the message. iconurl string the url of an icon to display inside the message. it may be a remote url, a data uri, or a url returned by the self module. onclick function a function to be called when the user clicks the message. it will be passed the value of data. data string a string that will be passed to onclick. ...
url - Archive of obsolete content
thods tostring() returns a string representation of the data url. if base64 is true, the data property is encoded using base-64 encoding. returns string : the url as a string. properties mimetype the mime type of the data. by default is an empty string. parameters an hashmap that contains the parameters of the data url. by default is an empty object. base64 defines the encoding for the value in data property. data the string that contains the data in the data url. if the uri given to the constructor contains base64 parameter, this string is decoded. ...
content/worker - Archive of obsolete content
er using the port.on function url the url of the content. tab if this worker is attached to a content document, returns the related tab. events message this event allows the content worker to receive messages from its associated content scripts. calling the self.postmessage() function from a content script will asynchronously emit the message event on the corresponding worker. arguments value : the event listener is passed the message, which must be a json-serializable value. error this event allows the content worker to react to an uncaught runtime script error that occurs in one of the content scripts. arguments error : the event listener is passed a single argument which is an error object. detach this event is emitted when the document associated with this worker is unloaded...
core/heritage - Archive of obsolete content
name, breed); dog.call(this, name); this.breed = breed; } // to subclass, you need to make another special dance with special // 'prototype' properties. pet.prototype = object.create(dog.prototype); // if you want correct instanceof behavior you need to make a dance with // another special `constructor` property of the `prototype` object. object.defineproperty(pet.prototype, 'constructor', { value: pet }); // finally you can define some properties. pet.prototype.call = function(name) { return this.name === name ? this.bark() : ''; }; since sdk apis may be interacting with untrusted code an extra security measures are required to guarantee that documented behavior can't be changed at runtime. to do that we need to freeze constructor's prototype chain to make sure functions are frozen: o...
dev/panel - Archive of obsolete content
e browser that the developer tools are currently debugging. the messages follow the remote debugging protocol. for a simple walkthrough of using the dev/panel api to add a new tool, see adding a panel to the toolbox. basic usage defining the panel constructor to add a new tool you first need to define a constructor that inherits from the panel class, and in that constructor you need to supply values for various properties . you can set the constructor up manually if you like, or you can use the add-on sdk core/heritage module to simplify the mechanics of inheriting from panel. you can use the class utility function: const { panel } = require("dev/panel"); const { class } = require("sdk/core/heritage"); const mypanel = class({ extends: panel, label: "my panel", tooltip: "my new devt...
frame/utils - Archive of obsolete content
, allowjavascript: true }); } globals functions create(document, options) creates a xul browser element in a privileged document. parameters document : nsidomdocument options : object optional options: name type type string string that defines access type of the document loaded into it. defaults to "content". for more details and other possible values see documentation on mdn uri string uri of the document to be loaded into the new frame. defaults to about:blank. remote boolean if true separate process will be used for this frame, and all the following options are ignored. allowauth boolean whether to allow auth dialogs. defaults to false. allowjavascript ...
places/favicon - Archive of obsolete content
can be a url string or a tab. callback : function an optional callback function that will be used in both resolve and reject cases. returns promise : a promise that resolves with the favicon url. ...
places/history - Archive of obsolete content
for every item returned from a search. arguments object : this is an object representing a history entry. contains url, time, accesscount and title of the entry. error the error event is emitted whenever a search could not be completed. arguments string : a string indicating the error that occurred. end the end event is called when all search results have returned. arguments array : the value passed into the handler is an array of all entries found in the history search. each entry is an object containing the properties url, time, accesscount and title. ...
system/runtime - Archive of obsolete content
access to information about firefox's runtime environment. all properties exposed are read-only. for more information, see nsixulruntime. globals properties insafemode this value is true if firefox was started in safe mode, otherwise false. os a string identifying the current operating system. for example, . "winnt", "darwin", or "linux". see os_target for a more complete list of possible values. processtype the type of the caller's process, which will be one of these constants: constant value description process_type_default 0 the default (chrome) process. process_type_plugin 1 a plugin subprocess. process_type_content 2 a content subprocess. process_type_ipdlunittest 3 an ipdl unit testing subprocess. ...
system/xul-app - Archive of obsolete content
version to compare. lowinclusive : string the lower bound of the version range to compare. the range includes this bound. highexclusive : string the upper bound of the version range to compare. the range does not include this bound. returns boolean : true if version falls in the given range and false otherwise. properties id the guid of the host application. for example, for firefox this value is "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}". name the host application name. the possible values here are: "firefox" "fennec" "mozilla" "seamonkey" "sunbird" "thunderbird" "firefox"and"fennec"` are the most commonly used values. version the host application version. platformversion the gecko/xulrunner platform version. ids a mapping of application names to their ids. for example...
test/utils - Archive of obsolete content
the first argument is the test's name as a string. the second argument is the assert object for the test. the third, optional, argument is a callback. if the callback is defined, then the afterfn is considered asynchronous, and the callback must be invoked before the next test runs. waituntil(predicate, interval) waituntil returns a promise that resolves upon the predicate returning a truthy value, which is called every interval milliseconds. parameters predicate : function a function that gets called every interval milliseconds to determine if the promise should be resolved. interval : number the frequency in milliseconds to execute predicate. defaults to 10. returns promise : waituntil returns a promise that becomes resolved once the predicate returns a truthy value. the promise c...
util/collection - Archive of obsolete content
d by an array. parameters array : array if array is given, it will be used as the backing array. this way the caller can fully control the collection. otherwise a new empty array will be used, and no one but the collection will have access to it. functions addcollectionproperty(object, propname, [backingarray]) adds a collection property to the given object. setting the property to a scalar value empties the collection and adds the value. setting it to an array empties the collection and adds all the items in the array. parameters object : object the property will be defined on this object. propname : string the name of the property. backingarray : array if given, this will be used as the collection's backing array. collection a collection object provides for...in-loop iteration.
util/match-pattern - Archive of obsolete content
.html "data:*" data:text/html,hi there regular expressions you can specify patterns using a regular expression: var { matchpattern } = require("sdk/util/match-pattern"); var pattern = new matchpattern(/.*example.*/); the regular expression is subject to restrictions based on those applied to the html5 pattern attribute. in particular: the pattern must match the entire value, not just any subset. for example, the pattern /moz.*/ will not match the url http://mozilla.org. the expression is compiled with the global, ignorecase, and multiline flags disabled. the matchpattern constructor will throw an exception if you try to set any of these flags. example pattern example matching urls example non-matching urls /.*moz.*/ http://foo.mo...
window/utils - Archive of obsolete content
oading. in order to see private windows in this list, your add-on must have opted into private browsing and you must include the includeprivate key in the list of options: var allwindows = window_utils.windows(null, {includeprivate:true}); parameters type : string string identifying the type of window to return. this is passed directly into nsiwindowmediator.getenumerator(), so its possible values are the same as those expected by that function. in particular: null: get all window types navigator:browser: get "normal" browser windows devtools:scratchpad: get scratchpad windows navigator:view-source: get view source windows if you're not also passing options, you can omit this, and it's the same as passing null. options : object options object containing the following property: ...
console - Archive of obsolete content
level for all installed sdk-based add-ons. extensions.extensionid.sdk.console.loglevel, where extensionid is an add-on's program id. if set, this determines the logging level for the specified add-on. this overrides the global preference if both preferences are set. both these preferences can be set programmatically using the preferences/service api, or manually using about:config. the value for each preference is the desired logging level, given as a string. when you run your add-on using jpm run (without --profile set) or jpm test, the global extensions.sdk.console.loglevel preference is automatically set to "info". this means that calls to console.log() will appear in the console output. when you install an add-on into firefox, the logging level will be "error" by default (that ...
Display a Popup - Archive of obsolete content
text_entry.hide(); }); the content script "get-text.js" looks like this: // when the user hits return, send the "text-entered" // message to main.js. // the message payload is the contents of the edit box. var textarea = document.getelementbyid("edit-box"); textarea.addeventlistener('keyup', function onkeyup(event) { if (event.keycode == 13) { // remove the newline. text = textarea.value.replace(/(\r\n|\n|\r)/gm,""); self.port.emit("text-entered", text); textarea.value = ''; } }, false); // listen for the "show" event being sent from the // main add-on code. it means that the panel's about // to be shown. // // set the focus to the text area so the user can // just start typing. self.port.on("show", function onshow() { textarea.focus(); }); finally, the "text-ent...
Getting Started (jpm) - Archive of obsolete content
rompt, create a new directory. navigate to it, type jpm init, and hit enter: mkdir my-addon cd my-addon jpm init you'll then be asked to supply some information about your add-on: this will be used to create your add-on's package.json file. for now, just press enter to accept the default for each property. for more information on jpm init, see the jpm command reference. once you've supplied a value or accepted the default for these properties, you'll be shown the complete contents of "package.json" and asked to accept it. implementing the add-on now you can write the add-on's code. unless you've changed the value of "entry point" ("main" in package.json), this goes in "index.js" file in the root of your add-on. this file was created for you in the previous step. open it and add the follow...
Modifying Web Pages Based on URL - Archive of obsolete content
learn more about page-mod, see its api reference page. in particular, the pagemod constructor takes several additional options to control its behavior: by default, content scripts are not attached to any tabs that are already open when the page-mod is created, and are attached to iframes as well as top-level documents. to control this behavior use the attachto option. define read-only values accessible to content scripts using the contentscriptoptions option. by default, content scripts are attached after all the content (dom, js, css, images) for the page has been loaded, at the time the window.onload event fires. to control this behavior, use contentscriptwhen option. to learn more about content scripts in general, see content scripts guide. ...
Modifying the Page Hosted by a Tab - Archive of obsolete content
ld see a red border appear around the page, like this: keeping content scripts in a separate file in the example above, we've passed in content script as a string. unless script is extremely simple, maintain the script as a separate file in add-on's data directory. this makes the code easier to maintain, debug, and review. to do this, provide option contentscriptfile not contentscript, whose value is a url pointing to one or more content script files. for example, if we save the script above under the add-on's data directory in a file called my-script.js: var self = require("sdk/self"); var button = require("sdk/ui/button/action").actionbutton({ id: "style-tab", label: "style tab", icon: "./icon-16.png", onclick: function() { require("sdk/tabs").activetab.attach({ cont...
Using XPCOM without chrome - Archive of obsolete content
notice the small l var bmlistener = bmlistener(); placesutils.bookmarks.addobserver(bmlistener, false); ...
Alerts and Notifications - Archive of obsolete content
ments = [image, title, msg, false, '']; } using notification box another way of non-modal notification and further interaction with users is using of xul elements notificationbox and notification (implicitly). however it is possible to use only buttons and a label there. ...
Autocomplete - Archive of obsolete content
about xul widgets and not about html form inputs. first, declare a panel with the "autocomplete" type, like so: <panel id="popup_autocomplete" type="autocomplete" noautofocus="true" /> now set the autocompletepopup attribute of your <browser> element to the id of the panel you just declared: <browser id="my_browser" ... autocompletepopup="popup_autocomplete" /> finally, make sure that the value of the browser.formfill.enable pref is set to true. see also textbox (toolkit autocomplete) how to implement custom autocomplete search component ...
Bookmarks - Archive of obsolete content
takes advantage of xpcomutils to generate the nsisupports.queryinterface() method. ...
Drag & Drop - Archive of obsolete content
ents.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.nsifile); if (file) uri = _ios.newfileuri(file); } } if (uri) uris.push...
Embedding SVG - Archive of obsolete content
2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- xul and svg go here --> </window> example: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <vbox> <label value="hello"/> <svg:svg version="1.1" baseprofile="full" width="150" height="150"> <svg:rect x="10" y="10" width="100" height="100" fill="red"/> <svg:circle cx="50" cy="50" r="30" fill="blue"/> </svg:svg> <label value="world"/> </vbox> </window> ...
Finding window handles - Archive of obsolete content
another technique is to use the accessibility framework, see for example http://developer.mozilla.org/en/docs..._of_interfaces another way to find a window handle... is to query it from an object. once you have a docshell, queryinterface it into nsibasewindow, call getmainwidget on result, and then call getnativedata(ns_native_window). like this hwnd gethwnd(nsibasewindow ...
Forms related code snippets - Archive of obsolete content
h.test(this.id), ndelta = rdecrease.test(this.id) ? -1 : 1, othiscal = ainstances[this.id.replace(rbgnnan, "")]; othiscal.current[bismonth ? "setmonth" : "setyear"](othiscal.current[bismonth ? ...
HTML to DOM - Archive of obsolete content
in the example, we dump() to the console the page's url and the text contained in the first h1 tag of the page's <body>. but, we still need to see how to execute the famous loaduri() method using our iframe: ...
LookupPrefix - Archive of obsolete content
+) { 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(':')+1); } if ( xmlnspattern.test(att.name) && att.value === namespaceuri && lookupnamespaceuri(originalelement, localname) === namespaceuri ) { return localname; } } } if (originalelement.parentnode) { // entityreferences may have to be skipped to get to it return _lookupnamespaceprefix(namespaceuri, originalelement.parentnode); } return null; } ...
QuerySelector - Archive of obsolete content
tion (selector) { // only for html return this.queryselector(selector); }; example: <h1>test!</h1> <script> htmldocument.prototype.$ = function (selector) { return this.queryselector(selector); }; alert(document.$('h1')); // [object htmlheadingelement] </script> xuldocument.prototype.$ = function (selector) { // only for xul return this.queryselector(selector); }; example: <label value="test!"/> <script type="text/javascript"><![cdata[ xuldocument.prototype.$ = function (selector) { // only for xul return this.queryselector(selector); }; alert(document.$('label')); // [object xulelement] ]]></script> document.prototype.$ = function (selector) { // only for plain xml return this.queryselector(selector); }; var foo = document.implementation.createdocument('somens', 'foo...
Rosetta - Archive of obsolete content
"" : odicts[smimetype](oscript.text); obaton.parentnode.insertbefore(ocompiled, obaton); } function reqerror (oerror) { throw new urierror("the script " + oerror.target.src + " is...
Scrollbar - Archive of obsolete content
hrome.manifest and add: skin app-global standard/1.0 skin/global/ override chrome://global/skin/xulscrollbars.css chrome://app-global/skin/scrollbars.css xulscrollbars.css are used for windows xp, and nativescrollbars.css on osx. so to make this work with osx, make an extra override: override chrome://global/skin/nativescrollbars.css chrome://app-global/skin/scrollbars.css change some color values inside the app/chrome/skin/global/scrollbars.css to test that the css is used. example xul window: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="samplewindow" width="320" height="240" xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul"> <hbox flex="1"> <browser type="content" src="http://mozilla.org" flex="1"/> <scrollbar o...
Sidebar - Archive of obsolete content
.width=newwidth; } you can also disable the ability to resize it manually, using the mouse, by hiding the sidebar's splitter element. for this snippet to work, you have to declare mainwindow as in the previous code block then write: mainwindow.document.getelementbyid("sidebar-splitter").hidden = true; be aware that if you change the splitter's hidden attribute, you need to reset it to a safe value when your sidebar is closed, or replaced by another sidebar. for example, use this in your sidebar's unload event handler: mainwindow.document.getelementbyid("sidebar-splitter").hidden = mainwindow.document.getelementbyid("sidebar-box").hidden; see also bootstrap demo addon that creates a sidebar with html content: https://gist.github.com/noitidart/8728393 ...
Toolbar - Archive of obsolete content
e your button on the toolbar by default. this should only be done on the first run of your add-on after installation so that if the user decides to remove your button, it doesn't show up again every time they start the application. notes insert your button by default only once, at first run, or when an extension update adds a new button. please only add your button by default if it adds real value to the user and will be a frequent entry point to your extension. you must not insert your toolbar button between any of the following elements: the combined back/forward button, the location bar, the stop botton, or the reload button. these elements have special behaviors when placed next to eachother, and will break if separated by another element. /** * installs the toolbar button with the...
Tree - Archive of obsolete content
<tree id="my-tree" onclick="ontreeclicked(event)"> use the following javascript: function ontreeclicked(event){ var tree = document.getelementbyid("my-tree"); var tbo = tree.treeboxobject; // get the row, col and child element at the point var row = { }, col = { }, child = { }; tbo.getcellat(event.clientx, event.clienty, row, col, child); var celltext = tree.view.getcelltext(row.value, col.value); alert(celltext); } getting the selected indices of a multiselect tree var start = {}, end = {}, numranges = tree.view.selection.getrangecount(), selectedindices = []; for (var t = 0; t < numranges; t++){ tree.view.selection.getrangeat(t, start, end); for (var v = start.value; v <= end.value; v++) selectedindices.push(v); } other resources xul: tree docu...
getAttributeNS - Archive of obsolete content
ile (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 = thisitem.parentnode; } } } return ''; // if not found (some implementations return 'null' but this is not standard) } alert(getattributenswrapper (someelement, 'http://www.w3.org/1999/xlink', 'hre...
Code snippets - Archive of obsolete content
external links the content at mozillazine example code is slowly being moved here, but you can still find useful examples there for now. ...
Displaying web content in an extension without security issues - Archive of obsolete content
t be able to establish a security boundary between your extension and untrusted data if your extension opens as a tab in the browser — so displaying your extension in a browser tab is a bad choice. note: dynamic changes of the "type" attribute have no effect, the frame type is read out when the frame element is inserted into the document and never again. so the usual rule is: don’t change the value of the "type" attribute. but if you really have to do this, you will also have to remove the frame element from the document and insert it back. not giving privileges to documents that contain untrusted data the privileges that a document gets depend on where it comes from. for example, "chrome://foo/content/foo.xhtml" will have full privileges, "http://example.com/foo.xhtml" will be allowed to a...
Installing Extensions and Themes From Web Pages - Archive of obsolete content
an be any image format supported by firefox, and should be 32x32 pixels in size. hash the hash property specifies a cryptographic hash of the xpi file contents. this is used to verify the downloaded file, to protect against a corrupted file being served by a mirror download server, for example. you can use any hash function supported by nsicryptohash. the hash is specified as hash function:hash value, for example, sha1:28857e60d043447c5f4550853f2d40770b326a13. tostring() the tostring() property should return the xpi url, for compatibility with firefox browsers older than version 1.0, and other applications such as seamonkey. themes pretty much everything i've described applies to themes too, except you'll use the installchrome function. because so many sites installed extensions by direct...
Jetpack Processes - Archive of obsolete content
, the script's global scope is endowed with the following privileged apis: sendmessage(amessagename [, v1 [, v2 [, ...]]]) similar to nsijetpack.sendmessage(), this function asynchronously sends a message to the chrome process. callmessage(amessagename [, v1 [, v2 [, ...]]]) this function is like sendmessage() but sends the message synchronously. it returns an array whose elements are the return values of each receiver in the chrome process that was triggered by the message. registerreceiver(amessagename, areceiver) similar to nsijetpack.registerreceiver(), this function registers a callback that is triggered when the chrome process sends a message with the given name. unregisterreceiver(amessagename, areceiver) similar to nsijetpack.unregisterreceiver(), this function unregisters a callback p...
Migrating from Internal Linkage to Frozen Linkage - Archive of obsolete content
0) : fatal error c1001: internal compiler error to debug this error, make in the failing directory, adding the /showincludes directive to figure out what is being included incorrectly: make -c directory/that/failed os_cppflags=-showincludes the frozen string api is similar but not identical to the nonfrozen string api. the frozen string api does not have (or need) nsxpidlstring: - nsxpidlstring value; + nsstring value; ptr->gettermethod(getter_copies(value)); - const 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(). use .setlength() instead: nsstring mystring = somestring; - mystring.truncate(4); + mystring.setlength(4); the frozen string api...
Appendix: What you should know about open-source software licenses - Archive of obsolete content
at you should be aware of. you don’t have to give it away there’s nothing in an oss license that prevents you from charging money for software. one of the advantages of oss is that it emphasizes that software can be distributed for free, but it can also be distributed for money. of course, customers who buys the software can then redistribute it themselves, so unless you provide some added value, you’ll have a hard time building a business. scope of modifications in the open-source world, “copyleft” is when you require that any modifications to your source code must also be released under the same terms. the following tasks can be considered modifications revision: rewriting the source code; addition: adding new code, or adding parts of it to other code; linkage: creating sta...
Appendix B: Install and Uninstall Scripts - Archive of obsolete content
false); then all we need is some persistent flag that ensures that the first run code is only run once. the best approach in this case is to use a preference, as explained in the handling preferences section. so, if we were to use fuel, we can do the following in the init function: init : function() { let firstrunpref = "extensions.xulschoolhello.firstrundone"; if (!application.prefs.getvalue(firstrunpref, false)) { application.prefs.setvalue(firstrunpref, true); // all the rest of the first run code goes here. } } in this case you would need to declare the first run preference in your default preferences file, with a default value of false. you should also change the preference value before you run any other first run code. keep in mind that the user could have set multipl...
Appendix C: Avoiding using eval in Add-ons - Archive of obsolete content
previous section about functions remain. alternative: just assign most of the time, assigning properties will just work. someexistingobject.someproperty = "abc"; // we already demonstrated with with functions in a previous example alternative: object.defineproperty() for most objects it is possible to (re-)define properties with the object.defineproperty() api, which allows to not override values, but also lets you define getters and setters. alternative: proxy if you cannot override objects or properties easily, e.g. because the object is frozen or sealed, then creating a proxy around the object might be a viable approach. triggering event handlers sometimes scripts might want to manually trigger an event handler that is defined directly in the xul document. consider the following x...
Appendix F: Monitoring DOM changes - Archive of obsolete content
.apply(this, arguments); doawesomerdomstuff(res, arguments); return res; }; } now, whenever doawesomedomstuff() is called, the original function will be called, followed by your own doawesomerdomstuff() function, which can then further modify the dom as needed. variations on this method include modifying the arguments passed to the wrapped function, modifying its return value, and making changes both before and after the original method is called. this scheme is highly flexible and can be made to work under most circumstances. css animation events this technique, which works on firefox 5+, has some particular advantages. because it is based on css, it can be keyed to match new elements of any arbitrary css selector. and because it is css-based, and is triggered when...
Intercepting Page Loads - Archive of obsolete content
licy and register it to the "content-policy" category using the nsicategorymanager. the nsicontentpolicy.shouldload() method is the only one in this interface that is really useful. it actually allows for cleaner-looking code than most of the previously seen solutions, because you get the content uri directly as an argument, and you indicate if the content should be loaded or not with the return value, which has well-defined possible values. the context parameter gives you access to the window loading the content. as with all other solutions, you need to be efficient, and a good way to do this is to filter out unneeded cases right from the start. shouldload is called for every load operation firefox tries to do, including images, scripts and xul documents. a good filter would look like this: ...
JavaScript Object Management - Archive of obsolete content
so be treated as string-indexed arrays: // equivalent. 〈namespace〉.hello = {}; 〈namespace〉["hello"] = {}; // equivalent. 〈namespace〉.hello.init(); 〈namespace〉.hello["init"](); this is very useful in cases where you have to set attributes or functions with dynamically generated names. it's one of the funky properties of javascript: all objects are nothing more than name / value mappings. you can add or replace functions and attributes to any javascript object, at any moment you want. this is an odd, but powerful feature that comes in handy at times when things get complicated. for instance, you could replace a method in any object in the firefox chrome, so that it behaves differently than how it normally does. this should be a last resort option, but it is very useful a...
Tabbed browser - Archive of obsolete content
r(this, "gsessionstore", "@mozilla.org/browser/sessionstore;1", "nsisessionstore"); // create new tab, but don't load the content. var url = "https://developer.mozilla.org"; var tab = gbrowser.addtab(null, {relatedtocurrent: true}); gsessionstore.settabstate(tab, json.stringify({ entries: [ { title: url } ], usertypedvalue: url, usertypedclear: 2, lastaccessed: tab.lastaccessed, index: 1, hidden: false, attributes: {}, image: null })); reusing tabs rather than open a new browser or new tab each and every time one is needed, it is good practice to try to re-use an existing tab which already displays the desired url--if one is already open. following this practice minimizes the proliferation of tabs an...
Using the Stylesheet Service - Archive of obsolete content
omponents.interfaces.nsiioservice); var u = ios.newuri("chrome://myext/content/myext.css", null, null); if(sss.sheetregistered(u, sss.user_sheet)) sss.unregistersheet(u, sss.user_sheet); registering stylesheets on startup via the category manager stylesheets may also be registered on startup via the agent-style-sheets and user-style-sheets categories. the category names are ignored, and the values are the uris from which to load the stylesheets. the order the sheets are applied in is undefined. usage notes stylesheets added using this service get applied to both chrome and content documents. remember to declare the correct namespace if you want to apply stylesheets to xul documents. registered style sheets are not remembered across restarts. loadandregistersheet fails if css contai...
progress - Archive of obsolete content
of the transfer is known. read only. loaded unsigned long (long) the number of bytes transferred since the beginning of the operation. this doesn't include headers and other overhead, but only the content itself. read only. total unsigned long (long) the total number of bytes of content that will be transferred during the operation. if the total size is unknown, this value is zero. read only. related events checking noupdate downloading progress cached updateready obsolete error ...
Makefile - .mk files - Archive of obsolete content
makefile description client.mk top level makefile which controls the overall build config/android-common.m config/autoconf.mk config/rules.mk targets (export, deps, libs, tools) and generic build rules config/static-checking-config.mk config/version.mk makefile description config/myconfig.mk user defined build configuration values config/myrules.mk user defined makefile rules for building $(topsrcdir)/$(moz_build_app)/app-config.mk application specific build configuration ...
Defining Cross-Browser Tooltips - Archive of obsolete content
html 4.01 definition of the title attribute states: title = text cs this attribute offers advisory information about the element for which it is set. unlike the title element, which provides information about an entire document and may only appear once, the title attribute may annotate any number of elements. please consult an element's definition to verify that it supports this attribute... values of the title attribute may be rendered by user agents in a variety of ways. for instance, visual browsers frequently display the title as a "tool tip" (a short message that appears when the pointing device pauses over an object). between these two passages, it is fairly clear that the proper method for defining a "tooltip" for an image (or, indeed, for any element) is to use the title attribut...
Monitoring WiFi access points - Archive of obsolete content
y.privilegemanager.enableprivilege('universalxpconnect'); var d = document.getelementbyid("d"); d.innerhtml = ""; for (var i=0; i<accesspoints.length; i++) { var a = accesspoints[i]; d.innerhtml += "<p>" + a.mac + " " + a.ssid + " " + a.signal + "</p>"; } var c = document.getelementbyid("c"); c.innerhtml = "<p>" + count++ + "</p>"; }, onerror: function (value) { alert("error: " +value); }, queryinterface: function(iid) { netscape.security.privilegemanager.enableprivilege('universalxpconnect'); if (iid.equals(components.interfaces.nsiwifilistener) || iid.equals(components.interfaces.nsisupports)) return this; throw components.results.ns_error_no_interface; }, } netscape.security.privilegem...
Source code directories overview - Archive of obsolete content
o both javascript scripts and c code with as little effort as possible. xpidl files have their own mini-language and processing tools. public contains source code that will be exported to the dist/include directory. they are not all necessarily public in the general sense; some are only meant for internal use in a certain module. as more code is written with or converted to xpidl interfaces, the value of the public directory diminishes. src contains the bulk of the source code. tests contains c harnesses, html or xul that exercise this module. tools contains scripts for automatically generating certain source code and other special tools for building this module. there are also platform dependent subdirectories which contain source code for specific platforms. windows contains source c...
Visualizing an audio spectrum - Archive of obsolete content
ssuming 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.addeventlistener('loadedmetadata', loadedmetadata, false); // f...
How Thunderbird and Firefox find their configuration files - Archive of obsolete content
rbird and firefox find their configuration files thunderbird looks into the binary %appdata%\thunderbird\profiles.ini file for its "registry", which contains, amongst other information, a pointer to the directory where the profile is stored (usually located in %appdata%\thunderbird\profiles\profilename). likewise, firefox uses a similar file, located in %appdata%\mozilla\firefox\profiles.ini. the value contained in this key is a litteral value, no variables (such as %userprofile%/mozprofile) allowed. we chose to point this to the user's home directory (h:\thunderbird). the configuration itself is stored in the specified directory, in a file named prefs.js. this is a readable file of javascript commands. all other files in that directory are dynamically created by mozilla on first start. unlike ...
Bookmark Keywords - Archive of obsolete content
t shown in figure 4, without the red highlighting. the %s is a little flag that means "insert user input here." it doesn't have to go at the end of the location field-- it can be anywhere inside the field. you just need to fill in whatever piece of a url it is you want to be able to "fill in" when you use the keymark. all we need now is a keyword, and our keymark will be ready to go. fill in the value bz, as shown in figure 5. with that done, all you have to do in the future is type <tt>bz</tt> followed by a space and the bug's number into mozilla's address bar, and the browser will jump right to the bug with that number. this is illustrated in figure 6. that's all it takes! setting up a google keymark to set up a keymark that will search google directly form the address bar, go to google...
Structure of an installable bundle - Archive of obsolete content
y wish to include binary component or plugins for multiple platforms, or theme authors might want to include multiple platform-specific jar files. to facilitate the first case, the extension/app loader has special sub-directories specifically for platform-specific files (starting with toolkit/gecko 1.8, firefox/thunderbird 1.5). the platform string is defined during the toolkit build process to a value unique for the combination of operating system, processor architecture and compiler. the format of the platform string is: {os_target}_{target_xpcom_abi} all of the files which are loaded from the main extension directory are loaded from the subdirectory /platform/{platform string} if it exists. for example, if a plugin vendor wanted to make a plugin available for consumer computers running...
Creating a Firefox sidebar extension - Archive of obsolete content
this is an separate xul file that specifies the location of menu items. the sidebar here is added to the view | sidebar menu. the overlay file is listed in example 4. example 4. chrome/content/firefoxoverlay.xul <?xml version="1.0"?> <!doctype over...
Specifying the appearance - Archive of obsolete content
there is one rule for each possible tinderbox state. make your own icons for the four states or use the following icons: no status , success , test failed and busted . if you restart mozilla now you should see the "no status" icon appear in the browser's status bar. « previousnext » ...
Creating regular expressions for a microsummary generator - Archive of obsolete content
^http://cgi\.ebay\.com/ws/ebayisapi\.dll\?viewitem&item= accommodating variations in query parameters we now have a regular expression that matches all four example urls. it'll probably match the urls for other auction item pages, too. but to make it more robust, we should accommodate the possibility of variation in the query parameters. a named query parameter is a string of the form <name>=<value>, where <name> and <value> are arbitrary strings. in our url, "item=280018439106" is the only such parameter. but urls can contain multiple named parameters separated by ampersands (&), and the parameters can appear in any order, so even though the "item" parameter seems to be necessary, it might not appear right next to "viewitem". for example, the following is an equally valid url for the same...
Using Dehydra - Archive of obsolete content
e subclassed! class __attribute__((user("final"))) myclass { }; // this subclass should be an error class subclass : public myclass { }; save the following analysis script final.js: /** * helper function: returns true if a class is marked with the "final" attribute. ...
Download Manager improvements in Firefox 3 - Archive of obsolete content
applications and extensions implement this interface to be made aware of changes in the status of downloads. nsidownloadmanagerui implement this interface to replace or augment the download manager user interface. other download manager documentation download manager preferences this article lists preferences used by the download manager as well as their default values. the download manager schema this article describes the database format used to store and track information about each download. examples monitoring downloads an example showing how to use the new download manager apis to create a download log window that shows all past and present downloads and their status, including the start and end times of the downloads, the ...
Exception logging in JavaScript - Archive of obsolete content
rface exceptions outlined in rules 3 and 4 above - those exceptions will not be reported in any case. there are two ways you can accomplish this. first, you can set the boolean preference dom.report_all_js_exceptions. if this preference is true, all exceptions from inner frames will be logged. alternatively, you can set the environment variable moz_report_all_js_exceptions. it doesn't matter what value you set this to (it can even be 0). if the variable exists, all exceptions from inner frames will be reported. see also error console bug 415498 ...
HTTP Class Overview - Archive of obsolete content
s a http request and response parses incoming data nshttpchunkeddecoder owned by a transaction strips chunked transfer encoding nshttprequesthead owns a nshttpheaderarray knows how to fill a request buffer nshttpresponsehead owns a nshttpheaderarray knows how to parse response lines performs common header manipulations/calculations nshttpheaderarray stores http "<header>:<value>" pairs nshttpauthcache stores authentication credentials for http auth domains nshttpbasicauth implements nsihttpauthenticator generates basic auth credentials from user:pass nshttpdigestauth implements nsihttpauthenticator generates digest auth credentials from user:pass original document information author(s): darin fisher last updated date: august 5, 2002 copyright in...
Hidden prefs - Archive of obsolete content
e @zi == zip code @co == country if the pref is set to "", no "get map" button will appear in the addressbook card preview pane. the default (defined in mailnews.js) is: pref("mail.addr_book.mapit_url.format", "http://www.mapquest.com/maps/map.adp...st&zipcode=@zi"); addressbook quick search query pref ("mail.addr_book.quicksearchquery.format" ) the format for this pref is: @v == the escaped value typed in the quick search bar in the addressbook every occurance of @v will be replaced. note, the ui has "name or email contains:". this entity (searchnameoremail.label) is defined in messenger.dtd. so if you change the quick search query to match based on phone number, the ui will not match the query. the default (defined in mailnews.js) is: pref("mail.addr_book.quicksearchquery.format","?(or...
popChallengeResponse - Archive of obsolete content
conform to that defined in the cmmf draft, and we intend to change this implementation to that defined in the cmc rfc.. see below for the current implementation. the resultstring will either be a base-64 encoded popodeckeyrespcontent message, or one of the following error strings: error string description "error:invalidparameter:xxx" the parameter xxx was an invalid value. "error:internalerror" the software encountered some internal error, such as out of memory challenge-response proof of possession expected input: popodeckeychallcontent ::= sequence of challenge -- one challenge per encryption key certification request (in the -- same order as these requests appear in fullcerttemplates). challenge ::= sequence { owf a...
Twitter - Archive of obsolete content
to be, please file a bug. (or write a patch!) arguments each and every method in the library takes a single argument, an object. there are two styles you can use to define this object. the first is simple: define properties on the object corresponding to the parameters of the twitter method. for instance, some twitter methods have an id parameter, so you would define an id property and set its value to a user's id. (you can read about the parameters of the various methods at twitter's api reference.) there are two special, optional properties: success and error. success is a function that's called when the request successfully completes, and error is a function called when it fails to complete. the library simply passes them to jquery.ajax(), and so they are called like so: success(data, te...
First run - Archive of obsolete content
ink to your jetpack's homepage. this page can be defined as either html or a remote url. the first-run page is defined by the firstrunpage property of your jetpack's manifest. a manifest is simply an object set to a variable named manifest. you may define this variable anywhere in the global namespace of your jetpack. it's the same manifest you use when defining settings for your jetpack. the value of firstrunpage must be either a string or e4x xml. if the value is a both a string and a valid url, the page at that url becomes your first-run page. otherwise, the value is assumed to be html, and it becomes the body of your first-run page. this example sets the first-run page to some html: var manifest = { firstrunpage: '<p>thanks for installing! visit my <a href="http://example.com/myjet...
First Run - Archive of obsolete content
or link to your jetpack's homepage. this page can be defined as either html or a remote url. the first-run page is defined by the firstrunpage property of your jetpack's manifest. a manifest is simply an object set to a variable named manifest. you may define this variable anywhere in the global namespace of your jetpack. it's the same manifest you use when defining settings for your jetpack. the value of firstrunpage must be either a string or e4x xml. if the value is a both a string and a valid url, the page at that url becomes your first-run page. otherwise, the value is assumed to be html, and it becomes the body of your first-run page. this example sets the first-run page to some html: var manifest = { firstrunpage: '<p>thanks for installing! visit my <a href="http://example.com/myjetp...
Settings - Archive of obsolete content
the jetpack [simple storage api][]. settings are private to each jetpack and are not accessible by other jetpacks. because it is still under development, the api currently lives in the future and must be imported before it is used: specifying settings in a manifest to specify its settings, a jetpack defines a variable named manifest in its global namespace before it imports the settings api. the value of this variable must be an object that contains a property named settings. the value of the settings property is an array of objects representing the settings to expose to users. jetpack will automatically generate a user interface from this specification that users of your jetpack may use to customize the settings. the user can open this interface from the "settings" button next to your jetpack...
Settings - Archive of obsolete content
s are private to each jetpack and are not accessible by other jetpacks. because it is still under development, the api currently lives in the future and must be imported before it is used: jetpack.future.import("storage.settings"); specifying settings in a manifest to specify its settings, a jetpack defines a variable named manifest in its global namespace before it imports the settings api. the value of this variable must be an object that contains a property named settings. the value of the settings property is an array of objects representing the settings to expose to users. jetpack will automatically generate a user interface from this specification that users of your jetpack may use to customize the settings. the user can open this interface from the "settings" button next to your jetpac...
Mozilla Crypto FAQ - Archive of obsolete content
. the u.s. government claimed in return that cryptographic software was regulated based solely on its ability to be used to secure communications and data, and that the national security interest in so regulating it overrode any first amendment protections; as the export regulations put it, "encryption software is controlled because of its functional capacity, and not because of any informational value of such software". the government also claimed that publication of cryptographic software in electronic form made such functional use easier than publication in printed form, and that that was sufficient to justify treating the two forms differently in the regulations. on august 25, 1997, the u.s. district court for the northern district of california issued a final ruling (written by judge mari...
NSC_SetPIN - Archive of obsolete content
in( ck_session_handle hsession, ck_char_ptr poldpin, ck_ulong uloldlen, ck_char_ptr pnewpin, ck_ulong ulnewlen ); parameters nsc_setpin takes five parameters: hsession [input] poldpin [input] . uloldlen [input] .; pnewpin [input] .; ulnewlen [input] . description nsc_setpin modifies the pin of user that is currently logged in. this is only valid for the private_key_slot. return value ckr_ok examples #include <assert.h> see also fc_setpin ...
New Security Model for Web Services - Archive of obsolete content
ked against the type of request being requested by the script, such as "soap", "soapv", or "load". types must not contain spaces. specify "any" as the type to permit any requested type of access to resources. the principle uri of the script will be checked for the specified uri prefix. if "from" is not specified, then all scripts will be allowed. note: one can also use wild charater(s) in "from" value. for example: <wsa:allow type="soapv" from="http://www.mozilla.org"/> this command allows soap requests with verification headers from scripts loaded from the domain www.mozilla.org. <wsa:allow type="soapv" from="http://*.mozilla.org"/> this command allows soap requests with verification headers from scripts loaded from the domain with host name containing mozilla.org. that is, http://www.
PyDOM - Archive of obsolete content
that we don't actually 'import' anything here - the scripts and event handlers do not exist in a python module. the intent is to provide similar semantics to js. for example, when a top-level window has something like: <window ... script="foo = 1" ... an event handler like: <button onclick="print foo"/> should be able to reference 'foo' via globals as shown. note that you can stick arbitrary values on any dom object - this is what js calls 'expandos'. for example, let's say you have xul similar to pyxultest: top-level script code says something like: button = document.getelementbyid("some-button") button.foo = 0 and the button itself might look like: <button id="some-button" label="click here" onclick="event.target.foo += 1; print 'foo is now', event.target.foo"/> note that (a) ...
Remote debugging - Archive of obsolete content
legitimate reason it happens only on some computers, but that reason just hasn't been discovered.) the crash victim, in turn, trusts the developer with full access to his computer. a good place to start is a detailed stack (in gdb, use bt followed by bt full). there give more information about the stack than a breakpad crash report: not only the names of the functions on the stack, but also the values they were passed. core dump a core dump includes all of the memory of a crashed program. it allows you to see the crash in a debugger even after the program has long exited. transferring a core dump is tricky, because it is large and can contain private information. core dumps on mac and linux to generate a core dump on mac, type "ulimit -c unlimited", run firefox from the command line, and make...
Frequently Asked Questions - Archive of obsolete content
illa use a plugin when people view the svg files on their website. the native svg support must be turned off before mozilla will look to see if there's an svg plugin installed. this is done by toggling a hidden user configuration preference (pref). to access the pref type about:config into the url bar, then type svg.enabled into the filter field. when you double click on the pref you will see its value change to and from true/false, turning the native support on/off. how does mozilla's svg implementation compare to adobe's? mozilla's native implementation is less complete than adobe svg viewer's in general. there are major features such as filters and smil based animation that have still to be implemented in mozilla. however, mozilla's implementation already supports some things that adobe's ...
Space Manager Detailed Design - Archive of obsolete content
and the number of items that the collection can handle. if the collection is too small, then an error is returned and the count is updated to indicate the size required. the algorithm to provide the band data is as follows: get a vertical offset in world coordinates (instead of frame-relative coordinates) by adding the y-origin of the spacemanager to the y offset passed in if the (adjusted) y value passed in is greater than the greatest band being managed, then all space is available so a single trapezoid is returned,marked as available and sized to the maximum size value (passed in). if the (adjusted) y offset intersects a band, then gather the banddata: walk the internal banddata list from head to tail for each band data entry, see if the top of the band is greater than the (adjusted) ...
Standalone XPCOM - Archive of obsolete content
component implementation that the sample application will try to instantiate. this should have been installed in your bin/components directory to run the test, cd to your bin/ directory setenv ld_library_path . ./nstestsample warning: mozilla_five_home not set. nsnativecomponentloader: autoregistering begins. nsnativecomponentloader: autoregistering succeeded inital print: initial value set value to: xpcom defies gravity final print : xpcom defies gravity test passed. test failed: what went wrong? the most common case of why the sample would have failed if you didn't run it from the bin directory. here are some error messsages and possible ways of fixing them. ./nstestsample: error in loading shared libraries: libxpcom.so: cannot open shared object file: no such file...
Supporting per-window private browsing - Archive of obsolete content
introduced per-window private browsing mode, in which private user data is stored and accessed concurrently with public user data from another window. detecting private browsing mode determining whether or not a given dom window is private is simple: import resource://gre/modules/privatebrowsingutils.jsm and use privatebrowsingutils.iswindowprivate(window). you can then take action based on this value, as any data or actions originating from this window should be considered private. try { // firefox 20+ components.utils.import("resource://gre/modules/privatebrowsingutils.jsm"); if (!privatebrowsingutils.iswindowprivate(window)) { ... } } catch(e) { // pre firefox 20 (if you do not have access to a doc. // m...
Table Cellmap - Border Collapse - Archive of obsolete content
if this corner is a start for a horizontal segment, if this corner is a start for a vertical segment, if this corner should be beveled. ...
Actionscript Acceptance Tests - Archive of obsolete content
s file can also be created with the same contents that will apply to the entire directory. testname.as.avm_args files will take precedence over the dir.avm_args file testname.as.tz if a test is only valid for certain timezones, the timezones can be specified in this support file. below is a sample file that covers the 4 main us timezones: # place all timezones that this file applies to. # these values correspond to the value returned by time.tzname tuple. # (see http://docs.python.org/library/time.html for details) # e.g.: eastern standard time/eastern daylight time = ('est','edt') # write timezones as tuples, one to each line. ('est', 'edt') ('cst', 'cdt') ('mst', 'mdt') ('pst', 'pdt') testname.err this file is used when the test throws an uncatchable error. the first line must contain the ...
Actionscript Performance Tests - Archive of obsolete content
private bytes memory (high water mark) for a test. by default each test is run a single time. to run each test multiple times use the --iterations flag. when the number of iterations is greater than 2 all times are displayed in [], faster time is displayed in the output column, and the 95% confidence interval is calculated. the 95% confidence interval is the calculated percentage of the mean value to fall within 95% of the measured results. for example if the mean is 100 and the 95% confidence interval is 2%, 95% of the expected values should fall between 98 and 102. to compare two vms against each other export avm2=<path to 2nd vm> or use --avm2=<path to 2nd vm>. the percentage difference is calculated between the two vms. see the --help usage for more details about performance tests.
Cmdline tests - Archive of obsolete content
ite allows more flexibility by coding scripts in python allowing any executable to run, sending commands to stdin, and asserting output using regular expressions. see test/cmdline/readme document for more information. ...
Writing textual data - Archive of obsolete content
lso write character arrays using the write function, although using writestring is simpler from javascript code. the example above passes 0 as the third argument, which disables buffering (note: the implementation of the converter stream might not support buffering). passing 0 ensures that data will be immediately written to the underlying stream; however, for better perfomance you should pass a value like 4096 instead. unsupported characters you can specify what should happen with characters that are not supported by the selected character encoding. the last argument to init specifies that: 0x0000 means that writing unsupported characters throws an exception (with an error code of ns_error_loss_of_significant_data), and no data will be written. to instead write a replacement character in s...
Event Handlers - Archive of obsolete content
le. (note that there is a possibility that this may change in the future.) handlers are attached to the bound element, and they are registered by default for bubbling events. this means that <handler event="click" action="foo()"/> is analogous to onclick="foo()" defined on the bound element. the phase attribute specifies the phase of event flow that the handler is registered for. the default value is bubbling, which means that the event handler will fire during the bubbling phase. the other possible values are target, which means the handler will only fire if event.originaltarget is the same as the target to which the handler is attached, and capturing, which indicates the handler should fire during the capturing phase of event flow. xbl event handlers always fire last, after all other ev...
XML in Mozilla - Archive of obsolete content
aration states that the document is not standalone (default), in which case mozilla will try to look for the entity under <bin>/res/dtd directory. mozilla may also make an exception with xhtml documents, see below. mozilla will read internal (dtd) subsets, and in special circumstances external dtds as explained above and will use this information to recognize id type attributes, default attribute values, and general entities. other notes a lot of the document object model (dom, w3c recommendations and drafts) applies to xml. likewise, the cascading style sheets (css, w3c recommendations and drafts) style language can be used to style xml documents. the code for most the core xml can be found in the following directories on the mozilla mercurial repository: content/xml/, parser/expat/ and parser...
Using XPInstall to Install Plugins - Archive of obsolete content
tinstall will suffice). the initinstall method is polymorphic, but here is a recommended invocation mechanism: initinstall("my plugin software", "@myplugin.com/myplugin,version=2.5", "2.5.0.0"); in the code snippet above, the initinstall method is invoked with three parameters: a string for the name of the application a string signifying the plugin identifier associated with the plugin. this value is actually entered in the client version registry upon installation, a mozilla-browser file that stores metadata about the software that has just been installed. this value can be queried via web-page delivered javascript, and is useful for initiating xpinstall downloads via trigger scripts. you can determine the version of the software that has been installed, and determine whether to update it...
InstallTrigger.startSoftwareUpdate - Archive of obsolete content
areupdate this is a very simple example of the installtrigger object's principal method, startsoftwareupdate, which takes a string representing the path to the xpi and installs that xpi on the local machine. function triggerurl(url) { installtrigger.startsoftwareupdtate(url); } // get the url to the .xpi from either a form // or text field entry. then do: ... onclick="triggerurl(this.form.url.value); ...
copy - Archive of obsolete content
summary makes a queued copy of the specified file. method of file object syntax int copy( filespecobject source, filespecobject dest ) parameters the copy method has the following parameters: source a filespecobject object reprsenting the file to be copied. dest a filespecobject object representing the destination directory. returns an integer error code. for a list of possible values, see return codes. description the destination can be a directory or a filename. if destination does not exist a new file will be created. ...
dirCreate - Archive of obsolete content
dircreate creates a new directory. method of file object syntax int dircreate( filespecobject dirtocreate ); parameters the dircreate method has the following parameters: dirtocreate a filespecobject representing the pathname of the directory to create. returns an integer error code. for a list of possible values, see return codes. description the input parameter is a filespecobject that you have already created with the install object's getfolder method. the following simple example demonstrates the use of the dircreate method. note that the getfolder method does not require that the folder or directory you specify exist in order for the object reference to be a valid one. example f = getfolder("program", "mynewdirectory"); err = file.dircreate(f); ...
dirRemove - Archive of obsolete content
dirremove removes a directory. method of file object syntax int dirremove( filespecobject dirtoremove [, boolean recursive] ); parameters the dirremove method has the following parameters: dirtoremove a filespecobject representing the directory to be removed. recursive an optional boolean value indicating whether the remove operation is to be performed recursively (1) or not (0). returns an integer error code. for a list of possible values, see return codes. ...
dirRename - Archive of obsolete content
rrename renames a directory in place. method of file object syntax int dirrename( filespecobject directory, string newname ); parameters the dirrename method has the following parameters: directory a filespecobject representing the directory to be renamed. newname the new terminal (or leaf) name of the directory. returns an integer error code. for a list of possible values, see return codes. ...
execute - Archive of obsolete content
e, [string aparameters] ); parameters the execute method has the following parameters: executablefile a filespecobject representing the local file already on disk to be executed. note that file names are case sensitive. aparameters an optional parameter string that is passed to the executable. (ignored on mac os) returns an integer error code. for a list of possible values, see return codes. description the specified file is not actually executed until the performinstall method is called. see performinstall for more information about queued commands during the installation process. example f = getfolder("program", "mytexteditor.exe"); err = file.execute(f, "myfile.txt"); // indicates that 'myfile.txt' will be // opened in the editor ...
exists - Archive of obsolete content
exists returns a value indicating whether the specified file or directory exists. method of file object syntax boolean exists( filespecobject target ) parameters the exists method has the following parameters: target a filespecobject representing the file or directory being tested for existence. returns a boolean value specifying whether the file or directory does indeed exist or does not. example f = getfolder( "program", "sample.txt" ); if ( file.exists(f) ) // do something with the file ...
isDirectory - Archive of obsolete content
summary returns a boolean value indicating whether the specified filespecobject is a directory. method of file object syntax boolean isdirectory ( filespecobject nativefolderpath ); parameters the isdirectory method has the following parameters: nativefolderpath a filespecobject representing the queried directory. returns a boolean value indicating whether the object is a directory or not. ...
isFile - Archive of obsolete content
summary returns a boolean value indicating whether the given filespecobject is a file. method of file object syntax boolean isfile (filespecobject nativefolderpath); parameters the isfile method has the following parameter: nativefolderpath a filespecobject representing the queried file object. returns a boolean value indicating whether the filespecobject is a file or not. example f = getfolder( "program", "sample.txt" ); if ( file.isfile(f) ) // the object represents a file ...
macAlias - Archive of obsolete content
y into which the program file will be installed. filename a string representing the name of the file to be installed. aliasdir a filespecobject that represents the directory into which the alias file will be installed (e.g.,"mac desktop"). aliasname a string representing the name of the alias itself. returns an integer error code. for a list of possible values, see return codes. example see file.macalias in the script examples chapter. ...
move - Archive of obsolete content
move moves a file from one location to another. method of file object syntax int move( filespecobject source, filespecobject dest ); parameters the move method has the following parameters: source a filespecobject representing the source file. dest a filespecobject representing the target directory. returns an integer error code. for a list of possible values, see return codes. description you must create a filespecobject for the destination directory to pass in for this function. if the destination doesn't already exist a file name for the destination is assumed. example source = getfolder("program", "file.txt"); dest = getfolder("chrome"); err = file.move(source, dest); ...
remove - Archive of obsolete content
summary deletes a specified file. method of file object syntax int remove( filespecobject file ) parameters the remove method has the following parameters: file a filespecobject representing the file to be removed. returns an integer error code. for a list of possible values, see return codes. ...
rename - Archive of obsolete content
summary renames a specified file in place. method of file object syntax int rename( filespecobject file, string newname ) parameters the rename method has the following parameters: file a filespecobject representing the file to be renamed. newname the new terminal (or leaf) name of the file. returns an integer error code. for a list of possible values, see return codes. ...
windowsGetShortName - Archive of obsolete content
s 8.3 file naming convention. method of file object syntax string windowsgetshortname( object localdirspec ) parameters the windowsregisterserver method has the following parameter: localdirspec a filespecobject representing a directory obtained by getcomponentfolder or getfolder. returns a string with the windows shortname. if the path already conforms to 8.3, the return value is null. example flongfilepath = getfolder(fprogram, "longfilename.file"); sshortfilepath = file.windowsgetshortname(flongfilepath); if(sshortfilepath) { // do something } ...
windowsRegisterServer - Archive of obsolete content
registerserver registers installed dlls with the windows registry. method of file object syntax int windowsregisterserver( object localdirspec ) parameters the windowsregisterserver method has the following parameters: localdirspec a filespecobject representing a directory obtained by getcomponentfolder or getfolder. returns an integer error code. for a list of possible values, see return codes. example filecdtool = getfolder("file:///", faod + "cdtool.dll"); err = file.windowsregisterserver(filecdtool); ...
windowsShortcut - Archive of obsolete content
run from. aparams parameters that atarget requires. aicon a filespecobject representing the absolute path (including fiilename) to a file that contains icons. can be either .ico, .dll, .exe, or any other binary file that contains icons. aiconid index of the icon from aicon to use for this shortcut. returns an integer error code. for a list of possible values, see return codes. example see file.windowsshortcut in the script examples chapter. ...
Methods - Archive of obsolete content
evelopers should see how to package a plugin as an extension. methods dircreate creates a new directory. dirgetparent returns an object representing the parent directory. dirremove removes a directory. dirrename renames the specified directory. copy makes a copy of the specified file. diskspaceavailable returns the amount of disk space available in bytes. exists returns a boolean value indicating whether the specified file exists or not. execute queues a file for executing as part of the installation process. isdirectory returns a boolean value indicating whether an object is a directory. isfile returns a boolean value indicating whether an object is a file. moddate returns a number representing the last modified date of the given file. moddatechanged specifies whethe...
cancelInstall - Archive of obsolete content
porary files. method of install object syntax void cancelinstall() void cancelinstall( int errorcode ) parameters none. returns an integer error code. the optional argument is an error code that can be returned to the triggering page. for most purposes, it's recommended that one of the standard return codes be used. but a script can, in fact, return any valid integer. for a list of possible values, and any custom errorcode created by install writer, see return codes. example use the following code to abort or to finalize an installation, based on a variable you set earlier in your code: initinstall("royal airways tripplanner","/royalairways/ tripplanner","1.0.0.0"); ... err = getlasterror(); if (!err) performinstall(); else cancelinstall(err); ...
deleteRegisteredFile - Archive of obsolete content
the specified file and removes its entry from the client version registry. method of install object syntax int deleteregisteredfile (string registryname); parameters the deleteregisteredfile method has the following parameter: registryname the pathname in the client version registry for the file that is to be deleted. returns an integer error code. for a list of possible values, see return codes. description the deleteregisteredfile method deletes the specified file and removes the file's entry from the client version registry. if the file is currently being used, the name of the file that is to be deleted is saved and netscape 6 attempts to delete it each time it starts up until the file is successfully deleted. this method is used to delete files that cannot be remo...
execute - Archive of obsolete content
boolean blocking]); int execute ( string xpisourcepath, string args [, boolean blocking]); parameters the execute method has the following parameters: xpisourcepath the pathname of the file to extract and execute. (note that this path points into the xpi itself.) args a parameter string that is passed to the executable. (ignored on mac os). see note below. blocking a boolean value that specifies whether the installation should wait for the execution of the file to finish before it resumes. default is false. see note below. the blocking parameter is not available as part of this method in versions of netscape before 6.1/mozilla 0.9.3. returns an integer error code. for a list of possible values, see return codes. description the execute method extracts the named file f...
getLastError - Archive of obsolete content
description use getlasterror method to obtain the most recent nonzero error code since initinstall or reseterror were called. this method allows you to defer checking for error codes each time you call addfile or adddirectory until the last addfile or adddirectory call. the getlasterror method does not return errors from methods that return objects, such as getfolder. ...
initInstall - Archive of obsolete content
y name provided here is not the location of the software on the machine, it is the location of information about the software inside the registry. this distinction is important when you add components with the addfile method. version an installversion object or a string representing the version of the package being installed. when version is a string it should be up to four integer values delimited by periods, such as "1.17.1999.1517". flags an optional field; reserved for future use. pass 0 as the default value. returns an integer error code. for a list of possible values, see return codes. description the initinstall method initializes the installation of the specified software. you must call this method immediately after the constructor. it is an error to call ...
logComment - Archive of obsolete content
logcomment adds a comment line to the installation log. method of install object syntax int logcomment( string acomment ); parameters the sole input parameter is a string whose value will be written to the log during the installation process. returns an integer error code. for a list of possible values, see return codes. description the install log is created in the product directory by default (where the browser executable is) if it can be, and if the installation doesn't have proper permission, the install log is written to the user's profile directory. respectively, these directories correspond to the "program" and "current user" keywords for the getfolder method. ...
performInstall - Archive of obsolete content
in some situations the method may return other errors. ...
refreshPlugins - Archive of obsolete content
returns nothing. description refreshplugins lets you register new plug-ins without having to restart the browser. ...
registerChrome - Archive of obsolete content
his function are created using the getfolder method on the install object. xpipath xpipath is the path within the xpi in where the contents.rdf file defining the chrome is located. for example, "locale/mylocale/aim," points to the locale/mylocale/aim subdirectory of the same xpi file in which the installation script is located. returns an integer error code. for a list of possible values, see return codes. in some situations the method may return other errors. in a few cases you may get a registry error. description when the third parameter is omitted (pointing to a specific location within the xpi file), this function is being used in a somewhat deprecated way. in this case, registerchrome is supporting the old format of installation archives, in which the manifest.rdf file wa...
Return Codes - Archive of obsolete content
to_locate_lib_function -237 unable_to_load_library -238 chrome_registry_error -239 malformed_install -240 key_access_denied -241 access to the registry key has been denied key_does_not_exist -242 registry key does not exist value_does_not_exist -243 registry value does not exist invalid_signature -260 the signature used in the xpi is not valid invalid_hash -261 the hash used in the xpi is not valid invalid_hash_type -262 the has used in the xpi is not of a valid type out_of_memory -299 insufficient m...
writeString - Archive of obsolete content
summary changes a value in a .ini file. method of winprofile object syntax boolean writestring ( string section, string key, string value); parameters the method has the following parameters: section section in the file, such as "boot" or "drivers". key the key in that section whose value to change. value the new value. returns true if successfully scheduled, otherwise, false. description the writestring method is similar to the windows api function writeprivateprofilestring. to delete an existing value, supply null as the value parameter. unlike the writeprivateprofilestring function, this method does not support using a null key to delete an entire section. values are not actually written until performinstall is called. example to se...
Methods - Archive of obsolete content
age show the use of the xpinstall api. the majority of this api is now deprecated and as of gecko 1.9 no longer available. extension, theme, and plug-in developers must switch away from install.js based packages to the new packaging scheme with an install.rdf manifest. in particular plugin developers should see how to package a plugin as an extension. methods getstring retrieves a value from a .ini file. writestring changes a value in a .ini file. ...
WinProfile Object - Archive of obsolete content
on. winprofile (windows only) windows developers use this object to manipulate the content of a windows .ini file. overview this object does not have a public constructor. instead, you construct an instance of this object by calling the getwinprofile method of the install object. the two methods of the winprofile object, getstring and writestring, allow you to read and write the data in the key/value pairs of a windows .ini file. ...
createKey - Archive of obsolete content
rs: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". classname usually an empty string. for information on this parameter, see the description of regcreatekeyex in your windows api documentation. returns 0 if it succeeded; a nonzero number if it failed to schedule the creation. for a list of possible values, see return codes. description the createkey method adds a key to the registry. you must add a key to the registry before you can add a value for that key. ...
deleteKey - Archive of obsolete content
deletekey removes a key from the registry. method of winreg object syntax int deletekey ( string subkey); parameters the method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". returns 0 if it succeeded; a nonzero number if it failed to schedule the deletion. for a list of possible values, see return codes. ...
isKeyWritable - Archive of obsolete content
iskeywritable returns whether the given registry key is writable or not. method of winreg object syntax boolean iskeywritable( string key); parameters the method has the following parameter: key a string representing the path to the key returns a boolean value: true if the key is writable; false if not. example winreg = getwinregistry(); if ( winreg != null ) { winreg.setrootkey ( winreg.hkey_local_machine ); if(winreg.iskeywritable("software")) { //iskeywritable returned true } else { //iskeywritable returned false } ...
keyExists - Archive of obsolete content
keyexists returns whether the key exists. method of winreg object syntax boolean keyexists ( string key); parameters the method has the following parameter: key a string representing the path to the key returns boolean value description if the user does not have read access to the given key, this will also return false. example winreg = getwinregistry(); if ( winreg != null ) { winreg.setrootkey( winreg.hkey_local_machine); if(winreg.keyexists("software\\mozilla")) { //keyexists returned true } else { //keyexists returned false } } ...
WinReg Object - Archive of obsolete content
n instance of this object by calling the getwinregistry method of the install object. this discussion assumes you are already familiar with the windows registry. for information on it, see api documentation for windows nt or windows 95. when you construct a winreg object, it is set to operate with hkey_classes_root as its root key. to use a different root key, use the setrootkey method. typically values in the windows registry are strings. to manipulate such values, use the getvaluestring and setvaluestring methods. to manipulate other values, use the getvalue and setvalue methods. reading registry values is immediate. however, writing to the registry is delayed until performinstall is called. ...
XPInstall API reference - Archive of obsolete content
macalias moddate moddatechanged move remove rename size windowsgetshortname windowsregisterserver windowsshortcut winprofile no properties methods getstring writestring winreg no properties methods createkey deletekey deletevalue enumkeys enumvaluenames getvalue getvaluenumber getvaluestring iskeywritable keyexists setrootkey setvalue setvaluenumber setvaluestring valueexists winregvalue constructor other information return codes see complete list examples trigger scripts and install scripts code samples ...
Learn XPI Installer Scripting by Example - Archive of obsolete content
{ logcomment("insufficient disk space: " + dirpath); logcomment(" required : " + spacerequired + " k"); logcomment(" available: " + spaceavailable + " k"); return(false); } return(true); } in the verifydiskspace block, filegetdiskspaceavailable is called with dirpath as its expected input. this input is defined in line 22, where getfolder() is used to assign a value to the communicatorfolder variable representing the "program" folder on the local system: var communicatorfolder = getfolder("program"); spaceavailable = filegetdiskspaceavailable(dirpath); spacerequired, the other expected input to the verifydiskspace function, is given as 17311 kilobytes on line 19. inside the function, the two sizes are compared and if the available space is larger than the...
browserid - Archive of obsolete content
...
movetoclick - Archive of obsolete content
...
norestorefocus - Archive of obsolete content
« xul reference home norestorefocus type: boolean if false, the default value, then when the panel is hidden, the keyboard focus will be restored to whatever had the focus before the panel was opened. if true, the focus will not be reset, although it will be cleared if the focus is within the panel. ...
progressmeter.max - Archive of obsolete content
« xul reference home max type: integer the maximum value that progressmeter may have. the default value if not specified is 100 such that the value may be used as a percentage. ...
searchbutton - Archive of obsolete content
this attribute only applies to textboxes with the type search. ...
acceltext - Archive of obsolete content
this attribute does not apply to menus directly on the menubar. ...
alwaysopenpopup - Archive of obsolete content
this attribute is obsolete as of gecko 1.9.1; to control the display of the popup, use the minresultsforpopup attribute instead. ...
attribute - Archive of obsolete content
« xul reference home attribute type: attribute name the attribute that the observer is observing. when the value of the attribute changes, the broadcast event is called on the observer. use the value * to observe all attribute of the broadcasters. the id, ref, and persist attributes are not observed. ...
autofill - Archive of obsolete content
...
button.type - Archive of obsolete content
« xul reference home type type: one of the values below the type of button. if this attribute is not present, a normal button is created. leave the attribute out for a normal button. checkbox this type of button can be in two states. the user can click the button to switch between the states. this is not the same as a checkbox because it looks like a button. menu set the type attribute to the value menu to create a button with a menu popup. place a menupopup element inside the button in this case. the user may click anywhere on the button to open and close the menu. menu-button you can also use the value menu-button to create a button with a menu. unlike the menu type, this type requires the user to press the arrow to open the menu, but a different command may be i...
buttonalign - Archive of obsolete content
...
buttondir - Archive of obsolete content
...
buttonorient - Archive of obsolete content
...
buttonpack - Archive of obsolete content
...
checkState - Archive of obsolete content
« xul reference home checkstate type: integer, values 0, 1, or 2 this attribute may be used to create three state buttons, numbered 0, 1 and 2. when in state 0 or 1, pressing the button will switch to the opposite state. when in state 2, pressing the button will switch to state 0. this means that the button acts like a checkbox except that there is a third state which must be set manually by adjusting the check state. if you wish to have different behavior for how the states are adjusted, set the autocheck attribute to false and adjust the state with a script. the type attribute must be set to checkbox for buttons with a check state. constants for the possible values for this attribute are in the nsidomxulbuttonelement interface. ...
chromemargin - Archive of obsolete content
« xul reference home chromemargin type: margin string controls the amount of chrome that should be visible on each side of the window. the specified string should contain four numbers, separated by commas, indicating the margin in pixels for the top, right, bottom, and left edges of the window, respectively. this value may be -1 to use the default margin for that side on the current platform, 0 to have no system border (that is, to extend the client area to the edge of the window), or a value greater than zero to indicate how much less than the default default width you wish the margin on that side to be. if this value turns out to be less than 0, 0 is used. ...
collapse - Archive of obsolete content
if this attribute is not specified, the splitter will not cause a collapse. you should put a grippy element inside the splitter when it is used for collapsing. none no collapsing occurs. before when the grippy is clicked, the element immediately before the splitter in the same parent is collapsed so that its width or height is 0. after when the grippy is clicked, the element immediately after the splitter in the same parent is collapsed so that its width or height is 0. ...
context - Archive of obsolete content
« xul reference home context type: id should be set to the value of the id of the popup element that should appear when the user context-clicks on the element. a context-click varies on each platform. usually it will be a right click. you can use the special value '_child' to indicate the first menupopup child of the element. ...
customindex - Archive of obsolete content
« xul reference home customindex not in seamonkey 1.x type: integer this value is the index of the toolbar in the list of the custom toolbars. the value is updated automatically by the toolbar customization dialog. ...
decimalplaces - Archive of obsolete content
« xul reference home decimalplaces type: integer the number of decimal places to display. the default is 0, which doesn't show any decimal places. the value infinity may be used if you want no limit on the number of decimal places. note that decimal numbers are stored as floats. ...
defaultButton - Archive of obsolete content
...
emptytext - Archive of obsolete content
« xul reference home emptytext deprecated since gecko 2 type: string a string that appears in the textbox when it has no value. this is superseded by the placeholder attribute in gecko 2.0. the old name is retained for compatibility, but you should update your code. ...
equalsize - Archive of obsolete content
always for a horizontally oriented element, this will make all of its children have the width of the widest child. for a vertically oriented element, this will make its children all have the height of the tallest child. ...
eventnode - Archive of obsolete content
if this attribute is not specified, events are listened to from the tabbox. thus, if this attribute is not used, the tabbox or an element inside it must have the focus for the keyboard navigation to apply. parent keyboard navigation is captured at the parent of the tabbox. window keyboard navigation is captured at the window level. tab navigation will occur as long as any element in the window is focused. document keyboard navigation is captured at the document level. ...
events - Archive of obsolete content
valid events are listed below, or you can use your own events. you can send a custom event by calling the updatecommands method of the command dispatcher. ...
firstdayofweek - Archive of obsolete content
« xul reference home firstdayofweek type: integer which day of the week to display as the first day in the grid. the values range from 0 to 6, where 0 is sunday and 6 is saturday. the default value is determined by the locale, so only use this attribute if you want to override it. ...
flags - Archive of obsolete content
dont-test-empty: for template generated content, the builder will not check that a container is empty. dont-build-content: this flag may be used on a tree to indicate that content elements should not be generated. ...
flex - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › flex
« xul reference home flex type: string (representing an integer) indicates the flexibility of the element, which indicates how an element's container distributes remaining empty space among its children. flexible elements grow and shrink to fit their given space. elements with larger flex values will be made larger than elements with lower flex values, at the ratio determined by the two elements. the actual value is not relevant unless there are other flexible elements within the same container. once the default sizes of elements in a box are calculated, the remaining space in the box is divided among the flexible elements, according to their flex ratios. specifying a flex value of 0 has the same effect as leaving the flex attribute out entirely. ...
group - Archive of obsolete content
only one button from each group can be checked at a time. ...
hidecolumnpicker - Archive of obsolete content
...
href - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › href
« xul reference home href type: string defines a url to open when this element is clicked. requires the class attribute to include text-link. <label href="http://example.com" class="text-link" value="click here to go to example.com"/> ...
icon - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › icon
« xul reference home icon mozilla 1.8 type: string this attribute should be used to set the usage for common buttons. some platforms display these buttons with a small icon indicating their usage. this should be used in place of the image attribute. possible values include: accept, cancel, help, open, save, find, clear, yes, no, apply, close, print, add, remove, refresh, go-forward, go-back, properties, select-font, select-color, network. if you are using a button that matches one of these common usages, use the icon attribute to indicate this. see the appearance of the different icons on some available platforms. ...
iframe.transparent - Archive of obsolete content
« xul reference hometransparenttype: one of the values belowset the background of an iframe as transparent.transparentthis results in the iframe's background being transparent. this can be used to workaround things like bug 540911 ...
insertafter - Archive of obsolete content
...
insertbefore - Archive of obsolete content
...
inverted - Archive of obsolete content
for instance, checking the checkbox disables the preference instead of enabling it. ...
listitem.type - Archive of obsolete content
...
max - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › max
« xul reference home 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. see also progressmeter.ma ...
maxpos - Archive of obsolete content
...
multiple - Archive of obsolete content
« xul reference home multiple type: boolean set to true to indicate that the value contains multiple values separated by commas. any of the values may match. otherwise, the entire value string is compared. ...
noautofocus - Archive of obsolete content
if true, the focus is not adjusted. ...
noinitialfocus - Archive of obsolete content
if true, the element will not receive initial focus. ...
notification.type - Archive of obsolete content
info a notification that is of lesser importance. warning a normal warning notification. ...
object - Archive of obsolete content
...
onchange - Archive of obsolete content
change. a change event is fired in different ways for different xul input elements as listed below: onchange type: script code textbox when enter key is pressed radio/check box when the state is changed select list when the selected item is changed what is accessible the script context at this point can only access the following things: global values/functions i.e. window, document, or any of the functions/objects/variables bound to the window object event object example <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findfile-window" title="find files" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="text/javascri...
oninput - Archive of obsolete content
« xul reference home oninput type: script code this event is sent when a user enters text in a textbox. this event is only called when the text displayed would change, thus it is not called when the user presses non-displayable keys. example <!-- this sets the label's text to the textbox value on each keystroke. --> <script language="javascript"> function setlabel(txtbox){ document.getelementbyid('lbl').value = txtbox.value; } </script> <label id="lbl"/> <textbox oninput="setlabel(this);"/> this is similar to the onkeypress event used in html documents. ...
ontextrevert - Archive of obsolete content
as of gecko 1.9.1, this attribute is superseded by the ontextreverted attribute. ...
ontextreverted - Archive of obsolete content
...
orient - Archive of obsolete content
you can also use the -moz-box-orient style property. horizontal child elements of the element are placed next to each other in a row in the order that they appear in the xul source. vertical child elements of the element are placed under each other in a column in the order that they appear in the xul source. ...
panel.fade - Archive of obsolete content
the default is none. ...
panel.flip - Archive of obsolete content
this is a vertical flip. horizontal flipping doesn't normally happen, since this would cause menus to open in strange places. for arrow popups, however, being able to flip horizontally makes sense. this attribute, set to both, permits that behavior. you will not normally have to use this attribute, since it's automatically applied to arrow panels. an arrow panel can also specify a value of slide, which causes the arrow to "slide" instead of flipping when the panel doesn't have room. a sliding panel will have the start (or end) position extended such that the panel can be the requested size, meaning the arrow will no longer be at the start (or end) of the panel - i.e., the arrow will appear to have been slid along the panel to ensure the arrow is still pointing at the anchor. ...
panel.ignorekeys - Archive of obsolete content
« xul reference home ignorekeys type: boolean if false, the default value, the escape key may be used to close the panel. if true, the escape key cannot be used to close the panel. ...
panel.level - Archive of obsolete content
if a panel has one or more text fields, this attribute should not be set, otherwise ime or on-screen keyboard popups will appear incorrectly. for these reasons, you should avoid setting the level if not needed. top the panel is shown in front of all other normal windows, including those of other applications. ...
panel.noautohide - Archive of obsolete content
« xul reference home noautohide type: boolean if false, the default value, the panel will be hidden when the user clicks outside the panel or switches focus to another application. if true, the panel will only be closed when the hidepopup method is called. ...
persist - Archive of obsolete content
in mozilla, persistent attributes are stored in the per-profile file xulstore.json. persistence can also be stored using the document.persist function. in order for persistence to work, the element must also have an id. ...
persistence - Archive of obsolete content
« xul reference home persistence type: integer the persistence may be set to a non-zero value so that the notificationbox's removetransientnotifications method does not remove them. this may be used to close a set of notifications as a group without affecting other notifications. ...
phase - Archive of obsolete content
« xul reference home phase type: string the event phase where the handler is invoked. this should be set to the value capturing to indicate during the event capturing phase or target to indicate at the target element or left out entirely for the bubbling phase. ...
placeholder - Archive of obsolete content
...
popup - Archive of obsolete content
« xul reference home popup type: id should be set to the value of the id of the popup element that should appear when the user clicks on the element. see also more information on the popup element in the xul tutorial ...
position - Archive of obsolete content
« xul reference home position type: string (representing an integer) when an element is in an overlay, the position is an index where the child is inserted. the position is one-based, so use a value of 1 to place the element at the beginning. this attribute is ignored if either an insertbefore or insertafter attribute matches an element. ...
preference-editable - Archive of obsolete content
see the pref system documentation for more information. ...
priority - Archive of obsolete content
« xul reference home priority type: integer numeric value that specifies the order in which the notifications appear. should be one of the constants described in the notificationbox's appendnotification method. ...
progressmeter.mode - Archive of obsolete content
« xul reference home mode type: one of the values below a determinedprogressmeter is used in cases where you know how long an operation will take. an undeterminedprogressmeter can be used when you don't and will typically be drawn as a spinning barber pole. determined the progress meter uses its value attribute to determine the amount of the bar that is filled in. undetermined the progressmeter is indeterminate. ...
query.type - Archive of obsolete content
« xul reference home type type: one of the values below the type of the parameter's value integer 32 bit integer int64 64 bit integer double double-precision floating-point number string string literal, the default value ...
ref - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › ref
this attribute should be placed alongside the datasources attribute. ...
resizeafter - Archive of obsolete content
closest the element immediately to the right or below the splitter resizes. farthest the element that is the farthest away from the splitter to the right or below the splitter resizes. grow the elements to the right or below the splitter do not change size (unless they are flexible) when the splitter is dragged, but instead the entire container changes size. flex the closest flexible element resizes. ...
resizebefore - Archive of obsolete content
closest the element immediately to the left or above the splitter resizes. farthest the element that is the farthest away from the splitter to the left or above the splitter resizes. ...
resizer.dir - Archive of obsolete content
left resized to the left. right resized to the right. top resized up. bottom resized down. bottomstart resized down and toward the start of the line (toward the left for left-to-right locales, toward the right for right-to-left locales). bottomend resized down and toward the end of the line (toward the right for left-to-right locales, toward the left for right-to-left locales). bottomleft resized down and to the left. bottomright resized down and to the right. topleft resized up and to the left. topright resized up and to the right. ...
resizer.type - Archive of obsolete content
« xul reference hometypetype: stringset this to the value "window" for a resizing grip that appears in the bottom corner of the window, used for resizing the window. as some platforms provide this resizing grip automatically, this type of resizer element will be hidden and ensure that the window does not get an extra resizer. ...
searchSessions - Archive of obsolete content
« xul reference home searchsessions obsolete since gecko 26 type: space-separated list of session names set to a keyword indicating what type of data to look up for autocomplete. you may set multiple types by separating their names by spaces. the following values are possible, although custom components may be installed which add others. history: the user's url history is searched. obsolete since gecko 3 addrbook: the user's address book is searched. obsolete since gecko 3 ldap: the user's ldap directories are searched. obsolete since gecko 25 ...
selected - Archive of obsolete content
« xul reference home selected type: boolean indicates whether the element is selected or not. this value is read-only. to change the selection, set either the selectedindex or selecteditem property of the containing element. see also visuallyselected ...
seltype - Archive of obsolete content
« xul reference home seltype type: one of the values below used to indicate whether multiple selection is allowed. single only one row may be selected at a time. (default in listbox and richlistbox.) multiple multiple rows may be selected at once. (default in tree.) for trees, you can also use the following values: cell individual cells can be selected text rows are selected; however, the selection highlight appears only over the text of the primary column. for richlistbox, this is new in firefox 3.5. ...
showpopup - Archive of obsolete content
...
sizetopopup - Archive of obsolete content
« xul reference home sizetopopup type: one of the values below indicates how the menu width and the menupopup width are determined. if the sizetopopup attribute is left out or set to none, the menu will be its preferred width and the popup may extend outside of this width, unaffected by the maximum width of the menu itself. otherwise, the menu will size itself to at least the size of the popup. if the menu has a maximum width, the popup will also be this width. none the width of the popup will not be constrained to the size of the menu. pref the preferred width of the menu label or button will be the size needed for the popup contents. this is the default value for menulists. always both the preferred and minimum width of the menu label or button will be the same a...
sortDirection - Archive of obsolete content
use the sortresource attribute to specify the sort key. ascending the data is sorted in ascending order. descending the data is sorted in descending order. ...
sortResource2 - Archive of obsolete content
...
spellcheck - Archive of obsolete content
« xul reference home spellcheck type: boolean if true, spell checking is enabled by default for the text box; if false, spell checking is disabled by default. if not specified, this defaults to false the html the spellcheck attribute uses values of true or false (you cannot simply add the spellcheck attribute to a given element): <!-- spellcheck everything! --> <input type="text" spellcheck="true" /><br /> <textarea spellcheck="true"></textarea> <div contenteditable="true" spellcheck="true">i am some content</div> <!-- spellcheck nothing! --> <input type="text" spellcheck="false" /><br /> <textarea spellcheck="false"></textarea> <div contenteditable="true" spellcheck="false">i am some content</div> you can use spellcheck on input, textarea, and contenteditable elements. ...
substate - Archive of obsolete content
since collapse="both" is a gecko 1.9+ feature, this will have no effect on earlier versions. before the element immediately before the splitter is collapsed. ...
targets - Archive of obsolete content
the command update will only occur when the event occurs to one of the specified elements. ...
textbox.autoFill - Archive of obsolete content
as of gecko 1.9.1, this attribute is now always specified in lower case. ...
textbox.disablehistory - Archive of obsolete content
« xul reference home disablehistory obsolete since gecko 2.0 type: boolean note: applies to: thunderbird and seamonkeyif false, an arrow button will appear on the end of the textbox which will open a dropdown menu of all available results. the default value is true, hiding the dropdown button. this attribute only works correctly in seamonkey 1.x; for thunderbird and seamonkey 2.0 you should also set the enablehistory attribute; as of gecko 2.0 this attribute is completely superseded by it. ...
textbox.minResultsForPopup - Archive of obsolete content
« xul reference home minresultsforpopup obsolete since gecko 1.9.1 type: integer the minimum number of results that must be returned for the popup to be displayed. the default value is 1. a zero value will always open the popup unless the textbox is empty. this can be used to display additional items that are not autocomplete results. as of gecko 1.9.1, this attribute is now always specified in lower case. ...
textbox.onchange - Archive of obsolete content
« xul reference home onchange type: script code this event is sent when the value of the textbox is changed. the event is not sent until the focus is moved to another element. see also onchange ...
titlebar - Archive of obsolete content
the noautohide attribute must be set to true. ...
toolbar.mode - Archive of obsolete content
icons show only icons. ...
toolbarbutton.title - Archive of obsolete content
« xul reference home title type: string this functionality only applies when toolbarbutton is used in the customize toolbar dialog. the text that is displayed as a button's label when it's in the customize toolbar palette. it overrides the value of label, which is used if title is not set. this does not affect the button's label when it is in a toolbar, which remains determined by the label attribute. see also title ...
tooltip - Archive of obsolete content
the tooltip will automatically disappear when the mouse is moved. ...
treecell.mode - Archive of obsolete content
« xul reference home mode type: one of the values below for columns that are progress meters, this determines the type of progress meter to use. none no progress meter is displayed. the cell text is displayed instead. normal the cell uses its value attribute to determine the amount of the bar that is filled in. undetermined the progressmeter is indeterminate. ...
treecol.type - Archive of obsolete content
the default is a text column that displays the content as text. checkbox the content of the columns are checkboxes. progressmeter the content of the columns are a progress meters. this is used in mozilla's download manager window. text the content of the columns is text. if you are using type="checkbox", then the tree and each treecol must be editable. you need to apply css to make the checkbox toggle. here is an example css style using the current theme's checkboxes: treechildren::-moz-tree-checkbox { /* unchecked checkbox treecells. ...
treecol.width - Archive of obsolete content
« xul reference home width type: string (representing an integer) the preferred width of the tree column. the value should not include a unit as all values are in pixels. specifying widths for your columns causes gecko to allow the tree to be scrolled horizontally if it is wider than the available space. ...
uri - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › uri
« xul reference home uri type: string for template-generated content, the attribute should be placed on the element where content generation should begin. thus, it should be placed on an element that is a descendant of a template. the value should be set to rdf:*. elements that appear inside the element with the attribute will be repeated for each node in the rdf datasource. elements outside will appear only once. ...
validate - Archive of obsolete content
« xul reference home validate type: one of the values below this attribute indicates whether to load the image from the cache or not. this would be useful if the images are stored remotely or you plan on swapping the image frequently. the following values are accepted, or leave out the attribute entirely for default handling: always the image is always checked to see whether it should be reloaded. never the image will be loaded from the cache if possible. ...
var - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › var
...
visuallyselected - Archive of obsolete content
« xul reference home visuallyselected type: boolean new in firefox 40. indicates that a tab is selected. the visuallyselected attribute is set asynchronously, once the browser has switched to the selected tab. if your code needs to apply some styling to the currently selected tab, this is the attribute you should use from firefox 40 onwards. this value is read-only. to change the selection, set either the selectedindex or selecteditem property of the containing element. ...
windowtype - Archive of obsolete content
« xul reference home windowtype type: string set to a string which can be used to identify the type of window. this might be used, for example, to distinguish between a browser window and an editor window. ...
wrap - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › wrap
« xul reference home wrap type: string set this attribute to the value off to disable word wrapping in the textbox. if this attribute is not specified, word wrapping is enabled. ...
wraparound - Archive of obsolete content
« xul reference home wraparound type: boolean if true, the value of the number box will wrap around when the maximum or minimum value is exceeded. the minimum and maximum values must both not be infinity. ...
Attribute (XUL) - Archive of obsolete content
owcaret showcommentcolumn showpopup size sizemode sizetopopup smoothscroll sort sortactive sortdirection sortresource sortresource2 spellcheck src state statedatasource statusbar statustext style subject substate suppressonselect tabindex tabscrolling targets template timeout title toolbarname tooltip tooltiptext tooltiptextnew top type uri useraction validate value var visuallyselected wait-cursor width windowtype wrap wraparound ...
Deprecated and defunct markup - Archive of obsolete content
n at end of scrollbar; had been only within larger <scrollbar>) so, not deprecated, but internal use only? ...
CheckboxStateChange - Archive of obsolete content
properties property type description target read only eventtarget the event target (the topmost target in the dom tree). type read only domstring the type of event. bubbles read only boolean does the event normally bubble? cancelable read only boolean is it possible to cancel the event? related events valuechange radiostatechange ...
RadioStateChange - Archive of obsolete content
property type description target read only eventtarget the event target (the topmost target in the dom tree). type read only domstring the type of event. bubbles read only boolean does the event normally bubble? cancelable read only boolean is it possible to cancel the event? related events checkboxstatechange valuechange ...
Working With Directories - Archive of obsolete content
or directory does not exist, so you should check first using nsifile.exists(). var dir = io.getfile("desktop", "myfiles"); dir.append("pictures"); if (dir.exists() && dir.isdirectory()) alert("this is a directory"); creating directories you can create a new directory by using nsifile.create(). for directories, the first argument to this method should be the constant directory_type (which has a value of 1). to create a file instead, you could use the constant normal_file_type instead. var dir = io.getfile("desktop", "myfiles"); dir.append("pictures"); if (!dir.exists()) dir.create(dir.directory_type, 0775); this example checks if the directory exists and creates it if it does not. if the directory already exists, then no action is taken. in this case, the directory is the 'pictures' subdir...
IO - Archive of obsolete content
Archive › Mozilla › XUL › FileGuide › IO
open and save dialogs. file errors see file errors for a list of errors that might occur while using files. working with directories directories may be accessed in a similar manner using nsiscriptableio.getfile(). for instance, in the following example, a subdirectory is retrieved. if the name 'subdirname' refers to a directory, then the returned object will refer to this directory. the returned value is still a nsifile object, however a number of methods may be used which are only of value for subdirectories. var file = io.getfile("profile", "subdirname"); for more information about using directories, see working with directories. specifically, to create a directory, see creating directories and to retrieve a list of files or subdirectories within a directory, see iterating over the files in...
addTabsProgressListener - Archive of obsolete content
« xul reference home addtabsprogresslistener( listener ) return type: no return value add a progress listener to the browser which will monitor loaded documents in all tabs in the tabbed browser. the progress listener should be based on the nsiwebprogresslistener interface with an additional "browser" argument as the first argument of every method, which is the browser (not <tabbrowser> = gbrowser) where the event occurred. see listening to events on all tabs for details. ...
onFindAgainCommand - Archive of obsolete content
« xul reference home onfindagaincommand( findprevious ) return type: no return value call this method to handle your application's "find next" and "find previous" commands. you should specify true as the input parameter to perform a "find previous" operation, or false to perform a "find next." example typically, you'll simply bind this method to your "find next" and "find previous" commands, like this: <command name="cmd_find_previous" oncommand="gfindbar.onfindagaincommand(true);"/> <command name="cmd_find_next" oncommand="gfindbar.onfindagaincommand(false);"/> ...
open - Archive of obsolete content
Archive › Mozilla › XUL › Method › Open
if you don't pass a mode, the last-used mode for the same findbar is used. ...
removeTabsProgressListener - Archive of obsolete content
« xul reference home removetabsprogresslistener( listener ) return type: no return value removes a progress listener to the browser which has been monitoring all tabs. the progress listener should implement the nsiwebprogresslistener interface. ...
startFind - Archive of obsolete content
this opens the findbar, focuses the edit field for the search term, and selects its contents. the first time this is called for a given findbar, the findbar will flash to draw attention to itself. the mode should be one of find_normal, find_typeahead, or find_links. if you don't pass a mode, the last-used mode for the same findbar is used. if the findbar hasn't been used before, find_normal is the default. ...
swapDocShells - Archive of obsolete content
during the swap, pagehide and pageshow events are fired on both browsers. this method can be used to move browser between windows or tear off a browser into a new window. ...
toggleHighlight - Archive of obsolete content
...
acceptDialog - Archive of obsolete content
...
addItemToSelection - Archive of obsolete content
...
addPane - Archive of obsolete content
Archive › Mozilla › XUL › Method › addPane
...
addProgressListener - Archive of obsolete content
« xul reference home addprogresslistener( listener ) return type: no return value add a progress listener to the browser which will monitor loaded documents. the progress listener should implement the nsiwebprogresslistener interface. ...
advance - Archive of obsolete content
Archive › Mozilla › XUL › Method › advance
this is equivalent to pressing the next button. the canadvance property must be set to true for the page to be changed. the code in the onwizardnext attribute is called before the page is changed. the pageid argument allows you to specify the index of the page to which to jump. ...
advanceSelectedTab - Archive of obsolete content
if the argument dir is set to -1, the currently selected tab changes to the previous tab. ...
appendGroup - Archive of obsolete content
the argument should be an array of objects, one for each document to load. the objects may be defined in script and contain a uri property for the url of the page to load. ...
blur - Archive of obsolete content
Archive › Mozilla › XUL › Method › blur
the focus is not automatically placed on any other element. ...
cancel - Archive of obsolete content
Archive › Mozilla › XUL › Method › cancel
« xul reference home cancel() return type: no return value call this method to cancel and close the wizard. the code in the onwizardcancel attribute is called before the wizard is cancelled. ...
cancelDialog - Archive of obsolete content
...
centerWindowOnScreen - Archive of obsolete content
...
checkAdjacentElement - Archive of obsolete content
if the argument dir is true, the next radio button is selected. ...
clearSelection - Archive of obsolete content
« xul reference home clearselection() return type: no return value deselects all of the items. a select event is sent before the items are deselected. ...
click - Archive of obsolete content
Archive › Mozilla › XUL › Method › click
...
close - Archive of obsolete content
Archive › Mozilla › XUL › Method › close
...
collapseToolbar - Archive of obsolete content
...
doCommand - Archive of obsolete content
...
ensureElementIsVisible - Archive of obsolete content
if the item is already visible, no scrolling occurs. ...
ensureIndexIsVisible - Archive of obsolete content
« xul reference home ensureindexisvisible( index ) return type: no return value if the item at the specified index is not currently visible to the user the displayed items are scrolled so that it is. if the item is already visible, no scrolling occurs. ...
ensureSelectedElementIsVisible - Archive of obsolete content
if the item is already visible, no scrolling occurs. ...
expandToolbar - Archive of obsolete content
...
extra1 - Archive of obsolete content
Archive › Mozilla › XUL › Method › extra1
« xul reference home extra1() return type: no return value call this method to simulate clicking the extra1 button. the code in the onextra1 attribute is called. ...
extra2 - Archive of obsolete content
Archive › Mozilla › XUL › Method › extra2
« xul reference home extra2() return type: no return value call this method to simulate clicking the extra2 button. the code in the onextra2 attribute is called. ...
focus - Archive of obsolete content
Archive › Mozilla › XUL › Method › focus
« xul reference home focus() return type: no return value assigns the focus to the element, if it can accept the focus. the onfocus handler is called if the toplevel window is active. ...
getElementsByAttributeNS - Archive of obsolete content
« xul reference home getelementsbyattributens(ns, attrib, value ) return type: dom nodelist returns an array of all the child elements of the element that have the attribute namespace given by the first argument, the attribute name given by the second argument, and the value given by the third argument. if the namespace (first argument) is set to '*', elements with any attribute namespace will be retrieved. if the third argument is '*', the elements retrieved may have the attribute (second argument) set to any value. note that this method is only available on xul elements and is not part of the dom. ...
getResultAt - Archive of obsolete content
...
getSessionStatusAt - Archive of obsolete content
...
goBack - Archive of obsolete content
Archive › Mozilla › XUL › Method › goBack
...
goBackGroup - Archive of obsolete content
...
goDown - Archive of obsolete content
Archive › Mozilla › XUL › Method › goDown
...
goForward - Archive of obsolete content
...
goForwardGroup - Archive of obsolete content
...
goHome - Archive of obsolete content
Archive › Mozilla › XUL › Method › goHome
...
goTo - Archive of obsolete content
Archive › Mozilla › XUL › Method › goTo
« xul reference home goto( pageid ) return type: no return value this method is used to change which page is currently displayed, specified by the pageid argument. the page will be changed regardless of the value of canadvance or canrewind. the onwizardback and onwizardnext code is not called when using this function. ...
goUp - Archive of obsolete content
Archive › Mozilla › XUL › Method › goUp
...
gotoIndex - Archive of obsolete content
« xul reference home gotoindex( index ) return type: no return value navigate to the page in the history with the given index. use a positive number to go forward and a negative number to go back. ...
hidePopup - Archive of obsolete content
...
invertSelection - Archive of obsolete content
« xul reference home invertselection() return type: no return value reverses the selected state of all items. selected items become deselected, and deselected items become selected. ...
loadTabs - Archive of obsolete content
if loadinbackground is true, the tabs are loaded in the background, and if replace is true, the currently displayed tabs are replaced with the specified uris instead of adding new tabs. ...
loadURI - Archive of obsolete content
Archive › Mozilla › XUL › Method › loadURI
« xul reference home note: this is the xul method on <browser> / <tabbrowser>, not the global function in chrome://browser/content/browser.js. please check which one you're documenting! (this one has no post data parameter, see loaduriwithflags for a version that does) loaduri( uri, referrer, charset ) return type: no return value load a url into the document, with the given referrer and character set. the first argument should be a string, not a nsiuri object. to get a string from an nsiuri, use nsiuri.spec or nsiuri.asciispec ...
loadURIWithFlags - Archive of obsolete content
in addition to the flags allowed for the reloadwithflags method, the following flags are also valid: load_flags_is_refresh: this flag is used when the url is loaded because of a meta tag refresh or redirect. load_flags_is_link: this flag is used when the url is loaded because a user clicked on a link. the http referer header is set accordingly. load_flags_bypass_history: do not add the url to the session history. ...
makeEditable - Archive of obsolete content
specify text or html as the editortype. ...
menulist.select - Archive of obsolete content
« xul reference home select() return type: no return value select all the text in the menulist's textbox. this method applies to editable menulists only. see also select ...
moveByOffset - Archive of obsolete content
if offset is negative, adjusts the focused item backward by that many items. if isselecting is true, then the selection is also adjusted. if isselectingrange is also true, then the new item is selected in addition to any currently selected items. ...
moveTo - Archive of obsolete content
Archive › Mozilla › XUL › Method › moveTo
« xul reference home moveto( x, y ) return type: no return value moves the popup to a new location defined by screen coordinates (and not client coordinates). if both x and y have the value -1 the call will realign the popup with its anchor node. ...
moveToAlertPosition - Archive of obsolete content
...
onSearchComplete - Archive of obsolete content
you should not call this method yourself. ...
openPopupAtScreen - Archive of obsolete content
« xul reference home openpopupatscreen( x, y, iscontextmenu ) return type: no return value open the popup at a specific screen position specified by x and y. this position may be adjusted if it would cause the popup to be off of the screen. the x and y coordinates are measured in css pixels. ...
pinTab - Archive of obsolete content
Archive › Mozilla › XUL › Method › pinTab
...
reload - Archive of obsolete content
Archive › Mozilla › XUL › Method › reload
...
reloadAllTabs - Archive of obsolete content
...
reloadTab - Archive of obsolete content
...
reloadWithFlags - Archive of obsolete content
the flags listed below may be used, which are all constants of the webnavigation property (or the nsiwebnavigation interface). you may combine flags using a or symbol ( | ). load_flags_none: no special flags. the document is loaded normally. load_flags_bypass_cache: reload the page, ignoring if it is already in the cache. this is the flag used when the reload button is pressed while the shift key is held down. load_flags_bypass_proxy: reload the page, ignoring the proxy server. ...
removeAllItems - Archive of obsolete content
...
removeAllNotifications - Archive of obsolete content
if immediate is true, the messages are removed immediately. ...
removeAllTabsBut - Archive of obsolete content
« xul reference home removealltabsbut( tabelement ) return type: no return value removes all of the tab panels except for the one corresponding to the specified tab. if only one tab page is displayed, this method does nothing. ...
removeCurrentNotification - Archive of obsolete content
...
removeItemFromSelection - Archive of obsolete content
...
removeProgressListener - Archive of obsolete content
...
removeTab - Archive of obsolete content
if only one tab is displayed, this method does nothing (unless the preference browser.tabs.closewindowwithlasttab is true, in which case the window containing the tab is closed). ...
reset - Archive of obsolete content
Archive › Mozilla › XUL › Method › reset
« xul reference home reset() return type: no return value resets the preference to its default value. for a textbox it also clears the undo transaction list (gecko 1.9). ...
rewind - Archive of obsolete content
Archive › Mozilla › XUL › Method › rewind
it is equivalent to pressing the back button. the canrewind property must be set to true for the page to be changed. ...
scrollByIndex - Archive of obsolete content
« xul reference home scrollbyindex( lines ) return type: no return value scrolls the contents of the arrowscrollbox by a certain number of lines. a line is a single element. use a positive value as the lines argument to scroll forward that many lines, or a negative value to scroll backward that many lines. ...
scrollByPixels - Archive of obsolete content
« xul reference home scrollbypixels( pixels ) return type: no return value scrolls the contents of the arrowscrollbox by a certain number of pixels. use a positive value as the pixels argument to scroll forward that many pixels, or a negative value to scroll backward that many pixels. ...
scrollToIndex - Archive of obsolete content
« xul reference home scrolltoindex( index ) return type: no return value scrolls the element to the specified index. this is different than ensureindexisvisible because the view is always scrolled. ...
select - Archive of obsolete content
Archive › Mozilla › XUL › Method › select
...
selectAll - Archive of obsolete content
« xul reference home selectall() return type: no return value selects all of the items. a select event is sent after the selection is made. ...
selectItem - Archive of obsolete content
a select event is sent after the selection is made. ...
selectItemRange - Archive of obsolete content
all other items are deselected. ...
selectTabAtIndex - Archive of obsolete content
« xul reference home selecttabatindex( index, event ) return type: no return value selects the tab at the given index. index values may be positive or negative. if the event argument is supplied, the default event handling will be prevented and propagation stopped. ...
setIcon - Archive of obsolete content
Archive › Mozilla › XUL › Method › setIcon
see geticon to get the current icon. ...
setSelectionRange - Archive of obsolete content
« xul reference home setselectionrange( start, end ) return type: no return value sets the selected portion of the textbox, where the start argument is the index of the first character to select and the end argument is the index of the character after the selection. set both arguments to the same value to move the cursor to the corresponding position without selecting text. ...
showOnlyTheseTabs - Archive of obsolete content
...
showPane - Archive of obsolete content
...
sizeTo - Archive of obsolete content
Archive › Mozilla › XUL › Method › sizeTo
...
startEditing - Archive of obsolete content
« xul reference home startediting( row, column ) return type: no return value activates user editing of the given cell, which is specified by row index number and the nsitreecolumn in which it is located. the tree view's nsitreeview.getcelltext() method is called to obtain the cell contents. ...
stop - Archive of obsolete content
Archive › Mozilla › XUL › Method › stop
...
stopEditing - Archive of obsolete content
« xul reference home stopediting( shouldaccept ) return type: no return value stops editing the cell currently being edited. if the shouldaccept parameter is true, the cell's label is changed to the edited value (the tree view's nsitreeview.setcelltext() method is called to change the cell contents). otherwise the cell label is reverted to the value it had prior to editing. ...
timedSelect - Archive of obsolete content
all other items are deselected. ...
toggleItemSelection - Archive of obsolete content
if it is not selected, it is selected. ...
unpinTab - Archive of obsolete content
...
Methods - Archive of obsolete content
ementisvisible expandtoolbar extra1 extra2 focus getbrowseratindex getbrowserfordocument getbrowserfortab getbrowserindexfordocument getbutton getdefaultsession geteditor getelementsbyattribute getelementsbyattributens getformattedstring gethtmleditor getindexoffirstvisiblerow getindexofitem getitematindex getnextitem getnotificationbox getnotificationwithvalue getnumberofvisiblerows getpagebyid getpreviousitem getresultat getresultcount getresultvalueat getrowcount getsearchat getselecteditem getsession getsessionbyname getsessionresultat getsessionstatusat getsessionvalueat getstring goback gobackgroup godown goforward goforwardgroup gohome goto gotoindex goup hidepopup increase increasepage inse...
Floating Panels - Archive of obsolete content
els a floating panel is used for secondary popups such as tool palettes and property inspector panels. it will have a titlebar which the user may use to move the panel around on the screen. a floating panel can be created using the panel element with at least two additional attributes as in the following example: <panel id="tools-panel" noautohide="true" titlebar="normal"> <label control="name" value="name:"/> <textbox id="name"/> </panel> the noautohide attribute is used to indicate that the panel is not temporary. when set to true, the popup will not close when the user clicks outside of it, nor when the user presses the escape key. the titlebar attribute creates a panel with a titlebar. currently, only the value normal is supported, which creates a default titlebar. in the future, a dis...
MoveResize - Archive of obsolete content
may be used to move and resize them. moving a popup once a popup is open, it can be moved using the popup's moveto method. void moveto(in long left, in long top); the left argument is the horizontal screen position and the top argument is the vertical screen position. this method will change the left and top attributes to match the supplied arguments, so if these attributes are persisted the values will be restored when the window is displayed again. for instance, the following example will move a popup to the upper left corner of the screen: popup.moveto(0, 0); the position may be shifted so as not to cover user interface elements provided by the operating system, such as the menu bar or the task bar. resizing a popup the size of a popup is determined automatically based on the cont...
PopupKeys - Archive of obsolete content
hen a panel is opened, the focus is removed from any element that has it. this allows the focus to be shifted to elements within the panel. for more information about focus handling within panels, see focus in panels. ignoring keys the ignorekeys attribute may be used to disable the key listener described above. when the ignorekeys attribute is placed on a <menupopup> or <panel> element, and its value is set to the value true, the key listener is not used. <panel ignorekeys="true"> in this case, none of the key handling described above is performed. instead, you will have to handle this yourself. you would not normally use this attribute for a menu, however you may wish to disable the escape key handling for a panel in this way. ...
findMode - Archive of obsolete content
« xul reference findmode type: integer read only. the find mode in use. ...
flexGroup - Archive of obsolete content
...
highlightNonMatches - Archive of obsolete content
...
searchButton - Archive of obsolete content
...
accessKey - Archive of obsolete content
...
align - Archive of obsolete content
Archive › Mozilla › XUL › Property › align
...
allowEvents - Archive of obsolete content
...
alwaysOpenPopup - Archive of obsolete content
...
autoCheck - Archive of obsolete content
...
autoFill - Archive of obsolete content
...
autoFillAfterMatch - Archive of obsolete content
...
buttons - Archive of obsolete content
this button will also be the default button. cancel: the cancel button which will cancel the operation. help: a help button for displaying help about the dialog. disclosure: a button to show more information. this might be a button or a disclosure triangle. extra1: an optional additional button. ...
checked - Archive of obsolete content
...
className - Archive of obsolete content
...
collapsed - Archive of obsolete content
...
command - Archive of obsolete content
...
completeDefaultIndex - Archive of obsolete content
...
contextMenu - Archive of obsolete content
« xul reference contextmenu type: popup element id gets and sets the value of the contextmenu attribute. note that the value of this property does not reflect the value of the context attribute, which is otherwise identical to the contextmenu attribute. ...
control - Archive of obsolete content
« xul reference control type: element id gets and sets the value of the control attribute. see also menuitem.control radio.control tab.control ...
crop - Archive of obsolete content
Archive › Mozilla › XUL › Property › crop
...
current - Archive of obsolete content
...
currentIndex - Archive of obsolete content
type: integer set to the row index of the tree caret in the tree. for trees with focus, the caret's position is indicated by the focus ring, but unfocused trees won't show a focus ring, naturally. for unfocused trees, the (undrawn) caret's position can still be obtained by this property. if the caret isn't present for any row (for example, because the tree has never been focused), the value will be -1. you cannot rely on this property to change or determine a tree selection, except for trees with seltype="single". (all trees have seltype="multiple" by default.) to reliably change or determine a selection, instead use the nsitreeselection interface methods available via tree.view.selection. example // one way of retrieving the text of a cell. <script language ="javascrip...
currentPage - Archive of obsolete content
...
currentSet - Archive of obsolete content
« xul reference currentset not in seamonkey 1.x type: comma-separated list of strings holds a comma-separated list of the ids of the items currently on the toolbar. for spacers, separators, and flexible spacers the following strings are used instead of ids: "spacer", "separator", "spring". an empty toolbar has a currentset value of "__empty". you may change the current set of items by setting this property. be careful, as setting this property doesn't automatically update the currentset attribute. ...
datasources - Archive of obsolete content
« xul reference datasources type: space-separated list of datasource uris gets and sets the value of the datasources attribute. in newer versions of mozilla (1.7+), the datasources will be reloaded and the template rebuilt. ...
dateLeadingZero - Archive of obsolete content
...
decimalPlaces - Archive of obsolete content
...
decimalSymbol - Archive of obsolete content
« xul reference decimalsymbol type: string the character used for the decimal place indicator. the default value is a period (.) ...
deck.selectedPanel - Archive of obsolete content
...
defaultButton - Archive of obsolete content
...
dir - Archive of obsolete content
Archive › Mozilla › XUL › Property › dir
...
disableAutocomplete - Archive of obsolete content
...
disableKeyNavigation - Archive of obsolete content
...
disableautoselect - Archive of obsolete content
...
disabled - Archive of obsolete content
« xul reference disabled type: boolean gets and sets the value of the disabled attribute. <!-- checkbox enables/disables the button --> <checkbox label="enable button" oncommand="document.getelementbyid('buttremove').disabled = ! this.checked"/> <button id="buttremove" label="remove all" disabled="true"/> ...
dlgType - Archive of obsolete content
...
emptyText - Archive of obsolete content
« xul reference emptytext deprecated since gecko 2 type: string gets and sets a string that appears in the textbox when it has no value. this is superseded by the placeholder property in gecko 2.0. the old name is retained for compatibility, but you should update your code. ...
flex - Archive of obsolete content
Archive › Mozilla › XUL › Property › flex
...
focused - Archive of obsolete content
...
forceComplete - Archive of obsolete content
...
group - Archive of obsolete content
Archive › Mozilla › XUL › Property › group
...
handleCtrlPageUpDown - Archive of obsolete content
...
handleCtrlTab - Archive of obsolete content
...
height - Archive of obsolete content
...
hidden - Archive of obsolete content
...
homePage - Archive of obsolete content
...
hourLeadingZero - Archive of obsolete content
...
id - Archive of obsolete content
Archive › Mozilla › XUL › Property › id
...
ignoreBlurWhileSearching - Archive of obsolete content
...
image - Archive of obsolete content
Archive › Mozilla › XUL › Property › image
...
increment - Archive of obsolete content
...
inverted - Archive of obsolete content
...
is24HourClock - Archive of obsolete content
« xul reference is24hourclock type: boolean a read only value indicating whether a 12-hour or 24-hour clock is used to display times. with a 12-hour clock, an extra field allows the user to pick between am and pm. this value is determined from the user's locale. ...
label - Archive of obsolete content
Archive › Mozilla › XUL › Property › label
« xul reference label type: string gets and sets the value of the label attribute. see also richlistitem.label textbox.label ...
left - Archive of obsolete content
Archive › Mozilla › XUL › Property › left
...
linkedPanel - Archive of obsolete content
...
listbox.currentIndex - Archive of obsolete content
(or, on some platforms, typeof(listboxcurrentindex) will be undefined) in a single selection list, the current index will always be the same as the selected index. ...
locked - Archive of obsolete content
this property is read-only. ...
max - Archive of obsolete content
Archive › Mozilla › XUL › Property › max
...
maxHeight - Archive of obsolete content
...
maxRows - Archive of obsolete content
...
maxWidth - Archive of obsolete content
note: prior to gecko 6.0, you could use this on <input> elements; this was never intended, was a violation of the html specification, and has been fixed. ...
menu - Archive of obsolete content
Archive › Mozilla › XUL › Property › menu
...
min - Archive of obsolete content
Archive › Mozilla › XUL › Property › min
...
minHeight - Archive of obsolete content
...
minResultsForPopup - Archive of obsolete content
...
minWidth - Archive of obsolete content
...
minuteLeadingZero - Archive of obsolete content
...
mode - Archive of obsolete content
Archive › Mozilla › XUL › Property › mode
...
monthLeadingZero - Archive of obsolete content
...
object - Archive of obsolete content
...
observes - Archive of obsolete content
...
open - Archive of obsolete content
Archive › Mozilla › XUL › Property › open
« xul reference open type: boolean gets and sets the value of the open attribute. see also colorpicker.open datepicker.open menu.open ...
ordinal - Archive of obsolete content
...
orient - Archive of obsolete content
...
pack - Archive of obsolete content
Archive › Mozilla › XUL › Property › pack
...
pageIncrement - Archive of obsolete content
...
persist - Archive of obsolete content
...
persistence - Archive of obsolete content
...
placeholder - Archive of obsolete content
...
position - Archive of obsolete content
...
priority - Archive of obsolete content
...
readOnly - Archive of obsolete content
...
ref - Archive of obsolete content
Archive › Mozilla › XUL › Property › ref
...
resource - Archive of obsolete content
if the ref attribute is not specified, the id attribute is used instead. ...
richlistitem.label - Archive of obsolete content
use the child elements directly to set label text. ...
searchLabel - Archive of obsolete content
...
searchParam - Archive of obsolete content
...
searchSessions - Archive of obsolete content
...
secondLeadingZero - Archive of obsolete content
...
selType - Archive of obsolete content
...
selected - Archive of obsolete content
this property is read only. ...
selectedPanel - Archive of obsolete content
« xul reference selectedpanel type: element holds a reference to the currently selected panel within a <tabbox> element. assigning a value to this property will modify the selected panel. a select event will be sent when the selected panel is changed. ...
selectedTab - Archive of obsolete content
...
selectionEnd - Archive of obsolete content
« xul reference selectionend type: integer get or set the end of the selected portion of the field's text. use in conjuction with the selectionstart property. the value specifies the index of the character after the selection. if this value is equal to the value of the selectionstart property, no text is selected, but the value indicates the position of the caret (cursor) within the textbox. ...
selectionStart - Archive of obsolete content
...
selstyle - Archive of obsolete content
otherwise, the entire row will be highlighted. ...
showCommentColumn - Archive of obsolete content
...
showImageColumn - Archive of obsolete content
...
showPopup - Archive of obsolete content
...
size - Archive of obsolete content
Archive › Mozilla › XUL › Property › size
...
src - Archive of obsolete content
Archive › Mozilla › XUL › Property › src
...
state - Archive of obsolete content
Archive › Mozilla › XUL › Property › state
open: the popup is open and visible on screen. showing: a request has been made to open the popup, but it has not yet been shown. ...
statusText - Archive of obsolete content
...
statusbar - Archive of obsolete content
...
style - Archive of obsolete content
Archive › Mozilla › XUL › Property › style
...
suppressOnSelect - Archive of obsolete content
...
tabIndex - Archive of obsolete content
...
tabScrolling - Archive of obsolete content
...
tag - Archive of obsolete content
Archive › Mozilla › XUL › Property › tag
« xul reference tag type: tag name this may be set to a tag name. if set, the conditions will only match if the template builder is parsing content for an element directly inside this tag. for example, by using a value of treechildren, the condition will only match when placing elements directly inside a treechildren tag. thus, nested elements will not match because they are directly inside a treeitem. this attribute is useful to provide different rules for outer and inner elements. ...
textbox.label - Archive of obsolete content
« xul reference label type: string sets the label attribute. gets the label attribute if it is present and not empty. otherwise it returns the value of the associated label element, if applicable. otherwise it returns the placeholder or emptytext property. the getter is mostly useful for screen readers. note: prior to firefox 3, and always in thunderbird and seamonkey, the label property of an autocomplete textbox returns its value, for compatibility with the menulist element. ...
textbox.type - Archive of obsolete content
see also type ...
timeout - Archive of obsolete content
...
tooltip - Archive of obsolete content
...
tooltipText - Archive of obsolete content
...
top - Archive of obsolete content
Archive › Mozilla › XUL › Property › top
...
triggerNode - Archive of obsolete content
...
type - Archive of obsolete content
Archive › Mozilla › XUL › Property › type
see also textbox.type ...
userAction - Archive of obsolete content
...
width - Archive of obsolete content
Archive › Mozilla › XUL › Property › width
...
wrapAround - Archive of obsolete content
...
yearLeadingZero - Archive of obsolete content
...
Notes - Archive of obsolete content
implementing an nsicommandlinehandler on windows may trigger a bug that causes an error message ("windows cannot find the file specified") to be displayed when opening external links (like from a shortcut or from an external application). deleting the "(default)" values in the following registry keys will fix this: hkey_classes_root\http\shell\open\ddeexec hkey_classes_root\https\shell\open\ddeexec you can also do this from within your xpcom component using windows registry interface. some more links on the matter: a mozillazine post. a blog post. ...
Additional Template Attributes - Archive of obsolete content
. the generated content is always inserted into the root node, in this example the listbox, not inside the template. declaring the container and member variables normally, the container and member variables are determined by the template builder automatically. the container or starting node variable is specified in the <content> tag inside a query, while the member variable is determined by the value of the uri attribute inside the action body. it is also possible to be explicit about the two variables by using two attributes on the <template> element. <template container="?first" member="?item"> the container and member attributes can be used to specify the container and member variables. this isn't particularly useful although there is a very slight optimization since the builder does not...
Recursive Generation - Archive of obsolete content
the second <hbox> element will have additional children added to it. for a nested item, the builder processes the query in the same way as usual, however instead of using the ref attribute as the seed starting point, the end point or member is used instead. this will correspond to the id on the appropriate element in the generated content above. to begin, b is evaluated and seeded with the right value: (?start = http://www.xulplanet.com/rdf/b) the <triple> statement is then examined, however, item b doesn't have a relateditem arc out of it, so the result is rejected. since there are no potential results, the builder doesn't generate anything. a similar situation will occur for item d. however, for item c, the triple does match an item, so the data will be added to the potential result: (?star...
XML Assignments - Archive of obsolete content
onal 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="?namelength" expr="string-length(@name)"/> <assign var="?siblings" expr="count(../*) - 1"/> </query> <action> <hbox uri="?" align="center"> <button label="?name"/> <label value="?gender"/> <label value="?namelength"/> <label value="?siblings"/> </hbox> </action> </template> </vbox> two assign elements are placed as children of the query element. it allows 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 tha...
The Joy of XUL - Archive of obsolete content
to the desktop. before the web became the standard for delivering applications to users across disparate desktops, this problem was solved with cross-platform client-server tools. but these offerings were invariably proprietary, cost a substantial amount of money per developer, and had runtime license fees that kept you humble and tightly tethered to the vendor. mozilla delivers much of the same value as these cross platform tools, but with an open source license. as a rapidly maturing cross-platform technology, xul could fill an interesting void for technologies such as java j2ee and microsoft .net which focus on enabling network access to distributed objects. dynamic application logic can benefit significantly from a ui presentation layer that is standards-based, scriptable, extensible, and...
SeaMonkey - making custom toolbar (SM ver. 1.x) - Archive of obsolete content
are in png format. some other formats will also work. here are some more images that you can download and use: restart the application to find the new button. you can repeat these steps to add as many buttons as you need. positioning buttons to position your buttons on each toolbar, you can use their position attributes in button.xul. you might have to use trial and error to find values that work well, and you might find that not all positions are possible using this technique. this simplfied tutorial handles all the toolbars in a single file, button.xul. this is not always satisfactory. if you find that settings for different toolbars interfere with each other, make a separate xul file for each toolbar by copying button.xul and removing that parts that you do not need. change ...
Adding Buttons - Archive of obsolete content
this attribute on all elements. you'll want to use this if you want to refer to the button in a style sheet or script. however, you should add this attribute to almost all elements. it isn't always placed on elements in this tutorial for simplicity. class the style class of the button. this works the same as in html. it is used to indicate the style that the button appears in. in this case the value dialog is used. in most cases, you will not use a class for a button. label the label that will appear on the button. for example, ok or cancel. if this is left out, no text appears. image the url of the image to appear on the button. if this is attribute is left out, no image appears. you can also specify the image in a stylesheet using the list-style-image property. disabled if this at...
Adding Style Sheets - Archive of obsolete content
p> <menuitem label="is"/> <menuitem label="is not"/> </menupopup> </menulist> <spacer class="springspace"/> <menulist id="find-text" flex="1" editable="true" datasources="file:///mozilla/recents.rdf" ref="http://www.xulplanet.com/rdf/recent/all"/> ... <spacer class="titlespace"/> <hbox> <progressmeter id="progmeter" value="50%" style="display:none;"/> the new xml-stylesheet line is used to import the style sheet. it will contain the styles instead of having them directly in the xul file. you can include any number of style sheets in a similar way. here the style sheet is placed in the same directory as findfile.xul. some of the styles in the code above have been removed. one that wasn't was the display proper...
Box Model Details - Archive of obsolete content
ell, although the second button will be underneath the first one, instead of beside it. a find text dialog example 5 : source view <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findtext" title="find text" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <vbox flex="3"> <label control="t1" value="search text:"/> <textbox id="t1" style="min-width: 100px;" flex="1"/> </vbox> <vbox style="min-width: 150px;" flex="1" align="start"> <checkbox id="c1" label="ignore case"/> <spacer flex="1" style="max-height: 30px;"/> <button label="find"/> </vbox> </window> here, two vertical boxes are created, one for the textbox and the other for the check box and button. the lef...
Commands - Archive of obsolete content
e command id. a simple way of using commands is as follows: example: simple command example 1 : source view <command id="cmd_openhelp" oncommand="alert('help!');"/> <button label="help" command="cmd_openhelp"/> in this example, instead of placing the oncommand attribute on the button, we instead place it on a command element. the two are then linked using the command attribute, which has the value of the command's id. the result is that when the button is pressed, the command 'cmd_openhelp' is invoked. there are two advantages to using this approach. first, it moves all your operations onto commands which can all be grouped together in one section of the xul file. this means that code is all together and not scattered throughout the ui code. the other advantage is that several buttons...
Creating a Skin - Archive of obsolete content
s the rounding on the first tab and the second sets the rounding on the last tab. used here is a special mozilla style rule, -moz-border-radius, that creates rounded border corners. the upper left border of the first tab and the upper right border of the second tab are rounded by four pixels and the other corners have a round corner of zero pixels, which is equivalent to no rounding. increase the values here for more rounding and decrease them for a more rectangular look. the last rule only applies to tabs that have their selected attribute set to true. it makes the text in the selected tab appear bold, underlined and dark blue. note in the image that this style has applied only to the first tab, because it's the selected one. adding toolbar icons it is somewhat difficult to distinguish the ...
Creating a Window - Archive of obsolete content
ally put an id attribute on all elements. the name can be anything you want although it should be something relevant. title="find files" the title attribute describes the text that would appear on the title bar of the window when it is displayed. in this case the text 'find files' will appear. orient="horizontal" the orient attribute specifies the arrangement of the items in the window. the value horizontal indicates that items should be placed horizontally across the window. you may also use the value vertical, which means that the items are placed in a column. this is the default value, so you may leave the attribute off entirely if you wish to have vertical orientation. xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> this line declares the namespace for xul, w...
Creating an Installer - Archive of obsolete content
called when the install is complete. you can name the function whatever you like of course. this function has two arguments. the first is the name of the package that was just installed. this is important if you are installing multiple components. the second argument is a result code. if the result is 0, the installation completed successfully. if the result is non-zero, an error occured and the value is an error code. the function donefn() here just displays an alert box to the user. next, we create an array xpi which will hold the name (calendar) and url (calendar.xpi) of the installer. you can add an additional similar such line for each package you wish to have installed. finally, we call the install function. when this section of script is executed, the file calendar.xpi will be install...
Features of a Window - Archive of obsolete content
defaults to vertical orientation. you can also specify the width and height directly on the window tag. this, of course, causes the window to be displayed in a specific size. if you leave it out, the size is determined by the elements that are in it. gecko 1.9.2 note starting in gecko 1.9.2 (firefox 3.6), overriding the position of a window using window features will not change the persisted values saved by the session store feature. that means the next time the window is opened, it will still open in the saved location. <window id="findfile-window" title="find files" width="400" height="450" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> in this example, the window will open with a width of 400 pixels and a height of 450 pixels. even if there aren't ...
Install Scripts - Archive of obsolete content
ns and plugins. when a new component is installed, the registry gets updated. the registry also stores the set of files and version information about the installed components. that way, it is easier to check if a version of your component is already present and only update it if necessary. the component registry works somewhat like the windows registry does. it consists of a hierarchy of keys and values. you don't need to know much about it to create xul applications unless you are creating your own xpcom components. what you do need to know for an installation is that the registry stores a set of information about your application, such as the file list and versions. all of this information is stored in a key (and within subkeys) that you provide in the installation script (in step 1 mentioned...
Introduction - Archive of obsolete content
xtension manager which allows packages to be installed without having to write a lot of complex code. what do i need to know to use this tutorial? you should have an understanding of html and at least a basic understanding of xml and css. here are some guidelines to keep in mind: xul elements and attributes should all be entered in lowercase as xml is case-sensitive (unlike html). attribute values in xul must be placed inside quotes, even if they are numbers. xul files are usually split into four files, one each for the layout and elements, for style declarations, for entity declarations (used for localization) and for scripts. in addition, you may have extra files for images or for platform specific data. xul is supported in mozilla and browsers that are also based upon on the gecko e...
Open and Save Dialogs - Archive of obsolete content
turns a status code that indicates what the user selected. note that the function does not return until the user has selected a file. the function returns one of three constants: returnok - the user selected a file and pressed ok. the file the user selected will be stored in the file picker's file property. returncancel - the user pressed cancel. returnreplace - in the save mode, this return value identifies that the user selected a file to be replaced. (returnok will be returned when the user entered the name of a new file.) you should check the return value and then get the file object from the file picker using the file property. var res = fp.show(); if (res != nsifilepicker.returncancel){ var thefile = fp.file; // --- do something with the file here --- } next, we'll see how t...
Stack Positioning - Archive of obsolete content
he positions of the child elements. it is always sized so that all of the child elements are visible (excluding any children with -moz-stack-sizing: ignore). so if you set a left attribute to 400, the stack will have a width around 400 pixels plus the width of the element. you can override this size with the various style properties such as width and max-width. you can use a script to adjust the value of the left and top attributes and thus make the elements move around. stacks have the advantage that when one absolutely positioned element changes its position, the position of the other elements is not affected. if you tried to move elements in a regular box, other elements might shuffle their positions around. it is also possible to place the child elements so that they overlap. when drawing...
Tabboxes - Archive of obsolete content
age with the check box labeled 'automatically check for mail' will appear. when the second tab is clicked, the page containing the button labeled 'clear news buffer' will appear instead. the currently selected tab element is given an additional selected attribute which is set to true. this alters the appearance of the currently selected tab to make it look selected. only one tab will have a true value for this attribute at a time. position of the tabs finally, you can change the position of the tabs so that they appear on any side of the tab pages. there is no special syntax to do this. you simply set the orient and dir attributes as necessary. remember that the tab elements are much like regular boxes in terms of layout. moreover, the tabbox element is much like a regular container box with...
XUL Structure - Archive of obsolete content
r the remainder of the application session. this improves performance. however, because of this, the xul will be not be reloaded even when the source files are changed. to disable this mechanism, it is necessary to change the preference nglayout.debug.disable_xul_cache. in firefox, this preference may be added to the user preferences by typing "about:config" in the address field, and setting this value to true. or, just manually edit your user.js preferences file and add the following line: pref("nglayout.debug.disable_xul_cache", true); there are usually three different parts to a chrome package, although they are all optional. each part is stored in a different directory. these three sets are the content, the skin, and the locale, which are all described below. a particular package might p...
Using spell checking in XUL - Archive of obsolete content
ourdly to user personal dictionary } else { // it's spelled incorrectly } } 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 } ...
Using the Editor from XUL - Archive of obsolete content
the url load, which the most important part here. when the xul was parsed, the src attribute on the content frame was set to about:blank (our default 'blank page' url). we can't set that before xul parsing, so we have to force a load of the page we now want to edit. we get the url to load from the args element, then kick off the load: var url = document.getelementbyid("args").getattribute("value"); editorshell.loadurl(url); loading the document in the <iframe> of course happens asynchronously, so we need to know when we have a document that we can start editing. nseditorshell is able to observe the document load on the <iframe>, because it implements nsidocumentloaderobserver, and registered itself as a doc loader when it was assigned the content window. it thus gets callbacks for ...
XULBrowserWindow - Archive of obsolete content
ut:addons and any other pages in the in content whitelist. you can augment the functionality of this method using chaining in order to hide chrome for other locations. see hiding browser chrome for details and an example. boolean hidechromeforlocation( in string alocation ); parameters alocation the url to check to see if chrome should be hidden while that location is displayed. return value true if chrome should be hidden while displaying the specified location; otherwise false. ...
XUL Coding Style Guidelines - Archive of obsolete content
t is localizable? widget resources content data style info layout geometry how to make them localizable? localization notes localization notes are the xul writers' notes to the localizers/translators. they are placed above the actual entity string in the format: <!-- localization note (entity.name): content --> where the <var>entity.name</var> is the entity name (id) for the string (entity value) to be localized, and the content provides helpful hints to the localizers. for example: <!-- localization note homebtn.label : do not translate the entity value "home". --> <!-- entity homebtn.label "home" --> properties files are very similar, but use the pound sign instead of <!--<var>xxxxx</var>-->: # localization note entity name : content we recognize that translation is a subset of l...
action - Archive of obsolete content
eference home [ examples | attributes | properties | methods | related ] used to specify the content that should be generated for each matching result from a query. the action should be contained within a query or rule element. one descendant of the action body should have a uri attribute set to the member variable. this element and its descendants may use variables in place of attribute values. variables are a question mark followed by a name. for a matched rule, each variable will be a reference to data within the datasource, determined from the query. if the same variable appears multiple times, it will have the same value in each place. for more information, see actions. examples example needed attributes inherited from xul element align, allowevents, allownegativeassertions...
assign - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] for xml templates, specifies an additional variable to assign a value to. for more information, see xml_assignments attributes expr, var examples (example needed) attributes expr type: string for xml queries, an xpath expression which returns results. any namespace prefixes declared on the element may be used within the expression. var type: string for the xul assign attribute, this is the variable to assign the value to; otherwise it's a reference to a template variable such as "?name". inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, eq...
binding - Archive of obsolete content
minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties object type: string the object of the element. it can be a variable reference, an rdf resource uri, or an rdf literal value. predicate type: uri the predicate or property to match. this must be a uri of the property. subject type: string the subject of the element. it can be a variable reference or an rdf resource uri. inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, i...
bindings - Archive of obsolete content
minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width object type: string the object of the element. it can be a variable reference, an rdf resource uri, or an rdf literal value. predicate type: uri the predicate or property to match. this must be a uri of the property. subject type: string the subject of the element. it can be a variable reference or an rdf resource uri. properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, ...
broadcaster - Archive of obsolete content
any elements that are observing the broadcaster will share the attributes placed on the broadcaster. for instance, if the broadcaster has a label attribute, the observers will use that label. if the label changes, the labels of the observers will update automatically. an onbroadcast event will be sent to the observers when a change is made. ...
command - Archive of obsolete content
ond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update additional state. 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. oncommand type: script code this event handler is called when the command is activated. this occurs when a user selects a menu item or presses a keyboard shortcut attached to the command. reserved type: string this attribute applies to a command element. setting this attribute to "...
conditions - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] this element should appear directly inside a rule element and is used to define conditions for the rule. within the conditions can be placed content, member and triple elements. these may have attributes whose value is a variable name beginning with a question mark (?). when evaluating the rule for a particular rdf resource, the variables are replaced with values from the resource. if all variables can be replaced, the rule matched. this element is used with firefox 2/mozilla 1.8 and earlier instead of the query element. more information is available in the xul tutorial. examples (example needed) attributes inherited from xul element align, allowevents, allownegativeassertions, clas...
content - Archive of obsolete content
n, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width propiedades tag type: tag name this may be set to a tag name. if set, the conditions will only match if the template builder is parsing content for an element directly inside this tag. for example, by using a value of treechildren, the condition will only match when placing elements directly inside a treechildren tag. thus, nested elements will not match because they are directly inside a treeitem. this attribute is useful to provide different rules for outer and inner elements. uri type: ? used to specify the variable name for the content. when a rule is evaluated, it scans through ...
dropmarker - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , ,...
XUL:Property:flexGroup - Archive of obsolete content
« xul reference flexgroup type: integer gets and sets the value of the flexgroup attribute ...
groupbox - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , ,...
menubar - Archive of obsolete content
nly type: boolean when set to true, the grippy will be hidden. when set to false, the default, the grippy will be shown. statusbar type: id if you set this attribute to the id of a statusbar element, the label on the statusbar will update to the statustext of the items on the menu as the user moves the mouse over them. properties accessibletype type: integer a value indicating the type of accessibility object for the element. statusbar type: id of statusbar element gets and sets the value of the statusbar attribute. inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight,...
popupset - Archive of obsolete content
perties | methods | related ] a container for menupopup, panel and tooltip elements. this element is optional; the given elements need not appear in a popupset container. more information is available in the xul tutorial. ...
preferences - Archive of obsolete content
ce id="pref_two" name="extensions.myextension.two" type="string"/> ... etc ... </preferences> attributes these ought to be readonly; three of these could be merged into a single member attribute nsiprefservice service; the preferences service. attribute nsiprefbranch rootbranch; the root prefs branch. attribute nsiprefbranch defaultbranch; the root branch of the tree with default values. attribute nsiprefbranch2 rootbranchinternal; the root prefs branch (nsiprefbranch2). 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, minw...
promptBox - Archive of obsolete content
nsidomelement appendprompt(args, onclosecallback); void removeprompt(nsidomelement aprompt); nodelist listprompts(nsidomelement aprompt); methods appendprompt() creates a new prompt, adding it to the tab. nsidomelement appendprompt( args, onclosecallback ); parameters args arguments for the prompt. onclosecallback the callback routine to be called when the prompt is closed. return value an nsidomelement object representing the new prompt. removeprompt() removes an existing prompt. void removeprompt( nsidomelement aprompt ); parameters aprompt the prompt to dispose of. listprompts() returns a list of all the prompts on the tabbrowser. nodelist listprompts( nsidomelement aprompt ); parameters aprompt this parameter isn't used; i don't know why it's even there. return va...
separator - Archive of obsolete content
p between elements. this type of separator should be used to separate parts of a dialog. it doesn't draw a bar visually, but is just a small space. it is functionally equivalent to a spacer except it defaults to a small size (usually 1.5 ems). attributes orient style classes groove, groove-thin, thin examples <separator class="groove-thin"/> attributes orient type: one of the values below used to specify whether the separator is a horizontal or vertical separator. note that the values are the reverse of what seems more likely. horizontal the separator separates vertically placed elements. vertical the separator separates horizontally placed elements. inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs...
spinbuttons - Archive of obsolete content
spin buttons are not used as separate elements, but are used in combination with other elements to create a control that can be increased and decreased. for instance, spinbuttons are used for the number type textbox, and with the timepicker and datepicker. ...
tabpanels - Archive of obsolete content
element. selectedindex type: integer returns the index of the currently selected item. you may select an item by assigning its index to this property. by assigning -1 to this property, all items will be deselected. returns -1 if no items are selected selectedpanel type: element holds a reference to the currently selected panel within a <tabbox> element. assigning a value to this property will modify the selected panel. a select event will be sent when the selected panel is changed. methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsby...
textnode - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] normally when substituting rdf resources in template rules, you place the rdf property name inside an attribute value preceded with rdf:. in the case of the textnode element, the entire node is replaced with text corresponding to the result of the value attribute. this is useful if you want to use the html element or other elements that have text content inside them instead of in attributes. this element does nothing outside of a template. attributes value examples (example needed) attributes value type: uri the text value to display. this value should be an rdf property (predicate). inherited from xul element align, allowevents, allownegativeassertions, class, coalesced...
toolbarseparator - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , ...
toolbarspacer - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , ,...
toolbarspring - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , ,...
treecols - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , ,...
treeitem - Archive of obsolete content
ro. open type: boolean for the menu type buttons, the open attribute is set to true when the menu is open. the open attribute is not present if the menu is closed. uri type: string for template-generated content, the attribute should be placed on the element where content generation should begin. thus, it should be placed on an element that is a descendant of a template. the value should be set to rdf:*. elements that appear inside the element with the attribute will be repeated for each node in the rdf datasource. elements outside will appear only once. properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , m...
triple - Archive of obsolete content
s not exist, the rule will not match. both the subject and object attributes may be variables. the subject of a triple is an rdf resource. in an rdf file this would usually be an rdf description element. the predicate would be a child element or property. for example, for a bookmark resource, the name and url would be predicates. they should be specified in their full uri form. the object is the value of the rdf property. more information is available in the xul tutorial. attributes object, predicate, subject examples (example needed) attributes object type: string the object of the element. it can be a variable reference, an rdf resource uri, or an rdf literal value. predicate type: uri the predicate or property to match. this must be a uri of the property. su...
wizardpage - Archive of obsolete content
wizardpage element. more information is available in the xul tutorial. attributes description, label, next, pageid properties next, pageid attributes description type: string descriptive text to appear in addition to the dialog title. 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. next type: id set to the pageid of the next wizardpage after this one. when set, the page with this pageid is displayed when the next button is pressed. this can be used to create wizards that do not have a linear sequence. if one of the pages has a next attribute, all of the pages should have ...
Application Update - Archive of obsolete content
ion%,%build_id%,%channel% for example pref("app.update.url", "https://yourserver.net/update/3/%product%/%version%/%build_id%/%build_target%/%locale%/%channel%/%os_version%/%distribution%/%distribution_version%/update.xml"); // url user can browse to manually if for some reason all update installation // attempts fail. pref("app.update.url.manual", "http://yourserver.net/yourpage"); // a default value for the "more information about this update" link // supplied in the "an update is available" page of the update wizard. pref("app.update.url.details", "http://yourserver.net/yourpage"); // user-settable override to app.update.url for testing purposes. //pref("app.update.url.override", ""); // interval: time between checks for a new version (in seconds) // default=1 day pref("app.upda...
CommandLine - Archive of obsolete content
onents.results.ns_error_no_interface; }, /* nsicommandlinehandler */ handle : function clh_handle(acmdline) { var observerservice = components.classes["@mozilla.org/observer-service;1"] .getservice(components.interfaces.nsiobserverservice); observerservice.notifyobservers(acmdline, "commandline-args-changed", null); }, helpinfo : " -test <value> a test attribute\n", /* nsifactory */ createinstance : function mdh_ci(aouter, aiid) { if (aouter != null) { throw components.results.ns_error_no_aggregation; } return this.queryinterface(aiid); }, lockfactory : function mdh_lock(alock) { /* no-op */ } }; var apphandlermodule = { /* nsisupports */ queryinterface : function mod_qi(aiid) { i...
Creating a Windows Inno Setup installer for XULRunner applications - Archive of obsolete content
please test your application before deploying it. if your application does not run, neither will the installed version. step 3: creating the inno setup script create an inno setup script (.iss file). the inno setup script wizard can't set chrome directory's deployment point, so you have to edit the iss file yourself. also you had better set the appname and apppublisher properties to the same values specified in your xulrunner application's application.ini file. my app's .iss file sample as follows: ; script generated by the inno setup script wizard. ; see the documentation for details on creating inno setup script files! [setup] appname=my app appvername=my app 1.0 apppublisher=mark finkle apppublisherurl=http://developer.mozilla.org/en/docs/getting_started_with_xulrunner appsupporturl=...
Custom app bundles for Mac OS X - Archive of obsolete content
ings) example.icns (this is the icon which will be used by your application bundle) chrome/ content/ example.xul (this directory contains your application's chrome) example.manifest defaults/ preferences/ app-prefs.js (this provides some default values for preferences) application bundle contents in addition to the standard directory hierarchy that's required of all mac os x applications, as shown above in application bundle layout, there are some specific rules for what content goes where: the top-level directory is given a name that ends with .app which designates the who...
MacFAQ - Archive of obsolete content
s[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> ...
calICalendarView - Archive of obsolete content
y active item in the view. other areas of the code may use this attribute for setting selection, editing purposes, or any other purpose. note: this will likely change to selecteditems and return an array of caliitembases in order to support selecting multiple items at once. selectedday the currently selected day in the display. other areas of the code will often use this as a basis for default values for new calievents and calitodos. methods showdate void showdate(in calidatetime adate); ensures that the passed in adate is visible in the view. the view is free to show other days as well. setdaterange void setdaterange(in calidatetime astartdate, in calidatetime aenddate); ensures that the entire range of dates from astartdate to aenddate is visible. the view is free to show oth...
calICalendarViewController - Archive of obsolete content
the displaycalendar of the calicalendarview. the calidatetime parameters are optional, but aendtime cannot be included without astarttime. if astarttime is specified, then the calievent is meant to be created 'silently', that is, without a more detailed dialog appearing. the calievent should have its enddate set to aendtime, if this parameter is specified. otherwise, it should be set to a default value, as determined by the application. the other values of the calievent (title, summary, alarm, etc) should likewise be set to defaults. if no astarttime is specified, then an event-creation dialog should be displayed. modifyoccurrence void modifyoccurrence (in caliitemoccurrence aoccurrence, in calidatetime anewstarttime, in calidatetime anewendtime); the modifyoccurrence method...
reftest opportunities files - Archive of obsolete content
est/tborder1 http://dbaron.org/css/test/tborder2 http://dbaron.org/css/test/sec1706c http://dbaron.org/css/test/sec1801 http://dbaron.org/css/test/sec1802 http://dbaron.org/css/test/sec1803 http://dbaron.org/css/test/outline http://dbaron.org/css/test/sq_small http://dbaron.org/css/test/sq_large tests from mozilla source tree parser/htmlparser/tests/html/xmp005.html parser/htmlparser/tests/html/value001.html parser/htmlparser/tests/html/utf8001.html parser/htmlparser/tests/html/usascii.html parser/htmlparser/tests/html/title01.html parser/htmlparser/tests/html/title.html parser/htmlparser/tests/html/tiny.html parser/htmlparser/tests/html/thead001.html parser/htmlparser/tests/html/text003.html parser/htmlparser/tests/html/text002.html parser/htmlparser/tests/html/text001.html parser/htmlparser...
Gecko Compatibility Handbook - Archive of obsolete content
are always empty - and not for html elements that have optional ending tags. for example, it is ok to code <br> as <br /> although there is no benefit to do so in html documents. but it is not ok to code <option> as <option />. to understand why, consider the following: html without optional ending tags equivalent html with optional ending tags <select> <option>optionvalue </select> <select> <option>optionvalue</option> </select> now consider if we used the xml empty tag notation: the <option />. html with xml empty tag notation equivalent html with ending tags <select> <option />optionvalue </select> <select> <option></option>optionvalue </select> this is simply not correct. if you must us...
2006-11-10 - Archive of obsolete content
es some ajax accessibility concerns. the article closes with a glimpse at the future of firefox accessibility. read more... access keys in firefox 2 previous versions of firefox used the <alt> key as a modifier. this has been changed to alt+shift for content accesskeys due to the "conflicts with ui mnemonics" according to aaron leventhal. this is reported to have broken accesskeys using numeric values. see bug 349716. currently there is a work-around extension available at bug 357101 to temporarily solve this problem. accessibility in chatzilla gijs kruitbosch and aaron leventhal have proposed an accessibility project involving chatzilla. ideas include: adding standardized shortcuts clc-4-tts and/or other screenreader integration screenreader integration via an accessibility api discussion ...
Extentsions FAQ - Archive of obsolete content
com/tutorials/x...dommodify.html request for a thunderbird extension that can automatically detect the default domain when composing e-mails via autodetect. <https://bugzilla.mozilla.org/show_bug.cgi?id=312818> "thunderbird requires domain in addresses and doesn't always add default" there is an extension that allows what you want attached to one of the comments in this bug. how to get the value of a text box when a button is clicked? read http://developer.mozilla.org/en/docs/extension_faq and check if there are any errors in js console. friday, september 29 - october 6, 2006 (↑ top) is there anyway, via plugin or extension, for firefox to mimic the functionality of ie in this respect? the ietab (opens ie in a firefox tab) should be able do this if you set it to always open "file...
2006-10-27 - Archive of obsolete content
emoval of the nn4.6 table border color quirk discussion on removing the nn 4.6 table boarder color quirk, which currently causes a specific markup to produce a green boarder instead of a gray one. help for getting html element width info discussion on retrieving width information on html elements when using the gecko engine. it was determined that the offsetwidth property can be used to get this value. multiple presshells discussion on why current interfaces allow for multiple presshells and how the relationships work for the following objects: docshell, presshell, prescontext, document, domwindow, widget, docshell and contentviewer. boris zbarsky explains in detail the relationships between these objects. the presshells are currently used for printing, but should or could have been used for ...
2006-10-20 - Archive of obsolete content
summary: mozilla.dev.tech.xul - oct 14-oct 20, 2006 return to mozilla-dev-tech-xul announcements none during this week. discussions october 16, 2006, 5:10pm - david marteau notes that using "persist" on templatized content prevents from restoring values for the persistent attributes. neil notes that the format of localstore has changed from previous versions and that "persist" is not functioning properly using the new format. this is an unexpected result and david has said he will post a bug. the bug number has not been posted to the newsgroup and searching in bugzilla was unsuccessful. meetings none during this week. ...
Monitoring plugins - Archive of obsolete content
ute their calls. this component then reports the plugin runtime using the observer service to anyone registered to receive the notifications. this article discusses how developers can make use of this new feature. runtime data the runtime information reported is always in fractions of a second. because the component measures the wall clock time it takes for blocking plugin calls to execute, the value includes both cpu time, the wait time between allocation of cpu time to the process as well as any disk i/o time. it is therefore technically incorrect to say that the runtime is a measure of cpu use, however, it is a good representation of overall resources being consumed by the plugin. usage to make use of the new component you must register to receive its runtime notifications using the obse...
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 one or mo...
NPFullPrint - Archive of obsolete content
nting. syntax typedef struct _npfullprint { npbool pluginprinted; /* true: print fullscreen */ npbool printone; /* true: print one copy */ /* to default printer */ void* platformprint; /* platform-specific */ } npfullprint; fields the data structure has the following fields: pluginprinted determines whether the plug-in prints in full-page mode. values: true: plug-in takes complete control of the printing process and prints full-page. false: (default) plug-in renders its area of the page only (for embedded plug-in). printone not currently in use. should always be false. true: print single copy of page to the default printer. false: display print dialogs so user can choose printer, other options. platformprint platform-specific printing...
NPNVariable - Archive of obsolete content
note: npnvariable != nppvariable ...
NPN_Evaluate - Archive of obsolete content
clude <npruntime.h> bool npn_evaluate(npp npp, npobject *npobj, npstring *script, npvariant *result); parameters the function has the following parameters: npp the npp indicating which plugin instance's window to evaluate the script in. npobj the scope object. script the script to evaluate. result on return, contains the value returned by the script. can't be null. returns true if the script was evaluated successfully, otherwise false. description the script is evaluated in the context of the window that the calling plugin instance (the <tt>npp</tt> argument) is loaded in. note: the caller must call npn_releasevariantvalue() to release the returned value when it's no longer needed. ...
NPN_Invoke - Archive of obsolete content
to invoke a method. methodname a string identifier indicating the name of the method to invoke. args an array of arguments to pass to the method. argcount the number of arguments in the args array. result a pointer to an npvariant to receive the result returned by the method. returns true if the method was successfully invoked, otherwise false. if the method was invoked successfully, any return value is stored in the npvariant specified by result. when the caller no longer needs the result, it must call npn_releasevariantvalue() to release it. description the method arguments are passed as an array of npvariants, and the number of arguments is passed in. the result of the method invocation is returned through an npvariant result parameter. if the method invocation succeeds, npn_invoke() retur...
NPN_InvokeDefault - Archive of obsolete content
t on which to invoke the default method. args an array of arguments to pass to the default method. argcount the number of arguments in the args array. result a pointer to an npvariant to receive the result returned by the default method. returns true if the default method was successfully invoked, otherwise false. if the default method was invoked successfully, any return value is stored in the npvariant specified by result. when the caller no longer needs the result, it must call npn_releasevariantvalue() to release it. description the method arguments are passed as an array of npvariants, and the number of arguments is passed in. the result of the method invocation is returned through an npvariant result parameter. if the method invocation succeeds, npn_invoke() retur...
NPN_RequestRead - Archive of obsolete content
ist); parameters the function has the following parameters: stream stream of type np_seek from which to read bytes. rangelist range of bytes in the form of a linked list of npbyterange objects, each of which specifies a request for a range of bytes. returns if successful, the function returns nperr_no_error. if unsuccessful, the function returns an error code. for possible values, see error codes. description for a seekable stream, the browser sends data only in response to requests by the plug-in. the plug-in calls npn_requestread() to request data from a seekable stream. the plug-in can use this function to make one or more requests for ranges of bytes. these requests result in subsequent calls to npp_writeready() and npp_write(). for multiple requests, the function c...
NPN_SetProperty - Archive of obsolete content
« gecko plugin api reference « scripting plugins summary sets the value of a property on the specified npobject. syntax #include <npruntime.h> bool npn_setproperty(npp npp, npobject *npobj, npidentifier propertyname, const npvariant *value); parameters the function has the following parameters: <tt>npp</tt> the npp indicating which plugin instance's is making the request. <tt>npobj</tt> the object on which a value is to be set. <tt>propertyname</tt> a string identifier indicating the name of the property whose value is to be set. <tt>value</tt> the value to store in the specified property. returns true if the value was set successfully, otherwise false. ...
NPN_Version - Archive of obsolete content
ter to a plug-in's major version number; changes with major code release number. plugin_minor pointer to a plug-in's minor version number; changes with point release number. netscape_major pointer to the browser's major version; changes with major code release number. netscape_minor pointer to the browser's version; changes with point release number. description the values of the major and minor version numbers of the plug-in api are determined when the plug-in and the browser are compiled. for example, plug-in api version 4.03 has a major version number of 4 and a point release number of 3. this function gets the values from the plug-in rather than from the browser. a plug-in can use this function to check that the version of the plug-in api it is using is compat...
NPObject - Archive of obsolete content
i. the browsers are expected to expose their window objects and everything reachable from it through this api. npobjects are reference counted objects, so callers need to be careful to properly release acquired references to them. to aid with the reference counting and ownership management in general, the functions npn_createobject(), npn_retainobject(), npn_releaseobject(), and npn_releasevariantvalue() are provided as part of this api. npobject behavior is implemented using the set of callback functions defined in npclass. syntax struct npobject { npclass *_class; uint32_t referencecount; /* * additional space may be allocated here by types of npobjects */ }; fields _class a pointer to the npclass of which the object is a member. referencecount the...
NPP - Archive of obsolete content
nce « plug-in side plug-in api summary represents a single instance of a plug-in. you specify one of these to any npapi function that needs to know which plug-in to work with. syntax typedef struct _npp { void* pdata; /* plug-in private data */ void* ndata; /* mozilla private data */ } npp_t; typedef npp_t* npp; fields the data structure has the following fields: pdata a value, whose definition is up to the plug-in, that the plug-in can use to store a pointer to an internal data structure associated with the instance; this field isn't modified by the browser. ndata a private value, owned by the browser, which is used to store data associated with the instance; this value should not be modified by the plug-in. description gecko creates an npp structure fo...
NPPVariable - Archive of obsolete content
note: nppvariable != npnvariable ...
NPP_Destroy - Archive of obsolete content
parameters the function has the following parameters: instance pointer to the plug-in instance to delete. **save state or other information to save for reuse by a new instance of this plug-in at the same url. passed to npp_new. returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. description npp_destroy releases the instance data and resources associated with a plug-in. the browser calls this function when a plug-in instance is deleted, typically because the user has left the page containing the instance, closed the window, or quit the browser. you should delete any private instance-specific information stored in the plug-in's instance->pdata at this...
NPP_WriteReady - Archive of obsolete content
rite a smaller amount of data if desired or necessary; for example, if only 8k of data is available in a network buffer. if the plug-in is allocating memory for the entire stream at once (an as_file stream), it can return a very large number. because it is not processing streaming data, the browser can pass as much data to the instance as necessary in a single npp_write. if the browser receives a value of zero, the data flow temporarily stops. the browser checks to see if the plug-in can receive data again by resending the data at regular intervals. see also npp_write, npstream, npp ...
NPPrint - Archive of obsolete content
t itself in full-page or embedded mode. syntax typedef struct _npprint { uint16 mode; /* np_full or np_embed */ union { npfullprint fullprint; /* if mode is np_full */ npembedprint embedprint; /* if mode is np_embed */ } print; } npprint; fields the data structure has the following fields: mode determines whether plug-in prints in full-page or embedded mode. values: np_full: pointer to npfullprint structure. plug-in can optionally print in full-page mode. the fullprint field of the union is valid. see npfullprint and npp_print. np_embed: pointer to npembedprint structure. plug-in should print in embedded mode. the embedprint field of the union is valid. see npembedprint. description the npp_print function passes a pointer to an npprint object (previous...
NPString - Archive of obsolete content
« gecko plugin api reference « scripting plugins summary npstring is a struct that holds a pointer to a sequence of 8-bit units (nputf8) making up a utf-8 string, and the number of 8-bit units in the utf-8 string. note: whenever an npstring owns its string data and the data may be released through a call to npn_releasevariantvalue(), the string data must be allocated using npn_memalloc(). syntax typedef struct _npstring { const nputf8 *utf8characters; uint32_t utf8length; } npstring; fields the data structure has the following fields: utf8characters an array of the utf-8 characters comprising the string. utf8length the number of bytes in the utf-8 string (not the number of characters). ...
NP_Initialize - Archive of obsolete content
s global initialization for a plug-in. syntax windows #include <npapi.h> nperror winapi np_initialize(npnetscapefuncs *anpnfuncs) unix #include <npapi.h> nperror np_initialize(npnetscapefuncs *anpnfuncs, nppluginfuncs *anppfuncs) returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. description the browser calls this function only once: when a plug-in is loaded, before the first instance is created. this is the first function that the browser calls. np_initialize tells the plug-in that the browser has loaded it and provides global initialization. allocate any memory or resources shared by all instances of your plug-in at this time. after the last insta...
NP_Port - Archive of obsolete content
nto which the plug-in should draw. portx, porty top-left corner of the plug-in rectangle in port coordinates (taking the scroll position into account). description on mac os, the window field of an npwindow structure points to an np_port object, which is allocated by the browser. the np_port is valid for the lifetime of the npwindow, that is, until npp_setwindow is called again with a different value or the instance is destroyed. since the port is shared between the plug-in and other plug-ins and the browser, the plug-in should always do the following: draw only within the area designated by the npwindow. save the current port settings before changing the port for drawing. set the desired port settings before drawing. restore the previous port settings after drawing. see also npp_setwin...
Supporting private browsing in plugins - Archive of obsolete content
sing is disabled. potentially private information may include (but is not necessarily limited to) history information for downloaded data. for example, if private browsing mode is in effect, video player plugins should not record the urls of watched videos in their histories. detecting private browsing mode plug-ins can detect whether or not private browsing mode is in effect by using the npn_getvalue() function to check the current value of the npnvprivatemodebool variable. ...
.htaccess ( hypertext access ) - Archive of obsolete content
search engine spiders. deny from 146.0.74.205 # blocks all access from 146.0.74.205 to the directory ssi or server side include : include external files to each file requested by the user without the need to write include statements in the file; you can have them automatically attached to all the files, whether at top or bottom, automatically through your .htaccess file. php_value auto_prepend_file "/real/path/to/file/functions.php" # adds function.php at the top of requested document php_value auto_append_file "/real/path/to/file/footer.php" # adds footer.html at bottom of requested document customized error responses : user can be directed to different pages depending on the error they caused or by the webserver. errordocument 404 /notfound.html # redirects traffic to...
Digital Signatures - Archive of obsolete content
ncryption and decryption, by themselves, do not address another problem: tampering. this section describes how public-key cryptography addresses the problem of tampering. tamper detection and related authentication techniques rely on a mathematical function called a one-way hash (also called a message digest). a one-way hash is a number of fixed length with the following characteristics: the value of the hash is unique for the hashed data. any change in the data, even deleting or altering a single character, results in a different value. the content of the hashed data cannot, for all practical purposes, be deduced from the hash-which is why it is called "one-way." similarly, in public key encryption, a key pair is generated for digital signing. the key pair consists of a private signing...
Encryption and Decryption - Archive of obsolete content
d with ssl, see "introduction to ssl.") an encryption key is considered full strength if the best known attack to break the key is no faster than a brute force attempt to test every key possibility. different ciphers may require different key lengths to achieve the same level of encryption strength. the rsa cipher used for public-key encryption, for example, can use only a subset of all possible values for a key of a given length, due to the nature of the mathematical problem on which it is based. other ciphers, such as those used for symmetric key encryption, can use all possible values for a key of a given length, rather than a subset of those values. because it is relatively trivial to break an rsa key, an rsa public-key encryption cipher must have a very long key, at least 1024 bits, to b...
TCP/IP Security - Archive of obsolete content
controls at other layers do not. ssl is the most commonly used transport layer security control. depending on how ssl is implemented and configured, it can provide any combination of the following types of protection: confidentiality. ssl can ensure that data cannot be read by unauthorized parties. this is accomplished by encrypting data using a cryptographic algorithm and a secret key—a value known only to the two parties exchanging data. the data can only be decrypted by someone who has the secret key. integrity. ssl can determine if data has been changed (intentionally or unintentionally) during transit. the integrity of data can be assured by generating a message authentication code (mac) value, which is a keyed cryptographic checksum of the data. if the data is altered and th...
Vulnerabilities - Archive of obsolete content
categories: software flaws, security configuration issues, and software feature misuse. these categories are described below. vulnerability categories a software flaw vulnerability is caused by an unintended error in the design or coding of software. an example is an input validation error, such as user-provided input not being properly evaluated for malicious character strings and overly long values associated with known attacks. another example is a race condition error that allows the attacker to perform a specific action with elevated privileges. a security configuration setting is an element of a software’s security that can be altered through the software itself. examples of settings are an operating system offering access to control lists that set the privileges that users have for...
Table Reflow Internals - Archive of obsolete content
mmands. the reflower positions reflowee (if it can) before actually reflowing in case views are involved (e.g. absolutely positioned elements) reflows reflowee and passes a reflow state (in) and a reflow metrics (in/out) review of reflow the reflow state: is a node in a tree structurally equivalent to the frame tree of reflow participants contains: reflow type, avail size, various computed values, resolved style structs possible request for preferred size and more. review of reflow the reflow metrics contains: max element size (if requested) - the minimum size it can be preferred size (if requested) - the size it would like to be given no size constraints. desired size - the size it would like to be given the avail size. this is equivalent to preferred size if the avail size is no...
Making sure your theme works with RTL locales - Archive of obsolete content
6px 34px 480px); } this specifies the default, left-to-right version of the button, then offers an override if the user's interface is being rendered in right-to-left mode. gecko 1.9.1 (firefox 3.5) and earlier the chromedir attribute firefox, thunderbird and seamonkey expose an attribute named chromedir on certain elements. all you have to do is add css rules to your theme that test for the value of this attribute, and use that to apply any rtl-specific rules that you may have. that's how the default theme works, so you can use it as an example. toolbar[iconsize="large"][mode="icons"] #back-button { -moz-image-region: rect(0px 398px 34px 360px); } toolbar[iconsize="large"][mode="icons"] #back-button[chromedir="rtl"] { -moz-image-region: rect(0px 516px 34px 478px); } this way, if c...
Theme changes in Firefox 3.5 - Archive of obsolete content
indows also have a shadow by default. this can result in unwanted shadows in your theme, e.g. under the autoscroll icon or the identity panel. if you don't want the shadow, you can turn it off by setting the new -moz-window-shadow css property to none on the affected element. browser.xul bug 463189 added a new attribute on the xul window element of browser.xul named browsingmode. the value of this attribute is normal when the private browsing mode is inactive, and private when it's active. this attribute can be used to style different parts of the browser window inside the private browsing mode. see this blog post for an example. supporting 3.5 features video/audio player: controlbar has to be styled (chrome://global/skin/media/videocontrols.css) shadow effect for disa...
Scratchpad - Archive of obsolete content
cution options available. run when you choose the run option, the selected code is executed. this is what you'd use to execute a function or other code that manipulates the content of your page without needing to see the result. inspect the inspect option executes the code just like the run option; however, after the code returns, an object inspector is opened to let you examine the returned value. for example, if you enter the code: window then choose inspect, the object inspector is shown that looks something like this: display the display option executes the selected code, then inserts the result directly into your scratchpad editor window as a comment, so you can use it as a repl. reload and run the reload and run option is only available in the execute menu. it first reloads...
Summary of Changes - Archive of obsolete content
block-level elements deprecated bgcolor css1 background-color: ; non-standard embed html 4.01 object deprecated applet html 4.01 object non-standard marquee html 4.01 div plus scripting non-standard bgsound html 4.01 object proprietary or deprecated feature w3c feature or recommended replacement ie5+ id_attribute_value document.all.id_attribute_value document.all[id_attribute_value] dom level 2: document.getelementbyid(id_attribute_value) ie5+ formname.inputname.value dom level 1: document.forms["formname"].inputname.value ie5+ inputname.value dom level 1: document.forms["formname"].inputname.value ie5+ formctrlname dom level 1: document.fo...
-moz-binding - Archive of obsolete content
the -moz-binding css property is used by mozilla-based applications to attach an xbl binding to a dom element. syntax /* <url> value */ -moz-binding: url(http://www.example.org/xbl/htmlbindings.xml#checkbox); /* global values */ -moz-binding: inherited; -moz-binding: initial; -moz-binding: unset; values <url> the url for the xbl binding (including the fragment identifier). none no xbl binding is applied to the element. formal definition initial valuenoneapplies toall elements except generated content or pseudo-elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <url> | none examples .exampleone { -moz-binding: url(http://www.example.org/xbl/htmlbindings.xml#radiobutton); } specifications not part of any standard. ...
-moz-window-shadow - Archive of obsolete content
d from firefox 44 onwards cannot be used on websites anymore. firefox 3 added support for transparent windows on mac os x. however, for these windows shadows were turned off and there was no way to turn them on. in firefox 3.5 the default changed, with all windows having a shadow. this version introduced the -moz-window-shadow css property to provide a way to turn off unwanted shadows. initial valuedefaultapplies toall elements that create native windows, e.g. <window>, <panel>inheritednocomputed valueas specifiedanimation typediscrete syntax the -moz-window-shadow property is specified as one of the keyword values listed below. values default the window will have a shadow with the default window shadow style. menu the window will have the shadow style that's appropriate for menus. ...
-ms-content-zoom-limit-max - Archive of obsolete content
the -ms-content-zoom-limit-max css property is a microsoft extension that specifies the selected elements' maximum zoom factor. initial value400%applies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednopercentagesthe largest allowed zoom factor. a zoom factor of 100% corresponds to no zooming. larger values zoom in. smaller values zoom out.computed valueas specifiedanimation typediscrete syntax values <percentage> the maximum zoom factor. formal syntax <percentage> specifications not part of any specification. remarks this property constrains the limit for touch zooming as well as values of the mscontentzoomfactor property. this property has no effect on non-zoomable elements. see -ms-content-zooming for details on zoomable elements. ...
-ms-content-zoom-limit-min - Archive of obsolete content
the -ms-content-zoom-limit-min css property is a microsoft extension that specifies the minimum zoom factor. initial value100%applies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednopercentagesthe smallest allowed zoom factor. a zoom factor of 100% corresponds to no zooming. larger values zoom in. smaller values zoom out.computed valueas specifiedanimation typediscrete syntax values <percentage> the minimum zoom factor. formal syntax <percentage> specifications not part of any specification. remarks this property constrains the limit for touch zooming as well as values of the mscontentzoomfactor property. this property has no effect on non-zoomable elements. see -ms-content-zooming for details on zoomable elements. starting with win...
-ms-hyphenate-limit-zone - Archive of obsolete content
the -ms-hyphenate-limit-zone css property is a microsoft extension specifying the width of the 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 no...
-ms-ime-align - Archive of obsolete content
ned on the screen with sufficient size to allow basic text input. in some cases, the ime may enforce a reasonable minimum size. in the case of -ms-ime-align: after, an ime might adjust the candidate window and keyboard input behavior to provide a better user experience, such as using a horizontal candidate list and allowing some keys to be sent to the app for suggestion list navigation. initial valueautoapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete syntax /* keyword values */ -ms-ime-align: auto; -ms-ime-align: after; values auto initial value. the ime may align the candidate window in any manner. after the ime should attempt to align the candidate window below the element (in left-to-right and right-to-left layouts). formal syntax auto | aft...
-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. ...
:-moz-system-metric() - Archive of obsolete content
this page was auto-generated because a user created a sub-page to this page. note: since firefox 58, this pseudo-class is no longer available to web content — it is only available internally (e.g. to xul / chrome code). see bug 1396066 for more details. ...
::-ms-browse - Archive of obsolete content
round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width syntax ::-ms-browse example html <label>select image: <input type="file"></label> css input...
::-ms-check - Archive of obsolete content
round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width syntax ::-ms-check example html <form> <label for="redbutton">red</label> <input type="rad...
::-ms-expand - Archive of obsolete content
...
::-ms-ticks-after - Archive of obsolete content
round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width syntax ::-ms-tic...
::-ms-ticks-before - Archive of obsolete content
round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width syntax ::-ms-tic...
::-ms-track - Archive of obsolete content
round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width syntax ::-ms-tra...
-moz-os-version - Archive of obsolete content
e is no longer available to web content — it is only available internally (e.g. to xul / chrome code). see bug 1396066 for more details. the -moz-os-version gecko-only css media feature can be used to apply styles based on the user's version of microsoft windows. this can be useful for adapting application skins and other chrome code depending on the user's operating system version. syntax values windows-win7 the user is on the windows 7 operating system. windows-win8 the user is on the windows 8 operating system. windows-win10 the user is on the windows 10 operating system. media: media/visual accepts min/max prefixes: no ...
Date.prototype.toLocaleFormat() - Archive of obsolete content
y. see also the newer version of date.prototype.tolocaledatestring(). this feature has been removed and will no longer work in firefox 58+. see warning: date.prototype.tolocaleformat is deprecated for more information and migration help. syntax dateobj.tolocaleformat(formatstring) parameters formatstring a format string in the same format expected by the strftime() function in c. return value a string representing the given date using the specified formatting. description the tolocaleformat() method provides greater software control over the formatting of the generated date and/or time. names for months and days of the week are localized using the operating system's locale. however, ordering of the day and month and other localization tasks are not handled automatically since you h...
ECMAScript 2016 to ES.Next support in Mozilla - Archive of obsolete content
ou can see the latest proposals on the tc39/ecma262 github repository. a channel for feedback on ecmascript standards is es-discuss. below is a list of features in es2016+ and what version of firefox they were implemented in. ...
Function.prototype.isGenerator() - Archive of obsolete content
description the isgenerator() method determines whether or not the function fun is a generator. it was part of an early harmony proposal, but has not been included in the ecmascript 2015 specification. ...
Date.getVarDate() - Archive of obsolete content
warning: this method is supported in internet explorer only. the getvardate method returns a vt_date value from a date object. syntax dateobj.getvardate() parameters the required dateobj reference is a date object. return value returns a vt_date value. remarks the getvardate() method is used when javascript code interacts with com objects, activex objects, or other objects that accept and return date values in vt_date format. these include objects in visual basic and visual basic scripting edition (vbscript). the actual format of the returned value depends on regional settings. requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, and inte...
Debug.msTraceAsyncCallbackCompleted - Archive of obsolete content
ters asyncoperationid the id associated with the asynchronous operation. status optional the status of the asynchronous operation. if not specified, debug.ms_async_op_status_success is used. remarks call this function when the asynchronous operation completes. asyncoperationid must correspond to the operation id previously returned from debug.mstraceasyncoperationstarting. the possible values for status include: debug.ms_async_op_status_success debug.ms_async_op_status_canceled debug.ms_async_op_status_error note: some debugging tools do not display the information sent to the debugger. example the following code provides an example of tracing an asynchronous call for a windows 8.x store app. function asyncwrapperfunction() { var opid = debug.mstraceasy...
Enumerator.atEnd - Archive of obsolete content
syntax myenum.atend() remarks the required myenum reference is any enumerator object. the atend method returns true if the current item is the last one in the collection, the collection is empty, or the current item is undefined. otherwise, it returns false. ...
Enumerator - Archive of obsolete content
e / bytespergb; drivestring += freegb.tofixed(3) + " gb free of "; drivestring += totalgb.tofixed(3) + " gb"; } else{ drivestring += "not ready"; } drivestring += "<br />";; e.movenext(); } document.write(drivestring); // output: <drive information properties the enumerator object has no properties. methods enumerator.atend returns a boolean value indicating if the enumerator is at the end of the collection. enumerator.item returns the current item in the collection. enumerator.movefirst resets the current item in the collection to the first item. enumerator.movenext moves the current item to the next item in the collection. requirements supported in the following document modes: quirks, internet explorer 6 standards, internet exp...
Error.description - Archive of obsolete content
n property returns or sets the descriptive string associated with a specific error. syntax object .description [= stringexpression] parameters object required. any instance of an error object. stringexpression optional. a string expression containing a description of the error. remarks the description property contains the error message string associated with a specific error. use the value contained in this property to alert a user to an error. the description and message properties provide the same functionality; the descriptionproperty provides backward compatibility; the message property complies with the ecma standard. example the following example illustrates the use of the description property. try { // cause an error: x = y } catch(e) { // prints "[object error]": ...
Error.stackTraceLimit - Archive of obsolete content
the error.stacktracelimit property gets or sets the stack trace limit, which is equivalent to the number of error frames to display. the default limit is 10. syntax error.stacktracelimit remarks you can set the stacktracelimit property to any positive value between 0 and infinity. if the stacktracelimit property is set to 0 at the time an error is thrown, no stack trace is shown. if the property is set to a negative value or a non-numeric value, the value is converted to 0. if the stacktracelimit is set to infinity, the entire stack is shown. otherwise, touint32 is used to convert the value. example the following example shows how to set and then get the stack trace limit. try { var err = new error("my error"); error.stacktracelimit = 7; throw err; } catch(e) { docume...
ScriptEngineBuildVersion - Archive of obsolete content
non-standard. do not use! this object is a microsoft extension and is only supported in internet explorer. the scriptenginebuildversion function bets the build version number of the scripting engine in use. syntax scriptenginebuildversion() remarks the return value corresponds directly to the version information contained in the dynamic-link library (dll) for the scripting language in use. example the following example illustrates the use of the scriptenginebuildversion function: if(window.scriptenginebuildversion) { console.log(window.scriptenginebuildversion()); } // output: <current build version> requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 sta...
ScriptEngineMajorVersion - Archive of obsolete content
non-standard. do not use! this object is a microsoft extension and is only supported in internet explorer. the scriptenginemajorversion function gets the major version number of the scripting engine in use. syntax scriptenginemajorversion() remarks the return value corresponds directly to the version information contained in the dynamic-link library (dll) for the scripting language in use. example the following example illustrates the use of the scriptenginemajorversion function: if (window.scriptenginemajorversion) { console.log(window.scriptengine()); } output: <current major version> requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, intern...
ScriptEngineMinorVersion - Archive of obsolete content
example the following example illustrates the use of the scriptengineminorversion function. ...
VBArray.lbound - Archive of obsolete content
syntax safearray.lbound(dimension) remarks if the vbarray is empty, the lbound method returns undefined. if dimension is greater than the number of dimensions in the vbarray, or is negative, the method generates a "subscript out of range" error. parameters safearray a vbarray object. dimension optional optional. the dimension of the vbarray for which the lower bound index is wanted. ...
VBArray.ubound - Archive of obsolete content
syntax safearray.ubound(dimension) parameters safearray a vbarray object. dimension optional the dimension of the vbarray for which the higher bound index is wanted. if omitted, ubound behaves as if a 1 was passed. remarks if the vbarray is empty, the ubound method returns undefined. ...
@if - Archive of obsolete content
warning: conditional compilation is not supported in internet explorer 11 standards mode and windows 8.x store apps. conditional compilation is supported in internet explorer 10 standards mode and in all earlier versions. the @if statement conditionally executes a group of statements, depending on the value of an expression. syntax @if ( condition1 ) text1 [@elif ( condition2 ) text2] [@else text3] @end parameters text1 optional text to be parsed if condition1 is true. text2 optional text to be parsed if condition1 is false and condition2 is true. text3 optional text to be parsed if both condition1 and condition2 are false. remarks when you write an @if statement, you do not have to place each clause on a separate line. you can use multiple @elif clause...
@set - Archive of obsolete content
nywhere in javascript code. examples of variable declarations look like this: @set @myvar1 = 12 @set @myvar2 = (@myvar1 * 20) @set @myvar3 = @_jscript_version the following operators are supported in parenthesized expressions: ! ~ * / % + - << >> >>> < <= > >= == != === !== & ^ | && | | if a variable is used before it has been defined, its value is nan. nan can be checked for using the @if statement: @if (@newvar != @newvar) ... this works because nan is the only value not equal to itself. requirements supported in all versions of internet explorer, but not in windows 8.x store apps. see also conditional compilation conditional compilation variables @cc_on statement @if statement ...
New in JavaScript 1.8.1 - Archive of obsolete content
compiler, which improves performance. new features in javascript 1.8.1 object.getprototypeof() support for native json string.prototype.trim() string.prototype.trimleft() string.prototype.trimright() changed functionality in javascript 1.8.1 implicit setting of properties in object and array initializers no longer execute setters in javascript. this makes the behavior of setting the values of properties more predictable. ...
Object.getNotifier() - Archive of obsolete content
the object.getnotifer() method was used to create an object that allows to synthetically trigger a change, but has been deprecated and removed in browsers. syntax object.getnotifier(obj) parameters obj the object to retrieve the notifier of. return value the notifier object associated with the object being passed to the function. description the notifier is used to trigger synthetic changes that will be observed by object.observe(). specifications not part of any standard. strawman proposal specification. ...
Object.prototype.unwatch() - Archive of obsolete content
ox 58+. in addition, using watchpoints has a serious negative impact on performance, which is especially true when used on global objects, such as window. you can usually use setters and getters or proxies instead. the unwatch() method removes a watchpoint set with the watch() method. syntax obj.unwatch(prop) parameters prop the name of a property of the object to stop watching. return value undefined. description the javascript debugger has functionality similar to that provided by this method, as well as other debugging options. for information on the debugger, see venkman. by default, this method is inherited by every object descended from object. note: the reason for unwatch() to take the property name prop as its only parameter is due to the "single handler allowing" behav...
Reflect.enumerate() - Archive of obsolete content
the static reflect.enumerate() method used to return an iterator with the enumerable own and inherited properties of the target object, but has been removed in ecmascript 2016 and is deprecated in browsers. syntax reflect.enumerate(target) parameters target the target object on which to get the property. return value an iterator with the enumerable own and inherited properties of the target object. exceptions a typeerror, if target is not an object. description the reflect.enumerate method returns an iterator with the enumerable own and inherited properties of the target object. examples using reflect.enumerate() var obj = { x: 1, y: 2 }; for (var name of reflect.enumerate(obj)) { console.log(name); } // logs "x" and "y" specifications not part of any standard...
String.prototype.quote() - Archive of obsolete content
rbird 37 / seamonkey 2.34)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. the non-standard quote() method returns a copy of the string, replacing various special characters in the string with their escape sequences and wrapping the result in double-quotes ("). syntax str.quote() return value a new string representing the original string wrapped in double-quotes, with any special characters escaped. examples using quote in the table below the quote() method replaces any special characters and wraps the strings in double-quotes. also note the third column where a wrapped eval() evaluates the escape sequences again. str str.quote() eval(str.quote()) hell...
arguments.caller - Archive of obsolete content
ntly executing function. this property has been removed and no longer works. description this property is not available anymore, but you can still use function.caller. function whocalled() { if (whocalled.caller == null) console.log('i was called from the global scope.'); else console.log(whocalled.caller + ' called me!'); } examples the following code was used to check the value of arguments.caller in a function, but doesn't work anymore. function whocalled() { if (arguments.caller == null) console.log('i was called from the global scope.'); else console.log(arguments.caller + ' called me!'); } specifications not part of any standard. implemented in javascript 1.1 and removed in bug 7224 due to potentially vulnerable for security. ...
for each...in - Archive of obsolete content
each...in statement is deprecated as the part of ecma-357 (e4x) standard. e4x support has been removed. consider using for...of instead. firefox now warns about the usage of for each...in and it no longer works starting with firefox 57. please see warning: javascript 1.6's for-each-in loops are deprecated for migration help. the for each...in statement iterates a specified variable over all values of object's properties. for each distinct property, a specified statement is executed. syntax for each (variable in object) { statement } variable variable to iterate over property values, optionally declared with the var keyword. this variable is local to the function, not to the loop. object object for which the properties are iterated. statement a statement to execute for ea...
handler.enumerate() - Archive of obsolete content
the handler.enumerate() method used to be a trap for for...in statements, but has been removed from the ecmascript standard in es2016 and is deprecated in browsers. syntax var p = new proxy(target, { enumerate(target) { } }); parameters the following parameter is passed to the enumerate method. this is bound to the handler. target the target object. return value an iterator object. description the handler.enumerate method is a trap for for...in statements. interceptions this trap can intercept these operations: property enumeration / for...in: for (var name in proxy) {...} reflect.enumerate() invariants if the following invariants are violated, the proxy will throw a typeerror: the enumerate method must return an object. examples the following code tr...
JSException - Archive of obsolete content
f possible. lineno the line number of the file, if possible. source the string containing the javascript code being evaluated. tokenindex the index into the source string where the error occurred. getwrappedexception instance method getwrappedexception. declaration public object getwrappedexception() description getwrappedexception() returns an object that represents the value that the javascript actually threw. javascript can throw any type of value. use getwrappedexception() to determine what kind of value the object return type represents. getwrappedexceptiontype instance method getwrappedexceptiontype. declaration public int getwrappedexceptiontype() description getwrappedexceptiontype() returns an int that matches one of the following static ints declared b...
JavaArray - Archive of obsolete content
by java code. see the core javascript 1.5 guide for more information about data type conversions. in javascript 1.4 and later, the methods of java.lang.object are inherited by javaarray. backward compatibility javascript 1.3 and earlier the methods of java.lang.object are not inherited 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 me...
RDF: Resource Description Framework for metadata - Archive of obsolete content
Archive › Web › RDF
f metadata model is based upon the idea of making statements about resources in the form of a subject-predicate-object expression, called a triple in rdf terminology. the subject is the resource, the "thing" being described. the predicate is a trait or aspect about that resource, and often expresses a relationship between the subject and the object. the object is the object of the relationship or value of that trait. documentation directions of the mozilla rdf engine this presentation shows new developments in the mozilla rdf engine. these include plans to expose the rdf api to public web content, as well as performance and correctness improvements. what is rdf tim bray's introduction to the resource description framework, at xml.com. rdf datasource how-to a cookbook-style docu...
background-size - Archive of obsolete content
to get reliable information about its css support without having this browser (read: multiple versions of this browser) installed. are you able and willing to do that for all css properties? if so, feel free to change the en/css_reference/property_template and all css property pages ; ) start with -webkit-background-size and investigate support of contain and cover keywords and "omitted second value" behavior. [i assume it's the same as safari, since they just backported a webkit patch into khtml. but we need facts, rather than assumptions.] btw, some time ago i'v listed opera in the property template table and removed netscape because netscape is gecko based and opera has a global market share of > 2% (> 40% in some european countries). user:jürgen jeka 2009-08-04 <hr> is there anyway to ...
Reference - Archive of obsolete content
object". we could also put in layman definitions there for js constructs like functions and variables. --maian 01:43, 30 september 2005 (pdt) we should define the terms we are using. in particular this means we should define activation object somewhere (and link to it whenever we mention it). --nickolay 18:40, 16 july 2006 (pdt) js 1.2 and gecko 1.8 per the fix for bug 255895, "javascript1.2" values for the script's language attribute no longer work, e.g. <script language="javascript1.2"> will execute the script in the latest js version rather than js 1.2. so how should this be documented? in fx 1.0, js 1.2 is available, but not in the upcoming fx 1.5. there are 5 cases where "javascript1.2" is mentioned in this reference: special:search?search=javascript1.2&go=go. how should they be revise...
Writing JavaScript for XHTML - Archive of obsolete content
correctly and will do no harm in xhtml where the names are already lower case. problem: my cookie isn't saved! we found out already, that the document object in xml files is different from the ones in html files. now we take a look at one widly used property that is missing in xml files. in xml documents there is no document.cookie. that is, you can write something like document.cookie = "key=value"; in xml as well, but nothing is saved in cookie storage. solution: use the storage object with firefox 2 there was a new feature enabled, the html 5 storage object. although this feature is not free of critics, you can use it to bypass the non-existing cookie, if your document is of type xml. again, you will have to write your own wrapper to respect any given combination of mime type and bro...
Troubleshooting XForms Forms - Archive of obsolete content
he first thing is the name of the root node of the instance. if your binding expression contains a /, look for any containing xf:group, xf:repeat, xf:input or other elements that set the context node. instance(...) not working be aware that the instance(...) returns an element node, and not the document node. so with an instance like this: <xf:instance id="ins2" xmlns=""> <data> <value>42</value> </data> </xf:instance> you should use <output ref="instance('ins2')/value"/> to show the contents of the value element. (specification). repeat and tables not working unfortunately you cannot do: <table> <xf:repeat nodeset="..."> <tr> ... </tr> </xf:repeat> </table> the xhtml modularization does not allow this. you either have to use css tables or repeat a...
Mozilla XForms Specials - Archive of obsolete content
the same limitation. pseudo-class support we currently support all the css pseudo-classes in xforms (:enabled, :disabled, etc. ), except for :read-only and :read-write, because of non-specified behaviour of these for (x)html. instead you have to use :-moz-read-only and :-moz-read-write for now. (limitation tracked in bug 313111)pseudo element support there is no support for the pseudo elements (::value, ::repeat-item, and ::repeat-index ). instead you will have to use the following normal classes instead: xf-value xf-repeat-item xf-repeat-index for example, to target the value element of an input control use: @namespace xf url("http://www.w3.org/2002/xforms"); xf|input .xf-value { ... } the pseudo elements are defined in the css3 basic user interface specification . (limitation tracked in ...
RFE to the Custom Controls Interfaces - Archive of obsolete content
introduction this page contains requests for enhancement to the custom control interfaces. you can refer to custom controls page to get familiar with custom controls mechanism. in short, we have the following interfaces: nsixformsaccessors - serves to get/set the value of the instance data node that the xforms element is bound to as well as getting the various states of that node nsixformsdelegate - used to obtain the nsixformsaccessors interface nsixformsuiwidget - used by the xforms processor to update the value/state of an xforms element when its bound node's value/state is changed our current mechanism that allows authors to build custom controls assumes that the controls will be bound to instance nodes of simple content type. this means that the bound node is not allowed to contain...
RFE to the XForms API - Archive of obsolete content
Archive › Web › XForms › RFE › XForms API
xforms element exposes the nsixformsdelegate interface. if you need some additional functionality that shouldn't be exposed from the xforms element directly, then you should think which interface of the xforms element is more appropriate to expose it. mozilla xforms doens't offer any service you can get via xpcom. as an example, the nsixformsaccessors interface which allows a user to get/set the value of an instance node and get the state of an instance node, is exposed by the nsixformsdelegate interface using the accessors property. xforms dom put here your requirements how to improve xforms dom api. reflect attributes to properties for the elements that can contain the incremental or selection attributes, it makes sense to expose analogous properties. xforms functional interfaces pu...
XForms Message Element - Archive of obsolete content
inding linking src - url of a document whose contents will be retrieved by the message element and used to provide the message text for the message element. special level - defines a representation of message element type restrictions the message element can be bound to any simple content. representations it may be represented in the following ways: modal window - if level attribute value is modal modeless window - if level attribute value is modeless tooltip window - if level attribute value is ephemeral note: message element doesn't define a default presentation. therefore you should always specify a level attribute. example <xforms:trigger> <xforms:label>it's a button</xforms:label> <xforms:message level="modal" ev:event="domactivate">hello</xforms:message> </xforms:t...
XForms Textarea Element - Archive of obsolete content
introduction serves to show/change multiline text (see the spec). attributes ui common appearance - isn't supported. accesskey - used to specify the keyboard shortcut for focusing this control. single-node binding special inputmode - isn't supported. incremental - supported. the default value is false. type restrictions the textarea element can be bound to a node of type xsd:string or any type derived from it. representations the xforms textarea element is represented by a multiline text field (xhtml/xul). characteristics analogous widgets are <xhtml:textarea/> and <xul:textbox multiline="true"/> if the incremental attribute has the value true, then the bound instance node is updated on every user input. ...
XForms - Archive of obsolete content
e w3c. drawing on other w3c standards like xml schema, xpath, and xml events, xforms tried to address some of the limitations of the current html forms model. however, xforms never gained traction and is now considered obsolete. other strengths that xforms brings to the table is the separation of data from presentation, strong data typing, the ability to submit xml data to servers instead of name/value pairs, and a descriptive way to author forms so that they can be displayed by a wide variety of devices. xforms is a w3c specification. xforms tutorial and cookbook xforms in wikibook format - over 50 examples tested with firefox. xforms support can be added to firefox and seamonkey by installing the mozilla xforms extension. this extension, while supporting a significant subset of the xforms ...
Displaying a graphic with audio samples - Archive of obsolete content
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'); audio.addeventlistener('mozaudioavailable', audioavail...
Fixing Incorrectly Sized List Item Markers - Archive of obsolete content
item text, but will instead stay the same as the user's default font size. see bug 97351 for more details. the solution fortunately, there are mozilla-specific css-like rules that can be used to correct both problems. the following rule is derived from mozilla's html.css file: *|*:-moz-list-bullet, *|*:-moz-list-number {font-size: 1em;} this rule tells gecko-based browsers to use the computed value of font-size for the marker's parent, which is the list item itself. thus the font sizes of the marker and the content will be the same. since this rule is not valid css, it will prevent the validation of any stylesheet that contains it. one solution is to move the rule into its own stylesheet, and accept that the stylesheet in question will never validate. this might also be a place to put any ...
Issues Arising From Arbitrary-Element hover - Archive of obsolete content
hover {color: red;} ..which translates as "any element that is being hovered should have its foreground colored red." thus, hovering over paragraphs, tables, headings, and any other element in a document will cause text to become red. a common variant is to use a bare class and hover pseudo-class together, like this: .nav:hover {color: red;} in situations where the only instances of the class value nav are applied to hyperlinks, this will work fine. however, rules of this type are usually seen in conjunction with markup like this: <td class="nav"> <a href="one.html" class="nav">one</a> | <a href="two.html" class="nav">two</a> | <a href="thr.html" class="nav">three</a> | <a href="fou.html" class="nav">four</a> </td> because the enclosing table cell has a class of nav, the vertical-bar char...
The Business Benefits of Web Standards - Archive of obsolete content
of web standards. it supplies a far better development framework, for content providers, for web developers, and for css stylists alike. it is simply not possible for everybody not to gain and share in the huge benefits of standards. customers, developers, digital media creators, can be freed from the tyranny of graphics led development, code generators, and incomprehensible markup. but the real value is at the bottom line. the message to accountants, executives and shareholders alike should be irresistible. benefits of css over javascript specifically, graphics and javascript are often used for special effects on text fragments. as style sheet technology gives designers good typographic control and permits effects such as roll-overs, it greatly reduces the need for javascript programming ...
Game distribution - Game development
ion involves little to no modification of the game itself — usually adding a manifest file containing necessary information in a zipped package containing all the resources is enough. the chrome web store is also an attractive option — again, having a manifest file ready, zipping your game and filling in the online submission form is about all that's required. tizen is also putting a high value on supporting apps written in javascript. their store is another available option. native mobile stores when it comes to the mobile market, there's the apple app store for ios, google play for android and all the rest of the competition. native stores are already filled with established devs selling great games, so you have to be talented and lucky to get noticed. the ios app store is quite...
Game monetization - Game development
s much money from the players as possible instead of delivering a fun experience. the worst cases were when you could use real money to pay for getting advantages over other players, or when they restricted access to the next stages of the game unless the players paid. the term "pay to win" was coined and this approach is disliked by many players and devs. if you want to implement iaps try to add value to the game with something players will enjoy instead of taking it out and then charging for it. add-ons and dlcs add-ons and downloadable content are a good way to provide extra value to an already released game, but remember that you'll have to offer decent, entertaining content to attract people to buy it. a totally new set of levels with new characters, weapons and story is a good material ...
2D collision detection - Game development
s no gap between any of the 4 sides of the rectangles. any gap means a collision does not exist. var rect1 = {x: 5, y: 5, width: 50, height: 50} var rect2 = {x: 20, y: 10, width: 10, height: 10} if (rect1.x < rect2.x + rect2.width && rect1.x + rect1.width > rect2.x && rect1.y < rect2.y + rect2.height && rect1.y + rect1.height > rect2.y) { // collision detected! } // filling in the values => if (5 < 30 && 55 > 20 && 5 < 20 && 55 > 10) { // collision detected! } rect code <div id="cr-stage"></div> <p>move the rectangle with arrow keys. green means collision, blue means no collision.</p> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/crafty/0.5.4/crafty-min.js"></script> crafty.init(200, 200); var dim1 = {x: 5, y: 5, w: 50, h: 50}...
3D collision detection - Game development
nd fast. a logical approach would be to check every vertex of the aabb, doing a point vs sphere test for each one. this is overkill, however — testing all the vertices is unnecessary, as we can get away with just calculating the distance between the aabb's closest point (not necessarily a vertex) and the sphere's center, seeing if it is less than or equal to the sphere's radius. we can get this value by clamping the sphere's center to the aabb's limits. in javascript, we'd do this test like so: function intersect(sphere, box) { // get box closest point to sphere center by clamping var x = math.max(box.minx, math.min(sphere.x, box.maxx)); var y = math.max(box.miny, math.min(sphere.y, box.maxy)); var z = math.max(box.minz, math.min(sphere.z, box.maxz)); // this is the same as isp...
Explaining basic 3D theory - Game development
ts up, and the z axis points out of the screen, as seen in the above diagram. objects different types of objects are built using vertices. a vertex is a point in space having its own 3d position in the coordinate system and usually some additional information that defines it. every vertex is described by these attributes: position: identifies it in a 3d space (x, y, z). color: holds an rgba value (r, g and b for the red, green, and blue channels, alpha for transparency — all values range from 0.0 to 1.0). normal: a way to describe the direction the vertex is facing. texture: a 2d image that the vertex can use to decorate the surface it is part of instead of a simple color. you can build geometry using this information — here is an example of a cube: a face of the given shape is...
GLSL Shaders - Game development
and you can also check out the links at the end of this article to learn more about it. both projectionmatrix and modelviewmatrix are provided by three.js and the vector is passed with the new 3d position, which results in the original cube moving 10 units along the x axis and 5 units along the z axis, translated via a shader. we can ignore the fourth parameter and leave it with the default 1.0 value; this is used to manipulate the clipping of the vertex position in the 3d space, but we don't need in our case. the texture shader code now we'll add the texture shader to the code — add the code below to the body's second <script> tag: void main() { gl_fragcolor = vec4(0.0, 0.58, 0.86, 1.0); } this will set an rgba color to recreate the current light blue one — the first three float va...
Audio for Web games - Game development
it comes in on the beat/bar/phrase or whatever units you want to chunk your background music into. to do this before playing the track you want to sync, you should calculate how long it is until the start of the next beat/bar etc. here's a bit of code that given a tempo (the time in seconds of your beat/bar) will calculate how long to wait until you play the next part — you feed the resulting value to the start() function with the first parameter, which takes the absolute time of when that playback should commence. note the second parameter (where to start playing from in the new track) is relative: if (offset == 0) { source.start(); offset = context.currenttime; } else { var relativetime = context.currenttime - offset; var beats = relativetime / tempo; var remainder = beats - ma...
Implementing game control mechanisms - Game development
, and update() is executed on every frame. for example, you can define a button in the create() function: create: function() { // ... var buttonenclave = this.add.button(10, 10, 'logo-enclave', this.clickenclave, this); // ... } it will be created once at the start of the game, and will execute this.clickenclave() action assigned to it when clicked, but you can also use the mouse's pointer value in the update() function to make an action: update: function() { // ... if(this.game.input.mousepointer.isdown) { // do something } // ... } this will be executed whenever the mouse button is pressed, and it will be checked against the input's isdown boolean variable on every frame of the game. that should give you some understanding of the project structure. we'll be playing mostly ...
Crisp pixel art look with image-rendering - Game development
images, which also benefit from working with smaller images. the css property to achieve this scaling is image-rendering. it is still experimental, but there is partial support in most browsers. the steps to achieve this effect are: create a <canvas> element and set its width and height attributes to the original, smaller resolution. set its css width and height properties to be 2x or 4x the value of the html width and height. if the canvas was created with a 128 pixel width, for example, we would set the css width to 512px if we wanted a 4x scale. set the <canvas> element's image-rendering css property to some value that does not make the image blurry. either crisp-edges or pixelated will work. check out the image-rendering article for more information on the differences between these va...
Efficient animation for web games - Game development
nless you have a great need to synchronise ui animation state with game animation state, you’re unlikely to be able to do a better job than the browser. the reason for this is that css transitions/animations are much higher level than javascript, and express a very specific intent. because of this, the browser can make some assumptions that it can’t easily make when you’re manually tweaking values in javascript. to take a concrete example, if you start a css transition to move something from off-screen so that it is fully visible on-screen, the browser knows that the related content will end up completely visible to the user and can then pre-render that content. when you animate position with javascript, the browser cannot easily make that same assumption, and so you might end up causing...
Square tilemaps implementation: Scrolling maps - Game development
w much its rendering (and therefore the rendering of the other tiles) is offset by. since the camera is pointing at (5, 10), we know that the first tile should be shifted by (-5,-10) pixels. in our demo the shifting amount is stored in the offsetx and offsety variables. var offsetx = -this.camera.x + startcol * map.tsize; var offsety = -this.camera.y + startrow * map.tsize; with these values in place, the loop that renders the map is quite similar to the one used for rendering static tilemaps. the main difference is that we are adding the offsetx and offsety values to the target x and y coordinates, and these values are rounded, to avoid artifacts that would result from the camera pointing at positions with floating point numbers. for (var c = startcol; c <= endcol; c++) { ...
Tiles and tilemaps overview - Game development
ge atlas that will be used (one or many.) map dimensions: the dimensions of the map, either in tiles across / tiles down, or pixels across / pixels down. visual grid: includes indices showing what type of tile should be placed on each position in the grid. logic grid: this can be a collision grid, a path-finding grid, etc., depending on the type of game. note: for the visual grid, a special value (usually a negative number, 0 or null) is needed to represent empty tiles. square tiles square-based tilemaps are the most simple implementation. a more generic case would be rectangular-based tilemaps — instead of square — but they are far less common. square tiles allow for two perspectives: top-down (like many rpg's or strategy games like warcraft 2 or final fantasy's world view.) s...
Build the brick field - Game development
culations that will work out the x and y position of each brick for each loop iteration: var brickx = (c*(brickwidth+brickpadding))+brickoffsetleft; var bricky = (r*(brickheight+brickpadding))+brickoffsettop; each brickx position is worked out as brickwidth + brickpadding, multiplied by the column number, c, plus the brickoffsetleft; the logic for the bricky is identical except that it uses the values for row number, r, brickheight, and brickoffsettop. now every single brick can be placed in its correct place row and column, with padding between each brick, drawn at an offset from the left and top canvas edges. the final version of the drawbricks() function, after assigning the brickx and bricky values as the coordinates instead of (0,0) each time, will look like this — add this into your ...
Collision detection - Game development
the screen or not. in the part of the code where we initialize the bricks, let's add a status property to each brick object. update the following part of the code as indicated by the highlighted line: var bricks = []; for(var c=0; c<brickcolumncount; c++) { bricks[c] = []; for(var r=0; r<brickrowcount; r++) { bricks[c][r] = { x: 0, y: 0, status: 1 }; } } next we'll check the value of each brick's status property in the drawbricks() function before drawing it — if status is 1, then draw it, but if it's 0, then it was hit by the ball and we don't want it on the screen anymore. update your drawbricks() function as follows: function drawbricks() { for(var c=0; c<brickcolumncount; c++) { for(var r=0; r<brickrowcount; r++) { if(bricks[c][r].status == 1...
Paddle and keyboard controls - Game development
the buttons are pressed. two functions handling the keydown and keyup events the code that will be run when the buttons are pressed. the ability to move the paddle left and right pressed buttons can be defined and initialized with boolean variables like in the example. add these lines somewhere near the rest of your variables: var rightpressed = false; var leftpressed = false; the default value for both is false because at the beginning the control buttons are not pressed. to listen for key presses, we will set up two event listeners. add the following lines just above the setinterval() line at the bottom of your javascript: document.addeventlistener("keydown", keydownhandler, false); document.addeventlistener("keyup", keyuphandler, false); when the keydown event is fired on any of th...
Track the score and win - Game development
nd filltext() to set the actual text that will be placed on the canvas, and where it will be placed. the first parameter is the text itself — the code above shows the current number of points — and the last two parameters are the coordinates where the text will be placed on the canvas. to award a score each time a brick is hit, add a line to the collisiondetection() function to increment the value of the score variable each time a collision is detected. add the following highlighted line to your code: function collisiondetection() { for(var c=0; c<brickcolumncount; c++) { for(var r=0; r<brickrowcount; r++) { var b = bricks[c][r]; if(b.status == 1) { if(x > b.x && x < b.x+brickwidth && y > b.y && y < b.y+brickheight) { ...
Animations and tweens - Game development
nstead of hiding the bricks instantly when hit by the ball, we will make their width and height scale to zero, so they will nicely disappear. to the end, we use the add.tween() method, specifying brick.scale as the argument as this is what we want to tween. the to() method defines the state of the object at the end of the tween. it takes an object containing the chosen parameter's desired ending values (scale takes a scale value, 1 being 100% of size, 0 being 0% of size, etc.), the time of the tween in milliseconds and the type of easing to use for the tween. we will also add the optional oncomplete event handler, which defines a function to be executed when the tween finishes. the last thing do to is to start the tween right away using start(). that's the expanded version of the tween def...
Build the brick field - Game development
now every single brick can be placed in its correct place, with padding between each brick, and drawn at an offset from the left and top canvas edges. checking the initbricks() code here is the complete code for the initbricks() function: function initbricks() { brickinfo = { width: 50, height: 20, coun...
Buttons - Game development
the 15th step out of 16 of the gamedev phaser tutorial. you can find the source code as it should look after completing this lesson at gamedev-phaser-content-kit/demos/lesson15.html. instead of starting the game right away we can leave that decision to the player by adding a start button they can press. let's investigate how to do that. new variables we will need a variable to store a boolean value representing whether the game is currently being played or not, and another one to represent our button. add these lines below your other variable definitions: var playing = false; var startbutton; loading the button spritesheet we can load the button spritesheet the same way we loaded the ball's wobble animation. add the following to the bottom of the preload() function: game.load.spriteshe...
Extra lives - Game development
ght-5); game.input.ondown.addonce(function(){ lifelosttext.visible = false; ball.body.velocity.set(150, -150); }, this); } else { alert('you lost, game over!'); location.reload(); } } instead of instantly printing out the alert when you lose a life, we first subtract one life from the current number and check if it's a non-zero value. if yes, then the player still has some lives left and can continue to play — they will see the life lost message, the ball and paddle positions will be reset on screen and on the next input (click or touch) the message will be hidden and the ball will start to move again. when the number of available lives reaches zero, the game is over and the game over alert message will be shown. events ...
Initialize the framework - Game development
ll available on the phaser download page, below the links for the v3 download. go to the phaser download page. choose an option that suits you best — i would recommend the min.js option as it keeps the source code smaller, and you are unlikely need to go through the source code anyway. save the phaser code inside a /js directory in the same location as your index.html file. update the src value of the first <script> element as shown above. walking through what we have so far at this point we have a charset defined, <title> and some basic css in the header to reset the default margin and padding. we also have a <script> element to apply the phaser source code to the page. the body contains a second <script> element, where we will write the javascript code to render the game and contro...
Physics - Game development
enabled by default. add the following line at the bottom of the create() function: game.physics.enable(ball, phaser.physics.arcade); next, if we want to move our ball on the screen, we can set velocity on its body. add the following line, again at the bottom of create(): ball.body.velocity.set(150, 150); removing our previous update instructions remember to remove our old method of adding values to x and y from the update() function: function update() { ball.x += 1; ball.y += 1; } we are now handling this properly, with a physics engine. final code check the latest code should look like this: var ball; function preload() { game.scale.scalemode = phaser.scalemanager.show_all; game.scale.pagealignhorizontally = true; game.scale.pagealignvertically = true; ga...
Randomizing gameplay - Game development
elow. add this new line to your code now, and try it out. function ballhitpaddle(ball, paddle) { ball.animations.play('wobble'); ball.body.velocity.x = -1*5*(paddle.x-ball.x); } it's a little bit of magic — the new velocity is higher, the larger the distance between the center of the paddle and the place where the ball hits it. also, the direction (left or right) is determined by that value — if the ball hits the left side of the paddle it will bounce left, whereas hitting the right side will bounce it to the right. it ended up that way because of a little bit of experimentation with the given values, you can do your own experimentation and see what happens. it's not completely random of course, but it does make the gameplay a bit more unpredictable and therefore more interesting.
Abstraction - MDN Web Docs Glossary: Definitions of Web-related terms
ler apis. advantages of data abstraction helps the user to avoid writing low level code. avoids code duplication and increases reusability. can change internal implementation of class independently without affecting the user. helps to increase security of an application or program as only important details are provided to the user. ...
Argument - MDN Web Docs Glossary: Definitions of Web-related terms
an argument is a value (primitive or object) passed as input to a function. learn more general knowledge difference between parameter and argument on wikipedia technical reference the arguments object in javascript ...
CSS - MDN Web Docs Glossary: Definitions of Web-related terms
css is one of the three core web technologies, along with html and javascript. css usually styles html elements, but can be also used with other markup languages like svg or xml. a css rule is a set of properties associated with a selector. ...
CSS pixel - MDN Web Docs Glossary: Definitions of Web-related terms
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 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 ...
Client hints - MDN Web Docs Glossary: Definitions of Web-related terms
support for client hints using the accept-ch (accept client hints) header or an equivalent html meta element with the http-equiv attribute. accept-ch: dpr, width, viewport-width, downlink and / or <meta http-equiv="accept-ch" content="dpr, width, viewport-width, downlink"> when a client receives the accept-ch header, if supported, it appends client hint headers that match the advertised field-values. for example, based on accept-ch example above, the client could append dpr, width, viewport-width, and downlink headers to all subsequent requests. in the second example, the server gives the browser the hints by setting the accept-ch meta tag. basically, with the client hints header, the developer or application can tell the browser to advertise information about itself to the server, such as...
Digest - MDN Web Docs Glossary: Definitions of Web-related terms
ideally, a digest is quick to calculate, irreversible, and unpredictable, and therefore indicates whether someone has tampered with a given message. ...
Dynamic typing - MDN Web Docs Glossary: Definitions of Web-related terms
dynamically-typed languages are those (like javascript) where the interpreter assigns variables a type at runtime based on the variable's value at the time. learn more learn about it javascript data types and data structures general knowledge type system on wikipedia ...
Effective connection type - MDN Web Docs Glossary: Definitions of Web-related terms
effective connection type (ect) refers to the measured network performance, returning a cellular connection type, like 3g, even if the actual connection is tethered broadband or wifi, based on the time between the browser requesting a page and effective type of the connection. the values of 'slow-2g', '2g', '3g', and '4g' are determined using observed round-trip times and downlink values. table of effective connection types ect minimum rtt maximum downlink explanation slow-2g 2000ms 50 kbps the network is suited for small transfers only such as text-only pages. 2g 1400ms 70 kbps the network is suited for transfers of small images. 3g 270ms 700 kbps the network is suited for transfers of large assets such as h...
Entity - MDN Web Docs Glossary: Definitions of Web-related terms
their corresponding character entities, as shown in the following table. character entity note & &amp; interpreted as the beginning of an entity or character reference. < &lt; interpreted as the beginning of a tag > &gt; interpreted as the ending of a tag " &quot; interpreted as the beginning and end of an attribute's value. learn more technical reference official list of character entities ...
Flex - MDN Web Docs Glossary: Definitions of Web-related terms
along with inline-flex 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. ...
Flex Container - MDN Web Docs Glossary: Definitions of Web-related terms
a flexbox layout is defined using the flex or inline-flex values of the display property on the parent item. this element then becomes a flex container, and each one of its children becomes a flex item. a value of flex causes the element to become a block level flex container, and inline-flex an inline level flex container. these values create a flex formatting context for the element, which is similar to a block formatting context in that floats will not intrude into the container, and the margins on the container will not collapse with those of the items. learn more property reference align-content align-items flex flex-direction flex-flow flex-wrap justify-content further reading css flexbox guide: basic concepts of flexbox css flexbox guide: aligning items in a f...
Function - MDN Web Docs Glossary: Definitions of Web-related terms
a function in javascript is also an object. a function name is an identifier included as part of a function declaration or function expression. the function name's scope depends on whether the function name is a declaration or expression. ...
Global object - MDN Web Docs Glossary: Definitions of Web-related terms
. scripts running under node.js have an object called global as their global object. window object in the browser the window object is the global object in the browser. any global variables or functions can be accessed as properties of the window object. access global variables var foo = "foobar"; foo === window.foo; // returns: true after defining a global variable foo, we can access its value directly from the window object, by using the variable name foo as a property name of the global object window.foo. explanation: the global variable foo was stored in the window object, like this: foo: "foobar" access global functions function greeting() { console.log("hi!"); } window.greeting(); // it is the same as the normal invoking: greeting(); the example above explains how globa...
Grid - MDN Web Docs Glossary: Definitions of Web-related terms
the grid that you define using these properties is described as an explicit grid. if you place content outside of this explicit grid, or if you are relying on auto-placement and the grid algorithm needs to create additional row or column tracks to hold grid items, then extra tracks will be created in the implicit grid. the implicit grid is the grid created automatically due to content being added outside of the tracks defined. in the example below i have created an explicit grid of three columns and two rows. ...
Grid Axis - MDN Web Docs Glossary: Definitions of Web-related terms
axis runs across the block axis and is the direction along which regular text flows. these are our rows in css grid layout. the physical direction of these axes can change according to the writing mode of the document. learn more further reading css grid layout guide: basic concepts of grid layout css grid layout guide: box alignment in grid layout css grid layout guide: grids, logical values and writing modes ...
Grid container - MDN Web Docs Glossary: Definitions of Web-related terms
when an element becomes a grid container it establishes a grid formatting context. the direct children can now lay themselves out on any explicit grid defined using grid-template-columns and grid-template-rows, or on the implicit grid created when an item is placed outside of the explicit grid. ...
Grid Lines - MDN Web Docs Glossary: Definitions of Web-related terms
learn more property reference grid-template-columns grid-template-rows grid-column-start grid-column-end grid-column grid-row-start grid-row-end grid-row further reading css grid layout guide: basic concepts of grid layout css grid layout guide: line-based placement with css grid css grid layout guide: layout using named grid lines css grid layout guide: css grids, logical values and writing modes definition of grid lines in the css grid layout specification ...
HTTP header - MDN Web Docs Glossary: Definitions of Web-related terms
an http header is a field of an http request or response that passes additional information, altering or precising the semantics of the message or of the body. headers are case-insensitive, begins at the start of a line and are immediately followed by a ':' and a value depending of the header itself. the value finish at the next crlf or at the end of the message. traditionally, headers are classed in categories, though this classification is no more part of any specification: general header: headers applying to both requests and responses but with no relation to 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 r...
IIFE - MDN Web Docs Glossary: Definitions of Web-related terms
nction. examples the function becomes a function expression which is immediately executed. the variable within the expression can not be accessed from outside it. (function () { var aname = "barry"; })(); // variable aname is not accessible from the outside scope aname // throws "uncaught referenceerror: aname is not defined" assigning the iife to a variable stores the function's return value, not the function definition itself. var result = (function () { var name = "barry"; return name; })(); // immediately creates the output: result; // "barry" ...
Intrinsic Size - MDN Web Docs Glossary: Definitions of Web-related terms
rinsic sizing specification. intrinsic sizing takes into account the min-content and max-content size of an element. for text the min-content size would be if the text wrapped as small as it can in the inline direction without causing an overflow, doing as much soft-wrapping as possible. for a box containing a string of text, the min-content size would be defined by the longest word. the keyword value of min-content for the width property will size an element according to the min-content size. the max-content size is the opposite — in the case of text, this would have the text display as wide as possible, doing no soft-wrapping, even if an overflow was caused. the keyword value max-content exposes this behavior. ...
Local scope - MDN Web Docs Glossary: Definitions of Web-related terms
learn more general knowledge scope on wikipedia ...
Local variable - MDN Web Docs Glossary: Definitions of Web-related terms
a variable whose name is bound to its value only within a local scope. example var global = 5; //is a global variable function fun(){ var local = 10; //is a local variable } ...
Main Axis - MDN Web Docs Glossary: Definitions of Web-related terms
these are: row row-reverse column column-reverse should you choose row or row-reverse then your main axis will run along the row in the inline direction. choose column or column-reverse and your main axis will run top to bottom of the page in the block direction. on the main axis you can control the sizing of flex items by adding any available space to the items themselves, by way of flex properties on the items. or, you can control the space between and around items by using the justify-content property. ...
Media (CSS) - MDN Web Docs Glossary: Definitions of Web-related terms
to be drawn by the rendering engine. typically, this is a screen—but it may also be a printer, a speech synthesizer, braille display, or another type of device. css offers several features that allow you to tweak your document's styles—or even offer different styles—according to the media type (such as screen or print, to name two) or media capabilities (such as width, resolution, or other values) of the viewer's device. learn more general knowledge using media queries technical reference media queries define a set of characteristics or parameters required to apply the css styles that are specified within the curly braces of the media query; for example: only applying certain css styles for devices below 768 pixels. @media at-rule conditionally apply part of a stylesheet, ba...
NaN - MDN Web Docs Glossary: Definitions of Web-related terms
practically speaking, if i divide two variables in a javascript program, the result may be nan, which is predefined in javascript as "undefined". hence this division may break the program. now, if this computation was a small part of a much larger algorithm, it would be really painful to figure out where the error actually occurs. ...
Parse - MDN Web Docs Glossary: Definitions of Web-related terms
if the document is well-formed, parsing it is straightforward and faster. ...
Prefetch - MDN Web Docs Glossary: Definitions of Web-related terms
which links the user is likely to click, then downloading the content of those links. if the user decides to click on one of the links, then the page will be rendered instantly as the content has already been downloaded. the prefetch hints are sent in http headers: link: ; rel=dns-prefetch, ; as=script; rel=preload, ; rel=prerender, ; as=style; rel=preload prefetch attribute value browsers will prefetch content when the prefetch <link> tag directs it to, giving the developer control over what resources should be prefetched. <link rel="prefetch" href="https://www.example.com/solutions" /> ...
Random Number Generator - MDN Web Docs Glossary: Definitions of Web-related terms
...
Recursion - MDN Web Docs Glossary: Definitions of Web-related terms
a function calling itself, recursion is used to solve problems that contain smaller sub-problems. a recursive function can receive two inputs: a base case (ends recursion) or a recursive case (resumes recursion). examples recursive function calls itself until condition met the following python code defines a function that takes a number, prints it, and then calls itself again with the number's value -1. it keeps going until the number is equal to 0, in which case it stops. def recurse(x): if x > 0: print(x) recurse(x - 1) recurse(10) the output will look like this: 10 9 8 7 6 5 4 3 2 1 0 learn more general knowledge recursion (computer science) on wikipedia more details about recursion in javascript ...
Reference - MDN Web Docs Glossary: Definitions of Web-related terms
in the context of objects, this is an object reference. on mdn, we could be talking about the javascript reference itself. in computing, a reference is a value that indirectly accesses data to retrieve a variable or a record in a computer's memory or other storage device. learn more general knowledge reference (computer science) on wikipedia ...
Response header - MDN Web Docs Glossary: Definitions of Web-related terms
ctly 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 jul 2016 16:06:00 gmt etag: "c561c68d0ba92bbeb8b0f612a9199f722e3a621a" keep-alive: timeout=5, max=997 last-modified: mon, 18 jul 2016 02:36:04 gmt server: apache set-cookie: mykey=myvalue; expires=mon, 17-jul-2017 16:06:00 gmt; max-age=31449600; path=/; secure transfer-encoding: chunked vary: cookie, accept-encoding x-backend-server: developer2.webapp.scl3.mozilla.com x-cache-info: not cacheable; meta data too large x-kuma-revision: 1085259 x-frame-options: deny ...
SQL Injection - MDN Web Docs Glossary: Definitions of Web-related terms
1 after clicking on the login button, the sql query will work as follows: "select count(*) from users where username=' admin ' and password=' anything 'or'1'='1 ' "; just take a closer look at the above query's password section. password=' anything 'or'1'='1 ' the password is not 'anything', hence password=anything results in false, but '1'='1' is a true statement and hence returns a true value. finally, due to the or operator, the value ( false or true ) is true, so authentication bypasses successfully. just due to a simple string (magical string) the entire database is compromised. how to prevent before executing the queries for the user credentials, make some changes like the following: $id = $_get['id'] (1) $id = stripslashes($id) (2) $id = mysql_real_escape_string($id) so ...
Scope - MDN Web Docs Glossary: Definitions of Web-related terms
if a variable or other expression is not "in the current scope," then it is unavailable for use. scopes can also be layered in a hierarchy, so that child scopes have access to parent scopes, but not vice versa. a function serves as a closure in javascript, and thus creates a scope, so that (for example) a variable defined exclusively within the function cannot be accessed from outside the function or within other functions. ...
Semantics - MDN Web Docs Glossary: Definitions of Web-related terms
ill style an <h1> with a large font size to make it look like a heading (although you could style it to look like anything you wanted). on the other hand, you could make any element look like a top level heading. consider the following: <span style="font-size: 32px; margin: 21px 0;">is this a top level heading?</span> this will render it to look like a top level heading, but it has no semantic value, so it will not get any extra benefits as described above. it is therefore a good idea to use the right html element for the right job. html should be coded to represent the data that will be populated and not based on its default presentation styling. presentation (how it should look), is the sole responsibility of css. some of the benefits from writing semantic markup are as follows: searc...
Serialization - MDN Web Docs Glossary: Definitions of Web-related terms
the process whereby an object or data structure is translated into a format suitable for transferral over a network, or storage (e.g. in an array buffer or file format). in javascript, for example, you can serialize an object to a json string by calling the function json.stringify(). css values are serialized by calling the function cssstyledeclaration.getpropertyvalue(). learn more general knowledge serialization on wikipedia ...
String - MDN Web Docs Glossary: Definitions of Web-related terms
in any computer programming language, a string is a sequence of characters used to represent text. in javascript, a string is one of the primitive values and the string object is a wrapper around a string primitive. learn more general knowledge string (computer science) on wikipedia javascript data types and data structures ...
Tag - MDN Web Docs Glossary: Definitions of Web-related terms
in html, a tag is used for creating an element. the name of an html element is the name used in angle brackets such as <p> for paragraph. note that the end tag's name is preceded by a slash character, </p>, and that in empty elements, the end tag is neither required nor allowed. if attributes are not mentioned, default values are used in each case. learn more general knowledge html element on wikipedia html elements syntax on whatwg technical reference introduction to html ...
Truthy - MDN Web Docs Glossary: Definitions of Web-related terms
in javascript, a truthy value is a value that is considered true when encountered in a boolean context. all values are truthy unless they are defined as falsy (i.e., except for false, 0, -0, 0n, "", null, undefined, and nan). javascript uses type coercion in boolean contexts. examples of truthy values in javascript (which will be coerced to true in boolean contexts, and thus execute the if block): if (true) if ({}) if ([]) if (42) if ("0") if ("false") if (new date()) if (-42) if (12n) if (3.14) if (-3.14) if (infinity) if (-infinity) specifications specification ecmascript (ecma-262)the definition of 'toboolean abstract operation' in that specification. ...
Variable - MDN Web Docs Glossary: Definitions of Web-related terms
a variable is a named reference to a value. that way an unpredictable value can be accessed through a predetermined name. learn more general knowledge variable (computer science) on wikipedia technical reference declaring variables in javascript var statement in javascript ...
XInclude - MDN Web Docs Glossary: Definitions of Web-related terms
} responsetype = 'responsetext'; break; case null: case 'xml': responsetype = 'responsexml'; break; default: alert('xinclude element contains an invalid "parse" attribute value'); return false; break; } request.send(null); if((request.status === 200 || request.status === 0) && request[responsetype] !== null) { response = request[responsetype]; if (responsetype === 'responsexml') { ...
Application Context - MDN Web Docs Glossary: Definitions of Web-related terms
applied to it. if an application context is created as a result of the user agent being asked to navigate to a deep link, the user agent must immediately navigate to the deep link with replacement enabled. otherwise, when the application context is created, the user agent must immediately navigate to the start url with replacement enabled. please note that the start url is not necessarily the value of the start_url member: the user or user agent could have changed it when the application was added to home-screen or otherwise bookmarked. ...
caret - MDN Web Docs Glossary: Definitions of Web-related terms
<textarea> elements, as well as any elements whose contenteditable attribute is set, thereby allowing the contents of the element to be edited by the user. learn more general knowledge caret navigation on wikipedia css related to the caret you can set the color of the caret for a given element's editable content by setting the element's css caret-color property to the appropriate <color> value. html elements that may present a caret these elements provide text entry fields or boxes and therefore make use of the caret. <input type="text"> <input type="password"> <input type="search"> <input type="date">, <input type="time">, <input type="datetime">, and <input type="datetime-local"> <input type="number">, <input type="range"> <input type="email">, <input type="tel">, and <inpu...
Loop - MDN Web Docs Glossary: Definitions of Web-related terms
e the code block. statement 3 is executed every time the code block is run. example: for(var i = 0; i < 10; i++){ console.log(i) } //this loop will print numbers 0-9, will stop when condition is met (i = 10) for the above example, the syntax is as follows: statement 1 sets the variable for the loop (var i = 0). statement 2 sets the loop condition (i < 10). statement 3 increases the value of i (i++) each time the code block is run. while loop syntax: while (condition){ execute code block } the code block will continue to loop as long as the condition is true. example: var i = 0; while(i < 5){ console.log(i) i++ } //this loop will print number 0-4, will stop when condition becomes false (i >=5) for the above example, the syntax is as follows: the code bloc...
Percent-encoding - MDN Web Docs Glossary: Definitions of Web-related terms
special characters needing encoding are: ':', '/', '?', '#', '[', ']', '@', '!', '$', '&', "'", '(', ')', '*', '+', ',', ';', '=', as well as '%' itself. other characters don't need to be encoded, though they could. ...
Property (JavaScript) - MDN Web Docs Glossary: Definitions of Web-related terms
a javascript property is a characteristic of an object, often describing attributes associated with a data structure. there are two kinds of properties: instance properties hold data that are specific to a given object instance. static properties hold data that are shared among all object instances. a property has a name (a string) and a value (primitive, method, or object reference). note that when we say that "a property holds an object", that is shorthand for "a property holds an object reference". this distinction matters because the original referenced object remains unchanged when you change the property's value. learn more general knowledge property (programming) on wikipedia introduction to object-oriented javascript ...
Property - MDN Web Docs Glossary: Definitions of Web-related terms
the term property can have several meanings depending on the context. it may refer to: property (css) a css property is a characteristic (like color) whose associated value defines one aspect of how the browser should display the element. property (javascript) a javascript property is a characteristic of an object, often describing attributes associated with a data structure. ...
Test your skills: CSS and JavaScript accessibility - Learn web development
: download the starting point for this task to work in your own editor or in an online editor. css accessibility 2 in this next task you are presented with a simple bit of content — just headings and paragraphs. there are accessibility issues with the colors and sizing of the text; we'd like you to: 1. explain what the problems are, and what the guidelines are that state the acceptable values for color and sizing. 2. select new values for the color and font-size that fix the problem. 3. update the css with these new values to fix the problem. 4. test the code to make sure the problem is now fixed. explain what tools or methods you used to select the new values and test the code. try updating the live code below to recreate the finished example: download the starting point for...
Mobile accessibility - Learn web development
ou, which allows you to quickly choose from a number of common useful options. to use it: twist two fingers around on the screen like you are turning a dial. each option will be read aloud as you twist further around. you can go back and forth to cycle through the options. once you've found the option you want: release your fingers to select it. if it is an option you can iterate the value of (such as volume or speaking rate), you can do a swipe up or down to increase or decrease the value of the selected item. the options available under the rotor are context-sensitive — they will differ depending on what app or view you are in (see below for an example). browsing web pages let's have a go at web browsing with voiceover: open your web browser. activate the url bar. ...
A cool-looking box - Learn web development
the css to the html. styling the box we'd like you to style the provided <p>, giving it the following: a reasonable width for a large button, say around 200 pixels. a reasonable height for a large button, centering the text vertically in the process. centered text. a slight increase in font size, to around 17-18 pixel computed style. use rems. write a comment about how you worked out the value. a base color for the design. give the box this color as its background color. the same color for the text; make it readable using a black text shadow. a fairly subtle border radius. a 1-pixel solid border with a color similar to the base color, but a slightly darker shade. a linear semi-transparent black gradient that goes toward the bottom right corner. make it completely transparent at th...
Test your skills: The Cascade - Learn web development
the aim of this task is to help you check your understanding of some of the values and units that we looked at in the lesson on the cascade and inheritance. note: you can try out solutions in the interactive editors below, however, it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. task one in this task, you need to use one of the special values we looked at in the controlling inheritance section to write a declaration in a new rule that will reset the background color back to white, without using an actual color value. in the example below see if you can match the image above. for assessment or ...
Test your skills: Images and Form elements - Learn web development
note: you can try out solutions in the interactive editors below, however, it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. task one in this task, you have an image that is overflowing the box. we want the image to scale down to fit inside the box without any extra white space, but we do not mind if some part of the image is cropped. ...
Combinators - Learn web development
next we will move on to another important part of css — the css box model. ...
Test your skills: Selectors - Learn web development
further work purposes, download the starting point for this task to work in your own editor or in an online editor. selectors five in this final task add css using attribute selectors to do the following: target the <a> element with a title attribute and make the border pink (border-color: pink). target the <a> element with an href attribute that contains the word contact somewhere in its value and make the border orange (border-color: orange). target the <a> element with an href value starting with https and give it a green border (border-color: green). try updating the live code below to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. assessment or further he...
CSS building blocks - Learn web development
to work with layout, an understanding of writing modes will be very helpful to you, therefore we will introduce them in this article. overflowing content in this lesson we will look at another important concept in css — overflow. overflow is what happens when there is too much content to be contained comfortably inside a box. in this guide, you will learn what it is and how to manage it. css values and units every property used in css has a value or set of values that are allowed for that property. in this lesson, we will take a look at some of the most common values and units in use. sizing items in css in the various lessons so far you have come across a number of ways to size items on a web page using css. understanding how big the different features in your design will be is importa...
Test Your Skills: Fundamental layout comprehension - Learn web development
should give you a page with basic styling but no layout, which should look something like the image seen below. this starting point has all of the content of your layout as displayed by the browser in normal flow. if you don't want to work locally then using a tool such as codepen or jsfiddle will work as well. you will need to upload the images using their assets functionality and replace the value in the src attribute to point to the new image location. your tasks you now need to implement your layout. the tasks you need to achieve are: to display the navigation items in a row, with an equal amount of space between the items. the navigation bar should scroll with the content and then become stuck at the top of the viewport when it reaches it. the image that is inside the article ...
Test your skills: Multicol - Learn web development
you will be working through three small tasks which use different elements of the material you have just covered. note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. ...
Test your skills: position - Learn web development
you will be working through two small tasks which use different elements of the material you have just covered. note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. positioning one in this task you need to position the item with a class of target to the top and right of the container, which has the 5px grey border. ...
Using your new knowledge - Learn web development
that i have used are as follows — each one links to its property page on mdn, which will give you more examples of its use. font-family color border-bottom font-weight font-size text-decoration i have used a mixture of selectors, styling elements such as h1 and h2, but also creating a class for the job title and styling that. use css to change how this biography looks by changing the values of the properties i have used. make the level one heading pink, using the css color keyword hotpink. give the heading a 10px dotted border-bottom which uses the css color keyword purple. make the level 2 heading italic. give the ul used for the contact details a background-color of #eeeeee, and a 5px solid purple border. use some padding to push the content away from the border. make the ...
create fancy boxes - Learn web development
circle as we want the bottom of our cloud to be flat. feel free to tweak this example to make a cloud that isn't flat at the bottom ;) */ border-radius: 100% 100% 0 0; } /* those are common style that apply to both our ::before and ::after pseudo elements. */ .fancy::before, .fancy::after { /* this is required to be allowed to display the pseudo-elements, event if the value is an empty string */ content: ''; /* we positionnate our pseudo-elements on the left and right sides of the box, but always at the bottom */ position: absolute; bottom : 0; /* this makes sure our pseudo-elements will be below the box content whatever happens. */ z-index : -1; background-color: #a4c9cf; border-radius: 100%; } .fancy::before { /* this is the ...
What text editors are available? - Learn web development
ier on yourself by choosing a text editor that understands the technologies you're working with. many text editors help you out with features like: syntax highlighting. make your file more legible by color-coding keywords based on the technology you're using. code completion. save you time by auto-completing recurring structures (for example, automatically close html tags, or suggesting valid values for a given css property). code snippets. as you saw when starting a new html document, many technologies use the same document structure over and over. save yourself the hassle of retyping all this by using a code snippet to pre-fill your document. most text editors now support syntax highlighting, but not necessarily the other two features. make sure in particular that your text editor supp...
How do you host your website on Google App Engine? - Learn web development
le account. go to the app engine dashboard on the google cloud platform console and press the create button. if you've not created a project before, you'll need to select whether you want to receive email updates or not, agree to the terms of service, and then you should be able to continue. enter a name for the project, edit your project id and note it down. for this tutorial, the following values are used: project name: gae sample site project id: gaesamplesite click the create button to create your project. creating an application each cloud platform project can contain one app engine application. let's prepare an app for our project. we'll need a sample application to publish. if you've not got one to use, download and unzip this sample app. have a look at the sam...
Test your skills: Form validation - Learn web development
re providing you with a similar example to what you saw in the accompanying article — a simple email address entry input. we would like you to use the constraint validation api, plus some form validation attributes, to program some custom error messages. make the input mandatory to fill in, and give it a minimum length of 10 characters. add an event listener that checks whether the inputted value is an email address, and whether it is long enough. if it doesn't look like an email address or is too short, provide the user with appropriate custom error messages. download the starting point for this task to work in your own editor or in an online editor. assessment or further help you can practice these examples in the interactive editors above. if you would like your work assessed, o...
Test your skills: HTML5 controls - Learn web development
pdating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. html5 controls 2 next, we want you to implement a slider control to allow the user to choose a maximum number of people to invite to their party. implement a basic slider control to go along with the provided label. give it a minimum value of 1, maximum value of 30, and initial value of 10. create a corresponding output element to put the current value of the slider into. give it a class of invite-output, and semantically associate it with the input. if you do this correctly, the javascript included on the page will automatically update the output value when the slider is moved. try updating the live code below to recreate the f...
Tips for authoring fast-loading HTML pages - Learn web development
e loaded eagerly; that is, the image is fetched and rendered as soon as it's processed in the html. all eagerly loaded images are rendered before the document's load event is sent. switching to lazy loading of images tells the browser to hold off on loading images until they're about to be needed to draw the visual viewport. to mark an image for lazy loading, specify its loading attribute with a value of lazy. with this set, the image will only be loaded when it's needed. <img href="./images/footerlogo.jpg" loading="lazy"> note that lazily-loaded images may not be available when the load event is fired. you can determine if a given image is loaded by checking to see if the value of its boolean complete property is true. choose your user-agent requirements wisely to achieve the greatest imp...
Define terms with HTML - Learn web development
ternative to a given term. you can use aria-describedby on any tag enclosing a keyword to be defined (not just the <dfn> element). aria-describedby references the id of the element containing the description. how to build a description list description lists are just what they claim to be: a list of terms and their matching descriptions (e.g., definition lists, dictionary entries, faqs, and key-value pairs). description lists are not suitable for marking up dialogue, because conversation does not directly describe the speakers. here are recommendations for marking up dialogue. the terms described go inside <dt> elements. the matching description follows immediately, contained within one or more <dd> elements. enclose the whole description list with a <dl> element. a simple example here'...
Use HTML to solve common problems - Learn web development
Learn › HTML › Howto
u should start: how to create a simple web form how to structure a web form tabular information some information, called tabular data, needs to be organized into tables with columns and rows. it's one of the most complex html structures, and mastering it is not easy: how to create a data table how to make html tables accessible data representation how to represent numeric and code values with html — see superscript and subscript, and representing computer code. how to use data attributes advanced text semantics how to take control of html line breaking how to mark changes (added and removed text) — see the <ins> and <del> elements. advanced images & multimedia how to add a responsive image to a webpage how to add vector image to a webpage how to add a hit map...
Marking up a letter - Learn web development
ss> elements. each line of the address should sit on a new line, but not be in a new paragraph. inline semantics the names of the sender and receiver (and tel and email) should be marked up with strong importance. the four dates in the document should be have appropriate elements containing machine-readable dates. the first address and first date in the letter should have a class attribute value of sender-column. the css you'll add later will cause these to be right aligned, as it should be in the case in a classic letter layout. mark up the five acronyms/abbreviations in the main text of the letter to provide expansions of each acronym/abbreviation. the six sub/superscripts should be marked up appropriately — in the chemical formulae, and the numbers 103 and 104 (they should be 10 ...
What’s in the head? Metadata in HTML - Learn web development
depending on what browser you use, you may not see this problem anyway. you should still set an encoding of utf-8 on your page anyway, to avoid any potential problems in other browsers. active learning: experiment with character encoding to try this out, revisit the simple html template you obtained in the previous section on <title> (the title-example.html page), try changing the meta charset value to iso-8859-1, and add the japanese to your page. this is the code we used: <p>japanese example: ご飯が熱い。</p> adding an author and description many <meta> elements include name and content attributes: name specifies the type of meta element it is; what type of information it contains. content specifies the actual meta content. two such meta elements that are useful to include o...
Video and audio content - Learn web development
audio) start playing again whenever it finishes. this can also be annoying, so only use if really necessary. muted causes the media to play with the sound turned off by default. poster the url of an image which will be displayed before the video is played. it is intended to be used for a splash screen or advertising screen. ...
Test your skills: Conditionals - Learn web development
r used to store a reponse that will be printed to the output panel. you need to create an if...else structure that checks whether the machine is switched on and puts a message into the response variable if it isn't, telling the user to switch the machine on. inside the first, you need to nest an if...else if...else that puts appropriate messages into the response variable depending on what the value of score is — if the machine is turned on. the different conditional tests (and resulting responses) are as follows: score of less than 0 or more than 100 — "this is not possible, an error has occurred." score of 0 to 19 — "that was a terrible score — total fail!" score of 20 to 39 — "you know some things, but it's a pretty bad score. needs improvement." score of 40 to 69 — "you...
Test your skills: Events - Learn web development
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). dom manipulation: considered useful some of the questions below require you to write some dom manipulation code to complete them — such as creating new html elements, setting their text contents to equal specific string values, and nesting them inside existing elements on the page — all via javascript. we haven't explicitly taught this yet in the course, but you'll have seen some examples that make use of it, and we'd like you to do some research into what dom apis you need to successfully answer the questions. a good starting place is our manipulating documents tutorial. events 1 in our first events-related task...
JavaScript building blocks - Learn web development
functions such as basic syntax, how to invoke and define functions, scope, and parameters. build your own function with most of the essential theory dealt with previously, this article provides a practical experience. here you'll get some practice with building up your own custom function. along the way, we'll also explain some further useful details of dealing with functions. function return values the last essential concept you must know about a function is return values. some functions don't return a significant value after completion, but others do. it's important to understand what their values are, how to make use of them in your code, and how to make your own custom functions return useful values. introduction to events events are actions or occurrences that happen in the system ...
What is JavaScript? - Learn web development
icking on this last version of the text label to see what happens (note also that you can find this demo on github — see the source code, or run it live)! javascript can do a lot more than that — let's explore what in more detail. so what can it really do? the core client-side javascript language consists of some common programming features that allow you to do things like: store useful values inside variables. in the above example for instance, we ask for a new name to be entered then store that name in a variable called name. operations on pieces of text (known as "strings" in programming). in the above example we take the string "player 1: " and join it to the name variable to create the complete text label, e.g. ''player 1: chris". running code in response to certain events occu...
Working with JSON - Learn web development
guess, stringify() works the opposite way. try entering the following lines into your browser's javascript console one by one to see it in action: let myjson = { "name": "chris", "age": "38" }; myjson let mystring = json.stringify(myjson); mystring here we're creating a javascript object, then checking what it contains, then converting it to a json string using stringify() — saving the return value in a new variable — then checking it again. test your skills! you've reached the end of this article, but can you remember the most important information? you can find some further tests to verify that you've retained this information before you move on — see test your skills: json. summary in this article, we've given you a simple guide to using json in your programs, including how to cr...
Test your skills: JSON - Learn web development
of the displaycatinfo() function, called when the provided promise chain (which starts by fetching the json data) is fulfilled. your task is to fill in the missing parts of the displaycatinfo() function to store: the names of the three mother cats, separated by commas, in the motherinfo variable. the total number of kittens, and how many are male and female, in the kitteninfo variable. the values of these variables are then printed to the screen inside paragraphs. some hints/questions: the json data is provided as text inside the displaycatinfo() function. you'll need to parse it into json before you can get any data out of it. you'll probably want to use an outer loop to loop through the cats and add their names to the motherinfo variable string, and an inner loop to loop through a...
Test your skills: Object-oriented JavaScript - Learn web development
dds 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 sidelength 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 examples in the interactive editors above. if you would like your work assessed, or are stuck and wa...
Test your skills: Object basics - Learn web development
r help section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version). object basics 1 in this task you are provided with an object literal, and your tasks are to store the value of the name property inside the catname variable, using bracket notation. run the greeting() method using dot notation (it will log the greeting to the browser devtools' console). update the color property value to black. 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. object ...
Measuring performance - Learn web development
a about what you are already doing well and what could be improved. at the time of writing, mdn's performance report summary looks similar to the following: a performance report contains information about things like how long a user has to wait before anything is displayed on the page, how many bytes need to be downloaded to display a page, and much more. it also lets you know it the measured values are considered good or bad. webpagetest.org is another example of a tool that automatically tests your site and returns useful metrics. try running your favorite website now, on both webpagetest.org and pagespeed insights, and see what the scores are. network tools most browsers have tools available that you can use to run against loaded pages and determine how they are performing. for examp...
Multimedia: Images - Learn web development
inue to load after the first paint, if their dimensions aren't defined before load, they can cause reflows to the page content. for example, when text gets pushed down the page by images loading. for this reason, it's critical that you set width and height attributes so that the browser can reserve space for them in the layout. for any background images, it's important you set a background-color value so any content overlaid is still readable before the image has downloaded. conclusion in this section we took a look at image optimization. you now have a general understanding of how to optimize half of the average web sites average bandwidth total. this is just one of the types of media consuming users bandwidth and slowing down page load. let's take a look at video optimization, tackling the...
The business case for web performance - Learn web development
ndon the site prematurely which can lead to low time on site metrics. net promotion score the net promoter score (nps) is a metric for assessing customer loyalty for a company’s brand, product, or service. poor user performance experiences can equation to poor brand reputation. setting converstion rate, time on site, and/or net promotion scores as kpis give financial and other business goal value to the web performance efforts, and get help boost buy in, with metrics to prove the efforts worth. expectation versus reality in performance business performance (in revenue, operations, etc.) is directly related to how to web performance. (source needed). area of conflict - not prioritizing web performance, but expecting good business metrics (see the three above). previous overview:...
Getting started with Ember - Learn web development
this on the todomvc family of projects: add keyboard access to demos re-enable outline on focusable elements ember has a strong commitment to being accessible by default and there is an entire section of the ember guides on accessibility on what it means for website / app design. that said, because this tutorial is a focus on the javascript side of making a small web application, todomvc's value comes from providing pre-made css and recommended html structure, which eliminates small differences between implementations, allowing for easier comparison. later on in the tutorial, we'll focus on adding code to our application to fix some of todomvc's biggest faults. installing the ember tooling ember uses a command-line interface (cli) tool for building and scaffolding parts of your applica...
Getting started with Vue - Learn web development
es for. public: this directory contains static assets that are published, but not processed by webpack during build (with one exception; index.html gets some processing). favicon.ico: this is the favicon for your app. currently, it's the vue logo. index.html: this is the template for your app. your vue app is run from this html page, and you can use lodash template syntax to interpolate values into it. note: this is not the template for managing the layout of your application — this template is for managing static html that sits outside of your vue app. editing this file typically only occurs in advanced use cases. src: this directory contains the core of your vue app. main.js: this is the entry point to your application. currently, this file initializes your vue...
Understanding client-side JavaScript frameworks - Learn web development
tivity issues related to updating objects and arrays. to avoid common pitfalls, we'll have to dig a little deeper into svelte's reactivity system. we'll also look at solving some accessibility focus issues, and more besides. 6. working with svelte stores in this article we will show another way to handle state management in svelte — stores. stores are global global data repositories that hold values. components can subscribe to stores and receive notifications when their values change. 7. typescript support in svelte we will now learn how to use typescript in svelte applications. first we'll learn what typescript is and what benefits it can bring us. then we'll see how to configure our project to work with typescript files. finally we will go over our app and see what modifications we hav...
Deploying our app - Learn web development
rom the command line we can run: npm run test the result, if successful, is … nothing. this is considered a success. in general we only want tests to be noisy if there's something wrong. the test also exited with a special signal that tells the command line that it was successful — an exit signal of 0. if there's a failure the test fails with an exit code of 1 — this is a system-level value that says "something failed". the npm run test command will use node to run all the files that are in the tests directory that end with .js. in our build script, npm run test is called, then you see the string && — this means "if the thing on the left succeeded (exited with zero), then do this thing on the right". so this translates into: if the tests pass, then build the code. you'...
Introducing a complete toolchain - Learn web development
if that's your preferred flavour of configuration file). first of all, create a file in the root of your will-it-miss directory called .prettierrc.json. to configure prettier, give .prettierrc.json the following contents: { "singlequote": true, "trailingcomma": "es5" } with these settings, when prettier formats javascript for you it will use single quotes for all your quoted values, and it won't use trailing commas (a newer feature of ecmascript that will cause errors in older browsers). you can find more about configuring prettier in its documentation. next up, we’ll configure eslint — create another file in the root of your will-it-miss directory called .eslintrc.json, and give it the following contents: { "env": { "es6": true, "browser": true },...
Package management basics - Learn web development
nor and patch releases after and including 2.0.1, up to but excluding 3.0.0. this is determined using a system called semver, which might look a bit complicated from the documentation but can be simplified by considering only the summary information and that a version is represented by major.minor.patch, such as 2.0.1 being major version 2 with patch version 1. an excellent way to try out semver values is to use the semver calculator. it's important to remember that npm update will not upgrade the dependencies to beyond the range defined in the package.json — to do this you will need to install that version specifically. audit for vulnerabilities npm audit yarn audit this will check all of the dependency tree for your project and run the specific versions you're using against a vulnerabi...
Accessibility/LiveRegionDevGuide
"tag:xul*" is not a live region. an event that has an object that is not a descendant of the document frame is not a live region. live properties this table describe the object attributes associated with a live region event. the following are guidelines on how to implement each container-live this property determines the interruption policy or politeness level for the event and can have values of "off", "polite", "assertive" and "rude". this property, along with an event's time stamp, determine the priority of a message within the priority queue. the following describes actions that should be taken for an event with the given politeness level: off: no action should be taken. the event should be filtered out as early as possible to prevent performance degradation. polite: a message ...
Multiprocess on Windows
he outparam array uses. this should be the iid that we want the interceptor to actually use when wrapping the array element. mlengthparamindex 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 array is allocated within the method's implementation by calling cotaskmemalloc(). using the interceptor in a11y code unlike the built in com marshaling schemes, we must explicitly wrap any com objects that we want to expose, through the mta with interceptors. the fun...
Mozilla’s UAAG evaluation report
ssibility support for other kinds of content 6.4 programmatic operation. (p1) vg can use keyboard api to control mozilla, by generating keystrokes programmatically when in-process, can use dom to generate events uses active accessibility to provide program access to controls do not support all active accessibility features for programmatic operation (put_accname, put_accvalue not yet supported) 6.5 programmatic alert of changes. (p1) g uses active accessibility to generate change events to assistive technology 6.6 conventional keyboard apis. (p1) c uses standard keyboard api, works with a number of assistive technologies 6.7 api character encodings. (p1) ? we use 16 bit strings, not sure about utf-16 6.8 dom css ac...
Benchmarking
plugin so you are testing firefox code and not flash jank problems. in about:addons > plugins, set shockwave flash to "never activate". timer precision firefox reduces the precision of the performance apis and other clock and timer apis accessible to web content. they are currently reduce to a multiple of 2ms; which is controlled by the privacy.reducetimerprecision about:config flag. the exact value of the precision is controlled by the privacy.resistfingerprinting.reducetimerprecision.microseconds about:config flag. profiling tools currently the gecko profiler has limitations in the ui for inverted call stack top function analysis which is very useful for finding heavy functions that call into a whole bunch of code. currently such functions may be easy to miss looking at a profile, so fe...
A bird's-eye view of the Mozilla framework
ttarget() method for obtaining the nsirdfnode for a given resource and property. var link = tocds.gettarget(resource, nc_link, true); now that getlink() has the nsirdfnode for the link, it can call queryinterface() to check whether the nsirdfliteral is supported. link = link.queryinterface(components.interfaces.nsirdfliteral); if nsirdfliteral is supported, getlink() uses it to return the value of the link. otherwise it returns null. if (link) return link.value; else return null; the document page for the link is displayed in thehelp viewer window. ...
Testopia
ital t). if you are on windows or another case insensitive file system you should first rename the folder (testopia-old for example) and then unzip the tarball. you can then merge your changes before deleting the old version. api users take note: positional parameters are now deprecated. all params should now be sent in a hash (struct, dict, hashmap or whatever your language of choice calls key, value pairs). though all attempts have been made to provide continuing support for positional parameters, please be aware that some api calls may fail until you make this change. also, future versions may remove this support completely. as always please backup your installation before attempting to install or upgrade. testopia 2.3 this version supports bugzilla 3.4. the main new features are: sup...
Building SpiderMonkey with UBSan
ero, which jesse doesn't think is actually undefined behavior (aside from the question of whether cpu overflow flags are set) vptr, a check that requires rtti, which is disabled by default in spidermonkey 4. when you hit a bug and want a stack trace, run under gdb with a breakpoint at the end of __ubsan::diag::~diag(). the stack trace should show a function such as __ubsan_handle_load_invalid_value or __ubsan_handle_type_mismatch being called by the buggy c++ code. (for automated testing outside of gdb, you can instead build with -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error, but then you lose ubsan's diagnostics and the ability to continue past errors.) known bugs. please file new bugs with e.g. [-fsanitize=float-cast-overflow] in the status whiteboard. ...
Choosing the right memory allocator
ow to use memory allocators that will only return valid memory buffers, and never return null. allocating strings in xpcom code see "callee-allocated parameters" in the xpcom strings guide; use tonewcstring() or tonewunicode() to allocate strings that will be passed out. these methods convert ns*string to nsimemory allocated, unowned [pruni]char* buffers. do not use nscrt::strdup for returning values from an xpcom object, as that uses a different allocator. nspr memory allocators you should only use the nspr allocators within nspr or the security code located in the /security/ subtree of the source code. avoid using them elsewhere. pr_alloc() (do not use, no users and only exists in /security/; use pr_malloc() instead) pr_malloc() == pr_malloc pr_calloc() == pr_calloc pr_reallo...
Creating a spell check dictionary add-on
trap element. type = 64 indicates that the add-on is in the restartless format, and unpack is required for hunspell to read the dictionary. although the restartless format for dictionary add-ons were introduced in gecko 10, dictionary updates only works starting from gecko 18. the em:minversion should therefore be the same as in the example above (or greater). if you set em:minversion to a lower value, gecko 10-17 will not be able to update your dictionary add-on once the restartless dictionary is installed (bug 782118), and gecko 10-16 may warn the user that your dictionary is not compatible, when users try to update to a newer version of firefox/thunderbird (bug 782115). update the em:maxversion to the greatest versions available. once you have added these files to your zip file and renam...
Debugging Internet Explorer
to run internet explorer in a single process add a dword registry value to hkey_current_user\software\microsoft\internet explorer\main called tabprocgrowth and set it to 0. edgehtml lets you extract various debugging dumps through a special webdriver ms/dumpinternal url. use jrmuizel's script to get started. ...
HTTP logging
don't like the default adjust the list of modules that you want to log: this list has the exact same format as the moz_log environment variable (see below). generally the default list is ok, unless a mozilla developer has told you to modify it. click on start logging. reproduce the bug (i.e. go to the web site that is broken for you and make the bug happen in the browser) make a note of the value of "current log file". click on stop logging. go to the folder containing the specified log file, and gather all the log files. you will see several files that look like: log.txt-main.1806, log.txt-child.1954, log.txt-child.1970, etc. this is because firefox now uses multiple processes, and each process gets its own log file. for many bugs, the "log.txt-main" file is the only thing you need t...
Building Firefox with Debug Symbols
fox with symbols there is a single configure option to enable building with symbols on all platforms. this is enabled by default so unless you have explcitly disabled it your build you should include symbols. ac_add_options --enable-debug-symbols this can optionally take an argument for the type of symbols that need to be produced (like "-g3"). by default it uses "-g" on linux and macos. this value takes precedence over the flags set in moz_debug_flags note that this will override the values provided for cflags and cxxflags. breakpad symbol files after the build is complete, run the following command to generate an archive of breakpad symbol files: mach buildsymbols the tinderbox uses an additional uploadsymbols target to upload symbols to a socorro server. see https://dxr.mozilla.org...
Makefiles - Best practices and suggestions
use variable assignments, autogen paths and dynamic file gathering. platform specific - avoid this logic whenever possible. ...
Eclipse CDT Manual Setup
support), so for now, this is the best we can do to give eclipse a chance of expanding its understanding of the source into the objective-c files. select "general > editors > text editors". if you want line numbers, tick "show line numbers". if you want a column marker to mark the 80th column to help with formatting code to mozilla's 80 character line limit, tick "show print margin" and set the value to 80. select "general > workspace" and select "refresh using native hooks or polling" and "refresh on access" to prevent eclipse giving you annoying "resource is out of sync" messages when files change from under it due to mercurial or other external activity. select "c/c++ > build > console" and set "limit console output (number of lines)" to something large, like "1000000". eclipse cdt will...
Gecko Logging
module - the log module to use. level - the log level of the message. message - a printf-style message to output. must be enclosed in parentheses. moz_log_test(module, level) checks if the module has the given level enabled. module - the log module to use. level - the output level of the message. log level numeric value purpose mozilla logging levels disabled 0 indicates logging is disabled. this should not be used directly in code. error 1 an error occurred, generally something you would consider asserting in a debug build. warning 2 a warning often indicates an unexpected state. info 3 an informational message, often indicates the current prog...
Obsolete Build Caveats and Tips
5, then you must first select the mozilla application that you want to build (see below), and you will probably also need to set at least some of the other basic configuration options (such as whether to build a debug build or not) to get the type of build that you need. if you are building from an older project branch that still uses cvs, you will need to set moz_co_project to the appropriate value or values, using a comma-separated list, such as "mk_add_options moz_co_project=browser,mail,calendar,suite,xulrunner". this setting is ignored by most mozilla project branches, which now use mercurial instead of cvs for source control. note: starting in gecko 2.0, objdir builds are enabled by default. if you do not specify a moz_objdir it will be automatically set to @topsrcdir@/obj-@confi...
Reviewer Checklist
apis added since froyo should be guarded by a version check. preffability if the feature being worked on is covered by prefs, make sure they are hooked up. if working on a new feature, consider adding prefs to control the behavior. consider adding prefs to disable the feature entirely in case bugs are found later in the release cycle. [fennec: "prefs" can be gecko prefs, sharedpreferences 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 l...
mach
gument will be an instance of mach.base.commandcontext. this object holds state from the mach driver, including the current directory, a handle on the logging manager, the settings object, and information about available mach commands. the arguments registered with @commandargument are passed to your method as keyword arguments using the **kwargs calling convention. so, you should define default values for all of your method's arguments. the return value from the @command method should be the integer exit code from the process. if not defined or none, 0 will be used. registering mach command providers once you've written a python module providing a mach command, you'll need to register it with mach. there are two ways to do this. if you have a single file, the easiest solution is probably ...
Cross Process Object Wrappers
ring. consider this code: mm.addmessagelistener("gotloadevent", function (msg) { mm.sendasyncmessage("changedocumenturi", {newuri: "hello.com"}); let uri = msg.objects.document.documenturi; dump("received load event: " + uri + "\n"); }); this sends a message asking the frame script to change the current document uri, then accesses the current document uri via a cpow. you might expect the value of uri to come back as "hello.com". but it might not: in order to avoid deadlocks, cpow messages can bypass normal messages and be processed first. it’s possible that the request for the documenturi property will be processed before the "changedocumenturi" message, in which case uri will have its previous value. for this reason, it’s best not to mix cpows with normal message manager messag...
Blocked: All storage access requests
fox: cookieblockedall=request to access cookies or storage on “x” was blocked because we are blocking all storage access requests. what went wrong? a request to access cookies or storage was blocked because the browser is blocking all storage access. the permission can be changed or removed by: going to preferences > content blocking in the custom content blocking section, selecting a value other than all cookies for the cookies item if the resource that is being blocked doesn't need authentication, you can fix the warning message by adding a crossorigin="anonymous" attribute to your element. ...
Storage access policy: Block cookies from trackers
added a preference that allows you to add custom domains to the tracking protection url classifier. to do so: type about:config in your address bar. if you are presented with a page that warns you "this may void your warranty!", click "i accept the risk!" search for the preference name "urlclassifier.trackingannotationtable.testentries". if the preference already exists, edit the preference value. if the preference does not exist, click "string" and then "+" to create a new preference. for the preference value enter comma separated origins that you’d like to have classified as trackers. e.g. "example.net,example.org". warning: be sure to remove these entries after you have finished testing. faq this cookie policy has the potential to lead to site breakage, but has been designed ...
HTMLIFrameElement.clearMatch()
...
HTMLIFrameElement.findAll()
...
HTMLIFrameElement.findNext()
dall() search has been carried out. invoking this method results in a mozbrowserfindchange event firing, which carries details about the search results. note: use of the browser api requires a privileged app, and browser and/or embed-apps permissions, depending on what you want to do. see using the browser api for more details. syntax instanceofhtmliframeelement.findnext(direction); return value void. parameters direction a string indicating the direction in which you want to cycle through the available search results. available values are forward and backward. examples the following functions are taken from our browser api demo, and cycle through the available search results. see implementing the search bar for more explanation. prev.addeventlistener('touchend',function() { ...
HTMLIFrameElement.getContentDimensions()
syntax var instanceofdomrequest = instanceofhtmliframeelement.getcontentdimensions(); returns a domrequest for handling the dimensions request. its request.onsuccess handler handles the success case, and its request.onerror handler handles the failure case. ...
HTMLIFrameElement.getManifest()
warning: removed in firefox 65. the getmanifest() method of the htmliframeelement interface retrieves the manifest of an app loaded in the browser <iframe> and returns it as json. syntax instanceofhtmliframeelement.getmanifest().then(function(json) { ... }); parameters none. return value a promise that resolves to a json object representation of the loaded app's manifest. examples var browser = document.queryselector('iframe'); browser.addeventlistener('mozbrowserloadend',function() { var request = browser.getmanifest().then(function(json) { console.log(json); }); }); specification not part of any specification. ...
HTMLIFrameElement.getMuted()
e two versions of this method, a callback version: var request = instanceofhtmliframeelement.getmuted(); and a promise version: instanceofhtmliframeelement.getmuted().then(function(muted) { ... }); returns callback version: a domrequest that represents the get muted request. it has an onsuccess handler to handle the success case, and an onerror handler to handle the failure case. the muted value is available in the request.result property, and is a boolean value — true means muted, and false means unmuted. promise version: a promise that resolves with the muted value — a boolean where true means muted, and false means unmuted. parameters none. example callback version: var browser = document.queryselector('iframe'); var request = browser.getmuted(); request.onsuccess = funct...
HTMLIFrameElement.getVolume()
versions of this method, a callback version: var request = instanceofhtmliframeelement.getvolume(); and a promise version: instanceofhtmliframeelement.getvolume().then(function(volume) { ... }); returns callback version: a domrequest that represents the get volume request. it has an onsuccess handler to handle the success case, and an onerror handler to handle the failure case. the volume value is available in the request.result property, and is a floating point number between 0 and 1. promise version: a promise that resolves with the volume value — a floating point number between 0 and 1. parameters none. example callback version: var browser = document.queryselector('iframe'); var request = browser.getvolume(); request.onsuccess = function() { console.log('the current bro...
mozbrowseractivitydone
t use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the mozbrowseractivitydone event is fired when something inside the browser <iframe> triggers a web activity, and that web activity's message is consumed by the receiving app. if the activity has a returnvalue set to true, then the activity is consumed when postresult or posterror is invoked on the activity by the receiving app. note: for activities where the receiving app's activity definition in its manifest does not include returnvalue or returnvalue is false, no mozbrowseractivitydone event will be generated as of the landing of bug 1194525 in firefox os 2.5. postresult and posterror calls made o...
mozbrowserasyncscroll
thin the browser <iframe>. note: top + height may be larger than scrollheight. this indicates that the content is over-scrolled, which occurs when the page "rubber-bands" after being scrolled all the way to the bottom. similarly, left + width may be greater than scrollwidth, and both left and top may be negative. note: for performance reasons, this event is asynchronous. that means that the value retrieved through the event object can be different than the real current position of the scroll when the event is processed. examples var browser = document.queryselector("iframe"); browser.addeventlistener("mozbrowserasyncscroll", function( event ) { console.log("the scroll top position of the document is:" + event.details.top + "px"); }); related events mozbrowserclose mozbrowsercon...
mozbrowsercontextmenu
read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following properties: clientx the x value of the coordinate that was clicked inside the browser <iframe>'s viewport. clienty the y value of the coordinate that was clicked inside the browser <iframe>'s viewport. systemtargets an array containing one or more menusystem objects (see the menusystem object, below), containing details of the standard menu(s) that will be shown. for example, if the user clicked on an image nested in an <a>...
mozbrowsererror
ubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. detail the detail property returns an anonymous javascript object with the following properties: type a domstring representing the type of error that occurred. ...
mozbrowsericonchange
ject a custom object. details the details property returns an anonymous javascript object with the following properties: href a domstring representing the path to the new icon. sizes a domstring listing the sizes the new icon is available in, e.g. "16x16" or "16x16 32x32". the any keyword can also be used, to represent "any size." rel a domstring representing the rel attribute value from the <link> element used to link to the icon. example var browser = document.queryselector("iframe"); browser.addeventlistener("mozbrowsericonchange", function( event ) { console.log("the url of the new favicon is:" + event.details.href); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowserloadend mozbrowserloadstart mozbrow...
mozbrowserlocationchange
story (true) or not (false). cangoforward a boolean that defines whether it's possible to go forward in the navigation history (true) or not (false). example this example updates the url bar so that it will always display the correct url for the current location. ...
mozbrowseropenwindow
details read only object a custom object. details the details property returns an anonymous javascript object with the following properties: url a domstring representing the url of the document loaded within the frameelement property. name a domstring representing the name of the new browser window. features a domstring containing features represented by a list of names and values separated by commas. for a complete list of possible features, see window.open(). frameelement an object representing the new browser <iframe> that will embed the new content. example var browser = document.queryselector("iframe"); browser.addeventlistener("mozbrowseropenwindow", function( event ) { console.log("a new window has opened containing the content at " + event.details.url + ".
mozbrowserscrollviewchange
oolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following properties: state a domstring representing the current state of scrolling in the viewport — available values are started and stopped. example var browser = document.queryselector("iframe"); browser.addeventlistener("mozbrowserscrollviewchange", function( event ) { console.log("scrolling has " + event.details.state + "."); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlo...
mozbrowserusernameandpasswordrequired
he event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following members: host a domstring representing the host requesting the http authentification. realm a domstring representing the value of the realm http header. isproxy a boolean indicating whether the server dealing with the authentication is a proxy server (true) or not (false). authenticate() a function that is called to enable the authentication to go ahead. it needs to take two parameters — the username and password to authenticate. cancel() a function that is called to cancel the authentication. example var brow...
HTMLIFrameElement.sendMouseEvent()
may change in the future. the sendmouseevent() method of the htmliframeelement interface allows you to fake a mouse event and send it to the browser <iframe>'s content. syntax instanceofhtmliframeelement.sendmouseevent(type, x, y, button, clickcount, modifiers); returns void. parameters type a string representing the event type. possible values are mousedown, mouseup, mousemove, mouseover, mouseout, or contextmenu. x a number representing the x position of the cursor relative to the browser <iframe>'s visible area in css pixels. y a number representing the y position of the cursor relative to the browser <iframe>'s visible area in css pixels. button a number representing which button has been pressed on the mouse: 0 (left button)...
HTMLIFrameElement.sendTouchEvent()
t and send it to the browser <iframe>'s content. note: this method is available for touch-enabled devices only. syntax instanceofhtmliframeelement.sendtouchevent(type, x, y, rx, ry, rotationangles, forces, count, modifiers); returns void. parameters type a string representing the event type. possible values are touchstart, touchend, touchmove, or touchcancel. x an array of numbers representing the x position of each touch point relative to the browser <iframe>'s visible area in css pixels. y an array of numbers representing the y position of each touch point relative to the browser <iframe>'s visible area in css pixels. rx an array of numbers representing the x radius of each touch point in c...
HTMLIFrameElement.setVolume()
user. there may also be large incompatibilities between implementations and the behavior may change in the future. the setvolume() method of the htmliframeelement sets the current volume of the browser <iframe>. syntax instanceofhtmliframeelement.setvolume(number); returns void. parameters number a floating point number representing the volume you want to set — this can have a value between 0 and 1. example var browser = document.queryselector('iframe'); browser.setvolume(0.5); specification not part of any specification. ...
HTMLIFrameElement.zoom()
Mozilla › Gecko › Chrome › API › Browser API › zoom
warning: removed in firefox 65. the zoom() method of the htmliframeelement interface changes the zoom factor of the browser <iframe>'s content. this is particularly useful for zooming in/out on non-touch-enabled devices. syntax var instanceofdomrequest = instanceofhtmliframeelement.zoom(zoomfactor); returns void. parameters zoomfactor a unitless number value representing the amount to zoom in or out. it acts like a percentage, so for example 1.1 would zoom in by 10%, whereas 0.9 would zoom out by 10%. examples var browser = document.queryselector('iframe'); var zoomfactor = 1; zoomin.addeventlistener('touchend',function() { zoomfactor += 0.1; browser.zoom(zoomfactor); }); zoomout.addeventlistener('touchend',function() { zoomfactor -= 0.1; browser.zoom(zoomfactor); });...
-moz-window-dragging
the -moz-window-dragging css property specifies whether a window is draggable or not. it only works in chrome code, and only on mac os x. the property was added in firefox 35 to solve intermittent problems related to firefox windows not being moveable when busy (bug 944836). initial value drag applies to all elements that create native windows, e.g. <window>, <panel> inherited no media visual computed value as specified animation type discrete canonical order the unique non-ambiguous order defined by the formal grammar syntax the -moz-window-dragging property is specified as one of the keyword values listed below. values drag the window is draggable. no-drag the window is not ...
Chrome-only CSS reference
Mozilla › Gecko › Chrome › CSS
it is short hand for the overflow-clip-box-inline and overflow-clip-box-block properties.overflow-clip-box-blockthe overflow-clip-box-block css property specifies relative to which box the clipping happens when there is an overflow — in the block direction.overflo...
MozBeforePaint
gecko 2.0 adds a new method for performing javascript controlled animations that synchronize not only with one another, but also with css transitions and smil animations being performed within the same window. usage outline in order to time your animation, the first thing you need to know is the time base; that is, the time at which your animation sequence started. you can determine this value by looking at window.mozanimationstarttime. this new property indicates the time, in milliseconds since epoch, at which all animations started in the specified window during the current refresh interval should be considered to have started running. with that value in hand, you can then schedule all your subsequent animation frames. whenever you're ready to refresh your animation, you call the window.r...
HTML parser threading
boundary. these objects are memory managed as follows: attribute holders (nshtml5htmlattributes objects) are allocated using new by the tokenizer. the tree builder either transfers an attribute holder to a tree op whose destructor explicitly deletes the attribute holder or if the tree builder ends up ignoring an attribute holder, the tree builder deletes the attribute holder explicitly. attribute values, public identifiers (in doctype) and system identifiers (in doctype) are heap-allocated nsstring objects (i.e. pointed to by nsstring*!). attribute values nsstrings are deleted by the attribute holder when it gets deleted. public identifiers and system identifiers are deleted by the tree op or by the portable parser core if they don't make it as far a tree op. the backing nsstringbuffers are thr...
How Mozilla determines MIME Types
see line 507 for the complete list. if that also failed, the list of loaded plugins is checked for a plugin that can handle this extension, and is asked for the mime type if no plugin is registered, the ext-to-type-mapping xpcom category is searched for the extension. this allows extensions to register additional mappings. the key of the category entry is the extension without leading dot, the value is the mime type. the extension must be lowercase. if no ext-to-type-mapping category is found, the externalhelperappservice returns application/x-extension-ext, where ext is the extension of the file. helper applications a somewhat related issue are the helper applications. when loading an uri with a type that mozilla can not handle, a helper app dialog shows up, and the displayed informatio...
IPDL Type Serialization
ze a collection of it (ex: an nstarray<examplestruct>) by simply declaring "using nstarray<examplestruct>;' in your ipdl file, then using it in a ipc method. serializers and deserializers are security-sensitive and must always receive two reviews from module owners who understand ipc serialization well. if in doubt, please ask for help! it is never acceptable to serialize/deserialize raw pointer values; if you are tempted, you probably should create a subprotocol for that data, so that ipdl can check the values and lifetime. ...
Infallible memory allocation
so; they are guaranteed to return a valid memory pointer. p = moz_xmalloc(); p = moz_xcalloc(); p = moz_xrealloc(); p = moz_xstrdup(); f = new foo(); farray = new foo[]; n = ::operator new(...); narray = ::operator new[](...); explicitly fallible memory allocators these memory allocators are explicitly fallible, and will remain so. when using these, you must check to ensure the resulting value isn't null before attempting to use the returned memory. p = malloc(); p = realloc(); namespace mozilla { f = new (fallible) foo(); farray = new (fallible) foo[]; } namespace mozilla { n = ::operator new(..., fallible); narray = ::operator new[](..., fallible); } see also choosing the right memory allocator ns_alloc() ...
JavaScript Tips
you need to access methods and properties of that interface. you do not have to query interfaces to compare objects, nor to pass objects as parameters (this is different from c++, where you do have to query interfaces in both cases). don't call queryinterface unless you expect to succeed. instead, use instanceof, e,g,: if (target instanceof components.interfaces.nsirdfresource) return target.value; if (target instanceof components.interfaces.nsirdfliteral) return target.value; return null; don't test the return value of queryinterface, it always returns the original variable if it succeeds. xpconnect knows all about tearoffs and modifies the object that you queryinterface or instanceof to cache all its known interfaces. when passing an object to an xpcom method it is helpful if the ...
AddonType
ay the different types of add-on. properties attribute type description id string the unique id for the type. name string the localized name for the type. uipriority integer a number used to determine the order of types displayed in the user interface. the lower the number the higher in the list the type will appear. built-in values: value category 2000 locale 4000 extension 5000 theme 6000 plugin viewtype integer the type of ui to use to display this type of add-on in the ui. if undefined the type will not appear in the ui. ...
Add-on Repository
callback) properties property type description homepageurl string the url of the repository site's home page. issearching boolean true if a search is currently in progress; otherwise false. methods getrecommendedurl() returns the url that can be visited to see recommended add-ons. string getrecommendedurl(); parameters none. return value an url indicating the repository's page of recommended add-ons. getsearchurl() returns an url of a web page that can be visited to see search results for the specified search terms. string getsearchurl( in string searchterms ); parameters searchterms search terms used to search the repository. return value the url of the search results page for the specified search terms. cancelsea...
DownloadLastDir.jsm
file(uri); console.log(file); private browsing mode when browsing normally, the browser uses the browser.download.lastdir preference to store the last download directory path. however, when private browsing mode is enabled, the last download directory path is instead maintained in memory, and the preference is not changed. when the user exits private browsing mode, the last download directory value is reverted to the preference's value. when history is cleared when the user's browsing history is cleared, the value of the last download directory path is restored to the platform's default download directory path. ...
Downloads.jsm
maintained using a view on a downloadlist. the start() method can be used to restart a failed download. handling of downloads that have been paused is also different. while some of the legacy methods and properties have an equivalent in downloads.jsm, there might be subtle differences in behavior. for example, the properties that handle progress are now more detailed and don't use the special value -1 anymore. you may see the documentation of the new methods and properties for details. using it in a xul app in a xul standalone application (running with xulrunner or firefox --app), you have to do additionnal things in order to use the new download manager. by default it is not enabled. it will be enabled when the bug 851471 will be closed. if you don't activate it, you could use downloads.
FxAccountsProfileClient.jsm
erverurl url profiler server url. token string bearer token. constructor fxaccountsprofileclient() creates and returns a new fxaccountsprofileclient object. fxaccountsprofileclient fxaccountsprofileclient( object options string serverurl, string token ); parameters serverurl - firefox profile server url. token - firefox accounts oauth bearer token. return value a newly created fxaccountsprofileclient object implementing the methods described in this article. methods fetchprofile() fetches firefox accounts profile information. parameters none return value promise resolves: object - successful response from the '/profile' endpoint. rejects: fxaccountsprofileclienterror - profile client error. examples using the fxaccountsprofileclien...
ISO8601DateUtils.jsm
convert a date object into a date string: datestring = iso8601dateutils.create(dateobj); method overview string create(adate); date parse(adatestring); methods create creates an iso 8601 format date string, e.g. "2010-05-15t13:45:00z", from a javascript date object. string create( adate ); parameters adate a javascript date object to translate into an iso 8601 format string. return value an iso 8601 format date string. parse converts an iso 8601 format date string into a javascript date object. date parse( adatestring ); parameters adatestring an iso 8601 format date string. return value a javascript date object corresponding to the specified date string. ...
Following the Android Toasts Tutorial from a JNI Perspective
ge shows this: there are two columns, the first column is the return, and the second column is the method name and arguments. we see that maketext returns static toast. this means it is a static method. we see that the return column of the show method does not contain the word static. therefore, it is a plain method. let's declare these methods in the third argument of loadclass we add a key-value pair, with the key being static_methods and methods and the value being an array. var toast = jni.loadclass(my_jenv, sig.toast.substr(1, sig.toast.length - 2), { static_methods: [ { name: 'maketext', sig: '()' } ], methods: [ { name: 'show', sig: '()' } ] }); the sig of methods is always in the format of "method format" from our types table above. the reason is ...
Log.jsm
structuredformatter(); length: 0 keys of prototype: format(); method overview enumerateinterfaces(); length: 0 enumerateproperties(); length: 2 member fields variable type description level object contains the following fields: field name value all 0 config 30 debug 20 desc { 0: "all", 10: "trace", 20: "debug", 30: "config", 40: "info", 50: "warn", 60: "error", 70: "fatal" } error 30 fatal 70 info 40 numbers { "all":...
OS.File.Info
// info.unixowner holds the owner of the file } else { // information is not available on this platform } } ); evolution of this example bug 802534 will introduce the ability to check whether field unixowner appears in os.file.info.prototype, which will make it possible to write faster code. global object os.file.info methods object tomsg(in os.file.info value) os.file.tomsg convert an instance of os.file.info to a form that can be serialized and transmitted between threads or processes. object tomsg( in os.file.info value ) arguments returns an object with the same fields as value but that may be serialized and transmitted between threads or processes. value an instance of os.file.info. instances of os.file.info cross-platform att...
PromiseUtils.jsm
s/promiseutils.jsm"); method overview deferred defer(); methods defer() creates a new pending promise and provides methods to resolve or reject this promise. this method was previously implemented as promise.defer(), which is obsolete since gecko 30. and promiseutils.defer uses dom promise instead of promise.jsm's promise. deferred defer(); parameters none. return value a new object, containing the new promise in the promise property, and the methods to change its state in the resolve and reject properties. see the deferred documentation for details. ...
JavaScript code modules
kmarks from the old-school "bookmarks.html" style bookmark files. ctypes.jsm provides an interface that allows javascript code to call native libraries without requiring the development of an xpcom component. customizableui.jsm allows you to interact with customizable buttons and items in firefox's main window ui. deferredtask.jsm run a task after a delay. dict.jsm provides an api for key/value pair dictionaries. downloadlastdir.jsm supplies the path to the directory into which the last download occurred. downloads.jsm provides a single entry point to interact with the downloading capabilities of the platform. fileutils.jsm provides helpers for dealing with files. geometry.jsm provides routines for performing basic geometric operations on points and rectangles. http.jsm a wrap...
Bootstrapping a new locale
d the top of the file to get any context on how to translate contained in the notes written by the developers or l10n-drivers. localization notes will look like this: <!-- localization notes... --> after the localization notes, you will see a list of <!entity> strings like the following: <!entity certerror.pagetitle "untrusted connection"> you should go through each entity, translating the value in the parameters (e.g. untrusted connection in the example above), like so (example for polish): <!entity certerror.pagetitle "niezaufane połączenie"> once you have translated all the <!entity> strings in this file, you should save your work and open the next .dtd or .property file. you will need to go through each and every file to in every directory in ab-cd. recommended order of locali...
Localization: Frequently asked questions
for more detailed documentation about localization in general, see our localization page. how do i preserve whitespace in an entity? do you really want to preserve whitespace or are you looking for a no-break space, you can add that via a &ua0; or \ua0 to dtd and properties files, resp. how can i not display a variable in a .properties entry? you can simply format the value to be of zero width, i.e., use %1$0.s ...
Mozilla Content Localized in Your Language
nd not be truncated or resolved through ellipsis. title on the final page (meaning no more click through) should allow enough room to display full text. buttons capitalize the first letter of each word. limit to one or two words. use verbs that precisely describe the button's action. for example, "cancel", "clear history", "add email", "select all", etc. value selector lists capitalize the first letter of the first word and the first letter of any proper nouns. limit to one or two words. note: if this doesn't apply to your language, indicate so as n/a. articles -- avoid them articles (such as the word "the" in english) should be avoided wherever possible. user interface elements have limited space available f...
Localization content best practices
ce files including the localized strings; it is important to add comments to the localizable files themselves, too. these comments are generally referred to as localization notes. don't forget to add a localization note when: part of the string is not supposed to be localized (for example, the name of an html attribute in a warning). string includes variables: always explain what will be the value of these variables at run-time. english could be ambiguous. for example: bookmark. is this a noun or a verb? using meaningful ids could also help in these cases. strings are used in a specific context. for example accessibility (a11y) strings: in this case space is less important than clarity, since these strings are not displayed in the ui but used by tools like screen readers. there is an e...
Localizing XLIFF files for iOS
in your terminal. enter the command git clone https://github.com/mozilla-l10n/firefoxios-l10n/your-locale-code/ you should now see the firefox-ios project in your selected directoy with the firefox-ios.xliff file in it. translating the xliff file open the firefox-ios.xliff file in your favorite text editor. in the <file> tag, add the target-language attribute with your locale code as the value (e.g., target-language="xx-xx"). be aware that there may be many <file> tags within one xliff document. each <file> tag requires the target-language attribute with your locale code as the value (e.g., target-language="xx-xx"). strings are located within <trans-unit> tags. source english strings are contained in <source> child tags. here is an example of such a <trans-unit> <trans-unit id="add ...
Localizing extension descriptions
d matches your application id from install.rdf and path_to_localization_file is the chrome path to the localization file you added to earlier): pref("extensions.extension_id.description", "path_to_localization_file"); localizable strings the following add-on metadata can be localized using this process: name description creator homepageurl localizable lists in cases where multiple values can exist, a numeric index is appended to the end of the preference name: extensions.extension_id.contributor.1=first_localized_contributor_name extensions.extension_id.contributor.2=second_localized_contributor_name extensions.extension_id.contributor.3=thrid_localized_contributor_name pref("extensions.extension_id.contributor.1", "path_to_localization_file"); pref("extensions.extension_id.co...
Localizing extension metadata on addons.mozilla.org
rily change with each revision (but it can). the localizable data fields of an extension are: name homepage summary description eula privacy policy version notes developer comments when you submit a new extension to amo, the process is divided into several steps. in step 2, you'll be asked to provide the attributes listed above in the add-on's default locale (selected in step 1). the values you provide here are used as fallback values if someone requests a language that doesn't exist. step 4 allows you to translate any of the above fields into any other language amo supports. remember, all fields are optional when localizing. any field that is blank will just show up in the default locale. getting translation help you are kindly advised not to use any automatic online translatio...
Localizing with Koala
let's create the other file. double-click on search.properties and click "ok" when koala asks if you want to create this file. from the sidebar, add the cmd_addfoundengine string to the newly-created search.properties file in your locale file structure. translate the cmd_addfoundengine string. notice that the .properties files have a different syntax than the dtd files. they're just a simple key=value mapping. save the file to save your work. re-running the comparison a common scheme of working with the compare-locales tools (included in koala) is to incrementally translate and commit the files and then re-run comparison to see what is left to be translated. to make sure you're always translating the most recent en-us reference, you should update the source repository before you start workin...
Localizing without a specialized tool
read the top of the file to get any context on how to translate contained in the notes written by the developers or l10n-drivers. localization notes will look like this: <!-- localization notes... --> after the localization notes, you will see a list of <!entity> strings like the following: <!entity certerror.pagetitle "untrusted connection"> you should go through each entity, translating the value in the parameters (e.g. untrusted connection in the example above), like so (example for polish): <!entity certerror.pagetitle "niezaufane połączenie"> once you have translated all the <!entity> strings in this file, you should save your work and open the next .dtd or .properties file. you will need to go through each and every file to in every directory in the x-testing directory. recommende...
Fonts for Mozilla 2.0's MathML engine
font as permitted by the eula for the product in which this font is included to display and print content", so consulting your lawyer is recommended if considering installing this on systems without the associated product. reset old preferences if users have previously changed the "font.mathfont-family" preference for a previous version of mozilla, then it is best to reset this to the default value. to do this, enter the url "about:config", "filter" for "mathfont", and "reset" to the default value through the context menu on the preference. mathml font selection with css you can get these fonts from the mathml-fonts add-on ; the xpi is just a zip archive that you can fetch and extract for example with the following command: wget https://addons.mozilla.org/firefox/downloads/latest/367848/add...
MathML Accessibility in Mozilla
d. torture test 14: ( ∂ 2 ∂ x 2 + ∂ 2 ∂ y 2 ) | φ ( x + i y ) | 2 = 0 __________ open the second partialderivative with respect to x of plus fraction the partial derivative of squared over the partial derivative of y squared end fraction close times the absolute value of phi open x plus i y close end absolute value squared is equal to 0 __________ ( fraction start, ∂ squared over ∂ x squared, end of fraction, + fraction start, ∂ squared over ∂ y squared, end of fraction, ), | ϕ ( x + i y ) | squared = 0 left paren fraction start. partial differential. superscript 2. over partial differen...
MathML Demo: <mspace> - space
interactive sizing html content <p> use the control buttons below to adjust the parameters of the <code>mspace</code> element and see the effects. ...
Mozilla Port Blocking
o the user or in the error console. "access to the port number given has been disabled for security reasons." "establishing a connection to an unsafe or otherwise banned port was prohibited" "0x804b0013 (ns_error_port_access_not_allowed)" if your product or web site uses a port which is blocked by mozilla's default port blocking rules, you can either change the port of your service to a unblocked value (recommended if possible) or ask your mozilla users to enable the port. for details on which ports are blocked and how to override the blocking see below. modifying mozilla's port blocking at run time users can modify the default port blocking through the addition of preferences containing comma delimited lists of port numbers to the user.js file (for single users with the user_pref(…) command)...
Mozilla Web Services Security Model
te elements are present or if the web service is in the same directory as the web-script-access.xml file, then the allow elements will be processed. if the file exists but contains no allow elements, then all access will be allowed. if allow elements exist, then the access will be allowed if one of them allows it. the type attribute the type attribute of the allow element can take the following values: any means that the allow element applies to all services that use web-scripts-access.xml for security checks. there may be more such such services in the future than there are now. this is the same as not having a type attribute. load [not implemented!] ability to load documents via xmlhttprequest or similar mechanisms. soap soap requests without verification headers soapv soap re...
Mozilla Quirks Mode Behavior
obsolete since gecko 1.9 (firefox 3) the basic table layout strategy ignores padding (on what) in quirks mode. obsolete since gecko 1.9 (firefox 3) the basic table layout strategy handles widths differently in some way. obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) in quirks mode absmiddle (handled incorrectly?) and middle (perhaps incorrectly as well?) are accepted as values of align on table cells, and absmiddle, abscenter, and middle are supported on tables (treated the same as center). removed in bug 559834 and bug 573322, though middle and absmiddle in table cells work in all modes now. in quirks mode, percentage values are supported on the cellspacing attribute, but treated as pixels (bug 106336). obsolete since gecko 13.0 (firefox 13.0 / thunderbird 13.0 ...
Build Metrics
installer. lower is better here, especially on space-restricted platforms like android. build times amount of time it takes to build firefox in automation on a specific platform / configuration. lower is better. compiler warnings number of compiler warnings detected during a build. lower is better. due to the way the build system works, compiler warnings are not consistently detected. so the value may fluctuate from build to build even if the number of compiler warnings didn't actually change. since perfherder alerts are calculated based on the mean value of a range, a regression may be reported as a fractional value. ...
BloatView
can be used. xpcom_mem_bloat_log if set, this causes a bloat log to be printed on program exit, and each time nstracerefcnt::dumpstatistics is called. this log contains data on leaks and bloat (a.k.a. usage). xpcom_mem_leak_log this is similar to xpcom_mem_bloat_log, but restricts the log to only show data on leaks. you can set these environment variables to any of the following values. 1 - log to stdout. 2 - log to stderr. filename - write log to a file. reading individual bloat logs full bloatview output contains per-class statistics on allocations and refcounts, and provides gross numbers on the amount of memory being leaked broken down by class. here's a sample of the bloatview output. == bloatview: all (cumulative) leak and bloat statistics, tab process 1862 ...
GC and CC logs
moz_cc_log_all environment variable. to log only shutdown collections, set moz_cc_log_shutdown. to make all ccs verbose, set moz_cc_all_traces to "all", or to "shutdown" to make only shutdown ccs verbose. live gc logging can be enabled with the pref javascript.options.mem.log. output to a file can be controlled with the moz_gctimer environment variable. see the statistics api page for details on values. set the environment variable moz_cc_log_thread to main to only log main thread ccs, or to worker to only log worker ccs. the default value is all, which will log all ccs. to get cycle collector logs on try server, set moz_cc_log_directory to moz_upload_dir, then set the other variables appropriately to generate cc logs. the way to set environment variables depends on the test harness, or you ...
Power profiling overview
estimates for up to four power planes or domains of a machine, as seen in the diagram above. pkg: the entire package. pp0: the cores. pp1: an uncore device, usually the gpu (not available on all processor models.) dram: main memory (not available on all processor models.) the following relationship holds: pp0 + pp1 <= pkg. dram is independent of the other three domains. these values are computed using a power model that uses processor-internal counts as inputs, and they have been verified as being fairly accurate. they are also updated frequently, at approximately 1,000 hz, though the variability in their update latency means that they are probably only accurate at lower frequencies, e.g. up to 20 hz or so. see section 14.9 of volume 3 of the intel software developer's manu...
TimerFirings logging
[6775] fn timer (one_shot 250 ms): presshell::spaintsuppressioncallback -991946880[7f46c365ba00]: [6775] fn timer (one_shot 160 ms): nsbrowserstatusfilter::timeouthandler -991946880[7f46c365ba00]: [6775] iface timer (one_shot 200 ms): 7f46964d7f80 -1340643584[7f46c365ec00]: [6775] obs timer (slack 1000 ms): 7f46a95a0200 each line has the following information. the first two values identify the thread. this is not especially useful. the next value is the process id (pid). this is useful in a multi-process scenario. next is the timer kind, one of fn (function), iface (interface) or obs (observer), which are the three kinds of timers that gecko supports. then comes the function kind, one of one_shot (a single-use timer), slack or precise (repeating timers of differing pre...
TraceMalloc
also, your javascript can call the following dom window methods: tracemallocdisable() - turn off tracing, first flushing any ...
perf
s the intel rapl energy estimates. the following example shows how to invoke it for this purpose. sudo perf stat -a -r 1 \ -e "power/energy-pkg/" \ -e "power/energy-cores/" \ -e "power/energy-gpu/" \ -e "power/energy-ram/" \ <command> the -a is necessary; it means "all cores", and without it all the measurements will be zero. the -r 1 means <command> is executed once; higher values can be used to get variations. the output will look like the following. performance counter stats for 'system wide': 51.58 joules power/energy-pkg/ [100.00%] 14.80 joules power/energy-cores/ [100.00%] 9.93 joules power/energy-gpu/ [100.00%] 27.38 joules power/energy-ram/ [100.00%] 5.003049064 seconds time elapsed it's not clear from the output, but the following r...
tools/power/rapl
does not support gpu or ram estimates then " n/a " will be printed in the relevant column instead of a number, and it will contribute zero to the total. once sampling is finished — either because the user interrupted it, or because the requested number of samples has been taken — the following summary data is shown: 10 samples taken over a period of 10.000 seconds 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 milli...
accessibility.tabfocus
the preference accessibility.tabfocus controls what elements receive focus when the user presses the tab key. note: on mac os x, if this preference is not set, the full keyboard access setting in system preferences > keyboard is honored. type:integer default value: 7 (windows and linux); 2 (mac os x) exists by default: no application support:gecko 1.7 status: active introduction: bugs: bug 140612 values 1 give focus only to text fields (default on mac osx) 2 give focus to all form elements except text fields. 4 give focus only to links and linked images. other you can add these values to combine their functionality. the value 7 (give focus to all elements) is the default on windows and linux. ...
browser.altClickSave
the preference browser.altclicksave controls whether clicking a link while holding the alt key starts the download of that link. type:boolean default value: false exists by default: yes application support:firefox 13.0 status: active; last updated 2012-03-19 introduction: pushed to nightly on 2012-03-02 bugs: bug 713052 values true clicking a link while holding the alt key starts the download of that link. false (default) no action triggered (see bug 736985). ...
browser.dom.window.dump.file
browser.dom.window.dump.file redirects the ouput of window.dump() calls to a file whose address is specified in this preference if browser.dom.window.dump.enabled is set to true. changes require an application restart. type:string default value:none exists by default: no application support: gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) status: active; last updated 2012-03-18 introduction: pushed to nightly on 2009-04-24 bugs: bug 489938 values the value holds the file system path for the file in which the content of the window.dump() calls get written, e.g. c:\dump.txt . it will be created if it doesn't exist yet. the line breaks have to be in the argument of the dump function, else successive dump calls will get logged into the same line. related browser.d...
browser.download.lastDir.savePerSite
browser.download.lastdir.savepersite controls whether the directory preselected in the file picker for saving a file download is being remembered on a per-website (host) base. if set to true, the data is stored as content preference. type:boolean default value:true exists by default: no application support:firefox 11.0 status: active; last updated 2012-02-15 introduction: pushed to nightly on 2011-12-11 bugs: bug 702748 values true (default) the last used directory for the website (host) serving the file for download will be preselected in the file picker. if no download directory for the current website has been stored, browser.download.lastdir will be used. false the last used directory for any download (stored in browser.download.lastdir) will be the preselected dir...
browser.pagethumbnails.capturing_disabled
the preference browser.pagethumbnails.capturing_disabled controls whether the application creates screenshots of visited pages which will be shown if the web page is shown in the grid of the "new tab page" (about:newtab) which offers the most often visited pages for fast navigation. type:boolean default value:true exists by default: no application support: firefox 14.0 status: active; last updated 2012-09-17 introduction: pushed to nightly on 2012-04-13 bugs: bug 726347 values false the application creates screenshots of visited web pages. true (default) the application doesn't create screenshots of visited web pages. ...
browser.search.context.loadInBackground
browser.search.context.loadinbackground controls whether a search from the context menu with "search <search engine> for <selected text>" opening a new tab will give focus to it and load it in the foreground or keep focus on the current tab and open it in the background. type:boolean default value:false exists by default: yes application support: firefox 13.0 status: active; last updated 2012-02-17 introduction: pushed to nightly on 2012-02-15 bugs: bug 727131 values true new tab with search results will be opened in the background, focus stays on the current tab. false (default) new tab with search results will be opened in the foreground. ...
browser.urlbar.formatting.enabled
the preference browser.urlbar.formatting.enabled controls whether the domain name including the top level domain is highlighted in the address bar by coloring it black and the other parts grey. type:boolean default value: true exists by default: yes application support:firefox 6.0 status: active; last updated 2012-04-03 introduction: pushed to nightly on 2011-05-03 bugs: bug 451833 values true (default) the domain name including the top level domain is highlighted in the address bar by coloring it black and the other parts grey. false all parts of the url are given the same color: black. ...
dom.event.clipboardevents.enabled
dom.event.clipboardevents.enabled lets websites get notifications if the user copies, pastes, or cuts something from a web page, and it lets them know which part of the page had been selected. the emitting of the oncopy, oncut and onpaste events are controlled by this preference. type:boolean default value:true exists by default: no application support: gecko 13.0 (firefox 13.0 / thunderbird 13.0 / seamonkey 2.10) status: active; last updated 2012-02-15 introduction: pushed to nightly on 2012-02-14 bugs: bug 542938 values true (default) the oncopy, oncut and onpaste events are enabled for web content. false the oncopy, oncut and onpaste events are disabled for web content. ...
javascript.options.showInConsole
the preference javascript.options.showinconsole controls whether errors or warnings in chrome code are shown in the error console. type:boolean default value: false (true in debug builds) exists by default: yes application support:firefox 1.0 status: active introduction:2002-02-26 bugs: bug 125181 bug 337875 values false only errors and warnings from content code are shown. true (default) errors and warnings from both chrome and content are shown in the error console. note: since the web console was introduced in firefox 4 specifically for debugging content, the default value for this preference has changed to true as of gecko 2.0. ...
javascript.options.strict
rnings are logged to the javascript console. example : <html> <head> <title>sample</title> </head> <body> <label id="name">enter you first name</label> <p id ="sample"></p> <script> "use strict" name1= "john" ; // this will cause and an error as variable not declared . var name2= "peter"; document.getelementbyid("sample").innerhtml = name1; </script> </body> </html> possible values and their effects: true: show javascript errors and warnings. false: show javascript errors only. (default) see also: http://kb.mozillazine.org/javascript.options.strict ...
mail.tabs.drawInTitlebar
starting in thunderbird 17.0, the tabs are drawn in the title bar. the old behavior can be restored by setting the preference mail.tabs.drawintitlebar to false. type:boolean default value: true exists by default: yes application support:thunderbird 17.0 status: active; last updated 2012-09-17 introduction: pushed to daily on 2012-08-08 bugs: bug 771816 values true (default) the tabs are drawn in the title bar of the mail program. false the tabs are drawn in a separate tab bar, and the title bar shows the title of the current tab (e.g. the subject of the currently selected mail). ...
nglayout.debug.disable_xul_cache
in the xul fastload file, which saves a “compiled” version of the xul and javascript in a document to disk for faster startup the next time the application runs. during development of xul applications, it’s convenient to disable the xul cache so that changes you make to files on disk take effect the next time the window or dialog is loaded (instead of the next time mozilla starts). possible values and their effects: true: do not cache parsed xul documents and do not save the cache to the xul fastload file on exit; re-read the source files each time the window or dialog needs to be displayed. false: cache xul documents in memory and save the cache to disk on exit to improve performance. (default) see also: http://kb.mozillazine.org/nglayout.debug.disable_xul_cache ...
nglayout.debug.disable xul fastload
the preference nglayout.debug.disable_xul_fastload controls whether or not xul fastload is used. never set nglayout.debug.disable_xul_fastload to true in a production environment; it exists solely to aid in debugging. in particular, add-ons should never change this preference.. type:boolean default value: false (true in debug builds) exists by default: yes application support:? status: active introduction:? bugs: values false (default) xul fastload is used. true xul fastload is disabled. ...
reader.parse-on-load.force-enabled
the preference reader.parse-on-load.force-enabled controls if the reader mode used in firefox mobile should be enabled independent of the memory available in the device. by default, the reader mode in firefox mobile is only enabled if the memory is greater than 384mb. type:boolean default value: false exists by default: yes application support:firefox mobile 23.0 status: active; last updated 2013-05-11 introduction: pushed to nightly on 2013-05-06 bugs: bug 867875 values true reader mode is enabled independent of memory available. false (default) reader mode is only enabled if memory available exceeds a threshold (currenlty 384mb). ...
ui.SpellCheckerUnderline
ui.spellcheckerunderline holds the colour which is used to underline words not recognized by the spellchecker. type:string default value:#ff0000 exists by default: no application support: gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) status: active; last updated 2012-02-21 introduction: pushed to nightly on 2009-04-03 bugs: bug 338209 values a color code like #ff0000 for red. ...
ui.SpellCheckerUnderlineStyle
ui.spellcheckerunderlinestyle holds the style which is used to underline words not recognized by the spellchecker. type:integer default value:5 exists by default: no application support: gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) status: active; last updated 2012-02-22 introduction: pushed to nightly on 2009-04-03 bugs: bug 338209 values the values are defined in nsstyleconsts.h. 0 no underlining 1 dotted 2 dashed 3 single solid line 4 two solid lines 5 (default) wavy ...
ui.tooltipDelay
ui.tooltipdelay stores the delay in milliseconds between the mouse stopping over an element and the appearing of its tooltip. type:integer default value:500 exists by default: no application support: gecko 11.0 (firefox 11.0 / thunderbird 11.0 / seamonkey 2.8) status: active; last updated 2012-02-21 introduction: pushed to nightly on 2011-12-15 bugs: bug 204786 values integer (milliseconds, default: 500) the time for delay between the mouse stopping over the element and the tooltip appearing is stored in milliseconds and the default value is 500ms. ...
view_source.syntax_highlight
the preference view_source.syntax_highlight controls whether markup in the view source view is syntax highlighted. type:boolean default value: true exists by default: yes application support:firefox 1.0 status: active introduction: bugs: bug 52154 values true (default) syntax hightlighting is enabled. false syntax hightlighting is disabled. ...
Preferences
these articles provide information about how to use the preference system. documentation preferences system an introduction to using the preference system in mozilla. xul school: handling preferences the xul school tutorial chapter on preferences. mozilla preference reference a reference guide to all mozilla preferences; currently a work in progress. ...
NSPR build instructions
from mercurial hg clone https://hg.mozilla.org/projects/nspr # create a build directory mkdir target.debug cd target.debug # run the configure script ../nspr/configure [optional configure options] # build the libraries gmake # build the test programs cd pr/tests gmake on mac os x, use make, which is gnu make. configure options although nspr uses autoconf, its configure script has two default values that are different from most open source projects. if the os vendor provides a compiler (for example, sun and hp), nspr uses that compiler instead of gcc by default. nspr build generates a debug build by default. --disable-debug --enable-optimize specify these two options to generate an optimized (release) build. these two options can actually be used independently, but it's not recommen...
Dynamic Library Linking
main executable program pr_loadlibrary cannot open a handle that references the main executable program. (this is admittedly an omission that should be fixed.) however, it is possible to look up symbols defined in the main executable program as follows. prlibrary *lib; void *funcptr; funcptr = pr_findsymbolandlibrary("functionname", &lib); when pr_findsymbolandlibrary returns, funcptr is the value of the function pointer you want to look up, and the variable lib references the main executable program. you can then call pr_findsymbol on lib to look up other symbols defined in the main program. remember to call pr_unloadlibrary(lib) to close the library handle when you are done. platform notes to use the dynamic library loading functions on some platforms, certain environment variables mus...
Hash Tables
ups). ...
Interval Timing
ossibility of outside influence (as might be observed if one was using a time-of-day clock that gets reset due to some administrative action). the counters have no fixed epoch and have a finite period. to make use of these counters, the application must declare a point in time, the epoch, and an amount of time elapsed since that epoch, the interval. in almost all cases the epoch is defined as the value of the interval timer at the time it was sampled. printervaltime interval functions interval timing functions are divided into three groups: getting the current interval and ticks per second converting standard clock units to platform-dependent intervals converting platform-dependent intervals to standard clock units getting the current interval and ticks per second pr_intervalnow...
Introduction to NSPR
ding the monitor's mutex). this requirement implies that when a thread first enters the monitor, an evaluation of the invariant expression must yield a true. the thread must also reinstate the monitored invariant before exiting the monitor. therefore, evaluation of the expression must also yield a true at that point in execution. a trivial example might be as follows. suppose an object has three values, v1, v2, and sum. the invariant is that the third value is the sum of the other two. expressed mathematically, the invariant is sum = v1 + v2. any modification of v1 or v2 requires modification of sum. since that is a complex operation, it must be monitored. furthermore, any type of access to sum must also be monitored to ensure that neither v1 nor v2 are in flux. note: evaluation of the invari...
NSPR Error Handling
ound. pr_no_access_rights_error calling thread does not have privilege to perform the operation requested. pr_operation_not_supported_erro the requested operation is not supported by the platform. pr_protocol_not_supported_error the host operating system does not support the protocol requested. pr_remote_file_error access to the remote file has been severed. pr_buffer_overflow_error the value retrieved is too large to be stored in the buffer provided. pr_connect_reset_error the (tcp) connection has been reset by the peer. pr_range_error unused. pr_deadlock_error performing the requested operation would have caused a deadlock. the deadlock was avoided. pr_file_is_locked_error an attempt to acquire a lock on a file has failed because the file is already locked. pr_file_too_big_...
NSPR LOG FILE
able to specify a log file other than the default. if nspr_log_file is not in the environment, then log output is written to stdout or stderr, depending on the platform. set nspr_log_file to the name of the log file you want to use. nspr logging, when enabled, writes to the file named in this environment variable. for ms windows systems, you can set nspr_log_file to the special (case-sensitive) value windebug. this value causes logging output to be written using the windows function outputdebugstring(), which writes to the debugger window. ...
NSPR LOG MODULES
this environment variable specifies which log modules have logging enabled. syntax modulename:level[, modulename:level]* modulename is the name specified in a pr_newlogmodule call or one of the handy magic names listed below. level is a numeric value between 0 and 5, with the values having the following meanings: 0 = pr_log_none: nothing should be logged 1 = pr_log_always: important; intended to always be logged 2 = pr_log_error: errors 3 = pr_log_warning: warnings 4 = pr_log_debug: debug messages, notices 5: everything! description specify a modulename that is associated with the name argument in a call to pr_newlogmodule and a non-zero level value to enable logging for the named modulename. special log module names are provided for controlling nspr's log service at executio...
PLHashEntry
syntax #include <plhash.h> typedef struct plhashentry plhashentry; description plhashentry is a structure that represents an entry in the hash table. an entry has a key and a value, represented by the following fields in the plhashentry structure. const void *key; void *value; the key field is a pointer to an opaque key. the value field is a pointer to an opaque value. if the key of an entry is an integral value that can fit into a void * pointer, you can just cast the key itself to void * and store it in the key field. similarly, if the value of an entry is an integral value that can fit into a void * pointer, you can cast the value itself to void * and store it in the value field. warning: there are other fields in the plhashentry structure besides key and value. these fields are f...
PLHashEnumerator
syntax #include <plhash.h> typedef printn (pr_callback *plhashenumerator)(plhashentry *he, printn index, void *arg); /* return value */ #define ht_enumerate_next 0 /* continue enumerating entries */ #define ht_enumerate_stop 1 /* stop enumerating entries */ #define ht_enumerate_remove 2 /* remove and free the current entry */ #define ht_enumerate_unhash 4 /* just unhash the current entry */ description plhashenumerator is a function type used in the enumerating a hash table. when all the table entries are enumerated, each entry is passed to a user-specified function of type plhashenumerator with the hash table entry, an integer index, and an arbitrary piece of user data as argument. remark the meaning of ht_enumerate_unhash is not clear. in the current implementatio...
PLHashNumber
syntax #include <plhash.h> typedef pruint32 plhashnumber; #define pl_hash_bits 32 description plhashnumber is an unsigned 32-bit integer. plhashnumber is the data type of the return value of a hash function. a hash function maps a key to a hash number, which is then used to compute the index of the bucket. the macro pl_hash_bits is the size (in bits) of the plhashnumber data type and has the value of 32. see also plhashfunction ...
PL_CompareStrings
compares two character strings. syntax #include <plhash.h> printn pl_comparestrings( const void *v1, const void *v2); description pl_comparestrings compares v1 and v2 as character strings using strcmp. if the two strings are equal, it returns 1. if the two strings are not equal, it returns 0. pl_comparestrings can be used as the comparator function for string-valued key or entry value. ...
PL_HashTableLookup
looks up the entry with the specified key and return its value. syntax #include <plhash.h> void *pl_hashtablelookup( plhashtable *ht, const void *key); parameters the function has the following parameters: ht a pointer to the hash table in which to look up the entry specified by key. key a pointer to the key for the entry to look up. returns the value of the entry with the specified key, or null if there is no such entry. description if there is no entry with the specified key, pl_hashtablelookup returns null. this means that one cannot tell whether a null return value means the entry does not exist or the value of the entry is null. keep this ambiguity in mind if you want to store null values in a hash table. ...
PL_strdup
returns a pointer to a new memory node in the nspr heap containing a copy of a specified string. 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. ...
PRAccessHow
...
PRBool
boolean value. syntax #include <prtypes.h> typedef enum { pr_false = 0, pr_true = 1 } prbool; description wherever possible, do not use prbool in mozilla c++ code. use standard c++ bool instead. otherwise, use prbool for variables and parameter types. use pr_false and pr_true for clarity of target type in assignments and actual arguments. use if (bool), while (!bool), (bool) ? x : y, and so on to test boolean values, just as you would c int-valued conditions. ...
PRHostEnt
rint16 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_length length of internal representation of the address in bytes. all of the addresses in the list are of the same type and therefore of the same length. 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 ...
PRIOMethods
d network address. poll test the file descriptor to see if it is ready for i/o. acceptread accept and read from a new network file descriptor. transmitfile transmit an entire file to the specified socket. getsockname get network address associated with a file descriptor. getpeername get peer's network address. getsockopt get current setting of specified socket option. setsockopt set value of specified socket option. description you don't need to know the type declaration for each function listed in the method table unless you are implementing a layer. for information about each function, see the corresponding function description in this document. for example, the write method in priomethods implements the pr_write function. for type definition details, see prio.h. the i/o met...
PRMcastRequest
syntax #include <prio.h> struct prmcastrequest { prnetaddr mcaddr; prnetaddr ifaddr; }; typedef struct prmcastrequest prmcastrequest; fields the structure has the following fields: mcaddr ip multicast address of group. ifaddr local ip address of interface. description the mcaddr and ifaddr fields are of the type prnetaddr, but their port fields are ignored. ...
PRPackedBool
syntax #include <prtypes.h> typedef pruint8 prpackedbool; description use prpackedbool within structures. ...
PRSeekWhence
specifies how to interpret the offset parameter in setting the file pointer associated with the fd parameter for the pr_seek and pr_seek64 functions. syntax #include <prio.h> typedef prseekwhence { pr_seek_set = 0, pr_seek_cur = 1, pr_seek_end = 2 } prseekwhence; enumerators the enumeration has the following enumerators: pr_seek_set sets the file pointer to the value of the offset parameter. pr_seek_cur sets the file pointer to its current location plus the value of the offset parameter. pr_seek_end sets the file pointer to the size of the file plus the value of the offset parameter. ...
PRSockOption
syntax #include <prio.h> typedef enum prsockoption { pr_sockopt_nonblocking, pr_sockopt_linger, pr_sockopt_reuseaddr, pr_sockopt_keepalive, pr_sockopt_recvbuffersize, pr_sockopt_sendbuffersize, pr_sockopt_iptimetolive, pr_sockopt_iptypeofservice, pr_sockopt_addmember, pr_sockopt_dropmember, pr_sockopt_mcastinterface, pr_sockopt_mcasttimetolive, pr_sockopt_mcastloopback, pr_sockopt_nodelay, pr_sockopt_maxsegment, pr_sockopt_last } prsockoption; enumerators the enumeration has the following enumerators: pr_sockopt_nonblocking nonblocking i/o. ...
PRThreadPrivateDTOR
the destructor function passed to pr_newthreadprivateindex that is associated with the resulting thread private index. syntax #include <prthread.h> typedef void (pr_callback *prthreadprivatedtor)(void *priv); description until the data associated with an index is actually set with a call to pr_setthreadprivate, the value of the data is null. if the data associated with the index is not null, nspr passes a reference to the data to the destructor function when the thread terminates. ...
PRTime
a representation of absolute times. syntax #include <prtime.h> typedef print64 prtime; description this type is a 64-bit integer representing the number of microseconds since the nspr epoch, midnight (00:00:00) 1 january 1970 coordinated universal time (utc). a time after the epoch has a positive value, and a time before the epoch has a negative value. in nspr, we use the more familiar term greenwich mean time (gmt) in place of utc. although utc and gmt are not exactly the same in their precise definitions, they can generally be treated as if they were. note: keep in mind that while prtime stores times in microseconds since epoch, javascript date objects store times in milliseconds since epoch. ...
PR_Accept
r_accept( prfiledesc *fd, prnetaddr *addr, printervaltime timeout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing the rendezvous socket on which the caller is willing to accept new connections. addr a pointer to a structure of type prnetaddr. on output, this structure contains the address of the connecting entity. timeout a value of type printervaltime specifying the time limit for completion of the accept operation. returns the function returns one of the following values: upon successful acceptance of a connection, a pointer to a new prfiledesc structure representing the newly accepted connection. if unsuccessful, null. further information can be obtained by calling pr_geterror. description the socket fd is a ...
PR_AcceptRead
eceive. does not include the size of the prnetaddr structures. if 0, no data will be read from the peer. timeout the timeout interval only applies to the read portion of the operation. pr_acceptread blocks indefinitely until the connection is accepted; the read will time out after the timeout interval elapses. returns a positive number indicates the number of bytes read from the peer. the value -1 indicates a failure. the reason for the failure can be obtained by calling pr_geterror. description pr_acceptread accepts a new connection and retrieves the newly created socket's descriptor and the connecting peer's address. also, as its name suggests, pr_acceptread receives the first block of data sent by the peer. ...
PR_Access
determines the accessibility of a file. syntax #include <prio.h> prstatus pr_access( const char *name, praccesshow how); parameters the function has the following parameters: name the pathname of the file whose accessibility is to be determined. how specifies which access permission to check for. use one of the following values: pr_access_read_ok. test for read permission. pr_access_write_ok. test for write permission. pr_access_exists. check existence of file. returns one of the following values: if the requested access is permitted, pr_success. if the requested access is not permitted, pr_failure. ...
PR_AtomicDecrement
atomically decrements a 32-bit value. syntax #include <pratom.h> print32 pr_atomicdecrement(print32 *val); parameter the function has the following parameter: val a pointer to the value to decrement. returns the function returns the decremented value (i.e., the result). description pr_atomicdecrement first decrements the referenced variable by one. the value returned is the referenced variable's final value. the modification to memory is unconditional. ...
PR_AtomicIncrement
atomically increments a 32-bit value. syntax #include <pratom.h> print32 pr_atomicincrement(print32 *val); parameter the function has the following parameter: val a pointer to the value to increment. returns the function returns the incremented value (i.e., the result). description the referenced variable is incremented by one. the result of the function is the value of the memory after the operation. the writing of the memory is unconditional. ...
PR_AtomicSet
atomically sets a 32-bit value and return its previous contents. syntax #include <pratom.h> print32 pr_atomicset( print32 *val, print32 newval); parameters the function has the following parameter: val a pointer to the value to be set. newval the new value to assign to the val parameter. returns the function returns the prior value of the referenced variable. description pr_atomicset first reads the value of var, then updates it with the supplied value. the returned value is the value that was readbefore memory was updated. the memory modification is unconditional--that is, it isn't a test and set operation. ...
PR_AttachSharedMemory
attaches a memory segment previously opened with pr_opensharedmemory and maps it into the process memory space. syntax #include <prshm.h> nspr_api( void * ) pr_attachsharedmemory( prsharedmemory *shm, printn flags ); /* define values for pr_attachsharedmemory(...,flags) */ #define pr_shm_readonly 0x01 parameters the function has these parameters: shm the handle returned from pr_opensharedmemory. flags options for mapping the shared memory. pr_shm_readonly causes the memory to be attached read-only. returns address where shared memory is mapped, or null if an error occurs. retrieve the reason for the failure by calling pr_geterror and pr_getoserror. ...
PR_AttachThread
type type, prthreadpriority priority, prthreadstack *stack); parameters pr_attachthread has the following parameters: type specifies that the thread is either a user thread (pr_user_thread) or a system thread (pr_system_thread). priority the priority to assign to the thread being attached. stack the stack for the thread being attached. returns the function returns one of these values: if successful, a pointer to a prthread object. if unsuccessful, for example if system resources are not available, null. description you use pr_attachthread when you want to use nss functions on the native thread that was not created with nspr. pr_attachthread informs nspr about the new thread by associating a prthread object with the native thread. the thread object is automatically de...
PR_Available
ines the number of bytes (expressed as a 32-bit integer) that are available for reading beyond the current read-write pointer in a specified file or socket. syntax #include <prio.h> print32 pr_available(prfiledesc *fd); parameter the function has the following parameter: fd pointer to a prfiledesc object representing a file or socket. returns the function returns one of the following values: if the function completes successfully, it returns the number of bytes that are available for reading. for a normal file, these are the bytes beyond the current file pointer. if the function fails, it returns the value -1. the error code can then be retrieved via pr_geterror. description pr_available works on normal files and sockets. pr_available does not work with pipes on win32 platfo...
PR_Available64
es the number of bytes (expressed as a 32-bit integer) that are available for reading beyond the current read-write pointer in a specified file or socket. syntax #include <prio.h> print64 pr_available64(prfiledesc *fd); parameter the function has the following parameter: fd pointer to a prfiledesc object representing a file or socket. returns the function returns one of the following values: if the function completes successfully, it returns the number of bytes that are available for reading. for a normal file, these are the bytes beyond the current file pointer. if the function fails, it returns the value -1. the error code can then be retrieved via pr_geterror. description pr_available64 works on normal files and sockets. pr_available does not work with pipes on win32 plat...
PR_Bind
nds an address to a specified socket. syntax #include <prio.h> prstatus pr_bind( prfiledesc *fd, const prnetaddr *addr); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket. addr a pointer to a prnetaddr object representing the address to which the socket will be bound. returns the function returns one of the following values: upon successful binding of an address to a socket, pr_success. if unsuccessful, pr_failure. further information can be obtained by calling pr_geterror. description when a new socket is created, it has no address bound to it. pr_bind assigns the specified address (also known as name) to the socket. if you do not care about the exact ip address assigned to the socket, set the inet.ip field...
PR_CALLBACK
...
PR_CExitMonitor
decrement the entry count associated with a cached monitor. syntax #include <prcmon.h> prstatus pr_cexitmonitor(void *address); parameters the function has the following parameters: address the address of the protected object--the same address previously passed to pr_centermonitor. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. this may indicate that the address parameter is invalid or that the calling thread is not in the monitor. description using the value specified in the address parameter to find a monitor in the monitor cache, pr_cexitmonitor decrements the entry count associated with the monitor. if the decremented entry count is zero, the monitor is exited. ...
PR_CLIST_IS_EMPTY
checks for an empty circular list. syntax #include <prclist.h> printn pr_clist_is_empty (prclist *listp); parameter listp a pointer to the linked list. description pr_clist_is_empty returns a non-zero value if the specified list is an empty list, otherwise returns zero. ...
PR_CNotify
notify a thread waiting on a change in the state of monitored data. syntax #include <prcmon.h> prstatus pr_cnotify(void *address); parameter the function has the following parameter: address the address of the monitored object. the calling thread must be in the monitor defined by the value of the address. returns pr_success indicates that the calling thread is the holder of the mutex for the monitor referred to by the address parameter. pr_failure indicates that the monitor has not been entered by the calling thread. description using the value specified in the address parameter to find a monitor in the monitor cache, pr_cnotify notifies single a thread waiting for the monitor's state to change. if a thread is waiting on the monitor (having called pr_cwait), then that thread...
PR_CNotifyAll
rameter: address the address of the monitored object. the calling thread must be in the monitor at the time pr_cnotifyall is called. returns pr_success indicates that the referenced monitor was located and the calling thread was in the monitor. pr_failure indicates that the referenced monitor could not be located or that the calling thread was not in the monitor description using the value specified in the address parameter to find a monitor in the monitor cache, pr_cnotifyall notifies all threads waiting for the monitor's state to change. all of the threads waiting on the state change are then scheduled to reenter the monitor. ...
PR_Cleanup
if the calling thread of this function is not the primordial thread, pr_failure. description pr_cleanup must be called by the primordial thread near the end of the main function. pr_cleanup attempts to synchronize the natural termination of the process. it does so by blocking the caller, if and only if it is the primordial thread, until all user threads have terminated. ...
PR_Close
if the file descriptor is not closed successfully, pr_failure. ...
PR_CloseFileMap
closes a file mapping. syntax #include <prio.h> prstatus pr_closefilemap(prfilemap *fmap); parameter the function has the following parameter: fmap the file mapping to be closed. returns the function returns one of the following values: if the memory region is successfully unmapped, pr_success. if the memory region is not successfully unmapped, pr_failure. the error code can be retrieved via pr_geterror. description when a file mapping created with a call to pr_createfilemap is no longer needed, it should be closed with a call to pr_closefilemap. ...
PR_Connect
initiates a connection on a specified socket. syntax #include <prio.h> prstatus pr_connect( prfiledesc *fd, const prnetaddr *addr, printervaltime timeout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket. addr a pointer to the address of the peer to which the socket is to be connected. timeout a value of type printervaltime specifying the time limit for completion of the connect operation. returns the function returns one of the following values: upon successful completion of connection setup, pr_success. if unsuccessful, pr_failure. further information can be obtained by calling pr_geterror. description pr_connect is usually invoked on a tcp socket, but it may also be invoked on a udp socket. both ca...
PR_CreatePipe
ipe, prfiledesc **writepipe); parameters the function has the following parameters: readpipe a pointer to a prfiledesc pointer. on return, this parameter contains the file descriptor for the read end of the pipe. writepipe a pointer to a prfiledesc pointer. on return, this parameter contains the file descriptor for the write end of the pipe. returns the function returns one of these values: if the pipe is successfully created, pr_success. if the pipe is not successfully created, pr_failure. the error code can be retrieved via pr_geterror. description pr_createpipe creates an anonymous pipe. data written into the write end of the pipe can be read from the read end of the pipe. pipes are useful for interprocess communication between a parent and a child process. when the pipe...
PR_DELETE
allocates memory of a specified size from the heap. syntax #include <prmem.h> void pr_delete(_ptr); parameter _ptr the address of memory to be returned to the heap. must be an lvalue (an expression that can appear on the left side of an assignment statement). returns nothing. description this macro returns allocated memory to the heap from the specified location and sets _ptr to null. ...
PR_Delete
syntax #include <prio.h> prstatus pr_delete(const char *name); parameters the function has the following parameter: name the pathname of the file to be deleted. returns one of the following values: if file is deleted successfully, pr_success. if the file is not deleted, pr_failure. description pr_delete deletes a file with the specified pathname name. if the function fails, the error code can then be retrieved via pr_geterror. ...
PR_DestroyPollableEvent
close the file descriptor associated with a pollable event and release related resources. syntax nspr_api(prstatus) pr_destroypollableevent(prfiledesc *event); parameter the function has the following parameter: event pointer to a prfiledesc structure previously created via a call to pr_newpollableevent. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. the reason for the failure can be retrieved via pr_geterror. ...
PR_ExitMonitor
f the entry count reaches zero, releases the monitor's lock. syntax #include <prmon.h> prstatus pr_exitmonitor(prmonitor *mon); parameter the function has the following parameter: mon a reference to an existing structure of type prmonitor. the monitor object referenced must be one for which the calling thread currently holds the lock. returns the function returns one of the following values: if successful, pr_success. if unsuccessful (the calling thread has not entered the monitor), pr_failure. description if the decremented entry count is zero, pr_exitmonitor releases the monitor's lock. threads that were blocked trying to enter the monitor will be rescheduled. ...
PR_ExplodeTime
...
PR_FamilyInet
gets the value of the address family for internet protocol. syntax #include <prnetdb.h> pruint16 pr_familyinet(void); returns the value of the address family for internet protocol. this is usually pr_af_inet, but can also be pr_af_inet6 if ipv6 is enabled. the returned value can be assigned to the inet.family field of a prnetaddr object. ...
PR GetAddrInfoByName
on has the following parameters: hostname the character string defining the host name of interest. af the address family. may be pr_af_unspec or pr_af_inet. flags may be either pr_ai_addrconfig or pr_ai_addrconfig | pr_ai_nocanonname. include pr_ai_nocanonname to suppress the determination of the canonical name corresponding to hostname returns the function returns one of the following values: if successful, a pointer to the opaque praddrinfo structure containing the results of the host lookup. use pr_enumerateaddrinfo to inspect the prnetaddr values stored in this structure. when no longer needed, this pointer must be destroyed with a call to pr_freeaddrinfo. if unsuccessful, null. you can retrieve the reason for the failure by calling pr_geterror. ...
PR_GetConnectStatus
if unsuccessful, pr_failure. ...
PR_GetError
returns the current thread's last set platform-independent error code. syntax #include <prerror.h> prerrorcode pr_geterror(void) returns the value returned is a 32-bit number. nspr provides no direct interpretation of the number's value. nspr does use pr_seterror to set error numbers defined in error codes. ...
PR_GetErrorTextLength
gets the length of the error text. syntax #include <prerror.h> print32 pr_geterrortextlength(void) returns if a zero is returned, no error text is currently set. otherwise, the value returned is sufficient to contain the error text currently available. ...
PR_GetFileInfo
syntax #include <prio.h> prstatus pr_getfileinfo( const char *fn, prfileinfo *info); parameters the function has the following parameters: fn the pathname of the file to get information about. info a pointer to a file information object (see prfileinfo). on output, pr_getfileinfo writes information about the given file to the file information object. returns one of the following values: if the file information is successfully obtained, pr_success. if the file information is not successfully obtained, pr_failure. description pr_getfileinfo stores information about the file with the specified pathname in the prfileinfo structure pointed to by info. the file size is returned as an unsigned 32-bit integer. see also for the 64-bit version of this function, see pr_getfilein...
PR_GetFileInfo64
e <prio.h> prstatus pr_getfileinfo64( const char *fn, prfileinfo64 *info); parameters the function has the following parameters: fn the pathname of the file to get information about. info a pointer to a 64-bit file information object (see prfileinfo64). on output, pr_getfileinfo64 writes information about the given file to the file information object. returns one of the following values: if the file information is successfully obtained, pr_success. if the file information is not successfully obtained, pr_failure. description pr_getfileinfo64 stores information about the file with the specified pathname in the prfileinfo64 structure pointed to by info. the file size is returned as an unsigned 64-bit integer. see also for the 32-bit version of this function, see pr_getfi...
PR_GetHostByAddr
saved in this buffer. this buffer is referenced by the runtime during a call to pr_enumeratehostent. bufsize number of bytes in the buf parameter. the buffer must be at least pr_netdb_buf_size bytes. hostentry this structure is allocated by the caller. on output, this structure is filled in by the runtime if the function returns pr_success. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. you can retrieve the reason for the failure by calling pr_geterror. description pr_gethostbyaddr is used to perform reverse lookups of network addresses. that is, given a valid network address (of type prnetaddr), pr_gethostbyaddr discovers the address' primary name, any aliases, and any other network addresses for the same host. ...
PR_GetHostByName
saved in this buffer. this buffer is referenced by the runtime during a call to pr_enumeratehostent. bufsize number of bytes in the buf parameter. the buffer must be at least pr_netdb_buf_size bytes. hostentry this structure is allocated by the caller. on output, this structure is filled in by the runtime if the function returns pr_success. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. you can retrieve the reason for the failure by calling pr_geterror. ...
PR_GetIdentitiesLayer
ith the specified identity in the specified stack of layers. syntax #include <prio.h> prfiledesc* pr_getidentitieslayer( prfiledesc* stack, prdescidentity id); parameters the function has the following parameters: stack a pointer to a prfiledesc object that is a layer in a stack of layers. id the identity of the specified layer. returns the function returns one of the following values: if successful, a pointer to a file descriptor of the layer with the specified identity in the given stack of layers. if not successful, null. description the stack of layers to be searched is specified by the fd parameter, which is a layer in the stack. both the layers underneath fd and the layers above fd are searched to find the layer with the specified identity. ...
PR_GetNameForIdentity
gets the string associated with a layer's unique identity. syntax #include <prio.h> const char* pr_getnameforidentity(prdescidentity ident); parameter the function has the following parameter: ident a layer's identity. returns the function returns one of the following values: if successful, the function returns a pointer to the string associated with the specified layer. if unsuccessful, the function returns null. description a string may be associated with a layer when the layer is created. the string is copied by the runtime, and pr_getnameforidentity returns a pointer to that copy. ...
PR_GetOSError
returns the current thread's last set os-specific error code. syntax #include <prerror.h> print32 pr_getoserror(void) returns the value returned is a 32-bit signed number. its interpretation is left to the caller. description used for platform-specific code that requires the underlying os error. for portability, clients should not create dependencies on the values of os-specific error codes. however, this information is preserved, along with a platform neutral error code, on a per thread basis. it is most useful during development. ...
PR_GetOpenFileInfo
eger. syntax #include <prio.h> prstatus pr_getopenfileinfo( prfiledesc *fd, prfileinfo *info); parameters the function has the following parameters: fd a pointer to a prfiledesc object for an open file. info a pointer to a prfileinfo object. on output, information about the given file is written into the file information object. returns the function returns one of the following values: if file information is successfully obtained, pr_success. if file information is not successfully obtained, pr_failure. description pr_getopenfileinfo obtains the file type (normal file, directory, or other), file size (as a 32-bit integer), and the file creation and modification times of the open file represented by the file descriptor. see also for the 64-bit version of this function...
PR_GetOpenFileInfo64
. syntax #include <prio.h> prstatus pr_getopenfileinfo64( prfiledesc *fd, prfileinfo *info); parameters the function has the following parameters: fd a pointer to a prfiledesc object for an open file. info a pointer to a prfileinfo64 object. on output, information about the given file is written into the file information object. returns the function returns one of the following values: if file information is successfully obtained, pr_success. if file information is not successfully obtained, pr_failure. description pr_getopenfileinfo64 is the 64-bit version of pr_getopenfileinfo. it obtains the file type (normal file, directory, or other), file size (as a 64-bit integer), and the creation and modification times of the open file represented by the file descriptor. see ...
PR_GetProtoByName
er to a scratch buffer for the runtime to return result. this buffer is allocated by the caller. bufsize number of bytes in the buffer parameter. the buffer must be at least pr_netdb_buf_size bytes. result on input, a pointer to a prprotoent structure. on output, this structure is filled in by the runtime if the function returns pr_success. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. you can retrieve the reason for the failure by calling pr_geterror. ...
PR_GetProtoByNumber
ter to a scratch buffer for the runtime to return result. this buffer is allocated by the caller. bufsize number of bytes in the buffer parameter. the buffer must be at least pr_netdb_buf_size bytes. result on input, a pointer to a prnetaddr structure. on output, this structure is filled in by the runtime if the function returns pr_success. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. you can retrieve the reason for the failure by calling pr_geterror. ...
PR_GetThreadPrivate
...
PR_GetThreadScope
gets the scoping of the current thread. syntax #include <prthread.h> prthreadscope pr_getthreadscope(void); returns a value of type prthreadscope indicating whether the thread is local or global. ...
PR_GetUniqueIdentity
asks the runtime to allocate a unique identity for a layer identified by the layer's name. syntax #include <prio.h> prdescidentity pr_getuniqueidentity(const char *layer_name); parameter the function has the following parameter: layer_name the string associated with the creation of a layer's identity. returns the function returns one of the following values: if successful, the prdescidentity for the layer associated with the string specified in the layer named layer_name. if the function cannot allocate enough dynamic memory, it fails and returns the value pr_invalid_io_layer with the error code pr_out_of_memory_error. description a string may be associated with a layer when the layer is created. pr_getuniqueidentity allocates a unique layer identity and associates it with ...
PR_ImplodeTime
converts a clock/calendar time to an absolute time. syntax #include <prtime.h> prtime pr_implodetime(const prexplodedtime *exploded); parameters the function has these parameters: exploded a pointer to the clock/calendar time to be converted. returns an absolute time value. description this function converts the specified clock/calendar time to an absolute time and returns the converted time value. ...
PR ImportTCPSocket
imports a native tcp socket into nspr. syntax #include "private/pprio.h" prfiledesc* pr_importtcpsocket(prosfd osfd); parameters the function has the following parameters: osfd the native file descriptor for the tcp socket to import. on posix systems, this is an int. on windows, this is a socket. returns the function returns one of the following values: upon successful completion, a pointer to the prfiledesc object created for the newly imported native tcp socket. if the import of the native tcp socket failed, null. description a native tcp socket osfd can be imported into nspr with pr_importtcpsocket. the caller gives up control of the native tcp socket osfd and should use the prfiledesc* returned by pr_importtcpsocket instead. although pr_importtcpsocket is a supported f...
PR_Initialize
e 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 returned from the root function, prmain. description pr_initialize initializes the nspr runtime and places nspr between the caller and the runtime library. this allows main to be treated like any other function, signaling its completion by returning and allowing the runtime to coordinate the completion of the other threads of the runtime. pr_initialize does not return to its caller until all u...
PR_Initialized
checks whether the runtime has been initialized. syntax #include <prinit.h> prbool pr_initialized(void); returns the function returns one of the following values: if pr_init has already been called, pr_true. if pr_init has not already been called, pr_false. ...
PR_Interrupt
otherwise, pr_failure. ...
PR_IntervalNow
pr_intervalnow() is both very efficient and nonblocking, so it is appropriate to use (for example) while holding a mutex. the most common use for pr_intervalnow() is to establish an epoch and test for the expiration of intervals. in this case, you typically call pr_intervalnow() in a sequence that looks like this: pruint32 interval = ... ; // milliseconds // ... ...
PR_IntervalToMicroseconds
converts platform-dependent intervals to standard clock microseconds. syntax #include <prinrval.h> pruint32 pr_intervaltomicroseconds(printervaltime ticks); parameter ticks the number of platform-dependent intervals to convert. returns equivalent in microseconds of the value passed in the ticks parameter. description conversion may cause overflow, which is not reported. ...
PR_IntervalToMilliseconds
converts platform-dependent intervals to standard clock milliseconds. syntax #include <prinrval.h> pruint32 pr_intervaltomilliseconds(printervaltime ticks); parameter ticks the number of platform-dependent intervals to convert. returns equivalent in milliseconds of the value passed in the ticks parameter. description conversion may cause overflow, which is not reported. ...
PR_IntervalToSeconds
converts platform-dependent intervals to standard clock seconds. syntax #include <prinrval.h> pruint32 pr_intervaltoseconds(printervaltime ticks); parameter ticks the number of platform-dependent intervals to convert. returns equivalent in seconds of the value passed in the ticks parameter. description conversion may cause overflow, which is not reported. ...
PR_JoinThread
blocks the calling thread until a specified thread terminates. syntax #include <prthread.h> prstatus pr_jointhread(prthread *thread); parameter pr_jointhread has the following parameter: thread a valid identifier for the thread that is to be joined. returns the function returns one of the following values: if successful, pr_success if unsuccessful--for example, if no joinable thread can be found that corresponds to the specified target thread, or if the target thread is unjoinable--pr_failure. description pr_jointhread is used to synchronize the termination of a thread. the function is synchronous in that it blocks the calling thread until the target thread is in a joinable state. pr_jointhread returns to the caller only after the target thread returns from its root functio...
PR_LOG
conditionally writes an entry to the log. syntax #include <prlog.h> void pr_log ( prlogmoduleinfo *_module, prlogmodulelevel _level ... _args); parameters the macro has these 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,...
PR_LOG_TEST
determines if logging is enabled for a module and level. syntax #include <prlog.h> prbool pr_log_test ( prlogmoduleinfo *_module, prlogmodulelevel _level); parameters the macro has these 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 returns pr_true when logging is enabled for the given module and level, otherwise pr_false. description this macro tests whether logging is enabled for the specified module ...
PR_Listen
ions 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 connections is specifie...
PR_MicrosecondsToInterval
...
PR_MillisecondsToInterval
...
PR_MkDir
e the name of the directory to be created. all the path components up to but not including the leaf component must already exist. mode the access permission bits of the file mode of the new directory if the file is created when pr_create_file is on. caveat: the mode parameter is currently applicable only on unix platforms. it may be applicable to other platforms in the future. possible values include the following: 00400. read by owner. 00200. write by owner. 00100. search by owner. 00040. read by group. 00020. write by group. 00010. search by group. 00004. read by others. 00002. write by others. 00001. search by others. returns if successful, pr_success. if unsuccessful, pr_failure. the actual reason can be retrieved via pr_geterror. description pr_mkdir creates...
PR_NetAddrToString
syntax #include <prnetdb.h> prstatus pr_netaddrtostring( const prnetaddr *addr, char *string, pruint32 size); parameters the function has the following parameters: addr a pointer to the network address to be converted. string a buffer that will hold the converted string on output. size the size of the result buffer (string). returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. you can retrieve the reason for the failure by calling pr_geterror. description the network address to be converted (addr) may be either an ipv4 or ipv6 address structure, assuming that the nspr library and the host system are both configured to utilize ipv6 addressing. if addr is an ipv4 address, size needs to be at least 16. if ad...
PR_NewCondVar
creates a new condition variable. syntax #include <prcvar.h> prcondvar* pr_newcondvar(prlock *lock); parameter pr_newcondvar has one parameter: lock the identity of the mutex that protects the monitored data, including this condition variable. returns the function returns one of the following values: if successful, a pointer to the new condition variable object. if unsuccessful (for example, if system resources are unavailable), null. ...
PR_NewLock
creates a new lock. syntax #include <prlock.h> prlock* pr_newlock(void); returns the function returns one of the following values: if successful, a pointer to the new lock object. if unsuccessful (for example, the lock cannot be created because of resource constraints), null. description pr_newlock creates a new opaque lock. ...
PR_NewLogModule
...
PR_NewMonitor
creates a new monitor object. the caller is responsible for the object and is expected to destroy it when appropriate. syntax #include <prmon.h> prmonitor* pr_newmonitor(void); returns the function returns one of the following values: if successful, a pointer to a prmonitor object. if unsuccessful (for example, if some operating system resource is unavailable), null. description a newly created monitor has an entry count of zero. ...
PR_NewTCPSocket
if the creation of a new tcp socket failed, null. description tcp (transmission control protocol) is a connection-oriented, reliable byte-stream protocol of the tcp/ip protocol suite. pr_newtcpsocket creates a new ipv4 tcp socket. a tcp connection is established by a passive socket (the server) accepting a connection setup request from an active socket (the client). ...
PR_NewUDPSocket
if the creation of a new udp socket failed, null. description udp (user datagram protocol) is a connectionless, unreliable datagram protocol of the tcp/ip protocol suite. udp datagrams may be lost or delivered in duplicates or out of sequence. pr_newudpsocket creates a new udp socket. the socket may be bound to a well-known port number with pr_bind. ...
PR_NormalizeTime
arameter callback function. returns nothing; the time parameter is altered by the callback function. description this function adjusts the fields of the specified time structure using the specified time parameter callback function, so that they are in the proper range. call this function in these situations: to normalize a time after performing arithmetic operations directly on the field values of the calendar time object. for example, if you have a ] object that represents the date 3 march 1998 and you want to say "forty days from 3 march 1998", you can simply add 40 to the tm_mday field and then call pr_normalizetime(). to calculate the optional field values tm_wday and tm_yday. for example, suppose you want to compute the day of week for 3 march 1998. you can set tm_mday to 3, t...
PR_Notify
nitor that a change in state of the monitored data has occurred. syntax #include <prmon.h> prstatus pr_notify(prmonitor *mon); parameters the function has the following parameter: mon a reference to an existing structure of type prmonitor. the monitor object referenced must be one for which the calling thread currently holds the lock. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. description notification of a monitor signals the change of state of some monitored data. the changing of that data and the notification must all be performed while in the monitor. when the notification occurs, the runtime promotes a thread that is waiting on the monitor to a ready state. if more than one thread is waiting, the sele...
PR_NotifyAll
all threads waiting on a specified monitor to a ready state. syntax #include <prmon.h> prstatus pr_notifyall(prmonitor *mon); parameters the function has the following parameter: mon a reference to an existing structure of type prmonitor. the monitor object referenced must be one for which the calling thread currently holds the lock. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. description a call to pr_notifyall causes all of the threads waiting on the monitor to be scheduled to be promoted to a ready state. if no threads are waiting, the operation is no-op. pr_notifyall should be used with some care. the expense of scheduling multiple threads increases dramatically as the number of threads increases. ...
PR_NotifyAllCondVar
if unsuccessful (for example, if the caller has not locked the lock associated with the condition variable), pr_failure. description the calling thread must hold the lock that protects the condition, as well as the invariants that are tightly bound to the condition. ...
PR_NotifyCondVar
if unsuccessful (for example, if the caller has not locked the lock associated with the condition variable), pr_failure. ...
PR_Now
returns the current time. syntax #include <prtime.h> prtime pr_now(void); parameters none. returns the current time as a prtime value. description pr_now() returns the current time as number of microseconds since the nspr epoch, which is midnight (00:00:00) 1 january 1970 utc. you cannot assume that the values returned by pr_now() are monotonically increasing because the system clock of the computer may be reset. to obtain monotonically increasing time stamps suitable for measuring elapsed time, use pr_intervalnow(). ...
PR_OpenSharedMemory
opens an existing shared memory segment or, if one with the specified name doesn't exist, creates a new one. syntax #include <prshm.h> nspr_api( prsharedmemory * ) pr_opensharedmemory( const char *name, prsize size, printn flags, printn mode ); /* define values for pr_opensharememory(...,create) */ #define pr_shm_create 0x1 /* create if not exist */ #define pr_shm_excl 0x2 /* fail if already exists */ parameters the function has the following parameters: name the name of the shared memory segment. size the size of the shared memory segment. flags options for creating the shared memory. mode same as passed to pr_open. returns pointer to opaque structure prsharedmemory, or null if an error occurs. retri...
PR_OpenTCPSocket
creates a new tcp socket of the specified address family. syntax #include <prio.h> prfiledesc* pr_opentcpsocket(printn af); parameters the function has the following parameters: af the address family of the new tcp socket. can be pr_af_inet (ipv4), pr_af_inet6 (ipv6), or pr_af_local (unix domain, supported on posix systems only). returns the function returns one of the following values: upon successful completion, a pointer to the prfiledesc object created for the newly opened tcp socket. if the creation of a new tcp socket failed, null. description tcp (transmission control protocol) is a connection-oriented, reliable byte-stream protocol of the tcp/ip protocol suite. pr_opentcpsocket creates a new tcp socket of the address family af. a tcp connection is established by a p...
PR OpenUDPSocket
creates a new udp socket of the specified address family. syntax #include <prio.h> prfiledesc* pr_openudpsocket(printn af); parameters the function has the following parameters: af the address family of the new udp socket. can be pr_af_inet (ipv4), pr_af_inet6 (ipv6), or pr_af_local (unix domain, supported on posix systems only). returns the function returns one of the following values: upon successful completion, a pointer to the prfiledesc object created for the newly opened udp socket. if the creation of a new udp socket failed, null. description udp (user datagram protocol) is a connectionless, unreliable datagram protocol of the tcp/ip protocol suite. udp datagrams may be lost or delivered in duplicates or out of sequence. pr_openudpsocket creates a new udp socket of ...
PR_PopIOLayer
yer from the stack. syntax #include <prio.h> prfiledesc *pr_popiolayer( prfiledesc *stack, prdescidentity id); parameters the function has the following parameters: stack a pointer to a prfiledesc object representing the stack from which the specified layer is to be removed. id identity of the layer to be removed from the stack. returns the function returns one of the following values: if the layer is successfully removed from the stack, a pointer to the removed layer. if the layer is not found in the stack or cannot be popped (for example, the bottommost layer), the function returns null with the error code pr_invalid_argument_error. description pr_popiolayer pops the specified layer from the stack. if the object to be removed is found, pr_popiolayer returns a pointer...
PR_PostSemaphore
syntax #include <pripcsem.h> nspr_api(prstatus) pr_postsemaphore(prsem *sem); parameter the function has the following parameter: sem a pointer to a prsem structure returned from a call to pr_opensemaphore. ...
PR_QueueJob_Timer
en a timer expires. syntax #include <prtpool.h> nspr_api(prjob *) pr_queuejob_timer( prthreadpool *tpool, printervaltime timeout, prjobfn fn, void * arg, prbool joinable ); parameters the function has the following parameters: tpool a pointer to a prthreadpool structure previously created by a call to pr_createthreadpool. iod a pointer to a prjobiodesc structure. timeout a value, expressed as a printervaltime, to wait before queuing the job. fn the function to be executed when the job is executed. arg a pointer to an argument passed to fn. joinable if pr_true, the job is joinable. if pr_false, the job is not joinable. see pr_joinjob. returns pointer to a prjob structure or null on error. ...
PR_Read
ntax #include <prio.h> print32 pr_read(prfiledesc *fd, void *buf, print32 amount); parameters the function has the following parameters: fd a pointer to a prfiledesc object for the file or socket. buf a pointer to a buffer to hold the data read in. on output, the buffer contains the data. amount the size of buf (in bytes). returns one of the following values: a positive number indicates the number of bytes actually read in. the value 0 means end of file is reached or the network connection is closed. the value -1 indicates a failure. to get the reason for the failure, call pr_geterror. description the thread invoking pr_read blocks until it encounters an end-of-stream indication, some positive number of bytes (but no more than amount bytes) ...
PR_Recv
. syntax #include <prio.h> print32 pr_recv( prfiledesc *fd, void *buf, print32 amount, printn flags, printervaltime timeout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket. buf a pointer to a buffer to hold the data received. amount the size of buf (in bytes). flags must be zero or pr_msg_peek. timeout a value of type printervaltime specifying the time limit for completion of the receive operation. returns the function returns one of the following values: a positive number indicates the number of bytes actually received. the value 0 means the network connection is closed. the value -1 indicates a failure. the reason for the failure can be obtained by calling pr_geterror. description pr_recv ...
PR_RecvFrom
meout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket. buf a pointer to a buffer containing the data received. amount the size of buf (in bytes). flags this obsolete parameter must always be zero. addr a pointer to the prnetaddr object that will be filled in with the address of the sending peer on return. timeout a value of type printervaltime specifying the time limit for completion of the receive operation. returns the function returns one of the following values: a positive number indicates the number of bytes actually received. the value 0 means the network connection is closed. the value -1 indicates a failure. the reason for the failure can be obtained by calling pr_geterror. description pr_recvf...
PR_Rename
if file is not successfully renamed, pr_failure. ...
PR_STATIC_ASSERT
syntax #include <prlog.h> pr_static_assert ( expression ); parameters the macro has this parameter: expression any valid expression which evaluates at compile-time to true or false. an expression which cannot be evaluated at compile time will cause a compiler error; see pr_assert for a runtime alternative. returns nothing description this macro evaluates the specified expression. when the result is zero (false) program compilation will fail with a compiler error; otherwise compilation completes successfully. the compiler error will include the number of the line for which the compile-time assertion failed. ...
PR_SecondsToInterval
...
PR_Send
> print32 pr_send( prfiledesc *fd, const void *buf, print32 amount, printn flags, printervaltime timeout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket. buf a pointer to a buffer containing the data to be sent. amount the size of buf (in bytes). flags this obsolete parameter must always be zero. timeout a value of type printervaltime specifying the time limit for completion of the receive operation. returns the function returns one of the following values: a positive number indicates the number of bytes successfully sent. if the parameter fd is a blocking socket, this number must always equal amount. the value -1 indicates a failure. the reason for the failure can be obtained by calling pr_geterr...
PR_SendTo
printn flags, const prnetaddr *addr, printervaltime timeout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket. buf a pointer to a buffer containing the data to be sent. amount the size of buf (in bytes). flags this obsolete parameter must always be zero. addr a pointer to the address of the destination. timeout a value of type printervaltime specifying the time limit for completion of the receive operation. returns the function returns one of the following values: a positive number indicates the number of bytes successfully sent. the value -1 indicates a failure. the reason for the failure can be obtained by calling pr_geterror. description pr_sendto sends a specified number of bytes from a socket to ...
PR_SetError
error information within a thread context. syntax #include <prerror.h> void pr_seterror(prerrorcode errorcode, print32 oserr) parameters the function has these parameters: errorcode the nspr (platform-independent) translation of the error. oserr the platform-specific error. if there is no appropriate os error number, a zero may be supplied. description nspr does not validate the value of the error number or os error number being specified. the runtime merely stores the value and returns it when requested. ...
PR_SetErrorText
be a null-terminated c string. otherwise the text is assumed to be the length specified and to possibly include null characters (as might occur in a multilingual string). text the text to associate with the error. description the text is copied into the thread structure and remains there until the next call to pr_seterror. if there is error text already present in the thread, the previous value is first deleted. the new value is copied into storage allocated and owned by nspr and remains there until the next call to pr_seterror or another call to pr_seterrortext. nspr makes no use of this function. clients may use it for their own purposes. ...
PR_SetLibraryPath
me. syntax #include <prlink.h> prstatus pr_setlibrarypath(const char *path); parameters the function has this parameter: path a pointer to a character array that contains the directory path that the application should use as a default. the syntax of the pathname is not defined, nor whether that pathname should be absolute or relative. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. this may indicate that the function cannot allocate sufficient storage to make a copy of the path string description this function registers a default library pathname with the runtime. this allows an environment to express policy decisions globally and lazily, rather than hardcoding and distributing the decisions throughout the cod...
PR_SetPollableEvent
set a pollable event. syntax nspr_api(prstatus) pr_setpollableevent(prfiledesc *event); parameter the function has the following parameter: event pointer to a prfiledesc structure previously created via a call to pr_newpollableevent. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. the reason for the failure can be retrieved via pr_geterror. ...
PR_SetSocketOption
...
PR_Shutdown
shuts down part of a full-duplex connection on a specified socket. syntax #include <prio.h> prstatus pr_shutdown( prfiledesc *fd, prshutdownhow how); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a connected socket. how the kind of disallowed operations on the socket. possible values include the following: pr_shutdown_rcv. further receives will be disallowed. pr_shutdown_send. further sends will be disallowed. pr_shutdown_both. further sends and receives will be disallowed. returns the function returns one of the following values: upon successful completion of shutdown request, pr_success. if unsuccessful, pr_failure. further information can be obtained by calling pr_geterror. description the prshutd...
PR_Sleep
pr_failure error. description pr_sleep simply waits on a condition for the amount of time specified. if you set ticks to pr_interval_no_wait, the thread yields. if ticks is not pr_interval_no_wait, pr_sleep uses an existing lock, but has to create a new condition for this purpose. if you have already created such structures, it is more efficient to use them directly. calling pr_sleep with the value of ticks set to pr_interval_no_wait simply surrenders the processor to ready threads of the same priority. all other values of ticks cause pr_sleep to block the calling thread for the specified interval. threads blocked in pr_sleep are interruptible. ...
PR_StringToNetAddr
if unsuccessful, pr_failure. ...
PR_Sync
synchronizes any buffered data for a file descriptor to its backing device (disk). syntax #include <prio.h> prstatus pr_sync(prfiledesc *fd); parameter the function has the following parameter: fd pointer to a prfiledesc object representing a file. returns the function returns one of the following values: on successful completion, pr_success. if the function fails, pr_failure. description pr_sync writes all the in-memory buffered data of the specified file to the disk. ...
PR_TransmitFile
eep_open indicates that the socket will be kept open after the data is sent. pr_transmitfile_close_socket indicates that the connection should be closed immediately after successful transfer of the file. timeout time limit for completion of the transmit operation. returns a positive number indicates the number of bytes successfully written, including both the headers and the file. the value -1 indicates a failure. if an error occurs while sending the file, the pr_transmitfile_close_socket flag is ignored. the reason for the failure can be obtained by calling pr_geterror. description the pr_transmitfile function sends a complete file (sourcefile) across a connected socket (networksocket). if headers is non-null, pr_transmitfile sends the headers across the socket before sending th...
PR_UnloadLibrary
unloads a library loaded with pr_loadlibrary. syntax #include <prlink.h> prstatus pr_unloadlibrary(prlibrary *lib); parameters the function has this parameter: lib a reference previously returned from pr_loadlibrary. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. use pr_geterror to find the reason for the failure. description this function undoes the effect of a pr_loadlibrary. after calling this function, future references to the library using its identity as returned by pr_loadlibrary will be invalid. ...
PR_Unlock
releases a specified lock object. releasing an unlocked lock results in an error. attempting to release a lock that was locked by a different thread causes undefined behavior. syntax #include <prlock.h> prstatus pr_unlock(prlock *lock); parameter pr_unlock has one parameter: lock a pointer to a lock object to be released. returns the function returns one of the following values: if successful, pr_success. if unsuccessful (for example, if the caller does not own the lock), pr_failure. see also pr_lock ...
PR_Unmap
unmap a memory region that is backed by a memory-mapped file. syntax #include <prio.h> prstatus pr_memunmap( void *addr, pruint32 len); parameters the function has the following parameters: addr the starting address of the memory region to be unmapped. len the length, in bytes, of the memory region. returns the function returns one of the following values: if the memory region is successfully unmapped, pr_success. if the memory region is not successfully unmapped, pr_failure. the error code can be retrieved via pr_geterror. description pr_memunmap removes the file mapping for the memory region (addr, addr + len). the parameter addr is the return value of an earlier call to pr_memmap. ...
PR_VersionCheck
compares the version of nspr assumed by the caller (the imported version) with the version being offered by the runtime (the exported version). syntax #include <prinit.h> prbool pr_versioncheck(const char *importedversion); parameter pr_versioncheck has one parameter: importedversion the version of the shared library being imported. returns the function returns one of the following values: if the version of the shared library is compatible with that expected by the caller, pr_true. if the versions are not compatible, pr_false. description pr_versioncheck tests whether the version of the library being imported (importedversion) is compatible with the running version of the shared library. this is a string comparison of sorts, though the details of the comparison will vary ov...
PR_WaitForPollableEvent
blocks the calling thread until the pollable event is set, and then atomically unsetting the event before returning. syntax nspr_api(prstatus) pr_waitforpollableevent(prfiledesc *event); parameter the function has the following parameter: event pointer to a prfiledesc structure previously created via a call to pr_newpollableevent. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. the reason for the failure can be retrieved via pr_geterror. ...
PR_Write
e or socket. syntax #include <prio.h> print32 pr_write( prfiledesc *fd, const void *buf, print32 amount); parameters the function has the following parameters: fd a pointer to the prfiledesc object for a file or socket. buf a pointer to the buffer holding the data to be written. amount the amount of data, in bytes, to be written from the buffer. returns one of the following values: a positive number indicates the number of bytes successfully written. the value -1 indicates that the operation failed. the reason for the failure is obtained by calling pr_geterror. description the thread invoking pr_write blocks until all the data is written or the write operation fails. therefore, the return value is equal to either amount (success) or -1 (failure). note that if pr_wr...
PR_cnvtf
floating point number to a string. syntax #include <prdtoa.h> void pr_cnvtf ( char *buf, printn bufsz, printn prcsn, prfloat64 fval); parameters the function has these parameters: buf the address of the buffer in which to store the result. bufsz the size of the buffer provided to hold the result. prcsn the number of digits of precision to which to generate the floating point value. fval the double-precision floating point number to be converted. description pr_cnvtf is a simpler interface to convert a floating point number to a string. it conforms to the ecma standard of javascript (ecmascript). on return, the result is written to the buffer pointed to by buf of size bufsz. ...
PR_htonl
performs 32-bit conversion from host byte order to network byte order. syntax #include <prnetdb.h> pruint32 pr_htonl(pruint32 conversion); parameter the function has the following parameter: conversion the 32-bit unsigned integer, in host byte order, to be converted. returns the value of the conversion parameter in network byte order. ...
PR_htons
performs 16-bit conversion from host byte order to network byte order. syntax #include <prnetdb.h> pruint16 pr_htons(pruint16 conversion); parameter the function has the following parameter: conversion the 16-bit unsigned integer, in host byte order, to be converted. returns the value of the conversion parameter in network byte order. ...
PR_ntohl
performs 32-bit conversion from network byte order to host byte order. syntax #include <prnetdb.h> pruint32 pr_ntohl(pruint32 conversion); parameter the function has the following parameter: conversion the 32-bit unsigned integer, in network byte order, to be converted. returns the value of the conversion parameter in host byte order. ...
PR_ntohs
performs 16-bit conversion from network byte order to host byte order. syntax #include <prnetdb.h> pruint16 pr_ntohs(pruint16 conversion); parameter the function has the following parameter: conversion the 16-bit unsigned integer, in network byte order, to be converted. returns the value of the conversion parameter in host byte order. ...
Random Number Generator
this chapter describes the nspr random number generator. random number generator function pr_getrandomnoise - produces a random value for use as a seed value for another random number generator. ...
NSPR API Reference
rs condition variables nspr sample code nspr types calling convention types algebraic types 8-, 16-, and 32-bit integer types signed integers unsigned integers 64-bit integer types floating-point integer type native os integer types miscellaneous types size type pointer difference types boolean types status type for return values threads threading types and constants threading functions creating, joining, and identifying threads controlling thread priorities controlling per-thread private data interrupting and yielding setting global thread concurrency getting a thread's scope process initialization identity and versioning name and version constants initialization an...
Function_Name
on "out" parameters. avoid describing the return until the next section, for example: this function looks in the nsscryptocontext and the nsstrustdomain to find the certificate that matches the der-encoded certificate. a match is found when the issuer and serial number of the der-encoded certificate are found on a certificate in the certificate database. returns full description of the return value, for example: a pointer to a certcertificate representing the certificate in the database that matched the dercert, or null if none was found. the certificate is a shallow copy, use cert_destroycertificate to decrement the reference count on the certificate instance. see also copy of the mxr link, with the following text occurrences of function_name in the current nss source code (generated by...
NSS Certificate Download Specification
or by selections made on the admin pages. if a certificate chain is being imported then the first certificate in the chain must be the server or ca certificate, and any subsequent certificates will be added as untrusted ca certificates to the local database. ...
Cryptography functions
xr 3.2 and later pk11_savecontextalloc mxr 3.6 and later pk11_setfortezzahack mxr 3.2 and later pk11_setpasswordfunc mxr 3.2 and later pk11_setprivatekeynickname mxr 3.4 and later pk11_setpublickeynickname mxr 3.4 and later pk11_setslotpwvalues mxr 3.2 and later pk11_setsymkeynickname mxr 3.4 and later pk11_setsymkeyuserdata mxr 3.11 and later pk11_setwrapkey mxr 3.2 and later pk11_sign mxr 3.2 and later pk11_signaturelen mxr 3.2 and later pk11_symkeyfromhandle mxr...
JSS FAQ
Mozilla › Projects › NSS › JSS › JSS FAQ
can i have multiple jss instances reading separate db's? no, you can only have one initialized instance of jss for each database. once jss initialized, i can't get anymore instances with certificatefactory.getinstance("x.509")? in version previous to jss 3.1, jss removes the default sun provider on startup. upgrade to the latest jss, or, in the cryptomanager.initializationvalues object you pass to cryptomanager.initialize(), set removesunproivider=true. is it possible to sign data in java with jss? what i am trying to do is write a java applet that will access the netscape certificate store, retrieve a x509 certificate and then sign some data. the best way to do this is with the pkcs #7 signeddata type. check out the javadoc. how do i convert org.mozilla.jss.c...
JSS Provider Notes
sion. then you can sign your own jss jar file. installing the provider in order to use any part of jss, including the jca provider, you must first call cryptomanager.initialize(). by default, the jca provider will be installed in the list of providers maintained by the java.security.security class. if you do not wish the provider to be installed, create a cryptomanager.initializationvalues object, set its installjssprovider field to false, and pass the initializationvalues object to cryptomanager.initialize(). specifying the cryptotoken all cryptographic operations in jss and nss occur on a particular pkcs #11 token, implemented in software or hardware. there is no clean way to specify this token through the jca api. by default, the jss provider carries out all operations e...
Mozilla-JSS JCA Provider notes
raphy extension. then you can sign your own jss jar file. installing the provider in order to use any part of jss, including the jca provider, you must first call cryptomanager.initialize(). by default, the jca provider will be installed in the list of providers maintained by the java.security.security class. if you do not wish the provider to be installed, create a cryptomanager.initializationvalues object, set its installjssprovider field to false, and pass the initializationvalues object to cryptomanager.initialize(). specifying the cryptotoken all cryptographic operations in jss and nss occur on a particular pkcs #11 token, implemented in software or hardware. there is no clean way to specify this token through the jca api. by default, the jss provider carries out all operations except m...
NSS Key Log Format
done for the official firefox binaries. (see bug 1188657.) notably, debian does not have this option enabled, see debian bug 842292. this key log file is a series of lines. comment lines begin with a sharp character ('#') and are ignored. secrets follow the format <label> <space> <clientrandom> <space> <secret> where: <label> describes the following secret. <clientrandom> is 32 bytes random value from the client hello message, encoded as 64 hexadecimal characters. <secret> depends on the label (see below). the following labels are defined, followed by a description of the secret: rsa: 48 bytes for the premaster secret, encoded as 96 hexadecimal characters (removed in nss 3.34) client_random: 48 bytes for the master secret, encoded as 96 hexadecimal characters (for ssl 3.0, tls 1.0,...
NSS Memory allocation
fresh from the heap each time they are allocated. this makes nss slower, but produces accurate leak allocation stacks. to accomplish that, set an environment variable prior to the initialization of nss and nspr. this can be done outside the program entirely, or can be done by the program itself, in the main() function. set the environment variable nss_disable_arena_free_list to have any non-empty value, e.g. nss_disable_arena_free_list=1. ...
NSS_3.12.1_release_notes.html
ts bug 431805: leak in nssarena_destroy() bug 431929: memory leaks on error paths in devutil.c bug 432303: replace pkix_pl_memcpy with memcpy bug 433177: fix the gcc compiler warnings in lib/util and lib/freebl bug 433437: vfychain ignores the -a option bug 433594: crash destroying ocsp cert id [[@ cert_destroyocspcertid ] bug 434099: nss relies on unchecked pkcs#11 object attribute values bug 434187: fix the gcc compiler warnings in nss/lib bug 434398: libpkix cannot find issuer cert immediately after checking it with ocsp bug 434808: certutil -b deadlock when importing two or more roots bug 434860: coverity 1150 - dead code in ocsp_createcertid bug 436428: remove unneeded assert from sec_pkcs7encryptlength bug 436430: make nss public headers compilable with no_nspr_1...
NSS 3.15.3 release notes
distributions are also available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_15_3_rtm/src/ security advisories the following security-relevant bugs have been resolved in nss 3.15.3. users are encouraged to upgrade immediately. bug 925100 - (cve-2013-1741) ensure a size is <= half of the maximum pruint32 value bug 934016 - (cve-2013-5605) handle invalid handshake packets bug 910438 - (cve-2013-5606) return the correct result in cert_verifycert on failure, if a verifylog isn't used new in nss 3.15.3 new functionality no new major functionality is introduced in this release. this release is a patch release to address cve-2013-1741, cve-2013-5605 and cve-2013-5606. bugs fixed in nss 3.15.3 bug 850478...
NSS 3.15.5 release notes
ozilla.org/security/nss/releases/nss_3_15_5_rtm/src/ new in nss 3.15.5 new functionality added support for the tls application layer protocol negotiation (alpn) extension. two ssl socket options, ssl_enable_npn and ssl_enable_alpn, can be used to control whether npn or alpn (or both) should be used for application layer protocol negotiation. added the tls padding extension. the extension type value is 35655, which may change when an official extension type value is assigned by iana. nss automatically adds the padding extension to clienthello when necessary. added a new macro cert_list_tail, defined in certt.h, for getting the tail of a certcertlist. notable changes in nss 3.15.5 bug 950129: improve the ocsp fetching policy when verifying ocsp responses bug 949060: validate the iov inpu...
NSS 3.16.3 release notes
tp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_16_3_rtm/src/ new in nss 3.16.3 this release consists primarily of ca certificate changes as listed below, and fixes an issue with a recently added utility function. new functions in cert.h ​cert_getgeneralnametypefromstring - an utlity function to lookup a value of type certgeneralnametype given a human readable string. this function was already added in nss 3.16.2, however, it wasn't declared in a public header file. notable changes in nss 3.16.3 the following 1024-bit ca certificates were removed cn = entrust.net secure server certification authority sha1 fingerprint: 99:a6:9b:e6:1a:fe:88:6b:4d:2b:82:00:7c:b8:54:fc:31:7e:15:39 ...
NSS 3.19.1 release notes
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 the minimum modulus size for dsa keys is now 1023 bits the minimum modulus size for diffie-hellman keys is now 1023 bits bu...
NSS 3.21.3 release notes
download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_21_3_rtm/src/ new in nss 3.21.3 new functionality no new functionality is introduced in this release. security fixes in nss 3.21.3 bug 1306103 / cve-2016-5285 - fixed a possible dos on nss servers due to a missing null check. bug 1221620 - fixed a possible left-shift of a negative integer value when parsing der. bug 1206283 - fixed an out-of-bound read when parsing invalid utf-16. bug 1241034 - fixed an out-of-bounds write when parsing invalid utf-16. bug 1241037 - fixed bogus surrogate detection when parsing invalid utf-16. compatibility nss 3.21.3 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked with older nss 3.x shared librarie...
NSS 3.21 release notes
ls 1.2 signatures. new in nss 3.21 new functionality certutil now supports a --rename option to change a nickname (bug 1142209) tls extended master secret extension (rfc 7627) is supported (bug 1117022) new info functions added for use during mid-handshake callbacks (bug 1084669) new functions in nss.h nss_optionset - sets nss global options nss_optionget - gets the current value of nss global options in secmod.h secmod_createmoduleex - create a new secmodmodule structure from module name string, module parameters string, nss specific parameters string, and nss configuration parameter string. the module represented by the module structure is not loaded. the difference with secmod_createmodule is the new function handles nss configuration parameter strings. ...
NSS 3.24 release notes
ss 3.24 additions, deprecations, and other changes in nss 3.24 are listed below. deprecate the following functions. (applications should instead use the new ssl_configservercert function.) ssl_setstapledocspresponses ssl_setsignedcerttimestamps ssl_configsecureserver ssl_configsecureserverwithcertchain deprecate the nss_findcertkeatype function, as it reports a misleading value for certificates that might be used for signing rather than key exchange. update sslauthtype to define a larger number of authentication key types. deprecate the member attribute authalgorithm of type sslciphersuiteinfo. instead, applications should use the newly added attribute authtype. rename ssl_auth_rsa to ssl_auth_rsa_decrypt. add a shared library (libfreeblpriv3) on linux platforms tha...
NSS 3.27.1 release notes
ionality is introduced in this release. this is a patch release to address a tls compatibility issue which some applications experienced with nss 3.27. notable changes in nss 3.27.1 availability of the tls 1.3 (draft) implementation has been re-disabled in the default build. previous versions of nss made tls 1.3 (draft) available only when compiled with nss_enable_tls_1_3. nss 3.27 set this value on by default, allowing tls 1.3 (draft) to be disabled using nss_disable_tls_1_3, although the maximum version used by default remained tls 1.2. however, some applications query the list of protocol versions that are supported by the nss library, enabling all supported tls protocol versions. because nss 3.27 enabled compilation of tls 1.3 (draft) by default, it caused those applications to enabl...
NSS 3.29.2 release notes
ownload: source tarballs: https://ftp.mozilla.org/pub/security/nss/releases/nss_3_29_2_rtm/src/ new in nss 3.29.2 new functionality no new functionality is introduced in this release. bugs fixed in nss 3.29.2 nss 3.29 and 3.29.1 included a change that reduced the time that nss considered a tls session ticket to be valid. this release restores the session ticket lifetime to the intended value. see bug 1340841 for details. compatibility nss 3.29.2 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.29.2 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 compatib...
NSS 3.43 release notes
this bugzilla query returns all the bugs fixed in nss 3.43: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target...
NSS 3.44 release notes
a certcertificate. notable changes in nss 3.44 it is now possible to build nss as a static library (bug 1543545) initial support for building for ios. ...
NSS 3.46 release notes
e controls after errors in tstcln, selfserv and vfyserv cmds bug 1550636 - upgrade sqlite in nss to a 2019 version bug 1572593 - reset advertised extensions in ssl_constructextensions bug 1415118 - nss build with ./build.sh --enable-libpkix fails bug 1539788 - add length checks for cryptographic primitives (cve-2019-17006) bug 1542077 - mp_set_ulong and mp_set_int should return errors on bad values bug 1572791 - read out-of-bounds in der_decodetimechoice_util from sslexp_delegatecredential bug 1560593 - cleanup.sh script does not set error exit code for tests that "failed with core" bug 1566601 - add wycheproof test vectors for aes-kw bug 1571316 - curve25519_32.c:280: undefined reference to `pr_assert' when building nss 3.45 on armhf-linux bug 1516593 - client to generate new random ...
NSS 3.47 release notes
bug 1542207 - limit policy check on signature algorithms to known algorithms bug 1560329 - drb...
NSS 3.51 release notes
cure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_51_rtm/src/ other releases are available in nss releases. notable changes in nss 3.51 updated dtls 1.3 implementation to draft-34. see bug 1608892 for details. bugs fixed in nss 3.51 bug 1608892 - update dtls 1.3 implementation to draft-34. bug 1611209 - correct swapped pkcs11 values of ckm_aes_cmac and ckm_aes_cmac_general bug 1612259 - complete integration of wycheproof ecdh test cases bug 1614183 - check if ppc __has_include(<sys/auxv.h>) bug 1614786 - fix a compilation error for ‘getfipsenv’ "defined but not used" bug 1615208 - send dtls version numbers in dtls 1.3 supported_versions extension to avoid an incompatibility. bug 1538980 - secu_readderfromfile calls...
NSS Developer Tutorial
er such a change is safe needs to be reviewed on a case-by-case basis. types structs members of an exported struct, cannot be reordered or removed. under certain circumstances, it is safe to add new members to an exported struct at the end. opaque structs give us complete freedom to change them, but require applications to call nss functions, to allocate and free them. enums the numeric values of public enumerators cannot be changed. to stress this fact, we often explicitly assign numeric values to enumerators, rather than relying on the values assigned by the compiler. symbol export lists the manifest.mn file, in a directory in the nss source tree, specifies which headers are public, and which headers are private. public headers are in the exports variable. private headers,which ...
NSS Sample Code sample5
ickname.type = sibuffer; nickname.data = "pvtkeynickname"; nickname.len = strlen("pvtkeynickname"); rv = atob_convertasciitoitem(&der, pvtkstr); if (rv!= secsuccess) { fprintf(stderr, "atob_convertasciitoitem failed %d\n", pr_geterror()); goto cleanup; } /* ku_all includes a lot of different key usages, ku_data_encipherment * is enough for just rsa encryption. ...
nss tech note6
d checksum files required for the nss softoken to operate in fips 140 mode. the new checksum file is called libsoftokn3.chk on unix/linux and softokn3.chk on windows. it must be put in the same directory as the nss libraries. the libsoftokn3.chk/softokn3.chk file contains a checksum for the softoken. when in fips 140 mode, the softoken is required to compute its checksum and compare it with the value in libsoftokn3.chk/softokn3.chk. the following applies to nss 3.8 through 3.10 : on 32-bit solaris sparc (i.e., not x86, and not 64-bit sparc) and 32-bit hp-ux pa-risc (i.e., not itanium, and not 64-bit pa-risc), there are two more .chk files: libfreebl_pure32_3.chk and libfreebl_hybrid_3.chk. the following applies to nss 3.11 : the low-level freebl cryptographic code has been separated from ...
nss tech note7
ps || 00 || m but in pkcs #1 v2.0 (section 9.1.2.1 encoding operation, step 3) and on the w3c web site (http://www.w3.org/tr/xmlenc-core/#rsa-1_5), pkcs1 v1.5 padding is described like this: 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.
Build instructions
these instructions are outdated. use the building nss page for more recent information. numerous optional features of nss builds are controlled through make variables. gmake is gnu make, usually your linux-distro-regular "make" binary file, unless maybe it is a bsd make. make variables may be set on the gmake command line, e.g., gmake variable=value variable=value target1 target2 or defined in the environment, e.g. (for posix shells), variable=value; export variable gmake target1 target2 here are some (not all) of the make variables that affect nss builds: build_opt: if set to 1, means do optimized non-debug build. default is debug, non-optimized build. use_debug_rtl: if set to 1, on windows, causes build with debug version of the c run-time library. ns_use_gcc: on ...
FC_CancelFunction
examples see also nsc_cancelfunction ...
FC_CloseAllSessions
lotid [in] the id of the token's slot. ...
FC_CloseSession
name fc_closesession - close a session opened between an application and a token. syntax ck_rv fc_closesession( ck_session_handle hsession ); parameters hsession [in] the session handle to be closed. description fc_closesession closes a session between an application and a token. a user may call fc_closesession without logging into the token (to assume the nss user role). return value examples see also fc_opensession ...
FC_CopyObject
[in] object handle. ptemplate [in] object template. ...
FC_CreateObject
); parameters hsession [in] session handle. ptemplate [in] object template. ...
FC_Decrypt
of the data in bytes. pdata [out] pointer to location where recovered data is to be stored. ...
FC_DecryptDigestUpdate
fer. ...
FC_DecryptFinal
ut] pointer to the location where the last block of recovered data, if any, is to be stored. ...
FC_DecryptInit
le hsession, ck_mechanism_ptr pmechanism, ck_object_handle hkey ); parameters hsession [in] session handle. pmechanism [in] mechanism to be used for the subsequent decryption operation. hkey [in] handle of the key to be used. description fc_decryptinit initializes a decryption operation. a user must log into the token (to assume the nss user role) before calling fc_decryptinit. return value examples see also nsc_decryptinit ...
FC_DecryptUpdate
e stored. ...
FC_DecryptVerifyUpdate
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 multiple times. the operation is finished by calls to fc_decryptfinal and fc_verifyfinal. a user must log into the token (to assume the nss user role) before calling fc_decryptverifyupdate. return value examples see also nsc_decryptverifyupdate ...
FC_DeriveKey
the wrapped key. ...
FC_DestroyObject
name fc_destroyobject - destroy an object. ...
FC_Digest
ata is to be stored. ...
FC_DigestEncryptUpdate
n fc_digestencryptupdate continues a multi-part digest and encryption operation. ...
FC_DigestFinal
he maximum buffer size. ...
FC_DigestInit
digest operation. ...
FC_DigestUpdate
block of data to be digested. uspartlen [in] length of data block in bytes. ...
FC_Encrypt
buffer usdatalen [in] length of the data buffer in bytes. ...
FC_EncryptFinal
er to the location that receives the last encrypted data part, if any puslastencryptedpartlen [in,out] pointer to location where the number of bytes of the last encrypted data part is to be stored. description fc_encryptfinal returns the last block of data of a multi-part encryption operation. a user must log into the token (to assume the nss user role) before calling fc_encryptfinal. return value examples see also fc_encryptinit, nsc_encryptfinal ...
FC_EncryptInit
ck_object_handle hkey ); parameters hsession[in] handle to the session. pmechanism[in] pointer to the mechanism to be used for subsequent encryption. hkey[in] handle of the encryption key. description fc_encryptinit initializes an encryption operation with the mechanism and key to be used. a user must log into the token (to assume the nss user role) before calling fc_encryptinit. return value ckr_ok slot information was successfully copied. ckr_slot_id_invalid the specified slot number is out of the defined range of values. examples see also nsc_encryptinit ...
FC_EncryptUpdate
d. ...
FC_Finalize
- indicate that an application is done with the pkcs #11 library. syntax ck_rv fc_finalize (ck_void_ptr preserved); parameters fc_finalize has one parameter: preserved must be null description fc_finalize shuts down the nss cryptographic module in the fips mode of operation. if the library is not initialized, it does nothing. the preserved argument is not used and must be null. return value fc_finalize always returns ckr_ok. fc_finalize should check the preserved argument and return ckr_arguments_bad if preserved is not null. fc_finalize should return ckr_cryptoki_not_initialized if the library is not initialized. examples #include <assert.h> ck_function_list_ptr pfunctionlist; ck_rv crv; crv = fc_getfunctionlist(&pfunctionlist); assert(crv == ckr_ok); ... /* invoke fc_fi...
FC_FindObjects
ive the object handles. usmaxobjectcount [in] maximum number of handles to retrieve. ...
FC_FindObjectsFinal
name fc_findobjectsfinal - terminate an object search. ...
FC_FindObjectsInit
] pointer to template. uscount [in] number of attributes in the template. ...
FC_GenerateKey
. ptemplate [in] pointer to the template for the new key. ...
FC_GenerateKeyPair
] pointer to the location to receive the handle of the new public key. ...
FC_GenerateRandom
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_GetFunctionList
has one parameter: ppfunctionlist [output] the address of a variable that will receive a pointer to the list of function pointers. description fc_getfunctionlist stores in *ppfunctionlist a pointer to the nss cryptographic module's list of function pointers in the fips mode of operation. a user may call fc_getfunctionlist without logging into the token (to assume the nss user role). return value fc_getfunctionlist always returns ckr_ok. examples #include <assert.h> ck_function_list_ptr pfunctionlist; ck_rv crv; crv = fc_getfunctionlist(&pfunctionlist); assert(crv == ckr_ok); /* invoke the fc_xxx function as pfunctionlist->c_xxx */ see also nsc_getfunctionlist ...
FC_GetFunctionStatus
examples see also nsc_getfunctionstatus ...
FC_GetInfo
s to 32 characters and not null-terminated. flags: should be 0. librarydescription: description of the library, "nss internal crypto services", padded with spaces to 32 characters and not null-terminated. libraryversion: pkcs #11 library version number, for example, 3.11 (major=0x03, minor=0x0b). a user may call fc_getinfo without logging into the token (to assume the nss user role). return value fc_getinfo always returns ckr_ok. fc_getinfo should return ckr_arguments_bad if pinfo is null. fc_getinfo should return ckr_cryptoki_not_initialized if the library is not initialized. examples note the use of the %.32s format string to print the manufacturerid and librarydescription members of the ck_info structure. #include <assert.h> #include <stdio.h> ck_function_list_ptr pfunctionlis...
FC_GetMechanismInfo
t_id slotid, ck_mechanism_type type, ck_mechanism_info_ptr pinfo ); parameters fc_getmechanisminfo takes three parameters: slotid [input] type [input] . pinfo [output] . description fc_getmechanisminfo obtains information about a particular mechanism possibly supported by a token. a user may call fc_getmechanisminfo without logging into the token (to assume the nss user role). return value ckr_ok examples see also nsc_getmechanisminfo ...
FC_GetMechanismList
ck_ulong_ptr puscount ); parameters fc_getmechanismlist takes three parameters: slotid [input] pinfo [output] the address of a variable that will receive a pointer to the list of function pointers. description fc_getmechanismlist obtains a list of mechanism types supported by a token. a user may call fc_getmechanismlist without logging into the token (to assume the nss user role). return value ckr_ok examples see also nsc_getmechanismlist ...
FC_GetObjectSize
e hsession, ck_object_handle hobject, ck_ulong_ptr pussize ); parameters hsession [in] session handle. hobject [in] object handle. pussize [out] pointer to location to receive the object's size. description fc_getobjectsize gets the size of an object in bytes. a user must log into the token (to assume the nss user role) before getting the size of a secret or private key object. return value examples see also nsc_getobjectsize ...
FC_GetOperationState
tate or null. ...
FC_GetSessionInfo
ion: state: the state of the session, i.e., no role is assumed, the user role is assumed, or the crypto officer role is assumed flags: bit flags that define the type of session ckf_rw_session (0x00000002): true if the session is read/write; false if the session is read-only. ckf_serial_session (0x00000004): this flag is provided for backward compatibility and is always set to true. return value examples see also fc_closesession, nsc_opensession ...
FC_GetSlotInfo
etslotinfo( ck_slot_id slotid, ck_slot_info_ptr pinfo ); parameters fc_getslotinfo takes two parameters: slotid [in] pinfo [out] the address of a ck_slot_info structure. description fc_getslotinfo stores the information about the slot in the ck_slot_info structure that pinfo points to. a user may call fc_getslotinfo without logging into the token (to assume the nss user role). return value ckr_ok slot information was successfully copied. ckr_slot_id_invalid the specified slot number is out of the defined range of values. examples see also nsc_getslotinfo ...
FC_GetSlotList
esent are included in the list, otherwise all slots are included. ...
FC_GetTokenInfo
hat this application currently has open with the token hardwareversion: hardware version number, for example, 8.3 (major=0x08, minor=0x03), which are the version numbers of the certificate and key databases, respectively. firmwareversion: firmware version number, 0.0 (major=0x00, minor=0x00). a user may call fc_gettokeninfo without logging into the token (to assume the nss user role). return value ckr_ok token information was successfully copied. ckr_cryptoki_not_initialized the pkcs #11 module library is not initialized. ckr_slot_id_invalid the specified slot number is out of the defined range of values. fc_gettokeninfo should return ckr_arguments_bad if pinfo is null. examples note the use of the %.32s format string to print the label and manufacturerid members of the ck_t...
FC_InitPIN
is, the session must be in the "r/w so functions" state (cks_rw_so_functions). the role of the pkcs #11 so is to initialize a token and to initialize the normal user's pin. in the nss cryptographic module, one uses the empty string password ("") to log in as the pkcs #11 so. the module only allows the pkcs #11 so to log in if the normal user's pin has not yet been set or has been reset. return value fc_initpin() returns the following return codes. ckr_ok: normal user's pin initialization succeeded. ckr_session_handle_invalid: the session handle is invalid. ckr_user_not_logged_in: the session is not in the "r/w so functions" state. ckr_pin_invalid: the pin has an invalid utf-8 character. ckr_pin_len_range: the pin is too short, too long, or too weak (doesn't have enough character types...
FC_InitToken
e to call fc_inittoken() without logging into the token (to assume the nss user role) because either the user's password hasn't been set yet or the user forgets the password and needs to blow away the password-encrypted private key database and start over. note: the so password should be the empty string, i.e., ulpinlen argument should be 0. fc_inittoken() ignores the plabel argument. return value fc_inittoken() returns the following return codes. ckr_ok: token initialization succeeded. ckr_slot_id_invalid: slot id is invalid. ckr_token_write_protected we don't have a reference to the key database (we failed to open the key database or we have released our reference). ckr_device_error: failed to reset the key database. application usage fc_inittoken() is used to reset the passwo...
FC_Login
r 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 the error state. ckr_host_memory: memory allocation failed. ckr_pin_incorrect: the pin is incorrect. ckr_pin_len_range: the pin is too long (ulpinlen is greater than 255). the function should return ckr_pin_incorrect in this case. ckr_session_handle_invalid: the s...
FC_Logout
name fc_logout - log a user out from a token. ...
FC_OpenSession
ported. phsession [out] pointer to a session handle. ...
FC_SeedRandom
al in bytes. ...
FC_SetOperationState
tication key to be used in the stored session or zero if none is needed. ...
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
recovered data is to be stored. ...
FC_SignEncryptUpdate
uffer. ...
FC_SignFinal
m buffer size. ...
FC_SignInit
sion_handle hsession, ck_mechanism_ptr pmechanism, ck_object_handle hkey ); parameters hsession [in] session handle. pmechanism [in] mechanism to be used for the subsequent signing operation. hkey [in] handle of the key to be used . description fc_signinit initializes a signature operation. a user must log into the token (to assume the nss user role) before calling fc_signinit. return value examples see also nsc_signinit fc_sign fc_signupdate fc_signfinal ...
FC_SignRecover
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_signrecover ...
FC_SignRecoverInit
); parameters hsession [in] session handle. ...
FC_SignUpdate
r to the next block of the data to be signed. uspartlen [in] length of data block in bytes. ...
FC_UnwrapKey
to receive the handle of the unwrapped key. ...
FC_Verify
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
gnature, ck_ulong ussignaturelen ); parameters hsession [in] session handle. ...
FC_VerifyInit
nism, ck_object_handle hkey ); parameters hsession [in] session handle. ...
FC_VerifyRecover
buffer, replaced by the length of the signature if the operation is successful. ...
FC_VerifyRecoverInit
e hkey ); parameters hsession [in] session handle. ...
FC_VerifyUpdate
ngth of data block in bytes. ...
FC_WaitForSlotEvent
name fc_waitforslotevent - waits for a slot event, such as token insertion or token removal, to occur. syntax ck_rv fc_waitforslotevent(ck_flags flags, ck_slot_id_ptr pslot ck_void_ptr preserved); parameters fc_waitforslotevent takes three parameters: [input] flags [input] pslot. preserved. description this function is not supported by the nss cryptographic module. return value fc_waitforslotevent always returns ckr_function_not_supported. examples see also fc_waitforslotevent ...
FC_WrapKey
d key or null. ...
NSC_InitToken
, 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 certificates that have their associated private keys in the key database.) note: the so password should be the empty string, i.e., ulpinlen argument should be 0. nsc_inittoken() ignores the plabel argument. return value nsc_inittoken() returns the following return codes. ckr_ok: token initialization succeeded. ckr_slot_id_invalid: slot id is invalid. ckr_token_write_protected slot id is 1. (the non-fips mode has two slots: 1 and 2. the key database is in slot 2. slot 1 doesn't have a key database.) we don't have a reference to the key database (we failed to open the key database or we have released our re...
NSC_Login
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 is in the error state. ckr_host_memory: memory allocation failed. ckr_pin_incorrect: the pin is incorrect. ckr_pin_len_range: the pin is too long (ulpinlen is greater than 255).the function should return ckr_pin_incorrect in this case. ckr_session_handle_invalid: the sessio...
NSS_Initialize
reserved - currently has no effect, but may be used in the future to trigger better cooperation between pkcs#11 modules used by both nss and the java sunpkcs11 provider. this should occur after a new flag is defined for c_initialize by the pkcs#11 working group. nss_init_cooperate - sets the above four recommended options for applications that use both nss and the java sunpkcs11 provider. return value nss_initialize returns secsuccess on success, or secfailure on failure. examples #include <nss.h> secstatus rv; const char *configdir; configdir = ...; /* application-specific */ rv = nss_initialize(configdir, "", "", secmod_db, nss_init_norootinit | nss_init_optimizespace); see also nss_init, nss_initreadwrite, nss_nodb_init, nss_shutdown ...
FIPS mode of operation
ismlist fc_getmechanisminfo fc_inittoken fc_initpin fc_setpin session management functions fc_opensession fc_closesession fc_closeallsessions fc_getsessioninfo fc_getoperationstate fc_setoperationstate fc_login fc_logout object management functions these functions manage certificates and keys. fc_createobject fc_copyobject fc_destroyobject fc_getobjectsize fc_getattributevalue fc_setattributevalue fc_findobjectsinit fc_findobjects fc_findobjectsfinal encryption functions these functions support triple des and aes in ecb and cbc modes. fc_encryptinit fc_encrypt fc_encryptupdate fc_encryptfinal decryption functions these functions support triple des and aes in ecb and cbc modes. fc_decryptinit fc_decrypt fc_decryptupdate fc_decryptfinal message di...
NSS tools : vfychain
ectedobjectsigner, 10=ocsp responder, 11=any ca -v verbose mode. prints root cert subject(double the argument for whole root cert info) -w password database password -w pwfile password file revocation options for pkix api (invoked with -pp options) is a collection of the following flags: [-g type [-h flags] [-m type [-s flags]] ...] ... where: -g test-type sets status checking test type. possible values are "leaf" or "chain" -g test type sets status checking test type. possible values are "leaf" or "chain". -h test flags sets revocation flags for the test type it follows. possible flags: "testlocalinfofirst" and "requirefreshinfo". -m method type sets method type for the test type it follows. possible types are "crl" and "ocsp". -s method flags sets revocation flags for the method it follows. p...
sslintro.html
pr_init. initializes nspr. must be called before any other nss functions. pk11_setpasswordfunc. sets the global callback function to obtain passwords for pkcs #11 modules. required. nss_init. sets up configuration files and performs other tasks required to run network security services. nss_init is not idempotent, so call it only once. required. ssl_optionsetdefault. changes default values for all subsequently opened sockets as long as the application is running (compare with ssl_seturl which only configures the socket that is currently open). this function must be called once for each default value that needs to be changed. optional. nss_setdomesticpolicy, nss_setexportpolicy, nss_setfrancepolicy, or ssl_cipherpolicyset. these functions tell the library which cipher suites are...
S/MIME functions
gneddata_getdigestalgs mxr 3.2 and later nss_cmssigneddata_getsignerinfo mxr 3.2 and later nss_cmssigneddata_hasdigests mxr 3.2 and later nss_cmssigneddata_importcerts mxr 3.2 and later nss_cmssigneddata_setdigests mxr 3.2 and later nss_cmssigneddata_setdigestvalue mxr 3.4 and later nss_cmssigneddata_signerinfocount mxr 3.2 and later nss_cmssigneddata_verifycertsonly mxr 3.2 and later nss_cmssigneddata_verifysignerinfo mxr 3.2 and later nss_cmssignerinfo_addmssmimeenckeyprefs mxr 3.6 and later nss_cmssignerinfo_addsmime...
NSS Tools pk12util
module or an external hardware module. it may be the case that the cryptographic module does not support the requested algorithm and a best fit will be selected, likely to be the default. if no suitable replacement for the desired algorithm can be found a "no security module can perform the requested operation" will appear on the error message. ...
NSS tools : vfychain
rgument for whole root cert info) -w password database password -w pwfile password file revocation options for pkix api (invoked with -pp options) is a collection of the following flags: [-g type [-h flags] [-m type [-s flags]] ...] ... where: -g test-type sets status checking test type. possible values are "leaf" or "chain" -g test type sets status checking test type. possible values are "leaf" or "chain". -h test flags sets revocation flags for the test type it follows. possible flags: "testlocalinfofirst" and "requirefreshinfo". -m method type sets method type for the test type it follows. possible types are ...
Pork Tool Development
enamer -rename foo bar rename_class.cc". for terminology, suppose "my_foo" --> "foo". then any post-location variables refer to "foo" and pre-location variables refer to "my_foo". cppsourceloc wraps sourceloc, providing information about macro expansion. cppsourceloc will change the previously provided location information (in variable cpp_source_loc._loc) from post-location to pre-location. all values from the ast refer to the post-location. notes the #static channel on irc.mozilla.org is for discussion of pork, dehydra, and other static analysis tools. ...
Pork Tools
it takes a list of functions as input and rewrites the definition and call sites of those functions. <caption>rewrites performed</caption> nsresult getter(nsifoo **aresult) { *aresult = ... if (!*aresult) return ns_error_failure; return ns_ok; } nsifoo* getter() { nsifoo *result = null; // aresult below is kept for complicated cases // typically it wont be needed and can be removed nsifoo **aresult = &result; // *aresult patterns are replaced with result result = ... ...
Rhino shell
nvironment variable names. input - the process input. if it is not java.io.inputstream, it is converted to string and sent to the process as its input. if not specified, no input is provided to the process. output - the process output instead of java.lang.system.out. if it is not instance of java.io.outputstream, the process output is read, converted to a string, appended to the output property value converted to string and put as the new value of the output property. err - the process error output instead of java.lang.system.err. if it is not instance of java.io.outputstream, the process error output is read, converted to a string, appended to the err property value converted to string and put as the new value of the err property. seal(object) seal the specified object so any attempt to ...
SpiderMonkey Build Documentation
ult, spidermonkey builds as a shared library. however, you can build spidermonkey as a static library by specifying the --disable-shared-js flag when you run configure. specifying compilers and compiler flags if you want to use a compiler other than the one the configure script chooses for you by default, you can set the cxx variable in the environment when you run configure. this will save the values you specify in the generated makefile, so once you've set it, you don't need to do so again until you re-run configure. if you'd like to pass certain flags to the compiler, you can set the cxxflags environment variable when you run configure. for example, if you're using the gnu toolchain, the following will pass the -g3 flag to the compiler, causing it to emit debug information about macros. t...
Invariants
sed in that function would refer to a different global object. even if the function is native, there is serious trouble: js_newobject with null parent argument calculates the parent from cx->fp->scopechain, which can be stale if we're on trace.) the chain of properties starting at any jsshape and chasing jsshape::parent never forms a cycle and does not contain any duplicate jsscopeproperty::slot values other than -1. (a cycle would be very silly and could cause infloops. the same slot being allocated to more than one property would be a problem for obvious reasons.) all jsshapes in dictionary-mode objects have the in_dictionary flag set. all jsshapes in property trees have it cleared. if an object is inextensible, its dslots will never again change. (we don't bother locking when accessing sl...
Self-hosted builtins in SpiderMonkey
t was expected. if the fun can potentially be a content-provided function, callcontentfunction has to be used. this is to prevent accidentally calling content functions when assuming that content can't interfere with behavior. e.g., if receiver is an object that content has access to, then callfunction(receiver.fun, receiver) wouldn't be guaranteed to work, because content might have changed the value of receiver.fun, so callcontentfunction(receiver.fun, receiver) has to be used. self-hosted functions by default are not constructors and do not have a prototype property, so that they meet the requirements for standard built-in functions as described in the ecmascript language specification 5.1, clause 15. to make a self-hosted function a constructor, call makeconstructible(functionname) after ...
JS::AutoIdArray
ex 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; 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::Compile
xt version of the script in characters. file is the filehandle containing the text of the script. filename is the name of the file (or url) containing the script. this information is included in error messages if an error occurs during compilation.. on success, js::compile stores an object representing the newly compiled script into script, and returns true. otherwise, it returns false and the value left in script is undefined. see also the jsapi user guide contains example code using compiled scripts. mxr id search for js::compile js::evaluate js::compileoffthread js::compilefunction js_decompilescript bug 771705 bug 1143793 -- removed obj parameter ...
JS::CompileFunction
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::compileoffthread js_executescript js_decompilescript bug 771705 ...
JS::PropertySpecNameEqualsId
this article covers features introduced in spidermonkey 38 determine if the given jspropertyspec::name or jsfunctionspec::name value equals the given jsid. syntax bool js::propertyspecnameequalsid(const char *name, js::handleid id); name type description name const char * jspropertyspec::name or jsfunctionspec::name. id js::handleid a jsid to compare with. description js::propertyspecnameequalsid determines if the given jspropertyspec::name or jsfunctionspec::name value equals the given jsid, and returns true if so. see also mxr id search for js::propertyspecnameequalsid js::propertyspecnameissymbol js::propertyspecnametopermanentid jspropertyspec jsfunctionspec bug 1082672 ...
JS::PropertySpecNameIsSymbol
this article covers features introduced in spidermonkey 38 determine if the given jspropertyspec::name or jsfunctionspec::name value is actually a symbol code and not a string. syntax bool js::propertyspecnameissymbol(const char *name); name type description name const char * the pointer of the name, actually the uintptr_t type, and not a pointer to any string. description js::propertyspecnameissymbol determines if the given jspropertyspec::name or jsfunctionspec::name value is actually a symbol code and not a string, and returns true if so. see also mxr id search for js::propertyspecnameissymbol js::propertyspecnameequalsid js::propertyspecnametopermanentid jspropertyspec jsfunctionspec bug 1082672 ...
JS::SourceBufferHolder
name type description data const char16_t * source buffer containing the script to compile. datalength size_t the length of data, in characters. ownership ownership see description. description js::sourcebufferholder is the container class for passing in script source buffers to the js engine. this not only groups the buffer and length values, it also provides a way to optionally pass ownership of the buffer to the js engine without copying. rules for use: the data array must be allocated with 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 sourcebufferhol...
JS::ToBoolean
this article covers features introduced in spidermonkey 17 convert any javascript value to a boolean. syntax bool js::toboolean(js::handlevalue v) name type description v js::handlevalue the value to convert. description js::toboolean converts a javascript value to a boolean. it implements the toboolean operation described in ecma 262 §7.1.2.this function can not fail and the return value is always the boolean conversion of the argument. mxr id search for js::toboolean bug 749536 ...
JS::ToString
this article covers features introduced in spidermonkey 31 convert any javascript value to a string. syntax #include "js/conversions.h" // as of spidermonkey 38; previously in jsapi.h jsstring* js::tostring(jscontext *cx, js::handlevalue v) name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handlevalue the value to convert. description js::tostring returns a string representation of a javascript value. if v.isstring() is true, it calls v.tostring(). otherwise, it converts the value to string. on success, js::tostring returns a jsstring instance. on error or exception, it returns nullptr. see ...
JSBool
oved at any time. try to avoid using it. every instance of jsbool has been replaced by bool. js_true has been replaced by just true and in the same way js_false by false. jsbool is the return type of many jsapi functions and callbacks. js_true indicates success; js_false indicates an error or exception occurred. jsbool is an integer type. js_true is (jsbool) 1 and js_false is (jsbool) 0. these values must not be used as jsvals. instead, use jsval_true and jsval_false, and use boolean_to_jsval and jsval_to_boolean to convert. ...
JSCheckAccessOp
cx jscontext * the js context in which the property access attempt is occurring. obj jsobject * the object whose properties are being accessed. id jsval the name or index of the property being accessed. mode jsaccessmode the type of access being checked. vp jsval * out parameter. on success, the callback must set *vp to the stored value of the property. description check whether obj[id] may be accessed per mode, returning js_false on error/exception, js_true on success with obj[id]'s stored value in *vp. as for jspropertyop, id is either a string or an int jsval. jscheckaccessop implementations generally work by using jsdbgapi functions such as js_frameiterator and js_stackframeprincipals to obtain the principals of the...
JSExnType
(lower bound) jsexn_err error jsexn_internalerr internalerror jsexn_evalerr evalerror jsexn_rangeerr rangeerror jsexn_referenceerr referenceerror jsexn_syntaxerr syntaxerror jsexn_typeerr typeerror jsexn_urierr urierror jsexn_limit (upper bound) description these types are part of a jserrorformatstring structure. they define which error to throw in case of a runtime error. ...
JSExtendedClass.wrappedObject
perating on the object it wraps. in these cases the engine calls the jsextendedclass.wrappedobject callback to get the wrapped object. most classes do not implement wrappedobject. the specific cases where this happens are: the default tostring method returns a string that contains the name of the wrapped object's class rather than the wrapper's class. in typeof expressions and in js_typeofvalue, the type of the wrapped object is returned. (the result may be "object", "function", or "xml".) when assigning to __proto__ or __parent__ from script, the javascript engine checks to see if the assignment would produce a cycle. if so, it fails with an exception. when walking the chain to do this check, wrappers are automatically unwrapped. a wrapper object is strictly equal to the object...
JSID_EMPTY
internal jsid value which is used in type inference. syntax const jsid jsid_empty; const js::handleid jsid_emptyhandle; // added in spidermonkey 31 description jsid_empty is an internal jsid value which is used in type inference code. jsid_emptyhandle is the handle to the jsid with the value of jsid_empty. see also mxr id search for jsid_empty mxr id search for jsid_emptyhandle bug 912411 ...
JSID_IS_INT
scription id jsid the property identifier to test or convert. i int32_t an integer to test or convert. description jsid_is_int tests whether a specified js id, id, is an integer, and returns true if it's an integer. jsid_to_int converts a specified js id, id to an integer. int_fits_in_jsid tests whether a specified integer fits in jsid, it means the integer value is not negative. int_to_jsid converts a specified integer, i to a jsid. see also mxr id search for jsid_is_int mxr id search for jsid_to_int mxr id search for int_fits_in_jsid mxr id search for int_to_jsid ...
JSID_VOID
an additional jsid which is used to indicate the absence of a valid jsid. syntax const jsid jsid_void; const js::handleid jsid_voidhandle; // added in spidermonkey 31 description jsid_void does not occur in js scripts but may be used to indicate the absence of a valid jsid. a void jsid is not a valid id and only arises as an exceptional api return value, such as in js_nextproperty. embeddings must not pass jsid_void into jsapi entry points expecting a jsid and do not need to handle jsid_void in hooks receiving a jsid except when explicitly noted in the api contract. jsid_voidhandle is the handle to the jsid which value is jsid_void. see also mxr id search for jsid_void mxr id search for jsid_voidhandle bug 912411 ...
JSIteratorOp
tors. syntax typedef jsobject * (*jsiteratorop)(jscontext *cx, jsobject *obj, jsbool keysonly); name type description cx jscontext * pointer to the js context in which the iterator creation should take place. obj jsobject * pointer to the object to iterate over. keysonly jsbool if true, the iterator should yield keys only, not [key, value] pairs. description the javascript engine calls the jsextendedclass.iteratorobject callback to create an iterator object for a given object. the callback should return an iterator object or null if an error or exception occurred on cx. see also bug 909178 ...
JSMarkOp
pe description cx jscontext * the js context in which the mark phase of garbage collection is occurring. obj jsobject * the object to be marked. arg void * opaque data which the mark hook must pass through to js_markgcthing. description call js_markgcthing for each gc thing directly reachable from obj. use jsval_is_gcthing to check whether a value needs to be marked and jsval_to_gcthing to convert the jsval to a pointer. jsclass hooks jsclass offers the following hook: the javascript engine calls the jsclass.mark callback during the mark phase of garbage collection. see also jsclass bug 638291 ...
JSObject
lexical scoping. security-sensitive applications can use this relationship to make every object a member of some security domain. almost every object can have any number of its own properties. the term own property refers to a property of an object that is not inherited from its prototype. each property has a name, a getter, a setter, and property attributes. most properties also have a stored value. see js_defineproperty. every object is associated with a jsclass and a jsobjectops. these are c/c++ hooks and metadata that govern various aspects of the object's behavior and describe its layout in memory. depending on the jsclass, an object may have a private data pointer and any number of reserved slots. ...
JSObjectOps.dropProperty
ropproperty callback releases a jsproperty. syntax typedef void (*jspropertyrefop)(jscontext *cx, jsobject *obj, jsproperty *prop); name type description cx jscontext * a context that was the cx argument to an earlier call to jsobjectops.lookupproperty that found a property. obj jsobject * the object of which prop is an own property. that is, the value that the jsobjectops.lookupproperty hook stored in the *objp out parameter. prop jsproperty * the property to release. that is, the value that jsobjectops.lookupproperty hook stored in the *propp out parameter. description the following contract governs jsobjectops callers and implementations: whenever jsobjectops.lookupproperty returns a jsproperty pointer, the property...
JSObjectOps.getProperty
js context in which the property access is happening. obj jsobject * the object to be accessed. id jsid the name or index of the property to access. vp jsval * in/out parameter. see the description section below. description get, set, or delete obj[id], returning js_false on error or exception, js_true on success. if getting or setting, the new value is returned in *vp on success. if deleting without error, *vp will be jsval_false if obj[id] is permanent, and jsval_true if id named a direct property of obj that was in fact deleted, or if id names no direct property of obj (id could name a property of a prototype, or no property in obj or its prototype chain). this reflects the quirky behavior of delete as specified in ecma 262-3 §11.4.1 and...
JSObjectOps.getRequiredSlot
*obj, uint32 slot); typedef jsbool (*jssetrequiredslotop)(jscontext *cx, jsobject *obj, uint32 slot, jsval v); name type description cx jscontext * the js context in which we access the slot. obj jsobject * the object whose slot we access. slot uint32 the index of the slot to access. see note below. v jsval the value to store in the slot, for jssetrequiredslotop. description get and set a required slot, one that should already have been allocated. these operations are infallible, so required slots must be pre-allocated, or implementations must suppress out-of-memory errors. the native ops (js_objectops, see js/src/jsobj.cpp) access slots reserved by including a call to the jsclass_has_reserved_slots(n...
JSPropertySpec
ince jsapi 29 */ /* added in jsapi 28 */ const char *selfhostedgetter; const char *selfhostedsetter; }; name type description name const char * name to assign the property. tinyid int8 obsolete since jsapi 31 unique id number for the property to aid in resolving getproperty and setproperty method calls. this value should be zero if you are not using tinyids (i.e. the getter/setter function is only used by one property). flags uint8_t the bitwise or of any number of property attributes. getter jsnativewrapper or selfhostedwrapper getter method for the property. setter jsnativewrapper or selfhostedwrapper setter method for the property. if a property is read-only,...
JSProtoKey
this article covers features introduced in spidermonkey 24 possible standard object prototype types. value prototype in javascript jsproto_null a dummy key for invalid prototype. mxr search for jsproto_null jsproto_object object mxr search for jsproto_object jsproto_function function mxr search for jsproto_function jsproto_array array mxr search for jsproto_array jsproto_boolean boolean mxr search for jsproto_boolean jsproto_json json mxr search for jsproto_json jsproto_date date mxr search for jsproto_date jsproto_math math mxr search for jsproto_math jsproto_number number mxr search for jsproto_number jsproto_s...
JSReserveSlotsOp
cx jscontext * the js context in which the new object is being created. obj jsobject * the new object. description warning: jsapi applications should not use this hook. a class cannot freely use a reserveslots hook to reserve a different number of slots for each object. rather, within a jsruntime, every call to the same reserveslots hook must return the same value (excepting a few internal classes such as function, call, and block). jsclass hooks jsclass offers the following hook: the jsclass.reserveslots callback is called each time a new object is created. the optional jsclass.reserveslots hook allows a class to make computed per-instance object slots reservations, in addition to or instead of using jsclass_has_reserved_slots(n) in the jsclas...
JSVAL_IS_BOOLEAN
obsolete since jsapi 32this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. determines if a given jsval is a javascript boolean. syntax jsval_is_boolean(v) description jsval_is_boolean(v) is true if the given javascript value, v, is a boolean value (that is, it is either jsval_true or jsval_false). to convert between javascript boolean values (jsval) and c boolean values, use jsval_to_boolean and boolean_to_jsval. see also bug 952650 ...
JSVAL_IS_GCTHING
obsolete since jsapi 32this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. indicates whether a js value has a type that is subject to garbage collection. syntax jsval_is_gcthing(v) description jsval_is_gcthing(v) is true if the jsval v is either jsval_null or a reference to a value that is subject to garbage collection. javascript performs automatic garbage collection of objects, strings, and doubles. this macro exposes javascript engine implementation details and usually isn't what the application really means. see jsval for alternatives. see also bug 952650 ...
JSVAL_IS_INT
ince jsapi 32this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. determine if a given jsval is a javascript number represented in memory as an integer. syntax jsval_is_int(v) description jsval_is_int(v) is true if the jsval v is a number represented in memory as an integer. to test whether a value is a number, regardless of how it is represented in memory, use jsval_is_number instead. to convert between c integer types and jsval, use jsval_to_int, int_fits_in_jsval, and int_to_jsval. example the following code snippet illustrates how a javascript variable, myitem, is conditionally tested in an if statement to see if it is a js integer data type. if (jsval_is_int(myitem)) { . . . } see...
JSVAL_IS_NULL
determine if a given jsval is null. syntax jsval_is_null(v) description jsval_is_null(v) is true if v is jsval_null, which is the javascript null value. (note: jsval_is_object(jsval_null) is also true.) example the following code snippet illustrates how a javascript variable, myitem, is conditionally tested in an if statement to see if it contains a null value. if (jsval_is_null(myitem)) { ... } see also bug 952650 ...
JSVAL_IS_NUMBER
obsolete since jsapi 32this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. determine if a given jsval is a javascript number. syntax jsval_is_number(v) description jsval_is_number(v) is true if v is a javascript number. to convert a numeric jsval to a c floating-point number, use js_valuetonumber. example the following code snippet illustrates how a javascript variable, myitem, is conditionally tested in an if statement to see if it is a js integer or double value. if (jsval_is_number(myitem)) { ... } see also bug 952650 ...
JSVAL_IS_VOID
obsolete since jsapi 32this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. determines if a given jsval is the javascript value undefined. syntax jsval_is_void(v) description jsval_is_void(v) is true if v is jsval_void, which represents the javascript value undefined. example the following code snippet illustrates how a javascript variable, myitem, is conditionally tested in an if statement to see if it is void. if (jsval_is_void(myitem)) { ... } see also bug 952650 ...
JSVAL_NULL
obsolete since jsapi 42this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. the jsval that represents the javascript value null. syntax jsval_null description jsval_null is a jsval constant that represents the javascript value null. it is equivalent to object_to_jsval(null). see also mxr id search for jsval_null jsval_void jsval_true jsval_false jsval_zero jsval_one bug 1177825 -- removed ...
JSVAL_TO_DOUBLE
obsolete since jsapi 32this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. casts a given jsval to a jsdouble without any type checking or error handling. syntax jsdouble jsval_to_double(jsval v); description jsval_to_double casts a specified js value, v, to a c floating-point number of type jsdouble. as a precondition, jsval_is_double(v) must be true. this function is not type-safe: if v is an integer, string, null, or anything else, the behavior is undefined. to convert any value to a number, use js_valuetonumber instead. see also bug 952650 ...
JSVAL_TO_GCTHING
sed to check this. this macro is exposed in jsapi.h because other jsapi macros make use of it. applications should not call it directly in most cases. when possible, it is better to use a more specific macro, such as jsval_to_object or jsval_to_string. another possible alternative is to avoid casting altogether by using an api that operates on jsvals rather than raw pointers (for example, js_call_value_tracer rather than js_call_tracer). see also bug 952650 ...
JSVAL_TO_INT
obsolete since jsapi 32this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. converts an integer jsval to a c integer without any type checking or error handling. syntax jsval_to_int(v) description jsval_to_int converts a specified integer jsval, v, to the corresponding c integer value. if v is any other type of value, the result is unspecified. note that although jsval is an integer type, it must be treated as opaque. the jsval encoding of the integer 4, for instance, is not ((jsval) 4) but some other pattern of bits. to convert an integer to jsval, use int_fits_in_jsval and int_to_jsval. see also bug 952650 ...
JSVAL_TO_OBJECT
it. cast a jsval to a jsobject * without a type check. syntax jsobject * jsval_to_object(jsval v); description jsval_to_object casts the argument, v, to type jsobject *. as a precondition, jsval_is_object(v) must be true. that is, v must be either a reference to an object or jsval_null. this function is not type-safe: if v is not an object or jsval_null, the behavior is undefined. to convert a value to an object, use the js_valuetoobject function, which has well-defined behavior even when the argument is not an object or null. see also bug 952650 ...
JSVAL_TO_STRING
use is discouraged since it could be removed at any time. try to avoid using it. cast a jsval to type jsstring * without a type check. syntax jsstring * jsval_to_string(jsval v); description jsval_to_string casts the argument, v, to type jsstring *. as a precondition, jsval_is_string(v) must be true. this function is not type-safe: if v is not a string, the behavior is undefined. to coerce any value to a string, use the js_valuetostring function instead. (the difference is that the latter will convert an object, array, number, or other value to a string in a type-safe way, creating a new string if needed.) to convert the return type of this macro (jsstring *) to a char pointer, use js_getstringbytes. see also bug 952650 ...
JSVAL_TRUE
obsolete since jsapi 42this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. jsval constants that represent the javascript values true and false. syntax jsval_true jsval_false description jsval_true and jsval_false are jsval constants that represent the javascript boolean values, true and false. they are equivalent to boolean_to_jsval(true) and boolean_to_jsval(false), respectively. take care not to confuse the jsval constants jsval_true and jsval_false with the bool constants true and false. jsval values must not be used as c true/false values; there is no guarantee that the c bit-pattern of any particular jsval is zero or nonzero. see also mxr id search for jsval_true mxr id...
JSVAL_VOID
obsolete since jsapi 42this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. the jsval that represents the javascript value undefined. syntax jsval_void description jsval_void is a jsval constant that represents the javascript value undefined. see also mxr id search for jsval_void jsval_null jsval_true jsval_false jsval_zero jsval_one bug 1177825 -- removed ...
JS_AlreadyHasOwnProperty
est 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. description these functions attempt to determine whethe...
JS_BindCallable
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. callable js::handle&lt;jsobject*&gt; pointer to the function object to bind new this. newthis js::handle&lt;jsobject*&gt; pointer to the new this value for callable. description js_bindcallable binds the given callable to use the given object as this. if callable is not callable, will throw and return nullptr. see also mxr id search for js_bindcallable bug 738356 ...
JS_ClearContextThread
st(cx); js_clearcontextthread(cx); /* note: outside the request */ } js_setcontextthread ties cx to the current thread for exclusive use. no other thread may use cx until the current thread removes this association by calling js_clearcontextthread. js_setcontextthread returns the thread id of the thread previously associated with this context. when the function is used properly, the return value is always zero, indicating that no thread was previously associated with the context. js_clearcontextthread relinquishes the calling thread's right to use cx. it returns the thread id of the last thread to be associated with this context. (this is always the current thread id when the function is used properly.) js_newcontext automatically associates the new context with the calling thread. us...
JS_ClearNewbornRoots
syntax void js_clearnewbornroots(jscontext *cx); name type description cx jscontext * the context to clear. ...
JS_ConstructObject
the new object's parent, or null. argc unsigned int (only in js_constructobjectwitharguments) the number of arguments to pass to the constructor. argv jsval * (only in js_constructobjectwitharguments) the array of arguments to pass to the constructor. this may be null if argc is zero. otherwise, the first argc elements of this array must be populated with valid jsval values. the caller does not need to ensure that the array elements are rooted. description js_constructobject creates a new object of the specified class, with the specified prototype and parent, then invokes a constructor function to initialize the new object. cx is a pointer to a context associated with the runtime in which to create the new object. clasp is a pointer to the class of object t...
JS_DefineFunction
onarity. 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. ...
JS_DefineFunctions
. fs is a pointer to the first element of an array of jsfunctionspec records. this array is usually defined as a static global, with each record initialized using js_fs or js_fn. each array element defines a single function: its name, the native c/c++ implementation, the number of javascript arguments the function expects, and any property attributes. the last element of the array must contain 0 values. (the macro js_fs_end can be used for the last element.) js_definefunctions creates one function for each non-zero element in the array. propertydefinitionbehavior is used to select if properties with jsprop_define_late flag should be defined on the object. normal jsapi consumers probably always want defineallproperties here. on success, js_definefunctions returns true. on error or exception, ...
JS_DeleteProperty2
d is set to true and obj's jsclass.delproperty hook is called (which may change *succeeded). if the hook returns false, the error is propagated. otherwise, if obj is not configurable, an error is raised. otherwise, *succeeded receives true and the property is removed. these functions return true on success, regardless of whether a property was actually deleted. on error or exception, the return value is false, and the value left in *succeeded is unspecified. jsobjectops.deleteproperty implements this behavior. (in javascript 1.2 and earlier, attempting to delete a permanent property caused an error. there is no longer any way to get this behavior.) to remove all properties from an object, call js_clearscope. see also mxr id search for js_deleteproperty2 mxr id search for js_deleteucpr...
JS_DoubleToInt32
in spidermonkey 17 convert a c floating-point number of type double to 32-bit integer per ecma spec. syntax int32_t js_doubletoint32(double d); uint32_t js_doubletouint32(double d); name type description d double the numeric value to convert. description js_doubletoint32 converts a c floating-point number of type double to int32, a signed 32-bit integer. js_doubletouint32 converts a c floating-point number of type double to uint32, an unsigned 32-bit integer. see also mxr id search for js_doubletoint32 mxr...
JS_EncodeStringToBuffer
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::getdeflatedutf8stringlength and js::deflatestringtoutf8buffer instead. see also mxr id search for js_encodestringtobuffer js_encodestring js_encodestringtoutf8 js_getstringencodinglength js::deflatestringtoutf8buffer js::getdeflatedutf8stringlength bug 607292 ...
JS_EnterCompartment
d. description every jscontext has a current compartment. any access to an object in a different compartment must be bracketed by calling js_entercompartment and js_leavecompartment. on success, js_entercompartment returns a pointer to the previously entered compartment. to return to that compartment, pass it to js_leavecompartment. js_entercompartment is infallible, so a null return value doesn't indicate failure. see also mxr id search for js_entercompartment js_leavecompartment jsautocompartment bug 786068 ...
JS_GetArrayLength
erty of obj as though by calling js_getproperty and converts it to a 32-bit unsigned integer. if obj is an array (see js_isarrayobject), this is guaranteed to succeed, because the .length property of an array is always a number and can't be deleted or redefined. on success, js_getarraylength stores the length in *lengthp and returns true. on failure, it reports an error and returns false, and the value left in *lengthp is undefined. see also mxr id search for js_getarraylength js_getelement js_setarraylength ...
JS_GetArrayPrototype
ation. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. forobj js::handleobject an object from the global whose array.prototype is being retrieved. description js_getarrayprototype() retrieves the original array.prototype of a specified object, obj. if an error occurs, it returns null. note: this expression might have different values over time if the global array property is modified, but this method returns only the original value. see also mxr id search for js_getarrayprototype bug 872043 ...
JS_GetClassObject
key jsprotokey the key of the prototype. objp js::mutablehandle&lt;jsobject*&gt; out parameter. if successful, receive the class constructor. description js_getclassobject gets the builtin class costructor for the specified prototype key. if successful, js_getclassobject stores the class constructor to *objp and returns true, otherwise returns false and the value of *objp is undefined. see also mxr id search for js_getclassobject js_getclassprototype jsprotokey ...
JS_GetClassPrototype
jsprotokey the key of the prototype. objp js::mutablehandle&lt;jsobject*&gt; out parameter. if successful, receive the class prototype object. description js_getclassprototype gets the builtin class costructor for the specified prototype key. if successful, js_getclassprototype stores the class prototype object to *objp and returns true, otherwise returns false and the value of *objp is undefined. see also mxr id search for js_getclassprototype js_getclassobject jsprotokey ...
JS_GetContextThread
ry to avoid using it. returns the id of the associated thread for a context. syntax int js_getcontextthread(jscontext *cx); name type description cx jscontext * the context to examine. description js_getcontextthread returns the id of the thread currently associated with this context. if the context is not currently associated with any thread, the return value is 0. see js_setcontextthread. js_getcontextthread is available only if the engine is built with js_threadsafe. mxr id search for js_getcontextthread ...
JS_GetEmptyString
ntroduced in spidermonkey 1.8.5 returns the empty string as a jsstring object. syntax jsstring * js_getemptystring(jsruntime *rt); name type description rt jsruntime * the runtime for which to return the empty string. description the returned empty string has the length 0. see also mxr id search for js_getemptystring js_getstringlength js_getemptystringvalue bug 612150 ...
JS_GetErrorPrototype
this article covers features introduced in spidermonkey 38 return the original value of error.prototype. syntax jsobject * js_geterrorprototype(jscontext *cx); name type description cx jscontext * pointer to a js context whose errors should be reported via your function. other contexts in the same runtime can have their own error reporting functions. description js_geterrorprototype returns the original value of error.prototype from the global object of the current compartment of cx. see also mxr id search for js_geterrorprototype bug 997285 ...
JS_GetFunctionArity
t16_t js_getfunctionarity(jsfunction *fun); name type description fun jsfunction * a javascript function. description js_getfunctionarity returns the number of formal parameters of a function, fun. this is the same as the function object's arity property, if that property has not been overwritten. specifically, if fun is a native function, the result is the value that was passed to the nargs parameter of js_definefunction. otherwise fun is implemented in javascript, and the result is the number of identifiers in its formal parameter list (see ecma 262-3 §13). note that it is not an error per se to call a javascript function with more or fewer actual arguments than its arity. see also mxr id search for js_getfunctionarity js_definefunction ...
JS_GetFunctionFlags
syntax unsigned int js_getfunctionflags(jsfunction *fun); name type description fun jsfunction * the function to examine. description js_getfunctionflags retrieves the function flags of a given javascript function, fun. these flags are for the javascript engine’s internal use. most applications can’t do anything useful with them. function flags are a value of type unsigned int, the bitwise or of zero or more of the jsfun flags described below. once a function is created, its flags cannot be modified. jsfun_generic_native the function is an array generic, such as array.map. jsfun_heavyweight the function uses language features such as closures, with, or eval that require extra work on the part of the interpreter. jsfun_lambda the f...
JS_GetFunctionName
retrieve the given name for a specified function. use js_getfunctionid instead. syntax const char * js_getfunctionname(jsfunction *fun); name type description fun jsfunction * a pointer to a javascript function. description js_getfunctionname retrieves the function name associated with a function pointer, fun. the return value is either the name of a function, or the string "anonymous", which indicates that the function was not assigned a name when created. the pointer returned by this function is valid only as long as the specified function, fun, exists. see also js_getfunctionid js_getfunctiondisplayid bug 617215 ...
JS_GetFunctionPrototype
quires request. in a js_threadsafe build, the caller must be in a request on this jscontext. forobj js::handleobject an object from the global whose function.prototype is being retrieved. description js_getfunctionprototype() retrieves the original function.prototype of a specified object, obj. if an error occurs, it returns null. note: this expression might have different values over time if the global function property is modified, but this method returns only the original value. see also mxr id search for js_getfunctionprototype bug 726182 ...
JS_GetGlobalObject
her case, the global function used by the function or script may differ from the context's global object. the context's global object field serves two purposes. first, it is a convenient place for the application to stash the global object, where it is automatically protected from garbage collection and the application can easily access it. second, the context's global object is used as a default value of last resort by functions that need a default parent object (see js_setparent for details) and by js_getscopechain. use js_setglobalobject to replace the global object. someone should document common use case "giving the global object a name", which can be done with js_getglobalobject and js_setproperty see also mxr id search for js_getglobalobject js_getglobalforobject js_getglobalforscope...
JS_GetObjectPrototype
on. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. forobj js::handleobject an object from the global whose object.prototype is being retrieved. description js_getobjectprototype() retrieves the original object.prototype of a specified object, obj. if an error occurs, it returns null. note: this expression might have different values over time if the global object property is modified, but this method returns only the original value. see also mxr id search for js_getobjectprototype bug 725888 ...
JS_GetOptions
use is discouraged since it could be removed at any time. try to avoid using it. get the currently enabled jscontext options. syntax uint32 js_getoptions(jscontext *cx); name type description cx jscontext * the context from which to read options. description js_getoptions retrieves the option flags of a given js context cx. this function returns a uint32 value that is the logical or of zero or more of the jsoption flags described in js_setoptions. see also mxr id search for js_getoptions js_setoptions js_toggleoptions bug 880330 ...
JS_GetParent
ck object representing the function's dynamic scope, or it may be the global object. in any case the global object is guaranteed appear on the new function's parent chain. the initial parent of an object created via the jsapi depends on the particular jsapi function (of which there are many that create objects, including but not limited to js_newobject, js_constructobject, js_defineobject, js_valuetoobject, js_newarrayobject, js_newscriptobject, js_newfunction, js_compilefunction, js_definefunction, js_definefunctions, and js_initclass). some of these functions allow the application to specify a parent object. if the jsapi function creating the object has a parent parameter, and the application passes a non-null value to it, then that object becomes the new object's parent. otherwise, if th...
JS_GetPendingException
get the current pending exception for a given jscontext. syntax bool js_getpendingexception(jscontext *cx, js::mutablehandlevalue vp); name type description cx jscontext * pointer to the js context in which the exception was thrown. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. vp js::mutablehandlevalue out parameter. on success, *vp receives the current pending exception. description if an exception has been thrown in the context cx, and it has not yet been caught or cleared, js_getpendingexception stores the exception object in *vp and returns true. otherwise, it returns false, and the value left in *vp is undefined. see examples in the jsapi phrasebook. see also mxr id search for js_getpe...
JS_GetPrivate
* an object whose jsclass has the jsclass_has_private flag. description js_getprivate accesses an object's private data field. obj must be an instance of a class that has the jsclass_has_private flag. new objects' private data fields are initially null. if obj is a function object, as reported by js_objectisfunction, the private data is a pointer to a jsfunction. (but consider using js_valuetofunction instead to access it.) warning: it is dangerous to call js_getprivate on a jsobject * unless the object's jsclass is known. if the object is not of the expected jsclass, the result of js_getprivate would probably be null or a pointer to some unexpected type of data. casting that pointer to the desired type and using it could then cause a crash or worse. getters, setters, and metho...
JS_GetPropertyAttrsGetterAndSetter
for the specified property. description see js_getpropertyattributes for details about these functions. the only difference is that on success, these functions also get the getter and setter functions for the property. the js_getter (or js_setter) attribute indicates that the property's getter (or setter) is a javascript function, not a c/c++ function. when this attribute is present, the value stored in getterp (or setterp) does not really point to a c/c++ function; it is a jsobject *, pointing to a javascript function, cast to type jspropertyop. the application may cast it back to jsobject * (using a c cast or a c++ reinterpret_cast) to access the getter/setter function object. for more information about javascript getters and setters, see defining getters and setters. property att...
JS_GetRuntimePrivate
cription rt jsruntime * any js runtime. data void * (in js_setruntimeprivate) pointer to application-defined data to be associated with the runtime rt. description each jsruntime has a field of type void * which the application may use for any purpose. it is especially useful for storing data which callbacks may then easily access. js_getruntimeprivate gets the value of this field and js_setruntimeprivate sets it. the field is initially null. memory management for this private data is the application's responsibility. the javascript engine itself never uses it. see also mxr id search for js_getruntimeprivate js_getcontextprivate js_setcontextprivate js_getsecondcontextprivate js_setsecondcontextprivate js_getcompartmentprivate js_setcompartmentprivate js_get...
JS_GetStringChars
syntax jschar * js_getstringchars(jsstring *str); // obsolete since jsapi 1.8.5 const jschar * js_getstringcharsz(jscontext *cx, jsstring *str); // added in spidermonkey 1.8.2, obsolete since jsapi 33 name type description cx jscontext * (in js_getstringcharsz only) a context. ...
JS_GetStringEncodingLength
context *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_getstringencodinglength 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::getdeflatedutf8stringlength and js::deflatestringtoutf8buffer instead. see also mxr id search for js_getstringencodinglength js_encodestringtobuffer js::deflatestringtoutf8buffer js::getdeflatedutf8stringlength bug 607292 ...
JS_HasArrayLength
uest. 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_hasarraylength determines if an object, obj, has a length property. if the property exists, js_hasarraylength stores the current value of the property in *lengthp. on success, js_hasarraylength returns js_true, and *lengthp receives the current value of the length property. on failure, js_hasarraylength returns js_false, and the value left in *lengthp is undefined. this function differs from js_getarraylength in the treatment of errors and unusual cases, like when an object's length is negative or not a number. this function may...
JS_HasElement
foundp, false otherwise. description js_haselement examines a specified js object, obj, and its prototype chain, for an element or numeric property numbered index. if the element exists, js_haselement sets *foundp to true. if not, it sets *foundp to false and returns true (to indicate no error occurred). if the search fails with an error or exception, js_haselement returns false, and the value left in *foundp is undefined. see also mxr id search for js_haselement js_defineelement js_deleteelement js_getarraylength js_getelement js_isarrayobject js_lookupelement js_newarrayobject js_setarraylength js_setelement ...
JS_HasOwnProperty
object.hasownproperty(obj, name). js_hasownpropertybyid is the same but takes a js::handleid for the property name. if the property exists, this function sets *foundp to true and returns true. if the object obj has no such property, the function sets *foundp to false and returns true (to indicate that no error occurred). if an error occurs during the search, the function returns false, and the value of *foundp is undefined. see also mxr id search for js_hasownproperty mxr id search for js_hasownpropertybyid bug 1163423 ...
JS_HasProperty
perty is the corresponding unicode api. js_haspropertybyid is the same but takes a js::handleid for the property name. if the property exists, this function sets *foundp to true and returns true. if the object obj has no such property, the function sets *foundp to false and returns true (to indicate that no error occurred). if an error occurs during the search, the function returns false, and the value of *foundp is undefined. see also mxr id search for js_hasproperty mxr id search for js_hasucproperty mxr id search for js_haspropertybyid bug 461163 ...
JS_IsExceptionPending
o a js context to check for pending exceptions. description js_isexceptionpending returns true if an exception has been thrown in the context cx and the exception has not yet been caught or cleared. otherwise, it returns false this can be used from jsnative functions which call js code to determine if the called js code threw an exception or not. example /* jsapi */ bool pending; js::rootedvalue exception(cx); /* if an exception is pending, save and clear it. */ pending = js_isexceptionpending(cx); if (pending) { if (!js_getpendingexception(cx, &exception)) return false; js_clearpendingexception(cx); } /* ... code that might throw js exception ... */ if (js_isexceptionpending(cx)) { /* ... react to exception thrown in this block ... */ js_clearpendingexceptio...
JS_IsExtensible
uest on this jscontext. obj js::handleobject the object to examine. extensible bool * out parameter. receives true if extensible, false otherwise. description js_isextensible queries [[extensible]] property of the specified object, obj. if successful, js_isextensible stores [[extensible]] property to *extensible and returns true, otherwise returns false and the value of *extensible is undefined. see also mxr id search for js_preventextensions js_preventextensions bug 492845 ...
JS_LeaveCompartment
rrent compartment is using jsautocompartment. leave a the compartment, returning to the compartment active before the corresponding js_entercompartment. syntax void js_leavecompartment(jscontext *cx, jscompartment *oldcompartment); name type description cx jscontext * the context in which to leave the compartment. oldcompartment jscompartment * value returned by previous call to js_entercompartment. description every jscontext has a current compartment. any access to an object in a different compartment must be bracketed by calls to js_entercompartment and js_leavecompartment. see also mxr id search for js_leavecompartment js_entercompartment jsautocompartment bug 786068 ...
JS_LeaveCrossCompartmentCall
ed in spidermonkey 1.8.1 js_leavecrosscompartmentcall has been removed in bug 786068. use js_leavecompartment instead. leave a the compartment, returning to the compartment active before the corresponding js_entercrosscompartmentcall. syntax void js_leavecrosscompartmentcall(jscrosscompartmentcall *call); name type description call jscrosscompartmentcall * value returned by previous call to js_entercrosscompartmentcall. description every jscontext has a current compartment. any access to an object in a different compartment must be bracketed by call js_entercrosscompartmentcall and js_leavecrosscompartmentcall. see also js_entercrosscompartmentcall js_entercompartment js_leavecompartment bug 786068 bug 563099 ...
JS_LeaveLocalRootScope
est on this jscontext. description see js_enterlocalrootscope for an explanation of local root scopes. leaving a nested local root scope causes all objects created since the matching js_enterlocalrootscope call to become subject to garbage collection. that is, they are not transferred to the enclosing local root scope. however, js_leavelocalrootscopewithresult provides a way to transfer one value to the enclosing local root scope. see also bug 519949 bug 803907 ...
JS_NewDateObject
mday int the day of the month to set the new object to. hour int the hour to set the new object to. min int the minute to set the new object's time to. sec int the second to set the new object's time to. description creates and returns a new jsobject representing a javascript date object, which is pre-configured using the specified values. see also mxr id search for js_newdateobject js_newdateobjectmsec js_objectisdate bug 625870 ...
JS_NewFunction
he function. if name is null, the new function has no name. (js_getfunctionid, passed the new function, will return null.) on success, js_newfunction returns a pointer to the newly created function. otherwise it reports an out-of-memory error and returns null. ...
JS_NextProperty
eid out parameter. on success, *idp receives the name or index of the next property name; or jsid_void if there are no more enumerable properties to visit. description on success, js_nextproperty returns true, with *idp containing the id of the next enumerable own property to visit using iterobj, or jsid_void if there is no such property left to visit. on error, it returns false, and the value left in *idp is undefined. see also bug 1081660 ...
JS_PopArguments
a request on this jscontext. ...
JS_PutEscapedString
he 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_ScheduleGC
this article covers features introduced in spidermonkey 17 set nextscheduled parameter of gc. syntax void js_schedulegc(jscontext *cx, uint32_t count); name type description cx jscontext * a context. the gc zeal level of the associated jsruntime is set. frequency uint32_t the value of nextscheduled parameter of gc. description js_schedulegc sets the nextscheduled parameter of gc. at every allocation nextscheduled is decremented. when it reaches zero, we do either a full or a compartmental gc. at this point, if zeal is one of the types that trigger periodic collection, then nextscheduled is reset to the value of frequency. otherwise, no additional gcs take place. see also mxr id search for js_schedulegc js_setgczeal bug 6...
JS_SealObject
see also bug 492849 ...
JS_SetBranchCallback
odically. the callback is called very frequently, so applications should ensure that the callback runs very quickly most of the time. typically an application only wants to do something every 5,000 or so branches. a common technique is to use a counter. the callback simply increments the counter and does nothing further (returning js_true immediately) unless the counter has reached the threshold value. see also mxr id search for js_setbranchcallback js_setoperationcallback js_setoptions bug 477187 ...
JS_SetContextCallback
which the callback may use to call into jsapi functions. this is the context which was just created, or is about to be destroyed. for example, the callback my call js_getcontextprivate(cx) in order to free up resources previously allocated by js_setcontextprivate. contextop unsigned see jscontextop. for future compatibility the callback must do nothing and return true if any other value is passed. data void * data specified in js_setcontextcallback. added in spidermonkey 31 typedef enum jscontextop { jscontext_new, jscontext_destroy } jscontextop; enumeration meaning jscontext_new js_newcontext successfully created a new jscontext instance. the callback can initialize the instance as required. if the callback returns js_false...
JS_SetErrorReporter
rrorreport * an error report record containing additional details about the error. description js_seterrorreporter enables you to define and use your own error reporting mechanism in your applications. the reporter you define is automatically passed a jserrorreport structure when an error occurs and has been parsed by js_reporterror. js_seterrorreporter js_geterrorreporter returns the value set by js_seterrorreporter. typically, the error reporting mechanism you define should log the error where appropriate (such as to a log file), and display an error to the user of your application. the error you log and display can make use of the information passed about the error condition in the jserrorreport structure. the error reporter callback must not reenter the jsapi. like all other s...
JS_SetExtraGCRoots
p, void *data); argument meaning rt the runtime whose trace operation is to be set. traceop the trace operation. this is described below. data closure pointer, to be passed through to traceop. callback syntax typedef void jstracedataop (jstracer *trc, void *data); argument meaning trc tracing data, to be passed through to js_calltracer. data closure pointer. this is the data value that was passed to js_setextragcroots when this callback function was installed. callback description generic trace operation that calls js_calltracer on additional traceable things. ...
JS_SetGCCallback
calls at several points during garbage collection. rt is the runtime in which you specify the callback. cb is a pointer to the new callback function to use. callback related to finalization is separated to js_setfinalizecallback in jsapi 13. obsolete since jsapi 13 js_setgccallback returns a pointer to the previously used callback function upon completion. the application may store this return value in order to restore the original callback when the new callback is no longer needed. to restore the original callback, call js_setgccallback a second time, and pass the old callback in as the cb argument. during each complete garbage collection cycle, the current gc callback is called four times: jsgc_begin start of gc. the callback may prevent gc from starting by returning false. but e...
JS_SetGCParametersBasedOnAvailableMemory
this article covers features introduced in spidermonkey 31 adjust performance parameters related to garbage collection based on available memory. syntax void js_setgcparametersbasedonavailablememory(jsruntime *rt, uint32_t availmem); name type description rt jsruntime * the runtime to configure. value uint32_t the value of available memory in megabytes. description js_setgcparametersbasedonavailablememory adjusts the parameters of the garbage collection based on available memory. see bug 950044 for details. see also mxr id search for js_setgcparametersbasedonavailablememory js_setgcparameter bug 950044 ...
JS_SetGlobalObject
t as the global object, or null. description this function is obsolete; see also js_getglobalobject. js_setglobalobject sets the global object of the context cx to obj. if obj is null, the context is set to have no global object. each context's global object is in the garbage collector's root set. this means that global objects are automatically protected from garbage collection, as are any values reachable from their properties. for full ecmascript standard compliance, obj should be of a jsclass that has the jsclass_global_flags flag. applications typically set a context's global object using js_initstandardclasses instead. see the sample code at jsapi user guide. see also js_getglobalobject bug 899245 ...
JS_SetPendingException
sets the current exception being thrown within a context. syntax void js_setpendingexception(jscontext *cx, js::handlevalue v); 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. v js::handlevalue value to throw as an exception. description js_setpendingexception sets the current exception being thrown within a context. if an exception is already being thrown, it is replaced with the new one given. v is the new value to throw as an exception. a native function or hook using this to throw an exception must also return false to ensure the exception is thrown. each jscontext's pending-exception fiel...
JS_ThrowStopIteration
w the stopiteration object. description js_throwstopiteration throws the appropriate stopiteration object for the function currently executing in cx. in for…in and for each…in loops, the javascript engine can create an iterator object and call its .next method repeatedly, as described in new in javascript 1.7: iterators. the .next method may throw stopiteration when there are no more values left to iterate. the engine automatically catches the exception and exits the loop. jsclass.enumerate offers a simpler way to customize object iteration. see also mxr id search for js_throwstopiteration js_isstopiteration bug 390947 ...
jschar
har is the type of javascript "characters", the 16-bit elements that make up strings. jschar, a typedef for the standard c++ type char16_t, will be removed in jsapi 38. functions that use jschar will use char16_t directly. embedder code should use char16_t, too. (see bug 1063962.) as required by the ecmascript standard, ecma 262-3 §4.3.16", javascript strings are arbitrary sequences of 16-bit values. a string may contain unmatched surrogates, which are not valid utf-16. it may also contain zeroes ('\0'). to get the characters of a javascript string, use js_getstringchars. see also bug 1063962 ...
jsdouble
since firefox/gecko 13 jsdouble has been removed, and instead it is possible to use the default c/c++ type double. you should be able to just replace every usage of jsdouble with double in your code. jsdouble is a c floating-point number type. it is defined to be a 64-bit, ieee 754 compliant type. see ecma 262-3 §8.5. arithmetic on jsdouble values in c should behave exactly like the floating-point arithmetic in javascript, except that c and javascript may treat not-a-number values differently. implementation note: spidermonkey has had several bugs involving details of floating-point arithmetic on various platforms. controlling the behavior of floating-point arithmetic is very architecture- and system-specific, and can be hard to get right. help in the form of test cases, commentary...
JSDBGAPI
meiterator js_getframescript js_getframepc js_getscriptedcaller js_stackframeprincipals js_evalframeprincipals js_getframeannotation js_setframeannotation js_getframeprincipalarray js_isnativeframe js_getframeobject js_getframescopechain js_getframecallobject js_getframethis js_getframefunction js_getframefunctionobject js_isconstructorframe js_isdebuggerframe js_getframereturnvalue js_setframereturnvalue js_getframecalleeobject js_getscriptfilename js_getscriptbaselinenumber js_getscriptlineextent js_getscriptversion js_gettopscriptfilenameflags js_getscriptfilenameflags js_flagscriptfilenameprefix jsfilename_null jsfilename_system jsfilename_protected evaluating debug code js_evaluateinstackframe examining object properties typedef jsproperty...
SpiderMonkey 1.8.8
nstead) js_constructobject and js_constructobjectwitharguments (preferably use js_new instead, or use this reimplementation as a short-term fix) js_newcompartmentandglobalobject (use js_newglobalobject instead.) jspd_argument jsval_is_object() (use !jsval_is_primitive(v) to detect objects and jsval_is_null(v) to detect null). js_isscriptframe jsclass_new_resolve_gets_start flag js_newnumbervalue api changes break out and discuss all api changes here... jsclass prototype has changed a number of optional members have been removed from the jsclass prototype. jsclass callback changes many of the jsclass callbacks such as jsresolveop, jsenumerateop and jspropertyop, have a type change on their arguments to jshandleobject, jshandleid, jshandlemutableobject etc. atleast for the c api this wrap...
SpiderMonkey 17
nstead) js_constructobject and js_constructobjectwitharguments (preferably use js_new instead, or use this reimplementation as a short-term fix) js_newcompartmentandglobalobject (use js_newglobalobject instead.) jspd_argument jsval_is_object() (use !jsval_is_primitive(v) to detect objects and jsval_is_null(v) to detect null). js_isscriptframe jsclass_new_resolve_gets_start flag js_newnumbervalue js_finalizestub js_clearnewbornroots jsclass_mark_is_trace flag js_setscriptstackquota api changes break out and discuss all api changes here... jsclass prototype has changed a number of optional members have been removed from the jsclass prototype. jsclass callback changes many of the jsclass callbacks such as jsresolveop, jsenumerateop and jspropertyop, have a type change on their argument...
Running Automated JavaScript Tests
. creating new tests for jit-tests creating new tests for jit-tests is easy. just add a new js file to the tests/basic directory (or any appropriate directory under 'tests'). the test harness will automatically find the test and run it. the test is considered to pass if the exit code of the js shell is zero (i.e., js didn't crash and there were no js errors). use the asserteq function to verify values in your test. there are some advanced options for tests. see the readme (in js/src/jit-tests) for details. ...
TPS Bookmark Lists
for example: var bookmarks_after_second_modify = { "menu": [ { uri: "http://www.getfirefox.com/", title: "get firefox" } ], "menu/foldera": [ { uri: "http://mozilla.com", title: "mozilla" }, ] }; this describes two bookmarks, one in the "menu" folder, and the other in the "folder1" subfolder of "menu". ...
Handling Mozilla Security Bugs
he security bug group has a problem with the module owner's decision, they can appeal to mozilla.org staff, who will make the final decision. the criteria for membership in the mozilla security bug group are as follows: the applicant must be trusted by those already in the group. the applicant should have a legitimate purpose for wishing to join the group. the applicant must be able to add value to the group's activities in some way. in practice, if over time a particular person happens to be frequently added to the cc list for security-sensitive bugs, then they would be a good candidate to be invited to join the security bug group. (as described previously, once added to the security bug group, that person would then have automatic access to all bugs marked security-sensitive, without...
Signing Mozilla apps for Mac OS X
utables with the same settings. note that you cannot specify an identifier requirement if you do this, or otherwise you need to sign the outer application again with the identifier requirement. --requirement 'designated requirement' adds additional requirements for verifying the signature and application metadata. at a minimum you'll need to provide: identifier: this must be the same as the value of the cfbundleidentifier specified in your application's info.plist file. leaf[subject.ou]: this needs to be the subject ou of your developer id. you can find it by running this command in the terminal: openssl x509 -text -noout -inform der -in devloperid_application.cer | grep subject putting it all together, you'll wind up using a command similar to the one below to sign your app. you'll ...
Gecko events
tate_busy, xxx: event_location_change an object has changed location, shape, or size. is supported: no event_name_change an object's name property has changed. is supported: yes targets: table_cell - the cell of <xul:tree/>, any accessible for html element when @title or @alt attribute is changed. event_description_change an object's description property has changed. is supported: no event_value_change an object's value property has changed. is supported: yes event_help_change an object's help has changed. is supported: no event_defaction_change an object's default action has changed. is supported: no event_action_change an object's action has changed. is supported: no event_accelerator_change an object's keyboard shortcut has changed. is supported: no event_selection the sele...
ROLE_CELL
« gecko roles page represents a cell within a table. also, see role_table. ...
Feed content access API
tener implemented by the program that wants to parse an rss or atom feed to receive messages during the parsing process. nsifeedresult describes the result of parsing a feed. nsifeedresultlistener implemented by the program that wants to parse an rss or atom feed to receive notification when parsing is complete. nsifeedtextconstruct represents text values in a feed; includes functions that let you fetch the text as plain text or html. nsiscriptableunescapehtml a utility class that unescapes html strings. example: reading a feed from the web it's actually quite easy to read and parse a feed. use an xmlhttprequest to load the feed, then pass its string to an nsifeedprocessor to parse the feed. loading the feed and sending it to the p...
Frecency algorithm
frecency is a score given to each unique uri in places, encompassing bookmarks, history and tags. this score is determined by the amount of revisitation, the type of those visits, how recent they were, and whether the uri was bookmarked or tagged. the word "frecency" itself is a combination of the words "frequency" and "recency." the default frecency value for all valid entries is -1. places with this value can show up in autocomplete results. invalid places have a frecency value of zero, and will not show up in autocomplete results. examples of invalid places are "place:" queries, and unvisited livemark feed entries. the frecency calculation process for the 10 most recent visits (where 10 is determined by places.frecency.numvisits): .. determine percentage bonus for ...
Manipulating bookmarks using Places
takes advantage of xpcomutils to generate the nsisupports.queryinterface() method. ...
places.sqlite Database Troubleshooting
by the last pragma query. sqlite> .exit open a new shell for the new database: my_work_folder> sqlite3 places.sqlite sqlite> pragma integrity_check; if the result is not ok, the file cannot be recovered; stop here and please file a bug. let's fix the schema version. nn must be replaced with the number we had noted previously: sqlite> pragma user_version = nn; let's update the page_size value: sqlite> pragma journal_mode = truncate; sqlite> pragma page_size = 32768; sqlite> vacuum; sqlite> pragma journal_mode = wal; sqlite> .exit copy the new places.sqlite to the profile folder, overwriting the existing one. remove the places.sqlite-corrupt file. launch firefox. if the database is still broken (missing history, creating -corrupt file, ...), please file a bug. ...
The Publicity Stream API
denied - if the user does not log in correctly permissiondenied - if the site is not allowed to access the publicity stream networkerror - if the publicity server is unreachable for_apps is a json list of apps that this store has (each represented as its origin url), so that stream events not relating to applications in a given presentation context can be excluded from the return value. if null or an empty list is passed, events for all apps are returned. since the timestamp of the earliest event you want returned. if not specified, will default to the beginning of the stream. before the timestamp of the latest event you want returned. if not specified, will default to now. count the maximum number of events to return, with preference given to more recent events [make thi...
Avoiding leaks in JavaScript XPCOM components
s wrapped so the javascript code can use it. the _filterradiogroup object is a javascript function that is wrapped so that xpcom code can use it. the reason closures matter here is that the _filterradiogroup function has access to the iterator variable. (var declarations inside javascript functions are function-scope, including the part of the function before the declaration.) this means that the value of iterator, the wrapper for the native tree walker, is reachable from the function. but the tree walker owns a reference to the wrapper for that function, so the wrapper maintains a garbage collection root to keep the function from being destroyed, so we have a cycle that prevents both objects from being freed. simply assigning iterator = null before the return is sufficient to fix the leak. ho...
How to build an XPCOM component in JavaScript
_categories: [{ // each object in the array specifies the parameters to pass to // nsicategorymanager.addcategoryentry(). 'true' is passed for both // apersist and areplace params. category: "some-category", // optional, defaults to the object's classdescription entry: "entry name", // optional, defaults to the object's contractid (unless 'service' is specified) value: "...", // optional, defaults to false. when set to true, and only if 'value' is not // specified, the concatenation of the string "service," and the object's contractid // is passed as avalue parameter of addcategoryentry. service: true }], // queryinterface implementation, e.g. using the generateqi helper (remove argument if skipped steps above) queryinterface: xpcomuti...
Finishing the Component
e same way we did in registering for notifications. a similar step is required for unregistration. implementing the nsicontentpolicy at this point, you can take the weblock component and install it into a gecko installation. when the component is loaded, gecko calls the nsicontentpolicy implementation in weblock on every page load, and this prevents pages from displaying by returning the proper value when the load method is called. the web locking policy that we are going to put into place is quite simple: for every load request that comes through, we will ensure that the uri is in the list of "good" urls on the white list. if you care to extend this implementation so that the list of urls is held remotely on a server somewhere - as might be the case when the weblock component is used in a...
Using XPCOM Components
ance. the singleton design pattern that is used to create services is described in xpcom services. remember, queryinterface allows you to query an object for the interfaces it supports. in the case of the snippet in the nsicookiemanager interface, the queryinterface method is being used to get the nsicookie interface from the enumerator so that, for instance, the javascript code can access the value and name attributes for each cookie. note: cookie-manager-ui note that the interface is not part of the component itself. xpcom makes it easy to use components like cookiemanager from mozilla's cross platform front end (xpfe) and other user interfaces, but the component itself doesn't provide its own ui. note: private-xpcom-interfaces there are exceptions to this. some xpcom interfaces are al...
Creating XPCOM components
eblock getting called at startup registering for notifications getting access to the category manager providing access to weblock creating the weblock programming interface defining the weblock interface in xpidl the xpidl syntax scriptable interfaces subclassing nsisupports the web locking interface implementing weblock declaration macros representing return values in xpcom xpidl code generation getting the weblock service from a client implementing the iweblock interface the directory service modifying paths with nsifile manipulating files with nsifile using nsilocalfile for reading data processing the white list data iweblock method by method lock and unlock addsite removesite setsites getnext getsites hasmoreelements...
How To Pass an XPCOM Object to a New Window
components.classes["@mozilla.org/embedcomp/window-watcher;1"]. getservice(components.interfaces.nsiwindowwatcher); var win = ww.openwindow(null, "chrome://myextension/content/debug.xul", "debug history", "chrome,centerscreen,resizable", myobject); note in this example that myobject is passed to the openwindow() method; you can pass any xpcom object (or any other value, for that matter) in this way. to access the xpcom object from the window's code, you can access the window.arguments[] array, as shown in the example below: components.utils.reporterror(string(window.arguments[0])); this will produce output similar to "[xpconnect wrapped nsimyxpcomobject]". ...
Interfacing with the XPCOM cycle collector
allback(msomeobj) ns_impl_cycle_collection_trace_end note that if your class is a wrapper cache then you likely have generate code that uses ns_impl_cycle_collection_wrappercache_# macro instead of ns_impl_cycle_collection_#. unfortunately this macro defines the trace method and so you can't list your js object; hence, you need to also manually implmenet trace and unlink as above. handling js::value fields recall (or see here) that a js::value may reference a string or object and is subject to gc. hence, we need to tell the cycle collector about any such member variables. this is the same as for the jsobject case, but using the ns_impl_cycle_collection_trace_jsval_member_callback macro: ns_impl_cycle_collection_trace_begin(nsfoo) ... ns_impl_cycle_collection_trace_jsval_member_callback...
Introduction to XPCOM for the DOM
the null-ness of the nscomptr. the following example demonstrates this. nscomptr<nsinotimplemented> iptr(do_queryinterface(ifooptr)); if(!iptr) { // nsfoo doesn't implement nsinotimplemented. iptr is thus null. return ns_ok; } it is also worth noting that queryinterface is null-safe. for example, in the previous example, nothing bad will happen if ifooptr is null. additionally, the return value of a call to queryinterface should not be returned unless there is a good reason for that. if you are concerned that it could return ns_nointerface, return ns_ok, as the previous example shows. at the beginning of this section, i talked about a second solution to get a pointer to an interface. this should be used in the case a getter function is not available. as you probably know, the "this" me...
Components.classes
ponents.classesbyid instead of components.classes to retrieve it. note also that it is possible that a given add-on component with a given contractid will be present on one machine but not have been installed on another machine. if the given element in the components.classes object is not registered on the machine then trying to access it will generate a javascript warning in strict mode and the value returned will be the javascript value undefined. you should use the in operator to test for the element before trying to access it: if (!("@some/bogus/class;1" in components.classes)) // do something... the properties of the components.classes object can be enumerated using a for...in loop. usage in order to retrieve the object for a given contractid, you can query the components.classes a...
Components.isSuccessCode
syntax var succeeded = components.issuccesscode(returncode); parameters returncode the return code (of type nsresult) to be checked. description components.issuccesscode() may be used to determine whether an xpcom return code (an nsresult) indicates success or failure. an xpcom return code indicates success if its high-order bit is 0, and it indicates failure if its high-order bit is 1. note: a non-zero xpcom return code (that is, not ns_ok) does not necessarily indicate failure. ...
Components.lastResult
ess' codes. this is because failure result codes get converted by xpconnect into exceptions that are thrown into the calling javascript method. most interfaces only return one success code -- ns_ok -- so components.lastresult is rarely necessary. in cases where components.lastresult is used, it is best to get it right away after the target call is made and save it in a local variable to test its value rather than doing multiple tests against components.lastresult. this is because many 'components' properties and methods are themselves implemented using xpconnect and subsequent calls to components.lastresult might reflect the result of 'implicit' xpconnect calls rather than the result of the target call. example in the following example, the local variable i contains the actual result returne...
Components.utils.cloneInto
add-on, can share an object with less-privileged code like a normal web page script. syntax components.utils.cloneinto(obj, targetscope[, options]); parameters obj : object the object to clone. targetscope : object the object to attach the object to. options : object this optional parameter is an object with the following optional properties: clonefunctions: a boolean value that determines if functions should be cloned. if omitted the default value is false. cloned functions have the same semantics as functions exported using components.utils.exportfunction. see cloning objects that have functions below. wrapreflectors: a boolean value that determines if objects reflected from c++, such as dom objects, should be cloned. if omitted the default value is false. see cl...
Components.utils.evalInSandbox
ndbox will become the global scope object when you pass it to evalinsandbox(text, sandbox). you can import functions or objects into the sandbox simply by assigning them to the sandbox object. for example: function double(n) { return n * 2; } // create new sandbox instance var mysandbox = new components.utils.sandbox("http://www.example.com/"); mysandbox.y = 5; // insert property 'y' with value 5 into global scope. mysandbox.double = double; var result = components.utils.evalinsandbox("x = y + 2; double(x) + 3", mysandbox); console.log(result); // 17 console.log(mysandbox.x); // 7 operations on objects you insert into this sandbox global scope do not carry privileges into the sandbox: mysandbox.foo = components; // this will give a "permission denied" error compon...
Components.utils.getGlobalForObject
to determine the global object with which an object is associated. this is the global object in place at the time the object was created, which is to say the global object used when executing the script that created the object. ...
Components.utils.import
ameters url a string of the url of the script to be loaded. the url must point to a file on the disk, possibly in a jar. scope an optional object to import onto; if omitted, the global object is used. under boot2gecko, the scope is not optional. if your code is meant to work on all platforms, you should always provide a scope. in case of doubt, this is generally a good scope. return value the module's global object. use of the return value is discouraged since it grants access to the module's internal properties which are not part of its public api. import throws if it encounters an error (like a syntax error) in the file it reads. example components.utils.import("resource://gre/modules/xpcomutils.jsm", this); difference from mozijssubscriptloader the differences from moz...
Components.utils.setGCZeal
this method lets scripts set the zeal level for garbage collection. you can get details on what this method does in js_setgczeal. this method calls through to that thusly: js_setgczeal(<current context>, zeal, js_default_zeal_freq, false); syntax components.utils.setgczeal(zeal); where zeal is the zeal value you wish to use. this method has no effect unless running in a debug build. ...
NS_Alloc
remarks this function provides a convenient way to access the xpcom memory manager. ...
NS_GetComponentManager
« xpcom api reference summary the ns_getcomponentmanager function returns a reference to the xpcom component manager. #include "nsxpcom.h" #include "nsicomponentmanager.h" nsresult ns_getcomponentmanager( nsicomponentmanager** aresult ); parameters aresult [out] a reference to the xpcom component manager. return values the ns_getcomponentmanager function returns ns_ok if successful. otherwise, it returns an error code. remarks the object returned is a singleton that is valid until ns_shutdownxpcom is called. the interface pointer should be release'd when it is no longer needed. history this function was finalized for mozilla 0.9.6. see bug 99147 for details. see also nsicomponentmanager ...
NS_GetComponentRegistrar
« xpcom api reference summary the ns_getcomponentregistrar function returns a reference to the xpcom component registrar. #include "nsxpcom.h" #include "nsicomponentregistrar.h" nsresult ns_getcomponentregistrar( nsicomponentmanager** aresult ); parameters aresult [out] a reference to the xpcom component registrar. return values the ns_getcomponentregistrar function returns ns_ok if successful. otherwise, it returns an error code. remarks the object returned is a singleton that is valid until ns_shutdownxpcom is called. the interface pointer should be release'd when it is no longer needed. history this function was finalized for mozilla 0.9.6. see bug 99147 for details. see also nsicomponentregistrar ...
NS_GetMemoryManager
otherwise, it returns an error code. ...
NS_GetServiceManager
« xpcom api reference summary the ns_getservicemanager function returns a reference to the xpcom service manager. #include "nsxpcom.h" #include "nsiservicemanager.h" nsresult ns_getservicemanager( nsiservicemanager** aresult ); parameters aresult [out] a reference to the xpcom service manager. return values the ns_getservicemanager function returns ns_ok if successful. otherwise, it returns an error code. remarks the object returned is a singleton that is valid until ns_shutdownxpcom is called. the interface pointer should be release'd when it is no longer needed. history this function was finalized for mozilla 0.9.6. see bug 99147 for details. see also nsiservicemanager ...
NS_NewLocalFile
afollowlinks [in] this attribute will determine if the nsilocalfile instance will automatically resolve symbolic links. this parameter has no effect on unix systems. on windows, passing true causes shortcuts to be automatically resolved, and on macos, passing true causes finder aliases to be automatically resolved. aresult [out] a reference to the newly created nsilocalfile instance. return values the ns_newlocalfile function returns ns_ok if successful. otherwise, it returns an error code. ns_error_file_unrecognized_path indicates that the specified path is invalid. this error is returned if a relative file path is passed to ns_newlocalfile. remarks on unix systems, the prefix "~/" is supported as a shorthand for the user's home directory. example code // create a local file th...
NS_NewNativeLocalFile
afollowlinks [in] this attribute will determine if the nsilocalfile instance will automatically resolve symbolic links. this parameter has no effect on unix systems. on windows, passing true causes shortcuts to be automatically resolved, and on macos, passing true causes finder aliases to be automatically resolved. aresult [out] a reference to the newly created nsilocalfile instance. return values the ns_newnativelocalfile function returns ns_ok if successful. otherwise, it returns an error code. ns_error_file_unrecognized_path indicates that the specified path is invalid. this error is returned if a relative file path is passed to ns_newnativelocalfile. remarks on unix systems, the prefix "~/" is supported as a shorthand for the user's home directory. if you use this function on w...
NS_Realloc
m.h" void* ns_realloc( void* aptr, prsize asize ); parameters aptr [in] a pointer to the block of memory to reallocate. this pointer must have been previously allocated by the xpcom memory manager, or this parameter may be null in which case this function behaves like ns_alloc. asize [in] the size in bytes of the block to allocate, or zero if the given block is to be freed. return values this function returns a pointer to the allocated block of memory, which is suitably aligned for any kind of variable, or null if the allocation failed. remarks this function provides a convenient way to access the xpcom memory manager. it is equivalent to calling realloc on the nsimemory instance returned from ns_getmemorymanager. history this function was finalized for mozilla 1.8. see b...
NS_ShutdownXPCOM
otherwise, it returns an error code. ...
nsresult
« xpcom api reference the nsresult data type is a strongly-typed enum used to represent a value returned by an xpcom function; these are typically error or status codes. for a list of defined result values, see error codes returned by mozilla apis. note: on compilers that do not support strongly-typed enums (that is, compilers that don't support this feature of c++11), it falls back to being an unsigned 32-bit integer, as in past versions of gecko. note: prior to gecko 19.0, nsresult was not strongly typed. as a result, it was possible for code to misuse it, such as returning an nsresult value from a function whose signature indicates it returns a boolean. because nsresult is strongly typed, code like the following will result in an error at compile time: bool foo() { ... i...
Append
void append( const self_type& astring ); parameters astring [in] a nsacstring to append to this string. void append( const char_type* adata, size_type adatalength = pr_uint32_max ); parameters adata [in] a raw character array to append to this string. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void append( char_type achar ); parameters achar [in] a character to append to this string. ...
Assign
void assign( const self_type& astring ); parameters astring [in] a nsacstring to copy into this string. void assign( const char_type* adata, size_type adatalength = pr_uint32_max ); parameters adata [in] a raw character array to copy into this string. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void assign( char_type achar ); parameters achar [in] the character to copy into this string. ...
Insert
void insert( const self_type& astring, index_type aposition ); parameters astring [in] a nsacstring to append to this string. aposition [in] an offset into the string's internal buffer specifying where to place the given characters. void insert( const char_type* adata, index_type aposition, size_type adatalength = pr_uint32_max ); parameters adata [in] a raw character array to append to this string. aposition [in] an offset into the string's internal buffer specifying where to place the given characters. adatalength [in] the length of adata, measured in storage units. ...
Replace
void replace( index_type acutstart, index_type acutlength, const self_type& astring ); parameters acutstart [in] the starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. astring [in] a nsacstring to append to this string. void replace( index_type acutstart, size_type acutlength, const char_type* adata, size_type adatalength = pr_uint32_max ); parameters acutstart [in] the starting index of the section to remove, measured in storage units. ...
operator=
« xpcom api reference summary this operator is a shortcut for the assign family of functions. self_type& operator=( const self_type& astring ); parameters astring [in] a nsacstring to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( const char_type* adata ); parameters adata [in] a raw character array to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( char_type achar ); parameters achar [in] a character to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. see also a...
operator+=
« xpcom api reference summary this operator+= is a shortcut for the append family of functions. self_type& operator+=( const self_type& astring ); parameters astring [in] a nsacstring to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. self_type& operator+=( const char_type* adata ); parameters adata [in] a raw character array to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. self_type& operator+=( char_type achar ); parameters achar [in] a character to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. see...
nsACString
e first element of the string's internal buffer. endreading the endreading function returns a const char_type pointer to the element just beyond the last element of the string's internal buffer. length the length function returns the number of storage units in the string's internal buffer (not including the null-terminator if present). assign the assign family of functions sets the value of a string's internal buffer. replace the replace family of functions sets the value of a string's internal buffer. append the append family of functions appends a value to the end of a string's internal buffer. insert the insert family of functions inserts a value into a string's internal buffer. cut the cut function removes a section of the string's internal buffer. opera...
Append
void append( const self_type& astring ); parameters astring [in] a nsastring to append to this string. void append( const char_type* adata, size_type adatalength = pr_uint32_max ); parameters adata [in] a raw character array to append to this string. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void append( char_type achar ); parameters achar [in] a character to append to this string. ...
Assign
void assign( const self_type& astring ); parameters astring [in] a nsastring to copy into this string. void assign( const char_type* adata, size_type adatalength = pr_uint32_max ); parameters adata [in] a raw character array to copy into this string. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void assign( char_type achar ); parameters achar [in] the character to copy into this string. ...
Insert
void insert( const self_type& astring, index_type aposition ); parameters astring [in] a nsastring to append to this string. aposition [in] an offset into the string's internal buffer specifying where to place the given characters. void insert( const char_type* adata, index_type aposition, size_type adatalength = pr_uint32_max ); parameters adata [in] a raw character array to append to this string. aposition [in] an offset into the string's internal buffer specifying where to place the given characters. adatalength [in] the length of adata, measured in storage units. ...
Replace
void replace( index_type acutstart, index_type acutlength, const self_type& astring ); parameters acutstart [in] the starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. astring [in] a nsastring to append to this string. void replace( index_type acutstart, size_type acutlength, const char_type* adata, size_type adatalength = pr_uint32_max ); parameters acutstart [in] the starting index of the section to remove, measured in storage units. ...
operator=
« xpcom api reference summary this operator= is a shortcut for the append family of functions. self_type& operator+=( const self_type& astring ); parameters astring [in] a nsastring to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( const char_type* adata ); parameters adata [in] a raw character array to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( char_type achar ); parameters achar [in] a character to append to this string. return values this operator returns a reference back to the object being modified to allow operator chaining. see also ...
Alloc
« xpcom api reference summary the alloc function allocates a block of memory of a particular size. static void* alloc( size_t asize ); parameters asize [in] specifies the size in bytes of the block of memory to allocate. return values this function is infallible, therefore guaranteed to return a pointer to the newly allocated buffer. the result must be freed with a call to nsmemory::free() when it is no longer needed. note: prior to gecko 13.0, this function returned nsnull if memory allocation failed. see also nsmemory::free() ...
Clone
rence summary the clone function creates a copy of an existing memory block up to the size specified. static void* clone( const void* aptr, size_t asize ); parameters aptr [in] the address of the memory block to copy. this must be non-null. asize [in] specifies the new size in bytes of the block of memory to allocate. the buffer at aptr must be at least asize bytes in length. return values this function returns nsnull if the memory allocation fails. otherwise, it returns a pointer to the newly allocated buffer. the result must be freed with a call to nsmemory::free when it is no longer needed. see also nsmemory::free ...
GetGlobalMemoryService
« xpcom api reference summary the getglobalmemoryservice function returns a reference to xpcom's global nsimemory object. static nsimemory* getglobalmemoryservice(); return values this function returns nsnull if the global memory manager does not exist or could not be initialized. remarks this function returns the same value as the ns_getmemorymanager function. see also ns_getmemorymanager ...
HeapMinimize
« xpcom api reference summary the heapminimize function attempts to shrink the size of the heap. static nsresult heapminimize( prbool aimmediate ); parameters aimmediate [in] if true, heap minimization will occur immediately if the call was made on the main thread. if false, the flush will be scheduled to happen when the app is idle. return values this function return ns_ok if successful. otherwise, it returns an error code. ...
Realloc
reallocates a block of memory to a new size. static void* realloc( void* aptr, size_t asize ); parameters aptr [in] the address of the memory block to reallocate. this may be nsnull, in which case realloc behaves like nsmemory::alloc. asize [in] specifies the new size in bytes of the block of memory to allocate. this may be 0, in which case realloc behaves like nsmemory::free. return values this function returns nsnull if the memory allocation fails. otherwise, it returns a pointer to the newly allocated buffer. the result must be freed with a call to nsmemory::free when it is no longer needed. remarks if aptr is non-null, then its contents will be unchanged to the minimum of the old and new sizes. newly allocated memory is uninitialized. see also nsmemory::free ...
imgICache
ype' and 'content-disposition' 'type' is a nsisupportscstring containing the images' mime type such as 'image/png' 'content-disposition' will be a nsisupportscstring containing the header if you call this before any data has been loaded from a uri, it will succeed, but come back empty. nsiproperties findentryproperties( in nsiuri uri ); parameters uri the uri to look up. return value null if the url was not found in the cache. removeentry() evict images from the cache. void removeentry( in nsiuri uri ); parameters uri the uri to remove. exceptions thrown ns_ok if a uri was removed from the cache. ns_error_not_available if a uri was unable to be removed from the cache. ...
imgIDecoder
any). if this method was provided as an external facility, a separate char * buffer would need to be used in order to call the output stream's other write() method. unsigned long writefrom( in nsiinputstream instr, in unsigned long count ); parameters instr the stream from which to read the encoded image data. count the maximum number of bytes to write to the image. return value the number of bytes actually written to the image, or undefined if an error occurred. see also imgidecoderobserver imgiload ...
mozIJSSubScriptLoader
the loaded script is executed with the principal associated with the target object. any top-level functions or variables created by the loaded script via var are created as properties of the targetobj target object (but things declared via let and const are not). additionally, properties of the targetobj target object can be referred to as variables in the loaded script. if the script returns a value, it will be returned by this method. note: this method must only be called from javascript! jsval loadsubscript( in string url, in object targetobj optional, in string charset optional, ); example let context = {}; services.scriptloader.loadsubscript("chrome://my-package/content/foo-script.js", context, "utf-8" /* the script's encoding */); param...
mozIPersonalDictionary
ry. void addword( in wstring word, in wstring lang ); parameters word the word to add to the dictionary. lang the language of the word. note that this parameter is currently unused. check() checks a unicode string. boolean check( in wstring word, in wstring lang ); parameters word the word to check. lang the language of the word. note that this parameter is currently ignored. return value true if the word is in either the dictionary or the ignore list, false if it is not in either list. endsession() clears the ignore list. void endsession(); parameters none. getcorrection() gets a list of previous corrections for the word. void getcorrection( in wstring word, [array, size_is(count)] out wstring words, out pruint32 count ); parameters word the word to get the list of corre...
mozIPlacesAutoComplete
ed by the places autocomplete search provider as well as methods to track opened pages for autocomplete purposes. 1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void registeropenpage(in nsiuri auri); void unregisteropenpage(in nsiuri auri); constants constant value description match_anywhere 0 match anywhere in each searchable term. match_boundary_anywhere 1 match first on word boundaries, and if we do not get enough results, then match anywhere in each searchable term. match_boundary 2 match on word boundaries in each searchable term. match_beginning 3 match only the beginning of each search term. behavior_history 1 << 0 search through history. ...
mozIStorageBindingParamsArray
ay. the appended parameters will be used when mozistoragestatement.executeasync() is called. void addparams( in mozistoragebindingparams aparameters ); parameters aparameters the mozistoragebindingparams object containing the parameters to append to the array. newbindingparams() creates and returns a new, empty, mozistoragebindingparams object to which you can add parameters and their values for binding. mozistoragebindingparams newbindingparams(); parameters none. ...
mozIStorageError
is article. last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) inherits from: nsisupports attributes attribute type description message autf8string a human readable error string with details; this may be null if no details are available. read only. result long one of the error code values listed under constants on this page. constants constant value description error 1 general sql error, or missing database ioerr 10 a disk i/o error occurred. corrupt 11 the database on disk is malformed. full 13 an insertion failed because the databas...
mozIStoragePendingStatement
9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) inherits from: nsisupports method overview void cancel(); methods cancel() cancels the pending statement. fails only if you attempt to cancel the operation more than once. note: for read statements, such as select, once you cancel the statement, you will receive no further notifications about results. void cancel(); parameters none. return value in versions of gecko prior to gecko 1.9.2, this returned a boolean value that was true if the query was canceled successfully or false if not. starting with gecko 1.9.2, this information is no longer provided and the method doesn't return a value. see also storage mozistorageconnection mozistoragestatement ...
mozIStorageProgressHandler
ods onprogress() the onprogress() method is called periodically while an sqlite operation is ongoing. this allows you to monitor the progress and possibly display status information to the user. boolean onprogress( in mozistorageconnection aconnection ); parameters <tt>aconnection</tt> a mozistorageconnection connection indicating the connection for which the callback was invoked. return value return true to abort the request or false to allow it to continue. see also storage mozstorage introduction and how-to article mozistorageconnection database connection to a specific file or in-memory data storage mozistoragestatement create and execute sql statements on a sqlite database. mozistoragevaluearray wraps an array of sql values, such as a result row. mozistoragefunction create a n...
mozIStorageResultSet
ults from a storage statement. storage/public/mozistorageresultset.idlscriptable 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 mozistoragerow getnextrow(); methods getnextrow() returns the next row from the result set. mozistoragerow getnextrow(); parameters none. return value a mozistoragerow object containing the next row from the result set, or null if there are no more results. see also storage mozistorageconnection mozistoragestatement ...
mozIStorageStatementRow
this interface has no defined properties, but has properties based on the name of the columns in the sql result from the statement it was accessed off of. ...
GetAccessibleAbove
« nsiaccessible page summary this method returns an accessible node geometrically above this one. nsiaccessible getaccessibleabove(); return value returns an accessible node geometrically above this one. see also nsiaccessible.getaccessibletoright() nsiaccessible.getaccessibletoleft() nsiaccessible.getaccessiblebelow() ...
GetAccessibleBelow
« nsiaccessible page summary this method returns an accessible node geometrically below this one. nsiaccessible getaccessiblebelow(); return value returns an accessible node geometrically below this one. see also nsiaccessible.getaccessibletoright() nsiaccessible.getaccessibletoleft() nsiaccessible.getaccessibleabove() ...
GetAccessibleRelated
« nsiaccessible page summary this method returns an accessible related to this one by the given relation type. nsiaccessible getaccessiblerelated( in unsigned long arelationtype ); parameters arelationtype[in] the relation type between the accessible (see constants listed in relations documentation). return value returns an accessible which is related to the one provided by the given relation type. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree.ns_error_not_implemented indicates that the given relation type is unsupported see also nsiaccessible.getrelations() nsiaccessible.relationscount nsiaccessible.getrelation() ...
GetAccessibleToLeft
« nsiaccessible page summary this method returns an accessible node geometrically to the left of this one. nsiaccessible getaccessibletoleft(); return value returns an accessible node geometrically to the left of this one. see also nsiaccessible.getaccessibletoright() nsiaccessible.getaccessibleabove() nsiaccessible.getaccessiblebelow() ...
GetAccessibleToRight
« nsiaccessible page summary this method returns an accessible node geometrically to the right of this one. nsiaccessible getaccessibletoright(); return value returns an accessible node geometrically to the right of this one. see also nsiaccessible.getaccessibletoleft() nsiaccessible.getaccessibleabove() nsiaccessible.getaccessiblebelow() ...
GetActionDescription
« nsiaccessible page summary this method retrieves the description (localized name) of the accessible action at the given zero-based index. astring getactiondescription( in pruint8 aindex ); parameters aindex[in] the zero-based index. return value returns the description of the accessible action. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. ns_error_invalid_arg indicates that the given index is our of range. see also nsiaccessible.numactions nsiaccessible.getactionname() nsiaccessible.doaction() ...
GetActionName
« nsiaccessible page summary this method retrieves the name of the accessible action at the given zero-based index. astring getactionname( in pruint8 aindex ); parameters aindex[in] the zero-based index. return value returns the name of the accessible action. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree.ns_error_invalid_arg indicates that the given index is our of range. see also nsiaccessible.numactions nsiaccessible.getactiondescription() nsiaccessible.doaction() ...
GetChildAt
if child index is less than zero then returns last child. if child index is greater than children count then returns null. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. ...
GetChildAtPoint
« nsiaccessible page summary this method returns an accessible child which contains the coordinate at (x, y) in screen pixels. nsiaccessible getchildatpoint( in long ax, in long ay ); parameters ax[in] accessible's x-coordinate.ay[out] accessible's y-coordinate. return value returns an accessible child at given (x, y) coordinate. remarks if the point is in the current accessible but not in a child, the current accessible will be returned. if the point is in neither the current accessible or a child, then null will be returned. ...
GetKeyBindings
« nsiaccessible page summary this method provides array of localized string of global keyboard accelerator for the given action index supported by accessible. nsidomdomstringlist getkeybindings( in pruint8 aactionindex ); parameters aactionindex[in] index of the given action. return values returns array of localized string of global keyboard accelerator. exceptions thrown ns_error_invalid_arg the given index doesn't correspond to default action (not zero). remark key bindings are supported for default action only. see also nsiaccessible.defaultkeybinding nsiaccessible.keyboardshortcut ...
GetRelation
exception thrown ns_error_invalid_arg indicates that the given index is invalid. ...
GetRelations
« nsiaccessible page summary this method returns multiple accessible relations for this accessible object. nsiarray getrelations(); return value returns nsiarray array of accessible relations for this object, every accessible relation object implements nsiaccessiblerelation interface. see also nsiaccessible.getaccessiblerelation() nsiaccessible.relationscount nsiaccessible.getrelation() ...
Role
« nsiaccessible page summary enumerated accessible role for the associated element. the values depend on platform because of variations. see the role_* constants in roles documentation. attribute unsigned long role; ...
nsIAccessibleCoordinateType
accessible/public/nsiaccessibletypes.idlscriptable these constants define which coordinate system a point is located in. 1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) prior to gecko 1.9, these constants were implemented in nsiaccessibletext. constants constant value description coordtype_screen_relative 0x00 the coordinates are relative to the screen. coordtype_window_relative 0x01 the coordinates are relative to the window. coordtype_parent_relative 0x02 the coordinates are relative to the upper left corner of the bounding box of the immediate parent. ...
nsIAccessibleScrollType
accessible/public/nsiaccessibletypes.idlscriptable these constants control the scrolling of an object or substring into a window. 1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) constants constant value description scroll_type_top_left 0x00 scroll the top left of the object or substring to the top left of the window (or as close as possible). scroll_type_bottom_right 0x01 scroll the bottom right of the object or substring to the bottom right of the window (or as close as possible). scroll_type_top_edge 0x02 scroll the top edge of the object or substring to the top edge of the window (or as close as possible). scroll_type_bottom_edge 0x03 scroll the bottom edge of the object or substring to the bottom edge ...
nsIAccessibleTableCell
occupied by this accessible cell. the result differs from 1 if the specified cell spans multiple rows. read only. rowheadercells nsiarray return an array of row header cells for this cell. read only. rowindex long return row index of this cell. read only. table nsiaccessibletable return host table accessible. read only. methods isselected() boolean isselected(); parameters none. return value a boolean value indicating whether this cell is selected. ...
nsIAccessibleTextChangeEvent
...
nsIAccessibleTreeCache
accessible() returns the tree item from the cache for the cell in the specified row and column; the nsiaccessible is created if it doesn't already exist in the cache. nsiaccessible getcachedtreeitemaccessible( in long arow, in nsitreecolumn acolumn ); parameters arow the row index. acolumn the column object. if is is null then the primary column is used. it makes sense for atk only. return value the nsiaccessible corresponding to the specified tree cell. invalidatecache() invalidates the number of cached treeitem accessibles. void invalidatecache( in long arow, in long acount ); parameters arow row index the invalidation starts from. acount the number of treeitem accessibles to invalidate, the number sign specifies whether rows have been inserted (plus) or removed (minus) treeview...
nsIApplicationCacheNamespace
this attribute should be the uri's asciispec. read only. itemtype unsigned long a bit field indicating one or more namespace types. must be one or more of the constants defined under constants on this page. read only. namespacespec acstring the prefix of this namespace. this should be the asciispec of the uri prefix. read only. constants constant value description namespace_bypass 1 items matching this namespace can be fetched from the network when loading from this cache. the data attribute is not used. namespace_fallback 2 items matching this namespace can be fetched from the network when loading from this cache; however, if the load fails, the cache entry specified by the data attribute should be loaded intst...
nsIAsyncInputStream
t necessary that nsiinputstream.isnonblocking() return true. nor is it necessary that a non-blocking nsiinputstream implementation also implement nsiasyncinputstream. method overview void asyncwait(in nsiinputstreamcallback acallback, in unsigned long aflags, in unsigned long arequestedcount, in nsieventtarget aeventtarget); void closewithstatus(in nsresult astatus); constants constant value description wait_closure_only (1<<0) if passed to asyncwait(), this flag overrides the default behavior, causing the oninputstreamready notification to be suppressed until the stream becomes closed (either as a result of closewithstatus()/close being called on the stream or possibly due to some error in the underlying stream). methods asyncwait() asynchronously wait for the stream to be read...
nsIAsyncOutputStream
ecessary that nsioutputstream.isnonblocking() return true. nor is it necessary that a non-blocking nsioutputstream implementation also implement nsiasyncoutputstream. method overview void asyncwait(in nsioutputstreamcallback acallback, in unsigned long aflags, in unsigned long arequestedcount, in nsieventtarget aeventtarget); void closewithstatus(in nsresult reason); constants constant value description wait_closure_only (1<<0) if passed to asyncwait(), this flag overrides the default behavior, causing the onoutputstreamready notification to be suppressed until the stream becomes closed (either as a result of closewithstatus()/close being called on the stream or possibly due to some error in the underlying stream). methods asyncwait() asynchronously wait for the stream to be wri...
nsIAuthModule
req_mutual_auth (1 << 0) client and server will be authenticated. req_delegate (1 << 1) the server is allowed to impersonate the client. the req_mutual_auth flag may also need to be specified in order for this flag to take effect. methods getnexttoken() this method is called to get the next token in a sequence of authentication steps. void getn...
nsIAuthPromptAdapterFactory
see also nsiauthprompt nsiauthprompt2 ...
nsIAuthPromptProvider
netwerk/base/public/nsiauthpromptprovider.idlscriptable this interface requests a prompt interface for the given prompt reason. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview void getauthprompt(in pruint32 apromptreason, in nsiidref iid, [iid_is(iid),retval] out nsqiresult result); constants constant value description prompt_normal 0 normal (non-proxy) prompt request. prompt_proxy 1 proxy authentication request. methods getauthprompt() this method requests a prompt interface for the given prompt reason. void getauthprompt( in pruint32 apromptreason, in nsiidref iid, [iid_is(iid),retval] out nsqiresult result ); parameters apromptreason the reason for the authentication prompt, one of the prompt_* constants. iid the desired...
nsIAutoCompleteItem
xpfe/components/autocomplete/public/nsiautocompleteresults.idlscriptable please add a summary to this article. inherits from: nsisupports last changed in gecko 1.7 attributes attribute type description classname string class name used to define some style through css like the colors, an icon url, and so on. comment wstring an extra comment that will be displayed next to the value but that will not be part of the value itself. param nsisupports parameter use by the search engine. value astring the result value using astring to avoid excess allocations. ...
nsIBadCertListener2
ication context that can be used to obtain more information about the active connection. this object usually supports nsisslsocketcontrol, nsitransportsecurityinfo, nsiidentityinfo, nsisslstatusprovider, nsiclientauthuserdecision and possibly other interfaces. status the ssl status object that describes the problem(s). targetsite the site name that was used to open the current connection. return value the consumer shall return true if it wants to suppress the error message related to the bad cert (the connection will still get canceled). see also nsisockettransport ...
nsIBidiKeyboard
o-left) installed. read only. note: this throws ns_error_not_implemented if the widget layer doesn't provide this information. currently, this is only implemented on windows. methods islangrtl() determines if the current keyboard language is right-to-left. (supported on: win32, mac, gtk2) note: prior to gecko 1.9 this method used a parameter 'out prbool aisrtl' to return the value. boolean islangrtl(); parameters none. return value true if the current keyboard is right-to-left, false if it is not. exceptions thrown ns_error_failure if no right-to-left keyboards are installed. setlangfrombidilevel() sets the keyboard language to left-to-right or right-to-left. (supported on: win32) void setlangfrombidilevel( in pruint8 alevel ); parameters alevel if o...
nsIBrowserHistory
tes a group associated with a host or domain. this method lets you delete pages from a specific host, or pages from all hosts in a given domain. if aentiredomain is true, it will assume ahost is a domain, and remove all pages from the entire domain. void removepagesfromhost( in autf8string ahost, in boolean aentiredomain ); parameters ahost the name of the host to be removed. an empty value for this parameter means local files and anything else without a hostname. you can also pass in the localized "(local files)" title given to you by a history query to remove all history information for local files. aentiredomain if set to true, it will assume ahost is a domain, and remove all pages from the entire domain, including subdomains. set to false otherwise. removevisitsbytimeframe()...
nsICache
access_read 1 access requested - i only want to read, if there isn't an entry just fail. access granted - you can read from this descriptor. ...
nsICacheEntryInfo
ing the cache entry. read only. lastfetched pruint32 get the last time the cache entry was opened (in seconds since the epoch). read only. lastmodified pruint32 get the last time the cache entry was modified (in seconds since the epoch). read only. methods isstreambased() this method finds out whether or not the cache entry is stream based. boolean isstreambased(); parameters none. return value returns true if the cache entry is stream based, otherwise returns false. see also nsicache nsicachevisitor ...
nsICacheListener
.11) method overview void oncacheentryavailable(in nsicacheentrydescriptor descriptor, in nscacheaccessmode accessgranted, in nsresult status); void oncacheentrydoomed(in nsresult status); methods oncacheentryavailable() this method is called when the requested access (or appropriate subset) is acquired. the status parameter equals ns_ok on success. see nsicacheservice for accessgranted values. void oncacheentryavailable( in nsicacheentrydescriptor descriptor, in nscacheaccessmode accessgranted, in nsresult status ); parameters descriptor the cache entry descriptor. accessgranted the cache access mode. status the status of the cache entry availability. oncacheentrydoomed() this method is called when the processing started by nsicachesession.doomentry() is completed. void onca...
nsICacheMetaDataVisitor
netwerk/cache/nsicacheentrydescriptor.idlscriptable this interface is used for visiting the meta data elements for a specified cache entry. inherits from: nsisupports last changed in gecko 1.7 method overview boolean visitmetadataelement(in string key, in string value); methods visitmetadataelement() this method is called for each key/value pair in the meta data for a cache entry. boolean visitmetadataelement( in string key, in string value ); parameters key the key for visiting the meta data for a cache entry. value the value for visiting the meta data for a cache entry. return value returns true if the provided key/value finds a cache entry, otherwise returns false. see also nsicache nsicacheentrydescriptor ...
nsICharsetResolver
out nsisupports aclosure ); parameters awebnavigation the nsiwebnavigation the document is being loaded in. may be null. achannel the channel the document is coming in from. awantcharset gets set to true if notifyresolvedcharset() should be called with the given aclosure object. aclosure a resulting object which should be passed to notifyresolvedcharset() if awantcharset is set to true. return value the resolved charset, or an empty string if no charset could be determined. ...
nsIClipboardDragDropHookList
nsiclipboarddragdrophooks ahooks); methods addclipboarddragdrophooks() this method adds a hook to the list. void addclipboarddragdrophooks( in nsiclipboarddragdrophooks ahooks ); parameters ahooks implementation of hooks. gethookenumerator() this method retrieves an enumerator for all hooks which have been added. nsisimpleenumerator gethookenumerator(); parameters none. return value returns nsisimpleenumerator for nsiclipboarddragdrophooks. removeclipboarddragdrophooks() this method removes a hook from the list. note: if this implementation is not present in the list then removal will be ignored. void removeclipboarddragdrophooks( in nsiclipboarddragdrophooks ahooks ); parameters ahooks implementation of hooks. see also nsiclipboarddragdrophooks nsiclipboard ...
nsIContentPref
see also nsicontentprefservice2 nsicontentprefcallback2 ...
nsIContentPrefCallback2
by nsicontentprefservice2 methods 1.0 66 introduced gecko 20.0 inherits from: nsisupports last changed in gecko 20.0 (firefox 20.0 / thunderbird 20.0 / seamonkey 2.17) method overview void handlecompletion(in unsigned short reason); void handleerror(in nsresult error); void handleresult(in nsicontentpref pref); constants constant value description complete_ok 0 complete_error 1 methods handlecompletion() called when the method finishes. this will be called exactly once for each method invocation, and afterward no other callback methods will be called. void handlecompletion( in unsigned short reason ); parameters reason one of the complete_* values indicating the manner in w...
nsIConverterOutputStream
will crash. void init( in nsioutputstream aoutstream, in string acharset, in unsigned long abuffersize, in prunichar areplacementcharacter ); parameters aoutstream the underlying output stream to which the converted strings will be written. acharset the character set to use for encoding the characters. a null charset will be interpreted as utf-8. abuffersize how many bytes to buffer. a value of 0 means that no bytes will be buffered. implementations not supporting buffering may ignore this parameter. areplacementcharacter the replacement character to use when an unsupported character is found. a value of 0x0000 will cause an exception to be thrown upon attempts to write unsupported characters. exceptions thrown ns_error_loss_of_significant_data if areplacementcharacter is not encod...
nsICookie
ossibly fully qualified) of the cookie. read only. isdomain boolean true if the cookie is a domain cookie, false otherwise. read only. issecure boolean true if the cookie was transmitted over ssl, false otherwise. read only. name acstring the name of the cookie. read only. path autf8string the path pertaining to the cookie. read only. policy nscookiepolicy holds the sites compact policy value. read only. status nscookiestatus holds the p3p status of cookie. read only. value acstring the cookie value. read only. constants constant value description status_unknown 0 the cookie collected in a previous session, and its information no longer exists. available status_accepted 1 the cookie was accepted. status_downgraded 2 the cookie was accepted but downgraded to a session c...
nsICookieAcceptDialog
extensions/cookie/nsicookieacceptdialog.idlscriptable this interface holds some constants for the cookie accept dialog. inherits from: nsisupports last changed in gecko 1.7 constants constant value description accept_cookie 0 value for accepting a cookie object. remember_decision 1 value for remembering a decision. hostname 2 value for holding the hostname object. cookiesfromhost 3 value for holding the cookie from the host. changingcookie 4 value for changing cookie. see also nsicookie ...
nsICookieConsent
n isforeign, out nscookiepolicy policy ); parameters uri the uri to find the policy for. httpchannel the channel to extract the p3p headers from. isforeign true if the cookie originates from a third-party site. this is used to decide the cookie status based on user preferences. policy the policy for the given uri, or nsicookie::policy_unknown if one cannot be found. valid values are defined in nsicookie.idl. return value returns nscookiestatus. valid values are defined in nsicookie.idl. see also nsicookie ...
nsIDBChangeListener
used to filter out events that you yourself started. ainstigator may also be null. onhdrpropertychanged() called in the general case where any field may have changed. onhdrpropertychanged is called twice per change. on the first call, aprechange is true, and astatus is undefined. onhdrpropertychanged saves any required status in astatus (such as a filter match). the calling function stores the value of astatus, changes the header ahdrtochange, then calls onhdrpropertychanged again with aprechange false. on this second call, the stored value of astatus is provided, so that any changes may be noted. void onhdrpropertychanged(in nsimsgdbhdr ahdrtochange, in prbool aprechange, inout pruint32 astatus, in nsidbchang...
nsIDNSListener
o this article. inherits from: nsisupports last changed in gecko 1.7 method overview void onlookupcomplete(in nsicancelable arequest, in nsidnsrecord arecord, in nsresult astatus); methods onlookupcomplete() called when an asynchronous host lookup completes. void onlookupcomplete( in nsicancelable arequest, in nsidnsrecord arecord, in nsresult astatus ); parameters arequest the value returned from asyncresolve. arecord the dns record corresponding to the hostname that was resolved. this parameter is null if there was an error. astatus if the lookup failed, this parameter gives the reason. ...
nsIDOMEventGroup
s in the document object model. inherits from: nsisupports last changed in gecko 1.7 method overview boolean issameeventgroup(in nsidomeventgroup other); methods issameeventgroup() reports whether or not another event group is the same as this one. boolean issameeventgroup( in nsidomeventgroup other ); parameters other instance of nsidomeventgroup object to compare against. return value returns true if the two objects are the same, otherwise false. see also document object model (dom) level 3 events specification ...
nsIDOMFileException
of the file api specification. content/base/public/nsidomfileexception.idlscriptable please add a summary to this article. last changed in gecko 1.9 (firefox 3) attributes attribute type description code unsigned short the error code describing the error condition that took place; see the constants list for details. constants constant value description not_found_err 0 the specified file wasn't found. not_readable_err 1 the specified file wasn't readable. see also nsidomfile nsidomfilelist nsidomfilereader ...
nsIDOMFontFace
attribute type description cssfamilyname domstring a family name that could be used in css font-family (not necessarily the actual name that was used, due to aliases, generics, localized names, and so on). read only. name domstring full font name as obtained from the font resource. read only. attributes only available when specified with @font-face these attributes only have meaningful values when the font is a user font defined using @font-face. attribute type description format domstring the font format. read only. localname domstring null if not a src:local(...) rule. read only. metadata domstring xml metadata from woff file(if any). read only. rule nsidomcssfontfacerule null if no associated @font-face rule. read only. srcindex long index in the rule's src list, -1 i...
nsIDOMFontFaceList
see also nsidomfontface @font-face ...
nsIDOMGeoGeolocation
...
nsIDOMGeoPositionError
fennec 1.0) inherits from: nsisupports attributes attribute type description code short numerical error code; see error constants for a complete list. read only. message domstring human readable error message. read only. gecko 1.9.2 note the message attribute was removed in gecko 1.9.2 (firefox 3.6). error constants constant value description permission_denied 1 the user denied permission to retrieve location data. position_unavailable 2 unable to access location data. timeout 3 a timeout occurred while trying to retrieve location data ...
nsIDOMGlobalPropertyInitializer
ap in firefox blog post for details. an alternative way to expose an object to the web content is to add the property in response to the content-document-global-created notification. method overview jsval init(in nsidomwindow window); methods init() jsval init( in nsidomwindow window ); parameters window the window to which the global property is being attached. return value the initialized global property. ensure that you never return any internal xpcom objects to untrusted code. it is also recommended to use __exposedprops__ to control which members are exposed. ...
nsIDOMMouseScrollEvent
, in boolean shiftkeyarg, in boolean metakeyarg, in unsigned short buttonarg, in nsidomeventtarget relatedtargetarg, in long axis); attributes attribute type description axis long indicates which mouse wheel axis changed; this will be either horizontal_axis or vertical_axis. read only. constants constant value description horizontal_axis 1 the horizontal (x) axis. vertical_axis 2 the vertical (y) axis. methods initmousescrollevent() initializes the progress event object. void initmousescrollevent( in domstring typearg, in boolean canbubblearg, in boolean cancelablearg, in nsidomabstractview viewarg, in long detailarg, in...
nsIDOMMozTouchEvent
see also mouse gesture events touch events event ...
nsIDOMOrientationEvent
d initorientationevent(in domstring eventtypearg, in boolean canbubblearg, in boolean cancelablearg, in double x, in double y, in double z); attributes attribute type description x double the amount of tilt along the x axis. read only. y double the amount of tilt along the y axis. read only. z double the amount of tilt along the z axis. read only. the values of x, y, and z can range from -1 to 1, where 0 means the device is balanced on that axis. see accelerometer values explained for details. methods initorientationevent() initializes the orientation event object. void initprogressevent( in domstring eventtypearg, in boolean canbubblearg, in boolean cancelablearg, in double x, in double y, in double z ); parameters eventtypearg the ty...
nsIDOMSerializer
acter set to use for the encoding to a byte stream. if this string is empty and root is a document, the document's character set will be used. serializetostring() the subtree rooted by the specified element is serialized to a string. astring serializetostring( in nsidomnode root ); parameters root the root of the subtree to be serialized. this could be any node, including a document. return value the serialized subtree in the form of a unicode string. ...
nsIDOMStorageItem
bute type description secure boolean if true, the item was stored for an https page. note: all items, regardless of whether they were stored for an http page or an https page, are visible from https pages. however, http pages can only see items stored from http pages, and will not see items stored from https pages. as such, this attribute is irrelevant for storage that is bound to an origin. value domstring the value associated with the item. see also dom storage structured client-side storage (html 5 specification) nsidomstorage nsidomstorage2 ...
nsIDOMStorageList
ecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview nsidomstorage nameditem(in domstring domain); methods nameditem() called when the list of available access points changes. nsidomstorage nameditem( in domstring domain ); parameters domain the name of the domain for whom to return the storage object. return value the nsidomstorage object representing the data store for the specified domain.see also dom storage structured client-side storage (html 5 specification) nsidomwindow ...
nsIDOMUserDataHandler
dom/interfaces/core/nsidomuserdatahandler.idlscriptable the callback function for the setuserdata method. 1.0 66 introduced gecko 1.5 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview void handle(in unsigned short operation, in domstring key, in nsivariant data, in nsidomnode src, in nsidomnode dst); constants constant value description node_cloned 1 the node was cloned. node_imported 2 the node was cloned into a new document. node_deleted 3 unimplemented node_renamed 4 unimplemented node_adopted 5 the node was adopted into a new document. methods handle() this method is a callback which will be called if a node with user data is being cloned, imported or adopted. void handle( in unsigned short operat...
nsIDOMWindow
dow as well as every other window nested in that window root. read only. native code only! note: prior to gecko 7.0 this attribute was part of nsidomwindow2. methods getcomputedstyle() see dom-window-getcomputedstyle for details. nsidomcssstyledeclaration getcomputedstyle( in nsidomelement elt, in domstring pseudoelt optional ); parameters elt pseudoelt optional return value getselection() returns the nsiselection object indicating what if any content is currently selected in the window. nsiselection getselection(); parameters none. return value the nsiselection object for the window. scrollby() scrolls the window by a given number of pixels relative to the current scroll position. void scrollby( in long xscrolldif, in long yscrolldif ); parameters...
nsIDOMXPathException
dom/interfaces/xpath/nsidomxpathexception.idlscriptable describes an exception resulting from xpath operations. inherits from: nsisupports last changed in gecko 1.7 attributes attribute type description code unsigned short the error code; see error codes for details. constants error codes constant value description invalid_expression_err 51 an invalid xpath expression was used. type_err 52 an attempt was made to reference an unavailable type. see also introduction to using xpath in javascript document object model (dom) level 3 xpath specification nsidomxpathevaluator document.evaluate nsidomxpathresult ...
nsIDOMXPathExpression
contextnode a dom node to evaluate the xpath expression against. to evaluate against a whole document, use the document.documentelement method to get the node to evaluate against. type a number that corresponds to one of the type constants of nsidomxpathresult. result an existing nsidomxpathresult to use for the result. using null will create a new nsidomxpathresult. return value an xpath result. see also introduction to using xpath in javascript nsidomxpathevaluator document.evaluate document object model (dom) level 3 xpath specification nsidomxpathresult ...
nsIDOMXULSelectControlItemElement
s/xul/nsidomxulselectcntrlitemel.idlscriptable please add a summary to this article. inherits from: nsidomxulelement last changed in gecko 1.7 attributes attribute type description accesskey domstring command domstring control nsidomxulselectcontrolelement read only. crop domstring disabled boolean image domstring label domstring selected boolean read only. value domstring ...
nsIDataSignatureVerifier
...
nsIDialogCreator
able please add a summary to this article. ...
nsIDirIndex
. inherits from: nsisupports last changed in gecko 1.7 attributes attribute type description contenttype string the content type; may be null if it is unknown. unspecified for directories. description wstring a description for the filename, which should be displayed by a viewer. lastmodified prtime last-modified time in seconds-since-epoch. if the last modified time is unknown, this value is -1. location string the fully qualified filename, expressed as a uri. this is encoded with the encoding specified in the nsidirindexparser, and is also escaped. size long long file size; if the size is unknown, this value is -1. type unsigned long the type of the entry; one of the type_* constants. constants constant value description type_unknown 0 the type is unknown. type_di...
nsIDirectoryServiceProvider
or on every request if the prop is not persistent. nsifile getfile( in string prop, out prbool persistent ); parameters prop the symbolic name of the file. persistent true if the returned file will be cached by directory service. subsequent requests for this prop will bypass the provider and use the cache. false if the provider will be asked for this prop each time it is requested. return value the nsifile represented by the property. example this code creates a global, read-only string called currdir with the value of the current working directory. __definegetter__("currdir", function getcurrdir() { return components.classes["@mozilla.org/file/directory_service;1"] .getservice(components.interfaces.nsidirectory...
getFiles
« xpcom api reference summary this method is called by the directory service to query an enumeration of file or directory locations. nsisimpleenumerator getfiles( in string aname ); parameters aname [in] the symbolic name for an enumeration of file or directory locations. return values the elements of the returned nsisimpleenumerator instance must support nsifile and may support nsilocalfile. see also nsifile, nsilocalfile, nsisimpleenumerator ...
nsIDirectoryServiceProvider2
given key. inherits from: nsidirectoryserviceprovider last changed in gecko 0.9.6 method overview nsisimpleenumerator getfiles(in string prop); methods getfiles() the directory service calls this when it gets a request for a prop and the requested type is nsisimpleenumerator. nsisimpleenumerator getfiles( in string prop ); parameters prop the symbolic name of the file list. return value an enumerator for a list of file locations. the elements in the enumeration are nsifile. use an xpcom return code of ns_success_aggregate_result if this result should be aggregated with other "lower" providers. if you are implementing this from js, you would be using components.returncode, but sadly this does not currently work (see bug 287107). ...
nsIDocumentLoader
iscouraged since it could be removed at any time. try to avoid using it. void getcontentviewercontainer( in nsisupports adocumentid, out nsicontentviewercontainer aresult ); parameters adocumentid aresult getloadgroup() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) nsiloadgroup getloadgroup(); parameters none. return value isbusy() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) boolean isbusy(); parameters none. return value stop() void stop(); parameters none. ...
nsIDownload
are nsidownloadmanager::download_finished, nsidownloadmanager::download_failed, and nsidownloadmanager::download_canceled. attributes attribute type description amounttransferred long long the number of bytes downloaded so far. read only. cancelable nsicancelable an object that can be used to cancel the download. once the download is complete, this value is set to null. read only. displayname astring a user-readable description of the transfer. read only. id unsigned long the id by which the download is identified uniquely in the database - not globally unique. for example, a private download and a public one might have identical ids. can only be safely used for direct database manipulation in the database that con...
nsIDownloadManagerUI
9 (firefox 3) method overview void getattention(); void show([optional] in nsiinterfacerequestor awindowcontext, [optional] in unsigned long aid, [optional] in short areason); attributes attribute type description visible boolean true if the download manager ui is visible; otherwise false. read only. constants constant value description reason_user_interacted 0 when opening the download manager user interface, this value indicates that it's being done at the user's request. reason_new_download 1 when opening the download manager user interface, this value indicates that the user interface is being displayed because a new download is being started. methods getattention() calls...
nsIDragSession
aflavorsupported() checks to see if any of the native data on the clipboard matches a given data flavor. if numdropitems is greater than one, there is no indication as to which of the items matches the data flavor. boolean isdataflavorsupported( in string adataflavor ); parameters adataflavor a string representing the mime type of the data to be matched, such as "text/unicode". return value true if the specified flavor matches any of the native data on the clipboard, otherwise false. ...
nsIDynamicContainer
erresultnode acontainer, in nsinavhistoryqueryoptions aoptions ); parameters acontainer the container node for the container being opened. aoptions the options used to generate this query. containers should follow these when possible, for example, whether to expand queries, etc. implementations should use this when possible if adding query and folder nodes to the container. do not modify this value. oncontainerremoving() this method is called when the given container is about to be deleted from the bookmarks table, so that the service can do any necessary cleanup. it is called before the container is deleted, so that the service can still reference it. void oncontainerremoving( in long long aitemid ); parameters aitemid the item-id of the container item. see also places nsinavhistory...
nsIException
tring a custom message set by the thrower. [binaryname(messagemoz)] read only. name string the name of the error code (a string representation of result) read only. result nsresult the nsresult associated with this exception. read only. methods tostring() a generic formatter - make it suitable to print, etc. string tostring(); parameters none. return value a string suitable for output. ...
nsIExternalURLHandlerService
...
nsIFTPEventSink
.idlscriptable please add a summary to this article. last changed in gecko 1.9 (firefox 3) inherits from: nsisupports method overview void onftpcontrollog(in boolean server, in string msg) methods onftpcontrollog allows a consumer to receive a log of the ftp control connection conversation. void onftpcontrollog ( in boolean server, in string msg); parameters server a boolean value specifying whether you are a server or a client. msg a string holding response of the last command which had been sent. ...
nsIFaviconDataCallback
i, in unsigned long adatalen, [const,array,size_is(adatalen)] in octet adata, in autf8string amimetype ); parameters auri receives the "favicon uri" (not the "favicon link uri") associated to the requested page. this can be null if there is no associated favicon uri, or the callback is notifying a failure. adatalen size of the icon data in bytes. notice that a value of 0 does not necessarily mean that we don't have an icon. adata icon data, or an empty array if adatalen is 0. amimetype mime type of the icon, or an empty string if adatalen is 0. ...
nsIFeedProgressListener
result); void handlestartfeed(in nsifeedresult result); void reporterror(in astring errortext, in long linenumber, in boolean bozo); methods handleentry() called after each entry or item is processed. if the document is a standalone item or entry, the handlefeedatfirstentry() method will not already have been called, and the received nsifeedentry will have a null parent value. void handleentry( in nsifeedentry entry, in nsifeedresult result ); parameters entry pointer to an nsifeedentry containing information about the entry that was just processed. result pointer to an nsifeedresult containing the current information about the feed being processed. handlefeedatfirstentry() called when the first entry or item in the feed is encountered. in atom, all fe...
nsIFeedResult
tylesheet nsiuri an xslt stylesheet available to transform the source of the feed. some feeds include this information in a processing instruction. it's generally intended for use by clients designed to work with specific feeds. uri nsiuri the address from which the feed was fetched. version astring the version of the feed; null if a non-feed is processed. this value will be one of the following: atom, rss2, rss09, rss091, rss091userland, rss092, rss1, atom03, atomentry, rssitem methods registerextensionprefix() registers a prefix for a namespace used to access an extension in the feed or entry. warning: this method is not implemented at this time. void registerextensionprefix( in astring anamespace, in astring aprefix ); parameters ...
nsIFeedTextConstruct
nt described; one of "text", "html", or "xhtml". methods createdocumentfragment() creates a new document fragment on a given dom element, containing the text and (if the text construct contains html or xhtml) its markup. nsidomdocumentfragment createdocumentfragment( in nsidomelement element ); parameters element the element in which to create the new document fragment. return value an nsidocumentfragment containing the text and markup. plaintext() returns the text as plain text with all markup stripped and all entities decoded. astring plaintext(); parameters none. return value the plain text version of the text construct's contents. if the type attribute is "text", this method returns the value of the text attribute unchanged. remarks if the document type is eit...
nsIFileOutputStream
netwerk/base/public/nsifilestreams.idlscriptable this interface is an output stream that lets you stream to a file. inherits from: nsioutputstream last changed in gecko 1.7 method overview void init(in nsifile file, in long ioflags, in long perm, in long behaviorflags); constants behavior flag constants constant value description defer_open 1<<0 see the same constant in nsifileinputstream. the deferred open will be performed when one of the following is called: seek() tell() write() flush() defer_open is useful if we use the stream on a background thread, so that the opening and possible stating of the file happens there as well. ...
nsIFileView
boolean if true results will be sorted in ascending order. read only. selectedfiles nsiarray an nsiarray of selected files, which contains nsiarray instances. read only. showhiddenfiles boolean if true hidden files will be shown. showonlydirectories boolean if true only directory entries will be returned. sorttype short the current sort type in effect. read only. constants constant value description sortname 0 sort by file name. sortsize 1 sort by file size. sortdate 2 sort by the date of the last modification. methods setdirectory() set the directory to be browsed. void setdirectory( in nsifile directory ); parameters directory the directory to be browsed. setfilter() set the filter to be applied to the file list, for example "*.jpg" would only return jpg files. vo...
nsIFrameLoaderOwner
d swapframeloaders(in nsiframeloaderowner aotherowner); attributes attribute type description frameloader nsiframeloader the frame loader owned by this nsiframeloaderowner. read only. methods getframeloader() returns the frame loader object owned by this object. [noscript, notxpcom] alreadyaddrefed_nsframeloader getframeloader(); parameters none. return value the nsiframeloader owned by this object. swapframeloaders() swaps frame loaders with the given nsiframeloaderowner. this may only be possible in a very limited set of circumstances, or never, depending on the object implementing this interface. void swapframeloaders( in nsiframeloaderowner aotherowner ); parameters aotherowner the other frame loader owner with which to swap frame load...
nsIFrameScriptLoader
script into new frames. if you used aallowdelayedload, you should call this as part of your cleanup (for example, when your add-on is disabled or uninstalled). parameters name type description aurl string url for the script to remove. getdelayedframescripts() returns all delayed scripts that will be loaded once a (remote) frame becomes available. the return value is a list of pairs [<url>, <wasloadedinglobalscope>]. returns list of the delayed scripts. each script is returned as a pair: [<url>, <wasloadedinglobalscope>]. ...
nsIGSettingsService
service: var gsettingsservice = components.classes["@mozilla.org/gsettings-service;1"] .createinstance(components.interfaces.nsigsettingsservice); method overview nsigsettingscollection getcollectionforschema(in autf8string schema); methods getcollectionforschema() nsigsettingscollection getcollectionforschema( in autf8string schema ); parameters schema return value ...
nsIGeolocationProvider
a geolocation provider. method overview boolean isready(); obsolete since gecko 1.9.2 void shutdown(); void startup(); void watch(in nsigeolocationupdate callback); methods isready() obsolete since gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) reports whether or not the device is ready and has a position. boolean isready(); parameters none. return value true if the device is ready and has a position available to return; otherwise false. shutdown() shuts down the location device. void shutdown(); parameters none. startup() start up the provider. this is called before any other method and may be called multiple times. void startup(); parameters none. watch() attaches a callback listener to be notified when a location change is observed. void wat...
nsIGlobalHistory
...
nsIGlobalHistory2
ther the uri was redirected to another location; this is true for the original uri which is redirected. atoplevel whether the uri is loaded in a top-level window. areferrer the uri of the referring page. isvisited() checks to see whether the given uri is in history. boolean isvisited( in nsiuri auri ); parameters auri the nsiuri of the page. return value true if a uri has been visited. setpagetitle() set the page title for the given uri. uris that are not already in global history will not be added. void setpagetitle( in nsiuri auri, in astring atitle ); parameters auri the nsiuri for which to set to the title. atitle the page title. see also nsiglobalhistory3 ...
nsIGlobalHistory3
ko as hints to optimize page loading. not all histories have them; this need not be supported (just return ns_error_not_implemented. these flags are opaque and should not be interpreted by the history engine. unsigned long geturigeckoflags( in nsiuri auri ); parameters auri the nsiuri to get flags for. flags are defined by the history that is implementing this interface. return value the gecko flags for the uri. seturigeckoflags() set the gecko flags for this uri. may fail if the history entry doesn't have any flags or if there is no entry for the uri. void seturigeckoflags( in nsiuri auri, in unsigned long aflags ); parameters auri the nsiuri to add flags for. aflags the flags to add. these are defined by the history that is implementing thi...
nsIHttpChannelInternal
provide to the new protocol the low level transport streams that are no longer used by http. the onstartrequest and onstoprequest events are still delivered and the listener gets full control over the socket if and when nsihttpupgradelistener.ontransportavailable() is delivered. void httpupgrade( in acstring aprotocolname, in nsihttpupgradelistener alistener ); parameters aprotocolname the value of the http upgrade request header. alistener the callback object used to handle a successful upgrade. setcookie() helper method to set a cookie with a consumer-provided cookie header, but using the channel's other information (uri's, prompters, date headers and so on.). void setcookie( in string acookieheader ); parameters acookieheader the cookie header to be parsed. setupfallbackchannel()...
nsIINIParserFactory
.5 / seamonkey 1.0) see example for how to use this interface. method overview nsiiniparser createiniparser(in nsilocalfile ainifile); methods createiniparser() creates an ini parser, returning the nsiiniparser object that you can use to parse it. nsiiniparser createiniparser( in nsilocalfile ainifile ); parameters ainifile the ini file to parse. return value the nsiiniparser object you can use to parse the ini file. example obtaining a parser object to obtain a parser for an ini file, you can use code that looks like this: to get an nsiiniparser instance for an ini file, you may use the following code: // create an nsilocalfile var cl = "@mozilla.org/file/local;1"; var interf = components.interfaces.nsilocalfile; var file = components.classes[cl].cre...
nsIInProcessContentFrameMessageManager
see also content process event handling nsicontentframemessagemanager ...
nsIJSCID
js/src/xpconnect/idl/xpcjsid.idlscriptable this interface provides methods to instantiate a component and access service components. inherits from: nsijsid last changed in gecko 1.7 method overview nsisupports createinstance(); nsisupports getservice(); methods createinstance() nsisupports createinstance(); parameters none. return value getservice() nsisupports getservice(); parameters none. return value see also see components.classes for usage patterns of the createinstance() and getservice() methods. ...
nsIJetpackService
history see bug 556846 for details. see also nsijetpack jetpack processes ...
nsILocale
strings are stored in nsilocale.idl. currently those are: nsilocale_collate - collation order. how strings are sorted. nsilocale_ctype - character classification and case conversion. nsilocale_monetary - monetary formatting. nsilocale_numeric - numeric, non-monetary formatting. nsilocale_time - date and time formats. nsilocale_messages - related to fonts, character encodings and so on. return value the locale code to be used for the given category. a locale code is of the form language[-country[-region]], where "language" is an iso 639 language code (two letter codes preferred over three letter codes when available), "country" is an iso 3166 two letter country code, and "region" is a string of up to 5 letters. see also stringbundle ...
nsILoginMetaInfo
toolkit/components/passwordmgr/public/nsiloginmetainfo.idlscriptable an object that contains metadata for logins stored by the login manager. this data can usually be ignored by most users of the login manager, which will create and maintain appropriate default values. 1.0 66 introduced gecko 1.9.1 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) you can specifically modify these values by passing changes into nsiloginmanager.modifylogin() using an nsipropertybag2 object as the input. metadata properties are ignored when comparing logins. attributes attribute type description guid astring the guid to uniquely identify the login. this can be any arbitrary string, but a format as created by nsiuuidgener...
nsIMemoryMultiReporter
66 introduced gecko 7.0 inherits from: nsisupports last changed in gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9) if you want to gather multiple measurements in a single operation (such as a single traversal of a large data structure), you can use a multi-reporter to do so. the callback, which must implement the nsimemorymultireportercallback interface, receives values that match the fields in the nsimemoryreporter object. in order for a multi-reporter to gather and generate reports, you need to call collectreports(). this will call the specified callback's nsimemorymultireportercallback.callback() method once for each report. this will trigger any needed computation work. note: this differs from the behavior of nsimemoryreporter, which lets all fields excep...
nsIMemoryMultiReporterCallback
in autf8string description, in nsisupports closure); methods callback() called to provide information from a multi-reporter. implement this method to handle the report information. void callback( in acstring process, in autf8string path, in print32 kind, in print32 units, in print64 amount, in autf8string description, in nsisupports closure ); parameters process the value of the process attribute for the memory reporter. path the value of the path attribute. kind the value of the kind attribute. units the value of the units attribute. amount the value of the amount attribute. description the value of the description attribute. closure an nsisupports object providing any additional data the callback might need; you pr...
nsIMemoryReporterManager
s, physical memory used). this reporter is special-cased because it is interesting, is available on all platforms, and returns a meaningful result on all common platforms. -1 means unknown. read only. methods enumeratemultireporters() returns an enumerator for looking at the installed memory multi-reporters. nsisimpleenumerator enumeratemultireporters(); parameters none. return value an enumerator of nsimemorymultireporters that are currently registered. enumeratereporters() returns an enumerator for looking at the installed memory reporters. nsisimpleenumerator enumeratereporters(); parameters none. return value an nsisimpleenumerator for enumerating installed memory reporters. init() initializes the memory reporter manager. void init(); parameters none. registermultirepor...
nsIMenuBoxObject
ed using the keyboard; otherwise false. note: for gecko 2.0, the openedwithkey attribute exists on the nsimenuboxobject_mozilla_2_0_branch interface. subsequent gecko versions will have the attribute on the nsimenuboxobject interface. methods handlekeypress() boolean handlekeypress( in nsidomkeyevent keyevent ); parameters keyevent the key event to handle for the menu. return value true if the event was handled, false if not. openmenu() void openmenu( in boolean openflag ); parameters openflag true to open the menu or false to close it. see also nsiboxobject menu ...
nsIMessageListener
o the message-sending function. json same as data. deprecated. objects an object whose properties are any cross process object wrappers exposed by the sender as the third argument to the message-sending function. principal principal for the window app. each listener is invoked with its own copy of the message parameter. when the listener is called, 'this' value is the target of the message. if the message is synchronous, the possible return value is returned as json (will be changed to use structured clones). when there are multiple listeners to synchronous messages, each listener's return value is sent back as an element in an array. undefined return values show up as undefined values in the array. ...
nsIMessageWakeupService
up-request" category. the easiest way to do this is to add the appropriate entry to the chrome manifest that registers your component (see category in "chrome registration"). to indicate a wakeup request in a manifest file, add a line that looks something like this: category wakeup-request nscomponent @mozilla.org/myservice;1,nsimyinterface,getservice,mymessage1,mymessage2[,..] the category entry value consists of a comma separate string that contains: the contract id for your component (e.g. "@mozilla.org/myservice;1"). the string name of interface to instantiate the component as (e.g. "nsimyinterface"). the method to call to instantiate the component (either "getservice" or "createinstance"). a comma-separated list of messages for which your component should be instantiated. alterna...
nsIMicrosummary
in nsimicrosummaryobserver observer ); parameters observer the microsummary observer to add. equals() microsummary equivalence test. microsummaries equal if they summarize the same page with the same microsummary-generator (see also nsimicrosummarygenerator.equals()). boolean equals( in nsimicrosummary aother ); parameters aother the microsummary to compare against. return value returns true if the microsummaries are equal. false if they aren't. note: this method returns false if either objects don't have a generator removeobserver() remove a microsummary observer from this microsummary. void removeobserver( in nsimicrosummaryobserver observer ); parameters observer the microsummary observer to remove. update() update the microsummary, first loading its ge...
nsIMicrosummarySet
rosummary observer to this microsummary set. adding an observer to a set is the equivalent of adding it to each constituent microsummary. void addobserver( in nsimicrosummaryobserver observer ); parameters observer the microsummary observer to add. enumerate() retrieve an nsisimpleenumerator of microsummaries in the set. nsisimpleenumerator enumerate(); parameters none. return value an enumerator of nsimicrosummary objects. removeobserver() remove a microsummary observer from this microsummary. void removeobserver( in nsimicrosummaryobserver observer ); parameters observer the microsummary observer to remove. see also nsimicrosummaryservice microsummary topics creating a microsummary ...
nsIMimeHeaders
ng allheaders, in long allheaderssize); attributes attribute type description allheaders string read only. ...
nsIModule
in string aloaderstr, in string atype); void unregisterself(in nsicomponentmanager acompmgr, in nsifile alocation, in string aloaderstr); methods canunload() this method may be queried to determine whether or not the component module can be unloaded by xpcom. boolean canunload( in nsicomponentmanager acompmgr ); parameters acompmgr the global component manager. return value indicates to the caller whether or not the component module can be unloaded. returning true is not a guarantee that the module will be unloaded. it constitues only willingness of the module to be unloaded. it is very important to ensure that no outstanding references to the module's code/data exist before returning true. returning false guaratees that the module will not be unloaded. if the compo...
Building an Account Manager Extension
ming. as our account manager extension is named "devmo-account", we are required to include a property named prefpanel-devmo-account. prefpanel-devmo-account=devmo demo panel step4: the new panel and javascript the javascript for an account manager panel needs to implement at least the following functions. these functions are invoked by the account manager. function onpreinit(account, accountvalues) { } function oninit(pageid, serverid) { } function onaccepteditor() { } function onsave() { } function updatepage() {} step5: putting it all together // todo build an demo extension for this tutorial... how to build an xpcom component in javascript ...
nsIMsgAccountManagerExtension
chrome package, where the files for the new panel are located. this is usually guid of the id of the addons which adds the new panel. this attribute is readonly! methods showpanel() before displaying a panel in the account manager this method is triggered. boolean showpanel( in nsimsgincomingserver server ); parameters server the account for which the panel should be displayed. return value a true indicates, that the account manager can display the panel for the given account, while false prevents the panel to be loaded. see also nsimsgaccountmanager building an account manager extension ...
nsIMsgCompFields
ipientarray splitrecipients ( in prunichar * recipients, in prbool emailaddressonly ); void convertbodytoplaintext ( ); attachment handling methods void addattachment ( in nsimsgattachment attachment ); void removeattachment ( in nsimsgattachment attachment ); void removeattachments ( ); header methods void setheader(char* name, char* value); references this interface is the type of the following properties: nsimsgcompose.compfields, nsimsgcomposeparams.composefields this interface is passed as an argument to the following methods: nsimsgcomposesecure.begincryptoencapsulation, nsimsgcomposesecure.requirescryptoencapsulation, nsimsgsend.createandsendmessage, nsimsgsend.sendmessagefile, nsismimejshelper.getnocertaddresses...
nsIMsgProtocolInfo
account type. read only. specialfoldersdeletionallowed boolean true if the user can delete folders like inbox, trash, etc. read only. methods getdefaultserverport() returns the default port for a connection to a server of this account type. long getdefaultserverport( in boolean issecure ); parameters issecure whether or not the connection will be secure. return value the default port number for connections of this account type. remarks this is one of the interfaces that is required to create a new account type. see also nsimsgincomingserver ...
nsIMsgSendLater
dd an event listener to this nsisendmsglater instance. void addlistener(in nsimsgsendlaterlistener listener); parameters listener the nsimsgsendlaterlistener to add. getunsentmessagesfolder() get the unsent messages folder for an identity. nsimsgfolder getunsentmessagesfolder(in nsimsgidentity identity); parameters identity the nsimsgidentity to get the folder for. return value the nsimsgfolder containing unsent messages. ...
nsIMutableArray
ay should not queryinterface to nsimutablearray unless they own the array. as above, it is legal to add null elements to the array. note also that null elements can be created as a side effect of insertelementat(). conversely, if insertelementat() is never used, and null elements are never explicitly added to the array, then it is guaranteed that nsiarray.queryelementat() will never return a null value. any of these methods may throw ns_error_out_of_memory when the array must grow to complete the call, but the allocation fails. method overview void appendelement(in nsisupports element, in boolean weak); void clear(); void insertelementat(in nsisupports element, in unsigned long index, in boolean weak); void removeelementat(in unsigned long index); vo...
nsINavHistoryResult
itself, potentially causing unwanted additional work. when you close the root node the result will stop observing changes, so it is good practice to close the root node when you are done with a result, since that will avoid unwanted performance hits. read only. sortingannotation autf8string the annotation to use in sort_by_annotation_* sorting modes; you must set this value before setting the sortingmode attribute. sortingmode unsigned short specifies the sorting mode for the result. this value must be one of nsinavhistoryqueryoptions.sort_by_*. changing this value updates the corresponding options for the result so that reusing the current options and queries will always return results based on the current view. suppress...
nsINetworkLinkService
inktype unsigned long the type of network connection, one of the link_type_* constants. read only. note: as of gecko 8.0, all operating systems currently return link_type_unknown. android support was backed out due to perceived security concerns, see bug 691054. as of gecko 28.0 android support is available again, see bug 939680. constants constant value description link_type_unknown 0 we were unable to determine the network connection type. link_type_ethernet 1 a standard wired ethernet connection. link_type_usb 2 a connection via a usb port. link_type_wifi 3 a connection via a wifi access point (ieee802.11). link_type_wimax 4 a connection via wimax (ieee802.16). ...
nsIPermission
criptable please add a summary to this article. last changed in gecko 2 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) inherits from: nsisupports attributes attribute type description capability pruint32 the permission to set: allow, deny, or unknown (which is the default). see nsipermissionmanager.permission_type_constants for allowed values. read only. expiretime print64 the expiration time of the permission measured in milliseconds since 1970 jan 1 0:00:00. read only. expiretype pruint32 the expiration type of the permission: on session termination, on a specified time, or never. constants are defined in nsipermissionmanager.permission_expiration_constants. read only. ...
nsIPipe
ut, in boolean nonblockingoutput, in unsigned long segmentsize, in unsigned long segmentcount, in nsimemory segmentallocator ); parameters nonblockinginput true specifies non-blocking input stream behavior. nonblockingoutput true specifies non-blocking output stream behavior. segmentsize specifies the segment size in bytes (pass 0 to use default value) segmentcount specifies the max number of segments (pass 0 to use default value). passing pr_uint32_max here causes the pipe to have "infinite" space. this mode can be useful in some cases, but should always be used with caution. the default value for this parameter is a finite value. segmentallocator pass reference to nsimemory to have all pipe allocations use this al...
nsIPlacesImportExportService
is started. "bookmarks-restore-success" is fired right after the bookmarks are successfully imported. "bookmarks-restore-failed" is fired right after a failure occurs when importing the bookmarks. observers will be passed through their data parameters either "html" if aisinitialimport is false or "html-initial" if aisinitialimport is true. the observer subject will be an nsisupportsprint64 whose value is afolder. void importhtmlfromfiletofolder( in nsilocalfile afile, in print64 afolder, in boolean aisinitialimport ); parameters afile the file to import. afolder the id of the bookmarks folder into which to import the bookmarks. aisinitialimport whether or not this is an initial import. importhtmlfromuri() obsolete since gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamon...
nsIProcessScriptLoader
o new child processes. if you used aallowdelayedload, you should call this as part of your cleanup (for example, when your add-on is disabled or uninstalled). parameters name type description aurl string url for the script to remove. getdelayedprocessscripts() returns all delayed scripts that will be loaded once a child process becomes available. the return value is a list of pairs [<url>, false]. returns list of the delayed scripts. each script is returned as a pair: [<url>, false]. ...
nsIProfileUnlocker
nsiprofileunlocker.idlscriptable returned by the nsitoolkitprofile.lock method; you can use this to attempt to force a profile to be unlocked. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview void unlock(in unsigned long aseverity); constants constant value description attempt_quit 0 politely ask the process currently holding the profile's lock to quit. force_quit 1 forcibly terminate the process holding the profile lock. methods unlock() tries to unlock the profile by attempting or forcing the process that currently holds the lock to quit. void unlock( in unsigned long aseverity ); parameters aseverity...
nsIProgrammingLanguage
xpcom/base/nsiprogramminglanguage.idlscriptable this interface provides an enumeration of programming language identifiers. inherits from: nsisupports last changed in gecko 0.9.5 constants identifiers for programming languages. constant value description unknown 0 cplusplus 1 c++ javascript 2 javascript python 3 python perl 4 perl java 5 java zx81_basic 6 zx81 basic javascript2 7 javascript 2 ruby 8 ruby php 9 php tcl 10 tcl max 10 this will be kept at the largest index. ...
nsIProperty
xpcom/ds/nsiproperty.idlscriptable please add a summary to this article. inherits from: nsisupports last changed in gecko 1.7 attributes attribute type description name astring get the name of the property. read only. value nsivariant get the value of the property. read only. ...
nsIPropertyBag
rface is used to store a set of properties. inherits from: nsisupports last changed in gecko 1.0 method overview nsivariant getproperty(in astring name); attributes attribute type description enumerator nsisimpleenumerator get a nsisimpleenumerator whose elements are nsiproperty objects. read only. methods getproperty() get a property value for the given name. nsivariant getproperty( in astring name ); parameters name the name to return the matching property. return value the property matching the given name. exceptions thrown ns_error_failure if a property with that name doesn't exist. examples get user agent information (operating system specifics. the window scope is not always accessible so the window.naviga...
nsIPropertyElement
xpcom/ds/nsipersistentproperties2.idlscriptable this interface provides access to individual entries within a stringbundle. inherits from: nsisupports last changed in gecko 1.0 attributes attribute type description key autf8string the key used to refer to this property. value astring the string value stored for this property. see also xul tutorial:property files ...
nsIProtocolProxyFilter
service, in nsiuri auri, in nsiproxyinfo aproxy ); parameters aproxyservice a reference to the protocol proxy service. this is passed so that implementations may easily access methods such as newproxyinfo. auri the uri for which these proxy settings apply. aproxy the proxy (or list of proxies) that would be used by default for the given uri. this may be null. return value the proxy (or list of proxies) that should be used in place of aproxy. this can be just be aproxy if the filter chooses not to modify the proxy. it can also be null to indicate that a direct connection should be used. use aproxyservice.newproxyinfo to construct nsiproxyinfo objects. see also nsiproxyinfo nsiprotocolproxyservice ...
nsISSLErrorListener
see also nsisockettransport ...
nsISelectionImageService
layout/base/nsiselectionimageservice.idlnot scriptable please add a summary to this article. inherits from: nsisupports last changed in gecko 1.7 method overview void getimage(in short selectionvalue, out imgicontainer container); void reset(); methods getimage() retrieve the image for alpha blending. void getimage( in short selectionvalue, out imgicontainer container ); parameters selectionvalue container reset() the current image is marked as invalid. void reset(); parameters none. ...
nsIServerSocketListener
port. onstoplistening() this method is called when the listening socket stops for some reason. the server socket is effectively dead after this notification. void onstoplistening( in nsiserversocket aserv, in nsresult astatus ); parameters aserv the server socket. astatus the reason why the server socket stopped listening. if the server socket was manually closed, then this value will be ns_binding_aborted. see also nsiserversocket nsisockettransport ...
nsISmsService
omstring which can either be "received" or "sent" and is representing the way the sms was delivered. sender a domstring with the name of the sender. receiver a domstring with the name of the receiver. body a domstring with the text of the message. timestamp a date object with the timestamp of the message. read a boolean indicating whether a message is marked as read or unread. return value a smsmessage getnumberofmessagesfortext() unsigned short getnumberofmessagesfortext( in domstring text ); parameters text a domstring text to check. return value the number of multi-part sms needed for a given text (160 characters for one sms). hassupport() checks if the current platform has sms support. boolean hassupport(); return value boolean. send() void send( in doms...
nsISocketProvider
when set, the hostname parameter passed in this interface will be used instead of the address structure passed for a later request. anonymous_connect 1 << 1 when setting this flag, the socket will not apply any credentials when establishin...
nsISocketProviderService
see also nsisocketprovider nsiservicemanager ...
nsISocketTransportService
ral of the peer for this socket. aport specifies the target port of the peer for this socket. aproxyinfo specifies the transport-layer proxy type to use. set to null if no proxy should be used. for more details on communicating information about proxies like socks (which are transparent to upper protocols), see nsiproxiedprotocolhandler , nsiprotocolproxyservice or proxies in necko. return value an nsisockettransport containing the sockettransport. init() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) void init(); parameters none. native code only! notifywhencanattachsocket if the number of sockets reaches the limit, then consumers can be notified when the number of sockets becomes less than the limit. the notification is asynchronous, delivered via t...
nsISound
event_alert_dialog_open 1 an alert dialog is opened. event_confirm_dialog_open 2 a confirm dialog is opened. event_prompt_dialog_open 3 a prompt dialog (one that allows the user to enter data, such as an authentic...
nsIStackFrame
g the name of the function at this point in the stack. read only. sourceline string the location of this function in filename read only. example to output the stack at a particular location: var s = components.stack; while(s) { console.log(s.name); s = s.caller; } methods tostring() a generic formatter - make it suitable to print, and so forth. string tostring(); parameters none. return value a string suitable for output. see also jsdistackframe ...
nsIStandardURL
ultport, in autf8string aspec, in string aorigincharset, in nsiuri abaseuri); attributes attribute type description mutable boolean control whether or not this url can be modified. protocol handlers can set this flag before handing out an url to ensure that it is not inadvertently modified. obsolete since gecko 1.9 constants these constants describe how to normalize an url. ...
nsIStreamConverter
onvert( in nsiinputstream afromstream, in string afromtype, in string atotype, in nsisupports actxt ); parameters afromstream the stream representing the original/raw data. afromtype the mime type of afromstream. atotype the mime type of the returned stream. actxt either an opaque context, or a converter specific context (implementation specific). return value the converted stream. note: the returned stream may not already be converted. an efficient stream converter implementation will converter data on demand rather than buffering the converted data until it is used. ...
nsIStreamListener
as the argument to this method. note: your implementation of this method must read exactly acount bytes of data before returning. void ondataavailable( in nsirequest arequest, in nsisupports acontext, in nsiinputstream ainputstream, in unsigned long aoffset, in unsigned long acount ); parameters arequest an nsirequest indicating the source of the data. acontext a user-defined context value. ainputstream an nsiinputstream from which the data is to be read. aoffset number of bytes that were sent in previous ondataavailable() calls for this request. in other words, the sum of all previous count parameters. if that number is greater than or equal to 2^32, this parameter will be pr_uint32_max (2^32 - 1). acount the number of bytes available for reading. you must read all of these bytes ...
nsIStructuredCloneContainer
rsion of the structured clone algorithm which was used to generate this container's serialized buffer. read only. serializednbytes unsigned long long get the size in bytes of this container's serialized data. read only. methods deserializetovariant() deserialize the object this container holds, returning it wrapped as an nsivariant. nsivariant deserializetovariant(); parameters none. return value an nsivariant. getdataasbase64() get this structured clone container's data as a base-64-encoded string. astring getdataasbase64(); parameters none. return value a base-64-encoded string. initfrombase64() initialize this structured clone container from a base-64-encoded byte stream. void initfrombase64( in astring adata, in unsigned long aformatversion ); parameters adata a base-64-encoded...
nsISupportsCString
scriptable this interface provides scriptable access for ascii character strings. inherits from: nsisupportsprimitive last changed in gecko 1.2 method overview string tostring(); attributes attribute type description data acstring provides access to the native type represented by the object. methods tostring() this methods returns a string valued representation of the object. string tostring(); parameters none. return value a string valued representation of the object. remarks this interface was frozen for gecko 1.2. see bug 166426 for details. from gecko 2.0 interfaces are no longer frozen. ...
nsISupportsChar
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for single character values (often used to store an ascii character). inherits from: nsisupportsprimitive last changed in gecko 1.2 method overview string tostring(); attributes attribute type description data char provides access to the native type represented by the object. methods tostring() this methods returns a string valued representation of the object. string tostring(); parameters none. return value a string valued representation of the object. remarks this interface was frozen for gecko 1.2. see bug 166426 for details. from gecko 2.0 interfaces are no longer frozen. ...
nsISupportsDouble
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for double-precision floating-point values. inherits from: nsisupportsprimitive last changed in gecko 1.2 method overview string tostring(); attributes attribute type description data double provides access to the native type represented by the object. methods tostring() this methods returns a string valued representation of the object. string tostring(); parameters none. return value a string valued representation of the object. remarks this interface was frozen for gecko 1.2. see bug 166426 for details. from gecko 2.0 interfaces are no longer frozen. ...
nsISupportsFloat
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for single-precision floating-point values. inherits from: nsisupportsprimitive last changed in gecko 1.2 method overview string tostring(); attributes attribute type description data float provides access to the native type represented by the object. methods tostring() this methods returns a string valued representation of the object. string tostring(); parameters none. return value a string valued representation of the object. remarks this interface was frozen for gecko 1.2. see bug 166426 for details. from gecko 2.0 interfaces are no longer frozen. ...
nsISupportsInterfacePointer
this interface provides scriptable access for xpcom objects. inherits from: nsisupportsprimitive last changed in gecko 1.2 method overview string tostring(); attributes attribute type description data nsisupports provides access to the native type represented by the object. dataiid nsidptr stores an iid corresponding to the data attribute. methods tostring() returns a string valued representation of the object. string tostring(); parameters none. return value a string valued representation of the object. remarks this interface was frozen for gecko 1.2. see bug bug 166426 for details. from gecko 2.0 interfaces are no longer frozen. ...
nsISupportsPRBool
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for boolean values. inherits from: nsisupportsprimitive last changed in gecko 1.2 method overview string tostring(); attributes attribute type description data prbool provides access to the native type represented by the object. methods tostring() this methods returns a string valued representation of the object. string tostring(); parameters none. return value a string valued representation of the object. remarks this interface was frozen for gecko 1.2. see bug 166426 for details. from gecko 2.0 interfaces are no longer frozen. ...
nsISupportsPRInt16
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for 16-bit signed integers. inherits from: nsisupportsprimitive last changed in gecko 1.2 method overview string tostring(); attributes attribute type description data print16 provides access to the native type represented by the object. methods tostring() this methods returns a string valued representation of the object. string tostring(); parameters none. return value a string valued representation of the object. remarks this interface was frozen for gecko 1.2. see bug 166426 for details. from gecko 2.0 interfaces are no longer frozen. ...
nsISupportsPRInt32
iptable this interface provides scriptable access for 32-bit signed integers. 66 introduced gecko 1.0 inherits from: nsisupportsprimitive last changed in gecko 1.2 method overview string tostring(); attributes attribute type description data print32 provides access to the native type represented by the object. methods tostring() this methods returns a string valued representation of the object. string tostring(); parameters none. return value a string valued representation of the object. remarks this interface was frozen for gecko 1.2. see bug 166426 for details. from gecko 2.0 interfaces are no longer frozen. ...
nsISupportsPRInt64
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for 64-bit signed integers. inherits from: nsisupportsprimitive last changed in gecko 1.2 method overview string tostring(); attributes attribute type description data print64 provides access to the native type represented by the object. methods tostring() this methods returns a string valued representation of the object. string tostring(); parameters none. return value a string valued representation of the object. remarks this interface was frozen for gecko 1.2. see bug 166426 for details. from gecko 2.0 interfaces are no longer frozen. ...
nsISupportsPRUint16
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for 16-bit unsigned integers. inherits from: nsisupportsprimitive last changed in gecko 1.2 method overview string tostring(); attributes attribute type description data pruint16 provides access to the native type represented by the object. methods tostring() this methods returns a string valued representation of the object. string tostring(); parameters none. return value a string valued representation of the object. remarks this interface was frozen for gecko 1.2. see bug 166426 for details. from gecko 2.0 interfaces are no longer frozen. ...
nsISupportsPRUint32
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for 32-bit unsigned integers. inherits from: nsisupportsprimitive last changed in gecko 1.2 method overview string tostring(); attributes attribute type description data pruint32 provides access to the native type represented by the object. methods tostring() this methods returns a string valued representation of the object. string tostring(); parameters none. return value a string valued representation of the object. remarks this interface was frozen for gecko 1.2. see bug 166426 for details. from gecko 2.0 interfaces are no longer frozen. ...
nsISupportsPRUint64
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for 64-bit unsigned integers. inherits from: nsisupportsprimitive last changed in gecko 1.2 method overview string tostring(); attributes attribute type description data pruint64 provides access to the native type represented by the object. methods tostring() this methods returns a string valued representation of the object. string tostring(); parameters none. return value a string valued representation of the object. remarks this interface was frozen for gecko 1.2. see bug 166426 for details. from gecko 2.0 interfaces are no longer frozen. ...
nsISupportsPRUint8
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for 8-bit unsigned integers. inherits from: nsisupportsprimitive last changed in gecko 1.2 method overview string tostring(); attributes attribute type description data pruint8 provides access to the native type represented by the object. methods tostring() this methods returns a string valued representation of the object. string tostring(); parameters none. return value a string valued representation of the object. remarks this interface was frozen for gecko 1.2. see bug 166426 for details. from gecko 2.0 interfaces are no longer frozen. ...
nsISupportsPrimitive
xpcom/ds/nsisupportsprimitives.idlscriptable this interface serves as a base interface for all of the nsisupports* family of interfaces. inherits from: nsisupports last changed in gecko 1.7 attributes attribute type description type unsigned short this attribute provides access to the type represented by the nsisupportsprimitive instance. constants constant value description type_id 1 corresponding to nsisupportsid. type_cstring 2 corresponding to nsisupportscstring. type_string 3 corresponding to nsisupportsstring. type_prbool 4 corresponding to nsisupportsprbool. type_pruint8 5 corresponding to nsisupportspruint8. type_pruint16 6 corresponding to nsisupportspruint16. type_pruint32 7 corresponding to nsisupportspruint32. type_pruint64 8 corresponding ...
nsISupportsString
criptable this interface provides scriptable access for unicode character strings. inherits from: nsisupportsprimitive last changed in gecko 1.2 method overview string tostring(); attributes attribute type description data astring provides access to the native type represented by the object. methods tostring() this methods returns a string valued representation of the object. string tostring(); parameters none. return value a string valued representation of the object. remarks this interface was frozen for gecko 1.2. see bug 166426 for details. from gecko 2.0 interfaces are no longer frozen. ...
nsISupportsVoid
riptable this interface provides scriptable access for generic pointers. inherits from: nsisupportsprimitive last changed in gecko 1.0 method overview string tostring(); attributes attribute type description data voidptr this attribute provides access to the native type represented by the object. native code only! methods tostring() string tostring(); parameters none. return value a string valued representation of the object. ...
nsISupportsWeakReference
ances of nsiweakreference. weak references in this scheme can only be produced for objects that implement this interface. inherits from: nsisupports last changed in gecko 1.7 method overview nsiweakreference getweakreference(); methods getweakreference() produces an appropriate instance of nsiweakreference. nsiweakreference getweakreference(); parameters none. return value the resulting nsiweakreference instance. remarks the xpcom glue library provides nssupportsweakreference, a canonical implementation of nsisupportsweakreference. this interface was frozen for gecko 0.9.9. see bug 48726 for details. from gecko 2.0 interfaces are no longer frozen. see also nsiweakreference nssupportsweakreference ...
nsISyncMessageSender
jsval sendrpcmessage([optional] in astring messagename, [optional] in jsval obj, [optional] in jsval objects, [optional] in nsiprincipal principal); sendsyncmessage() like sendasyncmessage(), except blocks the sender until all listeners of the message have been invoked. returns an array containing return values from each listener invoked. send messagename and obj to the "other side" of this message manager. this invokes listeners who registered for messagename using a nsimessagelistenermanager. see nsimessagelistener::receivemessage() for the format of the data delivered to listeners. throws ns_error_not_initialized if the sender is not initialized. for example, we will throw ns_error_not_initia...
nsITXTToHTMLConv
ble this interface allows you to modify the conversion from plain text to html. inherits from: nsistreamconverter last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) implemented by "@mozilla.org/streamconv;1?from=text/plain&to=text/html". you should normally obtain an instance via the nsistreamconverterservice interface. method overview void preformathtml(in boolean value); void settitle(in wstring text); prior versions of the interface named the methods using the initialcaps style instead of the intercaps style. methods preformathtml() specifies whether or not to wrap the resulting html in an <pre> block. void preformathtml( in boolean value ); parameters value true to wrap the resulting html in a <pre> block. settitle() sets the title to use on the r...
nsITaskbarPreview
terface for details on which controller methods are used. tooltip domstring a string containing the text displayed in the tooltip above the preview when the user hovers over it. by default, this is an empty string. visible boolean indicates whether or not the preview is visible; by default, this is false. note: changing this value is computationally expensive for tab previews, because doing so causes the proxy window to be destroyed and rebuilt, then re-registered with the taskbar. if any step of that process fails, an exception is thrown. for window previews, changing this value is computationally trivial. methods invalidate() invalidates the taskbar's cached image of the preview, forcing a redraw if necessary. v...
nsITaskbarTabPreview
is not registered, the api call to set its sibling (via the move() method) will fail silently. this method is only invoked when it's safe to make taskbar api calls. void ensureregistration(); parameters none. violates the xpcom interface guidelines gethwnd() used internally to obtain the handle to the proxy window for the preview. nativewindow gethwnd(); parameters none. return value the hwnd for the preview's proxy window. move() relocates the preview relative to another tab preview from the same window. void move( in nsitaskbartabpreview anext ); parameters anext the preview that this preview should be placed to the left of. a value of null indicates that this preview should be the rightmost one. see also nsitaskbarpreview nsitaskbarpreviewcontroller nsit...
nsITextInputProcessorCallback
otherwise, false. ...
nsIThreadEventFilter
methods violates the xpcom interface guidelines acceptevent() this method is called to determine whether or not an event may be accepted by a nested event queue. (see nsithreadinternal.pusheventqueue()) warning: this method must not make any calls on the thread object. boolean acceptevent( in nsirunnable event ); parameters event the event being dispatched. return value implement this method to return true if the event is accepted, or false to reject it. see also the thread manager nsithreadmanager nsithread nsithreadpool nsithreadobserver nsithreadinternal ...
nsIThreadManager
mainthread nsithread the main thread. read only. methods native code only!getthreadfromprthread given a prthread, this method returns the corresponding nsithread. returns null if there isn't a corresponding nsithread. nsithread getthreadfromprthread( in prthread prthread ); parameters prthread the prthread for which to retrieve the corresponding nsithread. return value the nsithread matching the specified prthread, or null if there is no matching nsithread. newthread() create a new thread. internally, this is a global user prthread. nsithread newthread( in unsigned long creationflags ); parameters creationflags reserved for future use. pass 0. return value the newly created nsithread. see also the thread manager nsithread nsithreadpool nsi...
nsIThreadPool
ener and releases it when the shutdown() method is called. threads created after the listener is set will also take ownership of the listener so that the listener will be kept alive long enough to receive the guaranteed nsithreadpoollistener.onthreadshuttingdown() notification. threadlimit unsigned long the maximum number of threads allowed at once in the pool; you may change this value by altering this attribute. methods shutdown() shuts down the thread pool. you must not call this method from any thread within the thread pool. instead, you should call it from another thread (typically the one that created the thread pool). when this method returns, the thread pool and all its threads will have been shut down, and it is no longer be possible to dispatch events to the...
nsITimer
t a one-shot timer. target nsieventtarget the nsieventtarget to which the callback is dispatched. this target must be set before calling any of the initialization methods. type unsigned long defines the timer type: one shot, repeating slack or repeating precise. must be one of the constants defined under constants on this page. constants constant value description type_one_shot 0 type of a timer that fires once only. type_repeating_slack 1 after firing, the timer is stopped and not restarted until its callback completes. the timer period will ideally be at least the time between when processing for last firing the callback completes and when the next firing occurs, but note that this is not guaranteed: the ...
nsIToolkitProfile
hods. nsiprofilelock lock( out nsiprofileunlocker aunlocker ); parameters aunlocker on error, contains an nsiprofileunlocker object you can use to unlock the profile. note: the unlocker object cannot be returned to javascript as the error causes an exception to be thrown. the unlocker object is only available in gecko 34 or later when running on windows vista or later. return value an nsiprofilelock object which holds a profile lock as long as you hold a reference to it. example: var profile = profilelist.getnext().queryinterface(ci.nsitoolkitprofile); var locker = profile.lock({}); remove() removes the profile from the registry of profiles. void remove( in boolean removefiles ); parameters removefiles indicates whether or not the profile directory should be r...
nsITraceableChannel
nsistreamlistener setnewlistener(in nsistreamlistener alistener); methods setnewlistener() replaces the channel's current listener with a new one, returning the listener previously assigned to the channel. nsistreamlistener setnewlistener( in nsistreamlistener alistener ); parameters alistener an nsistreamlistener to be notified of events on the http channel. return value the previous listener for the channel. each listener call through to the previous listener for every call, in order to establish a call chain to allow all interested parties a chance to act on each event. implementing nsistreamlistener the nsistreamlistener passed to setnewlistener() should implement the following methods, which are called to notify it of events that occur on the http stream: ...
nsITransportEventSink
ansport, in nsresult astatus, in unsigned long long aprogress, in unsigned long long aprogressmax ); parameters atransport the transport sending this status notification. astatus the transport status (resolvable to a string using nsierrorservice). see nsisockettransport for socket specific status codes and more comments. aprogress the amount of data either read or written depending on the value of the status code. this value is relative to aprogressmax. aprogressmax the maximum amount of data that will be read or written. if unknown, 0xffffffff will be passed. see also nsitransport nsisockettransport ...
nsITransportSecurityInfo
e provides information about transport security, including the security state and any error message for the connection. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) attributes attribute type description errormessage wstring error message on connection failure. read only. securitystate unsigned long a flag detailing the security state of the connection. the possible values are defined in nsiwebprogresslistener. read only. shortsecuritydescription wstring for secure connections (ssl) gives the common name (cn) of the certifying authority. read only. see also nsisockettransport ...
nsITreeContentView
titematindex(in long index); attributes attribute type description root nsidomelement the element in the dom which this view uses as root content. read only. obsolete since gecko 1.8 methods getindexofitem() retrieve the index associated with the specified content item. long getindexofitem( in nsidomelement item ); parameters item a tree row for which to find the row index. return value a non-negative integer row index if the row was found within the tree. returns -1 if the item was not found. getitematindex() retrieve the content item associated with the specified index. nsidomelement getitematindex( in long index ); parameters index the row index for which to get the item return value the nsidomelement item. remarks the nsitreecontentview interface only applies to trees w...
nsIURLParser
athlen); void parseuserinfo(in string userinfo, in long userinfolen, out unsigned long usernamepos, out long usernamelen, out unsigned long passwordpos, out long passwordlen); methods the string to parse in the methods may be given as a null terminated string, in which case the length argument should be -1. 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 components: username, password, hostname, and hostport. auth = <username>:<password>@<hostname>:<port> void parseauthori...
nsIUUIDGenerator
enerator;1"] .getservice(components.interfaces.nsiuuidgenerator); method overview nsidptr generateuuid(); void generateuuidinplace(in nsnonconstidptr id); native code only! methods generateuuid() obtains a new uuid using appropriate platform-specific methods to obtain a nsid that can be considered to be globally unique. nsidptr generateuuid(); parameters none. return value this method returns a nsidptr containing a unique id. exceptions thrown ns_error_failure if a uuid cannot be generated (for example if an underlying source of randomness is not available) native code only!generateuuidinplace obtain a new uuid like the generateuuid() method, but place it in the provided nsid pointer instead of allocating a new nsid. void generateuuidinplace( in nsnonconstidptr...
nsIUpdateManager
. this update is not in the history list. read only. updatecount long the number of updates in the history list; the updates can be fetched by calling getupdateat(). read only. methods getupdateat() returns the update at the specified index into the history list. nsiupdate getupdateat( in long index ); parameters index an index into the history list for the nsiupdate to retrieve. return value the nsiupdate at the specified index into the history list. saveupdates() saves all updates to disk. void saveupdates(); parameters none. see also nsiupdate nsiupdatechecklistener nsiupdatechecker nsiupdatepatch nsiapplicationupdateservice nsiupdateprompt nsiupdatetimermanager ...
nsIUploadChannel
n nsiinputstream astream, in acstring acontenttype, in long acontentlength ); parameters astream the stream to be uploaded by this 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. acontentlength a value of -1 indicates that the length of the stream should be determined by calling the stream's available method. ...
nsIUrlListManagerCallback
toolkit/components/url-classifier/public/nsiurllistmanager.idlscriptable interface for a class that manages updates of the url classifier database. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview void handleevent(in acstring value); methods handleevent() void handleevent( in acstring value ); parameters value ...
nsIUserCertPicker
lowinvalid, in boolean allowduplicatenicknames, out boolean canceled); methods pickbyusage() nsix509cert pickbyusage( in nsiinterfacerequestor ctx, in wstring selectednickname, in long certusage, in boolean allowinvalid, in boolean allowduplicatenicknames, out boolean canceled ); parameters ctx selectednickname certusage allowinvalid allowduplicatenicknames canceled return value ...
nsIWebBrowserChrome2
. this method may be called instead of nsiwebbrowserchrome.setstatus(). an implementor of this method, should still implement nsiwebbrowserchrome.setstatus(). void setstatuswithcontext( in unsigned long statustype, in astring statustext, in nsisupports statuscontext ); parameters statustype indicates what is setting the text. statustext status string. null is an acceptable value meaning no status. statuscontext an object that provides context pertaining to the status type. if statustype is status_link, then this may be a dom node corresponding to the source of the link. this value can be null if there is no context. see also nsiwebbrowserchrome ...
nsIWebBrowserChrome3
linktraversal() determines the appropriate target for a link. astring onbeforelinktraversal( in astring originaltarget, in nsiuri linkuri, in nsidomnode linknode, in prbool isapptab ); parameters originaltarget the original link target. linkuri link destination uri. linknode link dom node. isapptab whether or not the link is in an application tab. return value a new link target, if appropriate. otherwise returns originaltarget. see also nsiwebbrowserchrome2 ...
nsIWebBrowserFind
see also nsiwebbrowserfindinframes ...
nsIWebContentHandlerRegistrar
ss the domwindow and the registerprotocolhandler will get the contentwindow from it nsiwchr.registerprotocolhandler("mailto", "http://mail.live.com/secure/start?action=compose&to=%s", "outlook.com live mail", htmlcontentwindow); if (!allowregisterfromdifferenthost) { //it this variable is false, than we had set the pref to true obviously. so lets restore it back to false, which is the default value services.prefs.clearuserpref('gecko.handlerservice.allowregisterfromdifferenthost'); } register a webmail service as mailto handler without contentwindow under construction. to take from: http://mxr.mozilla.org/mozilla-release/source/browser/components/feeds/src/webcontentconverter.js#372 and http://stackoverflow.com/questions/24900655/use-registerprotocolhandler-without-contentwindow place...
nsIWebSocketListener
()() will be delievered to the listener after onserverclose() is called, but outgoing messages can still be sent through the nsiwebsocketchannel connection. void onserverclose( in nsisupports acontext, in unsigned short acode, in autf8string areason ); parameters acontext user defined context. acode the websocket closing handshake status code; see status codes for possible values. areason a text string explaining the reason for the closure of the connection. onstart() called to signify the establishment of the message stream. any listener that receives onstart() will also receive onstop(). void onstart( in nsisupports acontext ); parameters acontext user defined context. onstop() called to signify the completion of the message stream. this is the fi...
nsIWebappsSupport
parameters title the user-friendly name of the application. uri the uri of the web application. iconuri the uri of icon of the web application. icondata a base64 encoded representation of the application's icon. isapplicationinstalled() checks is a web application is already installed. boolean isapplicationinstalled( in wstring uri ); parameters uri the uri of the web application. return value true if the web application is installed, false if it's not installed. ...
nsIWifiListener
see also monitoring wifi access points nsiwifimonitor nsiwifiaccesspoint ...
nsIWinAccessNode
c/msaa/nsiwinaccessnode.idlnot scriptable 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 voidptr querynativeinterface([const] in mscomiidref aiid); methods querynativeinterface() voidptr querynativeinterface( [const] in mscomiidref aiid ); parameters aiid return value ...
nsIWindowCreator
see also nsiwindowwatcher for more details. ...
nsIWorkerFactory
see also using web workers worker sharedworker ...
nsIWorkerScope
close(); attributes attribute type description onclose nsidomeventlistener a listener object to be called when the worker stops running. onmessage nsidomeventlistener a listener object to be called when a message is posted on the port. the message is in the event's data member. methods close() allows the worker to terminate itself. if a listener has been established by setting the value of the onclose attribute, it gets called. void close(); parameters none. postmessage() posts a message to the scope's parent worker object. void postmessage( in domstring amessage, in nsiworkermessageport amessageport optional ); parameters amessage the message to post. it will be stored as the data member in the event. amessageport optional specifies the message port onto which to post th...
nsIXFormsModelElement
extensions/xforms/nsixformsmodelelement.idlscriptable defines scriptable methods for manipulating instance data and updating computed and displayed values. 1.0 66 introduced gecko 1.8 obsolete gecko 1.9.1 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview nsidomdocument getinstancedocument(in domstring instanceid); void rebuild(); void recalculate(); void refresh(); void revalidate(); methods getinstancedocument() nsidomdocument getinstancedocument( in domstring instanceid ); parameters instanceid the id of the instance element to be returned. return value an nsidomdocument. exceptions thrown domexception if there is no matching instance data. rebuild() signals th...
nsIXPCException
val(in xpcexjscontextptr cx, in xpcexjsval val); native code only! methods initialize() void initialize( in string amessage, in nsresult aresult, in string aname, in nsistackframe alocation, in nsisupports adata, in nsiexception ainner ); parameters amessage aresult aname alocation adata ainner native code only!stealjsval xpcexjsval stealjsval(); parameters none. return value native code only!stowjsval void stowjsval( in xpcexjscontextptr cx, in xpcexjsval val ); parameters cx val remarks components.exception is a javascript constructor to create nsixpcexception objects. the call signature of the constructor is: components.exception(message, result, stack, data, inner) all parameters are optional and the appropriate placeholder is 'unknown'. message - a c...
nsIXULAppInfo
name of the application vendor. this must be ascii, and is normally mixed-case, for example "mozilla". can be an empty string if vendor is not set. read only. version acstring the xul application's version, for example "0.8.0+" or "3.7a1pre". it is different than the version of gecko or the xulrunner platform. be careful about which one you want! can be an empty string, but a valid value is required for xul applications using the extension manager or update service. read only. example display the application and the gecko version in an alert box: var info = components.classes["@mozilla.org/xre/app-info;1"] .getservice(components.interfaces.nsixulappinfo); alert("application version: " + info.version + "\n" + "gecko version: " + info.platformversion); example...
nsIXULBrowserWindow
g onbeforelinktraversal( in astring originaltarget, in nsiuri linkuri, in nsidomnode linknode, in prbool isapptab ); parameters originaltarget the specified target for the link. linkuri the uri of the link that is about to be traversed. linknode the nsidomnode representing the dom node in which the link is located. isapptab whether or not the link being clicked is in an app tab. return value a string indicating the revised target for the link. setjsdefaultstatus() sets the default status according to javascript's version of the default status. void setjsdefaultstatus( in astring status ); parameters status the status string. setjsstatus() sets the status according to javascript's version of the status. void setjsstatus( in astring status ); parameters status the status strin...
nsIXULRuntime
ble. read only. xpcomabi autf8string a string tag identifying the binary abi of the current processor and compiler vtable. this is taken from the target_xpcom_abi configure variable. it may not be available on all platforms, especially unusual processor or compiler combinations. the result takes the form <processor>-<compilerabi>, for example: x86-msvc ppc-gcc3. this value should almost always be used in combination with os. may throw ns_error_not_available. read only. constants process type constants constant value description process_type_default 0 the default (chrome) process. process_type_plugin 1 a plugin subprocess. process_type_content 2 a content subprocess. process_type_...
nsIXmlRpcClient
t8, nsisupportspruint16, nsisupportsprint16, nsisupportsprint32: i4, nsisupportsprbool: boolean, nsisupportschar, nsisupportscstring: string, nsisupportsfloat, nsisupportsdouble: double, nsisupportsprtime: datetime.iso8601, nsiinputstream: base64, nsisupportsarray: array, nsidictionary: struct note that both nsisupportsarray and nsidictionary can only hold any of the supported input types. return value will be converted as follows: i4 or int: nsisupportsprint32 boolean: nsisupportsprbool string: nsisupportscstring double: nsisupportsdouble datetime.iso8601: nsisupportsprtime base64: nsisupportscstring array: nsisupportsarray struct: nsidictionary faults (server side errors) are indicated by returning ns_error_failure. via nsixpconnect::getpendingexception()->data a nsixmlrpcfault object can be ...
nsIZipEntry
read only. ...
nsMsgSearchTerm
defined in comm-central/ mailnews/ base/ search/ public/ nsmsgsearchcore.idl use this to specify the value of a search term [ptr] native nsmsgsearchterm(nsmsgsearchterm); // please note the ! at the start of this macro, which means the macro // needs to enumerate the non-string attributes. %{c++ #define is_string_attribute(_a) \ (!(_a == nsmsgsearchattrib::priority || _a == nsmsgsearchattrib::date || \ _a == nsmsgsearchattrib::msgstatus || _a == nsmsgsearchattrib::messagekey || \ _a == nsmsgsearchattrib::size || _a == nsmsgsearchattrib::ageindays || \ _a == nsmsgsearchattrib::folderinfo || _a == nsmsgsearchattrib::location || \ _a == nsmsgsearchattrib::label || _a == nsmsgsearchattrib::junkstatus || \ _a == nsmsgsearchattrib::folderflag || _a == nsmsgsearchattrib::uint3...
NS ENSURE TRUE
summary macro returns return-value if expr evaluates to false. syntax ns_ensure_true( expr, return-value ); usage nsresult mozmyclass::mozstringmucking() { char *foo = new char[123]; ns_ensure_true(foo, ns_error_out_of_memory); // this is equivalent to doing: if (!foo) return ns_error_out_of_memory; // thou shalt not return ns_error_failure.. int i = 3; ns_ensure_true(i == 3, ns_error_failure); return ns_ok; } char* mozmyclass::dostuff() { char* bar = new char[321]; ns_ensure_true(bar, nsnull); return bar; } ...
XPCOM Interface Reference by grouping
nsiaccessibledocument nsiaccessibleeditabletext nsiaccessibleevent nsiaccessiblehyperlink nsiaccessiblehypertext nsiaccessibleimage nsiaccessibleprovider nsiaccessibleretrieval nsiaccessiblerole nsiaccessiblescrolltype nsiaccessibleselectable nsiaccessiblestates nsiaccessibletable nsiaccessibletext nsiaccessibletreecache nsiaccessiblevalue nsiaccessnode nsisyncmessagesender script nsiscriptableunescapehtml nsiscriptableunicodeconverter nsiscripterror nsiscripterror2 stylesheet nsistylesheetservice url nsiuri nsiurl util nsidomserializer nsidomxpathevaluator nsidomxpathexception nsidomxpathexpression nsidomxpathresult xslt nsixsltexce...
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 adatalength = pr_uint32_max ); parameters astring [in] a nsacstring instance to be modified. adata [in] a raw character array to copy into this string. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null-terminated. return values the ns_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_CStringCloneData
« xpcom api reference summary the ns_cstringclonedata function returns a null-terminated, heap allocated copy of the string's internal buffer. #include "nsstringapi.h" char* ns_cstringclonedata( const nsacstring& astring ); parameters astring [in] a nsacstring instance whose data is to be cloned. return values the ns_cstringcutdata function returns a pointer to a null-terminated, heap allocated buffer on success. on failure it returns nsnull. the resulting buffer may be freed by calling nsmemory::free. history this function was frozen for mozilla 1.7. see bug 239716 for details. see also nsmemory::free, nsacstring ...
NS_CStringContainerInit
otherwise, it returns an error code. ...
NS_CStringCutData
nsacstring& astring, pruint32 acutstart, pruint32 acutlength ); parameters astring [in] a nsacstring instance to be modified. acutstart [in] the starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. 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 . example code nscstringcontainer str; ns_cstringcontainerinit(str); ns_cstringsetdata(str, "hello world"); // remove " world" portion of string ns_cstringcutdata(str, 5, pr_uint32_max); const char* da...
NS_CStringGetData
etdata( const nsacstring& astring, const char** adata, prbool* aterminated = nsnull ); parameters astring [in] a nsacstring instance to inspect. adata [out] a const pointer to the string's internal buffer. aterminated [out] this optional result parameter indicates whether or not adata is null-terminated. it may be null if the caller is not interested in this information. return values the ns_cstringgetdata function returns the length of adata, measured in storage units (bytes). example code // count the number of times a particular character appears in a string. pruint32 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) ...
NS_CStringGetMutableData
32 ns_cstringgetmutabledata( nsacstring& astring, pruint32 adatalength, char** adata ); parameters astring [in] a nsacstring instance to modify. adatalength [in] the number of characters to resize the string's internal buffer to or pr_uint32_max to return the buffer as-is. adata [out] upon return, if the function was successful, then *adata references the string's internal buffer. return values this function returns the number of characters contained in the string's internal buffer (excluding any null-terminator). this value will be zero if the function failed to resize its internal buffer to the size requested. remarks this function provides mutable access to a string's internal buffer. it returns a pointer to the first element of an array of characters that may be modified in-place. ...
NS_CStringSetData
cstring& astring, const char* adata, pruint32 adatalength = pr_uint32_max ); parameters astring [in] a nsacstring instance to modify. adata [in] a raw character array to copy into this string. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null-terminated. return values the ns_cstringsetdata function returns ns_ok if successful. otherwise, it returns an error code. example nscstringcontainer str; rv = ns_cstringcontainerinit(str); if (ns_succeeded(rv)) { rv = ns_cstringsetdata(str, "hello world"); if (ns_succeeded(rv)) { // now, pass |str| to some function expecting a |const nsacstring&| parameter. } ns_cstringcontainerfinish(str); } history...
NS_CStringSetDataRange
ndex of the section to replace, measured in storage units. acutlength [in] the length of the section to replace, measured in storage units. adata [in] a raw character array to copy into this string. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. return values the ns_cstringsetdatarange function returns ns_ok if successful. otherwise, it returns an error code. example // replace all occurances of |matchval| with |newval| void replacesubstring(nsacstring& str, const nsacstring& matchval, const nsacstring& newval) { const char* sp, *mp, *np; pruint32 sl, ml, nl; sl = ns_cstringgetdata(str, &sp); ...
NS_CStringToUTF16
« xpcom api reference summary the ns_cstringtoutf16 function converts the value of a nsacstring instance to utf-16 and stores the result in a nsastring instance. #include "nsstringapi.h" nsresult ns_cstringtoutf16( const nsacstring& asrc, nscstringencoding asrcencoding, nsastring& adest ); parameters asrc [in] a nsacstring instance containing the source string to be converted. asrcencoding [in] the character encoding of the source string. see nscstringencoding for the set of values that can be passed for this parameter. adest [out] a nsastring instance that will contain the result of the conversion. the result will be encoded using the host byte order. return values the ns_cstringtoutf16 function returns ns_ok if successful. otherwise, it returns an error code. t...
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 adatalength = pr_uint32_max ); parameters astring [in] a nsastring instance to be modified. adata [in] a raw character array to copy into this string. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. return values the ns_stringappenddata function returns ns_ok if successful. otherwise, it returns an error code. remarks this function is defined inline as a wrapper aro...
NS_StringCloneData
« xpcom api reference summary the ns_stringclonedata function returns a null-terminated, heap allocated copy of the string's internal buffer. #include "nsstringapi.h" prunichar* ns_stringclonedata( const nsastring& astring ); parameters astring [in] a nsastring instance whose data is to be cloned. return values the ns_stringcutdata function returns a pointer to a null-terminated, heap allocated buffer on success. on failure it returns nsnull. the resulting buffer may be freed by calling nsmemory::free. history this function was frozen for mozilla 1.7. see bug 239716 for details. see also nsmemory::free, nsastring ...
NS_StringContainerFinish
« xpcom api reference summary the ns_stringcontainerfinish function releases any memory allocated by a nsstringcontainer instance. this is a low-level api. #include "nsstringapi.h" void ns_stringcontainerfinish( nsstringcontainer& astring ); parameters astring [in] a nsstringcontainer instance that is no longer needed. return values this function does not return a value. example code see ns_stringcontainerinit for an example. history this function was frozen for mozilla 1.7. see bug 239123 for details. see also ns_stringcontainerinit ...
NS_StringContainerInit
« xpcom api reference summary the ns_stringcontainerinit function initializes a nsstringcontainer instance for use as a nsastring. this is a low-level api. #include "nsstringapi.h" nsresult ns_stringcontainerinit( nsstringcontainer& astring ); parameters astring [in] a nsstringcontainer instance to be initialized. return values the ns_stringcontainerinit function returns ns_ok if successful. otherwise, it returns an error code. remarks the nsstringcontainer structure has unspecified size and layout. its members may not be accessed directly. after a nsstringcontainer object has been initialized, it may be used as an ordinary nsastring object. the internal buffer allocated by a nsstringcontainer is always null-terminated. with ns_stringcontainerinit, the coder is re...
NS_StringCutData
astring& astring, pruint32 acutstart, pruint32 acutlength ); parameters astring [in] a nsastring instance to be modified. acutstart [in] the starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. pass pr_uint32_max to specify the length from acutstart to the end of the string. return values the ns_stringcutdata function returns ns_ok if successful. otherwise, it returns an error code. remarks this function is defined inline as a wrapper around ns_stringsetdatarange. note: gcc requires the -fshort-wchar option to compile this example since prunichar is an unsigned short. this example should compile by default under msvc. example code nsstringcontainer str; ns_stringcontai...
NS_StringGetData
his is a low-level api. #include "nsstringapi.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...
NS_StringSetData
tring& astring, const prunichar* adata, pruint32 adatalength = pr_uint32_max ); parameters astring [in] a nsastring instance to modify. adata [in] a raw character array to copy into this string. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. return values the ns_stringsetdata function returns ns_ok if successful. otherwise, it returns an error code. example code nsstringcontainer str; rv = ns_stringcontainerinit(str); if (ns_succeeded(rv)) { rv = ns_stringsetdata(str, "hello world"); if (ns_succeeded(rv)) { // now, pass |str| to some function expecting a |const nsastring&| parameter. } ns_stringcontainerfinish(s...
NS_StringSetDataRange
rting index of the section to replace, measured in storage units. acutlength [in] the length of the section to replace, measured in storage units. adata [in] a raw character array to copy into this string. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. return values the ns_stringsetdatarange function returns ns_ok if successful. otherwise, it returns an error code. example code // replace all occurances of |matchval| with |newval| void replacesubstring(nsastring& str, const nsastring& matchval, const nsastring& newval) { const prunichar* sp, *mp, *np; pruint32 sl, ml, nl; sl = ns_stringget...
nsMsgMessageFlags
replied 0x00000002 indicates whether or not the message has been replied to. ...
nsMsgNavigationType
terfaces.nsmsgnavigationtype.nextmessage, resultid, resultindex, threadindex, true); the nsmsgnavigationtype interface is defined as a global variable in thunderbird: var nsmsgviewcommandtype = components.interfaces.nsmsgviewcommandtype; mailnews/base/public/nsimsgdbview.idlscriptable please add a summary to this article. last changed in gecko 1.9 (firefox 3) constants name value description firstmessage 1 go to the first message in the view. nextmessage 2 go to the next message in the view. will wrap around if the wrap flag is set to true. previousmessage 3 go to the previous message in the view. will wrap around if the wrap flag is set to true. lastmessage 4 go to the last message in the view. togglethreadkilled 5 must match nsmsgviewcommandtype togglethr...
nsMsgViewCommandCheckState
the nsmsgviewcommandcheckstate interface contains constants used for command status in thunderbird. it is (as far as i can tell) not currently used anywhere in thunderbird. mailnews/base/public/nsimsgdbview.idlscriptable please add a summary to this article. last changed in gecko 1.9 (firefox 3) constants name value description notused 0 checked 1 unchecked 2 ...
nsMsgViewCommandType
ype interface contains constants used for commands in thunderbird. for example to mark a message read, you would call: // assuming gdbview is a global nsimsgdbview gdbview.docommand(components.interfaces.nsmsgviewcommandtype.markmessagesread); mailnews/base/public/nsimsgdbview.idlscriptable please add a summary to this article. last changed in gecko 1.9 (firefox 3) constants name value description markmessagesread 0 marks the selected messages as read. markmessagesunread 1 mark the selected messages as unread togglemessageread 2 toggle the read flag of the selected messages flagmessages 3 flag the selected messages. unflagmessages 4 unflag the selected messages. togglethreadwatched 6 toggle the watched state of the selected thread. deletemsg 7 move the sele...
nsMsgViewFlagsType
the nsmsgviewflagstype interface contains constants used for view flags in thunderbird. this interface isn't ever implemented. it is only used to store constants. ...
nsMsgViewType
the nsmsgviewtype interface contains constants used for views in thunderbird. this interface isn't ever implemented. it is only used to store constants. ...
nsStaticModuleInfo
summary this data structure is used by ns_initxpcom3 to specify static xpcom modules. #include "nsxpcom.h" struct nsstaticmoduleinfo { const char* name; nsgetmoduleproc getmodule; }; members name this member provides the name of the module as a null-terminated, ascii-valued character array. getmodule this member provides a function pointer of type nsgetmoduleproc that returns a nsimodule instance. ...
Performance
roll them back, and it also keeps recently used ones so it can run faster. in the past, it flushed the cache at the end of a transaction (by default). in order to keep the cache active between transactions, you needed to have a second connection with a 'dummy' (and schema changing) transaction. that is not needed now. you can control the size of the memory cache using the cache_size pragma. this value controls the number of pages of the file that can be kept in memory at once. the page size can be set using the page_size pragma before any operations have been done on the file. you can see an example of setting the maximum cache size to be a percentage of memory in nsnavhistory::initdb in toolkit/components/places/src/nsnavhistory.cpp. sharding the cache between connections by default, storage ...
Using nsIDirectoryService
getfile : function(prop, persistant) { // return an nsifile }, } components.classes["@mozilla.org/file/directory_service;1"] .getservice(components.interfaces.nsidirectoryservice).registerprovider(provider); when the callback is called, it will be passed the string key, and should return an nsifile. the persistant flag allows you to specify if you want the nsdirectoryservice to cache this value. in most cases you would set this to be true. the interfaces for this can be found here. known locations the nsiproperties strings for currently defined locations can be found in: nsdirectoryservicedefs.h nsappdirectoryservicedefs.h nsxulappapi.h content formerly at http://www.mozilla.org/projects/xpco...locations.html background the way in which mozilla components locate special files and d...
XPCOM ABI
always be found by exploring the build system. note: target_xpcom_abi in the mozilla build system, the variable storing the xpcom abi is named target_xpcom_abi. (this is an internals detail and should be of no concern to an extension developer.) extension installation when the application (e.g. firefox) is built, the name of the abi it supports is embedded into it. later on, it could use this value to check compatibility with third-party binary xpcom components. a common point of compatibility check is during the installation of extensions. if an extension provides binary xpcom components, it should declare their xpcom abi in the install manifest. an extension author may build (compile) the xpcom component for each and every supported machine and pack all the builds into a single xpi, each...
wrappedJSObject
...
Xptcall Porting Guide
bs... the invoke functionality requires the implementation of the following on each platform (from xptcall/public/xptcall.h): xptc_public_api(nsresult) ns_invokebyindex(nsisupports* that, pruint32 methodindex, pruint32 paramcount, nsxptcvariant* params); calling code is expected to supply an array of nsxptcvariant structs. these are discriminated unions describing the type and value of each parameter of the target function. the platform specific code then builds a call frame and invokes the method indicated by the index methodindex on the xpcom interface that. here are examples of this implementation for win32 and linux x86, netbsd x86, and freebsd. these implementations use the basic strategy of: figure out how much stack space is needed for the params, make the space in a...
XUL Overlays
Mozilla › Tech › XUL › Overlays
thus, given the following base: ... <menu id="file-menu"> <menupopup id="menu_filepopup"> <menuitem name="new"/> <menuitem name="open"/> <menuitem name="save"/> <menuitem name="close"/> </menupopup> </menu> ... and given the following overlay: <?xml ve...
Account Provisioner
he user already has an email account, the user can switch to the original account setup wizard. debugging the account provisioner dialog logs most if not all of its activities, which is useful for debugging. logs can either be dumped to the terminal via dump, or to the error console. to have logs dumped to the terminal, create a string preference called mail.provider.logging.dump and set its value to all. to have logs dumped to the error console, create a string preference called mail.provider.logging.console and set its value to all. a mozillazine article on how to set preferences in thunderbird. ...
Address Book examples
omponents.interfaces.nsimutablearray); cardstodelete.appendelement(card); // repeat append as necessary addressbook.deletecards(cardstodelete); how do i add and use my own properties? use the setproperty/getproperty functions on nsiabcard to set your property in the same way as you would do with normal properties: card.setproperty("random1", "xyz"); card.setproperty("random2", "foo"); ... my value = card.getproperty("random1"); note: local (mork) address books are currently the only built-in type of address book that supports saving of non-built-in properties. however, outlook directories are the only other built-in write capable directories. how do i add/edit/delete mailing lists? adding a mailing list first create a mailing list object and initialize it: var maillist = components.c...
Buddy icons in mail
warning: the content of this article may be out of date. it was imported from mozilla.org and last updated in 2003. seth spitzer mozilla is now able to show icons in the message header area and the addressbook card pane. for the message pane, the icon we will show is on disk at: <profile home>/nim/<value of pref aim.session.screenname>/picture/<screenname for sender email address>.gif when trying to determine the screenname for the sender, we search the addressbook that we are using for collection. (see this document for info about that.) for the addressbook card pane, the icon will show is on disk at: <profile home>/nim/<value of pref aim.session.screenname>/picture/<screenname for card>.gif if aim.session.screenname is not set, the icon will not appear. ...
Cached compose window FAQ
dow is now cached). close the other compose window. (this window is not cached, since you already have a cached compose window.) do new message again. this is the cached compose window. it should be as fast as in step 4. do new message again. there is no "cached" window, so this will be as slow as step 4. we cache at most <n> html compose windws and <n> plain text windows, where n is the value of the hidden pref. what's the hidden pref to control it? user_pref("mail.compose.max_recycled_windows", 1); where can i read more about it? see http://bugzilla.mozilla.org/show_bug.cgi?id=104989 ...
DB Views (message lists)
view. nsmsggroupview is used when grouping is turned on. one unique thing about nsmsggroupview is that instead of using the message database's nsmsgthread objects like the other view classes, it uses an nsmsggroupthread object, which also implements nsimsgthread. view flags and types the view flags (external reference) are not exclusive. the view types (external reference) are. these are the values filed in nsidbfolderinfo to remember the view settings for the folder. view interaction with nsitreeview the nsitreeview methods in nsmsgdbview.cpp control the appearance of the thread pane. properties these nsmsgdbview methods set properties, nsitreeview.getrowproperties (implementation) nsitreeview.getcellpropreties (implementation) theming the theme uses these properties to style...
LDAP Support
lly want to send the message to. in thunderbird, the type down window can be customized to show arbitrary ldap fields. this can be accomplished by setting the following preferences: user_pref("mail.autocomplete.commentcolumn", 2); user_pref("ldap_2.servers.directoryname.autocomplete.commentformat", "[ou]"); the first preference tells us to use a comment column in the type down (the default value is 0 for no comment), and that the value for the comment is a custom string unique to each directory. the commentformat preference is set on each directory. it acts as a template, specifying the extra ldap attribute which should be used in the comment field along with how the attribute should be formatted. it expects the following format: the desired ldap attribute should be wrapped in square ...
The libmime module
s the callback routines and other per-class data of the class defined in this module. struct foobarclass { parentclass superclass; ...any callbacks or class-variables... }; class definition this variable holds an instance of the one-and-only class record; the various instances of this class point to this object. (one interrogates the type of an instance by comparing the value of its class pointer with the address of this variable.) extern foobarclass foobarclass; instance declaration theis structure defines the per-instance data of an object, and a pointer to the corresponding class record. struct foobar { parent parent; ...any instance variables... }; then, in the corresponding .c file, the following structure is used: class definitio...
Thunderbird Configuration Files
by using the built-in config editor. to access the config editor, go to tools > options or do thunderbird > preferences. if you are on mac os x, and on linux do edit > preferences on, select the advanced options panel, click on the general tab, and click on config editor. this will display a list of used preferences, as well as a search bar at the top. double-click on a preference to change its value. to do add a new preference, open the context menu (right-click) on any existing preference, go to the new menu, and select the type of preference. some preferences may require that you restart thunderbird in order to take effect. configuration files some tips and tricks require that you edit configuration files manually. there are three files you should know about: userchrome.css used to ...
Creating a Custom Column
h empty function. from nsitreeview: getcellproperties(row, col, props): optionally modify the props array getrowproperties(row, props): optionally modify the props array getimagesrc(row, col): return a string (or null) getcelltext(row, col): return a string representing the actual text to display in the column from nsimsgcustomcolumnhandler: getsortstringforrow(hdr): return the string value that the column will be sorted by getsortlongforrow(hdr): return the long value that the column will be sorted by isstring(): return true / false warning! do not get confused between getcelltext() and getsortstring/longforrow()! though they sound similar you may not want to return the same value from both. getcelltext() is the text that is displayed to the user while getsort*forrow() is what ...
Demo Addon
}; } // ... }; let collection = query.getcollection(mylistener); at first, a new gloda query for finding messages is created. the subject is assigned as search criterion. in the gloda query result listener the variable acollection is a glodacollections. it contains a collection of glodaconversation objects which itself is a thread that contains ...
Use SQLite
n(e) { tbirdsqlite.onload(e); }, false); this is another practical sample on how to handle opendatabase and sql queries on the client side, using in-memory (blob) storage of 2mb: var db = opendatabase('mydb', '1.0', 'test db', 2 * 1024 * 1024); var msg; db.transaction(function (tx) { tx.executesql('create table if not exists 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.querysel...
Using COM from js-ctypes
ateinstance"); } catch (ex) { console.error('ex occured:', ex); } finally { if (spvoice) { spvoice.release(spvoiceptr); } couninitialize(); } } main(); lib.close(); other examples shgetpropertystoreforwindow - this examples shows that coinit is not needed, some winapi functions return the interface. this example uses ipropertystore::setvalue to change the system.usermodelapp.id of an open firefox window. ishellitem ifileoperation ishelllink & ipersistfile - create shortcut files. example a - based on bugzilla :: bug 738501 - attachement 608538 exmaple b - based on example a ishelllink & ipersistfile & ipropertystore - uses ipropertystore to set and get the system.usermodelapp.id on shortcut files. ...
Debugging Tips
printing cdata and ctype currently console.log doesn't show type information of cdata. running the following code shows only partial value information. let { ctypes } = components.utils.import("resource://gre/modules/ctypes.jsm", {}); let i = ctypes.int32_t(10); console.log(i); let point = ctypes.structtype("point", [{ x: ctypes.int32_t }, { y: ctypes.int32_t }]) let p = point(10, 20); console.log(p); let pp = p.address(); console.log(pp); the result will be as following: cdata { value: 10 } cdata { x: 10, y: 20 } cdata { contents: cdata } to see more descriptive information, you can use .tosource(). let { ctypes } = components.utils.import("resource://gre/modules/ctypes.jsm", {}); let i = ctypes.int32_t(10); console.log(i.tosource()); let point = ctypes.structtype("point", [{ x:...
Using js-ctypes
ers of the string itself. 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 integer (which is a carbon oserr value), and accepts an integer (the alert type), two strings, a pointer to a parameter block, which we aren't using, and another integer, which is used to return the hit item. see apple's documentation for standardalert for details. after that, we simply set up our parameters by using makestr() to generate the two str255 strings we need, then call stdalert(), which produces the following alert window:...
ABI
n js-ctypes under these operating systems use a different abi than regular function declarations. other all other operating systems use ctypes.default_abi as their calling convention for all function declarations. method overview string tosource() string tostring() methods tosource() returns the string "ctypes.***_abi". string tosource() parameters none. return value a javascript expression that evaluates to the abi. tostring() returns a string identifying the abi. string tostring(); parameters none. return value a string identifying the abi. see also ctypes functiontype library ...
Library
for function declarations. returntype the ctype type returned by the defined api, if it's a function. this parameter should not be provided if the api is an exported data symbol. argtype1...argtypen zero or more parameter ctype may be specified for the parameters of the function being declared. these should not be provided if the api is an exported data symbol rather than a function. return value a functiontype cdata object representing the declared api. exceptions thrown ctypes ctype functiontype abi typeerror the return type was specified as an array. alternative syntax another use for ctypes.declare is to get non-function/non-methods from libraries. the syntax for this is seen in firefox codebase here: //github.com/realityripple/uxp/blob/master/js/src/ctypes/library.cp...
Memory - Plugins
lush only when it is not possible to call npn_memalloc, for example, when calling system methods that allocate memory indirectly. if npn_memalloc is called, calls to npn_memflush have no effect. for example, suppose that the plug-in calls newgworld, and that the call fails because of insufficient memory. the plug-in should try calling npn_memflush to free enough memory. if npn_memflush returns a value indicating that enough memory was freed, the plug-in can call newgworld again. calling npn_memflush is particularly important to systems with small amounts of ram and with virtual memory turned off. to request that the browser free as much memory as possible, call npn_memflush repeatedly until it returns 0. uint32 npn_memflush (uint32 size); the size parameter is an unsigned long integer that...
DOM Inspector FAQ - Firefox Developer Tools
, 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 tree. isn't there is a faster way to find it than navigating the tree? sure. you can do a search via the node's name, id, or an attribute/value pair. choose the find nodes... menu item from the edit menu in an inspector window that is inspecting the document ...
Introduction to DOM Inspector - Firefox Developer Tools
the <f3> shortcut key. updating the dom dynamically another feature to mention in this introduction is the ability is the ability the dom inspector gives you to dynamically update information reflected in the dom about web pages, user interface, and other elements. note that when the dom inspector displays information about a particular node or subtree, it presents individual nodes and their values (in the dom, attributes are subnodes of elements, typically) in an active list. you can perform actions on the individual items in this list from the context menu and the edit menu, both of which contain menutimes that allow you edit the values of those attributes. this interactivity allows you to shrink and grow element size, change icons, and do other layout-tweaking updates—all without a...
DOM Property Viewer - Firefox Developer Tools
s), or by pressing its ctrl + shift + w keyboard shortcut. the toolbox will appear at the bottom of the browser window, with the dom property viewer activated. it's just called "dom" in the toolbox. dom property viewer user interface dom tree the different properties of the dom are displayed as an expandable tree. the left-hand side shows the property's name, and the right-hand side shows its value. up to three properties of an object and items of an array are displayed. if a property has more elements than this, you'll see a "more..." annotation, and will need to click the property to see all elements. a lock icon indicates that a property is not writable. refreshing the display if the dom changes you can hit the refresh button to update the display: filtering there is a search box w...
Break on DOM mutation - Firefox Developer Tools
r when this breakpoint is triggered are calling node.appendchild() and node.removechild(), calling childnode.remove() or setting element.innerhtml on one of the subnodes. attribute modification execution pauses when any of the elementsʼ attributes are modified. that means, the script execution is stopped whenever an attribute is added to or removed from the element the option is set on or the value of one of its attributes is changed. examples for when this breakpoint is triggered are calling element.setattribute(), element.removeattribute(), and element.classlist.add(), or setting element.id. node removal execution pauses if the element the option is set on is removed. examples for when this breakpoint is triggered are calling element.remove() or node.removechild() on its parent no...
Set watch expressions - Firefox Developer Tools
n any results. to set a watch expression, expand the watch expressions sidebar, then click "add watch expression." type the expression you'd like to watch into the text field. the debugger will save the expression and watch it as you step through your code. when the debugger reaches a breakpoint, it will display your watch expressions variables: you can step through your code, watching the value of the expression as it changes. each time it does, the box will flash briefly yellow. you can remove a watch expression by clicking the "x" icon next to it, and you can have more than one watch expression at a time. ...
Step through code - Firefox Developer Tools
tep through it using four buttons in the toolbar: in order, the buttons are: play: run to the next breakpoint step over: advance to the next line in the same function. step in: advance to the next line in the function, unless on a function call, in which case enter the function being called step out: run to the end of the current function, in which case, the debugger will skip the return value from a function, returning execution to the caller split console when paused, you can press the esc key to open and close the split console to gain more insight into errors and variables: pause on breakpoints overlay since firefox 70, when your code is paused on a breakpoint an overlay appears on the viewport of the tab you are debugging. this lets you know what kind of breakpoint the...
Use watchpoints - Firefox Developer Tools
e a given property is accessed. in the firefox debugger, this information can be provided by watchpoints. by setting a watchpoint on the property, rather than a breakpoint at a particular line, you can discover where that access occurs. there are three types of watchpoints: get, set, and get or set. a get watchpoint pauses whenever a property is read; a set watchpoint pauses whenever a property value changes; a get or set watchpoint pauses whenever a property value is accessed in either way. set a watchpoint run and then pause the debugger. in the scopes pane on the right side of the debugger user interface, find an object you want to watch, and right-click it to open its context menu. choose break on, and then one of property set property get property get or set a w...
Set an XHR breakpoint - Firefox Developer Tools
of a url, code execution will pause on any call to a url that contains that keyword. when your code breaks on an xhr request, the righthand pane will have two additional sections: call stack the list of functions that were executed in order ot get to the currently executing code. click on an item in the call stack to jump to the associated line in the code display. scopes a list of the values that are in scope in the function, method, or event handler where the break occurred. inline variable preview new in firefox 71, the source pane now gives you an instant preview of the variables on each line of code you've stepped through. see set a breakpoint > inline variable preview for more information. ...
Tutorial: Set a breakpoint - Firefox Developer Tools
t actually start debugging anything. adddebuggertoglobal(this); // create a 'debugger' instance. var dbg = new debugger; // make the tab's top window a debuggee, and get a // debugger.object referring to the window. var windowdo = dbg.adddebuggee(tabs[0].content); // get a debugger.object referring to the window's `report` // function. var reportdo = windowdo.getownpropertydescriptor('report').value; // set a breakpoint at the entry point of `report`. reportdo.script.setbreakpoint(0, { hit: function (frame) { console.log('hit breakpoint in ' + frame.callee.name); console.log('what = ' + frame.eval('what').return); } }); console.log('finished setting breakpoint!'); in the scratchpad, ensure that no text is selected, and press the “run” button. now, click...
Debugger-API - Firefox Developer Tools
y the security risks of the additional attack surface. the debugger api cannot currently observe self-hosted javascript. this is not inherent in the api’s design, but simply that the self-hosting infrastructure isn’t prepared for the kind of invasions the debugger api can perform. debugger instances and shadow objects debugger reflects every aspect of the debuggee’s state as a javascript value—not just actual javascript values like objects and primitives, but also stack frames, environments, scripts, and compilation units, which are not normally accessible as objects in their own right. here is a javascript program in the process of running a timer callback function: a running javascript program and its debugger shadows this diagram shows the various types of shadow objects that...
Examine and edit HTML - Firefox Developer Tools
t popup context menu you can perform certain common tasks on a specific node using a popup context menu. to activate this menu, context-click the element. the menu contains the following items — click on the links to find the description of each command in the context menu reference: edit as html create new node duplicate node delete node attributes add attribute copy attribute value edit attribute remove attribute break on ... subtree modification attribute modification node removal use in console show dom properties show accessibility properties change pseudo-class hover active focus focus-within visited screenshot node scroll into view copy inner html outer html css selector css path xpath imag...
Examine and edit the box model - Firefox Developer Tools
wn overlaid on the page: it's also shown overlaid if you hover over an element's markup in the html pane: if the element is inline and is split over multiple line boxes, the highlighter shows each individual line box that together make up the element: the box model view when an element's selected, you can get a detailed look at the box model in the box model view: if you hover over a value, you'll see a tooltip telling you which rule the value comes from: if you hover over part of the box model in the box model view, the corresponding part of the page is highlighted: editing the box model you can also edit the values in the box model view, and see the results immediately in the page: ...
Inspect and select colors - Firefox Developer Tools
if you click on the color sample, you'll see a color picker popup, enabling you to change the color: if the color is a foreground color, the color picker tells you whether its contrast with the background color meets accessibility guidelines. hovering the mouse over the contrast message gives a more detailed explanation. ...
UI Tour - Firefox Developer Tools
0, the box model view did not appear in the "computed view" tab, but had its own tab. to learn more about the css declarations listed in this view, see examine computed css. changes view when you are editing in the rules view, you can see the changes you have made in the changes view. computed view the computed view shows you the complete computed css for the selected element (the computed values are the same as what getcomputedstyle would return.): compatibility view starting with firefox developer edition version 77, the compatibility view shows css compability issues, if any, for properties applied to the selected element, and for the current page as a whole. it shows icons for the browsers that do support the properties, and notes properties that are experimental or deprecated. ...
Call Tree - Firefox Developer Tools
s a percentage of the total number of samples in the selected portion of the recording. in the current version of the call tree, these are the most important columns. functions with a relatively high self cost are good candidates for optimization, either because they take a long time to run, or because they are called very often. the inverted call tree is a good way to focus on these self cost values. this screenshot tells us something we probably already knew: bubble sort is a very inefficient algorithm. we have about six times as many samples in bubble sort as in selection sort, and 13 times as many as in quicksort. walking up the call tree next to each function name is a disclosure arrow: click that, and you can see the path back up the call tree, from the function in which the sample...
Frame rate - Firefox Developer Tools
graph is found in the recording overview part of the performance tool. it takes a timestamp when the browser finishes a frame, and uses this to keep track of the frame rate over the course of the recording. the x-axis is time over the profile period, and there are three annotations: the maximum frame rate, the average frame rate, and the lowest frame rate. using the frame rate graph the great value of the frame rate graph is that, like the web console, it gives you a quick indication of where your site might be having problems, enabling you to use the other tools for more in-depth analysis. for example, here's a screenshot of a performance profile: you can see that the average frame rate is reasonably healthy, but there are three spots where frame rate collapses for tens of milliseconds.
Debugging Firefox Desktop - Firefox Developer Tools
of firefox being debugged is called the debuggee, and the instance of firefox doing the debugging is called the debugger. enable remote debugging first, you'll need to ensure that both debugger and debuggee have the "enable browser chrome and add-on debugging toolboxes" and "enable remote debugging" settings checked in the developer tools settings. you only need to do this once: the setting values persist across restarts. start the debugger server next, you need to start the debugger server in the debuggee. run the debuggee from the command line, passing it the --start-debugger-server option: /path/to/firefox --start-debugger-server passed with no arguments, --start-debugger-server makes the debugger server listen on port 6000. to use a different port, pass the desired port number: ...
Settings - Firefox Developer Tools
ol. there's just one of these: enable persistent logs a setting to control whether or not the web console and network monitor clear their output when you navigate to a new page. if common preferences is not included in the settings, web console logs can be persisted by using the 'about:config' url in browser address bar, searching for: 'devtools.webconsole.persistlog' then toggling this value to true inspector show browser styles a setting to control whether styles applied by the browser (user-agent styles) should be displayed in the inspector's rules view. note that this setting is independent of the "browser styles" checkbox in the inspector's computed view. truncate dom attributes by default, the inspector truncates dom attributes that are more than 120 characters long. unc...
Extension Storage - Firefox Developer Tools
this storage type is only shown when debugging extensions. when selecting an extension id in the storage tree of the storage inspector, a table lists the details of all the extension storage present for the extension. this table contains the following columns: key — the name of the stored item. value — the value of the stored item. storage area — the name of the area where the item is stored. ...
IndexedDB - Firefox Developer Tools
ails: object store name — the name of the object store. key — the keypath property of the object store. auto increment — is automatic incrementation of the keys enabled? indexes — array of indexes present in the object store as shown below. when an object store is selected in the storage tree, all the items in that object store are listed in the table. all items have a key and a value associated with them. you can delete an indexeddb database using the context menu in the storage tree: if the database cannot be deleted (most commonly because there are still active connections to the database), a warning message will be displayed in the storage inspector: you can use the context menu in the table widget to delete all items in an object store, or a particular item: ...
Local Storage / Session Storage - Firefox Developer Tools
when an origin corresponding to local storage or session storage is selected within the storage inspector, the names and values of all the items corresponding to local storage or session storage will be listed in a table. you can edit local and session storage items by double-clicking inside cells in the table widget and editing the values they contain: you can delete local storage and session storage entries using the context menu: you can also delete local and session storage entries by selecting an item and pressing the delete or backspace key. finally, you can add new storage items by clicking the "plus" (+) button and then editing the resulting new row to the value you want. ...
Taking screenshots - Firefox Developer Tools
prevents saving to a file unless you use the --file option to force file writing. --delay number the number of seconds to delay before taking the screenshot; you can use an interger or floating point number. this is useful if you want to pop open a menu or invoke a hover state for the screenshot. --dpr number the device pixel ratio to use when taking the screenshot. values above 1 yield "zoomed-in" images, whereas values below 1 create "zoomed-out" images. --file boolean when present, the screenshot will be saved to a file, even if other options (e.g. --clipboard) are included. --filename string the name to use in saving the file. the file should have a ".png" extension. --fullpage boolean if included, the full webpage ...
Console messages - Firefox Developer Tools
he browser using the web console's javascript interpreter, and the corresponding responses, are logged in the console messages. for responses that contain objects or variables, the following context menu options are available: reveal in inspector shows the selected dom node in the inspector pane. store as global variable creates a global variable (with a name like temp0, temp1, etc.) whose value is the selected object. the name of the variable appears as an input to the interpreter, and its value appears as a response. copy object copies the selected object to the clipboard. filtering and searching filtering by category you can use the toolbar along the top to constrain the results displayed. to see only messages of particular categories, click the button labeled with that categor...
The JavaScript input interpreter - Firefox Developer Tools
f matching nodes. if unspecified, element defaults to document. the resulttype parameter specifies the type of result to return; it can be an xpathresult constant, or a corresponding string: "number", "string", "bool", "node", or "nodes"; if not provided, any_type is used. keys() given an object, returns a list of the keys (or property names) on that object. this is a shortcut for object.keys. values() given an object, returns a list of the values on that object; serves as a companion to keys(). clear() clears the console output area. inspect() given an object, opens the object inspector for that object. pprint() obsolete since gecko 74 formats the specified value in a readable way; this is useful for dumping the contents of objects and arrays. help()deprecated since gecko 62 :help ...
about:debugging (before Firefox 68) - Firefox Developer Tools
rkers". when about:debugging opens, on the left-hand side, you'll see a sidebar enabling you to switch between the two main views: one for add-ons and one for workers. whether or not system add-ons appear in the list on this page depends on the setting of the devtools.aboutdebugging.showsystemaddons preference. if you need to see system add-ons, navigate to about:config and make sure that this value is set to true. add-ons the add-ons section in about:debugging only supports restartless add-ons, including basic bootstrapped extensions, add-on sdk add-ons, and webextensions. this page enables you to do two things: load an add-on temporarily from disk connect the add-on debugger to any restartless add-ons connecting the add-on debugger the add-ons page in about:debugging lists al...
ANGLE_instanced_arrays.vertexAttribDivisorANGLE() - Web APIs
) and ext.drawelementsinstancedangle(). note: when using webgl2, this method is available as gl.vertexattribdivisor() by default. syntax void ext.vertexattribdivisorangle(index, divisor); parameters index a gluint specifying the index of the generic vertex attributes. divisor a gluint specifying the number of instances that will pass between updates of the generic attribute. return value none. examples var ext = gl.getextension('angle_instanced_arrays'); ext.vertexattribdivisorangle(0, 2); specifications specification status comment angle_instanced_arraysthe definition of 'angle_instanced_arrays' in that specification. recommendation initial definition. ...
AbortController.abort() - Web APIs
examples in the following snippet, we aim to download a video using the fetch api. ...
AbortController.signal - Web APIs
examples in the following snippet, we aim to download a video using the fetch api. we first create a controller using the abortcontroller() constructor, then grab a reference to its associated abortsignal object using the abortcontroller.signal property. ...
AbortSignal.aborted - Web APIs
later on we check whether or not it the signal has been aborted using the aborted property, and send an appropriate log to the console. ...
AbstractRange.endContainer - Web APIs
the endcontainer property of the abstractrange interface returns the node in which the end of the range is located. syntax var endnode = range.endcontainer value the dom node which contains the final character of the range. specifications specification status comment domthe definition of 'endcontainer' in that specification. living standard static rangethe definition of 'endcontainer' in that specification. editor's draft initial definition. ...
AbstractRange.endOffset - Web APIs
the endoffset property of the abstractrange interface returns the offset into the end node of the range's end position. syntax var endoffset = range.endoffset; value an integer value indicating the number of characters into the node indicated by endcontainer at which the final character of the range is located. specifications specification status comment domthe definition of 'endoffset' in that specification. living standard static rangethe definition of 'endoffset' in that specification. editor's draft initial definition. ...
AbstractRange.startContainer - Web APIs
the read-only startcontainer property of the abstractrange interface returns the start node for the range. syntax var startnode = range.startcontainer value the dom node inside which the start position of the range is found. specifications specification status comment domthe definition of 'startcontainer ' in that specification. living standard static rangethe definition of 'startcontainer' in that specification. editor's draft initial definition. ...
AbstractRange.startOffset - Web APIs
the read-only startoffset property of the abstractrange interface returns the offset into the start node of the range's start position. syntax var startoffset = range.startoffset value an integer value indicating the number of characters into the node indicated by startcontainer at which the first character of the range is located. specifications specification status comment domthe definition of 'startoffset' in that specification. living standard static rangethe definition of 'startoffset' in that specification. editor's draft initial definition. ...
AbstractWorker - Web APIs
se abstractworker in your code. instead, you'll interact with either worker or sharedworker, both of which inherit the properties of abstractworker. this code snippet demonstrates the creation of a new worker using the worker() constructor; it also shows how to then send a message to the worker. var myworker = new worker('worker.js'); first.onchange = function() { myworker.postmessage([first.value, second.value]); console.log('message posted to worker'); } the worker's code is loaded from the file "worker.js". this code assumes that there's an <input> element represented by first; an event handler for the change event is established so that when the user changes the value of first, a message is posted to the worker to let it know. you can find more examples on the mdn web docs github r...
Accelerometer.x - Web APIs
Web › API › Accelerometer › x
elerometer interface returns a double precision integer containing the acceleration of the device along the its x axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var xacceleration = accelerometer.x value a number. example acceleration is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let accelerometer = new accelerometer({frequency: 60}); accelerometer.addeventlistener('reading', e => { console.log("acceleration along the x-axis " + accelerometer.x); console.log("acceleration along the y-axis " + accelerometer.y); console.l...
Accelerometer.y - Web APIs
Web › API › Accelerometer › y
elerometer interface returns a double precision integer containing the acceleration of the device along the its y axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var yacceleration = accelerometer.y value a number. example acceleration is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let accelerometer = new accelerometer({frequency: 60}); accelerometer.addeventlistener('reading', e => { console.log("acceleration along the x-axis " + accelerometer.x); console.log("acceleration along the y-axis " + accelerometer.y); console.l...
Accelerometer.z - Web APIs
Web › API › Accelerometer › z
elerometer interface returns a double precision integer containing the acceleration of the device along the its z axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var zacceleration = accelerometer.z value a number. example acceleration is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let accelerometer = new accelerometer({frequency: 60}); accelerometer.addeventlistener('reading', e => { console.log("acceleration along the x-axis " + accelerometer.x); console.log("acceleration along the y-axis " + accelerometer.y); console.l...
AddressErrors.addressLine - Web APIs
an object based on addresserrors includes an addressline property when validation of the address finds one or more errors in the array of strings in the address's addressline. the returned string explains the error and should offer suggestions for how to correct it. syntax var addresslineerror = addresserrors.addressline; value if an error occurred during validation of the address due to one of the strings in the addressline array having an invalid value, this property is set to a domstring providing a human-readable error message explaining the validation error. the text should also include, when possible, advice about how to go about correcting the error. if the paymentaddress object's addressline property was determined to be valid, this property is not included in the addresserrors d...
AddressErrors.city - Web APIs
an object based on addresserrors includes a city property when validation of the address fails for the value given for the address's city property. the returned string explains the error and should offer suggestions for how to correct it. syntax var cityerror = addresserrors.city; value if the value specified in the paymentaddress object's city property could not be validated, this property contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. if the city value was validated successfully, this property is not included in the addresserrors object. specifications specification status comment payment request apithe definition of 'addresserrors.city' in that specification. candidate recommendat...
AddressErrors.dependentLocality - Web APIs
an object based on addresserrors includes a dependentlocality property when the address's dependentlocality property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. syntax var localityerror = addresserrors.dependentlocality; value if the value specified in the paymentaddress object's dependentlocality property could not be validated, this property contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. if the dependentlocality value was validated successfully, this property is not included in the addresserrors object. specifications specification status comment payment request apithe definition of 'addresserrors.dependentlocality'...
AddressErrors.phone - Web APIs
an object based on addresserrors includes a phone property when the address's phone property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. syntax var phoneerror = addresserrors.phone; value if the value specified in the paymentaddress object's phone property could not be validated, this property contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. if the phone value was validated successfully, this property is not included in the addresserrors object. specifications specification status comment payment request apithe definition of 'addresserrors.phone' in that specification. candidate recommendation initial definition. ...
AddressErrors.postalCode - Web APIs
an object based on addresserrors includes a postalcode property when the address's postalcode property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. syntax var postcodeerror = addresserrors.postcode; value if the value specified in the paymentaddress object's postalcode property could not be validated, this property contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. if the postalcode value was validated successfully, this property is not included in the addresserrors object. specifications specification status comment payment request apithe definition of 'addresserrors.postalcode' in that specification. candidate recomme...
AddressErrors.recipient - Web APIs
an object based on addresserrors includes a recipient property when the address's recipient property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. syntax var recipienterror = addresserrors.recipient; value if the value specified in the paymentaddress object's recipient property could not be validated, this property contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. if the recipient value was validated successfully, this property is not included in the addresserrors object. specifications specification status comment payment request apithe definition of 'addresserrors.recipient' in that specification. candidate recommenda...
AddressErrors.region - Web APIs
an object based on addresserrors includes a region property when the address's region property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. syntax var regionerror = addresserrors.region; value if the value specified in the paymentaddress object's region property could not be validated, this property contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. if the region value was validated successfully, this property is not included in the addresserrors object. specifications specification status comment payment request apithe definition of 'addresserrors.region' in that specification. candidate recommendation initial defin...
AddressErrors.regionCode - Web APIs
an object based on addresserrors includes a regioncode property when the address's regioncode property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. syntax var regioncodeerror = addresserrors.regioncode; value if the value specified in the paymentaddress object's regioncode property could not be validated, this property contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. if the regioncode value was validated successfully, this property is not included in the addresserrors object. usage notes the region code is derived from the iso 3166-2 country subdivision name standard. specifications specification status comment payment...
AddressErrors.sortingCode - Web APIs
an object based on addresserrors includes a sortingcode property when the address's sortingcode property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. syntax var sortingcodeerror = addresserrors.sortingcode; value if the value specified in the paymentaddress object's sortingcode property could not be validated, this property contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. if the sortingcode value was validated successfully, this property is not included in the addresserrors object. specifications specification status comment payment request apithe definition of 'addresserrors.sortingcode' in that specification. candid...
AmbientLightSensor.illuminance - Web APIs
ightsensor interface returns the current light level in lux of the ambient light level around the hosting device. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation insfructions. syntax var level = ambientlightsensor.illuminance value a number indicating the current light level in lux. example if ( 'ambientlightsensor' in window ) { const sensor = new ambientlightsensor(); sensor.onreading = () => { console.log('current light level:', sensor.illuminance); }; sensor.onerror = (event) => { console.log(event.error.name, event.error.message); }; sensor.start(); } specifications specification st...
AnalyserNode.AnalyserNode() - Web APIs
desired initial size of the fft for frequency-domain analysis. the default is 2048. maxdecibels: the desired initial maximum power in db for fft analysis. the default is -30. mindecibels: the desired initial minimum power in db for fft analysis. the default is -100. smoothingtimeconstant: the desired initial smoothing constant for the fft analysis. the default is 0.8. return value a new analysernode object instance. specifications specification status comment web audio apithe definition of 'analysernode() constructor' 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://...
AnalyserNode.fftSize - Web APIs
the fftsize property of the analysernode interface is an unsigned long value and represents the window size in samples that is used when performing a fast fourier transform (fft) to get frequency domain data. syntax var curvalue = analysernode.fftsize; analysernode.fftsize = newvalue; value an unsigned integer, representing the window size of the fft, given in number of samples. a higher value will result in more details in the frequency domain but fewer details in the time domain. must be a power of 2 between 252^5 and 2152^15, so one of: 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, and 32768. defaults to 2048. note: if its value is not a power of 2, or it is outside the specified range, a domexception with the name indexsizeerror is thrown. example the following example sho...
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 arraylength = 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 requestanim...
AnalyserNode.getByteTimeDomainData() - Web APIs
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 example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). const ...
AnalyserNode.getFloatTimeDomainData() - Web APIs
h 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 value none. example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic-float-data demo (see the source code too). var audioctx = new (wi...
Animation() - Web APIs
n be null (which is the default) to indicate that there should be no effect applied. timeline optional specifies the timeline with which to associate the animation, as an object of a type based on the animationtimeline interface. currently the only timeline type available is documenttimeline, but in the future there my be timelines associated with gestures or scrolling, for example. the default value is document.timeline, but this can be set to null as well. examples in the follow the white rabbit example, the animation() constructor is used to create an animation for the rabbitdownkeyframes using the document's timeline: var rabbitdownanimation = new animation(rabbitdownkeyframes, document.timeline); specifications specification status comment web animationsthe...
Animation.cancel() - Web APIs
Web › API › Animation › cancel
the web animations api's cancel() method of the animation interface clears all keyframeeffects caused by this animation and aborts its playback. when an animation is cancelled, its starttime and currenttime are set to null. syntax animation.cancel(); parameters none. return value none. exceptions this method doesn't directly throw exceptions; however, if the animation's playstate is anything but "idle" when cancelled, the current finished promise is rejected with a domexception named aborterror. specifications specification status comment web animationsthe definition of 'animation.cancel()' in that specification. working draft editor's draft. ...
Animation.commitStyles() - Web APIs
the commitstyles() method of the web animations api's animation interface commits the end styling state of an animation to the element being animated, even after that animation has been removed. it will cause the end styling state to be written to the element being animated, in the form of properties inside a style attribute. syntax animation.commitstyles(); parameters none. return value none. examples const divelem = document.queryselector('div'); document.body.addeventlistener('mousemove', evt => { let anim = divelem.animate( { transform: `translate(${ evt.clientx}px, ${evt.clienty}px)` }, { duration: 500, fill: 'forwards' } ); anim.commitstyles(); }); specifications specification status comment web animationsthe definition of 'commits...
Animation.effect - Web APIs
Web › API › Animation › effect
the animation.effect property of the web animations api gets and sets the target effect of an animation. the target effect may be either an effect object of a type based on animationeffectreadonly, such as keyframeeffect, or null. syntax var effect = animation.effect; animation.effect = animationeffectreadonly value a animationeffectreadonly object describing the target animation effect for the animation, or null to indicate no active effect. specifications specification status comment web animationsthe definition of 'animation.effect' in that specification. working draft editor's draft. ...
Animation.finish() - Web APIs
Web › API › Animation › finish
ace sets the current playback time to the end of the animation corresponding to the current playback direction. that is, if the animation is playing forward, it sets the playback time to the length of the animation sequence, and if the animation is playing in reverse (having had its reverse() method called), it sets the playback time to 0. syntax animation.finish(); parameters none. return value none. exceptions invalidstate the player's playback rate is 0 or the animation's playback rate is greater than 0 and the end time of the animation is infinity. examples the following example shows how to use the finish() method and catch an invalidstate error. interfaceelement.addeventlistener("mousedown", function() { try { player.finish(); } catch(e if e instanceof invalids...
Animation.finished - Web APIs
ished read-only property of the web animations api returns a promise which resolves once the animation has finished playing. every time the animation leaves the finished play state (that is, when it starts playing again), a new promise is created for this property. the new promise will resolve once the new animation sequence has completed. syntax var animationspromise = animation.finished; value a promise object which will resolve once the animation has finished running. examples the following code waits until all animations running on the element elem have finished, then deletes the element from the dom tree: promise.all( elem.getanimations().map( function(animation) { return animation.finished } ) ).then( function() { return elem.remove(); } ); specificat...
Animation.id - Web APIs
Web › API › Animation › id
the animation.id property of the web animations api returns or sets a string used to identify the animation. syntax var animationsid = animation.id; animation.id = newidstring; value a domstring which can be used to identify the animation, or null if the animation has no id. examples in the follow the white rabbit example, you can assign the rabbitdownanimation an id like so: rabbitdownanimation.effect.id = "rabbitgo"; specifications specification status comment web animationsthe definition of 'animation.id' in that specification. working draft editor's draft. ...
Animation.oncancel - Web APIs
el event can be triggered manually with animation.cancel() when the animation enters the "idle" play state from another state, such as when the animation is removed from an element before it finishes playing creating a new animation that is initially idle does not trigger a cancel event on the new animation. syntax var cancelhandler = animation.oncancel; animation.oncancel = cancelhandler; value a function to be executed when the animation is cancelled, or null if there is no cancel event handler. examples if this animation is canceled, remove its element. animation.oncancel = function() { animation.effect.target.remove(); }; specifications specification status comment web animationsthe definition of 'animation.oncancel' in that specification. working dr...
Animation.onfinish - Web APIs
play state supersedes the "finished" play state; if the animation is both paused and finished, the "paused" state is the one that will be reported. you can force the animation into the "finished" state by setting its starttime to document.timeline.currenttime - (animation.currenttime * animation.playbackrate). syntax var finishhandler = animation.onfinish; animation.onfinish = finishhandler; value a function to be called to handle the finish event, or null if no finish event handler is set. examples animation.onfinish is used several times in the alice in web animations api land growing/shrinking alice game. here is one instance where we add pointer events back to an element after its opacity animation has faded it in: // add an animation to the game's ending credits var endingui = doc...
Animation.onremove - Web APIs
the animation interface's onremove property (from the web animations api) is the event handler for the remove event. this event is sent when the animation is removed (i.e., put into an active replace state). syntax var removehandler = animation.onremove; animation.onremove = removehandler; value a function to be called to handle the remove event, or null if no remove event handler is set. examples in our simple replace indefinite animations demo, you can see the following code: const divelem = document.queryselector('div'); document.body.addeventlistener('mousemove', evt => { let anim = divelem.animate( { transform: `translate(${ evt.clientx}px, ${evt.clienty}px)` }, { duration: 500, fill: 'forwards' } ); anim.commitstyles(); //anim.persist() anim.onremove = fun...
Animation.pause() - Web APIs
Web › API › Animation › pause
exceptions invalidstateerror the animation's currenttime is unresolved (for example, if it's never been played or isn't currently playing) and the end time of the animation is positive infinity. throws an invalidstateerror if the animation's currenttime is unresolved (perhaps it hasn't started playing yet) and the end time of the animation is positive infinity. ...
Animation.pending - Web APIs
Web › API › Animation › pending
the read-only animation.pending property of the web animations api indicates whether the animation is currently waiting for an asynchronous operation such as initiating playback or pausing a running animation. syntax var pending = animation.pending; value true if the animation is pending, false otherwise. specifications specification status comment web animationsthe definition of 'pending' in that specification. working draft ...
Animation.persist() - Web APIs
Web › API › Animation › persist
the persist() method of the web animations api's animation interface explicitly persists an animation, when it would otherwise be removed due to the browser's automatically removing filling animations behavior. syntax animation.persist(); parameters none. return value none. examples in our simple replace indefinite animations demo, you can see the following code: const divelem = document.queryselector('div'); document.body.addeventlistener('mousemove', evt => { let anim = divelem.animate( { transform: `translate(${ evt.clientx}px, ${evt.clienty}px)` }, { duration: 500, fill: 'forwards' } ); anim.commitstyles(); //anim.persist() anim.onremove = function() { console.log('animation removed'); } console.log(anim.replacestate); }); here we have a <di...
Animation.play() - Web APIs
Web › API › Animation › play
the play() method of the web animations api's animation interface starts or resumes playing of an animation. if the animation is finished, calling play() restarts the animation, playing it from the beginning. syntax animation.play(); parameters none. return value undefined example in the growing/shrinking alice game example, clicking or tapping the cake causes alice's growing animation (alicechange) to play forward, causing her to get bigger, as well as triggering the cake's animation. two animation.play()s, one eventlistener: // the cake has its own animation: var nommingcake = document.getelementbyid('eat-me_sprite').animate( [ { transform: 'translatey(0)' }, { transform: 'translatey(-80%)' } ], { fill: 'forwards', easing: 'steps(4, end)', duration: alicechan...
Animation.playState - Web APIs
the animation.playstate property of the web animations api returns and sets an enumerated value describing the playback state of an animation. this property is read-only for css animations and transitions. syntax var currentplaystate = animation.playstate; animation.playstate = newstate; value idle the current time of the animation is unresolved and there are no pending tasks. running the animation is running. paused the animation was suspended and the animation.currenttime property is not updating. finished the animation has reached one of its boundaries and the animation.currenttime property is not updating. previously, web animations defined a pending value to indicate that some asynchronous operation such as initiating playback was yet to complete. this is now indicat...
Animation.playbackRate - Web APIs
the animation.playbackrate property of the web animations api returns or sets the playback rate of the animation. animations have a playback rate that provides a scaling factor from the rate of change of the animation's timeline time values to the animation’s current time. the playback rate is initially 1. syntax var currentplaybackrate = animation.playbackrate; animation.playbackrate = newrate; value takes a number that can be 0, negative, or positive. negative values reverse the animation. the value is a scaling factor, so for example a value of 2 would double the playback rate. setting an animation’s playbackrate to 0 effectively pauses the animation (however, its playstate does not necessarily become paused). examples in the growing/shrinking alice game example, clicking ...
Animation.ready - Web APIs
Web › API › Animation › ready
ated every time the animation enters the "pending" play state as well as when the animation is canceled, since in both of those scenarios, the animation is ready to be started again. since the same promise is used for both pending play and pending pause requests, authors are advised to check the state of the animation when the promise is resolved. syntax var readypromise = animation.ready; value a promise which resolves when the animation is ready to be played. you'll typically use a construct similar to this when using the ready promise: animation.ready.then(function() { // do whatever needs to be done when // the animation is ready to run }); example in the following example, the state of the animation will be running when the current ready promise is resolved because the anima...
Animation.replaceState - Web APIs
the read-only animation.replacestate property of the web animations api returns the replace state of the animation. this will be active if the animation has been removed, or persisted if animation.persist() has been invoked on it. syntax let myreplacestate = animation.replacestate; value a string that represents the replace state of the anmation. the value can be one of: active: the initial value of the animation's replace state; when the animation has been removed by the browser's automatically removing filling animations behavior. persisted: the animation has been explicitly persisted by invoking animation.persist() on it. removed: the animation has been explicitly removed. examples in our simple replace indefinite animations demo, you can see the following code: const divele...
Animation.reverse() - Web APIs
Web › API › Animation › reverse
the animation.reverse() method of the animation interface reverses the playback direction, meaning the animation ends at its beginning. if called on an unplayed animation, the whole animation is played backwards. if called on a paused animation, the animation will continue in reverse. syntax animation.reverse(); parameters none. return value undefined example in the growing/shrinking alice game example, clicking or tapping the bottle causes alice's growing animation (alicechange) to play backwards, causing her to get smaller. it is done by setting alicechange's animation.playbackrate to -1 like so: var shrinkalice = function() { // play alice's animation in reverse alicechange.playbackrate = -1; alicechange.play(); // play the bottle's animation drinking.play() ...
Animation.timeline - Web APIs
the animation.timeline property of the animation interface returns or sets the timeline associated with this animation. a timeline is a source of time values for synchronization purposes, and is an animationtimeline-based object. by default, the animation's timeline and the document's timeline are the same. syntax var animationstimeline = animation.timeline; animation.timeline = newtimeline; value a timeline object to use as the timing source for the animation, or null to use the default, which is the document's timeline. examples here we set the animation's timeline to be the same as the document's timeline (this is the default timeline for all animations, by the way): animation.timeline = document.timeline; specifications specification status comment web ...
AnimationEffect.updateTiming() - Web APIs
the updatetiming() method of the animationeffect interface updates the specified timing properties for an animation effect. syntax animation.updatetiming(timing); parameters timing an optionaleffecttiming object containing the timing properties to update. return value none. specifications specification status comment web animationsthe definition of 'animationeffect.updatetiming()' in that specification. working draft editor's draft. ...
AnimationEffect - Web APIs
e animationeffect interface of the web animations api defines current and future animation effects like keyframeeffect, which can be passed to animation objects for playing, and keyframeeffectreadonly (which is used by css animations and transitions). methods animationeffect.gettiming() returns the effecttiming object associated with the animation containing all the animation's timing values. animationeffect.getcomputedtiming() returns the calculated timing properties for this animationeffect. animationeffect.updatetiming() updates the specified timing properties of this animationeffect. specifications specification status comment web animationsthe definition of 'animationeffect' in that specification. working draft editor's draft. ...
AnimationEvent.animationName - Web APIs
the animationevent.animationname read-only property is a domstring containing the value of the animation-name css property associated with the transition. syntax name = animationevent.animationname specifications specification status comment css animationsthe definition of 'animationevent.animationname' in that specification. working draft initial definition. ...
AnimationEvent.elapsedTime - Web APIs
the animationevent.elapsedtime read-only property is a float giving the amount of time the animation has been running, in seconds, when this event fired, excluding any time the animation was paused. for an animationstart event, elapsedtime is 0.0 unless there was a negative value for animation-delay, in which case the event will be fired with elapsedtime containing (-1 * delay). syntax time = animationevent.elapsedtime specifications specification status comment css animationsthe definition of 'animationevent.elapsedtime' in that specification. working draft initial definition. ...
AnimationPlaybackEvent.AnimationPlaybackEvent() - Web APIs
he name of the event. eventinitdict optional an optional eventinit dictionary object containing the following fields: bubbles optional defaults to false, of type boolean, indicating if the event bubbles or not. cancelable optional defaults to false, of type boolean, indicating if the event can be canceled or not. detail optional defaults to null, of type any — an event-dependent value associated with the event. specifications specification status comment web animationsthe definition of 'animationplaybackevent()' in that specification. working draft editor's draft. ...
AnimationPlaybackEvent.timelineTime - Web APIs
the timelinetime read-only property of the animationplaybackevent interface represents the time value of the animation's timeline at the moment the event is queued. this will be unresolved if the animation was not associated with a timeline at the time the event was generated or if the associated timeline was inactive. value a number representing the current time in milliseconds, or null. specifications specification status comment web animationsthe definition of 'animationplaybackevent.timelinetime' in that specification. working draft editor's draft. ...
AnimationPlaybackEvent - Web APIs
api represents animation events. as animations play, they report changes to their playstate through animation events. constructor animationplaybackevent.animationplaybackevent() constructs a new animationplaybackevent object instance. attributes animationplaybackevent.currenttime the current time of the animation that generated the event. animationplaybackevent.timelinetime the time value of the timeline of the animation that generated the event. specifications specification status comment web animationsthe definition of 'animationplaybackevent' in that specification. working draft editor's draft. ...
AnimationTimeline - Web APIs
of the web animations api represents the timeline of an animation. this interface exists to define timeline features (inherited by documenttimeline and future timeline types) and is not itself directly used by developers. anywhere you see animationtimeline, you should use documenttimeline or any other timeline type instead. properties animationtimeline.currenttime read only returns the time value in milliseconds for this timeline or null if this timeline is inactive. specifications specification status comment web animationsthe definition of 'animationtimeline' in that specification. working draft editor's draft. ...
Attr.localName - Web APIs
Web › API › Attr › localName
example the following example shows "id" in an alert dialog. ...
Attr.namespaceURI - Web APIs
Web › API › Attr › namespaceURI
element is not in a namespace. before dom4 this api was defined within the node interface. syntax namespace = attribute.namespaceuri example in this snippet, an attribute is being examined for its localname and its namespaceuri. if the namespaceuri returns the xul namespace and the localname returns "browser", then the node is understood to be a xul <browser/>. if (attribute.localname == "value" && attribute.namespaceuri == "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul") { // this is a xul value } notes this is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. the namespace uri of an attribute is frozen at the attribute creation time. in firefox 3.5 and earlier, the namespace uri for ht...
AudioBuffer() - Web APIs
t 32 channels. samplerate: the sample rate in hz for the buffer. the default is the sample rate of the context used in constructing this object. user agents are required to support sample rates from 8,000 hz to 96,000 hz (but are allowed to go farther outside this range). deprecated parameters context a reference to an audiocontext. this parameter was removed from the spec. return value a new audiobuffer object instance. exceptions notsupportederror one or more of the options are negative or otherwise has an invalid value (such as numberofchannels being higher than supported, or a samplerate outside the nominal range). rangeerror there isn't enough memory available to allocate the buffer. specifications specification status comment web audio ap...
AudioBuffer - Web APIs
ull source code at our webaudio-examples repository; a running live version is also available. ...
AudioConfiguration - Web APIs
media capabilities api defines the audio file being tested when calling mediacapabilities.encodinginfo() or mediacapabilities.decodinginfo() to query whether a specific audio configuration is supported, smooth, and/or power efficient. properties the audioconfiguration dictionary is made up of four audio properties, including: contenttype: a valid audio mime type, for information on possible values and what they mean, see the web audio codec guide. channels: the number of channels used by the audio track. bitrate: the number of bits used to encode one second of the audio file. samplerate: the number of audio samples making up one second of the audio file. examples //create media configuration to be tested const mediaconfig = { type : 'file', // 'record', 'transmission', or 'med...
AudioContext.baseLatency - Web APIs
of seconds of processing latency incurred by the audiocontext passing an audio buffer from the audiodestinationnode — i.e. the end of the audio graph — into the host system's audio subsystem ready for playing. note: you can request a certain latency during construction time with the latencyhint option, but the browser may ignore the option. syntax var baselatency = audioctx.baselatency; value a double representing the base latency in seconds. example // default latency ("interactive") const audioctx1 = new audiocontext(); console.log(audioctx1.baselatency); // 0.00 // higher latency ("playback") const audioctx2 = new audiocontext({ latencyhint: 'playback' }); console.log(audioctx2.baselatency); // 0.15 specifications specification status comment web audi...
AudioContext.createMediaElementSource() - Web APIs
// create a mediaelementaudiosourcenode // feed the htmlmediaelement into it var source = audioctx.createmediaelementsource(myaudio); // create a gain node var gainnode = audioctx.creategain(); // create variables to store mouse pointer y coordinate // and height of screen var cury; var height = window.innerheight; // get new mouse pointer coordinates when mouse is moved // then set new gain value document.onmousemove = updatepage; function updatepage(e) { cury = (window.event) ? e.pagey : event.clienty + (document.documentelement.scrolltop ? document.documentelement.scrolltop : document.body.scrolltop); gainnode.gain.value = cury/height; } // connect the audiobuffersourcenode to the gainnode // and the gainnode to the destination, so we can play the // music and adjust the vo...
AudioContext.getOutputTimestamp() - Web APIs
the getoutputtimestamp() property of the audiocontext interface returns a new audiotimestamp object containing two audio timestamp values relating to the current audio context. the two values are as follows: audiotimestamp.contexttime: the time of the sample frame currently being rendered by the audio output device (i.e., output audio stream position), in the same units and origin as the context's audiocontext.currenttime. basically, this is the time after the audio context was first created. audiotimestamp.performancetime: an estimation of the moment when the sample frame corresponding to the stored contexttime value was rendered by the audio output device, in the same units and origin as performance.now(). this is the time after the document containing the audio context was first render...
AudioContext.outputLatency - Web APIs
f the current audio context. this is the time, in seconds, between the browser passing an audio buffer out of an audio graph over to the host system's audio subsystem to play, and the time at which the first sample in the buffer is actually processed by the audio output device. it varies depending on the platform and the available hardware. syntax var outputlatency = audioctx.outputlatency; value a double representing the output latency in seconds. example const audioctx = new audiocontext(); console.log(audioctx.outputlatency); specifications specification status comment web audio apithe definition of 'outputlatency' in that specification. working draft ...
AudioContext.resume() - Web APIs
the promise is rejected if the context has already been closed. ...
AudioContext - Web APIs
diodestinationnode associated with a mediastream representing an audio stream which may be stored in a local file or sent to another computer. audiocontext.createmediastreamtracksource() creates a mediastreamtrackaudiosourcenode associated with a mediastream representing an media stream track. audiocontext.getoutputtimestamp() returns a new audiotimestamp object containing two audio timestamp values relating to the current audio context. audiocontext.resume() resumes the progression of time in an audio context that has previously been suspended/paused. audiocontext.suspend() suspends the progression of time in the audio context, temporarily halting audio hardware access and reducing cpu/battery usage in the process. examples basic audio context declaration: var audioctx = new audioc...
AudioContextOptions.sampleRate - Web APIs
the audiocontextoptions dictionary (used when instantiating an audiocontext) may contain a property named samplerate, which indicates the sample rate to use for the new context. the value must be a floating-point value indicating the sample rate, in samples per second, for which to configure the new context; additionally, the value must be one which is supported by audiobuffer.samplerate. syntax audiocontextoptions.samplerate = 44100; var samplerate = audiocontextoptions.samplerate; value the desired sample rate for the audiocontext, specified in samples per second. the value must be compatible with audiobuffer.samplerate. this value should typically be between 8,000 hz and 96,000 hz; the default will vary depending on the output device, but the sample rate 44,100 hz is the most common. ...
AudioDestinationNode.maxChannelCount - Web APIs
the maxchannelcount property of the audiodestinationnode interface is an unsigned long defining the maximum amount of channels that the physical device can handle. the audionode.channelcount property can be set between 0 and this value (both included). if maxchannelcount is 0, like in offlineaudiocontext, the channel count cannot be changed. syntax var audioctx = new audiocontext(); var mydestination = audioctx.destination; mydestination.maxchannelcount = 2; value an unsigned long. example the following would set up a simple audio graph, featuring an audiodestinationnode with maxchannelcount of 2: var audioctx = new audiocontext(); var source = audioctx.createmediaelementsource(mymediaelement); source.connect(gainnode); audioctx.destination.maxchannelcount = 2; gainnode.connect(audi...
AudioDestinationNode - Web APIs
destination of an audio graph in a given context — usually the speakers of your device. it can also be the node that will "record" the audio data when used with an offlineaudiocontext. audiodestinationnode has no output (as it is the output, no more audionode can be linked after it in the audio graph) and one input. the number of channels in the input must be between 0 and the maxchannelcount value or an exception is raised. the audiodestinationnode of a given audiocontext can be retrieved using the audiocontext.destination property. number of inputs 1 number of outputs 0 channel count mode "explicit" channel count 2 channel interpretation "speakers" properties inherits properties from its parent, audionode. audiodesti...
AudioNode.channelCount - Web APIs
the channelcount property of the audionode interface represents an integer used to determine how many channels are used when up-mixing and down-mixing connections to any inputs to the node. channelcount's usage and precise definition depend on the value of audionode.channelcountmode: it is ignored if the channelcountmode value is max. it is used as a maximum value if the channelcountmode value is clamped-max. it is used as the exact value if the channelcountmode value is explicit. syntax var oscillator = audioctx.createoscillator(); var channels = oscillator.channelcount; value an integer. example var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); var oscillator = audioctx.createoscillator(); var gainnode = audioctx.creategain...
AudioNode.context - Web APIs
Web › API › AudioNode › context
the read-only context property of the audionode interface returns the associated baseaudiocontext, that is the object representing the processing graph the node is participating in. syntax var acontext = anaudionode.context; value the audiocontext or offlineaudiocontext object that was used to construct this audionode. example const audiocontext = window.audiocontext || window.webkitaudiocontext; const audioctx = new audiocontext(); const oscillator = audioctx.createoscillator(); const gainnode = audioctx.creategain(); oscillator.connect(gainnode).connect(audioctx.destination); console.log(oscillator.context); // audiocontext console.log(oscillator.context === audioctx); // true specifications specification status comment web audio apithe definition of 'conte...
AudioNode.numberOfInputs - Web APIs
the numberofinputs property of the audionode interface returns the number of inputs feeding the node. source nodes are defined as nodes having a numberofinputs property with a value of 0. syntax var numinputs = audionode.numberofinputs; value an integer ≥ 0. example const audioctx = new audiocontext(); const oscillator = audioctx.createoscillator(); const gainnode = audioctx.creategain(); oscillator.connect(gainnode).connect(audioctx.destination); console.log(oscillator.numberofinputs); // 0 console.log(gainnode.numberofinputs); // 1 console.log(audioctx.destination.numberofinputs); // 1 specifications specification status comment web audio apithe definition of 'numberofinputs' in that specification. working draft ...
AudioNode.numberOfOutputs - Web APIs
the numberofoutputs property of the audionode interface returns the number of outputs coming out of the node. destination nodes — like audiodestinationnode — have a value of 0 for this attribute. syntax var numoutputs = audionode.numberofoutputs; value an integer ≥ 0. example const audioctx = new audiocontext(); const oscillator = audioctx.createoscillator(); const gainnode = audioctx.creategain(); oscillator.connect(gainnode).connect(audioctx.destination); console.log(oscillator.numberofoutputs); // 1 console.log(gainnode.numberofoutputs); // 1 console.log(audioctx.destination.numberofoutputs); // 0 specifications specification status comment web audio apithe definition of 'numberofoutputs' in that specification. working draft ...
AudioScheduledSourceNode.onended - Web APIs
(such as audiobuffersourcenode, oscillatornode, or constantsourcenode) determines that it has stopped playing. the ended event is only sent to a node configured to loop automatically when the node is stopped using its stop() method. this is the case, for example, when using an audiobuffersourcenode with its loop property set to true. syntax audioscheduledsourcenode.onended = eventhandler; value a function which is called by the browser when the ended event occurs on the audioscheduledsourcenode. the function receives as input a single parameter, which is an object of type event describing the event that occurred. examples in this simple example, an event listener for the ended event is set up to enable a "start" button in the user interface when the node stops playing. node.onended ...
AudioScheduledSourceNode.stop() - Web APIs
cified time replaces any previously-scheduled stop time that hasn't occurred yet. if the node has already stopped, this method has no effect. note: if a scheduled stop time occurs before the node's scheduled start time, the node never starts to play. syntax audioscheduledsourcenode.stop([when]); parameters when optional the time, in seconds, at which the sound should stop playing. this value is specified in the same time coordinate system as the audiocontext is using for its currenttime attribute. omitting this parameter, specifying a value of 0, or passing a negative value causes the sound to stop playback immediately. return value undefined exceptions invalidstatenode the node has not been started by calling start(). rangeerror the value specified for when is negative. ...
AudioScheduledSourceNode - Web APIs
create an audioscheduledsourcenode object directly. instead, use the interface which extends it, such as audiobuffersourcenode, oscillatornode, and constantsourcenode. unless stated otherwise, nodes based upon audioscheduledsourcenode output silence when not playing (that is, before start() is called and after stop() is called). silence is represented, as always, by a stream of samples with the value zero (0). properties inherits properties from its parent interface, audionode. methods inherits methods from its parent interface, audionode, and adds the following methods: start() schedules the node to begin playing the constant sound at the specified time. if no time is specified, the node begins playing immediately. stop() schedules the node to stop playing at the specified time. if...
AudioTrack.id - Web APIs
Web › API › AudioTrack › id
perty contains a string which uniquely identifies the track represented by the audiotrack. this id can be used with the audiotracklist.gettrackbyid() method to locate a specific track within the media associated with a media element. the track id can also be used as the fragment of a url that loads the specific track (if the media supports media fragments). syntax var trackid = audiotrack.id; value a domstring which identifies the track, suitable for use when calling gettrackbyid() on an audiotracklist such as the one specified by a media element's audiotracks property. specifications specification status comment html living standardthe definition of 'audiotrack.id' in that specification. living standard html5the definition of 'audiotrack.id...
AudioTrack.kind - Web APIs
Web › API › AudioTrack › kind
the string is one of those found in audio track kind strings below. ...
AudioTrack.label - Web APIs
Web › API › AudioTrack › label
otherwise, an empty string ("") is returned. for example, a track whose kind is "commentary" might have a label such as "commentary with director mark markmarkimark and star donna donnalidon". ...
AudioTrack.language - Web APIs
the read-only audiotrack property language returns a string identifying the language used in the audio track. for tracks that include multiple languages (such as a movie in english in which a few lines are spoken in other languages), this should be the video's primary language. syntax var audiotracklanguage = audiotrack.language; value a domstring specifying the bcp 47 (rfc 5646) format language tag of the primary language used in the audio track, or an empty string ("") if the language is not specified or known, or if the track doesn't contain speech. for example, if the primary language used in the track is united states english, this value would be "en-us". for brazilian portuguese, the value would be "pt-br". example this example locates all of a media element's primary language and...
AudioTrack.sourceBuffer - Web APIs
specifications specification status comment media source extensionsthe definition of 'audiotrack: sourcebuffer' in that specification. recommendation ...
AudioTrackList.getTrackById() - Web APIs
the audiotracklist method gettrackbyid() returns the first audiotrack object from the track list whose id matches the specified string. this lets you find a specified track if you know its id string. syntax var thetrack = audiotracklist.gettrackbyid(id); paramters id a domstring indicating the id of the track to locate within the track list. return value an audiotrack object indicating the first track found within the audiotracklist whose id matches the specified string. if no match is found, this method returns null. the tracks are searched in their natural order; that is, in the order defined by the media resource itself, or, if the resource doesn't define an order, the relative order in which the tracks are declared by the media resource. example this example suggests a hypothe...
AudioTrackList.onaddtrack - Web APIs
occurs, indicating that a new audio track has been added to the media element whose audio tracks the audiotracklist represents. the event is passed into the event handler in the form of a trackevent object, whose track property identifies the newly-added track. note: you can also add a handler for the addtrack event using addeventlistener(). syntax audiotracklist.onaddtrack = eventhandler; value set onaddtrack to a function that accepts as input a trackevent object which indicates in its track property which audio track has been added to the media. usage notes the addtrack event is called whenever a new track is added to the media element whose audio tracks are represented by the audiotracklist object. this happens when tracks are added to the element when the media is first attached ...
AudioTrackList.onchange - Web APIs
list have been enabled or disabled. the event is passed into the event handler in the form of an event object; the event doesn't provide any additional information. to determine the new state of media's tracks, you'll have to look at their audiotrack.enabled flags. note: you can also add a handler for the change event using addeventlistener(). syntax audiotracklist.onchange = eventhandler; value set onchange to a function that should be called whenever tracks are enabled or disabled on the media element. example this snippet establishes a handler for the change event that looks at each of the tracks in the list, calling a function to update the state of a user interface control that indicates the current state of the track. var tracklist = document.queryselector("video").audiotracks;...
AudioTrackList.onremovetrack - Web APIs
removed from the media element, and therefore also from the audiotracklist. the event is passed into the event handler in the form of a trackevent object, whose track property identifies the track that was removed from the media element's audiotracklist. note: you can also add a handler for the removetrack event using addeventlistener(). syntax audiotracklist.onremovetrack = eventhandler; value set onremovetrack to a function that accepts as input a trackevent object which indicates in its track property which audio track has been removed from the media element. example this simple example just fetches the current number of audio tracks in the media element whenever a track is removed from the media element. document.queryselector("my-video").audiotracks.onremovetrack = function(eve...
AudioWorkletGlobalScope - Web APIs
le we output all global properties into the console in the constructor of a custom audioworkletprocessor. first we need to define the processor, and register it. note that this should be done in a separate file. ...
AudioWorkletNode.port - Web APIs
the read-only port property of the audioworkletnode interface returns the associated messageport. it can be used to communicate between the node and its associated audioworkletprocessor. note: the port at the other end of the channel is available under the port property of the processor. syntax audioworkletnodeinstance.port; value the messageport object that is connecting the audioworkletnode and its associated audioworkletprocessor. examples to demonstrate bidirectional communication capabilities, we'll create an audioworkletprocessor, which will output silence and respond to ping requests from its audioworkletnode. first, we need to define a custom audioworkletprocessor, and register it. note that that this should be done in a separate file. // ping-pong-processor.js cla...
AudioWorkletNode - Web APIs
s. they are instantiated during the creation of the underlying audioworkletprocessor. if the audioworkletprocessor has a static parameterdescriptors getter, the audioparamdescriptor array returned from it is used to create audioparam objects on the audioworkletnode. with this mechanism it is possible to make your own audioparam objects accessible from your audioworkletnode. you can then use their values in the associated audioworkletprocessor. event handlers audioworkletnode.onprocessorerror fired when an error is thrown in associated audioworkletprocessor. once fired, the processor and consequently the node will output silence throughout its lifetime. methods also inherits methods from its parent, audionode. the audioworkletnode interface does not define any methods of its own. exam...
AudioWorkletProcessor.port - Web APIs
the read-only port property of the audioworkletprocessor interface returns the associated messageport. it can be used to communicate between the processor and the audioworkletnode to which it belongs. note: the port at the other end of the channel is available under the port property of the node. syntax audioworkletprocessorinstance.port; value the messageport object that is connecting the audioworkletprocessor and the associated audioworkletnode. examples to demonstrate bidirectional communication capabilities, we'll create an audioworkletprocessor, which will output silence and respond to ping requests from its audioworkletnode. first, we need to define a custom audioworkletprocessor, and register it. note that that this should be done in a separate file. // ping-pong-pr...
BaseAudioContext.audioWorklet - Web APIs
the audioworklet read-only property of the baseaudiocontext interface returns an instance of audioworklet that can be used for adding audioworkletprocessor-derived classes which implement custom audio processing. syntax baseaudiocontextinstance.audioworklet; value an audioworklet instance. examples for a complete example demonstrating user-defined audio processing, see the audioworkletnode page. specifications specification status comment web audio apithe definition of 'audioworklet' in that specification. working draft initial definition. ...
BaseAudioContext.createBufferSource() - Web APIs
t = document.queryselector('script'); pre.innerhtml = myscript.innerhtml; // 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.getchanneldata(channel); for (var i = 0; i < framecount; i++) { // math.random() is in [0; 1.0] // audio needs to be in [-1.0; 1.0] nowbuffering[i] = math.random() * 2 - 1; } } // get an audio...
BaseAudioContext.createChannelMerger() - Web APIs
d the index of the channel to connect to. var ac = new audiocontext(); ac.decodeaudiodata(somestereobuffer, function(data) { var source = ac.createbuffersource(); source.buffer = data; var splitter = ac.createchannelsplitter(2); source.connect(splitter); var merger = ac.createchannelmerger(2); // reduce the volume of the left channel only var gainnode = ac.creategain(); gainnode.gain.setvalueattime(0.5, ac.currenttime); splitter.connect(gainnode, 0); // connect the splitter back to the second input of the merger: we // effectively swap the channels, here, reversing the stereo image. gainnode.connect(merger, 0, 1); splitter.connect(merger, 1, 0); var dest = ac.createmediastreamdestination(); // because we have used a channelmergernode, we now have a stereo // mediastream we ...
BaseAudioContext.createChannelSplitter() - Web APIs
d the index of the channel to connect to. var ac = new audiocontext(); ac.decodeaudiodata(somestereobuffer, function(data) { var source = ac.createbuffersource(); source.buffer = data; var splitter = ac.createchannelsplitter(2); source.connect(splitter); var merger = ac.createchannelmerger(2); // reduce the volume of the left channel only var gainnode = ac.creategain(); gainnode.gain.setvalueattime(0.5, ac.currenttime); splitter.connect(gainnode, 0); // connect the splitter back to the second input of the merger: we // effectively swap the channels, here, reversing the stereo image. gainnode.connect(merger, 0, 1); splitter.connect(merger, 1, 0); var dest = ac.createmediastreamdestination(); // because we have used a channelmergernode, we now have a stereo // mediastream we ...
BaseAudioContext.createConstantSource() - Web APIs
syntax var constantsourcenode = audiocontext.createconstantsource() parameters none. returns a constantsourcenode instance. specifications specification status comment web audio apithe definition of 'createconstantsource()' in that specification. working draft initial definition. ...
BaseAudioContext.createOscillator() - Web APIs
ator node. for applied examples/information, check out our violent theremin demo (see app.js for relevant code); also see our oscillatornode page for more information. // create web audio api context var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); // create oscillator node var oscillator = audioctx.createoscillator(); oscillator.type = 'square'; oscillator.frequency.setvalueattime(3000, audioctx.currenttime); // value in hertz oscillator.connect(audioctx.destination); oscillator.start(); specifications specification status comment web audio apithe definition of 'createoscillator' in that specification. working draft ...
BaseAudioContext.currentTime - Web APIs
by default and defaults to 20us in firefox 59; in 60 it will be 2ms. // reduced time precision (2ms) in firefox 60 audioctx.currenttime; // 23.404 // 24.192 // 25.514 // ... // reduced time precision with `privacy.resistfingerprinting` enabled audioctx.currenttime; // 49.8 // 50.6 // 51.7 // ... in firefox, you can also enabled privacy.resistfingerprinting, the precision will be 100ms or the value of privacy.resistfingerprinting.reducetimerprecision.microseconds, whichever is larger. specifications specification status comment web audio apithe definition of 'currenttime' in that specification. working draft initial definition. ...
BaseAudioContext.decodeAudioData() - Web APIs
oding successfully finishes. the single argument to this callback is an audiobuffer representing the decodeddata (the decoded pcm audio data). usually you'll want to put the decoded data into an audiobuffersourcenode, from which it can be played and manipulated how you want. errorcallback an optional error callback, to be invoked if an error occurs when the audio data is being decoded. return value void, or a promise object that fulfills with the decodeddata. example in this section we will first cover the older callback-based system and then the newer promise-based syntax. older callback syntax in this example, the getdata() function uses xhr to load an audio track, setting the responsetype of the request to arraybuffer so that it returns an array buffer as its response that we then s...
BaseAudioContext.destination - Web APIs
example note: for a full example implementation, see one of our web audio demos on the mdn github repo, like voice-change-o-matic. ...
BaseAudioContext.listener - Web APIs
example note: for a full web audio spatialization example, see our panner-node demo. var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); // older webkit/blink browsers require a prefix ... ...
BaseAudioContext.sampleRate - Web APIs
the samplerate property of the baseaudiocontext interface returns a floating point number representing the sample rate, in samples per second, used by all nodes in this audio context. this limitation means that sample-rate converters are not supported. syntax baseaudiocontext.samplerate; value a floating point number indicating the audio context's sample rate, in samples per second. example note: for a full web audio example implementation, see one of our web audio demos on the mdn github repo, like panner-node. try entering audioctx.samplerate into your browser console. var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); // older webkit/blink browsers require a prefix ... console.log(audioctx.samplerate); specifications ...
BaseAudioContext.state - Web APIs
closed: the audio context has been closed (with the audiocontext.close() method.) example the following snippet is taken from our audiocontext states demo (see it running live.) the audiocontext.onstatechange hander is used to log the current state to the console every time it changes. ...
BaseAudioContext - Web APIs
te audio data contained within an audiobuffer object. audiobuffers are created using audiocontext.createbuffer or returned by audiocontext.decodeaudiodata when it successfully decodes an audio track. baseaudiocontext.createconstantsource() creates a constantsourcenode object, which is an audio source that continuously outputs a monaural (one-channel) sound signal whose samples all have the same value. baseaudiocontext.createchannelmerger() creates a channelmergernode, which is used to combine channels from multiple audio streams into a single audio stream. baseaudiocontext.createchannelsplitter() creates a channelsplitternode, which is used to access the individual channels of an audio stream and process them separately. baseaudiocontext.createconvolver() creates a convolvernode, which ...
BasicCardRequest.supportedNetworks - Web APIs
the supportednetworks property of the basiccardrequest dictionary contains an array of domstrings representing the card networks that the retailer supports (e.g. amex, mastercard). syntax supportednetworks : [value [, ... value]] value an array containing one or more domstrings, which describe the card networks the retailer supports. legal values are defined in the w3c's document card network identifiers approved for use with payment request api, and are currently: amex cartebancaire diners discover jcb mastercard mir unionpay visa example the following example shows a sample definition of the first parameter of the paymentrequest() constructor, the data property of which contains supportednetworks and supportedtypes properties. var supportedinstruments = [{ supportedme...
BasicCardRequest.supportedTypes - Web APIs
est dictionary can optionally be provided to specify an array of domstrings representing the card types that the retailer supports (e.g. credit, debit, prepaid). this property is obsolete and should no longer be used. instead of making the web app or site worry about this, the onus has been transferred to the payment processor. syntax basiccardrequest.supportedtypes = [cardtype1...cardtypen]; value an array containing one or more domstrings, which describe the card types the retailer supports. legal values are defined in basiccardtype enum, and are currently: credit debit prepaid example the following example shows a sample definition of the first parameter of the paymentrequest() constructor, the data property of which contains supportednetworks and supportedtypes properties. var...
BasicCardResponse.billingAddress - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. ...
BasicCardResponse.cardNumber - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. console.log(instrumentresponse.details); }) .catch(function(err) { // do something with the error from request.show(). ...
BasicCardResponse.cardSecurityCode - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. ...
BasicCardResponse.cardholderName - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. ...
BasicCardResponse.expiryMonth - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. ...
BasicCardResponse.expiryYear - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. ...
BatteryManager.charging - Web APIs
a boolean value indicating whether or not the device's battery is currently being charged. syntax var charging = battery.charging on return, charging indicates whether or not the battery, which is a batterymanager object, is currently being charged; if the battery is charging, this value is true. otherwise, the value is false. example html content <div id="charging">(charging state unknown)</div> javascript content navigator.getbattery().then(function(battery) { var charging = battery.charging; document.queryselector('#charging').textcontent = charging ; }); specifications specification status comment battery status api candidate recommendation initial definition ...
BatteryManager.chargingTime - Web APIs
the time returned is precise to the second, browsers round them to a higher interval (typically to the closest 15 minutes) for privacy reasons. syntax var time = battery.chargingtime on return, time is the remaining time in seconds until the battery, which is a batterymanager object, is fully charged, or 0 if the battery is already fully charged. if the battery is currently discharging, this value is infinity. example html content <div id="chargingtime">(charging time unknown)</div> javascript content navigator.getbattery().then(function(battery) { var time = battery.chargingtime; document.queryselector('#chargingtime').textcontent = battery.chargingtime; }); specifications specification status comment battery status api candidate recommend...
BatteryManager.dischargingTime - Web APIs
ains until the battery is fully discharged. even if the time returned is precise to the second, browsers round them to a higher interval (typically to the closest 15 minutes) for privacy reasons. syntax var time = battery.dischargingtime on return, time is the remaining time in seconds until the battery, which is a batterymanager object, is fully discharged and the system will suspend. this value is infinity if the battery is currently charging rather than discharging, or if the system is unable to report the remaining discharging time. example html content <div id="dischargingtime">(discharging time unknown)</div> javascript content navigator.getbattery().then(function(battery) { var time = battery.dischargingtime; document.queryselector('#dischargingtime').textcontent = ...
BatteryManager.level - Web APIs
indicates the current battery charge level as a value between 0.0 and 1.0. syntax var level = battery.level on return, level is a number representing the system's battery charge level scaled to a value between 0.0 and 1.0. a value of 0 means the battery, which is a batterymanager object, is empty and the system is about to be suspended. a value of 1.0 means the battery is full. a value of 1.0 is also returned if the implementation isn't able to determine the battery charge level or if the system is not battery-powered. example html content <div id="level">(battery level unknown)</div> javascript content navigator.getbattery().then(function(battery) { var level = battery.level; document.queryselector('#level').textcontent = level; }); specifications specific...
Blob.size - Web APIs
Web › API › Blob › size
example this example uses an <input> element of type file to ask the user for a group of files, then iterates over those files outputting their names and lengths in bytes. ...
Blob.type - Web APIs
Web › API › Blob › type
example this example asks the user to select a number of files, then checks each file to make sure it's one of a given set of image file types. ...
Blob - Web APIs
Web › API › Blob
s it to an object url. a link to open that object url is created. click the link to see the decoded object url.</p> javascript the main piece of this code for example purposes is the typedarraytourl() function, which creates a blob from the given typed array and returns an object url for it. having converted the data into an object url, it can be used in a number of ways, including as the value of the <img> element's src attribute (assuming the data contains an image, of course). function typedarraytourl(typedarray, mimetype) { return url.createobjecturl(new blob([typedarray.buffer], {type: mimetype})) } const bytes = new uint8array(59); for(let i = 0; i < 59; i++) { bytes[i] = 32 + i; } const url = typedarraytourl(bytes, 'text/plain'); const link = document.createelement('a');...
BlobEvent.timecode - Web APIs
the timecode readonlyinline property of the blobevent interface a domhighrestimestamp indicating the difference between the timestamp of the first chunk in data, and the timestamp of the first chunk in the first blobevent produced by this recorder. note that the timecode in the first produced blobevent does not need to be zero. syntax var timecode = blobevent.timecode value a domhighrestimestamp. specifications specification status comment mediastream recordingthe definition of 'timecode' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us...
Bluetooth.getAvailability() - Web APIs
the getavailability() method of bluetooth interface of web bluetooth api interface exposes the bluetooth capabilities of the current device. for a returns a boolean which is true if the deveice has a bluetooth adapter and false otherwise (unless user configured user agent not to expose a real value). note: user might not allow use of web bluetooth api, even if getavailability() returned true (navigator.bluetooth.requestdevice() might not resolve with a bluetoothdevice). also, user can configure user agent to return a fixed value instead of a real one. syntax var readerpromise = bluetooth.getavailability(); parameters none. return value a promise that resolves with boolean. exceptions this method doesn't throw any exceptions. examples the following snippet prints out a message ...
Bluetooth.getDevices() - Web APIs
his method returns a bluetoothdevice for each device the origin is currently allowed to access, even the ones that are out of range or powered off. the program can detect when a device comes online or into range by watching for bluetooth advertisements by calling bluetoothdevice.watchadvertisements() on that device. syntax var readerpromise = bluetooth.getdevices(); parameters none. return value a promise that resolves with an array of bluetoothdevices. exceptions this method doesn't throw any exceptions. specifications specification status comment web bluetooththe definition of 'getdevices()' in that specification. draft initial definition. ...
Bluetooth.onavailabilitychanged - Web APIs
the onavailabilitychanged property of the bluetooth interface is an eventhandler that processes availabilitychanged events that fire when the bluetooth system as a whole becomes available or unavailable to the user agent. syntax bluetooth.onavailabilitychanged = functionref; value functionref is the handler function to be called when the bluetooth availabilitychanged event fires. specifications specification status comment web bluetooththe definition of 'bluetooth' in that specification. draft initial definition. ...
Bluetooth.referringDevice - Web APIs
the bluetooth.referringdevice attribute of the bluetooth interface returns a bluetoothdevice if the current document was opened in response to an instruction sent by this device and null otherwise. syntax bluetooth.referringdevice value a bluetoothdevice, if the document was opened in response to an instruction sent by this device and null otherwise. specifications specification status comment web bluetooththe definition of 'referringdevice' in that specification. draft initial definition. ...
Bluetooth - Web APIs
Web › API › Bluetooth
.bluetooth.referringdevice. events bluetooth.onavailabilitychanged an event handler that runs when an event of type availabilitychanged has fired. methods bluetooth.getavailability() returns a promise that resolved to a boolean indicating whether the user-agent has the ability to support bluetooth. some user-agents let the user configure an option that affects what is returned by this value. if this option is set, that is the value returned by this method. bluetooth.getdevices() returns a promise that resolved to an array of bluetoothdevices which the origin already obtained permission for via a call to bluetooth.requestdevice(). bluetooth.requestdevice() returns a promise to a bluetoothdevice object with the specified options. specifications specification status ...
BluetoothAdvertisingData.appearance - Web APIs
syntax var appearance = bluetoothadvertisingdata.appearance; ...
BluetoothAdvertisingData - Web APIs
api provides advertising data about a particular bluetooth device. interface interface bluetoothadvertisingdata { readonly attribute unsigned short? appearance; readonly attribute byte? txpower; readonly attribute byte? rssi; readonly attribute map manufacturerdata; readonly attribute map servicedata; }; properties bluetoothadvertisingdata.appearance read only returns one of the values defined by the org.bluetooth.characteristic.gap.appearance characteristic. bluetoothadvertisingdata.txpower read only returns the transmission power at which the device is broadcasting, measured in dbm. this is used to compute the path loss as this.txpower - this.rssi. bluetoothadvertisingdata.rssi read only returns the power at which the device’s packets are being received, measured in ...
BluetoothCharacteristicProperties.authenticatedSignedWrites - Web APIs
the authenticatedsignedwrites read-only property of the bluetoothcharacteristicproperties interface returns a boolean that is true if signed writing to the characteristic value is permitted. syntax var aboolean = bluetoothcharacteristicproperties.authenticatedsignedwrites; value a boolean. specifications specification status comment web bluetooththe definition of 'authenticatedsignedwrites' in that specification. draft initial definition. ...
BluetoothCharacteristicProperties.broadcast - Web APIs
the broadcast read-only property of the bluetoothcharacteristicproperties interface returns a boolean that is true if the broadcast of the characteristic value is permitted using the server characteristic configuration descriptor. syntax var aboolean = bluetoothcharacteristicproperties.broadcast; value a boolean. specifications specification status comment web bluetooththe definition of 'broadcast' in that specification. draft initial definition. ...
BluetoothCharacteristicProperties.indicate - Web APIs
the indicate read-only property of the bluetoothcharacteristicproperties interface returns a boolean that is true if indications of the characteristic value with acknowledgement is permitted. syntax var aboolean = bluetoothcharacteristicproperties.indicate; value a boolean. specifications specification status comment web bluetooththe definition of 'indicate' in that specification. draft initial definition. ...
BluetoothCharacteristicProperties.notify - Web APIs
the notify read-only property of the bluetoothcharacteristicproperties interface returns a boolean that is true if notifications of the characteristic value without acknowledgement is permitted. syntax var aboolean = bluetoothcharacteristicproperties.notify; value a boolean. specifications specification status comment web bluetooththe definition of 'notify' in that specification. draft initial definition. ...
BluetoothCharacteristicProperties.read - Web APIs
the read read-only property of the bluetoothcharacteristicproperties interface returns a boolean that is true if the reading of the characteristic value is permitted. syntax var aboolean = bluetoothcharacteristicproperties.read; value a boolean. specifications specification status comment web bluetooththe definition of 'read' in that specification. draft initial definition. ...
BluetoothCharacteristicProperties.reliableWrite - Web APIs
the reliablewrite read-only property of the bluetoothcharacteristicproperties interface returns a boolean that is true if reliable writes to the characteristic is permitted. syntax var aboolean = bluetoothcharacteristicproperties.reliablewrite; value a boolean specifications specification status comment web bluetooththe definition of 'reliablewrite' in that specification. draft initial definition. ...
BluetoothCharacteristicProperties.writableAuxiliaries - Web APIs
the writableauxiliaries read-only property of the bluetoothcharacteristicproperties interface returns a boolean that is true if reliable writes to the characteristic descriptor is permitted. syntax var aboolean = bluetoothcharacteristicproperties.writableauxiliaries; value a boolean. specifications specification status comment web bluetooththe definition of 'writableauxiliaries' in that specification. draft initial definition. ...
BluetoothCharacteristicProperties.write - Web APIs
the write read-only property of the bluetoothcharacteristicproperties interface returns a boolean that is true if the writing to the characteristic with response is permitted. syntax var aboolean = bluetoothcharacteristicproperties.write; value a boolean. specifications specification status comment web bluetooththe definition of 'write' in that specification. draft initial definition. ...
BluetoothCharacteristicProperties.writeWithoutResponse - Web APIs
the writewithoutresponse read-only property of the bluetoothcharacteristicproperties interface returns a boolean that is true if the writing to the characteristic without response is permitted. syntax var aboolean = bluetoothcharacteristicproperties.writewithoutresponse; value a boolean. specifications specification status comment web bluetooththe definition of 'authenticatedsignedwrites' in that specification. draft initial definition. ...
BluetoothDevice.paired - Web APIs
the bluetoothdevice.paired read-only property returns a boolean value indicating whether the device is paired with the system. syntax var paired = instanceofbluetoothdevice.paired returns a boolean. ...
BluetoothDevice - Web APIs
id field in the pnp_id characteristic in the device_information service. bluetoothdevice.productid read only the 16-bit product id field in the pnp_id characteristic in the device_information service. bluetoothdevice.productversion read only the 16-bit product version field in the pnp_id characteristic in the device_information service. bluetoothdevice.paired read only a boolean value indicating whether the device is paired with the system. bluetoothdevice.gattserver read only a reference to the device's gatt server or null if the device is disconnected. methods bluetoothdevice.watchadvertisments() a promise that resolves to undefined or is rejected with an error if advetisments can’t shown for any reason. bluetoothdevice.unwatchadvertisments() stops watchi...
BluetoothRemoteGATTServer.connected - Web APIs
it can be false while the user agent is physically connected. ...
BluetoothRemoteGATTServer - Web APIs
it can be false while the user agent is physically connected. bluetoothremotegattserver.deviceread only a reference to the bluetoothdevice running the server. methods bluetoothremotegattserver.connect() causes the script execution environment to connect to this.device. bluetoothremotegattserver.discon...
Body.arrayBuffer() - Web APIs
Web › API › Body › arrayBuffer
examples playing music in our fetch array buffer live, we have a play button. when pressed, the getdata() function is run. note that before playing full audio file will be downloaded. ...
Body.blob() - Web APIs
Web › API › Body › blob
ponse stream and reads it to completion. it returns a promise that resolves with a blob. syntax response.blob().then(function(myblob) { // do something with myblob }); parameters none. note: if the response has a response.type of "opaque", the resulting blob will have a blob.size of 0 and a blob.type of empty string "", which renders it useless for methods like url.createobjecturl. return value a promise that resolves with a blob. example in our fetch request example (run fetch request live), we create a new request using the request() constructor, then use it to fetch a jpg. when the fetch is successful, we read a blob out of the response using blob(), put it into an object url using url.createobjecturl, and then set that url as the source of an <img> element to display the image. ...
Body.bodyUsed - Web APIs
Web › API › Body › bodyUsed
example in our fetch request example (run fetch request live), we create a new request using the request() constructor, then use it to fetch a jpg. when the fetch is successful, we read a blob out of the response using blob(), put it into an object url using url.createobjecturl, and then set that url as the source of an <img> element to display the image. ...
Body.formData() - Web APIs
Web › API › Body › formData
the formdata() method of the body mixin takes a response stream and reads it to completion. it returns a promise that resolves with a formdata object. note: this is mainly relevant to service workers. if a user submits a form and a service worker intercepts the request, you could for example call formdata() on it to obtain a key-value map, modify some fields, then send the form onwards to the server (or use it locally). syntax response.formdata() .then(function(formdata) { // do something with your formdata }); parameters none. return value a promise that resolves with a formdata object. example tbd. specifications specification status comment fetchthe definition of 'formdata()' in that specification. living standard ...
Body.json() - Web APIs
Web › API › Body › json
the json() method of the body mixin takes a response stream and reads it to completion. it returns a promise that resolves with the result of parsing the body text as json. syntax response.json().then(data => { // do something with your data }); parameters none. return value a promise that resolves to a javascript object. this object could be anything that can be represented by json — an object, an array, a string, a number... example in our fetch json example (run fetch json live), we create a new request using the request() constructor, then use it to fetch a .json file. when the fetch is successful, we read and parse the data using json(), then read values out of the resulting objects as you'd expect and insert them into list items to display our product data. const mylist = do...
Body.text() - Web APIs
Web › API › Body › text
the text() method of the body mixin takes a response stream and reads it to completion. it returns a promise that resolves with a usvstring object (text). the response is always decoded using utf-8. syntax response.text().then(function (text) { // do something with the text response }); parameters none. return value a promise that resolves with a usvstring. example in our fetch text example (run fetch text live), we have an <article> element and three links (stored in the mylinks array.) first, we loop through all of these and give each one an onclick event handler so that the getdata() function is run — with the link's data-page identifier passed to it as an argument — when one of the links is clicked. when getdata() is run, we create a new request using the request() construct...
BroadcastChannel() - Web APIs
example // create a new channel listening to the "internal_notification" channel. ...
BroadcastChannel: message event - Web APIs
ding: .2rem; } label, br { margin: .5rem 0; } button { vertical-align: top; height: 1.5rem; } const channel = new broadcastchannel('example-channel'); const messagecontrol = document.queryselector('#message'); const broadcastmessagebutton = document.queryselector('#broadcast-message'); broadcastmessagebutton.addeventlistener('click', () => { channel.postmessage(messagecontrol.value); }) receiver 1 <h1>receiver 1</h1> <div id="received"></div> body { border: 1px solid black; padding: .5rem; height: 100px; font-family: "fira sans", sans-serif; } h1 { font: 1.6em "fira sans", sans-serif; margin-bottom: 1rem; } const channel = new broadcastchannel('example-channel'); channel.addeventlistener('message', (event) => { received.textcontent = event...
BroadcastChannel.onmessage - Web APIs
the broadcastchannel.onmessage event handler is a property that specifies the function to execute when a message event, of type messageevent, is received by this broadcastchannel. such an event is sent by the browser with a message broadcasted to the channel. note: this feature is available in web workers. syntax channel.onmessage = function; values function is the name of a user-defined function, without the () suffix or any parameters, or an anonymous function declaration, such as function(event) {...}. an event handler always has one single parameter, containing the event, here of type messageevent. example bc.onmessage = function(ev) { console.log(`message event received! '${ev.data}'`); }; specifications specification status comment html living standa...
BudgetState.budgetAt - Web APIs
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. ...
BudgetState.time - Web APIs
Web › API › BudgetState › time
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. ...
BudgetState - Web APIs
methods none. browser compatibility the compatibility table on this page is generated from structured data. ...
ByteLengthQueuingStrategy.ByteLengthQueuingStrategy() - Web APIs
() constructor creates and returns a bytelengthqueuingstrategy object instance. syntax var bytelengthqueuingstrategy = new bytelengthqueuingstrategy({highwatermark}); parameters {highwatermark} an object containing a highwatermark property. this is a non-negative integer defining the total number of chunks that can be contained in the internal queue before backpressure is applied. return value an instance of the bytelengthqueuingstrategy object. exceptions none. examples const queuingstrategy = new bytelengthqueuingstrategy({ highwatermark: 1 }); const readablestream = new readablestream({ start(controller) { ... }, pull(controller) { ... }, cancel(err) { console.log("stream error:", err); } }, queuingstrategy); var size = queuingstrategy.size(chunk); sp...
ByteLengthQueuingStrategy.size() - Web APIs
examples const queuingstrategy = new bytelengthqueuingstrategy({ highwatermark: 1 }); const readablestream = new readablestream({ start(controller) { ... }, pull(controller) { ... ...
CSS.paintWorklet (Static property) - Web APIs
Web › API › CSS › paintWorklet
examples the following example demonstrates loading a paintworklet from its js file and does so by feature detection. ...
CSS.supports() - Web APIs
Web › API › CSS › supports
the css.supports() method returns a boolean value indicating if the browser supports a given css feature, or not. syntax css.supports(propertyname, value); css.supports(supportcondition); parameters there are two distinct sets of parameters. the first one allows to test the support of a pair property-value: propertyname a domstring containing the name of the css property to check. value a domstring containing the value of the css property to check. the second syntax takes one parameter matching the condition of @supports: supportcondition a domstring containing the condition to check. return value true if the browser supports the rule, otherwise false. examples result = css.supports("text-decoration-style", "blink"); result = css.supports("display: flex"); result = css.su...
CSSKeyframeRule - Web APIs
properties as a cssrule, csskeyframerule also implements the properties of these interfaces. it has two specific properties: csskeyframe.keytext represents the key of the keyframe, like '10%', '75%'. the from keyword maps to '0%' and the to keyword maps to '100%'. ...
CSSKeyframesRule - Web APIs
properties as a cssrule, csskeyframesrule also implements the properties of these interfaces. it has two properties : csskeyframesrule.name represents the name of the animation, used by the animation-name property. ...
CSSMathProduct.CSSMathProduct() - Web APIs
the cssmathproduct() constructor creates a new cssmathproduct object which creates a new cssmathproduct object which syntax var cssmathproduct = new cssmathproduct() parameters arg a value for the cssmathproduct object to be constructed either a double integer or a cssnumericvalue. specifications specification status comment css typed om level 1the definition of 'cssmathproduct()' in that specification. working draft initial definition. ...
CSSMathSum.CSSMathSum() - Web APIs
the cssmathsum() constructor creates a new cssmathsum object which creates a new csskeywordvalue object which represents the result obtained by calling add(), sub(), or tosum() on cssnumericvalue. syntax var cssmathsum = new cssmathsum() parameters values one or more double integers or cssnumericvalue objects. specifications specification status comment css typed om level 1the definition of 'cssmathsum()' in that specification. working draft initial definition. ...
CSSMediaRule - Web APIs
syntax the syntax is described using the webidl format. interface cssmediarule : cssconditionrule { readonly attribute medialist media; } properties as a cssconditionrule, and therefore both a cssgroupingrule and a cssrule, cssmediarule also implements the properties of these interfaces. ...
CSSNamespaceRule - Web APIs
syntax the syntax is described using the webidl format. interface cssnamespacerule : cssrule { readonly attribute domstring namespaceuri; readonly attribute domstring? prefix; }; properties as a cssrule, cssnamespacerule also implements the properties of that interface. it has some specific properties: cssnamespacerule.namespaceuri returns a domstring containing the text of the uri of the given namespace. ...
CSSPageRule - Web APIs
syntax the syntax is described using the webidl format. interface csspagerule : cssrule { attribute domstring selectortext; readonly attribute cssstyledeclaration style; }; properties as a cssrule, csspagerule also implements the properties of this interface. it has the following specific properties: csspagerule.selectortext represents the text of the page selector associated with the at-rule. csspagerule.style read only returns the declaration block associated with the at-rule. ...
CSSPseudoElement.element - Web APIs
the element read-only property of the csspseudoelement interface returns a reference to the originating element of the pseudo-element, in other words its parent element. syntax var originatingelement = csspseudoelement.element; value an element representing the pseudo-element's originating element. examples the example below demonstrates the relationship between csspseudoelement.element and element.pseudo(): const myelement = document.queryselector('q'); const csspseudoelement = myelement.pseudo('::after'); const originatingelement = csspseudoelement.element; console.log(myelement === originatingelement); // outputs true console.log(myelement.parentelement === originatingelement); // outputs false console.log(myelement.lastelementchild === csspseudoelement); //...
CSSStyleDeclaration.getPropertyPriority() - Web APIs
"important") if one exists. if none exists, returns the empty string. ...
CSSStyleDeclaration.item() - Web APIs
nterface returns a css property name from a cssstyledeclaration by index. this method doesn't throw exceptions as long as you provide arguments; the empty string is returned if the index is out of range and a typeerror is thrown if no argument is provided. syntax var propertyname = style.item(index); parameters index is the index of the node to be fetched. the index is zero-based. return value propertyname is a domstring that is the name of the css property at the specified index. javascript has a special simpler syntax for obtaining an item from a nodelist by index: var propertyname = style[index]; example var style = document.getelementbyid('div1').style; var propertyname = style.item(1); // or simply style[1] - returns the second style listed specifications speci...
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 s...
CSSStyleDeclaration.parentRule - Web APIs
the cssstyledeclaration.parentrule read-only property returns a cssrule that is the parent of this style block, e.g. a cssstylerule representing the style for a css selector. syntax var rule = styles.parentrule; value the css rule that contains this declaration block or null if this cssstyledeclaration is not attached to a cssrule. example the following javascript code gets the parent css style rule from a cssstyledeclaration: var declaration = document.stylesheets[0].rules[0].style; var rule = declaration.parentrule; specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration.parentrule' in that specification. working draft document object model (dom) level 2 style specificationthe definition...
CSSStyleRule.styleMap - Web APIs
the stylemap read-only property of the cssstylerule interface returns a stylepropertymap object which provides access to the rule's property-value pairs. syntax var stylepropertymap = cssstylerule.stylemap; value a stylepropertymap object. specifications specification status comment css typed om level 1the definition of 'stylemap' in that specification. working draft initial definition. ...
CSSStyleSheet.addRule() - Web APIs
tion of the css rule. the default 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 th...
CSSStyleSheet.cssRules - Web APIs
each entry in the rule list is a cssrule object describing one rule making up the stylesheet. ...
CSSStyleSheet.deleteRule() - Web APIs
the cssstylesheet method deleterule() removes a rule from the stylesheet object. syntax cssstylesheet.deleterule(index) parameters index the index into the stylesheet's cssrulelist indicating the rule to be removed. return value undefined example this example removes the first rule from the stylesheet mystyles. mystyles.deleterule(0); specifications specification status comment css object model (cssom)the definition of 'cssstylesheet.deleterule()' in that specification. working draft ...
CSSStyleSheet.insertRule() - Web APIs
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 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 hie...
CSSStyleSheet.ownerRule - Web APIs
the read-only cssstylesheet property ownerrule returns the cssimportrule corresponding to the @import at-rule which imported the stylesheet into the document. if the stylesheet wasn't imported into the document using @import, the returned value is null. syntax var ownerrule = cssstylesheet.ownerrule; value a cssimportrule corresponding to the @import rule which imported the stylesheet into the document. if the stylesheet wasn't imported into the document using @import, the returned value is null. examples this snippet of code looks for rules which were not imported into the document using an @import at-rule. let rulelist = document.stylesheets[0].cssrules; for (let rule of rulelist) { if (!rule.ownerrule) { /* rule is not imported */ } } this snipped obtains a reference to th...
CSSStyleSheet.removeRule() - Web APIs
le() removes a rule from the stylesheet object. it is functionally identical to the standard, preferred method deleterule(). note: this is a legacy method which has been replaced by the standard method deleterule(). you should use that instead. syntax cssstylesheet.removerule(index) parameters index the index into the stylesheet's cssrulelist indicating the rule to be removed. return value undefined example this example removes the first rule from the stylesheet mystyles. mystyles.removerule(0); you can rewrite this to use the standard deleterule() method very easily: mystyles.deleterule(0); specifications specification status comment css object model (cssom)the definition of 'cssstylesheet.removerule()' in that specification. working draft ...
CSSStyleSheet.rules - Web APIs
cssrules property, it provides access to a live-updating list of the css rules comprising the stylesheet. note: as a legacy property, you not use rules and should instead use the preferred cssrules. while rules is unlikely to be removed soon, its availability is not as widespread and using it will result in compatibility problems for your site or app. syntax var rules = cssstylesheet.rules; 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. specifications specification status comment css object model (cssom)the definition of 'cssstylesheet.rules' in that specification. working draft ...
CSSStyleSheet - Web APIs
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 the specified index into the stylesheet's rule list. insertrule() inserts a new rule at the specified position in the stylesheet, given the textual representation of the rule. legacy properties these properties are legacy properties first introduced by microsoft long ago; they shouldn't be ...
CSSSupportsRule - Web APIs
syntax the syntax is described using the webidl format. interface csssupportsrule : cssconditionrule { } properties as a cssconditionrule and therefore a cssrule and a cssgroupingrule, csssupportsrule also implements the properties of these interfaces. it has no specific properties. ...
Managing screen orientation - Web APIs
sole.log("the orientation of the screen is: " + screen.orientation); }); preventing orientation change any web application can lock the screen to suits its own needs. the screen is locked using the screen.lockorientation() method and unlocked using the screen.unlockorientation(). the screen.lockorientation() accepts a string (or series of strings) to define the kind of lock to apply. accepted values are: portrait-primary, portrait-secondary, landscape-primary, landscape-secondary, portrait, landscape (see screen.lockorientation to know more about each of those values). screen.lockorientation('landscape'); note: a screen lock is web application dependent. if application a is locked to landscape and application b is locked to portrait, switching from application a to b or b to a will not ...
Cache.add() - Web APIs
Web › API › Cache › add
a url, retrieves it, and adds the resulting response object to the given cache. the add() method is functionally equivalent to the following: fetch(url).then(function(response) { if (!response.ok) { throw new typeerror('bad response status'); } return cache.put(url, response); }) for more complex operations, you'll need to use cache.put() directly. note: add() will overwrite any key/value pair previously stored in the cache that matches the request. syntax cache.add(request).then(function() { // request has been added to the cache }); parameters request the request you want to add to the cache. this can be a request object or a url. return value a promise that resolves with undefined. exceptions exception happens when typeerror the...
Cache.addAll() - Web APIs
Web › API › Cache › addAll
the addall() method of the cache interface takes an array of urls, retrieves them, and adds the resulting response objects to the given cache. the request objects created during retrieval become keys to the stored response operations. note: addall() will overwrite any key/value pairs previously stored in the cache that match the request, but will fail if a resulting put() operation would overwrite a previous cache entry stored by the same addall() method. syntax cache.addall(requests[]).then(function() { // requests have been added to the cache }); parameters requests an array of string urls that you want to be fetched and added to the cache. you can specify the request object instead of the url. return value a promise that resolves with undefined. exceptions except...
CacheStorage.delete() - Web APIs
ect matching the cachename, and if found, deletes the cache object and returns a promise that resolves to true. if no cache object is found, it resolves to false. you can access cachestorage through the global caches property. syntax caches.delete(cachename).then(function(boolean) { // your cache is now deleted }); parameters cachename the name of the cache you want to delete. return value a promise that resolves to true if the cache object is found and deleted, and false otherwise. examples in this code snippet we wait for an activate event, and then run a waituntil() block that clears up any old, unused caches before a new service worker is activated. here we have an array of cache names we want to keep (cachestokeep). we return the keys of the caches in the cachestorage objec...
CacheStorage.has() - Web APIs
Web › API › CacheStorage › has
od of the cachestorage interface returns a promise that resolves to true if a cache object matches the cachename. you can access cachestorage through the global caches property. syntax caches.has(cachename).then(function(boolean) { // true: your cache exists! }); parameters cachename a domstring representing the name of the cache object you are looking for in the cachestorage. return value a promise that resolves to true if the cache exists or false if not. examples the following example first checks whether a cache called 'v1' exists. if so, we add a list of assets to it. if not then we run some kind of cache set-up function. caches.has('v1').then(function(hascache) { if (!hascache) { somecachesetupfunction(); } else { caches.open('v1').then(function(cache) { ...
CacheStorage.keys() - Web APIs
Web › API › CacheStorage › keys
ll resolve with an array containing strings corresponding to all of the named cache objects tracked by the cachestorage object in the order they were created. use this method to iterate over a list of all cache objects. you can access cachestorage through the global caches property. syntax caches.keys().then(function(keylist) { //do something with your keylist }); parameters none. return value a promise that resolves with an array of the cache names inside the cachestorage object. examples in this code snippet we wait for an activate event, and then run a waituntil() block that clears up any old, unused caches before a new service worker is activated. here we have a whitelist containing the names of the caches we want to keep (cachewhitelist). we return the keys of the caches in the...
CacheStorage.open() - Web APIs
Web › API › CacheStorage › open
chename. you can access cachestorage through the global caches property. note: if the specified cache does not exist, a new cache is created with that cachename and a promise that resolves to this new cache object is returned. syntax caches.open(cachename).then(function(cache) { // do something with your cache }); parameters cachename the name of the cache you want to open. return value a promise that resolves to the requested cache object. examples this example is from the mdn sw-test example (see sw-test running live). here we wait for an installevent to fire, then runs waituntil() to handle the install process for the app. this consists of calling cachestorage.open() to create a new cache, then using cache.addall() to add a series of assets to it. self.addeventlistener('i...
CacheStorage - Web APIs
-test/star-wars-logo.jpg', '/sw-test/gallery/bountyhunters.jpg', '/sw-test/gallery/mylittlevader.jpg', '/sw-test/gallery/snowtroopers.jpg' ]); }) ); }); self.addeventlistener('fetch', function(event) { event.respondwith(caches.match(event.request).then(function(response) { // caches.match() always resolves // but in case of success response will have value if (response !== undefined) { return response; } else { return fetch(event.request).then(function (response) { // response may be used only once // we need to save clone to put one copy in cache // and serve second one let responseclone = response.clone(); caches.open('v1').then(function (cache) { cache.put(event.request, resp...
CanvasCaptureMediaStreamTrack.canvas - Web APIs
example // find the canvas element to capture var canvaselt = document.getelementsbytagname("canvas")[0]; // get the stream var stream = canvaselt.capturestream(25); // 25 fps // do things to the stream ... ...
CanvasCaptureMediaStreamTrack.requestFrame() - Web APIs
scapturemediastreamtrack method requestframe() requests that a frame be captured from the canvas and sent to the stream. applications that need to carefully control the timing of rendering and frame capture can use requestframe() to directly specify when it's time to capture a frame. to prevent automatic capture of frames, so that frames are only captured when requestframe() is called, specify a value of 0 for the capturestream() method when creating the stream. syntax stream.requestframe(); return value undefined usage notes there is currently an issue flagged in the specification pointing out that at this time, no exceptions are being thrown if the canvas isn't origin-clean. this may change in the future, so it would be wise to plan ahead and watch for exceptions such as securityerror...
CanvasGradient.addColorStop() - Web APIs
thod adds a new color stop, defined by an offset and a color, to a given canvas gradient. syntax void gradient.addcolorstop(offset, color); parameters offset a number between 0 and 1, inclusive, representing the position of the color stop. 0 represents the start of the gradient and 1 represents the end; an index_size_err is raised if the number is outside that range. color a css <color> value representing the color of the stop. a syntax_err is raised if the value cannot be parsed as a css <color> value. examples adding stops to a gradient this example uses the addcolorstop method to add stops to a linear canvasgradient object. the gradient is then used to fill a rectangle. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ct...
CanvasRenderingContext2D.clearRect() - Web APIs
id ctx.clearrect(x, y, width, height); the clearrect() method sets the pixels in a rectangular area to transparent black (rgba(0,0,0,0)). the rectangle's corner is at (x, y), and its size is specified by width and height. parameters x the x-axis coordinate of the rectangle's starting point. y the y-axis coordinate of the rectangle's starting point. width the rectangle's width. positive values are to the right, and negative to the left. height the rectangle's height. positive values are down, and negative are up. examples erasing the whole canvas this code snippet erases the entire canvas. this is commonly required at the start of each frame in an animation. the dimensions of the cleared area are set to equal the <canvas> element's width and height attributes. const canvas = do...
CanvasRenderingContext2D.clip() - Web APIs
s added to the path. it doesn't work with shape primitives drawn directly to the canvas, such as fillrect(). instead, you'd have to use rect() to add a rectangular shape to the path before calling clip(). syntax void ctx.clip([fillrule]); void ctx.clip(path [, fillrule]); parameters fillrule the algorithm by which to determine if a point is inside or outside the clipping region. possible values: "nonzero": the non-zero winding rule. default rule. "evenodd": the even-odd winding rule. path a path2d path to use as the clipping region. examples a simple clipping region this example uses the clip() method to create a clipping region according to the shape of a circular arc. two rectangles are then drawn; only those parts within the clipping region are rendered. html <canv...
CanvasRenderingContext2D.createLinearGradient() - Web APIs
. syntax canvasgradient ctx.createlineargradient(x0, y0, x1, y1); the createlineargradient() method is specified by four parameters defining the start and end points of the gradient line. parameters x0 the x-axis coordinate of the start point. y0 the y-axis coordinate of the start point. x1 the x-axis coordinate of the end point. y1 the y-axis coordinate of the end point. return value canvasgradient a linear canvasgradient initialized with the specified line. examples filling a rectangle with a linear gradient this example initializes a linear gradient using the createlineargradient() method. three color stops between the gradient's start and end points are then created. finally, the gradient is assigned to the canvas context, and is rendered to a filled rectangle. ht...
CanvasRenderingContext2D.createPattern() - Web APIs
n(image, repetition); parameters image a canvasimagesource to be used as the pattern's image. it can be any of the following: htmlimageelement (<img>) svgimageelement (<image>) htmlvideoelement (<video>, by using the capture of the video) htmlcanvaselement (<canvas>) imagebitmap offscreencanvas repetition a domstring indicating how to repeat the pattern's image. possible values are: "repeat" (both directions) "repeat-x" (horizontal only) "repeat-y" (vertical only) "no-repeat" (neither direction) if repetition is specified as an empty string ("") or null (but not undefined), a value of "repeat" will be used. return value canvaspattern an opaque object describing a pattern. examples creating a pattern from an image this example uses the createpatte...
CanvasRenderingContext2D.createRadialGradient() - Web APIs
s start circle, and three defining the end circle. parameters x0 the x-axis coordinate of the start circle. y0 the y-axis coordinate of the start circle. r0 the radius of the start circle. must be non-negative and finite. x1 the x-axis coordinate of the end circle. y1 the y-axis coordinate of the end circle. r1 the radius of the end circle. must be non-negative and finite. return value canvasgradient a radial canvasgradient initialized with the two specified circles. examples filling a rectangle with a radial gradient this example initializes a radial gradient using the createradialgradient() method. three color stops between the gradient's two circles are then created. finally, the gradient is assigned to the canvas context, and is rendered to a filled rectangle. html...
CanvasRenderingContext2D.drawImage() - Web APIs
nvas 2d api provides different ways to draw an image onto the canvas. syntax void ctx.drawimage(image, dx, dy); void ctx.drawimage(image, dx, dy, dwidth, dheight); void ctx.drawimage(image, sx, sy, swidth, sheight, dx, dy, dwidth, dheight); parameters image an element to draw into the context. the specification permits any canvas image source (canvasimagesource), specifically, a cssimagevalue, an htmlimageelement, an svgimageelement, an htmlvideoelement, an htmlcanvaselement, an imagebitmap, or an offscreencanvas. sx optional the x-axis coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context. sy optional the y-axis coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
CanvasRenderingContext2D.drawWindow() - Web APIs
not transparent because the user's background-color preference is applied, but iframes are transparent if the page doesn't set a background. if an opaque color is used for the background color, rendering will be faster because we won't have to compute the window's transparency. flags optional used to better control the drawwindow call. flags can be ored together. constant value description drawwindow_draw_caret 0x01 show the caret if appropriate when drawing. drawwindow_do_not_flush 0x02 do not flush pending layout notifications that could otherwise be batched up. drawwindow_draw_view 0x04 draw scrollbars and scroll the viewport if they are present. drawwindow_use_widget_layers 0x08 use ...
CanvasRenderingContext2D.ellipse() - Web APIs
he ellipse, expressed in radians. startangle the angle at which the ellipse starts, measured clockwise from the positive x-axis and expressed in radians. endangle the angle at which the ellipse ends, measured clockwise from the positive x-axis and expressed in radians. anticlockwise optional an optional boolean which, if true, draws the ellipse anticlockwise (counter-clockwise). the default value is false (clockwise). examples drawing a full ellipse this example draws an ellipse at an angle of π/4 radians (45°). to make a full ellipse, the arc begins at an angle of 0 radians (0°), and ends at an angle of 2π radians (360°). html <canvas id="canvas" width="200" height="200"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d...
CanvasRenderingContext2D.fill() - Web APIs
default rule. "evenodd": the even-odd winding rule. path a path2d path to fill. ...
CanvasRenderingContext2D.fillRect() - Web APIs
rect(x, y, width, height); the fillrect() method draws a filled rectangle whose starting point is at (x, y) and whose size is specified by width and height. the fill style is determined by the current fillstyle attribute. parameters x the x-axis coordinate of the rectangle's starting point. y the y-axis coordinate of the rectangle's starting point. width the rectangle's width. positive values are to the right, and negative to the left. height the rectangle's height. positive values are down, and negative are up. examples a simple filled rectangle this example draws a filled green rectangle using the fillrect() method. html <canvas id="canvas"></canvas> javascript the rectangle's top-left corner is at (20, 10). it has a width of 150 and a height of 100. const canvas = docu...
CanvasRenderingContext2D.fillText() - Web APIs
ings specified by font, textalign, textbaseline, and direction. x the x-axis coordinate of the point at which to begin drawing the text, in pixels. y the y-axis coordinate of the point at which to begin drawing the text, in pixels. maxwidth optional the maximum number of pixels wide the text may be once rendered. if not specified, there is no limit to the width of the text. however, if this value is provided, the user agent will adjust the kerning, select a more horizontally condensed font (if one is available or can be generated without loss of quality), or scale down to a smaller font size in order to fit the text in the specified width. return value undefined. examples drawing filled text this example writes the words "hello world" using the filltext() method. html first, we ne...
CanvasRenderingContext2D.getImageData() - Web APIs
in pixel manipulation with canvas. syntax ctx.getimagedata(sx, sy, sw, sh); parameters sx the x-axis coordinate of the top-left corner of the rectangle from which the imagedata will be extracted. sy the y-axis coordinate of the top-left corner of the rectangle from which the imagedata will be extracted. sw the width of the rectangle from which the imagedata will be extracted. positive values are to the right, and negative to the left. sh the height of the rectangle from which the imagedata will be extracted. positive values are down, and negative are up. return value an imagedata object containing the image data for the rectangle of the canvas specified. the coordinates of the rectangle's top-left corner are (sx, sy), while the coordinates of the bottom corner are (sx + sw, sy ...
CanvasRenderingContext2D.getLineDash() - Web APIs
if the number, when setting the elements, is odd, the elements of the array get copied and concatenated. for example, setting the line dash to [5, 15, 25] will result in getting back [5, 15, 25, 5, 15, 25]. examples getting the current line dash setting this example demonstrates the getlinedash() method. ...
CanvasRenderingContext2D.getTransform() - Web APIs
the canvasrenderingcontext2d.gettransform() method of the canvas 2d api retrieves the current transformation matrix being applied to the context. syntax let storedtransform = ctx.gettransform(); parameters none. return value a dommatrix object. the transformation matrix is described by: [acebdf001]\left[ \begin{array}{ccc} a & c & e \\ b & d & f \\ 0 & 0 & 1 \end{array} \right] note: the returned object is not live, so updating it will not affect the current transformation matrix, and updating the current transformation matrix will not affect an already returned dommatrix. examples in the following example, we have two <canvas> elements. we apply a transform to the first one's context using canvasrenderingcontext2d.settransform() and draw a square on it, then retrieve the matrix f...
CanvasRenderingContext2D.imageSmoothingEnabled - Web APIs
the imagesmoothingenabled property of the canvasrenderingcontext2d interface, part of the canvas api, determines whether scaled images are smoothed (true, default) or not (false). on getting the imagesmoothingenabled property, the last value it was set to is returned. this property is useful for games and other apps that use pixel art. when enlarging images, the default resizing algorithm will blur the pixels. set this property to false to retain the pixels' sharpness. note: you can adjust the smoothing quality with the imagesmoothingquality property. syntax ctx.imagesmoothingenabled = value; options value a boolean indicating whether to smooth scaled images or not. the default value is true. examples disabling image smoothing this example compares three images. the first image ...
CanvasRenderingContext2D.imageSmoothingQuality - Web APIs
"medium" medium quality. "high" high quality. ...
CanvasRenderingContext2D.isPointInPath() - Web APIs
intinpath(x, y [, fillrule]); ctx.ispointinpath(path, x, y [, fillrule]); parameters x the x-axis coordinate of the point to check, unaffected by the current transformation of the context. y the y-axis coordinate of the point to check, unaffected by the current transformation of the context. fillrule the algorithm by which to determine if a point is inside or outside the path. possible values: "nonzero": the non-zero winding rule. default rule. "evenodd": the even-odd winding rule. path a path2d path to check against. if unspecified, the current path is used. return value boolean a boolean, which is true if the specified point is contained in the current or specified path, otherwise false. examples checking a point in the current path this example uses the ispoi...
CanvasRenderingContext2D.isPointInStroke() - Web APIs
method of the canvas 2d api reports whether or not the specified point is inside the area contained by the stroking of a path. syntax ctx.ispointinstroke(x, y); ctx.ispointinstroke(path, x, y); parameters x the x-axis coordinate of the point to check. y the y-axis coordinate of the point to check. path a path2d path to check against. if unspecified, the current path is used. return value boolean a boolean, which is true if the point is inside the area contained by the stroking of a path, otherwise false. examples checking a point in the current path this example uses the ispointinstroke() method to check if a point is within the area of the current path's stroke. html <canvas id="canvas"></canvas> <p>in stroke: <code id="result">false</code></p> javascript const canv...
CanvasRenderingContext2D.lineTo() - Web APIs
connecting the sub-path's last point to the specified (x, y) coordinates. like other methods that modify the current path, this method does not directly render anything. to draw the path onto a canvas, you can use the fill() or stroke() methods. syntax ctx.lineto(x, y); parameters x the x-axis coordinate of the line's end point. y the y-axis coordinate of the line's end point. return value undefined. examples drawing a straight line this example draws a straight line using the lineto() method. html <canvas id="canvas"></canvas> javascript the line begins at (30, 50) and ends at (150, 100). const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.beginpath(); // start a new path ctx.moveto(30, 50); // move the pen to (30, 50) ctx...
CanvasRenderingContext2D.measureText() - Web APIs
example given this <canvas> element: <canvas id="canvas"></canvas> ... ...
CanvasRenderingContext2D.rect() - Web APIs
ep, use the fillrect() or strokerect() methods. syntax void ctx.rect(x, y, width, height); the rect() method creates a rectangular path whose starting point is at (x, y) and whose size is specified by width and height. parameters x the x-axis coordinate of the rectangle's starting point. y the y-axis coordinate of the rectangle's starting point. width the rectangle's width. positive values are to the right, and negative to the left. height the rectangle's height. positive values are down, and negative are up. examples drawing a rectangle this example creates a rectangular path using the rect() method. the path is then rendered using the fill() method. html <canvas id="canvas"></canvas> javascript the rectangle's corner is located at (10, 20). it has a width of 150 and a...
CanvasRenderingContext2D.rotate() - Web APIs
d rectangle is red. rotating a shape around its center this example rotates a shape around its center point. to do this, the following steps are applied to the matrix: first, translate() moves the matrix's origin to the shape's center. rotate() rotates the matrix by the desired amount. finally, translate() moves the matrix's origin back to its starting point. this is done by applying the values of the shape's center coordinates in a negative direction. html <canvas id="canvas"></canvas> javascript the shape is a rectangle with its corner at (80, 60), a width of 140, a height of 30. its horizontal center is at (80 + 140 / 2), or 150. its vertical center is at (60 + 30 / 2), or 75. thus, the center point is at (150, 75). const canvas = document.getelementbyid('canvas'); const ctx ...
CanvasRenderingContext2D.save() - Web APIs
the canvasrenderingcontext2d.save() method of the canvas 2d api saves the entire state of the canvas by pushing the current state onto a stack. the drawing state the drawing state that gets saved onto a stack consists of: the current transformation matrix. the current clipping region. the current dash list. the current values of the following attributes: strokestyle, fillstyle, globalalpha, linewidth, linecap, linejoin, miterlimit, linedashoffset, shadowoffsetx, shadowoffsety, shadowblur, shadowcolor, globalcompositeoperation, font, textalign, textbaseline, direction, imagesmoothingenabled. syntax void ctx.save(); examples saving the drawing state this example uses the save() method to save the default state and restore() to restore it later, so that you are able to draw a rect w...
CanvasRenderingContext2D.scale() - Web APIs
ion modifies this behavior. for instance, a scaling factor of 0.5 results in a unit size of 0.5 pixels; shapes are thus drawn at half the normal size. similarly, a scaling factor of 2.0 increases the unit size so that one unit becomes two pixels; shapes are thus drawn at twice the normal size. syntax void ctx.scale(x, y); parameters x scaling factor in the horizontal direction. a negative value flips pixels across the vertical axis. a value of 1 results in no horizontal scaling. y scaling factor in the vertical direction. a negative value flips pixels across the horizontal axis. a value of 1 results in no vertical scaling. examples scaling a shape this example draws a scaled rectangle. a non-scaled rectangle is then drawn for comparison. html <canvas id="canvas"></canvas> java...
CanvasRenderingContext2D.setLineDash() - Web APIs
the setlinedash() method of the canvas 2d api's canvasrenderingcontext2d interface sets the line dash pattern used when stroking lines. it uses an array of values that specify alternating lengths of lines and gaps which describe the pattern. note: to return to using solid lines, set the line dash list to an empty array. syntax ctx.setlinedash(segments); parameters segments an array of numbers that specify distances to alternately draw a line and a gap (in coordinate space units). if the number of elements in the array is odd, the elements of the array get copied and concatenated. for example, [5, 15, 25] will become [5, 15, 25, 5, 15, 25]. if the array is empty, the line dash list is cleared and line strokes return to being solid. return value undefined. examples basic example ...
CanvasRenderingContext2D.setTransform() - Web APIs
f); ctx.settransform(matrix); the transformation matrix is described by: [acebdf001]\left[ \begin{array}{ccc} a & c & e \\ b & d & f \\ 0 & 0 & 1 \end{array} \right] parameters settransform() has two types of parameter that it can accept. the older type consists of several parameters representing the individual components of the transformation matrix to set: a (m11) horizontal scaling. a value of 1 results in no scaling. b (m12) vertical skewing. c (m21) horizontal skewing. d (m22) vertical scaling. a value of 1 results in no scaling. e (dx) horizontal translation (moving). f (dy) vertical translation (moving). the newer type consists of a single parameter, matrix, representing a 2d transformation matrix to set (technically, a dommatrixinit object; any object will do as lon...
CanvasRenderingContext2D.shadowBlur - Web APIs
the canvasrenderingcontext2d.shadowblur property of the canvas 2d api specifies the amount of blur applied to shadows. the default is 0 (no blur). note: shadows are only drawn if the shadowcolor property is set to a non-transparent value. one of the shadowblur, shadowoffsetx, or shadowoffsety properties must be non-zero, as well. syntax ctx.shadowblur = level; level a non-negative float specifying the level of shadow blur, where 0 represents no blur and larger numbers represent increasingly more blur. this value doesn't correspond to a number of pixels, and is not affected by the current transformation matrix. the default value is 0. negative, infinity, and nan values are ignored. examples adding a shadow to a shape this example adds a blurred shadow to a rectangle. the shadowcol...
CanvasRenderingContext2D.shadowOffsetX - Web APIs
the canvasrenderingcontext2d.shadowoffsetx property of the canvas 2d api specifies the distance that shadows will be offset horizontally. note: shadows are only drawn if the shadowcolor property is set to a non-transparent value. one of the shadowblur, shadowoffsetx, or shadowoffsety properties must be non-zero, as well. syntax ctx.shadowoffsetx = offset; offset a float specifying the distance that shadows will be offset horizontally. positive values are to the right, and negative to the left. the default value is 0 (no horizontal offset). infinity and nan values are ignored. examples moving a shadow horizontally this example adds a blurred shadow to a rectangle. the shadowcolor property sets its color, shadowoffsetx sets its offset 25 units to the right, and shadowblur gives it ...
CanvasRenderingContext2D.shadowOffsetY - Web APIs
the canvasrenderingcontext2d.shadowoffsety property of the canvas 2d api specifies the distance that shadows will be offset vertically. note: shadows are only drawn if the shadowcolor property is set to a non-transparent value. one of the shadowblur, shadowoffsetx, or shadowoffsety properties must be non-zero, as well. syntax ctx.shadowoffsety = offset; offset a float specifying the distance that shadows will be offset vertically. positive values are down, and negative are up. the default value is 0 (no vertical offset). infinity and nan values are ignored. examples moving a shadow vertically this example adds a blurred shadow to a rectangle. the shadowcolor property sets its color, shadowoffsety sets its offset 25 units towards the bottom, and shadowblur gives it a blur level of...
CanvasRenderingContext2D.strokeRect() - Web APIs
ke() calls will have no effect on it. syntax void ctx.strokerect(x, y, width, height); the strokerect() method draws a stroked rectangle whose starting point is at (x, y) and whose size is specified by width and height. parameters x the x-axis coordinate of the rectangle's starting point. y the y-axis coordinate of the rectangle's starting point. width the rectangle's width. positive values are to the right, and negative to the left. height the rectangle's height. positive values are down, and negative are up. examples a simple stroked rectangle this example draws a rectangle with a green outline using the strokerect() method. html <canvas id="canvas"></canvas> javascript the rectangle's top-left corner is at (20, 10). it has a width of 160 and a height of 100. const ca...
CanvasRenderingContext2D.strokeText() - Web APIs
. the text is rendered using the settings specified by font, textalign, textbaseline, and direction. x the x-axis coordinate of the point at which to begin drawing the text. y the y-axis coordinate of the point at which to begin drawing the text. maxwidth optional the maximum width the text may be once rendered. if not specified, there is no limit to the width of the text. however, if this value is provided, the user agent will adjust the kerning, select a more horizontally condensed font (if one is available or can be generated without loss of quality), or scale down to a smaller font size in order to fit the text in the specified width. return value undefined. examples drawing text outlines this example writes the words "hello world" using the stroketext() method. html first,...
CanvasRenderingContext2D.transform() - Web APIs
slate (move), and skew the context. note: see also the settransform() method, which resets the current transform to the identity matrix and then invokes transform(). syntax void ctx.transform(a, b, c, d, e, f); the transformation matrix is described by: [acebdf001]\left[ \begin{array}{ccc} a & c & e \\ b & d & f \\ 0 & 0 & 1 \end{array} \right] parameters a (m11) horizontal scaling. a value of 1 results in no scaling. b (m12) vertical skewing. c (m21) horizontal skewing. d (m22) vertical scaling. a value of 1 results in no scaling. e (dx) horizontal translation (moving). f (dy) vertical translation (moving). examples skewing a shape this example skews a rectangle both vertically (.2) and horizontally (.8). scaling and translation remain unchanged. html <canvas id="ca...
CanvasRenderingContext2D.translate() - Web APIs
renderingcontext2d.translate() method of the canvas 2d api adds a translation transformation to the current matrix. syntax void ctx.translate(x, y); the translate() method adds a translation transformation to the current matrix by moving the canvas and its origin x units horizontally and y units vertically on the grid. parameters x distance to move in the horizontal direction. positive values are to the right, and negative to the left. y distance to move in the vertical direction. positive values are down, and negative are up. examples moving a shape this example draws a square that is moved from its default position by the translate() method. an unmoved square of the same size is then drawn for comparison. html <canvas id="canvas"></canvas> javascript the translate() meth...
A basic ray-caster - Web APIs
ox 1.5 beta 1 is even faster; i can run 320 x 240 at 24 fps with 4 pixel slivers. not exactly a new member of the id software family, but pretty decent considering it's a fully interpreted environment, and i didn't have to worry about memory allocation or video modes or coding inner routines in assembler or anything. the code does attempt to be very efficient, using array look-ups of pre-computed values, but i'm no optimization guru, so things could probably be written faster. also, it leaves a lot to be desired in terms of trying to be any sort of game engine—there are no wall textures, no sprites, no doors, not even any teleporters to get to another level. but i'm pretty confident all those things could be added given enough time. the canvas api supports pixel copying of images, so texture...
Basic animations - Web APIs
x = canvasxsize - imgw; } // draw aditional image if (x > (canvasxsize-imgw)) { ctx.drawimage(img, x - imgw + 1, y, imgw, imgh); } } // draw image ctx.drawimage(img, x, y,imgw, imgh); // amount to move x += dx; } below is the <canvas> in which the image is scrolled. note that the width and height specified here must match the values of the canvasxzsize and canvasysize variables in the javascript code. <canvas id="canvas" width="800" height="200"></canvas> mouse following animation <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>document</t...
Drawing shapes with canvas - Web APIs
let's have a more detailed look at the arc method, which takes six parameters: x and y are the coordinates of the center of the circle on which the arc should be drawn. radius is self-explanatory. the startangle and endangle parameters define the start and end points of the arc in radians, along the curve of the circle. these are measured from the x axis. the anticlockwise parameter is a boolean value which, when true, draws the arc anticlockwise; otherwise, the arc is drawn clockwise. note: angles in the arc function are measured in radians, not degrees. to convert degrees to radians you can use the following javascript expression: radians = (math.pi/180)*degrees. the following example is a little more complex than the ones we've seen above. it draws 12 different arcs all with different a...
Optimizing canvas - Web APIs
nerate it in the first place. mycanvas.offscreencanvas = document.createelement('canvas'); mycanvas.offscreencanvas.width = mycanvas.width; mycanvas.offscreencanvas.height = mycanvas.height; mycanvas.getcontext('2d').drawimage(mycanvas.offscreencanvas, 0, 0); avoid floating-point coordinates and use integers instead sub-pixel rendering occurs when you render objects on a canvas without whole values. ctx.drawimage(myimage, 0.3, 0.5); this forces the browser to do extra calculations to create the anti-aliasing effect. to avoid this, make sure to round all co-ordinates used in calls to drawimage() using math.floor(), for example. don’t scale images in drawimage cache various sizes of your images on an offscreen canvas when loading as opposed to constantly scaling them in drawimage(). ...
ChannelMergerNode() - Web APIs
aseaudiocontext representing the audio context you want the node to be associated with. options optional a channelmergeroptions dictionary object defining the properties you want the channelmergernode to have (also inherits parameters from the audionodeoptions dictionary): numberofinputs: a number defining the number of inputs the channelmergernode should have. if not specified, the default value used is 6. return value a new channelmergernode object instance. exceptions invalidstateerror an option such as channelcount or channelcountmode has been given an invalid value. example var ac = new audiocontext(); var options = { numberofinputs : 2 } var mymerger = new channelmergernode(ac, options); specifications specification status comment web aud...
ChannelSplitterNode.ChannelSplitterNode() - Web APIs
epresenting the audio context you want the node to be associated with. options optional a channelsplitteroptions dictionary object defining the properties you want the channelsplitternode to have (it also inherits the options defined in the audionodeoptions dictionary): numberofoutputs: a number defining the number of inputs the channelsplitternode should have. if not specified, the default value used is 6. return value a new channelsplitternode object instance. example var ac = new audiocontext(); var options = { numberofoutputs : 2 } var mysplitter = new channelsplitternode(ac, options); specifications specification status comment web audio apithe definition of 'channelsplitternode' in that specification. working draft ...
ChildNode.after() - Web APIs
Web › API › ChildNode › after
argitem : document.createtextnode(string(argitem))); }); this.parentnode.insertbefore(docfrag, this.nextsibling); ...
ChildNode.before() - Web APIs
Web › API › ChildNode › before
argitem : document.createtextnode(string(argitem))); }); this.parentnode.insertbefore(docfrag, this); } ...
ChildNode.remove() - Web APIs
Web › API › ChildNode › remove
living standard initial definition. ...
ChildNode.replaceWith() - Web APIs
olyfill you can polyfill the replacewith() method in internet explorer 10+ and higher with the following code: function replacewithpolyfill() { 'use-strict'; // for safari, and ie > 10 var parent = this.parentnode, i = arguments.length, currentnode; if (!parent) return; if (!i) // if there are no arguments parent.removechild(this); while (i--) { // i-- decrements i and returns the value of i before the decrement currentnode = arguments[i]; if (typeof currentnode !== 'object'){ currentnode = this.ownerdocument.createtextnode(currentnode); } else if (currentnode.parentnode){ currentnode.parentnode.removechild(currentnode); } // the value of "i" below is after the decrement if (!i) // if currentnode is the first argument (currentnode === argument...
Client.frameType - Web APIs
Web › API › Client › frameType
the frametype read-only property of the client interface indicates the type of browsing context of the current client. this value can be one of "auxiliary", "top-level", "nested", or "none". syntax var myframetype = client.frametype; example tbd specifications specification status comment service workersthe definition of 'frametype' in that specification. working draft initial definition. ...
Client.postMessage() - Web APIs
yntax client.postmessage(message[, transfer]); client.postmessage(message[, { transfer }]); parameters message the message to send to the client. this can be any structured-clonable type. transfer optional a sequence of objects that are transferred with the message. the ownership of these objects is given to the destination side and they are no longer usable on the sending side. return value undefined. examples sending a message from a service worker to a client: addeventlistener('fetch', event => { event.waituntil(async function() { // exit early if we don't have access to the client. // eg, if it's cross-origin. if (!event.clientid) return; // get the client. const client = await clients.get(event.clientid); // exit early if we don't get the client. ...
Client.url - Web APIs
Web › API › Client › url
the url read-only property of the client interface returns the url of the current service worker client. syntax var clienturl = client.url; value a usvstring. 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 com...
Clients.claim() - Web APIs
Web › API › Clients › claim
rolled by this service worker. when a service worker is initially registered, pages won't use it until they next load. the claim() method causes those pages to be controlled immediately. be aware that this results in your service worker controlling pages that loaded regularly over the network, or possibly via a different service worker. syntax await clients.claim(); parameters none. return value a promise that resolves to undefined. example the following example uses claim() inside service worker's "activate" event listener so that clients loaded in the same scope do not need to be reloaded before their fetches will go through this service worker. self.addeventlistener('activate', event => { event.waituntil(clients.claim()); }); specifications specification status ...
Clients.get() - Web APIs
Web › API › Clients › get
the get() method of the clients interface gets a service worker client matching a given id and returns it in a promise. syntax self.clients.get(id).then(function(client) { // do something with your returned client }); parameters id a domstring representing the id of the client you want to get. return value a promise that resolves to a client object or undefined. examples self.clients.get(id).then(function(client) { self.clients.openwindow(client.url); }); specifications specification status comment service workersthe definition of 'get()' in that specification. working draft initial definition ...
Clients.matchAll() - Web APIs
Web › API › Clients › matchAll
the matching operation. available options are: includeuncontrolled: a boolean — if set to true, the matching operation will return all service worker clients who share the same origin as the current service worker. otherwise, it returns only the service worker clients controlled by the current service worker. the default is false. type: sets the type of clients you want matched. available values are "window", "worker", "sharedworker", and "all". the default is "all". return value a promise that resolves to an array of client objects. in chrome 46/firefox 54 and later, this method returns clients in most recently focused order, correct as per spec. examples clients.matchall(options).then(function(clientlist) { for (var i = 0 ; i < clientlist.length ; i++) { if (clientli...
Clients.openWindow() - Web APIs
the url in an existing browsing context provided by a standalone web app previously added to the user's home screen. as of recently, this also works on chrome for windows. syntax self.clients.openwindow(url).then(function(windowclient) { // do something with your windowclient }); parameters url a usvstring representing the url of the client you want to open in the window. generally this value must be a url from the same origin as the calling script. return value a promise that resolves to a windowclient object if the url is from the same origin as the service worker or a null value otherwise. examples // send notification to os if applicable if (self.notification.permission === 'granted') { const notificationobject = { body: 'click here to view your messages.', data:...
Clipboard.read() - Web APIs
Web › API › Clipboard › read
you must first have the "clipboard-read" permission. note: the asynchronous clipboard and permissions apis are still in the process of being integrated into most browsers, so they often deviate from the official rules for permissions and the like. be sure to review the compatibility table before using these methods. syntax var promise = navigator.clipboard.read(); parameters none. return value a promise that resolves with a datatransfer object containing the clipboard's contents. the promise is rejected if permission to access the clipboard is not granted. example after using navigator.permissions.query() to find out if we have (or if the user will be prompted to allow) "clipboard-read" access, this example fetches the data currently on the clipboard. if it's not a png image, an err...
Clipboard.readText() - Web APIs
the clipboard interface's readtext() method returns a promise which resolves with a copy of the textual contents of the system clipboard.. the "clipboard-read" permission of the permissions api must be granted before you can read data from the clipboard. syntax var promise = navigator.clipboard.readtext() parameters none. return value a promise that resolves with a domstring containing the textual contents of the clipboard. returns an empty string if the clipboard is empty, does not contain text, or does not include a textual representation among the datatransfer objects representing the clipboard's contents. to read non-text contents from the clipboard, use the read() method instead. you can write text to the clipboard using writetext(). example this example retrieves the textual con...
Clipboard.writeText() - Web APIs
when they are in the active tab. note: browser support for the asynchronous clipboard apis is still in the process of being implemented. be sure to check the compatibility table as well as clipboard availability in clipboard for more information. syntax var promise = navigator.clipboard.writetext(newcliptext) parameters newcliptext the domstring to be written to the clipboard. return value a promise which is resolved once the clipboard's contents have been updated. the promise is rejected if the caller does not have permission to write to the clipboard. example this example sets the clipboard's contents to the string "<empty clipboard>". navigator.clipboard.writetext("<empty clipboard>").then(function() { /* clipboard successfully set */ }, function() { /* clipboard writ...
ClipboardItem() - Web APIs
ch represents data to be stored or retrieved via the clipboard api, that is clipboard.write() and clipboard.read() respectively. note: image format support varies by browser. see the browser compatibility table for the clipboard interface. syntax var clipboarditem = new clipboarditem(clipboarditemdata); parameters clipboarditemdata an object with the mime type as the key and blob as the value. note: to work with text see the clipboard.readtext() and clipboard.writetext() methods of the clipboard interface. examples the below example requests a png image using the fetch api, and in turn, the responses' blob() method, to create a new clipboarditem and write it to the clipboard, using the clipboard api. note: you can only pass in one clipboard item at a time. async function wri...
ClipboardItem.getType() - Web APIs
exceptions domexception the type does not match a known mime type. typeerror no parameter is specified or the type is not that of the clipboarditem. ...
ClipboardItem.types - Web APIs
examples in the below example, we're returning all items on the clipboard via the clipboard.read() method. then checking the types property for available types before utilizing the clipboarditem.gettype() method to return the blob object. if no clipboards contents is found for the specified type, an error is returned. ...
ClipboardItem - Web APIs
ad permission must be requested, which you can do by trying to read data from the clipboard. note: to work with text see the clipboard.readtext() and clipboard.writetext() methods of the clipboard interface. note: you can only pass in one clipboard item at a time. constructor clipboarditem.clipboarditem() creates a new clipboarditem object, with the mime type as the key and blob as the value properties this interface provides the following properties. types read only returns an array of mime types available within the clipboarditem. methods this interface defines the following methods. gettype() returns a promise that resolves with a blob of the requested mime type, or an error if the mime type is not found. examples writing to clipboard here we're writing a new cl...
CloseEvent() - Web APIs
closeeventinit optional is a closeeventinit dictionary, having the following fields: "wasclean", optional and defaulting to false, of type long, indicates if the connection has been closed cleanly or not. "code", optional and defaulting to 0, of type unsigned short, that is the connection close code sent by the server. "reason", optional and defaulting to '', of type domstring, that is a human-readable reason why the server closed the connection. ...
CompositionEvent.CompositionEvent() - Web APIs
compositioneventinit optional a compositioneventinit dictionary object, which can contain the following members: data initializes the data attribute of the compositionevent object to the characters generated by the ime composition. note: the compositioneventinit dictionary inherits from the uieventinit dictionary, so can also accept members defined on there. ...
CompositionEvent.data - Web APIs
the data read-only property of the compositionevent interface returns the characters generated by the input method that raised the event; its exact nature varies depending on the type of event that generated the compositionevent object. syntax mydata = compositionevent.data value a domstring representing the event data: for compositionstart events, this is the currently selected text that will be replaced by the string being composed. this value doesn't change even if content changes the selection range; rather, it indicates the string that was selected when composition started. for compositionupdate, this is the string as it stands currently as editing is ongoing. for compositionend events, this is the string as committed to the editor. specifications specification st...
CompositionEvent.initCompositionEvent() - Web APIs
parameters typearg a domstring representing the type of composition event; this will be one of compositionstart, compositionupdate, or compositionend. canbubblearg a boolean specifying whether or not the event can bubble. cancelablearg a boolean shether or not the event can be canceled. viewarg the window object from which the event was generated. dataarg a domstring representing the value of the data attribute. localearg a domstring representing the value of the locale attribute. return value void. specifications specification status comment document object model (dom) level 3 events specificationthe definition of 'initcompositionevent()' in that specification. obsolete initial definition. ...
CompositionEvent.locale - Web APIs
the locale read-only property of the compositionevent interface returns the locale of current input method (for example, the keyboard layout locale if the composition is associated with ime). syntax mylocale = compositionevent.locale value a domstring representing the locale of current input method. specifications specification status comment document object model (dom) level 3 events specification obsolete no longer in the spec, but still supported. ...
console.count() - Web APIs
Web › API › Console › count
specifications specification status comment console apithe definition of 'console.count()' in that specification. living standard initial definition ...
Console.table() - Web APIs
Web › API › Console › table
displays tabular data as a table. this function takes one mandatory argument data, which must be an array or an object, and one additional optional parameter columns. it logs data as a table. each element in the array (or enumerable property if data is an object) will be a row in the table. the first column in the table will be labeled (index). if data is an array, then its values will be the array indices. if data is an object, then its values will be the property names. note that (in firefox) console.table is limited to displaying 1000 rows (first row is the labeled index). note: this feature is available in web workers. collections of primitive types the data argument may be an array or an object. // an array of strings console.table(["apples", "oranges", "bananas"]); // an objec...
Console.timeEnd() - Web APIs
Web › API › Console › timeEnd
in addition, the call to timeend() has the additional information, "timer ended" to make it obvious that the timer is no longer tracking time. specifications specification status comment console apithe definition of 'console.timeend()' in that specification. living standard initial definition ...
ConstantSourceNode() - Web APIs
the constantsourcenode() constructor creates a new constantsourcenode object instance, representing an audio source which constantly outputs samples whose values are always the same. syntax var constantsourcenode = new constantsourcenode(context, options); parameters context an audiocontext representing the audio context you want the node to be associated with. options a constantsourceoptions dictionary object defining the properties you want the constantsourcenode to have: offset: a read-only audioparam specifying the constant value generated by the source. the default is 1.0. the normal range is -1.0 to 1.0, but the value can be anywhere in the range from -infinity to +infinity. example in this example, an audio context is created, then a constantsourcenode is established...
ConstrainULong - Web APIs
the constrainulong type is used to specify a constraint for a property whose value is an integral number. it extends the ulongrange dictionary (which provides the ability to specify a permitted range of property values) to also support an exact value and/or an ideal value the property should take on. in addition, you can specify the value as a simple long integer value, in which case the user agent does its best to match the value once all other more stringent constraints are met. properties if the value of a constrainulong is an object rather than a number, it may have the properties below in addition to the properties it inherits from ulongrange. exact an integer specifying precise, required, value the property must have to be considered acceptable. ideal an integer specifying a valu...
ContentIndex.add() - Web APIs
Web › API › ContentIndex › add
category of content. can be: '' an empty string, this is the default. homepage article video audio icons: optional an array of image resources, defined as an object with the following data: src: a url string of the source image. sizes: optional a string representation of the image size. type: optional the mime type of the image. return value returns a promise that resolves with undefined exceptions typeerror if the service worker's registration is not present or the service worker does not contain a fetchevent. if the id, title, description or url are missing, not of type string, or an empty string. if icons images are not of image type. examples here we're declaring an item in the correct format and creating an asynchrono...
ContentIndex.delete() - Web APIs
examples below is an asynchronous function, that removes an item from the content index. ...
ContentIndex.getAll() - Web APIs
contentdescription each item returned is an object containing the following data: id: a unique string identifier. title: a string title for the item. used in user-visible lists of content. ...
ContentIndexEvent() - Web APIs
ndexevent(type, contentindexeventinit); parameters type a domstring indicating the event which occurred. for contentindexevent, this is always delete. eventinitdict optional an options object containing any initialization data you want to populate the contentindexevent object with. the options are: id: the id of the indexed content you want the contentindexevent to remove. return value a contentindexevent object configured using the given inputs. examples this examples constructs a new contentindexevent with the relevant id. var removedata = { id : 'unique-content-id' } var cievent = new contentindexevent('contentdelete', removedata); cievent.id; // should return 'unique-content-id' specifications specification status comment unknownthe defini...
ContentIndexEvent.id - Web APIs
examples this example listens for the contentdelete event and logs the removed content index id. the contentindexevent is only available to the {domxref('serviceworkerglobalscope','global scope')}} of a serviceworker. ...
ConvolverNode() - Web APIs
xt. options optional options are as follows: audiobuffer: a mono, stereo, or 4-channel audiobuffer containing the (possibly multichannel) impulse response used by the convolvernode to create the reverb effect. disablenormalization: a boolean controlling whether the impulse response from the buffer will be scaled by an equal-power normalization, or not. the default is 'false'. return value a new convolvernode object instance. exceptions exception explanation notsupportederror the referenced audiobuffer does not have the correct number of channels, or it has a different sample rate to the associated audiocontext. specifications specification status comment web audio apithe definition of 'convolvernode()' in that specific...
ConvolverNode.buffer - Web APIs
loon pop or synthesized impulse from the sink. that audio recording could then be used as the buffer. this audiobuffer must have the same sample-rate as the audiocontext or an exception will be thrown. at the time when this attribute is set, the buffer and the state of the attribute will be used to configure the convolvernode with this impulse response having the given normalization. the initial value of this attribute is null. syntax var audioctx = new audiocontext(); var convolver = audioctx.createconvolver(); convolver.buffer = myaudiobuffer; value an audiobuffer. example var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var convolver = audioctx.createconvolver(); ... // grab audio track via xhr for convolver node var soundsource, concerthallbuffer; ajax...
ConvolverNode.normalize - Web APIs
the normalize property of the convolvernode interface is a boolean that controls whether the impulse response from the buffer will be scaled by an equal-power normalization when the buffer attribute is set, or not. its default value is true in order to achieve a more uniform output level from the convolver, when loaded with diverse impulse responses. if normalize is set to false, then the convolution will be rendered with no pre-processing/scaling of the impulse response. changes to this value do not take effect until the next time the buffer attribute is set. syntax var audioctx = new audiocontext(); var convolver = audioctx.createconvolver(); convolver.normalize = false; value a boolean. example var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var convolver = ...
CountQueuingStrategy.CountQueuingStrategy() - Web APIs
queuingstrategy() constructor creates and returns a countqueuingstrategy object instance. syntax var countqueuingstrategy = new countqueuingstrategy({highwatermark}); parameters {highwatermark} an object containing a highwatermark property. this is a non-negative integer defining the total number of chunks that can be contained in the internal queue before backpressure is applied. return value an instance of the countqueuingstrategy object. exceptions none. examples const queuingstrategy = new countqueuingstrategy({ highwatermark: 1 }); const writablestream = new writablestream({ // implement the sink write(chunk) { ... }, close() { ... }, abort(err) { console.log("sink error:", err); } }, queuingstrategy); var size = queuingstrategy.size(); specificat...
CountQueuingStrategy.size() - Web APIs
examples const queuingstrategy = new countqueuingstrategy({ highwatermark: 1 }); const writablestream = new writablestream({ // implement the sink write(chunk) { ... }, close() { ... ...
CrashReportBody - Web APIs
a crash report is generated when a document becomes unusable due to the browser (or one of its processes) crashing. for security reasons, no details of the crash are communicated in the body except for a general crash reason. properties reason a string representing the reason for the crash. current possible reasons are: oom: the browser ran out of memory. unresponsive: the page was killed due to being unresponsive. examples crash reports are generally only retrievable via endpoints set up using the report-to header. ...
Credential.id - Web APIs
Web › API › Credential › id
the id property of the credential interface returns a domstring containing the credential's identifier. this might be any one of a guid, username, or email address. syntax var id = credential.id; value a a domstring containing the credential's identifier. specifications specification status comment credential management level 1 working draft initial definition. ...
Credential.name - Web APIs
Web › API › Credential › name
the name property of the credential interface returns a domstring, containing the name associated with a credential. it should be a human-readable, public name. syntax var credname = credential.name; value a domstring containing the credential's given name. example // tbd specifications specification status comment credential management level 1 working draft initial definition. ...
Credential.type - Web APIs
Web › API › Credential › type
the type property of the credential interface returns a domstring containing the credential's type. valid values are password, federated and public-key. syntax var credtype = credential.type; value a domstring contains a credential's given name. example // tbd specifications specification status comment credential management level 1 working draft initial definition. ...
Credential - Web APIs
the credential interface of the the credential management api provides information about an entity as a prerequisite to a trust decision. properties credential.id read only returns a domstring containing the credential's identifier. this might be any one of a guid, username, or email address. credential.type read only returns a domstring containing the credential's type. valid values are password, federated and public-key. (for passwordcredential, federatedcredential and publickeycredential) event handlers none. methods none. examples // tbd specifications specification status comment credential management level 1 working draft initial definition. ...
CredentialsContainer.get() - Web APIs
iders: an array of domstring instances of identity providers to search for. protocols an array of domstring instances of federation protocols to search for. publickey: an publickeycredentialrequestoptions object containing requirements for returned webauthn credentials. mediation: a string indicating whether the user will be required to log on for every visit to the website. valid values are "silent", "optional", or "required". unmediated: a boolean indicating the returned credential instance should not require user mediation. signal: an instance of abortsignal that can indicate that an ongoing get() operation should be halted. an aborted operation may complete normally (generally if the abort was received after the operation finished) or reject with an "aborterror" domexc...
Crypto.subtle - Web APIs
Web › API › Crypto › subtle
the crypto.subtle read-only property returns a subtlecrypto which can then be used to perform low-level cryptographic operations. syntax var crypto = crypto.subtle; value a subtlecrypto object you can use to interact with the web crypto api's low-level cryptography features. specifications specification status comment web cryptography apithe definition of 'crypto.subtle' in that specification. recommendation initial definition. ...
Crypto - Web APIs
Web › API › Crypto
ough the window.crypto property, which is a crypto object. properties this interface implements properties defined on randomsource. crypto.subtle read only secure context returns a subtlecrypto object providing access to common cryptographic primitives, like hashing, signing, encryption, or decryption. methods this interface implements methods defined on randomsource. crypto.getrandomvalues() fills the passed typedarray with cryptographically sound random values. usage notes you should avoid using the web crypto api on insecure contexts, even though the crypto interface is present on insecure contexts, as is the window.crypto property. in addition, the crypto method getrandomvalues() is available on insecure contexts, but the subtle property is not. in general, you probably sh...
CustomElementRegistry.define() - Web APIs
; parameters name name for the new custom element. note that custom element names must contain a hyphen. constructor constructor for the new custom element. options optional object that controls how the element is defined. one option is currently supported: extends: string specifying the name of a built-in element to extend. used to create a customized built-in element. return value void. exceptions exception description notsupportederror the customelementregistry already contains an entry with the same name or the same constructor (or is otherwise already defined), or extends is specified and it is a valid custom element name, or extends is specified but the element it is trying to extend is an unknown element. syntaxerror the prov...
CustomElementRegistry.get() - Web APIs
the get() method of the customelementregistry interface returns the constructor for a previously-defined custom element. syntax constructor = customelements.get(name); parameters name the name of the custom element whose constructor you want to return a reference to. return value the constructor for the named custom element, or undefined if there is no custom element definition with that name. examples customelements.define('my-paragraph', class extends htmlelement { constructor() { super(); let template = document.getelementbyid('my-paragraph'); let templatecontent = template.content; const shadowroot = this.attachshadow({mode: 'open'}) .appendchild(templatecontent.clonenode(true)); } }) // return a reference to the my-paragraph construct...
CustomElementRegistry.upgrade() - Web APIs
() method of the customelementregistry interface upgrades all shadow-containing custom elements in a node subtree, even before they are connected to the main document. syntax customelements.upgrade(root); parameters root a node instance with shadow-containing descendant elements that are to be upgraded. if there are no descendant elements that can be upgraded, no error is thrown. return value void. examples taken from the html spec: const el = document.createelement("spider-man"); class spiderman extends htmlelement {} customelements.define("spider-man", spiderman); console.assert(!(el instanceof spiderman)); // not yet upgraded customelements.upgrade(el); console.assert(el instanceof spiderman); // upgraded! specifications specification status comment ...
CustomElementRegistry.whenDefined() - Web APIs
if the custom element is already defined, the promise is resolved immediately. exceptions exception description syntaxerror if the provided name is not a valid custom element name, the promise rejects with a syntaxerror. ...
CustomEvent() - Web APIs
ent() constructor creates a new customevent. note: this feature is available in web workers. syntax event = new customevent(typearg, customeventinit); parameters typearg a domstring representing the name of the event. customeventinit optional a customeventinit dictionary, having the following fields: "detail", optional and defaulting to null, of type any, that is an event-dependent value associated with the event. the customeventinit dictionary also accepts fields from the eventinit dictionary. return value a new customevent object of the specified type, with any other properties configured according to the customeventinit dictionary (if one was provided). example // add an appropriate event listener obj.addeventlistener("cat", function(e) { process(e.detail) }); ...
CustomEvent.detail - Web APIs
the detail readonly property of the customevent interface returns any data passed when initializing the event. note: this feature is available in web workers. syntax let mydetail = customeventinstance.detail; return value whatever data the event was initialized with. example // add an appropriate event listener obj.addeventlistener("cat", function(e) { process(e.detail) }); // create and dispatch the event let event = new customevent("cat", { detail: { hazcheeseburger: true } }); obj.dispatchevent(event); // will return an object contaning the hazcheeseburger property let mydetail = event.detail; specifications specification status comment domthe definition of 'detail' in that specification. living standard initial definition. ...
DOMException() - Web APIs
pecified message and name. syntax var domexception = new domexception(); var domexception = new domexception(message); var domexception = new domexception(message, name); parameters message optional a description of the exception. if not present, the empty string '' is used. name optional returns a domstring that contains one of the strings associated with an error constant. return value domexception a newly created domexception object. example tbd specifications specification status comment web idlthe definition of 'domexception()' in that specification. candidate recommendation adds the constructor for the domexception class. browser compatibility the compatibility table on this page is generated from structured data. if you'd like...
DOMException.code - Web APIs
Web › API › DOMException › code
the code read-only property of the domexception interface returns a short that contains one of the error code constants, or 0 if none match. this field is used for historical reasons. new dom exceptions don't use this anymore: they put this info in the domexception.name attribute. syntax var domexceptioncode = domexceptioninstance.code; value a short number. specifications specification status comment web idlthe definition of 'code' in that specification. candidate recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet explor...
DOMException.message - Web APIs
specifications specification status comment web idlthe definition of 'message' in that specification. candidate recommendation browser compatibility the compatibility table on this page is generated from structured data. ...
DOMException.name - Web APIs
Web › API › DOMException › name
the name read-only property of the domexception interface returns a domstring that contains one of the strings associated with an error name. syntax var domexceptionname = domexceptioninstance.name; value a domstring. specifications specification status comment web idlthe definition of 'name' in that specification. candidate recommendation ...
DOMMatrixReadOnly.flipX() - Web APIs
the original matrix is not modified. examples this svg contains two paths in the shape of a triangle, both drawn to the same position. ...
DOMMatrixReadOnly.translate() - Web APIs
the translate() method of the dommatrixreadonly interface creates a new matrix being the result of the original matrix with a translation applied. syntax the translate() method accepts two or three values. dommatrix.translate(translatex, translatey[, translatez]) parameters translatex a number representing the abscissa (x-coordinate) of the translating vector. translatey a number representing the ordinate (y-coordinate) of the translating vector. translatez optional a number representing the z component of the translating vector. if not supplied, this defaults to 0. if this is anything other than 0, the resulting matrix will be 3d. return value returns a dommatrix containing a new matrix being the result of the matrix being translated by the given vector. the original matrix...
DOMParser() - Web APIs
the domparser() constructor creates a new domparser object. syntax var parser = new domparser(); parameters none. return value a new domparser object. this object can be used to parse the text of a document using the parsefromstring() method. ...
DOMPoint.DOMPoint() - Web APIs
Web › API › DOMPoint › DOMPoint
the dompoint() constructor creates and returns a new dompoint object, given the values for some or all of its properties. you can also create a dompoint by calling the dompoint.frompoint() static function. that function accepts as input a dompointinit compatible object, including a dompoint or dompointreadonly. syntax point = new dompoint(x, y, z, w); parameters x optional the x coordinate for the new dompoint. y optional the y coordinate for the new dompoint. z optional the z coordinate for the new dompoint. w optional the perspective value of the new dompoint. examples this example creates a dompoint representing the top-left corner of the current window, then creates a second point based on the first, which is then offset by 100 pixels both vertically and horizontally. var...
DOMPoint.x - Web APIs
Web › API › DOMPoint › x
the dompoint interface's x property holds the horizontal coordinate, x, for a point in space. in general, positive values x mean to the right, and negative values of x means to the left, barring any transforms that may have altered the orientation of the axes. syntax var xpos = dompoint.x; value a double-precision floating-point value indicating the x coordinate's value for the point. this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity). specifications specification status comment geometry interfaces module level 1the definition of 'x' in that specification. candidate recommendation initial definition ...
DOMPoint.y - Web APIs
Web › API › DOMPoint › y
the dompoint interface's y property holds the vertical coordinate, y, for a point in space. unless transforms have been applied to alter the orientation, the value of y increases downward and decreases upward. syntax var ypos = dompoint.y; value a double-precision floating-point value indicating the y coordinate's value for the point. this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity). specifications specification status comment geometry interfaces module level 1the definition of 'y' in that specification. candidate recommendation initial definition ...
DOMPoint.z - Web APIs
Web › API › DOMPoint › z
the dompoint interface's z property specifies the depth coordinate of a point in space. unless transforms have changed the orientation, a z of 0 is the plane of the screen, with positive values extending outward toward the user from the screen, and negative values receding into the distance behind the screen. syntax var zpos = dompoint.z; value a double-precision floating-point value indicating the z coordinate's value for the point. this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity). specifications specification status comment geometry interfaces module level 1the definition of 'z' in that specification. candidate recommendation initial definition ...
DOMPointInit.x - Web APIs
Web › API › DOMPointInit › x
the dompointinit dictionary's x property is used to specify the x component of a point in 2d or 3d space when either creating or serializing a dompoint or dompointreadonly. in general, positive values x mean to the right, and negative values of x means to the left, assuming that transforms have not altered the orientation of the axes. syntax var dompointinit = { x: xpos }; dompointinit.x = xpos; var xpos = dompointinit.x; value a double-precision floating-point value indicating the point's x coordinate. this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity). if this property is missing when the dompointinit object is passed into frompoint(), the value is assumed to be 0 by default. dompointinit is used as an inp...
DOMPointReadOnly.fromPoint() - Web APIs
int is specified as a dompointinit-compatible object, which includes both dompoint and dompointreadonly. you can also create a new dompointreadonly object using the new dompointreadonly() constructor. syntax const point = dompointreadonly.frompoint(sourcepoint) properties sourcepoint a dompointinit-compliant object, which includes both dompoint and dompointreadonly, from which to take the values of the new point's properties. return value a new dompointreadonly object (which is identical to the source point). examples creating a 2d point this sample creates a 2d point, specifying an inline object that includes the values to use for x and y. the z and w properties are allowed to keep their default values (0 and 1 respectively). const point2d = dompointreadonly.frompoint({x: 25, y:...
DOMPointReadOnly.x - Web APIs
the dompointreadonly interface's x property holds the horizontal coordinate, x, for a read-only point in space. this property cannot be changed by javascript code in this read-only version of the dompoint object. in general, positive values x mean to the right, and negative values of x means to the left, assuming no transforms have resulted in a reversal. syntax const xpos = somedompointreadonly.x; value a double-precision floating-point value indicating the x coordinate's value for the point. this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity). specifications specification status comment geometry interfaces module level 1the definition of 'x' in that specification. candidate recomm...
DOMPointReadOnly.y - Web APIs
the dompointreadonly interface's y property holds the vertical coordinate, y, for a read-only point in space. if your script needs to be able to change the value of this property, you should instead use the dompoint object. in general, positive values of y mean downward, and negative values of y mean upward, assuming no transforms have resulted in a reversal. syntax const ypos = somedompointreadonly.y; value a double-precision floating-point value indicating the y coordinate's value for the point. this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity). specifications specification status comment geometry interfaces module level 1the definition of 'y' in that specification. candidate re...
DOMPointReadOnly.z - Web APIs
the dompointreadonly interface's z property holds the depth coordinate, z, for a read-only point in space. if your script needs to be able to change the value of this property, you should instead use the dompoint object. in general, positive values of z mean toward the user (out from the screen), and negative values of z mean away from the user (into the screen), assuming no transforms have resulted in a reversal. syntax const zpos = somedompointreadonly.z; value a double-precision floating-point value indicating the z coordinate's value for the point. this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity). specifications specification status comment geometry interfaces module level 1the ...
DOMRectReadOnly.bottom - Web APIs
the bottom read-only property of the domrectreadonly interface returns the bottom coordinate value of the domrect. (has the same value as y + height, or y if height is negative.) syntax var recbottom = domrect.bottom; value a double. specifications specification status comment geometry interfaces module level 1the definition of 'bottom' in that specification. candidate recommendation latest spec version is an ed. ...
DOMRectReadOnly.fromRect() - Web APIs
ar domrect = domrectreadonly.fromrect(rectangle) parameters rectangle optional an object specifying the location and dimensions of a rectangle. all properties default to 0. the properties are: x: the coordinate of the left side of the rectangle. y: the coordinate of the top side of the rectangle. width: the width of the rectangle. height: the height of the rectangle. return value an instance of domrect. specifications specification status comment geometry interfaces module level 1the definition of 'fromrect()' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out http...
DOMRectReadOnly.height - Web APIs
the height read-only property of the domrectreadonly interface represents the height of the domrect. syntax var recheight = domrect.height; value a double. specifications specification status comment geometry interfaces module level 1the definition of 'height' in that specification. candidate recommendation latest spec version is an ed. ...
DOMRectReadOnly.left - Web APIs
the left read-only property of the domrectreadonly interface returns the left coordinate value of the domrect. (has the same value as x, or x + width if width is negative.) syntax var recleft = domrect.left; value a double. specifications specification status comment geometry interfaces module level 1the definition of 'left' in that specification. candidate recommendation latest spec version is an ed. ...
DOMRectReadOnly.right - Web APIs
the right read-only property of the domrectreadonly interface returns the right coordinate value of the domrect. (has the same value as x + width, or x if width is negative.) syntax var recright = domrect.right; value a double. specifications specification status comment geometry interfaces module level 1the definition of 'right' in that specification. candidate recommendation latest spec version is an ed. ...
DOMRectReadOnly.top - Web APIs
the top read-only property of the domrectreadonly interface returns the top coordinate value of the domrect. (has the same value as y, or y + height if height is negative.) syntax var rectop = domrect.top; value a double. specifications specification status comment geometry interfaces module level 1the definition of 'top' in that specification. candidate recommendation latest spec version is an ed. ...
DOMRectReadOnly.width - Web APIs
the width read-only property of the domrectreadonly interface represents the width of the domrect. syntax var recwidth = domrect.width; value a double. specifications specification status comment geometry interfaces module level 1the definition of 'width' in that specification. candidate recommendation latest spec version is an ed. ...
DOMRectReadOnly.x - Web APIs
Web › API › DOMRectReadOnly › x
the x read-only property of the domrectreadonly interface represents the x coordinate of the domrect's origin. syntax var recx = domrect.x; value a double. specifications specification status comment geometry interfaces module level 1the definition of 'x' in that specification. candidate recommendation latest spec version is an ed. ...
DOMRectReadOnly.y - Web APIs
Web › API › DOMRectReadOnly › y
the y read-only property of the domrectreadonly interface represents the y coordinate of the domrect's origin. syntax var recy = domrect.y; value a double. specifications specification status comment geometry interfaces module level 1the definition of 'y' in that specification. candidate recommendation latest spec version is an ed. ...
DOMRectReadOnly - Web APIs
oing so returns an "illegal constructor" typeerror. properties domrectreadonly.x read only the x coordinate of the domrect's origin. domrectreadonly.y read only the y coordinate of the domrect's origin. domrectreadonly.width read only the width of the domrect. domrectreadonly.height read only the height of the domrect. domrectreadonly.top read only returns the top coordinate value of the domrect (usually the same as y.) domrectreadonly.right read only returns the right coordinate value of the domrect (usually the same as x + width). domrectreadonly.bottom read only returns the bottom coordinate value of the domrect (usually the same as y + height). domrectreadonly.left read only returns the left coordinate value of the domrect (usually the same as x). static met...
DOMTokenList.add() - Web APIs
Web › API › DOMTokenList › add
we then add a new token to the list, and write the list into the <span>'s node.textcontent. ...
DOMTokenList.contains() - Web APIs
the contains() method of the domtokenlist interface returns a boolean — true if the underlying list contains the given token, otherwise false. syntax tokenlist.contains(token); parameters token a domstring representing the token you want to check for the existance of in the list. return value a boolean, which is true if the calling list contains token, otherwise false. examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist. we then test for the existence of "c" in the list, and write the result 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 result = classes.contains("c");...
DOMTokenList.item() - Web APIs
Web › API › DOMTokenList › 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. ...
DOMTokenList.length - Web APIs
examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist, then write the length of the list to the <span>'s node.textcontent. ...
DOMTokenList.remove() - Web APIs
the remove() method of the domtokenlist interface removes the specified tokens from the list. syntax tokenlist.remove(token1[, token2[, ...tokenn]]); parameters tokenn a domstring representing the token you want to remove from the list. if the string is not in the list, no error is thrown, and nothing happens. return value undefined examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist. we then remove a token from the list, and write the list 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; classes.remove("c"); span.textcontent = classes; the output looks like this: to remo...
DOMTokenList.replace() - Web APIs
enlist interface replaces an existing token with a new token. if the first token doesn't exist, replace() returns false immediately, without adding the new token to the token list. syntax tokenlist.replace(oldtoken, newtoken); parameters oldtoken a domstring representing the token you want to replace. newtoken a domstring representing the token you want to replace oldtoken with. return value a boolean value, which is true if oldtoken was successfully replaced, or false if not. note: in older browsers, replace() returns void. examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist. we then replace a token in the list, and write the list into the <span>'s node.textcontent. first, the html: <span class="...
DOMTokenList.toggle() - Web APIs
xist it's added and the function returns true. syntax tokenlist.toggle(token [, force]); parameters token a domstring representing the token you want to toggle. force optional a boolean that, if included, turns the toggle into a one way-only operation. if set to false, then token will only be removed, but not added. if set to true, then token will only be added, but not removed. return value a boolean indicating whether token is in the list after the call. examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist. we then replace a token in the list, and write the list into the <span>'s node.textcontent. first, the html: <span class="a b">classlist is 'a b'</span> now the javascript: let span = document.
DataTransfer.addElement() - Web APIs
the datatransfer.addelement() method sets the drag source to the given element. this element will be the element to which drag and dragend events are fired, and not the defaut target (the node that was dragged). note: this method is gecko-specific. syntax void datatransfer.addelement(el); arguments el the element to set as the drag source. return value void example this example shows the use of the addelement() method function change_drag_node(event, node) { var dt = event.datatransfer; dt.addelement(node); } specifications this method is not defined in any web standard. ...
DataTransfer.files - Web APIs
if the drag operation had no files, the list is empty. ...
DataTransfer.getData() - Web APIs
the datatransfer.getdata() method retrieves drag data (as a domstring) for the specified type. if the drag operation does not include data, this method returns an empty string. example data types are text/plain and text/uri-list. syntax datatransfer.getdata(format); arguments format a domstring representing the type of data to retrieve. return value domstring a domstring representing the drag data for the specified format. if the drag operation has no data or the operation has no data for the specified format, this method returns an empty string. caveats data availability the html5 drag and drop specification dictates a drag data store mode. this may result in unexpected behavior, being datatransfer.getdata() not returning an expected value. example this example shows t...
DataTransfer.items - Web APIs
if the drag operation had no data, the list is empty. ...
DataTransfer.mozClearDataAt() - Web APIs
ormat for a particular index removes that item entirely, shifting the remaining items down and changing their indices. note: this method is gecko-specific. syntax void datatransfer.mozcleardataat([type], index); arguments type a string representing the type of the drag data to remove from the drag data object. index a unsigned long representing the index of the data to remove. return value void example this example shows the use of the mozcleardataat() method in a dragend event handler. function dragend_handler(event) { var dt = event.datatransfer; // remove a text/html item dt.mozcleardataat("text/html", 1); } specifications this method is not defined in any web standard. ...
DataTransfer.mozCursor - Web APIs
the datatransfer.mozcursor property returns or sets the drag cursor's state. this is primarily used to control the cursor during tab drags. the possible values are: auto uses the default system behavior. default uses the default gecko behavior, which is to set the cursor to an arrow during the drag operation. note: if any value other than default is set, auto is assumed. note: this property is currently only implemented on windows. note: this property is gecko-specific. syntax datatransfer.mozcursor; return value a domstring representing one of the values listed above. example this example shows the use of the mozcursor property. function drop_handler(event) { var dragdata = event.datatransfer; console.log("mozcursor = " + dragdata.mozcursor); } specifications this ...
DataTransfer.mozGetDataAt() - Web APIs
specified item does not exist or if the index is not in the range from zero to the number of items minus one. note: this method is gecko-specific. syntax nsivariant datatransfer.mozgetdataat([type], index); arguments type a string representing the type of the drag data to retrieve from the drag data object. index a unsigned long representing the index of the data to retrieve. return value nsivariant the data item requested. if the specified item does not exist, null is returned. example this example shows the use of the mozgetdataat() method in a drop event handler. function drop_handler(event) { var dt = event.datatransfer; var count = dt.mozitemcount; output("items: " + count + "\n"); for (var i = 0; i < count; i++) { output(" item " + i + ":\n"); var ty...
DataTransfer.mozItemCount - Web APIs
the datatransfer.mozitemcount property returns the number of items being dragged. this can be used, for example, to get the number of files being dragged. note: this property is gecko-specific. this property is read only . syntax datatransfer.mozitemcount; return value a number representing the number of items being dragged. example this example shows the use of the mozitemcount property. function drop_handler(event) { var files = []; var dt = event.datatransfer; for (var i = 0; i < dt.mozitemcount; i++) files.push(dt.mozgetdataat("application/x-moz-file", i)); } specifications this property is not defined in any web standard. ...
DataTransfer.mozSetDataAt() - Web APIs
l be converted into a string) or an nsisupports. note: this method is gecko-specific. syntax void datatransfer.mozsetdataat([type], data, index); arguments type a string representing the type of the drag data to add to the drag data object. data a nsivariant representing the data to add to the drag data object. index a unsigned long representing the index of the data to add. return value void example this example shows the use of the mozsetdataat() method in a dragstart handler. function dragstart_handler(event) { var dt = event.datatransfer; var idx = dt.mozitemcount; // add two new items to the drag transfer if (idx >= 0) { dt.mozsetdataat("text/uri-list","http://www.example.com/", idx); dt.mozsetdataat("text/html", "hello world", idx+1); } } specif...
DataTransfer.mozSourceNode - Web APIs
the datatransfer.mozsourcenode property is used to determine the node over which the mouse cursor was located when the the drag operation was initiated (for example, when a <button> was clicked). for external drags or if the calling function cannot reach the node, null is returned. note: this property is gecko-specific. this property is read only . syntax datatransfer.mozsourcenode; return value a node representing node where the drag originated. returns null for external drags or if the node cannot be accessed. example this example shows the use of the mozsourcenode property in the dragend event handler. function dragend_handler(event) { var dragdata = event.datatransfer; var node = dragdata.mozsourcenode; if (node != null) console.log("mozsourcenode = " + dragdata.mozsour...
DataTransfer.mozTypesAt() - Web APIs
thod returns a list of the format types that are stored for an item at the specified index. if the index is not in the range from 0 to the number of items minus one, an empty string list is returned. note: this method is gecko-specific. syntax nsivariant datatransfer.moztypesat(index); arguments index a unsigned long that is the index of the data for which to retrieve the types. return value nsivariant a list of data formats (which are strings). if the index is not in the range from 0 to the number of items minus one, an empty string list is returned. example this example shows the use of the moztypesat() method in a drop event handler. function drop_handler(event) { var dt = event.datatransfer; var count = dt.mozitemcount; output("items: " + count + "\n"); for (var ...
DataTransfer.mozUserCancelled - Web APIs
the datatransfer.mozusercancelled property is used in the dragend event handler to determine if the user canceled the drag or not. if the user canceled the event, the property returns true and returns false otherwise. this property only applies to the dragend event. note: this property is gecko-specific. this property is read only . syntax datatransfer.mozusercancelled; return value a boolean representing true if the user canceled the drag event and returns false otherwise. example this example shows the use of the mozusercancelled property in the dragend event handler. function dragend_handler(event) { var dragdata = event.datatransfer; console.log("mozusercancelled = " + dragdata.mozusercancelled); } specifications this property is not defined in any web standard. ...
DataTransfer.setData() - Web APIs
laced in the same position. that is, the order of the types list is not changed when replacing data of the same type. example data types are text/plain and text/uri-list. syntax void datatransfer.setdata(format, data); arguments format a domstring representing the type of the drag data to add to the drag object. data a domstring representing the data to add to the drag object. return value void example this example shows the use of the datatransfer object's getdata(), setdata() and cleardata() methods. <!doctype html> <html lang=en> <title>examples of datatransfer's setdata(), getdata() and cleardata()</title> <meta content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { ...
DataTransfer.types - Web APIs
the datatransfer.types read-only property returns an array of the drag data formats (as strings) that were set in the dragstart event. the order of the formats is the same order as the data included in the drag operation. the formats are unicode strings giving the type or format of the data, generally given by a mime type. some values that are not mime types are special-cased for legacy reasons (for example "text"). syntax datatransfer.types; return value an array of the data formats used in the drag operation. each format is string. if the drag operation included no data, this list will be empty. if any files are included in the drag operation, then one of the types will be the string files. example this example shows the use of the types and items properties. <!doctype html> <html...
DataTransferItem.getAsString() - Web APIs
the datatransferitem.getasstring() method invokes the given callback with the drag data item's string data as the argument if the item's kind is a plain unicode string (i.e. kind is string). syntax datatransferitem.getasstring(callback); parameters callback a callback function that has access to the data transfer item's string data. see callback below for details. return value undefined callback the callback 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 (v...
DataTransferItem.type - Web APIs
example this example shows the use of the type property. ...
DataTransferItem.webkitGetAsEntry() - Web APIs
a filesystemfileentry or filesystemdirectoryentry representing it. if the item isn't a file, null is returned. this function is implemented as webkitgetasentry() in non-webkit browsers including firefox at this time; it may be renamed to simply getasentry() in the future, so you should code defensively, looking for both. syntax datatransferitem.webkitgetasentry(); parameters none. return value a filesystementry-based object describing the dropped item. this will be either filesystemfileentry or filesystemdirectoryentry. example in this example, a drop zone is created, which responds to the drop event by scanning through the dropped files and directories, outputting a hierarchical directory listing. html content the html establishes the drop zone itself, which is a <div> element wi...
DataTransferItemList.DataTransferItem() - Web APIs
the datatransferitem() getter method implements support for accessing items in the datatransferitemlist using array-style syntax (that is datatransferitem[index]). syntax dataitem = datatransferitem[index]; parameters index the zero-based index of the item in the drag data list to return. return value the datatransferitem object at the specified index in the item list. if the index is less than zero or greater than or equal to the number of items in the list (as indicated by the list's length property, undefined is returned. the returned value is never null. example this example shows how to use drag and drop. javascript function dragstart_handler(ev) { console.log("dragstart"); // add this element's id to the drag payload so the drop handler will // know which element to ...
DataTransferItemList.add() - Web APIs
e newly-created datatransferitem object is returned. syntax datatransferitem = datatransferitemlist.add(data, type); datatransferitem = datatransferitemlist.add(file); parameters data a string representing the drag item's data. type a string of the drag item's type. some example types are text/html and text/plain. file a file object. no type needs to be given in this case. return value a datatransferitem containing the specified data. if the drag item couldn't be created (for example, if the associated datatransfer object has no data store), null is returned. exceptions notsupportederror a string data parameter was provided, and the list already contains an item whose kind is "plain unicode string" and whose type is equal to the specified type parameter. example this e...
DataTransferItemList.clear() - Web APIs
ethod clear() removes all datatransferitem objects from the drag data items list, leaving the list empty. the drag data store in which this list is kept is only writable while handling the dragstart event. while handling drop, the drag data store is in read-only mode, and this method silently does nothing. no exception is thrown. syntax datatransferitemlist.clear(); parameters none. return value undefined example this example shows the use of the clear() method. html <div> <p id="source" ondragstart="dragstart_handler(event);" ondragend="dragend_handler(event);" draggable="true"> select this element, drag it to the drop zone and then release the selection to move the element.</p> </div> <div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">d...
DataTransferItemList.length - Web APIs
the drag item list is considered to be disabled if the item list's datatransfer object is not associated with a drag data store. example this example shows the use of the length property. ...
DataTransferItemList.remove() - Web APIs
em at the specified index from the list. if the index is less than zero or greater than one less than the length of the list, the list will not be changed. 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. example this example shows the use of the remove() method. 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.datat...
DedicatedWorkerGlobalScope.name - Web APIs
the name read-only property of the dedicatedworkerglobalscope interface returns the name that the worker was (optionally) given when it was created. this is the name that the worker() constructor can pass to get a reference to the dedicatedworkerglobalscope. syntax var nameobj = self.name; value a domstring. example if a worker is created using a constructor with a name option: var myworker = new worker("worker.js", { name : "myworker" }); the dedicatedworkerglobalscope will now have a name of "myworker", returnable by running self.name from inside the worker. specifications specification status comment html living standardthe definition of 'name' in that specification. living standard ...
DeviceLightEvent - Web APIs
the devicelightevent provides web developers with information from photo sensors or similiar detectors about ambient light levels near the device. for example this may be useful to adjust the screen's brightness based on the current ambient light level in order to save energy or provide better readability. properties devicelightevent.value the level of the ambient light in lux. example window.addeventlistener('devicelight', function(event) { console.log(event.value); }); specifications no specification. ...
DeviceMotionEvent.acceleration - Web APIs
the acceleration property returns the amount of acceleration recorded by the device, in meters per second squared (m/s2). note: if the hardware doesn't know how to remove gravity from the acceleration data, this value may not be present in the devicemotionevent. in this situation, you'll need to use devicemotionevent.accelerationincludinggravity instead. syntax var acceleration = devicemotionevent.acceleration; value the acceleration property is an object providing information about acceleration on three axis. each axis is represented with its own property: x represents the acceleration upon the x axis which is the west to east axis y represents the acceleration upon the y axis which is the south to north axis z represents the acceleration upon the z axis which is the down to up...
DeviceMotionEvent.accelerationIncludingGravity - Web APIs
the accelerationincludinggravity property returns the amount of acceleration recorded by the device, in meters per second squared (m/s2). unlike devicemotionevent.acceleration which compensates for the influence of gravity, its value is the sum of the acceleration of the device as induced by the user and the acceleration caused by gravity. this value is not typically as useful as devicemotionevent.acceleration, but may be the only value available on devices that aren't able of removing gravity from the acceleration data, such as on devices that don't have a gyroscope. syntax var acceleration = devicemotionevent.accelerationincludinggravity; value the accelerationincludinggravity property is an object providing information about acceleration on three axis. each axis is represented with its...
DeviceMotionEvent.rotationRate - Web APIs
returns the rate at which the device is rotating around each of its axes in degrees per second. note: if the hardware isn't capable of providing this information, this property returns null. syntax var rotationrate = devicemotionevent.rotationrate; value the rotationrate property is a read only object describing the rotation rates of the device around each of its axes: alpha the rate at which the device is rotating about its z axis; that is, being twisted about a line perpendicular to the screen. beta the rate at which the device is rotating about its x axis; that is, front to back. gamma the rate at which the device is rotating about its y axis; that is, side to side. specifications specification status comment deviceorientation event specification...
DeviceMotionEventAcceleration: x - Web APIs
summary this read-only property indicates the amount of acceleration that occurred along the x axis in a devicemotioneventacceleration object. syntax var xaccel = devicemotioneventacceleration.x; return value x a double indicating the amount of acceleration along the x axis. see accelerometer values explained for details. specifications specification status comment deviceorientation event specificationthe definition of 'devicemotioneventacceleration: x' in that specification. editor's draft ...
DeviceMotionEventAcceleration: y - Web APIs
summary this read-only property indicates the amount of acceleration that occurred along the y axis in a devicemotioneventacceleration object. syntax var yaccel = devicemotioneventacceleration.y; return value y a double indicating the amount of acceleration along the y axis. see accelerometer values explained for details. specifications specification status comment deviceorientation event specificationthe definition of 'devicemotioneventacceleration: y' in that specification. editor's draft ...
DeviceMotionEventAcceleration: z - Web APIs
summary this read-only property indicates the amount of acceleration that occurred along the z axis in a devicemotioneventacceleration object. syntax var zaccel = devicemotioneventacceleration.z; return value z a double indicating the amount of acceleration along the z axis. see accelerometer values explained for details. specifications specification status comment deviceorientation event specificationthe definition of 'devicemotioneventacceleration: z' in that specification. editor's draft ...
DeviceMotionEventRotationRate: alpha - Web APIs
this property indicates the rate of rotation around the z axis -- in degrees per second -- in a devicemotioneventrotationrate object. syntax var alpha = devicerotationrate.alpha; this property is read-only. return value alpha a double indicating the rate of rotation around the z axis, in degrees per second. see accelerometer values explained for details. specifications specification status comment deviceorientation event specificationthe definition of 'devicemotioneventrotationrate: alpha' in that specification. editor's draft ...
DeviceMotionEventRotationRate: beta - Web APIs
this property indicates the rate of rotation around the x axis -- in degrees per second -- in a devicemotioneventrotationrate object. syntax var beta = devicerotationrate.beta; this property is read-only. return value beta a double indicating the rate of rotation around the x axis, in degrees per second. see accelerometer values explained for details. specifications specification status comment deviceorientation event specificationthe definition of 'devicemotioneventrotationrate: beta' in that specification. editor's draft ...
DeviceMotionEventRotationRate: gamma - Web APIs
this property indicates the rate of rotation around the y axis -- in degrees per second -- in a devicemotioneventrotationrate object. syntax var gamma = devicerotationrate.gamma; this property is read-only. return value gamma a double indicating the rate of rotation around the y axis, in degrees per second. see accelerometer values explained for details. specifications specification status comment deviceorientation event specificationthe definition of 'devicemotioneventrotationrate: gamma' in that specification. editor's draft ...
DeviceOrientationEvent.DeviceOrientationEvent() - Web APIs
tor creates a new deviceorientationevent. syntax var deviceorientationevent = new deviceorientationevent(type[, options]) parameters type either "deviceorientation" or "deviceorientationabsolute". if the later, then options.absolute should be true. options optional options are as follows: alpha: a number representing the motion of the device around the z axis, express in degrees with values ranging from 0 to 360. beta: a number representing the motion of the device around the x axis, express in degrees with values ranging from -180 to 180. this represents a front to back motion of the device. gamma: a number representing the motion of the device around the y axis, express in degrees with values ranging from -90 to 90. this represents a left to right motion of the device. abso...
DeviceProximityEvent.max - Web APIs
the max property provides the maximum sensing distance the sensor is able to report, in centimeters. syntax var value = instanceofdeviceproximityevent.max; value a positive number indicating the maximum distance, in centimeters (cm), that the device's proximity sensor is able to detect and report. ...
DeviceProximityEvent.min - Web APIs
the min property provides the minimum distance the sensor can report, in centimeters. syntax var value = instanceofdeviceproximityevent.min; value a positive number indicating the minimum distance, in centimeters (cm), the device's proximity sensor can report. ...
Document.adoptNode() - Web APIs
node from another document into the method's document. the adopted node and its subtree is removed from its original document (if any), and its ownerdocument is changed to the current document. the node can then be inserted into the current document. syntax const importednode = document.adoptnode(externalnode); parameters externalnode the node from another document to be adopted. return value the copied importednode in the scope of the importing document. after calling this method, importednode and externalnode are the same object. note: importednode's node.parentnode is null, since it has not yet been inserted into the document tree! example const iframe = document.queryselector('iframe'); const iframeimages = iframe.contentdocument.queryselectorall('img'); const newparent = ...
Document.alinkColor - Web APIs
returns or sets the color of an active link in the document body. a link is active during the time between mousedown and mouseup events. syntax var color = document.alinkcolor; document.alinkcolor = color; color is a string containing the name of the color (e.g., blue, darkblue, etc.) or the hexadecimal value of the color (e.g., #0000ff) notes the default value for this property in mozilla firefox is red (#ee0000 in hexadecimal). document.alinkcolor is deprecated in dom level 2 html. one alternative is the css selector :active. another alternative is document.body.alink, although this is deprecated in html 4.01 in favor of the css alternative. gecko supports both alinkcolor/:active and :focus. internet explorer 6 and 7 support alinkcolor/:active only for html anchor (<a>) links and ...
Document.all - Web APIs
Web › API › Document › all
conversion to boolean document.all is the only falsy object accessible to javascript, because it has the [[ishtmldda]] internal slot. ...
Document.anchors - Web APIs
Web › API › Document › anchors
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(new...
Document: animationstart event - Web APIs
the animationstart event is fired when a css animation has started. if there is an animation-delay, this event will fire once the delay period has expired. a negative delay will cause the event to fire with an elapsedtime equal to the absolute value of the delay (and, correspondingly, the animation will begin playing at that time index into the sequence). bubbles yes cancelable no interface animationevent event handler property onanimationstart the original target for this event is the element that had the animation applied. you can listen for this event on the document interface to handle it in the capture or bubbling phases. for full details on this event please see the page on htmlelement: animationstart. examples this listens for th...
Document.applets - Web APIs
Web › API › Document › applets
the applets property of the document interface returns a list of the applets within a document. note: the <applet> element was removed in gecko 56 and chrome in late 2015. since then, calling document.applets in those browsers always returns an empty htmlcollection. removal is being considered in webkit and edge. syntax var nodelist = document.applets; value an htmlcollection. example // when you know the second applet is the one you want my_java_app = document.applets[1]; specifications specification status comment html living standardthe definition of 'document.applets' in that specification. living standard obsoleted. document object model (dom) level 2 html specificationthe definition of 'document.applets' in that specification. ...
Document.compatMode - Web APIs
"css1compat" if the document is in no-quirks (also known as "standards") mode or limited-quirks (also known as "almost standards") mode. note: all these modes are now standardized, so the older "standards" and "almost standards" names are nonsensical and no longer used in standards. ...
Document.contentType - Web APIs
the document.contenttype read-only property returns the mime type that the document is being rendered as. this may come from http headers or other sources of mime information, and might be affected by automatic type conversions performed by either the browser or extensions. note: this property is unaffected by <meta> elements. syntax contenttype = document.contenttype; value contenttype is a read-only property. specifications specification status comment domthe definition of 'document.contenttype' in that specification. living standard initial definition ...
Document.createDocumentFragment() - Web APIs
usage notes documentfragments are dom node objects which are never part of the main dom tree. the usual use case is to create the document fragment, append elements to the document fragment and then append the document fragment to the dom tree. in the dom tree, the document fragment is replaced by all its children. ...
Document.createEntityReference() - Web APIs
since gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. prior to gecko 7.0 this method showed up as present, due to bug bug 9850, it always only returned null. the only workaround is to create a text node, cdata section, attribute node value, etc. which has the value referred to by the entity, using unicode escape sequences or fromcharcode() as necessary. specifications createentityreference ...
Document.createExpression() - Web APIs
parameters xpathtext is a string which is the xpath expression to be compiled. namespaceurlmapper is a function which maps a namespace prefix to a namespace url (or null if none needed). firefox 3 note prior to firefox 3, you could call this method on documents other than the one you planned to run the xpath against. under firefox 3, you must call it on the same document. return value xpathexpression ...
Document.createNSResolver() - Web APIs
notes adapts any dom node to resolve namespaces so that an xpath expression can be easily evaluated relative to the context of the node where it appeared within the document. ...
Document.createNodeIterator() - Web APIs
returns a new nodeiterator object. syntax const nodeiterator = document.createnodeiterator(root[, whattoshow[, filter]]); values root the root node at which to begin the nodeiterator's traversal. whattoshow optional is an optional unsigned long representing a bitmask created by combining the constant properties of nodefilter. it is a convenient way of filtering for certain types of node. it defaults to 0xffffffff representing the show_all constant. constant numerical value description nodefilter.show_all -1 (that is the max value of unsigned long) shows all nodes. nodefilter.show_attribute 2 shows attribute attr nodes. this is meaningful only when creating a treewalker with an attr node as its root. in t...
Document.createTouchList() - Web APIs
note: before gecko 25.0, this method was defined on the documenttouch mixin. the document.createtouchlist() method creates and returns a new touchlist object. syntax var list = documenttouch.createtouchlist([touch1 [, touch2 [, ...]]]); parameters touches zero or more touch objects. note: firefox also accepts an array of touch objects. return value list a touchlist object containing the touch objects specified by the touches parameter. example this example illustrates using the document.createtouchlist() method to create touchlist objects. in following code snippet, some touch objects are created for the target element and those touch points are then used to create some touchlist objects. var target = document.getelementbyid("target"); // create some touch points var t...
Document.designMode - Web APIs
document.designmode controls whether the entire document is editable. valid values are "on" and "off". according to the specification, this property is meant to default to "off". firefox follows this standard. the earlier versions of chrome and ie default to "inherit". starting in chrome 43, the default is "off" and "inherit" is no longer supported. in ie6-10, the value is capitalized. syntax var mode = document.designmode; document.designmode = value; value a string indicating whether designmode is (or should be) set to on or off. valid values are on and off. example make an <iframe>'s document editable: iframenode.contentdocument.designmode = "on"; specifications specification status comment html living standardthe definition of 'designmode' in that spec...
Document.dir - Web APIs
Web › API › Document › dir
the document.dir property is a domstring representing the directionality of the text of the document, whether left to right (default) or right to left. possible values are 'rtl', right to left, and 'ltr', left to right. syntax dirstr = document.dir document.dir = dirstr specifications specification status comment html living standardthe definition of 'document.dir' in that specification. living standard initial specification ...
Document.embeds - Web APIs
Web › API › Document › embeds
the embeds read-only property of the document interface returns a list of the embedded <object> elements within the current document. syntax nodelist = document.embeds value an htmlcollection. specifications specification status comment html living standardthe definition of 'document.embeds' in that specification. living standard ...
Document.enableStyleSheetsForSet() - Web APIs
erred style sheets (but not the persistent style sheets; that is, those with no title attribute). notes title matches are case-sensitive. calling this method with a null name has no effect; if you want to disable all alternate and preferred style sheets, you must pass "", the empty string. stylesheets that don't have a title are never affected by this method. this method never affects the values of document.laststylesheetset or document.preferredstylesheetset. example document.enablestylesheetsforset("some style sheet set name"); ...
Document.exitFullscreen() - Web APIs
the document method exitfullscreen() requests that the element on this document which is currently being presented in full-screen mode be taken out of full-screen mode, restoring the previous state of the screen. this usually reverses the effects of a previous call to element.requestfullscreen(). syntax exitpromise = document.exitfullscreen(); parameters none. return value a promise which is resolved once the user agent has finished exiting full-screen mode. if an error occurs while attempting to exit full-screen mode, the catch() handler for the promise is called. example this example causes the current document to toggle in and out of a full-screen presentation whenever the mouse button is clicked within it. document.onclick = function (event) { if (document.fullscreenelement) { ...
Document.featurePolicy - Web APIs
the featurepolicy read-only property of the document interface returns the featurepolicy interface which provides a simple api for inspecting the feature policies applied to a specific document. syntax var policy = iframeelement.featurepolicy value a featurepolicy object that can be used to inspect the feature policy settings applied to the document. specification specification status comment feature policy editor's draft initial definition. ...
Document.fgColor - Web APIs
Web › API › Document › fgColor
fgcolor gets/sets the foreground color, or text color, of the current document. syntax var color = document.fgcolor; document.fgcolor = color; parameters color is a string representing the color as a word (e.g., "red") or hexadecimal value (e.g., "#ff0000"). example document.fgcolor = "white"; document.bgcolor = "darkblue"; notes the default value for this property in mozilla firefox is black (#000000 in hexadecimal). document.fgcolor is deprecated in dom level 2 html. the recommended alternative is the css property color (e.g., document.body.style.color = "red"). another alternative is document.body.text, although this is deprecated in html 4.01 in favor of the css alternative above. ...
Document.fonts - Web APIs
Web › API › Document › fonts
the fontfaceset interface is useful for loading new fonts, checking the status of previously loaded fonts etc. examples doing operation after all fonts are loaded document.fonts.ready.then(function() { // any operation that needs to be done only after all the fonts // have finished loading can go here. ...
Document.fullscreen - Web APIs
content in full-screen mode. although this property is read-only, it will not throw if it is modified (even in strict mode); the setter is a no-operation and it will be ignored. note: since this property is deprecated, you can determine if full-screen mode is active on the document by checking to see if document.fullscreenelement is not null. syntax var isfullscreen = document.fullscreen; value a boolean value which is true if the document is currently displaying an element in full-screen mode; otherwise, the value is false. example this simple function reports whether or not full-screen mode is currently active, using the obsolete fullscreen property. function isdocumentinfullscreenmode() { return document.fullscreen; } this next example, on the other hand, uses the current ful...
Document.getAnimations() - Web APIs
the getanimations() method of the document interface returns an array of all animation objects currently in effect whose target elements are descendants of the document. this array includes css animations, css transitions, and web animations. syntax var allanimations = document.getanimations(); parameters none. return value an array of animation objects, each representing one animation currently associated with elements which are descendants of the document on which it's called. examples the following code snippet will slow down all animations on a page by halving their animation.playbackrate. document.getanimations().foreach( function (animation) { animation.playbackrate *= .5; } ); specifications specification status comment web animationsthe...
Document.getElementsByTagNameNS() - Web APIs
ce. the complete document is searched, including the root node. syntax elements = document.getelementsbytagnamens(namespace, name) elements is a live nodelist (but see the note below) of found elements in the order they appear in the tree. namespace is the namespace uri of elements to look for (see element.namespaceuri). name is either the local name of elements to look for or the special value *, which matches all elements (see element.localname). note: while the w3c specification says elements is a nodelist, this method returns a htmlcollection both in gecko and internet explorer. opera returns a nodelist, but with a nameditem method implemented, which makes it similar to a htmlcollection. as of january 2012, only in webkit browsers is the returned value a pure nodelist. see bug 148...
Document.hasFocus() - Web APIs
Web › API › Document › hasFocus
the hasfocus() method of the document interface returns a boolean value indicating whether the document or any element inside the document has focus. this method can be used to determine whether the active element in a document has focus. when viewing a document, an element with focus is always the active element in the document, but an active element does not necessarily have focus. for example, an active element within a popup window that is not the foreground doesn't have focus. syntax var focused = document.hasfocus(); return value false if the active element in the document has no focus; true if the active element in the document has focus. example this example checks whether the document has focus every 300 milliseconds. to test the functionality of hasfocus(), click on the butt...
Document.head - Web APIs
Web › API › Document › head
the head read-only property of the document interface returns the <head> element of the current document. syntax var objref = document.head; value an htmlheadelement. example <!doctype html> <head id="my-document-head"> <title>example: using document.head</title> </head> <script> var thehead = document.head; console.log(thehead.id); // "my-document-head"; console.log( thehead === document.queryselector("head") ); // true </script> notes document.head is read-only. trying to assign a value to this property will fail silently or, in strict mode, throws a typeerror . specifications specification status comment html 5.1the definition of 'document.head' in that specification. recommendation html5the definition of 'document.head' in...
Document.hidden - Web APIs
Web › API › Document › hidden
syntax var boolean = document.hidden examples document.addeventlistener("visibilitychange", function() { console.log( document.hidden ); // modify behavior... ...
Document.images - Web APIs
Web › API › Document › images
each entry in the collection is an htmlimageelement representing a single image element. usage notes you can use either javascript array notation or the item() method on the returned collection to access the items in the collection. ...
Document: keypress event - Web APIs
the keypress event is fired when a key that produces a character value is pressed down. examples of keys that produce a character value are alphabetic, numeric, and punctuation keys. examples of keys that don't produce a character value are modifier keys such as alt, shift, ctrl, or meta. since this event has been deprecated, you should look to use beforeinput or keydown instead. interface keyboardevent bubbles yes cancelable yes default action varies: keypress event; launch text composition system; blur and focus events; domactivate event; other event examples addeventlistener keypress example this example logs the keyboardevent.code value whenever you press a key. <p>press inside this iframe first to focus it, then try press...
Document.lastModified - Web APIs
alert(document.lastmodified); // returns: tuesday, december 16, 2017 11:09:42 transforming lastmodified into a date object this example transforms lastmodified into a date object. ...
Document.lastStyleSheetSet - Web APIs
the document.laststylesheetset property returns the last enabled style sheet set. this property's value changes whenever the document.selectedstylesheetset property is changed. syntax var laststylesheetset = document.laststylesheetset on return, laststylesheetset indicates the style sheet set that was most recently set. if the current style sheet set has not been changed by setting document.selectedstylesheetset, the returned value is null. note: this value doesn't change when document.enablestylesheetsforset() is called. example let lastsheetset = document.laststylesheetset; if (!lastsheetset) { lastsheetset = 'style sheet not yet changed'; } else { console.log('the last style sheet set is: ' + lastsheetset); } ...
Document.linkColor - Web APIs
e document. this property is deprecated. as an alternative, you can set the css color property on either html anchor links (<a>) or on :link pseudo-classes. another alternative is document.body.link, although this is deprecated in html 4.01. syntax color = document.linkcolor document.linkcolor = color parameters color is a string representing the color as a word (e.g., red) or hexadecimal value (e.g., #ff0000). example document.linkcolor = 'blue'; specification html5 document.linkcolor is deprecated in dom level 2 html. ...
Document.links - Web APIs
Web › API › Document › links
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. ...
Document.location - Web APIs
Web › API › Document › location
u can also assign a domstring to it. this means that you can work with document.location as if it were a string in most cases: document.location = 'http://www.example.com' is a synonym of document.location.href = 'http://www.example.com'. to retrieve just the url as a string, the read-only document.url property can also be used. if the current document is not in a browsing context, the returned value is null. syntax locationobj = document.location document.location = 'http://www.mozilla.org' // equivalent to document.location.href = 'http://www.mozilla.org' examples console.log(document.location); // prints a location object to the console specifications specification status comment html living standardthe definition of 'document.location' in that specifica...
Document.onfullscreenchange - Web APIs
the document interface's onfullscreenchange property is an event handler for the fullscreenchange event that is fired immediately before a document transitions into or out of full-screen mode. syntax targetdocument.onfullscreenchange = fullscreenchangehandler; value an event handler which is invoked whenever the document receives a fullscreenchange event, indicating that the document is transitioning into or out of full-screen mode. usage notes the fullscreenchange event does not directly specify whether the transition is into or out of full-screen mode, so your event handler should look at the value of document.fullscreenelement. if it's null, the event indicates a transition out of full-screen mode. otherwise, the specified element is about to take over the screen. example document.
Document.onfullscreenerror - Web APIs
example this example attempts to call requestfullscreen() outside of an event handler. ...
Document.ononline - Web APIs
Web › API › Document › ononline
nline and offline mode. additionally, the events bubble up from document.body, to document, ending at window. both events are non-cancellable (you can't prevent the user from coming online, or going offline). window.navigator.online returns boolean true if the browser is online and false if it is definitely offline (disconnected from the network). the online and offline events are fired when the value of this attribute changes. it is important to note that this event and attribute are inherently unreliable. a computer can be connected to a network without having internet access. you can register listeners for these events in a few familiar ways: using addeventlistener on the window, document, or document.body by setting the .ononline or .onoffline properties on document or document.bod...
Document.open() - Web APIs
Web › API › Document › open
the document.open() method opens a document for writing. this does come with some side effects. for example: all event listeners currently registered on the document, nodes inside the document, or the document's window are removed. all existing nodes are removed from the document. syntax document.open(); parameters none. return value a document object instance. examples the following simple code opens the document and replaces its content with a number of different html fragments, before closing it again. document.open(); document.write("<p>hello world!</p>"); document.write("<p>i am a fish</p>"); document.write("<p>the number is 42</p>"); document.close(); notes an automatic document.open() call happens when document.write() is called after the page has loaded. for years f...
Document.plugins - Web APIs
Web › API › Document › plugins
the plugins read-only property of the document interface returns an htmlcollection object containing one or more htmlembedelements representing the <embed> elements in the current document. for a list of installed plugins, use navigatorplugins.plugins instead. syntax embedarrayobj = document.plugins value an htmlcollection, or null if there are no embeds in the document. specifications specification status comment html living standardthe definition of 'document.plugins' in that specification. living standard ...
Document.popupNode - Web APIs
is will be the target of the mouse event that activated the popup. if the popup was opened via the keyboard, the popup node may be set to null. typically, this property will be checked during a popupshowing event handler for a context menu to initialize the menu based on the context. this property is only set for popups attached via the popup or context attributes. for other types of popups, the value is not changed. in these other cases, for example when calling the popup's showpopup method, you may wish to set the popupnode property directly beforehand. this property applies only to xul documents. syntax var node = document.popupnode; example <menupopup id="toolbarcontextmenu"> ... <menuitem oncommand="mailnewscore.deletebutton(document.popupnode)"> ... </menupopup> ...
Document.queryCommandEnabled() - Web APIs
notes for 'cut' and 'copy' commands the method only returns true when called from a user-initiated thread. ...
Document.queryCommandState() - Web APIs
the querycommandstate() method will tell you if the current selection has a certain document.execcommand() command applied. syntax querycommandstate(string command) parameters command is a command from document.execcommand() return value querycommandstate() can return a boolean value or null if the state is unknown. example html <div contenteditable="true">select a part of this text!</div> <button onclick="makebold();">test the state of the 'bold' command</button> javascript function makebold() { var state = document.querycommandstate("bold"); switch (state) { case true: alert("the bold formatting will be removed from the selected text."); break; case false: alert("the selected text will be displayed in bold."); break; case null: ale...
Document.queryCommandSupported() - Web APIs
the document.querycommandsupported() method reports whether or not the specified editor command is supported by the browser. syntax issupported = document.querycommandsupported(command); parameters command the command for which to determine support. return value returns a boolean which is true if the command is supported and false if the command isn't. notes the 'paste' command return false not only if the feature is unavailable, but also if the script calling it has insufficient privileges to perform the action [1] example var flg = document.querycommandsupported("selectall"); if(flg) { // ...do something } specifications specification status comment execcommand ...
Document.querySelector() - Web APIs
eption is thrown. see locating dom elements using selectors for more about selectors and how to manage them. note: characters that are not part of standard css syntax must be escaped using a backslash character. since javascript also uses backslash escaping, be especially careful when writing string literals using these characters. see escaping special characters for more information. return value an htmlelement object representing the first element in the document that matches the specified set of css selectors, or null is returned if there are no matches. if you need a list of all elements matching the specified selectors, you should use queryselectorall() instead. exceptions syntax_err the syntax of the specified selectors is invalid. usage notes if the specified selector matc...
Document.readyState - Web APIs
interactive the document has finished loading and the document has been parsed but sub-resources such as images, stylesheets and frames are still loading. complete the document and all sub-resources have finished loading. the state indicates that the load event is about to fire. ...
Document.referrer - Web APIs
Web › API › Document › referrer
the document.referrer property returns the uri of the page that linked to this page. syntax var referrer = document.referrer; value the value is an empty string if the user navigated to the page directly (not through a link, but, for example, by using a bookmark). because this property returns only a string, it doesn't give you document object model (dom) access to the referring page. inside an <iframe>, the document.referrer will initially be set to the same value as the href of the parent window's window.location. specifications specification status comment html living standardthe definition of 'document.referrer' in that specification. living standard ...
Document.scripts - Web APIs
Web › API › Document › scripts
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. ...
Document.selectedStyleSheetSet - Web APIs
the selectedstylesheetset property indicates the name of the style sheet set that's currently in use. syntax currentstylesheetset = document.selectedstylesheetset; document.selectedstylesheet = newstylesheetset; on return, currentstylesheetset indicates the name of the style sheet set currently in use. you can also set the current style sheet set using this property. setting the value of this property is equivalent to calling document.enablestylesheetsforset() with the value of currentstylesheetset, then setting the value of laststylesheetset to that value as well. note: this attribute's value is live; directly changing the disabled attribute on style sheets will affect the value of this attribute. example console.log('current style sheet set: ' + document.selectedstylesheetset); d...
Document.vlinkColor - Web APIs
the document.vlinkcolor property gets/sets the color of links that the user has visited in the document. syntax color = document.vlinkcolor document.vlinkcolor = color parameters color is a string representing the color as a word (e.g., "red") or hexadecimal value (e.g., "#ff0000"). notes the default value for this property in mozilla firefox is purple (#551a8b in hexadecimal). document.vlinkcolor is deprecated in dom level 2 html. the recommended alternative is to get/set the color of the css :visited pseudo-class on html <a> elements (e.g., a:visited {color:red;}). another alternative is document.body.vlink, although this is deprecated in html 4.01 in favor of the css alternative. ...
Document: wheel event - Web APIs
cancelable yes interface wheelevent event handler property globaleventhandlers.onwheel this event replaces the non-standard deprecated mousewheel event. note: don't confuse the wheel event with the scroll event. the default action of a wheel event is implementation-specific, and doesn't necessarily dispatch a scroll event. even when it does, the delta* values in the wheel event don't necessarily reflect the content's scrolling direction. therefore, do not rely on the wheel event's delta* properties to get the scrolling direction. instead, detect value changes of scrollleft and scrolltop in the scroll event. examples scaling an element via the wheel this example shows how to scale an element using the mouse (or other pointing device) wheel. <div>...
DocumentFragment.querySelector() - Web APIs
element, or null if no matches are found, within the documentfragment (using depth-first pre-order traversal of the document's nodes) that matches the specified group of selectors. if the selector matches an id and this id is erroneously used several times in the document, it returns the first matching element. if the selectors specified in parameter are invalid a domexception with a syntax_err value is raised. syntax element = documentfragment.queryselector(selectors); parameters selectors is a domstring containing one or more css selectors separated by commas. examples basic example in this basic example, the first element in the documentfragment with the class "myclass" is returned: var el = documentfragment.queryselector(".myclass"); css syntax and the method's argument th...
DocumentFragment.querySelectorAll() - Web APIs
note: the definition of this api was moved to the parentnode interface. ...
DocumentOrShadowRoot.elementFromPoint() - Web APIs
e is negative, the result is null. if you need to find the specific position inside the element, use document.caretpositionfrompoint(). syntax const element = document.elementfrompoint(x, y) parameters x the horizontal coordinate of a point, relative to the left edge of the current viewport. y the vertical coordinate of a point, relative to the top edge of the current viewport. return value the topmost element object located at the specified coordinates. example this example creates two buttons which let you set the current color of the paragraph element located under the coordinates (2, 2). javascript function changecolor(newcolor) { elem = document.elementfrompoint(2, 2); elem.style.color = newcolor; } the changecolor() method simply obtains the element located at the sp...
DocumentOrShadowRoot.elementsFromPoint() - Web APIs
the elementsfrompoint() method of the documentorshadowroot interface returns an array of all elements at the specified coordinates (relative to the viewport). it operates in a similar way to the elementfrompoint() method. syntax const elements = document.elementsfrompoint(x, y); parameters x the horizontal coordinate of a point. y the vertical coordinate of a point. return value 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.
DocumentOrShadowRoot.getSelection() - Web APIs
returns a selection object. example function foo() { var selobj = document.getselection(); alert(selobj); var selrange = selobj.getrangeat(0); // do stuff with the range } notes string representation of the selection object in javascript, when an object is passed to a function expecting a string (like window.alert()), the object's tostring() method is called and the returned value is passed to the function. this can make the object appear to be a string when used with other functions when it is 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...
DocumentOrShadowRoot.pointerLockElement - Web APIs
the pointerlockelement property of the document and shadowroot interfaces provides the element set as the target for mouse events while the pointer is locked. it is null if lock is pending, pointer is unlocked, or the target is in another document. syntax var element = document.pointerlockelement; return value an element or null. specifications specification status comment pointer lockthe definition of 'pointerlockelement' in that specification. candidate recommendation extend the document interface ...
DocumentTimeline - Web APIs
imations api represents animation timelines, including the default document timeline (accessed via document.timeline). constructor documenttimeline() creates a new documenttimeline object associated with the active document of the current browsing context. properties this interface inherits its property from its parent, animationtimeline. animationtimeline.currenttime returns the time value in milliseconds for this timeline or null if it is inactive. examples we could share a single documenttimeline among multiple animations, thus allowing us to manipulate just that group of animations via their shared timeline. this bit of code would start all the cats animating 500 milliseconds into their animations: const cats = document.queryselectorall('.sharedtimelinecat'); const sharedtim...
Example - Web APIs
ate a new element to be the second paragraph var newelement = document.createelement("p"); // put the text in the paragraph newelement.appendchild(newtext); // and put the paragraph on the end of the document by appending it to // the body (which is the parent of para) para.parentnode.appendchild(newelement); } </script> </head> <body> <input type="button" value="change this document." onclick="change()"> <h1>header</h1> <p>paragraph</p> </body> </head> ...
Using the W3C DOM Level 1 Core - Web APIs
edit the dom of a document is to use javascript to access the document property of the global object. this document object implements the document interface from the w3c's dom level 1 spec. a simple example suppose the author wants to change the header of the above document and write two paragraphs instead of one. ...
DragEvent.dataTransfer - Web APIs
example this example illustrates accessing the drag and drop data within the dragend event handler. function processdata(d) { // process the data ... ...
DynamicsCompressorNode.reduction - Web APIs
the reduction read-only property of the dynamicscompressornode interface is a float representing the amount of gain reduction currently applied by the compressor to the signal. intended for metering purposes, it returns a value in db, or 0 (no gain reduction) if no signal is fed into the dynamicscompressornode. the range of this value is between -20 and 0 (in db). syntax var myreduction = compressornodeinstance.reduction; value a float. example var audioctx = new audiocontext(); var compressor = audioctx.createdynamicscompressor(); var myreduction = compressor.reduction; specifications specification status comment web audio apithe definition of 'reduction' in that specification. working draft ...
EXT_disjoint_timer_query.beginQueryEXT() - Web APIs
the ext_disjoint_timer_query.beginqueryext() method of the webgl api starts a timer query. syntax void ext.beginqueryext(target, query); parameters target a glenum specifying the target of the time query. must be ext.time_elapsed_ext. query a webglquery object for which to start the time querying. return value none. examples var ext = gl.getextension('ext_disjoint_timer_query'); var query = ext.createqueryext(); ext.beginqueryext(ext.time_elapsed_ext, query); // ... specifications specification status comment ext_disjoint_timer_querythe definition of 'ext_disjoint_timer_query' in that specification. working draft initial definition. ...
EXT_disjoint_timer_query.createQueryEXT() - Web APIs
the ext_disjoint_timer_query.createqueryext() method of the webgl api creates and initializes webglquery objects, which track the time needed to fully complete a set of gl commands. syntax webgltimerqueryext ext.createqueryext(); parameters none. return value a webglquery object. examples var ext = gl.getextension('ext_disjoint_timer_query'); var query = ext.createqueryext(); specifications specification status comment ext_disjoint_timer_querythe definition of 'ext_disjoint_timer_query' in that specification. working draft initial definition. ...
EXT_disjoint_timer_query.deleteQueryEXT() - Web APIs
examples var ext = gl.getextension('ext_disjoint_timer_query'); var query = ext.createqueryext(); // ... ...
EXT_disjoint_timer_query.endQueryEXT() - Web APIs
examples var ext = gl.getextension('ext_disjoint_timer_query'); var query = ext.createqueryext(); ext.beginqueryext(ext.time_elapsed_ext, query); // ... ...
EXT_disjoint_timer_query.getQueryEXT() - Web APIs
t_disjoint_timer_query.getqueryext() method of the webgl api returns information about a query target. syntax any ext.getqueryext(target, pname); parameters target a glenum specifying the target of the time query. must be ext.timestamp_ext or ext.time_elapsed_ext. pname a glenum specifying which information to return. must be ext.current_query_ext or ext.query_counter_bits_ext. return value depends on pname: if pname is ext.current_query_ext: a webglquery object, which is the currently active query for the given target. if pname is ext.query_counter_bits_ext: a glint indicating the number of bits used to hold the query result for the given target. examples var ext = gl.getextension('ext_disjoint_timer_query'); var startquery = ext.createqueryext(); ext.querycounterext(startq...
EXT_disjoint_timer_query.getQueryObjectEXT() - Web APIs
the ext_disjoint_timer_query.getqueryobjectext() method of the webgl api returns the state of a query object. syntax any ext.getqueryobjectext(query, pname); parameters query a webglquery object from which to return information. pname a glenum specifying which information to return. must be ext.query_result_ext or ext.query_result_available_ext. return value depends on pname: if pname is ext.query_result_ext: a gluint64ext containing the query result. if pname is ext.query_result_available_ext: a glboolean indicating whether or not a query result is available. examples var ext = gl.getextension('ext_disjoint_timer_query'); var query = ext.createqueryext(); ext.beginqueryext(ext.time_elapsed_ext, query); // ... drawing ... ext.endqueryext(ext.time_elapsed_ext); // at so...
EXT_disjoint_timer_query.isQueryEXT() - Web APIs
examples var ext = gl.getextension('ext_disjoint_timer_query'); var query = ext.createqueryext(); // ... ...
EXT_disjoint_timer_query.queryCounterEXT() - Web APIs
the ext_disjoint_timer_query.querycounterext() method of the webgl api records the current time into the corresponding query object. syntax void ext.querycounterext(query, target); parameters query a webglquery object for which to record the current time. target a glenum specifying the target of the time query. must be ext.timestamp_ext. return value none. examples var ext = gl.getextension('ext_disjoint_timer_query'); var startquery = ext.createqueryext(); var endquery = ext.createqueryext(); ext.querycounterext(startquery, ext.timestamp_ext); // ... ext.querycounterext(endquery, ext.timestamp_ext); specifications specification status comment ext_disjoint_timer_querythe definition of 'ext_disjoint_timer_query' in that specification. working draft...
EXT_texture_compression_bptc - Web APIs
_ext compresses 8-bit fixed-point data. each 4x4 block of texels consists of 128 bits of rgba or image data. see also bc7 format. ext.compressed_srgb_alpha_bptc_unorm_ext compresses 8-bit fixed-point data. each 4x4 block of texels consists of 128 bits of srgb_alpha or image data. see also bc7 format. ext.compressed_rgb_bptc_signed_float_ext compresses high dynamic range signed floating point values. each 4x4 block of texels consists of 128 bits of rgb data. it only contains rgb data, so the returned alpha value is 1.0. see also bc6h format. ext.compressed_rgb_bptc_unsigned_float_ext compresses high dynamic range unsigned floating point values. each 4x4 block of texels consists of 128 bits of rgb data. it only contains rgb data, so the returned alpha value is 1.0. see also bc6h format. ...
EffectTiming.delay - Web APIs
the effecttiming dictionary's delay property in the web animations api represents the number of milliseconds to delay the start of the animation. element.animate(), keyframeeffectreadonly(), and keyframeeffect() all accept an object of timing properties including delay. the value of delay corresponds directly to effecttiming.delay in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. syntax var timingproperties = { delay: delayinmilliseconds }; timingproperties.delay = delayinmilliseconds; value a number specifying the delay, in milliseconds, from the start of the animation's play cycle to the beginning of its active interval (the time index at which actual animation begins). defaults to 0. examples in the pool of tears exampl...
Element.attachShadow() - Web APIs
sed shadow root from javascript outside it: element.shadowroot; // returns null delegatesfocus a boolean that, when set to true, specifies behavior that mitigates custom element issues around focusability. when a non-focusable part of the shadow dom is clicked, the first focusable part is given focus, and the shadow host is given any available :focus styling. return value returns a shadowroot object. exceptions exception explanation invalidstateerror the element you are trying to attach to is already a shadow host. notsupportederror you are trying to attach a shadow root to an element outside the html namespace, or the element cannot have a shadow attached to it (see above). examples the following example is taken...
Element.className - Web APIs
Web › API › Element › className
syntax var cname = elementnodereference.classname; elementnodereference.classname = cname; cname is a string variable representing the class or space-separated classes of the current element. example let el = document.getelementbyid('item'); if (el.classname === 'active'){ el.classname = 'inactive'; } else { el.classname = 'active'; } notes the name classname is used for this property instead of class because of conflicts with the "class" keyword in many languages which are used to manipulate the dom. classname can also be an instance of svganimatedstring if the element is an svgelement. ...
Element.clientHeight - Web APIs
rizontal scrollbars (if present). clientheight can be calculated as: css height + css padding - height of horizontal scrollbar (if present). when clientheight is used on the root element (the <html> element), (or on <body> if the document is in quirks mode), the viewport's height (excluding any scrollbar) is returned. this is a special case of clientheight. note: this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). syntax var intelemclientheight = element.clientheight; intelemclientheight is an integer corresponding to the clientheight of element in pixels. the clientheight property is read–only. example specification specification status comment css object model (cssom) view modulethe ...
Element.clientLeft - Web APIs
re is an overflow causing a left vertical scrollbar to be rendered. clientleft does not include the left margin or the left padding. clientleft is read-only. when layout.scrollbar.side preference is set to 1 or to 3 and when the text-direction is set to rtl, then the vertical scrollbar is positioned on the left and this impacts the way clientleft is computed. note: this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). note: when an element has display: inline, clientleft returns 0 regardless of the element's border. syntax var left = element.clientleft; example padding-top lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim ...
Element.clientWidth - Web APIs
otherwise, it's the inner width of an element in pixels. it includes padding but excludes borders, margins, and vertical scrollbars (if present). when clientwidth is used on the root element (the <html> element), (or on <body> if the document is in quirks mode), the viewport's width (excluding any scrollbar) is returned. this is a special case of clientwidth. note: this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). syntax var intelemclientwidth = element.clientwidth; intelemclientwidth is an integer corresponding to the clientwidth of element in pixels. the clientwidth property is read–only. example specification specification status comment css object model (cssom) view modulethe defin...
Element.closest() - Web APIs
Web › API › Element › closest
ethod traverses the element and its parents (heading toward the document root) until it finds a node that matches the provided selector string. will return itself or the matching ancestor. if no such element exists, it returns null. syntax var closestelement = targetelement.closest(selectors); parameters selectors is a domstring containing a selector list. ex: p:hover, .toto + q return value closestelement is the element which is the closest ancestor of the selected element. it may be null. exceptions syntaxerror is thrown if the selectors is not a valid selector list string. example html <article> <div id="div-01">here is div-01 <div id="div-02">here is div-02 <div id="div-03">here is div-03</div> </div> </div> </article> javascript var el = document.
Element.createShadowRoot() - Web APIs
use element.createshadowroot to create an instance of shadow dom. when shadow dom is created, it is always attached to an existing element. after the shadow dom is created, the element that it is attached to is called the shadow root. this method has been deprecated in favor of attachshadow(). syntax var shadowroot = element.createshadowroot(); parameters no parameters. result value returns a shadowroot. specifications this feature is no longer defined by any specifications. ...
Element.getAttributeNodeNS() - Web APIs
dename) attributenode is the node for specified attribute. namespace is a string specifying the namespace of the attribute. nodename is a string specifying the name of the attribute. == example == tbd the example needs to be fixed pre> // html: <div id="top" /> t = document.getelementbyid("top"); specialnode = t.getattributenodens( "http://www.mozilla.org/ns/specialspace", "id"); // inode.value = "full-top" </pre notes getattributenodens is more specific than getattributenode in that it allows you to specify attributes that are part of a particular namespace. the corresponding setter method is setattributenodens. dom methods dealing with element's attributes: not namespace-aware, most commonly used methods namespace-aware variants (dom level 2) dom level 1 methods for dealing with...
Element.getElementsByTagName() - Web APIs
etelementbyid('forecast-table'); const cells = table.getelementsbytagname('td'); for (let cell of cells) { let status = cell.getattribute('data-status'); if (status === 'open') { // grab the data } } specifications specification status comment domthe definition of 'element.getelementsbytagname()' in that specification. living standard changed the return value from nodelist to htmlcollection document object model (dom) level 3 core specificationthe definition of 'element.getelementsbytagname()' in that specification. obsolete no change from document object model (dom) level 2 core specification document object model (dom) level 2 core specificationthe definition of 'element.getelementsbytagname()' in that specification. obsol...
Element.hasAttributes() - Web APIs
the hasattributes() method of the element interface returns a boolean indicating whether the current 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 objec...
Element.hasPointerCapture() - Web APIs
the haspointercapture() method of the element interface sets whether the element on which it is invoked has pointer capture for the pointer identified by the given pointer id. syntax targetelement.haspointercapture(pointerid); parameters pointerid the pointerid of a pointerevent object. return value a boolean value — true if the element does have pointer capture, false if it doesn't. examples <html> <script> function downhandler(ev) { const el = document.getelementbyid("target"); // element 'target' will receive/capture further events el.setpointercapture(ev.pointerid); /* ... */ // check whether element still has pointer capture let pointercap = el.haspointercapture(ev.pointerid); if(pointercap) { // we've still got point...
Element.id - Web APIs
Web › API › Element › id
the id is often used with getelementbyid() to retrieve a particular element. another common case is to use an element's id as a selector when styling the document with css. note: identifiers are case-sensitive, but you should avoid creating ids that differ only in the capitalization. syntax var idstr = element.id; // get the id element.id = idstr; // set the id idstr is the identifier of the element. ...
Element.insertAdjacentElement() - Web APIs
tion relative to the targetelement; must match (case-insensitively) one of the following strings: 'beforebegin': before the targetelement itself. 'afterbegin': just inside the targetelement, before its first child. 'beforeend': just inside the targetelement, after its last child. 'afterend': after the targetelement itself. element the element to be inserted into the tree. return value the element that was inserted, or null, if the insertion failed. exceptions exception explanation syntaxerror the position specified is not a recognised value. typeerror the element specified is not a valid element. visualization of position names <!-- beforebegin --> <p> <!-- afterbegin --> foo <!-- beforeend --> </p> <!-- afterend --> no...
Element: keypress event - Web APIs
the keypress event is fired when a key that produces a character value is pressed down. examples of keys that produce a character value are alphabetic, numeric, and punctuation keys. examples of keys that don't produce a character value are modifier keys such as alt, shift, ctrl, or meta. since this event has been deprecated, you should look to use beforeinput or keydown instead. interface keyboardevent bubbles yes cancelable yes default action varies: keypress event; launch text composition system; blur and focus events; domactivate event; other event examples addeventlistener keypress example this example logs the keyboardevent.code value whenever you press a key after focussing the <input> element. <div> <label for="sampl...
Element: keyup event - Web APIs
. an uppercase "a" is reported as 65 by all events. since firefox 65, the keyup and keydown events are now fired during ime composition, to improve cross-browser compatibility for cjkt users (bug 354358, also see keydown and keyup events are now fired during ime composition for more useful details). to ignore all keyup events that are part of composition, do something like this (229 is a special value set for a keycode relating to an event that has been processed by an ime): eventtarget.addeventlistener("keyup", event => { if (event.iscomposing || event.keycode === 229) { return; } // do something }); examples addeventlistener keyup example this example logs the keyboardevent.code value whenever you release a key inside the <input> element. <input placeholder="click here, then ...
Element: mousedown event - Web APIs
reference to the canvas and the 2d context we will use to draw. drawing begins when the mousedown event fires. first we store the x and y coordinates of the mouse pointer in the variables x and y, and then set isdrawing to true. as the mouse moves over the page, the mousemove event fires. if isdrawing is true, the event handler calls the drawline function to draw a line from the stored x and y values to the current location. when the drawline() function returns, we adjust the coordinates and then save them in x and y. the mouseup event draws the final line segment, sets x and y to 0, and stops further drawing by setting isdrawing to false. html <h1>drawing with mouse events</h1> <canvas id="mypics" width="560" height="360"></canvas> css canvas { border: 1px solid black; width: 560...
Element: mousemove event - Web APIs
reference to the canvas and the 2d context we will use to draw. drawing begins when the mousedown event fires. first we store the x and y coordinates of the mouse pointer in the variables x and y, and then set isdrawing to true. as the mouse moves over the page, the mousemove event fires. if isdrawing is true, the event handler calls the drawline function to draw a line from the stored x and y values to the current location. when the drawline() function returns, we adjust the coordinates and then save them in x and y. the mouseup event draws the final line segment, sets x and y to 0, and stops further drawing by setting isdrawing to false. html <h1>drawing with mouse events</h1> <canvas id="mypics" width="560" height="360"></canvas> css canvas { border: 1px solid black; width: 560...
Element: mouseup event - Web APIs
reference to the canvas and the 2d context we will use to draw. drawing begins when the mousedown event fires. first we store the x and y coordinates of the mouse pointer in the variables x and y, and then set isdrawing to true. as the mouse moves over the page, the mousemove event fires. if isdrawing is true, the event handler calls the drawline function to draw a line from the stored x and y values to the current location. when the drawline() function returns, we adjust the coordinates and then save them in x and y. the mouseup event draws the final line segment, sets x and y to 0, and stops further drawing by setting isdrawing to false. html <h1>drawing with mouse events</h1> <canvas id="mypics" width="560" height="360"></canvas> css canvas { border: 1px solid black; width: 560...
Element: msContentZoom event - Web APIs
ft edge and internet explorer. zoomed elements can expose their zoom level through mscontentzoom (ie. scrolltop/left). the zoom level can be reset with element.mszoomto(). bubbles unknown cancelable unknown interface unknown event handler property unknown example contentzoom.addeventlistener("mscontentzoom", function(e) { zoomfactor.value = contentzoom.mscontentzoomfactor.tofixed(2); }); specifications not part of any specification. ...
Element.namespaceURI - Web APIs
, an element is being examined for its localname and its namespaceuri. if the namespaceuri returns the xul namespace and the localname returns "browser", then the node is understood to be a xul <browser/>. if (element.localname == "browser" && element.namespaceuri == "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul") { // this is a xul browser } notes this is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. the namespace uri of a node is frozen at the node creation time. in firefox 3.5 and earlier, the namespace uri for html elements in html documents is null. in later versions, in compliance with html5, it is http://www.w3.org/1999/xhtml as in xhtml. you can create an element with the specifi...
Element.onfullscreenerror - Web APIs
example this example attempts to switch into full-screen mode from outside a handler for a user-initiated event (such as a click or keypress event). ...
Element.openOrClosedShadowRoot - Web APIs
note: this api is available only to webextensions. the element.openorcloseshadowroot read-only property represents the shadow root hosted by the element, regardless if its mode is open or closed. use element.attachshadow() to add a shadow root to an existing element. syntax var shadowroot = element.shadowroot; value a shadowroot object instance, regardless if its mode is set to open or closed, or null if no shadow root is present. (see element.attachshadow() for further details). specifications this property is not part of any specification. ...
Element.releasePointerCapture() - Web APIs
ntercapture() method of the element interface releases (stops) pointer capture that was previously set for a specific (pointerevent) pointer. see the element.setpointercapture() method for a description of pointer capture and how to set it for a particular element. syntax targetelement.releasepointercapture(pointerid); parameters pointerid the pointerid of a pointerevent object. return value this method returns undefined. exceptions exception explanation invalidpointerid pointerid does not match any of the active pointers. example this example sets pointer capture on a <div> when you press down on it. this lets you slide the element horizontally, even when you pointer moves outside of its boundaries. html <div id="slider">slide me</div> css ...
Element.removeAttribute() - Web APIs
the element method removeattribute() removes the attribute with the specified name from the element. syntax element.removeattribute(attrname); parameters attrname a domstring specifying the name of the attribute to remove from the element. if the specified attribute does not exist, removeattribute() returns without generating an error. return value undefined. usage notes you should use removeattribute() instead of setting the attribute value to null either directly or using setattribute(). many attributes will not behave as expected if you set them to null. dom methods dealing with element's attributes: not namespace-aware, most commonly used methods namespace-aware variants (dom level 2) dom level 1 methods for dealing with attr nodes directly (seldom used) dom level 2 namesp...
Element.removeAttributeNode() - Web APIs
lement.removeattributenode(attributenode) attributenode is the attr node that needs to be removed. removedattr is the removed attr node. example // given: <div id="top" align="center" /> var d = document.getelementbyid("top"); var d_align = d.getattributenode("align"); d.removeattributenode(d_align); // align is now removed: <div id="top" /> notes if the removed attribute has a default value, it is immediately replaced. the replacing attribute has the same namespace uri and local name, as well as the original prefix, when applicable. there is no removeattributenodens method; the removeattributenode method can remove both namespaced attributes and non-namespaced attributes. dom methods dealing with element's attributes: not namespace-aware, most commonly used methods namespace-aw...
Element.scrollIntoViewIfNeeded() - Web APIs
thod scrolls the current element into the visible area of the browser window if it's not already within the visible area of the browser window. if the element is already within the visible area of the browser window, then no scrolling takes place. this method is a proprietary variation of the standard element.scrollintoview() method. syntax todo parameters opt_center is an optional boolean value with a default value of true: if true, the element will be aligned so it is centered within the visible area of the scrollable ancestor. if false, the element will be aligned to the nearest edge of the visible area of the scrollable ancestor. depending on which edge of the visible area is closest to the element, either the top of the element will be aligned to the top edge of the visible ar...
Element.scrollWidth - Web APIs
the element.scrollwidth read-only property is a measurement of the width of an element's content, including content not visible on the screen due to overflow. the scrollwidth value is equal to the minimum width the element would require in order to fit all the content in the viewport without using a horizontal scrollbar. the width is measured in the same way as clientwidth: it includes the element's padding, but not its border, margin or vertical scrollbar (if present). it can also include the width of pseudo-elements such as ::before or ::after. if the element's content can fit without a need for horizontal scrollbar, its scrollwidth is equal to clientwidth this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). syntax var x...
Element.setAttributeNS() - Web APIs
setattributens adds a new attribute or changes the value of an attribute with the given namespace and name. syntax element.setattributens(namespace, name, value) namespace is a string specifying the namespace of the attribute. name is a string identifying the attribute by its qualified name; that is, a namespace prefix followed by a colon followed by a local name. value is the desired string value of the new attribute. example let d = document.getelementbyid('d1'); d.setattributens('http://www.mozilla.org/ns/specialspace', 'spec:align', 'center'); notes dom methods dealing with element's attributes: not namespace-aware, most commonly used methods namespace-aware variants (dom level 2) dom level 1 methods for dealing with attr nodes directly (seldom used) dom level 2 namespace-...
Element.setAttributeNode() - Web APIs
if any, returned by this function. example this example copies the align attribute from one element to another. html <div id="one" align="left">one</div> <div id="two">two</div> javascript let d1 = document.getelementbyid('one'); let d2 = document.getelementbyid('two'); let a = d1.getattributenode('align'); d2.setattributenode(a.clonenode(true)); // returns: 'left' alert(d2.attributes[1].value); notes if the attribute named already exists on the element, that attribute is replaced with the new one and the replaced one is returned. this method is seldom used, with element.setattribute() usually being used to change element's attributes. dom methods dealing with element's attributes: not namespace-aware, most commonly used methods namespace-aware variants (dom level 2) dom level ...
Element.setAttributeNodeNS() - Web APIs
note that if you try to set without cloning the node, mozilla gives an ns_error_dom_inuse_attribute_err "attribute already in use" error, as the dom requires cloning for attr to be reused (unlike other nodes which can be mo...
Element.setPointerCapture() - Web APIs
geted to a particular element instead of the normal (or hit test) target at a pointer's location. this can be used to ensure that an element continues to receive pointer events even if the pointer device's contact moves off the element (such as by scrolling or panning). syntax targetelement.setpointercapture(pointerid); parameters pointerid the pointerid of a pointerevent object. return value this method returns undefined. exceptions exception explanation invalidpointerid pointerid does not match any of the active pointers. example this example sets pointer capture on a <div> when you press down on it. this lets you slide the element horizontally, even when you pointer moves outside of its boundaries. html <div id="slider">slide me</div> css ...
Element.slot - Web APIs
Web › API › Element › slot
the slot property of the element interface returns the name of the shadow dom slot the element is inserted in. a slot is a placeholder inside a web component that users can fill with their own markup (see using templates and slots for more information). syntax var astring = element.slot element.slot = astring value a domstring. examples in our simple-template example (see it live), we create a trivial custom element example called <my-paragraph> in which a shadow root is attached and then populated using the contents of a template that contains a slot named my-text. when <my-paragraph> is used in the document, the slot is populated by a slotable element by including it inside the element with a slot attribute with the value my-text. here is one such example: <my-paragraph> <span sl...
Element: wheel event - Web APIs
event replaces the non-standard deprecated mousewheel event. bubbles yes cancelable yes interface wheelevent event handler property onwheel note: don't confuse the wheel event with the scroll event. the default action of a wheel event is implementation-specific, and doesn't necessarily dispatch a scroll event. even when it does, the delta* values in the wheel event don't necessarily reflect the content's scrolling direction. therefore, do not rely on the wheel event's delta* properties to get the scrolling direction. instead, detect value changes of scrollleft and scrolltop of the target in the scroll event. examples scaling an element via the wheel this example shows how to scale an element using the mouse (or other pointing device)...
ElementCSSInlineStyle - Web APIs
re features in addition to the ones listed below. note: elementcssinlinestyle is a mixin and not an interface; you can't actually create an object of type elementcssinlinestyle. propertiesstylethe style property is used to get as well as set the inline style of an element. when getting, it returns a cssstyledeclaration object that contains a list of all styles properties for that element with values assigned for the attributes that are defined in the element's inline style attribute.methodsthis interface has no methods. specifications specification status comment css object model (cssom)the definition of 'htmlorforeignelement' in that specification. working draft initial definition. ...
Comparison of Event Targets - Web APIs
consider: property defined in purpose event.target dom event interface the dom element on the lefthand side of the call that triggered this event, eg: element.dispatchevent(event) event.currenttarget dom event interface the eventtarget whose eventlisteners are currently being processed. as the event capturing and bubbling occurs, this value changes. event.relatedtarget dom mouseevent interface identifies a secondary target for the event. event.explicitoriginaltarget event.webidl if the event was retargeted for some reason other than an anonymous boundary crossing, this will be set to the target before the retargeting occurs. for example, mouse events are retargeted to their parent node when they happe...
Event() - Web APIs
Web › API › Event › Event
eventinit optional this is an eventinit dictionary, having the following optional fields: bubbles optional a boolean indicating whether the event bubbles. the default is false. cancelable optional a boolean indicating whether the event can be cancelled. the default is false. composed optional a boolean indicating whether the event will trigger listeners outside of a shadow root (see event.composed for more details). the default is false. ...
Event.bubbles - Web APIs
Web › API › Event › bubbles
example function handleinput(e) { // checks whether the event bubbles and ... if (!e.bubbles) { // ... passes the event along if does not passiton(e); } // already bubbling dooutput(e); } note: only certain events can bubble. ...
Event.cancelBubble - Web APIs
the cancelbubble property of the event interface is a historical alias to event.stoppropagation(). setting its value to true before returning from an event handler prevents propagation of the event. in later implementations, setting this to false does nothing. see browser compatibility for details. syntax event.cancelbubble = bool; var bool = event.cancelbubble; value a boolean. example elem.onclick = function(event) { // do cool things here event.cancelbubble = true; } specifications specification status comment domthe definition of 'cancelbubble' in that specification. living standard ...
Event.cancelable - Web APIs
Web › API › Event › cancelable
ts that can be canceled are the ones that result from the user interacting with the page. canceling the click, scroll, or beforeunload events would prevent the user from clicking on something, scrolling the page, or navigating away from the page, respectively. custom events created by other javascript code control if they can be canceled when they are created. syntax bool = event.cancelable; value the result is a boolean, which is true if the event can be canceled. example for example, browser vendors are proposing that the wheel event can only be canceled the first time the listener is called — any following wheel events cannot be canceled. function preventscrollwheel(event) { if (typeof event.cancelable !== 'boolean' || event.cancelable) { // the event can be canceled, so we ...
Event.defaultPrevented - Web APIs
the defaultprevented read-only property of the event interface returns a boolean indicating whether or not the call to event.preventdefault() canceled the event. note: you should use this instead of the non-standard, deprecated getpreventdefault() method (see bug 691151). syntax var defaultwasprevented = event.defaultprevented; value a boolean, where true indicates that the default user agent action was prevented, and false indicates that it was not. example this example logs attempts to visit links from two <a> elements. javascript is used to prevent the second link from working. html <p><a id="link1" href="#link1">visit link 1</a></p> <p><a id="link2" href="#link2">try to visit link 2</a> (you can't)</p> <p id="log"></p> javascript function stoplink(event) { event.preventdefault...
Event.eventPhase - Web APIs
Web › API › Event › eventPhase
the eventphase read-only property of the event interface indicates which phase of the event flow is currently being evaluated. syntax let phase = event.eventphase; value returns an integer value which specifies the current evaluation phase of the event flow. possible values are listed in event phase constants. constants event phase constants these values describe which phase the event flow is currently being evaluated. constant value description event.none 0 no event is being processed at this time. event.capturing_phase 1 the event is being propagated through the target's ancestor objects. this process starts with the window, then document, then the htmlhtmlelement, and so on through the elements until the target's parent is reached. e...
Event.isTrusted - Web APIs
Web › API › Event › isTrusted
the istrusted read-only property of the event interface is a boolean that is true when the event was generated by a user action, and false when the event was created or modified by a script or dispatched via eventtarget.dispatchevent(). syntax var eventistrusted = event.istrusted; value boolean example if (e.istrusted) { /* the event is trusted */ } else { /* the event is not trusted */ } specification specification status comment domthe definition of 'event.istrusted' in that specification. living standard document object model (dom) level 3 events specificationthe definition of 'trusted events' in that specification. obsolete adds requirements regarding trusted and untrusted events, though it does not itself define the istrusted pr...
Event.msConvertURL() - Web APIs
clipboarddata.files collection, allowing otherwise inaccessible files to be converted to blob or data uris. this proprietary method is specific to internet explorer and the microsoft edge browser. syntax var retval = dragevent.msconverturl(file, targettype, targeturl); parameters file [in] type: file the file object to be converted. targettype [in] type: domstring one of the following values indicating the desired conversion type: "specified", "base64", or "unchanged". targeturl [in, optional] type: url the target url. return value this method does not return a value. example var bloblist = []; document.getelementbyid("pastezone").addeventlistener('paste', handlepaste, false); function handlepaste(evt) { var filelist = window.clipboarddata.files; // note tha...
Event.stopPropagation() - Web APIs
the stoppropagation() method of the event interface prevents further propagation of the current event in the capturing and bubbling phases. it does not, however, prevent any default behaviors from occurring; for instance, clicks on links are still processed. if you want to stop those behaviors, see the preventdefault() method. syntax event.stoppropagation(); parameters none. return value undefined. examples see example 5: event propagation in the examples chapter for a more detailed example of this method and event propagation in the dom. specifications specification status comment domthe definition of 'event.stoppropagation()' in that specification. living standard dom4the definition of 'event.stoppropagation()' in that specification. obsol...
Event.target - Web APIs
Web › API › Event › target
the target property of the event interface is a reference to the object onto which the event was dispatched. it is different from event.currenttarget when the event handler is called during the bubbling or capturing phase of the event. syntax const thetarget = someevent.target; value eventtarget example the event.target property can be used in order to implement event delegation. // make a list const ul = document.createelement('ul'); document.body.appendchild(ul); const li1 = document.createelement('li'); const li2 = document.createelement('li'); ul.appendchild(li1); ul.appendchild(li2); function hide(evt) { // e.target refers to the clicked <li> element // this is different than e.currenttarget, which would refer to the parent <ul> in this context evt.target.style.visibility =...
Event.type - Web APIs
Web › API › Event › type
the type read-only property of the event interface returns a string containing the event's type. it is set when the event is constructed and is the name commonly used to refer to the specific event, such as click, load, or error. for a list of available event types, see the event reference. syntax let eventtype = event.type; value a domstring containing the type of event. example this example logs the event type whenever you press a keyboard key or click a mouse button. html <p>press any key or click the mouse to get the event type.</p> <p id="log"></p> javascript function geteventtype(event) { const log = document.getelementbyid('log'); log.innertext = event.type + '\n' + log.innertext; } // keyboard events document.addeventlistener('keydown', geteventtype, false); // first ...
EventListener.handleEvent() - Web APIs
the eventlistener method handleevent() method is called by the user agent when an event is sent to the eventlistener, in order to handle events that occur on an observed eventtarget. syntax eventlistener.handleevent(event); parameters event an event object describing the event that has been fired and needs to be processed. return value undefined. if you return a value, the browser will ignore it. specifications specification status comment domthe definition of 'eventlistener.handleevent()' in that specification. living standard no change. document object model (dom) level 2 events specificationthe definition of 'eventlistener.handleevent()' in that specification. obsolete initial definition. ...
EventSource.close() - Web APIs
Web › API › EventSource › close
the close() method of the eventsource interface closes the connection, if one is made, and sets the eventsource.readystate attribute to 2 (closed). note: if the connection is already closed, the method does nothing. syntax eventsource.close(); parameters none. return value void. examples var button = document.queryselector('button'); var evtsource = new eventsource('sse.php'); button.onclick = function() { console.log('connection closed'); evtsource.close(); } note: you can find a full example on github — see simple sse demo using php. specifications specification status comment html living standardthe definition of 'close()' in that specification. living standard initial definition ...
EventSource.readyState - Web APIs
the readystate read-only property of the eventsource interface returns a number representing the state of the connection. syntax var myreadystate = eventsource.readystate; value a number representing the state of the connection. possible values are: 0 — connecting 1 — open 2 — closed examples var evtsource = new eventsource('sse.php'); console.log(evtsource.readystate); note: you can find a full example on github — see simple sse demo using php. specifications specification status comment html living standardthe definition of 'readystate' in that specification. living standard initial definition ...
EventSource.url - Web APIs
Web › API › EventSource › url
examples var evtsource = new eventsource('sse.php'); console.log(evtsource.url); note: you can find a full example on github — see simple sse demo using php. ...
EventSource.withCredentials - Web APIs
the withcredentials read-only property of the eventsource interface returns a boolean indicating whether the eventsource object was instantiated with cors credentials set. syntax var mywithcredentials = eventsource.withcredentials; value a boolean indicating whether the eventsource object was instantiated with cors credentials set (true), or not (false, the default). examples var evtsource = new eventsource('sse.php'); console.log(evtsource.withcredentials); note: you can find a full example on github — see simple sse demo using php. specifications specification status comment html living standardthe definition of 'withcredentials' in that specification. living standard initial definition ...
EventTarget.dispatchEvent() - Web APIs
tlisteners in the appropriate order. the normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchevent(). syntax cancelled = !target.dispatchevent(event) parameter event is the event object to be dispatched. target is used to initialize the event.target and determine which event listeners to invoke. return value the return value is false if event is cancelable and at least one of the event handlers which received event called event.preventdefault(). otherwise it returns true. the dispatchevent() method throws unspecified_event_type_err if the event's type was not specified by initializing the event before the method was called, or if the event's type is null or an empty string. exceptions exceptio...
EventTarget - Web APIs
turn !event.defaultprevented; }; specifications specification status comment domthe definition of 'eventtarget' in that specification. living standard no change. document object model (dom) level 3 events specificationthe definition of 'eventtarget' in that specification. obsolete a few parameters are now optional (listener), or accepts the null value (usecapture). document object model (dom) level 2 events specificationthe definition of 'eventtarget' in that specification. obsolete initial definition. ...
ExtendableEvent.waitUntil() - Web APIs
o other events can rely on a completely upgraded state. the waituntil() method must be initially called within the event callback, but after that it can be called multiple times, until all the promises passed to it settle. note: the behaviour described in the above paragraph was fixed in firefox 43 (see bug 1180274). syntax extendableevent.waituntil(promise); parameters a promise. return value undefined. example using waituntil() within a service worker's install event: addeventlistener('install', event => { const precache = async () => { const cache = await caches.open('static-v1'); return cache.addall([ '/', '/about/', '/static/styles.css' ]); }; event.waituntil(precache()); }); specifications specification status comment ...
ExtendableMessageEvent.data - Web APIs
examples when the following code is used inside a service worker to respond to a push messages by sending the data received via pushmessagedata to the main context via a channel message, the event object of onmessage will be a extendablemessageevent. ...
ExtendableMessageEvent.lastEventId - Web APIs
examples when the following code is used inside a service worker to respond to a push messages by sending the data received via pushmessagedata to the main context via a channel message, the event object of onmessage will be a extendablemessageevent. ...
ExtendableMessageEvent.origin - Web APIs
examples when the following code is used inside a service worker to respond to a push messages by sending the data received via pushmessagedata to the main context via a channel message, the event object of onmessage will be a extendablemessageevent. ...
ExtendableMessageEvent.ports - Web APIs
the ports read-only property of the extendablemessageevent interface returns the array containing the messageport objects representing the ports of the associated message channel (the channel the message is being sent through.) syntax var myports = extendablemessageevent.ports; value an array of messageport objects. examples when the following code is used inside a service worker to respond to a push messages by sending the data received via pushmessagedata to the main context via a channel message, the event object of onmessage will be a extendablemessageevent. var port; self.addeventlistener('push', function(e) { var obj = e.data.json(); if(obj.action === 'subscribe' || obj.action === 'unsubscribe') { port.postmessage(obj); } else if(obj.action === 'init' || obj.action ===...
ExtendableMessageEvent.source - Web APIs
examples when the following code is used inside a service worker to respond to a push messages by sending the data received via pushmessagedata to the main context via a channel message, the event object of onmessage will be a extendablemessageevent. ...
FeaturePolicy.allowedFeatures() - Web APIs
the allowedfeatures() method of the featurepolicy interface returns a list of directive names of all features allowed by the feature policy.enables introspection of individual directives of the feature policy it is run on. as such, allowedfeatures() method returns a subset of directives returned by features(). syntax const allowed = featurepolicy.allowedfeatures() parameters none. return value an array of strings representing the feature policy directive names that are allowed by the feature policy this method is called on. example the followin example logs all the allowed directives for the current document. please note that these features might be restricted by the permissions api, if the user did not grant the corrsponding permission yet. // first, get the feature policy object ...
FeaturePolicy.allowsFeature() - Web APIs
d in the specified context (or the default context if no context is specified). syntax const allowed = featurepolicy.allowsfeature(<feature>) or const allowed = featurepolicy.allowsfeature(<feature>, <origin>) parameters feature name a specific feature name must be specified. origin name optional an origin url to check the feature on. if it is omitted the default origin is used. return value a boolean that is true if and only if the feature is allowed. example the following example queries whether or not the document is allowed to use camera api by the feature policy. please note that camera api might be restricted by the permissions api, if the user did not grant the corresponding permission yet. // first, get the feature policy object const featurepolicy = document.featurepolic...
FeaturePolicy.features() - Web APIs
the features() method of the featurepolicy interface returns a list of names of all features supported by the user agent. feature whose name appears on the list might not be allowed by the feature policy of the current execution context and/or might not be accessible because of user's permissions. syntax const supportedfeatures = featurepolicy.features() parameters none. return value a list of strings that represent names of all feature policy directives supported by the user agent. example the followin example logs all the supported directives in the console. // get the feature policy object const featurepolicy = document.featurepolicy // retreive the list of all supported feature policy directives const supporteddirectives = featurepolicy.features() // print out each di...
FeaturePolicy.getAllowlistForFeature() - Web APIs
errors the function will raise a warning if the specified feature policy directive name is not known. ...
FederatedCredential.protocol - Web APIs
openidconnect). ...
FederatedCredential.provider - Web APIs
example // tbd specifications specification status comments credential management level 1 working draft initial definition. browser compatibility the compatibility table in this page is generated from structured data. ...
FetchEvent.preloadResponse - Web APIs
example this code snippet is from the navigation preload page. the serviceworkerglobalscope.onfetch event handler listens for the fetch event. ...
FetchEvent.client - Web APIs
Web › API › FetchEvent › client
the fetchevent.client read-only property returns the client that the current service worker is controlling. note: this feature has been deprecated, with its functionality replaced by fetchevent.clientid and clients.get(). see this github issue for discussion/background. syntax var myclient = fetchevent.client; value a client object. example self.addeventlistener('fetch', function(event) { console.log(event.client); ​}); ...
FetchEvent.clientId - Web APIs
the clientid read-only property of the fetchevent interface returns the id of the client that the current service worker is controlling. the clients.get() method could then be passed this id to retrieve the associated client. syntax var myclientid = fetchevent.clientid; value a domstring that represents the client id. example self.addeventlistener('fetch', function(event) { console.log(event.clientid); ​}); specifications specification status comment service workersthe definition of 'clientid' in that specification. working draft initial definition. ...
FetchEvent.isReload - Web APIs
the isreload read-only property of the fetchevent interface returns true if the event was dispatched by the user attempting to reload the page, and false otherwise. pressing the refresh button is a reload while clicking a link and pressing the back button is not. syntax var reloaded = fetchevent.isreload value a boolean. example self.addeventlistener('fetch', function(event) { event.respondwith( if (event.isreload) { //return something } else { //return something else }; ); ​}); ...
FetchEvent.navigationPreload - Web APIs
example the following example shows the implementation of a fetch event that uses a preloaded response. ...
FetchEvent.replacesClientId - Web APIs
n empty string when navigating from about:blank to another page, as about:blank's client will be reused, rather than be replaced. additionally, if the fetch isn't a navigation, replacesclientid will be an empty string. this could be used to access/communicate with a client that will imminently be replaced, right before a navigation. syntax var myreplacedclientid = fetchevent.replacesclientid; value a domstring. example self.addeventlistener('fetch', function(event) { console.log(event.replacesclientid); }); specifications specification status comment service workersthe definition of 'replacesclientid' in that specification. working draft initial definition. ...
FetchEvent.request - Web APIs
the request read-only property of the fetchevent interface returns the request that triggered the event handler. this property is non-nullable (since version 46, in the case of firefox.) if a request is not provided by some other means, the constructor init object must contain a request (see fetchevent.fetchevent().) syntax var recentrequest = fetchevent.request; value a request object. example this code snippet is from the service worker fetch sample (run the fetch sample live). the serviceworkerglobalscope.onfetch event handler listens for the fetch event. when fired, pass a promise that back to the controlled page to fetchevent.respondwith(). this promise resolves to the first matching url request in the cache object. if no match is found, the code fetches a response from the network...
FetchEvent.resultingClientId - Web APIs
e is the id of the client that replaces the previous client during a page navigation. for example, when navigating from page a to page b resultingclientid is the id of the client associated with page b. if the fetch request is a subresource request or the request's destination is report, resultingclientid will be an empty string. syntax var myresultingclientid = fetchevent.resultingclientid; value a domstring. example self.addeventlistener('fetch', function(event) { console.log(event.resultingclientid); }); specifications specification status comment service workersthe definition of 'resultingclientid' in that specification. working draft initial definition. ...
File.File() - Web APIs
Web › API › File › File
mix of any of such objects, that will be put inside the file. usvstring objects are encoded as utf-8. name a usvstring representing the file name or the path to the file. options optional an options object containing optional attributes for the file. available options are as follows: type: a domstring representing the mime type of the content that will be put into the file. defaults to a value of "". lastmodified: a number representing the number of milliseconds between the unix time epoch and when the file was last modified. defaults to a value of date.now(). example var file = new file(["foo"], "foo.txt", { type: "text/plain", }); specifications specification status comment file api working draft initial definition ...
File.fileName - Web APIs
Web › API › File › fileName
...
File.fileSize - Web APIs
Web › API › File › fileSize
returns the size of a file in bytes. this property is deprecated. use blob.size instead. syntax var size = instanceoffile.filesize; value a number. specification not part of any specification. ...
File.name - Web APIs
Web › API › File › name
returns the name of the 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.size - Web APIs
Web › API › File › size
summary returns the size of a file in bytes. syntax var size = instanceoffile.size value a number specification not part of any specification. ...
File.webkitRelativePath - Web APIs
example in this example, a directory picker is presented which lets the user choose one or more directories. ...
FileError - Web APIs
Web › API › FileError
ou're just testing your app, and you don't want to set up a web server, you can bypass the security restriction on chrome. just start chrome with the --allow-file-access-from-files flag. use the flag only for testing purposes. attribute attribute type description code unsigned short the most appropriate error code for the condition. see error codes for possible values. error codes note: do not rely on the numeric values of the constants, which might change as the specifications continue to change. use the constant names instead. constant value description encoding_err 5 the url is malformed. make sure that the url is complete and valid. invalid_modification_err 9 the modification requested is not allowed. ...
FileException - Web APIs
{ //error is thrown if "log.txt" already exists. var fileentry = fs.root.getfile('log.txt', {create: true, exclusive:true}0; } catch (e) { onerrror(e); } the sample code was borrowed from html5rocks attribute attribute type description code unsigned short the most appropriate error code for the condition. constants note: do not rely on the numeric values of the constants, which might change as the specifications continue to change. use the constant names instead. constant value description encoding_err 5 the url is malformed. make sure that the url is complete and valid. invalid_modification_err 9 the modification requested is not allowed. examples of invalid modifications include moving a directory ...
FileList - Web APIs
Web › API › FileList
st. 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 files selected by the user using a...
FileReader.error - Web APIs
Web › API › FileReader › error
in chrome 48+/firefox 58+ this property returns a domexception because domerror has been removed from the dom standard. ...
FileReaderSync.readAsArrayBuffer() - Web APIs
the readasarraybuffer() method of the filereadersync interface allows to read file or blob objects in a synchronous way into an arraybuffer. this interface is only available in workers as it enables synchronous i/o that could potentially block. syntax arraybuffer readasarraybuffer( in blob blob ); parameters blob the dom file or blob to read into the file or arraybuffer. return value an arraybuffer representing the file's data. exceptions the following exceptions can be raised by this method: notfounderror is raised when the resource represented by the dom file or blob cannot be found, e.g. because it has been erased. securityerror is raised when one of the following problematic situation is detected: the resource has been modified by a third party; too many read are...
FileReaderSync.readAsBinaryString() - Web APIs
n favor of readasarraybuffer(). the readasbinarystring() method of the filereadersync interface allows to read file or blob objects in a synchronous way into an domstring. this interface is only available in workers as it enables synchronous i/o that could potentially block. syntax readasbinarystring(file); readasbinarystring(blob); parameters blob the dom file or blob to read. return value an domstring representing the input data. exceptions the following exceptions can be raised by this method: notfounderror is raised when the resource represented by the dom file or blob cannot be found, e.g. because it has been erased. securityerror is raised when one of the following problematic situation is detected: the resource has been modified by a third party; too many read ...
FileReaderSync.readAsDataURL() - Web APIs
the readasdataurl() method of the filereadersync interface allows to read file or blob objects in a synchronous way into an domstring representing a data url. this interface is only available in workers as it enables synchronous i/o that could potentially block. syntax readasdataurl(file); readasdataurl(blob); parameters blob the dom file or blob to read. return value an domstring representing the input data as a data url. exceptions the following exceptions can be raised by this method: notfounderror is raised when the resource represented by the dom file or blob cannot be found, e.g. because it has been erased. securityerror is raised when one of the following problematic situation is detected: the resource has been modified by a third party; too many read are perfor...
FileReaderSync.readAsText() - Web APIs
lable in workers as it enables synchronous i/o that could potentially block. syntax readastext(file); readastext(blob); readastext(file, encoding); readastext(blob, encoding); parameters blob the dom file or blob to read. encoding the optional parameter specifies encoding to be used (e.g., iso-8859-1 or utf-8). if not present, the method will apply a detection algorithm for it. return value an domstring representing the input data. exceptions the following exceptions can be raised by this method: notfounderror is raised when the resource represented by the dom file or blob cannot be found, e.g. because it has been erased. securityerror is raised when one of the following problematic situation is detected: the resource has been modified by a third party; too many read ...
FileRequest.lockedFile - Web APIs
ard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. summary the lockedfile property represents the lockedfile object from which the request was started. syntax var lockedfile = instanceoffilerequest.lockedfile value a lockedfile object. specifications specification status comment filesystem api editor's draft draft proposal. ...
FileRequest.onprogress - Web APIs
eter. those objects contain two properties: loaded a number representing the current amount of bytes processed by the operation. total a number representing the total amount of bytes that will be processed by the operation. example // assuming 'request' which is a filerequest object request.onprogress = function (status) { var progress = document.queryselector('progress'); progress.value = status.loaded; progress.max = status.total; } specification not part of any current specification. ...
FileSystem.name - Web APIs
Web › API › FileSystem › name
example // tbd specifications specification status comment file and directory entries apithe definition of 'name' in that specification. draft initial specification. ...
FileSystem.root - Web APIs
Web › API › FileSystem › root
example // tbd specifications specification status comment file and directory entries apithe definition of 'root' in that specification. draft initial specification. ...
FileSystemDirectoryEntry.createReader() - Web APIs
example this example creates a method called readdirectory(), which fetches all of the entries in the specified filesystemdirectoryentry and returns them in an array. ...
FileSystemDirectoryEntry.removeRecursively() - Web APIs
ystemdirectoryentry.removerecursively(successcallback[, errorcallback]); parameters successcallback a function to call once the directory removal process has completed. the callback has no parameters. errorcallback optional a function to be called if an error occurs while attempting to remove the directory subtree. receives a fileerror describing the error which occurred as input. return value undefined. errors if an error occurs and an errorcallback was specified, it gets called with a single parameter: a fileerror object describing the error. the fileerror.code specifies what type of error occurred, as follows: fileerror.invalid_modification_err an attempt was made to remove the root directory; this is not permitted. fileerror.no_modification_allowed_err the file system's st...
FileSystemDirectoryReader.readEntries() - Web APIs
or filesystemdirectoryentry objects, which represent directories. if there are no files left, or you've already called readentries() on this filesystemdirectoryreader, the array is empty. errorcallback optional a callback function which is called if an error occurs while reading from the directory. it receives one input parameter: a fileerror object describing the error which occurred. return value undefined. example in this example, a drop zone is created, which responds to the drop event by scanning through the dropped files and directories, outputting a hierarchical directory listing. html content the html establishes the drop zone itself, which is a <div> element with the id "dropzone", and an unordered list element with the id "listing". <p>drag files and/or directories to the bo...
FileSystemEntry.copyTo() - Web APIs
me. successcallback optional a function which is called when the copy operation is succesfully completed. receives a single input parameter: a filesystementry based object providing the copied item's new details. errorcallback optional an optional callback which is executed if an error occurs while copying the items. there's a single parameter: a fileerror describing what went wrong. return value undefined. errors fileerror.invalid_modification_err the requested operation involves an impossible change, such as moving a directory inside itself or one of its own child directories, or copying an item within the same directory without renaming it. fileerror.quota_exceeded_err the operation exceeded the user's storage quota, or there isn't enough storage space left to complete the oper...
FileSystemEntry.filesystem - Web APIs
example this example obtains a filesystemdirectoryentry for the root directory of the file system containing a file. ...
FileSystemEntry.fullPath - Web APIs
the read-only fullpath property of the filesystementry interface returns a usvstring specifying the full, absolute path from the file system's root to the file represented by the entry. this can also be thought of as a path which is relative to the root directory, with a "/" prepended to it to make it absolute. syntax var fullpath = filesystementry.fullpath; value a usvstring indicating the entry's full path. example this example shows a function which is called with a file system; it then gets a filesystemfileentry for a file named data.json and returns its full path. function gotfilesystem(fs) { let path = ""; fs.root.getfile("data.json", { create: true, exclusive: true }, function(entry) { path = fullpath; }, handleerror(error)); return path; } obviously, this is s...
FileSystemEntry.getMetadata() - Web APIs
orcallback]); parameters successcallback a function which is called when the copy operation is succesfully completed. receives a single input parameter: a metadata object with information about the file. errorcallback optional an optional callback which is executed if an error occurs while looking up the metadata. there's a single parameter: a fileerror describing what went wrong. return value undefined. errors fileerror.not_found_err the filesystementry refers to an item which doesn't exist. fileerror.security_err security restrictions prohibit obtaining the requested metadata. example this example checks the size of a log file in a temporary folder and, if it exceeds a megabyte, moves it into a different directory. workingdirectory.getfile("tmp/log.txt", {}, function(file...
FileSystemEntry.getParent() - Web APIs
retrieved. the callback receives a single input parameter: a filesystemdirectoryentry object representing the parent directory. the parent of the root directory is considered to be the root directory, itself, so be sure to watch for that. errorcallback optional an optional callback which is executed if an error occurs. there's a single parameter: a fileerror describing what went wrong. return value undefined. errors fileerror.invalid_state_err the operation failed because the file system's state doesn't permit it. this can happen, for example, if the file system's cached state differs from the actual state of the file system. fileerror.not_found_err the specified path could not be found. fileerror.security_err security restrictions prohibit obtaining the parent directory's informa...
FileSystemEntry.isDirectory - Web APIs
not. you can also use isfile to determine if the entry is a file. you should not assume that any entry which isn't a directory is a file or vice-versa. there are other types of file descriptors on many operating systems. be sure to use both isdirectory and isfile as needed to ensure that the entry is something you know how to work with. syntax var isdirectory = filesystementry.isdirectory; value a boolean indicating whether or not the filesystementry is a directory. example this example shows how this property might be used to determine whether to process the entry as a directory or file. if the entry is neither, an error handler is called with an appropriate message. if (entry.isdirectory) { processsubdirectory(entry); } else if (entry.isfile) { processfile(entry); } else { di...
FileSystemEntry.isFile - Web APIs
not. you can also use isdirectory to determine if the entry is a directory. you should not assume that any entry which isn't a file is a directory or vice-versa. there are other types of file descriptors on many operating systems. be sure to use both isdirectory and isfile as needed to ensure that the entry is something you know how to work with. syntax var isfile = filesystementry.isfile; value a boolean indicating whether or not the filesystementry is a file. example this example shows how this property might be used to determine whether to process the entry as a directory or file. if the entry is neither, an error handler is called with an appropriate message. if (entry.isdirectory) { processsubdirectory(entry); } else if (entry.isfile) { processfile(entry); } else { display...
FileSystemEntry.moveTo() - Web APIs
name. successcallback optional a function which is called when the move operation is succesfully completed. receives a single input parameter: a filesystementry based object providing the moved item's new details. errorcallback optional an optional callback which is executed if an error occurs while moving the items. there's a single parameter: a fileerror describing what went wrong. return value undefined. errors fileerror.invalid_modification_err the requested operation involves an impossible change, such as moving a directory inside itself or one of its own child directories, or copying an item within the same directory without renaming it. fileerror.quota_exceeded_err the operation exceeded the user's storage quota, or there isn't enough storage space left to complete the oper...
FileSystemEntry.name - Web APIs
example this example shows a function called isfilewithextension() which returns true if the specified filesystementry is both a file and the file's name ends with a given extension. ...
FileSystemEntry.remove() - Web APIs
ry as well as all of its contents and its subdirectories, call filesystemdirectoryentry.removerecursively() instead. syntax filesystementry.remove(successcallback[, errorcallback]); parameters successcallback a function which is called once the file has been successfully removed. errorcallback optional an optional callback which is called if the attempt to remove the file fails. return value undefined. errors fileerror.invalid_modification_err the specified entry was the file system's root directory, or the specified entry is a directory which isn't empty. fileerror.invalid_state_err the file system's cached state is inconsistent with its state on disk, so the file could not be deleted for safety reasons. fileerror.no_modification_allowed_err the file system's state doesn't...
FileSystemEntry - Web APIs
which provides the full, absolute path from the file system's root to the entry; it can also be thought of as a path which is relative to the root directory, prepended with a "/" character. isdirectory read only a boolean which is true if the entry represents a directory; otherwise, it's false. isfile read only a boolean which is true if the entry represents a file. if it's not a file, this value is false. name read only a usvstring containing the name of the entry (the final part of the path, after the last "/" character). methods this interface defines the following methods. copyto() copies the file or directory to a new location on the file system. getmetadata() obtains metadata about the file, such as its modification date and size. getparent() returns a filesystemdirect...
FileSystemFileEntry.createWriter() - Web APIs
arameters successcallback a callback function which is called when the filewriter has been created successfully; the filewriter is passed into the callback as the only parameter. errorcallback optional if provided, this must be a method which is caled when an error occurs while trying to create the filewriter. this callback receives as input a fileerror object describing the error. return value undefined. example this example establishes a method, writetofileentry(), which outputs a text string to the file corresponding to the passed-in directory entry. function writetofileentry(entry, text) { entry.createwriter(function(filewriter) { let data = blob([text], { type: "text/plain" }); filewriter.write(data); }, function(fileerror) { /* do whatever to handle the error ...
FileSystemFileEntry.file() - Web APIs
the file has been created successfully; the file is passed into the callback as the only parameter. errorcallback optional if provided, this must be a method which is called when an error occurs while trying to create the file. this callback receives as input a fileerror object describing the error. editor's note: we need to find out what kinds of errors can occur and document them. return value undefined. example this example establishes a method, readfile(), reads a text file and calls a specified callback function with the received text (in a string object) once the read is completed. if an error occurs, a specified (optional) error callback is called. function readfile(entry, successcallback, errorcallback) { entry.file(function(file) { let reader = new filereader(); r...
Introduction to the File and Directory Entries API - Web APIs
omes with asynchronous and synchronous versions. both versions of the api offer the same capabilities and features. in fact, they are almost alike, except for a few differences. webworkers. the asynchronous api can be used in either the document or webworkers context, while the synchronous api is for use with webworkers only. callbacks. the asynchronous api doesn't give you data by returning values; instead, you have to pass a callback function. you send requests for operations to happen, and get notified by callbacks. in contrast, the synchronous api does not use callbacks because the api methods return values. global methods of the asynchronous and synchronous apis. the asynchronous api has the following global methods: requestfilesystem() and resolvelocalfilesystemurl(). these methods ...
FocusEvent() - Web APIs
syntax var focusevent = new focusevent(typearg[, focuseventinit]); properties the focusevent() constructor also inherits arguments from uievent() and from event(). typearg is a domstring representing the name of the event. ...
FontFace.family - Web APIs
Web › API › FontFace › family
the fontface.family property allows the author to get or set the font family of a fontface object. this is equivalent to the font-family descriptor of @font-face. syntax instanceoffontface.family = 'font family name'; var fontface = instanceoffontface.family; // "font family name" value a domstring. example var fontface = new fontface('roboto', 'url(https://fonts.example.com/roboto.woff2)'); console.log(fontface.family); // 'roboto' fontface.family = 'newroboto'; console.log(fontface.family); // 'newroboto' specifications specification status comment css font loading module level 3the definition of 'family' in that specification. working draft initial definition ...
FontFace.featureSettings - Web APIs
the featuresettings property of the fontface interface retrieves or sets infrequently used font features that are not available from a font's variant properties. it is equivalent to the font-feature-settings descriptor. syntax var featuresettingdescriptor = fontface.featuresettings; fontface.featuresettings = featuresettingdescriptor; value a cssomstring containing a descriptor. specifications specification status comment css font loading module level 3the definition of 'featuresettings' in that specification. working draft initial definition. ...
FontFace.load - Web APIs
Web › API › FontFace › load
the load() method of the fontface interface loads a font based on current object's constructor-passed requirements, including a location or source buffer, and returns a promise that resolves with the current fontface object. syntax var promise = fontface.load(); parameters none. return value a promise that resolves with a reference to the current fontface object when the font loads or rejects with a networkerror if the loading process fails. exceptions networkerror indicates that the attempt to load the font failed. specifications specification status comment css font loading module level 3the definition of 'load' in that specification. working draft initial definition. ...
FontFace.loaded - Web APIs
Web › API › FontFace › loaded
the loaded read-only property of the fontface interface returns a promise that resolves with the current fontface object when the font specified in the object's constructor is done loading or rejects with a syntaxerror. syntax var apromise = fontface.loaded; value a promise that resolves with the current fontface object. specifications specification status comment css font loading module level 3the definition of 'loaded' in that specification. working draft initial definition. ...
FontFace.status - Web APIs
Web › API › FontFace › status
the status read-only property of the fontface interface returns an enumerated value indicating the status of the font, one of "unloaded", "loading", "loaded", or "error". syntax var status = fontface.status; value one of "unloaded", "loading", "loaded", or "error". specifications specification status comment css font loading module level 3the definition of 'status' in that specification. working draft initial definition. ...
FontFace.stretch - Web APIs
Web › API › FontFace › stretch
the stretch property of the fontface interface retrieves or sets how the font stretches. it is equivalent to the font-stretch descriptor. syntax var stretchdescriptor = fontface.stretch; fontface.stretch = stretchdescriptor; value a cssomstring containing a descriptor as it would be defined in a style sheet's @font-face rule. specifications specification status comment css font loading module level 3the definition of 'stretch' in that specification. working draft initial definition. ...
FontFace.style - Web APIs
Web › API › FontFace › style
the style property of the fontface interface retrieves or sets the font's style. it is equivalent to the font-style descriptor. syntax var style = fontface.style; fontface.style = value; value a cssomstring containing the descriptors defined in the style sheet's @font-face rule. specifications specification status comment css font loading module level 3the definition of 'style' in that specification. working draft initial definition. ...
FontFace.unicodeRange - Web APIs
the unicoderange property of the fontface interface retrieves or sets the range of unicode codepoints encompassing the font. it is equivalent to the unicode-range descriptor. syntax var unicoderangedescriptor = fontface.unicoderange; fontface.unicoderange = unicoderangedescriptor; value a cssomstring containing a descriptor as it would appear in a style sheet's @font-face rule. specifications specification status comment css font loading module level 3the definition of 'unicoderange' in that specification. working draft initial definition. ...
FontFace.variant - Web APIs
Web › API › FontFace › variant
the variant property of the fontface interface programatically retrieves or sets font variant values. it is equivalent to the font-variant descriptor. syntax var variantsubproperty = fontface.variant; fontface.variant = variantsubproperty; value a cssomstring containing a descriptor as it would be defined in a style sheet's @font-face rule. specifications specification status comment css font loading module level 3the definition of 'variant' in that specification. working draft initial definition. ...
FontFace.weight - Web APIs
Web › API › FontFace › weight
the weight property of the fontface interface retrieves or sets the weight of the font. it is equivalent to the font-weight descriptor. syntax var weightdescriptor = fontface.weight; fontface.weight = weightdescriptor; value a cssomstring containing a descriptor as it would be defined in a style sheet's @font-face rule. specifications specification status comment css font loading module level 3the definition of 'weight' in that specification. working draft initial definition. ...
FontFace - Web APIs
Web › API › FontFace
or sets infrequently used font features that are not available from a font's variant properties. it is equivalent to the font-feature-settings descriptor. fontface.loaded read only returns a promise that resolves with the current fontface object when the font specified in the object's constructor is done loading or rejects with a syntaxerror. fontface.status read only returns an enumerated value indicating the status of the font, one of "unloaded", "loading", "loaded", or "error". fontface.stretch a cssomstring that retrieves or sets how the font stretches. it is equivalent to the font-stretch descriptor. fontface.style a cssomstring that retrieves or sets the style of the font. it is equivalent to the font-style descriptor. fontface.unicoderange a cssomstring that retrieves or se...
FontFaceSet.check() - Web APIs
Web › API › FontFaceSet › check
"italic bold 16px roboto" text: limit the font faces to those whose unicode range contains at least one of the characters in text. ...
FontFaceSet.load() - Web APIs
Web › API › FontFaceSet › load
the load() method of the fontfaceset forces all the fonts given in parameters to be loaded. syntax result = afontfaceset.load(font); result = afontfaceset.load(font, text); returns a promise of an array of fontface loaded. the promise is fulfilled when all the fonts are loaded; it is rejected if one of the fonts failed to load. parameters font: a font specification using the css value syntax, e.g. "italic bold 16px roboto" text: limit the font faces to those whose unicode range contains at least one of the characters in text. this does not check for individual glyph coverage. examples // returns a promise that will be fulfilled or rejected according the success to load myfont // the code in 'then' can assume the availability of that font. document.fonts.load("12px myfont", "ß...
FontFaceSetLoadEvent.FontFaceSetLoadEvent() - Web APIs
options optional options are as follows: fontfaces: an array of fontface instances. specifications specification status comment css font loading module level 3the definition of 'fontfacesetloadevent()' in that specification. ...
FontFaceSetLoadEvent.fontfaces - Web APIs
specifications specification status comment css font loading module level 3the definition of 'fontfaces' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. ...
FormData.delete() - Web APIs
Web › API › FormData › delete
the delete() method of the formdata interface deletes a key and its value(s) from a formdata object. note: this method is available in web workers. syntax formdata.delete(name); parameters name the name of the key you want to delete. returns void. example the following line creates an empty formdata object and prepopulates it with key/value pairs from a form: var formdata = new formdata(myform); you can delete keys and their values using delete(): formdata.delete('username'); specifications specification status comment xmlhttprequestthe definition of 'delete()' in that specification. living standard ...
FormData.entries() - Web APIs
Web › API › FormData › entries
the formdata.entries() method returns an iterator allowing to go through all key/value pairs contained in this object. the key of each pair is a usvstring object; the value either a usvstring, or a blob. note: this method is available in web workers. syntax formdata.entries(); return value returns an iterator. example // create a test formdata object var formdata = new formdata(); formdata.append('key1', 'value1'); formdata.append('key2', 'value2'); // display the key/value pairs for(var pair of formdata.entries()) { console.log(pair[0]+ ', '+ pair[1]); } the result is: key1, value1 key2, value2 specifications specification status comment xmlhttprequestthe definition of 'entries() (as iterator<>)' in that specification. living standard initial de...
FormData.has() - Web APIs
Web › API › FormData › has
able in web workers. syntax formdata.has(name); parameters name a usvstring representing the name of the key you want to test for. returns a boolean. example the following line creates an empty formdata object: var formdata = new formdata(); the following snippet shows the results of testing for the existence of username in the formdata object, before and after appending a username value to it with formdata.append: formdata.has('username'); // returns false formdata.append('username', 'chris'); formdata.has('username'); // returns true specifications specification status comment xmlhttprequestthe definition of 'has()' in that specification. living standard ...
FormData.keys() - Web APIs
Web › API › FormData › keys
the formdata.keys() method returns an iterator allowing to go through all keys contained in this object. the keys are usvstring objects. note: this method is available in web workers. syntax formdata.keys(); return value returns an iterator. example // create a test formdata object var formdata = new formdata(); formdata.append('key1', 'value1'); formdata.append('key2', 'value2'); // display the keys for (var key of formdata.keys()) { console.log(key); } the result is: key1 key2 specifications specification status comment xmlhttprequestthe definition of 'keys() (as iterator<>)' in that specification. living standard initial definition ...
Frame Timing API - Web APIs
ne, the specified observer callback will be invoked. accessing frame data when a frame observer is invoked, frame performance entries can be retrieved by calling performanceobserverentrylist.getentriesbytype() with an argument of "frame". this method returns a list of "frame" performanceentry objects. each frame object's duration property returns the timestamp of two consecutive frames. if this value is greater than the time needed to provide a good user experience, further analysis might be warranted. ...
Guide to the Fullscreen API - Web APIs
if (e.keycode == 13) { togglefullscreen(); } }, false); toggling fullscreen mode this code is called when the user hits the enter key, as seen above. function togglefullscreen() { if (!document.fullscreenelement) { document.documentelement.requestfullscreen(); } else { if (document.exitfullscreen) { document.exitfullscreen(); } } } this starts by looking at the value of the fullscreenelement attribute on the document (checking it prefixed with both moz, ms, or webkit). if it's null, the document is currently in windowed mode, so we need to switch to fullscreen mode. switching to fullscreen mode is done by calling element.requestfullscreen(). if fullscreen mode is already active (fullscreenelement is non-null), we call document.exitfullscreen(). prefixing ...
Gamepad.connected - Web APIs
Web › API › Gamepad › connected
the gamepad.connected property of the gamepad interface returns a boolean indicating whether the gamepad is still connected to the system. if the gamepad is connected, the value is true; if not, it is false. syntax readonly attribute boolean connected; example var gp = navigator.getgamepads()[0]; console.log(gp.connected); value a boolean. specifications specification status comment gamepadthe definition of 'gamepad.connected' in that specification. working draft initial definition ...
Gamepad.hand - Web APIs
Web › API › Gamepad › hand
the hand read-only property of the gamepad interface returns an enum defining what hand the controller is being held in, or is most likely to be held in. syntax var myhand = gamepadinstance.hand; value a gamepadhand enum; possible values are: left — the left hand. right — the right hand. empty string ("") — this value is returned if the other values are not applicable, e.g. the controller is held in both hands, or would be fine in either. examples tbc specifications specification status comment gamepad extensionsthe definition of 'hand' in that specification. editor's draft initial definition ...
Gamepad.hapticActuators - Web APIs
the hapticactuators read-only property of the gamepad interface returns an array containing gamepadhapticactuator objects, each of which represents haptic feedback hardware available on the controller. syntax var myhapticactuators = gamepadinstance.hapticactuators; value an array containing gamepadhapticactuator objects. examples tbc specifications specification status comment gamepad extensionsthe definition of 'hapticactuators' in that specification. editor's draft initial definition ...
Gamepad.id - Web APIs
Web › API › Gamepad › id
pad. this information is intended to allow you to find a mapping for the controls on the device as well as display useful feedback to the user. syntax readonly attribute domstring id; example window.addeventlistener("gamepadconnected", function() { var gp = navigator.getgamepads()[0]; gamepadinfo.innerhtml = "gamepad connected at index " + gp.index + ": " + gp.id + "."; }); value a string. specifications specification status comment gamepadthe definition of 'gamepad.id' in that specification. working draft initial definition ...
Gamepad.index - Web APIs
Web › API › Gamepad › index
the system. this can be used to distinguish multiple controllers; a gamepad that is disconnected and reconnected will retain the same index. syntax readonly attribute long index; example window.addeventlistener("gamepadconnected", function() { var gp = navigator.getgamepads()[0]; gamepadinfo.innerhtml = "gamepad connected at index " + gp.index + ": " + gp.id + "."; }); value a number. specifications specification status comment gamepadthe definition of 'gamepad.index' in that specification. working draft initial definition ...
Gamepad.mapping - Web APIs
Web › API › Gamepad › mapping
rowser has remapped the controls on the device to a known layout. currently there is only one supported known layout–the standard gamepad. if the browser is able to map controls on the device to that layout the mapping property will be set to the string standard. syntax readonly attribute domstring mapping; example var gp = navigator.getgamepads()[0]; console.log(gp.mapping); value a string. specifications specification status comment gamepadthe definition of 'gamepad.mapping' in that specification. working draft initial definition ...
Gamepad.timestamp - Web APIs
Web › API › Gamepad › timestamp
the gamepad.timestamp property of the gamepad interface returns a domhighrestimestamp representing the last time the data for this gamepad was updated. the idea behind this is to allow developers to determine if the axes and button data have been updated from the hardware. the value must be relative to the navigationstart attribute of the performancetiming interface. values are monotonically increasing, meaning that they can be compared to determine the ordering of updates, as newer values will always be greater than or equal to older values. note: this property is not currently supported anywhere. syntax readonly attribute domhighrestimestamp timestamp; example var gp = navigator.getgamepads()[0]; console.log(gp.timestamp); value a domhighrestimestamp. specifications s...
GamepadButton.pressed - Web APIs
the gamepadbutton.pressed property of the gamepadbutton interface returns a boolean indicating whether the button is currently pressed (true) or unpressed (false). syntax var ispressed = navigator.getgamepads()[0].pressed; example var gp = navigator.getgamepads()[0]; // get the first gamepad object if(gp.buttons[0].pressed == true) { // respond to button being pressed } value a boolean. specifications specification status comment gamepadthe definition of 'gamepadbutton.pressed' in that specification. working draft initial definition ...
GamepadEvent.gamepad - Web APIs
adconnected 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 ...
GamepadHapticActuator.pulse() - Web APIs
the pulse() method of the gamepadhapticactuator interface makes the hardware pulse at a certain intensity for a specified duration. syntax gamepadhapticactuatorinstance.pulse(value, duration).then(function(result) { ... }); parameters value a double representing the intensity of the pulse. this can vary depending on the hardware type, but generally takes a value between 0.0 (no intensity) and 1.0 (full intensity). duration a double representing the duration of the pulse, in milliseconds. note: repeated calls to pulse() override the previous calls if they are still ongoing. return value a promise that resolves with a value of true when the pulse has successfully completed. examples tbc specifications specification status comment gamepad exten...
GamepadHapticActuator.type - Web APIs
the type read-only property of the gamepadhapticactuator interface returns an enum representing the type of the haptic hardware. syntax var myactuatortype = gamepadhapticactuatorinstance.type; value an enum of type gamepadhapticactuatortype; currently available types are: vibration — vibration hardware, which creates a rumbling effect. examples tbc specifications specification status comment gamepad extensionsthe definition of 'gamepadhapticactuatortype' in that specification. editor's draft initial definition ...
Geolocation.watchPosition() - Web APIs
geolocation.watchposition(success[, error[, options]]) parameters success a callback function that takes a geolocationposition object as an input parameter. error optional an optional callback function that takes a geolocationpositionerror object as an input parameter. options optional an optional positionoptions object that provides configuration options for the location watch. return value an integer id that identifies the registered handler. the id can be passed to the geolocation.clearwatch() to unregister the handler. examples var id, target, options; function success(pos) { var crd = pos.coords; if (target.latitude === crd.latitude && target.longitude === crd.longitude) { console.log('congratulations, you reached the target'); navigator.geolocation.clearwatch(i...
Geolocation - Web APIs
hods for requesting this permission. properties the geolocation interface neither implements, nor inherits any property. methods the geolocation interface doesn't inherit any method. geolocation.getcurrentposition() secure context determines the device's current location and gives back a geolocationposition object with the data. geolocation.watchposition() secure context returns a long value representing the newly established callback function to be invoked whenever the device location changes. geolocation.clearwatch() secure context removes the particular handler previously installed using watchposition(). specifications specification status comment geolocation api recommendation initial specification. ...
GeolocationCoordinates.accuracy - Web APIs
the geolocationcoordinates.accuracy read-only property is a strictly positive double representing the accuracy, with a 95% confidence level, of the geolocationcoordinates.latitude and geolocationcoordinates.longitude properties expressed in meters. syntax let acc = geolocationcoordinatesinstance.accuracy value a positive double representing the accuracy, with a 95% confidence level, of the geolocationcoordinates.latitude and geolocationcoordinates.longitude properties expressed in meters. specifications specification status comment geolocation apithe definition of 'coordinates.accuracy' in that specification. recommendation initial definition ...
GeolocationCoordinates.altitude - Web APIs
the geolocationcoordinates.altitude read-only property is a double representing the altitude of the position in meters, relative to sea level. this value is null if the implementation cannot provide this data. syntax let alt = geolocationcoordinatesinstance.altitude value a double representing the altitude of the position in meters, relative to sea level. specifications specification status comment geolocation apithe definition of 'coordinates.altitude' in that specification. recommendation initial definition ...
GeolocationCoordinates.altitudeAccuracy - Web APIs
the geolocationcoordinates.altitudeaccuracy read-only property is a strictly positive double representing the accuracy, with a 95% confidence level, of the altitude expressed in meters. this value is null if the implementation doesn't support measuring altitude. syntax let altacc = geolocationcoordinatesinstance.altitudeaccuracy value a positive double representing the accuracy, with a 95% confidence level, of the altitude expressed in meters. specifications specification status comment geolocation apithe definition of 'geolocationcoordinates.altitudeaccuracy' in that specification. recommendation initial specification. ...
GeolocationCoordinates.heading - Web APIs
the geolocationcoordinates.heading read-only property is a double representing the direction in which the device is traveling. this value, specified in degrees, indicates how far off from heading due north the device is. zero degrees represents true true north, and the direction is determined clockwise (which means that east is 90 degrees and west is 270 degrees). if geolocationcoordinates.speed is 0, heading is nan. if the device is not able to provide heading information, this value is null. syntax let heading = geolocationcoordinatesinstance.heading value a double representing the direction in which the device is traveling. specifications specification status comment geolocation apithe definition of 'geolocationcoordinates.heading' in that specif...
GeolocationCoordinates.latitude - Web APIs
the geolocationcoordinates.latitude read-only property is a double representing the latitude of the position in decimal degrees. syntax let lat = geolocationcoordinatesinstance.latitude value a double representing the latitude of the position in decimal degrees. specifications specification status comment geolocation apithe definition of 'geolocationcoordinates.latitude' in that specification. recommendation initial specification. ...
GeolocationCoordinates.speed - Web APIs
the geolocationcoordinates.speed read-only property is a double representing the velocity of the device in meters per second. this value is null if the implementation is not able to measure it. syntax let speed = geolocationcoordinatesinstance.speed value a double representing the velocity of the device in meters per second. specifications specification status comment geolocation apithe definition of 'geolocationcoordinates.speed' in that specification. recommendation initial specification. ...
GeolocationPosition.coords - Web APIs
the geolocationposition.coords read-only property returns a geolocationcoordinates object representing a geographic position. it contains the location, that is longitude and latitude on the earth, the altitude, and the speed of the object concerned, regrouped inside the returned value. it also contains accuracy information about these values. syntax let coord = geolocationpositioninstance.coords value a geolocationcoordinates object instance. specifications specification status comment geolocation apithe definition of 'geolocationposition.coords' in that specification. recommendation initial specification. ...
GeolocationPosition.timestamp - Web APIs
the geolocationposition.timestamp read-only property returns a domtimestamp object, represents the date and the time of the creation of the geolocationposition object it belongs to. the precision is to the millisecond. syntax var timestamp = geolocationpositioninstance.timestamp value a domtimestamp object instance. specifications specification status comment geolocation apithe definition of 'geolocationposition.timestamp' in that specification. recommendation initial definition ...
GeolocationPositionError.message - Web APIs
the geolocationpositionerror.message read-only property returns a human-readable domstring describing the details of the error. syntax let msg = geolocationpositionerrorinstance.message value a human-readable domstring describing the details of the error. specifications specification status comment geolocation apithe definition of 'geolocationpositionerror.message' in that specification. recommendation initial definition ...
GeolocationPositionError - Web APIs
the geolocationpositionerror interface represents the reason of an error occurring when using the geolocating device. properties the geolocationpositionerror interface doesn't inherit any property. geolocationpositionerror.code read only secure context returns an unsigned short representing the error code. the following values are possible: value associated constant description 1 permission_denied the acquisition of the geolocation information failed because the page didn't have the permission to do it. 2 position_unavailable the acquisition of the geolocation failed because at least one internal source of position returned an internal error. 3 timeout the time allowed to acquire the geolocation, ...
GlobalEventHandlers.onabort - Web APIs
sts that browsers should not currently fire the abort event on a window that would trigger onabort to be called. todo: define what "abort" is. closing the window via window manager? stopping the load of the page? by which means and reasons (user, network/server)? at which stages would it fire / be caught? for ie, onabort is only available with <img> tags. syntax window.onabort = functionref; value functionref is a function name or a function expression. example window.onabort = function() { alert('load aborted.'); } specification specification status comment html living standardthe definition of 'onabort' in that specification. living standard ...
GlobalEventHandlers.onanimationcancel - Web APIs
aborts, that is, any time it stops running without sending an animationend event. this can happen, for example, when the animation-name is changed such that the animation is removed, or when the animating node is hidden—either directly or because any of its containing nodes are hidden—using css. syntax var animcancelhandler = target.onanimationcancel; target.onanimationcancel = function value a function to be called when an animationcancel event occurs indicating that a css animation has begun on the target, where the target object is an html element (htmlelement), document (document), or window (window). the function receives as input a single parameter: an animationevent object describing the event which occurred. example html <div class="main"> <div id="box" onanimationcancel...
GlobalEventHandlers.onanimationend - Web APIs
the onanimationend property of the globaleventhandlers mixin is the eventhandler for processing animationend events. the animationend event fires when a css animation reaches the end of its active period (which is calculated as animation-duration * animation-iteration-count) + animation-delay). syntax var animendhandler = target.onanimationend; target.onanimationend = function value a function to be called when an animationend event occurs indicating that a css animation has begun on the target, where the target object is an html element (htmlelement), document (document), or window (window). the function receives as input a single parameter: an animationevent object describing the event which occurred. example html content <div class="main"> <div id="box"> <div id="text">box<...
GlobalEventHandlers.onanimationiteration - Web APIs
xin is the eventhandler for processing animationiteration events. the animationiteration event is sent when a css animation reaches the end of an iteration. an iteration ends when a single pass through the sequence of animation instructions is completed by executing the last animation step. syntax var animiterationhandler = target.onanimationiteration; target.onanimationiteration = function value a function to be called when an animationiteration event occurs indicating that a css animation has reached the end of an iteration while running on the target, where the target object is an html element (htmlelement), document (document), or window (window). the function receives as input a single parameter: an animationevent object describing the event which occurred. example let's create an...
GlobalEventHandlers.onanimationstart - Web APIs
the function receives as input a single parameter: an animationevent object describing the event which occurred. ...
GlobalEventHandlers.onauxclick - Web APIs
ty with regards to button behaviors. specifically, event behavior is being updated so that click only fires for primary button clicks (e.g., left mouse button), while auxclick fires for non-primary button clicks. historically, click has generally fired for the click of any device input button, although with browser behavior being somewhat inconsistent. syntax target.onauxclick = functionref; value functionref is a function name or a function expression. the function receives a mouseevent object as its sole argument. within the function, this will be the element upon which the event was triggered. only one onauxclick handler can be assigned to an object at a time. you may prefer to use the eventtarget.addeventlistener() method instead, since it's more flexible. example in this example w...
GlobalEventHandlers.oncancel - Web APIs
the oncancel property of the globaleventhandlers mixin is an eventhandler for processing cancel events sent to a <dialog> element. the cancel event fires when the user indicates a wish to dismiss a <dialog>. this event handler prevents the event from bubbling, so any parent handlers are not notified of the event. syntax target.oncancel = functionref; value functionref is a function name or a function expression. the function receives an event object as its sole argument. only one oncancel handler can be assigned to an object at a time. you may prefer to use the eventtarget.addeventlistener() method instead, since it's more flexible. specifications specification status comment html living standardthe definition of 'oncancel' in that specification. living stan...
GlobalEventHandlers.onclick - Web APIs
events on a given element. the click event is raised when the user clicks on an element. it fires after the mousedown and mouseup events, in that order. note: when using the click event to trigger an action, also consider adding this same action to the keydown event, to allow the use of that same action by people who don't use a mouse or a touch screen. syntax target.onclick = functionref; value functionref is a function name or a function expression. the function receives a mouseevent object as its sole argument. within the function, this will be the element upon which the event was triggered. only one onclick handler can be assigned to an object at a time. you may prefer to use the eventtarget.addeventlistener() method instead, since it's more flexible. examples detecting clicks t...
GlobalEventHandlers.onclose - Web APIs
the function receives an event object as its sole argument. ...
GlobalEventHandlers.oncontextmenu - Web APIs
the function receives an event object as its sole argument. ...
GlobalEventHandlers.ondblclick - Web APIs
the function receives a mouseevent object as its sole argument. within the function, this will be the element upon which the event was triggered. ...
GlobalEventHandlers.ondrag - Web APIs
example this example includes the use of the ondrag attribute handler to set an element's drag event handler. ...
GlobalEventHandlers.ondragend - Web APIs
example this example shows two ways to use the ondragend attribute handler to set an element's dragend event handler. ...
GlobalEventHandlers.ondragenter - Web APIs
example this example demonstrates using the ondragenter attribute handler to set an element's dragenter event handler. ...
GlobalEventHandlers.ondragexit - Web APIs
the globaleventhandler.ondragexit property is an event handler for the dragexit event. the ondragexit event is a gecko specific event listener. if you are building a drag-and-drop feature for a website please see the ondragleave event listener instead. syntax var dragexithandler = targetelement.ondragexit; return value dragexithandler the dragexit event handler for element targetelement. example this example demonstrates using the ondragexit attribute handler to set an element's dragexit event handler. <!doctype html> <html lang=en> <title>examples of using the drag and drop global event attribute</title> <meta content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1...
GlobalEventHandlers.ondragleave - Web APIs
example this example demonstrates using the ondragleave attribute handler to set an element's dragleave event handler. ...
GlobalEventHandlers.ondragover - Web APIs
example this example demonstrates using the ondragover attribute handler to set an element's dragover event handler. ...
GlobalEventHandlers.ondragstart - Web APIs
example this example demonstrates using the ondragstart attribute handler to set an element's dragstart event handler. ...
GlobalEventHandlers.ondrop - Web APIs
example this example demonstrates the use of the ondrop attribute to define an element's drop event handler. ...
GlobalEventHandlers.ongotpointercapture - Web APIs
the function receives a pointerevent object as its sole argument. ...
GlobalEventHandlers.oninvalid - Web APIs
is an eventhandler that processes invalid events. the invalid event fires when a submittable element has been checked and doesn't satisfy its constraints. the validity of submittable elements is checked before submitting their owner form, or after the checkvalidity() method of the element or its owner form is called. syntax target.oninvalid = functionref; var functionref = target.oninvalid; value functionref is a function name or a function expression. the function receives a event object as its sole argument. example this example demonstrates oninvalid and onsubmit event handlers on a form. html <form id="form"> <p id="error" hidden>please fill out all fields.</p> <label for="city">city</label> <input type="text" id="city" required> <button type="submit">submit</button> </...
GlobalEventHandlers.onkeydown - Web APIs
the onkeydown property of the globaleventhandlers mixin is an eventhandler that processes keydown events. the keydown event fires when the user presses a keyboard key. syntax target.onkeydown = functionref; value functionref is a function name or a function expression. the function receives a keyboardevent object as its sole argument. example this example logs the keyboardevent.code value whenever you press down a key inside the <input> element. html <input> <p id="log"></p> javascript const input = document.queryselector('input'); const log = document.getelementbyid('log'); input.onkeydown = logkey; function logkey(e) { log.textcontent += ` ${e.code}`; } result specifications specification status comment html living standardthe definition of 'onkeyd...
GlobalEventHandlers.onkeypress - Web APIs
the onkeypress property of the globaleventhandlers mixin is an eventhandler that processes keypress events. the keypress event should fire when the user presses a key on the keyboard. however, in practice browsers do not fire keypress events for certain keys. the onkeypress event handler has been deprecated. you may want to use onkeydown instead. syntax target.onkeypress = functionref; value functionref is a function name or a function expression. the function receives a keyboardevent object as its sole argument. examples basic example this example logs the keyboardevent.code value whenever you press a key inside the <input> element. html <input> <p id="log"></p> javascript const input = document.queryselector('input'); const log = document.getelementbyid('log'); input.onkey...
GlobalEventHandlers.onkeyup - Web APIs
the onkeyup property of the globaleventhandlers mixin is an eventhandler that processes keyup events. the keyup event fires when the user releases a key that was previously pressed. syntax target.onkeyup = functionref; value functionref is a function name or a function expression. the function receives a keyboardevent object as its sole argument. example this example logs the keyboardevent.code value whenever you release a key inside the <input> element. html <input> <p id="log"></p> javascript const input = document.queryselector('input'); const log = document.getelementbyid('log'); input.onkeyup = logkey; function logkey(e) { log.textcontent += ` ${e.code}`; } result specifications specification status comment html living standardthe definition of ...
GlobalEventHandlers.onload - Web APIs
the onload property of the globaleventhandlers mixin is an eventhandler that processes load events on a window, xmlhttprequest, <img> element, etc. the load event fires when a given resource has loaded. syntax target.onload = functionref; value functionref is the handler function to be called when the window’s load event fires. examples window.onload = function() { init(); dosomethingelse(); }; <!doctype html> <html> <head> <title>onload test</title> // es5 <script> function load() { console.log("load event detected!"); } window.onload = load; </script> // es2015 <script> const load = () => { console.log("load event detected!"); } window.onload = load; </script> </head> <body> <p>the load ...
GlobalEventHandlers.onloadend - Web APIs
the onloadend property of the globaleventhandlers mixin is an eventhandler representing the code to be called when the loadend event is raised (when progress has stopped on the loading of a resource.) syntax img.onloadend = funcref; value funcref is the handler function to be called when the resource's loadend event fires. examples html content <img src="myimage.jpg"> javascript content // 'loadstart' fires first, then 'load', then 'loadend' image.addeventlistener('load', function(e) { console.log('image loaded'); }); image.addeventlistener('loadstart', function(e) { console.log('image load started'); }); image.addeventlistener('loadend', function(e) { console.log('image load finished'); }); ...
GlobalEventHandlers.onloadstart - Web APIs
the onloadstart property of the globaleventhandlers mixin is an eventhandler representing the code to be called when the loadstart event is raised (when progress has begun on the loading of a resource.) syntax img.onloadstart = funcref; value funcref is the handler function to be called when the resource's loadstart event fires. examples html content <img src="myimage.jpg"> javascript content // 'loadstart' fires first, then 'load', then 'loadend' image.addeventlistener('load', function(e) { console.log('image loaded'); }); image.addeventlistener('loadstart', function(e) { console.log('image load started'); }); image.addeventlistener('loadend', function(e) { console.log('image load finished'); }); specifications specification status comment html...
GlobalEventHandlers.onlostpointercapture - Web APIs
the function receives a pointerevent object as its sole argument. ...
GlobalEventHandlers.onmousedown - Web APIs
the function receives a mouseevent object as its sole argument. example this example reveals part of an image when you press and hold a mouse button. ...
GlobalEventHandlers.onmousemove - Web APIs
the function receives a mouseevent object as its sole argument. examples tooltips this example creates link tooltips that follow your mouse. it uses the onmousemove, onmouseover, and onmouseout event handlers. ...
GlobalEventHandlers.onmouseup - Web APIs
the function receives a mouseevent object as its sole argument. example in this example, a piece of "toast" hides when you click down with the mouse, and reappears when you release. ...
GlobalEventHandlers.onpointercancel - Web APIs
example this example shows two ways to use onpointercancel to handle an element's pointercancel events. ...
GlobalEventHandlers.onpointerenter - Web APIs
example this example shows two ways to use onpointerenter to set an element's pointerenter event handler. ...
GlobalEventHandlers.onpointerleave - Web APIs
the global event handler for the pointerleave event, which is delivered to a node when the pointer (mouse cursor, fingertip, etc.) exits its hit test area (for example, if the cursor exits an element or window's content area). this event is part of the pointer events api. syntax eventtarget.onpointerleave = leavehandler; var leavehandler = eventtarget.onpointerleave; value leavehandler the eventlistener which will be invoked to handle pointerleave events sent to the target. example this example shows two ways to use onpointerleave to set an element's pointerleave event handler. <html> <script> function leavehandler(ev) { // process the pointerleave event } function init() { var el=document.getelementbyid("target1"); el.onpointerleave = leavehandler; } </script> <body onload="ini...
GlobalEventHandlers.onpointermove - Web APIs
example this example shows two ways to use onpointermove to set an element's pointermove event handler. ...
GlobalEventHandlers.onpointerout - Web APIs
example this example shows two ways to use onpointerout to set an element's pointerout event handler. ...
GlobalEventHandlers.onpointerover - Web APIs
example this example shows two ways to use onpointerover to set an element's pointerover event handler. ...
GlobalEventHandlers.onpointerup - Web APIs
example this example shows two ways to use onpointerup to set an element's pointerup event handler. ...
GlobalEventHandlers.onreset - Web APIs
the function receives an event object as its sole argument. example this example logs the current event.timestamp whenever you reset the form. ...
GlobalEventHandlers.onresize - Web APIs
the function receives a focusevent object as its sole argument. ...
GlobalEventHandlers.onscroll - Web APIs
y of the globaleventhandlers mixin is an eventhandler that processes scroll events. the scroll event fires when the document view or an element has been scrolled, whether by the user, a web api, or the user agent. note: don't confuse onscroll with onwheel! onwheel handles general wheel rotation, while onscroll handles scrolling of an object's content. syntax target.onscroll = functionref value functionref a function name, or a function expression. the function receives a uievent object as its sole argument. only one onscroll handler can be assigned to an object at a time. for greater flexibility, you can pass a scroll event to the eventtarget.addeventlistener() method instead. example this example monitors scrolling on a <textarea>, and logs the element's vertical scroll posit...
GlobalEventHandlers.onselectionchange - Web APIs
the function receives a focusevent object as its sole argument. ...
GlobalEventHandlers.onselectstart - Web APIs
the function receives a focusevent object as its sole argument. ...
GlobalEventHandlers.onsubmit - Web APIs
the function receives a focusevent object as its sole argument. example this example demonstrates oninvalid and onsubmit event handlers on a form. ...
GlobalEventHandlers.ontouchcancel - Web APIs
the ontouchcancel property of the globaleventhandlers mixin is an eventhandler that processes touchcancel events. note: this attribute has not been formally standardized. it is specified in the touch events – level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. syntax var cancelhandler = someelement.ontouchcancel; return value cancelhandler the touchcancel event handler for element someelement. example this example shows two ways to use ontouchcancel to set an element's touchcancel event handler. <html> <script> function canceltouch(ev) { // process the event } function init() { let el = document.getelementbyid('target1'); el.ontouchcancel = canceltouch; } </script> <body onload="init();"> <div id="tar...
GlobalEventHandlers.ontouchend - Web APIs
a global event handler for the touchend event. note: this attribute has not been formally standardized. it is specified in the touch events – level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. syntax var endhandler = targetelement.ontouchend; return value endhandler the touchend event handler for element targetelement. example this example shows two ways to use ontouchend to set an element's touchend event handler. <html> <script> function endtouch(ev) { // process the event } function init() { var el=document.getelementbyid("target1"); el.ontouchend = endtouch; } </script> <body onload="init();"> <div id="target1"> touch me ... </div> <div id="target2" ontouchend="endtouch(event)"> touch me ... </div> </body> ...
GlobalEventHandlers.ontouchmove - Web APIs
a global event handler for the touchmove event. note: this attribute has not been formally standardized. it is specified in the touch events – level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. syntax var movehandler = someelement.ontouchmove; return value movehandler the touchmove event handler for element someelement. example this example shows two ways to use ontouchmove to set an element's touchmove event handler. <html> <head> <script> function movetouch(ev) { // process the event } function init() { var el=document.getelementbyid("target1"); el.ontouchmove = movetouch; } </script> </head> <body onload="init();"> <div id="target1"> touch me ... </div> <div id="target2" ontouchmove="movetouch(event)"> tou...
GlobalEventHandlers.ontouchstart - Web APIs
the ontouchstart property of the globaleventhandlers mixin is an eventhandler that processes touchstart events. note: this attribute has not been formally standardized. it is specified in the touch events – level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. syntax var starthandler = someelement.ontouchstart; return value starthandler the touchstart event handler for element someelement. example this example shows two ways to use ontouchstart to set an element's touchstart event handler. <html> <script> function starttouch(ev) { // process the event } function init() { let el = document.getelementbyid('target1'); el.ontouchstart = starttouch; } </script> <body onload="init();"> <div id="target1"> touc...
GlobalEventHandlers.onwheel - Web APIs
the onwheel property of the globaleventhandlers mixin is an eventhandler that processes wheel events. the wheel event fires when the user rotates the mouse (or other pointing device) wheel. note: don't confuse onwheel with onscroll: onwheel handles general wheel rotation, while onscroll handles scrolling of an object's content. syntax target.onwheel = functionref; value functionref is a function name or a function expression. the function receives a wheelevent object as its sole argument. examples this example shows how to scale an element using the mouse (or other pointing device) wheel. html <div>scale me with your mouse wheel.</div> css body { min-height: 100vh; margin: 0; display: flex; align-items: center; justify-content: center; } div { width: 80px; height:...
Gyroscope.x - Web APIs
Web › API › Gyroscope › x
perty of the gyroscope interface returns a double precision integer containing the angular velocity of the device along the its x axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var x = gyroscope.x value a number. example the gyroscope is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let gyroscope = new gyroscope({frequency: 60}); gyroscope.addeventlistener('reading', e => { console.log("angular velocity along the x-axis " + gyroscope.x); console.log("angular velocity along the y-axis " + gyroscope.y); console.log("angular...
Gyroscope.y - Web APIs
Web › API › Gyroscope › y
perty of the gyroscope interface returns a double precision integer containing the angular velocity of the device along the its y axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var y = gyroscope.y value a number. example the gyroscope is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let gyroscope = new gyroscope({frequency: 60}); gyroscope.addeventlistener('reading', e => { console.log("angular velocety along the x-axis " + gyroscope.x); console.log("angular velocety along the y-axis " + gyroscope.y); console.log("angular...
Gyroscope.z - Web APIs
Web › API › Gyroscope › z
perty of the gyroscope interface returns a double precision integer containing the angular velocity of the device along the its z axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var z = gyroscope.z value a number. example the gyroscope is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let gyroscope = new gyroscope({frequency: 60}); gyroscope.addeventlistener('reading', e => { console.log("angular velocety along the x-axis " + gyroscope.x); console.log("angular velocety along the y-axis " + gyroscope.y); console.log("angular...
HTMLAnchorElement.download - Web APIs
the htmlanchorelement.download property is a domstring indicating that the linked resource is intended to be downloaded rather than displayed in the browser. the value, if any, specifies the default file name for use in labeling the resource in a local file system. if the name is not a valid file name in the underlying os, the browser will adjust it. note: this value might not be used for download. this value cannot be used to determine whether the download will occur. syntax var dnload = anchorelt.download; anchorelt.download = dnload; specifications specification status comment html living standardthe definition of 'download' in that specification. living standard initial definition. ...
HTMLAnchorElement.referrerPolicy - Web APIs
"origin" meaning that the referrer will be the origin of the page, that is roughly the scheme, the host and the port. ...
HTMLAreaElement.referrerPolicy - Web APIs
"origin" meaning that the referrer will be the origin of the page, that is roughly the scheme, the host and the port. ...
msAudioDeviceType - Web APIs
ifies the output device id that the audio will be sent to. syntax <audio src="sound.mp3" msaudiodevicetype="communications" /> by default, audio on your system will output to your default speakers and be considered a foreground element, meaning that the audio will play only when the element is active in the app. for real-time communications, you can use the msaudiodevicetype property with the value console, multimedia, or communications to specify where the current audio should output. value include a description of the property's value, including data type and what it represents. value description console specifies that the audio output will be sent to the console device. multimedia specifies that the audio output will be sent to the multimedia ...
HTMLBaseFontElement - Web APIs
g representing a list of one or more font names. the document text in the default style is rendered in the first font face that the client's browser supports. if no font listed is installed on the local system, the browser typically defaults to the proportional or fixed-width font for that system. htmlbasefontelement.size is a domstring representing the font size as either a numeric or relative value. numeric values range from 1 to 7 with 1 being the smallest and 3 the default. relative value starts with a '+' or a '-'. methods no specific method; inherits methods from its parent, htmlelement. specifications specification status comment document object model (dom) level 2 html specificationthe definition of 'htmlbasefontelement' in that specification. obsolete ...
HTMLButtonElement.labels - Web APIs
the htmlbuttonelement.labels read-only property returns a nodelist of the <label> elements associated with the <button> element. syntax var labelelements = button.labels; 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 specific...
HTMLCanvasElement.captureStream() - Web APIs
the htmlcanvaselement capturestream() method returns a mediastream which includes a canvascapturemediastreamtrack containing a real-time video capture of the canvas's contents. syntax mediastream = canvas.capturestream(framerate); parameters framerate optional a double-precision floating-point value that indicates the rate of capture of each frame. if not set, a new frame will be captured each time the canvas changes; if set to 0, frames will not be captured automatically; instead, they will only be captured when the returned track's requestframe() method is called. return value a reference to a mediastream object, which has a single canvascapturemediastreamtrack in it. exceptions notsupportederror the value of framerate is negative. example // find the canvas element to cap...
HTMLCanvasElement.mozFetchAsStream() - Web APIs
eam() internal method used to create a new input stream that, when ready, would provide the contents of the canvas as image data. however, this non-standard and internal method has been removed. syntax void canvas.mozfetchasstream(callback, type); parameters callback an nsiinputstreamcallback. type optional a domstring indicating the image format. the default type is image/png. return value none. examples save to disk with mozfetchasstream (chrome context only) this technique also converts it to ico, however it will not work in windows xp as winxp cannot convert from png to ico. it saves to the desktop it uses fileutils.jsm. also uses netutil.jsm var canvas = document.getelementbyid('canvas'); var d = canvas.width; ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.moveto(d /...
HTMLCanvasElement.mozGetAsFile() - Web APIs
the image contained in the canvas. syntax canvas.mozgetasfile(name, type); parameters name a domstring indicating the file name to give the file representing the image file in memory. type optional a domstring which specifies the image file format to use when creating the new image file. the default type is image/png. for other options, see our image file type and format guide. return value a file object representing the image contained in the canvas. the file's data is entirely located in memory until such time as it is explicitly written to disk. examples this example creates an image file from the <canvas> element on the page, then uses a filereader to read the image data from the file. html <canvas id="canvas" width="100" height="100"></canvas> <p><a href="#" id="link">cli...
HTMLCanvasElement.transferControlToOffscreen() - Web APIs
examples var htmlcanvas = document.createelement('canvas'); var offscreen = htmlcanvas.transfercontroltooffscreen(); var gl = offscreen.getcontext('webgl'); // ... some drawing using the gl context ... ...
HTMLCollection.item - Web APIs
the htmlcollection method item() returns the node located at the specified offset into the collection. note: because the contents of an htmlcollection are live, changes to the underlying dom can and will cause the position of individual nodes in the collection to change, so the 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 eas...
HTMLContentElement - Web APIs
the htmlcontentelement interface represents a <content> html element, which is used in shadow dom. properties this interface inherits the properties of htmlelement. htmlcontentelement.select is a domstring that reflects the select html attribute. the value is a comma-separated list of css selectors that select the content to insert in place of the <content> element. methods this interface inherits the methods of htmlelement. htmlcontentelement.getdistributednodes() returns a static nodelist of the distributed nodes associated with this <content> element. specifications this feature is no longer defined by any standards. ...
HTMLDataElement - Web APIs
ight="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="416" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmldataelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmldataelement.value is a domstring reflecting the value html attribute, containing a machine-readable form of the element's value. methods no specific method; inherits methods from its parent, htmlelement. specifications specification status comment html living standardthe definition of 'htmldataelement' in that specification. living standard html5the definition of 'htm...
HTMLDivElement - Web APIs
"#4d4e53" text-anchor="middle" alignment-baseline="middle">htmldivelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmldivelement.align is a domstring representing an enumerated property indicating alignment of the element's contents with respect to the surrounding context. the possible values are "left", "right", "justify", and "center". methods no specific method; inherits methods from its parent, htmlelement. specifications specification status comment html living standardthe definition of 'htmldivelement' in that specification. living standard html5the definition of 'htmldivelement' in that specification. recommendation no change...
HTMLElement: animationstart event - Web APIs
the animationstart event is fired when a css animation has started. if there is an animation-delay, this event will fire once the delay period has expired. a negative delay will cause the event to fire with an elapsedtime equal to the absolute value of the delay (and, correspondingly, the animation will begin playing at that time index into the sequence). bubbles yes cancelable no interface animationevent event handler property onanimationstart examples this listens for the animationstart event and logs a message when it is fired: const animated = document.queryselector('.animated'); animated.addeventlistener('animationstart', () => { console.log('animation started'); }); the same, but using onanimationstart: const animated = docu...
HTMLElement.contentEditable - Web APIs
the contenteditable property of the htmlelement interface specifies whether or not the element is editable. this enumerated attribute can have the following values: 'true' indicates that the element is contenteditable. 'false' indicates that the element cannot be edited. 'inherit' indicates that the element inherits its parent's editable status. you can use the htmlelement.iscontenteditable property to test the computed boolean value of this property. syntax editable = element.contenteditable element.contenteditable = 'true' specifications specification status comment html living standardthe definition of 'contenteditable' in that specification. living standard initial definition ...
HTMLElement.offsetWidth - Web APIs
nd vertical scrollbars (if rendered). it does not include the width of pseudo-elements such as ::before or ::after. if the element is hidden (for example, by setting style.display on the element or one of its ancestors to "none"), then 0 is returned. syntax var intelemoffsetwidth = element.offsetwidth; intelemoffsetwidth is a variable storing an integer corresponding to the offsetwidth pixel value of the element. the offsetwidth property is a read-only. this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). example specification specification status comment css object model (cssom) view modulethe definition of 'offsetwidth' in that specification. working draft notes offsetwid...
HTMLElement.oncopy - Web APIs
the function receives a clipboardevent object as its sole argument. example this example blocks every copy and paste attempt from the <textarea>. ...
HTMLElement.oncut - Web APIs
Web › API › HTMLElement › oncut
the function receives a clipboardevent object as its sole argument. example this example allows text to be copied from the <textarea>, but doesn't allow text to be cut. it also logs each copy and cut attempt. ...
HTMLElement.onpaste - Web APIs
the htmlelement.onpaste property of the htmlelement interface is an eventhandler that processes paste events. the paste event fires when the user attempts to paste text. note that there is currently no dom-only way to obtain the text being pasted; you'll have to use an nsiclipboard to get that information. syntax target.onpaste = functionref; value functionref is a function name or a function expression. the function receives a clipboardevent object as its sole argument. example this example logs every copy and paste attempt to the <textarea>. html <h3>play with this text area:</h3> <textarea id="editor" rows="3">try copying and pasting text into this field!</textarea> <h3>log:</h3> <p id="log"></p> javascript function logcopy(event) { log.innertext = 'copied!\n' + log...
HTMLElement.outerText - Web APIs
as a setter, it removes the current node and replaces it with the given text. ...
HTMLEmbedElement - Web APIs
4e53" text-anchor="middle" alignment-baseline="middle">htmlembedelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlembedelement.align is a domstring representing an enumerated property indicating alignment of the element's contents with respect to the surrounding context. the possible values are "left", "right", "center", and "justify". htmlembedelement.height is a domstring reflecting the height html attribute, containing the displayed height of the resource. htmlembedelement.name is a domstring representing the name of the embedded object. htmlembedelement.src is a domstring that reflects the src html attribute, containing the address of the resource. htmlembedelement.typ...
HTMLFieldSetElement - Web APIs
is property depends on the version of the spec that is implemented by the browser. htmlfieldsetelement.formread only an htmlformcontrolscollection or htmlcollection referencing the containing form element, if this element is in a form. if the field set is not a descendant of a form element, then the attribute can be the id of any form element in the same document it is related to, or the null value if none matches. htmlfieldsetelement.name a domstring reflecting the name html attribute, containing the name of the field set. this can be used when accessing the field set in javascript. it is not part of the data which is sent to the server. htmlfieldsetelement.typeread only the domstring "fieldset". htmlfieldsetelement.validationmessage a domstring representing a localized message that...
HTMLFontElement.color - Web APIs
ither a named color or a color specified in the hexadecimal #rrggbb format. the format of the string must follow one of the following html microsyntaxes: microsyntax description examples valid name color string nameofcolor (case insensitive) green green green valid hex color string in rgb format: #rrggbb #008000 rgb using decimal values rgb(x,x,x) (x in 0-255 range) rgb(0,128,0) syntax colorstring = fontobj.color; fontobj.color = colorstring; examples // assumes there is <font id="f"> element in the html var f = document.getelementbyid("f"); f.color = "green"; specifications the <font> tag is not supported in html5 and as a result neither is <font>.color. ...
HTMLFormControlsCollection.namedItem() - Web APIs
the htmlformcontrolscollection.nameditem() method returns the radionodelist or the element in the collection whose name or id match the specified name, or null if no node matches. note that this version of nameditem() hides the one inherited from htmlcollection. like that one, in javascript, using the array bracket syntax with a string, like collection["value"] is equivalent to collection.nameditem("value"). syntax var item = collection.nameditem(str); var item = collection[str]; parameters str is a domstring return value item is a radionodelist , element, or null. example html <form> <input id="my-form-control" type="textarea"> </form> javascript // returns the htmlinputelement representing #my-form-control elem1 = document.forms[0]['my-form-control']; specifications ...
HTMLFormControlsCollection - Web APIs
nherits the methods of its parent, htmlcollection. htmlformcontrolscollection.nameditem() returns the radionodelist or the element in the collection whose name or id matches the specified name, or null if no nodes match. note that this version of nameditem() hide the one inherited from htmlcollection. like that one, in javascript, using the array bracket syntax with a string, like collection["value"] is equivalent to collection.nameditem("value"). specifications specification status comment html living standardthe definition of 'htmlformcontrolscollection' in that specification. living standard no change since the last snapshot, html5. html5the definition of 'htmlformcontrolscollection' in that specification. recommendation in this snapshot of...
HTMLFormElement.enctype - Web APIs
the htmlformelement.enctype property is the mime type of content that is used to submit the form to the server. possible values are: application/x-www-form-urlencoded: the initial default type. multipart/form-data: the type that allows file <input> element(s) to upload file data. text/plain: a type introduced in html5. this value can be overridden by a formenctype attribute on a <button> or <input> element. syntax var string = form.enctype; form.enctype = string; example form.enctype = 'application/x-www-form-urlencoded'; specifications specification status comment html living standardthe definition of 'htmlformelement: enctype' in that specification. living standard ...
HTMLFormElement.length - Web APIs
mlformelement.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. example if (document.getelementbyid('form1').length > 1) { // more than one form control here } specifications specification status comment html living standardthe definition of 'htmlfo...
HTMLFormElement.reportValidity() - Web APIs
the htmlformelement.reportvalidity() method returns true if the element's child controls satisfy their validation constraints. when false is returned, cancelable invalid events are fired for each invalid child and validation problems are reported to the user. syntax htmlformelement.reportvalidity() return value boolean example document.forms['myform'].addeventlistener('submit', function() { document.forms['myform'].reportvalidity(); }, false); specifications specification status comment html living standardthe definition of 'htmlformelement.reportvalidity()' in that specification. living standard html 5.1the definition of 'htmlformelement.reportvalidity()' in that specification. recommendation initial definition ...
HTMLFormElement.requestSubmit() - Web APIs
tted using a specific submit button. syntax htmlformelement.requestsubmit(submitter); parameters submitter optional the submit button whose attributes describe the method by which the form is to be submitted. this may be either an <input> or <button> element whose type attribute is submit. if you omit the submitter parameter, the form element itself is used as the submitter. return value none. exceptions typeerror the specified submitter is not a submit button. notfounderror the specified submitter isn't a member of the form on which requestsubmit() was called. the submitter must be either a descendant of the form element or must have an form attribute referring to the form. usage notes the obvious question is: why does this method exist, when we've had the submit() me...
HTMLFormElement.reset() - Web APIs
this method does the same thing as clicking the form's reset button. if a form control (such as a reset button) has a name or id of reset it will mask the form's reset method. it does not reset other attributes in the input, such as disabled. ...
HTMLHeadingElement - Web APIs
l="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlheadingelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlheadingelement.align is a domstring representing an enumerated attribute indicating alignment of the heading with respect to the surrounding context. the possible values are "left", "right", "justify", and "center". methods no specific method; inherits methods from its parent, htmlelement. specifications specification status comment html living standardthe definition of 'htmlheadingelement' in that specification. living standard html5the definition of 'htmlheadingelement' in that specification. recommendation th...
HTMLHtmlElement.version - Web APIs
...
HTMLHtmlElement - Web APIs
the htmlhtmlelement interface serves as the root node for a given html document. this object inherits the properties and methods described in the htmlelement interface. you can retrieve the htmlhtmlelement object for a given document by reading the value of the document.documentelement property. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco...
HTMLHyperlinkElementUtils.origin - Web APIs
e.g "blob:https://mozilla.org" will have "https://mozilla.org". note: this feature is available in web workers. syntax string = object.origin; examples // on this page, returns the origin var result = window.location.origin; // returns:'https://developer.mozilla.org' specifications specification ...
HTMLHyperlinkElementUtils - Web APIs
ame. htmlhyperlinkelementutils.origin read only this returns a usvstring containing the origin of the url (that is its scheme, its domain and its port). methods note: this interface doesn't inherit any method. htmlhyperlinkelementutils.tostring() this returns a usvstring containing the whole url. it is a synonym for htmlhyperlinkelementutils.href, though it can't be used to modify the value. specifications specification status comment html living standardthe definition of 'htmlhyperlinkelementutils' in that specification. living standard initial definition ...
HTMLIFrameElement.allowPaymentRequest - Web APIs
specifications specification status comment payment request apithe definition of 'allowpaymentrequest' in that specification. candidate recommendation adds allowpaymentrequest property. ...
HTMLIFrameElement.csp - Web APIs
specifications specification status comment content security policy: embedded enforcementthe definition of 'csp' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. ...
HTMLIFrameElement.featurePolicy - Web APIs
the featurepolicy read-only property of the htmliframeelement interface returns the featurepolicy interface which provides a simple api for introspecting the feature policies applied to a specific frame. syntax var policy = htmliframeelement.featurepolicy value a featurepolicy object that can be used to inspect the feature policy settings applied to the frame. specification specification status comment feature policy editor's draft initial definition. ...
HTMLIFrameElement.referrerPolicy - Web APIs
no referrer information is sent along with requests. no-referrer-when-downgrade (default) this is the user agent's default behavior if no policy is specified. ...
HTMLIFrameElement - Web APIs
</a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmliframeelement.align is a domstring that specifies the alignment of the frame with respect to the surrounding context. htmliframeelement.allow is a list of origins the the frame is allowed to display content from. this attribute also accepts the values self and src which represent the origin in the iframe's src attribute. the default value is src. htmliframeelement.allowfullscreen is a boolean indicating whether the inline frame is willing to be placed into full screen mode. see using full-screen mode for details. htmliframeelement.allowpaymentrequest is a boolean indicating whether the payment request api may be invoked inside a cross-o...
HTMLImageElement.currentSrc - Web APIs
this is useful when you provide multiple image options using the sizes and/or htmlimageelement.srcset properties. currentsrc lets you determine which image from the set of provided images was selected by the browser. ...
HTMLImageElement.decode() - Web APIs
e loading of the image prior to attaching it to an element in the dom (or adding it to the dom as a new element), so that the image can be rendered immediately upon being added to the dom. this, in turn, prevents the rendering of the next frame after adding the image to the dom from causing a delay while the image loads. syntax var promise = htmlimageelement.decode(); parameters none. return value a promise which is resolved once the image data is ready to be used. exceptions encodingerror a domexception indicating that an error occurred while decoding the image. usage notes one potential use case for decode(): when loading very large images (for example, in an online photo album), you can present a low resolution thumbnail image initially and then replace that image with the full...
HTMLImageElement.height - Web APIs
the height property of the htmlimageelement interface indicates the height at which the image is drawn, in css pixels if the image is being drawn or rendered to any visual medium such as the screen or a printer; otherwise, it's the natural, pixel density corrected height of the image. syntax htmlimageelement.height = newheight; let height = htmlimageelement.height; value an integer value indicating the height of the image. the terms in which the height is defined depends on whether the image is being rendered to a visual medium or not. if the image is being rendered to a visual medium such as a screen or printer, the height is expressed in css pixels. otherwise, the image's height is represented using its natural (intrinsic) height, adjusted for the display density as indicated by nat...
HTMLImageElement.hspace - Web APIs
the obsolete hspace property of the htmlimageelement interface specifies the number of pixels of empty space to leave empty on the left and right sides of the <img> element when laying out the page. this property reflects the html hspace attribute. syntax htmlimageelement.hspace = marginwidth; marginwidth = htmlimageelement.hspace; value an integer value specifying the width, in pixels, of the horizontal margin to apply to the left and right sides of the image. usage notes the value specified for hspace is mapped to the margin-left and margin-right properties to specify the width of those margins in pixels. important: this property is obsolete. you should instead use the css margin property and its longhand forms to establish margins around an <img>. specifications spec...
HTMLImageElement.longDesc - Web APIs
the obsolete property longdesc on the htmlimageelement interface specifies the url of a text or html file which contains a long-form description of the image. this can be used to provide optional added details beyond the short description provided in the title attribute. syntax descurl = htmlimageelement.longdesc; htmlimageelement.longdesc = descurl; value a domstring which may be either an empty string (indicating that no long description is available) or the url of a file containing a long form description of the image's contents. for example, if the image is a png of a flowchart. the longdesc property could be used to provide an explanation of the flow of control represented by the chart, using only text. this can be used by readers both as an explanation, but also as a substitute f...
HTMLImageElement.lowSrc - Web APIs
the htmlimageelement interface's obsolete lowsrc property can be used to specify the url of a reduced-quality or otherwise faster-loading version of the image specified by the src property. this property reflects the html lowsrc attribute. syntax htmlimageelement.lowsrc = imageurl; imageurl = htmlimageelement.lowsrc; value a domstring specifying the url of a version of the image specified by src which has been modified in some fashion so that it loads significantly more quickly than the primary image. there are a number of ways to achieve this; primary among them: higher compression levels (for example, a primary image saved as a jpeg using 85% quality might have a lowsrc version saved at 15%. reduced color depth; a primary image in 32-bit color might have an alternate image in 8...
HTMLImageElement.name - Web APIs
important: this property is deprecated and is only in the specification still for backward compatibility purposes. since it functions identically to id, you can and should use it instead. ...
HTMLImageElement.naturalHeight - Web APIs
the htmlimageelement interface's naturalheight property is a read-only value which returns the intrinsic (natural), density-corrected height of the image in css pixels. this is the height the image is if drawn with nothing constraining its height; if you don't specify a height for the image, or place the image inside a container that either limits or expressly specifies the image height, it will be rendered this tall. syntax let naturalheight = htmlimageelement.naturalheight; value an integer value indicating the intrinsic height, in css pixels, of the image. this is the height at which the image is naturally drawn when no constraint or specific value is established for the image. this natural height is corrected for the pixel density of the device on which it's being presented, unlike hei...
HTMLImageElement.naturalWidth - Web APIs
width the image is if drawn with nothing constraining its width; if you neither specify a width for the image nor place the image inside a container that limits or expressly specifies the image width, this is the number of css pixels wide the image will be. the corresponding naturalheight method returns the natural height of the image. syntax let naturalwidth = htmlimageelement.naturalwidth; value an integer value indicating the intrinsic width of the image, in css pixels. this is the width at which the image is naturally drawn when no constraint or specific value is established for the image. this natural width is corrected for the pixel density of the device on which it's being presented, unlike the value of width. if the intrinsic width is not available—either because the image does...
HTMLImageElement.src - Web APIs
this can be set either within the html itself using the src content attribute, or programmatically by setting the element's src property. ...
HTMLImageElement.useMap - Web APIs
the usemap property on the htmlimageelement interface reflects the value of the html usemap attribute, which is a string providing the name of the client-side image map to apply to the image. syntax htmlimageelement.usemap = imagemapanchor; let imagemapanchor = htmlimageelement.usemap; value a usvstring providing the page-local url (that is, a url that begins with the hash or pound symbol, "#") of the <map> element which defines the image map to apply to the image. you can learn more about client-side image maps in our learning article add a hitmap on top of an image. usage notes the string value of usemap must be a valid anchor for a <map> element. in other words, this string should be the value of the appropriate <map>'s name attribute with a pound or hash symbol prepended to it. co...
HTMLImageElement.vspace - Web APIs
the obsolete vspace property of the htmlimageelement interface specifies the number of pixels of empty space to leave empty on the top and bottom of the <img> element when laying out the page. syntax htmlimageelement.vspace = marginheight; marginheight = htmlimageelement.vspace; value an integer value specifying the height, in pixels, of the vertical margin to apply to the top and bottom sides of the image. usage notes the value specified for vspace is mapped to the margin-top and margin-bottom properties to specify the height of those margins in pixels. important: this property is obsolete. you should instead use the css margin property and its longhand forms to establish margins around an <img>. specifications specification status comment html living...
HTMLImageElement.width - Web APIs
the width property of the htmlimageelement interface indicates the width at which the image is drawn, in css pixels if the image is being drawn or rendered to any visual medium such as the screen or a printer; otherwise, it's the natural, pixel density corrected width of the image. syntax htmlimageelement.width = newwidth; let width = htmlimageelement.width; value an integer value indicating the width of the image. the terms in which the width is defined depends on whether the image is being rendered to a visual medium or not. if the image is being rendered to a visual medium such as a screen or printer, the width is expressed in css pixels. otherwise, the image's width is represented using its natural (intrinsic) width, adjusted for the display density as indicated by naturalwidth. ...
HTMLInputElement.labels - Web APIs
the htmlinputelement.labels read-only property returns a nodelist of the <label> elements associated with the <input> element. syntax var labelelements = 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 stand...
HTMLInputElement.multiple - Web APIs
firefox currently only supports multiple for <input type="file">. ...
HTMLInputElement.webkitEntries - Web APIs
e property empty (bug 1326031). the array can only contain directories if the webkitdirectory property is true. this means the <input> element was configured to let the user choose directories. this property is called webkitentries in the specification due to its origins as a google chrome-specific api. it's likely to be renamed someday. syntax var entries = htmlinputelement.webkitentries; value an array of objects based on filesystementry, each representing one file which is selected in the <input> element. more specifically, files are represented by filesystemfileentry objects, and, if they're allowed, directories are represented by filesystemdirectoryentry objects. example this example shows how to create a file selection <input> element and process the selected files. html <inpu...
HTMLInputElement.webkitdirectory - Web APIs
hat reflects the webkitdirectory html attribute and indicates that the <input> element should let the user select directories instead of files. when a directory is selected, the directory and its entire hierarchy of contents are included in the set of selected items. the selected file system entries can be obtained using the webkitentries property. syntax htmlinputelement.webkitdirectory = boolvalue value a boolean; true if the <input> element should allow picking only directories or false if only files should be selectable. understanding the results after the user makes a selection, each file object in files has its file.webkitrelativepath property set to the relative path within the selected directory at which the file is located. for example, consider this file system: photoalbums ...
HTMLIsIndexElement - Web APIs
isindex> elements. the <isindex> element has been deprecated in html4 and removed in html5. this latest specification requires that this element implements htmlunknownelement rather than htmlisindexelement. properties inherits properties from its parent, htmlelement. htmlisindexelement.form read only is a htmlformelement representing the <form> element it belongs too. it can have the null value, if <isindex> isn't part of any form. htmlisindexelement.prompt is a domstring representing a text to be prompted for the field. methods no specific method; inherits methods from its parent, htmlelement. specifications specification status comment html5the definition of 'htmlisindexelement' in that specification. recommendation removed. <isindex> must now impl...
HTMLKeygenElement - Web APIs
that reflects the keytype html attribute, containing the type of key used. labels read only unimplemented (see bug 556743) is a nodelist that represents a list of label elements associated with this keygen element. name is a domstring that reflects the name html attribute, containing the name for the control that is submitted with form data. type read only is a domstring that must be the value keygen. validationmessage read only is a domstring representing 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 constraint validation (willvalidate is false), or it satisfies its constraints. validity read only is a validitystate representing the validity states that this...
HTMLLIElement - Web APIs
xt></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmllielement.type is a domstring representing the type of the bullets, "disc", "square" or "circle". as the standard way of defining the list type is via the css list-style-type property, use the cssom methods to set it via a script. htmllielement.value is a long indicating the ordinal position of the list element inside a given <ol>. it reflects the value attribute of the html <li> element, and can be smaller than 0. if the <li> element is not a child of an <ol> element, the property has no meaning. methods no specific method; inherits properties from its parent, htmlelement. specifications specification status comment ...
HTMLLabelElement.control - Web APIs
the read-only htmllabelelement.control property returns a reference to the control (in the form of an object of type htmlelement or one of its derivatives) with which the <label> element is associated, or null if the label isn't associated with a control. syntax control = htmllabelelement.control value an htmlelement derived object representing the control with which the <label> is associated, or null if the label stands alone. if this property has a value and htmllabelelement.htmlfor has a value, the htmllabelelement.htmlfor property must refer to the same control. specifications specification status comment html living standardthe definition of 'control' in that specification. living standard initial definition ...
HTMLLabelElement.form - Web APIs
the read-only htmllabelelement.form property returns an htmlformelement object which represents the form of which the label's associated control is a part, or null if there is either no associated control, or if that control isn't in a form. this property is just a shortcut for htmllabelelement.control.form. syntax form = htmllabelelement.form value an htmlformelement which represents the form with which the label's control is associated. if control is null (meaning the label isn't associated with a control), or if the control isn't part of a form, this property returns null. specifications specification status comment html living standardthe definition of 'form' in that specification. living standard initial definition ...
HTMLLabelElement.htmlFor - Web APIs
the htmllabelelement.htmlfor property reflects the value of the for content property. that means that this script-accessible property is used to set and read the value of the content property for, which is the id of the label's associated control element. syntax controlid = htmllabelelement.htmlfor htmllabelelement.htmlfor = newid value a domstring which contains the id string of the element which is associated with the control. if this property has a value, the htmllabelelement.control property must refer to the same control. specifications specification status comment html living standardthe definition of 'htmlfor' in that specification. living standard initial definition ...
HTMLLegendElement - Web APIs
middle" alignment-baseline="middle">htmllegendelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmllegendelement.form read only is a htmlformelement representing the form that this legend belongs to. if the legend has a fieldset element as its parent, then this attribute returns the same value as the form attribute on the parent fieldset element. otherwise, it returns null. htmllegendelement.accesskey is a domstring representing a single-character access key to give access to the element. htmllegendelement.align is a domstring representing the alignment relative to the form set methods no specific method; inherits methods from its parent, htmlelement. specifications ...
HTMLLinkElement.as - Web APIs
specifications specification status comment preloadthe definition of 'as' in that specification. candidate recommendation initial definition. ...
HTMLMapElement - Web APIs
e mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlmapelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlmapelement.name is a domstring representing the <map> element for referencing it other context. if the id attribute is set, this must have the same value; and it cannot be null or empty. htmlmapelement.areas read only is a live htmlcollection representing the <area> elements associated to this <map>. methods no specific method; inherits methods from its parent, htmlelement . specifications specification status comment html living standardthe definition of 'htmlmapelement' in that specification. living standard ...
HTMLMediaElement.audioTracks - Web APIs
tracks are added to and removed from the media element, the list's contents change dynamically. once you have a reference to the list, you can monitor it for changes to detect when new audio tracks are added or existing ones removed. see event handlers in audiotracklist to learn more about watching for changes to a media element's track list. syntax var audiotracks = mediaelement.audiotracks; value a audiotracklist object representing the list of audio tracks included in the media element. the list of tracks can be accessed using array notation, or using the object's gettrackbyid() method. each track is represented by a audiotrack 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...
HTMLMediaElement.buffered - Web APIs
the htmlmediaelement.buffered read-only property returns a new timeranges object that indicates the ranges of the media source that the browser has buffered (if any) at the moment the buffered property is accessed. note: this feature is not available in web workers. syntax var 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 ...
HTMLMediaElement.canPlayType() - Web APIs
the htmlmediaelement method canplaytype() reports how likely it is that the current browser will be able to play media of a given mime type. note: this feature is not available in web workers. syntax canplayresponse = audioorvideo.canplaytype(mediatype); parameters mediatype a domstring containing the mime type of the media. return value a domstring indicating how likely it is that the media can be played. the string will be one of the following values: probably media of the type indicated by the mediatype parameter is probably playable on this device. maybe not enough information is available to determine for sure whether or not the media will play until playback is actually attempted. "" (empty string) media of the given type definitely can't be played on the current devi...
HTMLMediaElement.captureStream() - Web APIs
the capturestream() property of the htmlmediaelement interface returns a mediastream object which is streaming a real-time capture of the content being rendered in the media element. this can be used, for example, as a source for a webrtc rtcpeerconnection. syntax var mediastream = mediaelement.capturestream() parameters none. return value a mediastream object which can be used as a source for audio and/or video data by other media processing code, or as a source for webrtc. example in this example, an event handler is established so that clicking a button starts capturing the contents of a media element with the id "playback" into a mediastream. the stream can then be used for other purposes—like a source for streaming over webrtc, to allow sharing prerecorded videos with another p...
HTMLMediaElement.controller - Web APIs
the default is null. example ... ...
HTMLMediaElement.controls - Web APIs
the htmlmediaelement.controls property reflects the controls html attribute, which controls whether user interface controls for playing the media item will be displayed. syntax var ctrls = video.controls; audio.controls = true; value a boolean. a value of true means controls will be displayed. example var obj = document.createelement('video'); obj.controls = true; specifications specification status comment html living standardthe definition of 'htmlmediaelement.controls' in that specification. living standard no change from html5 html5the definition of 'htmlmediaelement.controls' in that specification. recommendation initial definition. ...
HTMLMediaElement.controlsList - Web APIs
the controlslist property of the htmlmediaelement interface returns a domtokenlist that helps the user agent select what controls to show on the media element whenever the user agent shows its own set of controls. the domtokenlist takes one or more of three possible values: nodownload, nofullscreen, and noremoteplayback. syntax var domtokenlist = htmlmediaelement.controlslist; value a domtokenlist. specifications specification status comment controls list api: solution outline 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 explor...
HTMLMediaElement.currentSrc - Web APIs
the htmlmediaelement.currentsrc property contains the absolute url of the chosen media resource. this could happen, for example, if the web server selects a media file based on the resolution of the user's display. the value is an empty string if the networkstate property is empty. syntax var mediaurl = audioobject.currentsrc; value a domstring object containing the absolute url of the chosen media source; this may be an empty string if networkstate is empty; otherwise, it will be one of the resources listed by the htmlsourceelement contained within the media element, or the value or src if no <source> element is provided. example var obj = document.createelement('video'); console.log(obj.currentsrc); // "" specifications specification status comment html livin...
HTMLMediaElement.defaultMuted - Web APIs
the htmlmediaelement.defaultmuted property reflects the muted html attribute, which indicates whether the media element's audio output should be muted by default. this property has no dynamic effect. to mute and unmute the audio output, use the muted property. syntax var dmuted = video.defaultmuted; audio.defaultmuted = true; value a boolean. a value of true means that the audio output will be muted by default. example var videoele = document.createelement('video'); videoele.defaultmuted = true; console.log(videoele.outerhtml); // <video muted=""></video> specifications specification status comment html living standardthe definition of 'htmlmediaelement.defaultmuted' in that specification. living standard no change from html5 html5the definition...
HTMLMediaElement.defaultPlaybackRate - Web APIs
the htmlmediaelement.defaultplaybackrate property indicates the default playback rate for the media. syntax var dspeed = video.defaultplaybackrate; audio.defaultplaybackrate = 1.0; value a double. 1.0 is "normal speed," values lower than 1.0 make the media play slower than normal, higher values make it play faster. the value 0.0 is invalid and throws a not_supported_err exception. example var obj = document.createelement('video'); console.log(obj.defaultplaybackrate); // 1 specifications specification status comment html living standardthe definition of 'htmlmediaelement.defaultplaybackrate' in that specification. living standard no change from html5 html5the definition of 'htmlmediaelement.defaultplaybackrate' in that specification. recommen...
HTMLMediaElement.disableRemotePlayback - Web APIs
the htmlmediaelement.disableremoteplayback property determines whether the media element is allowed to have a remote playback ui. syntax var remoteplaybackdisabled ​= element.disableremoteplayback; value a boolean indicating whether the media element may have a remote playback ui. (false means "not disabled", which means "enabled") example var obj = document.createelement('audio'); obj.disableremoteplayback = true; specifications specification status comment remote playback apithe definition of 'disableremoteplayback' in that specification. candidate recommendation initial definition. ...
HTMLMediaElement.duration - Web APIs
the read-only htmlmediaelement property duration indicates the length of the element's media in seconds. 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. living standard html5the definition of 'htmlmediaelement.duration' in that specification. recommendation ...
HTMLMediaElement.error - Web APIs
the htmlmediaelement.error is the mediaerror object for the most recent error, or null if there has not been an error. when an error event is received by the element, you can determine details about what happened by examining this object. syntax var myerror = htmlmediaelement.error; value a mediaerror object describing the most recent error to occur on the media element or null if no errors have occurred. example this example establishes a video element and adds an error handler to it; the error handler simply logs the details to console. var videoelement = document.createelement('video'); videoelement.onerror = function() { console.log("error " + videoelement.error.code + "; details: " + videoelement.error.message); } videoelement.src = "https://example.com/bogusvideo.mp4"; specifi...
HTMLMediaElement.fastSeek() - Web APIs
example this example quickly seeks to 20-second position of the video element. ...
HTMLMediaElement.initialTime - Web APIs
the htmlmediaelement.initialtime is the initial playback position in seconds. this property is obsolete, you can use a media fragments uri in the htmlmediaelement.src attribute instead. syntax ... value a double. example ... specifications this was previously defined within the whatwg html living standard, though was removed because of missing use cases. ...
HTMLMediaElement.load() - Web APIs
the htmlmediaelement method load() resets the media element to its initial state and begins the process of selecting a media source and loading the media in preparation for playback to begin at the beginning. the amount of media data that is prefetched is determined by the value of the element's preload attribute. this method is generally only useful when you've made dynamic changes to the set of sources available for the media element, either by changing the element's src attribute or by adding or removing <source> elements nested within the media element itself. load() will reset the element and rescan the available sources, thereby causing the changes to take effect. syntax mediaelement.load(); parameters none. return value undefined. usage notes calling load() aborts all ongoing o...
HTMLMediaElement.loop - Web APIs
the htmlmediaelement.loop property reflects the loop html attribute, which controls whether the media element should start over when it reaches the end. syntax var loop = video.loop; audio.loop = true; value a boolean. example var obj = document.createelement('video'); obj.loop = true; // true specifications specification status comment html living standardthe definition of 'htmlmediaelement.loop' in that specification. living standard html5the definition of 'htmlmediaelement.loop' in that specification. recommendation ...
HTMLMediaElement.mediaGroup - Web APIs
the htmlmediaelement.mediagroup property reflects the mediagroup html attribute, which indicates the name of the group of elements it belongs to. a group of media elements shares a common controller. syntax ... value a domstring. example ... specifications specification status comment html5the definition of 'htmlmediaelement.mediagroup' in that specification. recommendation initial definition. ...
msClearEffects - Web APIs
here may also be large incompatibilities between implementations and the behavior may change in the future. the mscleareffects method of the htmlmediaelement, is a proprietary method specific to internet explorer and microsoft edge. mscleareffects clears all effects from the media pipeline. syntax htmlmediaelement.mscleareffects(); parameters this method has no parameters. return value this method does not return a value. see also touch api microsoft api extensions ...
HTMLMediaElement.msInsertAudioEffect() - Web APIs
icrosoft edge. syntax htmlmediaelement.msinsertaudioeffect(activatableclassid: domstring, effectrequired: boolean, config); parameters activatableclassid a domstring defining the audio effects class. effectrequired a boolean which if set to true requires an audio effect to be defined. configoptional an optional object to help with defining any additional configuration needed. return value this method does not return a value. see also htmlmediaelement microsoft api extensions ...
HTMLMediaElement.muted - Web APIs
true means muted and false means not muted. example var obj = document.createelement('video'); console.log(obj.muted); // false specifications specification status comment html living standardthe definition of 'htmlmediaelement.muted' in that specification. ...
HTMLMediaElement.networkState - Web APIs
also, readystate is have_nothing. network_idle 1 htmlmediaelement is active and has selected a resource, but is not using the network. network_loading 2 the browser is downloading htmlmediaelement data. network_no_source 3 no htmlmediaelement src found. ...
HTMLMediaElement.onerror - Web APIs
the onerror property of the htmlmediaelement interface is the eventhandler for processing error events. the error event fires when some form of error occurs while attempting to load or perform the media. syntax htmlmediaelement.onerror = eventlistener; value a function which serves as the event handler for the error event. when an error occurs, the specified function will be called. if null, no error handler is in effect. specifications specification status comment html living standardthe definition of 'onerror' in that specification. living standard ...
HTMLMediaElement.pause() - Web APIs
exceptions none. ...
HTMLMediaElement.paused - Web APIs
true is paused and false is not paused. example var obj = document.createelement('video'); console.log(obj.paused); // true specifications specification status comment html living standardthe definition of 'htmlmediaelement.paused' in that specification. ...
HTMLMediaElement.play() - Web APIs
the htmlmediaelement play() method attempts to begin playback of the media. it returns a promise which is resolved when playback has been successfully started. failure to begin playback for any reason, such as permission issues, result in the promise being rejected. syntax var promise = htmlmediaelement.play(); parameters none. return value a promise which is resolved when playback has been started, or is rejected if for any reason playback cannot be started. note: older browsers may not return a value from play(). exceptions the promise's rejection handler is called with an exception name passed in as its sole input parameter (as opposed to a traditional exception being thrown). possible errors include: notallowederror the user agent (browser) or operating system doesn't allow ...
HTMLMediaElement.readyState - Web APIs
have_metadata 1 enough of the media resource has been retrieved that the metadata attributes are initialized. seeking will no longer raise an exception. have_current_data 2 data is available for the current playback position, but not enough to actually play more than one frame. ...
HTMLMediaElement.seekToNextFrame() - Web APIs
ent to let interested parties know that a seek has taken place. if the seek fails because the media is already at the last frame, a seeked event occurs, followed immediately by an ended event. if there is no video on the media element, or the media isn't seekable, nothing happens. syntax var seekcompletepromise = htmlmediaelement.seektonextframe(); htmlmediaelement.seektonextframe(); return value a promise which is fulfilled once the seek operation has completed. firefox 49 returns undefined instead of a promise, and performs the seek operation synchronously. specifications not part of any specification. ...
HTMLMediaElement.seekable - Web APIs
the seekable read-only property of the 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 specifi...
HTMLMediaElement.sinkId - Web APIs
the htmlmediaelement.sinkid read-only property returns a domstring that is the unique id of the audio device delivering output. if it is using the user agent default, it returns an empty string. this id should be one of the mediadeviceinfo.deviceid values returned from mediadevices.enumeratedevices(), id-multimedia, or id-communications. syntax var sinkid = htmlmediaelement.sinkid specifications specification status comment audio output devices apithe definition of 'sinkid' in that specification. candidate recommendation initial definition. older versions of this spec were called "media capture output". ...
HTMLMediaElement.src - Web APIs
the htmlmediaelement.src property reflects the value of the html media element's src attribute, which indicates the url of a media resource to use in the element. note: the best way to know the url of the media resource currently in active use in this element is to look at the value of the currentsrc attribute, which also takes into account selection of a best or preferred media resource from a list provided in an htmlsourceelement (which represents a <source> element). syntax var mediaurl = htmlmediaelement.src; value a usvstring object containing the url of a media resource to use in the element; this property reflects the value of the html element's src attribute. example var obj = document.createelement('video'); console.log(obj.src); // "" specifications specification...
HTMLMediaElement.srcObject - Web APIs
ts from blob). note: as of march 2020, only safari supports setting objects other than mediastream. until other browsers catch up, for mediasource, blob and file, consider falling back to creating a url with url.createobjecturl() and assign it to htmlmediaelement.src. see below for an example. syntax var sourceobject = htmlmediaelement.srcobject; htmlmediaelement.srcobject = sourceobject; value a mediastream, mediasource, blob, or file object (though see the compatibility table for what is actually supported). usage notes older versions of the media source specification required using createobjecturl() to create an object url then setting src to that url. now you can just set srcobject to the mediastream directly. examples basic example in this example, a mediastream from a camera...
HTMLMedia​Element​.textTracks - Web APIs
s tracks are added to and removed from the media element, the list's contents change dynamically. once you have a reference to the list, you can monitor it for changes to detect when new text tracks are added or existing ones removed. see event handlers in texttracklist to learn more about watching for changes to a media element's track list. syntax var texttracks = mediaelement.texttracks; value a texttracklist object representing the list of text tracks included in the media element. the list of tracks can be accessed using array notation, or using the object's gettrackbyid() method. each track is represented by a texttrack object which provides information about the track. examples we start with a <video> that has several <track> children <video controls poster="/images/sample.gi...
HTMLMediaElement.videoTracks - Web APIs
tracks are added to and removed from the media element, the list's contents change dynamically. once you have a reference to the list, you can monitor it for changes to detect when new video tracks are added or existing ones removed. see event handlers in videotracklist to learn more about watching for changes to a media element's track list. syntax var videotracks = mediaelement.videotracks; value a videotracklist object representing the list of video tracks included in the media element. the list of tracks can be accessed using array notation, or using the object's gettrackbyid() method. each track is represented by a videotrack object which provides information about the track. specifications specification status comment html living standardthe definition of '...
HTMLMediaElement.volume - Web APIs
example var obj = document.createelement('audio'); console.log(obj.volume); // 1 obj.volume = 0.75; specifications specification status comment html living standardthe definition of 'htmlmediaelement.volume' in that specification. ...
HTMLMetaElement - Web APIs
416" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlmetaelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. name type description content domstring gets or sets the value of meta-data property. httpequiv domstring gets or sets the name of an http response header to define for a document. name domstring gets or sets the name of a meta-data property to define for a document. scheme domstring gets or sets the name of a scheme used to interpret the value of a meta-data property. methods no specific method; inherit...
HTMLObjectElement.checkValidity - Web APIs
the checkvalidity() method of the htmlobjectelement interface returns a boolean that always is true, because object objects are never candidates for constraint validation. syntax const valid = htmlobjectelement.checkvalidity(); parameters none. return value true exceptions none. specifications specification status comment html living standardthe definition of 'checkvalidity' in that specification. living standard initial definition. ...
HTMLObjectElement.contentDocument - Web APIs
the contentdocument read-only property of the htmlobjectelement interface returns a document representing the active document of the object element's nested browsing context, if any; otherwise null. syntax var document = htmlobjectelement.contentdocument; value a document. specifications specification status comment html living standardthe definition of 'contentdocument' in that specification. living standard initial definition. ...
HTMLObjectElement.contentWindow - Web APIs
the contentwindow read-only property of the htmlobjectelement interface returns a windowproxy representing the window proxy of the object element's nested browsing context, if any; otherwise null. syntax var windowproxy = htmlobjectelement.contentwindow; value a windowproxy. specifications specification status comment html living standardthe definition of 'contentwindow' in that specification. living standard initial definition. ...
HTMLObjectElement.data - Web APIs
the data property of the htmlobjectelement interface returns a domstring that reflects the data html attribute, specifying the address of a resource's data. syntax var data = htmlobjectelement.data; htmlobjectelement.data; value a domstring. specifications specification status comment html living standardthe definition of 'data' in that specification. living standard initial definition. ...
HTMLObjectElement.form - Web APIs
the form read-only property of the htmlobjectelement interface retuns a htmlformelement representing the object element's form owner, or null if there isn't one. syntax var htmlformelement = htmlobjectelement.form; value a htmlformelement. specifications specification status comment html living standardthe definition of 'form' in that specification. living standard initial definition. ...
HTMLObjectElement.height - Web APIs
the height property of the htmlobjectelement interface returns a domstring that reflects the height html attribute, specifying the displayed height of the resource in css pixels. syntax var string = htmlobjectelement.height; htmlobjectelement.height = string; value a domstring. specifications specification status comment html living standardthe definition of 'height' in that specification. living standard initial definition. ...
HTMLObjectElement.name - Web APIs
the name property of the htmlobjectelement interface returns a domstring that reflects the name html attribute, specifying the name of the browsing context. syntax var string = htmlobjectelement.name; htmlobjectelement.name = string; value a domstring. specifications specification status comment html living standardthe definition of 'name' in that specification. living standard initial definition. ...
HTMLObjectElement.type - Web APIs
the type property of the htmlobjectelement interface returns a domstring that reflects the type html attribute, specifying the mime type of the resource. syntax var string = htmlobjectelement.type htmlobjectelement.type = string; value a domstring. specifications specification status comment html living standardthe definition of 'type' in that specification. living standard initial definition. ...
HTMLObjectElement.useMap - Web APIs
the usemap property of the htmlobjectelement interface returns a domstring that reflects the usemap html attribute, specifying a <map> element to use. syntax var string = htmlobjectelement.usemap; htmlobjectelement.usemap = string; value a domstring. specifications specification status comment html living standardthe definition of 'usemap' in that specification. living standard initial definition. ...
HTMLObjectElement.validationMessage - Web APIs
age read-only property of the htmlobjectelement interface returns a domstring representing 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 constraint validation (willvalidate is false), or it satisfies its constraints. syntax var string = htmlobjectelement.validationmessage; value a domstring. specifications specification status comment html living standardthe definition of 'validationmessage' in that specification. living standard initial definition. ...
HTMLObjectElement.validity - Web APIs
the validity read-only property of the htmlobjectelement interface returns a validitystate with the validity states that this element is in. syntax var validitystate = htmlobjectelement.validity; value a validitystate object. specifications specification status comment html living standardthe definition of 'validity' in that specification. living standard initial definition. ...
HTMLObjectElement.width - Web APIs
the width property of the htmlobjectelement interface returns a domstring that reflects the width html attribute, specifying the displayed width of the resource in css pixels. syntax var string = htmlobjectelement.width; htmlobjectelement.width = string; value a domstring. specifications specification status comment html living standardthe definition of 'width' in that specification. living standard initial definition. ...
HTMLObjectElement.willValidate - Web APIs
the willvalidate read-only property of the htmlobjectelement interface returns a boolean that indicates whether the element is a candidate for constraint validation. always false for htmlobjectelement objects. syntax var boolean = htmlobjectelement.willvalidate; value a boolean. specifications specification status comment html living standardthe definition of 'willvalidate' in that specification. living standard initial definition. ...
HTMLObjectElement - Web APIs
53" text-anchor="middle" alignment-baseline="middle">htmlobjectelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlobjectelement.align is a domstring representing an enumerated property indicating alignment of the element's contents with respect to the surrounding context. the possible values are "left", "right", "justify", and "center". htmlobjectelement.archive is a domstring that reflects the archive html attribute, containing a list of archives for resources for this object. htmlobjectelement.border is a domstring that reflects the border html attribute, specifying the width of a border around the object. htmlobjectelement.code is a domstring representing the name of ...
HTMLOptionsCollection - Web APIs
ono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmloptionscollection</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties name type description length unsigned long as optionally allowed by the spec, this property isn't read-only. 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 specification status comment html living standardthe definition of 'htmloptionscollection' in that specification. living sta...
HTMLElement.blur() - Web APIs
the htmlelement.blur() method removes keyboard focus from the current element. syntax element.blur(); examples remove focus from a text input html <input type="text" id="mytext" value="sample text"> <br><br> <button type="button" onclick="focusinput()">click me to gain focus</button> <button type="button" onclick="blurinput()">click me to lose focus</button> javascript function focusinput() { document.getelementbyid('mytext').focus(); } function blurinput() { document.getelementbyid('mytext').blur(); } result specification specification status comment html living standardthe definition of 'blur' in that specification. living standard html 5.1the definition of 'blur' in that specification. recommendation html5the defin...
HTMLOrForeignElement.nonce - Web APIs
the nonce property of the htmlorforeignelement interface returns the cryptographic number used once that is used by content security policy to determine whether a given fetch will be allowed to proceed. in later implementations, elements only expose their nonce attribute to scripts (and not to side-channels like css attribute selectors). examples retrieving a nonce value in the past, not all browsers supported the nonce idl attribute, so a workaround is to try to use getattribute as a fallback: let nonce = script['nonce'] || script.getattribute('nonce'); however, recent browsers version hide nonce values that are accessed this way (an empty string will be returned). the idl property (script['nonce']) will be the only way to access nonces. nonce hiding helps preventing that attackers exf...
HTMLOutputElement.labels - Web APIs
the htmloutputelement.labels read-only property returns a nodelist of the <label> elements associated with the <output> element. syntax var labelelements = output.labels; 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 specific...
HTMLParagraphElement - Web APIs
text-anchor="middle" alignment-baseline="middle">htmlparagraphelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlparagraphelement.align a domstring representing an enumerated property indicating alignment of the element's contents with respect to the surrounding context. the possible values are "left", "right", "justify", and "center". methods no specific methods, inherits methods from its parent, htmlelement. specifications specification status comment html living standardthe definition of 'htmlparagraphelement' in that specification. living standard html5the definition of 'htmlparagraphelement' in that specification. recommendation...
HTMLPreElement - Web APIs
f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="421" y="94" font-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 ...
HTMLSelectElement.form - Web APIs
nt.form read-only property returns a htmlformelement representing the form that this element is associated with. if the element is not associated with of a <form> element, then it returns null. syntax edit aform = aselectelement.form.selectname; example html <form action="http://www.google.com/search" method="get"> <label>google: <input type="search" name="q"></label> <input type="submit" value="search..."> </form> javascript a property available on all form elements, "type" returns the type of the calling form element. for select, the two possible values are "select-one" or "select-multiple", depending on the type of selection list. the below code gives all select elements in a particular form a css class of "selectclass": <script type="text/javascript"> var form_element = document.
HTMLSelectElement.item() - Web APIs
to the htmloptionelement whose position in the options list corresponds to the index given in the parameter, or null if there are none. in javascript, using the array bracket syntax with an unsigned long, like selectelt[index] is equivalent to selectelt.nameditem(index). syntax var item = collection.item(index); var item = collection[index]; parameters index is an unsigned long. return value item is a htmloptionelement. examples html <form> <select id="myformcontrol" type="textarea"> <option id="o1">opt 1</option> <option id="o2">opt 2</option> </select> </form> javascript // returns the htmloptionelement representing #o2 elem1 = document.forms[0]['myformcontrol'][1]; specifications specification status comment html living standardthe ...
HTMLSelectElement.namedItem() - Web APIs
the htmlselectelement.nameditem() method returns the htmloptionelement corresponding to the htmloptionelement whose name or id match the specified name, or null if no option matches. in javascript, using the array bracket syntax with a string, like selectelt["value"] is equivalent to selectelt.nameditem("value"). syntax var item = collection.nameditem(str); var item = collection[str]; parameters str is a domstring. return value item is a htmloptionelement. example html <form> <select id="myformcontrol"> <option id="o1">opt 1</option> <option id="o2">opt 2</option> </select> </form> javascript elem1 = document.forms[0]['myformcontrol']['o1']; // returns the htmloptionelement representing #o1 specifications specification status comment h...
HTMLSelectElement.selectedIndex - Web APIs
the htmlselectelement.selectedindex is a long that reflects the index of the first or last selected <option> element, depending on the value of multiple. the value -1 indicates that no element is selected. syntax var index = selectelem.selectedindex; selectelem.selectedindex = index; example html <p id="p">selectedindex: 0</p> <select id="select"> <option selected>option a</option> <option>option b</option> <option>option c</option> <option>option d</option> <option>option e</option> </select> javascript var selectelem = document.getelementbyid('select') var pelem = document.getelementbyid('p') // when a new <option> is selected selectelem.addeventlistener('change', function() { var index = selectelem.selectedindex; // add that data to the <p> pelem.innerhtml = 'sele...
HTMLSelectElement.type - Web APIs
the htmlselectelement.type read-only property returns the form control's type. syntax var str = selectelt.type; the possible values are: "select-multiple" if multiple values can be selected. "select-one" if only one value can be selected. example switch (select.type) { case 'select-multiple': // multiple values may be selected break; case 'select-one': // only one value may be selected break; default: // non-standard value (or this isn't a select element) } specifications specification status comment html living standardthe definition of 'htmlselectelement' in that specification. living standard no change from html5, the latest snapshot. html5the definition of 'htmlselectelement' in that specification. recommendat...
HTMLSlotElement.assignedElements() - Web APIs
it returns the slot's fallback content. syntax var assignedelements = htmlslotelement.assignedelements(options) parameters options optional an object that sets options for the nodes to be returned. the available options are: flatten: a boolean indicating whether to return the assigned elements of any available child <slot> elements (true) or not (false). defaults to false. return value an array of elements. examples let slots = this.shadowroot.queryselector('slot'); let elements = slots.assignedelements({flatten: true}); specifications specification status comment html living standardthe definition of 'assignedelements()' in that specification. living standard browser compatibility the compatibility table on this page is genera...
HTMLSlotElement.assignedNodes() - Web APIs
e found, it returns the slot's fallback content. syntax var assignednodes = htmlslotelement.assignednodes(options) parameters options optional an object that sets options for the nodes to be returned. the available options are: flatten: a boolean indicating whether to return the assigned nodes of any available child <slot> elements (true) or not (false). defaults to false. return value an array of nodes. examples the following snippet is taken from our slotchange example (see it live also). let slots = this.shadowroot.queryselectorall('slot'); slots[1].addeventlistener('slotchange', function(e) { let nodes = slots[1].assignednodes(); console.log('element in slot "' + slots[1].name + '" changed to "' + nodes[0].outerhtml + '".'); }); here we grab references to all the s...
HTMLSlotElement.name - Web APIs
examples the following snippet is taken from our slotchange example (see it live also). ...
HTMLStyleElement - Web APIs
a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement, and implements linkstyle. htmlstyleelement.media is a domstring representing the intended destination medium for style information. htmlstyleelement.type is a domstring representing the type of style being applied by this statement. htmlstyleelement.disabled is a boolean value representing whether or not the stylesheet is disabled (true) or not (false). linkstyle.sheet read only returns the stylesheet object associated with the given element, or null if there is none htmlstyleelement.scoped is a boolean value indicating if the element applies to the whole document (false) or only to the parent's sub-tree (true). methods no specific method; inherits properti...
HTMLTableElement.align - Web APIs
the htmltableelement.align property represents the alignment of the table. syntax htmltableelement.align = alignment; var alignment = htmltableelement.align; parameters alignment domstring with one of the following values: left center right example // set the alignmnet of a table var t = document.getelementbyid('tablea'); t.align = 'center'; specification w3c dom 2 html specification htmltableelement .align. ...
HTMLTableElement.bgColor - Web APIs
lement.bgcolor property represents the background color of the table. the bgcolor attribute is deprecated in html 4.01. the css background-color property should be used instead by modifying the element's style object or using a style rule. also available on dom tbody, row and cell objects. syntax color = table.bgcolor table.bgcolor = color parameters color is a string representing a color value. example // set table background colour to lightblue var t = document.getelementbyid('tablea'); t.bgcolor = 'lightblue'; specification dom level 2 html:htmltableelement .bgcolor ...
HTMLTableElement.cellPadding - Web APIs
the htmltableelement.cellpadding property represents the padding around the individual cells of the table. syntax htmltableelement.cellpadding = padding; var padding = htmltableelement.cellpadding; padding is either a number of pixels (e.g. "10") or a percentage value (e.g. "10%"). example // set cell padding to 10 pixels let t = document.getelementbyid('tablea'); t.cellpadding = '10'; specification w3c dom 2 html specification htmltableelement .cellpadding. ...
HTMLTableElement.cellSpacing - Web APIs
hile you should instead use the css border-spacing property, the obsolete htmltableelement interface's cellspacing property represents the spacing around the individual <th> and <td> elements representing a table's cells. any two cells are separated by the sum of the cellspacing of each of the two cells. syntax htmltableelement.cellspacing = spacing; var spacing = htmltableelement.cellspacing; value a domstring which is either a number of pixels (such as "10") or a percentage value (like "10%"). example this example sets cell spacing for a given table to 10 pixels. var t = document.getelementbyid('tablea'); t.cellspacing = "10"; specification w3c dom 2 html specification htmltableelement .cellspacing. ...
HTMLTableElement.createCaption() - Web APIs
table>. if no <caption> element exists on the table, this method creates it, and then returns it. note: if no caption exists, createcaption() inserts a new caption directly into the table. the caption does not need to be added separately as would be the case if document.createelement() had been used to create the new <caption> element. syntax htmltableelement = table.createcaption(); return value htmltablecaptionelement example this example uses javascript to add a caption to a table that initially lacks one. html <table> <tr><td>cell 1.1</td><td>cell 1.2</td><td>cell 1.3</td></tr> <tr><td>cell 2.1</td><td>cell 2.2</td><td>cell 2.3</td></tr> </table> javascript let table = document.queryselector('table'); let caption = table.createcaption(); caption.textcontent = 'this caption ...
HTMLTableElement.createTFoot() - Web APIs
th a given <table>. if no footer exists in the table, this methods creates it, and then returns it. note: if no footer exists, createtfoot() inserts a new footer directly into the table. the footer does not need to be added separately as would be the case if document.createelement() had been used to create the new <tfoot> element. syntax htmltablesectionelement = table.createtfoot(); return value htmltablesectionelement example let myfoot = mytable.createtfoot(); // now this should be true: myfoot == mytable.tfoot specifications specification status comment html living standardthe definition of 'htmltableelement: createtfoot' in that specification. living standard ...
HTMLTableElement.createTHead() - Web APIs
ith a given <table>. if no header exists in the table, this method creates it, and then returns it. note: if no header exists, createthead() inserts a new header directly into the table. the header does not need to be added separately as would be the case if document.createelement() had been used to create the new <thead> element. syntax htmltablesectionelement = table.createthead(); return value htmltablesectionelement example let myhead = mytable.createthead(); // now this should be true: myhead == mytable.thead specifications specification status comment html living standardthe definition of 'htmltableelement: createthead' in that specification. living standard ...
HTMLTableElement.deleteRow() - Web APIs
the htmltableelement.deleterow() method removes a specific row (<tr>) from a given <table>. syntax htmltableelement.deleterow(index) parameters index index is an integer representing the row that should be deleted. however, the special index -1 can be used to remove the very last row of a table. return value no return value errors thrown if the number of the row to delete, specified by the parameter, is greater or equal to the number of available rows, or if it is negative and not equal to the special index -1, representing the last row of the table, the exception index_size_err is thrown. example this example uses javascript to delete a table's second row. html <table> <tr><td>cell 1.1</td><td>cell 1.2</td><td>cell 1.3</td></tr> <tr><td>cell 2.1</td><td>cell 2.2</td><td>c...
HTMLTableElement.insertRow() - Web APIs
. syntax var newrow = htmltableelement.insertrow(index); htmltableelement is a reference to an html <table> element. parameters index optional the row index of the new row. if index is -1 or equal to the number of rows, the row is appended as the last row. if index is greater than the number of rows, an indexsizeerror exception will result. if index is omitted it defaults to -1. return value newrow is an htmltablerowelement that references the new row. example this example uses insertrow(-1) to append a new row to a table. we then use htmltablerowelement.insertcell() to insert a new cell in the new row. (to be valid html, a <tr> must have at least one <td> element.) finally, we add some text to the cell using document.createtextnode() and node.appendchild(). html <table id="my-...
HTMLTableElement.rows - Web APIs
the read-only htmltableelement property rows returns a live htmlcollection of all the rows in the table, including the rows contained within any <thead>, <tfoot>, and <tbody> elements. although the property itself is read-only, the returned object is live and allows the modification of its content. 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 htmlcollecti...
HTMLTableElement.rules - Web APIs
the htmltableelement.rules property indicates which cell borders to render in the table. ...
HTMLTableElement.tFoot - Web APIs
syntax htmltablesectionelementobject = table.tfoot table.tfoot = htmltablesectionelementobject example if (table.tfoot == my_foot) { // ... } specifications specification status comment html living standardthe definition of 'htmltableelement.tfoot' in that specification. living standard no change from html5 html5the definition of 'htmltableelement.tfoot' in that specification. ...
HTMLTableElement.tHead - Web APIs
syntax thead_element = table.thead; table.thead = thead_element; parameters thead_element is a htmltablesectionelement. example if (table.thead == my_head_el) { // ... } specifications specification status comment html living standardthe definition of 'htmltableelement.thead' in that specification. living standard no change from html5 html5the definition of 'htmltableelement.thead' in that specification. ...
HTMLTableElement.width - Web APIs
example mytable.width = "75%"; ...
HTMLTableRowElement.insertCell() - Web APIs
blerowelement.insertcell(index); htmltablerowelement is a reference to an html <tr> element. parameters index optional index is the cell index of the new cell. if index is -1 or equal to the number of cells, the cell is appended as the last cell in the row. if index is greater than the number of cells, an indexsizeerror exception will result. if index is omitted it defaults to -1. return value newcell is an htmltablecellelement that references the new cell. example this example uses htmltableelement.insertrow() to append a new row to a table. we then use insertcell(0) to insert a new cell in the new row. (to be valid html, a <tr> must have at least one <td> element.) finally, we add some text to the cell using document.createtextnode() and node.appendchild(). html <table id="my-t...
HTMLTableRowElement.rowIndex - Web APIs
the htmltablerowelement.rowindex read-only property represents the position of a row in relation to the whole <table>. even when the <thead>, <tbody>, and <tfoot> elements are out of order in the html, browsers render the table in the right order. therefore the rows count from <thead> to <tbody>, from <tbody> to <tfoot>. syntax var index = htmltablerowelement.rowindex value returns the index of the row, or -1 if the row is not part of a table. example this example uses javascript to label all the row numbers in a table. html <table> <thead> <tr><th>item</th> <th>price</th></tr> </thead> <tbody> <tr><td>bananas</td> <td>$2</td></tr> <tr><td>oranges</td> <td>$8</td></tr> <tr><td>top sirloin</td> <td>$20</td></tr> </tbody> <tfoot> <tr><td>tota...
HTMLTextAreaElement.labels - Web APIs
the htmltextareaelement.labels read-only property returns a nodelist of the <label> elements associated with the <textarea> element. syntax var labelelements = textarea.labels; return 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 'lab...
HTMLTimeElement.dateTime - Web APIs
the htmltimeelement.datetime property is a domstring that reflects the datetime html attribute, containing a machine-readable form of the element's date and time value. the format of the string must follow one of the following html microsyntaxes: microsyntax description examples valid month string yyyy-mm 2011-11, 2013-05 valid date string yyyy-mm-dd 1887-12-01 valid yearless date string mm-dd 11-12 valid time string hh:mm hh:mm:ss hh:mm:ss.mmm 23:59 12:15:47 12:15:52.998 valid local date and time string yyyy-mm-dd hh:mm yyyy-mm-dd hh:mm:ss yyyy-mm-dd hh:mm:ss.mmm yyyy-mm-ddthh:mm yyyy-mm-ddthh:mm:ss yyyy-mm-ddthh:mm:ss.mmm 2013-12-25 11:12 1972-07-25 13:43:07...
HTMLTimeElement - Web APIs
ale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmltimeelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmltimeelement.datetime is a domstring that reflects the datetime html attribute, containing a machine-readable form of the element's date and time value. methods no specific method; inherits methods from its parent, htmlelement. specifications specification status comment html living standardthe definition of 'htmltimeelement' in that specification. living standard html 5.1the definition of 'htmltimeelement' in that specification. recommendation no change from html5. html5the definition...
HTMLTrackElement.src - Web APIs
example // coming soon specifications specification status comment html living standardthe definition of 'htmltrackelement.src' in that specification. living standard no change from html5 html5the definition of 'htmltrackelement.src' in that specification. ...
HTMLUListElement - Web APIs
stroke="#d4dde4" stroke-width="2px" /><text x="411" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlulistelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlulistelement.type is a domstring value reflecting the type and defining the kind of marker to be used to display. the values are browser dependent and have never been standardized. htmlulistelement.compact is a boolean indicating that spacing between list items should be reduced. this property reflects the compact attribute only, it doesn't consider the line-height css property used for that behavior in modern pages. methods no...
HTMLVideoElement.msFrameStep() - Web APIs
the future. the htmlvideoelement.msframestep() method steps the video by one frame forward or one frame backward. this proprietary method is specific to internet explorer and microsoft edge. syntax htmlvideoelement.msframestep(forward); parameters forward a boolean which if set to true steps the video forward by one frame, if false steps the video backwards by one frame. return value this method does not return a value. see also htmlmediaelement microsoft api extensions ...
HTMLVideoElement.msHorizontalMirror - Web APIs
rk for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. mshorizontalmirror is a read/write property which gets or sets whether a video element is flipped horizontally in the display. this proprietary property is specific to internet explorer and microsoft edge. syntax htmlvideoelement.mshorizontalmirror: boolean; value boolean value set to true flips the video playback horizontally. video perspective is flipped on a horizontal axis - this may be useful for playback of a webcam video, providing the user with better mirroring of their real behaviors (ie. when user moves left, their representation on-screen would move left as well). example var myvideo = document.getelementbyid("videotag1"); myvi...
HTMLVideoElement.msInsertVideoEffect() - Web APIs
oft edge. syntax str = htmlmediaelement.msinsertvideoeffect(activatableclassid: domstring, effectrequired: boolean, config); parameters activatableclassid a domstring defining the video effects class. effectrequired a boolean which if set to true requires a video effect to be defined. configoptional an optional object to help with defining any additional configuration needed. return value this method does not return a value. example var ovideo1 = document.getelementbyid("video1"); ovideo1.msinsertvideoeffect("windows.media.videoeffects.videostabilization", true, null); see also htmlvideoelement microsoft api extensions ...
HTMLVideoElement.msIsLayoutOptimalForPlayback - Web APIs
every user. there may also be large incompatibilities between implementations and the behavior may change in the future. msislayoutoptimalforplayback is a read-only property which indicates whether the video can be rendered more efficiently. this proprietary property is specific to internet explorer and microsoft edge. syntax htmlvideoelement.msislayoutoptimalforplayback: domstring; value boolean value set to true indicates that video is being rendered optimally (better performance and using less battery power). if false, improvements can be made to optimize performance. for msislayoutoptimalforplayback to be true, avoid the following: video elements with cascading style sheets (css) outlines set. rendering a video element through a canvas element. embedding video elements ...
HTMLVideoElement.msIsStereo3D - Web APIs
msisstereo3d is a read-only property which determines whether the system considers the loaded video source to be stereo 3-d or not. this proprietary property is specific to internet explorer and microsoft edge. syntax htmlvideoelement.msisstereo3d: boolean; value boolean value set to true indicates that the video source is stereo 3d. this uses metadata set in mp4 or mpeg-2 file containers and h.264 supplemental enhancement information (sei) messages to determine the stereo capability of the source. ...
msSetVideoRectangle - Web APIs
hod sets the dimensions of a sub-rectangle within a video. this proprietary method is specific to internet explorer and microsoft edge. syntax htmlvideoelement.mssetvideorectangle(); parameters left a number representing left-side position. top a number representing top position. right a number representing right-side position. bottom a number representing bottom position. return value this method does not return a value. example htmlvideoelement.mssetvideorectangle(left: 2, top: 0, right: 4, bottom: 4); see also htmlvideoelement microsoft api extensions ...
msStereo3DPackingMode - Web APIs
. there may also be large incompatibilities between implementations and the behavior may change in the future. msstereo3dpackingmode is a read/write property which gets or sets the frame-packing mode for stereo 3-d video content. this proprietary property is specific to internet explorer and microsoft edge. syntax htmlvideoelement.msstereo3dpackingmode(topbottom, sidebyside, none); value the following values return, or set, the stereo 3-d content packing as "topbottom", "sidebyside", or "none" for regular 2-d video. none (0): specifies regular 2-d video. topbottom (1): specifies stereo 3-d content packing and that the views are packed side-by-side in a single frame. sidebyside (2): specifies sidebyside stereo 3-d content packing and that the views are packed top-to-bottom i...
msStereo3DRenderMode - Web APIs
there may also be large incompatibilities between implementations and the behavior may change in the future. msstereo3drendermode is a read/write property which gets or sets whether the system display is set to stereo display (if stereo-capable). this proprietary property is specific to internet explorer and microsoft edge. syntax htmlvideoelement.msstereo3drendermode(mono, stereo); value the following values set the stereo display to mono or stereo. the default is mono. mono (0): specifies that stereo mode is disabled. stereo (1): specifies stereo mode is enabled. see also htmlvideoelement microsoft api extensions ...
HTMLVideoElement.msZoom - Web APIs
every user. there may also be large incompatibilities between implementations and the behavior may change in the future. mszoom is a read/write property which gets or sets whether the video frame is trimmed, on the top and bottom or left and right, to fit the video display. this proprietary property is specific to internet explorer and microsoft edge. syntax htmlvideoelement.mszoom; value boolean value set to true trims the video frame to the display space. set to false the video frame uses letter box or pillarbox to display video. if the native aspect ratio of a video frame, which is defined by the videowidth and videoheight attributes, does not match the aspect ratio of the video tag, which is defined by the width and height attributes, the video is rendered with letterbox or ...
onMSVideoFormatChanged - Web APIs
on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. onmsvideoformatchanged is an event which occurs when the video format changes. this proprietary property is specific to internet explorer and microsoft edge. ...
onMSVideoFrameStepCompleted - Web APIs
duction sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. onmsvideoframestepcompleted is an event which occurs when the video frame has been stepped forward or backward one frame. this proprietary property is specific to internet explorer and microsoft edge. ...
onMSVideoOptimalLayoutChanged - Web APIs
use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. onmsvideooptimallayoutchanged is an event which occurs when the msislayoutoptimalforplayback state changes. this proprietary property is specific to internet explorer and microsoft edge. ...
HTMLVideoElement.videoHeight - Web APIs
the htmlvideoelement interface's read-only videoheight property indicates the intrinsic height of the video, expressed in css pixels. in simple terms, this is the height of the media in its natural size. see about intrinsic width and height for more details. syntax height = htmlvideoelement.videoheight; value an integer value specifying the intrinsic height of the video in css pixels. if the element's readystate is htmlmediaelement.have_nothing, then the value of this property is 0, because neither video nor poster frame size information is yet available. about intrinsic width and height a user agent calculates the intrinsic width and height of the element's media by starting with the media's raw pixel width and height, then taking into account factors including: the media's aspect ra...
HTMLVideoElement.videoWidth - Web APIs
the htmlvideoelement interface's read-only videowidth property indicates the intrinsic width of the video, expressed in css pixels. in simple terms, this is the width of the media in its natural size. see about intrinsic width and height for more details. syntax width = htmlvideoelement.videowidth; value an integer value specifying the intrinsic width of the video in css pixels. if the element's readystate is htmlmediaelement.have_nothing, then the value of this property is 0, because neither video nor poster frame size information is yet available. about intrinsic width and height a user agent calculates the intrinsic width and height of the element's media by starting with the media's raw pixel width and height, then taking into account factors including: the media's aspect ratio. ...
Using microtasks in JavaScript with queueMicrotask() - Web APIs
simply pass the javascript function to call while the context is handling microtasks into the queuemicrotask() method, which is exposed on the global context as defined by either the window or worker interface, depending on the current execution context. queuemicrotask(() => { /* code to run in the microtask here */ }); the microtask function itself takes no parameters, and does not return a value. when to use microtasks in this section, we'll take a look at scenarios in which microtasks are particularly useful. generally, it's about capturing or checking results, or performing cleanup, after the main body of a javascript execution context exits, but before any event handlers, timeouts and intervals, or other callbacks are processed. when is that useful? the main reason to use microtas...
HashChangeEvent.newURL - Web APIs
the newurl read-only property of the hashchangeevent interface returns the new url to which the window is navigating. syntax let neweventurl = event.newurl; value a domstring. example window.addeventlistener('hashchange', function(event) { console.log('hash changed to ' + event.newurl); }); specifications specification status comment html living standardthe definition of 'hashchangeevent: newurl' in that specification. living standard ...
HashChangeEvent.oldURL - Web APIs
the oldurl read-only property of the hashchangeevent interface returns the previous url from which the window was navigated. syntax let oldeventurl = event.oldurl; value a domstring. example window.addeventlistener('hashchange', function(event) { console.log('hash changed from ' + event.oldurl); }); specifications specification status comment html living standardthe definition of 'hashchangeevent: oldurl' in that specification. living standard ...
Headers() - Web APIs
Web › API › Headers › Headers
in the last case, the new headers object inherits its data from the existing headers object. ...
Headers.delete() - Web APIs
Web › API › Headers › delete
for security reasons, some headers can only be controller by the user agent. these headers include the forbidden header names and forbidden response header names. syntax myheaders.delete(name); parameters name the name of the http header you want to delete from the headers object. returns void. ...
Headers.keys() - Web APIs
Web › API › Headers › keys
the headers.keys() method returns an iterator allowing to go through all keys contained in this object. the keys are bytestring objects. note: this method is available in web workers. syntax headers.keys(); return value returns an iterator. example // create a test headers object var myheaders = new headers(); myheaders.append('content-type', 'text/xml'); myheaders.append('vary', 'accept-language'); // display the keys for(var key of myheaders.keys()) { console.log(key); } the result is: content-type vary ...
History.go() - Web APIs
Web › API › History › go
the history.go() method loads a specific page from the session history. you can use it to move forwards and backwards through the history depending on the value of a parameter. this method is asynchronous. add a listener for the popstate event in order to determine when the navigation has completed. syntax history.go([delta]) parameters delta optional the position in the history to which you want to move, relative to the current page. a negative value moves backwards, a positive value moves forwards. so, for example, history.go(2) moves forward two pages and history.go(-2) moves back two pages. if no value is passed or if delta equals 0, it has the same result as calling location.reload(). examples to move back one page (the equivalent of calling back()): history.go(-1) to move fo...
History.scrollRestoration - Web APIs
manual the location on the page is not restored. the user will have to scroll to the location manually. examples query the current scroll restoration behavior. ...
History API - Web APIs
.go(1) similarly, you can move forward 2 pages by passing 2, and so forth. another use for the go() method is to refresh the current page by either passing 0, or by invoking it without an argument: // the following statements // both have the effect of // refreshing the page window.history.go(0) window.history.go() you can determine the number of pages in the history stack by looking at the value of the length property: let numberofentries = window.history.length interfaces history allows manipulation of the browser session history (that is, the pages visited in the tab or frame that the current page is loaded in). examples the following example assigns a listener to the onpopstate property. and then illustrates some of the methods of the history object to add, replace, and move...
HkdfParams - Web APIs
to.derivekey(), when 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 mater...
HmacImportParams - Web APIs
the hmacimportparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.importkey() 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, om...
IDBDatabase.name - Web APIs
Web › API › IDBDatabase › name
example this example shows a database connection being opened, the resulting idbdatabase object being stored in a db variable, and the name property then being logged. for a full example, see our to-do notifications app (view example live). ...
IDBDatabase.objectStoreNames - Web APIs
the objectstorenames read-only property of the idbdatabase interface is a domstringlist containing a list of the names of the object stores currently in the connected database. note: this feature is available in web workers. syntax var list[] = idbdatabase.objectstorenames; value a domstringlist containing a list of the names of the object stores currently in the connected database. example // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); // these two event handlers act on the database being opened successfully, or not dbopenrequest.onerror = function(event) { note.innerhtml += '<li>error loading database.</li>'; }; dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of openin...
IDBDatabase.onclose - Web APIs
when the database is unexpectedly closed. this can happen, for example, when the application is shut down or access to the disk the database is stored on is lost while the database is open. the close event is fired after all transactions have been aborted and the connection has been closed. note: this feature is available in web workers. syntax idbdatabase.onclose = function(event) { ... }; value a function which is called when the close event is fired. example db.onclose = function(event) { myappshowalert('the database "' + db.name + '" has unexpectedly closed.'); }; specifications specification status comment indexed database api draftthe definition of 'onclose' in that specification. recommendation browser compatibility the compatibility ...
IDBDatabase.version - Web APIs
the version property of the idbdatabase interface is a 64-bit integer that contains the version of the connected database. when a database is first created, this attribute is an empty string. note: this feature is available in web workers. syntax var myinteger = idbdatabase.version; value an integer containing the version of the connected database. example // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); // these two event handlers act on the database // being opened successfully, or not dbopenrequest.onerror = function(event) { note.innerhtml += '<li>error loading database.</li>'; }; dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variabl...
IDBDatabaseException - Web APIs
n idbdatabaseexception object represents exception conditions that can be encountered while performing database operations. attributes attribute type description code unsigned short the most appropriate error code for the condition. message domstring error message describing the exception raised. constants note: do not rely on the numeric values of the constants, which might change as the specifications continue to change. use the constant names instead. constant value description abort_err 8 a request was aborted, for example, through a call to idbtransaction.abort. constraint_err 4 a mutation operation in the transaction failed because a constraint was not satisfied. for example, an o...
IDBDatabaseSync - Web APIs
description readonly domstring the human-readable description of the connected database. name readonly domstring the name of the connected database. objectstores readonly domstringlist the names of the object stores that exist in the connected database. version readonly domstring the version of the connected database. has the null value when the database is first created. methods createobjectstore() creates and returns a new object store with the given name in the connected database. idbobjectstoresync createobjectstore( in domstring name, in domstring keypath, in optional boolean autoincrement ) raises (idbdatabaseexception); parameters name the name of a new object store. keypath the key path used by ...
databases - Web APIs
tabases method of the idbfactory interface returns a list represening all the available databases, including their names and versions. note: this feature is available in web workers. note: this method is introduced in a draft of a specifications and browser compatibility is limited. syntax const promise = indexeddb.databases() parameters the method does not take in any parameters. return value a promise that resolves either to an error or a list of dictionaries, each with two elements, name and version. name the database name. version the database version. exceptions this method may raise a domexception of the following types: attribute description securityerror the method is called from an opaque origin. other error specification does ...
IDBFactory.deleteDatabase() - Web APIs
ant to delete. note that attempting to delete a database that doesn't exist does not throw an exception, in contrast to idbdatabase.deleteobjectstore(), which does throw an exception if the named object store does not exist. optionsnon-standard in gecko, since version 26, you can include a non-standard optional storage parameter that specifies whether you want to delete a permanent (the default value) indexeddb, or an indexeddb in temporary storage (aka shared pool.) return value a idbopendbrequest on which subsequent events related to this request are fired. example var dbdeleterequest = window.indexeddb.deletedatabase("todolist"); dbdeleterequest.onerror = function(event) { console.log("error deleting database."); }; dbdeleterequest.onsuccess = function(event) { console.log("dat...
IDBFactory - Web APIs
and delete a database with this object, and not directly with idbfactory. note: this feature is available in web workers. methods idbfactory.open the current method to request opening a connection to a database. idbfactory.deletedatabase a method to request the deletion of a database. idbfactory.cmp a method that compares two keys and returns a result indicating which one is greater in value. idbfactory.databases a method that returns a list of all available databases, including their names and versions. example in the following code snippet, we make a request to open a database, and include handlers for the success and error cases. for a full working example, see our to-do notifications app (view example live.) // in the following line, you should include the prefixes of imple...
IDBIndex.getAllKeys() - Web APIs
the idbindex interface instantly retrieves the primary keys of all objects inside the index, setting them as the result of the request object. syntax var allkeysrequest = idbindex.getallkeys(); var allkeysrequest = idbindex.getallkeys(query); var allkeysrequest = idbindex.getallkeys(query, count); parameters query optional a key or an idbkeyrange identifying the keys to retrieve. if this value is null or missing, the browser will use an unbound key range. count optional the number records to return. if this value exceeds the number of records in the query, the browser will only retrieve the first item. if it is lower than 0 or greater than 232-1 a typeerror exception will be thrown. return value an idbrequest object on which subsequent events related to this operation are fired. ...
FileHandle.name - Web APIs
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. summary provides the name of the file. syntax var name = instanceoffilehandle.name value a string. specifications specification status comment filesystem api editor's draft draft proposal. ...
FileHandle.type - Web APIs
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. summary provides the mime type of the file. syntax var type = instanceoffilehandle.type value a string. specifications specification status comment filesystem api editor's draft draft proposal. ...
IDBObjectStore.delete() - Web APIs
dbcursor.delete() method to more efficiently delete the current record — without having to explicitly look up the record's key. note: this feature is available in web workers. syntax var request = objectstore.delete(key); var request = objectstore.delete(keyrange); parameters key the key of the record to be deleted, or an idbkeyrange to delete all records with keys in range. return value an idbrequest object on which subsequent events related to this operation are fired. the request.result attribute is set to undefined. exceptions this method may raise a domexception of the following types: exception description transactioninactiveerror this object store's transaction is inactive. readonlyerror the object store's transaction mode is rea...
IDBObjectStore.deleteIndex() - Web APIs
connected database, used during a version upgrade. note that this method must be called only from a versionchange transaction mode callback. note that this method synchronously modifies the idbobjectstore.indexnames property. note: this feature is available in web workers. syntax objectstore.deleteindex(indexname); parameters indexname the name of the existing index to remove. return value undefined exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror occurs if the method was not called from a versionchange transaction mode callback. transactioninactiveerror occurs if the transaction this idbobjectstore belongs to is not active (e.g. has been deleted or removed.) in firefox...
IDBObjectStore.getKey() - Web APIs
ed by the specified query. this is for retrieving specific records from an object store. if a key is successfully found, then a structured clone of it is created and set as the result of the request object. note: this feature is available in web workers. syntax var request = objectstore.getkey(key); parameters key the key or key range that identifies the record to be retrieved. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbobjectstore's transaction is inactive. dataerror the key or key range provided contains an invalid key. invalidstateer...
IDBObjectStore.indexNames - Web APIs
example in the following code snippet, we open a read/write transaction on our database and add some data to an object store using add(). after the object store has been created, we log objectstore.indexnames to the console. ...
IDBObjectStore.name - Web APIs
exceptions there are a several exceptions which can occur when you attempt to change an object store's name. ...
IDBObjectStore.transaction - Web APIs
example in the following code snippet, we open a read/write transaction on our database and add some data to an object store using add(). after the object store has been created, we log objectstore.transaction to the console. ...
IDBRequest.onerror - Web APIs
up a transaction as usual var objectstore = db.transaction(['todolist'], "readwrite").objectstore('todolist'); // get the to-do list object that has this title as it's title var objectstoretitlerequest = objectstore.get(title); objectstoretitlerequest.onsuccess = function() { // grab the data object returned as the result var data = objectstoretitlerequest.result; // update the notified value in the object to "yes" data.notified = "yes"; // create another request that inserts the item back // into the database var updatetitlerequest = objectstore.put(data); // when this new request succeeds, run the displaydata() // function again to update the display updatetitlerequest.onsuccess = function() { displaydata(); }; }; objectstoretitlerequest.onerror = function() {...
IDBRequest.onsuccess - Web APIs
up a transaction as usual var objectstore = db.transaction(['todolist'], "readwrite").objectstore('todolist'); // get the to-do list object that has this title as it's title var objectstoretitlerequest = objectstore.get(title); objectstoretitlerequest.onsuccess = function() { // grab the data object returned as the result var data = objectstoretitlerequest.result; // update the notified value in the object to "yes" data.notified = "yes"; // create another request that inserts the item back // into the database var updatetitlerequest = objectstore.put(data); // when this new request succeeds, run the displaydata() // function again to update the display updatetitlerequest.onsuccess = function() { displaydata(); }; }; specifications specification stat...
IDBTransaction.commit() - Web APIs
standing requests have been satisfied and no new requests have been made. commit() can be used to start the commit process without waiting for events from outstanding requests to be dispatched. if it is called on a transaction that is not active, it throws an invalidstateerror domexception. note: this feature is available in web workers. syntax transaction.commit(); parameters none. return value void. exceptions exception description invalidstateerror the transaction state is not active. examples // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["mydb"], "readwrite"); // report on the success of opening the transaction transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction comp...
IDBTransaction.db - Web APIs
Web › API › IDBTransaction › db
example in the following code snippet, we open a read/write transaction on our database and add some data to an object store. note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure. ...
IDBTransaction.mode - Web APIs
the mode read-only property of the idbtransaction interface returns the current mode for accessing the data in the object stores in the scope of the transaction (i.e. is the mode to be read-only, or do you want to write to the object stores?) the default value is readonly. note: this feature is available in web workers. syntax var mycurrentmode = idbtransaction.mode; value an idbtransactionmode object defining the mode for isolating access to data in the current object stores: value explanation readonly allows data to be read but not changed. readwrite allows reading and writing of data in existing data stores to be changed. versionchange allows any operation to be performed, including ones that delete and create object stores and ind...
IDBTransaction.objectStore() - Web APIs
action. every call to this method on the same transaction object, with the same name, returns the same idbobjectstore instance. if this method is called on a different transaction object, a different idbobjectstore instance is returned. note: this feature is available in web workers. syntax idbtransaction.objectstore(name); parameters name the name of the requested object store. return value an idbobjectstore object for accessing an object store. exceptions this method may raise a domexception of one of the following types: exception description notfounderror the requested object store is not in this transaction's scope. invalidstateerror the request was made on a source object that has been deleted or removed, or if the transaction has fin...
IDBVersionChangeEvent.newVersion - Web APIs
example in the following code snippet, we make a request to open a database, and include handlers for the success and error cases. these events are fired via the custom idbversionchangeevent interface. ...
IDBVersionChangeEvent.oldVersion - Web APIs
the oldversion read-only property of the idbversionchangeevent interface returns the old version number of the database. when the opened database doesn't exist yet, the value of oldversion is 0. note: this feature is available in web workers. syntax var oldversion = idbversionchangeevent.oldversion value a 64-bit integer. example var dbname = "sampledb"; var dbversion = 2; var request = indexeddb.open(dbname, dbversion); request.onupgradeneeded = function(e) { var db = request.result; if (e.oldversion < 1) { db.createobjectstore("store1"); } if (e.oldversion < 2) { db.deleteobjectstore("store1"); db.createobjectstore("store2"); } // etc. for version < 3, 4... }; specifications specification status comment indexed database api 2.0th...
IDBVersionChangeEvent.version - Web APIs
roperty of the idbversionchangeevent interface returns the new version of the database in a versionchange transaction. warning: while this property is still implemented in older browsers, the latest specification replaces it with the oldversion and newversion attributes. see the compatibility table to know what browsers support them. syntax readonly attribute unsigned long long? version; value a 64-bit integer. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung intern...
IIRFilterNode - Web APIs
inherits methods from its parent, audionode. it also has the following additional methods: getfrequencyresponse() uses the filter's current parameter settings to calculate the response for frequencies specified in the provided array of frequencies. examples you can find a simple iir filter demo live on codepen. also see the source code on github. it includes some different coefficient values for different lowpass frequencies — you can change the value of the filternumber constant to a value between 0 and 3 to check out the different available effects. also see our using iir filters guide for a full explanation. specifications specification status comment web audio apithe definition of 'iirfilternode' in that specification. working draft initial def...
IdleDeadline.timeRemaining() - Web APIs
to begin, it can call timeremaining() to see if there's enough time to complete the next task. if there isn't, the callback can just return immediately, or look for other work to do with the remaining time. by the time timeremaining() reaches 0, it is suggested that the callback should return control to the user agent's event loop. syntax timeremaining = idledeadline.timeremaining(); return value a domhighrestimestamp value (which is a floating-point number) representing the number of milliseconds the user agent estimates are left in the current idle period. the value is ideally accurate to within about 5 microseconds. if the idledeadline object's didtimeout property is true, this method returns zero. example see our complete example in the article cooperative scheduling of background...
IdleDeadline - Web APIs
method, timeremaining(), which lets you determine how much longer the user agent estimates it will remain idle and a property, didtimeout, which lets you determine if your callback is executing because its timeout duration expired. to learn more about how request callbacks work, see collaborative scheduling of background tasks. properties idledeadline.didtimeout read only a boolean whose value is true if the callback is being executed because the timeout specified when the idle callback was installed has expired. methods idledeadline.timeremaining() returns a domhighrestimestamp, which is a floating-point value providing an estimate of the number of milliseconds remaining in the current idle period. if the idle period is over, the value is 0. your callback can call this repeatedl...
ImageCapture() constructor - Web APIs
the imagecapture() constructor creates a new imagecapture object. syntax const imagecapture = new imagecapture(videotrack) parameters videotrack a mediastreamtrack from which the still images will be taken. this can be any source, such as an incoming stream of a video conference, a playing movie, or the stream from a webcam. return value a new imagecapture object which can be used to capture still frames from the specified video track. example the following example shows how to use a call to mediadevices.getusermedia() to retrieve the mediastreamtrack needed by the imagecapture() constructor. navigator.mediadevices.getusermedia({video: true}) .then(mediastream => { document.queryselector('video').srcobject = mediastream const track = mediastream.getvideotracks()[0]; ...
ImageCapture.grabFrame() - Web APIs
example this example is extracted from this simple image capture demo. it shows how to use the promise returned by grabframe() to copy the returned frame to a <canvas> element. ...
ImageCapture.takePhoto() - Web APIs
ning the data. syntax const blobpromise = imagecaptureobj.takephoto([photosettings]) parameters photosettings optional an object that sets options for the photo to be taken. the available options are: filllightmode: the flash setting of the capture device, one of "auto", "off", or "flash". imageheight: the desired image height as an integer. the user agent selects the closest height value to this setting if it only supports discrete heights. imagewidth: the desired image width as an integer. the user agent selects the closest width value to this setting if it only supports discrete widths. redeyereduction: a boolean indicating whether the red-eye reduction should be used if it is available. return value a promise that resolves with a blob. example this example is extr...
ImageCapture.track - Web APIs
the track read-only property of the imagecapture interface returns a reference to the mediastreamtrack passed to the imagecapture() constructor. syntax const mediastreamtrack = imagecaptureobj.track value a mediastreamtrack object. specifications specification status comment mediastream image capturethe definition of 'track' in that specification. working draft initial definition. ...
ImageData - Web APIs
Web › API › ImageData
ampedarray and the size of the image it contains. if no array is given, it creates an image of a transparent black rectangle. note that this is the most common way to create such an object in workers as createimagedata() is not available there. properties imagedata.data read only is a uint8clampedarray representing a one-dimensional array containing the data in the rgba order, with integer values between 0 and 255 (inclusive). imagedata.height read only is an unsigned long representing the actual height, in pixels, of the imagedata. imagedata.width read only is an unsigned long representing the actual width, in pixels, of the imagedata. specifications specification status comment html living standardthe definition of 'imagedata' in that specification.
IndexedDB API - Web APIs
idbobjectstore represents an object store that allows access to a set of data in an indexeddb database, looked up via primary key. idbindex also allows access to a subset of data in an indexeddb database, but uses an index to retrieve the record(s) rather than the primary key. this is sometimes faster than using idbobjectstore. idbcursor iterates over object stores and indexes. idbcursorwithvalue iterates over object stores and indexes and returns the cursor's current value. idbkeyrange defines a key range that can be used to retrieve data from a database in a certain range. idblocaleawarekeyrange defines a key range that can be used to retrieve data from a database in a certain range, sorted according to the rules of the locale specified for a certain index (see createindex()'s op...
InputEvent() - Web APIs
inputeventinitoptional is a inputeventinit dictionary, having the following fields: inputtype: (optional) a string specifying the type of change for editible content such as, for example, inserting, deleting, or formatting text. data: (optional) a string containing characters to insert. this may be an empty string if the change doesn't insert text (such as when deleting characters, for example). ...
InputEvent.data - Web APIs
Web › API › InputEvent › data
the data read-only property of the inputevent interface returns a domstring with the inserted characters. this may be an empty string if the change doesn't insert text (such as when deleting characters, for example). syntax var astring = inputevent.data; value a domstring. examples in the following simple example we've set up an event listener on the input event so that when any change is made to the contents of the <input> element (either by typing or pasting), the text that was added is retrieved via the inputevent.data property and reported in the paragraph below the input. <p>some text to copy and paste.</p> <input type="text"> <p class="result"></p> var editable = document.queryselector('input') var result = document.queryselector('.result'); editable.addeventlistener('input'...
InputEvent.dataTransfer - Web APIs
the datatransfer read-only property of the inputevent interface returns a datatransfer object containing information about richtext or plaintext data being added to or removed from editible content. syntax var datatransfer = inputevent.datatransfer value a datatransfer object. examples in the following simple example we've set up an event listener on the input event so that when any content is pasted into the contenteditable <p> element, its html source is retrieved via the inputevent.datatransfer.getdata() method and reported in the paragraph below the input. try copying and pasting some of the content provided to see the effects. <p><span style="font-weight: bold; color: blue">whoa, bold blue text!</span></p> <p><span style="font-style: italic; color: red">exciting: italic red text...
InputEvent.getTargetRanges() - Web APIs
specifications specification status comment input events level 2the definition of 'gettargetranges()' in that specification. working draft initial definition. ...
InputEvent.isComposing - Web APIs
the inputevent.iscomposing read-only property returns a boolean value indicating if the event is fired after compositionstart and before compositionend. syntax var bool = event.iscomposing; example var inputevent = new inputevent('syntheticinput', false); console.log(inputevent.iscomposing); // return false specifications specification status comment document object model (dom) level 3 events specificationthe definition of 'inputevent.iscomposing' in that specification. obsolete initial definition. ...
InputEvent - Web APIs
ad only returns a datatransfer object containing information about richtext or plaintext data being added to or removed from editable content. inputevent.inputtyperead only returns the type of change for editable content such as, for example, inserting, deleting, or formatting text. see the property page for a complete list of input types. inputevent.iscomposingread only returns a boolean value indicating if the event is fired after compositionstart and before compositionend. methods this interface inherits methods from its parents, uievent and event. inputevent.gettargetranges() returns an array of static ranges that will be affected by a change to the dom if the input event is not canceled. specifications specification status comment input events ...
InstallEvent.activeWorker - Web APIs
examples self.addeventlistener('install', function(event) { var myactiveworker = event.activeworker; }); ...
enabled - Web APIs
summary indicates whether or not software installation is enabled for this client machine. method of installtrigger object syntax boolean enabled (); parameters none returns true if software installation is enabled for this client machine; otherwise, false. the method reflects the value of the software installation preference in the user interface, and of the xpinstall.enabled preference in pref.js. example the following code uses the startsoftwareupdate method to unconditionally trigger a download from http://royalairways/royalpkg.xpi as long as software installation is enabled on the browser: if (installtrigger.enabled() ) { installtrigger.startsoftwareupdate ("http://royalair.com/rasoft.xpi"); } ...
installChrome - Web APIs
parameters the installchrome method has the following parameters: type type can be installtrigger.skin or installtrigger.locale. url url is a string containing a full or relative url to download name name is displayed in the dialog, but is also used to *select* the theme somust match exactly the name in the internal manifest.rdf file. returns a boolean value indicating false if the software install feature has been turned off, and true if it's on. note that this return value does not indicate anything about the success of the installation. description installchrome is a special method for installing new chrome in netscape 6 and mozilla. the method performs a simplified installation of language packs or netscape 6/mozilla skins, and saves you the trou...
IntersectionObserver.disconnect() - Web APIs
the intersectionobserver method disconnect() stops watching all of its target elements for visibility changes. syntax intersectionobserver.disconnect(); parameters none. return value undefined. specifications specification status comment intersection observerthe definition of 'intersectionobserver.disconnect()' in that specification. working draft initial definition. ...
IntersectionObserver.observe() - Web APIs
design allows multiple elements' intersection changes to be processed by a single call to the callback. syntax intersectionobserver.observe(targetelement); parameters targetelement an element whose visibility within the root is to be monitored. this element must be a descendant of the root element (or contained wtihin the current document, if the root is the document's viewport). return value undefined. examples <<<...>>> specifications specification status comment intersection observerthe definition of 'intersectionobserver.observe()' in that specification. working draft initial definition. ...
IntersectionObserver.root - Web APIs
the intersectionobserver interface's read-only root property identifies the element or document whose bounds are treated as the bounding box of the viewport for the element which is the observer's target. if the root is null, then the bounds of the actual document viewport are used. syntax var root = intersectionobserver.root; value a element or document object whose bounding box is used as the bounds of the viewport for the purposes of determining how much of the target element is visible. the intersection of this bounding rectangle, offset by any margins specified in the options passed to the intersectionobserver() constructor, the target element's bounds, minus the bounds of every element or other object which overlaps the target element, is considered to be the visible area of the tar...
IntersectionObserver.takeRecords() - Web APIs
either explicitly through a call to this method or implicitly by an automatic call to the observer's callback. note: if you use the callback to monitor these changes, you don't need to call this method. calling this method clears the pending intersection list, so the callback will not be run. syntax intersectionobserverentries = intersectionobserver.takerecords(); parameters none. return value an array of intersectionobserverentry objects, one for each target element whose intersection with the root has changed since the last time the intersections were checked. examples <<<...>>> specifications specification status comment intersection observerthe definition of 'intersectionobserver.takerecords()' in that specification. working draft initial d...
IntersectionObserver.unobserve() - Web APIs
the intersectionobserver method unobserve() instructs the intersectionobserver to stop observing the specified target element. syntax intersectionobserver.unobserve(target); parameters target the element to cease observing. if the specified element isn't being observed, this method does nothing and no exception is thrown. return value undefined. example this snippet simply shows an observer being created, an element being observed, and then being unobserved. var observer = new intersectionobserver(callback); observer.observe(document.getelementbyid("elementtoobserve")); /* ... */ observer.unobserve(document.getelementbyid("elementtoobserve")); specifications specification status comment intersection observerthe definition of 'intersectionobserver.uno...
IntersectionObserverEntry.boundingClientRect - Web APIs
the intersectionobserverentry interface's read-only boundingclientrect property returns a domrectreadonly which in essence describes a rectangle describing the smallest rectangle that contains the entire target element. syntax var boundsrect = intersectionobserverentry.boundingclientrect; value a domrectreadonly which describes the smallest rectangle that contains every part of the target element whose intersection change is being described. this value is obtained using the same algorithm as element.getboundingclientrect(), so refer to that article for details on precisely what is done to obtain this rectangle and what is and is not included within its bounds. in the general case, however, it's safe to simply think of this as the bounds rectangle of the target element. specifi...
IntersectionObserverEntry.intersectionRatio - Web APIs
the intersectionobserverentry interface's read-only intersectionratio property tells you how much of the target element is currently visible within the root's intersection ratio, as a value between 0.0 and 1.0. syntax var intersectionratio = intersectionobserverentry.intersectionratio; value a number between 0.0 and 1.0 which indicates how much of the target element is actually visible within the root's intersection rectangle. more precisely, this value is the ratio of the area of the intersection rectangle (intersectionrect) to the area of the target's bounds rectangle (boundingclientrect). if the area of the target's bounds rectangle is zero, the returned value is 1 if isintersecting is true or 0 if not. example in this simple example, an intersection callback sets each tar...
IntersectionObserverEntry.intersectionRect - Web APIs
the intersectionobserverentry interface's read-only intersectionrect property is a domrectreadonly object which describes the smallest rectangle that contains the entire portion of the target element which is currently visible within the intersection root. syntax var intersectionrect = intersectionobserverentry.intersectionrect; value a domrectreadonly which describes the part of the target element that's currently visible within the root's intersection rectangle. this rectangle is computed by taking the intersection of boundingclientrect with each of the target's ancestors' clip rectangles, with the exception of the intersection root itself. example in this simple example, an intersection callback stores the intersection rectangle for later use by the code that draws the tar...
IntersectionObserverEntry.isIntersecting - Web APIs
the intersectionobserverentry interface's read-only isintersecting property is a boolean value which is true if the target element intersects with the intersection observer's root. if this is true, then, the intersectionobserverentry describes a transition into a state of intersection; if it's false, then you know the transition is from intersecting to not-intersecting. syntax var isintersecting = intersectionobserverentry.isintersecting; value a boolean value which indicates whether the target element has transitioned into a state of intersection (true) or out of a state of intersection (false). example in this simple example, an intersection callback is used to update a counter of how many targeted elements are currently intersecting with the intersection root. function intersectionc...
IntersectionObserverEntry.rootBounds - Web APIs
the intersectionobserverentry interface's read-only rootbounds property is a domrectreadonly corresponding to the target's root intersection rectangle, offset by the intersectionobserver.rootmargin if one is specified. syntax var rootbounds = intersectionobserverentry.rootbounds; value a domrectreadonly which describes the root intersection rectangle. for roots which are the document's viewport, this rectangle is the bounds rectangle of the entire document. otherwise, it's the bounds of the root element. this rectangle is offset by the values in intersectionobserver.rootmargin. specifications specification status comment intersection observerthe definition of 'intersectionobserverentry.rootbounds' in that specification. working draft initial defi...
IntersectionObserverEntry.target - Web APIs
example in this simple example, each targeted element's opacity is set to its intersectionratio. ...
IntersectionObserverEntry.time - Web APIs
the time is specified in milliseconds since the creation of the containing document. ...
IntersectionObserverEntry - Web APIs
nds are computed as described in the documentation for element.getboundingclientrect(). intersectionobserverentry.intersectionratio read only returns the ratio of the intersectionrect to the boundingclientrect. intersectionobserverentry.intersectionrect read only returns a domrectreadonly representing the target's visible area. intersectionobserverentry.isintersecting read only a boolean value which is true if the target element intersects with the intersection observer's root. if this is true, then, the intersectionobserverentry describes a transition into a state of intersection; if it's false, then you know the transition is from intersecting to not-intersecting. intersectionobserverentry.rootbounds read only returns a domrectreadonly for the intersection observer's root. inters...
InterventionReportBody - Web APIs
an intervention report is generated when usage of a feature in a web document has been blocked by the browser for reasons such as security, performance, or user annoyance. so for example, a script was been stopped because it was significantly slowing down the browser, or the browser's autoplay policy blocked audio from playing without a user gesture to trigger it. properties id a string representing the intervention that generated the report. this can be used to group reports by deprecated feature. ...
Keyboard.getLayoutMap() - Web APIs
the getlayoutmap() method of the keyboard interface returns a promise that resolves with an instance of keyboardlayoutmap which is a map-like object with functions for retrieving the strings associated with specific physical keys. syntax var promise = keyboard.getlayoutmap() parameters none. return value a promise that resolves with an instance of keyboardlayoutmap. example the following example demonstrates how to get the location- or layout-specific string associated with the key that corresponds to the 'w' key on an english qwerty keyboard. var keyboard = navigator.keyboard; keyboard.getlayoutmap() .then(keyboardlayoutmap => { var upkey = keyboardlayoutmap.get('keyw'); window.alert('press ' + upkey + ' to move up.'); }) specifications specification stat...
Keyboard.lock() - Web APIs
Web › API › Keyboard › lock
a promise after enabling the capture of keypresses for any or all of the keys on the physical keyboard. this method can only capture keys that are granted access by the underlying operating system. syntax var promise = keyboard.lock([keycodes[]]) parameters keycodes optional an array of one or more key codes to lock. if no keycodes are provided all keys will be locked. a list of valid code values is found in the ui events keyboardevent code values spec. return value a promise. examples capturing all keys the following example captures all keypresses. navigator.keyboard.lock(); capturing specific keys the following example captures the "w", "a", "s", and "d" keys. it captures these keys regardless of which modifiers are used with the key press. assuming a standard us qwerty layou...
Keyboard.unlock() - Web APIs
Web › API › Keyboard › unlock
the unlock() method of the keyboard interface unlocks all keys captured by the keyboard.lock() method and returns synchronously. syntax keyboard.unlock() parameters none. return value undefined specifications specification status comment keyboard mapthe definition of 'keyboard' in that specification. editor's draft defines the keyboard interface. keyboard lockthe definition of 'unlock()' in that specification. editor's draft initial definition. ...
KeyboardEvent.altKey - Web APIs
the keyboardevent.altkey read-only property is a boolean that indicates if the alt key (option or ⌥ on os x) was pressed (true) or not (false) when the event occured. syntax var altkeypressed = instanceofkeyboardevent.altkey return value boolean examples <html> <head> <title>altkey example</title> <script type="text/javascript"> function showchar(e){ alert( "key keydown: " + string.fromcharcode(e.charcode) + "\n" + "charcode: " + e.charcode + "\n" + "alt key keydown: " + e.altkey + "\n" ); } </script> </head> <body onkeydown="showchar(event);"> <p> press any character key, with or without holding down the alt key.<br /> you can also use the shift key together with the alt key. </p> </body> </html> specifications specification status comment ...
KeyboardEvent.ctrlKey - Web APIs
the keyboardevent.ctrlkey read-only property returns a boolean that indicates if the control key was pressed (true) or not (false) when the event occured. ...
KeyboardEvent.isComposing - Web APIs
after compositionstart and before compositionend. syntax var bool = event.iscomposing; example var kbdevent = new keyboardevent("synthetickey", false); console.log(kbdevent.iscomposing); // return false specifications specification status comment ui eventsthe definition of 'keyboardevent.prototype.iscomposing' in that specification. ...
KeyboardEvent.metaKey - Web APIs
ng systems may intercept the key so it is never detected. note: on macintosh keyboards, this is the ⌘ command key. on windows keyboards, this is the windows key (⊞ windows). at least as of firefox 48, the ⊞ windows key is not considered the "meta" key. keyboardevent.metakey is false when the ⊞ windows is pressed. syntax var metakeypressed = instanceofkeyboardevent.metakey return value a boolean example function ismetakey(e) { alert("metakey = " + e.metakey); } <button onclick="ismetakey(event)">click me with the meta key</button> specifications specification status comment document object model (dom) level 3 events specificationthe definition of 'keyboardevent.metakey' in that specification. obsolete initial definition ...
KeyboardEvent.repeat - Web APIs
the repeat read-only property of the keyboardevent interface returns a boolean that is true if the given key is being held down such that it is automatically repeating. syntax var repeat = event.repeat; return value boolean specifications specification status comment document object model (dom) level 3 events specificationthe definition of 'keyboardevent.repeat' in that specification. obsolete initial definition. ...
KeyboardEvent.shiftKey - Web APIs
the keyboardevent.shiftkey read-only property is a boolean that indicates if the shift key was pressed (true) or not (false) when the event occurred. ...
KeyboardEvent.which - Web APIs
please see keyboardevent.charcode and keyboardevent.keycode for more details. ...
KeyboardLayoutMap.entries - Web APIs
the entries read-only property of the keyboardlayoutmap interface 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). syntax keyboardlayoutmap.entries() value an array of the given keyboardlayoutmap object's own enumerable property [key, value] pairs. specifications specification status comment keyboard mapthe definition of 'entries' in that specification. editor's draft initial definition. ...
KeyboardLayoutMap.forEach() - Web APIs
the foreach() method of the keyboardlayoutmap interface executes a provided function once for each element of the map. syntax keyboardlayoutmap.foreach(function callback(currentvalue[, index[, array]]) { //your iterator }[, thisarg]); parameters callback the function to execute for each element, taking three arguments: currentvalue the value of the current element being processed. index optional the index of the current element being processed. array optional the keyboardlayoutmap that foreach() is being called on. thisarg optional value to use as this (i.e the reference object) when executing callback. return value undefined. specifications specification status comment keyboard mapthe definition of 'foreach()' in that s...
KeyboardLayoutMap.has() - Web APIs
the has() method of the keyboardlayoutmap interface returns a boolean indicating whether the object has an element with the specified key. a list of valid keys is found in the ui events keyboardevent code values spec. syntax var aboolean = keyboardlayoutmap.has(key) parameters key the key of an element to search for in the map. return value a boolean indicating whether the specifed key was found. example specification status comment keyboard mapthe definition of 'has()' in that specification. editor's draft initial definition. ...
KeyboardLayoutMap.keys - Web APIs
the keys read-only property of the keyboardlayoutmap interface returns a new array iterator object that contains the keys for each index in the array. syntax iterator = keyboardlayoutmap.keys value an iterator. specifications specification status comment keyboard mapthe definition of 'keys' in that specification. editor's draft initial definition. ...
KeyboardLayoutMap.size - Web APIs
the size read-only property of the keyboardlayoutmap interface returns the number of elements in the map. syntax var size = keyboardlayoutmap.size() value a number. specifications specification status comment keyboard mapthe definition of 'size' in that specification. editor's draft initial definition. ...
KeyframeEffect.composite - Web APIs
the composite property of a keyframeeffect resolves how an element's animation impacts its underlying property values. syntax // getting var compositeenumeration = keyframeeffect.composite; // setting keyframeeffect.composite = 'accumulate'; value to understand these values, take the example of a keyframeeffect value of blur(2) working on an underlying property value of blur(3). replace the keyframeeffect overrides the underlying value it is combined with: blur(2) replaces blur(3). add the keyframeeffect is added to the underlying value with which it is combined (aka additive): blur(2) blur(3). accumulate the keyframeeffect is accumulated on to the underlying value: blur(5). specifications specification status comment web animationsthe definition...
KeyframeEffect.iterationComposite - Web APIs
the iterationcomposite property of a keyframeeffect resolves how the animation's property value changes accumulate or override each other upon each of the animation's iterations. syntax // getting var iterationcompositeenumeration = keyframeeffect.iterationcomposite; // setting keyframeeffect.iterationcomposite = 'replace'; values replace the keyframeeffect value produced is independent of the current iteration. accumulate subsequent iterations of the keyframeeffect build on the final value of the previous iteration. specifications specification status comment web animations level 2the definition of 'iterationcomposite' in that specification. draft initial definition. ...
KeyframeEffect.target - Web APIs
specific element. it performs as both a getter and a setter, except with animations and transitions generated by css. syntax var targetelement = document.getelementbyid("elementtoanimate"); var keyframes = new keyframeeffect( targetelement, keyframeblock, timingoptions ); // returns #elementtoanimate keyframes.target; // assigns keyframes a new target keyframes.target = newtargetelement; value an element, csspseudoelement, or null. examples in the follow the white rabbit example, whiterabbit sets the target element to be animated: var whiterabbit = document.getelementbyid("rabbit"); var rabbitdownkeyframes = new keyframeeffect( whiterabbit, [ { transform: 'translatey(0%)' }, { transform: 'translatey(100%)' } ], { duration: 3000, fill: 'forwards' } ); // returns <d...
LinearAccelerationSensor.x - Web APIs
le precision integer containing the linear acceleration of the device along the device's x axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var xlinearaccelerationsensor = linearaccelerationsensor.x value a number. example linear acceleration is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let lasensor = new linearaccelerationsensor({frequency: 60}); lasensor.addeventlistener('reading', e => { console.log("linear acceleration along the x-axis " + lasensor.x); console.log("linear acceleration along the y-axis " + lasensor.y);...
LinearAccelerationSensor.y - Web APIs
ensor interface returns a double precision integer containing the acceleration of the device along the device's y axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var yacceleration = accelerometer.y value a number. example linear acceleration is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let lasensor = new linearaccelerationsensor({frequency: 60}); lasensor.addeventlistener('reading', e => { console.log("linear acceleration along the x-axis " + lasensor.x); console.log("linear acceleration along the y-axis " + lasensor.y);...
LinearAccelerationSensor.z - Web APIs
ensor interface returns a double precision integer containing the acceleration of the device along the device's z axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var zacceleration = accelerometer.z value a number. example linear acceleration is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let lasensor = new linearaccelerationsensor({frequency: 60}); lasensor.addeventlistener('reading', e => { console.log("linear acceleration along the x-axis " + lasensor.x); console.log("linear acceleration along the y-axis " + lasensor.y);...
Location: href - Web APIs
Web › API › Location › href
if you want redirection, use location.replace(). ...
Location: origin - Web APIs
Web › API › Location › origin
e.g "blob:https://mozilla.org" will have "https://mozilla.org". note: this feature is available in web workers. syntax string = object.origin; examples // on this page, returns the origin var result = window.location.origin; // returns:'https://developer.mozilla.org' specifications specification ...
Location - Web APIs
Web › API › Location
rovided url). the difference from the assign() method and setting the href property is that after using replace() the current page will not be saved in session history, meaning the user won't be able to use the back button to navigate to it. location.tostring() returns a usvstring containing the whole url. it is a synonym for htmlhyperlinkelementutils.href, though it can't be used to modify the value. examples // create anchor element and use href property for the purpose of this example // a more correct alternative is to browse to the url and use document.location or window.location var url = document.createelement('a'); url.href = 'https://developer.mozilla.org:8080/search?q=url#search-results-close-container'; console.log(url.href); // https://developer.mozilla.org:8080/search?q=u...
Locks.mode - Web APIs
Web › API › Lock › mode
example the following examples show how the mode property is passed in the call to lockmanager.request(). lockmanager is the object returned by navigator.locks. ...
Locks.name - Web APIs
Web › API › Lock › name
pt when the lock is requested. the name is selected by the developer to represent an abstract resource for which use is being coordinated across multiple tabs, workers, or other code within the origin. for example, if only one tab of a web application should be synchronizing network resources with an offline database, it could use a lock name such as "net_db_sync". syntax var name = lock.name value a domstring. example the following examples show how the name property passed in the call to lockmanager.request(). lockmanager is the object returned by navigator.locks. navigator.locks.request("net_db_sync", show_lock_properties); function show_lock_properties(lock) { console.log(`the lock name is: ${lock.name}`); console.log(`the lock mode is: ${lock.mode}`); } specifications ...
LockManager.query() - Web APIs
Web › API › LockManager › query
held: an array of lock objects for held locks. pending: an array of lock objects for pending lock requests. ...
LockedFile.active - Web APIs
Web › API › LockedFile › active
ior may change in the future. the active property allows to know if the lockedfile object is still usable (true) or not (false). if the object is inactive then it is impossible to perform any read or write operation with it. typically, a lockedfile object becomes inactive when the lockedfile.abort() method is called or if an error occurs. syntax var state = instanceoflockedfile.active value a boolean. specifications specification status comment filesystem api editor's draft draft proposal. ...
LockedFile.append() - Web APIs
Web › API › LockedFile › append
not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. summary the append method is used to write some data at the end of the file. the write operation is performed at the end of the file, regardless of the lockedfile.location value, and actually sets this value to null. syntax var request = instanceoflockedfile.append(data); parameters data the data to write into the file. it can be a string or an arraybuffer. return a filerequest object to handle the success or failure of the operation. specifications specification status comment filesystem api editor's draft draft proposal ...
LockedFile.fileHandle - Web APIs
d and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. summary the filehandle property gives access to the filehandle object that produced the lockedfile object. syntax var handler = instanceoflockedfile.filehandle value a filehandle object. specifications specification status comment filesystem api editor's draft draft proposal. ...
LockedFile.location - Web APIs
ndard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. summary the location property is a zero-based index representing the position of the read/write pointer within the file. its value indicates at which bytes within the file any write or read operation will start. this value is changed automatically after every read and write operation. the special value null means end-of-file. this property can be changed at will. syntax var location = instanceoflockedfile.location value a number. specifications specification status comment filesystem api e...
LockedFile.mode - Web APIs
Web › API › LockedFile › mode
d this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. summary the mode property provides the read/write status of the lockedfile file. syntax var mode = instanceoflockedfile.mode value a string, one of readonly or readwrite. specifications specification status comment filesystem api editor's draft draft proposal. ...
LockedFile.truncate() - Web APIs
behavior may change in the future. summary the truncate method is used to remove some data within the file. if the method is called with no argument, the operation removes all the bytes starting at the index set in lockedfile.location. if the method is called with an argument, the operation removes all the bytes starting at the index corresponding to the parameter and regardless of the value of lockedfile.location. syntax var request = instanceoflockedfile.truncate(start); parameters start optional a number representing the index where to start the operation. return a filerequest object to handle the success or failure of the operation. specifications specification status comment filesystem api editor's draft draft proposal ...
MIDIAccess - Web APIs
ed read only a boolean attribute indicating whether system exclusive support is enabled on the current midiaccess instance. event handlers midiaccess.onstatechange called whenever a new midi port is added or an existing port changes state. examples navigator.requestmidiaccess() .then(function(access) { // get lists of available midi controllers const inputs = access.inputs.values(); const outputs = access.outputs.values(); access.onstatechange = function(e) { // print information about the (dis)connected midi controller console.log(e.port.name, e.port.manufacturer, e.port.state); }; }); specifications specification status comment web midi api working draft initial definition. ...
MSManipulationEvent.initMSManipulationEvent() - Web APIs
lse, the default action cannot be canceled. viewarg [in] type: abstractview the view in which the event is taking place. detailarg [in] type: integer specifies some detailed information depending upon the event. laststate [in] type: integer indicates the last state of the manipulation event. currentstate [in] type: integer indicates the current state of the manipulation event. return value this method does not return a value. example interface msmanipulationevent extends uievent { readonly currentstate: number; readonly inertiadestinationx: number; readonly inertiadestinationy: number; readonly laststate: number; initmsmanipulationevent(typearg: string, canbubblearg: boolean, cancelablearg: boolean, viewarg: window, detailarg: number, laststate: number, curre...
Magnetometer.x - Web APIs
Web › API › Magnetometer › x
of the magnetometer interface returns a double precision integer containing the magnetic field around the device's x axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var magnetometerx = magnetometer.x value a number. example the magnetometer is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let magsensor = new magnetometer({frequency: 60}); magsensor.addeventlistener('reading', e => { console.log("magnetic field along the x-axis " + magsensor.x); console.log("magnetic field along the y-axis " + magsensor.y); console.log("magne...
Magnetometer.y - Web APIs
Web › API › Magnetometer › y
of the magnetometer interface returns a double precision integer containing the magnetic field around the device's y axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var magnetometery = magnetometer.x value a number. example the magnetometer is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let magsensor = new magnetometer({frequency: 60}); magsensor.addeventlistener('reading', e => { console.log("magnetic field along the x-axis " + magsensor.x); console.log("magnetic field along the y-axis " + magsensor.y); console.log("magne...
Magnetometer.z - Web APIs
Web › API › Magnetometer › z
the magnetometer interface returns a double-precision integer containing the magnetic field around the device's z axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var magnetometerz = magnetometer.z value a number. example the magnetometer is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let magsensor = new magnetometer({frequency: 60}); magsensor.addeventlistener('reading', e => { console.log("magnetic field along the x-axis " + magsensor.x); console.log("magnetic field along the y-axis " + magsensor.y); console.log("magne...
MediaCapabilities.encodingInfo() - Web APIs
ent, which describe how compatible the device is with the type of media. syntax mediacapabilities.encodinginfo(mediaencodingconfiguration) parameters mediaencodingconfiguration a valid mediaencodingconfiguration dictionary containing a valid media encoding type of record or transmission and a valid media configuration: either an audioconfiguration or videoconfiguration dictionary. ...
MediaDecodingConfiguration - Web APIs
e mediadecodingconfiguration dictionary of the media capabilities api is used to define the type of media being tested when calling mediacapabilities.decodinginfo() to query whether a specific media configuration is supported, smooth, and/or power efficient. properties a mediadecodingconfiguration dictionary takes two properties: type — the type of media being tested. this takes one of two values: file: represents a configuration that is meant to be used for a plain file playback. media-source: represents a configuration that is meant to be used for playback of a mediasource. a media configuration — a videoconfiguration or audioconfiguration dictionary. examples //create media configuration to be tested const mediaconfig = { type : 'file', // or 'media-source' ...
MediaDeviceInfo.deviceId - Web APIs
iceinfo interface returns a domstring that is an identifier for the represented device and is persisted across sessions. it is un-guessable by other applications, and unique to the origin of the calling application. it is reset when the user clears cookies. for private browsing, a different identifier is used that is not persisted across sessions. syntax var deviceid = mediadeviceinfo.deviceid value a domstring. specifications specification status comment media capture and streamsthe definition of 'deviceid' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/bro...
MediaDeviceInfo.kind - Web APIs
specifications specification status comment media capture and streamsthe definition of 'kind' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
MediaDeviceInfo.label - Web APIs
the label readonlyinline property of the mediadeviceinfo interface returns a domstring, that is a label describing this device (for example "external usb webcam"). only available during active mediastream use, or when persistent permissions have been granted. syntax var label = mediadeviceinfo.label; value a domstring which describes the media device. for security reasons, the label is always an empty string ("") if the user has not obtained permission to use at least one media device, either by starting a stream from the microphone or camera, or by persistent permissions being granted. specifications specification status comment media capture and streamsthe definition of 'label' in that specification. candidate recommendation initial definition. ...
MediaDeviceInfo - Web APIs
cookies (for private browsing, a different identifier is used that is not persisted across sessions). mediadeviceinfo.groupidread only returns a domstring that is a group identifier. two devices have the same group identifier if they belong to the same physical device — for example a monitor with both a built-in camera and a microphone. mediadeviceinfo.kindread only returns an enumerated value that is either "videoinput", "audioinput" or "audiooutput". mediadeviceinfo.labelread only returns a domstring that is a label describing this device (for example "external usb webcam"). for security reasons, the label field is always blank unless an active media stream exists or the user has granted persistent permission for media device access. the set of device labels could otherwise be ...
MediaDevices.enumerateDevices() - Web APIs
the mediadevices method enumeratedevices() requests a list of the available media input and output devices, such as microphones, cameras, headsets, and so forth. the returned promise is resolved with a mediadeviceinfo array describing the devices. syntax var enumeratorpromise = navigator.mediadevices.enumeratedevices(); return value a promise that receives an array of mediadeviceinfo objects when the promise is fulfilled. each object in the array describes one of the available media input and output devices. if enumeration fails, the promise is rejected. example here's an example of using enumeratedevices(). it simply outputs a list of the device ids, with their labels if available. if (!navigator.mediadevices || !navigator.mediadevices.enumeratedevices) { console.log("enumeratedevi...
MediaDevices.getDisplayMedia() - Web APIs
e details and an example. syntax var promise = navigator.mediadevices.getdisplaymedia(constraints); parameters constraints optional an optional mediastreamconstraints object specifying requirements for the returned mediastream. since getdisplaymedia() requires a video track, the returned stream will have one even if no video track is expressly requested by the constraints object. return value a promise that resolves to a mediastream containing a video track whose contents come from a user-selected screen area, as well as an optional audio track. note: browser support for audio tracks varies, both in terms of whether or not they're supported at all by the media recorder and in terms of the which audio source or sourcoes are supported. check the compatibility table for details for ea...
MediaDevices.getSupportedConstraints() - Web APIs
the getsupportedconstraints() method of the mediadevices interface returns an object based on the mediatracksupportedconstraints dictionary, whose member fields each specify one of the constrainable properties the user agent understands. syntax var supportedconstraints = navigator.mediadevices.getsupportedconstraints(); parameters none. return value a new object based on the mediatracksupportedconstraints dictionary listing the constraints supported by the user agent. because only constraints supported by the user agent are included in the list, each of these boolean properties has the value true. example this example outputs a list of the constraints supported by your browser. html <p>the following media constraints are supported by your browser:</p> <ul id="constraintlist"> </ul>...
MediaElementAudioSourceNode() - Web APIs
ameters inherits parameters from the audionodeoptions dictionary. context an audiocontext representing the audio context you want the node to be associated with. options a mediaelementaudiosourceoptions dictionary object defining the properties you want the mediaelementaudiosourcenode to have: mediaelement: an htmlmediaelement that will be used as the source for the audio. return value a new mediaelementaudiosourcenode object instance. example var ac = new audiocontext(); var mediaelement = document.createelement('audio'); var options = { mediaelement : mediaelement } var myaudiosource = new mediaelementaudiosourcenode(ac, options); specifications specification status comment web audio apithe definition of 'mediaelementaudiosourcenode' in that s...
MediaElementAudioSourceNode.mediaElement - Web APIs
urcenode interface's read-only mediaelement property indicates the htmlmediaelement that contains the audio track from which the node is receiving audio. this stream was specified when the node was first created, either using the mediaelementaudiosourcenode() constructor or the audiocontext.createmediaelementsource() method. syntax audiosourceelement = mediaelementaudiosourcenode.mediaelement; value an htmlmediaelement representing the element which contains the source of audio for the node. examples const audioctx = new window.audiocontext(); const audioelem = document.queryselector('audio'); let options = { mediaelement: audioelem } let source = new mediaelementaudiosourcenode(audioctx, options); console.log(source.mediaelement); specifications specification status ...
MediaElementAudioSourceNode - Web APIs
// create a mediaelementaudiosourcenode // feed the htmlmediaelement into it var source = audioctx.createmediaelementsource(myaudio); // create a gain node var gainnode = audioctx.creategain(); // create variables to store mouse pointer y coordinate // and height of screen var cury; var height = window.innerheight; // get new mouse pointer coordinates when mouse is moved // then set new gain value document.onmousemove = updatepage; function updatepage(e) { cury = (window.event) ? e.pagey : event.clienty + (document.documentelement.scrolltop ? document.documentelement.scrolltop : document.body.scrolltop); gainnode.gain.value = cury/height; } // connect the audiobuffersourcenode to the gainnode // and the gainnode to the destination, so we can play the // music and adjust the vo...
MediaEncodingConfiguration - Web APIs
the mediaencodingconfiguration dictionary of the media capabilities api is used to define the type of media being tested when calling mediacapabilities.encodinginfo() to query whether a specific media configuration is supported, smooth, and/or power efficient. properties a mediaencodingconfiguration dictionary takes two properties: type — the type of media being tested; takes one of two values: record — represents a configuration for recording of media, e.g. using mediarecorder. transmission — represents a configuration meant to be transmitted over electronic means (e.g. using rtcpeerconnection). a media configuration — a videoconfiguration audioconfiguration dictionary. examples //create media configuration to be tested const mediaconfig = { type : 'recor...
MediaError.code - Web APIs
Web › API › MediaError › code
the read-only property mediaerror.code returns a numeric value which represents the kind of error that occurred on a media element. to get a text string with specific diagnostic information, see mediaerror.message. syntax var myerror = mediaerror.code; value a numeric value indicating the general type of error which occurred. the possible values are described below, in media error code constants. media error code constants name value description media_err_aborted 1 the fetching of the associated resource was aborted by the user's request. media_err_network 2 some kind of network error occurred which prevented the media from being successfully fetched, despite having previously been available. media_err_decode 3 despite havin...
MediaError.message - Web APIs
the read-only property mediaerror.message returns a domstring which contains a human-readable string offering specific diagnostic details related to the error described by the mediaerror object, or an empty string ("") if no diagnostic information can be determined or provided. syntax var errormessage = mediaerror.message; value a domstring providing a detailed, specific explanation of what went wrong and possibly how it might be fixed. this is not simply a generic description of the mediaerror.code property's value, but instead goes deeper into the specifics of this particular error and its circumstances. if no specific details are available, this string is empty. example this example creates a <audio> element, establishes an error handler for it, then lets the user click buttons to cho...
msExtendedCode - Web APIs
incompatibilities between implementations and the behavior may change in the future. in the event of an error, the media element's error event will be fired. the element's error property will then contain an msextendedcode read-only property with platform-specific error code information. msextendedcode is a read-only proprietary property specific to internet explorer and microsoft edge. value type: long; the platform specific error code. example var video1 = object.getelementbyid("video1"); video1.addeventlistener('error', function () { var error = video1.error.msextendedcode; //... }, false); video.addeventlistener('canplay', function () { video1.play(); }, false); ...
close() - Web APIs
specifications specification status comment encrypted media extensionsthe definition of 'close()' in that specification. recommendation initial definition ...
MediaKeySession.closed - Web APIs
the mediakeysession.closed read-only property returns a promise signaling when a mediakeysession closes. this promise can only be fulfilled and is never rejected. closing a session means that licenses and keys associated with it are no longer valid for decrypting media data. syntax var promise = mediakeysessionobj.closed; value a promise. specifications specification status comment encrypted media extensionsthe definition of 'closed' in that specification. recommendation initial definition ...
expiration - Web APIs
the mediakeysession.expiration read-only property returns the time after which the keys in the current session can no longer be used to decrypt media data, or nan if no such time exists. this value is determined by the cdm and measured in milliseconds since january 1, 1970, utc. this value may change during a session lifetime, such as when an action triggers the start of a window. syntax ​var expirationtime = mediakeysessionobj.expiration; specifications specification status comment encrypted media extensionsthe definition of 'expiration' in that specification. recommendation initial definition ...
load() - Web APIs
the mediakeysession.load() method returns a promise that resolves to a boolean value after loading data for a specified session object. syntax mediakeysession.load(sessionid).then(function(booleanvalue) { ... }); parameter sessionid a unique string generated by the content decription module for the current media object and its associated keys or licenses. return value a promise that resolves to a boolean indicating whether the load succeeded or failed. specifications specification status comment encrypted media extensionsthe definition of 'load()' in that specification. recommendation initial definition ...
remove() - Web APIs
the mediakeysession.remove() method returns a promise after removing any session data associated with the current object. return value a promise that resolves to a boolean indicating whether the load succeeded or failed. specifications specification status comment encrypted media extensionsthe definition of 'remove()' in that specification. recommendation initial definition ...
update() - Web APIs
the mediakeysession.update() method loads messages and licenses to the cdm, and then returns a promise . syntax mediakeysession.update(response).then(function() { ... }); parameters response an instance of type buffersource. return value a promise. specifications specification status comment encrypted media extensionsthe definition of 'update()' in that specification. recommendation initial definition ...
MediaKeyStatusMap.entries() - Web APIs
syntax // tbd parameters none. returns exceptions specifications specification status comment encrypted media extensions recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
MediaKeyStatusMap.get() - Web APIs
specifications specification status comment encrypted media extensions recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
MediaKeyStatusMap.has() - Web APIs
specifications specification status comment encrypted media extensions recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
MediaKeyStatusMap.size - Web APIs
specifications specification status comment encrypted media extensionsthe definition of 'size' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
MediaList.mediaText - Web APIs
the mediatext property of the medialist interface is a stringifier that returns a domstring representing the medialist as text, and also allows you to set a new medialist. syntax medialistinstance.mediatext; medialistinstance.mediatext = string; value a domstring representing the media queries of a stylesheet. each one is separated by a comma, for example screen and (min-width: 480px), print. if you wish to set new media queries on the document, the string value must have the different queries separated by commas, e.g. screen, print. note that the medialist is a live list; updating the list via mediatext will immediately update the behavior of the document. also note that is you try to set mediatext to null, it will be treated as an empty string, i.e. the value will be set to "". exampl...
MediaList - Web APIs
Web › API › MediaList
text, and also allows you to set a new medialist. medialist.length read only returns the number of media queries in the medialist. methods medialist.appendmedium() adds a media query to the medialist. medialist.deletemedium() removes a media query from the medialist. medialist.item() a getter that returns a cssomstring representing a media query as text, given the media query's index value inside the medialist. examples the following would log to the console a textual representation of the medialist of the first stylesheet applied to the current document. const stylesheets = document.stylesheets; let stylesheet = stylesheets[0]; console.log(stylesheet.media.mediatext); specifications specification status comment css object model (cssom)the definition o...
MediaMetadata.album - Web APIs
specifications specification status comment media session standardthe definition of 'album' in that specification. draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. ...
MediaMetadata.artist - Web APIs
specifications specification status comment media session standardthe definition of 'artist' in that specification. draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. ...
MediaMetadata.artwork - Web APIs
specifications specification status comment media session standardthe definition of 'artwork' in that specification. draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. ...
MediaMetadata.title - Web APIs
specifications specification status comment media session standardthe definition of 'title' in that specification. draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. ...
MediaPositionState.duration - Web APIs
se this information along with the position property and the navigator.mediasession.playbackstate, as well as the session's metadata to provide an integrated common user interface showing the 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 mediapositionstat...
MediaPositionState.position - Web APIs
owser might use this information along with the position property and the navigator.mediasession.playbackstate, as well as the session's metadata to provide an integrated common user interface showing the currently playing media as well as standard pause, play, forward, reverse, and other controls. syntax let positionstate = { position: timeinseconds }; let duration = positionstate.duration; value a floating-point value indicating the current playback position within the media currently being performed, in seconds. this value should always be zero or more. example in this example, a player for a non-standard media file format, written in javascript, uses setinterval() to establish a callback which fires once per second to refresh the position information by calling setpositionstate(). i...
MediaQueryList.addListener() - Web APIs
a function or function reference representing the callback function you want to run when the media query status changes. in the original implementation, the callback was a non-standard mediaquerylistlistener object. in the new implementation the standard event mechanism is used, the callback is a standard function, and the event object is a mediaquerylistevent, which inherits from event. return value void. examples var para = document.queryselector('p'); var mql = window.matchmedia('(max-width: 600px)'); function screentest(e) { if (e.matches) { /* the viewport is 600 pixels wide or less */ para.textcontent = 'this is a narrow screen — less than 600px wide.'; document.body.style.backgroundcolor = 'red'; } else { /* the viewport is more than than 600 pixels wide */ ...
MediaQueryList.matches - Web APIs
the matches read-only property of the mediaquerylist interface is a boolean that returns true if the document currently matches the media query list, or false if not. you can be notified when the value of matches changes by watching for the change event to be fired at the mediaquerylist. syntax var matches = <varm>mediaquerylist.matches; value a boolean which is true if the document currently matches the media query list; otherwise, it's false. examples this example detects viewport orientation changes by creating a media query using the orientation media feature: function addmqlistener(mq, callback) { if (mq.addeventlistener) { mq.addeventlistener("change", callback); } else { mq.addlistener(callback); } } addmqlistener(window.matchmedia("(orientation:landscape)"), ev...
MediaQueryList.removeListener() - Web APIs
d use removeeventlistener() instead. syntax mediaquerylist.removelistener(func) parameters func a function or function reference representing the callback function you want to remove. in the original implementation, the callback was a non-standard mediaquerylistlistener object. in the new implementation the standard event mechanism is used, and the callback is a standard function. return value void. examples var mql = window.matchmedia('(max-width: 600px)'); function screentest(e) { if (e.matches) { /* the viewport is 600 pixels wide or less */ para.textcontent = 'this is a narrow screen — less than 600px wide.'; document.body.style.backgroundcolor = 'red'; } else { /* the viewport is more than than 600 pixels wide */ para.textcontent = 'this is a wide scr...
MediaQueryList - Web APIs
can create a mediaquerylist by calling matchmedia() on the window object. the resulting object handles sending notifications to listeners when the media query state changes (i.e. when the media query test starts or stops evaluating to true). this is very useful for adaptive design, since this makes it possible to observe a document to detect when its media queries change, instead of polling the values periodically, and allows you to programmatically make changes to a document based on media query status. properties the mediaquerylist interface inherits properties from its parent interface, eventtarget. matchesread only a boolean that returns true if the document currently matches the media query list, or false if not. mediaread only a domstring representing a serialized media query.
MediaQueryListEvent.matches - Web APIs
the matches read-only property of the mediaquerylistevent interface is a boolean that returns true if the document currently matches the media query list, or false if not. syntax var matches = mediaquerylistevent.matches; value a boolean; returns true if the document currently matches the media query list, false if not. examples var mql = window.matchmedia('(max-width: 600px)'); function screentest(e) { if (e.matches) { /* the viewport is 600 pixels wide or less */ para.textcontent = 'this is a narrow screen — less than 600px wide.'; document.body.style.backgroundcolor = 'red'; } else { /* the viewport is more than than 600 pixels wide */ para.textcontent = 'this is a wide screen — more than 600px wide.'; document.body.style.backgroundcolor = 'blue'; } ...
MediaQueryListEvent.media - Web APIs
the media read-only property of the mediaquerylistevent interface is a domstring representing a serialized media query. syntax var media = mediaquerylistevent.media; value a domstring representing a serialized media query. examples var mql = window.matchmedia('(max-width: 600px)'); function screentest(e) { if (e.matches) { /* the viewport is 600 pixels wide or less */ para.textcontent = 'this is a narrow screen — less than 600px wide.'; document.body.style.backgroundcolor = 'red'; } else { /* the viewport is more than than 600 pixels wide */ para.textcontent = 'this is a wide screen — more than 600px wide.'; document.body.style.backgroundcolor = 'blue'; } console.log(e.media); } mql.addlistener(screentest); specifications specification ...
MediaQueryListListener - Web APIs
e mediaquerylist.addlistener() callback is now a plain function and called with the standard mediaquerylistevent object. a mediaquerylist object maintains a list of media queries on a document, and handles sending notifications to listeners when the media queries on the document change. this makes it possible to observe a document to detect when its media queries change, instead of polling the values periodically, if you need to detect changes to the values of media queries on a document. a mediaquerylistlistener is a callback function that gets invoked with a single argument, the mediaquerylist for which the evaluated result changed. syntax function( mediaquerylist ) { ... } parameters mediaquerylist the mediaquerylist instance. specifications specification status ...
MediaRecorder() - Web APIs
o component of the media. videobitspersecond: the chosen bitrate for the video component of the media. bitspersecond: the chosen bitrate for the audio and video components of the media. this can be specified instead of the above two properties. if this is specified along with one or the other of the above properties, this will be used for the one that isn't specified. if bits per second values are not specified for video and/or audio, the default adopted for video is 2.5mbps, while the audio default is adaptive, depending upon the sample rate and the number of channels. exceptions notsupportederror the specified mime type is not supported by the user agent. example this example shows how to create a media recorder for a specified stream, whose audio bit rate is set to 128...
MediaRecorder.audioBitsPerSecond - Web APIs
specifications specification status comment mediastream recordingthe definition of 'audiobitspersecond' in that specification. working draft initial definition. ...
MediaRecorder.ignoreMutedMedia - Web APIs
the ignoremutedmedia property of the mediarecorder interface indicates whether the mediarecorder instance will record input, when the input mediastreamtrack is muted. if this attribute is false, mediarecorder will record silence for audio and black frames for video. the default is false. syntax var boolean = mediarecorder.ignoremutedmedia mediarecorder.ignoremutedmedia = boolean value a boolean. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetignoremutedmedia ...
MediaRecorder.isTypeSupported - Web APIs
the mediarecorder.istypesupported() static method returns a boolean which is true if the mime type specified is one the user agent should be able to successfully record. syntax var canrecord = mediarecorder.istypesupported(mimetype) parameters mimetype the mime media type to check. return value true if the mediarecorder implementation is capable of recording blob objects for the specified mime type. recording may still fail if there are insufficient resources to support the recording and encoding process. if the value is false, the user agent is incapable of recording the specified format. example var types = ["video/webm", "audio/webm", "video/webm\;codecs=vp8", "video/webm\;codecs=daala", "video/webm\;codecs=h264", ...
MediaRecorder.onerror - Web APIs
's onerror event handler is called by the mediastream recording api when an error occurs. you can provide an event handler to deal with errors that occur while creating or using a media recorder. the error object is of type mediarecordererrorevent, and its error property contains a domexception object that describes the error that occurred. syntax mediarecorder.onerror = errorhandlerfunction; value a function to be called whenever an error occurs during the recorder's lifetime. in addition to other general errors that might occur, the following errors are specifically possible when using the mediastream recording api; to determine which occurred, check the value of mediarecordererrorevent.error.name. invalidstateerror an attempt was made to stop or pause or an inactive recorder, start ...
MediaRecorder.pause() - Web APIs
ed, the browser queues a task that runs the below steps: if mediarecorder.state is "inactive", raise a dom invalidstate error and terminate these steps. if not, continue to the next step. set mediarecorder.state to "paused". stop gathering data into the current blob, but keep it available so that recording can be resumed later on. raise a pause event. syntax mediarecorder.pause() return value undefined. exceptions invalidstateerror the mediarecorder is currently "inactive"; you can't pause recording if it's not active. if you call pause() while already paused, it silently does nothing. example ... pause.onclick = function() { mediarecorder.pause(); console.log("recording paused"); } ... specifications specification status comment medias...
MediaRecorder.start() - Web APIs
diarecorder.stop event. syntax mediarecorder.start(timeslice) parameters timeslice optional the number of milliseconds to record into each blob. if this parameter isn't included, the entire media duration is recorded into a single blob unless the requestdata() method is called to obtain the blob and trigger the creation of a new blob into which the media continues to be recorded. return value undefined. exceptions errors that can be detected immediately are thrown as dom exceptions. all other errors are reported through error events sent to the mediarecorder object. you can implement the onerror event handler to respond to these errors. invalidmodificationerror the number of tracks on the stream being recorded has changed. you can't add or remove tracks while recording media. ...
MediaRecorder.stream - Web APIs
the mediarecorder.stream read-only property returns the stream that was passed into the mediarecorder() constructor when the mediarecorder was created. syntax var stream = mediarecorder.stream values the mediastream passed into the mediarecorder() constructor when the mediarecorder was originally created. example if (navigator.getusermedia) { console.log('getusermedia supported.'); navigator.getusermedia ( // constraints - only audio needed for this app { audio: true }, // success callback function(stream) { var mediarecorder = new mediarecorder(stream); var mystream = mediarecorder.stream; console.log(mystream); ... specifications specification status comment mediastream recordingt...
MediaRecorder.videoBitsPerSecond - Web APIs
the videobitspersecond read-only property of the mediarecorder interface returns the video encoding bit rate in use. this may differ from the bit rate specified in the constructor, if it was provided. syntax var videobitspersecond = mediarecorder.videobitspersecond value a number (unsigned long). example // tbd specifications specification status comment mediastream recordingthe definition of 'videobitspersecond' in that specification. working draft initial definition. ...
MediaRecorderErrorEvent.error - Web APIs
rface is a domexception object providing details about the exception that was thrown by a mediarecorder instance. when a media​recorder​error​event occurs, you can determine to some extent what went wrong by examining the error property within the media​recorder​error​event received by the mediarecorder's error event handler, onerror. syntax error = mediarecordererrorevent.error; value a domexception describing the error represented by the event. the error's name property's value may be any exception that makes sense during the handling of media recording, including these specifically identified by the specification. the descriptions here are generic ones; you'll find more specific ones to various scenarios in which they may occur in the corresponding method references. inv...
MediaSession.metadata - Web APIs
ce contains a mediametadata object providing descriptive information about the currently playing media, or null if the metadata has not been set. this metadata is provided by the browser to the device for presentation in any standard media control user interface the device might offer. syntax var mediametadata = navigator.mediasession.metadata; navigator.mediasession.metadata = mediametadata; value an instance of mediametadata containing information about the media currently being played. example the following example creates a new media session and assigns action handlers to it: if ('mediasession' in navigator){ navigator.mediasession.metadata = new mediametadata({ title: "podcast episode title", artist: "podcast host", album: "podcast name", artwork: [{src: "podcast.
MediaSession.setPositionState() - Web APIs
his method on the navigator object's mediasession object. syntax navigator.mediasession.setpositionstate(statedict); parameters statedict optional an object conforming to the mediapositionstate dictionary, providing updated information about the playback position and speed of the document's ongoing media. if the object is empty, the existing playback state information is cleared. return value undefined. exceptions typeerror this error can occur in an array of circumstances: the specified mediapositionstate object's duration is missing, negative, or null. position is missing or null, or is either negative or greater than duration. the playbackrate is zero. example in this example, a player for a non-standard media file format, written in javascript, uses setinte...
MediaSession - Web APIs
that provides controls for media. a browser on that device might deliver the metadata provided by calling mediasession to the device in order to be controllable using the global user interface. properties metadata returns an instance of mediametadata which contains rich media metadata, for display in a platform ui. playbackstate indicates whether the current media session is playing. valid values are none, paused, or playing. methods setactionhandler() sets an event handler for a media session action, such as play or pause. see the method page for a full list. setpositionstate() sets the current playback position and speed of the media currently being presented. examples the following example creates a new media session and assigns action handlers to it: if ('mediasession' in...
MediaSessionActionDetails.action - Web APIs
pause pauses playback of the media. ...
MediaSettingsRange.max - Web APIs
the max read-only property of the mediasettingsrange interface returns the maximum value of the settings range. syntax var max = mediasettingsrange.max value a double integer. specifications specification status comment mediastream image capturethe definition of 'max' in that specification. working draft initial definition. ...
MediaSettingsRange.min - Web APIs
the min read-only property of the mediasettingsrange interface returns the minimum value of the settings range. syntax var min = mediasettingsrange.min value a double integer. specifications specification status comment mediastream image capturethe definition of 'min' in that specification. working draft initial definition. ...
MediaSettingsRange.step - Web APIs
the step read-only property of the mediasettingsrange interface returns the minimum difference between consecutive values of the settings range. syntax var step = mediasettingsrange.step value a double integer. specifications specification status comment mediastream image capturethe definition of 'step' in that specification. working draft initial definition. ...
MediaSource.activeSourceBuffers - Web APIs
the activesourcebuffers read-only property of the mediasource interface returns a sourcebufferlist object containing a subset of the sourcebuffer objects contained within sourcebuffers — the list of objects providing the selected video track, enabled audio tracks, and shown/hidden text tracks. syntax var myactivesourcebuffers = mediasource.activesourcebuffers; value a sourcebufferlist containing the sourcebuffer objects for each of the active tracks. example the following snippet is based on a simple example written by nick desaulniers (view the full demo live, or download the source for further investigation.) function sourceopen (_) { //console.log(this.readystate); // open var mediasource = this; var sourcebuffer = mediasource.addsourcebuffer(mimecodec); fetchab(asseturl, f...
MediaSource.addSourceBuffer() - Web APIs
the addsourcebuffer() method of the mediasource interface creates a new sourcebuffer of the given mime type and adds it to the mediasource's sourcebuffers list. the new sourcebuffer is also returned. syntax var sourcebuffer = mediasource.addsourcebuffer(mimetype); parameters mimetype a domstring specifying the mime type of the sourcebuffer to create and add to the mediasource. return value a sourcebuffer object representing the new source buffer that has been created and added to the media source. exceptions invalidaccesserror the value specified for mimetype is an empty string rather than a valid mime type. invalidstateerror the mediasource is not in the "open" readystate. notsupportederror the specified mimetype isn't supported by the user agent, or is not compatible with ...
MediaSource.clearLiveSeekableRange() - Web APIs
the clearliveseekablerange() method of the mediasource interface clears a seekable range previously set with a call to setliveseekablerange(). syntax mediasource.clearliveseekablerange() parameters none. return value undefined specifications specification status comment media source extensionsthe definition of 'clearliveseekablerange()' in that specification. recommendation initial definition. ...
MediaSource.duration - Web APIs
the duration property of the mediasource interface gets and sets the duration of the current media being presented. syntax mediasource.duration = 5.5; // 5.5 seconds var myduration = mediasource.duration; value a double. a value in seconds is expected. exceptions the following exceptions may be thrown when setting a new value for this property. exception explanation invalidaccesserror an attempt was made to set a duration value that was negative, or nan. invalidstateerror mediasource.readystate is not equal to open, or one or more of the sourcebuffer objects in mediasource.sourcebuffers are being updated (i.e. their sourcebuffer.updating property is true.) example the following snippet is based on a simple example written by nic...
MediaSource.readyState - Web APIs
the readystate read-only property of the mediasource interface returns an enum representing the state of the current mediasource. the three possible values are: closed: the source is not currently attached to a media element. open: the source is attached to a media element and ready to receive sourcebuffer objects. ended: the source is attached to a media element but the stream has been ended via a call to mediasource.endofstream(). syntax var myreadystate = mediasource.readystate; value a domstring. example the following snippet is from a simple example written by nick desaulniers (view the full demo live, or download the source for further investigation.) if ('mediasource' in window && mediasource.istypesupported(mimecodec)) { var mediasource = new mediasource; //c...
MediaSource.removeSourceBuffer() - Web APIs
the removesourcebuffer() method of the mediasource interface removes the given sourcebuffer from the sourcebuffers list associated with this mediasource object. syntax mediasource.removesourcebuffer(sourcebuffer); parameters sourcebuffer the sourcebuffer object to be removed. return value undefined exceptions exception explanation notfounderror the supplied sourcebuffer doesn't exist in mediasource.sourcebuffers. examples for (i = 0; i < 10; i++) { var sourcebuffer = mediasource.addsourcebuffer(mimecodec); } mediasource.removesourcebuffer(mediasource.sourcebuffers[0]); specifications specification status comment media source extensionsthe definition of 'removesourcebuffer()' in that specification. recomm...
MediaSource.sourceBuffers - Web APIs
the sourcebuffers read-only property of the mediasource interface returns a sourcebufferlist object containing the list of sourcebuffer objects associated with this mediasource. syntax var mysourcebuffers = mediasource.sourcebuffers; value a sourcebufferlist. example the following snippet is based on a simple example written by nick desaulniers (view the full demo live, or download the source for further investigation.) function sourceopen (_) { //console.log(this.readystate); // open var mediasource = this; var sourcebuffer = mediasource.addsourcebuffer(mimecodec); fetchab(asseturl, function (buf) { sourcebuffer.addeventlistener('updateend', function (_) { mediasource.endofstream(); console.log(mediasource.sourcebuffers); // will contain the source buf...
MediaSource - Web APIs
able range previously set with a call to setliveseekablerange(). mediasource.endofstream() signals the end of the stream. mediasource.removesourcebuffer() removes the given sourcebuffer from the mediasource.sourcebuffers list. mediasource.setliveseekablerange() sets the range that the user can seek to in the media element. static methods mediasource.istypesupported() returns a boolean value indicating if the given mime type is supported by the current user agent — this is, if it can successfully create sourcebuffer objects for that mime type. examples the following simple example loads a video with xmlhttprequest, playing it as soon as it can. this example was written by nick desaulniers and can be viewed live here (you can also download the source for further investigation.) ...
MediaStream() - Web APIs
mediastream(); newstream = new mediastream(stream); newstream = new mediastream(tracks[]); parameters stream a different mediastream object whose tracks are added to the newly-created stream automatically. the tracks are not removed from the original stream, so they're shared by the two streams. tracks an array of mediastreamtrack objects, one for each track to add to the stream. return value a newly-created mediastream object, either empty, or containing the tracks provided, if any. specifications specification status comment media capture and streamsthe definition of 'mediastream' in that specification. candidate recommendation ...
MediaStream.addTrack() - Web APIs
the mediastream.addtrack() method adds a new track to the stream. the track is specified as a parameter of type mediastreamtrack. if the specified track is already in the stream's track set, this method has no effect. syntax stream.addtrack(track); parameters track a mediastreamtrack to add to the stream. return value undefined example specifications specification status comment media capture and streamsthe definition of 'addtrack()' in that specification. candidate recommendation initial specification. ...
MediaStream.clone() - Web APIs
Web › API › MediaStream › clone
the clone() method of the mediastream interface creates a duplicate of the mediastream. this new mediastream object has a new unique id and contains clones of every mediastreamtrack contained by the mediastream on which clone() was called. syntax var stream = mediastream.clone(); parameters none. return value a new mediastream instance which has a new unique id and contains clones of every mediastreamtrack contained by the mediastream on which clone() was called. specifications specification status comment media capture and streamsthe definition of 'mediastream.clone()' in that specification. candidate recommendation initial definition. ...
MediaStream.getAudioTracks() - Web APIs
audio tracks are those tracks whose kind property is audio. the array is empty if the stream contains no audio tracks. ...
MediaStream.getTrackById() - Web APIs
the mediastream.gettrackbyid() method returns a mediastreamtrack object representing the track with the specified id string. if there is no track with the specified id, this method returns null. syntax var track = mediastream.gettrackbyid(id); parameters id a domstring which identifies the track to be returned. return value if a track is found for which mediastreamtrack.id matches the specified id string, that mediastreamtrack object is returned. otherwise, the returned value is null. example this example activates a commentary track on a video by ducking the audio level of the main audio track to 50%, then enabling the commentary track. stream.gettrackbyid("primary-audio-track").applyconstraints({ volume: 0.5 }); stream.gettrackbyid("commentary-track").enabled = true; specifica...
MediaStream.getTracks() - Web APIs
the gettracks() method of the mediastream interface returns a sequence that represents all the mediastreamtrack objects in this stream's track set, regardless of mediastreamtrack.kind. syntax var mediastreamtracks = mediastream.gettracks() parameters none. return value an array of mediastreamtrack objects. example navigator.mediadevices.getusermedia({audio: false, video: true}) .then(mediastream => { document.queryselector('video').srcobject = mediastream; // stop the stream after 5 seconds settimeout(() => { const tracks = mediastream.gettracks() tracks[0].stop() }, 5000) }) specifications specification status comment media capture and streamsthe definition of 'gettracks()' in that specification. candidate recommendation initial d...
MediaStream.getVideoTracks() - Web APIs
video tracks are those tracks whose kind property is video. the array is empty if the stream contains no video tracks. ...
MediaStream.onaddtrack - Web APIs
ds a track to the stream (such as when a rtcpeerconnection is renegotiated or a stream being captured using htmlmediaelement.capturestream() gets a new set of tracks because the media element being captured loaded a new source. the addtrack event does not get fired when javascript code explicitly adds tracks to the stream (by calling addtrack()). syntax mediastream.onaddtrack = eventhandler; value this should be set to a function which you provide that accepts as input a mediastreamtrackevent object representing the addtrack event which has occurred. the mediastreamtrack representing the track which was added is specified in the event's track property. example this example adds a listener which, when a new track is added to the stream, appends a new item to a list of tracks; the new ite...
MediaStream.onremovetrack - Web APIs
the stream (such as when a rtcpeerconnection is renegotiated or a stream being captured using htmlmediaelement.capturestream() gets a new set of tracks because the media element being captured loaded a new source. the removetrack event does not get fired when javascript code explicitly removes tracks from the stream (by calling removetrack()). syntax mediastream.onremovetrack = eventhandler; value this should be set to a function which you provide that accepts as input a mediastreamtrackevent object representing the removetrack event which has occurred. the mediastreamtrack representing the track which was removed is specified in the event's track property. example this example adds a listener which, when a track is removed from the stream, logs the track that was removed. stream.onrem...
MediaStreamAudioDestinationNode.MediaStreamAudioDestinationNode() - Web APIs
e. syntax var myaudiodest = new mediastreamaudiodestinationnode(context, options); parameters inherits parameters from the audionodeoptions dictionary. context an audiocontext representing the audio context you want the node to be associated with. options optional an audionodeoptions dictionary object defining the properties you want the mediastreamaudiodestinationnode to have. return value a new mediastreamaudiodestinationnode object instance. example var ac = new audiocontext(); var mydestination = new mediastreamaudiodestinationnode(ac); specifications specification status comment web audio apithe definition of 'mediastreamaudiodestinationnode' in that specification. working draft ...
MediaStreamAudioDestinationNode.stream - Web APIs
interface represents a mediastream containing a single audiomediastreamtrack with the same number of channels as the node itself. you can use this property to get a stream out of the audio graph and feed it into another construct, such as a media recorder. syntax var audioctx = new audiocontext(); var destination = audioctx.createmediastreamdestination(); var mystream = destination.stream; value a mediastream. example specifications specification status comment web audio apithe definition of 'stream' in that specification. working draft ...
MediaStreamAudioSourceNode() - Web APIs
astreamaudiosourcenode(context, options); parameters context an audiocontext representing the audio context you want the node to be associated with. options a mediastreamaudiosourceoptions object defining the properties you want the mediastreamaudiosourcenode to have: mediastream a required property which specifies the mediastream from which to obtain audio for the node. return value a new mediastreamaudiosourcenode object representing the audio node whose media is obtained from the specified source stream. exceptions invalidstateerror the specified mediastream doesn't have any audio tracks. examples this example uses getusermedia() to obtain access to the user's camera, then creates a new mediastreamaudiosourcenode from its mediastream. // define variables var audi...
MediaStreamAudioSourceNode.mediaStream - Web APIs
reamaudiosourcenode interface's read-only mediastream property indicates the mediastream that contains the audio track from which the node is receiving audio. this stream was specified when the node was first created, either using the mediastreamaudiosourcenode() constructor or the audiocontext.createmediastreamsource() method. syntax audiosourcestream = mediastreamaudiosourcenode.mediastream; value a mediastream representing the stream which contains the mediastreamtrack serving as the source of audio for the node. the user agent uses the first audio track it finds on the specified stream as the audio source for this node. however, there is no way to be certain which track that will be on multi-track streams. if the specific track matters to you, or you need to have access to the track it...
MediaStreamAudioSourceOptions.mediaStream - Web APIs
the mediastreamaudiosourceoptions dictionary's mediastream property must specify the mediastream from which to retrieve audio data when instantiating a mediastreamaudiosourcenode using the mediastreamaudiosourcenode() constructor. syntax mediastreamaudiosourceoptions = { mediastream: audiosourcestream; } mediastreamaudiosourceoptions.mediastream = audiosourcestream; value a mediastream representing the stream from which to use a mediastreamtrack as the source of audio for the node. example specifications specification status comment web audio apithe definition of 'mediastreamaudiosourceoptions.mediastream' in that specification. working draft ...
MediaStreamEvent() - Web APIs
mediastreameventinit is a mediastreameventinit dictionary, having the following fields: "stream" of type mediastream representing the stream being concerned by the event. "bubbles", optional and defaulting to false, inherited from eventinit, and indicating if the event must bubble or not. ...
MediaStreamTrack.clone() - Web APIs
the clone() method of the mediastreamtrack interface creates a duplicate of the mediastreamtrack. this new mediastreamtrack object is identical except for its unique id. syntax const newtrack = track.clone() return value a new mediastreamtrack instance which is identical to the one clone() was called, except for its new unique id. specifications specification status comment media capture and streamsthe definition of 'clone()' in that specification. candidate recommendation initial definition. ...
MediaStreamTrack.getCapabilities() - Web APIs
the getcapabilities() method of the mediastreamtrack interface returns a mediatrackcapabilities object which specifies the values or range of values which each constrainable property, based upon the platform and user agent. once you know what the browser's capabilities are, your script can use applyconstraints() to ask for the track to be configured to match ideal or acceptable settings. see capabilities, constraints, and settings for details on how to work with constrainable properties. syntax const capabilities = track.getcapabilities() return value a mediatrackcapabilities object which specifies the value or range of values which are supported for each of the user agent's supported constrainable properties. specifications specification status comment media cap...
MediaStreamTrack.getSettings() - Web APIs
the getsettings() method of the mediastreamtrack interface returns a mediatracksettings object containing the current values of each of the constrainable properties for the current mediastreamtrack. see capabilities, constraints, and settings for details on how to work with constrainable properties. syntax const settings = track.getsettings() returns a mediatracksettings object describing the current configuration of the track's constrainable properties. note: the returned object identifies the current values of every constrainable property, including those which are platform defaults rather than having been expressly set by the site's code. to instead fetch the most-recently established constraints for the track's properties, as specified by the site's code, use getconstraints(). spec...
MediaStreamTrack.kind - Web APIs
the mediastreamtrack.kind read-only property returns a domstring set to "audio" if the track is an audio track and to "video", if it is a video track. it doesn't change if the track is deassociated from its source. syntax const type = track.kind value the possible values are a domstring with on of the following values: "audio": the track is an audio track. "video": the track is a video track. specifications specification status comment media capture and streamsthe definition of 'mediastreamtrack.kind' in that specification. candidate recommendation initial specification. ...
MediaStreamTrack: mute event - Web APIs
note: the condition that most people think of as "muted" (that is, a user-toggled state of silencing a track) is actually managed using the mediastreamtrack.enabled property, for which there are no events. ...
MediaStreamTrack.onended - Web APIs
a function which serves as an eventhandler to be called when the ended event occurs on the track. this event occurs when the track will no longer provide data to the stream for any reason, including the end of the media input being reached, the user revoking needed permissions, the source device being removed, or the remote peer ending a connection. syntax mediastreamtrack.onended = function; value a function to serve as an eventhandler for the ended event. the event handler function receives a single parameter: the event object, which is a simple event object. examples this example sets up an event handler for the ended event which changes an on-screen icon to indicate that the track is no longer active. track.onended = function(event) { let statuselem = document.getelementbyid("stat...
MediaStreamTrack.onmute - Web APIs
the event handler function receives a single parameter: the event object, which is a simple event object. example in this example, an onmute handler is established to set the content html of an element to display the "muted speaker" emoji. ...
MediaStreamTrack.onoverconstrained - Web APIs
the mediastreamtrack.onoverconstrained event handler is a property called when the overconstrained event is received. such an event is sent when the track is again able to send data. syntax track.onoverconstrained = function; values function is the name of a user-defined function, without the () suffix or any parameters, or an anonymous function declaration, such as function(event) {...}. an event handler always has one single parameter, containing the event, here of type mediastreamerrorevent. example dc.onoverconstrained = function() { alert("overconstrained event detected!"); }; ...
MediaStreamTrack.onunmute - Web APIs
the event handler receives as input a single parameter: an event whose kind is "unmute". ...
MediaStreamTrack.readyState - Web APIs
in that case, the output of data can be switched on or off using the mediastreamtrack.enabled property. "ended" which indicates that the input is not giving any more data and will never provide new data. ...
MediaStreamTrack.remote - Web APIs
the mediastreamtrack.remote read-only property allows javascript to know whether a webrtc mediastreamtrack is from a remote source or a local one. it returns a boolean with a value of true if the track is sourced remotely (that is, sourced by an rtcpeerconnection), or false if it is sourced locally. syntax var bool ​= track.remote; ...
MediaStreamTrackAudioSourceNode() - Web APIs
treamtrackaudiosourcenode(context, options); parameters context an audiocontext representing the audio context you want the node to be associated with. options a mediastreamtrackaudiosourceoptions object defining the properties you want the mediastreamtrackaudiosourcenode to have: mediastreamtrack the mediastreamtrack from which to take audio data for this node's output. return value a new mediastreamtrackaudiosourcenode object representing the audio node whose media is obtained from the specified media track. exceptions notsupportederror the specified context is not an audiocontext. invalidstateerror the specified mediastreamtrack isn't an audio track (that is, its kind property isn't audio. example this example uses getusermedia() to obtain access to the user's c...
MediaStreamTrackAudioSourceOptions.mediaStreamTrack - Web APIs
iastreamtrackaudiosourceoptions dictionary's mediastreamtrack property must contain a reference to the mediastreamtrack from which the mediastreamtrackaudiosourcenode being created using the mediastreamtrackaudiosourcenode() constructor. syntax mediastreamtrackaudiosourceoptions = { mediastreamtrack: audiosourcetrack; } mediastreamtrackaudiosourceoptions.mediastreamtrack = audiosourcetrack; value a mediastreamtrack from which the audio output of the new mediastreamtrackaudiosourcenode will be taken. example this example uses getusermedia() to obtain access to the user's camera, then creates a new mediastreamaudiosourcenode from the first audio track provided by the device. let audioctx = new (window.audiocontext || window.webkitaudiocontext)(); if (navigator.mediadevices.getusermedia...
MediaStreamTrackEvent() - Web APIs
eamtrackevent(type, {track: amediastreamtrack}); parameters the mediastreamtrackevent() constructor also inherits arguments from event(). type a domstring representing the name of the type of the mediastreamtrackevent. it is case-sensitive and can be "addtrack" or "removetrack". track a mediastreamtrack object representing the track which was added to or removed from the stream. return value a new mediastreamtrackevent, initialized based on the provided options. specifications specification status comment media capture and streamsthe definition of 'mediastreamtrackevent()' in that specification. candidate recommendation ...
MediaStream Image Capture API - Web APIs
oint, you might want to configure the device capabilities before capturing an image. you can do this by calling applyconstraints() on the track object before doing anything else. let zoom = document.queryselector('#zoom'); const capabilities = track.getcapabilities(); // check whether zoom is supported or not. if(!capabilities.zoom) { return; } track.applyconstraints({ advanced : [{ zoom: zoom.value }] }); finally, pass the mediastreamtrack object to the imagecapture() constructor. though a mediastream holds several types of tracks and provides multiple methods for retrieving them, the imagecapture constructor will throw a domexception of type notsupportederror if mediastreamtrack.kind is not "video". let imagecapture = new imagecapture(track); interfaces imagecapture an interface f...
Recording a media element - Web APIs
resolution handler receives as input an array of media data blobs locally known as recordedchunks. the first thing we do is merge the chunks into a single blob whose mime type is "video/webm" by taking advantage of the fact that the blob() constructor concatenates arrays of objects into one object. then url.createobjecturl() is used to create an url that references the blob; this is then made the value of the recorded video playback element's src attribute (so that you can play the video from the blob) as well as the target of the download button's link. then the download button's download attribute is set. while the download attribute can be a boolean, you can also set it to a string to use as the name for the downloaded file. so by setting the download link's download attribute to "recordedv...
MediaTrackSettings.cursor - Web APIs
the mediatracksettings dictionary's cursor property indicates whether or not the cursor should be captured as part of the video track included in the mediastream returned by getdisplaymedia(). syntax cursorsetting = mediatracksettings.cursor; value the value of cursor comes from the cursorcaptureconstraint enumerated string type, and may have one of the following values: always the mouse should always be visible in the video content of the {domxref("mediastream"), unless the mouse has moved outside the area of the content. motion the mouse cursor should always be included in the video if it's moving, and for a short time after it stops moving. never the mouse cursor is never included in the shared video. specifications specification status comment screen ...
MediaTrackSupportedConstraints.cursor - Web APIs
the mediatracksupportedconstraints dictionary's cursor property indicates whether or not the cursor constraint is supported by the user agent and the device on which the content is being used. the supported constraints list is obtained by calling navigator.mediadevices.getsupportedconstraints(). syntax iscursorsupported = supportedconstraints.cursor; value a boolean value which is true if the cursor constraint is supported by the device and user agent. example this method sets up the constraints object specifying the options for the call to getdisplaymedia(). it adds the cursor constraint only if it is known to be supported by the browser. capturing is then started by calling getdisplaymedia() and attaching the returned stream to the video element referenced by the variable videoelem. ...
MediaTrackSupportedConstraints.displaySurface - Web APIs
the mediatracksupportedconstraints dictionary's displaysurface property indicates whether or not the displaysurface constraint is supported by the user agent and the device on which the content is being used. the supported constraints list is obtained by calling navigator.mediadevices.getsupportedconstraints(). syntax isdisplaysurfacesupported = supportedconstraints.displaysurface; value a boolean value which is true if the displaysurface constraint is supported by the device and user agent. example this method sets up the constraints object specifying the options for the call to getdisplaymedia(). it adds the displaysurface constraint (requesting that only full-screen sharing be allowed) only if it is known to be supported by the browser. capturing is then started by calling getdispla...
MediaTrackSupportedConstraints.logicalSurface - Web APIs
the mediatracksupportedconstraints dictionary's logicalsurface property indicates whether or not the logicalsurface constraint is supported by the user agent and the device on which the content is being used. the supported constraints list is obtained by calling navigator.mediadevices.getsupportedconstraints(). syntax islogicalsurfacesupported = supportedconstraints.logicalsurface; value a boolean value which is true if the logicalsurface constraint is supported by the device and user agent. example this method sets up the constraints object specifying the options for the call to getdisplaymedia(). it adds the logicalsurface constraint (requesting that only logical display surfaces—those which may not be entirely visible onscreen—be included among the options available to the user)...
Media Capabilities API - Web APIs
media capabilities dictionaries mediaconfiguration describes how video and audio configuration dictionaries must be configured, or defined, to be passed as a parameter of the mediacapabilities.encodinginfo() and mediacapabilities.decodinginfo() methods. it is inherited by the mediadecodingconfiguration and mediaencodingconfiguration dictionaries. mediadecodingconfiguration defines the valid values for allowed types of media when the media configuration is submitted as the parameter for mediacapabilities.decodinginfo(). consists of a media decoding type and a videoconfiguration or audioconfiguration dictionary. mediaencodingconfiguration defines the valid values for allowed types of media when the media configuration is submitted as the parameter for mediacapabilities.encodinginfo(). con...
Media Capture and Streams API (Media Stream) - Web APIs
elow provide additional guidance and how-to information that will help you learn to use the api, and how to perform specific tasks that you may wish to handle. capabilities, constraints, and settingsthe twin concepts of constraints and capabilities let the browser and web site or app exchange information about what constrainable properties the browser's implementation supports and what values it supports for each one. this article discusses capabilities and constraints, as well as media settings, and includes an example we call the constraint exerciser. ...
MerchantValidationEvent() - Web APIs
which may contain zero or more of the following properties: methodname optional a domstring containing the payment method identifier for the payment handler being used. this is an empty string by default. validationurl optional the url from which to retrieve payment handler specific verification information used to validate the merchant. this is an empty string by default. return value a newly-created merchantvalidationevent providing the information that needs to be delivered to the client-side code to present to the user agent by calling complete(). exceptions typeerror the string specified as validationurl could not be parsed as a url. rangeerror the specified methodname does not correspond to a known and supported merchant or is not a well-formed standard payment me...
MerchantValidationEvent.complete() - Web APIs
the merchantvalidation event, passing in the data fetched from the validationurl. syntax merchantvalidationevent.complete(validationdata); merchantvalidationevent.complete(merchantsessionpromise); parameters validationdata or merchantsessionpromise an object containing the data needed to complete the merchant validation process, or a promise which resolves to the validation data. return value undefined. exceptions this exception may be passed into the rejection handler for the promise: invalidstateerror the event did not come directly from the user agent, but was instead dispatched by other code. another payment request is currently being processed, the current payment request is not currently being displayed to the user, or payment information is currently being updated. exa...
MessageChannel.port1 - Web APIs
example in the following code block, you can see a new channel being created using the messagechannel() constructor. ...
MessageChannel.port2 - Web APIs
the port2 read-only property of the messagechannel interface returns the second port of the message channel — the port attached to the context at the other end of the channel, which the message is initially sent to. note: this feature is available in web workers. syntax channel.port2; value a messageport object representing the second port of the channel, the port attached to the context at the other end of the channel. example in the following code block, you can see a new channel being created using the messagechannel.messagechannel constructor. when the iframe has loaded, we pass port2 to the iframe using messageport.postmessage along with a message. the handlemessage handler then responds to a message being sent back from the iframe (using messageport.onmessage), putting it into a...
MessageEvent.data - Web APIs
Web › API › MessageEvent › data
the data read-only property of the messageevent interface represents the data sent by the message emitter. syntax var data = messageevent.data; value the data sent by the message emitter; this can be any data type. example myworker.onmessage = function(e) { result.textcontent = e.data; console.log('message received from worker'); }; specifications specification status comment html living standardthe definition of 'messageevent: data' in that specification. living standard ...
MessageEvent.lastEventId - Web APIs
the lasteventid read-only property of the messageevent interface is a domstring representing a unique id for the event. syntax var myid = messageevent.lasteventid; value a domstring representing the id. example myworker.onmessage = function(e) { result.textcontent = e.data; console.log('message received from worker'); console.log(e.lasteventid); }; specifications specification status comment html living standardthe definition of 'messageevent: lasteventid' in that specification. living standard ...
MessageEvent.origin - Web APIs
the origin read-only property of the messageevent interface is a usvstring representing the origin of the message emitter. syntax var origin = messageevent.origin; value a usvstring representing the origin. example myworker.onmessage = function(e) { result.textcontent = e.data; console.log('message received from worker'); console.log(e.origin); }; specifications specification status comment html living standardthe definition of 'messageevent: origin' in that specification. living standard ...
MessageEvent.ports - Web APIs
the ports read-only property of the messageevent interface is an array of messageport objects representing the ports associated with the channel the message is being sent through (where appropriate, e.g. in channel messaging or when sending a message to a shared worker). syntax var myports = messageevent.ports; value an array of messageport objects. example onconnect = function(e) { var port = e.ports[0]; port.addeventlistener('message', function(e) { var workerresult = 'result: ' + (e.data[0] * e.data[1]); port.postmessage(workerresult); }); port.start(); // required when using addeventlistener. otherwise called implicitly by onmessage setter. } specifications specification status comment html living standardthe definition of 'ports' in that s...
MessageEvent.source - Web APIs
the source read-only property of the messageevent interface is a messageeventsource (which can be a windowproxy, messageport, or serviceworker object) representing the message emitter. syntax let mysource = messageevent.source; value a messageeventsource (which can be a windowproxy, messageport, or serviceworker object) representing the message emitter. example myworker.onmessage = function(e) { result.textcontent = e.data; console.log('message received from worker'); console.log(e.source); }; specifications specification status comment html living standardthe definition of ' messageevent: source' in that specification. living standard ...
MessagePort.close() - Web APIs
Web › API › MessagePort › close
is feature is available in web workers. syntax port.close() returns void. parameters none. example in the following code block, you can see a handlemessage handler function, run when a message is sent back to this document using eventtarget.addeventlistener. channel.port1.addeventlistener('message', handlemessage, false); function handlemessage(e) { para.innerhtml = e.data; textinput.value = ''; } channel.port1.start(); you could stop messages being sent at any time using channel.port1.close(); specifications specification status comment html living standardthe definition of 'close()' in that specification. living standard ...
MessagePort: message event - Web APIs
g code like this: const channel = new messagechannel(); const myport = channel.port1; const targetframe = window.top.frames[1]; const targetorigin = 'https://example.org'; const messagecontrol = document.queryselector('#message'); const channelmessagebutton = document.queryselector('#channel-message'); channelmessagebutton.addeventlistener('click', () => { myport.postmessage(messagecontrol.value); }) targetframe.postmessage('init', targetorigin, [channel.port2]); the target can receive the port and start listening for messages on it using code like this: window.addeventlistener('message', (event) => { const myport = event.ports[0]; myport.addeventlistener('message', (event) => { received.textcontent = event.data; }); myport.start(); }); note that the listene...
MessagePort: messageerror event - Web APIs
g code like this: const channel = new messagechannel(); const myport = channel.port1; const targetframe = window.top.frames[1]; const targetorigin = 'https://example.org'; const messagecontrol = document.queryselector('#message'); const channelmessagebutton = document.queryselector('#channel-message'); channelmessagebutton.addeventlistener('click', () => { myport.postmessage(messagecontrol.value); }) targetframe.postmessage('init', targetorigin, [channel.port2]); the target can receive the port and start listening for messages and message errors on it using code like this: window.addeventlistener('message', (event) => { const myport = event.ports[0]; myport.addeventlistener('message', (event) => { received.textcontent = event.data; }); myport.addeventlistener...
MessagePort.start() - Web APIs
Web › API › MessagePort › start
living standard ...
Metadata.modificationTime - Web APIs
e object which specifies the date and time the file system entry (or the data referenced by the entry) was last modified.a file system entry is considered to have been modified if the metadata or the contents of the referenced file (or directory, or whatever other kind of file system entry might exist on the platform in use) has changed. syntax var modificationtime = metadata.modificationtime; value a date timestamp indicating when the file system entry was last changed. example this example tries to get a particular working file at tmp/workfile.json. once that file has been found, its metadata is obtained and the file's modification timestamp year is compared to the current year. if it was last modified in a year at least five prior to the current year, the file is removed and a new one ...
Metadata.size - Web APIs
Web › API › Metadata › size
example this example checks the size of a log file and removes it if it's larger than a megabyte. ...
MouseEvent.WEBKIT_FORCE_AT_FORCE_MOUSE_DOWN - Web APIs
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. mouseevent.webkit_force_at_force_mouse_down is a proprietary, webkit-specific, static numeric property whose value is the minimum force necessary for a force click. because webkit_force_at_force_mouse_down is a static property of mouseevent, you always use it as mouseevent.webkit_force_at_force_mouse_down, rather than as a property of a mouseevent instance. specifications not part of any specification. apple has a description at the mac developer library. ...
MouseEvent.WEBKIT_FORCE_AT_MOUSE_DOWN - Web APIs
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. mouseevent.webkit_force_at_mouse_down is a proprietary, webkit-specific, static numeric property whose value is the minimum force necessary for a normal click. because webkit_force_at_mouse_down is a static property of mouseevent, you always use it as mouseevent.webkit_force_at_mouse_down, rather than as a property of a mouseevent instance. specifications not part of any specification. apple has a description at the mac developer library. ...
MouseEvent.altKey - Web APIs
Web › API › MouseEvent › altKey
key was pressed or not when a given mouse event occurs. be aware that the browser can't always detect the alt key on some operating systems. on some linux variants, for example, a left mouse click combined with the alt key is used to move or resize windows. note: on macintosh keyboards, this key is also known as the option key. syntax var altkeypressed = instanceofmouseevent.altkey return value a boolean, where true indicates that the key is pressed, and false indicates that the key is not pressed. example this example logs the altkey property when you trigger a click event. html <p>click anywhere to test the <code>altkey</code> property.</p> <p id="log"></p> javascript let log = document.queryselector('#log'); document.addeventlistener('click', logkey); function logkey(e) { l...
MouseEvent.clientX - Web APIs
the clientx read-only property of the mouseevent interface provides the horizontal coordinate within the application's client area at which the event occurred (as opposed to the coordinate within the page). for example, clicking on the left edge of the client area will always result in a mouse event with a clientx value of 0, regardless of whether the page is scrolled horizontally. syntax var x = instanceofmouseevent.clientx return value a double floating point value, as redefined by the cssom view module. originally, this property was defined as a long integer. see the "browser compatibility" section for details. example this example displays your mouse's coordinates whenever you trigger the mousemove event. html <p>move your mouse to see its position.</p> <p id="screen-log"></p> j...
MouseEvent.clientY - Web APIs
the clienty read-only property of the mouseevent interface provides the vertical coordinate within the application's client area at which the event occurred (as opposed to the coordinate within the page). for example, clicking on the top edge of the client area will always result in a mouse event with a clienty value of 0, regardless of whether the page is scrolled vertically. syntax var y = instanceofmouseevent.clienty return value a double floating point value, as redefined by the cssom view module. originally, this property was defined as a long integer. see the "browser compatibility" section for details. example this example displays your mouse's coordinates whenever you trigger the mousemove event. html <p>move your mouse to see its position.</p> <p id="screen-log"></p> javasc...
MouseEvent.ctrlKey - Web APIs
example this example logs the ctrlkey property when you trigger a click event. ...
MouseEvent.getModifierState() - Web APIs
the mouseevent.getmodifierstate() method returns the current state of the specified modifier key: true if the modifier is active (i.e., the modifier key is pressed or locked), otherwise, false. see the document of keyboardevent.getmodifierstate() for details. syntax var active =​ event.getmodifierstate(keyarg); returns a boolean parameters keyarg a modifier key value. the value must be one of the keyboardevent.key values which represent modifier keys or "accel". this is case-sensitive. specifications specification status comment document object model (dom) level 3 events specificationthe definition of 'getmodifierstate()' in that specification. obsolete initial definition. ...
MouseEvent.metaKey - Web APIs
aware that many operating systems bind special functionality to the meta key, so this property may be false even when the key is actually pressed. on windows, for example, this key may open the start menu. note: on macintosh keyboards, this key is the command key (⌘). on windows keyboards, this key is the windows key (⊞). syntax var metakeypressed = instanceofmouseevent.metakey return value a boolean, where true indicates that the key is pressed, and false indicates that the key is not pressed. example this example logs the metakey property when you trigger a click event. html <p>click anywhere to test the <code>metakey</code> property.</p> <p id="log"></p> javascript let log = document.queryselector('#log'); document.addeventlistener('click', logkey); function logkey(e) { ...
MouseEvent.movementX - Web APIs
the movementx read-only property of the mouseevent interface provides the difference in the x coordinate of the mouse pointer between the given event and the previous mousemove event. in other words, the value of the property is computed like this: currentevent.movementx = currentevent.screenx - 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.addeventlisten...
MouseEvent.movementY - Web APIs
the movementy read-only property of the mouseevent interface provides the difference in the y coordinate of the mouse pointer between the given event and the previous mousemove event. in other words, the value of the property is computed like this: currentevent.movementy = currentevent.screeny - previousevent.screeny. syntax var yshift = instanceofmouseevent.movementy; 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.innertext = `movement: ${event.movementx}, ${event.movementy}\n${log.innertext}`; } const log = document.getelementbyid('log'); document.addeventlistener('mousemove', logmovement); result specifications spe...
MouseEvent.mozInputSource - Web APIs
ad-only property on mouseevent provides information indicating the type of device that generated the event. this lets you, for example, determine whether a mouse event was generated by an actual mouse or by a touch event (which might affect the degree of accuracy with which you interpret the coordinates associated with the event). syntax var source = instanceofmouseevent.mozinputsource; return value the following values are possible. constant name value desription moz_source_unknown 0 the input device is unknown. moz_source_mouse 1 the event was generated by a mouse (or mouse-like device). moz_source_pen 2 the event was generated by a pen on a tablet. moz_source_eraser 3 the event was generated by an eraser on a tab...
MouseEvent.region - Web APIs
Web › API › MouseEvent › region
example example of using the event.region combined with canvasrenderingcontext2d.addhitregion() method. ...
MouseEvent.relatedTarget - Web APIs
ointing device entered to the eventtarget the pointing device exited from dragexit the eventtarget the pointing device exited from the eventtarget the pointing device entered to for events with no secondary target, relatedtarget returns null. focusevent.relatedtarget is a similar property for focus events. syntax var target = instanceofmouseevent.relatedtarget return value an eventtarget object or null. example try moving your mouse cursor into and out of the red and blue boxes. html <body id="body"> <div id="outer"> <div id="red"></div> <div id="blue"></div> </div> <p id="log"></p> </body> css #outer { width: 250px; height: 125px; display: flex; } #red { flex-grow: 1; background: red; } #blue { flex-grow: 1; background: blue; }...
MouseEvent.shiftKey - Web APIs
example this example logs the shiftkey property when you trigger a click event. ...
MouseEvent.webkitForce - Web APIs
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. mouseevent.webkitforce is a proprietary, webkit-specific numeric property whose value represents the amount of pressure that is being applied on the touchpad or touchscreen. specifications not part of any specification. apple has a description at the mac developer library. ...
MouseEvent.which - Web APIs
Web › API › MouseEvent › which
the mouseevent.which read-only property indicates which button was pressed on the mouse to trigger the event. the standard alternatives to this property are mouseevent.button and mouseevent.buttons. syntax var buttonpressed = instanceofmouseevent.which return value a number representing a given button: 0: no button 1: left button 2: middle button (if present) 3: right button for a mouse configured for left-handed use, the button actions are reversed. in this case, the values are read from right to left. specification this is not part of any specification. ...
MouseScrollEvent - Web APIs
vertical_axis 0x02 the event is caused by vertical wheel operation. methods initmousescrollevent() see nsidommousescrollevent::initmousescrollevent(). ...
MouseWheelEvent - Web APIs
vents. like mousescrollevent, this interface is non-standard and deprecated. it was used in non-gecko browsers only. instead use the standard wheelevent. properties attribute type description wheeldelta read only long the distance in pixels (defined as so by msdn, but the actual usage is different, see mousewheel). wheeldeltax read only long? the value along horizontal axis of wheeldelta. wheeldeltay read only long? the value along vertical axis of wheeldelta. ...
msFirstPaint - Web APIs
time when the document loaded by the window object began to be displayed to the user. put another way, msfirstpaint utilizes the browser to measure when the first content completes being painted in the window. it is available from javascript and can be reported from the field. this proprietary property is specific to internet explorer and microsoft edge. syntax p = object.msfirstpaint; value an integer value that represents the time when the document began to be displayed or 0 if the document could not be loaded. the numerical value reported represents the number of milliseconds between the recorded time and midnight january 1, 1970 (utc). this property is supported only for documents displayed in ie9 standards mode. example the following example shows how to calculate the time ...
msIsBoxed - Web APIs
Web › API › MsIsBoxed
at of a video, and the aspect ratio of the screen. typically the video's left and right edges go to the full width of the screen. pillarbox format displays black bars on the left and right of a video to fill in the difference between a video and a wider screen. with pillarbox format, the top and bottom edges of the video go to the full height of the screen. syntax isboxed = object.msisboxed value boolean value set to true activates boxed mode for the video player. boolean value set to false means the video player is zoomed to fill the screen. ...
msPlayToDisabled - Web APIs
es facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. msplaytodisabled is a read/write property which gets and sets if the playto device is enabled or disabled. this proprietary property is specific to internet explorer and microsoft edge. syntax ptr = object.msplaytodisabled; value boolean value set to true indicates that the playto device is disabled. the msplaytodisabled attribute extends the htmlembedelement, htmlimageelement, htmlmediaelement, and htmlobject interfaces. ...
msPlayToPreferredSourceUri - Web APIs
msplaytopreferredsourceuri is a read/write property which gets or sets the path to the preferred media source. this enables the playto target device to stream the media content, which can be drm protected, from a different location, such as a cloud media server. this proprietary property is specific to internet explorer and microsoft edge. syntax ptr = object.msplaytopreferredsourceuri; value msplaytopreferredsourceuri enables a playto reference (a uri or url) for streaming content on the playto target device from a different location, such as a cloud media server. this enables web pages and microsoft store apps to play digital rights management (drm) protected content. the app specifies a preferred uniform resource identifier (uri). this uri can point to a cloud based media server a...
msPlayToPrimary - Web APIs
n production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. msplaytoprimary is a read/write property which gets or sets the primary dlna playto device. this proprietary property is specific to internet explorer and microsoft edge. syntax ptr = object.msplaytoprimary; value boolean value set to true indicates that the device is the primary dlna playto device, otherwise false. example // microsoft extensions interface htmlimageelement : htmlelement { attribute boolean msplaytodisabled; attribute boolean msplaytoprimary; attribute domstring msplaytopreferredsourceuri; }; see also htmlme...
msRealTime - Web APIs
ng the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. msrealtime is a read/write property which specifies whether or not to enable low-latency playback on the media element. this proprietary property is specific to internet explorer and microsoft edge. syntax ptr = object.msrealtime; value boolean value set to true indicates that low-latency playback will be enabled on the media element. low-latency playback is useful in communication and some gaming scenarios, but is more demanding on power consumption and less reliable for smooth media playback. you must set the msrealtime before setting the src property in code. msrealtime should not be used in non-real-time or non-communicat...
MutationObserver.disconnect() - Web APIs
note: all notifications of mutations that have already been detected, but not yet reported to the observer, are discarded. usage notes if the element being observed is removed from the dom, and then subsequently released by the browser's garbage collection mechanism, the mutationobserver is likewise deleted. ...
MutationObserver.takeRecords() - Web APIs
ut not yet processed by the observer's callback function, leaving the mutation queue empty. the most common use case for this is to immediately fetch all pending mutation records immediately prior to disconnecting the observer, so that any pending mutations can be processed when stopping down the observer. syntax const mutationrecords = mutationobserver.takerecords() parameters none. return value an array mutationrecord objects, each describing one change applied to the observed portion of the document's dom tree. note: the queue of mutations which have occurred, but not been delivered to the observer's callback is left empty after calling takerecords(). example in this example, we demonstrate how to handle any undelivered mutationrecords by calling takerecords() just before disconn...
MutationObserverInit.childList - Web APIs
ether or not to monitor the specified node or nodes for the addition or removal of new child nodes. if childlist is false (the default), adding or removing new nodes does not trigger mutation callbacks. by setting childlist to true, your callback will be invoked any time nodes are added to or removed from the dom node or nodes being watched. syntax var options = { childlist: true | false } value a boolean value indicating whether or not to invoke the callback function when new nodes are added to or removed from the section of the dom being monitored.. if subtree is false, only the node indicated by the observer's target node is monitored for changes. setting subtree to true causes addition or removal of nodes anywhere within the subtree rooted at target to be reported. example specifi...
NDEFMessage.records - Web APIs
the records property of ndefmessage interface represents a list of ndefrecords defining the ndef message. syntax var recordlist = ndefmessage.records; value a list of ndefrecord object that represent data recorded in the message. specifications specification status comment web nfc, dnefmessage.records draft initial definition. ...
NDEFReader() - Web APIs
specifications specification status comment web nfc, ndefreader draft initial definition. ...
NDEFReader.scan() - Web APIs
Web › API › NDEFReader › scan
fc tags. syntax var readerpromise = ndefreader.scan(options); parameters options optional id -- the match pattern for matching each ndefrecord.id. recordtype -- the match pattern for matching each ndefrecord.recordtype. mediatype -- the match pattern for matching each ndefrecord.mediatype. signal -- optional abortsignal that allows to cancell this scan() operation. return value a promise that resolves with undefined immediatelly after scheduling read operations for the nfc adapter. exceptions this method doesn't throw true exceptions; instead, it rejects the returned promise, passing into it a domexception whose name is one of the following: aborterror the scan operation was aborted with abortsignal passed in options. notallowederror the permission for this ope...
NDEFRecord() - Web APIs
specifications specification status comment web nfc, ndefrecord draft initial definition. ...
NDEFRecord.data - Web APIs
Web › API › NDEFRecord › data
the data property of the ndefrecord interface is dataview providing access to the payload data of the record. it provides access to a raw content of the record and thus data consumer might need to decode it. syntax ndefrecord.data value a dataview that contains encoded payload data of the record. specifications specification status comment web nfc, ndefrecord.data draft initial definition. ...
NDEFRecord.encoding - Web APIs
the encoding property ofthe ndefrecord interface is usvstring containing the name of the encoding used to encode ndef payload if it contains textual data. syntax ndefrecord.encoding value a usvstring which can be one of the following: "utf-8", "utf-16", "utf-16le" or "utf-16be". specifications specification status comment web nfc, ndefrecord.encoding draft initial definition. ...
NDEFRecord.id - Web APIs
Web › API › NDEFRecord › id
ndefrecord interface is usvstring containing the record identifier. this identifier is created by the generator of the record which is solely responsible for enforcing record identifier uniqueness. web nfc does not sign the nfc content, thus record consumer should not make any assumptions about integrity or authenticity of the identifier or any other part of the records. syntax ndefrecord.id value a usvstring. specifications specification status comment web nfc, ndefrecord draft initial definition. ...
NDEFRecord.lang - Web APIs
Web › API › NDEFRecord › lang
the lang property ofthe ndefrecord interface is usvstring containing the language tag of the record contents, if it is a vailable. the record might be missing a language tag, for example, if the recorded information is not locale-specific. syntax ndefrecord.lang value a usvstring. specifications specification status comment web nfc, ndefrecord.lang draft initial definition. ...
NDEFRecord.mediaType - Web APIs
the mediatype property ofthe ndefrecord interface is usvstring containing the mime type of the record payload. syntax ndefrecord.mediatype value a usvstring, corresponding to a mime type of the record payload. specifications specification status comment web nfc, ndefrecord.mediatype draft initial definition. ...
NDEFRecord.recordType - Web APIs
"text" represents a text ndef record. "url" represents an uri ndef record. "smart-poster" represents a "smart poster" ndef record. "absolute-url" represents an absolute url ndef record. "mime" represents a mime type ndef record. "unknown" represents an unknown ndef record. local type name represents a local type name, frequently used to specify ndef record embedded within another record. ...
NDEFRecord.toRecords() - Web APIs
the torecords() method of the ndefrecord interface of web nfc api parses record payload ndefrecord.data besed on ndefrecord.recordtype and returns the result. in practice, it's possible to implement the parsing mechanism manually, but this method simplifies the process. syntax ndefrecord.torecords() parameters none. return value a list of ndefrecords. exceptions notsupported the user agent does not know how to parse this combination of ndefrecord.data and ndefrecord.recordtype. specifications specification status comment web nfc, ndefrecord.torecords() draft initial definition. ...
NDEFWriter() - Web APIs
specifications specification status comment web nfc, ndefwriter draft initial definition. ...
NDEFWriter.write() - Web APIs
Web › API › NDEFWriter › write
mstring or buffersource or ndefmessageinit. options optional ignoreread -- boolean specifying whether or not to skip reading for the activated reader objects. will be ignored if overwrite is false. overwrite -- boolean specifying whether or not existing record should be overwritten, if such exists. signal -- optional abortsignal that allows to cancell this write operation. return value a promise that resolves with undefined when and if the message transfer is successfully completed. exceptions this method doesn't throw true exceptions; instead, it rejects the returned promise, passing into it a domexception whose name is one of the following: aborterror the write operation was aborted with abortsignal passed in options. notallowederror the permission for this operation...
NameList - Web APIs
Web › API › NameList
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. note: although 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 statu...
Navigation Timing API - Web APIs
on time api, the navigation timing api adds two properties: timing and navigation, of the types below. performancenavigationtiming provides methods and properties to store and retrieve metrics regarding the browser's document navigation events. for example, this interface can be used to determine how much time it takes to load or unload a document. performancetiming used as the type for the value of timing, objects of this type contain timing information that can provide insight into web page performance. performancenavigation the type used to return the value of navigation, which contains information explaining the context of the load operation described by this performance instance. the navigation timing api can be used to gather performance data on the client side to be sent to ...
Navigator.buildID - Web APIs
Web › API › Navigator › buildID
returns the build identifier of the browser. in modern browsers this property now returns a fixed timestamp as a privacy measure, e.g. 20181001000000 in firefox 64 onwards. syntax buildid = navigator.buildid; value a string representing the build identifier of the application. the build id is in the form yyyymmddhhmmss. example console.log(window.navigator.buildid); specification not part of any public standard. ...
Navigator.canShare() - Web APIs
the navigator.canshare() method of the web share api returns true if a call to navigator.share() would succeed. syntax var canshare = navigator.canshare(data); parameters data optional an object containing data to share that matches what you would pass to navigator.share(). return value a boolean. true if data can be shared with navigator.share(). exceptions none. examples if(navigator.canshare(data)) { // we can use share() to share the data! woop! } specifications specification status comment web share api - level 2the definition of 'canshare' in that specification. draft initial definition. ...
Navigator.clipboard - Web APIs
d api can be used to implement cut, copy, and paste features within a web application. use of the asynchronous clipboard read and write methods requires that the user grant the web site or app permission to access the clipboard. this permission must be obtained from the permissions api using the "clipboard-read" and/or "clipboard-write" permissions. syntax theclipboard = navigator.clipboard; value the clipboard object used to access the system clipboard. examples the following code uses navigator.clipboard to access the system clipboard in order to read the contents of the clipboard. navigator.clipboard.readtext().then( cliptext => document.queryselector(".cliptext").innertext = cliptext); this snippet replaces the contents of the element whose class is "cliptext" with the text cont...
Navigator.connection - Web APIs
the navigator.connection read-only property returns a networkinformation object containing information about the system's connection, such as the current bandwidth of the user's device or whether the connection is metered. this could be used to select high definition content or low definition content based on the user's connection. syntax networkinformation = navigator.connection value a networkinformation object. specifications specification status comment network information apithe definition of 'navigator.connection' in that specification. draft initial specification ...
Navigator.cookieEnabled - Web APIs
the property is read-only. syntax var cookieenabled = navigator.cookieenabled; cookieenabled is a boolean: true or false. note: when the browser is configured to block third-party cookies, and navigator.cookieenabled is invoked inside a third-party iframe, it returns true in safari, edge spartan and ie (while trying to set a cookie in such scenario would fail). it returns false in firefox and chromium-based browsers. note: web browsers may prevent writing certain cookies in certain scenarios. for example, chrome 80+ does not allow creating cookies with samesite=none attribute, unless they are created over https and with secure attribute. ...
Navigator.credentials - Web APIs
the credentials property of the navigator interface returns the credentialscontainer interface, which exposes methods to request credentials. the credentialscontainer interface also notifies the user agent when an interesting event occurs, such as a successful sign-in or sign-out. this interface can be used for feature detection. syntax var credentialscontainer = navigator.credentials value the credentialscontainer interface. example if ('credentials' in navigator) { navigator.credentials.get({password: true}) .then(function(creds) { //do something with the credentials. }); } else { //handle sign-in the way you did before. }; specifications specification status comment credential management level 1 working draft initial definition.
Navigator.deviceMemory - Web APIs
the devicememory read-only property of the navigator interface returns the approximate amount of device memory in gigabytes. the reported value is imprecise to curtail fingerprinting. it’s approximated by rounding down to the nearest power of 2, then dividing that number by 1024. it is then clamped within lower and upper bounds to protect the privacy of owners of very low- or high-memory devices. syntax memoryamount = navigator.devicememory value a floating point number; one of 0.25, 0.5, 1, 2, 4, 8. example const memory = navigator.devicememory console.log (`this device has at least ${memory}gib of ram.`) specifications specification status comment device memory 1the definition of 'devicememory' in that specification. editor's draft ini...
Navigator.doNotTrack - Web APIs
the navigator.donottrack property returns the user's do not track setting, which indicates whether the user is requesting web sites and advertisers to not track them. the value of the property reflects that of the dnt http header, i.e. values of "1", "0", or "unspecified". example console.log(navigator.donottrack); // prints "1" if dnt is enabled; "0" if the user opted-in for tracking; otherwise this is "unspecified" specifications specification status comment tracking preference expression (dnt)the definition of 'navigator.donottrack' in that specification. obsolete initial definition ...
Navigator.getBattery() - Web APIs
ved in a batterymanager object providing also some new events you can handle to monitor the battery status. this implements the battery status api; see that documentation for additional details, a guide to using the api, and sample code. note: in some browsers access to this feature is controlled by feature-policy directive battery. syntax var batterypromise = navigator.getbattery(); return value a promise which, when resolved, calls its fulfillment handler with a single parameter: a batterymanager object which you can use to get information about the battery's state. exceptions this method doesn't throw true exceptions; instead, it rejects the returned promise, passing into it a domexception whose name is one of the following: securityerror the user agent does not expose battery i...
Navigator.getUserMedia() - Web APIs
'video'); video.srcobject = stream; video.onloadedmetadata = function(e) { // do something with the video here. }; } errorcallback when the call fails, the function specified in the errorcallback is invokedwith a mediastreamerror object as its sole argument; this object is is modeled on domexception. see {anch("errors")}} below for a list of the errors which can occur. return value undefined. errors examples width and height here's an example of using getusermedia(), including code to cope with various browsers' prefixes. note that this is the deprecated way of doing it: see the examples section under the mediadevices.getusermedia() for modern examples. navigator.getusermedia = navigator.getusermedia || navigator.webkitgetusermedia || ...
Navigator.keyboard - Web APIs
specifications specification status comment keyboard mapthe definition of 'keyboard' in that specification. editor's draft initial definition. ...
Navigator.locks - Web APIs
Web › API › Navigator › locks
the locks read-only property of the navigator interface returns a lockmanager object which provides methods for requesting a new lock object and querying for an existing lock object. syntax var lockmanager = navigator.locks value a lockmanager object. specifications specification status comment web locks apithe definition of 'locks' in that specification. draft initial definition. ...
Navigator.mediaCapabilities - Web APIs
the navigator.mediacapabilities read-only property returns a mediacapabilities object that can expose information about the decoding and encoding capabilities for a given format and output capabilities as defined by the media capabilities api. syntax mediacapabilitiesobj = globalobj.navigator.mediacapabilities value a mediacapabilities object. examples navigator.mediacapabilities.decodinginfo({ type : 'file', audio : { contenttype : "audio/mp3", channels : 2, bitrate : 132700, samplerate : 5200 } }).then(function(result) { console.log('this configuration is ' + (result.supported ? '' : 'not ') + 'supported, ' + (result.smooth ? '' : 'not ') + 'smooth, and ' + (result.powerefficient ? '' : 'not ') + 'power efficient.
Navigator.mediaDevices - Web APIs
the navigator.mediadevices read-only property returns a mediadevices object, which provides access to connected media input devices like cameras and microphones, as well as screen sharing. syntax var mediadevices = navigator.mediadevices; return value the mediadevices singleton object. usually, you just use this object's members directly, such as by calling navigator.mediadevices.getusermedia(). specifications specification status comment media capture and streamsthe definition of 'navigatorusermedia.mediadevices' in that specification. candidate recommendation initial definition. ...
Navigator.mediaSession - Web APIs
ler() method, which lets you receive events when the user engages device controls such as either onscreen or physical play, pause, seek, and other similar controls. an internet radio app, for example, can use setactionhandler() to let fhe media controls on a keyboard or elsehwere on the user's device be used to control the app's media playback. syntax let mediasession = navigator.mediasession; value a mediasession object the current document can use to share information about media it's playing and its current playback status. this information can include typical metadata such as the title, artist, and album name of the song being played as well as potentially one or more images containing things like album art, artist photos, and so forth. example in this example, metadata is submitted t...
Navigator.msLaunchUri() - Web APIs
arameters uri a domstring specifying the url containing including the protocol of the document or resource to be displayed. successcallbackoptional a function matching the signature of mslaunchuricallback to be executed if the protocol handler is present. nohandlercallbackoptional a function matching mslaunchuricallback to be executed if the protocol handler is not present. return value undefined. usage notes if a default protocol handler is available on the system that matches the uri, the successcallback is invoked, otherwise, the nohandlercallback is called. to help protect a user's privacy, windows displays a prompt for the user to allow the service or app to be launched. the user can choose to not see the prompt after the first instance for a particular protocol and aut...
msSaveBlob - Web APIs
the navigator.mssaveblob() method saves the file or blob to disk. this method behaves in the same way as navigator.mssaveoropenblob() except that this disables the file open option. syntax navigator.mssaveblob(blob, 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 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=<...
msSaveOrOpenBlob - Web APIs
the navigator.mssaveoropenblob() method saves the file or blob to disk. this method behaves in the same way as navigator.mssaveblob() except that this enables the file open option. syntax navigator.mssaveoropenblob(blob, 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.permissions - Web APIs
the navigator.permissions read-only property returns a permissions object that can be used to query and update permission status of apis covered by the permissions api. syntax permissionsobj = globalobj.navigator.permissions value a permissions object. examples navigator.permissions.query({name:'geolocation'}).then(function(result) { if (result.state === 'granted') { showmap(); } else if (result.state === 'prompt') { showbuttontoenablemap(); } // don't do anything if the permission was denied. }); specification specification status comment permissions working draft initial definition. ...
Navigator.registerContentHandler() - Web APIs
o the handler as a string. title is the title of the handler presented to the user as a string. example navigator.registercontenthandler( "application/vnd.mozilla.maybe.feed", "http://www.example.tld/?foo=%s", "my feed reader" ); notes for firefox 2 and above, only the application/vnd.mozilla.maybe.feed, application/atom+xml, and application/rss+xml mime types are supported. all values have the same effect, and the registered handler will receive feeds in all atom and rss versions (see bug 391286). firefox is the only browser that implemented this feature, and it wasn't implemented to match the standard. this feature has since been removed from the html standard and shouldn't be used. specifications specification status comment html 5.2the defini...
Navigator.requestMediaKeySystemAccess() - Web APIs
eatemediakeys() method. syntax ​promise = navigator.requestmediakeysystemaccess(keysystem, supportedconfigurations); parameters keysystem a domstring identifying the key system. for example com.example.somesystem or org.w3.clearkey. supportedconfigurations a non-empty array of mediakeysystemconfiguration objects. the first element with a satisfiable configuration will be used. return value a promise that, when resolved, delivers a mediakeysystemaccess object to your fulfillment handler function. the fulfillment handler receives as input just one parameter: mediakeysystemaccess a mediakeysystemaccess object representing the media key system configuration described by keysystem and supportedconfigurations exceptions in case of an error, the returned promise is rejected with a...
Navigator.sendBeacon() - Web APIs
the navigator.sendbeacon() method asynchronously sends a small amount of data over http to a web server. syntax navigator.sendbeacon(url, data); parameters url the url that will receive the data. can be relative or absolute. data a arraybuffer, arraybufferview, blob, domstring, formdata, or urlsearchparams object containing the data to send. return values the sendbeacon() method returns true if the user agent successfully queued the data for transfer. otherwise, it returns false. description this method is for analytics and diagnostics that send data to a server before the document is unloaded, where sending the data any sooner may miss some possible data collection. for example, which link the user clicked before navigating away and unloading the page. ensuring that data has b...
Navigator.serviceWorker - Web APIs
the navigator.serviceworker read-only property returns the serviceworkercontainer object for the associated document, which provides access to registration, removal, upgrade, and communication with the serviceworker. the feature may not be available in private mode. syntax var workercontainerinstance = navigator.serviceworker; value serviceworkercontainer examples this code checks if the browser supports service workers. if ('serviceworker' in navigator) { // supported! } specifications specification status comment service workersthe definition of 'navigator.serviceworker' in that specification. working draft initial definition. ...
Navigator.share() - Web APIs
Web › API › Navigator › share
gator.share(data); parameters data an object containing data to share. at least one of the following fields must be specified. available options are: url: a usvstring representing a url to be shared. text: a usvstring representing text to be shared. title: a usvstring representing the title to be shared. files: a " frozenarray" representing the array of file to be shared. return value a promise that will be fulfilled once a user has completed a share action (usually the user has chosen an application to share to). it will reject immediately if the data parameter is not correctly specified, and will also reject if the user cancels sharing. examples in our web share test (see the source code) there is a button which, when clicked, invokes the web share api to share mdn's url.
Navigator.vendorSub - Web APIs
the value of the navigator.vendorsub property is always the empty string, in any browser. syntax vensub = window.navigator.vendorsub value the empty string specifications specification status comment html living standardthe definition of 'navigatorid: vendorsub' in that specification. living standard initial definition ...
Navigator.vibrate() - Web APIs
Web › API › Navigator › vibrate
ern 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. see vibration api for details. passing a value of 0, an empty array, or an array containing all zeros will cancel any currently ongoing vibration pattern. examples win...
Navigator.xr - Web APIs
Web › API › Navigator › xr
this can be used to present augmented and/or virtual reality imagery to the user. usage notes each window has its own instance of navigator, which can be accessed as window.navigator or simply as navigator. at the same time, a new xr instance is also created and attached to the navigator instance as navigator.xr. ...
NavigatorConcurrentHardware - Web APIs
more than one thread at a time using advanced scheduling techniques. so a four-core cpu may return 8. the browser may, however, choose to reduce the number in order to represent more accurately the number of workers that can run at once properties navigatorconcurrenthardware.hardwareconcurrency read only returns the number of logical processors which may be available to the user agent. this value is always at least 1, and will be 1 if the actual number of logical processors can't be determined. methods the navigatorconcurrenthardware mixin has no methods. specifications specification status comment html living standardthe definition of 'navigatorconcurrenthardware' in that specification. living standard initial definition. ...
NavigatorID.platform - Web APIs
platform is a string that must be an empty string or a string representing the platform on which the browser is executing. ...
NavigatorID - Web APIs
always returns "mozilla", in any browser. this property is kept only for compatibility purposes. navigatorid.appname read only always returns "netscape", in any browser. this property is kept only for compatibility purposes. navigatorid.appversion read only returns either "4.0" or a string representing version information about the browser. do not rely on this property to return a useful value. navigatorid.platform read only returns either the empty string or a string representing the platform the browser is running on. do not rely on this property to return a useful value. navigatorid.product read only always returns "gecko", in any browser. this property is kept only for compatibility purposes. navigatorid.useragent read only returns the user-agent string for the current bro...
NavigatorLanguage.language - Web APIs
lang stores a string representing the language version as defined in bcp 47. examples of valid language codes include "en", "en-us", "fr", "fr-fr", "es-es", etc. note that in safari on ios prior to 10.2, the country code returned is lowercase: "en-us", "fr-fr" etc. ...
NavigatorLanguage.languages - Web APIs
the navigatorlanguage.languages read-only property returns an array of domstrings representing the user's preferred languages. the language is described using bcp 47 language tags. in the returned array they are ordered by preference with the most preferred language first. the value of navigator.language is the first element of the returned array. when its value changes, as the user's preferred languages are changed a languagechange event is fired on the window object. the accept-language http header in every http request from the user's browser uses the same value for the navigator.languages property except for the extra qvalues (quality values) field (e.g. en-us;q=0.8). syntax preferredlanguages = globalobj.navigator.languages examples navigator.language //"en-us" navigator.langu...
NavigatorLanguage - Web APIs
ties related to the language of the navigator. there is no object of type navigatorlanguage, but other interfaces, like navigator or workernavigator, implement it. properties the navigatorlanguage interface doesn't inherit any property. navigatorlanguage.language read only returns a domstring representing the preferred language of the user, usually the language of the browser ui. the null value is returned when this is unknown. navigatorlanguage.languages read only returns an array of domstring representing the languages known to the user, by order of preference. methods the navigatorlanguage interface neither implements, nor inherit any method. specifications specification status comment html living standardthe definition of 'navigatorlanguage' in th...
Online and offline events - Web APIs
tively, the requirements break down as such: you need to know when the user comes back online, so that you can re-synchronize with the server. you need to know when the user is offline, so that you can queue your server requests for a later time. it is this process that online/offline events help to simplify. api navigator.online navigator.online is a property that maintains a true/false value (true for online, false for offline). this property is updated whenever the user switches into "offline mode" by selecting the corresponding menu item (file -> work offline in firefox). additionally, this property should update whenever a browser is no longer capable of connecting to the network. according to the specification: the navigator.online attribute must return false if the user agent ...
NavigatorPlugins.javaEnabled() - Web APIs
this method indicates whether the current browser is java-enabled or not. syntax result = window.navigator.javaenabled() example if (window.navigator.javaenabled()) { // browser has java } notes the return value for this method indicates whether the preference that controls java is on or off - not whether the browser offers java support in general. specifications specification status comment html living standardthe definition of 'navigatorplugins.javaenabled' in that specification. living standard initial definition. ...
NavigatorPlugins.plugins - Web APIs
y navigator.plugins or navigator.mimetypes by 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 != 'o...
NavigatorStorage.storage - Web APIs
igatorstorage.storage read-only property returns the singleton storagemanager object used to access the overall storage capabilities of the browser for the current site or app. the returned object lets you examine and configure persistence of data stores and learn approximately how much more space your browser has available for local storage use. syntax var storagemanager = navigator.storage; value a storagemanager object you can use to maintain persistence for stored data, as well as to determine roughly how much room there is for data to be stored. specifications specification status comment storagethe definition of 'navigator.storage' in that specification. living standard initial definition. ...
NetworkInformation.downlink - Web APIs
the downlink read-only property of the networkinformation interface returns the effective bandwidth estimate in megabits per second, rounded to the nearest multiple of 25 kilobits per seconds. this value is based on recently observed application layer throughput across recently active connections, excluding connections made to a private address space. in the absence of recent bandwidth measurement data, the attribute value is determined by the properties of the underlying connection technology. note that chrome-based browsers do not conform to the specification, and arbitrarily cap the reported downlink at a maximum of 10 mbps as an anti-fingerprinting measure. similar caps exist for the reported latency. syntax var downlink = networkinformation.downlink value a double. specifications ...
NetworkInformation.downlinkMax - Web APIs
examples the following example monitors the connection using the change event and logs changes as they occur. ...
NetworkInformation.effectiveType - Web APIs
the effectivetype read-only property of the networkinformation interface returns the effective type of the connection meaning one of 'slow-2g', '2g', '3g', or '4g'. this value is determined using a combination of recently observed, round-trip time and downlink values. syntax var effectivetype = networkinformation.effectivetype value a string containing one of 'slow-2g', '2g', '3g', or '4g'. specifications specification status comment network information apithe definition of 'effectivetype' in that specification. draft initial definition. ...
NetworkInformation.rtt - Web APIs
the networkinformation.rtt read-only property returns the estimated effective round-trip time of the current connection, rounded to the nearest multiple of 25 milliseconds. this value is based on recently observed application-layer rtt measurements across recently active connections. it excludes connections made to a private address space. if no recent measurement data is available, the value is based on the properties of the underlying connection technology. note: this feature is available in web workers. syntax rtt = networkinformation.rtt return value a number. specifications specification status comment network information apithe definition of 'rtt' in that specification. draft initial definition ...
NetworkInformation.saveData - Web APIs
specifications specification save data api ...
NetworkInformation.type - Web APIs
the networkinformation.type read-only property returns the type of connection a device is using to communicate with the network. note: this feature is available in web workers. syntax var type = netinfo.type return value an enumerated value that is one of the following values: "bluetooth" "cellular" "ethernet" "none" "wifi" "wimax" "other" "unknown" specifications specification status comment network information apithe definition of 'type' in that specification. draft initial definition ...
Network Information API - Web APIs
memory. this example would be called soon after page load to check for a connection type where preloading a video may not be desirable. if a cellular connection is found, then the preloadvideo flag is set to false. for simplicity and clarity, this example only tests for one connection type. a real-world use case would likely use a switch statement or some other method to check all of the possible values of networkinformation.type. regardless of the type value you can get an estimate of connection speed through the networkinformation.effectivetype property. let preloadvideo = true; var connection = navigator.connection || navigator.mozconnection || navigator.webkitconnection; if (connection) { if (connection.effectivetype === 'slow-2g') { preloadvideo = false; } } interfaces network...
Node.appendChild() - Web APIs
Web › API › Node › appendChild
t in sync. if the given child is a documentfragment, the entire contents of the documentfragment are moved into the child list of the specified parent node. newer api avaliable! the parentnode.append() method supports multiple arguments and appending strings. syntax element.appendchild(achild) parameters achild the node to append to the given parent node (commonly an element). return value the returned value is the appended child (achild), except when achild is a documentfragment, in which case the empty documentfragment is returned. notes chaining may not work as expected, due to appendchild() returning the child element: let ablock = document.createelement('block').appendchild( document.createelement('b') ); sets ablock to <b></b> only, which is probably not what you want. ...
Node.baseURI - Web APIs
Web › API › Node › baseURI
used to resolve relative urls when the browser needs to obtain an absolute url, for example when processing the html <img> element's src attribute or xml xlink:href attribute. in most cases the base url is simply the location of the document, but it can be affected by many factors, including the <base> element in html and the xml:base attribute in xml. syntax var nodebaseuri = node.baseuri; value a domstring representing the base url of the specified node. it may be null if unable to obtain an absolute uri. although this property is read-only, its value may change in certain situations (see below). details the base url of a document the base url of a document defaults to the document's address (as displayed by the browser and available in window.location), but it can be changed: wh...
Node.baseURIObject - Web APIs
ns the nsiuri representing the node's (typically a document or an element) base url. it's similar to node.baseuri, except it returns an nsiuri instead of a string. this property exists on all nodes (html, xul, svg, mathml, etc.), but only if the script trying to use it has universalxpconnect privileges. see node.baseuri for details on what the base url is. syntax uriobj = node.baseuriobject value an nsiuri. this property is read-only; attempting to write to it will throw an exception. in addition, this property may only be accessed from privileged code. specification not in any specification. ...
Node.contains() - Web APIs
Web › API › Node › contains
the node itself, one of its direct children (childnodes), one of the children's direct children, and so on. syntax node.contains( othernode ) example this function checks to see if an element is in the page's body. as contains is inclusive and determining if the body contains itself isn't the intention of isinpage this case explicitly returns false. function isinpage(node) { return (node === document.body) ? false : document.body.contains(node); } specifications specification status comment domthe definition of 'node.contains()' in that specification. ...
Node.getRootNode() - Web APIs
Web › API › Node › getRootNode
living...
Node.getUserData() - Web APIs
Web › API › Node › getUserData
n the given node by node.setuserdata(). the node.setuserdata and node.getuserdata methods are no longer available from web content. element.dataset or weakmap can be used instead. syntax userdata = somenode.getuserdata(userkey); parameters userkey is the key to choose the specific data sought for the given node. more than one key may have been assigned on a given node, containing its own value. example var d = document.setuserdata('key', 15, null); console.log(document.getuserdata('key')); // 15 specifications specification status comment document object model (dom) level 3 core specificationthe definition of 'node.getuserdata()' in that specification. obsolete initial definition. ...
Node.hasChildNodes() - Web APIs
the node.haschildnodes() method returns a boolean value indicating whether the given node has child nodes or not. syntax bool = node.haschildnodes(); return value a boolean that is true if the node has child nodes, and false otherwise. example let foo = document.getelementbyid('foo'); if (foo.haschildnodes()) { // do something with 'foo.childnodes' } polyfill here is one possible polyfill: ;(function(prototype) { prototype.haschildnodes = prototype.haschildnodes || function() { return !!this.firstchild; } })(node.prototype); there are various ways to determine whether the node has a child node: node.haschildnodes() node.firstchild != null (or just node.firstchild) node.childnodes && node.childnodes.length (or node.childnodes.length > 0) specifications sp...
Node.insertBefore() - Web APIs
Web › API › Node › insertBefore
being inserted (the same as newnode) parentnode the parent of the newly inserted node. newnode the node to be inserted. referencenode the node before which newnode is inserted. if this is null, then newnode is inserted at the end of parentnode's child nodes. note: referencenode is not an optional parameter. you must explicitly pass a node or null. failing to provide it or passing invalid values may behave differently in different browser versions. return value returns the added child (unless newnode is a documentfragment, in which case the empty documentfragment is returned). example example 1 <div id="parentelement"> <span id="childelement">foo bar</span> </div> <script> // create the new node to insert let newnode = document.createelement("span") // get a reference to the ...
Node.isConnected - Web APIs
Web › API › Node › isConnected
the isconnected read-only property of the node interface returns a boolean indicating whether the node is connected (directly or indirectly) to the context object, for example the document object in the case of the normal dom, or the shadowroot in the case of a shadow dom. syntax var isitconnected = nodeobjectinstance.isconnected return value a boolean that is true if the node is connected to its relevant context object, and false if not. examples standard dom a standard dom example: let test = document.createelement('p'); console.log(test.isconnected); // returns false document.body.appendchild(test); console.log(test.isconnected); // returns true shadow dom a shadow dom example: // create a shadow root var shadow = this.attachshadow({mode: 'open'}); // create some css to apply t...
Node.isDefaultNamespace() - Web APIs
the node.isdefaultnamespace() method accepts a namespace uri as an argument and returns a boolean with a value of true if the namespace is the default namespace on the given node or false if not. syntax result = node.isdefaultnamespace(namespaceuri); parameters namespaceuri is a string representing the namespace against which the element will be checked. return value result is a boolean that holds the return value true or false. example var xulns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; var el = document.getelementsbytagnamens(xulns, 'textbox')[0]; alert(el.isdefaultnamespace(xulns)); // true specifications specification status comment domthe definition of 'node: isdefaultnamespace' in that specification. living standard ...
Node.isSupported() - Web APIs
Web › API › Node › isSupported
the node.issupported()returns a boolean flag containing the result of a test whether the dom implementation implements a specific feature and this feature is supported by the specific node. syntax boolvalue = element.issupported(feature, version) parameters feature is a domstring containing the name of the feature to test. this is the same name which can be passed to the method hasfeature on domimplementation. possible values defined within the core dom specification are listed on the dom level 2 conformance section. version is a domstring containing the version number of the feature to test. in dom level 2, version 1, this is the string 2.0. if the version is not specified, supporting any version of the feature will cause the method to return true. example <div id="doc"> </div> ...
Node.localName - Web APIs
Web › API › Node › localName
see notes below for details) example (must be served with xml content type, such as text/xml or application/xhtml+xml.) <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg"> <head> <script type="application/javascript"><![cdata[ function test() { var text = document.getelementbyid('text'); var circle = document.getelementbyid('circle'); text.value = "<svg:circle> has:\n" + "localname = '" + circle.localname + "'\n" + "namespaceuri = '" + circle.namespaceuri + "'"; } ]]></script> </head> <body onload="test()"> <svg:svg version="1.1" width="100px" height="100px" viewbox="0 0 100 100"> <svg:circle cx="50" cy="50" r="30" style="fill:#aaa" id="circle"/> </svg:svg> <textarea id="text" rows=...
Node.lookupNamespaceURI() - Web APIs
the node.lookupnamespaceuri() method accepts a prefix and returns the namespace uri associated with it on the given node if found (and null if not). syntax var namespace = node.lookupnamespaceuri(prefix); parameters prefix the prefix to look for. if this parameter is null, the method will return the default namespace uri, if any. return value a domstring containing the the namespace uri. if the prefix is not found, it returns null. specifications specification status comment domthe definition of 'node: lookupnamespaceuri' in that specification. living standard ...
Node.nodePrincipal - Web APIs
sers, its use is discouraged since it could be removed at any time. try to avoid using it. the node.nodeprincipal read-only property returns the nsiprincipal object representing current security context of the node. note: this property exists on all nodes (html, svg, mathml, xul, etc.), but only if the script trying to use it has chrome privileges. syntax principalobj = node.nodeprincipal value an nsiprincipal object representing the node's security context. notes this property is read-only; attempting to write to it will throw an exception. in addition, this property may only be accessed from privileged code. specifications not in any specification. this is a firefox-specific property. ...
Node.ownerDocument - Web APIs
the ownerdocument read-only property of the node interface returns the top-level document object of the node. syntax var document = element.ownerdocument; value document is the top-level document object in which all the child nodes are created. if this property is used on a node that is itself a document, the value is null. example // given a node "p", get the top-level html // child of the document object var d = p.ownerdocument; var html = d.documentelement; specifications specification status comment domthe definition of 'node: ownerdocument' in that specification. living standard ...
Node.replaceChild() - Web APIs
Web › API › Node › replaceChild
placechild() method replaces a child node within the given (parent) node. note the idiosyncratic argument order (new before old). childnode.replacewith() may be easier to read and use. syntax parentnode.replacechild(newchild, oldchild); parameters newchild the new node to replace oldchild. if it already exists in the dom, it is first removed. oldchild the child to be replaced. return value the returned value is the replaced node. this is the same node as oldchild. example // given: // <div> // <span id="childspan">foo bar</span> // </div> // create an empty element node // without an id, any attributes, or any content var sp1 = document.createelement("span"); // give it an id attribute called 'newspan' sp1.id = "newspan"; // create some content for the new element. var sp1_c...
Node.rootNode - Web APIs
Web › API › Node › rootNode
important: for compatibility reasons, this property has been replaced by the node.getrootnode() method. the node.rootnode read-only property returns a node object representing the topmost node in the tree, or the current node if it's the topmost node in the tree. this is found by walking backward along node.parentnode until the top is reached. syntax rootnode = node.rootnode; value a node object representing the topmost node in the tree. example running the following line in supporting browsers should return a reference to the html/document node: console.log(document.body.rootnode); notes gecko-based browsers insert text nodes into a document to represent whitespace in the source markup. therefore a node obtained, for example, using node.firstchild or node.previoussibling may r...
NodeIterator.expandEntityReferences - Web APIs
the nodeiterator.expandentityreferences read-only property returns a boolean flag indicating whether or not the children of entity reference nodes are visible to the nodeiterator. if this value is false, the children of entity reference nodes (as well as all of their descendants) are rejected. this takes precedence over the value of the nodeiterator.whattoshow method and the associated filter. syntax expand = nodeiterator.expandentityreferences; example var nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); expand = nodeiterator.expandentityreferences; specifications specification status comment document object model (dom) level 2 tra...
NodeIterator.pointerBeforeReferenceNode - Web APIs
the nodeiterator.pointerbeforereferencenode read-only property returns a boolean flag that indicates whether the nodefilter is anchored before (if this value is true) or after (if this value is false) the anchor node indicated by the nodeiterator.referencenode property. syntax flag = nodeiterator.pointerbeforereferencenode; example var nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); flag = nodeiterator.pointerbeforereferencenode; specifications specification status comment domthe definition of 'nodeiterator.pointerbeforereferencenode' in that specification. living standard initial definition. ...
NodeIterator - Web APIs
sn't inherit any property. nodeiterator.root read only returns a node representing the root node as specified when the nodeiterator was created. nodeiterator.whattoshow read only returns an unsigned long being a bitmask made of constants describing the types of node that must to be presented. non-matching nodes are skipped, but their children may be included, if relevant. the possible values are: constant numerical value description nodefilter.show_all -1 (that is the max value of unsigned long) shows all nodes. nodefilter.show_attribute 2 shows attribute attr nodes. this is meaningful only when creating a nodeiterator with an attr node as its root; in this case, it means that the attribute node will appear in the...
NodeList.entries() - Web APIs
Web › API › NodeList › entries
the nodelist.entries() method returns an iterator allowing to go through all key/value pairs contained in this object. the values are node objects. syntax list.entries(); return value returns an iterator. example var node = document.createelement("div"); var kid1 = document.createelement("p"); var kid2 = document.createtextnode("hey"); var kid3 = document.createelement("span"); node.appendchild(kid1); node.appendchild(kid2); node.appendchild(kid3); var list = node.childnodes; // using for..of for(var entry of list.entries()) { console.log(entry); } results in: array [ 0, <p> ] array [ 1, #text "hey" ] array [ 2, <span> ] ...
NodeList.item() - Web APIs
Web › API › NodeList › item
syntax nodeitem = nodelist.item(index) nodelist is a nodelist. this is usually obtained from another dom property or method, such as childnodes. index is the index of the node to be fetched. the index is zero-based. nodeitem is the indexth node in the nodelist returned by the item method. ...
NodeList.keys() - Web APIs
Web › API › NodeList › keys
the nodelist.keys() method returns an iterator allowing to go through all keys contained in this object. the keys are unsigned integer. syntax nodelist.keys(); return value returns an iterator. example var node = document.createelement("div"); var kid1 = document.createelement("p"); var kid2 = document.createtextnode("hey"); var kid3 = document.createelement("span"); node.appendchild(kid1); node.appendchild(kid2); node.appendchild(kid3); var list = node.childnodes; // using for..of for(var key of list.keys()) { console.log(key); } the result is: 0 1 2 ...
NodeList.length - Web APIs
Web › API › NodeList › length
example the length property is often useful in dom programming. it's often used to test the length of a list, to see if it exists at all. it's also commonly used as the iterator in a for loop, as in this example. ...
Notification.actions - Web APIs
on using the notification() constructor. this is a list of the application-defined actions the user can choose to take immediately within the context of a notification. note: device and user agent might be able to display only a limited number of actions (due to, e.g., limited screen space). this limit can be infered from notification.maxactions. syntax var actions[] = notification.actions; value a read-only array of notificationaction objects, each describing a single action the user can choose within a notification. specifications specification status comment notifications apithe definition of 'actions' in that specification. living standard living standard ...
Notification.badge - Web APIs
note: this feature is available in web workers. the badge property of the notification interface returns the url of the image used to represent the notification when there is not enough space to display the notification itself. syntax var url = notification.badge value a usvstring containing a url. specifications specification status comment notifications apithe definition of 'badge' in that specification. living standard initial definition. ...
Notification.body - Web APIs
Web › API › Notification › body
note: this feature is available in web workers. the body read-only property of the notification interface indicates the body string of the notification, as specified in the body option of the notification() constructor. syntax var body = notification.body; value a domstring. examples function spawnnotification(thebody, theicon, thetitle) { var options = { body: thebody, icon: theicon } var n = new notification(thetitle, options); console.log(n.body); } specifications specification status comment notifications apithe definition of 'body' in that specification. living standard living standard ...
Notification.data - Web APIs
Web › API › Notification › data
note: this feature is available in web workers. the data read-only property of the notification interface returns a structured clone of the notification's data, as specified in the data option of the notification() constructor. the notification's data can be any arbitrary data that you want associated with the notification. syntax var data = notification.data; value a structured clone. examples the following snippet fires a notification; a simple options object is created, then the notification is fired using the notification() constructor. var options = { body: 'do you like my body?', data: 'i like peas.' } var n = new notification('test notification',options); console.log(n.data) // should return 'i like peas.' specifications specification status comm...
Notification.icon - Web APIs
Web › API › Notification › icon
note: this feature is available in web workers. the icon read-only property of the notification interface contains the url of an icon to be displayed as part of the notification, as specified in the icon option of the notification() constructor. syntax var icon = notification.icon; value a usvstring. examples in our to-do list app (view the app running live), we use the notification() constructor to fire a notification, passing it arguments to specify the body, icon and title we want. var notification = new notification('to do list', { body: text, icon: img }); specifications specification status comment notifications apithe definition of 'icon' in that specification. living standard living standard ...
Notification.image - Web APIs
note: this feature is available in web workers. the image read-only property of the notification interface contains the url of an image to be displayed as part of the notification, as specified in the image option of the notification() constructor. syntax var image = notification.image; value a usvstring. specifications specification status comment notifications apithe definition of 'image' in that specification. living standard living standard ...
Notification.lang - Web APIs
Web › API › Notification › lang
in web workers. the lang read-only property of the notification interface indicates the language used in the notification, as specified in the lang option of the notification() constructor. the language itself is specified using a domstring representing a bcp 47 language tag. see the sitepoint iso 2 letter language codes page for a simple reference. syntax var language = notification.lang; value a domstring specifying the language tag. examples the following snippet fires a notification; a simple options object is created, then the notification is fired using the notification() constructor. var options = { body: 'do you like my body?', lang: 'en-us' } var n = new notification('test notification',options); console.log(n.lang) // should return 'en-us' specifications sp...
Notification.maxActions - Web APIs
note: this feature is available in web workers. the maxactions attribute of the notification interface returns the maximum number of actions supported by the device and the user agent. effectively, this is the maximum number of elements in notification.actions array which will be respected by the user agent. syntax notification.maxactions value an integer number which indicates the largest number of notification actions that can be presented to the user by the user agent and the device. examples the following snippet logs the maximum number of supported actions. const maxactions = notification.maxactions; console.log('this device can display at most ' + maxactions + ' actions on each notification.'); specifications specification status comment no...
Notification.permission - Web APIs
note: this feature is available in web workers. the permission read-only property of the notification interface indicates the current permission granted by the user for the current origin to display web notifications. syntax var permission = notification.permission; value a domstring representing the current permission. the value can be: granted: the user has explicitly granted permission for the current origin to display system notifications. denied: the user has explicitly denied permission for the current origin to display system notifications. default: the user decision is unknown; in this case the application will act as if permission was denied. examples the following snippet could be used if you wanted to first check whether notifications are supported, then check i...
Notification.renotify - Web APIs
false is the default; true makes the notification renotify the user. ...
Notification.requireInteraction - Web APIs
this can be set when the notification is first created by setting the requireinteraction option to true in the options object of the notification.notification() constructor. syntax function spawnnotification(thetitle,thebody,shouldrequireinteraction) { var options = { body: thebody, requireinteraction: shouldrequireinteraction } var n = new notification(thetitle,options); } value a boolean. specifications specification status comment notifications apithe definition of 'requireinteraction' in that specification. living standard living standard. ...
Notification.silent - Web APIs
note: this feature is available in web workers. the silent read-only property of the notification interface specifies whether the notification should be silent, i.e., no sounds or vibrations should be issued, regardless of the device settings. this is specified in the silent option of the notification() constructor. syntax var silent = notification.silent; value a boolean. false is the default; true makes the notification silent. examples the following snippet is intended to fire a silent notification; a simple options object is created, and then the notification is fired using the notification() constructor. var options = { body: 'do you like my body?', silent: true } var n = new notification('test notification', options); console.log(n.silent) // should log true speci...
Notification.tag - Web APIs
Web › API › Notification › tag
tag for the notification, as specified in the tag option of the notification() constructor. the idea of notification tags is that more than one notification can share the same tag, linking them together. one notification can then be programmatically replaced with another to avoid the users' screen being filled up with a huge number of similar notifications. syntax var tag = notification.tag; value a domstring. examples our using the notifications api article has a good example of tag usage. specifications specification status comment notifications apithe definition of 'tag' in that specification. living standard living standard ...
Notification.timestamp - Web APIs
sent the time, in milliseconds since 00:00:00 utc on 1 january 1970, of the event for which the notification was created, or it can be an arbitrary timestamp that you want associated with the notification. for example, a timestamp for an upcoming meeting could be set in the future, whereas a timestamp for a missed message could be set in the past. syntax var timestamp = notification.timestamp; value a domtimestamp. examples the following snippet fires a notification; a simple options object is created, then the notification is fired using the notification() constructor. var dts = math.floor(date.now()); var options = { body: 'do you like my body?', timestamp: dts } var n = new notification('test notification',options); console.log(n.timestamp) // should log original timestamp spe...
Notification.title - Web APIs
note: this feature is available in web workers. the title read-only property of the notification interface indicates the title of the notification, as specified in the title parameter of the notification() constructor. syntax var title = notification.title; value a domstring. examples function spawnnotification(thebody,theicon,thetitle) { var options = { body: thebody, icon: theicon } var n = new notification(thetitle,options); console.log(n.title) } specifications specification status comment notifications apithe definition of 'title' in that specification. living standard living standard ...
Notification.vibrate - Web APIs
note: this feature is available in web workers. the vibrate read-only property of the notification interface specifies a a vibration pattern for the device's vibration hardware to emit when the notification fires. this is specified in the vibrate option of the notification() constructor. syntax var vibrate = notification.vibrate; value a vibration pattern, as specified in the vibration api spec. examples the following snippet is intended to create a notification that also triggers a device vibration; a simple options object is created, and then the notification is fired using the notification() constructor. var options = { body: 'do you like my body?', vibrate: [200, 100, 200] } var n = new notification('test notification',options); console.log(n.vibrate) // should log [...
Notification - Web APIs
platforms but generally they provide a way to asynchronously provide information to the user. constructor notification() creates a new instance of the notification object. properties static properties these properties are available only on the notification object itself. notification.permission read only a string representing the current permission to display notifications. possible values are: denied — the user refuses to have notifications displayed. granted — the user accepts having notifications displayed. default — the user choice is unknown and therefore the browser will act as if the value were denied. notification.maxactions read only instance properties these properties are available only on instances of the notification object. notification.acti...
NotificationEvent.action - Web APIs
the notification id is set during the creation of the notification via the actions array attribute and can't be modified unless the notification is replaced. returns a domstring object. ...
NotificationEvent - Web APIs
interface. constructor notificationevent() creates a new notificationevent object. properties inherits properties from its ancestor, event. notificationevent.notification read only returns a notification object representing the notification that was clicked to fire the event. notificationevent.action read only returns the string id of the notification button the user clicked. this value returns an empty string if the user clicked the notification somewhere other than an action button, or the notification does not have a button. methods inherits methods from its parent, extendableevent. extendableevent.waituntil() extends the lifetime of the event. tells the browser that work is ongoing. example self.addeventlistener('notificationclick', function(event) { console.
NotifyAudioAvailableEvent - Web APIs
lete, notifyaudioavailableevent interface defines the event sent to audio elements when the audio buffer is full. 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 mozframebufferlength 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. ...
OES_vertex_array_object.bindVertexArrayOES() - Web APIs
examples var ext = gl.getextension('oes_vertex_array_object'); var vao = ext.createvertexarrayoes(); ext.bindvertexarrayoes(vao); // ... ...
OES_vertex_array_object.createVertexArrayOES() - Web APIs
the oes_vertex_array_object.createvertexarrayoes() method of the webgl api creates and initializes a webglvertexarrayobject object that represents a vertex array object (vao) pointing to vertex array data and which provides names for different sets of vertex data. syntax webglvertexarrayobjectoes ext.createvertexarrayoes(); parameters none. return value a webglvertexarrayobject representing a vertex array object (vao) which points to vertex array data. examples var ext = gl.getextension('oes_vertex_array_object'); var vao = ext.createvertexarrayoes(); ext.bindvertexarrayoes(vao); // ... // calls to bindbuffer or vertexattribpointer // which will be "recorded" in the vao // ... specifications specification status comment oes_vertex_array_objectthe definition...
OES_vertex_array_object.deleteVertexArrayOES() - Web APIs
the oes_vertex_array_object.deletevertexarrayoes() method of the webgl api deletes a given webglvertexarrayobject object. syntax void ext.deletevertexarrayoes(arrayobject); parameters arrayobject a webglvertexarrayobject (vao) object to delete. return value none. examples var ext = gl.getextension('oes_vertex_array_object'); var vao = ext.createvertexarrayoes(); ext.bindvertexarrayoes(vao); // ... ext.deletevertexarrayoes(vao); specifications specification status comment oes_vertex_array_objectthe definition of 'oes_vertex_array_object' in that specification. recommendation initial definition. ...
OES_vertex_array_object.isVertexArrayOES() - Web APIs
the oes_vertex_array_object.isvertexarrayoes() method of the webgl api returns true if the passed object is a webglvertexarrayobject object. syntax glboolean ext.isvertexarrayoes(arrayobject); parameters arrayobject a webglvertexarrayobject (vao) object to test. return value a glboolean indicating whether the given object is a webglvertexarrayobject object (true) or not (false). examples var ext = gl.getextension('oes_vertex_array_object'); var vao = ext.createvertexarrayoes(); ext.bindvertexarrayoes(vao); // ... ext.isvertexarrayoes(vao); specifications specification status comment oes_vertex_array_objectthe definition of 'oes_vertex_array_object' in that specification. recommendation initial definition. ...
OVR_multiview2 - Web APIs
vr base view index of the framebuffer object attachment. max_views_ovr the maximum number of views. most vr headsets have two views, but there are prototypes of headset with ultra-wide fov using 4 views which is currently the maximum number of views supported by multiview. framebuffer_incomplete_view_targets_ovr if baseviewindex is not the same for all framebuffer attachment points where the value of framebuffer_attachment_object_type is not none, the framebuffer is considered incomplete. calling checkframebufferstatus for a framebuffer in this state returns framebuffer_incomplete_view_targets_ovr. methods framebuffertexturemultiviewovr() simultaneously renders to multiple elements of a 2d texture array. examples this example is taken from the specification. see also this three.js...
OfflineAudioCompletionEvent.renderedBuffer - Web APIs
specifications specification status comment web audio apithe definition of 'renderedbuffer' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. ...
OfflineAudioContext.OfflineAudioContext() - Web APIs
audiocontext using the new audiocontext() constructor with no arguments, the offlineaudiocontext() constructor requires three arguments, since it needs to create an audiobuffer. this works in exactly the same way as when you create a new audiobuffer with the audiocontext.createbuffer() method. for more detail, read audio buffers: frames, samples and channels from our basic concepts guide. return value a new offlineaudiocontext object whose associated audiobuffer is configured as requested. like a regular audiocontext, an offlineaudiocontext can be the target of events, therefore it implements the eventtarget interface. example const offlinectx = new offlineaudiocontext({ numberofchannels: 2, length: 44100 * 40, samplerate: 44100, }); const source = offlinectx.createbuffersource(); //...
OfflineAudioContext.length - Web APIs
the length property of the offlineaudiocontext interface returns an integer representing the size of the buffer in sample-frames. syntax var length = offlineaudiocontext.length; value an integer representing the size of the buffer in sample-frames. specifications specification status comment web audio apithe definition of 'length' in that specification. working draft initial definition. ...
OffscreenCanvas.convertToBlob() - Web APIs
your offscreencanvas object into a blob object, for example: const blob = offscreencanvas.converttoblob({ type: "image/jpeg", quality: 0.95 }); options: type: a domstring indicating the image format. the default type is image/png. quality: a number between 0 and 1 indicating image quality if the type option is image/jpeg or image/webp. if this argument is anything else, the default value for image quality is used. other arguments are ignored. return value a promise returning a blob object representing the image contained in the canvas. examples var offscreen = new offscreencanvas(256, 256); var gl = offscreen.getcontext("webgl"); // ... some drawing using the gl context ... offscreen.converttoblob().then(function(blob) { console.log(blob); }); // blob { size: 334, t...
OffscreenCanvas.convertToBlob() - Web APIs
your offscreencanvas object into a blob object, for example: const blob = offscreencanvas.converttoblob({ type: "image/jpeg", quality: 0.95 }); options: type: a domstring indicating the image format. the default type is image/png. quality: a number between 0 and 1 indicating image quality if the type option is image/jpeg or image/webp. if this argument is anything else, the default value for image quality is used. other arguments are ignored. return value a promise returning a blob object representing the image contained in the canvas. examples var offscreen = new offscreencanvas(256, 256); var gl = offscreen.getcontext("webgl"); // ... some drawing using the gl context ... offscreen.converttoblob().then(function(blob) { console.log(blob); }); // blob { size: 334, t...
OffscreenCanvas.convertToBlob() - Web APIs
your offscreencanvas object into a blob object, for example: const blob = offscreencanvas.converttoblob({ type: "image/jpeg", quality: 0.95 }); options: type: a domstring indicating the image format. the default type is image/png. quality: a number between 0 and 1 indicating image quality if the type option is image/jpeg or image/webp. if this argument is anything else, the default value for image quality is used. other arguments are ignored. return value a promise returning a blob object representing the image contained in the canvas. examples var offscreen = new offscreencanvas(256, 256); var gl = offscreen.getcontext("webgl"); // ... some drawing using the gl context ... offscreen.converttoblob().then(function(blob) { console.log(blob); }); // blob { size: 334, t...
OffscreenCanvas.transferToImageBitmap() - Web APIs
examples var offscreen = new offscreencanvas(256, 256); var gl = offscreen.getcontext("webgl"); // ... some drawing using the gl context ... ...
OrientationSensor.populateMatrix() - Web APIs
re it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax orientationinstance.populatematrix(targetmatrix) because orientationsensor is a base class, populatematrix may only be read from one of its derived classes. parameters targetmatrix tbd return value undefined example // tbd specifications specification status comment orientation sensorthe definition of 'populatematrix' in that specification. candidate recommendation initial definition. ...
OrientationSensor.quaternion - Web APIs
the quaternion read-only property of the orientationsensor interface returns a four element array whose elements contain the components of the unit quaternion representing the device's orientation. syntax var quaternion = orientationinstance.quaternion because orientationsensor is a base class, quaternion may only be read from one of its derived classes. value a array whose values are the x, y, z, and w components of the quaternion representing the device orientation. example // tbd specifications specification status comment orientation sensorthe definition of 'quaternion' in that specification. candidate recommendation initial definition. ...
OscillatorNode.onended - Web APIs
ing example shows basic usage of an audiocontext to create an oscillator node. for an applied example, check out our violent theremin demo (see app.js for relevant code). // create web audio api context var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); // create oscillator node var oscillator = audioctx.createoscillator(); oscillator.type = 'square'; oscillator.frequency.value = 440; // value in hertz oscillator.start(); // start the tone playing oscillator.stop(5); // the tone will stop again in 5 seconds. oscillator.onended = function() { console.log('your tone has now stopped playing!'); } properties none. specifications specification status comment web audio apithe definition of 'onended' in that specification. working draft ...
OscillatorNode.setPeriodicWave() - Web APIs
at32array(2); var ac = new audiocontext(); var osc = ac.createoscillator(); real[0] = 0; imag[0] = 0; real[1] = 1; imag[1] = 0; var wave = ac.createperiodicwave(real, imag); osc.setperiodicwave(wave); osc.connect(ac.destination); osc.start(); osc.stop(2); this works because a sound that contains only a fundamental tone is by definition a sine wave. here, we create a periodicwave with two values. the first value is the dc offset, which is the value at which the oscillator starts. 0 is good here, because we want to start the curve at the middle of the [-1.0; 1.0] range. the second and subsequent values are sine and cosine components. you can think of it as the result of a fourier transform, where you get frequency domain values from time domain value. here, with createperiodicwave(), yo...
OscillatorNode.stop() - Web APIs
the stop method of the oscillatornode interface specifies the time to stop playing the tone. its parameter is optional and defaults to 0. syntax oscillator.stop(when); // stop playing oscillator at when parameters when optional an optional double representing the audio context time when the oscillator should stop. if a value is not included, it defaults to 0. if the time is equal to or before the current audio context time, the oscillator will stop playing immediately. example the following example shows basic usage of an audiocontext to create an oscillator node. for an applied example, check out our violent theremin demo (see app.js for relevant code). // create web audio api context var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); // create oscillator n...
OverconstrainedError.constraint - Web APIs
the constraint read-only property of the overconstrainederror interface returns the constraint that was supplied in the constructor, meaning the contraint that was not satisfied. syntax var constraint = overconstrainederror.constraint; value a string specifications specification status comment media capture and streamsthe definition of 'constraint' in that specification. candidate recommendation initial definition. ...
OverconstrainedError.message - Web APIs
the message read-only property of the overconstrainederror interface returns the text supplied in the constructor. syntax var message = overconstrainederror.message; value a domstring. specifications specification status comment media capture and streamsthe definition of 'message' in that specification. candidate recommendation initial definition. ...
OverconstrainedError.name - Web APIs
the name read-only property of the overconstrainederror interface will always return 'overconstrainederror'. syntax var name = overconstrainederror.name; value a domstring. specifications specification status comment media capture and streamsthe definition of 'name' in that specification. candidate recommendation initial definition. ...
PageTransitionEvent.persisted - Web APIs
the persisted read-only property indicates if a webpage is loading from a cache. syntax window.addeventlistener('pageshow', function(event) { if (event.persisted) { console.log('page was loaded from cache.'); } }); value a boolean. specifications specification status comment html living standardthe definition of 'pagetransitionevent: persisted' in that specification. living standard initial definition ...
Paint​Worklet​.device​Pixel​Ratio - Web APIs
the paintworklet.devicepixelratio read-only property of the paintworklet interface returns the current device's ratio of physical pixels to logical pixels. syntax var devicepixelratio = paintworklet.devicepixelratio; value a double-precision integer. specifications specification status comment css painting api level 1the definition of 'paintworklet.devicepixelratio' in that specification. working draft initial definition. ...
PaintWorklet.devicePixelRatio - Web APIs
the paintworklet.devicepixelratio read-only property of the paintworklet interface returns the current device's ratio of physical pixels to logical pixels. syntax var devicepixelratio = paintworklet.devicepixelratio; value a double-precision integer. specifications specification status comment css painting api level 1the definition of 'paintworklet.devicepixelratio' in that specification. working draft initial definition. ...
PaintWorklet.devicePixelRatio - Web APIs
the paintworklet.devicepixelratio read-only property of the paintworklet interface returns the current device's ratio of physical pixels to logical pixels. syntax var devicepixelratio = paintworklet.devicepixelratio; value a double-precision integer. specifications specification status comment css painting api level 1the definition of 'paintworklet.devicepixelratio' in that specification. working draft initial definition. ...
ParentNode.childElementCount - Web APIs
his interface contained two distinct set of properties, one aimed at node that have children, one at those that are children, they have been moved into two separate pure interfaces, parentnode and childnode. in this case, childelementcount moved to parentnode. this is a fairly technical change that shouldn't affect compatibility. syntax var count = node.childelementcount; count the return value, which is an unsigned long (simply an integer) type. node an object representing a document, documentfragment, or element. example var foo = document.getelementbyid('foo'); if (foo.childelementcount > 0) { // do something } polyfill for ie8 & ie9 & safari this property is completely unsupported prior to ie9. in ie9 and safari, it is unsupported in the document and documentfragment objec...
ParentNode.children - Web APIs
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. ...
ParentNode.querySelector() - Web APIs
g selectors to identify elements. multiple selectors may be specified by separating them using commas. note: characters which are not part of standard css syntax must be escaped using a backslash character. since javascript also uses backspace escaping, special care must be taken when writing string literals using these characters. see escaping special characters for more information. return value the first element that matches at least one of the specified selectors or null if no such element is found. note: if the specified selectors include a css pseudo-element, the returned value is always null. exceptions syntaxerror the syntax of the specified selectors string is not valid. specifications specification status comment domthe definition of 'paren...
PasswordCredential - Web APIs
o require a csrf token. examples this example shows how to set up an htmlformelement to caputure data which we'll use to create a passwordcredential object. starting with the form element. <form id="form" method="post"> <input type="text" name="id" autocomplete="username" /> <input type="password" name="password" autocomplete="current-password" /> <input type="hidden" name="csrf_token" value="*****" /> </form> then, a reference to this form element, using it to create a passwordcredential object, and storing it in the browser's password system. var form = document.queryselector('#form'); var creds = new passwordcredential(form); // store the credentials. navigator.credentials.store(creds) .then(function(creds) { // do something with the credentials if you need to. }); specific...
PasswordCredential.iconURL - Web APIs
the iconurl read-only property of the passwordcredential interface returns a usvstring containing a url pointing to an image for an icon. this image is intended for display in a credential chooser. the url must be accessible without authentication. syntax url =passwordcredential.iconurl value a usvstring containing a url. specifications specification status comment credential management level 1the definition of 'iconurl' in that specification. working draft initial definition. ...
PasswordCredential.idName - Web APIs
the idname property of the passwordcredential interface returns a usvstring, representing the name that will be used for the id field, when submitting the current object to a remote endpoint via fetch. this property defaults to 'username', but may be set to match whatever your backend service expects. syntax var idname = passwordcredential.idname passwordcredential.idname = "userid" value a usvstring represents the name used for the id field, when submitting the current object to a remote endpoint via fetch. example // tbd specifications specification status comment credential management level 1 working draft initial definition. ...
PasswordCredential.name - Web APIs
the name read-only property of the passwordcredential interface returns a usvstring containing a human-readable public name for display in a credential chooser. syntax name =passwordcredential.name value a usvstring containing a name. specifications specification status comment credential management level 1the definition of 'name' in that specification. working draft initial definition. ...
PasswordCredential.password - Web APIs
the password read-only property of the passwordcredential interface returns a usvstring containing the password of the credential. syntax password =passwordcredential.password value a usvstring containing a password. specifications specification status comment credential management level 1the definition of 'password' in that specification. working draft initial definition. ...
PasswordCredential.passwordName - Web APIs
e passwordname property of the passwordcredential interface returns a usvstring, depicting the name used by the password field, when submitting the current object to a remote endpoint via fetch. this property defaults to 'password', but may be matched to anything your backend service expects. syntax var passwordname = passwordcredential.passwordname passwordcredential.passwordname = "passcode" value a usvstring representing the password field name, used when submitting the current object to a remote endpoint via fetch. example // tbd specifications specification status comment credential management level 1 working draft initial definition. ...
PayerErrors.email - Web APIs
Web › API › PayerErrors › email
the email property is included in a payererrors object if the paymentresponse.payeremail property failed validation; in this case, the property should contain a string describing how to correct the problem. if the payer's email address passed validation, this property is not included in the payererrors object. syntax payeremail = payererrors.email; value if validation of the payer's email address (paymentresponse.payeremail) found problems, this property should be set to a domstring that explains the validation problem and how to correct it. if the email address is valid, this property should be omitted from the payererrors object. example function validatepayment(response) { const correctionpromises let paymenterrors = {}; let payererrors = {}; // check payer details...
PayerErrors.phone - Web APIs
Web › API › PayerErrors › phone
the phone property is found in a payererrors object if the payername returned in the response couldn't be validated as a valid phone number. the value of this property is a string explaining the problem. if the payer's phone number validated successfully, the phone property is omitted from the payererrors object. syntax payerphone = payererrors.phone; value if this property is present in the payererrors object, the payer's phone number couldn't be successfully validated, and the phone property's value is a domstring explaining the error. this string will be displayed to the user by the user agent's payment handling user interface as appropriate. if the phone number is valid, this property is omitted from the payererrors object. example function validatepayment(response) { c...
PaymentAddress.city - Web APIs
the city read-only property of the paymentaddress interface returns a string containing the city or town portion of the address. syntax var paymentcity = paymentaddress.city; value a domstring indicating the city or town portion of the address described by the paymentaddress object. specifications specification status comment payment request apithe definition of 'paymentaddress.city' in that specification. candidate recommendation initial definition. ...
PaymentAddress.country - Web APIs
the country read-only property of the paymentaddress interface is a string identifying the address's country using the iso 3166-1 alpha-2 standard. the string is always in its canonical upper-case form. some examples of valid country values: "us", "gb", "cn", or "jp". syntax var paymentcountry = paymentaddress.country; value a domstring which contains the iso3166-1 alpha-2 code identifying the country in which the address is located, or an empty string if no country is available, which frequently can be assumed to mean "same country as the site owner." usage notes if the payment handler validates the address and determines that the value of country is invalid, a call to paymentrequestupdateevent.updatewith() will be made with a details object containing a shippingaddresserrors field. th...
PaymentAddress.dependentLocality - Web APIs
the read-only dependentlocality property of the paymentaddress interface is a string containing a sublocality designation within a city, such as a neighborhood, borough, district, or, in the united kingdom, a dependent locality. also known as a post town. syntax var paymentdependentlocality = paymentaddress.dependentlocality; value a domstring indicating the sublocality portion of the address. this may be an empty string if no sublocality is available or required. it's used to provide disambiguation when a city may include areas that duplicate street names a sublocality is an area within a city, such as a neighborhood, borough, or district. in the united kingdom, this is used to indicate the post town in the united kingdom (known officially by the royal mail as the dependent locality). t...
PaymentAddress.languageCode - Web APIs
the languagecode read-only property of the paymentaddress interface returns a string containing the bcp-47 language code for the address. this is used while localizing the displayy of the address, allowing the determination of the field separators and the order of fields when formatting the address. syntax var paymentlanguagecode = paymentaddress.languagecode; value a domstring providing the bcp-47 format language code indicating the language the address was written in, such as "en-us", "pt-br", or "ja-jp". ...
PaymentAddress.organization - Web APIs
the organization read-only property of the paymentaddress interface returns a string containing the name of the organization, firm, company, or institution at the address. syntax var paymentorganization = paymentaddress.organization; value a domstring whose value is the name of the organization or company located at the address described by the paymentaddress object. this should be the name of the organization that is to receive the shipment for shipping addresses, or which is repsonsible for payment for payment addresses. specifications specification status comment payment request apithe definition of 'paymentaddress.organization' in that specification. candidate recommendation initial definition. ...
PaymentAddress.phone - Web APIs
the read-only phone property of the paymentaddress interface returns a string containing the telephone number of the recipient or contact person. syntax var paymentphone = paymentaddress.phone; value a domstring containing the telephone number for the recipient of the shipment or of the responsible party for payment. if no phone number is available, this value is an empty string. specifications specification status comment payment request apithe definition of 'paymentaddress.phone' in that specification. candidate recommendation initial definition. ...
PaymentAddress.postalCode - Web APIs
a postal code is a string (either numeric or alphanumeric) which is used by a postal service to optimize mail routing and delivery. ...
PaymentAddress.recipient - Web APIs
the read-only recipient property of the paymentaddress interface returns a string containing the name of the recipient, purchaser, or contact person at the payment address. syntax var paymentrecipient = paymentaddress.recipient; value a domstring giving the name of the person receiving or paying for the purchase, or the name of a contact person in other contexts. if no name is available, this string is empty. specifications specification status comment payment request apithe definition of 'paymentaddress.recipient' in that specification. candidate recommendation initial definition. ...
PaymentAddress.region - Web APIs
the read-only region property of the paymentaddress interface returns a string containing the top-level administrative subdivision of the country in which the address is located. for example, this may be a state, province, oblast, or prefecture. syntax var paymentregion = paymentaddress.region; value a domstring specifying the top-level administrative subdivision within the country in which the address is located. this region has different names in different countries, such as: state, province, oblast, prefecture, or county. usage notes in some countries, like belgium, it's uncommon for people to provide a region as part of their postal address. in such cases, the browser returns an empty string as the value of region. however, the address should still be acceptable to use for its intend...
PaymentAddress.regionCode - Web APIs
" for lisbon, portugal). the code is derived from the iso 3166-2 standard, which defines codes for identifying the subdivisions (e.g., states, provinces, autonomous regions, etc.) of all countries in the world. if the browser can't determine the region code, or the country doesn't use regions for postal addresses, it returns an empty string. syntax var regioncode = paymentaddress.regioncode; value a domstring indicating the one to three character alphanumeric code representing the region portion of the address. this should correspond to region, but should be the iso 3166--2 standard's region code. the string is empty if the region code couldn't be determined, isn't needed for the address's country, or was not provided. ...
PaymentAddress.sortingCode - Web APIs
the sortingcode read-only property of the paymentaddress interface returns a string containing a postal sorting code such as is used in france. syntax var sortingcode = paymentaddress.sortingcode; value a domstring containing the sorting code portion of the address. specifications specification status comment payment request apithe definition of 'paymentaddress.sortingcode' in that specification. candidate recommendation initial definition. ...
PaymentAddress.toJSON() - Web APIs
specifications specification status comment web idlthe definition of 'tojson()' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. ...
PaymentCurrencyAmount.currencySystem - Web APIs
the obsolete paymentcurrencyamount property currencysystem is a string which specifies the standard being used to specify the currency the value is specified in. for example, the default is urn:iso:std:iso:4217, which specifies that the standard used is iso 4217. warning: this property has been removed from the specification and should no longer be used; the currency is now always specified using iso 4127. syntax currencysystem = paymentcurrencyamount.currencysystem; value a domstring which specifies the currency standard used to specify the currency in which the payment value is represented. the default, urn:iso:std:iso:4217, indicates the iso 4217 standard. this obsolete property was removed in the may 3, 2018 update of the payment request api specification. specifications ...
PaymentDetailsUpdate.error - Web APIs
the paymentdetailsupdate dictionary's error property is a human-readable domstring which provides an error message to be displayed if the specified information doesn't offer any valid shipping options. syntax errorstring = paymentdetailsupdate.error; paymentdetailsupdate.error = errorstring; value a domstring specifying the string to display to the user if the information specified in the paymentdetailsupdate doesn't provide any valid shipping options. this happens if both of the following are true: the paymentrequest specifies using its requestshipping property that shipping information is required. the paymentdetailsupdate object specifies no valid shipping options in its shippingoptions list. this message can be used to explain to the user why they cannot submit their payment ...
PaymentDetailsUpdate - Web APIs
the shipping address that could not be validated. shippingoptions optional an array of paymentshippingoption objects, each describing one available shipping option from which the user may choose. total optional a paymentitem providing an updated total for the payment. make sure this equals the sum of all of the items in displayitems. this is not calculated automatically. you must update this value yourself anytime the total amount due changes. this lets you have flexibility for how to handle things like tax, discounts, and other adjustments to the total price charged. specifications specification status comment payment request apithe definition of 'paymentdetailsupdate' in that specification. candidate recommendation initial definition. ...
PaymentItem - Web APIs
the paymentitem dictionary is used by the payment request api to describe a single line item on a payment request. this might be an item or service being purchased or a tax or other charge. properties amount secure context a paymentcurrencyamount object describing the monetary value of the item. label secure context a string specifying a human-readable name or description of the item or service being charged for. this may be displayed to the user by the user agent, depending on the design of the interface. pending secure context a boolean value which is true if the specified amount has not yet been finalized. this can be used to show items such as shipping or tax amounts that depend upon the selection of shipping address, shipping option, or so forth. the user agent may show this in...
PaymentMethodChangeEvent - Web APIs
g properties: methodname optional a domstring containing the payment method identifier for the payment handler being used. this is an empty string by default. methoddetails optional an object providing payment method-specific information describing the changes made to the payment, or null if there is no additional information available or required. this is null by default. return value a newly-created paymentmethodchangeevent object describing a change to the options specified for the payment method given in the methodname property. the type of the methoddetails property depends on the payment method. for example, if methodname is basic-card, indicating that the basic card payment method is being used for validation, the methoddetails field must be a basiccardchangedetails ob...
PaymentMethodChangeEvent.methodDetails - Web APIs
the read-only methoddetails property of the paymentmethodchangeevent interface is an object containing any data the payment handler may provide to describe the change the user has made to their payment method. the value is null if no details are available. syntax details = paymentmethodchangeevent.methodname; value an object containing any data needed to describe the changes made to the payment method. the contents vary depending on the actual payment method chosen, so you will need to refer to the methodname property first, then inerpret the methoddetails after that. the default value is null, indicating that no additional details are available. example this example uses the paymentmethodchange event to watch for changes to the payment method selected for apple pay, in order...
PaymentMethodChangeEvent.methodName - Web APIs
string which uniquely identifies the payment handler currently selected by the user. the payment handler may be a payment technology, such as apple pay or android pay, and each payment handler may support multiple payment methods; changes to the payment method within the payment handler are described by the paymentmethodchangeevent. syntax var methodname = paymentmethodchangeevent.methodname; value a domstring which uniquely identifies the currently-selected payment handler. this may be a string chosen from the list of standardized payment method identifiers, or a url used by the payment processing service. see payment method identifiers in payment request api for more information. the default value is the empty string, "". example this example uses the paymentmethodchange event to watc...
PaymentRequest.onmerchantvalidation - Web APIs
indicating that the payment handler (e.g., apple pay) requires the merchant to validate themselves. this is usually the first event to be fired, and the user won't be able to proceed with a payment until the merchant validate themselves. this event is not be fired by all payment handlers. in particular, it's used by apple pay. syntax paymentrequest.onmerchantvalidation = eventhandlerfunction; value an event handler function which is to be called whenever the merchantvalidation event is fired at the paymentrequest, indicating that the payment handler requires the merchant to validate themselves as allowed to use this payment handler. examples an example merchant validation handler for the paymentrequest object request looks like this: request.onmerchantvalidation = ev => { ev.complete(...
PaymentRequest.onpaymentmethodchange - Web APIs
xample, when using apple pay, the user can swipe to select different credit cards, debit cards, and so forth. each time the user does so, this event is fired. this event may not be fired by all payment handlers. syntax paymentrequest.addeventlistener('paymentmethodchange', paymentmethodchangeevent => { ... }); paymentrequest.onpaymentmethodchange = function(paymentmethodchangeevent) { ... }; value an event handler function which is to be called whenever the paymentmethodchange event is fired at the paymentrequest, indicating that the user has changed payment methods within the same payment handler. the paymentmethodchange event is triggered by a user-agent controlled interaction (i.e., the end-user switches from a debit to a credit card in the payment ui). to make sure you receive the ev...
PaymentRequest.shippingOption - Web APIs
uest = new paymentrequest(methoddata, details, options); // async update to details request.onshippingaddresschange = ev => { ev.updatewith(checkshipping(request)); }; // sync update to the total request.onshippingoptionchange = ev => { const shippingoption = shippingoptions.find( option => option.id === request.id ); const newtotal = { currency: "usd", label: "total due", value: calculatenewtotal(shippingoption), }; ev.updatewith({ ...details, total: newtotal }); }; async function checkshipping(request) { try { const json = request.shippingaddress.tojson(); await ensurecanshipto(json); const { shippingoptions, total } = await calculateshipping(json); return { ...details, shippingoptions, total }; } catch (err) { return { ...details, error: ...
PaymentRequest.shippingType - Web APIs
specifications specification status comment payment request apithe definition of 'shippingtype' in that specification. candidate recommendation initial definition. ...
PaymentRequest - Web APIs
). paymentrequest.shippingoption read only secure context returns the identifier of the selected shipping option. this property is only populated if the constructor is called with the requestshipping flag set to true. paymentrequest.shippingtype read only secure context returns the type of shipping used to fulfill the transaction. this will be one of shipping, delivery, pickup, or null if a value was not provided in the constructor. methods paymentrequest.canmakepayment() secure context indicates whether the paymentrequest object can make a payment before calling show(). paymentrequest.show() secure context causes the user agent to begin the user interaction for the payment request. paymentrequest.abort() secure context causes the user agent to end the payment request and ...
PaymentRequestEvent.instrumentKey - Web APIs
specifications specification status comment payment handler apithe definition of 'instrumentkey' in that specification. working draft initial definition. ...
PaymentRequestEvent.methodData - Web APIs
specifications specification status comment payment handler apithe definition of 'methoddata' in that specification. working draft initial definition. ...
PaymentRequestEvent.modifiers - Web APIs
the modifiers read-only property of the paymentrequestevent interface returns an array of objects containing changes to payment details. syntax var modifiers[] = paymentdetailsevent.modifiers value an array of modifier objects. specifications specification status comment payment handler apithe definition of 'modifiers' in that specification. working draft initial definition. ...
PaymentRequestEvent.openWindow() - Web APIs
rty of the paymentrequestevent interface opens the specified url in a new window, if and only if the given url is on the same origin as the calling page. it returns a promise that resolves with a reference to a windowclient. syntax var apromise = paymentrequestevent.openwindow(url) parameters url the url to open in the new window. it must be on the same origin as the calling page. return value a promise that resolves with a reference to a windowclient. specifications specification status comment payment handler apithe definition of 'openwindow' in that specification. working draft initial definition. ...
paymentRequestId - Web APIs
the paymentrequestid read-only property of the paymentrequestevent interface returns the id of the paymentrequest object. syntax var id = paymentrequestevent.paymentrequestid value a domstring contains the id. specifications specification status comment payment handler apithe definition of 'paymentrequestid' in that specification. working draft initial definition. ...
PaymentRequestEvent.paymentRequestOrigin - Web APIs
the paymentrequestorigin read-only property of the paymentrequestevent interface returns the origin where the paymentrequest object was initialized. syntax var ausvstring = paymentrequestevent.paymentrequestorigin value a usvstring. specifications specification status comment payment handler apithe definition of 'paymentrequestorigin' in that specification. working draft initial definition. ...
PaymentRequestEvent.respondWith() - Web APIs
the respondwith property of the paymentrequestevent interface prevents the default event handling and allows you to provide a promise for a paymentresponse object yourself. syntax paymentrequestevent.respondwith( // promise that resolves with a paymentresponse. ) parameters promise a promise that resolves with a paymentresponse object. return value a paymentresponse object. specifications specification status comment payment handler apithe definition of 'respondwith' in that specification. working draft initial definition. ...
PaymentRequestEvent.topOrigin - Web APIs
the toporigin read-only property of the paymentrequestevent interface returns the top level payee origin where the paymentrequest object was initialized. syntax var ausvstring = paymentrequestevent.toporigin value a usvstring specifications specification status comment payment handler apithe definition of 'toporigin' in that specification. working draft initial definition. ...
PaymentRequestEvent.total - Web APIs
the total readonly property of the paymentrequestevent interface returns a paymentcurrencyamount object containing the total amount being requested for payment. syntax var paymentcurrencyamount = paymentrequestevent.total value a paymentcurrencyamount object. specifications specification status comment payment handler apithe definition of 'total' in that specification. working draft initial definition. ...
PaymentRequestUpdateEvent.PaymentRequestUpdateEvent() - Web APIs
the paymentrequestupdateevent constructor creates a new paymentrequestupdateevent object which enables a web page to update the details of a paymentrequest in response to a user action. actual updates are made by passing options to the updatewith() method. syntax var paymentrequestupdateevent = new paymentrequestupdateevent() parameters none. return value a new paymentrequestupdateevent object.payment request apithe definition of 'paymentrequestupdateevent' in that specification. specifications specification status comment payment request apithe definition of 'paymentrequestupdateevent()' in that specification. candidate recommendation initial definition. ...
PaymentRequestUpdateEvent.updateWith() - Web APIs
the shipping address that could not be validated. shippingoptions optional an array of paymentshippingoption objects, each describing one available shipping option from which the user may choose. total optional a paymentitem providing an updated total for the payment. make sure this equals the sum of all of the items in displayitems. this is not calculated automatically. you must update this value yourself anytime the total amount due changes. this lets you have flexibility for how to handle things like tax, discounts, and other adjustments to the total price charged. return value undefined. specifications specification status comment payment request apithe definition of 'paymentrequestupdateevent.updatewith()' in that specification. candidate recommendat...
PaymentResponse.complete() - Web APIs
nt some form of "payment successful" indication to the user. fail the payment was not successfully processed. the failure may or may not be announced to the user by the user agent, depending on its design. unknown the success or failure status of the transaction is unknown or irrelevant, and the user agent should not present any notification, even if it normally would. this is the default value. note: in older versions of the specification, an empty string, "", was used instead of unknown to indicate a completion without a known result state. see the browser compatibility section below for details. return value a promise which resolves with no input value once the payment interface has been fully closed. if an error occurs, the promise instead rejects, returning one of the ...
PaymentResponse.methodName - Web APIs
the methodname read-only property of the paymentresponse interface returns a string uniquely identifying the payment handler selected by the user. this string may be either one of the standardized payment method identifiers or a url used by the payment handler to process payments. syntax var methodname = paymentresponse.methodname; value a domstring uniquely identifying the payment handler being used to process the payment. this may be either a standardized identifier, or a url used by the payment processor to handle payments. see merchant validation in payment processing concepts for more information. example the following example extracts the method name from the paymentresponse object to the promise returned from paymentrequest.show(). in a real-world implementation this data would ...
PaymentRequest.payerName - Web APIs
specifications specification status comment payment request apithe definition of 'payername' in that specification. ...
PaymentResponse.requestId - Web APIs
specifications specification status comment payment request apithe definition of 'requestid' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. ...
PaymentResponse - Web APIs
uctor. paymentresponse.payerphone read only secure context returns the phone number supplied by the user. this option is only present when the requestpayerphone option is set to true in the options parameter of the paymentrequest() constructor. paymentresponse.requestid read only secure context returns the identifier of the paymentrequest that produced the current response. this is the same value supplied in the paymentrequest() constructor by details.id. paymentresponse.shippingaddress read only secure context returns the shipping address supplied by the user. this option is only present when the requestshipping option is set to true in the options parameter of the paymentrequest() constructor. paymentresponse.shippingoption read only secure context returns the id attribute of the ...
PaymentValidationErrors - Web APIs
essages to display to the user. properties error optional a general description of a payment error from which the user may attempt to recover by retrying the payment, possibly after correcting mistakes in the payment information. error can be provided all by itself to provide only a generic error message, or in concert with the other properties to serve as an overview while other properties' values gude the user to errors in specific fields in the payment form. payer optional a payererrors compliant object which provides appropriate error messages for any of the fields describing the payer which failed validation. paymentmethod optional any payment method specific errors which may have occurred. this object's contents will vary depending on the payment used. for example, if the user ch...
Payment Request API - Web APIs
e basic card specification basiccardchangedetails an object providing redacted address information that is provided as the methoddetails on the paymentmethodchange event sent to the paymentrequest when the user changes payment information. basiccarderrors an object providing any error messages associated with the fields in the basiccardresponse object that are not valid. this is used as the value of the paymentmethod property on the paymentvalidationerrors object sent to the paymentrequest when an error occurs. basiccardrequest defines an object structure for containing payment request details such as card type. basiccardresponse defines an object structure for payment response details such as the number/expiry date of the card used to make the payment, and the billing address. spec...
Pbkdf2Params - Web APIs
se. this may be one of: sha-1 sha-256 sha-384 sha-512 warning: sha-1 is considered vulnerable in most cryptographic applications, but is still considered safe in pbkdf2. however, it's advisable to transition away from it everywhere, so unless you need to use sha-1, don't. use a different digest algorithm instead. salt a buffersource. this should be a random or pseudo-random value of at least 16 bytes. unlike the input key material passed into derivekey(), salt does not need to be kept secret. iterations a number representing the number of times the hash function will be executed in derivekey(). this determines how computationally expensive (that is, slow) the derivekey() operation will be. in this context, slow is good, since it makes it more expensive for an attacker t...
performance.clearMarks() - Web APIs
ormance entries with an entry type of "mark" will be removed from the performance entry buffer. note: this feature is available in web workers. syntax performance.clearmarks(); performance.clearmarks(name); arguments name optional a domstring representing the name of the timestamp. if this argument is omitted, all performance entries with an entry type of "mark" will be removed. return value void example the following example shows both uses of the clearmarks() method. // create a small helper to show how many performancemark entries there are. function logmarkcount() { console.log( "found this many entries: " + performance.getentriesbytype("mark").length ); } // create a bunch of marks. performance.mark("squirrel"); performance.mark("squirrel"); performance.mark("...
performance.clearMeasures() - Web APIs
ies with an entry type of "measure" will be removed from the performance entry buffer. note: this feature is available in web workers. syntax performance.clearmeasures(); performance.clearmeasures(name); arguments name optional a domstring representing the name of the timestamp. if this argument is omitted, all performance entries with an entry type of "measure" will be removed. return value void example the following example shows both uses of the clearmeasures() method. // create a small helper to show how many performancemeasure entries there are. function logmeasurecount() { console.log( "found this many entries: " + performance.getentriesbytype("measure").length ); } // create a bunch of measures. performance.measure("from navigation"); performance.mark("a"); ...
performance.clearResourceTimings() - Web APIs
all performance entries with an entrytype of "resource" from the browser's performance data buffer and sets the size of the performance data buffer to zero. to set the size of the browser's performance data buffer, use the performance.setresourcetimingbuffersize() method. note: this feature is available in web workers. syntax performance.clearresourcetimings(); arguments void return value none this method has no return value. example function load_resource() { var image = new image(); image.src = "https://developer.mozilla.org/static/img/opengraph-logo.png"; } function clear_performance_timings() { if (performance === undefined) { log("browser does not support web performance"); return; } // create a resource timing performance entry by loading an image ...
performance.getEntries() - Web APIs
ies) can be created by making performance marks or measures (for example by calling the mark() method) at explicit points in time. if you are only interested in performance entries of certain types or that have certain names, see getentriesbytype() and getentriesbyname(). note: this feature is available in web workers. syntax general syntax: entries = window.performance.getentries(); return value entries an array of performanceentry objects. the items will be in chronological order based on the entries' starttime. example function use_performanceentry_methods() { console.log("performanceentry tests ..."); if (performance.mark === undefined) { console.log("... performance.mark not supported"); return; } // create some performance entries via the mark() method per...
performance.getEntriesByName() - Web APIs
ce marks or measures (for example by calling the mark() method) at explicit points in time. note: this feature is available in web workers. syntax entries = window.performance.getentriesbyname(name, type); arguments name the name of the entry to retrieve. type optional the type of entry to retrieve such as "mark". the valid entry types are listed in performanceentry.entrytype. return value entries a list of performanceentry objects that have the specified name and type. if the type argument is not specified, only the name will be used to determine the entries to return. the items will be in chronological order based on the entries' starttime. if no objects meet the specified criteria, an empty list is returned. example function use_performanceentry_methods() { log("perform...
performance.getEntriesByType() - Web APIs
st's members (entries) can be created by making performance marks or measures (for example by calling the mark() method) at explicit points in time. note: this feature is available in web workers. syntax entries = window.performance.getentriesbytype(type); arguments type the type of entry to retrieve such as "mark". the valid entry types are listed in performanceentry.entrytype. return value entries a list of performanceentry objects that have the specified type. the items will be in chronological order based on the entries' starttime. if no objects have the specified type, or no argument is provided, an empty list is returned. example function useperformanceentrymethods() { log("performanceentry tests ..."); if (performance.mark === undefined) { log("... performan...
performance.mark() - Web APIs
Web › API › Performance › mark
es*() methods (getentries(), getentriesbyname() or getentriesbytype()). the mark()'s stores its data internally as performanceentry. note: this feature is available in web workers. syntax performance.mark(name); arguments name a domstring representing the name of the mark. if the name given to this method already exists in the performancetiming interface, syntaxerror is thrown. return value void example the following example shows how to use mark() to create and retrieve performancemark entries. // create a bunch of marks. performance.mark("squirrel"); performance.mark("squirrel"); performance.mark("monkey"); performance.mark("monkey"); performance.mark("dog"); performance.mark("dog"); // get all of the performancemark entries. const allentries = performance.getentriesbyty...
Performance.onresourcetimingbufferfull - Web APIs
the onresourcetimingbufferfull property is an event handler that will be called when the resourcetimingbufferfull event is fired. this event is fired when the browser's resource timing performance buffer is full. note: this feature is available in web workers. syntax callback = performance.onresourcetimingbufferfull = buffer_full_cb; return value callback an eventhandler that is invoked when the resourcetimingbufferfull event is fired. examples the following example sets a callback function on the onresourcetimingbufferfull property. function buffer_full(event) { console.log("warning: resource timing buffer is full!"); performance.setresourcetimingbuffersize(200); } function init() { // set a callback if the resource buffer becomes filled performance.onresourcetimingbuffer...
performance.setResourceTimingBufferSize() - Web APIs
ce" performance entry type objects. a browser's recommended resource timing buffer size is at least 150 performance entry objects. note: this feature is available in web workers. syntax performance.setresourcetimingbuffersize(maxsize); arguments maxsize a number representing the maximum number of performance entry objects the browser should hold in its performance entry buffer. return value none this method has no return value. example function setresourcetimingbuffersize(maxsize) { if (performance === undefined) { log("browser does not support web performance"); return; } var supported = typeof performance.setresourcetimingbuffersize == "function"; if (supported) { log("... performance.setresourcetimingbuffersize() = yes"); performance.setresourcetimi...
Performance.timeOrigin - Web APIs
specifications specification status high resolution time level 2the definition of 'timeorigin' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. ...
performance.toJSON() - Web APIs
the tojson() method of the performance interface is a standard serializer: it returns a json representation of the performance object's properties. note: this feature is available in web workers. syntax myperf = performance.tojson() arguments none return value myperf a json object that is the serialization of the performance object. example var js; js = window.performance.tojson(); console.log("json = " + json.stringify(js)); specifications specification status comment high resolution time level 2the definition of 'tojson() serializer' in that specification. recommendation defines tojson(). ...
PerformanceEntry.entryType - Web APIs
the entrytype property returns a domstring representing the type of performance metric such as, for example, "mark". this property is read only. note: this feature is available in web workers. syntax var type = entry.entrytype; return value the return value depends on the subtype of the performanceentry object and affects the value of the performanceentry.name property as shown by the table below. performance entry type names value subtype type of name property description of name property frame, navigation performanceframetiming, performancenavigationtiming url the document's address. resource performanceresourcetiming url the resolved url of the requested resource. this value doesn't change even if the request is redirected. ...
PerformanceEntry.name - Web APIs
the name property of the performanceentry interface returns a value that further specifies the value returned by the performanceentry.entrytype property. this property is read only. note: this feature is available in web workers. syntax var name = entry.name; return value the return value depends on the subtype of the performanceentry object and the value of performanceentry.entrytype, as shown by the table below. value subtype entrytype values description url performanceframetiming, performancenavigationtiming frame, navigation the document's address. url performanceresourcetiming resource the resolved url of the requested resource. this value doesn't change even if the request is redirected. domstring performancemar...
PerformanceEntry.startTime - Web APIs
the starttime property returns the first recorded timestamp of the performance entry. note: this feature is available in web workers. the value returned by this property depends on the performance entry's type: "frame" - returns the timestamp when the frame was started. "mark" - returns the timestamp when the mark was created by a call to performance.mark(). "measure" - returns the timestamp when the measure was created by a call to performance.measure(). "navigation" - returns the timestamp with a value of "0". "resource" - returns the timestamp immediately before the browser starts fetching the resource. this property is read only . syntax entry.starttime; return value a domhighrestimestamp representing the first timestamp when the performance entry was created. note: if the ...
PerformanceEntry.toJSON() - Web APIs
example the following example shows the use of the tojson() method. function run_performanceentry() { log("performanceentry support ..."); if (performance.mark === undefined) { log("... ...
PerformanceEventTiming - Web APIs
e` option. // https://bugs.webkit.org/show_bug.cgi?id=209216 try { function onfirstinputentry(entry) { // only report fid if the page wasn't hidden prior to // the entry being dispatched. this typically happens when a // page is loaded in a background tab. if (entry.starttime < firsthiddentime) { const fid = entry.processingstart - entry.starttime; // report the fid value to an analytics endpoint. sendtoanalytics({fid}); } } // create a performanceobserver that calls `onfirstinputentry` for each entry. const po = new performanceobserver((entrylist) => { entrylist.getentries().foreach(onfirstinputentry); }); // observe entries of type `first-input`, including buffered entries, // i.e. entries that occurred before calling `observe()` belo...
PerformanceLongTaskTiming.attribution - Web APIs
specifications specification status comment long tasks api 1the definition of 'attribution' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. ...
PerformanceNavigation.type - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancenavigation.type read-only property returns an unsigned short containing a constant describing how the navigation to this page was done. possible values are: value constant name meaning 0 type_navigate the page was accessed by following a link, a bookmark, a form submission, a script, or typing the url in the address bar. 1 type_reload the page was accessed by clicking the reload button or via the location.reload() method. 2 type_back_forward the page was accessed by navigating into the history. 255 type_reserved any other way. syn...
PerformanceNavigation - Web APIs
nterface represents information about how the navigation to the current document was done. an object of this type can be obtained by calling the performance.navigation read-only attribute. properties the performancenavigation interface doesn't inherit any properties. performancenavigation.type read only an unsigned short which indicates how the navigation to this page was done. possible values are: type_navigate (0) the page was accessed by following a link, a bookmark, a form submission, or a script, or by typing the url in the address bar. type_reload (1) the page was accessed by clicking the reload button or via the location.reload() method. type_back_forward (2) the page was accessed by navigating into the history. type_reserved (255) any other way. perfor...
PerformanceNavigationTiming.loadEventEnd - Web APIs
example the following example illustrates this property's usage. ...
PerformanceNavigationTiming.redirectCount - Web APIs
example the following example illustrates this property's usage. ...
PerformanceNavigationTiming.toJSON() - Web APIs
the tojson() method is a serializer - it returns a json representation of the performancenavigationtiming object. syntax json = resourceperfentry.tojson(); arguments none return value json a json object that is the serialization of the performancenavigationtiming object as a map with entries from the closest inherited interface and with entries for each of the serializable attributes. example // get a resource performance entry var perfentries = performance.getentriesbytype("navigation"); var entry = perfentries[0]; // get the json and log it var json = entry.tojson(); var s = json.stringify(json); console.log("performancenavigationtiming.tojson() = " + s); specifications specification status comment navigation timing level 2the definitio...
PerformanceNavigationTiming.type - Web APIs
the type read-only property returns a string representing the type of navigation. the value must be one of the following: navigate navigation started by clicking a link, entering the url in the browser's address bar, form submission, or initializing through a script operation other than reload and back_forward as listed below. reload navigation is through the browser's reload operation or location.reload(). back_forward navigation is through the browser's history traversal operation. prerender navigation is initiated by a prerender hint. this property is read only . syntax perfentry.type; return value a string which is one of the values listed above. example the following example illustrates this property's usage. function print_nav_timing_data() { // use getent...
PerformanceObserver() - Web APIs
ypes that have been registered, via the observe() method. syntax var observer = new performanceobserver(callback); parameters callback a performanceobservercallback callback that will be invoked when observed performance events are recorded. when the callback is invoked, its first parameter is a list of performance observer entries and the second parameter is the observer object. return value a new performanceobserver object which will call the specified callback when observed performance events occur. example var observer = new performanceobserver(function(list, obj) { var entries = list.getentries(); for (var i=0; i < entries.length; i++) { // process "mark" and "frame" events } }); observer.observe({entrytypes: ["mark", "frame"]}); function perf_observer(list, observe...
PerformanceObserver.takeRecords() - Web APIs
the takerecords() method of the performanceobserver interface returns the current list of performance entries stored in the performance observer, emptying it out. syntax var performanceentry[] = performanceobserver.takerecords(); parameters none. return value a list of performanceentry objects. example var observer = new performanceobserver(function(list, obj) { var entries = list.getentries(); for (var i=0; i < entries.length; i++) { // process "mark" and "frame" events } }); observer.observe({entrytypes: ["mark", "frame"]}); var records = observer.takerecords(); console.log(records[0].name); console.log(records[0].starttime); console.log(records[0].duration); specifications specification status comment performance timeline level 2the definition o...
PerformanceObserverEntryList.getEntries() - Web APIs
", entrytype: "mark"}); parameters performanceentryfilteroptionsoptional is a performanceentryfilteroptions dictionary, having the following fields: "name", the name of a performance entry. "entrytype", the entry type. the valid entry types are listed in the performanceentry.entrytype method. "initiatortype", the type of the initiating resource (for example an html element). the values are defined by the performanceresourcetiming.initiatortype interface. this parameter is currently not supported on chrome or opera. return value a list of explicitly observed performanceentry objects that meets the criteria of the filter. the items will be in chronological order based on the entries' starttime. if no objects that meet the filter are found, an empty list is returned. if no ...
PerformanceObserverEntryList.getEntriesByName() - Web APIs
tion (as the first parameter in the callback). this method is exposed to window and worker interfaces. syntax entries = list.getentriesbyname(name, type); parameters name a domstring representing the name of the entry to retrieve. type optional a domstring representing the type of entry to retrieve such as "mark". the valid entry types are listed in performanceentry.entrytype. return value a list of explicitly observed performance entry objects that have the specified name and type. if the type argument is not specified, only the name will be used to determine the entries to return. the items will be in chronological order based on the entries' starttime. if no objects meet the specified criteria, an empty list is returned. example function print_perf_entry(pe) { console.log("...
PerformanceObserverEntryList.getEntriesByType() - Web APIs
types specified in the call to the observe() method. the list is available in the observer's callback function (as the first parameter in the callback). this method is exposed to window and worker interfaces. syntax entries = list.getentriesbytype(type); parameters type the type of entry to retrieve such as "frame". the valid entry types are listed in performanceentry.entrytype. return value a list of explicitly observed performanceentry objects that have the specified type. the items will be in chronological order based on the entries' starttime. if no objects have the specified type, or no argument is provided, an empty list is returned. example function print_perf_entry(pe) { console.log("name: " + pe.name + "; entrytype: " + pe.entrytype + ...
PerformanceResourceTiming.decodedBodySize - Web APIs
read-only property returns the size (in octets) received from the fetch (http or cache) of the message body, after removing any applied content-codings. if the resource is retrieved from an application cache or local resources, it returns the size of the payload after removing any applied content-codings. note: this feature is available in web workers. syntax resource.decodedbodysize; return value the size (in octets) received from the fetch (http or cache) of the message body, after removing any applied content-codings. example the following example, the value of the size properties of all "resource" type events are logged. function log_sizes(perfentry){ // check for support of the *size properties and print their values // if supported. if ("decodedbodysize" in perfentry) c...
PerformanceResourceTiming.encodedBodySize - Web APIs
y represents the size (in octets) received from the fetch (http or cache), of the payload body, before removing any applied content-codings. note: this feature is available in web workers. if the resource is retrieved from an application cache or a local resource, it must return the size of the payload body before removing any applied content-codings. syntax resource.encodedbodysize; return value a number representing the size (in octets) received from the fetch (http or cache), of the payload body, before removing any applied content-codings. example the following example, the value of the size properties of all "resource" type events are logged. function log_sizes(perfentry){ // check for support of the performanceentry.*size properties and print their values // if supported. ...
PerformanceResourceTiming.toJSON() - Web APIs
the tojson() method is a serializer that returns a json representation of the performanceresourcetiming object. syntax json = resourceperfentry.tojson(); arguments none return value json a json object that is the serialization of the performanceresourcetiming object as a map with entries from the closest inherited interface and with entries for each of the serializable attributes. example // get a resource performance entry var perfentries = performance.getentriesbytype("resource"); var entry = perfentries[0]; // get the json and log it var json = entry.tojson(); var s = json.stringify(json); console.log("performanceentry.tojson = " + s); specifications specification status comment resource timing level 2the definition of 'tojson' in that specifica...
PerformanceResourceTiming.transferSize - Web APIs
the transfersize read-only property represents the size (in octets) of the fetched resource. the size includes the response header fields plus the response payload body (as defined by rfc7230). note: this feature is available in web workers. if the resource is fetched from a local cache, or if it is a cross-origin resource, this property returns zero. syntax resource.transfersize; return value a number representing the size (in octets) of the fetched resource. the size includes the response header fields plus the response payload body (rfc7230). example the following example, the value of size properties of all "resource" type events are logged. function log_sizes(perfentry){ // check for support of the performanceentry.*size properties and print their values // if supported. i...
PerformanceResourceTiming - Web APIs
workers. properties this interface extends the following performanceentry properties for resource performance entry types by qualifying and constraining them as follows: performanceentry.entrytyperead only returns "resource". performanceentry.nameread only returns the resources url. performanceentry.starttimeread only returns the timestamp for the time a resource fetch started. this value is equivalent to performanceentry.fetchstart. performanceentry.durationread only returns a timestamp that is the difference between the responseend and the starttime properties. the interface also supports the following properties which are listed in the order in which they are recorded for the fetching of a single resource. an alphabetical listing is shown in the navigation, at left. per...
PerformanceServerTiming.description - Web APIs
the description read-only property returns a domstring value of the server-specified metric description, or an empty string. syntax servertiming.description; specifications specification status comment server timingthe definition of 'description' in that specification. working draft initial definition. ...
PerformanceServerTiming.duration - Web APIs
the duration read-only property returns a double that contains the server-specified metric duration, or value 0.0. syntax servertiming.duration; specifications specification status comment server timingthe definition of 'duration' in that specification. working draft initial definition. ...
PerformanceServerTiming.name - Web APIs
syntax servertiming.name; specifications specification status comment server timingthe definition of 'name' in that specification. ...
PerformanceServerTiming.toJSON - Web APIs
the tojson() method of the performanceservertiming interface returns a domstring that is the json representation of the performanceservertiming object. syntax var json = performanceservertiming.tojson() parameters none. return value a domstring containing json. exceptions none. specifications specification status comment server timingthe definition of 'tojson' in that specification. working draft initial definition. ...
PerformanceServerTiming - Web APIs
rics that are sent with the response in the server-timing http header. this interface is restricted to the same origin, but you can use the timing-allow-origin header to specify the domains that are allowed to access the server metrics. note that this interface is only available in secure contexts (https) in some browsers. properties performanceservertiming.descriptionread only a domstring value of the server-specified metric description, or an empty string. performanceservertiming.durationread only a double that contains the server-specified metric duration, or value 0.0. performanceservertiming.nameread only a domstring value of the server-specified metric name. methods performanceservertiming.tojson() returns a domstring that is the json representation of the performancese...
PerformanceTiming.connectEnd - Web APIs
ming interface instead. the legacy performancetiming.connectend read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, where the connection is opened network. if the transport layer reports an error and the connection establishment is started again, the last connection establisment end time is given. if a persistent connection is used, the value will be the same as performancetiming.fetchstart. a connection is considered as opened when all secure connection handshake, or socks authentication, is terminated. syntax time = performancetiming.connectend; specifications specification status comment navigation timingthe definition of 'performancetiming.connectend' in that specification. recommendation initial ...
PerformanceTiming.connectStart - Web APIs
he legacy performancetiming.connectstart read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, where the request to open a connection is sent to the network. if the transport layer reports an error and the connection establishment is started again, the last connection establisment start time is given. if a persistent connection is used, the value will be the same as performancetiming.fetchstart. syntax time = performancetiming.connectstart; specifications specification status comment navigation timingthe definition of 'performancetiming.connectstart' in that specification. recommendation initial definition. ...
PerformanceTiming.domainLookupEnd - Web APIs
navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.domainlookupend read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, where the domain lookup is finished. if a persistent connection is used, or the information is stored in a cache or a local resource, the value will be the same as performancetiming.fetchstart. syntax time = performancetiming.domainlookupend; specifications specification status comment navigation timingthe definition of 'performancetiming.domainlookupend' in that specification. recommendation initial definition. ...
PerformanceTiming.domainLookupStart - Web APIs
the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.domainlookupstart read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, where the domain lookup starts. if a persistent connection is used, or the information is stored in a cache or a local resource, the value will be the same as performancetiming.fetchstart. syntax time = performancetiming.domainlookupstart; specifications specification status comment navigation timingthe definition of 'performancetiming.domainlookupstart' in that specification. recommendation initial definition. ...
PerformanceTiming.navigationStart - Web APIs
avigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.navigationstart read-only property returns an unsigned long long representing the moment, in milliseconds since the unix epoch, right after the prompt for unload terminates on the previous document in the same browsing context. if there is no previous document, this value will be the same as performancetiming.fetchstart. syntax time = performancetiming.navigationstart; specifications specification status comment navigation timingthe definition of 'performancetiming.navigationstart' in that specification. recommendation initial definition. ...
PerformanceTiming.redirectEnd - Web APIs
ease use the performancenavigationtiming interface instead. the legacy performancetiming.redirectend read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, the last http redirect is completed, that is when the last byte of the http response has been received. if there is no redirect, or if one of the redirect is not of the same origin, the value returned is 0. syntax time = performancetiming.redirectend; specifications specification status comment navigation timingthe definition of 'performancetiming.redirectend' in that specification. recommendation initial definition. ...
PerformanceTiming.redirectStart - Web APIs
perty is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.redirectstart read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, the first http redirect starts. if there is no redirect, or if one of the redirect is not of the same origin, the value returned is 0. syntax time = performancetiming.redirectstart; specifications specification status comment navigation timingthe definition of 'performancetiming.redirectstart' in that specification. recommendation initial definition. ...
PerformanceTiming.unloadEventEnd - Web APIs
el 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.unloadeventend read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, the unload event handler finishes. if there is no previous document, or if the previous document, or one of the needed redirects, is not of the same origin, the value returned is 0. syntax time = performancetiming.unloadeventend; specifications specification status comment navigation timingthe definition of 'performancetiming.unloadeventend' in that specification. recommendation initial definition. ...
PerformanceTiming.unloadEventStart - Web APIs
l 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.unloadeventstart read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, the unload event has been thrown. if there is no previous document, or if the previous document, or one of the needed redirects, is not of the same origin, the value returned is 0. syntax time = performancetiming.unloadeventstart; specifications specification status comment navigation timingthe definition of 'performancetiming.unloadeventstart' in that specification. recommendation initial definition. ...
Performance Timeline - Web APIs
e properties are extended (with additional constraints) by other interfaces (such as performancemark): name the name of the performance entry when the metric was created. entrytype the type of performance metric (for example, "mark"). starttime a high resolution timestamp representing the starting time for the performance entry. duration a high resolution timestamp representing the time value of the duration of the performance event. (some performance entry types have no concept of duration and this value is set to '0' for such types.) this interface includes a tojson() method that returns the serialization of the performanceentry object. the serialization is specific to the performance entry's type. performance observers the performance observer interfaces allow an application...
PeriodicWave.PeriodicWave() - Web APIs
s the options defined in the periodicwaveconstraints dictionary.): real: a float32array containing the cosine terms that you want to use to form the wave (equivalent to the real parameter of audiocontext.createperiodicwave). imag: a float32array containing the sine terms that you want to use to form the wave (equivalent to the imag parameter of audiocontext.createperiodicwave). return value a new periodicwave object instance. example var real = new float32array(2); var imag = new float32array(2); var ac = new audiocontext(); real[0] = 0; imag[0] = 0; real[1] = 1; imag[1] = 0; var options = { real : real, imag : imag, disablenormalization : false } var wave = new periodicwave(ac, options); specifications specification status comment web audio api...
Permissions.query() - Web APIs
Web › API › Permissions › query
the permissions.query() method of the permissions interface returns the state of a user permission on the global scope. syntax navigator.permissions.query(permissiondescriptor).then(function(permissionstatus) { ... }) parameters permissiondescriptor an object that sets options for the query operation consisting of a comma-separated list of name-value pairs. the available options are: name: the name of the api whose permissions you want to query. an up-to-date list of permission names can be found in the spec under the permissionname enum, but bear in mind that the actual permissions supported by browsers is currently much smaller than this. firefox for example currently supports geolocation, notifications, push, and persistent-storage (see our permissions.webidl file). uservisib...
Permissions.revoke() - Web APIs
everts a currently set permission back to its default state, which is usually prompt. syntax this method is called on the global permissions object navigator.permissions. var revokepromise = navigator.permissions.revoke(descriptor); parameters descriptor an object based on the permissiondescriptor dictionary that sets options for the operation consisting of a comma-separated list of name-value pairs. the available options are: name: the name of the api whose permissions you want to query. valid values are 'geolocation', 'midi', 'notifications', and 'push'. uservisibleonly: (push only, not supported in firefox — see the browser compatibility section below) indicates whether you want to show a notification for every message or be able to send silent push notifications. the defaul...
Using the Permissions API - Web APIs
missions object. this object will eventually include methods for querying, requesting, and revoking permissions, although currently it only contains permissions.query(); see below. querying permission state in our example, the permissions functionality is handled by one function — handlepermission(). this starts off by querying the permission status using permissions.query(). depending on the value of the state property of the permissionstatus object returned when the promise resolves, it reacts differently: "granted" the "enable geolocation" button is hidden, as it isn't needed if geolocation is already active. "prompt" the "enable geolocation" button is hidden, as it isn't needed if the user will be prompted to grant permission for geolocation. the geolocation.getcurrentposition() ...
PhotoCapabilities.fillLightMode - Web APIs
auto the device's fill light will be used automatically in low light conditions. off no fill light will be used. flash always use the device's fill light. ...
PhotoCapabilities.imageHeight - Web APIs
specifications specification status comment mediastream image capturethe definition of 'imageheight' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. ...
imageWidth - Web APIs
specifications specification status comment mediastream image capturethe definition of 'imagewidth' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. ...
PhotoCapabilities.redEyeReduction - Web APIs
never red-eye reduction is not available. always red-eye reduction is available in the source and it is always turned on. controllable red-eye reduction is available in the source and it is configurable via the photosettings object. ...
Point - Web APIs
Web › API › Point
which existed only briefly in the css transforms level 1 specification, which represents a point in 2-dimensional space. it is non-standard, not broadly compatible, and should not be used. although it is not directly related to this defunct interface, you are probably looking for dompoint, which is part of the geometry interfaces module level 1 specification. properties x a floating-point value specifying the point's position with respect to the x (horizontal) axis. y a floating-point value specifying the point's position with respect to the y (vertical) axis. specifications this class was specified in the defunct 20 march 2009 working draft of css 2d transforms module level 3. it is not present in the current working draft of the css transforms level 1 specification. ...
PointerEvent.height - Web APIs
the height read-only property of the pointerevent interface represents the height of the pointer's contact geometry, along the y-axis (in css pixels). depending on the source of the pointer device (for example a finger), for a given pointer, each event may produce a different value. if the input hardware cannot report the contact geometry to the browser, the height defaults to 1. syntax var contactheight = pointerevent.height; return value contactheight the height of the event's contact area (in css pixels). example an example of this property is included in the pointerevent.width example. specifications specification status comment pointer events – level 2the definition of 'height' in that specification. recommendation non-stable version. ...
PointerEvent.isPrimary - Web APIs
ertype) are considered primary. for example, a touch contact and a mouse cursor moved simultaneously will produce pointers that are both considered primary. if there are multiple primary pointers, these pointers will all produce compatibility mouse events (see pointer_events for more information about pointer, mouse and touch interaction). syntax var isprimary = pointerevent.isprimary; return value isprimary returns true if the pointer for this event is the primary pointer and returns false otherwise. example this example illustrates using the value of isprimary to call the appropriate processing function. target.addeventlistener('pointerdown', function(event) { if (event.isprimary) process_primary_pointer(event); else process_secondary_pointer(event); }, false); ...
PointerEvent.pressure - Web APIs
the pressure read-only property of the pointerevent interface indicates the normalized pressure of the pointer input. syntax var pressure = pointerevent.pressure; return value pressure the normalized pressure of the pointer input in the range of 0 to 1, inclusive, where 0 and 1 represent the minimum and maximum pressure the hardware is capable of detecting, respectively. for hardware that does not support pressure, such as a mouse, the value is 0.5 when the pointer is active buttons state and 0 otherwise. example in this snippet, when a pointerdown event is fired, different functions are called depending on the value of the event's pressure property. someelement.addeventlistener('pointerdown', function(event) { if (event.pressure == 0) { // no pressure process_no_pressure...
PointerEvent.tangentialPressure - Web APIs
the tangentialpressure read-only property of the pointerevent interface represents the normalized tangential pressure of the pointer input (also known as barrel pressure or cylinder stress). syntax var tanpressure = pointerevent.tangentialpressure; return value a float representing the normalized tangential pressure of the pointer input in the range -1 to 1, inclusive, where 0 is the neutral position of the control. note that some hardware may only support positive values in the range 0 to 1. for hardware that does not support tangential pressure, the value will be 0. example in this snippet, when a pointerdown event is fired, different functions are called depending on the value of the event's tangentialpressure property. someelement.addeventlistener('pointerdown', function(event) { ...
PointerEvent.tiltX - Web APIs
the tiltx read-only property of the pointerevent interface is the angle (in degrees) between the y-z plane of the pointer and the screen. this property is typically only useful for a pen/stylus pointer type. for an illustration of this property see figure 2 in the specification. syntax var tiltx = pointerevent.tiltx; return value tiltx the angle in degrees between the y-z plane of the pointer (stylus) and the screen. the range of values is -90 to 90, inclusive, where a positive value is a tilt to the right. for devices that do not support this property, the value is 0. example this example illustrates simple accessing of the tiltx and tilty properties. someelement.addeventlistener("pointerdown", function(event) { process_tilt(event.tiltx, event.tilty); }, false); specification...
PointerEvent.tiltY - Web APIs
the tilty read-only property of the pointerevent interface is the angle (in degrees) between the x-z plane of the pointer and the screen. this property is typically only useful for a pen/stylus pointer type. for an illustration of this property, see figure 3 in the specification. syntax var tilty = pointerevent.tilty; return value tilty the angle in degrees between the x-z plane of the pointer (stylus) and the screen. the range of values is -90 to 90, inclusive, where a positive value is a tilt towards the user. for devices that do not support this property, the value is 0. example this example illustrates simple accessing of the tiltx and tilty properties. someelement.addeventlistener("pointerdown", function(event) { process_tilt(event.tiltx, event.tilty); }, false); specifica...
PointerEvent.twist - Web APIs
the twist read-only property of the pointerevent interface represents the clockwise rotation of the pointer (e.g., pen stylus) around its major axis, in degrees. syntax var twist = pointerevent.twist; return value a long value representing the amount of twist, in degrees, applied to the transducer (pointer). the value is in the range 0 to 359, inclusive. for devices that do not report twist, the value is 0. example when a pointerdown event is fired, different functions are called depending on the value of the event's twist property. someelement.addeventlistener('pointerdown', function(event) { if (event.twist == 0) { // no twist process_no_twist(event); } else { // default process_twist(event); } }, false); specifications specification status com...
PointerEvent.width - Web APIs
the width read-only property of the pointerevent interface represents the width of the pointer's contact geometry along the x-axis, measured in css pixels. depending on the source of the pointer device (such as a finger), for a given pointer, each event may produce a different value. if the input hardware cannot report the contact geometry to the browser, the width defaults to 1. syntax var contactwidth = pointerevent.width; return value contactwidth the width of the event's contact area (in css pixels). example this example illustrates using the pointerevent interface's width and height properties to calculate the contact area. target.addeventlistener("pointerdown", function(ev) { // calculate the contact area var area = ev.width * ev.height; }, false); specifications ...
PointerEvent - Web APIs
the plane containing both the pointer (e.g. pen stylus) axis and the y axis. pointerevent.tilty read only the plane angle (in degrees, in the range of -90 to 90) between the x–z plane and the plane containing both the pointer (e.g. pen stylus) axis and the x axis. pointerevent.twist read only the clockwise rotation of the pointer (e.g. pen stylus) around its major axis in degrees, with a value in the range 0 to 359. pointerevent.pointertype read only indicates the device type that caused the event (mouse, pen, touch, etc.) pointerevent.isprimary read only indicates if the pointer represents the primary pointer of this pointer type. methods pointerevent.getcoalescedevents() returns a sequence of all pointerevent instances that were coalesced into the dispatched pointermove...
Pinch zoom gestures - Web APIs
g in -> zoom out",ev); ev.target.style.background = "lightblue"; } } // cache the distance for the next move event prevdiff = curdiff; } } pointer up the pointerup event is fired when a pointer is raised from the contact surface. when this occurs, the event is removed from the event cache and the target element's background color and border are restored to their original values. in this application, this handler is also used for pointercancel, pointerleave and pointerout events. function pointerup_handler(ev) { log(ev.type, ev); // remove this pointer from the cache and reset the target's // background and border remove_event(ev); ev.target.style.background = "white"; ev.target.style.border = "1px solid black"; // if the number of pointers down is less...
Using Pointer Events - Web APIs
); // make it a hex digit g = g.tostring(16); // make it a hex digit b = b.tostring(16); // make it a hex digit var color = "#" + r + g + b; log("color for touch with identifier " + touch.pointerid + " = " + color); return color; } the result from this function is a string that can be used when calling <canvas> functions to set drawing colors. for example, for a pointerevent.pointerid value of 10, the resulting string is "#aaa". copying a touch object some browsers may re-use touch objects between events, so it's best to copy the bits you care about, rather than referencing the entire object. function copytouch(touch) { return { identifier: touch.pointerid, pagex: touch.clientx, pagey: touch.clienty }; } finding an ongoing touch the ongoingtouchindexbyid() function below sca...
PositionOptions.enableHighAccuracy - Web APIs
the positionoptions.enablehighaccuracy property is a boolean that indicates the application would like to receive the best possible results. if true and if the device is able to provide a more accurate 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 default value), the device can take the liberty to save resources by responding more quickly and/or using less power. syntax positionoptions.enablehighaccuracy = booleanvalue specifications specification status comment geolocation apithe definition of 'positionoptions.enablehighaccuracy' in that specification. recommendation initial definition ...
PositionOptions.maximumAge - Web APIs
if set to 0, it means that the device cannot use a cached position and must attempt to retrieve the real current position. if set to infinity the device must return a cached position regardless of its age. ...
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 = timelength specifications specification status comment geolocation apithe definition of 'positionoptions.timeout' in that specification. recommendation initial definition ...
ProgressEvent() - Web APIs
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. ...
ProgressEvent.initProgressEvent() - Web APIs
cess. 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 the operation was cancelled and didn't complete. load the operation completed. loadend the operation stopped. ...
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 ...
ProgressEvent.loaded - Web APIs
the progressevent.loaded read-only property is an integer representing the amount of work already performed by the underlying process. the ratio of work done can be calculated with the property and progressevent.total. when downloading a resource using http, this only represent the part of the content itself, not headers and other overhead. syntax value = progressevent.loaded specifications specification status comment xmlhttprequestthe definition of 'progressevent.loaded' in that specification. living standard ...
ProgressEvent.total - Web APIs
the progressevent.total read-only property is an integer representing the total amount of work that the underlying process is in the progress of performing. when downloading a resource using http, this only represent the content itself, not headers and other overhead. syntax value = progressevent.total specifications specification status comment xmlhttprequestthe definition of 'progressevent.lengthcomputable' in that specification. living standard ...
ProgressEvent - Web APIs
t.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 ...
PromiseRejectionEvent() - Web APIs
ng the name of the type of the promiserejectionevent. this is case-sensitive and should be one of "rejectionhandled" or "unhandledrejection", to match the event names of the possible (non-synthetic) promiserejectionevent events that user agents can actually fire). options an object specifying details about the rejection which occurred: promise the promise that was rejected. reason any value or object which represents the reason the promise was rejected. this can be anything from a numeric error code to an error domstring to an object which contains detailed information describing the situation resulting in the promise being rejected. return value a new promiserejectionevent configured as specified by the parameters. examples this example creates a new unhandledrejection eve...
PromiseRejectionEvent.promise - Web APIs
the promiserejectionevent interface's promise read-only property indicates the javascript promise which was rejected. you can examine the event's promiserejectionevent.reason property to learn why the promise was rejected. syntax promise = promiserejectionevent.promise value the javascript promise which was rejected, and whose rejection went unhandled. examples this example listens for unhandled promises and, if the reason is an object with a code field containing the text "module not ready", it sets up an idle callback that will retry the task that failed to execute correctly. event.preventdefault() is called to indicate that the promise has now been handled. window.onunhandledrejection = function(event) { if (event.reason.code && event.reason.code == "module not ready") { windo...
PromiseRejectionEvent - Web APIs
fill: #0095dd; pointer-events: all;} constructor promiserejectionevent() creates a promiserejectionevent event, given the type of event (unhandledrejection or rejectionhandled) and other details. properties also inherits properties from its parent event. promiserejectionevent.promise read only the javascript promise that was rejected. promiserejectionevent.reason read only a value or object indicating why the promise was rejected, as passed to promise.reject(). methods this interface has no unique methods; inherits methods from its parent event. events rejectionhandled fired when a javascript promise is rejected, and after the rejection is handled by the promise's rejection handling code. unhandledrejection fired when a javascript promise is rejected but there is...
Proximity Events - Web APIs
l by using the addeventlistener method (using the deviceproximity or userproximity event name) or by attaching an event handler to the window.ondeviceproximity or window.onuserproximity properties. once captured, the event object gives access to different kinds of information: the deviceproximityevent event provides an exact match for the distance between the device and the object through its value property. it also provides the closest and farthest distance the device is able to detect something through its min and max properties. the userproximityevent event provides a rough approximation of the distance, expressed through a boolean. the userproximityevent.near property is true if the object is close or false if the object is far. example window.addeventlistener('userproximity', funct...
PublicKeyCredential.getClientExtensionResults() - Web APIs
wsers may recognize different extensions. all extensions are optional for the client to process them: if a browser does not know of a given extension, that will not cause any failure. note: this method may only be used in top-level contexts and will not be available in an <iframe> for example. syntax maparraybuffer = publickeycredential.getclientextensionresults() parameters none. return value an arraybuffer containing the result of the processing of the different extensions by the client. this object contains a map between the extensions' identifiers and their results from the processing. warning! as of march 2019, only appid (used during creation with publickeycredentialrequestoptions.extensions) is supported by chrome and edge. firefox does not seem to support any extension. ex...
PublicKeyCredential.id - Web APIs
nly property of the publickeycredential interface is a domstring, inherited from credential, which represents the identifier of the current publickeycredential instance. this property is a base64url encoded version of publickeycredential.rawid. note: this property may only be used in top-level contexts and will not be available in an <iframe> for example. syntax id = publickeycredential.id value a domstring being the base64url encoded version of publickeycredential.rawid. examples var publickey = { challenge: new uint8array(26) /* this actually is given from the server */, rp: { name: "example corp", id : "login.example.com" }, user: { id: new uint8array(26), /* to be changed for each user */ name: "jdoe@example.com", displayname: "john doe", }, pubkey...
PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable() - Web APIs
to identify them. at the time of this writing, this method's result only resolves to true on windows when windows hello capabilities are available (on recent versions of this os). note: this method may only be used in top-level contexts and will not be available in an <iframe> for example. syntax publickeycredential.isuserverifyingplatformauthenticatoravailable() parameters none. return value a promise which resolves to a boolean indicating whether or a not a user-verifying platform authenticator is available. as of today (march 2019), this is basically indicating if windows hello may be used with the web authentication api and that the user has accepted its use. note: this is a static method which is directly called on the publickeycredential interface and not on an instance. n...
PublicKeyCredential.rawId - Web APIs
the rawid read-only property of the publickeycredential interface is an arraybuffer object containing the identifier of the credentials. the publickeycredential.id property is a base64url encoded version of this identifier. note: this property may only be used in top-level contexts and will not be available in an <iframe> for example. syntax rawid = publickeycredential.rawid value a arraybuffer containing the identifier of the credentials. this identifier is expected to be globally unique and is appointed for the current publickeycredential and its associated authenticatorassertionresponse. examples var options = { challenge: new uint8array(26) /* from the server */, rp: { name: "example corp", id : "login.example.com" }, user: { id: new uint8array(26),...
PublicKeyCredential.response - Web APIs
dential.getclientextensionresults()) to validate the demand. note: when validating the fetching of existing credentials, the whole publickeycredential object and the client extensions are necessary for the relying party's server. note: this property may only be used in top-level contexts and will not be available in an <iframe> for example. syntax response = publickeycredential.response value an authenticatorresponse object containing the data a relying party's script will receive and which should be sent to the relying party's server in order to validate the demand for creation or fetching. this object contains data from the client (authenticatorresponse/clientdatajson) and from the authenticator. examples var options = { challenge: new uint8array(16) /* from the server */, rp...
PublicKeyCredentialCreationOptions.challenge - Web APIs
the challenge property of the publickeycredentialcreationoptions dictionary is a buffersource used as a cryptographic challenge. this is randomly generated then sent from the relying party's server. this value (among other client data) will be signed by the authenticator, using its private key, and must be sent back for verification to the server as part of authenticatorattestationresponse.attestationobject. note: when the credential is retrieved with a navigator.credentials.get() call, the signature of the challenge is contained in authenticatorassertionresponse.signature. note: a challenge will be at least 16 bytes long. syntax challenge = publickeycredentialcreationoptions.challenge value a buffersource which is at least 16 bytes long. contains a cryptographic challenge emitted ...
PublicKeyCredentialCreationOptions.pubKeyCredParams - Web APIs
ns dictionary is an array whose elements are objects describing the desired features of the credential to be created. these objects define the type of public-key and the algorithm used for cryptographic signature operations. if this array contains multiple elements, they are sorted by descending order of preference. syntax pubkeycredparams = publickeycredentialcreationoptions.pubkeycredparams value an array whose elements are objects with the following properties: type a string describing type of public-key credential to be created. as of this writing (march 2019), only "public-key" may be used. alg a numeric identifier for the algorithm to be used to generate the key pair. the links between identifier and algorithms are defined in this iana registry (e.g. -7 indicates the elliptic c...
PublicKeyCredentialCreationOptions.rp - Web APIs
the rp property of the publickeycredentialcreationoptions dictionary is an object describing the relying party which requested the credential creation (via navigator.credentials.create()). syntax relyingpartyobj = publickeycredentialcreationoptions.rp properties icon optional an url as a usvstring value which points to an image resource which can be the logo/icon of the relying party. id a domstring uniquely identifying a relying party. the default value of this property is the domain of the current document (e.g. "login.example.com"). it may be overridden with a suffix of the current domain (e.g. "example.com"). name a domstring giving a human-readable name for the relying party. this property is intended for display (e.g. "example corp"). examples var publickey = { challeng...
PublicKeyCredentialCreationOptions.timeout - Web APIs
in milliseconds, for the time the script is willing to wait for the completion of the creation operation. this property is optional and merely is a hint which may be overridden by the browser. note: an analogous option exists for the fetching operation (navigators.credentials.get()), see publickeycredentialrequestoptions.timeout. syntax timeout = publickeycredentialcreationoptions.timeout value a numerical hint, expressed in milliseconds, giving the time to wait for the creation operation to complete. examples var publickey = { timeout: 6000, // accepting to wait for a minute before giving up. challenge: new uint8array(26) /* this actually is given from the server */, rp: { name: "example corp", id : "login.example.com" }, user: { id: new uint8array(26), /* to ...
PublicKeyCredentialCreationOptions.user - Web APIs
count for which the credentials are generated (via navigator.credentials.create()). syntax useraccount = publickeycredentialcreationoptions.user properties displayname a domstring which is human readable and intended for display. it may be the full name of the user (e.g. "john doe"). this is not intended to store the login of the user (see name below). icon optional an url as a usvstring value which points to an image resource which can be the avatar image for the user. id a buffersource uniquely identifying a given user. this an opaque identifier which can be used by the authenticator to link the user account with its corresponding credentials. this value will later be used when fetching the credentials in authenticatorassertionresponse.userhandle. name a domstring giving a human-...
PublicKeyCredentialCreationOptions - Web APIs
. properties publickeycredentialcreationoptions.rp an object describing the relying party which requested the credential creation. publickeycredentialcreationoptions.user an object describing the user account for which the credential is generated. publickeycredentialcreationoptions.challenge a buffersource, emitted by the relying party's server and used as a cryptographic challenge. this value will be signed by the authenticator and the signature will be sent back as part of authenticatorattestationresponse.attestationobject. publickeycredentialcreationoptions.pubkeycredparams an array of element which specify the desired features of the credential, including its type and the algorithm used for the cryptographic signature operations. this array is sorted by descending order of prefer...
PublicKeyCredentialRequestOptions.challenge - Web APIs
the challenge property of the publickeycredentialrequestoptions dictionary is a buffersource used as a cryptographic challenge. this is randomly generated then sent from the relying party's server. this value (among other client data) will be signed by the authenticator's private key and produce authenticatorassertionresponse.signature which should be sent back to the server as part of the response. note: when the credential is created with a navigator.credentials.create() call, the signature of the challenge is contained within authenticatorattestationresponse.attestationobject. note: a challenge will be at least 16 bytes long. syntax challenge = publickeycredentialrequestoptions.challenge value a buffersource which is at least 16 bytes long. contains a cryptographic challenge emi...
PublicKeyCredentialRequestOptions.timeout - Web APIs
milliseconds, for the time the script is willing to wait for the completion of the retrieval operation. this property is optional and merely is a hint which may be overridden by the browser. note: an analogous option exists for the creation operation (navigators.credentials.create()), see publickeycredentialcreationoptions.timeout. syntax timeout = publickeycredentialrequestoptions.timeout value a numerical hint, expressed in milliseconds, giving the time to wait for the creation operation to complete. examples var options = { challenge: new uint8array([/* bytes sent from the server */]), timeout: 6000 // wait a minute for the fetching operation // and maybe fail if it takes longer }; navigator.credentials.get({ "publickey": options }) .then(function (creden...
PublicKeyCredentialRequestOptions - Web APIs
the publickeycredentialrequestoptions dictionary of the web authentication api holds the options passed to navigator.credentials.get() in order to fetch a given publickeycredential. properties publickeycredentialrequestoptions.challenge a buffersource, emitted by the relying party's server and used as a cryptographic challenge. this value will be signed by the authenticator and the signature will be sent back as part of authenticatorassertionresponse.signature. publickeycredentialrequestoptions.timeout optional a numerical hint, in milliseconds, which indicates the time the caller is willing to wait for the retrieval operation to complete. this hint may be overridden by the browser. publickeycredentialrequestoptions.rpid optional a usvstring which indicates the relying party...
PushEvent.data - Web APIs
Web › API › PushEvent › data
examples the following example takes data from a pushevent and displays it on all of the service workers' clients. ...
PushManager.getSubscription() - Web APIs
syntax ​pushmanager.getsubscription().then(function(pushsubscription) { ... } ); parameters none. returns a promise that resolves to a pushsubscription object or null. ...
PushManager.supportedContentEncodings - Web APIs
specifications specification status comment push apithe definition of 'supportedcontentencodings' in that specification. working draft initial definition. ...
PushManager - Web APIs
ushmanager.supportedcontentencodings returns an array of supported content codings that can be used to encrypt the payload of a push message. methods pushmanager.getsubscription() retrieves an existing push subscription. it returns a promise that resolves to a pushsubscription object containing details of an existing subscription. if no existing subscription exists, this resolves to a null value. pushmanager.permissionstate() returns a promise that resolves to the permission state of the current pushmanager, which will be one of 'granted', 'denied', or 'prompt'. pushmanager.subscribe() subscribes to a push service. it returns a promise that resolves to a pushsubscription object containing details of a push subscription. a new push subscription is created if the current service worker...
PushSubscription.endpoint - Web APIs
ed with the push subscription. the endpoint takes the form of a custom url pointing to a push server, which can be used to send a push message to the particular service worker instance that subscribed to the push service. for this reason, it is a good idea to keep your endpoint a secret, so others do not hijack it and abuse the push functionality. syntax var myend = pushsubscription.endpoint; value a usvstring. example navigator.serviceworker.ready.then(function(reg) { reg.pushmanager.subscribe({uservisibleonly: true}).then(function(subscription) { console.log(subscription.endpoint); // at this point you would most likely send the subscription // endpoint to your server, save it, then use it to send a // push message at a later date }) }) specifications ...
PushSubscription.expirationTime - Web APIs
specifications specification status comment push apithe definition of 'expirationtime' in that specification. working draft initial definition. ...
PushSubscription.getKey() - Web APIs
the getkey() method of the pushsubscription interface returns an arraybuffer representing a client public key, which can then be sent to a server and used in encrypting push message data. syntax ​var key = subscription.getkey(name); parameters name a domstring representing the encryption method used to generate a client key. the value can be: p256dh: an elliptic curve diffie–hellman public key on the p-256 curve (that is, the nist secp256r1 elliptic curve). the resulting key is an uncompressed point in ansi x9.62 format. auth: an authentication secret, as described in message encryption for web push. returns an arraybuffer. example reg.pushmanager.getsubscription() .then(function(subscription) { // enable any ui which subscribes / unsubscribes from // push m...
PushSubscription.options - Web APIs
the options read-only property of the pushsubscription interface is an object containing containing the options used to create the subscription. syntax var options = pushsubscription.options value an read-only options object containing the following values: uservisibleonly: a boolean, indicating that the returned push subscription will only be used for messages whose effect is made visible to the user. applicationserverkey: a public key your push server will use to send messages to client apps via a push server. this value is part of a signing key pair generated by your application server, and usable with elliptic curve digital signature (ecdsa), over the p-256 curve. specifications specification status comment push apithe definition of 'options' in that s...
Web Push API Notifications best practices - Web APIs
very sparingly, since they can be the most annoying. your notifications should be assistive, not disruptive. building trust some studies have shown that as many as 60% of push notifications are blocked. allowing your site to push notifications in realtime requires trust. you can build trust by having a well-designed website that provides good content that shows respect for the user, and a clear value to accepting push notifications. browser mitigations because of abuses of push notifications in the past, web browser developers have begun to implement strategies to help mitigate this problem. for example, safari 12.1 now requires—and other browsers either already do, or are planning[1] to do so—that the user interact with the page in some way before the page can request permission to per...
RTCConfiguration.iceServers - Web APIs
the rtcconfiguration dictionary's iceservers property is an array of rtciceserver objects, each of which describes a single stun or turn server to use for negotiation purposes. syntax let rtcconfiguration = { iceservers: [ iceserver1... ] }; let rtcconfiguration.iceservers = [ iceserver1... ]; value an array of zero or more rtciceserver objects, each of which describes one stun or turn server for the ice agent to use during the connection's negotiation. each object must at least have an urls property, which is an array of one or more strings, each providing one server's url. if the array is empty, or if the iceservers option isn't specified, the ice agent will negotiate without the use of any servers, which will limit the connection to local peers. description how the list...
RTCConfiguration.iceTransportPolicy - Web APIs
...
RTCDTMFSender.ontonechange - Web APIs
the ontonechange property of the rtcdtmfsender interface is used to set the event handler for the tonechange event, which is sent to the rtcdtmfsender each time a tone begins or ends. the event handler receives as input a single parameter of type rtcdtmftonechangeevent, which describes the change. syntax rtcdtmfsender.ontonechange = tonechangehandlerfunction; value a function which is called when a tonechange event is sent to the rtcdtmfsender, indicating that a dtmf tone has either started playing, or if all tones have finished playing. example tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'ontonechange' in that specification. candidate recommendation ...
RTCDTMFSender.toneBuffer - Web APIs
the rtcdtmfsender interface's tonebuffer property returns a string containing a list of the dtmf tones currently queued for sending to the remote peer over the rtcpeerconnection. to place tones into the buffer, call insertdtmf(). tones are removed from the string as they're played, so only upcoming tones are listed. syntax var tonebuffer = rtcdtmfsender.tonebuffer; value a domstring listing the tones to be played. if the string is empty, there are no tones pending. tone buffer format the tone buffer is a string which can contain any combination of the characters that are permitted by the dtmf standard. dtmf tone characters the digits 0-9 these characters represent the digit keys on a telephone keypad. the letters a-d these characters represent the "a" through "d" keys which are p...
RTCDTMFSender: tonechange event - Web APIs
ange event is sent to an rtcdtmfsender by the webrtc api to indicate when dtmf tones previously queued for sending (by calling rtcdtmfsender.insertdtmf()) begin and end. bubbles no cancelable no interface rtcdtmftonechangeevent event handler property ontonechange to determine what tone started playing, or if a tone stopped playing, check the value of the event's tone property. examples this example establishes a handler for the tonechange event which updates an element to display the currently playing tone in its content, or, if all tones have played, the string "<none>". this can be done using addeventlistener(): dtmfsender.addeventlistener("tonechange", ev => { let tone = ev.tone; if (tone === "") { tone = "&lt;none&gt;"; }...
RTCDTMFToneChangeEvent.RTCDTMFToneChangeEvent() - Web APIs
ent. this is always "tonechange". options a dictionary of type rtcdtmftonechangeeventinit, which may contain one or more of the following fields: tone a domstring containing a single dtmf tone character which has just begun to play, or an empty string ("") to indicate that the previous tone has stopped playing. see tone characters for details on what characters are permitted. return value a newly-created rtcdtmftonechangeevent, configured as specified in the provided options. tone characters the digits 0-9 these characters represent the digit keys on a telephone keypad. the letters a-d these characters represent the "a" through "d" keys which are part of the dtmf standard but not included on most telephones. these are not interpreted as digits. lower-case "a"-"d" automatic...
RTCDataChannel.close() - Web APIs
tcdatachannel.readystate property is set to "closed". if the transport was closed with an error, the rtcdatachannel is sent a networkerror event. a close event is sent to the channel. in firefox, the rtcdatachannel interface was implemented under the name datachannel until firefox 24, so this method was called datachannel.close(). syntax rtcdatachannel.close(); parameters none. return value undefined. example var pc = new rtcpeerconnection(); var dc = pc.createdatachannel("my channel"); dc.onmessage = function (event) { console.log("received: " + event.data); dc.close(); // we decided to close after the first received message }; dc.onopen = function () { console.log("datachannel open"); }; dc.onclose = function ( console.log("datachannel close"); }; // now negotiate t...
RTCDataChannel.id - Web APIs
Web › API › RTCDataChannel › id
d is false) or by the site or app script (if negotiated is true). each rtcpeerconnection can therefore have up to a theoretical maximum of 65,534 data channels on it, although the actual maximum may vary from browser to browser. in early versions of the webrtc specification, this property's name was stream. code that uses that property needs to be updated. syntax var id = adatachannel.id; value an unsigned short value (that is, an integer between 0 and 65,535) which uniquely identifies the data channel. while the label property doesn't have to be unique, this id number is guaranteed to be unique among all data channels. additionally, known implementations of webrtc use the same id on both peers. a unique id makes it easier for your code to do its own out-of-band data channel-related s...
RTCDataChannel.label - Web APIs
m all the same name. or you could give each channel a unique label for tracking purposes. it's entirely up to the design decisions made when building your site or app. a unique id can be found in the id property. a data channel's label is set when the channel is created by calling rtcpeerconnection.createdatachannel(). it cannot be changed after that. syntax var name = adatachannel.label; value a string identifier assigned by the web site or app when the data channel was created, as specified when rtcpeerconnection.createdatachannel() was called to create the channel. example this sample creates a data channel on an rtcpeerconnection, then, some time later, sets the content of a ui element to display the channel's name. var pc = new rtcpeerconnection(); var dc = pc.createdatachannel...
RTCDataChannel.maxPacketLifeTime - Web APIs
the read-only rtcdatachannel property maxpacketlifetime returns the amount of time, in milliseconds, the browser is allowed to take to attempt to transmit a message, as set when the data channel was created, or null. this limits how long the browser can continue to attempt to transmit and retransmit the message before giving up. syntax var lifetime = adatachannel.maxpacketlifetime; value the number of milliseconds over which the browser may continue to attempt to transmit the message until it either succeeds or gives up. if not set when rtcpeerconnection.createdatachannel() was called to create the data channel, this value is null. example // tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definitio...
RTCDataChannel.maxRetransmits - Web APIs
he maximum number of times the browser should try to retransmit a message before giving up, as set when the data channel was created, or null, which indicates that there is no maximum. this can only be set when the rtcdatachannel is created by calling rtcpeerconnection.createdatachannel(), using the maxretransmits field in the specified options. syntax var tries = adatachannel.maxretransmits; value the maximum number of times the browser will try to retransmit a message before giving up, or null if not set when rtcpeerconnection.createdatachannel() was called. the default is null. example // tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannel.maxretransmits' in that specificat...
RTCDataChannel.negotiated - Web APIs
the read-only rtcdatachannel property negotiated indicates whether the rtcdatachannel's connection was negotiated by the web app (true) or by the webrtc layer (false). the default is false. see creating a data channel in using webrtc data channels for further information about this property. syntax var negotiated = adatachannel.negotiated; value true if the rtcdatachannel's connection was negotiated by the web app itself; false if the negotiation was handled by the webrtc layer. the default is false. example the code snippet below checks the value of negotiated; if it's true, a function called shutdownremotechannel() is called with the channel's id; presumably this would be implemented to transmit a shutdown signal to the remote peer prior to terminating the connection. if (datachann...
RTCDataChannel.onbufferedamountlow - Web APIs
event is sent to the rtcdatachannel. this event, which is represented by a simple event object, is sent when the amount of data buffered to be sent falls to or below the threshold specified by the channel's bufferedamountlowthreshold. see buffering in using webrtc data channels to learn more about how to work with the data channel buffer. syntax rtcdatachannel.onbufferedamountlow = function; value a function which the browser will call to handle the bufferedamountlow event. this function receives as its only input parameter a simple event object representing the event 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...
RTCDataChannel.onclose - Web APIs
the function receives as its sole input parameter the event itself, as an object of type event. ...
RTCDataChannel.onclosing - Web APIs
es a function to be called by the browser when the closing event is received by the rtcdatachannel. this is a simple event which indicates that the data channel is being closed, that is, rtcdatachannel transitions to "closing" state. for example, after rtcdatachannel.close() was called but the underlying data transport might not have been closed yet. syntax rtcdatachannel.onclosing = function; value a function which the browser will call to handle the closing event. the function receives as its sole input parameter the event itself, as an object of type event. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannel.onclosing' in that specification. candidate recommendation initial s...
RTCDataChannel.onerror - Web APIs
the rtcdatachannel.onerror property is an eventhandler which specifies a function to be called when the error event is received. when an error occurs on the data channel, the function receives as input an errorevent object describing the error which occurred. syntax rtcdatachannel.onerror = function; value a function which the browser will call to handle the error event when it occurs on the data channel. this function receives as its only input an errorevent object describing the event which was received. that event object, in turn, describes the error that took place. example in the example below, a data channel is established, and an onerror handler is added to it. the error handler passes information about the error to a ui library's alert box function to present an error message t...
RTCDataChannel.onmessage - Web APIs
the rtcdatachannel.onmessage property stores an eventhandler which specifies a function to be called when the message event is fired on the channel. this event is represented by the messageevent interface. this event is sent to the channel when a message is received from the other peer. syntax rtcdatachannel.onmessage = function; value a function which the browser will call to handle the message event. the function receives as its sole input parameter a messageevent object describing the event. example this code snippet creates a peer connection, adds a data channel to it, and starts creating new <p> (paragraph) elements each time a message arrives, with the message's contents displayed inside it. the new elements are then attached to the end of the document. let pc = new rtcpeerconne...
RTCDataChannel.onopen - Web APIs
the rtcdatachannel.onopen property is an eventhandler which specifies a function to be called when the open event is fired; this is a simple event which is sent when the data channel's underlying data transport—the link over which the rtcdatachannel's messages flow—is established or re-established. syntax rtcdatachannel.onopen = function; value a function which the browser will call to handle the open event. the function receives as its only input parameter the event itself, of type event. example this example adds a new data channel to an existing rtcpeerconnection, mypeerconnection. it then establishes an open event handler which updates some user interface elements to prepare them for being used to send messages over the data channel. let dc = mypeerconnection.createdatachannel...
RTCDataChannel: open event - Web APIs
nnect button and disabling the connect button. finally, the message input box is focused so the user can immediately begin to type. dc.addeventlistener("open", ev => { messageinputbox.disabled = false; sendmessagebutton.disabled = false; disconnectbutton.disabled = false; connectbutton.disabled = true; messageinputbox.focus(); }, false); this can also be done by directly setting the value of the channel's onopen event handler property. dc.onopen = ev => { messageinputbox.disabled = false; sendmessagebutton.disabled = false; disconnectbutton.disabled = false; connectbutton.disabled = true; messageinputbox.focus(); } ...
RTCDataChannel.ordered - Web APIs
ndicates whether or not the data channel guarantees in-order delivery of messages; the default is true, which indicates that the data channel is indeed ordered. this is set when the rtcdatachannel is created, by setting the ordered property on the rtcdatachannelinit object passed as rtcpeerconnection.createdatachannel()'s options parameter. syntax var ordered = adatachannel.ordered; a boolean value which is true if in-order delivery is guaranteed and is otherwise false. example var pc = new rtcpeerconnection(); var dc = pc.createdatachannel("my channel"); if (!dc.ordered) { // handle unordered messaging } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannel.ordered' in that speci...
RTCDataChannel.protocol - Web APIs
the read-only rtcdatachannel property protocol returns a domstring containing the name of the subprotocol in use. if no protocol was specified when the data channel was created, then this property's value is "" (the empty string). the permitted values of this property are defined by the web site or app using the data channel. the ability for each channel to have a defined subprotocol lets your app, for example, use json objects as messages on one channel while another channel is plaintext and another is raw binary or even some other format. syntax var subprotocol = adatachannel.protocol; value a string identifying the app-defined subprotocol being used for exchanging data on the channel. if none has been established, this is an empty string (""). example var pc = new rtcpeerconnec...
RTCDataChannel.reliable - Web APIs
the read-only rtcdatachannel property reliable indicates whether or not the data channel is reliable. this property is obsolete. use rtcdatachannel.ordered instead in any new code, and update existing code as soon as possible. syntax var reliable = adatachannel.reliable; value true if the rtcdatachannel's connection is reliable; false if it isn't. example // tbd specifications no longer part of any specification. ...
RTCDataChannel.send() - Web APIs
lement them, and those that do have various additional restrictions. this will get less complicated over time, but for now, if you have questions, see understanding message size limits in using webrtc data channels. syntax rtcdatachannel.send(data); parameters data the data to transmit across the connection. this may be a usvstring, a blob, an arraybuffer, or an arraybufferview. return value undefined. exceptions invalidstateerror since the data channel uses a separate transport channel from the media content, it must establish its own connection; if it hasn't finished doing so (that is, its readystate is "connecting"), this error occurs without sending or buffering the data. networkerror the specified data would need to be buffered, and there isn't room for it in the buffer.
RTCDataChannel.stream - Web APIs
is set at the time the data channel is created, either by the user agent (if rtcdatachannel.negotiated is false) or by the site or app script (if negotiated is true). this property has been replaced with the rtcdatachannel.id property. if you have code that uses stream, you will need to update, since browsers have begun to remove support for stream. syntax var stream = adatachannel.stream; value an unsigned short value (that is, an integer between 0 and 65,535) which uniquely identifies the data channel. example var datachannel = pc.createdatachannel("samplechannel"); console.log("data channel stream id: " + datachannel.stream); ...
RTCDataChannelEvent() - Web APIs
t a rtcdatachanneleventinit dictionary, which has following fields: "channel" of type rtcdatachannel, representing the data channel being concerned by the event. "bubbles", optional, inherited from eventinit. indicates if the event must bubble or not. default is false. "cancelable", optional, inherited from eventinit. indicates if the event can be canceled or not. default is false. value a new rtcdatachannelevent configured as specified. example in this example, a new datachannel event is created. dc is a data channel which already exists. var event = new rtcdatachannelevent("datachannel", {"channel": dc}); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannelevent' in th...
RTCDataChannelEvent.channel - Web APIs
example the first line of code in the datachannel event handler shown below takes the channel from the event object and saves it locally for use by the code handling data traffic. ...
RTCDtlsTransport.iceTransport - Web APIs
the read-only rtcdtlstransport property icetransport contains a reference to the underlying rtcicetransport. syntax var icetransport = rtcdtlstransport.icetransport; value the underlying rtcicetransport instance. examples tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdtlstransport.icetransport' in that specification. candidate recommendation initial definition. ...
RTCDtlsTransport - Web APIs
n turn, identify the rtcdtlstransport used to securely encapsulate the data channels' sctp communications by looking at the rtcsctptransport object's transport property. examples this example presents a function, tallysenders(), which iterates over an rtcpeerconnection's rtcrtpsenders, tallying up how many of them are in various states. the function returns an object containing properties whose values indicate how many of the senders are in each state. let pc = new rtcpeerconnection({ bundlepolicy: "max-bundle" }); /* ... */ function tallysenders(pc) { let results = { transportmissing: 0, connectionpending: 0, connected: 0, closed: 0, failed: 0, unknown: 0 }; let senderlist = pc.getsenders(); senderlist.foreach(sender => { let transport = sender.transpo...
RTCError - Web APIs
Web › API › RTCError
the rtcerror interface describes an error which has occurred while handling webrtc operations. it's based upon the standard domexception interface that describes general dom errors. constructor rtcerror() creates and returns a new rtcerror object initialized with the properties of the provided rtcerrorinit dictionary and, optionally, a string to use as the value of the error's message property. properties in addition to the properties defined by the parent interface, domexception, rtcerror includes the following properties: errordetail read only a domstring specifying the webrtc-specific error code identifying the type of error that occurred. receivedalert read only an unsigned long integer value indicating the fatal dtls error which was received from the network. only valid i...
RTCErrorEvent.error - Web APIs
the read-only rtcerrorevent property error contains an rtcerror object describing the details of the error which the event is announcing. syntax let errorinfo = rtcerrorevent.error; value an rtcerror object whose properties provide details about the error which has occurred in the context of a webrtc operation. since rtcerror is based upon domexception, it includes those properties. additional properties defined by rtcerror are: errordetail read only a domstring specifying the webrtc-specific error code identifying the type of error that occurred. receivedalert read only an unsigned long integer value indicating the fatal dtls error which was received from the network. only valid if the errordetail string is dtls-failure. if null, no dtls error was received. sctpcausecode read onl...
RTCIceCandidate.foundation - Web APIs
the rtcicecandidate interface's read-only foundation property is a string which uniquely identifies the candidate across multiple transports. as such, the foundation can be used to correlate candidates that are present on multiple rtcicetransport objects syntax var foundation = rtcicecandidate.foundation; value a domstring which uniquely identifies the candidate across all rtcicetransports on which it is available. note: if port is null — and port is supported by the user agent — passing the candidate to addicecandidate() will fail, throwing an operationerror exception. usage notes consider this sdp attribute line (a-line) which describes an ice candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the field "4234997325" is the foundation. example thi...
RTCIceCandidatePair.local - Web APIs
the rtcicecandidatepair is returned by the rtcicetransport method getselectedcandidatepair(). example this one-line example simply obtains the current candidate pair and then from that gets the local candidate. ...
RTCIceCandidatePair.remote - Web APIs
the rtcicecandidatepair is returned by the rtcicetransport method getselectedcandidatepair(). example this one-line example simply obtains the current candidate pair and then from that gets the remote candidate. ...
RTCIceCandidatePair - Web APIs
properties local an rtcicecandidate describing the configuration of the local end of the connection. remote the rtcicecandidate describing the configuration of the remote end of the connection. ...
RTCIceCandidatePairStats.bytesReceived - Web APIs
the rtcicecandidatepairstats property bytesreceived indicates the total number of payload bytes—that is, bytes which aren't overhead such as headers or padding—that hve been received to date on the connection described by the candidate pair. the bytessent property reports the number of bytes sent so far on the described connection. syntax received = rtcicecandidatepairstats.bytesreceived; value an integer value indicating the total number of bytes received so far on the connection described by this candidate pair. only data bytes are counted; overhead such as padding, headers, and the like are not included in this count. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.bytesrecei...
RTCIceCandidatePairStats.bytesSent - Web APIs
the rtcicecandidatepairstats property bytessent indicates the total number of payload bytes—that is, bytes which aren't overhead such as headers or padding—that hve been sent so far on the connection described by the candidate pair. the bytesreceived property reports the number of bytes received so far on the described connection. syntax sent = rtcicecandidatepairstats.bytessent; value an integer value indicating the total number of bytes sent so far on the connection described by this candidate pair. only data bytes are counted; overhead such as padding, headers, and the like are not included in this count. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.bytessent' in that spe...
RTCIceCandidatePairStats.circuitBreakerTriggerCount - Web APIs
ircuitbreakertriggercount indicates the number of times the circuit-breaker has been triggered to indicate a connection timeout or other unexpected connection abort on this specific connection configuration. a circuit breaker trigger is fired each time the connection times out or otherwise needs to be halted automatically. syntax cbtcount = rtcicecandidatepairstats.circuitbreakertriggercount; value an integer value indicating the number of times the circuit-breaker has been triggered for the 5-tuple used by this connection. a 5-tuple defining a tcp connection is made up of the following data: the source ip address. the source port number. the destination ip address. the destination port number. network protocol. specifications specification status comment ...
RTCIceCandidatePairStats.consentExpiredTimestamp - Web APIs
piredtimestamp indicates the time at which the most recent stun binding response expired. this indicates when the current stun bindings — the mapping of the ip address and port configurations for both peers on the webrtc connection — are due to expire. if this time has arrived or passed, the bindings have expired. syntax consentexpiration = rtcicecandidatepairstats.consentexpiredtimestamp; value a domhighrestimestamp object that indicates the time at which the stun binding that allows the two peers described by this rtcicecandidatepair to communicate will expire (or the time at which the binding did expire, if the time has passed). this property's value is undefined if there have been no stun binding responses yet on the candidate pair. this is only possible if responsesreceived is 0. ...
RTCIceCandidatePairStats.consentRequestsSent - Web APIs
the rtcicecandidatepairstats property consentrequestssent specifies the number of consent requests that have been sent by this peer to the remote peer on the connection described by the pair of candidates. syntax consentrequestssent = rtcicecandidatepairstats.consentrequestssent; value an integer indicating the number of consent requests this peer has sent to the other peer over the connection described by the pair of candidates referenced by this rtcicecandidatepairstats object. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.consentrequestssent' in that specification. candidate recommendation initial specification. ...
RTCIceCandidatePairStats.currentRoundTripTime - Web APIs
the rtcicecandidatepairstats property currentroundtriptime is a floating-point value indicating the number of seconds it takes for data to be sent by this peer to the remote peer and back over the connection described by this pair of ice candidates. syntax rtt = rtcicecandidatepairstats.currentroundtriptime; value a floating-point value indicating the round-trip time, in seconds for the connection described by the pair of candidates for which this rtcicecandidatepairstats object offers statistics. this value is computed by observing the time that elapsed between the most recent stun request being sent to the remote peer and the response to that request arriving. this information may come from ongoing stun connectivity checks as well as from consent requests made when the connection was in...
RTCIceCandidatePairStats.lastPacketReceivedTimestamp - Web APIs
the rtcicecandidatepairstats property lastpacketreceivedtimestamp indicates the time at which the connection described by the candidate pair last received a packet. stun packets are not included. syntax lastpacketreceivedtimestamp = rtcicecandidatepairstats.lastpacketreceivedtimestamp; value a domhighrestimestamp object indicating the timestamp at which the connection described by pair of candidates last received a packet, stun packets excluded. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.lastpacketreceivedtimestamp' in that specification. candidate recommendation initial specification. ...
RTCIceCandidateStats.lastPacketSentTimestamp - Web APIs
the rtcicecandidatepairstats property lastpacketsenttimestamp indicates the time at which the connection described by the candidate pair last sent a packet, not including stun packets. syntax lastpacketsenttimestamp = rtcicecandidatepairstats.lastpacketsenttimestamp; value a domhighrestimestamp object indicating the timestamp at which the connection described by pair of candidates last sent a packet, stun packets excluded. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.lastpacketsenttimestamp' in that specification. candidate recommendation initial specification. ...
RTCIceCandidateStats.lastResponseTimestamp - Web APIs
the rtcicecandidatepairstats property lastresponsetimestamp indicates the time at which the last stun response was received on the described candidate pair. syntax lastresponsetimestamp = rtcicecandidatepairstats.lastresponsetimestamp; value a domhighrestimestamp object indicating the timestamp at which the most recent stun response was received on the connection defined by the described pair of candidates. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.lastresponsetimestamp' in that specification. candidate recommendation initial specification. ...
RTCIceCandidateStats.localCandidateId - Web APIs
the rtcicecandidatepairstats property localcandidateid is a string that uniquely identifies the local ice candidate which was analyzed to generate the rtcicecandidatestats used to compute the statistics for this pair of candidates. syntax localcandidateid = rtcicecandidatepairstats.localcandidateid; value a domstring giving a unique identifier for the local rtcicecandidate for the connection described by this rtcicecandidatepairstats object. this candidate is the source of one of the two rtcicecandidatestats objects that were used to compute the contents of this rtcicecandidatepairstats object. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.localcandidateid' in that specification.
RTCIceCandidatePairStats.nominated - Web APIs
the rtcicecandidatepairstats property nominated specifies whether or not the candidate pair described by the underlying rtcicecandidatepair has been nominated to be used as the configuration for the webrtc connection. syntax nominated = rtcicecandidatepairstats.nominated; value a boolean value which is set to true by the ice layer if the controlling user agent has indicated that the candidate pair should be used to configure the webrtc connection between the two peers. note: if more than one candidate pair are nominated at the same time, the one whose priority is higher will be selected for use. once a candidate pair has been nominated and the two peers have each reconfigured themselves to use the specified configuration, the ice negotiation process can potentially end (or it can conti...
RTCIceCandidatePairStats.packetsReceived - Web APIs
the rtcicecandidatepairstats dictionary's packetsreceived property indicates the total number of packets of any kind that have been received on the connection described by the pair of candidates. the number of packets sent to date on the connection can be obtained using packetssent. syntax packetsreceived = rtcicecandidatepairstats.packetsreceived; value an integer value indicating the total number of packets, of any kind, which have been received on the connection described by the two candidates comprising this pair. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.packetsreceived' in that specification. candidate recommendation initial specification. ...
RTCIceCandidatePairStats.packetsSent - Web APIs
the rtcicecandidatepairstats dictionary's packetssent property indicates the total number of packets which have been sent on the connection described by the pair of candidates. the number of packets received to date on the connection can be obtained using packetsreceived. syntax packetssent = rtcicecandidatepairstats.packetssent; value an integer value indicating the total number of packets, of any kind, which have been sent on the connection described by the two candidates comprising this pair. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.packetssent' in that specification. candidate recommendation initial specification. ...
RTCIceCandidatePairStats.readable - Web APIs
the obsolete rtcicecandidatepairstats property readable reports whether or not the connection described by the candidate pair has received at least one valid incoming ice request. syntax isreadable = rtcicecandidatepairstats.readable; value a boolean value which is true if the connection described by this candidate pair has received at least one valid ice request, and is therefore ready to be read from. note: this property was removed from the specification in early 2017 because you can determine whether or not the connection is readable by checking to see if requestsreceived is greater than 0: if (icpstats.requestsreceived > 0) { /* at least one ice request has been received */ } ...
RTCIceCandidatePairStats.remoteCandidateId - Web APIs
the rtcicecandidatepairstats property remotecandidateid is a string that uniquely identifies the remote ice candidate which was analyzed to generate the rtcicecandidatestats used to compute the statistics for this pair of candidates. syntax remotecandidateid = rtcicecandidatepairstats.remotecandidateid; value a domstring uniquely identifies the remote ice candidate—that is, the candidate describing a configuration for the remote peer—which is represented by the remote end of these statistics. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.remotecandidateid' in that specification. candidate recommendation initial specification. ...
RTCIceCandidatePairStats.requestsReceived - Web APIs
the rtcicecandidatepairstats dictionary's requestsreceived property indicates the total number of stun connectivity check requests that have been received so far on the connection described by this pairing of candidates. syntax requestsreceived = rtcicecandidatepairstats.requestsreceived; value an integer value which specifies the number of stun connectivity and/or consent requests that have been received to date on the connection described by this pair of ice candidates. because there's no way to tell the difference between requests made to check connectivity and requests made to check consent, the returned figure includes both. note: the reported number of requests includes retransmissions. if a request had to be repeated due to network issues, it will be counted multiple times here. ...
RTCIceCandidatePairStats.responsesReceived - Web APIs
the responsesreceived property in the rtcicecandidatepairstats dictionary indicates the total number of stun connectivity check responses that have been received on the connection described by this pair of candidates. syntax responsesreceived = rtcicecandidatepairstats.responsesreceived; value an integer value which specifies the number of stun connectivity request responses that have been received on the connection described by this pair of candidates so far. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.responsesreceived' in that specification. candidate recommendation initial specification. ...
RTCIceCandidatePairStats.responsesSent - Web APIs
the rtcicecandidatepairstats dictionary's responsessent property indicates the total number of stun connectivity check responses that have been sent so far on the connection described by this pair of candidates. syntax responsessent = rtcicecandidatepairstats.responsessent; value an integer value indicating the number of times a repsonse has been sent to a stun connectivity check request. note: since it isn't possible to tell the difference between connectivity check requests and consent requests, this value includes both. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.responsessent' in that specification. candidate recommendation initial specification. ...
RTCIceCandidatePairStats.retransmissionsReceived - Web APIs
rtcicecandidatepairstats dictionary's retransmissionsreceived property indicates the total number of stun connectivity check request retransmissions that have been received so far on the pair of candidates. the number of retransmissions that have been sent on the connection can be found in retransmissionssent. syntax retransmissionsreceived = rtcicecandidatepairstats.retransmissionsreceived; value an integer value indicating the total number of retransmitted stun connectivity check requests have been received on the connection referenced by this candidate pair so far. note: retransmissions are connectivity check requests with a transaction_transmit_counter attribute whose req field is greater than 1 (indicating that the request has been transmitted more than once). see rfc 7982 for furt...
RTCIceCandidatePairStats.retransmissionsSent - Web APIs
the rtcicecandidatepairstats dictionary's retransmissionssent property indicates the total number of stun connectivity check request retransmissions that have been sent so far on the pair of candidates. the number of retransmissions that have been received on the connection can be found in retransmissionsreceived. syntax retransmissionssent = rtcicecandidatepairstats.retransmissionssent; value an integer value indicating the total number of retransmitted stun connectivity check requests have been sent on the connection referenced by this candidate pair so far. note: retransmissions are connectivity check requests with a transaction_transmit_counter attribute whose req field is greater than 1 (indicating that the request has been transmitted more than once). see rfc 7982 for further deta...
RTCIceCandidatePairStats.transportId - Web APIs
the transport-related statistics come from the rtctransportstats dictionary's properties. ...
RTCIceCandidatePairStats.writable - Web APIs
the obsolete rtcicecandidatepairstats property writable reports whether or not the connection described by the candidate pair is writable. syntax iswritable = rtcicecandidatepairstats.writable; value a boolean value which is true if the connection described by this candidate pair has received acknowledgement of receipt (ack) for at least one ice request and that stun consent hasn't expired. note: this property was removed from the specification in early 2017 because you can determine whether or not an incoming ice request is available to read by checking to see if responsesreceived is greater than 0 and that the time specified by consentexpiredtimestamp has not passed: if (icpstats.responsesreceived > 0 && icpstats.consentexpiredtimestamp < performance.now()) { /* at least one i...
RTCIceCandidateStats.address - Web APIs
ats dictionary indicates the address of the ice candidate. while it's preferred that the address be specified as an ipv4 or ipv6 numeric address, a fully-qualified domain name can be used as well. when a domain name is specified, the first ip address selected for that address is used, even if the domain name maps to multiple ip addresses. syntax candidateaddress = rtcicecandidatestats.address; value either an ipv4 or ipv6 address or a fully-qualified domain name, which corresponds to the candidate. if the value of address is comprised entirely of digits from 0-9 with periods as separators, the value is interpreted as an ipv4 address. if the value is entirely comprised of hexadecimal digits and colon (":") characters, it is interpreted as an ipv6 address. otherwise, the address is pres...
RTCIceCandidateStats.candidateType - Web APIs
the rtcicecandidatestats interface's candidatetype property is a string which indicates the type of ice candidate the object represents. syntax candidatetype = rtcicecandidatestats.candidatetype; value a domstring whose value is one of the strings found in the rtcicecandidatetype enumerated type:host the candidate is a host candidate, whose ip address as specified in the rtcicecandidate.ip property is in fact the true address of the remote peer. srflx the candidate is a server reflexive candidate; the ip indicates an intermediary address assigned by the stun server to represent the candidate's peer anonymously. prflx the candidate is a peer reflexive candidate; the ip is an intermediary address assigned by the stun server to represent the candidate's peer anonymously. relay the can...
RTCIceCandidateStats.port - Web APIs
the rtcicecandidatestats dictionary's port property specifies the network port used by the candidate. syntax candidateport = rtcicecandidatestats.port; value an integer value indicating the network port used by the rtcicecandidate described by the rtcicecandidatestats object. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatestats.port' in that specification. candidate recommendation initial specification. ...
RTCIceCandidateStats.relayProtocol - Web APIs
the rtcicecandidatestats dictionary's relayprotocol property specifies the protocol being used by a local ice candidate to communicate with the turn server. the ice protocl being used by the candidate otherwise can be obtained from the protocol property. syntax relayprotocol = rtcicecandidatestats.relayprotocol; value a domstring identifying the protocol being used by the endpoint to communicate with the turn server. the possible values are: tcp tcp (transport control protocol) is being used to communicate with the turn server. tls tls (transport layer security) is being used to communicate with the turn server. udp udp (user datagram protocol) is being used to communicate with the turn server. note: this property is only present on rtcicecandidatestats objects that represent l...
RTCIceCandidateStats.transportId - Web APIs
the rtcicecandidatestats dictionary's transportid property is a string that uniquely identifies the transport that produced the rtctransportstats from which information about this candidate was taken. syntax transportid = rtcicecandidatestats.transportid; value a domstring whose value uniquely identifies the transport from which any transport-related information accumulated in the rtcicecandidatestats was taken. this can be used to compare candidates that would use the same transport, for example. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatestats.transportid' in that specification. candidate recommendation initial specification. ...
RTCIceCandidateStats.url - Web APIs
this is the same url that would be received in the icecandidate event's url property. note: this property does not exist for remote candidates. ...
RTCIceCandidateType - Web APIs
host the candidate is a host candidate, whose ip address as specified in the rtcicecandidate.ip property is in fact the true address of the remote peer. srflx the candidate is a server reflexive candidate; the ip indicates an intermediary address assigned by the stun server to represent the candidate's peer anonymously. ...
RTCIceComponent - Web APIs
the webrtc api's rtcicecomponent enumerated type contains domstring values that each identify a specific ice component; these are "rtp" and "rtcp". these strings are mapped to corresponding numeric values as they appear in the candidate a-line in sdp. values "rtp" identifies an ice transport which is being used for the real-time transport protocol (rtp), or for rtp multiplexed with the rtp control protocol (rtcp). rtp is defined in rfc 3550. an rtcicecomponent of this value corresponds to the component id field in the candidate a-line with the value 1. "rtcp" identifies an ice transport being used for rtcp, which is defined in rfc 3550, section 6. this value of rtcicecomponent corresponds to the component id 2. usage notes the rtcicecomponent type is used by the component property of...
RTCIceCredentialType - Web APIs
the webrtc api's rtcicecredentialtype enumerated string type defines the authentication method used to gain access to an ice server identified by an rtciceserver object. values oauth the rtciceserver requires the use of oauth 2.0 to authenticate in order to use the ice server described. this process is detailed in rfc 7635. this property was formerly called token. password the rtciceserver requires a username and password to authenticate prior to using the described ice server. obsolete values the following values are no longer part of the webrtc specification, but were in the past. token authenticating with the ice server requires the use of an oauth 2.0 token as defined in rfc 7635. this value has been renamed to oauth. specifications specification status comm...
RTCIceGathererState - Web APIs
"gathering" the transport is in the process of gathering candidates. "complete" the transport has finished gathering ice candidates and has sent the end-of-candidates indicator to the remote device. the transport won't gather any further candidates unless an ice restart occurs, at which point the gathering process starts over from scratch. ...
RTCIceParameters.password - Web APIs
the rtciceparameters dictionary's password property specifies the ice password that, in tandem with the usernamefragment, uniquely identifies an ice session for its entire duration. syntax password = rtciceparameters.password; value a domstring containing the password that corresponds to the transport's usernamefragment string specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtciceparameters.password' in that specification. candidate recommendation initial specification. ...
RTCIceParameters.usernameFragment - Web APIs
the string may be up to 256 characters long. ...
RTCIceParameters - Web APIs
y specifies the username fragment and password assigned to an ice session. during ice negotiation, each peer's username fragment and password are recorded in an rtciceparameters object, which can be obtained from the rtcicetransport by calling its getlocalparameters() or getremoteparameters() method, depending on which end interests you. properties usernamefragment a domstring specifying the value of the ice session's username fragment field, ufrag. password a domstring specifying the session's password string. usage notes the username fragment and password uniquely identify the remote peer for the duration of the ice session, and are used to both ensure security and to avoid crosstalk across multiple ongoing ice sessions. see rtcicecandidate.usernamefragment for further information. ...
RTCIceProtocol - Web APIs
the tcptype property provides additional information about the kind of tcp candidate represented by the object. udp the candidate will use the udp transport protocol for its data. this is the preferred protocol for media interactions because of its better performance profile. usage notes the rtciceprotocol type is used by the protocol property of rtcicecandidate objects. ...
RTCIceServer.credential - Web APIs
syntax var iceserver = { ... credential = credential, ... }; var credential = iceserver.credential; iceserver.credential = newcredential; example this example creates a new rtcpeerconnection which uses a turn server at turnserver.example.org to negotiate connections. ...
RTCIceServer.url - Web APIs
Web › API › RTCIceServer › url
hould no longer be used. you should instead use the newer urls property, which allows you to optionally specify multiple urls for the server. try to update any existing code to use that property instead. syntax var iceserver = { ... url = iceserverurl, ... }; var serverurl = iceserver.url; iceserver.url = iceserverurl; the value of this property is a domstring containing the full url of a server to use during ice negotiation. example this example creates a new rtcpeerconnection which will use a stun server at stunserver.example.org to negotiate connections. mypeerconnection = new rtcpeerconnection({ iceservers: [ { url: "stun:stunserver.example.org" } ] }); unfortunately, the only way to tell ice th...
RTCIceServers.urls - Web APIs
Web › API › RTCIceServer › urls
rver dictionary's urls property specifies the url or urls of the servers to be used for ice negotiations. these are typically stun and/or turn servers. syntax var iceserver = { urls = iceserverurl | [ url1, ..., urln ], username: "webrtc", // optional credential: "turnpassword" // optional }; iceservers.push(iceserver); the value of this property may be specified as a single url or as an array of multiple urls. examples let's look a few examples of varying complexity. a single ice server this example creates a new rtcpeerconnection which will use a stun server at stunserver.example.org to negotiate connections. mypeerconnection = new rtcpeerconnection({ iceservers: [ { urls: "stun:stunserver.example.org" ...
RTCIceServer.username - Web APIs
syntax var iceserver = { ... username = username, ... }; var username = iceserver.username; iceserver.username = newusername; example this example creates a new rtcpeerconnection which will use a turn server at turnserver.example.org to negotiate connections. ...
RTCIceServer - Web APIs
in the configuration of an rtcpeerconnection, in the iceservers array. properties credential optional the credential to use when logging into the server. this is only used if the rtciceserver represents a turn server. credentialtype optional if the rtciceserver represents a turn server, this attribute specifies what kind of credential is to be used when connecting. this must be one of the values defined by the rtcicecredentialtype enum. the default is password. urls this required property is either a single domstring or an array of domstrings, each specifying a url which can be used to connect to the server. username optional if the rtciceserver is a turn server, then this is the username to use during the authentication process. avoid specifying an unnecessarily large number of u...
RTCIceTcpCandidateType - Web APIs
"passive" the transport will receive incoming connection requests but won't try to open an outbound connection. "so" the transport will try to open a connection simultaneously with its peer. usage notes the rtcicetcpcandidatetype type is used by the tcptype property of rtcicecandidate objects. ...
RTCIceTransport.component - Web APIs
the read-only rtcicetransport property component specifies whether the object is serving to transport rtp or rtcp. the value is one of the strings in rtcicecomponent. syntax icecomponent = rtcicetransport.component; value a domstring whose value comes from the enumerated type rtcicecomponent: "rtp" identifies an ice transport which is being used for the real-time transport protocol (rtp), or for rtp multiplexed with the rtp control protocol (rtcp). rtp is defined in rfc 3550. an rtcicecomponent of this value corresponds to the component id field in the candidate a-line with the value 1. "rtcp" identifies an ice transport being used for rtcp, which is defined in rfc 3550, section 6. this value of rtcicecomponent corresponds to the component id 2. specifications specificat...
RTCIceTransport.gatheringState - Web APIs
the read-only rtcicetransport property gatheringstate returns a domstring from the enumerated type rtcicegathererstate that indicates what gathering state the ice agent is currently in: "new", "gathering", or "complete". syntax gatherstate = rtcicetransport.gatheringstate; value a string from the rtcicegathererstate enumerated type whose value indicates the current state of the ice agent's candidate gathering process: "new" the rtcicetransport is newly created and has not yet started to gather ice candidates. "gathering" the transport is in the process of gathering candidates. "complete" the transport has finished gathering ice candidates and has sent the end-of-candidates indicator to the remote device. the transport won't gather any further candidates unless an ice restart occurs...
RTCIceTransport.getLocalCandidates() - Web APIs
h of the candidates that have been gathered by the local device during the current ice agent session. the local candidates are placed in this list by the ice agent prior to being delivered to the local client's code in an icecandidate event so that the client can forward the candidates to the remote peer. syntax localcandidates = rtcicetransport.getlocalcandidates(); parameters none. return value a javascript array containing one rtcicecandidate object for each candidate that has been identified so far during the ice candidate gathering session. you can't correlate these local candidates with matching remote candidates. to find the best match found so far, call rtcicetransport.getselectedcandidatepair(). example this simple example gets the local candidate list from the rtcicetranspor...
RTCIceTransport.getLocalParameters() - Web APIs
getlocalparameters() returns an rtciceparameters object which provides information uniquely identifying the local peer for the duration of the ice session. the local peer's parameters are obtained during ice signaling and delivered to the transport when the client calls rtcpeerconnection.setlocaldescription(). syntax parameters = rtcicetransport.getlocalparameters(); parameters none. return value an rtciceparameters object indicating the usernamefragment and password which uniquely identify the local peer for the duration of the ice session. returns null if the parameters have not yet been received. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicetransport.getlocalparameters' in that s...
RTCIceTransport.getRemoteCandidates() - Web APIs
for each of the candidates that have been received from the remote peer so far during the current ice gathering session. each time your signaling code calls rtcpeerconnection.addicecandidate() to add a received candidate to the ice session, the ice agent places it in the list returned by this function. syntax remotecandidates = rtcicetransport.getremotecandidates(); parameters none. return value an array containing one rtcicecandidate object for each candidate that has been received so far from the remote peer during the current ice candidate gathering session. it's important to keep in mind that there's no way to correlate these remote candidates with compatible local candidates. to find the best match found so far, call rtcicetransport.getselectedcandidatepair(). example this simpl...
RTCIceTransport.getRemoteParameters() - Web APIs
moteparameters() returns an rtciceparameters object which provides information uniquely identifying the remote peer for the duration of the ice session. the remote peer's parameters are received during ice signaling and delivered to the transport when the client calls rtcpeerconnection.setremotedescription(). syntax parameters = rtcicetransport.getremoteparameters(); parameters none. return value an rtciceparameters object indicating the usernamefragment and password which uniquely identify the remote peer for the duration of the ice session. returns null if the parameters haven't been received yet. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicetransport.getremoteparameters' in that ...
RTCIceTransport.getSelectedCandidatePair() - Web APIs
the rtcicetransport method getselectedcandidatepair() returns an rtcicecandidatepair object containing the current best-choice pair of ice candidates describing the configuration of the endpoints of the transport. syntax candidatepair = rtcicetransport.getselectedcandidatepair(); parameters none. return value a rtcicecandidatepair object describing the configurations of the currently-selected candidate pair's two endpoints. local describes the configuration of the local end of the connection, while remote describes the remote peer's configuration. the return value is null if no pair of candidates has been selected yet. usage notes as the ice agent performs negotiation of a rtcpeerconnection, it gathers and analyzes candidate configurations from each the two peers. as soon as it finds...
RTCIceTransport.ongatheringstatechange - Web APIs
the ongatheringstatechange event handler for the rtcicetransport interface specifies an event handler that is to be called when the gatheringstatechange event occurs on the transport. this event is delivered whenever the transport's gatheringstate property changes. syntax rtcicetransport.ongatheringstatechange = statechangehandler; value a function to be called when the rtcicetransport object's gathering state changes. to determine the new state, examine the value of gatheringstate. the gathering state indicates whether or not the ice agent has begun gathering candidates, and if so, whether or not gathering has finished. its possible values are: "new" the rtcicetransport is newly created and has not yet started to gather ice candidates. "gathering" the transport is in the process o...
RTCIceTransport.onselectedcandidatepairchange - Web APIs
the rtcicetransport interface's onselectedcandidatepairchange event handler specifies a function to be called to handle the selectedcandidatepairchange event, which is fired when the ice agent selects a new candidate pair to be used for the connection. syntax rtcicetransport.onselectedcandidatepairchange = candidatepairhandler; value this propoerty should be set to reference an event handler function to be called by the ice agent when it discovers a new candidate pair that the rtcicetransport will be using for communication with the remote peer. this event will occur at least once, and may occur more than once if the ice agent continues to identify candidate pairs that will work better, more closely match the requested parameters, and so forth. the event handler can determine the current...
RTCIceTransport.onstatechange - Web APIs
the onstatechange event handler for the rtcicetransport interface is a property which specifies a function to serve as the eventhandler for the statechange event that is fired whenever the transport's state changes. syntax rtcicetransport.onstatechange = statechangehandler; value set this property to reference a function you provide that is called by the webrtc layer when the rtcicetransport object's state changes. the event handler receives as its sole input an event object describing the statechange event which occurred. to determine the new state, examine the value of state. example this snippet establishes a handler for the statechange event that looks to see if the transport has entered the "failed" state, which indicates that the connection has failed with no chance of being auto...
RTCIceTransport.role - Web APIs
the read-only rtcicetransport property role indicates which ice role the transport is fulfilling: that of the controlling agent, or the agent that is being controlled. you can learn more about ice roles in choosing a candidate pair in webrtc connectivity. syntax icerole = rtcicetransport.role; value a domstring specifying whether the rtcicetransport represents the controlling agent or the controlled agent. the value must be one of those found in the enumerated type rtcicerole: "controlling" the rtcicetransport object is serving as the controlling agent. "controlled" the transport is the controlled agent. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicetransport.role' in that specific...
RTCInboundRtpStreamStats.bytesReceived - Web APIs
the rtcinboundrtpstreamstats dictionary's bytesreceived property is an integer value which indicates the total number of bytes received so far from this synchronization source (ssrc). syntax var bytesreceived = rtcinboundrtpstreamstats.bytesreceived; value an unsigned integer value indicating the total number of bytes received so far on this rtp stream, not including header and padding bytes. this value can be used to calculate an approximation of the average media data rate: avgdatarate = rtcinboundrtpstreamstats.bytesreceived / elapsedtime; this value gets reset to zero if the sender's ssrc identifier changes for any reason. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcinboundrtpstreamstats.bytesrecei...
RTCInboundRtpStreamStats.fecPacketsDiscarded - Web APIs
the fecpacketsdiscarded property of the rtcinboundrtpstreamstats dictionary is a numeric value indicating the number of rtp forward error correction (fec) packets that have been discarded. syntax var fecpacketsdiscarded = rtcinboundrtpstreamstats.fecpacketsdiscarded; value an unsigned integer value indicating how many fec packets have been received whose error correction payload has been discarded. this can happen if all the packets covered by the fec packet have already been received or recovered using another fec packet, or if the fec packet arrived outside the recovery window and the lost rtp packets have already been skipped during playback as a result. the value of fecpacketsreceived includes these discarded packets. specifications specification status comment ...
RTCInboundRtpStreamStats.firCount - Web APIs
the fircount property of the rtcinboundrtpstreamstats dictionary indicates the number of full intra request (fir) packets have been sent by the receiver to the sender. the receiver sends a fir packet when the stream falls behind and needs to skip frames in order to catch up. syntax var fircount = rtcinboundrtpstreamstats.fircount; value an integer value indicating how many fir packets have been received by the sender during the current connection. this statistic is available only for video tracks. the receiver sends a fir packet to the sender any time it falls bahind or loses packets and cannot decode the incoming stream any longer because of the lost data. this tells the sender to send a full frame instead of a delta frame, so that the receiver can catch up. the higher fircount is, the ...
RTCInboundRtpStreamStats.lastPacketReceivedTimestamp - Web APIs
the lastpacketreceivedtimestamp property of the rtcinboundrtpstreamstats dictionary indicates the time at which the most recently received packet arrived from this source. syntax var lastpackettimestamp = rtcinboundrtpstreamstats.lastpacketreceivedtimestamp; value a domhighrestimestamp which specifies the time at which the most recently received packet arrived on this rtp stream. note: this value differs from the timestamp, which represents the time at which the statistics object was created. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcinboundrtpstreamstats.lastpacketreceivedtimestamp' in that specification. candidate recommendation initial definition. ...
RTCInboundRtpStreamStats.nackCount - Web APIs
the nackcount property of the rtcinboundrtpstreamstats dictionary is a numeric value indicating the number of times the receiver sent a nack packet to the sender. a nack (negative acknowledgement, also called "generic nack") packet tells the sender that one or more of the rtp packets it sent were lost in transport. syntax var nackcount = rtcinboundrtpstreamstats.nackcount; value an integer value indicating how many times the receiver sent a nack packet to the sender after detecting that one or more packets were lost during transport. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcinboundrtpstreamstats.nackcount' in that specification. candidate recommendation initial definition. ...
RTCInboundRtpStreamStats.packetsFailedDecryption - Web APIs
the packetsfaileddecryption property of the rtcinboundrtpstreamstats dictionary indicates the total number of rtp packets which failed to be decrypted successfully after being received by the local end of the connection during this session. syntax var packetsfaileddecryption = rtcinboundrtpstreamstats.packetsfaileddecryption; value an integer value which indicates how many packets the local end of the rtp connection could not be successfully decrypted. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcinboundrtpstreamstats.packetsfaileddecryption' in that specification. candidate recommendation initial definition. ...
RTCInboundRtpStreamStats.pliCount - Web APIs
the plicount property of the rtcinboundrtpstreamstats dictionary states the number of times the rtcrtpreceiver described by these statistics sent a picture loss indication (pli) packet to the sender. a pli packet indicates that some amount of encoded video data has been lost for one or more frames. syntax var plicount = rtcinboundrtpstreamstats.plicount; value an integer value indicating the number of times a pli packet was sent by the rtcrtpreceiver to the sender. these are sent by the receiver's decoder to notify the encoder (the sender) that an undefined amount of coded video data, which may span frame boundaries, has been lost. this information is only available for video streams. this may trigger the sender to send a full frame in order to allow the receiver to re-synchronize, since ...
RTCInboundRtpStreamStats.receiverId - Web APIs
the receiverid property of the rtcinboundrtpstreamstats dictionary specifies the id of the rtcaudioreceiverstats or rtcvideoreceiverstats object representing the rtcrtpreceiver receiving the stream. syntax var receiverstatsid = rtcinboundrtpstreamstats.receiverid; value a domstring which contains the id of the rtcaudioreceiverstats or rtcvideoreceiverstats object which provides information about the rtcrtpreceiver which is receiving the streamed media. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcinboundrtpstreamstats.receiverid' in that specification. candidate recommendation initial definition. ...
RTCInboundRtpStreamStats.remoteId - Web APIs
the remoteid property of the rtcinboundrtpstreamstats dictionary specifies the id of the rtcremoteoutboundrtpstreamstats object representing the remote peer's rtcrtpsender which is sending the media to the local peer. syntax var remotestatsid = rtcinboundrtpstreamstats.remoteid; value a domstring containing the id of the rtcremoteoutboundrtpstreamstats object that represents the remote peer's rtcrtpsender for the synchronization source represented by this stats object. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcinboundrtpstreamstats.remoteid' in that specification. candidate recommendation initial definition. ...
RTCInboundRtpStreamStats.sliCount - Web APIs
a decoder to let the encoder know that it's detected corruption of one or more consecutive macroblocks (in scan order) in the received media. in general, what's usually of interest is that the higher this number is, the more the stream data is becoming corrupted between the sender and the receiver, requiring resends or dropping frames. syntax var slicount = rtcinboundrtpstreamstats.slicount; value an unsigned integer indicating the number of sli packets this receiver sent to the remote sender due to lost runs of macroblocks. a high value of slicount may be an indication of an unreliable network. this is a very technical part of how video codecs work. for details, see rfc 4585: 6.3.2. note: this value is only present for video media. specifications specification status ...
RTCInboundRtpStreamStats.trackId - Web APIs
the trackid property of the rtcinboundrtpstreamstats dictionary indicates the id of the rtcreceiveraudiotrackattachmentstats or rtcreceivervideotrackattachmentstats object representing the mediastreamtrack which is receiving the incoming media. syntax var trackstatsid = rtcinboundrtpstreamstats.trackid; value a domstring containing the id of the rtcreceiveraudiotrackattachmentstats or rtcreceivervideotrackattachmentstats object representing the track which is receiving the media from this rtp session. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcinboundrtpstreamstats.trackid' in that specification. candidate recommendation initial definition. ...
RTCOfferAnswerOptions - Web APIs
tcofferansweroptions as the base type for their options parameter's dictionary. createoffer() uses rtcofferoptions and createanswer() uses rtcansweroptions. properties voiceactivitydetection optional for configurations of systems and codecs that are able to detect when the user is speaking and toggle muting on and off automatically, this option enables and disables that behavior. the default value is true, enabling this functionality specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcofferansweroptions' in that specification. candidate recommendation initial definition. ...
RTCOfferOptions - Web APIs
the rtcofferoptions dictionary is used to provide optional settings when creating an rtcpeerconnection offer with the createoffer() method. properties this dictionary also inherits properties from the rtcofferansweroptions dictionary, on which it's based. icerestart optional a boolean which, when set to true, tells createoffer() to generate and use new values for the identifying properties of the sdp it creates, resulting in a request that triggers renegotiation of the ice connection. this is useful if network conditions have changed in a way that make the current configuration untenable or impractical, for instance. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcofferoptions' in that specif...
RTCOutboundRtpStreamStats.firCount - Web APIs
y indicates the number of full intra request (fir) that the remote rtcrtpreceiver has sent to this rtcrtpsender. a fir packet is sent when the receiver finds that it has fallen behind and needs to skip frames in order to catch up; the sender should respond by sending a full frame instead of a delta frame. available only on video media. syntax var fircount = rtcoutboundrtpstreamstats.fircount; value an integer value indicating how many fir packets have been received by the sender during the current connection. this statistic is available only for video tracks. the receiver sends a fir packet to the sender any time it falls bahind or loses packets and cannot decode the incoming stream any longer because of the lost data. this tells the sender to send a full frame instead of a delta frame, s...
RTCOutboundRtpStreamStats.lastPacketSentTimestamp - Web APIs
the lastpacketsenttimestamp property of the rtcoutboundrtpstreamstats dictionary indicates the time at which the rtcrtpsender described by this rtcoutboundrtpstreamstats object last transmitted a packet to the remote receiver. syntax var lastpackettimestamp = rtcoutboundrtpstreamstats.lastpacketsenttimestamp; value a domhighrestimestamp which specifies the time at which the most recently received packet arrived on this rtp stream. note: this value differs from the timestamp, which represents the time at which the statistics object was created. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcoutboundrtpstreamstats.lastpacketsenttimestamp' in that specification. candidate recommendation initial defini...
RTCOutboundRtpStreamStats.nackCount - Web APIs
the nackcount property of the rtcoutboundrtpstreamstats dictionary is a numeric value indicating the number of times the rtcrtpsender described by this object received a nack packet from the remote receiver. a nack (negative acknowledgement, also called "generic nack") packet is used by the rtcrtpreceiver to inform the sender that one or more rtp packets it sent were lost in transport. syntax var nackcount = rtcoutboundrtpstreamstats.nackcount; value an integer value indicating how many times the sender received a nack packet from the receiver, indicating the loss of one or more packets. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcoutboundrtpstreamstats.nackcount' in that specification. candidate reco...
RTCOutboundRtpStreamStats.perDscpPacketsSent - Web APIs
the perdscppacketssent property of the rtcoutboundrtpstreamstats dictionary is a record comprised of key/value pairs in which each key is a string representation of a differentiated services code point and the value is the number of packets sent for that dcsp. note: not all operating systems make data available on a per-dscp basis, so this property shouldn't be relied upon on those systems. syntax var perdscppacketssent = rtcoutboundrtpstreamstats.perdscppacketssent; value a record comprised of string/value pairs. each key is the string representation of a single differentiated services code point (dscp)'s id number. note: due to network bleaching and remapping, the numbers seen on this record are not necessarily going to match the values as they were when the data was sent. specifi...
RTCOutboundRtpStreamStats.pliCount - Web APIs
the plicount property of the rtcoutboundrtpstreamstats dictionary states the number of times the remote peer's rtcrtpreceiver sent a picture loss indication (pli) packet to the rtcrtpsender for which this object provides statistics. a pli packet indicates that some amount of encoded video data has been lost for one or more frames. syntax var plicount = rtcoutboundrtpstreamstats.plicount; value an integer value indicating the number of times a pli packet was sent to this sender by the remote peer's rtcrtpreceiver. these are sent by the receiver's decoder to notify the sender's encoder that an undefined amount of coded video data, which may span frame boundaries, has been lost. note: this property is only used for video streams. usage notes upon receiving a pli packet, the sender may ha...
RTCOutboundRtpStreamStats.qualityLimitationReason - Web APIs
eduction is being performed. this quality reduction may include changes such as reduced frame rate or resolution, or an increase in compression factor. the amount of time the encoded media has had its quality reduced in each of the potential ways that can be done can be found in qualitylimitationdurations. syntax var qualitylimitationreason = rtcoutboundrtpstreamstats.qualitylimitationreason; value a map whose keys are domstrings whose values come from the rtcqualitylimitationreason enumerated type, and whose values are the duration of the media, in seconds, whose quality was reduced for that reason. examples specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcoutboundrtpstreamstats.qualitylimitationreason...
RTCOutboundRtpStreamStats.remoteId - Web APIs
the remoteid property of the rtcoutboundrtpstreamstats dictionary specifies the id of the rtcremoteinboundrtpstreamstats object representing the remote peer's rtcrtpreceiver which is sending the media to the local peer for this ssrc. syntax var remotestatsid = rtcoutboundrtpstreamstats.remoteid; value a domstring containing the id of the rtcremoteinboundrtpstreamstats object that represents the remote peer's rtcrtpreceiver for the synchronization source represented by this stats object. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcoutboundrtpstreamstats.remoteid' in that specification. candidate recommendation initial definition. ...
RTCOutboundRtpStreamStats.sliCount - Web APIs
w that it's detected corruption of one or more consecutive macroblocks, in scan order, in the received media.in general, what's usually of interest is that the higher this number is, the more the stream data is becoming corrupted between the sender and the receiver, causing the receiver to request retransmits or to drop frames entirely. syntax var slicount = rtcoutboundrtpstreamstats.slicount; value an unsigned integer indicating the number of sli packets the sender received from the receiver due to lost runs of macroblocks. a high value of slicount may be an indication of an unreliable network. this is a very technical part of how video codecs work. for details, see rfc 4585: 6.3.2. note: this value is only present for video media. specifications specification status c...
RTCOutboundRtpStreamStats.trackId - Web APIs
the trackid property of the rtcoutboundrtpstreamstats dictionary indicates the id of the rtcsenderaudiotrackattachmentstats or rtcsendervideotrackattachmentstats object representing the mediastreamtrack which is being sent on this stream. syntax var trackstatsid = rtcoutboundrtpstreamstats.trackid; value a domstring containing the id of the rtcsenderaudiotrackattachmentstats or rtcsendervideotrackattachmentstats object representing the track which is the source of the media being sent on this stream. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcoutboundrtpstreamstats.trackid' in that specification. candidate recommendation initial definition. ...
RTCPeerConnection.addStream() - Web APIs
e is set to closed, an invalidstateerror is raised. if the signalingstate is set to stable, the event negotiationneeded is sent on the rtcpeerconnection to indicate that ice negotiation must be repeated to consider the new stream. syntax rtcpeerconnection.addstream(mediastream); parameters mediastream a mediastream object indicating the stream to add to the webrtc peer connection. return value none. example this simple example adds the audio and video stream coming from the user's camera to the connection. navigator.mediadevices.getusermedia({video:true, audio:true}, function(stream) { var pc = new rtcpeerconnection(); pc.addstream(stream); }); migrating to addtrack() compatibility allowing, you should update your code to instead use the addtrack() method: navigator.getuserm...
RTCPeerConnection.addTransceiver() - Web APIs
iver(trackorkind, init); parameters trackorkind a mediastreamtrack to associate with the transceiver, or a domstring which is used as the kind of the receiver's track, and by extension of the rtcrtpreceiver itself. init optional an object that conforms to the rtcrtptransceiverinit dictionary which provides any options that you may wish to specify when creating the new transceiver. possible values are: direction optional the new transceiver's preferred directionality. this value is used to initialize the new rtcrtptransceiver object's rtcrtptransceiver.direction property. sendencodings optional a list of encodings to allow when sending rtp media from the rtcrtpsender. each entry is of type rtcrtpencodingparameters. streams optional a list of mediastream objects to add to the transc...
RTCPeerConnection: datachannel event - Web APIs
athering the information needed to communicate with the newly added rtcdatachannel and by adding event handlers for the events that occur on that channel. pc.addeventlistener("datachannel", ev => { receivechannel = ev.channel; receivechannel.onmessage = myhandlemessage; receivechannel.onopen = myhandleopen; receivechannel.onclose = myhandleclose; }, false); receivechannel is set to the value of the event's channel property, which specifies the rtcdatachannel object representing the data channel linking the remote peer to the local one. this same code can also instead use the rtcpeerconnection interface's ondatachannel event handler property, like this: pc.ondatachannel = ev => { receivechannel = ev.channel; receivechannel.onmessage = myhandlemessage; receivechannel.onopen = m...
RTCPeerConnection.generateCertificate() - Web APIs
ate key then returns an rtccertificate, providing access to it. syntax var cert = rtcpeerconnection.generatecertificate(keygenalgorithm) parameters keygenalgorithm 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', moduluslength: 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 commu...
RTCPeerConnection.getDefaultIceServers() - Web APIs
tcpeerconnection interface returns an array of objects based on the rtciceserver dictionary, which indicates what, if any, ice servers the browser will use by default if none are provided to the rtcpeerconnection in its rtcconfiguration. however, browsers are not required to provide any default ice servers at all. syntax var defaulticeservers = rtcpeerconnection.getdefaulticeservers(); return value an array of ice servers, specified as objects based on rtciceserver, which the browser will use if none are specified in the configuration of the rtcpeerconnection. if there are no defaults provided by the browser, the returned array is empty; this property's value is never null. example var pc = new rtcpeerconnection(); var iceservers = pc.getdefaulticeservers(); if (iceservers.length === 0)...
RTCPeerConnection.getIdentityAssertion() - Web APIs
only if the signalingstate is not "closed". the method returns immediately. if the assertion cannot be generated, an idpassertionerror will be sent to the object. it is not expected for the application dealing with the rtcpeerconnection: this is automatically done; an explicit call only allows to anticipate the need. syntax pc.getidentityassertion(); there is neither parameter nor return value for this method. example var pc = new peerconnection(); pc.getidentityassertion(); // not mandatory, but we know that we will need it in the future. specifications specification status comment identity for webrtcthe definition of 'rtcpeerconnection.getidentityassertion()' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection.getReceivers() - Web APIs
the array is empty if there are no rtp receivers on the connection. ...
RTCPeerConnection.getSenders() - Web APIs
the rtcpeerconnection method getsenders() returns an array of rtcrtpsender objects, each of which represents the rtp sender responsible for transmitting one track's data. a sender object provides methods and properties for examining and controlling the encoding and transmission of the track's data. syntax var senders = rtcpeerconnection.getsenders(); return value an array of rtcrtpsender objects, one for each track on the connection. the array is empty if there are no rtp senders on the connection. the order of the returned rtcrtpsenders is not defined by the specification, and may change from one call to getsenders() to the next. example in this example, a setmuting() function is shown. this function takes as input an rtcpeerconnection, pc, and a boolean, muting. the function gets the...
RTCPeerConnection.getTransceivers() - Web APIs
the list is in the order in which the transceivers were added to the connection. ...
RTCPeerConnection.iceConnectionState - Web APIs
the read-only property rtcpeerconnection.iceconnectionstate returns an enum of type rtciceconnectionstate which state of the ice agent associated with the rtcpeerconnection. you can detect when this value has changed by watching for the iceconnectionstatechange event. syntax var state = rtcpeerconnection.iceconnectionstate; value the current state of the ice agent and its connection. the value is one of the strings in the rtciceconnectionstate enum. rtciceconnectionstate enum the rtciceconnectionstate enum defines the string constants used to describe the current state of the ice agent and its connection to the ice server (that is, the stun or turn server). constant description "new" the ice agent is gathering addresses or is waiting to be given remote cand...
RTCPeerConnection: iceconnectionstatechange event - Web APIs
perty is an empty string (""), or by setting the rtcpeerconnection property cantrickleicecandidates to false. examples an event handler for this event can be added using the rtcpeerconnection.oniceconnectionstatechange property or by using addeventlistener() on the rtcpeerconnection. in this example, a handler for iceconnectionstatechange is set up to update a call state indicator by using the value of iceconnectionstate to create a string which corresponds to the name of a css class that we can assign to the status indicator to cause it to reflect the current state of the connection. pc.addeventlistener("iceconnectionstatechange", ev => { let stateelem = document.queryselector("#call-state"); stateelem.classname = `${pc.iceconnectionstate}-state`; }, false); this can also be written ...
RTCPeerConnection.iceGatheringState - Web APIs
the read-only property rtcpeerconnection.icegatheringstate returns an enum of type rtcicegatheringstate that describes connection's ice gathering state. this lets you detect, for example, when collection of ice candidates has finished. you can detect when the value of this property changes by watching for an event of type icegatheringstatechange. syntax var state = rtcpeerconnection.icegatheringstate; value the possible values are those of an enum of type rtcicegatheringstate. rtcicegatheringstate enum the rtcicegatheringstate enum defines string constants which reflect the current status of ice gathering, as returned using the rtcpeerconnection.icegatheringstate property. you can detect when this value changes by watching for an event of type icegatheringstatechange. const...
RTCPeerConnection.localDescription - Web APIs
the read-only property rtcpeerconnection.localdescription returns an rtcsessiondescription describing the session for the local end of the connection. if it has not yet been set, this is null. syntax var sessiondescription = peerconnection.localdescription; on a more fundamental level, the returned value is the value of rtcpeerconnection.pendinglocaldescription if that property isn't null; otherwise, the value of rtcpeerconnection.currentlocaldescription is returned. see pending and current descriptions in webrtc connectivity for details on this algorithm and why it's used. example this example looks at the localdescription and displays an alert containing the rtcsessiondescription object's type and sdp fields. var pc = new rtcpeerconnection(); … var sd = pc.localdescription; if (sd...
RTCPeerConnection.onaddstream - Web APIs
cription() and doesn't wait for the result of the sdp negotiation. important: this property has been removed from the specification; you should now use rtcpeerconnection.ontrack to watch for track events instead. it is included here in order to help you adapt existing code and understand existing samples, which may not be up-to-date yet. syntax rtcpeerconnection.onaddstream = eventhandler; value a function which handles addstream events. these events, of type mediastreamevent, are sent when streams are added to the connection by the remote peer. the first time an event occurs may be nearly immediately after the remote end of the connection is set using rtcpeerconnection.setremotedescription(); it doesn't wait for a particular stream to be accepted or rejected using sdp negotiation. exa...
RTCPeerConnection.onconnectionstatechange - Web APIs
specifies an eventhandler which is called to handle the connectionstatechange event when it occurs on an instance of rtcpeerconnection. this happens whenever the aggregate state of the connection changes. the aggregate state is a combination of the states of all of the individual network transports being used by the connection. syntax rtcpeerconnection.onconnectionstatechange = eventhandler; value a function which is called by the browser when the connectionstatechange event occurs on the rtcpeerconnection. the function receives as input a single parameter, which is an object of type event. the event object contains no special information of note; you can look at the value of the peer connection's connectionstate property to determine what the new state is. example pc.onconnectionstatec...
RTCPeerConnection.ondatachannel - Web APIs
ction. this event, of type rtcdatachannelevent, is sent when an rtcdatachannel is added to the connection by the remote peer calling createdatachannel(). at the time this event is received, the rtcdatachannel it indicates may not yet actually be open. be sure to wait for the "open" event to be fired on the new rtcdatachannel before using it. syntax rtcpeerconnection.ondatachannel = function; value set this property to be a function you provide which receives as input a single parameter: an rtcdatachannelevent which provides in its channel property the rtcdatachannel which has been created. example pc.ondatachannel = function(ev) { console.log('data channel is created!'); ev.channel.onopen = function() { console.log('data channel is open and ready to be used.'); }; }; specifi...
RTCPeerConnection.onicecandidate - Web APIs
to the other peer through the signaling server. this lets the ice agent perform negotiation with the remote peer without the browser itself needing to know any specifics about the technology being used for signaling; simply implement this method to use whatever messaging technology you choose to send the ice candidate to the remote peer. syntax rtcpeerconnection.onicecandidate = eventhandler; value this should be set to a function which you provide that accepts as input an rtcpeerconnectioniceevent object representing the icecandidate event. the function should deliver the ice candidate, whose sdp can be found in the event's candidate property, to the remote peer through the signaling server. if the event's candidate property is null, ice gathering has finished. this message should not be...
RTCPeerConnection.onicecandidateerror - Web APIs
the rtcpeerconnection.onicecandidateerror property is an eventhandler which specifies a function which is called to handle the icecandidateerror event when it occurs on an rtcpeerconnection instance. this event is fired when an error occurs during the ice candidate gathering process. syntax rtcpeerconnection.onicecandidateerror = eventhandler; value this should be set to a function you provide which is passed a single parameter: an rtcpeerconnectioniceerrorevent object describing the icecandidateerror event. the event offers properties describing the error to help you handle it appropriately. example pc.onicecandidateerror = function(event) { if (event.errorcode >= 300 && event.errorcode <= 699) { // stun errors are in the range 300-699. see rfc 5389, section 15.6 // for a l...
RTCPeerConnection.oniceconnectionstatechange - Web APIs
the rtcpeerconnection.oniceconnectionstatechange property is an event handler which specifies a function to be called when the iceconnectionstatechange event is fired on an rtcpeerconnection instance. this happens when the state of the connection's ice agent, as represented by the iceconnectionstate property, changes. syntax rtcpeerconnection.oniceconnectionstatechange = eventhandler; value this event handler can be set to function which is passed a single input parameter: an event object describing the iceconnectionstatechange event which occurred. your code can look at the value of rtcpeerconnection.iceconnectionstate to determine what the new state is. example the example below watches the state of the ice agent for a failure or unexpected closure and takes appropriate action, such...
RTCPeerConnection.onidentityresult - Web APIs
the rtcpeerconnection.onidentityresult event handler is a property containing the code to execute when the identityresult event, of type rtcidentityevent, is received by this rtcpeerconnection. such an event is sent when an identity assertion is generated, via getidentityassertion() or during the creation of an offer or an answer. syntax peerconnection.onidentityresult = function; values function is the name of a user-defined function, without the () suffix or any parameters, or an anonymous function declaration, such as function(event) {...}. an event handler always has one single parameter, containing the event, here of type rtcidentityevent. example pc.onidentityresult = function(ev) { alert("onidentityresult event detected!"); }; ...
RTCPeerConnection.onidpassertionerror - Web APIs
tyerrorevent, is received by this rtcpeerconnection. such an event is sent when the associated identity provider (idp) encounters an error while generating an identity assertion. this event handler is deprecated. you should instead detect idp assertion errors by handling rejection of the promise returned by rtcpeerconnection.peeridentity. syntax peerconnection.onidpassertionerror = function; values function is the name of a user-defined function, without the () suffix or any parameters, or an anonymous function declaration, such as function(event) {...}. an event handler always has one single parameter, containing the event, here of type rtcidentityerrorevent. example pc.onidpassertionerror = function(ev) { alert("onidpassertionerror event detected!"); }; ...
RTCPeerConnection.onidpvalidationerror - Web APIs
revent, is received by this rtcpeerconnection. such an event is sent when the associated identity provider (idp) encounters an error while validating an identity assertion. this event handler is obsolete. you should instead detect idp validation errors by watching for the promise returned by rtcpeerconnection.peeridentity to be rejected. syntax peerconnection.onidpvalidationerror = function; values function is the name of a user-defined function, without the () suffix or any parameters, or an anonymous function declaration, such as function(event) {...}. an event handler always has one single parameter, containing the event, here of type rtcidentityerrorevent. example pc.onidpvalidationerror = function(ev) { alert("onidpvalidationerror event detected!"); }; ...
RTCPeerConnection.onnegotiationneeded - Web APIs
werer. most commonly, the negotiationneeded event is fired after a send track is added to the rtcpeerconnection. if the session is modified in a manner that requires negotiation while a negotiation is already in progress, no negotiationneeded event will fire until negotiation completes, and only then if negotiation is still needed. syntax rtcpeerconnection.onnegotiationneeded = eventhandler; value this should be set to a function you provide which is passed a single parameter: an event object containing the negotiationneeded event. there's no additional information provided in the event; anything you need, you can get by examining the properties of the rtcpeerconnection. example this example, derived from the example in signaling and video calling, establishes a handler for negotiationn...
RTCPeerConnection.onpeeridentity - Web APIs
ty event, of type event, is received by this rtcpeerconnection. such an event is sent when an identity assertion, received from a peer, has been successfully validated. this event handler is obsolete. to detect successful validation of the identity, wait for the promise returned by peeridentity to resolve successfully with the peer's identity. syntax peerconnection.onpeeridentity = function; values function is the name of a user-defined function, without the () suffix or any parameters, or an anonymous function declaration, such as function(event) {...}. an event handler always has one single parameter, containing the event, here of type event. example pc.onpeeridentity = function(ev) { alert("onpeeridentity event detected!"); }; ...
RTCPeerConnection.onremovestream - Web APIs
is equivalent to the remote stream being removed and the old removestream event. the rtcpeerconnection.onremovestream event handler is a property containing the code to execute when the removestream event, of type mediastreamevent, is received by this rtcpeerconnection. such an event is sent when a mediastream is removed from this connection. syntax peerconnection.onremovestream = function; values function is the name of a user-defined function, without the () suffix or any parameters, or an anonymous function declaration, such as function(event) {...}. an event handler always has one single parameter, containing the event, here of type mediastreamevent. example pc.onremovestream = function(ev) { alert("onremovestream event detected!"); }; ...
RTCPeerConnection.onsignalingstatechange - Web APIs
a function to be called when the signalingstatechange event occurs on an rtcpeerconnection interface. the function receives as input the event object of type event; this event is sent when the peer connection's signalingstate changes, which may happen either because of a call to setlocaldescription() or to setremotedescription(). syntax rtcpeerconnection.onsignalingstatechange = errorhandler; value set this to a function which you provide that receives an event object as input; this contains the signalingstatechange event. this event object doesn't provide details about what changed, but you can examine the signalingstate property to determine what the new state is. you may also, as always, set up a handler for the signalingstatechange event using addeventlistener(): myrtcpeerconnection.
RTCPeerConnection.ontrack - Web APIs
ed when the track event occurs, indicating that a track has been added to the rtcpeerconnection. the function receives as input the event object, of type rtctrackevent; this event is sent when a new incoming mediastreamtrack has been created and associated with an rtcrtpreceiver object which has been added to the set of receivers on connection. syntax rtcpeerconnection.ontrack = eventhandler; value set ontrack to be a function you provide that accepts as input a rtctrackevent object describing the new track and how it's being used. this information includes the mediastreamtrack object representing the new track, the rtcrtpreceiver and rtcrtptransceiver, and a list of mediastream objects which indicates which stream or streams the track is part of.. example this example, taken from the co...
RTCPeerConnection.peerIdentity - Web APIs
the read-only rtcpeerconnection property peeridentity returns a javascript promise that resolves to an rtcidentityassertion which contains a domstring identifying the remote peer. once this promise resolves successfully, the resulting identity is the target peer identity and cannot change for the duration of the connection. syntax var identity = rtcpeerconnection.peeridentity; value a javascript promise which resolves to an rtcidentityassertion that describes the remote peer's identity. if an error occcurs while attempting to validate an incoming identity assertion (that is, the information describing a peer's identity), the promise is rejected. if there isn't already a target peer identity, peeridentity is set to a newly created promise and the process begins again, until the process su...
RTCPeerConnection: peeridentity event - Web APIs
cancelable no interface event event handler property onpeeridentity important: this event and its event handler have been removed from the specification and are no longer available. instead of using this event to detect when an identity is available, simply wait for the promise returned by rtcpeerconnection.peeridentity to be resolved. once resolved, its value is the new identity. examples for the correct way to detect a new peer identity, see rtcpeerconnection.peeridentity. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'peeridentity' in that specification. candidate recommendation ...
RTCPeerConnection.pendingLocalDescription - Web APIs
his does not describe the connection as it currently stands, but as it may exist in the near future. use rtcpeerconnection.currentlocaldescription or rtcpeerconnection.localdescription to get the current state of the endpoint. for details on the difference, see pending and current descriptions in webrtc connectivity. syntax sessiondescription = rtcpeerconnection.pendinglocaldescription; return value if a local description change is in progress, this is an rtcsessiondescription describing the proposed configuration. otherwise, this returns null. example this example looks at the pendinglocaldescription to determine whether or not there's a description change being processed. var pc = new rtcpeerconnection(); … var sd = pc.pendinglocaldescription; if (sd) { // there's a description cha...
RTCPeerConnection.pendingRemoteDescription - Web APIs
connection as it currently stands, but as it may exist in the near future. use rtcpeerconnection.currentremotedescription or rtcpeerconnection.remotedescription to get the current session description for the remote endpoint. for details on the difference, see pending and current descriptions in webrtc connectivity. syntax sessiondescription = rtcpeerconnection.pendingremotedescription; return value if a remote description change is in progress, this is an rtcsessiondescription describing the proposed configuration. otherwise, this returns null. example this example looks at the pendingremotedescription to determine whether or not there's a description change being processed. var pc = new rtcpeerconnection(); … var sd = pc.pendingremotedescription; if (sd) { // there's a description ...
RTCPeerConnection.remoteDescription - Web APIs
the read-only property rtcpeerconnection.remotedescription returns a rtcsessiondescription describing the session (which includes configuration and media information) for the remote end of the connection. if this hasn't been set yet, this is null. the returned value typically reflects a remote description which has been received over the signaling server (as either an offer or an answer) and then put into effect by your code calling rtcpeerconnection.setremotedescription() in response. syntax var sessiondescription = peerconnection.remotedescription; on a more fundamental level, the returned value is the value of rtcpeerconnection.pendingremotedescription if that property isn't null; otherwise, the value of rtcpeerconnection.currentremotedescription is returned. see pending and current ...
RTCPeerConnection.removeStream() - Web APIs
etrack() if your target browser versions have implemented it. if the signalingstate is set to "closed", an invalidstateerror is raised. if the signalingstate is set to "stable", the event negotiationneeded is sent on the rtcpeerconnection. syntax rtcpeerconnection.removestream(mediastream); parameters mediastream a mediastream specifying the stream to remove from the connection. return value undefined. example var pc, videostream; navigator.getusermedia({video: true}, function(stream) { pc = new rtcpeerconnection(); videostream = stream; pc.addstream(stream); } document.getelementbyid("closebutton").addeventlistener("click", function(event) { pc.removestream(videostream); pc.close(); }, false); ...
RTCPeerConnection.removeTrack() - Web APIs
ate is set to "stable"), it is marked as needing to be negotiated again; the remote peer won't experience the change until this negotiation occurs. a negotiationneeded event is sent to the rtcpeerconnection to let the local end know this negotiation must occur. syntax pc.removetrack(sender); parameters mediatrack a rtcrtpsender specifying the sender to remove from the connection. return value undefined. exceptions invalidstateerror the connection is not open. example this example adds a video track to a connection and sets up a listener on a close button which removes the track when the user clicks the button. var pc, sender; navigator.getusermedia({video: true}, function(stream) { pc = new rtcpeerconnection(); var track = stream.getvideotracks()[0]; sender = pc.addtra...
RTCPeerConnection.restartIce() - Web APIs
or because incoming offers are in the process of being negotiated—the rtcpeerconnection will remember that you requested ice restart. the next time the connection's signalingstate changes to stable, the connection will fire the negotiationneeded event. this process continues until an ice restart has been successfully completed. syntax rtcpeerconnection.restartice(); parameters none. return value undefined. usage notes after calling restartice(), the next offer created using createoffer() will initiate ice restart once sent to the remote peer over your signaling mechanism. restarting ice essentially resets ice so that it creates all new candidates using new credentials. existing media transmissions continue uninterrupted during this process. for details about how ice restart works, se...
RTCPeerConnection.sctp - Web APIs
the read-only sctp property on the rtcpeerconnection interface returns an rtcsctptransport describing the sctp transport over which sctp data is being sent and received. if sctp hasn't been negotiated, this value is null. the sctp transport is used for transmitting and receiving data for any and all rtcdatachannels on the peer connection. syntax var sctp = rtcpeerconnection.sctp; value a rtcsctptransport object describing the sctp transport being used by the rtcpeerconnection for transmitting and receiving on its data channels, or null if sctp negotiation hasn't happened. example var pc = new rtcpeerconnection(); var channel = pc.createdatachannel("mydata"); channel.onopen = function(event) { channel.send('sending a message'); } channel.onmessage = function(event) { console.log(e...
RTCPeerConnection.setIdentityProvider() - Web APIs
tityprovider() method sets the identity provider (idp) to the triplet given in parameter: its name, the protocol used to communicate with it (optional) and an optional username. the idp will be used only when an assertion is needed. if the signalingstate is set to "closed", an invalidstateerror is raised. syntax pc.setidentityprovider(domainname [, protocol] [, username]); there is no return value for this method. parameters domainname is a domstring is the domain name where the idp is. protocol optional is a domstring representing the protocol used to communicate with the idp. it defaults to "default" and is used to determine the url where the idp is listening. username optional is a domstring representing the username associated with the idp. example var pc = new peerconnecti...
RTCPeerConnection.setLocalDescription() - Web APIs
rowser object. they're interchangeable: mypeerconnection.createoffer().then(function(offer) { return mypeerconnection.setlocaldescription(offer); }); this is equivalent to: mypeerconnection.createoffer().then(function(offer) { return mypeerconnection.setlocaldescription(new rtcsessiondescription(offer)); }); for this reason, the rtcsessiondescription() constructor is deprecated. return value a promise which is fulfilled once the value of rtcpeerconnection.localdescription is successfully changed or rejected if the change cannot be applied (for example, if the specified description is incompatible with one or both of the peers on the connection). the promise's fulfillment handler receives no input parameters. the process of changing descriptions actually involves intermediary steps...
RTCPeerConnectionIceEvent.candidate - Web APIs
the read-only candidate property of the rtcpeerconnectioniceevent interface returns the rtcicecandidate associated with the event. syntax var candidate = event.candidate; value an rtcicecandidate object representing the ice candidate that has been received, or null to indicate that there are no further candidates for this negotiation session. example pc.onicecandidate = function( ev ) { alert("the ice candidate (transport address: '" + ev.candidate.candidate + "') has been added to this connection."); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnectioniceevent.candidate' in that specification. candidate recommendation initial specification. ...
RTCRemoteOutboundRtpStreamStats.remoteTimestamp - Web APIs
the rtcremoteoutboundrtpstreamstats property remotetimestamp indicates the timestamp on the remote peer at which these statistics were sent. this differs from timestamp, which indicates the time at which the statistics were generated or received locally. syntax let remotetimestamp = rtcremoteoutboundrtpstreamstats.remotetimestamp; value a domhighrestimestamp value indicating the timestamp on the remote peer at which it sent these statistics. this is different from the value timestamp, which gives the time at which the statistics were generated or received by the local peer. if this property is present, it comes from the rtcp sender report (sr) block, which reflects the clock on the remote peer at the time the message was sent. keep in mind that this means the clock may not be synchronize...
RTCRemoteOutboundRtpStreamStats.reportsSent - Web APIs
the rtcremoteoutboundrtpstreamstats dictionary's reportssent property provides the number of sender reports (srs) the remote peer has transmitted to the local peer. syntax let reportcount = rtcremoteoutboundrtpstreamstats.reportssent; value an integer value which indicates the total number of rtcp sender reports so far sent by the remote peer to the local peer. usage notes sender reports, described in rfc 3550, section 6.4.1 with an overview in rfc 3550, section 6.4, are used by rtp to share data transmission quality feedback between the two peers. the data in these reports is used by webrtc to fill out various fields within the statistics objects, and this property's value indicates how many times that information was shared. examples <<<--- add an example --->>> ...
RTCRemoteOutboundRtpStreamStats - Web APIs
remotetimestamp a domhighrestimestamp specifying the timestamp (on the remote device) at which the statistics in the rtcremoteoutboundrtpstreamstats object were sent by the remote endpoint. this is different from the timestamp found in the base rtcstats dictionary; it represents the time at which the object's statistics were received or generated by the local endpoint. reportssent an integer value indicating the total number of rtcp sender report (sr) blocks that this ssrc has sent. usage notes the rtcremoteoutboundrtpstreamstats object's remotetimestamp proeprty provides statistics based on the received data's ntp timestamp taken from an rtcp sender report (sr) block. be aware that the remote clock may not be synchronized with the local clock (either in current time or speed at which t...
RTCRtpContributingSource.rtpTimestamp - Web APIs
the read-only rtptimestamp property of the rtcrtpcontributingsource interface returns a domhighrestimestamp indicating the source-generated time at which the media contained int he packet was first sampled or obtained. syntax let rtptimestamp = rtcrtpcontributingsource.rtptimestamp value an integer value specifiying a source-generated timestamp indicating the time at which the media in this packet, scheduled for play out at the time indicated by timestamp, was initially sampled or generated. this value may be useful for sequencing and synchronization purposes. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtptimestamp' in that specification. candidate recommendation initial definition. ...
RTCRtpContributingSource.source - Web APIs
the read-only source property of the rtcrtpcontributingsource interface returns the source identifier of a particular stream of rtp packets. the value is the contributing source (csrc) or synchronization source (ssrc) identifier, depending on whether the object is an rtcrtpcontributingsource or rtcrtpsynchronizationsource, which is based on the former. syntax var sourceid = rtcrtpcontributingsource.source value an unsigned, 32-bit integer value which uniquely identifies the source of rtp packets described by this rtcrtpcontributingsource (in which case the value is a csrc identifier) or rtcrtpsynchronizationsource (the value is an ssrc identifier). specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'so...
RTCRtpContributingSource.timestamp - Web APIs
the read-only timestamp property of the rtcrtpcontributingsource interface returns a domhighrestimestamp indicating the most recent time of playout of an rtp packet from the source. syntax var domhighrestimestamp = rtcrtpcontributingsource.timestamp value a domhighrestimestamp which indicates the time at which the most recent rtp packet from the corresponding source was played out. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'timestamp' in that specification. candidate recommendation initial definition. ...
RTCRtpReceiver.getCapabilities() static function - Web APIs
t device. you can, similarly, obtain the capabilities of rtcrtpsenders by calling the static function rtcrtpsender.getcapabilities(). syntax let rtpcapabilities = rtcrtpreceiver.getcapabilities(kind); parameters kind a domstring indicating the type of media for which you wish to get the device's capability to receive. all browsers support the primary media kinds: audio and video. return value an rtcrtpcapabilities object stating what capabilities the browser has for receiving the specified media kind over an rtcpeerconnection. if the browser doesn't have any support for the given media kind, the returned value is null. description as a static function, this is always called using the form: capabilities = rtcrtpreceiver.getcapabilities("audio"); the returned set of capabilities is...
RTCRtpReceiver.getContributingSources() - Web APIs
the getcontributingsources() method of the rtcrtpreceiver interface returns an array of rtcrtpcontributingsource instances, each corresponding to one csrc (contributing source) identifier received by the current rtcrtpreceiver in the last ten seconds. syntax var rtcrtpcontributingsources = rtcrtpreceiver.getcontributingsources() parameters none. return value an array of rtcrtpcontributingsource instances. each instance describes one of the contributing sources that provided data to the incoming stream in the past ten seconds. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'getcontributingsources()' in that specification. candidate recommendation initial definition. ...
RTCRtpReceiver.getParameters() - Web APIs
examples this example obtains the canonical name (cname) being used for rtcp on an rtcrtpreceiver. ...
RTCRtpReceiver.getStats() - Web APIs
the rtcrtpreceiver method getstats() asynchronously requests an rtcstatsreport object which provides statistics about incoming traffic on the owning rtcpeerconnection, returning a promise whose fulfillment handler will be called once the results are available. syntax var promise = rtcrtpreceiver.getstats(); return value a javascript promise which is fulfilled once the statistics are available. the promise's fulfillment handler receives as a parameter a rtcstatsreport object containing the collected statistics. the returned statistics include those from all streams which are coming in through the rtcrtpreceiver, as well as any of their dependencies. example this simple example obtains the statistics for an rtcrtpreceiver and updates an element's innertext to display the number of packet...
RTCRtpReceiver.getSynchronizationSources() - Web APIs
the getsynchronizationsources() method of the rtcrtpreceiver interface returns an array of rtcrtpcontributingsource instances, each corresponding to one ssrc (synchronization source) identifier received by the current rtcrtpreceiver in the last ten seconds. syntax var rtcrtpcontributingsources = rtcrtpreceiver.getcontributingsources() parameters none. return value an array of rtcrtpsynchronizationsource instances. each instance describes one of the synchronization sources that provided data to the incoming stream in the past ten seconds. as you'll see in the documentarion for rtcrtpsynchronizationsource, it inherits the properties of rtcrtpcontributingsource, including timestamp, source, and audiolevel. the synchronization source objects add a voiceactivityflag property, which indicate...
RTCRtpReceiver.track - Web APIs
specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'track' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. ...
RTCRtpReceiver.transport - Web APIs
the read-only transport property of an rtcrtpreceiver object provides the rtcdtlstransport object used to interact with the underlying transport over which the receiver is exchanging real-time transport control protocol (rtcp) packets. this transport is responsible for receiving the data for the media on the receiver's track. syntax let transport = rtcrtpreceiver.transport; value an rtcdtlstransport object representing the underlying transport being used by the receiver to exchange packets with the remote peer, or null if the receiver isn't yet connected to a transport. description when the rtcrtpreceiver is first created, the value of transport is null. this is replaced with an rtcdtlstransport once the receiver's transport has been established. note that when bundling is in effect—...
RTCRtpSender.dtmf - Web APIs
Web › API › RTCRtpSender › dtmf
the read-only dtmf property on the rtcrtpsender interface returns a rtcdtmfsender object which can be used to send dtmf tones over the rtcpeerconnection . see using dtmf for details on how to make use of the returned rtcdtmfsender object. syntax var dtmfsender = rtcrtpsender.dtmf; value an rtcdtmfsender which can be used to send dtmf over the rtp session, or null if the track being carried by the rtp session or the rtcpeerconnection as a whole doesn't support dtmf. only audio tracks can support dtmf, and typically only one audio track per rtcpeerconnection will have an associated rtcdtmfsender example tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpsender.dtmf' in that specification.
RTCRtpSender.getCapabilities() static function - Web APIs
sender. you can, similarly, obtain the capabilities of rtcrtpreceivers by calling the static function rtcrtpreceiver.getcapabilities(). syntax let rtpcapabilities = rtcrtpsender.getcapabilities(kind); parameters kind a domstring indicating the type of media for which you wish to get the sender's capability to receive. all browsers support the primary media kinds: audio and video. return value an rtcrtpcapabilities object stating what capabilities the browser has for sending the specified media kind over an rtcpeerconnection. if the browser doesn't have any support for the given media kind, the returned value is null. description as a static function, this is always called using the form: capabilities = rtcrtpsender.getcapabilities("audio"); the returned set of capabilities is the...
RTCRtpSender.getParameters() - Web APIs
the getparameters() method of the rtcrtpsender interface returns an rtcrtpsendparameters object describing the current configuration for the encoding and transmission of media on the sender's track. syntax var rtpsendparameters = rtpsender.getparameters() parameters none. return value an rtcrtpsendparameters object indicating the current configuration of the sender. examples this example gets the sender's current transaction id; the transaction id uniquely identifies the current set of parameters, to ensure that calls to setparameters() are always handled in the correct order, avoiding inadvertently overwriting parameters with older parameters. function getsendertransactionid(sender) { let parameters = sender.getparameters(); return parameters.transactionid; } specifications ...
RTCRtpSender.getStats() - Web APIs
the rtcrtpsender method getstats() asynchronously requests an rtcstatsreport object which provides statistics about outgoing traffic on the rtcpeerconnection which owns the sender, returning a promise which is fulfilled when the results are available. syntax var promise = rtcrtpsender.getstats(); return value a javascript promise which is fulfilled once the statistics are available. the promise's fulfillment handler receives as a parameter a rtcstatsreport object containing the collected statistics. the returned rtcstatsreport accumulates the statistics for all of the streams being sent using the rtcrtpsender, as well as the statistics for any dependencies those streams have. example this simple example obtains the statistics for an rtcrtpsender and updates an element's innertext to di...
RTCRtpSender.setStreams() - Web APIs
mediastream objects. syntax rtcrtpsender.setstreams(mediastream); rtcrtpsender.setstreams([mediastream...]); parameters mediastream or [mediastream...] optional an mediastream object—or an array of multiple mediastream objects—identifying the streams to which the rtcrtpsender's track belongs. if this parameter isn't specified, no new streams will be associated with the track. return value none. exceptions invalidstateerror the sender's connection is closed. description setstreams() is purely additive. it doesn't remove the track from any streams; it simply adds it to new ones. if you specify streams to which the track already belongs, that stream is unaffected. once the track has been added to all of the streams, renegotiation of the connection will be triggered by the n...
RTCRtpSender.track - Web APIs
the track read-only property of the rtcrtpsender interface returns the mediastreamtrack which is being handled by the rtcrtpsender. syntax var mediastreamtrack = rtcrtpsender.track value a mediastreamtrack object representing the media associated with the rtcrtpsender. if no track is associated with the sender, this value is null, in which case the sender transmits nothing. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'track' in that specification. candidate recommendation initial definition. ...
RTCRtpSender.transport - Web APIs
the read-only transport property of an rtcrtpsender object provides the rtcdtlstransport object used to interact with the underlying transport over which the sender is exchanging real-time transport control protocol (rtcp) packets. this transport is responsible for receiving the data for the media on the sender's track. syntax let transport = rtcrtpsender.transport; value an rtcdtlstransport object representing the underlying transport being used by the sender to exchange packets with the remote peer, or null if the sender isn't yet connected to a transport. description when the rtcrtpsender is first created, the value of transport is null. this is replaced with an rtcdtlstransport once the sender's transport has been established. note that when bundling is in effect—that is, when th...
RTCRtpSender - Web APIs
tion doesn't support dtmf. only audio tracks can support dtmf. rtcrtpsender.track read only the mediastreamtrack which is being handled by the rtcrtpsender. if track is null, the rtcrtpsender doesn't transmit anything. rtcrtpsender.transport read only the rtcdtlstransport over which the sender is exchanging the rtp and rtcp packets used to manage transmission of media and control data. this value is null until the transport is established. when bundling is in use, more than transceiver may be sharing the same transport object. obsolete properties rtcptransport this property has been removed; the rtp and rtcp transports have been combined into a single transport. use the transport property instead. methods rtcrtpsender.getparameters() returns a rtcrtpparameters object descr...
RTCRtpStreamStats.codecId - Web APIs
the rtcrtpstreamstats dictionary's codecid property is a string which uniquely identifies the object that was inspected to produce the data in the rtccodecstats for the rtp stream. syntax var codecid = rtcrtpstreamstats.codecid; value a domstring which uniquely identifies the object from which the contents of the stream's rtccodecstats are derived. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcrtpstreamstats.codecid' in that specification. candidate recommendation initial definition. ...
RTCRtpStreamStats.firCount - Web APIs
the fircount property of the rtcrtpstreamstats dictionary indicates the number of full intra request (fir) packets have been sent by the receiver to the sender. this is a measure of how often the stream falls behind and has to skip frames in order to catch up. syntax var fircount = rtcrtpstreamstats.fircount; value an integer value indicating how many fir packets have been received by the sender during the current connection. this value is available only on receivers for video tracks. the receiver sends a fir packet to the sender any time it falls bahind or loses packets and cannot decode the incoming stream any longer because of the lost data. this tells the sender to send a full frame instead of a delta frame, so that the receiver can catch up. the higher fircount is, the more often fr...
RTCRtpStreamStats.kind - Web APIs
the kind property of the rtcrtpstreamstats dictionary is a string indicating whether the described rtp stream contains audio or video media. its value is always either "audio" or "video". this property was previously called mediatype. the name was changed in the specification in february, 2018. see browser compatibility below to determine how this affects the browsers you're targeting. syntax mediakind = rtcrtpstreamstats.kind; value a domstring whose value is "audio" if the track whose statistics are given by the rtcrtpstreamstats object contains audio, or "video" if the track contains video media. this string will always be the same as the one provided by the associated mediastreamtrack object's kind property. it will also match the statistics object's rtccodecstats.codec property's me...
RTCRtpStreamStats.nackCount - Web APIs
the nackcount property of the rtcrtpstreamstats dictionary is a numeric value indicating the number of times the receiver sent a nack packet to the sender. a nack (negative acknowledgement, also called "generic nack") packet tells the sender that one or more of the rtp packets it sent were lost in transport. syntax var nackcount = rtcrtpstreamstats.nackcount; value an integer value indicating how many times the receiver sent a nack packet to the sender after detecting that one or more packets were lost during transport. note: this value is only available on the receiver. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcinboundrtpstreamstats: nackcount' in that specification. candidate recommendation ...
RTCRtpStreamStats.sliCount - Web APIs
the slicount property of the rtcrtpstreamstats dictionary indicates how many slice loss indication (sli) packets were received by the sender. an sli packet is used by a decoder to let the encoder know that it's detected corruption of one or more consecutive macroblocks in the received media. syntax var slicount = rtcrtpstreamstats.slicount; value an unsigned long integer indicating the number of sli packets the sender received from the receiver due to lost runs of macroblocks. a high value of slicount may be an indication of an unreliable network. for technical details, see rfc 4585: 6.3.2. note: this value is sent by the sender to the receiver and is only present for video media. specifications specification status comment identifiers for webrtc's statistics ...
RTCRtpStreamStats.trackId - Web APIs
the rtcrtpstreamstats dictionary's trackid property is a string which uniquely identifies the rtcmediastreamtrackstats object which contains the track statistics for the mediastreamtrack for which statistics are provided in this object. syntax var trackid = rtcrtpstreamstats.trackid; value a domstring which uniquely identifies the rtcmediastreamtrackstats object that provides statistics for the track for which statistics are being collected by this rtcstatsreport. note: this value is not the same as the value of mediastramtrack.id. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcrtpstreamstats.trackid' in that specification. candidate recommendation initial definition. ...
RTCRtpStreamStats.transportId - Web APIs
the rtcrtpstreamstats dictionary's transportid property is a string which uniquely identifies the object from which the statistics contained in the rtctransportstats properties in the rtcstatsreport. syntax var transportid = rtcrtpstreamstats.transportid; value a domstring uniquely identifying the source of the statistics contained the rtctransportstats properties in the rtcstatsreport. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcrtpstreamstats.transportid' in that specification. candidate recommendation initial definition. ...
RTCRtpSynchronizationSource.voiceActivityFlag - Web APIs
the read-only voiceactivityflag property of the rtcrtpsynchronizationsource interface indicates whether or not the most recent rtp packet on the source includes voice activity. this is only present if the stream is using the voice activity detection feature; see the rtcofferoptions flag voiceactivitydetection. syntax var voiceactivity = rtcrtpsynchronizationsource.voiceactivityflag value a boolean value which is true if voice activity is present in the most recently received rtp packet played by the associated source, or false if voice activity is not present. this property is omitted entirely if voice activity detection is not enabled on the source, or if the rfc 6464 extension header isn't present. specifications specification status comment webrtc 1.0: real-...
RTCRtpSynchronizationSource - Web APIs
rce implements rtcrtpcontributingsource, its properties are also available. the information provided is based on the last ten seconds of media received. while the published specification describes this as an interface, it has since been changed to a dictionary in follow-up drafts. properties also implements the properties of rtcrtpcontributingsource. voiceactivityflag optional a boolean value indicating whether or not voice activity is included in the last rtp packet played from the source. if the peer has indicated that it's not supporting voice activity detection, this field is not provided. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpsynchronizationsource' in that specification. ...
RTCRtpTransceiver.mid - Web APIs
the read-only rtcrtptransceiver interface's mid property specifies the negotiated media id (mid) which the local and remote peers have agreed upon to uniquely identify the stream's pairing of sender and receiver. syntax var mediaid = rtcrtptransceiver.mid; value a domstring which uniquely identifies the pairing of source and destination of the transceiver's stream. its value is taken from the media id of the sdp m-line. this value is null if negotiation has not completed. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtptransceiver.mid' in that specification. candidate recommendation ...
RTCRtpTransceiver.receiver - Web APIs
the read-only receiver property of webrtc's rtcrtptransceiver interface indicates the rtcrtpreceiver responsible for receiving and decoding incoming media data for the transceiver's stream. syntax var rtpreceiver = rtcrtptransceiver.receiver; value an rtcrtpreceiver object which is responsible for receiving and decoding incoming media data whose media id is the same as the current value of mid. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtptransceiver.receiver' in that specification. candidate recommendation ...
RTCRtpTransceiver.sender - Web APIs
the read-only sender property of webrtc's rtcrtptransceiver interface indicates the rtcrtpsender responsible for encoding and sending outgoing media data for the transceiver's stream. syntax var rtpsender = rtcrtptransceiver.sender; value an rtcrtpsender object used to encode and send media whose media id matches the current value of mid. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtptransceiver.sender' in that specification. candidate recommendation ...
RTCRtpTransceiver.setCodecPreferences() - Web APIs
capability objects, in order of preference, each providing the parameters for one of the transceiver's supported codecs. if codecs is empty, the codec configurations are all returned to the user agent's defaults. note: any codecs not included in codecs will not be considered during the process of negotiating a connection. this lets you prevent the use of codecs you don't wish to use. return value undefined exceptions invalidaccesserror the codecs list includes one or more codecs which are not supported by the transceiver. usage notes getting a list of supported codecs you can only include in the codecs list codecs which the transceiver actually supports. that means that either the associated rtcrtpsender or the rtcrtpreceiver needs to support every codec in the list. if any unsu...
RTCRtpTransceiver.stop() - Web APIs
the stop() method in the rtcrtptransceiver interface permanently stops the transceiver by stopping both the associated rtcrtpsender and rtcrtpreceiver. note: until recently, the stopped property was provided to return true if the connection is stopped. that property has been deprecated and will be removed at some point. instead, check the value of currentdirection. if it's stopped, the transceiver has been stopped. this method does nothing if the transceiver is already stopped. syntax rtcrtptransceiver.stop() paramters none. return value undefined exceptions invalidstateerror the rtcpeerconnection of which the transceiver is a member is closed. usage notes when you call stop() on a transceiver, the sender immediately stops sending media and each of its rtp streams are closed ...
RTCRtpTransceiver.stopped - Web APIs
he read-only stopped property on the rtcrtptransceiver interface indicates whether or not the transceiver's associated sender and receiver have both been stopped. the transceiver is stopped if the stop() method has been called or if a change to either the local or the remote description has caused the transceiver to be stopped for some reason. syntax var isstopped = rtcrtptransceiver.stopped; value a boolean value which is true if the transceiver's sender will no longer send data, and its receiver will no longer receive data. if either or both are still at work, the result is false. usage notes this property is deprecated and will be removed in the future. instead, look at the value of currentdirection. its value is stopped if the transceiver has stopped. note: currently only firefox i...
RTCRtpTransceiverDirection - Web APIs
the rtcrtptransceiverdirection type is an enumerated set of strings which are used to describe the directionality of a rtcrtptransceiver instance. both the preferred direction and the currentdirection properties are of this type. values the rtcrtptransceiverdirection type is an enumeration of string values. each describes how the transceiver's associated rtcrtpsender and rtcrtpreceiver behave as shown in the table below. value rtcrtpsender behavior rtcrtpreceiver behavior "sendrecv" offers to send rtp data, and will do so if the other peer accepts the connection and at least one of the sender's encodings is active1. offers to receive rtp data, and does so if the other peer accepts. "sendonly" offers to send rtp data, and will do so if the other ...
RTCRtpTransceiverInit - Web APIs
sendencodings optional a list of encodings to allow when sending rtp media from the rtcrtpsender. each entry is of type rtcrtpencodingparameters. ...
RTCSctpTransport - Web APIs
he rtcsctptransport for a given rtcpeerconnection through its sctp property. possibly the most useful property on this interface is its maxmessagesize property, which you can use to determine the upper limit on the size of messages you can send over a data channel on the peer connection. properties also inherits properties from: eventtarget rtcsctptransport.maxchannelsread only an integer value indicating the maximum number of rtcdatachannels that can be open simultaneously. rtcsctptransport.maxmessagesizeread only an integer value indicating the maximum size, in bytes, of a message which can be sent using the rtcdatachannel.send() method. rtcsctptransport.stateread only a domstring enumerated value indicating the state of the sctp transport. rtcsctptransport.transportread only ...
RTCSessionDescriptionCallback - Web APIs
id using it (and the callback-based forms of createoffer() and createanswer() that make use of it). syntax rtcsessiondescriptioncallback(description); parameters description an rtcsessiondescriptioninit (or rtcsessiondescription) object describing the session being offered or being accepted. this object contains the type and sdp properties which are part of rtcsessiondescription. return value the callback doesn't need to return anything, so the return value is undefined. example var pc = new rtcpeerconnection(); var descriptioncallback = function(offer) { pc.setlocaldescription(offer); } pc.createoffer(descriptioncallback); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcsessiondescri...
RTCStats.id - Web APIs
Web › API › RTCStats › id
the id property of the rtcstats dictionary is a string which uniquely identifies the object for which this rtcstats object provides statistics. using the id, you can correlate two or more rtcstats-based objects in order to monitor statistics over time for a given webrtc object, such as an rtp stream, an rtcpeerconnection, or an rtcdatachannel. syntax var id = rtcstats.id; value a domstring which uniquely identifies the object for which this rtcstats-based object provides statistics. the format of the id string is not defined by the specification, so you cannot reliably make any assumptions about the contents of the string, or assume that the format of the string will remain unchanged for a given object type. specifications specification status comment webrtc 1.0:...
RTCStats.timestamp - Web APIs
stimestamp object specifying the time at which the data in the object was sampled. for reports related to rtcp packets, for instance, this indicates the time at which the data covered by the statistics was received at the corresponding endpoint. the time is given in milliseconds elapsed since the unix epoch (the first moment of january 1, 1970, utc). syntax var timestamp = rtcstats.timestamp; value a domhighrestimestamp value indicating the time at which the activity described by the statistics in this object was recorded, in milliseconds elapsed since the beginning of january 1, 1970, utc. this should be accurate to within a few milliseconds but may not be entirely pricise, either because of hardware or operating system limitations or because of fingerprinting protection in the form of re...
RTCTrackEvent() - Web APIs
eerconnection. this object has the following properties: receiver the rtcrtpreceiver which is being used to receive the track's media. streams optional an array of mediastream objects representing each of the streams that comprise the event's corresponding track. track the mediastreamtrack the event is associated with. transceiver the rtcrtptransceiver associated with the event. return value a new rtctrackevent describing a track which has been added to the rtcpeerconnection. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtctrackevent()' in that specification. candidate recommendation initial specification. ...
RTCTrackEvent.receiver - Web APIs
note: the transceiver includes its own receiver property, which will always be the same rtcrtpreceiver as this one. ...
RTCTrackEvent.streams - Web APIs
the webrtc api interface rtctrackevent's read-only streams property specifies an array of mediastream objects, one for each of the streams that comprise the track being added to the rtcpeerconnection. syntax var streams = trackevent.streams; value an array of mediastream objects, one for each stream that make up the new track. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtctrackevent.streams' in that specification. candidate recommendation initial specification. ...
RTCTrackEvent.track - Web APIs
the webrtc api interface rtctrackevent's read-only track property specifies the mediastreamtrack that has been added to the rtcpeerconnection. syntax var track = trackevent.track; value a mediastreamtrack indicating the track which has been added to the rtcpeerconnection. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtctrackevent.track' in that specification. candidate recommendation initial specification. ...
RTCTrackEvent.transceiver - Web APIs
the webrtc api interface rtctrackevent's read-only transceiver property indicates the rtcrtptransceiver affiliated with the event's track. the transceiver pairs the track's receiver with an rtcrtpsender. syntax var rtptransceiver = trackevent.transceiver; value the rtcrtptransceiver which pairs the receiver with a sender and other properties which establish a single bidirectional srtp stream for use by the track associated with the rtctrackevent. note: the rtcrtpreceiver referred to by this rtcrtpreceiver's receiver property will always be the same as the rtctrackevent's receiver property. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtctrackevent.transceiver' in that specification. ca...
RTCTrackEventInit.receiver - Web APIs
the rtctrackeventinit dictionary's receiver property specifies the rtcrtpreceiver associated with the event. syntax var trackeventinit = { receiver: rtpreceiver, track: mediastreamtrack, streams: [videostream], transceiver: rtptransceiver }; var rtpreceiver = trackeventinit.receiver; value the rtcrtptransceiver which pairs the receiver with a sender and other properties which establish a single bidirectional srtp stream for use by the track associated with the rtctrackevent. note: the transceiver includes its own receiver property, which will always be the same rtcrtpreceiver as this one. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtctrackeventinit.receiver' in that specificati...
RTCTrackEventInit.streams - Web APIs
the rtctrackeventinit dictionary's optional streams property provides an array containing a mediastream object for each of the streams associated with the event's track. syntax var trackeventinit = { receiver: rtpreceiver, track: mediastreamtrack, streams: [videostream], transceiver: rtptransceiver }; var streamlist = trackeventinit.streams; value an array of mediastream objects, one for each stream which make up the track. if streams is not specified, its default value is an empty array. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtctrackeventinit.streams' in that specification. candidate recommendation initial specification. ...
RTCTrackEventInit.track - Web APIs
the rtctrackeventinit dictionary's track property specifies the mediastreamtrack associated with the track event. syntax var trackeventinit = { receiver: rtpreceiver, track: mediastreamtrack, streams: [videostream], transceiver: rtptransceiver }; var track = trackeventinit.track; value a mediastreamtrack representing the track with which the event is associated. this is the track that's being added to the rtcpeerconnection. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtctrackeventinit.track' in that specification. candidate recommendation initial specification. ...
RTCTrackEventInit.transceiver - Web APIs
init dictionary's transceiver property specifies the rtcrtptransceiver associated with the track event. the transceiver pairs the track's receiver with an rtcrtpsender to allow bidirectional communication. syntax var trackeventinit = { receiver: rtpreceiver, track: mediastreamtrack, streams: [videostream], transceiver: rtptransceiver }; var rtptransceiver = trackeventinit.transceiver; value the rtcrtptransceiver which pairs the receiver with a sender and other properties which establish a single bidirectional srtp stream for use by the track associated with the rtctrackevent. note: the rtcrtpreceiver referred to by this rtcrtpreceiver's receiver property will always be the same as the rtctrackevent's receiver property. specifications specification status comment...
Range.cloneRange() - Web APIs
Web › API › Range › cloneRange
syntax clone = range.clonerange(); example range = document.createrange(); range.selectnode(document.getelementsbytagname("div").item(0)); clone = range.clonerange(); specifications specification status comment domthe definition of 'range.clonerange()' in that specification. living standard no change. ...
Range.collapse() - Web APIs
Web › API › Range › collapse
if omitted, it defaults to false . ...
Range.getBoundingClientRect() - Web APIs
the range.getboundingclientrect() method returns a domrect object that bounds the contents of the range; this is a rectangle enclosing the union of the bounding rectangles for all the elements in the range. this method is useful for determining the viewport coordinates of the cursor or selection inside a text box. see element.getboundingclientrect() for details on the returned value. syntax boundingrect = range.getboundingclientrect() example html <div id="highlight"></div> <p>this example positions a "highlight" rectangle behind the contents of a range. the range's content <b>starts here</b> and continues on until it <b>ends here</b>. the bounding client rectangle contains everything selected in the range.</p> css #highlight { background: yellow; position: absolute; z...
Range.setEnd() - Web APIs
Web › API › Range › setEnd
(higher in the document) than the start point will result in a collapsed range with the start and end points both set to the specified end position. syntax range.setend(endnode, endoffset); parameters endnode the node inside which the range should end. endoffset an integer greater than or equal to zero representing the offset for the end of the range from the start of endnode. return value undefined. exceptions exceptions are thrown as domexception objects of the following types: invalidnodetypeerror the node specified by endnode is a doctype node; range endpoints cannot be located inside a doctype node. indexsizeerror the value 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 ...
Range.setStart() - Web APIs
Web › API › Range › setStart
id="address">wyatt earp<br> 101 e. main st.<br> dodge city, ks<br> 67801<br> usa</p> <hr> <p>nodes in the original address:</p> <ol id="log"></ol> javascript const address = document.getelementbyid('address'); const log = document.getelementbyid('log'); // log info address.childnodes.foreach(node => { const li = document.createelement('li'); li.textcontent = `${node.nodename}, ${node.nodevalue}`; log.appendchild(li); }); // highlight the street and city const startoffset = 2; // start at third node: 101 e. main st. const endoffset = 5; // end at fifth node: dodge city, ks const range = document.createrange(); range.setstart(address, startoffset); range.setend(address, endoffset); const mark = document.createelement('mark'); range.surroundcontents(mark); result get character...
ReadableByteStreamController.byobRequest - Web APIs
the byobrequest read-only property of the readablebytestreamcontroller interface returns the current byob pull request, or undefined if there are no pending requests. syntax var request = readablebytestreamcontroller.byobrequest; value a readablestreambyobrequest object instance, or undefined. examples tbd. specifications specification status comment streamsthe definition of 'byobrequest' in that specification. living standard initial definition. ...
ReadableByteStreamController.close() - Web APIs
the close() method of the readablebytestreamcontroller interface closes the associated stream. note: readers will still be able to read any previously-enqueued chunks from the stream, but once those are read, the stream will become closed. syntax readablebytestreamcontroller.close(); parameters none. return value undefined. exceptions typeerror the source object is not a readablebytestreamcontroller, or the stream is not readable for some other reason. examples tbd. specifications specification status comment streamsthe definition of 'close()' in that specification. living standard initial definition. ...
ReadableByteStreamController.desiredSize - Web APIs
the desiredsize read-only property of the readablebytestreamcontroller interface returns the desired size required to fill the stream's internal queue. syntax var desiredsize = readablebytestreamcontroller.desiredsize; value an integer. note that this can be negative if the queue is over-full. examples tbd. specifications specification status comment streamsthe definition of 'desiredsize' in that specification. living standard initial definition. ...
ReadableByteStreamController.enqueue() - Web APIs
the enqueue() method of the readablebytestreamcontroller interface enqueues a given chunk in the associated stream. syntax readablebytestreamcontroller.enqueue(chunk); parameters chunk the chunk to enqueue. return value undefined. exceptions typeerror the source object is not a readablebytestreamcontroller, or the stream cannot be read for some other reason, or the chunk is not an object, or the chunk's internal array buffer is non-existant or detached. examples tbd. specifications specification status comment streamsthe definition of 'enqueue()' in that specification. living standard initial definition. ...
ReadableByteStreamController.error() - Web APIs
the error() method of the readablebytestreamcontroller interface causes any future interactions with the associated stream to error. syntax readablebytestreamcontroller.error(e); parameters e the error you want future interactions to fail with. return value undefined. exceptions typeerror the source object is not a readablebytestreamcontroller, or the stream is not readable for some other reason. examples tbd. specifications specification status comment streamsthe definition of 'error()' in that specification. living standard initial definition. ...
ReadableStream.locked - Web APIs
examples const stream = new readablestream({ ... ...
ReadableStream.pipeThrough() - Web APIs
am starts out closed or closing, the source readable stream will no longer be canceled. in this case the method will return a promise rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source. signal: if set to an abortsignal object, ongoing pipe operations can then be aborted via the corresponding abortcontroller. return value the readable side of the transformstream. exceptions typeerror the writable and/or readable property of transformstream are undefined. examples in the following example (see unpack chunks of a png for the full code running live, and png-transform-stream for the source code), an image is fetched and its body retrieved as a readablestream. next, we log the contents of the readable stream, ...
ReadableStream.pipeTo() - Web APIs
am starts out closed or closing, the source readable stream will no longer be canceled. in this case the method will return a promise rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source. signal: if set to an abortsignal object, ongoing pipe operations can then be aborted via the corresponding abortcontroller. return value a promise that resolves when the piping process has completed. exceptions typeerror the writablestream and/or readablestream objects are not a writable stream/readable stream, or one or both of the streams are locked. examples // fetch the original image fetch('png-logo.png') // retrieve its body as readablestream .then(response => response.body) .then(body => body.pipethrough(new pngtra...
ReadableStreamBYOBReader.ReadableStreamBYOBReader() - Web APIs
the readablestreambyobreader() constructor creates and returns a readablestreambyobreader object instance. note: you generally wouldn't use this constructor manually; instead, you'd use the readablestream.getreader() method. syntax var readablestreambyobreader = new readablestreambyobreader(stream); parameters stream the readablestream to be read. return value an instance of the readablestreambyobreader object. exceptions typeerror the supplied stream parameter is not a readablestream, or it is already locked for reading by another reader, or its stream controller is not a readablebytestreamcontroller. examples tbd specifications specification status comment streamsthe definition of 'readablestreambyobreader()' in that specification. living ...
ReadableStreamBYOBReader.cancel() - Web APIs
mer. the supplied reason parameter will be given to the underlying source, which may or may not use it. note: if the reader is active, the cancel() method behaves the same as that for the associated stream (readablestream.cancel()). syntax var promise = readablestreambyobreader.cancel(reason); parameters reason a domstring providing a human-readable reason for the cancellation. return value a promise, which fulfills with the value given in the reason parameter. exceptions typeerror the source object is not a readablestreambyobreader, or the stream has no owner. examples tbd. specifications specification status comment streamsthe definition of 'cancel()' in that specification. living standard initial definition. ...
ReadableStreamBYOBReader.closed - Web APIs
the closed read-only property of the readablestreambyobreader interface returns a promise that fulfills if the stream becomes closed or the reader's lock is released, or rejects if the stream errors. syntax var closed = readablestreambyobreader.closed; value a promise. examples tbd. specifications specification status comment streamsthe definition of 'closed' in that specification. living standard initial definition. ...
ReadableStreamBYOBReader.read() - Web APIs
the read() method of the readablestreambyobreader interface returns a promise providing access to the next chunk in the byte stream's internal queue. syntax var promise = readablestreambyobreader.read(view); parameters view the view to be read into. return value a promise, which fulfills/rejects with a result depending on the state of the stream. the different possibilities are as follows: if a chunk is available, the promise will be fulfilled with an object of the form { value: thechunk, 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 readablestreambyo...
ReadableStreamBYOBReader.releaseLock() - Web APIs
will appear errored in that same way subsequently; otherwise, the reader will appear closed. a reader’s lock cannot be released while it still has a pending read request, i.e., if a promise returned by the reader’s readablestreambyobreader.read() method has not finished. this will result in a typeerror being thrown. syntax readablestreambyobreader.releaselock(); parameters none. return value undefined. exceptions typeerror the source object is not a readablestreambyobreader, or a read request is pending. examples tbd. specifications specification status comment streamsthe definition of 'releaselock()' in that specification. living standard initial definition. ...
ReadableStreamBYOBRequest.respond() - Web APIs
exceptions typeerror the source object is not a readablestreambyobrequest, or there is no associated controller, or the associated internal array buffer is detached. examples tbd. ...
ReadableStreamBYOBRequest.respondWithNewView() - Web APIs
exceptions typeerror the source object is not a readablestreambyobrequest, or there is no associated controller, or the associated internal array buffer is non-existant or detached. examples tbd. ...
ReadableStreamBYOBRequest.view - Web APIs
examples tbd. ...
ReadableStreamDefaultController.close() - Web APIs
s the associated stream. readers will still be able to read any previously-enqueued chunks from the stream, but once those are read, the stream will become closed. if you want to completely get rid of the stream and discard any enqueued chunks, you'd use readablestream.cancel() or readablestreamdefaultreader.cancel(). syntax readablestreamdefaultcontroller.close(); parameters none. return value undefined. exceptions typeerror the source object is not a readablestreamdefaultcontroller. examples in the following simple example, a custom readablestream is created using a constructor (see our simple random stream example for the full code). the start() function generates a random string of text every second and enqueues it into the stream. a cancel() function is also provided to st...
ReadableStreamDefaultController.desiredSize - Web APIs
note that this can be negative if the queue is over-full. ...
ReadableStreamDefaultController.enqueue() - Web APIs
exceptions typeerror the source object is not a readablestreamdefaultcontroller. examples in the following simple example, a custom readablestream is created using a constructor (see our simple random stream example for the full code). ...
ReadableStreamDefaultController.error() - Web APIs
the error() method of the readablestreamdefaultcontroller interface causes any future interactions with the associated stream to error. note: the error() method can be called more than once, and can be called when the stream is not readable. syntax readablestreamdefaultcontroller.error(e); parameters e the error you want future interactions to fail with. return value undefined. exceptions typeerror the source object is not a readablestreamdefaultcontroller, or the stream is not readable for some other reason. examples the a readable stream with an underlying push source and backpressure support example in the spec provides a good example of using readablestreamdefaultcontroller.desiredsize to manually detect when the stream is full and apply backpressure, and also of using...
ReadableStreamDefaultReader.closed - Web APIs
examples in this snippet, a previously-created reader is queried to see if the stream has been closed. ...
ReadableStreamDefaultReader.releaseLock() - Web APIs
appear errored in that same way subsequently; otherwise, the reader will appear closed. a reader’s lock cannot be released while it still has a pending read request, i.e., if a promise returned by the reader’s readablestreamdefaultreader.read() method has not finished. this will result in a typeerror being thrown. syntax readablestreamdefaultreader.releaselock(); parameters none. return value undefined. exceptions typeerror the source object is not a readablestreamdefaultreader, or a read request is pending. examples function fetchstream() { const reader = stream.getreader(); ... reader.releaselock() ... } specifications specification status comment streamsthe definition of 'releaselock()' in that specification. living standard initi...
Report - Web APIs
Web › API › Report
istitem = document.createelement('li'); let textnode = document.createtextnode('report ' + (i + 1) + ', type: ' + reports[i].type); listitem.appendchild(textnode); let innerlist = document.createelement('ul'); listitem.appendchild(innerlist); list.appendchild(listitem); for (let key in reports[i].body) { let innerlistitem = document.createelement('li'); let keyvalue = reports[i].body[key]; innerlistitem.textcontent = key + ': ' + keyvalue; innerlist.appendchild(innerlistitem); } } } the reports parameter contains an array of all the reports in the observer's report queue. we loop over each report using a basic for loop, then iterate over each entry of in the report's body using a for...in structure, displaying each key/value pair inside a ...
ReportingObserver.takeRecords() - Web APIs
examples let options = { types: ['deprecation'], buffered: true } let observer = new reportingobserver(function(reports, observer) { reportbtn.onclick = () => displayreports(reports); }, options); observer.observe() // ... ...
Reporting API - Web APIs
reportingobserveroptions allows options to be set in the constructor when creating a reporting observer. available report types the spec defines the following report types: deprecation report indicates that a webapi or other browser feature being used in the website is expected to stop working in a future release. indicated by a report.body property with a deprecationreportbody return value. intervention report indicates that a request made by the website has been denied by the browser, e.g. for security or user annoyance reasons. indicated by a report.body property with a interventionreportbody return value. crash report indicates that the website stopped running due to a browser crash. indicated by a report.body property with a crashreportbody return value. examples in our ...
Request.clone() - Web APIs
Web › API › Request › clone
of the request interface creates a copy of the current request object. clone() throws a typeerror if the response body has already been used. in fact, the main reason clone() exists is to allow multiple uses of body objects (when they are one-use only.) if intend to modify the request, you may prefer the request constructor. syntax var newrequest = request.clone(); parameters none. return value a request object, which is an exact copy of the request that clone() was called on. example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then clone the request. var myrequest = new request('flowers.jpg'); var newrequest = myrequest.clone(); // a copy of the request is now stored in newrequest...
Request.context - Web APIs
Web › API › Request › context
he serviceworker api; a service worker can make decisions based on whether the url is for an image, or an embeddable object such as a <video>, iframe, etc. note: you can find a full list of the different available contexts including associated context frame types, csp directives, and platform feature examples in the fetch spec request context section. syntax var mycontext = request.context; value a requestcontext value. example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then save the request context in a variable: var myrequest = new request('flowers.jpg'); var mycontext = myrequest.context; // returns the empty string by default ...
Request.credentials - Web APIs
the credentials read-only property of the request interface indicates whether the user agent should send cookies from the other domain in the case of cross-origin requests. syntax var mycred = request.credentials; value a requestcredentials dictionary value indicating whether the user agent should send cookies from the other domain in the case of cross-origin requests. possible values are: omit: never send or receive cookies. same-origin: send user credentials (cookies, basic http auth, etc..) if the url is on the same origin as the calling script. this is the default value. include: always send user credentials (cookies, basic http auth, etc..), even for cross-origin calls. this is similar to xhr’s withcredentials flag, but with three available values instead of two. example in...
Request.headers - Web APIs
Web › API › Request › headers
the headers read-only property of the request interface contains the headers object associated with the request. syntax var myheaders = request.headers; value a headers object. example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then save the request headers in a variable: var myrequest = new request('flowers.jpg'); var myheaders = myrequest.headers; // headers {} to add a header to the headers object we use headers.append; we then create a new request along with a 2nd init parameter, passing headers in as an init option: var myheaders = new headers(); myheaders.append('content-type', 'image/jpeg'); var myinit = { method: 'get', headers: myheaders, mode: 'cors', cache: 'defa...
Request.integrity - Web APIs
Web › API › Request › integrity
the integrity read-only property of the request interface contains the subresource integrity value of the request. syntax var myintegrity = request.integrity; value the subresource integrity value of the request (e.g., sha256-bpfbw7ivv8q2jlit13fxdyae2tjllusrsz273h2nfse=). if an integrity has not been specified, the property returns ''. example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then save the request integrity value in a variable: var myrequest = new request('flowers.jpg'); var myintegrity = myrequest.integrity; specifications specification status comment fetchthe definition of 'integrity' in that specification. living standard initial definitio...
Request.method - Web APIs
Web › API › Request › method
the method read-only property of the request interface contains the request's method (get, post, etc.) syntax var mymethod = request.method; value a bytestring indicating the method of the request. example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then save the method of the request in a variable: var myrequest = new request('flowers.jpg'); var mymethod = myrequest.method; // get specifications specification status comment fetchthe definition of 'method' in that specification. living standard initial definition ...
Request.redirect - Web APIs
Web › API › Request › redirect
the redirect read-only property of the request interface contains the mode for how redirects are handled. syntax var myredirect = request.redirect; value a requestredirect enum value, which can be one the following strings: follow error manual if not specified when the request is created, it takes the default value of follow. example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then save the request redirect value in a variable: var myrequest = new request('flowers.jpg'); var mycred = myrequest.redirect; specifications specification status comment fetchthe definition of 'redirect' in that specification. living standard initial definition ...
Request.referrer - Web APIs
Web › API › Request › referrer
the referrer read-only property of the request interface is set by the user agent to be the referrer of the request. (e.g., client, no-referrer, or a url.) note: if referrer's value is no-referrer, it returns an empty string. syntax var myreferrer = request.referrer; value a domstring representing the request's referrer. example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then save the request referrer in a variable: var myrequest = new request('flowers.jpg'); var myreferrer = myrequest.referrer; // returns "about:client" by default specifications specification status comment fetchthe definition of 'referrer' in that specification. living standard ini...
Request.referrerPolicy - Web APIs
the referrerpolicy read-only property of the request interface returns the referrer policy, which governs what referrer information, sent in the referer header, should be included with the request. syntax var myreferrerpolicy = request.referrerpolicy; value a domstring representing the request's referrerpolicy. for more information and possible values, see the referrer-policy http header page. example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then save the request referrer policy in a variable: var myrequest = new request('flowers.jpg'); var myreferrer = myrequest.referrerpolicy; // returns "" by default specifications specification status comment fetchthe d...
Request.url - Web APIs
Web › API › Request › url
the url read-only property of the request interface contains the url of the request. syntax var myurl = request.url; value a usvstring indicating the url of the request. example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then save the url of the request in a variable: var myrequest = new request('flowers.jpg'); var myurl = myrequest.url; // "http://mdn.github.io/fetch-examples/fetch-request/flowers.jpg" specifications specification status comment fetchthe definition of 'url' in that specification. living standard initial definition ...
RequestDestination - Web APIs
navigator.sendbeacon(), eventsource, <a ping>, <area ping>, fetch(), xmlhttprequest, websocket, cache and more. "audio" the target is audio data. "audioworklet" the target is data being fetched for use by an audio worklet. "document" the target is a document (html or xml). "embed" the target is embedded content. "font" the target is a font. "image" the target is an image. "manifest" the target is a manifest. ...
ResizeObserver.disconnect() - Web APIs
exceptions none. ...
ResizeObserver.observe() - Web APIs
bserving the specified element or svgelement. syntax resizeobserver.observe(target, options); parameters target a reference to an element or svgelement to be observed. options optional an options object allowing you to set options for the observation. currently this only has one possible option that can be set: box sets which box model the observer will observe changes to. possible values are content-box (the default), and border-box. return value void. exceptions none. examples the following snippet is taken from the resize-observer-text.html (see source) example: const resizeobserver = new resizeobserver(entries => { for (let entry of entries) { if(entry.contentboxsize) { h1elem.style.fontsize = math.max(1.5, entry.contentboxsize.inlinesize/200) + 'rem';...
ResizeObserver.unobserve() - Web APIs
exceptions none. ...
ResizeObserverEntry.borderBoxSize - Web APIs
the array is necessary to support elements that have multiple fragments, which occur in multi-column scenarios. ...
ResizeObserverEntry.contentBoxSize - Web APIs
this object contains two properties: blocksize the length of the observed element's content box in the block dimension. ...
ResizeObserverEntry.contentRect - Web APIs
of the observed element when the callback is run. note that this is better supported than resizeobserverentry.borderboxsize or resizeobserverentry.contentboxsize, but it is left over from an earlier implementation of the resize observer api, is still included in the spec for web compat reasons, and may be deprecated in future versions. syntax var contentrect = resizeobserverentry.contentrect; value a domrectreadonly object containing the new size of the element indicated by the target property. if the target is an html element, the returned contentrect is the element's content box. if the target is an svgelement, the returned contentrect is the svg's bounding box. examples the following snippet is taken from the resize-observer-text.html (see source) example. this uses a simple feature ...
Resize Observer API - Web APIs
s change in proportion to the size of the box. we could just implement this using border-radius with a percentage, but that quickly leads to ugly-looking elliptical corners, whereas the above solution gives you nice square corners that scale with the box size. resize-observer-text.html (see source): here we use the resize observer to change the font-size of a header and paragraph as a slider’s value is changed causing the containing <div> to change width. this shows that you can respond to changes in an element’s size, even if they have nothing to do with the viewport. the code will usually follow this kind of pattern (taken from resize-observer-border-radius.html): const resizeobserver = new resizeobserver(entries => { for (let entry of entries) { if(entry.contentboxsize) { ...
Response.clone() - Web APIs
Web › API › Response › clone
the clone() method of the response interface creates a clone of a response object, identical in every way, but stored in a different variable. clone() throws a typeerror if the response body has already been used. in fact, the main reason clone() exists is to allow multiple uses of body objects (when they are one-use only.) syntax var response2 = response1.clone(); parameters none. value a response object. example in our fetch response clone example (see fetch response clone live) we create a new request object using the request() constructor, passing it a jpg path. we then fetch this request using fetch(). when the fetch resolves successfully, we clone it, extract a blob from both responses using two body.blob calls, create object urls out of the blobs using url.createobjecturl, and ...
Response.error() - Web APIs
Web › API › Response › error
onse object associated with a network error. note: this is mainly relevant to serviceworkers; the error method is used to return an error if you so wish it. an error response has its type set to error. note: an "error" response never really gets exposed to script: such a response to a fetch() would reject the promise. syntax var errorresponse = response.error(); parameters none. return value a response object. example tbd (does not yet appear to be supported anywhere). specifications specification status comment fetchthe definition of 'error()' in that specification. living standard ...
Response.headers - Web APIs
Web › API › Response › headers
the headers read-only property of the response interface contains the headers object associated with the response. syntax var myheaders = response.headers; value a headers object. example in our fetch response example (see fetch response live) we create a new request object using the request() constructor, passing it a jpg path. we then fetch this request using fetch(), extract a blob from the response using body.blob, create an object url out of it using url.createobjecturl, and display this in an <img>. note that at the top of the fetch() block we log the response headers value to the console. var myimage = document.queryselector('img'); var myrequest = new request('flowers.jpg'); fetch(myrequest).then(function(response) { console.log(response.headers); // returns a headers{} obj...
Response.ok - Web APIs
Web › API › Response › ok
the ok read-only property of the response interface contains a boolean stating whether the response was successful (status in the range 200-299) or not. syntax var myok = response.ok; value a boolean. example in our fetch response example (see fetch response live) we create a new request object using the request() constructor, passing it a jpg path. we then fetch this request using fetch(), extract a blob from the response using body.blob, create an object url out of it using url.createobjecturl, and display this in an <img>. note: at the top of the fetch() block we log the response ok value to the console. var myimage = document.queryselector('img'); var myrequest = new request('flowers.jpg'); fetch(myrequest).then(function(response) { console.log(response.ok); // returns true i...
Response.redirect() - Web APIs
Web › API › Response › redirect
erviceworker api. a controlling service worker could intercept a page's request and redirect it as desired. this will actually lead to a real redirect if a service worker sends it upstream. syntax var response = response.redirect(url, status); parameters url the url that the new response is to originate from. status optional an optional status code for the response (e.g., 302.) return value a response object. exceptions exception explanation rangeerror the specified status is not a redirect status. typeerror the specified url is invalid. example responseobj.redirect('https://www.example.com', 302); specifications specification status comment fetchthe definition of 'redirect()' in that specification. livi...
Response.redirected - Web APIs
he response is the result of a request you made which was redirected. relying on redirected to filter out redirects makes it easy for a forged redirect to prevent your content from working as expected. instead, you should actually instead do the filtering when you call fetch(). see the example disallowing redirects, which shows this being done. syntax var isredirected = response.redirected; value a boolean which is true if the response indicates that your request was redirected. examples detecting redirects checking to see if the response comes from a redirected request is as simple as checking this flag on the response object. in the code below, a textual message is inserted into an element when a redirect occurred during the fetch operation. note, however, that this isn't as safe as...
Response.status - Web APIs
Web › API › Response › status
the status read-only property of the response interface contains the status code of the response (e.g., 200 for a success). syntax var mystatus = response.status; value a number (to be precise, an unsigned short). example in our fetch response example (see fetch response live) we create a new request object using the request() constructor, passing it a jpg path. we then fetch this request using fetch(), extract a blob from the response using body.blob, create an object url out of it using url.createobjecturl, and display this in an <img>. note that at the top of the fetch() block we log the response status value to the console. var myimage = document.queryselector('img'); var myrequest = new request('flowers.jpg'); fetch(myrequest).then(function(response) { console.log(response.sta...
Response.statusText - Web APIs
the statustext read-only property of the response interface contains the status message corresponding to the status code (e.g., ok for 200). syntax var mystatustext = response.statustext; value a bytestring. the default value is "". example in our fetch response example (see fetch response live) we create a new request object using the request() constructor, passing it a jpg path. we then fetch this request using fetch(), extract a blob from the response using body.blob, create an object url out of it using url.createobjecturl, and display this in an <img>. note that at the top of the fetch() block we log the response statustext value to the console. var myimage = document.queryselector('img'); var myrequest = new request('flowers.jpg'); fetch(myrequest).then(function(response) { ...
Response.type - Web APIs
Web › API › Response › type
paque: response for “no-cors” request to cross-origin resource. severely restricted. opaqueredirect: the fetch request was made with redirect: "manual". the response's status is 0, headers are empty, body is null and trailer is empty. note: an "error" response never really gets exposed to script: such a response to a fetch() would reject the promise. syntax var mytype = response.type; value a responsetype string indicating the type of the response. example in our fetch response example (see fetch response live) we create a new request object using the request() constructor, passing it a jpg path. we then fetch this request using fetch(), extract a blob from the response using body.blob, create an object url out of it using url.createobjecturl, and display this in an <img>. note ...
Response.url - Web APIs
Web › API › Response › url
example in our fetch response example (see fetch response live) we create a new request object using the request() constructor, passing it a jpg path. we then fetch this request using fetch(), extract a blob from the response using body.blob, create an object url out of it using url.createobjecturl, and display this in an <img>. note that at the top of the fetch() block we log the response url to the console. ...
Response.useFinalURL - Web APIs
the usefinalurl property of the response interface contains a boolean stating whether this is the final url of the response. this property applies only to serviceworkers. in other contexts it will return undefined. syntax var isfinalurl = response.usefinalurl; value a boolean indicating whether or not the url is final rather than a redirect. example consider a script residing in page index.html: fetch('/test').then((r) => console.log(r.url)) test.html is being controlled by the service worker sw.js: onfetch = (e) => { e.respondwith(fetch('/page2').then((r) => { r.usefinalurl = true; return r; }) } the output will be /page2 and not /test in index.html, since setting the usefinalurl means that the response's url is not set to request's url. ...
Response - Web APIs
Web › API › Response
onse is the result of a redirect (that is, its url list has more than one entry). response.status read only the status code of the response. (this will be 200 for a success). response.statustext read only the status message corresponding to the status code. (e.g., ok for 200). response.trailers a promise resolving to a headers object, associated with the response with response.headers for values of the http trailer header. response.type read only the type of the response (e.g., basic, cors). response.url read only the url of the response. response.usefinalurl a boolean indicating whether this is the final url of the response. body interface properties response implements body, so it also has the following properties available to it: body.body read only a simple getter ex...
RsaHashedKeyGenParams - Web APIs
ome organizations are now recommending that it should be 4096. publicexponent a uint8array. the public exponent. unless you have a good reason to use something else, specify 65537 here ([0x01, 0x00, 0x01]). hash a domstring representing the name of the digest function to use. you can pass any of sha-256, sha-384, or sha-512 here. warning: although you can technically pass sha-1 as a value here, this is strongly discouraged as sha-1 is considered vulnerable. examples see the examples for subtlecrypto.generatekey(). specifications specification status comment web cryptography apithe definition of 'subtlecrypto.rsahashedkeygenparams' in that specification. recommendation ...
SVGAElement.target - Web APIs
he svgaelement.target read-only property of svgaelement returns an svganimatedstring object that specifies the portion of a target window, frame, pane into which a document is to be opened when a link is activated. this property is used when there are multiple possible targets for the ending resource, like when the parent document is a mlti-frame html or xhtml document. syntax mylink.target = 'value'; value an svganimatedstring indicating the ending resource target that opens the document when the link is activated. sample values can be found here example the code is taken from the "svgaelement example code" ... var linkref = document.queryselector('a'); linkref.target ='_blank'; ... specifications specification status comment scalable vector graphics (svg) 1.
format - Web APIs
the svgaltglyphelement.format property is a domstring that defines the format of the given font. it has the same meaning as the 'format' property of svgglyphrefelement property. if the font is in one of the formats listed in css2([css2], section15.3.5), then its value is the corresponding <string> parameter of the font. syntax string = myglyph.format; myglyph.format = string; value the format values listed below are taken from css2([css2], section15.3.5). string font format examples of common extensions truedoc-pfr truedoc™ portable font resource .pfr embedded-opentype embedded opentype .eot type-1 postscript™ type 1 .pfb, .pfa truetype truetype .ttf opentype opentype, including truetype ope...
SVGAltGlyphElement.glyphRef - Web APIs
the svgaltglyphelement.glyphref property is a domstring representing a glyph identifier. it has the same meaning as the ‘glyphref’ property on the svgglyphrefelement interface of the <glyphref> element. syntax string = myglyph.glyphref; myglyph.glyphref = string; value the return value is a glyph identifier, the value of which depends on the format of the given font. example myglyph.glypref = "#glyphid"; specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'glyphref' in that specification. recommendation ...
SVGAnimatedAngle - Web APIs
is used for attributes of basic type <angle> which can be animated. interface overview also implement none methods none properties readonly svgangle baseval readonly svgangle animval normative document svg 1.1 (2nd edition) properties name type description baseval svgangle the base value of the given attribute before applying any animations. animval svgangle a read only svgangle representing the current animated value of the given attribute. if the given attribute is not currently being animated, then the svgangle will have the same contents as baseval. the object referenced by animval will always be distinct from the one referenced by baseval, even when the attrib...
SVGAnimatedBoolean - Web APIs
nterface is used for attributes of type boolean which can be animated. interface overview also implement none methods none properties readonly boolean baseval readonly boolean animval normative document svg 1.1 (2nd edition) properties name type description baseval boolean the base value of the given attribute before applying any animations. animval boolean if the given attribute or property is being animated, contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated, contains the same value as baseval. methods the svganimatedboolean interface do not provide any specific methods. br...
SVGAnimatedInteger - Web APIs
interface is used for attributes of basic type <integer> which can be animated. interface overview also implement none methods none properties readonly long baseval readonly long animval normative document svg 1.1 (2nd edition) properties name type description baseval long the base value of the given attribute before applying any animations. animval long if the given attribute or property is being animated, contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated, contains the same value as baseval. methods the svganimatedinteger interface do not provide any specific methods. brows...
SVGAnimatedLength - Web APIs
sed for attributes of basic type <length> which can be animated. interface overview also implement none methods none properties readonly svglength baseval readonly svglength animval normative document svg 1.1 (2nd edition) properties name type description baseval svglength the base value of the given attribute before applying any animations. animval svglength if the given attribute or property is being animated, contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated, contains the same value as baseval. methods the svganimatedlength interface do not provide any specific methods. b...
SVGAnimatedLengthList - Web APIs
ributes of type svglengthlist which can be animated. interface overview also implement none methods none properties readonly svglengthlist baseval readonly svglengthlist animval normative document svg 1.1 (2nd edition) properties name type description baseval svglengthlist the base value of the given attribute before applying any animations. animval svglengthlist a read only svglengthlist representing the current animated value of the given attribute. if the given attribute is not currently being animated, then the svglengthlist will have the same contents as baseval. the object referenced by animval will always be distinct from the one referenced by baseval, even ...
SVGAnimatedNumber - Web APIs
number interface is used for attributes of basic type <number> which can be animated. interface overview also implement none methods none properties float baseval readonly float animval normative document svg 1.1 (2nd edition) properties name type description baseval float the base value of the given attribute before applying any animations. animval float if the given attribute or property is being animated, contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated, contains the same value as baseval. methods the svganimatednumber interface do not provide any specific methods. brows...
SVGAnimatedNumberList - Web APIs
h take a list of numbers and which can be animated. interface overview also implement none methods none properties readonly svgnumberlist baseval readonly svgnumberlist animval normative document svg 1.1 (2nd edition) properties svganimatednumberlist.baseval read only is a svgnumberlist that represents the base value of the given attribute before applying any animations. svganimatednumberlist.animval read only is a read only svgnumberlist that represents the current animated value of the given attribute. if the given attribute is not currently being animated, then the svgnumberlist will have the same contents as baseval. the object referenced by animval will always be distinct from the one referenced by b...
SVGAnimatedPathData - Web APIs
eto_abs (m), svg_pathseg_lineto_abs (l), svg_pathseg_curveto_cubic_abs (c) and svg_pathseg_closepath (z). animatedpathseglist svgpathseglist provides access to the current animated contents of the 'd' attribute in a form which matches one-for-one with svg's syntax. if the given attribute or property is being animated, contains the current animated value of the attribute or property, and both the object itself and its contents are read only. normalizedpathseglist svgpathseglist provides access to the base (i.e., static) contents of the 'd' attribute in a form where all path data commands are expressed in terms of the following subset of svgpathseg types: svg_pathseg_moveto_abs (m), svg_pathseg_lin...
SVGAnimatedPreserveAspectRatio - Web APIs
type svgpreserveaspectratio which can be animated. interface overview also implement none methods none properties readonly float baseval readonly float animval normative document svg 1.1 (2nd edition) properties svganimatedpreserveaspectratio.baseval read only is a svgpreserveaspectratio that represents the base value of the given attribute before applying any animations. svganimatedpreserveaspectratio.animval read only is a svgpreserveaspectratio that represents the current animated value of the given attribute. if the given attribute is not currently being animated, then the svgpreserveaspectratio will have the same contents as baseval. the object referenced by animval is always distinct from the one ref...
SVGAnimatedRect - Web APIs
terface is used for attributes of basic svgrect which can be animated. interface overview also implement none methods none properties readonly svgrect baseval readonly svgrect animval normative document svg 1.1 (2nd edition) properties name type description baseval svgrect the base value of the given attribute before applying any animations. animval svgrect a read only svgrect representing the current animated value of the given attribute. if the given attribute is not currently being animated, then the svgrect will have the same contents as baseval. the object referenced by animval will always be distinct from the one referenced by baseval, even when the attribute...
SVGAnimatedString.animVal - Web APIs
animval attribute or animval property contains the same value as the baseval property.if the given attribute or property is being animated, contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated, then it contains the same value as baseval the animval property is a read only property. internet explorer 9 supports script-based svg animation but it does not support declarative-based svg animation. as a result, the animval property contains the same value as the baseval property. syntax var = object.animval specifications specification status comment scalable vector graphics (svg) 1.1 (second edition) recommendation scalable vector graphics (svg) 2 candidate recommendati...
SVGAnimatedString.baseVal - Web APIs
setter throws domexception. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition) recommendation scalable vector graphics (svg) 2 candidate recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
SVGAnimatedString - Web APIs
the svganimatedstring interface represents string attributes which can be animated from each svg declaration. you need to create svg attribute before doing anything else, everything should be declared inside this. properties svganimatedstring.animval read only this is a domstring representing the animation value. if the given attribute or property is being animated it contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated, it contains the same value as baseval. svganimatedstring.baseval this is a domstring representing the base value. the base value of the given attribute before applying any animations. setter throws domexception. methods the svganimatedstring interface do not provide any specific method...
SVGAnimatedTransformList - Web APIs
list of numbers and which can be animated. interface overview also implement none methods none properties readonly svgtransformlist baseval readonly svgtransformlist animval normative document svg 1.1 (2nd edition) properties name type description baseval svgtransformlist the base value of the given attribute before applying any animations. animval svgtransformlist a read only svgtransformlist representing the current animated value of the given attribute. if the given attribute is not currently being animated, then the svgtransformlist will have the same contents as baseval. the object referenced by animval will always be distinct from the one referenced by basev...
SVGAnimationElement: repeatEvent event - Web APIs
the repeatevent event of the svganimationelement interface is fired when the element's local timeline repeats. it will be fired each time the element repeats, after the first iteration. note: associated with the repeatevent event is an integer that indicates which repeat iteration is beginning; this can be found in the detail property of the event object. the value is a 0-based integer, but the repeat event is not raised for the first iteration and so the observed values will be >= 1. this is supported in firefox, but not in chrome. bubbles no cancelable no interface timeevent event handler property onrepeat examples animated circle <svg xmlns="http://www.w3.org/2000/svg" width="300px" height="100px"> <title>svg smil animate with p...
targetElement - Web APIs
the svganimationelement.targetelement property refers to the element which is being animated. if no target element is being animated (for example, because the href attribute specifies an unknown element), the value returned is null. syntax var targetelement = someelement.targetelement; specifications specification status comment svg animations level 2the definition of 'svganimationelement.targetelement' in that specification. editor's draft added null as return value in case that no target element is being animated. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svganimationelement.targetelement' in that specification. recommendation initial definition ...
SVGAnimationElement - Web APIs
animationelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent, svgelement. svganimationelement.targetelement read only an svgelement representing the element which is being animated. if no target element is being animated (for example, because the href specifies an unknown element) the value returned is null. methods this interface also inherits methods from its parent, svgelement. svganimationelement.getstarttime() returns a float representing the begin time, in seconds, for this animation element's current interval, if it exists, regardless of whether the interval has begun yet. if there is no current interval, then a domexception with code invalid_state_err is thrown. svga...
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 svganimatedlength 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 svganimatedlength 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 svganimatedlength 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 graph...
SVGCircleElement - Web APIs
t randomly increases or decreases the radius of the circle element. function clickcircle() { var circle = document.getelementbyid("circle"); // randomly determine if the circle radius will increase or decrease var change = math.random() > 0.5 ? 10 : -10; // clamp the circle radius to a minimum of 10 and a maximum of 250, // so it won't disappear or get bigger than the viewport var newvalue = math.min(math.max(circle.r.baseval.value + change, 10), 250); circle.setattribute("r", newvalue); } click on the circle. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgcircleelement' in that specification. candidate recommendation replaced the inheritance from svgelement, svgtests, svglangspace, svgexternal...
SVGColorProfileElement - Web APIs
ponding to the local attribute of the given element. svgcolorprofileelement.name a domstring corresponding to the name attribute of the given element. svgcolorprofileelement.renderingintent an unsigned short corresponding to the rendering-intent attribute of the given element. it takes one of the rendering_intent_* constants defined on the svgrenderingintent interface that corresponds to the value of the rendering-intent attribute. methods this interface does not provide any specific methods, but implements those of its parent, svgelement, and implements methods of svgurireference and svgrenderingintent. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgcolorprofileelement' in that specification...
SVGDocument - Web APIs
name type description domain domstring the domain name of the server that served the document, or a null string if the server cannot be identified by a domain name. referrer domstring returns the uri of the page that linked to this page. the value is an empty string if the user navigated to the page directly (not through a link, but, for example, via a bookmark). rootelement svgsvgelement the root "svg" in the document hierarchy. title domstring the title of a document as specified by the "title" sub-element of the "svg" root element (i.e., ...
SVGElement - Web APIs
text-anchor="middle" alignment-baseline="middle">svgelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties also inherits properties from: documentandelementeventhandlers, element, elementcssinlinestyle, globaleventhandlers, htmlorforeignelement, svgelementinstance svgelement.datasetread only a domstringmap object which provides a list of key/value pairs of named data attributes which correspond to custom data attributes attached to the element. these can also be defined in svg using attributes of the form data-*, where * is the key name for the pair. this works just like html's htmlelement.dataset property and html's data-* global attribute. svgelement.classname read only an svganimatedstring that reflects the value of the class attrib...
SVGFEDropShadowElement - Web APIs
n element. svgfedropshadowelement.stddeviationy read only an svganimatednumber corresponding to the (possibly automatically computed) y component of the stddeviationy attribute of the given element. methods this interface also inherits methods of its parent, svgelement, and also implements methods of svgfilterprimitivestandardattributes. svgfedropshadowelement.setstddeviation() sets the values for the stddeviation attribute. specifications specification status comment filter effects module level 1the definition of 'svgfedropshadowelement' in that specification. working draft initial definition ...
SVGFEImageElement - Web APIs
gelement, and implements properties of svgfilterprimitivestandardattributes and svgurireference. svgfeimageelement.preserveaspectratio read only an svganimatedpreserveaspectratio corresponding to the preserveaspectratio attribute of the given element. svgfeimageelement.crossorigin read only an svganimatedstring reflects the crossorigin attribute of the given element, limited to only known values. methods this interface does not provide any specific methods, but implements those of its parent, svgelement, and implements methods of svgfilterprimitivestandardattributesand svgurireference. specifications specification status comment filter effects module level 1the definition of 'svgfeimageelement' in that specification. working draft no change sc...
SVGFilterElement - Web APIs
ibute of the given <filter> element. svgfilterelement.filterresx read only an svganimatedinteger that contains the x component of the filterres attribute of the given <filter> element. svgfilterelement.filterresy read only an svganimatedinteger that contains the y component of the filterres attribute of the given <filter> element. methods svgfilterelement.setfilterres() sets the values of the filterres attribute. specifications specification status comment filter effects module level 1the definition of 'svgfilterelement' in that specification. working draft removed the inheritance from svglangspace, svgexternalresourcesrequired, svgstylable, and svgunittypes and removed the setfilterres() function scalable vector graphics (svg) 1.1 (se...
SVGGeometryElement.getPointAtLength() - Web APIs
ggeometryelement.getpointatlength() 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.getpointatlength(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.gettotallength()' in that specification. candidate recommendation initial definition ...
SVGGeometryElement.getTotalLength() - Web APIs
the svggeometryelement.gettotallength() 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.gettotallength(); 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.gettotallength()' in that specification. candidate recommendation initial definition ...
SVGGeometryElement.isPointInFill() - Web APIs
the svggeometryelement.ispointinfill() method determines whether a given point is within the fill shape of an element. normal hit testing rules apply; the value of the pointer-events property on the element determines whether a point is considered to be within the fill. the point argument is interpreted as a point in the local coordiante system of the element. syntax boolean someelement.ispointinfill(dompointinit point); parameters point a dompointinit interpreted as a point in the local coordiante system of the element. return value a boolean indicating whether the given point is within the fill or not. example svg <svg viewbox="0 0 100 100" width="150" height="150" xmlns="http://www.w3.org/2000/svg"> <circle id="circle" cx="50" cy="50" r="45" fill="white" stroke="bl...
SVGGeometryElement.isPointInStroke() - Web APIs
the svggeometryelement.ispointinstroke() method determines whether a given point is within the stroke shape of an element. normal hit testing rules apply; the value of the pointer-events property on the element determines whether a point is considered to be within the stroke. the point argument is interpreted as a point in the local coordiante system of the element. syntax boolean someelement.ispointinstroke(dompointinit point); parameters point a dompointinit interpreted as a point in the local coordinate system of the element. return value a boolean indicating whether the given point is within the stroke or not. example svg <svg viewbox="0 0 100 100" width="150" height="150" xmlns="http://www.w3.org/2000/svg"> <circle id="circle" cx="50" cy="50" r="45" fill="white" ...
getBBox() - Web APIs
with respect to the current svg space (after the application of all geometry attributes on all the elements contained in the target element). note: getbbox() must return the actual bounding box at the time the method was called—even in case the element has not yet been rendered. it also does not account for any transformation applied to the element or its parents. getbbox returns different values than getboundingclientrect(), as the latter returns value relative to the viewport syntax let bboxrect = object.getbbox(); return value the returned value is a svgrect object, which defines the bounding box. this value is irrespective of any transformation attribute applied to it or the parent elements. example html <svg viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"> <g id...
SVGGraphicsElement: paste event - Web APIs
nsert its desired data manually. it's possible to construct and dispatch a synthetic paste event, but this will not affect the document's contents. ...
SVGGraphicsElement - Web APIs
aphicselement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} note: this interface was introduced in svg 2 and replaces the svglocatable and svgtransformable interfaces from svg 1.1. properties this interface also inherits properties from its parent, svgelement. svggraphicselement.transform read only an svganimatedtransformlist reflecting the computed value of the transform property and its corresponding transform attribute of the given element. methods this interface also inherits methods from its parent, svgelement. svggraphicselement.getbbox() returns a domrect representing the computed bounding box of the current element. svggraphicselement.getctm() returns a dommatrix representing the matrix that transforms the current element's coordi...
SVGImageElement.decode - Web APIs
exceptions none. ...
SVGImageElement.height - Web APIs
the height read-only property of the svgimageelement interface returns an svganimatedlength corresponding to the height attribute of the given <image> element. syntax var height = svgimageelement.height value an svganimatedlength. specifications specification status comment scalable vector graphics (svg) 2the definition of 'height' in that specification. candidate recommendation initial definition. ...
SVGImageElement.preserveAspectRatio - Web APIs
the preserveaspectratio read-only property of the svgimageelement interface returns an svganimatedpreserveaspectratio corresponding to the preserveaspectratio attribute of the given <image> element. syntax var svganimatedpreerveaspectratio = svgimageelement.preserveaspectratio; value an svganimatedpreserveaspectratio. specifications specification status comment scalable vector graphics (svg) 2the definition of 'preserveaspectratio' in that specification. candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of 'preserveaspectratio' in that specification. recommendation initial definition ...
SVGImageElement.width - Web APIs
the width read-only property of the svgimageelement interface returns an svganimatedlength corresponding to the width attribute of the given <image> element. syntax var width = svgimageelement.width; value an svganimatedlength. specifications specification status comment scalable vector graphics (svg) 2the definition of 'width' in that specification. candidate recommendation initial definition. ...
SVGImageElement.x - Web APIs
Web › API › SVGImageElement › x
the x read-only property of the svgimageelement interface returns an svganimatedlength corresponding to the x attribute of the given <image> element. syntax var x = svgimageelement.x; value an svganimatedlength. specifications specification status comment scalable vector graphics (svg) 2the definition of 'x' in that specification. candidate recommendation initial definition. ...
SVGImageElement.y - Web APIs
Web › API › SVGImageElement › y
the y read-only property of the svgimageelement interface returns an svganimatedlength corresponding to the y attribute of the given <image> element. syntax var y = svgimageelement.y; value an svganimatedlength. specifications specification status comment scalable vector graphics (svg) 2the definition of 'y' in that specification. candidate recommendation initial definition. ...
SVGLengthList - Web APIs
tself is read only. initialize(in svglength newitem) svglength clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter. if the inserted item is already in a list, it is removed from its previous list before it is inserted into this list. the inserted item is the item itself and not a copy. the return value is the item inserted into the list. exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. getitem(in unsigned long index) svglength returns the specified item from the list. the returned item is the item itself and not a copy. any changes made to ...
SVGMatrix - Web APIs
Web › API › SVGMatrix
post-multiplies a rotation transformation on the current matrix and returns the resulting matrix as svgmatrix. svgmatrix.rotatefromvector() post-multiplies a rotation transformation on the current matrix and returns the resulting matrix as svgmatrix. the rotation angle is determined by taking (+/-) atan(y/x). the direction of the vector (x, y) determines whether the positive or negative angle value is used. svgmatrix.flipx() post-multiplies the transformation [-1 0 0 1 0 0] and returns the resulting matrix as svgmatrix. svgmatrix.flipy() post-multiplies the transformation [1 0 0 -1 0 0] and returns the resulting matrix as svgmatrix. svgmatrix.skewx() post-multiplies a skewx transformation on the current matrix and returns the resulting matrix as svgmatrix. svgmatrix.skewy() post-mul...
SVGNumberList - Web APIs
ct itself is read only. initialize(in svgnumber newitem) svgnumber clears all existing current items from the list and re-initializes the list to hold the single item specified by newitem. if the inserted item is already in a list, it is removed from its previous list before it is inserted into this list. the inserted item is the item itself and not a copy. the return value is the item inserted into the list. exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. getitem(in unsigned long index) svgnumber returns the specified item from the list. the returned item is the item itself and not a copy. any changes mad...
SVGPathElement.getPointAtLength() - Web APIs
the svgpathelement.getpointatlength() 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.getpointatlength(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.gettotallength()' in that specification. recommendation initial definition ...
SVGPathElement.getTotalLength() - Web APIs
the svgpathelement.gettotallength() 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.gettotallength(); 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.gettotallength()' in that specification. recommendation initial definition ...
SVGPathElement - Web APIs
ement.pathlength an svganimatednumber corresponding to the pathlength attribute of the given <path> element. note: in svg 2 this property was moved to the svggeometryelement interface, from which this interface inherits it. methods this interface also inherits methods from its parent, svggeometryelement. svgpathelement.gettotallength() returns a float representing the computed value for the total length of the path using the browser's distance-along-a-path algorithm, as a distance in the current user coordinate system. note: in svg 2 this method was moved to the svggeometryelement interface, from which this interface inherits it. svgpathelement.getpointatlength() returns an svgpoint representing the x and y coordinates in user space utilizing the browser's distance...
SVGPathSegList - Web APIs
nitialize(in svgpathseg newitem) svgpathseg clears all existing current items from the list and re-initializes the list to hold the single item specified by newitem. if the inserted item is already in a list, it is removed from its previous list before it is inserted into this list. the inserted item is the item itself and not a copy. the return value is the item inserted into the list. exceptions: a domexception with code no_modification_allowed_err is raised when the list cannot be modified. getitem(in unsigned long index) svgpathseg returns the specified item from the list. the returned item is the item...
SVGPointList - Web APIs
initialize(in svgpoint newitem) svgpoint clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter. if the inserted item is already in a list, it is removed from its previous list before it is inserted into this list. the inserted item is the item itself and not a copy. the return value is the item inserted into the list. exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. getitem(in unsigned long index) svgpoint returns the specified item from the list. the retu...
The 'X' property - Web APIs
the x property describes the horizontal 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). its syntax is the same as that for <length> // rect draws a rectangle with up...
SVGScriptElement - Web APIs
,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgscriptelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties svgscriptelement.type read only a domstring corresponding to the type attribute of the given <script> element. a domexception is raised with the code no_modification_allowed_err on an attempt to change the value of a read only attribut. svgscriptelement.crossorigin read only a domstring corresponding to the crossorigin attribute of the given <script> element. methods this interface doesn't implement any specific methods, but inherits methods from its parent interface, svgelement. specifications specification status comment scalable vector graphics (svg) 2the definition of ...
SVGURIReference - Web APIs
on getting href, an svganimatedstring object is returned that reflects the href attribute, and if the element is defined to support the deprecated xlink:href attribute, additionally reflects that deprecated attribute. methods this interface does not provide any specific method...
SVGViewElement - Web APIs
the svgviewelement interface provides access to the properties of <view> elements, as well as methods to manipulate them. properties this interface also inherits properties from its parent interface, svgelement. svgviewelement.viewtarget an svgstringlist corresponding to the viewtarget attribute of the given <view> element. a list of domstring values which contain the names listed in the viewtarget attribute. each of the domstring values can be associated with the corresponding element using the getelementbyid() method call. methods this interface doesn't implement any specific methods, but inherits methods from its parent interface, svgelement. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgviewelement' in t...
Screen.lockOrientation() - Web APIs
fault will make it to portrait. note: it's possible to set several locks at the same time. so, if the lock is set for only one orientation, the screen orientation will never change until the screen orientation is unlocked. otherwise, the screen orientation will change from an orientation to another as long as the orientations are amongst the orientations the device has been locked to. return value returns true if the orientation was authorized to be locked or false if the orientation locking was denied. note that the return value doesn't indicate that the screen orientation is indeed locked: there may be a delay. examples usage with a domstring argument screen.lockorientationuniversal = screen.lockorientation || screen.mozlockorientation || screen.mslockorientation; if (screen.lockori...
Screen.mozBrightness - Web APIs
indicates how bright the screen's backlight is, on a scale from 0 (very dim) to 1 (full brightness); this value is a double-precision float. you can read and write this attribute even when the screen is disabled, but the backlight is off while the screen is disabled. if you write a value of x into this attribute, the attribute may not have the same value x when you later read it. most screens don't support as many different brightness levels as there are doubles between 0 and 1. the value's precision might be reduced before storing it. syntax let screenbrightness = window.screen.mozbrightness; specifications not part of specification. ...
Screen.orientation - Web APIs
note that older, prefixed versions returned a domstring equivalent to screenorientation.type. example var orientation = (screen.orientation || {}).type || screen.mozorientation || screen.msorientation; if (orientation === "landscape-primary") { console.log("that looks good."); } else if (orientation === "landscape-secondary") { console.log("mmmh... ...
Screen.unlockOrientation() - Web APIs
the screen.unlockorientation() method removes all the previous screen locks set by the page/app. the screenorientation.unlock() method should be used instead. note: this method only works for installed web apps or for web pages in full-screen mode. syntax var unlocked = window.screen.unlockorientation(); return value returns true if the orientation was successfully unlocked or false if the orientation couldn't be unlocked. example var unlockorientation = screen.unlockorientation || screen.mozunlockorientation || screen.msunlockorientation || (screen.orientation && screen.orientation.unlock); if (unlockorientation()) { // orientation was unlocked } else { // orientation unlock failed } specifications specification status comment screen orientation...
ScreenOrientation.angle - Web APIs
specifications specification status comment screen orientation apithe definition of 'angle' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
ScreenOrientation.lock() - Web APIs
the lock() property of the screenorientation interface locks the orientation of the containing document to its default orientation. syntax screenorientation.lock(orientation) parameters orientation an orientation lock type. one of the following: "any" "natural" "landscape" "portrait" "portrait-primary" "portrait-secondary" "landscape-primary" "landscape-secondary" return value a promise. specifications specification status comment screen orientation apithe definition of 'lock()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and ...
ScreenOrientation.type - Web APIs
specifications specification status comment screen orientation apithe definition of 'type' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. ...
ScreenOrientation.unlock() - Web APIs
specifications specification status comment screen orientation apithe definition of 'unlock()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. ...
Using the Screen Capture API - Web APIs
e stream configuration, and not to filter the available choices. there are three new constraints added to mediatrackconstraints (as well as to mediatracksupportedconstraints and mediatracksettings) for configuring a screen capture stream: cursor indicates whether or not to capture the mouse cursor, and if so, whether to do so all the time or only while the mouse is in motion. the possible values are: always the mouse cursor should always be captured in the generated stream. motion the cursor should only be visible while moving, and, at the discretion of the user agent, for a brief time before after moving. then the cursor is removed from the stream. never the cursor should never be visible in the generated stream. logicalsurface a boolean which if true indicates tha...
ScriptProcessorNode.bufferSize - Web APIs
note: as of the august 29 2014 web audio api spec publication, this feature has been marked as deprecated, and is soon to be replaced by audio workers. the buffersize property of the scriptprocessornode interface returns an integer representing both the input and output buffer size, in sample-frames. its value can be a power of 2 value in the range 256–16384. syntax var audioctx = new audiocontext(); var scriptnode = audioctx.createscriptprocessor(4096, 1, 1); console.log(scriptnode.buffersize); value an integer. example the following example shows basic usage of a scriptprocessornode to take a track loaded via audiocontext.decodeaudiodata(), process it, adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode. for e...
ScriptProcessorNode - Web APIs
number of inputs 1 number of outputs 1 channel count mode "max" channel count 2 (not used in the default count mode) channel interpretation "speakers" properties inherits properties from its parent, audionode. scriptprocessornode.buffersize read only returns an integer representing both the input and output buffer size. its value can be a power of 2 value in the range 256–16384. methods no specific methods; inherits methods from its parent, audionode. events listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface: audioprocess fired when an input buffer of a scriptprocessornode is ready to be processed. also available via the onaudioproces...
SecurityPolicyViolationEvent.blockedURI - Web APIs
the blockeduri read-only property of the securitypolicyviolationevent interface is a usvstring representing the uri of the resource that was blocked because it violates a policy. syntax let blockeduri = violationeventinstance.blockeduri; value a usvstring representing the uri of the blocked resource. example document.addeventlistener("securitypolicyviolation", (e) => { console.log(e.blockeduri); }); specifications specification status comment content security policy level 3the definition of 'blockeduri' in that specification. working draft initial definition ...
SecurityPolicyViolationEvent.columnNumber - Web APIs
the columnnumber read-only property of the securitypolicyviolationevent interface is the column number in the document or worker at which the violation occurred. syntax let colnum = violationeventinstance.columnnumber; value a number representing the column number where the violation occurred. example document.addeventlistener("securitypolicyviolation", (e) => { console.log(e.columnnumber); }); specifications specification status comment content security policy level 3the definition of 'columnnumber' in that specification. working draft initial definition ...
SecurityPolicyViolationEvent.disposition - Web APIs
the disposition read-only property of the securitypolicyviolationevent interface indicates how the violated policy is configured to be treated by the user agent. syntax let disposition = violationeventinstance.disposition; value a value defined in the securitypolicyviolationeventdisposition enum representing the uri of the blocked resource. possible values are "enforce" or "report" example document.addeventlistener("securitypolicyviolation", (e) => { console.log(e.disposition); }); specifications specification status comment content security policy level 3the definition of 'disposition' in that specification. working draft initial definition ...
SecurityPolicyViolationEvent.documentURI - Web APIs
the documenturi read-only property of the securitypolicyviolationevent interface is a usvstring representing the uri of the document or worker in which the violation was found. syntax let documenturi = violationeventinstance.documenturi; value a usvstring representing the uri of the document or worker in which the violation was found. example document.addeventlistener("securitypolicyviolation", (e) => { console.log(e.documenturi); }); specifications specification status comment content security policy level 3the definition of 'documenturi' in that specification. working draft initial definition ...
SecurityPolicyViolationEvent.effectiveDirective - Web APIs
the effectivedirective read-only property of the securitypolicyviolationevent interface is a domstring representing the directive whose enforcement uncovered the violation. syntax let effdir = violationeventinstance.effectivedirective; value a domstring representing the directive whose enforcement uncovered the violation. example document.addeventlistener("securitypolicyviolation", (e) => { console.log(e.effectivedirective); }); specifications specification status comment content security policy level 3the definition of 'effectivedirective' in that specification. working draft initial definition ...
SecurityPolicyViolationEvent.lineNumber - Web APIs
the linenumber read-only property of the securitypolicyviolationevent interface is the line number in the document or worker at which the violation occurred. syntax let linenumber = violationeventinstance.linenumber; value a number representing the line number at which the violation occurred. example document.addeventlistener("securitypolicyviolation", (e) => { console.log(e.linenumber); }); specifications specification status comment content security policy level 3the definition of 'linenumber' in that specification. working draft initial definition ...
SecurityPolicyViolationEvent.originalPolicy - Web APIs
the originalpolicy read-only property of the securitypolicyviolationevent interface is a domstring containing the policy whose enforcement uncovered the violation. syntax let origpolicy = violationeventinstance.originalpolicy; value a domstring representing the policy whose enforcement uncovered the violation. example document.addeventlistener("securitypolicyviolation", (e) => { console.log(e.originalpolicy); }); specifications specification status comment content security policy level 3the definition of 'originalpolicy' in that specification. working draft initial definition ...
SecurityPolicyViolationEvent.referrer - Web APIs
the referrer read-only property of the securitypolicyviolationevent interface is a usvstring representing the referrer of the resources whose policy was violated. this will be a url or null. syntax let referrer = violationeventinstance.referrer; value a usvstring representing the url of the referrer of the violating resources. example document.addeventlistener("securitypolicyviolation", (e) => { console.log(e.referrer); }); specifications specification status comment content security policy level 3the definition of 'referrer' in that specification. working draft initial definition ...
SecurityPolicyViolationEvent.sample - Web APIs
this will only be populated if the resource is an inline script, event handler, or style — external resources causing a violation will not generate a sample. ...
SecurityPolicyViolationEvent.sourceFile - Web APIs
the sourcefile read-only property of the securitypolicyviolationevent interface is a usvstring representing the uri of the document or worker in which the violation was found. syntax let source = violationeventinstance.sourcefile; value a usvstring representing the uri of the document or worker in which the violation was found. example document.addeventlistener("securitypolicyviolation", (e) => { console.log(e.sourcefile); }); specifications specification status comment content security policy level 3the definition of 'sourcefile' in that specification. working draft initial definition ...
SecurityPolicyViolationEvent.statusCode - Web APIs
the statuscode read-only property of the securitypolicyviolationevent interface is a number representing the http status code of the document or worker in which the violation occurred. syntax let status = violationeventinstance.statuscode; value a number representing the status code of the document or worker in which the violation occurred. example document.addeventlistener("securitypolicyviolation", (e) => { console.log(e.statuscode); }); specifications specification status comment content security policy level 3the definition of 'statuscode' in that specification. working draft initial definition ...
SecurityPolicyViolationEvent.violatedDirective - Web APIs
the violateddirective read-only property of the securitypolicyviolationevent interface is a domstring representing the directive whose enforcement uncovered the violation. syntax let violateddir = violationeventinstance.violateddirective; value a domstring representing the directive whose enforcement uncovered the violation. example document.addeventlistener("securitypolicyviolation", (e) => { console.log(e.violateddirective); }); specifications specification status comment content security policy level 3the definition of 'violateddirective' in that specification. working draft initial definition ...
Selection.collapse() - Web APIs
the selection.collapse() method collapses the current selection to a single point. the document is not modified. if the content is focused and editable, the caret will blink there. syntax sel.collapse(node, offset); parameters node the caret location will be within this node. this value can also be set to null — if null is specified, the method will behave like selection.removeallranges(), i.e. all ranges will be removed from the selection. offset optional the offset in node to which the selection will be collapsed. if not specified, the default value 0 is used. examples /* place the caret at the beginning of an html document's body. */ var body = document.getelementsbytagname("body")[0]; window.getselection().collapse(body,0); specifications specificati...
Selection.containsNode() - Web APIs
d node is part of the selection. syntax sel.containsnode(node, partialcontainment) parameters node the node that is being looked for in the selection. partialcontainment optional when true, containsnode() returns true when a part of the node is part of the selection. when false, containsnode() only returns true when the entire node is part of the selection. if not specified, the default value false is used. example check for selection this snippet checks whether anything inside the body element is selected. console.log(window.getselection().containsnode(document.body, true)); find the hidden word in this example, a message appears when you select the secret word. it uses addeventlistener() to check for selectionchange events. html <p>can you find the secret word?</p> <p>hmm, ...
Selection.extend() - Web APIs
Web › API › Selection › extend
hod moves the focus of the selection to a specified point. the anchor of the selection does not move. the selection will be from the anchor to the new focus, regardless of direction. syntax sel.extend(node, offset) parameters node the node within which the focus will be moved. offset optional the offset position within node where the focus will be moved to. if not specified, the default value 0 is used. specifications specification status comment selection apithe definition of 'selection.extend()' in that specification. working draft current browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us...
Selection.getRangeAt() - Web APIs
the selection.getrangeat() method returns a range object representing one of the ranges currently selected. syntax range = sel.getrangeat(index) parameters index the zero-based index of the range to return. a negative number or a number greater than or equal to selection.rangecount will result in an error. return value the specified range object. example let ranges = []; sel = window.getselection(); for(let i = 0; i < sel.rangecount; i++) { ranges[i] = sel.getrangeat(i); } /* each item in the ranges array is now * a range object representing one of the * ranges in the current selection */ specifications specification status comment selection apithe definition of 'selection: getrangeat()' in that specification. working draft current ...
Selection.rangeCount - Web APIs
no selection is visible. a user can normally only select one range at a time, so the rangecount will usually be 1. scripting can be used to make the selection contain more than one range. gecko browsers allow multiple selections across table cells. firefox allows to select multiple ranges in the document by using ctrl+click (unless the click within an element with display: table-cell). syntax value = sel.rangecount example the following example will show the rangecount every second. select text in the browser to see it change. html <table> <tr><td>a.1<td>a.2 <tr><td>b.1<td>b.2 <tr><td>c.1<td>c.2 javascript window.setinterval(function () { console.log(window.getselection().rangecount); }, 1000); result open your console to see how many ranges are in the selection. in gecko...
Selection.removeRange() - Web APIs
* this will remove all ranges except the first. ...
Selection.toString() - Web APIs
description this method returns the currently selected text. in javascript, this method is called automatically when a function the selection object is passed to requires a string: alert(window.getselection()) // what is called alert(window.getselection().tostring()) // what is actually being effectively called. ...
Selection API - Web APIs
the selection api provides functionality for reading and manipulating the range of text selected by the user. concepts and usage to retrieve the current text range the user has selected, you can use the window.getselection() or document.getselection() method, storing the return value — a selection object — in a variable for futher use. once your selection is in a variable, you perform a variety of operations on it, for example copying the selection to a text string using selection.tostring(), adding a range (as represented by a standard range object) to the selection (or removing one) with selection.addrange()/selection.removerange(), or changing the selection to be the entire contents of a dom node using selection.selectallchildren(). you can run code in response to the selection be...
Sensor.activated - Web APIs
Web › API › Sensor › activated
the activated read-only property of the sensor interface returns a boolean indicating whether the sensor is active. syntax var boolean = sensorinstance.activated because sensor is a base class, activated may only be read from one of its derived classes. value a boolean. specifications specification status comment generic sensor apithe definition of 'activated' in that specification. candidate recommendation initial definition. ...
Sensor.hasReading - Web APIs
Web › API › Sensor › hasReading
the hasreading read-only property of the sensor interface returns a boolean indicating whether the sensor has a reading. syntax var boolean = sensorinstance.hasreading because sensor is a base class, hasreading may only be read from one of its derived classes. value a boolean. specifications specification status comment generic sensor apithe definition of 'hasreading' in that specification. candidate recommendation initial definition. ...
Sensor.start() - Web APIs
Web › API › Sensor › start
the start method activates one of the sensors based on sensor. syntax sensor.start() parameters none. return value undefined specifications specification status comment generic sensor apithe definition of 'start' in that specification. candidate recommendation initial definition. ...
Sensor.stop() - Web APIs
Web › API › Sensor › stop
the stop method of the sensor interface deactivates the current sensor. syntax sensor.stop() parameters none. return value undefined example // tbd specifications specification status comment generic sensor apithe definition of 'stop' in that specification. candidate recommendation initial definition. ...
Sensor.timestamp - Web APIs
Web › API › Sensor › timestamp
the timestamp read-only property of the sensor interface returns the time stamp of the latest sensor reading. syntax var timestamp = sensorinstance.timestamp because sensor is a base class, timestamp may only be read from one of its derived classes. value a domhighrestimestamp. specifications specification status comment generic sensor apithe definition of 'timestamp' in that specification. candidate recommendation initial definition. ...
SensorErrorEvent.error - Web APIs
the error read-only property of the sensorerrorevent interface returns the domexception object passed in the event's contructor. syntax var domexception = sensorerrorevent.error; value a domexception. specifications specification status comment generic sensor apithe definition of 'error' in that specification. candidate recommendation initial definition. ...
ServiceWorker.onstatechange - Web APIs
s fired; it is basically fired anytime the serviceworker.state changes. syntax serviceworker.onstatechange = function(statechangeevent) { ... } serviceworker.addeventlistener('statechange', function(statechangeevent) { ... } ) examples this code snippet is from the service worker registration-events sample (live demo). the code listens for any change in the serviceworker.state and returns its value. var serviceworker; if (registration.installing) { serviceworker = registration.installing; document.queryselector('#kind').textcontent = 'installing'; } else if (registration.waiting) { serviceworker = registration.waiting; document.queryselector('#kind').textcontent = 'waiting'; } else if (registration.active) { serviceworker = registration.active; document.queryselector('#kind').t...
ServiceWorker.scriptURL - Web APIs
returns the serviceworker serialized script url defined as part of serviceworkerregistration. must be on the same origin as the document that registers the serviceworker. syntax someurl = serviceworker.scripturl value a usvstring (see the webidl definition of usvstring.) examples tbd specifications specification status comment service workersthe definition of 'scripturl' in that specification. working draft initial definition ...
ServiceWorker.state - Web APIs
the state read-only property of the serviceworker interface returns a string representing the current state of the service worker. it can be one of the following values: installing, installed, activating, activated, or redundant. syntax someurl = serviceworker.state value a serviceworkerstate definition (see the spec.) examples this code snippet is from the service worker registration-events sample (live demo). the code listens for any change in the serviceworker.state and returns its value. var serviceworker; if (registration.installing) { serviceworker = registration.installing; document.queryselector('#kind').textcontent = 'installing'; } else if (registration.waiting) { serviceworker = registration.waiting; document.queryselector('#kind').textcontent = 'waiting'; } else if ...
ServiceWorkerContainer.controller - Web APIs
the controller read-only property of the serviceworkercontainer interface returns a serviceworker object if its state is activated (the same object returned by serviceworkerregistration.active). this property returns null if the request is a force refresh (shift + refresh) or if there is no active worker. syntax var mycontroller = navigator.serviceworker.controller; value a serviceworker object. example if ('serviceworker' in navigator) { // do a one-off check to see if a service worker's in control. if (navigator.serviceworker.controller) { console.log(`this page is currently controlled by: ${navigator.serviceworker.controller}`); } else { console.log('this page is not currently controlled by a service worker.'); } } else { console.log('service workers are not support...
ServiceWorkerContainer.getRegistration() - Web APIs
document url. the method returns a promise that resolves to a serviceworkerregistration or undefined. syntax serviceworkercontainer.getregistration(scope).then(function(serviceworkerregistration) { ... }); parameters scope optional a unique identifier for a service worker registration — the scope url of the registration object you want to return. this is usually a relative url. return value a promise that resolves to a serviceworkerregistration object or undefined. example navigator.serviceworker.getregistration('/app').then(function(registration) { if(registration){ document.queryselector('#status').textcontent = 'serviceworkerregistration found.'; } }); specifications specification status comment service workersthe definition of 'serviceworke...
ServiceWorkerContainer.getRegistrations() - Web APIs
the getregistrations() method of the serviceworkercontainer interface gets all serviceworkerregistrations associated with a serviceworkercontainer, in an array. the method returns a promise that resolves to an array of serviceworkerregistration. syntax serviceworkercontainer.getregistrations().then(function(serviceworkerregistrations) { ... }); parameters none. return value a promise that resolves to an array of serviceworkerregistration objects. example navigator.serviceworker.getregistrations().then(function(registrations) { document.queryselector('#status').textcontent = 'serviceworkerregistrations found.'; }); specifications specification status comment service workersthe definition of 'getregistrations()' in that specification. working draft initi...
ServiceWorkerContainer.ready - Web APIs
a way of delaying code execution until a service worker is active. it returns a promise that will never reject, and which waits indefinitely until the serviceworkerregistration associated with the current page has an active worker. once that condition is met, it resolves with the serviceworkerregistration. syntax navigator.serviceworker.ready.then(function(serviceworkerregistration) { ... }); value a promise that will never reject, and which may eventually resolve with a serviceworkerregistration. example if ('serviceworker' in navigator) { navigator.serviceworker.ready .then(function(registration) { console.log('a service worker is active:', registration.active); // at this point, you can call methods that require an active // service worker, like registration.pushmanag...
ServiceWorkerContainer.startMessages() - Web APIs
e invoked a message handler using eventtarget.addeventlistener() before the page has finished loading, but want to start processing the messages right away. note: the messages start being sent automatically when setting the handler directly using serviceworkercontainer.onmessage. in this you don't need startmessages(). syntax serviceworkercontainer.startmessages(); parameters none. return value undefined. examples if('serviceworker' in navigator) { navigator.serviceworker .register('/sw.js') .then(function() { console.log('service worker registered'); }); } // ... navigator.serviceworker.addeventlistener('message', (e) => { // ... }); navigator.serviceworker.startmessages(); specifications specification status comment service wo...
ServiceWorkerGlobalScope.caches - Web APIs
the caches read-only property of the serviceworkerglobalscope interface returns the cachestorage object associated with the service worker. syntax var mycachestorage = self.caches; value a cachestorage object. specifications specification status comment service workersthe definition of 'serviceworkerglobalscope.caches' in that specification. working draft initial definition. ...
ServiceWorkerGlobalScope.clients - Web APIs
the clients read-only property of the serviceworkerglobalscope interface returns the clients object associated with the service worker. syntax swclients = self.clients value the clients object associated with the specific worker. specifications specification status comment service workersthe definition of 'serviceworkerregistration.clients' in that specification. working draft initial definition. ...
ServiceWorkerGlobalScope.registration - Web APIs
the registration read-only property of the serviceworkerglobalscope interface returns a reference to the serviceworkerregistration object, which represents the service worker's registration. syntax serviceworkerregistration = self.registration value a serviceworkerregistration object. specifications specification status comment service workersthe definition of 'serviceworkerglobalscope.registration' in that specification. working draft initial definition. ...
ServiceWorkerMessageEvent.data - Web APIs
important: in modern browsers, this property has been deprecated. service worker messages will now use the messageevent interface, for consistency with other web messaging features. the data read-only property of the serviceworkermessageevent interface returns the event's data. it can be any data type. syntax var mydata = serviceworkermessageeventinstance.data; value any data type. examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent. navigator.serviceworker.ready.then(function(reg) { ... // set up a message channel to communicate with the sw var channel = new messagechannel(); channel.po...
ServiceWorkerMessageEvent.lastEventId - Web APIs
modern browsers, this property has been deprecated. service worker messages will now use the messageevent interface, for consistency with other web messaging features. the lasteventid read-only property of the serviceworkermessageevent interface represents, in server-sent events, the last event id of the event source. syntax var mylasteventid = serviceworkermessageeventinstance.lasteventid; value a domstring. examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent. navigator.serviceworker.ready.then(function(reg) { ... // set up a message channel to communicate with the sw var channel = new messagech...
ServiceWorkerMessageEvent.origin - Web APIs
important: in modern browsers, this property has been deprecated. service worker messages will now use the messageevent interface, for consistency with other web messaging features. the origin read-only property of the serviceworkermessageevent interface returns the origin of the service worker's environment settings object. syntax var myorigin = serviceworkermessageeventinstance.origin; value a domstring. examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent. navigator.serviceworker.ready.then(function(reg) { ... // set up a message channel to communicate with the sw var channel = new messagech...
ServiceWorkerMessageEvent.ports - Web APIs
this property has been deprecated. service worker messages will now use the messageevent interface, for consistency with other web messaging features. the ports read-only property of the serviceworkermessageevent interface returns an array of messageport objects connected with the message channel the message is being sent through. syntax var myports = serviceworkermessageeventinstance.ports; value an array of messageport objects. examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent. navigator.serviceworker.ready.then(function(reg) { ... // set up a message channel to communicate with the sw var cha...
ServiceWorkerMessageEvent.source - Web APIs
rn browsers, this property has been deprecated. service worker messages will now use the messageevent interface, for consistency with other web messaging features. the source read-only property of the serviceworkermessageevent returns a reference to the serviceworker object of the associated service worker that sent the message. syntax var mysource = serviceworkermessageeventinstance.source; value a serviceworker or messageport object. examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent. navigator.serviceworker.ready.then(function(reg) { ... // set up a message channel to communicate with the sw v...
ServiceWorkerRegistration.active - Web APIs
service worker whose serviceworker.state is activated. this property is initially set to null. an active worker controls a serviceworkerclient if the client's url falls within the scope of the registration (the scope option set when serviceworkercontainer.register is first called.) note: this feature is available in web workers. syntax var serviceworker = serviceworkerregistration.active; value a serviceworker object's property, if it is currently in an activated state. specifications specification status comment service workersthe definition of 'serviceworkerregistration.active' in that specification. working draft initial definition. ...
ServiceWorkerRegistration.getNotifications() - Web APIs
orkers on that same origin. syntax s​erviceworkerregistration.getnotifications(options) .then(function(notificationslist) { ... }); parameters options optional an object containing options to filter the notifications returned. the available options are: tag: a domstring representing a notification tag. if specified, only notifications that have this tag will be returned. return value a promise that resolves to a list of notification objects. example navigator.serviceworker.register('sw.js'); var options = { tag : 'user_alerts' }; navigator.serviceworker.ready.then(function(registration) { registration.getnotifications(options).then(function(notifications) { // do something with your notifications }) }); specifications specification status comment...
ServiceWorkerRegistration.index - Web APIs
the index read-only property of the serviceworkerregistration interface returns a reference to the contentindex interface, which allows for indexing of offline content. syntax var a contentindex object = serviceworkerregistration.index; value a contentindex object examples you can access the property from either your main script or the registered service worker. here is an example from the main script: // reference registration const registration = await navigator.serviceworker.ready; // feature detection if ('index' in registration) { // content index api functionality const contentindex = registration.index; } from the service worker: // service worker script const contentindex = self.registration.index; specifications specification status comm...
ServiceWorkerRegistration.installing - Web APIs
the installing property of the serviceworkerregistration interface returns a service worker whose serviceworker.state is installing. this property is initially set to null. note: this feature is available in web workers. syntax var serviceworker = serviceworkerregistration.installing; value a serviceworker object, if it is currently in an installing state. specifications specification status comment service workersthe definition of 'serviceworkerregistration.installing' in that specification. working draft initial definition. ...
ServiceWorkerRegistration.navigationPreload - Web APIs
specifications specification status comment service workersthe definition of 'navigationpreload' in that specification. working draft initial definition. ...
ServiceWorkerRegistration.periodicSync - Web APIs
examples // tbd specifications currently not part of any specification. ...
ServiceWorkerRegistration.pushManager - Web APIs
the pushmanager property of the serviceworkerregistration interface returns a reference to the pushmanager interface for managing push subscriptions; this includes support for subscribing, getting an active subscription, and accessing push permission status. syntax var pushmanager = serviceworkerregistration.pushmanager; value a pushmanager object. examples this.onpush = function(event) { console.log(event.data); // from here we can write the data to indexeddb, send it to any open // windows, display a notification, etc. } navigator.serviceworker.register('serviceworker.js').then( function(serviceworkerregistration) { serviceworkerregistration.pushmanager.subscribe().then( function(pushsubscription) { console.log(pushsubscription.subscriptionid); conso...
ServiceWorkerRegistration.sync - Web APIs
the sync property of the serviceworkerregistration interface returns a reference to the syncmanager interface, which manages background synchronization processes. syntax var syncmanager = serviceworkerregistration.sync; value a syncmanager object. specifications specification status comment web background synchronization living standard initial definition. ...
ServiceWorkerRegistration.unregister() - Web APIs
e irrespective of whether unregistration happened or not (it may not unregister if someone else just called serviceworkercontainer.register() with the same scope.) the service worker will finish any ongoing operations before it is unregistered. note: this feature is available in web workers. syntax serviceworkerregistration.unregister().then(function(boolean) { }); parameters none. return value promise resolves with a boolean indicating whether the service worker has unregistered or not. example the following simple example registers a service worker example, but then immediately unregisters it again: if ('serviceworker' in navigator) { navigator.serviceworker.register('/sw-test/sw.js', {scope: 'sw-test'}).then(function(registration) { // registration worked console.log('r...
ServiceWorkerRegistration.update() - Web APIs
empts to update the service worker. it fetches the worker's script url, and if the new worker is not byte-by-byte identical to the current worker, it installs the new worker. the fetch of the worker bypasses any browser caches if the previous fetch occurred over 24 hours ago. note: this feature is available in web workers. syntax serviceworkerregistration.update(); parameters none. return value a promise that resolves with a serviceworkerregistration object. example the following simple example registers a service worker example then adds an event handler to a button so you can explicitly update the service worker whenever desired: if ('serviceworker' in navigator) { navigator.serviceworker.register('/sw-test/sw.js', {scope: 'sw-test'}).then(function(registration) { // registr...
ServiceWorkerRegistration.waiting - Web APIs
the waiting property of the serviceworkerregistration interface returns a service worker whose serviceworker.state is installed. this property is initially set to null. note: this feature is available in web workers. syntax var serviceworker = serviceworkerregistration.waiting; value a serviceworker object, if it is currently in an installed state. specifications specification status comment service workersthe definition of 'serviceworkerregistration.waiting' in that specification. working draft initial definition. ...
ServiceWorkerState - Web APIs
during this state, extendableevent.waituntil() can be called inside the install event handler to extend the life of the installing worker until the passed promise resolves successfully. this is primarily used to ensure that the service worker is not active until all of the core caches are populated. installed the service worker in this state is considered a waiting worker. activating the service worker in this state is considered an active worker. ...
ShadowRoot.delegatesFocus - Web APIs
the delegatesfocus read-only property of the shadowroot interface returns a boolean that indicates whether delegatesfocus was set when the shadow was attached (see element.attachshadow()). this is currently an experimental non-standard feature, available only in chrome. syntax var df = shadowroot.delegatesfocus value a boolean value — true if the shadow root does delegate focus, false if it doesn't. examples let customelem = document.queryselector('my-shadow-dom-element'); let shadow = customelem.shadowroot; ... // does it delegate focus? let hostelem = shadow.delegatesfocus; specifications this feature is not currently in a specification. ...
ShadowRoot.host - Web APIs
Web › API › ShadowRoot › host
examples let customelem = document.queryselector('my-shadow-dom-element'); let shadow = customelem.shadowroot; ... ...
ShadowRoot.innerHTML - Web APIs
the innerhtml property of the shadowroot interface sets or returns a reference to the dom tree inside the shadowroot. syntax var domstring = shadowroot.innerhtml shadowroot.innerhtml = domstring value a domstring. examples let customelem = document.queryselector('my-shadow-dom-element'); let shadow = customelem.shadowroot; shadow.innerhtml = '<strong>this element should be more important!</strong>'; specifications this property is not defined by any specifications yet; see this open spec issue to specify it. ...
ShadowRoot.mode - Web APIs
Web › API › ShadowRoot › mode
ines whether or not the shadow root's internal features are accessible from javascript. when the mode of a shadow root is "closed", the shadow root’s implementation internals are inaccessible and unchangeable from javascript—in the same way the implementation internals of, for example, the <video> element are inaccessible and unchangeable from javascript. syntax var mode = shadowroot.mode value a value defined in the shadowrootmode enum — either open or closed. examples let customelem = document.queryselector('my-shadow-dom-element'); let shadow = customelem.shadowroot; // another way to check whether the shadow root is open; it will return null if not if(shadow) { // if it is open, close it to stop people stealing our secrets! shadow.mode = 'closed'; } specifications ...
ShadowRoot - Web APIs
> element's class definition we include some life cycle callbacks that make a call to an external function, updatestyle(), which actually applies the size and color to the element. you'll see that we are passing it this (the custom element itself) as a parameter. connectedcallback() { console.log('custom square element added to page.'); updatestyle(this); } attributechangedcallback(name, oldvalue, newvalue) { console.log('custom square element attributes changed.'); updatestyle(this); } in the updatestyle() function itself, we get a reference to the shadow dom using element.shadowroot. from here we use standard dom traversal techniques to find the <style> element inside the shadow dom and then update the css found inside it: function updatestyle(elem) { var shadow = elem.shadowroo...
SharedWorker.port - Web APIs
Web › API › SharedWorker › port
example the following code snippet shows creation of a sharedworker object using the sharedworker() constructor. ...
SharedWorkerGlobalScope.applicationCache - Web APIs
er available in insecure contexts from firefox 60 onwards (bug 1354175, currently nightly/beta only). don't use it to make offline websites — consider using service workers instead. the applicationcache read-only property of the sharedworkerglobalscope interface returns the applicationcache object for the worker (see using the application cache). syntax var nameobj = self.applicationcache; value an applicationcache. example if a shared worker has an appcache associated with it, you can return a reference to the cache using self.applicationcache from inside the shared worker. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a ...
SharedWorkerGlobalScope.name - Web APIs
the name read-only property of the sharedworkerglobalscope interface returns the name that the sharedworker was (optionally) given when it was created. this is the name that the sharedworker() constructor can pass to get a reference to the sharedworkerglobalscope. syntax var nameobj = self.name; value a domstring. example if a shared worker is created using a constructor with a name option: var myworker = new sharedworker("worker.js", { name : "mysharedworker" }); the sharedworkerglobalscope will now have a name of "mysharedworker", returnable by running self.name from inside the shared worker. specifications specification status comment html living standardthe definition of 'name' in that specification. living standard ...
SourceBuffer.abort() - Web APIs
exceptions exception explanation invalidstateerror the mediasource.readystate property of the parent media source is not equal to open, or this sourcebuffer has been removed from the mediasource. example the spec description of abort() is somewhat confusing — consider for example step 1 of reset parser state. ...
SourceBuffer.appendBuffer() - Web APIs
the appendbuffer() method of the sourcebuffer interface appends media segment data from an arraybuffer or arraybufferview object to the sourcebuffer. syntax sourcebuffer.appendbuffer(source); parameters source a buffersource (that is, either an arraybufferview or arraybuffer) which contains the media segment data you want to add to the sourcebuffer. return value undefined. exceptions none. example tbd. specifications specification status comment media source extensionsthe definition of 'appendbuffer()' in that specification. recommendation initial definition. ...
SourceBuffer.appendBufferAsync() - Web APIs
media segment data from an arraybuffer or arraybufferview object to the sourcebuffer. it returns a promise which is fulfilled once the buffer has been appended. syntax appendpromise = sourcebuffer.appendbufferasync(source); parameters source a buffersource (that is, either an arraybufferview or arraybuffer) which contains the media segment data you want to add to the sourcebuffer. return value a promise which is fulfilled when the buffer has been added successfully to the sourcebuffer, or null if the request could not be initiated. example this simplified example async function, fillsourcebuffer(), takes as input parameters buffersource, buffer, and a sourcebuffer to which to append the source media from the buffer. async function fillsourcebuffer(buffer, msbuffer) { try { wh...
SourceBuffer.appendStream() - Web APIs
the appendstream() method of the sourcebuffer interface appends media segment data from a readablestream object to the sourcebuffer. syntax sourcebuffer.appendstream(stream, maxsize); parameters stream the readablestream that is the source of the media segment data you want to append to the sourcebuffer. maxsize an unsigned long value indicating the maximum number of bytes that can be appended in this operation. return value undefined. exceptions none. example tbd. ...
SourceBuffer.audioTracks - Web APIs
the audiotracks read-only property of the sourcebuffer interface returns a list of the audio tracks currently contained inside the sourcebuffer. syntax var myaudiotracks = sourcebuffer.audiotracks; value an audiotracklist object. example tbd specifications specification status comment media source extensionsthe definition of 'audiotracks' in that specification. recommendation initial definition. ...
SourceBuffer.buffered - Web APIs
the buffered read-only property of the sourcebuffer interface returns the time ranges that are currently buffered in the sourcebuffer as a normalized timeranges object. syntax var mybufferedrange = sourcebuffer.buffered; value a timeranges object. example tbd specifications specification status comment media source extensionsthe definition of 'buffered' in that specification. recommendation initial definition. ...
SourceBuffer.changeType() - Web APIs
makes it possible to change codecs or container type mid-stream. one scenario in which this is helpful is to support adapting the media source to changing bandwidth availability, by transitioning from one codec to another as resource constraints change. syntax sourcebuffer.changetype(type); parameters type a domstring specifying the mime type that future buffers will conform to. return value undefined. exceptions typeerror the specified string is empty, rather than indicating a valid mime type. invalidstateerror the sourcebuffer is not a member of the parent media source's sourcebuffers list, or the buffer's updating property indicates that a previously queued appendbuffer() or remove() is still being processed. notsupportederror the specified mime type is not supported, or...
SourceBuffer.remove() - Web APIs
hin a specific time range from the sourcebuffer. this method can only be called when sourcebuffer.updating equals false. if sourcebuffer.updating is not equal to false, call sourcebuffer.abort(). syntax sourcebuffer.remove(start, end); parameters start a double representing the start of the time range, in seconds. end a double representing the end of the time range, in seconds. return value undefined. exceptions exception explanation invalidaccesserror the mediasource.duration property is equal to nan, the start parameter is negative or greater than mediasource.duration, or the end parameter is less than or equal to start or equal to nan. invalidstateerror the sourcebuffer.updating property is equal to true, or this sourcebuffer has been re...
SourceBuffer.removeAsync() - Web APIs
fulfilled when the buffers in the specified time range have been removed. this method can only be called when updating is false. if that's not the case, call abort() instead. syntax removepromise = sourcebuffer.removeasync(start, end); parameters start a double representing the start of the time range, in seconds. end a double representing the end of the time range, in seconds. return value a promise whose fulfillment handler is executed once the buffers in the specified time range have been removed from the sourcebuffer. example this example establishes an asynchronous function, emptysourcebuffer(), which simply clears the contents of the specified sourcebuffer. async function emptysourcebuffer(msbuffer) { await msbuffer.removeasync(0, infinity).catch(function(e) { handle...
SourceBuffer.textTracks - Web APIs
the texttracks read-only property of the sourcebuffer interface returns a list of the text tracks currently contained inside the sourcebuffer. syntax var mytexttracks = sourcebuffer.texttracks; value an texttracklist object. example tbd specifications specification status comment media source extensionsthe definition of 'texttracks' in that specification. recommendation initial definition. ...
SourceBuffer.timestampOffset - Web APIs
the timestampoffset property of the sourcebuffer interface controls the offset applied to timestamps inside media segments that are appended to the sourcebuffer. the initial value of timestampoffset is 0. syntax var myoffset = sourcebuffer.timestampoffset; sourcebuffer.timestampoffset = 2.5; value a double, with the offset amount expressed in seconds. exceptions the following exceptions may be thrown when setting a new value for this property. exception explanation invalidstateerror one or more of the sourcebuffer objects in mediasource.sourcebuffers are being updated (i.e. their sourcebuffer.updating property is currently true), a media segment inside the sourcebuffer is currently being parsed, or this sourcebuffer has been removed from the med...
SourceBuffer.updating - Web APIs
the updating read-only property of the sourcebuffer interface indicates whether the sourcebuffer is currently being updated — i.e. whether an sourcebuffer.appendbuffer(), sourcebuffer.appendstream(), or sourcebuffer.remove() operation is currently in progress. syntax var isupdating = sourcebuffer.updating; value a boolean. example tbd specifications specification status comment media source extensionsthe definition of 'updating' in that specification. recommendation initial definition. ...
SourceBuffer.videoTracks - Web APIs
the videotracks read-only property of the sourcebuffer interface returns a list of the video tracks currently contained inside the sourcebuffer. syntax var myvideotracks = sourcebuffer.videotracks; value an videotracklist object. example tbd specifications specification status comment media source extensionsthe definition of 'videotracks' in that specification. recommendation initial definition. ...
SourceBufferList: indexed property getter - Web APIs
the indexed property getter of the sourcebufferlist interface allows the sourcebuffer objects in the list to be accessed with an array operator (i.e. [].) syntax var mysourcebuffer = sourcebufferlist[index]; parameters index the index position of the sourcebuffer object you want to return. return value a sourcebuffer object. exceptions no specific exceptions are thrown, but if the supplied index is great than or equal to sourcebufferlist.length, the operation will return undefined. example tbd. specifications specification status comment media source extensionsthe definition of 'sourcebuffer() getter' in that specification. recommendation initial definition. ...
SourceBufferList.length - Web APIs
the length read-only property of the sourcebufferlist interface returns the number of sourcebuffer objects in the list. syntax var mylistlength = sourcebufferlist.length; value an unsigned long number. example tbd specifications specification status comment media source extensionsthe definition of 'length' in that specification. recommendation initial definition. ...
SpeechGrammar.src - Web APIs
Web › API › SpeechGrammar › src
the src property of the speechgrammar interface sets and returns a string containing the grammar from within in the speechgrammar object. syntax var mygrammar = speechgrammarinstance.src; value a domstring representing the grammar. 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 speechrecognition(); var speechrecognitionlist = new speechgrammarlis...
SpeechGrammar.weight - Web APIs
the optional weight property of the speechgrammar interface sets and returns the weight of the speechgrammar object. syntax var mygrammarweight = speechgrammarinstance.weight; value a float representing the weight of the grammar, in the range 0.0–1.0. 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 speechrecognition(); var speechrecognitionlist ...
SpeechGrammarList.addFromString() - Web APIs
chgrammarlistinstance.addfromstring(string,weight); returns void. parameters string a domstring representing the grammar to be added. weight optional a float representing the weight of the grammar relative to other grammars present in the speechgrammarlist. the weight means the importance of this grammar, or the likelihood that it will be recognised by the speech recognition service. the value can be between 0.0 and 1.0; if not specified, the default used is 1.0. 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 | or...
SpeechGrammarList.addFromURI() - Web APIs
grammarlistinstance.addfromuri(src,weight); returns void. parameters src a domstring representing the uri of the grammar to be added. weight optional a float representing the weight of the grammar relative to other grammars present in the speechgrammarlist. the weight means the importance of this grammar, or the likelihood that it will be recognised by the speech recognition service. the value can be between 0.0 and 1.0; if not specified, the default used is 1.0. 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 | or...
SpeechGrammarList.length - Web APIs
the length read-only property of the speechgrammarlist interface returns the number of speechgrammar objects contained in the speechgrammarlist. syntax var mylistlength = speechgrammarlistinstance.length; value a number indicating the number of speechgrammar objects contained in the speechgrammarlist. examples var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = ne...
SpeechRecognition.continuous - Web APIs
the continuous property of the speechrecognition interface controls whether continuous results are returned for each recognition, or only a single result. it defaults to single results (false.) syntax var mycontinuous = myspeechrecognition.continuous; myspeechrecognition.continuous = true; value a boolean representing the current speechrecognition's continuous status. true means continuous, and false means not continuous (single result each time.) examples this code is excerpted from our speech color changer example. 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 | ma...
SpeechRecognition.grammars - Web APIs
the grammars property of the speechrecognition interface returns and sets a collection of speechgrammar objects that represent the grammars that will be understood by the current speechrecognition. syntax var mygrammars = myspeechrecognition.grammars; myspeechrecognition.grammars = myspeechgrammarlist; value a speechgrammarlist containing the speechgrammar objects that represent your grammar for your app. examples this code is excerpted from our speech color changer example. 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 | o...
SpeechRecognition.interimResults - Web APIs
the interimresults property of the speechrecognition interface controls whether interim results should be returned (true) or not (false.) interim results are results that are not yet final (e.g. the speechrecognitionresult.isfinal property is false.) the default value for interimresults is false. syntax var myinterimresult = myspeechrecognition.interimresults; myspeechrecognition.interimresults = false; value a boolean representing the state of the current speechrecognition's interim results. true means interim results are returned, and false means they aren't. examples this code is excerpted from our speech color changer example. var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | c...
SpeechRecognition.serviceURI - Web APIs
examples var recognition = new speechrecognition(); recognition.serviceuri = 'http://www.example.com'; ... ...
SpeechRecognition.start() - Web APIs
the start() method of the web speech api starts the speech recognition service listening to incoming audio with intent to recognize grammars associated with the current speechrecognition. syntax myspeechrecognition.start(); parameters none. return value void. 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 speechrecognition(); var speechrecognit...
SpeechRecognitionError.error - Web APIs
the possible error types are: no-speech no speech was detected. aborted speech input was aborted in some manner, perhaps by some user-agent-specific behavior like a button the user can press to cancel speech input. ...
SpeechRecognitionError.message - Web APIs
the message read-only property of the speechrecognitionerror interface returns a message describing the error in more detail. this speechrecognitionerror interface was renamed to speechrecognitionerrorevent in the web speech api specification. syntax var myerrormsg = event.message; value a domstring containing more details about the error that was raised. note that the spec does not define the exact wording of these messages — this is up to the implementors to decide upon. examples var recognition = new speechrecognition(); recognition.onerror = function(event) { console.log('speech recognition error detected: ' + event.error); console.log('additional information: ' + event.message); } ...
SpeechRecognitionErrorEvent.error - Web APIs
the possible error types are: no-speech no speech was detected. aborted speech input was aborted in some manner, perhaps by some user-agent-specific behavior like a button the user can press to cancel speech input. audio-capture audio capture failed. network network communication required for completing the recognition failed. ...
SpeechRecognitionErrorEvent.message - Web APIs
note that the spec does not define the exact wording of these messages — this is up to the implementors to decide upon. ...
SpeechRecognitionEvent.emma - Web APIs
the emma read-only property of the speechrecognitionevent interface returns an extensible multimodal annotation markup language (emma) — xml — representation of the result. note: emma is defined in the specification emma: extensible multimodal annotation markup language. you can see muliple emma examples in the spec. syntax var myemma = event.emma; value a valid xml document. the exact contents can vary across user agents and recognition engines, but all supporting implementations will expose a valid xml document complete with an emma namespace. if the speech recognition system does not supply emma data then the user agent will return null. examples recognition.onresult = function(event) { var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received...
SpeechRecognitionEvent.interpretation - Web APIs
the interpretation read-only property of the speechrecognitionevent interface returns the semantic meaning of what the user said. this might be determined, for instance, through the sisr specification of semantics in a grammar (see semantic interpretation for speech recognition (sisr) version 1.0 for specification and examples.) syntax var myinterpretation = event.interpretation; value the returned value can be of any type. if no semantic interpretation has been returned by the speec recognition system, null will be returned. examples recognition.onresult = function(event) { var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; console.log(event.interpretation); } ...
SpeechRecognitionEvent.resultIndex - Web APIs
the resultindex read-only property of the speechrecognitionevent interface returns the lowest index value result in the speechrecognitionresultlist "array" that has actually changed. the speechrecognitionresultlist object is not an array, but it has a getter that allows it to be accessed by array syntax. syntax var myresultindex = event.resultindex; value a number. examples recognition.onresult = function(event) { var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; console.log(event.resultindex); // returns 0 if there is only one result } specifications specification status comment web speech apithe definition of 'resultindex' in that specification. draft...
SpeechRecognitionEvent.results - Web APIs
d by the current best hypothesis for all interim results. when subsequent result events are fired, interim results may be overwritten by a newer interim result or by a final result — they may even be removed, if they are at the end of the "results" array and the array length decreases. final results on the other hand will not be overwritten or removed. syntax var myresults = event.results; value a speechrecognitionresultlist object. 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...
SpeechRecognitionEvent - Web APIs
gnitionevent also inherits properties from its parent interface, event. speechrecognitionevent.emma read only returns an extensible multimodal annotation markup language (emma) — xml — representation of the result. speechrecognitionevent.interpretation read only returns the semantic meaning of what the user said. speechrecognitionevent.resultindex read only returns the lowest index value result in the speechrecognitionresultlist "array" that has actually changed. speechrecognitionevent.results read only returns a speechrecognitionresultlist object representing all the speech recognition results for the current session. examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results prop...
SpeechSynthesis.getVoices() - Web APIs
note: the spec wrongly lists this method as returning as a speechsynthesisvoicelist object, but this was in fact removed from the spec. ...
SpeechSynthesis.paused - Web APIs
erface is a boolean that returns true if the speechsynthesis object is in a paused state, or false if not. it can be set to paused even if nothing is currently being spoken through it. if utterances are then added to the utterance queue, they will not be spoken until the speechsynthesis object is unpaused, using speechsynthesis.resume(). syntax var amipaused = speechsynthesisinstance.paused; value a boolean. examples var synth = window.speechsynthesis; synth.pause(); var amipaused = synth.paused; // will return true specifications specification status comment web speech apithe definition of 'paused' in that specification. draft ...
SpeechSynthesis.pending - Web APIs
the pending read-only property of the speechsynthesis interface is a boolean that returns true if the utterance queue contains as-yet-unspoken utterances. syntax var amipending = speechsynthesisinstance.pending; value a boolean. examples var synth = window.speechsynthesis; var utterance1 = new speechsynthesisutterance('how about we say this now? this is quite a long sentence to say.'); var utterance2 = new speechsynthesisutterance('we should say another sentence too, just to be on the safe side.'); synth.speak(utterance1); synth.speak(utterance2); var amipending = synth.pending; // will return true if utterance 1 is still being spoken and utterance 2 is in the queue specifications specification status comment web speech apithe definition of 'pendi...
SpeechSynthesis.speak() - Web APIs
cerpted from our speech synthesiser demo. when a form containing the text we want to speak is submitted, we (amongst other things) create a new utterance containing this text, then speak it by passing it into speak() as a parameter. var synth = window.speechsynthesis; ... 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]; } } synth.speak(utterthis); inputtxt.blur(); } specifications specification status comment web speech apithe definition of 'speak()' in that specification. dr...
SpeechSynthesis.speaking - Web APIs
the speaking read-only property of the speechsynthesis interface is a boolean that returns true if an utterance is currently in the process of being spoken — even if speechsynthesis is in a paused state. syntax var amispeaking = speechsynthesisinstance.speaking; value a boolean. examples var synth = window.speechsynthesis; var utterance1 = new speechsynthesisutterance('how about we say this now? this is quite a long sentence to say.'); var utterance2 = new speechsynthesisutterance('we should say another sentence too, just to be on the safe side.'); synth.speak(utterance1); synth.speak(utterance2); var amispeaking = synth.speaking; // will return true if utterance 1 or utterance 2 are currently being spoken specifications specification status comment ...
SpeechSynthesisErrorEvent - Web APIs
ethods from its parent interface, event. examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... ...
SpeechSynthesisEvent.charIndex - Web APIs
the charindex read-only property of the speechsynthesisutterance interface returns the index position of the character in the speechsynthesisutterance.text that was being spoken when the event was triggered. syntax event.charindex; value a number. examples utterthis.onpause = function(event) { var char = event.utterance.text.charat(event.charindex); console.log('speech paused at character ' + event.charindex + ' of "' + event.utterance.text + '", which is "' + char + '".'); } specifications specification status comment web speech apithe definition of 'charindex' in that specification. draft ...
SpeechSynthesisEvent.elapsedTime - Web APIs
the elapsedtime read-only property of the speechsynthesisutterance interface returns the elapsed time in seconds after the speechsynthesisutterance.text started being spoken that the event was triggered at. syntax event.elapsedtime; value a float. examples utterthis.onboundary = function(event) { console.log(event.name + ' boundary reached after ' + event.elapsedtime + ' seconds.'); } specifications specification status comment web speech apithe definition of 'elapsedtime' in that specification. draft ...
SpeechSynthesisEvent.name - Web APIs
examples utterthis.onboundary = function(event) { console.log(event.name + ' boundary reached after ' + event.elapsedtime + ' milliseconds.'); } specifications specification status comment web speech apithe definition of 'name' in that specification. draft ...
SpeechSynthesisEvent.utterance - Web APIs
the utterance read-only property of the speechsynthesisutterance interface returns the speechsynthesisutterance instance that the event was triggered on. syntax event.utterance; value a speechsynthesisutterance object. examples utterthis.onpause = function(event) { var char = event.utterance.text.charat(event.charindex); console.log('speech paused at character ' + event.charindex + ' of "' + event.utterance.text + '", which is "' + char + '".'); } specifications specification status comment web speech apithe definition of 'utterance' in that specification. draft ...
SpeechSynthesisUtterance.SpeechSynthesisUtterance() - Web APIs
pet is excerpted from our speech synthesizer demo. var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... ...
SpeechSynthesisUtterance.onboundary - Web APIs
stance.onboundary = function() { ... }; examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... ...
SpeechSynthesisUtterance.onend - Web APIs
nceinstance.onend = function() { ... }; examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... ...
SpeechSynthesisUtterance.onerror - Web APIs
einstance.onerror = function() { ... }; examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... ...
SpeechSynthesisUtterance.onmark - Web APIs
ceinstance.onmark = function() { ... }; examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... ...
SpeechSynthesisUtterance.onpause - Web APIs
einstance.onpause = function() { ... }; examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... ...
SpeechSynthesisUtterance.onresume - Web APIs
instance.onresume = function() { ... }; examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... ...
SpeechSynthesisUtterance.onstart - Web APIs
einstance.onstart = function() { ... }; examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... ...
SpeechSynthesisVoice.default - Web APIs
-only property of the speechsynthesisvoice interface returns a boolean indicating whether the voice is the default voice for the current app (true), or not (false.) note: for some devices, it might be the default voice for the voice's language. the spec is not very clear on which it should be, so some implementations may differ. syntax var amidefault = speechsynthesisvoiceinstance.default; value a boolean. examples 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); } speci...
SpeechSynthesisVoice.lang - Web APIs
the lang read-only property of the speechsynthesisvoice interface returns a bcp 47 language tag indicating the language of the voice. syntax var mylang = speechsynthesisvoiceinstance.lang; value a domstring representing the language of the device. examples 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); } specifications specification status comment web speech apithe definition of 'lang' in that specification. draft ...
SpeechSynthesisVoice.localService - Web APIs
nthesizer service (true), or a remote speech synthesizer service (false.) this property is provided to allow differentiation in the case that some voice options are provided by a remote service; it is possible that remote voices might have extra latency, bandwidth or cost associated with them, so such distinction may be useful. syntax var amilocal = speechsynthesisvoiceinstance.localservice; value a boolean. examples 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'; } console.log(voices[i].localservice); option.setattribute('data-lang', voices[i].lang); option.setattribute('data-name', voices[i].name); v...
SpeechSynthesisVoice.name - Web APIs
the name read-only property of the speechsynthesisvoice interface returns a human-readable name that represents the voice. syntax var voicename = speechsynthesisvoiceinstance.name; value a domstring representing the name of the voice. examples 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); } specifications specification status comment web speech apithe definition of 'name' in that specification. draft ...
SpeechSynthesisVoice.voiceURI - Web APIs
this is a generic uri and can point to local or remote services, e.g. it could be a proprietary system urn or a a url to a remote service. ...
SpeechSynthesisVoice - Web APIs
tion.setattribute('data-lang', voices[i].lang); option.setattribute('data-name', voices[i].name); voiceselect.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.charind...
StaticRange.StaticRange() - Web APIs
erties are: startcontainer the node in which the starting point of the range is located. startoffset the offset into the starting node at which the first character of the range is found. endcontainer the node in which the end point of the range is located. endoffset the offset into the node indicated by endoffset at which the last character in the range is located. return value a new staticrange object initialized with the values given in the rangespec object. exceptions invalidnodetypeerror a domexception fired if either or both of the startcontainer and/or endcontainer are a type of node which you can't include in a range. those node types are node.document_type_node (representing the documenttype node derived from the dtd identified using the doctype preamble i...
StaticRange.endContainer - Web APIs
the endcontainer property of the staticrange interface returns the end node for the range. syntax var node = staticnode.endcontainer staticnode.endcontainer = endcontainer value the dom node which contains the final character of the range. specifications specification status comment domthe definition of 'endcontainer' in that specification. living standard static rangethe definition of 'endcontainer' in that specification. editor's draft initial definition. ...
StaticRange.endOffset - Web APIs
the endoffset property of the staticrange interface returns the offset into the end node of the range's end position. syntax var endoffset = staticrange.endoffset value an integer value indicating the number of characters into the node indicated by endcontainer at which the final character of the range is located. specifications specification status comment domthe definition of 'endoffset' in that specification. living standard static rangethe definition of 'endoffset' in that specification. editor's draft initial definition. ...
StaticRange.startContainer - Web APIs
the read-only startcontainer property of the staticrange interface returns the start node for the range. syntax var node = staticnode.startcontainer value the dom node inside which the start position of the range is found. specifications specification status comment domthe definition of 'startcontainer ' in that specification. living standard static rangethe definition of 'startcontainer' in that specification. editor's draft initial definition. ...
StaticRange.startOffset - Web APIs
the read-only startoffset property of the staticrange interface returns the offset into the start node of the range's start position. syntax var startoffset = staticrange.startoffset value an integer value indicating the number of characters into the node indicated by startcontainer at which the first character of the range is located. specifications specification status comment domthe definition of 'startoffset' in that specification. living standard static rangethe definition of 'startoffset' in that specification. editor's draft initial definition. ...
StaticRange.toRange() - Web APIs
the torange() property of the staticrange interface converts the staticrange object to a range object. syntax var range = staticrange.torange() parameters none. return value a new range object. specifications specification status comment static rangethe definition of 'torange()' in that specification. editor's draft initial definition. ...
Storage.clear() - Web APIs
Web › API › Storage › clear
examples the following function creates three data entries in local storage, and then deletes them by using clear(). function populatestorage() { localstorage.setitem('bgcolor', 'red'); localstorage.setitem('font', 'helvetica'); localstorage.setitem('image', 'migato.png'); localstorage.clear(); } note: for a real world example, see our web storage demo. ...
Storage.length - Web APIs
Web › API › Storage › length
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. livin...
Storage.removeItem() - Web APIs
y name, will remove that key from the given storage object if it exists. the storage interface of the web storage api provides access to a particular domain's session or local storage. if there is no item associated with the given key, this method will do nothing. syntax storage.removeitem(keyname); parameters keyname a domstring containing the name of the key you want to remove. return value undefined. example the following function creates three data items inside local storage, then removes the image data item. function populatestorage() { localstorage.setitem('bgcolor', 'red'); localstorage.setitem('font', 'helvetica'); localstorage.setitem('image', 'mycat.png'); localstorage.removeitem('image'); } we can do the same for the session storage. function populatestorage(...
StorageManager.persist() - Web APIs
the persist() method of the storagemanager interface requests permission to use persistent storage, and returns a promise that resolves to true if permission is granted and box mode is persistent, and false otherwise. syntax navigator.storage.persist().then(function(persistent) { ... }) parameters none. return value a promise that resolves to a boolean. example if (navigator.storage && navigator.storage.persist) navigator.storage.persist().then(function(persistent) { if (persistent) console.log("storage will not be cleared except by explicit user action"); else console.log("storage may be cleared by the ua under storage pressure."); }); specifications specification status comment storagethe definition of 'persist' in that specificati...
StorageQuota.supportedTypes - Web APIs
the supportedtypes read-only property of the storagequota interface returns a list of the available storage types. syntax var storagetypes = storagequota.supportedtypes value a frozen array of available storage types. specifications specification status comment quota management apithe definition of 'supportedtypes' in that specification. obsolete initial definition. ...
Storage Access API - Web APIs
fari, successful use of the storage access api resets this counter. documentation for firefox's new storage access policy for blocking tracking cookies includes a detailed description of the scope of storage access grants. storage access api methods the storage api methods are implemented on the document interface: document.hasstorageaccess() returns a promise that resolves with a boolean value indicating whether the document has access to its first-party storage. document.requeststorageaccess() returns a promise that resolves if the access to first-party storage was granted, and rejects if access was denied. note: user interaction propagates to the promise returned by both of these methods, allowing the callers to take actions that require user interaction without requiring a seco...
StylePropertyMap.append() - Web APIs
the append() method of the stylepropertymap interface adds a new css declaration to the stylepropertymap with the given property and value. syntax stylepropertymap.append(property,value) parameters property an identifier indicating the stylistic feature (e.g. font, width, background color) to add. value the value the given property should have. return value undefined. example // tbd specifications specification status comment css typed om level 1the definition of 'append()' in that specification. working draft initial definition. ...
StylePropertyMap.clear() - Web APIs
the clear() method of the stylepropertymap interface removes all declarations in the stylepropertymap. syntax stylepropertmap.clear() parameters none. return value undefined example // tbd specifications specification status comment css typed om level 1the definition of 'clear()' in that specification. working draft initial definition. ...
StylePropertyMap.delete() - Web APIs
the delete() method of the stylepropertymap interface removes the css declaration with the given property. syntax stylepropertymap.delete(property) parameters property an identifier indicating the stylistic feature (e.g. font, width, background color) to remove. return value undefined example // tbd specifications specification status comment css typed om level 1the definition of 'delete()' in that specification. working draft initial definition. ...
StylePropertyMap.set() - Web APIs
the set() method of the stylepropertymap interface changes the css declaration with the given property. syntax stylepropertymap.set(property,value) parameters property an identifier indicating the stylistic feature (e.g. font, width, background color) to change. value the value the given property should have. return value undefined example // tbd specifications specification status comment css typed om level 1the definition of 'set()' in that specification. working draft initial definition. ...
StylePropertyMap - Web APIs
anchor="middle" alignment-baseline="middle">stylepropertymap</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, stylepropertymapreadonly. methods inherits methods from its parent, stylepropertymapreadonly. stylepropertymap.append() adds a new css declaration to the stylepropertymap with the given property and value. stylepropertymap.clear() removes all declarations in the stylepropertymap. stylepropertymap.delete() removes the css declaration with the given property. stylepropertymap.set() changes the css declaration with the given property. specifications specification status comment css typed om level 1the definition of 'stylepropertymap' in that specification. working ...
StylePropertyMapReadOnly.entries() - Web APIs
the stylepropertymapreadonly.entries() method 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). syntax stylepropertymapreadonly.entries() parameters none. return value an array of the given stylepropertymapreadonly object's own enumerable property [key, value] pairs. example // tbd specifications specification status comment css typed om level 1the definition of 'entries()' in that specification. working draft initial definition. ...
StylePropertyMapReadOnly.forEach() - Web APIs
the stylepropertymapreadonly.foreach() method executes a provided function once for each element of stylepropertymapreadonly. syntax stylepropertymapreadonly.foreach(function callback(currentvalue[, index[, array]]) { //your code }[, thisarg]); parameters callback the function to execute for each element, taking three arguments: currentvalue the value of the current element being processed. indexoptional the index of the current element being processed. arrayoptional the stylepropertymapreadonly thatforeach() is being called on. thisarg optional value to use as this (i.e the reference object) when executing callback. return value undefined. example // tbd specifications specification status comment css typed om level 1the defi...
StylePropertyMapReadOnly.getAll() - Web APIs
the getall() method of the stylepropertymapreadonly interface returns an array of cssstylevalue objects containing the values for the provided property. syntax var cssstylevalues[] = stylepropertymapreadonly.getall(property) parameters property the name of the property to retrieve all values of. return value an array of cssstylevalue objects. example // tbd specifications specification status comment css typed om level 1the definition of 'getall()' in that specification. working draft initial definition. ...
StylePropertyMapReadOnly.has() - Web APIs
the has() method of the stylepropertymapreadonly interface indicates whether the specified property is in the stylepropertymapreadonly object. syntax var boolean = stylepropertymapreadonly.has(property) parameters property the name of a property. return value a boolean. example // tbd specifications specification status comment css typed om level 1the definition of 'has()' in that specification. working draft initial definition. ...
StylePropertyMapReadOnly.keys() - Web APIs
the stylepropertymapreadonly.keys() method returns a new array iterator containing the keys for each item in stylepropertymapreadonly syntax stylepropertymapreadonly.keys() parameters none. return value a new array. example // tbd specifications specification status comment css typed om level 1the definition of 'keys()' in that specification. working draft initial definition. ...
StylePropertyMapReadOnly.size - Web APIs
the size read-only property of the stylepropertymapreadonly interface returns an unsinged long integer containing the size of the stylepropertymapreadonly object. syntax var size = stylepropertymapreadonly.size value an unsigned long integer. example // tbd specifications specification status comment css typed om level 1the definition of 'size' in that specification. working draft initial definition. ...
StyleSheet.ownerNode - Web APIs
ylesheet ?>. syntax noderef = stylesheet.ownernode example <html lang="en"> <head> <link rel="stylesheet" href="example.css"> </head> <body> <button onclick="alert(document.stylesheets[0].ownernode)">show example.css’s ownernode</button> </body> </html> // displays "object htmllinkelement" notes for style sheets that are included by other style sheets, such as with @import, the value of this property is null. specifications specification status comment css object model (cssom)the definition of 'stylesheet: ownernode' in that specification. working draft ...
SubmitEvent() - Web APIs
the submitevent() constructor creates and returns a new submitevent object, which is used to represent a submit event fired at an html form. syntax let submitevent = new submitevent(type,eventinitdict); parameters type a domstring indicating the event which occurred. for submitevent, this is always submit. eventinitdict optional an optional dictionary of initial values for the event's properties. return value a submitevent object configured using the given inputs. examples this code snippet locates a form in the current document, and then an html <button> within the form with the class submit on it. next, a new submitevent is created, configured with its submitter set to the identified button (or null if the button wasn't found). then the event is sent to the form, telling the fo...
SubmitEvent.submitter - Web APIs
the read-only submitter property found on the submitevent interface specifies the submit button or other element that was invoked to cause the form to be submitted. syntax let submitter = submitevent.submitter; value an element, indicating the element that sent the submit event to the form. while this is often an <input> element whose type or a <button> whose type is submit, it could be some other element which has initiated a submission process. if the submission was not triggered by a button of some kind, the value of submitter is null. examples in this example, a shopping cart may have an assortment of different submit buttons depending on factors such as the user's settings, the shop's settings, and any minimum or maximum shopping card totals established by the payment processors. e...
SubtleCrypto.exportKey() - Web APIs
t a key, the key must have cryptokey.extractable set to true. keys can be exported in several formats: see supported formats in the subtlecrypto.importkey() page for details. keys are not exported in an encrypted format: to encrypt keys when exporting them use the subtlecrypto.wrapkey() api instead. syntax const result = crypto.subtle.exportkey(format, key); parameters format is a string value describing the data format in which the key should be exported. it can be one of the following: raw: raw format. pkcs8: pkcs #8 format. spki: subjectpublickeyinfo format. jwk: json web key format. key is the cryptokey to export. return value result is a promise. if format was jwk, then the promise fulfills with a json object containing the key. otherwise the ...
SyncEvent.lastChance - Web APIs
the syncevent.lastchance read-only property of the syncevent interface returns true if the user agent will not make further synchronization attempts after the current attempt. this is the value passed in the lastchance parameter of the syncevent() constructor. syntax var lastchance = syncevent.lastchance value a boolean that indicates whether the user agent will not make further synchronization attempts after the current attempt. specifications specification web background synchronization ...
registration - Web APIs
the registration read-only property of the syncevent interface returns a reference to a syncregistration object. syntax var syncreg = syncevent.registration value a syncregistration object ...
SyncEvent.tag - Web APIs
Web › API › SyncEvent › tag
the syncevent.tag read-only property of the syncevent interface returns the developer-defined identifier for this syncevent. this is the value passed in the tag parameter of the syncevent() constructor. syntax var tag = syncevent.tag value the developer-defined identifier for this syncevent. specifications specification status comment web background synchronizationthe definition of 'tag' in that specification. living standard initial definition. ...
SyncManager.register() - Web APIs
meaning there is no maximum delay. mindelay: the minimum delay in milliseconds before the next sync event (or the first sync event if it is periodic). the default is 0. minperiod: the minimum time in milliseconds between periodic sync events. the default is 0, meaning events are not periodic. minrequirednetwork: the network condition under which background synchronization will occur. valid values are 'network-any', 'network-offline', 'network-online', 'network-non-mobile'. the default value is 'network-online'. ...
TaskAttributionTiming.containerId - Web APIs
specifications specification status comment long tasks api 1the definition of 'containerid' in that specification. working draft initial definition. ...
TaskAttributionTiming.containerName - Web APIs
the containername readonly property of the taskattributiontiming interface returns the container's name attribute. a container is the iframe, embed or object etc. that is being implicated, on the whole, for a long task. syntax var containername = taskattributiontiming.containername; value a domstring containing the container's name attribute. specifications specification status comment long tasks api 1the definition of 'containername' in that specification. working draft initial definition. ...
TaskAttributionTiming.containerSrc - Web APIs
the containersrc readonly property of the taskattributiontiming interface returns the container's src attribute. a container is the iframe, embed or object etc. that is being implicated, on the whole, for a long task. syntax var containersrc = taskattributiontiming.containersrc; value a domstring containing the container's src attribute. specifications specification status comment long tasks api 1the definition of 'containersrc' in that specification. working draft initial definition. ...
TaskAttributionTiming.containerType - Web APIs
specifications specification status comment long tasks api 1the definition of 'containertype' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. ...
HTMLSlotElement.assignedSlot - Web APIs
Web › API › Text › assignedSlot
specifications specification status comment domthe definition of 'assignedslot' in that specification. living standard 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. ...
Text.isElementContentWhitespace - Web APIs
putting any property that represents the textual content of the text node into test() should do the same work just like the three example above. the text.iselementcontentwhitespace read-only property returns a boolean flag indicating whether or not the text node's content consists solely of whitespace. syntax b = textnode.iselementcontentwhitespace; example in the example below, we create a node with mixed display and whitespace characters and the attribute is false. ...
Text.replaceWholeText() - Web APIs
this method returns the text node which received the replacement text, or null if the replacement text is an empty string. ...
Text.splitText() - Web APIs
Web › API › Text › splitText
nal 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 domexception with a value of index_size_err is thrown if the specified offset is negative or is greater than the number of 16-bit units in the node's text; a domexception with a value of no_modification_allowed_err is thrown if the node is read-only. example in this example, the tex...
TextDecoder.prototype.encoding - Web APIs
the textdecoder.prototype.encoding read-only property returns a domstring containing the name of the decoding algorithm used by the specific decoder. it can be one of the following values: the recommended encoding for the web: 'utf-8'. the legacy single-byte encodings: 'ibm866', 'iso-8859-2', 'iso-8859-3', 'iso-8859-4', 'iso-8859-5', 'iso-8859-6', 'iso-8859-7', 'iso-8859-8'', 'iso-8859-8i', 'iso-8859-10', 'iso-8859-13', 'iso-8859-14', 'iso-8859-15', 'iso-8859-16', 'koi8-r', 'koi8-u', 'macintosh', 'windows-874', 'windows-1250', 'windows-1251', 'windows-1252', 'windows-1253', 'windows-1254', 'windows-1255', 'windows-1256', 'windows-1257', 'windows-1258', or 'x-mac-cyrillic'. the legacy multi-byte chinese (simplified) encodings: 'gbk', 'gb18030', and 'hz-gb-2312'. the legacy multi-byte c...
TextEncoder.prototype.encode() - Web APIs
the textencoder.prototype.encode() method takes a usvstring as input, and returns a uint8array containing the text given in parameters encoded with the specific method for that textencoder object. syntax b1 = encoder.encode(string); parameters string is a usvstring containing the text to encode. return value a uint8array object. examples <p class="source">this is a sample paragraph.</p> <p class="result">encoded result: </p> const sourcepara = document.queryselector('.source'); const resultpara = document.queryselector('.result'); const string = sourcepara.textcontent; const textencoder = new textencoder(); let encoded = textencoder.encode(string); resultpara.textcontent += encoded; specifications specification status comment encodingthe definition o...
TextEncoder.prototype.encodeInto() - Web APIs
ect indicating the progress of the encoding. this is potentially more performant than the older encode() method especially when the target buffer is a view into a wasm heap. syntax b1 = encoder.encodeinto(string, uint8array); parameters string is a usvstring containing the text to encode. uint8array is a uint8array object instance to place the resulting utf-8 encoded text into. return value a textencoderencodeintoresult dictionary, which contains two members: read the number of utf-16 units of code from the source that has been converted over to utf-8. this may be less than string.length if uint8array did not have enough space. written the number of bytes modified in the destination uint8array. the bytes written are guaranteed to form complete utf-8 byte sequences. encode i...
TextEncoder.encoding - Web APIs
the textencoder.encoding read-only property returns a domstring containing the name of the encoding algorithm used by the specific encoder. it can only have the following value utf-8. syntax b = encoder.encoding; specifications specification status comment encodingthe definition of 'textencoder.encoding' in that specification. living standard initial definition. ...
TextRange - Web APIs
Web › API › TextRange
andenabled() returns a boolean indicating whether the specified command can be executed successfully with the execcommand method in the current state of the given document. you can also see document.querycommandenabled(). textrange.querycommandstate() returns the boolean indicating the current state of the specified command. you can also see document.querycommandstate(). textrange.querycommandvalue() returns the domstring indicating the current value of the specified command. you can also see document.querycommandvalue(). textrange.scrollintoview() scroll the range to the visible range (top or bottom). it can be used as an alternative to element.scrollintoview in the lower version of ie. textrange.select() select the current range (i.e. the blue selection seen by the user). textrange.
getTrackById() - Web APIs
the texttracklist method gettrackbyid() returns the first texttrack object from the track list whose id matches the specified string. this lets you find a specified track if you know its id string. syntax var thetrack = texttracklist.gettrackbyid(id); paramters id a domstring indicating the id of the track to locate within the track list. return value a texttrack object indicating the first track found within the texttracklist whose id matches the specified string. if no match is found, this method returns null. the tracks are searched in their natural order; that is, in the order defined by the media resource itself, or, if the resource doesn't define an order, the relative order in which the tracks are declared by the media resource. specifications specification stat...
TextTrackList.onaddtrack - Web APIs
ent occurs, indicating that a new text track has been added to the media element whose text tracks the texttracklist represents. the event is passed into the event handler in the form of a trackevent object, whose track property identifies the newly-added track. note: you can also add a handler for the addtrack event using addeventlistener(). syntax texttracklist.onaddtrack = eventhandler; value set onaddtrack to a function that accepts as input a trackevent object which indicates in its track property which video track has been added to the media. usage notes the addtrack event is called whenever a new track is added to the media element whose video tracks are represented by the texttracklist object. this happens when tracks are added to the element when the media is first attached t...
TextTrackList.onremovetrack - Web APIs
een removed from the media element, and therefore also from the texttracklist. the event is passed into the event handler in the form of a trackevent object, whose track property identifies the track that was removed from the media element's texttracklist. note: you can also add a handler for the removetrack event using addeventlistener(). syntax texttracklist.onremovetrack = eventhandler; value set onremovetrack to a function that accepts as input a trackevent object which indicates in its track property which text track has been removed from the media element. example this simple example just fetches the current number of text tracks in the first media element whenever a track is removed from the media element. document.queryselectorall("video, audio")[0].texttracks.onremovetrack =...
TimeEvent - Web APIs
Web › API › TimeEvent
specifies some detail information about the event, depending on the type of the event. for this event type, indicates the repeat number for the animation. timeevent.view read only is a windowproxy that identifies the window from which the event was generated. methods inittimeevent(domstring typearg, abstractview viewarg, long detailarg) the inittimeevent method is used to initialize the value of a timeevent created through the documentevent interface. this method may only be called before the timeevent has been dispatched via the dispatchevent method, though it may be called multiple times during that phase if necessary. ...
msManipulationViewsEnabled - Web APIs
e web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the msmanipulationviewsenabled read-only property returns true if manipulation features are support available, such as touch panning and zooming using css rules. this proprietary property is specific to internet explorer and microsoft edge. value returns true if manipulation features are support available, such as touch panning and zooming using css rules. example using a json file: { msmanipulationviewsenabled: true, } see also touch api microsoft api extensions ...
Touch.clientX - Web APIs
Web › API › Touch › clientX
example this example illustrates using the touch object's touch.clientx and touch.clienty properties. the touch.clientx property is the horizontal coordinate of a touch point relative to the browser's viewport excluding any scroll offset. ...
Touch.clientY - Web APIs
Web › API › Touch › clientY
example this example illustrates using the touch object's touch.clientx and touch.clienty properties. the touch.clientx property is the horizontal coordinate of a touch point relative to the browser's viewport excluding any scroll offset. ...
Touch.pageX - Web APIs
Web › API › Touch › pageX
example this example illustrates how to access the touch object's touch.pagex and touch.pagey properties. the touch.pagex property is the horizontal coordinate of a touch point relative to the viewport (in css pixels), including any scroll offset. ...
Touch.pageY - Web APIs
Web › API › Touch › pageY
example this example illustrates how to access the touch object's touch.pagex and touch.pagey properties. the touch.pagex property is the horizontal coordinate of a touch point relative to the viewport (in css pixels), including any scroll offset. ...
Touch.screenX - Web APIs
Web › API › Touch › screenX
example this example illustrates how to access the touch object's touch.screenx and touch.screeny properties. the touch.screenx property is the horizontal (x) coordinate of a touch point relative to the screen in css pixels. the touch.screeny property is the vertical coordinate of a touch point relative to the screen in css pixels. ...
Touch.screenY - Web APIs
Web › API › Touch › screenY
example the touch.screenx example includes an example of this property's usage. ...
Touch.target - Web APIs
Web › API › Touch › target
een removed from the document. note that if the target element is removed from the document, events will still be targeted at it, and hence won't necessarily bubble up to the window or document anymore. if there is any risk of an element being removed while it is being touched, the best practice is to attach the touch listeners directly to the target. syntax var el = touchpoint.target; return value el the target element of the touch object. example this example illustrates how to access the touch object's touch.target property. the touch.target property is an element (eventtarget) on which a touch point is started when contact is first placed on the surface. in following simple code snippet, we assume the user initiates one or more touch contacts on the source element. when the touc...
TouchEvent() - Web APIs
toucheventinit optional is a toucheventinit dictionary, having the following fields: "touches", optional and defaulting to [], of type touch[], that is a list of objects for every point of contact currently touching the surface. "targettouches", optional and defaulting to [], of type touch[], that is a list of objects for every point of contact that is touching the surface and started on the element that is the target of the current event. ...
TouchEvent.changedTouches - Web APIs
points that became active with the current event. for the touchmove event, it is a list of the touch points that have changed since the last event. for the touchend event, it is a list of the touch points that have been removed from the surface (that is, the set of touch points corresponding to fingers no longer touching the surface). syntax var changes = touchevent.changedtouches; return value changes a touchlist whose touch objects include all the touch points that contributed to this touch event. example this example illustrates the touchevent object's touchevent.changedtouches property. the touchevent.changedtouches property is a touchlist object that contains one touch object for each touch point which contributed to the event. in following code snippet, the touchmove event...
TouchEvent.targetTouches - Web APIs
the targettouches read-only property is a touchlist listing all the touch objects for touch points that are still in contact with the touch surface and whose touchstart event occurred inside the same target element as the current target element. syntax var touches = touchevent.targettouches; return value touches a touchlist listing all the touch objects for touch points that are still in contact with the touch surface and whose touchstart event occurred inside the same target element as the current target element. example this 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 curr...
TouchEvent.touches - Web APIs
touches is a read-only touchlist listing all the touch objects for touch points that are currently in contact with the touch surface, regardless of whether or not they've changed or what their target element was at touchstart time. you can think of it as how many separate fingers are able to be identified as touching the screen. syntax var touches = touchevent.touches; return value touches a touchlist listing all the touch objects for touch points that are still in contact with the touch surface, regardless 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 poi...
TouchList.identifiedTouch() - Web APIs
the identifiedtouch() method returns the first touch item in the touchlist that matches the specified identifier. it is recommended that you use touchlist.item() instead. syntax var touchitem = touchlist.identifiedtouch(id); parameters id an integer value identifying the touch object to retrieve from the list. return value touchitem a touch object matching the specified id. specifications not part of any specification. this api was removed from the touch events v2 draft specification. ...
TouchList.item() - Web APIs
Web › API › TouchList › item
returns null if the index is not less than the length of the list. ...
TouchList.length - Web APIs
Web › API › TouchList › length
example this code example illustrates the use of the touchlist interface's item method and the length property. ...
TouchList - Web APIs
Web › API › TouchList
e 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 recommendation initial definition. ...
Multi-touch interaction - Web APIs
e.border = "dashed"; // check this event for 2-touch move/pinch/zoom gesture handle_pinch_zoom(ev); } touch end handler the touchend handler restores the event target's background color back to its original color. function end_handler(ev) { ev.preventdefault(); if (logevents) log(ev.type, ev, false); if (ev.targettouches.length == 0) { // restore background and border to original values ev.target.style.background = "white"; ev.target.style.border = "1px solid black"; } } application ui the application uses <div> elements for the touch areas and provides buttons to enable logging and clear the log. <div id="target1"> tap, hold or swipe me 1</div> <div id="target2"> tap, hold or swipe me 2</div> <div id="target3"> tap, hold or swipe me 3</div> <div id="target4"> tap...
Touch events - Web APIs
// make it a hex digit g = g.tostring(16); // make it a hex digit b = b.tostring(16); // make it a hex digit var color = "#" + r + g + b; console.log("color for touch with identifier " + touch.identifier + " = " + color); return color; } the result from this function is a string that can be used when calling <canvas> functions to set drawing colors. for example, for a touch.identifier value of 10, the resulting string is "#a31". copying a touch object some browsers (mobile safari, for one) re-use touch objects between events, so it's best to copy the properties you care about, rather than referencing the entire object. function copytouch({ identifier, pagex, pagey }) { return { identifier, pagex, pagey }; } finding an ongoing touch the ongoingtouchindexbyid() function below s...
TrackDefault.byteStreamTrackID - Web APIs
the bytestreamtrackid read-only property of the trackdefault interface returns the id of the specific track that the sourcebuffer should apply to. if not specified in the constructor, this value will be an empty string and the sourcebuffer can contain any tracks of the specified trackdefault.type. syntax var myid = trackdefault.bytestreamtrackid; value a domstring. example tbd ...
TrackDefault.kinds - Web APIs
example tbd ...
TrackDefault.label - Web APIs
example tbd ...
TrackDefault.language - Web APIs
example tbd ...
TrackDefault.type - Web APIs
Web › API › TrackDefault › type
example tbd ...
TrackDefaultList.length - Web APIs
example tbd ...
TrackEvent() - Web APIs
ack, audiotrack, or texttrack as appropriate given the type of track. bubbles optional a boolean indicating whether the event bubbles or not. cancelable optional a boolean indicating whether or not the event can be canceled. composed optional a boolean indicating whether or not the event will trigger listeners outside of a shadow root; see event.composed for more details. return value a newly-created trackevent object, initialized as described by the inputs to the constructor. specifications specification status comment html living standardthe definition of 'trackevent()' in that specification. living standard initial definition. html5the definition of 'trackevent()' in that specification. recommendation initial definition. ...
TrackEvent.track - Web APIs
Web › API › TrackEvent › track
this identifies the track to which the event applies. ...
TransitionEvent.elapsedTime - Web APIs
the transitionevent.elapsedtime read-only property is a float giving the amount of time the animation has been running, in seconds, when this event fired. this value is not affected by the transition-delay property. syntax name = transitionevent.elapsedtime specifications specification status comment css transitionsthe definition of 'transitionevent.elapsedtime' in that specification. working draft initial definition. ...
TransitionEvent - Web APIs
() creates a transitionevent event with the given parameters. properties also inherits properties from its parent event. transitionevent.propertyname read only is a domstring containing the name css property associated with the transition. transitionevent.elapsedtime read only is a float giving the amount of time the transition has been running, in seconds, when this event fired. this value is not affected by the transition-delay property. transitionevent.pseudoelement read only is a domstring, starting with ::, containing the name of the pseudo-element the animation runs on. if the transition doesn't run on a pseudo-element but on the element, an empty string: ''. types of transitionevent transitioncancel an event fired when a css transition has been cancelled. transition...
TreeWalker.expandEntityReferences - Web APIs
the treewalker.expandentityreferences read-only property returns a boolean flag indicating whether or not the children of entity reference nodes are visible to the treewalker. if this value is false, the children of entity reference nodes (as well as all of their descendants) are rejected. this takes precedence over the value of the treewalker.whattoshow method and the associated filter. syntax expand = treewalker.expandentityreferences; example var treewalker = document.createtreewalker( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); expand = treewalker.expandentityreferences; specifications document object model (dom) level 2 traversal and range specificationthe definition of 'treewalke...
TreeWalker - Web APIs
interface doesn't inherit any property. treewalker.root read only returns a node representing the root node as specified when the treewalker was created. treewalker.whattoshow read only returns an unsigned long being a bitmask made of constants describing the types of node that must be presented. non-matching nodes are skipped, but their children may be included, if relevant. the possible values are: constant numerical value description nodefilter.show_all -1 (that is the max value of unsigned long) shows all nodes. nodefilter.show_attribute 2 shows attribute attr nodes. this is meaningful only when creating a treewalker with an attr node as its root. in this case, it means that the attribute node will appear in the fi...
TypeInfo - Web APIs
Web › API › TypeInfo
nded to be used to describe a dom data type by keying its name to a namespace within the document's schema. properties typeinfo.typename read only returns a domstring indicating the type's name. typeinfo.typenamespace read only returns a domstring indicating the type's namespace within the schema. methods typeinfo.isderivedfrom() returns a boolean. constants constant value derivation_restriction 1 derivation_extension 2 derivation_union 4 derivation_list 8 specifications specification status comment document object model (dom) level 3 core specificationthe definition of 'typeinfo' in that specification. obsolete initial definition ...
UIEvent.initUIEvent() - Web APIs
vent(). the page on creating and triggering events gives more information about the way to use these. syntax event.inituievent(type, canbubble, cancelable, view, detail) parameters type is a domstring defining the type of event. canbubble is a boolean deciding whether the event should bubble up through the event chain or not. once set, the read-only property event.bubbles will give its value. cancelable is a boolean defining whether the event can be canceled. once set, the read-only property event.cancelable will give its value. view is the windowproxy associated with the event. detail is an unsigned long specifying some detail information about the event, depending on the type of event. for mouse events, it indicates how many times the mouse has been clicked on a given screen...
UIEvent.isChar - Web APIs
Web › API › UIEvent › isChar
the uievent.ischar read-only property returns a boolean indicating whether the event produced a key character or not. syntax var ischar = uievent.ischar; value a boolean which is true if the event produces a character; otherwise false. some keystroke combinations may raise events but not produce any character (example: ctrl-alt-?). when this is the case, ischar returns false. it is used when event handlers need to do something like echo the input on the screen. example in this snippet, which is part of an event handler, the event is checked to see if it generates a character; if it does, the value of uievent.which is appended to a string which buffers the typed characters. if (event.ischar) { characterbuffer += e.which; } specification this property is not part of any sp...
UIEvent.pageX - Web APIs
Web › API › UIEvent › pageX
, and was only implemented across a subset of browsers, and only for a limited number of versions. a standardized version of pagex was added to the mouseevent interface, however, and is well-supported. you should not expect to find pagex on any non-mouse events. do not look for pagex on any non-mouse events in new code and update existing code as soon as possible. syntax var pos = event.pagex value an integer value, in pixels, indicating the x coordinate at which the mouse pointer was located when the event occurred. this value is relative to the left edge of the entire document, regardless of the current horizontal scrolling offset of the document. examples for an example, see the documentation for the standard mouseevent.pagex property, which you should use instead. specifications th...
sourceCapabilities - Web APIs
device is considered "responsible" for an event only when that interaction is part of the abstraction provided by the web platform. for example, many user agents allow a window to be resized with a mouse or a keyboard, but this detail is not exposed to the web platform in any way, and so the sourcecapabilities of a resize event will typically be null. syntax var idc = event.sourcecapabilities value an instance of inputdevicecapabilities. specifications specification status comment inputdevicecapabilitiesthe definition of 'sourcecapabilities' in that specification. draft initial definition. ...
URL.createObjectURL() - Web APIs
s the specified file object or blob object. to release an object url, call revokeobjecturl(). note: this feature is available in web workers. note: this feature is not available in service workers due to its potential to create memory leaks. syntax const objecturl = url.createobjecturl(object) parameters object a file, blob, or mediasource object to create an object url for. return value a domstring containing an object url that can be used to reference the contents of the specified source object. examples see using object urls to display images. usage notes memory management each time you call createobjecturl(), a new object url is created, even if you've already created one for the same object. each of these must be released by calling url.revokeobjecturl() when you no...
URL.hash - Web APIs
Web › API › URL › hash
the hash property of the url interface is a usvstring containing a '#' followed by the fragment identifier of the url. the fragment is not percent-decoded. if the url does not have a fragment identifier, this property contains an empty string — "". note: this feature is available in web workers. syntax const string = url.hash url.hash = newhash value a usvstring. examples const url = new url('/docs/web/api/url/href#examples'); console.log(url.hash); // logs: '#examples' specifications specification status comment urlthe definition of 'url.hash' in that specification. living standard initial definition ...
URL.host - Web APIs
Web › API › URL › host
the host property of the url interface is a usvstring containing the host, that is the hostname, and then, if the port of the url is nonempty, a ':', followed by the port of the url. note: this feature is available in web workers. syntax const host = url.host url.host = newhost value a usvstring. examples let url = new url('/docs/web/api/url/host'); console.log(url.host); // "developer.mozilla.org" url = new url('https://developer.mozilla.org:443/docs/web/api/url/host'); console.log(url.host); // "developer.mozilla.org" // the port number is not included because 443 is the scheme's default port url = new url('https://developer.mozilla.org:4097/docs/web/api/url/host'); console.log(url.host); // "developer.mozilla.org:4097" specifications specification status comment ...
URL.hostname - Web APIs
Web › API › URL › hostname
the hostname property of the url interface is a usvstring containing the domain name of the url. note: this feature is available in web workers. syntax const domain = url.hostname url.hostname = domain value a usvstring. examples const url = new url('/docs/web/api/url/hostname'); console.log(url.hostname); // logs: 'developer.mozilla.org' specifications specification status comment urlthe definition of 'url.hostname' in that specification. living standard initial definition. ...
URL.href - Web APIs
Web › API › URL › href
the href property of the url interface is a usvstring containing the whole url. note: this feature is available in web workers. syntax const urlstring = url.href url.href = newurlstring value a usvstring. examples const url = new url('/docs/web/api/url/href'); console.log(url.href); // logs: '/docs/web/api/url/href' specifications specification status comment urlthe definition of 'url.href' in that specification. living standard initial definition. ...
URL.origin - Web APIs
Web › API › URL › origin
d-only property of the url interface returns a usvstring containing the unicode serialization of the origin of the represented url. the exact structure varies depending on the type of url: for http or https urls, the scheme followed by '://', followed by the domain, followed by ':', followed by the port (the default port, 80 and 443 respectively, if explicitely specified). for file: urls, the value is browser dependant. for blob: urls, the origin of the url following blob: will be used, e.g "blob:https://mozilla.org" will be returned as "https://mozilla.org". note: this feature is available in web workers. syntax const originstring = url.origin value a usvstring. examples const url = new url("blob:https://mozilla.org:443/") console.log(url.origin); // logs 'https://mozilla.org' ...
URL.password - Web APIs
Web › API › URL › password
the password property of the url interface is a usvstring containing the password specified before the domain name. if it is set without first setting the username property, it silently fails. note: this feature is available in web workers. syntax const passwordstring = url.password url.password = newpassword value a usvstring. examples const url = new url('https://anonymous:flabada@developer.mozilla.org/docs/web/api/url/password'); console.log(url.password) // logs "flabada" specifications specification status comment urlthe definition of 'url.password' in that specification. living standard initial definition. ...
URL.pathname - Web APIs
Web › API › URL › pathname
the pathname property of the url interface is a usvstring containing an initial '/' followed by the path of the url (or the empty string if there is no path). note: this feature is available in web workers. syntax const path = url.pathname url.pathname = newpath value a usvstring. examples const url = new url('/docs/web/api/url/pathname?q=value'); console.log(url.pathname); // logs "/docs/web/api/url/pathname" specifications specification status comment urlthe definition of 'url.pathname' in that specification. living standard initial definition. ...
URL.pathname - Web APIs
the pathname property of the url interface is a usvstring containing an initial '/' followed by the path of the url (or the empty string if there is no path). note: this feature is available in web workers. syntax const path = url.pathname url.pathname = newpath value a usvstring. examples const url = new url('/docs/web/api/url/pathname?q=value'); console.log(url.pathname); // logs "/docs/web/api/url/pathname" specifications specification status comment urlthe definition of 'url.pathname' in that specification. living standard initial definition. ...
URL.port - Web APIs
Web › API › URL › port
the port property of the url interface is a usvstring containing the port number of the url. if the url does not contain an explicit port number, it will be set to ''. note: this feature is available in web workers. syntax const portnumber = url.port url.port = newportnumber value a usvstring. examples const url = new url('https://mydomain.com:80/svn/repos/'); console.log(url.port); // logs '80' specifications specification status comment urlthe definition of 'url.port' in that specification. living standard initial definition. ...
URL.protocol - Web APIs
Web › API › URL › protocol
the protocol property of the url interface is a usvstring representing the protocol scheme of the url, including the final ':'. note: this feature is available in web workers. syntax const protocol = url.protocol url.protocol = newprotocol value a usvstring. examples const url = new url('/docs/web/api/url/protocol'); console.log(url.protocol); // logs "https:" specifications specification status comment urlthe definition of 'protocol' in that specification. living standard initial definition. ...
URL.search - Web APIs
Web › API › URL › search
property of the url interface is a search string, also called a query string, that is a usvstring containing a '?' followed by the parameters of the url. modern browsers provide the url.searchparams property to make it easy to parse out the parameters from the query string. note: this feature is available in web workers. syntax const searchparams = object.search url.search = newsearchparams value a usvstring. examples const url = new url('/docs/web/api/url/search?q=123'); console.log(url.search); // logs "?q=123" specifications specification status comment urlthe definition of 'url.search' in that specification. living standard initial definition. ...
URL.search - Web APIs
Web › API › URL › search?q=123
property of the url interface is a search string, also called a query string, that is a usvstring containing a '?' followed by the parameters of the url. modern browsers provide the url.searchparams property to make it easy to parse out the parameters from the query string. note: this feature is available in web workers. syntax const searchparams = object.search url.search = newsearchparams value a usvstring. examples const url = new url('/docs/web/api/url/search?q=123'); console.log(url.search); // logs "?q=123" specifications specification status comment urlthe definition of 'url.search' in that specification. living standard initial definition. ...
URL.searchParams - Web APIs
Web › API › URL › searchParams
the searchparams readonly property of the url interface returns a urlsearchparams object allowing access to the get decoded query arguments contained in the url. note: this feature is available in web workers. syntax const urlsearchparams = url.searchparams value a urlsearchparams object. examples if the url of your page is https://example.com/?name=jonathan%20smith&age=18 you could parse out the name and age parameters using: let params = (new url(document.location)).searchparams; let name = params.get('name'); // is the string "jonathan smith". let age = parseint(params.get('age')); // is the number 18 specifications specification status comment urlthe definition of 'searchparams' in that specification. living standard initial definition. ...
URL.toJSON() - Web APIs
Web › API › URL › toJSON
the tojson() method of the url interface returns a usvstring containing a serialized version of the url, although in practice it seems to have the same effect as url.tostring(). note: this feature is available in web workers. syntax const href = url.tojson() return value a usvstring. examples const url = new url("/docs/web/api/url/tostring"); url.tojson(); // should return the url as a string specifications specification status comment urlthe definition of 'tojson()' in that specification. living standard initial definition. ...
URL.toString() - Web APIs
Web › API › URL › toString
the url.tostring() stringifier method returns a usvstring containing the whole url. it is effectively a read-only version of url.href. note: this feature is available in web workers. syntax const href = url.tostring() return value a usvstring. examples const url = new url("/docs/web/api/url/tostring"); url.tostring(); // should return the url as a string specifications specification status comment urlthe definition of 'stringifier' in that specification. living standard initial definition. ...
URL.username - Web APIs
Web › API › URL › username
the username property of the url interface is a usvstring containing the username specified before the domain name. note: this feature is available in web workers. syntax const usernamestring = url.username url.username = newusername value a usvstring. examples const url = new url('https://anonymous:flabada@developer.mozilla.org/docs/web/api/url/username'); console.log(url.username) // logs "anonymous" specifications specification status comment urlthe definition of 'username' in that specification. living standard initial definition. ...
URLSearchParams() - Web APIs
the urlsearchparams() constructor creates and returns a new urlsearchparams object. note: this feature is available in web workers. syntax var urlsearchparams = new urlsearchparams(init); parameters init optional one of: a usvstring, which will be parsed from application/x-www-form-urlencoded format. a leading '?' character is ignored. a sequence of usvstring pairs, representing names/values. a record of usvstring keys and usvstring values. return value a urlsearchparams object instance. examples the following example shows how to create a urlsearchparams object from a url string. // retrieve params via url.search, passed into ctor var url = new url('https://example.com?foo=1&bar=2'); var params = new urlsearchparams(url.search); // pass in a string literal var params2 = new ...
URLSearchParams.delete() - Web APIs
the delete() method of the urlsearchparams interface deletes the given search parameter and all its associated values, from the list of all search parameters. note: this feature is available in web workers. syntax urlsearchparams.delete(name) parameters name the name of the parameter to be deleted. return value void examples let url = new url('https://example.com?foo=1&bar=2&foo=3'); let params = new urlsearchparams(url.search.slice(1)); // delete the foo parameter. params.delete('foo'); //query string is now: 'bar=2' specifications specification status comment urlthe definition of 'delete()' in that specification. living standard initial definition. ...
URLSearchParams.entries() - Web APIs
the entries() method of the urlsearchparams interface returns an iterator allowing iteration through all key/value pairs contained in this object. the key and value of each pair are usvstring objects. note: this feature is available in web workers. syntax searchparams.entries(); parameters none. return value returns an iterator. examples // create a test urlsearchparams object var searchparams = new urlsearchparams("key1=value1&key2=value2"); // display the key/value pairs for(var pair of searchparams.entries()) { console.log(pair[0]+ ', '+ pair[1]); } the result is: key1, value1 key2, value2 specifications specification status comment urlthe definition of 'entries() (see "iterable")' in that specification. living standard initial definition.
URLSearchParams.forEach() - Web APIs
the foreach() method of the urlsearchparams interface allows iteration through all values contained in this object via a callback function. note: this feature is available in web workers. syntax searchparams.foreach(callback); parameters callback a callback function that is executed against each parameter, with the param value provided as its parameter. return value void. examples // create a test urlsearchparams object var searchparams = new urlsearchparams("key1=value1&key2=value2"); // log the values searchparams.foreach(function(value, key) { console.log(value, key); }); the result is: value1 key1 value2 key2 specifications specification status comment urlthe definition of 'foreach() (see "iterable")' in that specification. living standard...
URLSearchParams.get() - Web APIs
the get() method of the urlsearchparams interface returns the first value associated to the given search parameter. note: this feature is available in web workers. syntax urlsearchparams.get(name) parameters name the name of the parameter to return. return value a usvstring if the given search parameter is found; otherwise, null. examples if the url of your page is https://example.com/?name=jonathan&age=18 you could parse out the 'name' and 'age' parameters using: let params = new urlsearchparams(document.location.search.substring(1)); let name = params.get("name"); // is the string "jonathan" let age = parseint(params.get("age"), 10); // is the number 18 requesting a parameter that isn't present in the query string will return null: let address = params.get("address"); // nul...
URLSearchParams.has() - Web APIs
the has() method of the urlsearchparams interface returns a boolean that indicates whether a parameter with the specified name exists. note: this feature is available in web workers. syntax var hasname = urlsearchparams.has(name) parameters name the name of the parameter to find. return value a boolean. examples let url = new url('https://example.com?foo=1&bar=2'); let params = new urlsearchparams(url.search.slice(1)); params.has('bar') === true; //true specifications specification status comment urlthe definition of 'has()' in that specification. living standard initial definition. ...
URLSearchParams.keys() - Web APIs
the keys() method of the urlsearchparams interface returns an iterator allowing iteration through all keys contained in this object. the keys are usvstring objects. note: this method is available in web workers. syntax searchparams.keys(); parameters none. return value returns an iterator. examples // create a test urlsearchparams object var searchparams = new urlsearchparams("key1=value1&key2=value2"); // display the keys for(var key of searchparams.keys()) { console.log(key); } the result is: key1 key2 specifications specification status comment urlthe definition of 'keys() (see "iterable")' in that specification. living standard initial definition. ...
URLSearchParams.toString() - Web APIs
the tostring() method of the urlsearchparams interface returns a query string suitable for use in a url. note: this method returns the query string without the question mark. this is different from window.location.search, which includes it. note: this feature is available in web workers. syntax urlsearchparams.tostring() parameters none. return value a domstring, without the question mark. (returns an empty string if no search parameters have been set.) examples let url = new url('https://example.com?foo=1&bar=2'); let params = new urlsearchparams(url.search.slice(1)); //add a second foo parameter. params.append('foo', 4); console.log(params.tostring()); //prints 'foo=1&bar=2&foo=4' // note: params can also be directly created let url = new url('https://example.com?foo=1&bar=2');...
URLUtilsReadOnly.origin - Web APIs
the urlutilsreadonly.origin read-only property is a domstring containing the unicode serialization of the origin of the represented url, that is, for http and https, the scheme followed by '://', followed by the domain, followed by ':', followed by the port (the default port, 80 and 443 respectively, if explicitely specified). for url using file: scheme, the value is browser dependant. this version of origin is implemented by workerlocation for use on workers. syntax string = object.origin; examples // on this page, returns the origin var result = self.location.origin; // returns:'https://developer.mozilla.org:443' specifications specification status comment urlthe definition of 'urlutilsreadonly.origin' in that specification. living standard initial de...
USB.getDevices() - Web APIs
Web › API › USB › getDevices
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(). ...
USB.requestDevice() - Web APIs
Web › API › USB › requestDevice
nstance of usbdevice if the specified device is found. calling this function triggers the user agent's pairing flow. syntax usb.requestdevice([filters]) parameters filters an array of filter objects for possible devices you would like to pair. each filter object can have the following properties: vendorid productid classcode subclasscode protocolcode serialnumber return value a promise that resolves with an instance of usbdevice. example the following example looks for one of two usb devices. notice that two product ids are specified. both are passed to requestdevice(). this triggers a user-agent flow that prompts the user to select a device for pairing. only the selected device is passed to then(). the number of filters does not specifiy the number of devices sho...
USBConfiguration.USBConfiguration() - Web APIs
the usbconfiguration() constructor creates a new usbconfiguration object which contains information about the configuration on the provided usbdevice with the given configuration value. syntax var usbconfiguration = new usbconfiguration(device, configurationvalue) parameters device specifies the usbdevice you want to configure. configurationvalue specifies the configuration descriptor you want to read. this is an unsigned integer in the range 0 to 255. specifications specification status comment unknownthe definition of 'usbconfiguration' in that specification. unknown initial definition. ...
USBConfiguration.configurationName - Web APIs
the configurationname read-only property of the usbconfiguration interface returns the name provided by the device to describe this configuration. this is equal to the value of the string descriptor with the index provided in the iconfiguration field of the configuration descriptor defining this configuration. syntax var name = usbconfiguration.configurationname value the name provided by the device to describe this configuration. specifications specification status comment unknownthe definition of 'configurationname' in that specification. unknown initial definition. ...
USBConfiguration.interfaces - Web APIs
the interfaces read-only property of the usbconfiguration interface returns an array containing instances of the usbinterface describing each interface supported by this configuration. syntax var interfaces[] = usbconfiguration.interfaces value an array containing instances of usbinterface. specifications specification status comment unknownthe definition of 'interfaces' in that specification. unknown initial definition. ...
USBDevice.deviceClass - Web APIs
the deviceclass read only property of the usbdevice interface one of three properties that identify usb devices for the purpose of loading a usb driver that will work with that device. the other two properties are usbdevice.devicesubclass and usbdevice.deviceprotocol. syntax var number = usbdevice.deviceclass value a number. specifications specification status comment webusbthe definition of 'deviceclass' in that specification. draft initial definition. ...
USBDevice.claimInterface() - Web APIs
the claiminterface() method of the usbdevice interface returns a promise that resolves when the requested interface is claimed for exclusive access. syntax var promise = usbdevice.claiminterface(interfacenumber) parameters interfacenumber the index of one of the interfaces supported by the device. interfaces are device-specific. return value a promise. example the following example shows claiminterface() in the context of connecting to a usb device. async function connectdevice(usbdevice) { await usbdevice.open(); if (usbdevice.configuration === null) await usbdevice.selectconfiguration(1); await usbdevice.claiminterface(0); } specifications specification status comment webusbthe definition of 'claiminterface()' in that specification. draft...
USBDevice.clearHalt() - Web APIs
when a halt condition is cleared. a halt condition is when a data tranfer to or from the device has a status of 'stall', which requires the web page (the host system, in usb terminology) to clear that condition. see the for details. syntax var promise = usbdevice.clearhalt(direction, endpointnumber) parameters direction indicates whether the devices input or output should be cleared. valid values are 'in' or 'out'. endpointnumber indicates the number of the endpoint to clear. the promise will reject if an invalid endpoint is supplied. return value a promise. example the following example shows how to test for and clear a 'stall' condition in the result of a data transfer. what data can be passed to a usb device and how it is passed is particular and unique to each device. w...
USBDevice.close() - Web APIs
Web › API › USBDevice › close
the close() method of the usbdevice interface returns a promise that resolves when all open interfaces are released and the device session has ended. syntax var promise = usbdevice.close() parameters none. return value a promise. specifications specification status comment webusbthe definition of 'close()' in that specification. draft initial definition. ...
USBDevice.configuration - Web APIs
example the following example uses this property to test for the existence of a usbconfiguration property to select a configuration before claiming an interface. ...
USBDevice.configurations - Web APIs
the configurations read only property of the usbdevice interface an array of device-specific interfaces for controlling a paired usb device. syntax var usbconfiguration[] = usbdevice.configurations value an array of usbconfiguration objects. specifications specification status comment webusbthe definition of 'configurations' in that specification. draft initial definition. ...
USBDevice.deviceClass - Web APIs
the deviceclass read only property of the usbdevice interface one of three properties that identify usb devices for the purpose of loading a usb driver that will work with that device. the other two properties are usbdevice.devicesubclass and usbdevice.deviceprotocol. syntax var number = usbdevice.deviceclass value a number. specifications specification status comment webusbthe definition of 'deviceclass' in that specification. draft initial definition. ...
USBDevice.deviceProtocol - Web APIs
the deviceprotocol read only property of the usbdevice interface one of three properties that identify usb devices for the purpose of loading a usb driver that will work with that device. the other two properties are usbdevice.deviceclass and usbdevice.devicesubclass. syntax var number = usbdevice.deviceprotocol value a number. specifications specification status comment webusbthe definition of 'deviceprotocol' in that specification. draft initial definition. ...
USBDevice.deviceSubclass - Web APIs
the devicesubclass read only property of the usbdevice interface one of three properties that identify usb devices for the purpose of loading a usb driver that will work with that device. the other two properties are usbdevice.deviceclass and usbdevice.deviceprotocol. syntax var serialnumber = usbdevice.devicesubclass value a number. specifications specification status comment webusbthe definition of 'devicesubclass' in that specification. draft initial definition. ...
USBDevice.deviceVersionMajor - Web APIs
the deviceversionmajor read only property of the usbdevice interface he major version number of the device in a semantic versioning scheme. syntax var serialnumber = usbdevice.deviceversionmajor value a number. specifications specification status comment webusbthe definition of 'deviceversionmajor' in that specification. draft initial definition. ...
USBDevice.deviceVersionMinor - Web APIs
the deviceversionminor read only property of the usbdevice interface the minor version number of the device in a semantic versioning scheme. syntax var serialnumber = usbdevice.deviceversionminor value a number. specifications specification status comment webusbthe definition of 'deviceversionminor' in that specification. draft initial definition. ...
USBDevice.deviceVersionSubminor - Web APIs
the deviceversionsubminor read only property of the usbdevice interface the patch version number of the device in a semantic versioning scheme. syntax var serialnumber = usbdevice.deviceversionsubminor value a number. specifications specification status comment webusbthe definition of 'deviceversionsubminor' in that specification. draft initial definition. ...
USBDevice.isochronousTransferIn() - Web APIs
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, packetlengths) parameters endpointnumber the number of a device-specific endpoint (buffer). packetlengths an array of lengths for the packets being received. return value a promise that resolves with a usbisochronousintransferresult specifications specification status comment webusbthe definition of 'isochronoustransferin()' in that specification. draft initial definition. ...
USBDevice.isochronousTransferOut() - Web APIs
ferresult when time sensitive information has been transmitted to the usb device. syntax var promise = usbdevice.isochronoustransferout(endpointnumber, data, packetlengths) parameters endpointnumber the number of a device-specific endpoint (buffer). data a typedarray containing the data to send to the device. packetlengths 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. ...
USBDevice.manufacturerName - Web APIs
the manufacturername read only property of the usbdevice interface the of the organization that manufactured the usb device. syntax var serialnumber = usbdevice.manufacturername value a domstring. specifications specification status comment webusbthe definition of 'manufacturername' in that specification. draft initial definition. ...
USBDevice.open() - Web APIs
Web › API › USBDevice › open
the open() method of the usbdevice interface returns a promise that resolves when a device session has started. syntax var promise = usbdevice.open() parameters none. return value a promise. specifications specification status comment webusbthe definition of 'open()' in that specification. draft initial definition. ...
USBDevice.productID - Web APIs
the productid read only property of the usbdevice interface the manufacturer-defined code that identifies a usb device. syntax var serialnumber = usbdevice.productid value the manufacturer-defined code that identifies a usb device. specifications specification status comment webusbthe definition of 'productid' in that specification. draft initial definition. ...
USBDevice.productName - Web APIs
the productname read only property of the usbdevice interface the manufacturer-defined name that identifies a usb device. syntax var serialnumber = usbdevice.productname value the manufacturer-defined name that identifies a usb device. specifications specification status comment webusbthe definition of 'productname' in that specification. draft initial definition. ...
USBDevice.releaseInterface() - Web APIs
the releaseinterface() method of the usbdevice interface returns a promise that resolves when a cliamed interface is released from exclusive access. syntax var promise = usbdevice.releaseinterface(interfacenumber) parameters interfacenumber the device-specific index of the currently-claimed interface. return value a promise. specifications specification status comment webusbthe definition of 'releaseinterface()' in that specification. draft initial definition. ...
USBDevice.reset() - Web APIs
Web › API › USBDevice › reset
the reset() method of the usbdevice interface returns a promise that resolves when the device is reset and all app operations canceled and their promises rejected. syntax var promise = usbdevice.reset() parameters none. return value a promise. specifications specification status comment webusbthe definition of 'reset()' in that specification. draft initial definition. ...
USBDevice.selectAlternateInterface() - Web APIs
the usbdevice interface returns a promise that resolves when the specified alternative endpoint is selected. syntax var promise = usbdevice.selectalternateinterface(interfacenumber, alternatesetting) parameters interfacenumber the index of one of the interfaces supported by the device. interfaces are device-specific. alternatesetting the configuration of the selected interface. return value a promise. specifications specification status comment webusbthe definition of 'selectalternateinterface()' in that specification. draft initial definition. ...
USBDevice.selectConfiguration() - Web APIs
the selectconfiguration() method of the usbdevice interface returns a promise that resolves when the specified configuration is selected. syntax var promise = usbdevice.selectconfiguration(configurationvalue) parameters configurationvalue the number of a device-specific configuration. return value a promise. specifications specification status comment webusbthe definition of 'selectconfiguration' in that specification. draft initial definition. ...
USBDevice.serialNumber - Web APIs
the serialnumber read only property of the usbdevice interface is the manufacturer-defined serial number for the specific usb device. syntax var serialnumber = usbdevice.serialnumber value the serial number for the specified usb device specifications specification status comment webusbthe definition of 'serialnumber' in that specification. draft initial definition. ...
USBDevice.transferIn() - Web APIs
lves with a usbtransferinresult when bulk or interrupt data is received from the usb device. syntax var promise = usbdevice.transferin(endpointnumber, length) parameters endpointnumber the number of a device-specific endpoint (buffer). length the maximum number of bytes that will be read back from the device. the actual data is in the usbintransferresult in the resolved promise. return value a promise that resolves with a usbtransferinresult. specifications specification status comment webusbthe definition of 'transferin()' in that specification. draft initial definition. ...
USBDevice.transferOut() - Web APIs
the transferout() method of the usbdevice interface returns a promise that resolves with a usbtransferoutresult when bulk or interrupt data is sent to the usb device. syntax var promise = usbdevice.transferout(endpointnumber, data) parameters endpointnumber the number of a device-specific endpoint (buffer). data a typedarray containing the data to send to the device. return value a promise that resolves with a usbtransferoutresult. specifications specification status comment webusbthe definition of 'transferout()' in that specification. draft initial definition. ...
USBDevice.usbVersionMajor - Web APIs
the usbversionmajor read only property of the usbdevice interface is one of three properties that declare the usb protocol version supported by the device. the other two properties are usbdevice.usbversionminor and usbdevice.usbversionsubminor. syntax var serialnumber = usbdevice.usbversionmajor value the last of three properties that declare the usb protocol version supported by the device. specifications specification status comment webusbthe definition of 'usbversionmajor' in that specification. draft initial definition. ...
USBDevice.usbVersionMinor - Web APIs
the usbversionminor read only property of the usbdevice interface is one of three properties that declare the usb protocol version supported by the device. the other two properties are usbdevice.usbversionmajor and usbdevice.usbversionsubminor. syntax var serialnumber = usbdevice.usbversionminor value the second of three properties that declare the usb protocol version supported by the device. specifications specification status comment webusbthe definition of 'usbversionminor' in that specification. draft initial definition. ...
USBDevice.usbVersionSubminor - Web APIs
the usbversionsubminor read only property of the usbdevice interface is one of three properties that declare the usb protocol version supported by the device. the other two properties are usbdevice.usbversionmajor and usbdevice.usbversionminor. syntax var serialnumber = usbdevice.usbversionsubminor value the first of three properties that declare the usb protocol version supported by the device. specifications specification status comment webusbthe definition of 'usbversionsubminor' in that specification. draft initial definition. ...
USBDevice.vendorID - Web APIs
the vendorid read only property of the usbdevice interface is the official usg.org-assigned vendor id. syntax var serialnumber = usbdevice.vendorid value the official usg.org-assigned vendor id. specifications specification status comment webusbthe definition of 'vendorid' in that specification. draft initial definition. ...
USBEndpoint - Web APIs
an endpoint represents a unidirectional data stream into or out of a device. constructor usbendpoint.usbendpoint creates a new usbendpoint object which will be populated with information about the endpoint on the provided usbaltenateinterface with the given endpoint number and transfer direction. properties usbendpoint.endpointnumber returns this endpoint's "endpoint number" which is a value from 1 to 15 extracted from the bendpointaddress field of the endpoint descriptor defining this endpoint. this value is used to identify the endpoint when calling methods on usbdevice. usbendpoint.direction returns the direction in which this endpoint transfers data, one of: "in" - data is transferred from device to host. "out" - data is transferred from host to device. usben...
USBInterface - Web APIs
this interface. this is equal to the binterfacenumber field of the interface descriptor defining this interface. usbinterface.alternateread only returns the currently selected alternative configuration of this interface. by default this is the usbalternateinterface from alternates with alternatesetting equal to 0. it can be changed by calling usbdevice.selectalternateinterface() with any other value found in alternates. usbinterface.alternatesread only returns an array containing instances of the usbalternateinterface interface describing each of the alternative configurations possible for this interface. usbinterface.claimedread only returns whether or not this interface has been claimed by the current page by calling usbdevice.claiminterface(). specifications specificatio...
UserProximityEvent.near - Web APIs
the near property tell if there is an object close to the device (true) or not (false). syntax var near = userproximityevent.near; value a boolean ...
VRStageParameters - Web APIs
this interface is accessible through the vrdisplay.stageparameters property. properties vrstageparameters.sittingtostandingtransform read only contains a matrix that transforms the sitting-space view matrices of vrframedata to standing-space. vrstageparameters.sizex read only returns the width of the play-area bounds in meters. vrstageparameters.sizey read only returns the depth of the play-area bounds in meters. ...
VTTCue() - Web APIs
Web › API › VTTCue › VTTCue
lies. for example, if a cue is to be visible from 50 seconds to a one minute, five and a half seconds in the media's playback, starttime will be 50.0. endtime this is a double representing the ending time for this text track cue. this is the time at which the cue should stop being presented to the user, given in seconds and fractions thereof. given the example cue mentioned under starttime, the value of endtime would be 65.5. text a domstring providing the text that will be shown during the time span indicated by starttime and endtime. return value a new vttcue object representing a cue which will be presented during the time span given. example // create a cue that is shown from 2 to 3 seconds and uses the given text. var cue = new vttcue(2, 3, 'cool text to be displayed'); specifica...
VTTCue - Web APIs
Web › API › VTTCue
gion that the cue will be drawn onto, or null if none is assigned. vttcue.vertical returns an enum representing the cue writing direction. vttcue.snaptolines returns true if the vttcue.line attribute is an integer number of lines or a percentage of the video size. vttcue.line returns the line positioning of the cue. this can be the string auto or a number whose interpretation depends on the value of vttcue.snaptolines. vttcue.linealign returns an enum representing the alignment of the vttcue.line. vttcue.position returns the indentation of the cue within the line. this can be the string auto or a number representing the percentage of the vttcue.region, or the video size if vttcue.region is null. vttcue.positionalign returns an enum representing the alignment of the cue. this is used...
validityState.badInput - Web APIs
the read-only badinput property of a validitystate object indicates if the user has provided input that the browser is unable to convert. for example, if you have a number input element whose content is a string. note: while this is unsupported in internet explorer, any non-numeric value will be dismissed from the field if it is a number input. example <input type="number" id="age"> var input = document.getelementbyid("age"); if (input.validity.badinput) { console.log("bad input detected…"); } else { console.log("content of input ok."); } specifications specification status comment html living standardthe definition of 'validitystate.badinput' in that specification. living standard live standard html 5.1the definition of 'validitystate.badinpu...
ValidityState.stepMismatch - Web APIs
the read-only stepmismatch property of a validitystate object indicates if the value of an <input>, after having been edited by the user, does not conform to the constraints set by the element's step attribute. if the field is numeric in nature, including the date, month, week, time, datetime-local, number and range types and the step value is not any, if the value don't doesn't conform to the constraints set by the step and min values, then stepmismatch will be true. if the remainder of the form control's value less the min value, divided by the step value (which defaults to 1 if ommitted) is not zero, there is a mismatch. given the following: <input type="number" min="20" max="40" step="2"/> if (value - min) / 2 != 0, stepmismatch will be true. if true, the element matches the :...
validityState.tooLong - Web APIs
specifications specification status comment html living standardthe definition of 'validitystate.toolong' in that specification. living standard html 5.1the 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. living standard html 5.1the definition of 'validitystate.tooshort' in that specification. ...
VideoPlaybackQuality.totalFrameDelay - Web APIs
rk in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. ...
VideoPlaybackQuality.totalVideoFrames - Web APIs
the videoplaybackquality interface's totalvideoframes read-only property returns the total number of video frames that have been displayed or dropped since the media was loaded. syntax value = videoplaybackquality.totalvideoframes; value the total number of frames that the <video> element has displayed or dropped since the media was loaded into it. essentially, this is the number of frames the element would have presented had no problems occurred. this value is reset when the media is reloaded or replaced. example this example calls getvideoplaybackquality() to obtain a videoplaybackquality object, then determines what percentage of frames have been lost by either corruption or being dropped. if that exceeds 10% (0.1), a function called lostframesthresholdexceeded() is called to, perhap...
VideoTrack.id - Web APIs
Web › API › VideoTrack › id
perty contains a string which uniquely identifies the track represented by the videotrack. this id can be used with the videotracklist.gettrackbyid() method to locate a specific track within the media associated with a media element. the track id can also be used as the fragment of a url that loads the specific track (if the media supports media fragments). syntax var trackid = videotrack.id; value a domstring which identifies the track, suitable for use when calling gettrackbyid() on an videotracklist such as the one specified by a media element's videotracks property. specifications specification status comment html living standardthe definition of 'videotrack: id' in that specification. living standard ...
VideoTrack.kind - Web APIs
Web › API › VideoTrack › kind
the string is one of those found in video track kind strings below. ...
VideoTrack.label - Web APIs
Web › API › VideoTrack › label
otherwise, an empty string ("") is returned. for example, a track whose kind is "sign" might have a label such as "a sign-language interpretation.". ...
Videotrack.language - Web APIs
the read-only videotrack property language returns a string identifying the language used in the video track. for tracks that include multiple languages (such as a movie in english in which a few lines are spoken in other languages), this should be the video's primary language. syntax var videotracklanguage = videotrack.language; value a domstring specifying the bcp 47 (rfc 5646) format language tag of the primary language used in the video track, or an empty string ("") if the language is not specified or known, or if the track doesn't contain speech. for example, if the primary language used in the track is united states english, this value would be "en-us". for brazilian portuguese, the value would be "pt-br". specifications specification status comment ht...
VideoTrack.sourceBuffer - Web APIs
specifications specification status comment media source extensionsthe definition of 'videotrack: sourcebuffer' in that specification. recommendation ...
VideoTrack - Web APIs
only a single video track can be active at any given time, so setting this property to true for one track while another track is active will make that other track inactive. ...
getTrackById - Web APIs
the videotracklist method gettrackbyid() returns the first videotrack object from the track list whose id matches the specified string. this lets you find a specified track if you know its id string. syntax var thetrack = videotracklist.gettrackbyid(id); paramters id a domstring indicating the id of the track to locate within the track list. return value a videotrack object indicating the first track found within the videotracklist whose id matches the specified string. if no match is found, this method returns null. the tracks are searched in their natural order; that is, in the order defined by the media resource itself, or, if the resource doesn't define an order, the relative order in which the tracks are declared by the media resource. specifications specification ...
VideoTrackList.onaddtrack - Web APIs
occurs, indicating that a new video track has been added to the media element whose video tracks the videotracklist represents. the event is passed into the event handler in the form of a trackevent object, whose track property identifies the newly-added track. note: you can also add a handler for the addtrack event using addeventlistener(). syntax videotracklist.onaddtrack = eventhandler; value set onaddtrack to a function that accepts as input a trackevent object which indicates in its track property which video track has been added to the media. usage notes the addtrack event is called whenever a new track is added to the media element whose video tracks are represented by the videotracklist object. this happens when tracks are added to the element when the media is first attached ...
VideoTrackList.onchange - Web APIs
deotracklist has been made active. the event is passed into the event handler in the form of an event object; the event doesn't provide any additional information. to determine the new state of media's tracks, you'll have to look at their videotrack.selected flags. note: you can also add a handler for the change event using addeventlistener(). syntax videotracklist.onchange = eventhandler; value set onchange to a function that should be called whenever a track is made active. example this snippet establishes a handler for the change event that looks at each of the tracks in the list, calling a function to update the state of a user interface control that indicates the current state of the track. var tracklist = document.queryselector("video").videotracks; tracklist.onchange = functi...
VideoTrackList.onremovetrack - Web APIs
removed from the media element, and therefore also from the videotracklist. the event is passed into the event handler in the form of a trackevent object, whose track property identifies the track that was removed from the media element's videotracklist. note: you can also add a handler for the removetrack event using addeventlistener(). syntax videotracklist.onremovetrack = eventhandler; value set onremovetrack to a function that accepts as input a trackevent object which indicates in its track property which video track has been removed from the media element. example this simple example just fetches the current number of video tracks in the media element whenever a track is removed from the media element. document.queryselector("my-video").videotracks.onremovetrack = function(eve...
VideoTrackList.selectedIndex - Web APIs
the read-only videotracklist property selectedindex returns the index of the currently selected track, if any, or -1 otherwise. syntax var index = videotracklist.selectedindex; value a number indicating the index of the currently selected track, if any, or -1 otherwise. specifications specification status comment html living standardthe definition of 'videotracklist: selectedindex' in that specification. living standard ...
VideoTrackList - Web APIs
ad only the number of tracks in the list. selectedindex read only the index of the currently selected track, if any, or −1 otherwise. event handlers onaddtrack an event handler to be called when the addtrack event is fired, indicating that a new video track has been added to the media element. onchange an event handler to be called when the change event occurs — that is, when the value of the selected property for a track has changed, due to the track being made active or inactive. onremovetrack an event handler to call when the removetrack event is sent, indicating that a video track has been removed from the media element. methods this interface also inherits methods from its parent interface, eventtarget. gettrackbyid() returns the videotrack found within the videot...
VisualViewport.height - Web APIs
the height read-only property of the visualviewport interface returns the height of the visual viewport, in css pixels. syntax var height = visualviewport.height value a double. specifications specification status comment visual viewport apithe definition of 'height' in that specification. draft initial definition. ...
VisualViewport.offsetTop - Web APIs
the offsettop read-only property of the visualviewport interface returns the offset of the top edge of the visual viewport from the top edge of the layout viewport in css pixels. syntax var offsettop = visualviewport.offsettop value a double. specifications specification status comment visual viewport apithe definition of 'offsettop' in that specification. draft initial definition. ...
VisualViewport.offsetleft - Web APIs
the offsetleft read-only property of the visualviewport interface returns the offset of the left edge of the visual viewport from the left edge of the layout viewport in css pixels. syntax var offsetleft = visualviewport.offsetleft value a double. specifications specification status comment visual viewport apithe definition of 'offsetleft' in that specification. draft initial definition. ...
VisualViewport.pageLeft - Web APIs
the pageleft read-only property of the visualviewport interface returns the x coordinate of the left edge of the visual viewport relative to the initial containing block origin, in css pixels. syntax var pageleft = visualviewport.pageleft value a double. specifications specification status comment visual viewport apithe definition of 'pageleft' in that specification. draft initial definition. ...
VisualViewport.pageTop - Web APIs
the pagetop read-only property of the visualviewport interface returns the y coordinate of the top edge of the visual viewport relative to the initial containing block origin, in css pixels. syntax var pagetop = visualviewport.pagetop value a double. specifications specification status comment visual viewport apithe definition of 'pagetop' in that specification. draft initial definition. ...
VisualViewport.scale - Web APIs
the scale read-only property of the visualviewport interface returns the pinch-zoom scaling factor applied to the visual viewport. syntax var scale = visualviewport.scale value a double. specifications specification status comment visual viewport apithe definition of 'scale' in that specification. draft initial definition. ...
VisualViewport.width - Web APIs
the width read-only property of the visualviewport interface returns the width of the visual viewport, in css pixels. syntax var width = visualviewport.width value a double. specifications specification status comment visual viewport apithe definition of 'width' in that specification. draft initial definition. ...
Visual Viewport API - Web APIs
he viewport's position and size, and receives the resize and event:visualviewport:scroll events you can onitor to know when chances occur to the window's viewport. example the code below is based on the sample the specification, though it adds a few things that make it function better. it shows a function called viewporthandler(). when called it queries the offsetleft and height properties for values it uses in a css translate() method. you invoke this function by passing it to both event calls. one thing that may not be clear in this example is the use of the pendingupdate flag and the call to requestanimationframe(). the pendingupdate flag serves to prevent multiple invocations of the transfrom that can occur when onresize and onscroll fire at the same time. using requestanimationframe() ...
WEBGL_compressed_texture_astc.getSupportedProfiles() - Web APIs
the webgl_compressed_texture_astc.getsupportedprofiles() method returns an array of strings containing the names of the astc profiles supported by the implementation. syntax sequence<domstring> ext.getsupportedprofiles(); return value an array of domstring elements indicating which astc profiles are supported by the implementation. currently, this can be: "ldr": low dynamic range. "hdr": high dynamic range. dynamic range refers to ratio between the brightest and darkest parts of the scene. low dynamic ranges are for example jpeg format images which won't exceed 255:1, or crt monitors which won't exceed 100:1. an hdr image stores pixel values that span the whole tonal range of real-world scenes (100,000:1). examples var ext = gl.getextension('webgl_compressed_texture_astc'); ext.ge...
WEBGL_compressed_texture_pvrtc - Web APIs
ebgl1 and webgl2 contexts. note: on ios devices, this extension is named webkit_webgl_compressed_texture_pvrtc. constants the compressed texture formats are exposed by four constants and can be used in two functions: compressedteximage2d() (where the height and width parameters must be powers of 2) and compressedtexsubimage2d() (where the the height and width parameters must equal the current values of the existing texture and the xoffset and yoffset parameters must be 0). ext.compressed_rgb_pvrtc_4bppv1_img rgb compression in 4-bit mode. one block for each 4×4 pixels. ext.compressed_rgba_pvrtc_4bppv1_img rgba compression in 4-bit mode. one block for each 4×4 pixels. ext.compressed_rgb_pvrtc_2bppv1_img rgb compression in 2-bit mode. one block for each 8×4 pixels. ext.compressed_...
WEBGL_compressed_texture_s3tc - Web APIs
lable to both, webgl1 and webgl2 contexts. constants the compressed texture formats are exposed by four constants and can be used in two functions: compressedteximage2d() and compressedtexsubimage2d(). ext.compressed_rgb_s3tc_dxt1_ext a dxt1-compressed image in an rgb image format. ext.compressed_rgba_s3tc_dxt1_ext a dxt1-compressed image in an rgb image format with a simple on/off alpha value. ext.compressed_rgba_s3tc_dxt3_ext a dxt3-compressed image in an rgba image format. compared to a 32-bit rgba texture, it offers 4:1 compression. ext.compressed_rgba_s3tc_dxt5_ext a dxt5-compressed image in an rgba image format. it also provides a 4:1 compression, but differs to the dxt3 compression in how the alpha compression is done. examples var ext = ( gl.getextension('webgl_compres...
WEBGL_compressed_texture_s3tc_srgb - Web APIs
both webgl1 and webgl2 contexts. constants the compressed texture formats are exposed by four constants and can be used in two functions: compressedteximage2d() and compressedtexsubimage2d(). ext.compressed_srgb_s3tc_dxt1_ext a dxt1-compressed image in an srgb image format. ext.compressed_srgb_alpha_s3tc_dxt1_ext a dxt1-compressed image in an srgb image format with a simple on/off alpha value. ext.compressed_srgb_alpha_s3tc_dxt3_ext a dxt3-compressed image in an srgba image format. ext.compressed_srgb_alpha_s3tc_dxt5_ext a dxt5-compressed image in an srgba image format. examples var ext = gl.getextension('webgl_compressed_texture_s3tc_srgb'); var texture = gl.createtexture(); gl.bindtexture(gl.texture_2d, texture); gl.compressedteximage2d(gl.texture_2d, 0, ext.compressed_srgb...
WEBGL_debug_shaders.getTranslatedShaderSource() - Web APIs
the webgl_debug_shaders.gettranslatedshadersource() method is part of the webgl api and allows you to debug a translated shader. syntax gl.getextension('webgl_debug_shaders').gettranslatedshadersource(shader); parameters shader a webglshader to get the translated source from. return value a string containing the translated shader source. an empty string is returned, if: no source has been defined or, webglrenderingcontext.compileshader() has not yet been called or, the translation for the shader failed. examples var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var shader = gl.createshader(gl.fragment_shader); gl.shadersource(shader, 'void main() { gl_fragcolor = vec4(gl_fragcoord.x, 0.0, 0.0, 1.0); }'); gl.compileshader(shader); var src =...
WakeLock.request() - Web APIs
Web › API › WakeLock › request
the request() method of the wakelock interface returns a promise that resolves with a wakelocksentinel object, which allows control over screen dimming and locking. syntax var wakelock = navigator.wakelock.request(type); parameters type options are as follows: 'screen': requests a screen wake lock. prevents devices from dimming or locking the screen. return value a promise that resolves with a wakelocksentinel object. exceptions notallowederror thrown when wake lock is not available, which can happen because: document is not allowed to use screen wake lock due to screen-wake-lock policy. document is not fully active. document is hidden. user agent could not acquire platform's wake lock. examples the following asynchronous function requests a w...
WakeLockSentinel.release() - Web APIs
you should always listen for the onrelease event to check if a wake lock has been released. examples in this example, when a user clicks a button the wakelocksentinel is released. ...
WakeLockSentinel - Web APIs
nactive or looses visibility, if the device is low on power or the user turns on a power save mode. releasing all wakelocksentinel instances of a given wake lock type will cause the underlying platform wake lock to be released. properties this interface provides the following properties. type read only returns a string representation of the currently acquired wakelocksentinel type. return values are: 'screen': a screen wake lock. prevents devices from dimming or locking the screen. event handlers onrelease fired when the release() method is called or the wake lock is released by the user agent. methods release() releases the wakelocksentinel, returning a promise that is resolved once the sentinel has been successfully released. examples in this example we create a...
WaveShaperNode.curve - Web APIs
the curve property of the waveshapernode interface is a float32array of numbers describing the distortion to apply. the mid-element of the array is applied to any signal value of 0, the first one to signal values of -1, and the last to signal values of 1; values lower than -1 or greater than 1 are treated like -1 or 1 respectively. if necessary, intermediate values of the distortion curve are linearly interpolated. note: the array can be a null value: in that case, no distortion is applied to the input signal. syntax var audioctx = new audiocontext(); var distortion = audioctx.createwaveshaper(); distortion.curve = mycurvedataarray; // mycurvedataarray is a float32array value a float32array. example the following example shows basic usage of an audiocontext to create a wave shaper ...
WaveShaperNode - Web APIs
channel count 2 (not used in the default count mode) channel interpretation "speakers" constructor waveshapernode() creates a new instance of an waveshapernode object. properties inherits properties from its parent, audionode. waveshapernode.curve is a float32array of numbers describing the distortion to apply. waveshapernode.oversample is an enumerated value indicating if oversampling must be used. oversampling is a technique for creating more samples (up-sampling) before applying the distortion effect to the audio signal. methods no specific method; inherits methods from its parent, audionode. example the following example shows basic usage of an audiocontext to create a wave shaper node. for applied examples/information, check out our voice-ch...
WebGL2RenderingContext.beginQuery() - Web APIs
the webgl2renderingcontext.beginquery() method of the webgl 2 api starts an asynchronous query. the target parameter indicates which kind of query to begin. syntax void gl.beginquery(target, query); parameters target a glenum specifying the target of the query. possible values: gl.any_samples_passed: specifies an occlusion query: these queries detect whether an object is visible (whether the scoped drawing commands pass the depth test and if so, how many samples pass). gl.any_samples_passed_conservative: same as above above, but less accurate and faster version. gl.transform_feedback_primitives_written: number of primitives that are written to transform feedback buffers. query a webglquery object for which to start the querying. return value none. examples ...
WebGL2RenderingContext.beginTransformFeedback() - Web APIs
the webgl2renderingcontext.begintransformfeedback() method of the webgl 2 api starts a transform feedback operation. syntax void gl.begintransformfeedback(primitivemode); parameters primitivemode a glenum specifying the output type of the primitives that will be recorded into the buffer objects that are bound for transform feedback. possible values: gl.points gl.lines gl.triangles return value none. examples var transformfeedback = gl.createtransformfeedback(); gl.bindtransformfeedback(gl.transform_feedback, transformfeedback); gl.begintransformfeedback(gl.triangles); gl.drawarrays(gl.triangles, 0, 3); specifications specification status comment webgl 2.0the definition of 'begintransformfeedback' in that specification. editor's d...
WebGL2RenderingContext.bindBufferBase() - Web APIs
the webgl2renderingcontext.bindbufferbase() method of the webgl 2 api binds a given webglbuffer to a given binding point (target) at a given index. syntax void gl.bindbufferbase(target, index, buffer); parameters target a glenum specifying the target for the bind operation. possible values: gl.transform_feedback_buffer gl.uniform_buffer index a gluint specifying the index of the target. buffer a webglbuffer which to bind to the binding point (target). return value none. examples gl.bindbufferbase(gl.transform_feedback_buffer, 0, buffer); specifications specification status comment webgl 2.0the definition of 'bindbufferbase' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definitio...
WebGL2RenderingContext.bindBufferRange() - Web APIs
the webgl2renderingcontext.bindbufferrange() method of the webgl 2 api binds a range of a given webglbuffer to a given binding point (target) at a given index. syntax void gl.bindbufferrange(target, index, buffer, offset, size); parameters target a glenum specifying the target for the bind operation. possible values: gl.transform_feedback_buffer gl.uniform_buffer index a gluint specifying the index of the target. buffer a webglbuffer which to bind to the binding point (target). offset a glintptr specifying the starting offset. size a glsizeiptr specifying the amount of data that can be read from the buffer. return value none. examples gl.bindbufferrange(gl.transform_feedback_buffer, 1, buffer, 0, 4); specifications specification status ...
WebGL2RenderingContext.bindSampler() - Web APIs
the webgl2renderingcontext.bindsampler() method of the webgl 2 api binds a passed webglsampler object to the texture unit at the passed index. syntax void gl.bindsampler(unit, sampler); parameters unit a gluint specifying the index of the texture unit to which to bind the sampler to. sampler a webglsampler object to bind. return value none. examples var sampler = gl.createsampler(); gl.bindsampler(0, sampler); specifications specification status comment webgl 2.0the definition of 'bindsampler' in that specification. editor's draft initial definition. opengl es 3.0the definition of 'glbindsampler' in that specification. standard man page of the (similar) opengl api. ...
WebGL2RenderingContext.bindTransformFeedback() - Web APIs
the webgl2renderingcontext.bindtransformfeedback() method of the webgl 2 api binds a passed webgltransformfeedback object to the current gl state. syntax void gl.bindtransformfeedback(target, transformfeedback); parameters target a glenum specifying the target (binding point). must be gl.transform_feedback. transformfeedback a webgltransformfeedback object to bind. return value none. examples var transformfeedback = gl.createtransformfeedback(); gl.bindtransformfeedback(gl.transform_feedback, transformfeedback); specifications specification status comment webgl 2.0the definition of 'bindtransformfeedback' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'glbindtransformfeedback'...
WebGL2RenderingContext.bindVertexArray() - Web APIs
examples var vao = gl.createvertexarray(); gl.bindvertexarray(vao); // ... // calls to bindbuffer or vertexattribpointer // which will be "recorded" in the vao // ... ...
WebGL2RenderingContext.blitFramebuffer() - Web APIs
srcy0, srcx1, srcy1, dstx0, dsty0, dstx1, dsty1, mask, filter); parameters srcx0, srcy0, srcx1, srcy1 a glint specifying the bounds of the source rectangle. dstx0, dsty0, dstx1, dsty1 a glint specifying the bounds of the destination rectangle. mask a glbitfield specifying a bitwise or mask indicating which buffers are to be copied. possible values: gl.color_buffer_bit gl.depth_buffer_bit gl.stencil_buffer_bit filter a glenum specifying the interpolation to be applied if the image is stretched. possible values: gl.nearest gl.linear return value none. examples gl.blitframebuffer(0, 0, canvas.width, canvas.height, 0, 0, canvas.width, canvas.height, gl.color_buffer_bit, gl.nea...
WebGL2RenderingContext.clientWaitSync() - Web APIs
ync, flags, timeout); parameters sync a webglsync object on which to wait on. flags a glbitfield specifying a bitwise combination of flags controlling the flushing behavior. may be gl.sync_flush_commands_bit. timeout a glint64 specifying a timeout (in nanoseconds) for which to wait for the sync object to become signaled. must not be larger than gl.max_client_wait_timeout_webgl. return value a glenum indicating the sync object's status. gl.already_signaled: indicates that the sync object was signaled when this method was called. gl.timeout_expired: indicates that the timeout time passed and that the sync object did not become signaled. gl.condition_satisfied: indicates that the sync object was signaled before the timeout expired. gl.wait_failed: indicates that an error occurre...
WebGL2RenderingContext.createQuery() - Web APIs
examples gl must be a webgl2renderingcontext. webglquery objects are not available in webgl 1. ...
WebGL2RenderingContext.createSampler() - Web APIs
examples gl must be a webgl2renderingcontext. webglsampler objects are not available in webgl 1. ...
WebGL2RenderingContext.createTransformFeedback() - Web APIs
examples gl must be a webgl2renderingcontext. webgltransformfeedback objects are not available in webgl 1. ...
WebGL2RenderingContext.createVertexArray() - Web APIs
the webgl2renderingcontext.createvertexarray() method of the webgl 2 api creates and initializes a webglvertexarrayobject object that represents a vertex array object (vao) pointing to vertex array data and which provides names for different sets of vertex data. syntax webglvertexarrayobject gl.createvertexarray(); parameters none. return value a webglvertexarrayobject representing a vertex array object (vao) which points to vertex array data. examples var vao = gl.createvertexarray(); gl.bindvertexarray(vao); // ... // calls to bindbuffer or vertexattribpointer // which will be "recorded" in the vao // ... specifications specification status comment webgl 2.0the definition of 'createvertexarray' in that specification. editor's draft initial...
WebGL2RenderingContext.deleteQuery() - Web APIs
examples gl must be a webgl2renderingcontext. webglquery objects are not available in webgl 1. var query = gl.createquery(); // ... ...
WebGL2RenderingContext.deleteSampler() - Web APIs
examples gl must be a webgl2renderingcontext. webglsampler objects are not available in webgl 1. var sampler = gl.createsampler(); // ... ...
WebGL2RenderingContext.deleteSync() - Web APIs
examples gl must be a webgl2renderingcontext. webglsync objects are not available in webgl 1. var sync = gl.fencesync(gl.sync_gpu_commands_complete, 0); // ... ...
WebGL2RenderingContext.deleteTransformFeedback() - Web APIs
examples gl must be a webgl2renderingcontext. webgltransformfeedback objects are not available in webgl 1. var transformfeedback = gl.createtransformfeedback(); // ... ...
WebGL2RenderingContext.deleteVertexArray() - Web APIs
examples var vao = gl.createvertexarray(); gl.bindvertexarray(vao); // ... ...
WebGL2RenderingContext.endQuery() - Web APIs
the webgl2renderingcontext.endquery() method of the webgl 2 api marks the end of a given query target. syntax void gl.endquery(target); parameters target a glenum specifying the target of the query. possible values: gl.any_samples_passed: specifies an occlusion query: these queries detect whether an object is visible (whether the scoped drawing commands pass the depth test and if so, how many samples pass). gl.any_samples_passed_conservative: same as above above, but less accurate and faster version. gl.transform_feedback_primitives_written: number of primitives that are written to transform feedback buffers. return value none. examples var query = gl.createquery(); gl.beginquery(gl.any_samples_passed, query); // ... gl.endquery(gl.any_samples_passed); sp...
WebGL2RenderingContext.endTransformFeedback() - Web APIs
examples var transformfeedback = gl.createtransformfeedback(); gl.bindtransformfeedback(gl.transform_feedback, transformfeedback); gl.begintransformfeedback(gl.triangles); gl.drawarrays(gl.triangles, 0, 3); gl.endtransformfeedback(); specifications specification status comment webgl 2.0the definition of 'endtransformfeedback' in that specification. ...
WebGL2RenderingContext.fenceSync() - Web APIs
it into the gl command stream. syntax webglsync gl.fencesync(condition, flags); parameters condition a glenum specifying the condition that must be met to set the sync object's state to signaled. must be gl.sync_gpu_commands_complete. flags a glbitfield specifying a bitwise combination of flags controlling the behavior of the sync object. must be 0 (exists for extensions only). return value a webglsync object. examples gl must be a webgl2renderingcontext. webglsync objects are not available in webgl 1. var sync = gl.fencesync(gl.sync_gpu_commands_complete, 0); specifications specification status comment webgl 2.0the definition of 'fencesync' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition o...
WebGL2RenderingContext.getActiveUniformBlockName() - Web APIs
ntext.getactiveuniformblockname() method of the webgl 2 api retrieves the name of the active uniform block at a given index within a webglprogram. syntax domstring gl.getactiveuniformblockname(program, uniformblockindex); parameters program a webglprogram containing the uniform block. uniformblockindex a gluint specifying the index of the uniform block to whose name to retrieve. return value a domstring indicating the active uniform block name. examples var blockname = gl.getactiveuniformblockname(program, 0); specifications specification status comment webgl 2.0the definition of 'getactiveuniformblockname' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'glgetactiveuniformblockname' in tha...
WebGL2RenderingContext.getFragDataLocation() - Web APIs
the webgl2renderingcontext.getfragdatalocation() method of the webgl 2 api returns the binding of color numbers to user-defined varying out variables. syntax glint gl.getfragdatalocation(program, name); parameters program a webglprogram to query. name a domstring specifying the name of the user-defined varying out variable. return value a glint indicating the assigned color number binding, or -1 otherwise. examples // program is a linked webglprogram gl.getfragdatalocation(program, 'fragcolor'); specifications specification status comment webgl 2.0the definition of 'getfragdatalocation' in that specification. editor's draft initial definition. opengl es 3.0the definition of 'glgetfragdatalocation' in that specification. stan...
WebGL2RenderingContext.getIndexedParameter() - Web APIs
the webgl2renderingcontext.getindexedparameter() method of the webgl 2 api returns indexed information about a given target. syntax any gl.getindexedparameter(target, index); parameters target a glenum specifying the target for which to return information. possible values: gl.transform_feedback_buffer_binding: returns a webglbuffer. gl.transform_feedback_buffer_size: returns a glsizeiptr. gl.transform_feedback_buffer_start: returns a glintptr. gl.uniform_buffer_binding: returns a webglbuffer. gl.uniform_buffer_size: returns a glsizeiptr. gl.uniform_buffer_start: returns a glintptr. index a gluint specifying the index of the target that is queried. return value depends on the requested information (as specified with target). examples var binding = gl.ge...
WebGL2RenderingContext.getQuery() - Web APIs
the webgl2renderingcontext.getquery() method of the webgl 2 api returns the currently active webglquery for the target, or null. syntax webglquery gl.getquery(target, pname); parameters target a glenum specifying the target of the query. possible values: gl.any_samples_passed: specifies an occlusion query: these queries detect whether an object is visible (whether the scoped drawing commands pass the depth test and if so, how many samples pass). gl.any_samples_passed_conservative: same as above above, but less accurate and faster version. gl.transform_feedback_primitives_written: number of primitives that are written to transform feedback buffers. pname a glenum specifying the query object target. must be gl.current_query. return value a webglquery object. e...
WebGL2RenderingContext.getQueryParameter() - Web APIs
the webgl2renderingcontext.getqueryparameter() method of the webgl 2 api returns parameter information of a webglquery object. syntax any gl.getqueryparameter(query, pname); parameters query a webglquery object. pname a glenum specifying which information to return. possible values: gl.query_result: returns a gluint containing the query result. gl.query_result_available: returns a glboolean indicating whether or not a query result is available. return value depends on the pname parameter, either a gluint or a glboolean. examples var query = gl.createquery(); gl.beginquery(gl.any_samples_passed, query); var result = gl.getqueryparameter(query, gl.query_result); specifications specification status comment webgl 2.0the definition of '...
WebGL2RenderingContext.getTransformFeedbackVarying() - Web APIs
the webgl2renderingcontext.gettransformfeedbackvarying() method of the webgl 2 api returns information about varying variables from webgltransformfeedback buffers. syntax webglactiveinfo gl.gettransformfeedbackvarying(program, index); parameters program a webglprogram. index a gluint specifying the index of the varying variable whose information to retrieve. return value a webglactiveinfo object. examples activeinfo = gl.gettransformfeedbackvarying(program, 0); specifications specification status comment webgl 2.0the definition of 'gettransformfeedbackvarying' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'glgettransformfeedbackvarying' in that specification. standard m...
WebGL2RenderingContext.getUniformBlockIndex() - Web APIs
the webgl2renderingcontext.getuniformblockindex() method of the webgl 2 api retrieves the index of a uniform block within a webglprogram. syntax gluint gl.getuniformblockindex(program, uniformblockname); parameters program a webglprogram containing the uniform block. uniformname a domstring specifying the name of the uniform block to whose index to retrieve. return value a gluint indicating the uniform block index. examples // assuming a shader with the following declaration: // uniform ubodata { // mat4 foo; // } instancename; // use the block name, not the instance name: var blockindex = gl.getuniformblockindex(program, 'ubodata'); specifications specification status comment webgl 2.0the definition of 'getuniformblockindex' in that specif...
WebGL2RenderingContext.getUniformIndices() - Web APIs
the webgl2renderingcontext.getuniformindices() method of the webgl 2 api retrieves the indices of a number of uniforms within a webglprogram. syntax sequence<gluint> gl.getuniformindices(program, uniformnames); parameters program a webglprogram containing uniforms whose indices to query. uniformnames an array of domstring specifying the names of the uniforms to query. return value an array of gluint containing the uniform indices. examples var uniformindices = gl.getuniformindices(program, ['ubored', 'ubogreen', 'uboblue']); specifications specification status comment webgl 2.0the definition of 'getuniformindices' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'glgetuniformindi...
WebGL2RenderingContext.isQuery() - Web APIs
examples gl must be a webgl2renderingcontext. webglquery objects are not available in webgl 1. var query = gl.createquery(); // ... ...
WebGL2RenderingContext.isSampler() - Web APIs
examples gl must be a webgl2renderingcontext. webglsampler objects are not available in webgl 1. var sampler = gl.createsampler(); // ... ...
WebGL2RenderingContext.isSync() - Web APIs
examples gl must be a webgl2renderingcontext. webglsync objects are not available in webgl 1. var sync = gl.fencesync(gl.sync_gpu_commands_complete, 0); // ... ...
WebGL2RenderingContext.isTransformFeedback() - Web APIs
examples gl must be a webgl2renderingcontext. ...
WebGL2RenderingContext.isVertexArray() - Web APIs
examples var vao = gl.createvertexarray(); gl.bindvertexarray(vao); // ... ...
WebGL2RenderingContext.pauseTransformFeedback() - Web APIs
examples var transformfeedback = gl.createtransformfeedback(); gl.bindtransformfeedback(gl.transform_feedback, transformfeedback); gl.begintransformfeedback(gl.triangles); gl.pausetransformfeedback(); //... ...
WebGL2RenderingContext.readBuffer() - Web APIs
the webgl2renderingcontext.readbuffer() method of the webgl 2 api selects a color buffer as the source for pixels for subsequent calls to copyteximage2d, copytexsubimage2d, copytexsubimage3d or readpixels. syntax void gl.readbuffer(src); parameters src a glenum specifying a color buffer. possible values: gl.back: reads from the back color buffer. gl.none: reads from no color buffer. gl.color_attachment{0-15}: reads from one of the 16 color attachment buffers. return value none. examples gl.readbuffer(gl.color_attachment0); specifications specification status comment webgl 2.0the definition of 'readbuffer' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'glreadbuffer' i...
WebGL2RenderingContext.resumeTransformFeedback() - Web APIs
examples var transformfeedback = gl.createtransformfeedback(); gl.bindtransformfeedback(gl.transform_feedback, transformfeedback); gl.begintransformfeedback(gl.triangles); gl.pausetransformfeedback(); //... ...
WebGL2RenderingContext.transformFeedbackVaryings() - Web APIs
the webgl2renderingcontext.transformfeedbackvaryings() method of the webgl 2 api specifies values to record in webgltransformfeedback buffers. syntax void gl.transformfeedbackvaryings(program, varyings, buffermode); parameters program a webglprogram. varyings an array of domstring specifying the the names of the varying variables to use. buffermode a glenum specifying the mode to use when capturing the varying variables. either gl.interleaved_attribs or gl.separate_attribs. return value none. examples var transformfeedback = gl.createtransformfeedback(); gl.bindtransformfeedback(gl.transform_feedback, transformfeedback); var transformfeedbackoutputs = ['gl_position', 'anotheroutput']; gl.transformfeedbackvaryings(shaderprog, transformfeedbackoutputs, ...
WebGL2RenderingContext.uniformBlockBinding() - Web APIs
m blocks. syntax void gl.uniformblockbinding(program, uniformblockindex, uniformblockbinding); parameters program a webglprogram containing the active uniform block whose binding to assign. uniformblockindex a gluint specifying the index of the active uniform block within the program. uniformblockbinding a gluint specifying the binding point to which to bind the uniform block. return value none. examples gl.uniformblockbinding(program, 0, 1); specifications specification status comment webgl 2.0the definition of 'uniformblockbinding' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'gluniformblockbinding' in that specification. standard man page of the (similar) opengl api. ...
WebGL2RenderingContext.vertexAttribDivisor() - Web APIs
nstanced() and gl.drawelementsinstanced(). note: when using webgl 1, the angle_instanced_arrays extension can provide this method, too. syntax void gl.vertexattribdivisor(index, divisor); parameters index a gluint specifying the index of the generic vertex attributes. divisor a gluint specifying the number of instances that will pass between updates of the generic attribute. return value none. examples gl.vertexattribdivisor(0, 2); specifications specification status comment webgl 2.0the definition of 'vertexattribdivisor' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'glvertexattribdivisor' in that specification. standard man page of the (similar) opengl api. ...
WebGL2RenderingContext.vertexAttribI4[u]i[v]() - Web APIs
the webgl2renderingcontext.vertexattribi4[u]i[v]() methods of the webgl 2 api specify integer values for generic vertex attributes. syntax void gl.vertexattribi4i(index, v0, v1, v2, v3); void gl.vertexattribi4ui(index, v0, v1, v2, v3); void gl.vertexattribi4iv(index, value); void gl.vertexattribi4uiv(index, value); parameters index a gluint specifying the position of the vertex attribute to be modified. v0, v1, v2, v3 an integer number for the vertex attribute value. value a uint32array/int32array or sequences of gluint/ glint for integer vector vertex attribute values. return value none. examples gl.vertexattribi4i(a_foobar, 10); specifications specification status comment webgl 2.0the definition of 'vertexattribi' in that specificatio...
WebGL2RenderingContext.vertexAttribIPointer() - Web APIs
ifying the data type of each component in the array. must be one of: gl.byte, gl.unsigned_byte, gl.short, gl.unsigned_short, gl.int, or gl.unsigned_int. stride a glsizei specifying the offset in bytes between the beginning of consecutive vertex attributes. offset a glintptr specifying an offset in bytes of the first component in the vertex attribute array. must be a multiple of type. return value none. description very similar to webglrenderingcontext.vertexattribpointer(). the main difference is that while values specified by vertexattribpointer are always interpreted as floating-point values in the shader (even if they were originally specified as integers in the buffer), this method allows specifying values which are interpreted as integers in the shader. examples linear blend sk...
WebGL2RenderingContext.waitSync() - Web APIs
between multiple gl contexts. syntax void gl.waitsync(sync, flags, timeout); parameters sync a webglsync object on which to wait on. flags a glbitfield specifying a bitwise combination of flags controlling the flushing behavior. must be 0 (exists for extensions only). timeout a glint64 specifying a timeout the server should wait before continuing. must be gl.timeout_ignored. return value none. examples var sync = gl.fencesync(gl.sync_gpu_commands_complete, 0); gl.waitsync(sync, 0, gl.timeout_ignored); specifications specification status comment webgl 2.0the definition of 'waitsync' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'glwaitsync' in that specification. standard man pa...
WebGLRenderingContext.bindAttribLocation() - Web APIs
an attribute variable. syntax void gl.bindattriblocation(program, index, name); parameters program a webglprogram object to bind. index a gluint specifying the index of the generic vertex to bind. name a domstring specifying the name of the variable to bind to the generic vertex index. this name cannot start with "webgl_" or "_webgl_", as these are reserved for use by webgl. return value none. examples gl.bindattriblocation(program, colorlocation, 'vcolor'); specifications specification status comment webgl 1.0the definition of 'bindattriblocation' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glbindattriblocation' in that specification. standard man page of the (similar) opengl api. ...
WebGLRenderingContext.bindFramebuffer() - Web APIs
the webglrenderingcontext.bindframebuffer() method of the webgl api binds a given webglframebuffer to a target. syntax void gl.bindframebuffer(target, framebuffer); parameters target a glenum specifying the binding point (target). possible values: gl.framebuffer: collection buffer data storage of color, alpha, depth and stencil buffers used to render an image. when using a webgl 2 context, the following values are available additionally: gl.draw_framebuffer: equivalent to gl.framebuffer. used as a destination for drawing, rendering, clearing, and writing operations. gl.read_framebuffer: used as a source for reading operations. framebuffer a webglframebuffer object to bind. return value none. exceptions a gl.invalid_enum error is thrown if target is n...
WebGLRenderingContext.bindRenderbuffer() - Web APIs
the webglrenderingcontext.bindrenderbuffer() method of the webgl api binds a given webglrenderbuffer to a target, which must be gl.renderbuffer. syntax void gl.bindrenderbuffer(target, renderbuffer); parameters target a glenum specifying the binding point (target). possible values: gl.renderbuffer: buffer data storage for single images in a renderable internal format. renderbuffer a webglrenderbuffer object to bind. return value none. exceptions a gl.invalid_enum error is thrown if target is not gl.renderbuffer. examples binding a renderbuffer var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var renderbuffer = gl.createrenderbuffer(); gl.bindrenderbuffer(gl.renderbuffer, renderbuffer); getting current bindings to check the curre...
WebGLRenderingContext.bindTexture() - Web APIs
the webglrenderingcontext.bindtexture() method of the webgl api binds a given webgltexture to a target (binding point). syntax void gl.bindtexture(target, texture); parameters target a glenum specifying the binding point (target). possible values: gl.texture_2d: a two-dimensional texture. gl.texture_cube_map: a cube-mapped texture. when using a webgl 2 context, the following values are available additionally: gl.texture_3d: a three-dimensional texture. gl.texture_2d_array: a two-dimensional array texture. texture a webgltexture object to bind. return value none. exceptions a gl.invalid_enum error is thrown if target is not gl.texture_2d, gl.texture_cube_map, gl.texture_3d, or gl.texture_2d_array. examples binding a texture var canvas = document.
WebGLRenderingContext.blendColor() - Web APIs
the source and destination blending factors. syntax void gl.blendcolor(red, green, blue, alpha); parameters red a glclampf for the red component in the range of 0 to 1. green a glclampf for the green component in the range of 0 to 1. blue a glclampf for the blue component in the range of 0 to 1. alpha a glclampf for the alpha component (transparency) in the range of 0 to 1. return value none. examples to set the blend color, use: gl.blendcolor(0, 0.5, 1, 1); to get the blend color, query the blend_color constant which returns a float32array. gl.getparameter(gl.blend_color); // float32array[0, 0.5, 1, 1] specifications specification status comment webgl 1.0the definition of 'blendcolor' in that specification. recommendation initial definition...
WebGLRenderingContext.blendEquation() - Web APIs
how source and destination colors are combined. must be either: gl.func_add: source + destination, gl.func_subtract: source - destination, gl.func_reverse_subtract: destination - source when using the ext_blend_minmax extension: ext.min_ext: minimum of source and destination, ext.max_ext: maximum of source and destination. when using a webgl 2 context, the following values are available additionally: gl.min: minimum of source and destination, gl.max: maximum of source and destination. default value: gl.func_add exception if mode is not one of the three possible values, a gl.invalid_enum error is thrown. return value none. examples to set the blend equation, use: gl.blendequation(gl.func_add); gl.blendequation(gl.func_subtract); gl.
WebGLRenderingContext.canvas - Web APIs
the webglrenderingcontext.canvas property is a read-only reference to the htmlcanvaselement or offscreencanvas object that is associated with the context. it might be null if it is not associated with a <canvas> element or an offscreencanvas object. syntax gl.canvas; return value either a htmlcanvaselement or offscreencanvas object or null. examples canvas element given this <canvas> element: <canvas id="canvas"></canvas> you can get back a reference to it from the webglrenderingcontext using the canvas property: var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); gl.canvas; // htmlcanvaselement offscreen canvas example using the experimental offscreencanvas object. var offscreen = new offscreencanvas(256, 256); var gl = offscreen.getcontext('web...
WebGLRenderingContext.clearDepth() - Web APIs
the webglrenderingcontext.cleardepth() method of the webgl api specifies the clear value for the depth buffer. this specifies what depth value to use when calling the clear() method. the value is clamped between 0 and 1. syntax void gl.cleardepth(depth); parameters depth a glclampf specifying the depth value used when the depth buffer is cleared. default value: 1. return value none. examples gl.cleardepth(0.5); to get the current depth clear value, query the depth_clear_value constant. gl.getparameter(gl.depth_clear_value); // 0.5 specifications specification status comment webgl 1.0the definition of 'cleardepth' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glcleardepthf' in that specificatio...
WebGLRenderingContext.colorMask() - Web APIs
the webglrenderingcontext.colormask() method of the webgl api sets which color components to enable or to disable when drawing or rendering to a webglframebuffer. syntax void gl.colormask(red, green, blue, alpha); parameters red a glboolean specifying whether or not the red color component can be written into the frame buffer. default value: true. green a glboolean specifying whether or not the green color component can be written into the frame buffer. default value: true. blue a glboolean specifying whether or not the blue color component can be written into the frame buffer. default value: true. alpha a glboolean specifying whether or not the alpha (transparency) component can be written into the frame buffer. default value: true. return value none. examples gl.colormask(...
WebGLRenderingContext.createBuffer() - Web APIs
the webglrenderingcontext.createbuffer() method of the webgl api creates and initializes a webglbuffer storing data such as vertices or colors. syntax webglbuffer gl.createbuffer(); parameters none. return value a webglbuffer storing data such as vertices or colors. examples creating a buffer var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var buffer = gl.createbuffer(); specifications specification status comment webgl 1.0the definition of 'createbuffer' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glgenbuffers' in that specification. standard man page of the (similar) opengl api. ...
WebGLRenderingContext.createFramebuffer() - Web APIs
the webglrenderingcontext.createframebuffer() method of the webgl api creates and initializes a webglframebuffer object. syntax webglframebuffer gl.createframebuffer(); parameters none. return value a webglframebuffer object. examples creating a frame buffer var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var framebuffer = gl.createframebuffer(); specifications specification status comment webgl 1.0the definition of 'createframebuffer' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glgenframebuffers' in that specification. standard man page of the (similar) opengl api. ...
WebGLRenderingContext.createProgram() - Web APIs
these are then linked into a usable program.. ...
WebGLRenderingContext.createRenderbuffer() - Web APIs
the webglrenderingcontext.createrenderbuffer() method of the webgl api creates and initializes a webglrenderbuffer object. syntax webglrenderbuffer gl.createrenderbuffer(); parameters none. return value a webglrenderbuffer object that stores data such an image, or can be source or target of an rendering operation. examples creating a render buffer var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var renderbuffer = gl.createrenderbuffer(); specifications specification status comment webgl 1.0the definition of 'createrenderbuffer' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glgenrenderbuffers' in that specification. standard man page of the (similar) opengl ...
WebGLRenderingContext.createTexture() - Web APIs
examples see also the webgl tutorial on using textures in webgl. ...
WebGLRenderingContext.deleteBuffer() - Web APIs
examples deleting a buffer var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var buffer = gl.createbuffer(); // ... ...
WebGLRenderingContext.deleteFramebuffer() - Web APIs
examples deleting a frame buffer var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var framebuffer = gl.createframebuffer(); // ... ...
WebGLRenderingContext.deleteProgram() - Web APIs
examples deleting a program var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var program = gl.createprogram(); // ... ...
WebGLRenderingContext.deleteRenderbuffer() - Web APIs
the webglrenderingcontext.deleterenderbuffer() method of the webgl api deletes a given webglrenderbuffer object. this method has no effect if the render buffer has already been deleted. syntax void gl.deleterenderbuffer(renderbuffer); parameters renderbuffer a webglrenderbuffer object to delete. return value none. examples deleting a renderbuffer var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var renderbuffer = gl.createrenderbuffer(); // ... gl.deleterenderbuffer(renderbuffer); specifications specification status comment webgl 1.0the definition of 'deleterenderbuffer' in that specification. recommendation initial definition. opengl es 2.0the definition of 'gldeleterenderbuffers' in that specificatio...
WebGLRenderingContext.deleteShader() - Web APIs
the webgl api marks a given webglshader object for deletion. it will then be deleted whenever the shader is no longer in use. this method has no effect if the shader has already been deleted, and the webglshader is automatically marked for deletion when it is destroyed by the garbage collector. syntax void gl.deleteshader(shader); parameters shader a webglshader object to delete. return value none. examples deleting a shader gl.deleteshader(shader); specifications specification status comment webgl 1.0the definition of 'deleteshader' in that specification. recommendation initial definition. opengl es 2.0the definition of 'gldeleteshader' in that specification. standard man page of the (similar) opengl api. ...
WebGLRenderingContext.deleteTexture() - Web APIs
examples deleting a texture var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var texture = gl.createtexture(); // ... ...
WebGLRenderingContext.disableVertexAttribArray() - Web APIs
the webglrenderingcontext.disablevertexattribarray() method of the webgl api turns the generic vertex attribute array off at a given index position. syntax void gl.disablevertexattribarray(index); parameters index a gluint specifying the index of the vertex attribute to disable. return value none. examples gl.disablevertexattribarray(0); specifications specification status comment webgl 1.0the definition of 'disablevertexattribarray' in that specification. recommendation initial definition. opengl es 2.0the definition of 'gldisablevertexattribarray' in that specification. standard man page of the opengl api. ...
WebGLRenderingContext.finish() - Web APIs
the webglrenderingcontext.finish() method of the webgl api blocks execution until all previously called commands are finished. syntax void gl.finish(); parameters none. return value none. specifications specification status comment webgl 1.0the definition of 'finish' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glfinish' in that specification. standard man page of the opengl api. ...
WebGLRenderingContext.flush() - Web APIs
the webglrenderingcontext.flush() method of the webgl api empties different buffer commands, causing all commands to be executed as quickly as possible. syntax void gl.flush(); parameters none. return value none. specifications specification status comment webgl 1.0the definition of 'flush' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glflush' in that specification. standard man page of the opengl api. ...
WebGLRenderingContext.frontFace() - Web APIs
the webglrenderingcontext.frontface() method of the webgl api specifies whether polygons are front- or back-facing by setting a winding orientation. syntax void gl.frontface(mode); parameters mode a glenum type winding orientation. the default value is gl.ccw. possible values: gl.cw: clock-wise winding. gl.ccw: counter-clock-wise winding. return value none. examples gl.frontface(gl.cw); specifications specification status comment webgl 1.0the definition of 'frontface' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glfrontface' in that specification. standard man page of the opengl api. ...
WebGLRenderingContext.generateMipmap() - Web APIs
objects that are closer, and a lower-resolution mipmap is used for objects that are farther away. it starts with the resolution of the texture image and halves the resolution until a 1x1 dimension texture image is created. syntax void gl.generatemipmap(target); parameters target a glenum specifying the binding point (target) of the active texture whose mipmaps will be generated. possible values: gl.texture_2d: a two-dimensional texture. gl.texture_cube_map: a cube-mapped texture. when using a webgl 2 context, the following values are available additionally: gl.texture_3d: a three-dimensional texture. gl.texture_2d_array: a two-dimensional array texture. return value none. examples gl.generatemipmap(gl.texture_2d); specifications specifica...
WebGLRenderingContext.getActiveAttrib() - Web APIs
returns a webglactiveinfo object containing size, type, and name of a vertex attribute. it is generally used when querying unknown attributes either for debugging or generic library creation. syntax webglactiveinfo gl.getactiveattrib(program,index); parameters program a webglprogram containing the vertex attribute. index a gluint specifying the index of the vertex attribute to get. this value is an index 0 to n - 1 as returned by gl.getprogramparameter(program, gl.active_attributes). return value a webglactiveinfo object. examples const numattribs = gl.getprogramparameter(program, gl.active_attributes); for (let i = 0; i < numattribs; ++i) { const info = gl.getactiveattrib(program, i); console.log('name:', info.name, 'type:', info.type, 'size:', info.size); } specifications...
WebGLRenderingContext.getAttachedShaders() - Web APIs
the webglrenderingcontext.getattachedshaders() method of the webgl api returns a list of webglshader objects attached to a webglprogram. syntax sequence<webglshader> gl.getattachedshaders(program); parameters program a webglprogram object to get attached shaders for. return value an array of webglshader objects that are attached to the given webglprogram. examples var program = gl.createprogram(); // attach pre-existing shaders gl.attachshader(program, vertexshader); gl.attachshader(program, fragmentshader); gl.linkprogram(program); gl.getattachedshaders(program); specifications specification status comment webgl 1.0the definition of 'getattachedshaders' in that specification. recommendation initial definition. opengl es 2.0the definition...
WebGLRenderingContext.getAttribLocation() - Web APIs
the webglrenderingcontext.getattriblocation() method of the webgl api returns the location of an attribute variable in a given webglprogram. syntax glint gl.getattriblocation(program, name); parameters program a webglprogram containing the attribute variable. name a domstring specifying the name of the attribute variable whose location to get. return value a glint number indicating the location of the variable name if found. returns -1 otherwise. examples gl.getattriblocation(program, 'vcolor'); specifications specification status comment webgl 1.0the definition of 'getattriblocation' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glgetattriblocation' in that specification. standard main p...
WebGLRenderingContext.getContextAttributes() - Web APIs
the webglrenderingcontext.getcontextattributes() method returns a webglcontextattributes object that contains the actual context parameters. might return null, if the context is lost. syntax gl.getcontextattributes(); return value a webglcontextattributes object that contains the actual context parameters, or null if the context is lost. examples given this <canvas> element <canvas id="canvas"></canvas> and given this webgl context var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); gl.getcontextattributes(); the getcontextattributes method returns an object that describes the attributes set on this context, for example: { alpha: true, antialias: true, depth: true, failifmajorperformancecaveat: false, powerpreference: "default", premult...
WebGLRenderingContext.getExtension() - Web APIs
examples once a webgl extension is enabled, you are able to use the methods, properties or constants that this extension object provides. ...
WebGLRenderingContext.getProgramInfoLog() - Web APIs
the webglrenderingcontext.getprograminfolog returns the information log for the specified webglprogram object. it contains errors that occurred 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...
WebGLRenderingContext.getShaderInfoLog() - Web APIs
when a webglshader object is initially created, its information log will be a string of length 0. ...
WebGLRenderingContext.getShaderParameter() - Web APIs
the webglrenderingcontext.getshaderparameter() method of the webgl api returns information about the given shader. syntax any gl.getshaderparameter(shader, pname); parameters shader a webglshader to get parameter information from. pname a glenum specifying the information to query. possible values: gl.delete_status: returns a glboolean indicating whether or not the shader is flagged for deletion. gl.compile_status: returns a glboolean indicating whether or not the last shader compilation was successful. gl.shader_type: returns a glenum indicating whether the shader is a vertex shader (gl.vertex_shader) or fragment shader (gl.fragment_shader) object. return value returns the requested shader information (as specified with pname). examples gl.getshaderparameter(shader,...
WebGLRenderingContext.getShaderPrecisionFormat() - Web APIs
ebglrenderingcontext.getshaderprecisionformat() method of the webgl api returns a new webglshaderprecisionformat object describing the range and precision for the specified shader numeric format. syntax webglshaderprecisionformat gl.getshaderprecisionformat(shadertype, precisiontype); parameters shadertype either a gl.fragment_shader or a gl.vertex_shader. precisiontype a precision type value. either gl.low_float, gl.medium_float, gl.high_float, gl.low_int, gl.medium_int, or gl.high_int. return value a webglshaderprecisionformat object or null, if an error occurs. exceptions gl.invalid_enum if the shader or precision types aren't recognized. gl.invalid_operation if the shader compiler isn't supported. examples the following code gets the precision format of a gl.vertex_shad...
WebGLRenderingContext.getShaderSource() - Web APIs
the webglrenderingcontext.getshadersource() method of the webgl api returns the source code of a webglshader as a domstring. syntax domstring gl.getshadersource(shader); parameters shader a webglshader object to get the source code from. return value a domstring containing the source code of the shader. examples var shader = gl.createshader(gl.vertex_shader); gl.shadersource(shader, originalsource); var source = gl.getshadersource(shader); specifications specification status comment webgl 1.0the definition of 'getshadersource' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glgetshadersource' in that specification. standard man page of the (similar) opengl api. ...
WebGLRenderingContext.getSupportedExtensions() - Web APIs
examples var canvas = document.getelementbyid('canvas'); gl = canvas.getcontext('webgl'); var extensions = gl.getsupportedextensions(); // array [ 'angle_instanced_arrays', 'ext_blend_minmax', ... ] see also the webglrenderingcontext.getextension() method to get a specific extension object. webgl extensions extensions for the webgl api are registered in the webgl extension registry. ...
WebGLRenderingContext.getVertexAttribOffset() - Web APIs
the webglrenderingcontext.getvertexattriboffset() method of the webgl api returns the address of a specified vertex attribute. syntax glintptr gl.getvertexattriboffset(index, pname); parameters index a gluint specifying the index of the vertex attribute. pname a glenum which must be gl.vertex_attrib_array_pointer. return value a glintptr indicating the address of the vertex attribute. examples gl.getvertexattriboffset(i, gl.vertex_attrib_array_pointer); specifications specification status comment webgl 1.0the definition of 'getvertexattriboffset' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glgetvertexattribpointerv' in that specification. standard man page of the opengl api. ...
WebGLRenderingContext.isBuffer() - Web APIs
the webglrenderingcontext.isbuffer() method of the webgl api returns true if the passed webglbuffer is valid and false otherwise. syntax glboolean gl.isbuffer(buffer); parameters buffer a webglbuffer to check. return value a glboolean indicating whether or not the buffer is valid. examples creating a buffer var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var buffer = gl.createbuffer(); gl.isbuffer(buffer); specifications specification status comment webgl 1.0the definition of 'isbuffer' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glisbuffer' in that specification. standard man page of the opengl api. ...
WebGLRenderingContext.isContextLost() - Web APIs
usage notes there are several reasons why a webgl context may be lost, making it necessary to re-establish the context before resuming rendering. ...
WebGLRenderingContext.isFramebuffer() - Web APIs
the webglrenderingcontext.isframebuffer() method of the webgl api returns true if the passed webglframebuffer is valid and false otherwise. syntax glboolean gl.isframebuffer(framebuffer); parameters framebuffer a webglframebuffer to check. return value a glboolean indicating whether or not the frame buffer is valid. examples checking a frame buffer var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var framebuffer = gl.createframebuffer(); gl.isframebuffer(framebuffer); specifications specification status comment webgl 1.0the definition of 'isframebuffer' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glisframebuffer' in that specification. standard man pa...
WebGLRenderingContext.isProgram() - Web APIs
examples checking a program var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var program = gl.createprogram(); // ... ...
WebGLRenderingContext.isRenderbuffer() - Web APIs
the webglrenderingcontext.isrenderbuffer() method of the webgl api returns true if the passed webglrenderbuffer is valid and false otherwise. syntax glboolean gl.isrenderbuffer(renderbuffer); parameters renderbuffer a webglrenderbuffer to check. return value a glboolean indicating whether or not the renderbuffer is valid. examples checking a renderbuffer var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var renderbuffer = gl.createrenderbuffer(); gl.isrenderbuffer(renderbuffer); specifications specification status comment webgl 1.0the definition of 'isrenderbuffer' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glisrenderbuffer' in that specification. standa...
WebGLRenderingContext.isShader() - Web APIs
examples checking a shader var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var shader = gl.createshader(gl.vertex_shader); // ... ...
WebGLRenderingContext.isTexture() - Web APIs
the webglrenderingcontext.istexture() method of the webgl api returns true if the passed webgltexture is valid and false otherwise. syntax glboolean gl.istexture(texture); parameters texture a webgltexture to check. return value a glboolean indicating whether or not the texture is valid. examples checking a texture var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var texture = gl.createtexture(); gl.istexture(texture); specifications specification status comment webgl 1.0the definition of 'istexture' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glistexture' in that specification. standard man page of the opengl api. ...
WebGLRenderingContext.lineWidth() - Web APIs
t recommended to use line widths other than 1.0 since there is no guarantee any user's browser will display any other width. as of january 2017 most implementations of webgl only support a minimum of 1 and a maximum of 1 as the technology they are based on has these same limits. syntax void gl.linewidth(width); parameters width a glfloat specifying the width of rasterized lines. default value: 1. return value none. examples setting the line width: gl.linewidth(5); getting the line width: gl.getparameter(gl.line_width); getting the range of available widths. returns a float32array. gl.getparameter(gl.aliased_line_width_range); specifications specification status comment webgl 1.0the definition of 'linewidth' in that specification. recommendation ...
WebGLRenderingContext.linkProgram() - Web APIs
the webglrenderingcontext interface's linkprogram() method links a given webglprogram, completing the process of preparing the gpu code for the program's fragment and vertex shaders. syntax void gl.linkprogram(program); parameters program the webglprogram to link. return value none. examples var program = gl.createprogram(); // attach pre-existing shaders gl.attachshader(program, vertexshader); gl.attachshader(program, fragmentshader); gl.linkprogram(program); if ( !gl.getprogramparameter( program, gl.link_status) ) { var info = gl.getprograminfolog(program); throw new error('could not compile webgl program. \n\n' + info); } specifications specification status comment webgl 1.0the definition of 'linkprogram' in that specification. recommendation...
WebGLRenderingContext.makeXRCompatible() - Web APIs
e displayed. if necessary, the webgl layer may reconfigure the context to be ready to render to a different device than it originally was. this is useful if you have an application which can start out being presented on a standard 2d display but can then be transitioned to a 3d immersion system. syntax let makecompatpromise = webglrenderingcontext.makexrcompatible(); parameters none. return value a promise which successfully resolves once the webgl context is ready to be used for rendering webxr content. exceptions this method doesn't throw traditional exceptions; instead, the promise rejects with one of the following errors as the value passed into the rejection handler: aborterror switching the context over to the webxr-compatible context failed. invalidstateerror the webgl con...
WebGLRenderingContext.scissor() - Web APIs
the webglrenderingcontext.scissor() method of the webgl api sets a scissor box, which limits the drawing to a specified rectangle. syntax void gl.scissor(x, y, width, height); parameters x a glint specifying the horizontal coordinate for the lower left corner of the box. default value: 0. y a glint specifying the vertical coordinate for the lower left corner of the box. default value: 0. width a non-negative glsizei specifying the width of the scissor box. default value: width of the canvas. height a non-negative glsizei specifying the height of the scissor box. default value: height of the canvas. return value none. exceptions if either width or height is a negative value, a gl.invalid_value error is thrown. examples when the scissor test is enabled, only pixels within th...
WebGLRenderingContext.shaderSource() - Web APIs
the webglrenderingcontext.shadersource() method of the webgl api sets the source code of a webglshader. syntax void gl.shadersource(shader, source); parameters shader a webglshader object in which to set the source code. source a domstring containing the glsl source code to set. return value none. examples var shader = gl.createshader(gl.vertex_shader); gl.shadersource(shader, originalsource); var source = gl.getshadersource(shader); specifications specification status comment webgl 1.0the definition of 'shadersource' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glshadersource' in that specification. standard man page of the (similar) opengl api. ...
WebGLRenderingContext.stencilMask() - Web APIs
the webglrenderingcontext.stencilmask() method of the webgl api controls enabling and disabling of both the front and back writing of individual bits in the stencil planes. the webglrenderingcontext.stencilmaskseparate() method can set front and back stencil writemasks to different values. syntax void gl.stencilmask(mask); parameters mask a gluint specifying a bit mask to enable or disable writing of individual bits in the stencil planes. by default, the mask is all 1. return value none. examples gl.stencilmask(110101); to get the current stencil masks, query the stencil_writemask, stencil_back_writemask, or stencil_bits constants. gl.getparameter(gl.stencil_writemask); // 110101 gl.getparameter(gl.stencil_back_writemask); // 110101 gl.getparameter(gl.stencil_bits); // 0 spe...
WebGLRenderingContext.stencilMaskSeparate() - Web APIs
the webglrenderingcontext.stencilmaskseparate() method of the webgl api controls enabling and disabling of front and/or back writing of individual bits in the stencil planes. the webglrenderingcontext.stencilmask() method can set both, the front and back stencil writemasks to one value at the same time. syntax void gl.stencilmaskseparate(face, mask); parameters face a glenum specifying whether the front and/or back stencil writemask is updated. the possible values are: gl.front gl.back gl.front_and_back mask a gluint specifying a bit mask to enable or disable writing of individual bits in the stencil planes. by default, the mask is all 1. return value none. examples gl.stencilmaskseparate(gl.front, 110101); to get the current stencil masks, query the stencil_write...
WebGLRenderingContext.useProgram() - Web APIs
the webglrenderingcontext.useprogram() method of the webgl api sets the specified webglprogram as part of the current rendering state. syntax void gl.useprogram(program); parameters program a webglprogram to use. return value none. examples var program = gl.createprogram(); // attach pre-existing shaders gl.attachshader(program, vertexshader); gl.attachshader(program, fragmentshader); gl.linkprogram(program); gl.useprogram(program); specifications specification status comment webgl 1.0the definition of 'useprogram' in that specification. recommendation initial definition. opengl es 2.0the definition of 'gluseprogram' in that specification. standard man page of the opengl api. ...
WebGLRenderingContext.validateProgram() - Web APIs
the webglrenderingcontext.validateprogram() method of the webgl api validates a webglprogram. it checks if it is successfully linked and if it can be used in the current webgl state. syntax void gl.validateprogram(program); parameters program a webglprogram to validate. return value none. examples var program = gl.createprogram(); // attach pre-existing shaders gl.attachshader(program, vertexshader); gl.attachshader(program, fragmentshader); gl.linkprogram(program); gl.validateprogram(program); if ( !gl.getprogramparameter( program, gl.link_status) ) { var info = gl.getprograminfolog(program); throw 'could not compile webgl program. \n\n' + info; } gl.useprogram(program); specifications specification status comment webgl 1.0the definition of 'val...
WebGLShaderPrecisionFormat.precision - Web APIs
the read-only webglshaderprecisionformat.precision property returns the number of bits of precision that can be represented. for integer formats this value is always 0. examples var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); gl.getshaderprecisionformat(gl.vertex_shader, gl.medium_float).precision; // 23 gl.getshaderprecisionformat(gl.fragment_shader, gl.low_int).precision; // 0 specifications specification status comment webgl 1.0the definition of 'webglshaderprecisionformat.precision' in that specification. recommendation initial definition. ...
WebGLShaderPrecisionFormat.rangeMax - Web APIs
the read-only webglshaderprecisionformat.rangemax property returns the base 2 log of the absolute value of the maximum value that can be represented. examples var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); gl.getshaderprecisionformat(gl.vertex_shader, gl.medium_float).rangemax; // 127 gl.getshaderprecisionformat(gl.fragment_shader, gl.low_int).rangemax; // 24 specifications specification status comment webgl 1.0the definition of 'webglshaderprecisionformat.rangemax' in that specification. recommendation initial definition. ...
WebGLShaderPrecisionFormat.rangeMin - Web APIs
the read-only webglshaderprecisionformat.rangemin property returns the base 2 log of the absolute value of the minimum value that can be represented. examples var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); gl.getshaderprecisionformat(gl.vertex_shader, gl.medium_float).rangemin; // 127 gl.getshaderprecisionformat(gl.fragment_shader, gl.low_int).rangemin; // 24 specifications specification status comment webgl 1.0the definition of 'webglshaderprecisionformat.rangemin' in that specification. recommendation initial definition. ...
WebGLShaderPrecisionFormat - Web APIs
the webglshaderprecisionformat interface is part of the webgl api and represents the information returned by calling the webglrenderingcontext.getshaderprecisionformat() method. properties webglshaderprecisionformat.rangemin read only the base 2 log of the absolute value of the minimum value that can be represented. webglshaderprecisionformat.rangemax read only the base 2 log of the absolute value of the maximum value that can be represented. webglshaderprecisionformat.precision read only the number of bits of precision that can be represented. for integer formats this value is always 0. examples a webglshaderprecisionformat object is returned by the webglrenderingcontext.getshaderprecisionformat() method. var canvas = document.getelementbyid('canvas'); var gl = canvas.getconte...
Canvas size and WebGL - Web APIs
its element size in css pixels, as it appears in the browser window. effect of canvas size on rendering with webgl with scissor() and clear() we can demonstrate how the webgl drawing buffer is affected by the size of the canvas. the size of the first canvas is set to the styled element size, determined by css. this is done by assigning the width and height properties of the canvas to the values of the clientwidth and clientheight properties, respectively. in contrast, no such assignment is done for the second canvas. the internal width and height properties of the canvas remain at default values, which are different than the actual size of the canvas element in the browser window. the effect is clearly visible when using scissor() and clear() to draw a square in the center of the can...
Clearing by clicking - Web APIs
e drawing buffer (the viewport). if (!gl) { gl = canvas.getcontext("webgl") || canvas.getcontext("experimental-webgl"); if (!gl) { alert("failed to get webgl context.\n" + "your browser or device may not support webgl."); return; } gl.viewport(0, 0, gl.drawingbufferwidth, gl.drawingbufferheight); } // get a random color value using a helper function. var color = getrandomcolor(); // set the clear color to the random color. gl.clearcolor(color[0], color[1], color[2], 1.0); // clear the context with the newly set color. this is // the function call that actually does the drawing. gl.clear(gl.color_buffer_bit); } // random color helper function. function getrandomcolor() { return [math.
Scissor animation - Web APIs
every frame (we set frame rate to roughly one every 17ms, or roughly 60fps – frames per second). in contrast, the color of the square (set with clearcolor) is only updated when a new square is created. this is a nice demonstration of webgl as a state machine. for each square, we set its color once, and then update only its position every frame. the clear color state of webgl remains at the set value, until we change it again when a new square is created. <p>webgl animation by clearing the drawing buffer with solid color and applying scissor test.</p> <button id="animation-onoff"> press here to <strong>[verb goes here]</strong> the animation</button> <canvas>your browser does not seem to support html5 canvas.</canvas> body { text-align : center; } canvas { display : block;...
Simple color animation - Web APIs
var color = getrandomcolor(); // set the webglrenderingcontext clear color to the // random color. gl.clearcolor(color[0], color[1], color[2], 1.0); // clear the context with the newly set color. gl.clear(gl.color_buffer_bit); } // random color helper function. function getrandomcolor() { return [math.random(), math.random(), math.random...
Data in WebGL - Web APIs
Web › API › WebGL API › Data
varyings varyings are variables that are declared by the vertex shader and used to pass data from the vertex shader to the fragment shader. this is commonly used to share a vertex's normal vector after it has been computed by the vertex shader. <<how to use>> uniforms uniforms are set by the javascript code and are available to both the vertex and fragment shaders. they're used to provide values that will be the same for everything drawn in the frame, such as lighting positions and magnitudes, global transformation and perspective details, and so forth. <<add details>> buffers <<add information>> textures <<add information>> ...
Using WebGL extensions - Web APIs
extension objects if an extension defines specific symbols or functions that are not available in the core specification of webgl, they will be available on the extension object returned by the call to gl.getextension(). ...
WebGL best practices - Web APIs
hat is, it's the first js run after raf callbacks and the browser content (transaction) presentation step. (rpaf explainer) this allows as much time as possible for rendering each frame. devicepixelratio and high-dpi rendering handling devicepixelratio != 1.0 is tricky. while the common approach is to set canvas.width = width * devicepixelratio, this will cause moire artifacts with non-integer values of devicepixelratio, as is common with ui scaling on windows, as well as zooming on all platforms. instead, we can use non-integer values for css's top/bottom/left/right to fairly reliably 'pre-snap' our canvas to whole integer device coordinates. demo: https://jdashg.github.io/misc/webgl/device-pixel-presnap.html resizeobserver and 'device-pixel-content-box' on supporting browsers (chromium...
Introduction to WebRTC protocols - Web APIs
s not truly a protocol, but a data format used to describe connection that shares media between devices. documenting sdp is well outside the scope of this documentation; however, there are a few things worth noting here. structure sdp consists of one or more lines of utf-8 text, each beginning with a one-character type, followed by an equals sign ("="), followed by structured text comprising a value or description, whose format depends on the type. the lines of text that begin with a given letter are generally referred to as "letter-lines". for example, lines providing media descriptions have the type "m", so those lines are referred to as "m-lines." for more information to learn more about sdp, see the following useful resources: specification: rfc 4566: sdp: session description protoc...
Lifetime of a WebRTC session - Web APIs
ation of the connection in some way (such as changing to a different set of ice servers), you can do so before restarting ice by calling rtcpeerconnection.setconfiguration() with an updated rtcconfiguration dictionary before restarting ice. to explicitly trigger ice restart, simply start the renegotiation process by calling rtcpeerconnection.createoffer(), specifying the icerestart option with a value of true. then handle the connection process from then on just like you normally would. this generates new values for the ice username fragment (ufrag) and password, which will be used by the renegotiation process and the resulting connection. the answerer side of the connection will automatically begin ice restart when new values are detected for the ice ufrag and ice password. transmission re...
Taking still photos with WebRTC - Web APIs
if this is indeed the first run, we set the video's height based on the size difference between the video's actual size, video.videowidth, and the width at which we're going to render it, width. finally, the width and height of both the video and the canvas are set to match each other by calling element.setattribute() ...
WebRTC Statistics API - Web APIs
ct contains a map of named objects based one of the rtcstats dictionary's subclasses. upon looking up a statistic category by name, you get an object containing the corresponding data. the table below shows the statistic categories and the corresponding dictionaries; for each statistic category, the full hierarchy of rtcstats-based dictionaries are listed, so you can easily find all the available values. mapping of statistic category names to the dictionaries they implement statistic category name (rtcstatstype) description dictionaries implemented candidate-pair statistics describing the change from one rtcicetransport to another, such as during an ice restart. rtcicecandidatepairstats rtcstats certifi...
WebSocket.binaryType - Web APIs
"arraybuffer" if arraybuffer objects are used. ...
WebSocket.bufferedAmount - Web APIs
the websocket.bufferedamount read-only property returns the number of bytes of data that have been queued using calls to send() but not yet transmitted to the network. this value resets to zero once all queued data has been sent. this value does not reset to zero when the connection is closed; if you keep calling send(), this will continue to climb. syntax var bufferedamount = awebsocket.bufferedamount; value an unsigned long. specifications specification status comment html living standardthe definition of 'websocket: bufferedamount' in that specification. living standard initial definition ...
WebSocket.extensions - Web APIs
the websocket.extensions read-only property returns the extensions selected by the server. this is currently only the empty string or a list of extensions as negotiated by the connection. syntax var extensions = awebsocket.extensions; value a domstring. specifications specification status comment html living standardthe definition of 'websocket: extensions' in that specification. living standard initial definition ...
WebSocket.onclose - Web APIs
Web › API › WebSocket › onclose
the websocket.onclose property is an eventhandler that is called when the websocket connection's readystate changes to closed. it is called with a closeevent. syntax awebsocket.onclose = function(event) { console.log("websocket is closed now."); }; value an eventlistener. specifications specification status comment html living standardthe definition of 'websocket: onclose' in that specification. living standard initial definition ...
WebSocket.onerror - Web APIs
Web › API › WebSocket › onerror
the websocket interface's onerror event handler property is a function which gets called when an error occurs on the websocket. you can also add an error event handler using addeventlistener(). syntax websocket.onerror = eventhandler; value a function or eventhandler which is executed whenever an error event occurs on the websocket connection. example websocket.onerror = function(event) { console.error("websocket error observed:", event); }; specifications specification status comment html living standardthe definition of 'websocket: onerror' in that specification. living standard initial definition ...
WebSocket.onmessage - Web APIs
the websocket.onmessage property is an eventhandler that is called when a message is received from the server. it is called with a messageevent. syntax awebsocket.onmessage = function(event) { console.debug("websocket message received:", event); }; value an eventlistener. specifications specification status comment html living standardthe definition of 'websocket: onmessage' in that specification. living standard initial definition ...
WebSocket.onopen - Web APIs
Web › API › WebSocket › onopen
the websocket.onopen property is an eventhandler that is called when the websocket connection's readystate changes to 1; this indicates that the connection is ready to send and receive data. it is called with an event. syntax awebsocket.onopen = function(event) { console.log("websocket is open now."); }; value an eventlistener. specifications specification status comment html living standardthe definition of 'websocket: onopen' in that specification. living standard initial definition ...
WebSocket.protocol - Web APIs
specifications specification status comment html living standardthe definition of 'websocket: protocol' in that specification. living standard initial definition ...
WebSocket.readyState - Web APIs
the connection is not yet open. 1 open the connection is open and ready to communicate. 2 closing the connection is in the process of closing. 3 closed the connection is closed or couldn't be opened. ...
WebSocket.url - Web APIs
Web › API › WebSocket › url
the websocket.url read-only property returns the absolute url of the websocket as resolved by the constructor. syntax var url = awebsocket.url; value a domstring. specifications specification status comment html living standardthe definition of 'websocket: url' in that specification. living standard initial definition ...
WebSocket - Web APIs
Web › API › WebSocket
the websocket object provides the api for creating and managing a websocket connection to a server, as well as for sending and receiving data on the connection. to construct a websocket, use the websocket() constructor. constructor websocket(url[, protocols]) returns a newly created websocket object. constants constant value websocket.connecting 0 websocket.open 1 websocket.closing 2 websocket.closed 3 properties websocket.binarytype the binary data type used by the connection. websocket.bufferedamount read only the number of bytes of queued data. websocket.extensions read only the extensions selected by the server. websocket.onclose an event listener to be called when the connection is closed. websocket.o...
Writing a WebSocket server in Java - Web APIs
shaking when a client connects to a server, it sends a get request to upgrade the connection to a websocket from a simple http request. this is known as handshaking. try { string data = s.usedelimiter("\\r\\n\\r\\n").next(); matcher get = pattern.compile("^get").matcher(data); creating the response is easier than understanding why you must do it in this way. you must, obtain the value of sec-websocket-key request header without any leading and trailing whitespace link it with "258eafa5-e914-47da-95ca-c5ab0dc85b11" compute sha-1 and base64 code of it write it back as value of sec-websocket-accept response header as part of a http response. if (get.find()) { matcher match = pattern.compile("sec-websocket-key: (.*)").matcher(data); match.find(); byte[] res...
Lighting a WebXR setting - Web APIs
w it changes over time to attempt to determine a spatial relationship between the devices; this could in theory indicate that the devices are in the same general area, for example. how browsers mitigate these issues in order to help mitigate these risks, browsers are required by the webxr lighting estimation api specification to report lighting information that is fudged somewhat from the true value. there are many ways this could be done. spherical harmonics precision browsers can mitigate the risk of fingerprinting by reducing the precision of spherical harmonics. when performing real-time rendering—as is the case with any virtual or augmented reality application—spherical harmonic lighting is used to simplify and accelerate the process of generating highly realistic shadows and shad...
WebXR performance guide - Web APIs
y: const vertexlist = ... const normalmatrix = mat4.create(); const modelviewmatrix = mat4.create(); function drawscene(gl, view, programinfo, buffers, texture, deltatime) { ... for (object in scene) { ... } } now, instead of allocating variables every loop iteration, we're using global constants(or class member constants). this has multiple benefits: the memory allocated for each value or structure will not need to be reallocated every frame. this reduces the potential for triggering garbage collection, and optimizes memory use. you can't accidentally delete the objects that contain your vectors and matrices, since they're constants. you can, however, still replace the contents of each of these objects, so they're reusable. you're now protected from several possible coding ...
Spaces and reference spaces: Spatial tracking in WebXR - Web APIs
o movement at all, but with emulatedposition set to true. in either case, you may wish to adjust your rendering to compensate for the loss, depending on your specific needs. <<<--- more text and example about how to handle rendering during lost tracking --->>> when tracking resumes you can detect when tracking has resumed after being lost when the user position jumps while at the same time the value of emulatedposition changes from true to false. how you handle this depends on your application. if your app provides a way for the user to move through the virtual world without physically moving in the real world (a so-called teleportation mechanic), you can simply accept the new position and continue, allowing the jump from your previously-assumed position to be immediately corrected with the ...
Web Animations API - Web APIs
elopers to describe animations on dom elements. to get more information on the concepts behind the api and how to use it, read using the web animations api. web animations interfaces animation provides playback controls and a timeline for an animation node or source. can take an object created with the keyframeeffect() constructor. keyframeeffect describes sets of animatable properties and values, called keyframes and their timing options. these can then be played using the animation() constructor. animationtimeline represents the timeline of animation. this interface exists to define timeline features (inherited by documenttimeline and future timeline objects) and is not itself accessed by developers. animationevent actually part of css animations. documenttimeline represents anim...
Web Bluetooth API - Web APIs
acteristic. bluetoothdevice represents a bluetooth device inside a particular script execution environment. bluetoothremotegattcharacteristic represents a gatt characteristic, which is a basic data element that provides further information about a peripheral’s service. bluetoothremotegattdescriptor represents a gatt descriptor, which provides further information about a characteristic’s value. bluetoothremotegattserver represents a gatt server on a remote device. bluetoothremotegattservice represents a service provided by a gatt server, including a device, a list of referenced services, and a list of the characteristics of this service. specifications specification feedback web bluetooth to provide feedback on the web bluetooth api, file a spec issue. ...
Web Locks API - Web APIs
s been acquired. await do_something(); await do_something_else(); // now the lock will be released. }); while a lock is held, requests for the same lock from this execution context, or from other tabs/workers, will be queued. the first queued request will be granted only when the lock is released. the api provides optional functionality that may be used as needed, including: returning values from the asynchronous task shared and exclusive lock modes conditional acquisition diagnostics to query the state of locks in an origin an escape hatch to protect against deadlocks locks are scoped to origins; the locks acquired by a tab from https://example.com have no effect on the locks acquired by a tab from https://example.org:8080 as they are separate origins. the main entry point i...
Web Storage API - Web APIs
web storage concepts and usage 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) stores data only for a session, meaning that the data is stored until the browser (or tab) is closed. data is never transferred to the server. storage limit is larger than a cookie (at most 5mb). localstorage does the same thing, but persists even when the browser is closed and reopened. ...
WheelEvent() - Web APIs
ting the horizontal scroll amount in the deltamode unit. "deltay", optional and defaulting to 0.0, is a double representing the vertical scroll amount in the deltamode unit. "deltaz", optional and defaulting to 0.0, is a double representing the scroll amount for the z-axis in the deltamode unit. "deltamode", optional and defaulting to 0, is a unsigned long representing the unit of the delta values scroll amount. permitted values are: constant value description dom_delta_pixel 0x00 the delta values are specified in pixels. dom_delta_line 0x01 the delta values are specified in lines. dom_delta_page 0x02 the delta values are specified in pages. th...
WheelEvent.deltaMode - Web APIs
the wheelevent.deltamode read-only property returns an unsigned long representing the unit of the delta values scroll amount. permitted values are: constant value description dom_delta_pixel 0x00 the delta values are specified in pixels. dom_delta_line 0x01 the delta values are specified in lines. dom_delta_page 0x02 the delta values are specified in pages. syntax var unit = event.deltamode; example var syntheticevent = new wheelevent("syntheticwheel", {"deltax": 4, "deltamode": 0}); console.log(syntheticevent.deltamode); specifications specification status comment document object model (dom) level 3 events specificationthe definition of 'wheelevent.deltamode' in that specification. obsolete ...
Window: animationstart event - Web APIs
the animationstart event is fired when a css animation has started. if there is an animation-delay, this event will fire once the delay period has expired. a negative delay will cause the event to fire with an elapsedtime equal to the absolute value of the delay (and, correspondingly, the animation will begin playing at that time index into the sequence). bubbles yes cancelable no interface animationevent event handler property onanimationstart the original target for this event is the element that had the animation applied. you can listen for this event on the window interface to handle it in the capture or bubbling phases. for full details on this event please see the page on htmlelement: animationstart. examples this listens for the ...
Window.back() - Web APIs
Web › API › Window › back
the obsolete and non-standard method back() on the window interface returns the window to the previous item in the history. this was a firefox-specific method and was removed in firefox 31. note: use the standard history.back method instead. syntax window.back(); parameters none. return value undefined. example this simple example handles a click on a "back" button by calling back(). function handlemybackbutton() { if (cangoback) { window.back(); } } specification this is not part of any specification. ...
window.cancelAnimationFrame() - Web APIs
the window.cancelanimationframe() method cancels an animation frame request previously scheduled through a call to window.requestanimationframe(). syntax window.cancelanimationframe(requestid); parameters requestid the id value returned by the call to window.requestanimationframe() that requested the callback. examples var requestanimationframe = window.requestanimationframe || window.mozrequestanimationframe || window.webkitrequestanimationframe || window.msrequestanimationframe; var cancelanimationframe = window.cancelanimationframe || window.mozcancelanimationframe; var start = window.mozanimationstarttime; // only supported in ff. other browsers can use something like date.now(). var myreq; function step(timestamp) { var progress = timestamp - ...
Window.captureEvents() - Web APIs
example <!doctype html> <html lang="en"> <head> <!-- ... ...
Window.closed - Web APIs
Web › API › Window › closed
false: the window is open. examples change the url of a window from a popup the following example demonstrates how a popup window can change the url of the window that opened it. ...
Window.confirm() - Web APIs
Web › API › Window › confirm
the window.confirm() method displays a modal dialog with an optional message and two buttons: ok and cancel. syntax result = window.confirm(message); parameters message a string you want to display in the alert dialog. return value a boolean indicating whether ok (true) or cancel (false) was selected. if a browser is ignoring in-page dialogs, then the returned value is always false. example if (window.confirm("do you really want to leave?")) { window.open("exit.html", "thanks for visiting!"); } produces: notes the following text is shared between this article, dom:window.prompt and dom:window.alert dialog boxes are modal windows — they prevent the user from accessing the rest of the program's interface until the dialog box is closed. for this reason, you should not ove...
Window.convertPointFromNodeToPage() - Web APIs
ng this method, as it's not widely supported (nor is the point object it uses). syntax point = window.convertpointfromnodetopage(node, nodepoint); parameters node the node in whose coordinate system the point specified by nodepoint is described. nodepoint a point object describing a point in node's coordinate system; this point will be converted to the page's coordinate system. return value a point object specifying a point in the page's coordinate system. specifications this method was specified in the defunct 20 march 2009 working draft of css 2d transforms module level 3. it is not present in the current css transforms module level 1 working draft. ...
Window.convertPointFromPageToNode - Web APIs
fore using this method, as it's not widely supported (nor is the point object it uses). syntax point = window.convertpointfrompagetonode(node, pagepoint); parameters node the node into whose coordinate system the point is to be converted. pagepoint a point object specifying a point in the coordinate system of the page, which is to be converted into the node's coordinate system. return value a point object describing the specified location in the node's coordinate system. specifications this method was specified in the defunct 20 march 2009 working draft of css 2d transforms module level 3. it is not present in the current css transforms module level 1 working draft. ...
Window.dialogArguments - Web APIs
the dialogarguments property returns the parameters that were passed into the window.showmodaldialog() method. this lets you determine what parameters were specified when the modal dialog was created. syntax value = window.dialogarguments; ...
Window.forward() - Web APIs
Web › API › Window › forward
moves the window one document forward in history. this was a firefox-specific method and was removed in firefox 31. note: use the standard window.history.forward() method instead. syntax window.forward(); parameters none return value undefined. example function goforward() { if (cangoforward) { window.forward(); } } specification this is not part of any specification. ...
Window.frameElement - Web APIs
the window.frameelement property returns the element (such as <iframe> or <object>) in which the window is embedded. note: despite this property's name, it works for documents embedded within any embedding point, including <object>, <iframe>, or <embed>. syntax const frameel = window.frameelement value the element which the window is embedded into. if the window isn't embedded into another document, or if the document into which it's embedded has a different origin, the value is null instead. example const frameel = window.frameelement; // if we're embedded, change the containing element's url to 'http://mozilla.org/' if (frameel) { frameel.src = 'http://mozilla.org/'; } specifications specification status comment html living standardthe definition of...
Window.frames - Web APIs
Web › API › Window › frames
and its items can be accessed using the [i] notation. framelist === window evaluates to true. each item in the window.frames pseudo-array represents the window 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.fr...
Window.fullScreen - Web APIs
Web › API › Window › fullScreen
d in full screen mode or not. syntax isinfullscreen = windowref.fullscreen; with chrome privileges, the property is read-write, otherwise it is read-only. bear in mind that if you try to set this property without chrome privileges, it will not throw an exception and instead just silently fail. this is to prevent scripts designed to set this property in internet explorer from breaking. return value isinfullscreen a boolean. possible values: true: the window is in full screen mode. false: the window is not in full screen mode. notes switching between regular window and full screen will fire the "resize" event on the corresponding window. example if (window.fullscreen) { // it's fullscreen! } else { // not fullscreen! } ...
Window: gamepadconnected event - Web APIs
the gamepadconnected event is fired when the browser detects that a gamepad has been connected or the first time a button/axis of the gamepad is used. ...
Window.innerWidth - Web APIs
Web › API › Window › innerWidth
window property innerwidth returns the interior width of the window in pixels. this includes the width of the vertical scroll bar, if one is present. more precisely, innerwidth returns the width of the window's layout viewport. the interior height of the window—the height of the layout viewport—can be obtained from the innerheight property. syntax let intviewportwidth = window.innerwidth; value an integer value indicating the width of the window's layout viewport in pixels. this property is read-only, and has no default value. to change the window's width, use one of the window methods for resizing windows, such as resizeby() or resizeto(). usage notes if you need to obtain the width of the window minus the scrollbar and borders, use the root <html> element's clientwidth property in...
Window.localStorage - Web APIs
d in a "private browsing" or "incognito" session is cleared when the last "private" tab is closed.) data stored in either localstorage is specific to the protocol of the page. in particular, data stored by a script on a site accessed with http (e.g., http://example.com) is put in a different localstorage object from the same site accessed with https (e.g., https://example.com). the keys and the values are always in the utf-16 domstring format, which uses two bytes per character. as with objects, integer keys are automatically converted to strings. syntax mystorage = window.localstorage; value a storage object which can be used to access the current origin's local storage space. exceptions securityerror the request violates a policy decision, or the origin is not a valid scheme/host/p...
Window.moveBy() - Web APIs
Web › API › Window › moveBy
the moveby() method of the window interface moves the current window by a specified amount. note: this function moves the window relative to its current location. in contrast, window.moveto() moves the window to an absolute location. syntax window.moveby(deltax, deltay) parameters deltax is the amount of pixels to move the window horizontally. positive values are to the right, while negative values are to the left. deltay is the amount of pixels to move the window vertically. positive values are down, while negative values are up. example this example moves the window 10 pixels to the right and 10 pixels up. function budge() { moveby(10, -10); } specification specification status comment css object model (cssom) view modulethe definition of 'windo...
Window.mozAnimationStartTime - Web APIs
obsolete since gecko 42 (firefox 42 / thunderbird 42 / seamonkey 2.39)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. returns the time, in milliseconds since the epoch, at which animations started now should be considered to have started. this value should be used instead of, for example, date.now(), because this value will be the same for all animations started in this window during this refresh interval, allowing them to remain in sync with one another. this also allows javascript-based animations to remain synchronized with css transitions and smil animations triggered during the same refresh interval. syntax time = window.mozanimationstarttime; parameters time is the time in...
Window.mozInnerScreenX - Web APIs
summary gets the x coordinate of the top-left corner of the window's viewport, in screen coordinates. note: this coordinate is reported in css pixels, not in hardware pixels. that means it can be affected by the zoom level; to compute the actual number of physical screen pixels, you should use the nsidomwindowutils.screenpixelspercsspixel property. syntax screenx = window.mozinnerscreenx; value screenx stores the window.mozinnerscreenx property value. the window.mozinnerscreenx property is a floating point, read-only value; it has no default value. specification not part of any w3c technical specification or recommendation. ...
Window.mozInnerScreenY - Web APIs
summary gets the y coordinate of the top-left corner of the window's viewport, in screen coordinates. note: this coordinate is reported in css pixels, not in hardware pixels. that means it can be affected by the zoom level; to compute the actual number of physical screen pixels, you should use the nsidomwindowutils.screenpixelspercsspixel property. syntax screeny = window.mozinnerscreeny; value screeny stores the window.mozinnerscreeny property value. the window.mozinnerscreeny property is a floating point, read-only value; it has no default value. specification not part of any w3c technical specification or recommendation. ...
Window.mozPaintCount - Web APIs
irefox 72 / thunderbird 72 / seamonkey 2.69)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. returns the number of times the current document has been painted to the screen in this window. syntax var paintcount = window.mozpaintcount; paintcount stores the window.mozpaintcount property value. the window.mozpaintcount value is a long long, and starts at zero when the document is first created, incrementing by one each time the document is painted. specification not part of any w3c technical specification or recommendation. ...
Window.name - Web APIs
Web › API › Window › name
browsing contexts do not need to have names. it has also been used in some frameworks for providing cross-domain messaging (e.g., sessionvars and dojo's dojox.io.windowname) as a more secure alternative to jsonp. modern web applications hosting sensitive data should, however, not rely on window.name for cross-domain messaging but instead utilize the postmessage api. window.name will convert all values to their string representations by using the tostring method. specifications specification status comment html living standardthe definition of 'window.name' in that specification. living standard html5the definition of 'window.name' in that specification. recommendation ...
Window: offline event - Web APIs
the offline event of the window interface is fired when the browser has lost access to the network and the value of navigator.online switches to false. bubbles no cancelable no interface event event handler property onoffline examples // addeventlistener version window.addeventlistener('offline', (event) => { console.log("the network connection has been lost."); }); // onoffline version window.onoffline = (event) => { console.log("the network connection has been lost."); }; specifications specification status html living standardthe definition of 'offline event' in that specification. living standard ...
Window.ongamepadconnected - Web APIs
the ongamepadconnected property of the window interface represents an event handler that will run when a gamepad is connected (when the gamepadconnected event fires). the event object is of type gamepadevent. syntax window.ongamepadconnected = function() { ... }; examples window.ongamepadconnected = function(event) { // all buttons and axes values can be accessed through event.gamepad; }; specifications specification status comment gamepadthe definition of 'gamepadconnected event' in that specification. working draft initial definition ...
Window: online event - Web APIs
note: this event shouldn't be used to determine the availability of a particular website. network problems or firewalls might still prevent the website from being reached. ...
Window.opener - Web APIs
Web › API › Window › opener
if this window was not opened by being linked to or created by another, returns null. ...
Window.orientation - Web APIs
summary returns the orientation in degrees (in 90-degree increments) of the viewport relative to the device's natural orientation. its only possible values are -90, 0, 90, and 180. positive values are clockwise; negative values are counterclockwise. specifications specification status comment compatibility standardthe definition of 'window.orientation' in that specification. living standard ...
Window: pageshow event - Web APIs
the initial page load, the pageshow event fires after the load event. bubbles no cancelable no interface pagetransitionevent event handler property onpageshow examples this example sets up event handlers for events listed in the array events. the handler, eventlogger(), logs the type of event that occurred to the console, and includes the value of the persisted flag on pageshow and pagehide events. javascript const events = [ "pagehide", "pageshow", "unload", "load" ]; const eventlogger = event => { switch (event.type) { case "pagehide": case "pageshow": let ispersisted = event.persisted ? "persisted" : "not persisted"; console.log('event:', event.type, '-', ispersisted); break; default: cons...
Window.performance - Web APIs
the window interface's performance property returns a performance object, which can be used to gather performance information about the current document. it serves as the point of exposure for the performance timeline api, the high resolution time api, the navigation timing api, the user timing api, and the resource timing api. syntax performancedata = window.performance; value a performance object offering access to the performance and timing-related information offered by the apis it exposes. specifications specification status comment high resolution timethe definition of 'window.performance' in that specification. recommendation defines now() method. ...
Window.releaseEvents() - Web APIs
summary releases the window from trapping events of a specific type. syntax window.releaseevents(eventtype) eventtype is a combination of the following values: event.abort, event.blur, event.click, event.change, event.dblclick, event.dragddrop, event.error, event.focus, event.keydown, event.keypress, event.keyup, event.load, event.mousedown, event.mousemove, event.mouseout, event.mouseover, event.mouseup, event.move, event.reset, event.resize, event.select, event.submit, event.unload. example window.releaseevents(event.keypress) notes note that you can pass a list of events to this method using the following syntax: window.releaseevents(event.keypress | event.keydown | event.keyup). see also window.captureevents ( ). specification this is not part of any specification. brows...
Window.requestAnimationFrame() - Web APIs
o do this. syntax window.requestanimationframe(callback); parameters callback the function to call when it's time to update your animation for the next repaint. the callback function is passed one single argument, a domhighrestimestamp similar to the one returned by performance.now(), indicating the point in time when requestanimationframe() starts to execute callback functions. return value a long integer value, the request id, that uniquely identifies the entry in the callback list. this is a non-zero value, but you may not make any other assumptions about its value. you can pass this value to window.cancelanimationframe() to cancel the refresh callback request. example in this example, an element is animated for 2 seconds (2000 milliseconds). the element moves at a speed of 0.1...
Window.requestFileSystem() - Web APIs
a filesystem object representing the file system the app has permission to use. errorcallback optional an optional parameter specifying a function which is called if an error occurs while attempting to obtain the file system, or if the user denies permission to create or access the file system. the callback receives as input a single parameter: a fileerror object describing the error. return value undefined example specifications specification status comment file and directory entries api draft draft of proposed api this api has no official w3c or whatwg specification. browser compatibility the compatibility 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/br...
Window.resizeTo() - Web APIs
Web › API › Window › resizeTo
example this function resizes the window so that it takes up one quarter of the available screen. see the screen.availwidth and screen.availheight properties. ...
Window.status - Web APIs
Web › API › Window › status
the status property of the window interface was originally intended to set the text in the status bar at the bottom of the browser window. however, the html standard now requires setting window.status to have no effect on the text displayed in the status bar. syntax window.status = string; var value = window.status; specifications specification status comment html living standardthe definition of 'window.status' in that specification. living standard ...
Window.visualViewport - Web APIs
the visualviewport read-only property of the window interface returns a visualviewport object representing the visual viewport for a given window. syntax var visualviewport = window.visualviewport value a visualviewport object. specifications specification status comment visual viewport apithe definition of 'visualviewport' in that specification. draft initial definition. ...
WindowClient.focus() - Web APIs
the focus() method of the windowclient interface gives user input focus to the current client and returns a promise that resolves to the existing windowclient. syntax windowclient.focus().then(function(windowclient) { // do something with your windowclient once it has been focused }); parameters none. return value a promise that resolves to 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]; ...
WindowClient.focused - Web APIs
the focused read-only property of the windowclient interface is a boolean that indicates whether the current client has focus. syntax var myfocused = windowclient.focused; value a boolean. 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) { if(!client.focused) return client.focus(); } } } if (clients.openwindow) return clients.open...
WindowClient.navigate() - Web APIs
the navigate() method of the windowclient interface loads a specified url into a controlled client page then returns a promise that resolves to the existing windowclient. syntax windowclient.navigate(url).then(function(windowclient) { // do something with your windowclient after navigation }); parameters url the location to navigate to. return value a promise that resolves to the existing windowclient. specifications specification status comment service workersthe definition of 'navigate()' in that specification. working draft initial definition. ...
WindowClient.visibilityState - Web APIs
the visibilitystate read-only 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). example event.waituntil(clients.matchall({ type: "window" }).then(function(clientlist) { for (let i = 0; i < clientlist.length; i++) { let client = clientlist[i]; if (client.url == '/' && 'focus' in client) { if (client.visibilitystate === 'hidden') return client.focus(); } } } if (clients.openwindow) { return clients.openwindow('/'); } })); }); specifications specification status comment service wor...
WindowClient - Web APIs
ves user input focus to the current client. windowclient.navigate() loads a specified url into a controlled client page. properties windowclient inherits properties from its parent interface, client. windowclient.focused read only a boolean that indicates whether the current client has focus. windowclient.visibilitystate read only indicates the visibility of the current client. this value can be one of "hidden", "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 (v...
WindowEventHandlers.onlanguagechange - Web APIs
mixin is the eventhandler for processing languagechange events. these events are received by the object implementing this interface, usually a window, an htmlbodyelement, or an htmliframeelement. such an event is sent by the browser to inform that the preferred languages list has been updated. the list is accessible via navigatorlanguage.languages. syntax object.onlanguagechange = function; value function is the name of a user-defined function, without the () suffix or any parameters, or an anonymous function declaration, such as function(event) {...}. an event handler always has one single parameter, containing the event, here of type event. example window.onlanguagechange = function(event) { console.log('languagechange event detected!'); }; specifications specificati...
WindowEventHandlers.onstorage - Web APIs
the onstorage property of the windoweventhandlers mixin is an eventhandler for processing storage events. the storage event fires when a storage area has been changed in the context of another document. syntax window.onstorage = functionref; value functionref is a function name or a function expression. this function receives a storageevent as its sole argument. example this example logs the value for a storage key whenever it changes in another document. window.onstorage = function(e) { console.log('the ' + e.key + ' key has been changed from ' + e.oldvalue + ' to ' + e.newvalue + '.'); }; specifications specification status comment html living standardthe definition of 'onstorage' in that specification. living standard ...
WindowEventHandlers.onunhandledrejection - Web APIs
the onunhandledrejection property of the windoweventhandlers mixin is the eventhandler for processing unhandledrejection events. these events are raised for unhandled promise rejections. syntax window.onunhandledrejection = function; value function is an eventhandler or function to call when unhandledrejection events are received by the window. the event handler receives as an input parameter as a promiserejectionevent. examples this example simply logs unhandled rejections' reason values to the console. window.onunhandledrejection = function(e) { console.log(e.reason); } specifications specification status comment html living standardthe definition of 'onunhandledrejection' in that specification. living standard initial definition. ...
WindowOrWorkerGlobalScope.atob() - Web APIs
the windoworworkerglobalscope.atob() function decodes a string of data which has been encoded using base64 encoding. you can use the btoa() method to encode and transmit data which may otherwise cause communication problems, then transmit it and use the atob() method to decode the data again. for example, you can encode, transmit, and decode control characters such as ascii values 0 through 31. for use with unicode or utf-8 strings, see the note on "unicode strings" in the page for btoa(). syntax var decodeddata = scope.atob(encodeddata); parameters encodeddata a binary string contains an base64 encoded data. return value an ascii string containing decoded data from encodeddata. exceptions domexception (name: invalidcharactererror) throws if encodeddata is not valid base64. e...
WindowOrWorkerGlobalScope.btoa() - Web APIs
lobalscope.btoa() method creates a base64-encoded ascii string from a binary string (i.e., a string object in which each character in the string is treated as a byte of binary data). you can use this method to encode data which may otherwise cause communication problems, transmit it, then use the atob() method to decode the data again. for example, you can encode control characters such as ascii values 0 through 31. syntax var encodeddata = scope.btoa(stringtoencode); parameters stringtoencode the binary string to encode. return value an ascii string containing the base64 representation of stringtoencode. exceptions invalidcharactererror the string contained a character that did not fit in a single byte. see "unicode strings" below for more detail. example const encodeddata =...
WindowOrWorkerGlobalScope.caches - Web APIs
the caches read-only property of the windoworworkerglobalscope interface returns the cachestorage object associated with the current context. this object enables functionality such as storing assets for offline use, and generating custom responses to requests. syntax var mycachestorage = self.caches; // or just caches value a cachestorage object. example the following example shows how you'd use a cache in a service worker context to store assets offline. this.addeventlistener('install', function(event) { event.waituntil( caches.open('v1').then(function(cache) { return cache.addall([ '/sw-test/', '/sw-test/index.html', '/sw-test/style.css', '/sw-test/app.js', '/sw-test/image-list.js', '/sw-test/star-wars-logo.jpg', ...
WindowOrWorkerGlobalScope.clearInterval() - Web APIs
intervalid) parameters intervalid the identifier of the repeated action you want to cancel. this id was returned by the corresponding call to setinterval(). it's worth noting that the pool of ids used by setinterval() and settimeout() are shared, which means you can technically use clearinterval() and cleartimeout() interchangeably. however, for clarity, you should avoid doing so. return value undefined example see the setinterval() examples. specifications specification status comment html living standardthe definition of 'windoworworkerglobalscope.clearinterval()' in that specification. living standard method moved to the windoworworkerglobalscope mixin in the latest spec. html living standardthe definition of 'clearinterval()' in that spec...
WindowOrWorkerGlobalScope.crossOriginIsolated - Web APIs
the crossoriginisolated read-only property of the windoworworkerglobalscope interface returns a boolean value that indicates whether a sharedarraybuffer can be sent via a window.postmessage() call. this value is dependant on any cross-origin-opener-policy and cross-origin-embedder-policy headers present in the response. syntax var mycrossoriginisolated = self.crossoriginisolated; // or just crossoriginisolated value a boolean value examples if(crossoriginisolated) { // post sharedarraybuffer } else { // do something else } specifications specification status comment html living standardthe definition of 'crossoriginisolated' in that specification. living standard initial definition. ...
WindowOrWorkerGlobalScope.indexedDB - Web APIs
the indexeddb read-only property of the windoworworkerglobalscope mixin provides a mechanism for applications to asynchronously access the capabilities of indexed databases. syntax var idbfactory = self.indexeddb; value an idbfactory object. example the following code creates a request for a database to be opened asychronously, after which the database is opened when the request's onsuccess handler is fired: var db; function opendb() { var dbopenrequest = window.indexeddb.open('todolist'); dbopenrequest.onsuccess = function(e) { db = dbopenrequest.result; } } specifications specification status comment indexed database api draftthe definition of 'indexeddb' in that specification. recommendation defined in a windoworworkerglobalscope partial in the n...
WindowOrWorkerGlobalScope.isSecureContext - Web APIs
the issecurecontext read-only property of the windoworworkerglobalscope interface returns a boolean indicating whether the current context is secure (true) or not (false). syntax var isitsecure = self.issecurecontext; // or just issecurecontext value a boolean. specifications specification status comment secure contextsthe definition of 'windoworworkerglobalscope.issecurecontext' in that specification. candidate recommendation initial definition. ...
WindowOrWorkerGlobalScope.origin - Web APIs
examples executed from inside a worker script, the following snippet will log the worker's global scope's origin to the console each time it receives a message onmessage = function() { console.log(self.origin); }; if the origin is not a scheme/host/port tuple (say you are trying to run it locally, i.e. via file:// url), origin will return the string "null". ...
WindowOrWorkerGlobalScope.queueMicrotask() - Web APIs
other just-before-rendering tasks. queuemicrotask() is exposed on the windoworworkerglobalscope mixin. syntax scope.queuemicrotask(function); parameters function a function to be executed when the browser engine determines it is safe to call your code. enqueued microtasks are executed after all pending tasks have completed but before yielding control to the browser's event loop. return value undefined. examples self.queuemicrotask(() => { // function contents here }) taken from the queuemicrotask spec: myelement.prototype.loaddata = function (url) { if (this._cache[url]) { queuemicrotask(() => { this._setdata(this._cache[url]); this.dispatchevent(new event("load")); }); } else { fetch(url).then(res => res.arraybuffer()).then(data => { this._ca...
WindowOrWorkerGlobalScope - Web APIs
the windoworworkerglobalscope mixin, and implemented by window and workerglobalscope. windoworworkerglobalscope.caches read only returns the cachestorage object associated with the current context. this object enables functionality such as storing assets for offline use, and generating custom responses to requests. windoworworkerglobalscope.crossoriginisolated read only returns a boolean value that indicates whether a sharedarraybuffer can be sent via a window.postmessage() call. windoworworkerglobalscope.indexeddb read only provides a mechanism for applications to asynchronously access capabilities of indexed databases; returns an idbfactory object. windoworworkerglobalscope.issecurecontext read only returns a boolean indicating whether the current context is secure (true) or no...
Worker - Web APIs
Web › API › Worker
available using the onunhandledrejection event handler property. example the following code snippet creates a worker object using the worker() constructor, then uses the worker object: var myworker = new worker('/worker.js'); var first = document.queryselector('input#number1'); var second = document.queryselector('input#number2'); first.onchange = function() { myworker.postmessage([first.value, second.value]); console.log('message posted to worker'); } for a full example, see ourbasic dedicated worker example (run dedicated worker). specifications specification status comment html living standardthe definition of 'worker' in that specification. living standard ...
WorkerGlobalScope.console - Web APIs
example this property allows you to have access to a browser console for debugging purposes, inside a worker. ...
WorkerGlobalScope.importScripts() - Web APIs
the importscripts() method of the workerglobalscope interface synchronously imports one or more scripts into the worker's scope. syntax self.importscripts('foo.js'); self.importscripts('foo.js', 'bar.js', ...); parameters a comma-separated list of domstring objects representing the scripts to be imported. these paths are relative to html document base url. return value none. exceptions networkerror imported scripts were not served with a valid javascript mime type (i.e. text/javascript). example if you had some functionality written in a separate script called foo.js that you wanted to use inside worker.js, you could import it using the following line: importscripts('foo.js'); importscripts() and self.importscripts() are effectively equivalent — both represent importscripts()...
WorkerGlobalScope.location - Web APIs
the location read-only property of the workerglobalscope interface returns the workerlocation associated with the worker. it is a specific location object, mostly a subset of the location for browsing scopes, but adapted to workers. syntax var locationobj = self.location; value a workerlocation object. example if you called the following in a document served at localhost:8000 console.log(location); inside a worker (which would basically be the equivalent of self.console.log(self.location);, as these are being called on the worker scope, which can be referenced with workerglobalscope.self), you will get a workerlocation object written to the console — something like the following: workerlocation {hash: "", search: "", pathname: "/worker.js", port: "8000", hostname: "localhost"…} ...
WorkerGlobalScope.navigator - Web APIs
the navigator read-only property of the workerglobalscope interface returns the workernavigator associated with the worker. it is a specific navigator object, mostly a subset of the navigator for browsing scopes, but adapted to workers. syntax var navigatorobj = self.navigator; value a workernavigator object. example if you call the following console.log(navigator); inside a worker (which would basically be the equivalent of self.console.log(self.navigator);, as these are being called on the worker scope, which can be referenced with workerglobalscope.self), you will get a workernavigator object written to the console — something like the following: object {online: true, useragent: "mozilla/5.0 (macintosh; intel mac os x 10_10_1) ap…ml, like gecko) chrome/40.0.2214.93 safari/537.3...
WorkerGlobalScope.performance - Web APIs
the performance read-only property of the workerglobalscope interface returns a performance object to be used on the worker. not all performance properties and methods are available to web workers. this property is read only . syntax var perfobj = self.performance; return value a performance object. example if you called console.log(performance); inside a worker (which would basically be the equivalent of self.console.log(self.performance);, as these are being called on the worker scope, which can be referenced with workerglobalscope.self), you will get a workerperformance object written to the console — something like the following: workerperformance {now: function} __proto__: workerperformance constructor: function workerperformance() { [native code] } now: functio...
WorkerGlobalScope.self - Web APIs
the self read-only property of the workerglobalscope interface returns a reference to the workerglobalscope itself. most of the time it is a specific scope like dedicatedworkerglobalscope, sharedworkerglobalscope, or serviceworkerglobalscope. syntax var selfref = self; value a global scope object (differs depending on the type of worker you are dealing with, as indicated above). example if you called console.log(self); inside a worker, you will get a worker 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 calle...
WorkerGlobalScope - Web APIs
the current context is secure (true) or not (false). windoworworkerglobalscope.origin read only returns the global object's origin, serialized as a string. (this does not yet appear to be implemented in any browser.) events error fired when an error occured. also available via the workerglobalscope.onerror property. offline fired when the browser has lost access to the network and the value of navigator.online switched to false. also available via the workerglobalscope.onoffline property. online fired when the browser has gained access to the network and the value of navigator.online switched to true. also available via the workerglobalscope.ononline property. languagechange fired at the global/worker scope object when the user's preferred languages change. also available via...
WorkerNavigator.locks - Web APIs
the locks read-only property of the workernavigator interface returns a lockmanager object which provides methods for requesting a new lock object and querying for an existing lock object. syntax var lockmanager = navigator.locks value a lockmanager object. specifications specification status comment web locks apithe definition of 'locks' in that specification. draft initial definition. ...
WorkerNavigator.permissions - Web APIs
the workernavigator.permissions read-only property returns a permissions object that can be used to query and update permission status of apis covered by the permissions api. syntax permissionsobj = self.permissions value a permissions object. examples self.navigator.permissions.query({name:'notifications'}).then(function(result) { if (result.state === 'granted') { shownotification(); } else if (result.state === 'prompt') { requestnotificationpermission() } }); specification specification status comment permissions working draft initial definition. browser support 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-...
Worklet.addModule() - Web APIs
Web › API › Worklet › addModule
t interface loads the module in the given javascript file and adds it to the current worklet. syntax addpromise = worklet.addmodule(moduleurl); addpromise = worklet.addmodule(moduleurl, options); parameters moduleurl a string containing the url of a javascript file with the module to add. options optional an object with any of the following options: credentials: a requestcredentials value that indicates whether to send credentials (e.g. cookies and http authentification) when loading the module. can be one of "omit", "same-origin", or "include". defaults to "same-origin". see also request.credentials. return value a promise that resolves once the module from the given url has been added. the promise doesn't return any value. exceptions if addmodule() fails, it rejects the...
WritableStream.WritableStream() - Web APIs
gative integer — this defines the total number of chunks that can be contained in the internal queue before backpressure is applied. size(chunk) a method containing a parameter chunk — this indicates the size to use for each chunk, in bytes. note: you could define your own custom queuingstrategy, or use an instance of bytelengthqueuingstrategy or countqueuingstrategy for this object value. if no queuingstrategy is supplied, the 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-supplied queuing strategy. it then calls a function called se...
WritableStream.abort() - Web APIs
the abort() method of the writablestream interface aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded. syntax var promise = writablestream.abort(reason); parameters reason a domstring providing a human-readable reason for the abort. return value a promise, which fulfills with the value given in the reason parameter. exceptions typeerror the stream you are trying to abort is not a writablestream, or it is locked. examples const writablestream = new writablestream({ write(chunk) { ... }, close() { ... }, abort(err) { ... } }, queuingstrategy); ... // abort the stream later on, when required writablestream.abort(); speci...
WritableStream.getWriter() - Web APIs
exceptions typeerror the stream you are trying to create a writer for is not a writablestream. ...
WritableStream.locked - Web APIs
examples const writablestream = new writablestream({ write(chunk) { ... }, close() { ... }, abort(err) { ... } }, queuingstrategy); ... ...
WritableStreamDefaultController.error() - Web APIs
it suffices to return a rejected promise from one of the underlying sink’s methods. however, it can be useful for suddenly shutting down a stream in response to an event outside the normal lifecycle of interactions with the underlying sink. syntax writablestreamdefaultcontroller.error(e); parameters e a domstring representing the error you want future interactions to fail with. return value undefined. exceptions typeerror the stream you are trying to error is not a writablestream. examples const writablestream = new writablestream({ start(controller) { // do stuff with controller // error stream if necessary controller.error('my error is broken'); }, write(chunk, controller) { ... }, close(controller) { ... }, abort(err) { ... } }); ...
WritableStreamDefaultWriter.WritableStreamDefaultWriter() - Web APIs
the writablestreamdefaultwriter() constructor creates a new writablestreamdefaultwriter object instance. note: you generally wouldn't use this constructor manually; instead, you'd use the writablestream.getwriter() method. syntax var writablestreamdefaultwriter = new writablestreamdefaultwriter(stream); parameters stream the writablestream to be written to. return value an instance of the writablestreamdefaultwriter object. exceptions typeerror the provided stream value is not a writablestream, or it is locked to another writer already. examples the following example shows the creation of a writablestream with a custom sink and an api-supplied queuing strategy. it then calls a function called sendmessage(), passing the newly created stream and a string. inside this func...
WritableStreamDefaultWriter.abort() - Web APIs
iately moved to an error state, with any queued writes discarded. if the writer is active, the abort() method behaves the same as that for the associated stream (writablestream.abort()). if not, it returns a rejected promise. syntax var promise = writablestreamdefaultwriter.abort(reason); parameters reason optional a domstring representing a human-readable reason for the abort. return value a promise, which fulfills with the value given in the reason parameter. exceptions typeerror the stream you are trying to abort is not a writablestream, or it is locked. examples const writablestream = new writablestream({ write(chunk) { ... }, close() { ... }, abort(err) { ... } }, queuingstrategy); ... const writer = writablestream.getwriter(); ... // abort ...
WritableStreamDefaultWriter.close() - Web APIs
the close() method of the writablestreamdefaultwriter interface closes the associated writable stream. the underlying sink will finish processing any previously-written chunks, before invoking the close behavior. during this time any further attempts to write will fail (without erroring the stream). syntax var promise = writablestreamdefaultwriter.close(); parameters none. return value a promise, which fulfills with the undefined if all remaining chunks were successfully written before the close, or rejects with an error if a problem was encountered during the process. exceptions typeerror the stream you are trying to close is not a writablestream. examples the following example shows the creation of a writablestream with a custom sink and an api-supplied queuing strategy. i...
WritableStreamDefaultWriter.closed - Web APIs
examples const writablestream = new writablestream({ start(controller) { }, write(chunk, controller) { ... }, close(controller) { ... }, abort(err) { ... } }, queuingstrategy); ... ...
WritableStreamDefaultWriter.ready - Web APIs
example the following example shows two uses of the ready property. ...
WritableStreamDefaultWriter.releaseLock() - Web APIs
e writablestreamdefaultwriter interface releases the writer's lock on the corresponding stream. after the lock is released, the writer is no longer active. if the associated stream is errored when the lock is released, the writer will appear errored in the same way from now on; otherwise, the writer will appear closed. syntax writablestreamdefaultwritere.releaselock() parameters none. return value undefined. examples const writablestream = new writablestream({ write(chunk) { ... }, close() { ... }, abort(err) { ... } }, queuingstrategy); ... const writer = writablestream.getwriter(); ... // release writer's lock on the stream when desired writer.releaselock(); specifications specification status comment streamsthe definition of 'rele...
WritableStreamDefaultWriter.write() - Web APIs
indicate the success or failure of the write operation. note that what "success" means is up to the underlying sink; it might indicate simply that the chunk has been accepted, and not necessarily that it is safely saved to its ultimate destination. syntax var promise = writablestreamdefaultwriter.write(chunk); parameters chunk a block of binary data to pass to the writablestream. return value a promise, which fulfills with the undefined upon a successful write, or rejects if the write fails or stream becomes errored before the writing process is initiated. exceptions typeerror the target stream is not a writable stream, or it does not have an owner. examples the following example shows the creation of a writablestream with a custom sink and an api-supplied queuing strategy. i...
XDomainRequest.onerror - Web APIs
ay to determine the cause of the error from the xdomainrequest interface. syntax xdr.onerror = funcref; parameters funcref a function to call when an error occurs. example var xdr = new xdomainrequest(); xdr.open("post", "http://example.com/api/method"); xdr.onerror = function(){ //handle error } xdr.onload = function(){ //handle response with xdr.responsetext } xdr.send("param1=value1&param2=value2"); specification not part of any specification. ...
XDomainRequest.onprogress - Web APIs
ad event handler gets called. syntax xdr.onprogress = funcref; parameters funcref a function to call when progress events occur. example var xdr = new xdomainrequest(); xdr.open("post", "http://example.com/api/method"); xdr.onprogress = function(){ //handle partial response with xdr.responsetext } xdr.onload = function(){ //handle response with xdr.responsetext } xdr.send("param1=value1&param2=value2"); specification not part of any specification. ...
XDomainRequest.ontimeout - Web APIs
er which is called when a pending xdomainrequest times out. syntax xdr.ontimeout = funcref; parameters funcref a function to be called when the event times out. example var xdr = new xdomainrequest(); xdr.open("post", "http://example.com/api/method"); xdr.ontimeout = function(){ //handle timeout } xdr.onload = function(){ //handle response with xdr.responsetext } xdr.send("param1=value1&param2=value2"); specification not part of any specification. ...
XDomainRequest.timeout - Web APIs
gets or sets the amount of time in milliseconds until an xdomainrequest times out. syntax xdr.timeout = milliseconds; the default value is 0. example xdr.timeout = 10000; specification not part of any specification. ...
XMLDocument.async - Web APIs
Web › API › XMLDocument › async
document.async can be set to indicate whether a xmldocument.load() call should be an asynchronous or synchronous request. true is the default value, indicating that documents should be loaded asynchronously. (it has been possible to load documents synchronously since 1.4 alpha.) example function loadxmldata(e) { alert(new xmlserializer().serializetostring(e.target)); // gives querydata.xml contents as string } var xmldoc = document.implementation.createdocument("", "test", null); xmldoc.async = false; xmldoc.onload = loadxmldata; xmldoc.load('querydata.xml'); ...
Synchronous and asynchronous requests - Web APIs
pplied to the callback function (in this case, showmessage) which is invoked by function xhrsuccess. line 15 specifies true for its third parameter to indicate that the request should be handled asynchronously. line 16 actually initiates the request. example: using a timeout you can use a timeout to prevent your code from hanging while waiting for a read to finish. ...
XMLHttpRequest() - Web APIs
the object must be prepared by at least calling open() to initialize it before calling send() to send the request to the server. non-standard firefox syntax firefox 16 added a non-standard parameter to the constructor that can enable anonymous mode (see bug 692677). ...
XMLHttpRequest.abort() - Web APIs
the xmlhttprequest.abort() method aborts the request if it has already been sent. when a request is aborted, its readystate is changed to xmlhttprequest.unsent (0) and the request's status code is set to 0. syntax xmlhttprequest.abort() parameters none. return value undefined example this example begins loading content from the mdn home page, then due to some condition, aborts the transfer by calling abort(). var xhr = new xmlhttprequest(), method = "get", url = "https://developer.mozilla.org/"; xhr.open(method, url, true); xhr.send(); if (oh_noes_we_need_to_cancel_right_now_or_else) { xhr.abort(); } specifications specification status comment xmlhttprequest living standard whatwg living standard ...
XMLHttpRequest.onreadystatechange - Web APIs
called from the user interface thread. the xmlhttprequest.onreadystatechange property contains the event handler to be called when the readystatechange event is fired, that is every time the readystate property of the xmlhttprequest changes. warning: this should not be used with synchronous requests and must not be used from native code. syntax xmlhttprequest.onreadystatechange = callback; values callback is the function to be executed when the readystate changes. examples const xhr = new xmlhttprequest(), method = "get", url = "https://developer.mozilla.org/"; xhr.open(method, url, true); xhr.onreadystatechange = function () { // in local files, status is 0 upon success in mozilla firefox if(xhr.readystate === xmlhttprequest.done) { var status = xhr.status; if...
XMLHttpRequest.overrideMimeType() - Web APIs
o force a stream to be treated and parsed as "text/xml", even if the server does not report it as such. this method must be called before calling send(). syntax xmlhttprequest.overridemimetype(mimetype) parameters mimetype a domstring specifying the mime type to use instead of the one specified by the server. if the server doesn't specify a type, xmlhttprequest assumes "text/xml". return value undefined. example this example specifies a mime type of "text/plain", overriding the server's stated type for the data being received. note: if the server doesn't provide a content-type header, xmlhttprequest assumes that the mime type is "text/xml". if the content isn't valid xml, an "xml parsing error: not well-formed" error occurs. you can avoid this by calling overridemimetype() to spec...
XMLHttpRequest.readyState - Web APIs
open() not called yet. 1 opened open() has been called. 2 headers_received send() has been called, and headers and status are available. 3 loading downloading; responsetext holds partial data. 4 done the operation is complete. unsent the xmlhttprequest client has been created, but the open() method hasn't been called yet. ...
XMLHttpRequest.responseURL - Web APIs
the read-only xmlhttprequest.responseurl property returns the serialized url of the response or the empty string if the url is null. if the url is returned, any url fragment present in the url will be stripped away. the value of responseurl will be the final url obtained after any redirects. example var xhr = new xmlhttprequest(); xhr.open('get', 'http://example.com/test', true); xhr.onload = function () { console.log(xhr.responseurl); // http://example.com/test }; xhr.send(null); specifications specification status comment xmlhttprequest living standard whatwg living standard ...
XMLHttpRequest.responseXML - Web APIs
t was made asynchronously, instead the response is parsed as "text/html". responsexml is null for any other types of data, as well as for data: urls. if the server doesn't specify the content-type as "text/xml" or "application/xml", you can use xmlhttprequest.overridemimetype() to parse it as xml anyway. this property isn't available to workers. syntax var data = xmlhttprequest.responsexml; value a document from parsing the xml or html received using xmlhttprequest, or null if no data was received or if the data is not xml/html. exceptions invalidstateerror the responsetype isn't either "document" or an empty string. example var xhr = new xmlhttprequest; xhr.open('get', '/server'); // if specified, responsetype must be empty string or "document" xhr.responsetype = 'document'; /...
XMLHttpRequest.send() - Web APIs
r(), an accept header with the type "*/*" (any type) is sent. syntax xmlhttprequest.send(body) parameters body optional a body of data to be sent in the xhr request. this can be: a document, in which case it is serialized before being sent. an xmlhttprequestbodyinit, which per the fetch spec can be a blob, buffersource, formdata, urlsearchparams, or usvstring object. null if no value is specified for the body, a default value of null is used. the best way to send binary content (e.g. in file uploads) is by using an arraybufferview or blob in conjunction with the send() method. return value undefined. exceptions exception description invalidstateerror send() has already been invoked for the request, and/or the request is complete. net...
XMLHttpRequest.sendAsBinary() - Web APIs
e the send() method, which now supports binary data in various forms. syntax xmlhttprequest.sendasbinary(binarystring); parameters binarystring a domstring which encodes the binary content to be sent. you can create the binary string using the filereader method readasbinarystring(). the string is converted to binary for transfer by removing the high-order byte of each character. return value undefined. polyfill since sendasbinary() is an experimental feature, here is a polyfill for browsers that don't support the sendasbinary() method but support typed arrays. /*\ |*| |*| :: xmlhttprequest.prototype.sendasbinary() polyfill :: |*| |*| https://developer.mozilla.org/docs/dom/xmlhttprequest#sendasbinary() |*| \*/ if (!xmlhttprequest.prototype.sendasbinary) { xmlhttprequest.proto...
XMLHttpRequest.status - Web APIs
browsers also report a status of 0 in case of xmlhttprequest errors. ...
XMLHttpRequest.statusText - Web APIs
the read-only xmlhttprequest.statustext property returns a domstring containing the response's status message as returned by the http server. unlike xmlhttprequest.status which indicates a numerical status code, this property contains the text of the response status, such as "ok" or "not found". if the request's readystate is in unsent or opened state, the value of statustext will be an empty string. if the server response doesn't explicitly specify a status text, statustext will assume the default value "ok". example var xhr = new xmlhttprequest(); console.log('0 unsent', xhr.statustext); xhr.open('get', '/server', true); console.log('1 opened', xhr.statustext); xhr.onprogress = function () { console.log('3 loading', xhr.statustext); }; xhr.onload = function () { console.log('4 done...
XMLHttpRequest.timeout - Web APIs
timeout shouldn't be used for synchronous xmlhttprequests requests used in a document environment or it will throw an invalidaccesserror exception. when a timeout happens, a timeout event is fired. note: you may not use a timeout for synchronous requests with an owning window. ...
XMLHttpRequestEventTarget.onabort - Web APIs
the xmlhttprequesteventtarget.onabort is the function called when an xmlhttprequest transaction is aborted, such as when the xmlhttprequest.abort() function is called. syntax xmlhttprequest.onabort = callback; values callback is the function to be executed when the transaction is aborted. example var xmlhttp = new xmlhttprequest(), method = 'get', url = 'https://developer.mozilla.org/'; xmlhttp.open(method, url, true); xmlhttp.onabort = function () { console.log('** the request was aborted'); }; xmlhttp.send(); //.. xmlhttp.abort(); // this will invoke our onabort handler above specifications specification status comment xmlhttprequest living standard whatwg living standard ...
XMLHttpRequestEventTarget.onerror - Web APIs
the xmlhttprequesteventtarget.onerror is the function called when an xmlhttprequest transaction fails due to an error. syntax xmlhttprequest.onerror = callback; values callback is the function to be executed when the request fails. example var xmlhttp = new xmlhttprequest(), method = 'get', url = 'https://developer.mozilla.org/'; xmlhttp.open(method, url, true); xmlhttp.onerror = function () { console.log("** an error occurred during the transaction"); }; xmlhttp.send(); specifications specification status comment xmlhttprequest living standard whatwg living standard ...
XMLHttpRequestEventTarget.onloadstart - Web APIs
the xmlhttprequesteventtarget.onloadstart is the function called when an xmlhttprequest transaction starts transferring data. syntax xmlhttprequest.onloadstart = callback; values callback is the function to be called when the transaction begins to transfer data. example var xmlhttp = new xmlhttprequest(), method = 'get', url = 'https://developer.mozilla.org/'; xmlhttp.open(method, url, true); xmlhttp.onloadstart = function () { console.log("download underway"); }; xmlhttp.send(); specifications specification status comment xmlhttprequest living standard whatwg living standard ...
XMLHttpRequestEventTarget.onprogress - Web APIs
event event.loaded the amount of data currently transfered. event.total the total amount of data to be transferred. ...
XMLHttpRequestEventTarget - Web APIs
enttarget.onprogress contains the function that is called periodically with information about the progress of the request and the progress event is received by this object. xmlhttprequesteventtarget.ontimeout contains the function that is called if the event times out and the timeout event is received by this object; this only happens if a timeout has been previously established by setting the value of the xmlhttprequest object's timeout attribute. xmlhttprequesteventtarget.onloadend contains the function that is called when the load is completed, even if the request failed, and the loadend event is received by this object. specifications specification status comment xmlhttprequest living standard whatwg living standard ...
XMLSerializer.serializeToString() - Web APIs
exceptions typeerror the specified rootnode is not a compatible node type. ...
XPathEvaluator.createExpression() - Web APIs
ed for (repeated) evaluations of the xpath expression. syntax xpathexpression xpathevaluator.createexpression(expression, resolver); parameters expression a domstring representing representing the xpath expression to be created. resolver optional permits translation of all prefixes, including the xml namespace prefix, within the xpath expression into appropriate namespace uris. return value a xpathexpression representing the compiled form of the xpath expression. exceptions invalid_expression_err if the expression is not legal according to the rules of the xpathevaluator, an xpathexception of type invalid_expression_err is raised. namespace_err if the expression contains namespace prefixes which cannot be resolved by the specified xpathnsresolver, a domexception of type namesp...
XPathEvaluator.createNSResolver() - Web APIs
method node.lookupnamespaceuri() in resolving the namespace uri from a given prefix using the current information available in the node's hierarchy at the time the method is called, also correctly resolving the implicit xml prefix. syntax xpathnsresolver xpathevaluator.creatensresolver(noderesolver); parameters noderesolver a node to be used as a context for namespace resolution. return value an xpathnsresolver object which resolves namespaces with respect to the definitions in scope for a specified node. specifications specification status comment document object model (dom) level 3 xpath specificationthe definition of 'xpathevaluator.creatensresolver()' in that specification. recommendation initial definition ...
XPathEvaluator.evaluate() - Web APIs
ppropriate namespace uris. type optional specifies the type of result to be returned by evaluating the expression. this must be one of the xpathresult.constants. result optional allows to specify a result object which may be reused and returned by this method. if this is specified as null or the implementation does not reuse the specified result, a new result object will be returned. return value an xpathresult object representing the result of evaluating the xpath expression. exceptions invalid_expression_err if the expression is not legal according to the rules of the xpathevaluator, an xpathexception of type invalid_expression_err is raised. type_err in case result cannot be converted to the specified type, an xpathexception of type type_err is raised. namespace_err if the expr...
XPathException.code - Web APIs
the code read-only property of the xpathexception interface returns a short that contains one of the error code constants. syntax var exceptioncode = exception.code; value a short number representing the error code. specifications specification status comment document object model (dom) level 3 xpath specificationthe definition of 'xpathexception' in that specification. recommendation initial definition ...
XPathException - Web APIs
in the dom xpath api the xpathexception interface represents exception conditions that can be encountered while performing xpath operations. properties xpathexception.code read only returns a short that contains one of the error code constants. constants constant value description invalid_expression_err 51 if the expression has a syntax error or otherwise is not a legal expression according to the rules of the specific xpathevaluator or contains specialized extension functions or variables not supported by this implementation. type_err 52 if the expression cannot be converted to return the specified type. specifications specification status comment document object model (dom) level 3 xpath specificationth...
XPathExpression.evaluate() - Web APIs
evaluating the expression. type optional specifies the type of result to be returned by evaluating the expression. this must be one of the xpathresult.constants. result optional allows to specify a result object which may be reused and returned by this method. if this is specified as null or the implementation does not reuse the specified result, a new result object will be returned. return value an xpathresult object representing the result of evaluating the xpath expression. exceptions invalid_expression_err if the expression is not legal according to the rules of the xpathevaluator, an xpathexception of type invalid_expression_err is raised. type_err in case result cannot be converted to the specified type, an xpathexception of type type_err is raised. namespace_err if the expr...
XPathNSResolver.lookupNamespaceURI() - Web APIs
the lookupnamespaceuri method looks up the namespace uri associated to the given namespace prefix within an xpath expression evaluated by the xpathevaluator interface. syntax domstring xpathnsresolver.lookupnamespaceuri(prefix); parameters prefix a domstring representing the prefix to look for. return value a domstring representing the associated namespace uri or null if none is found. specifications specification status comment document object model (dom) level 3 xpath specificationthe definition of 'xpathnsresolver.lookupnamespaceuri()' in that specification. recommendation initial definition ...
XPathResult.invalidIteratorState - Web APIs
read-only invaliditeratorstate property of the xpathresult interface signifies that the iterator has become invalid. it is true if xpathresult.resulttype is unordered_node_iterator_type or ordered_node_iterator_type and the document has been modified since this result was returned. note: this feature is available in web workers. syntax var iteratorstate = result.invaliditeratorstate; return value a boolean value indicating whether the iterator has become invalid. example the following example shows the use of the invaliditeratorstate property. html <div>xpath example</div> <p>iterator state: <output></output></p> javascript var xpath = "//div"; var result = document.evaluate(xpath, document, null, xpathresult.any_type, null); // invalidates the iterator state document.queryselecto...
XPathResult.iterateNext() - Web APIs
exceptions type_err in case xpathresult.resulttype is not unordered_node_iterator_type or ordered_node_iterator_type, an xpathexception of type type_err is thrown. invalid_state_err if the document is mutated since the result was returned, an xpathexception of type invalid_state_err is thrown. ...
XPathResult.snapshotItem() - Web APIs
the snapshotitem() method of the xpathresult interface returns an item of the snapshot collection or null in case the index is not within the range of nodes. unlike the iterator result, the snapshot does not become invalid, but may not correspond to the current document if it is mutated. syntax var node = result.snapshotitem(i); return value the node at the given index within the node set of the xpathresult. exceptions type_err in case xpathresult.resulttype is not unordered_node_snapshot_type or ordered_node_snapshot_type, an xpathexception of type type_err is thrown. example the following example shows the use of the snapshotitem() method. html <div>xpath example</div> <div>tag names of the matched nodes: <output></output></div> javascript var xpath = "//div"; var result = doc...
XRBoundedReferenceSpace.boundsGeometry - Web APIs
controls their xr hardware. this may be done by walking the border of the space they wish to use, or by drawing the shape of their room using their xr input device. theoretically, a more advanced system might use sensors or other detection methods to determine the bounds of a dedicated xr room (notice how we carefully don't call it a holodeck?). syntax bounds = xrreferencespace.boundsgeometry; value the boundsgeometry property is an array of dompointreadonly objects, each of which defines one vertex in a polygon inside which the viewer is required to remain. each point must be at floor level, with its y coordinate's value set to 0. additionally, the value of w is always 1 in every point in the array. additionally, the points must be listed in clockwise order. each entry in boundsgeometry i...
XREye - Web APIs
Web › API › XREye
the xreye enumerated type is used to identify which eye a particular xrview represents: left or right; or, if the view doesn't represent a single eye, the value may be none. values left the xrview represents the point-of-view of the viewer's left eye. right the view represents the viewer's right eye. none the xrview describes a monoscopic view, or the view otherwise doesn't represent a particular eye's point-of-view. usage notes these values are used by the xrview property eye. specifications specification status comment webxr device apithe definition of 'xreye' in that specification. working draft initial definition. ...
XRFrame.getPose() - Web APIs
Web › API › XRFrame › getPose
would compare the controller's gripspace to the xrreferencespace of type viewer. syntax var xrpose = xrframe.getpose(space, basespace); parameters space an xrspace specifying the space for which to obtain an xrpose describing the item's position and orientation. basespace an xrspace to use as the base or origin for the purposes of computing the relative position and orientation. return value an xrpose object specifying the position and orientation, relative to the xrspace indicated by basespace. specifications specification status comment webxr device apithe definition of 'xrframe.getpose()' in that specification. working draft initial definition. ...
XRFrame.getViewerPose() - Web APIs
ation) relative to the specified reference space. see the getpose() method for a way to calculate a pose that represents the difference between two spaces. syntax var xrviewerpose = xrframe.getviewerpose(referencespace); parameters referencespace an xrreferencespace object specifying the space to use as the reference point or base for the computation of the viewer's current pose. return value a xrviewerpose describing the viewer's position and orientation relative to the specified reference space. exceptions invalidstateerror a domexception indicating that getviewerpose() was not called within the context of a callback to a session's xrsession.requestanimationframe(). examples in this callback function for requestanimationframe(), the xrviewerpose describing the viewer's view...
XRFrame.session - Web APIs
Web › API › XRFrame › session
an xrframe object's read-only session property returns the xrsession object that generated the frame. syntax var xrsession = xrframe.session; value a xrsession object representing the webxr session for which this xrframe describes the object positions and orientations. specifications specification status comment webxr device apithe definition of 'xrframe.session' in that specification. working draft initial definition. ...
XRFrameRequestCallback - Web APIs
to obtain the current time and the current xrframe. syntax function xrframerequestcallback(time, xrframe){ // process xrframe here } xrsession.requestanimationframe(xrframerequestcallback) parameters domhighrestimestamp a timestamp corresponding to the returned xrframe. xrframe an xrframe representing a snapshot of the state of all of the tracked objects for the xrsession. return value none. specifications specification status comment webxr device apithe definition of 'xrframerequestcallback' in that specification. working draft initial definition. ...
XRInputSource.profiles - Web APIs
the read-only xrinputsource property profiles returns an array of strings, each describing a configuration profile for the input source. the profile stings are listed in order of specificity, with the most specific profile listed first. note: the profiles list is always empty when the webxr session is in inline mode. syntax let profilelist = xrinputsource.profiles; value an array of domstring objects, each describing one configuration profile for the input device represented by the xrinputsource object. each input profile specifies the preferred visual representation and behavior of the input source. usage notes input profile names an input profile name is a string describing a visual representation and behavior the input source may be configured to use. each string: has no spac...
XRInputSourceEvent() - Web APIs
he xrinputsourceevent() constructor creates and returns a new xrinputsourceevent object describing an event (state change) which has occurred on a webxr user input device represented by an xrinputsource. syntax newinputsourceevent = new xrinputsourceevent(type, eventinitdict); parameters type a domstring indicating which of the input source events the new object will represent. permitted values are listed under event types below. eventinitdict an object based on the xrinputsourceeventinit dictionary which contains the values to assign to the new event's properties. return value a new xrinputsourceevent object representing the event described by the given type and eventinitdict. event types select sent to an xrsession when the sending input source has fully completed a prima...
XRInputSourceEvent.frame - Web APIs
the read-only xrinputsourceevent property frame specifies an xrframe object representing the event frame during which a webxr user input occurred. this may thus be an event which occurred in the past rather than a current or impending event. syntax let inputframe = xrinputsourceevent.frame; value an xrframe indicating the event frame at which the user input event described by the object took place. usage notes the event frame does not correspond to a visual frame as is delivered to the frame rendering callback function (see rendering and the webxr frame rendering callback for details on the callback). instead, the xrframe specified by the frame property is simply a method to provide access to the getpose() method, which you can use to get the relative positions of the objects in the sc...
XRInputSourceEvent.inputSource - Web APIs
the xrinputsourceevent interface's read-only inputsource property specifies the xrinputsource which generated the input event. this information lets you handle the event appropriately given the particulars of the user input device being manipulated. syntax let inputsource = xrinputsourceevent.inputsource; value an xrinputsource object identifying the source of the user input event. this event indicates an action the user has taken using a webxr input controller, such as a hand controller, motion sensing device, or other input apparatus. example the snippet below shows a handler for the select event which looks specifically for events which happen on gaze input devices. the device type is identified by looking at the xrinputsource in inputsource and its targetraymode property. xrsessio...
XRInputSourceEventInit.frame - Web APIs
cespace to the space in which the event took place. of course, as a general rule, you won't need to create xrinputsourceeventinit objects yourself. these events are generated by and sent to you by the webxr infrastructure. syntax xrinputsourceeventinit.frame = xrframe; let xrinputsourceeventinit = { frame: xrframe }; let xrinputsourceevent = new xrinputsourceevent(type, { frame: xrframe }); value an xrframe indicating the time at which the event took place, and providing a getpose() method which can be used to map reference spaces to the world reference space. usage notes the event frame does not correspond to a visual frame as is delivered to the frame rendering callback function (see rendering and the webxr frame rendering callback for details on the callback). instead, the xrframe s...
XRInputSourceEventInit.inputSource - Web APIs
eing sent. of course, as a general rule, you won't need to create xrinputsourceeventinit objects yourself. these events are generated by and sent to you by the webxr infrastructure. syntax let xrinputsourceeventinit.inputsource = xrinputsource; let xrinputsourceeventinit = { inputsource: xrinputsource }; let xrinputsourceevent = new xrinputsourceevent(type, { inputsource: xrinputsource }); value an xrinputsource object indicating the source of the newly-created xrinputsourceevent to be created. the new object's inputsource will be set to this value. examples this example creates a new select event and sends it to the xrsession. let event = new xrinputsourceevent("select", { frame: eventframe, inputsource: source }; if (event) { xrsession.dispatchevent(event); } specifications...
XRInputSourcesChangeEvent() - Web APIs
self, as these events are created and sent to you by the webxr system. syntax newinputsourceschangeevent = new xrinputsourceschangeevent(type, eventinitdict); parameters type a domstring indicating the type of event which has occurred. this string must always be inputsourceschange. eventinitdict an object conforming to the xrinputsourceschangeeventinit dictionary, prodividing the initial values for the event. return value a newly-created xrinputsourceschangeevent object configured based upon the input parameters provided. event types inputsourceschange delivered to the xrsession when the set of input devices available to it changes. example the following snippet of code creates a new xrinputsourceschangeevent object indicating that a single new input source, described by an ...
XRInputSourcesChangeEvent.added - Web APIs
examples the example below creates a handler for the inputsourceschange event that processes the lists of added and removed from the webxr system. ...
XRInputSourcesChangeEvent.removed - Web APIs
examples the example below creates a handler for the inputsourceschange event that processes the lists of added and removed from the webxr system. ...
XRInputSourcesChangeEvent.session - Web APIs
the xrinputsourceschangeevent property session specifies the xrsession to which the input source list change event applies. syntax let inputssession = xrinputsourceschangeevent.session; value an xrsession indicating the webxr session to which the input source list change applies. specifications specification status comment webxr device apithe definition of 'xrinputsourceschangeevent.session' in that specification. working draft initial definition. ...
XRInputSourcesChangeEventInit.added - Web APIs
specifications specification status comment webxr device apithe definition of 'xrinputsourceschangeeventinit.added' in that specification. working draft initial definition. ...
XRInputSourcesChangeEventInit.removed - Web APIs
specifications specification status comment webxr device apithe definition of 'xrinputsourceschangeeventinit.removed' in that specification. working draft initial definition. ...
XRInputSourcesChangeEventInit.session - Web APIs
specifications specification status comment webxr device apithe definition of 'xrinputsourceschangeeventinit.session' in that specification. working draft initial definition. ...
XRPermissionDescriptor.mode - Web APIs
y is a string taken from the xrsessionmode enumerated type, specifying which web xr session mode (inline, immersive-vr, or immersive-ar) the described permissions will be used for. syntax xrpermissiondescriptor = { mode: xrsessionmode, requiredfeatures: reqfeaturelist, optionalfeatures: optfeaturelist }; xrpermissiondescriptor.mode = xrsessionmode; xrmode = xrpermissiondescriptor.mode; value a domstring whose value is one of the strings found in the xrsessionmode enumerated type: immersive-ar the session's output will be given exclusive access to the immersive device, but the rendered content will be blended with the real-world environment. the session's environmentblendmode indicates the method to be used to blend the content together. important: the immersive-ar mode i...
XRPermissionDescriptor - Web APIs
ell as those features it would like ot use if permision is granted. the xrpermissiondescriptor's name must be set to xr in order to direct the permissions api to correctly handle the request as applying to webxr. properties in addition to inheriting the properties of the parent interface, permissiondescriptor, xrpermissiondescriptor provides the following properties. mode an xrsessionmode value indicating the xr mode (inline, immersive-vr, or immersive-ar) for which the permissions are requested. optionalfeatures an array of strings, each specifying the name of a webxr feature which is requested but not required for the app to function. the available features are the same as those used by xrsessioninit; see default features in xrsessioninit for further information. requiredfeatures ...
XRReferenceSpace.onreset - Web APIs
face's onreset event handler property can be set to a function which is called when the xrreferencespace receives a reset event, signaling that the xr device has experienced a discontinuity large enough to require that the position and/or orientation of the origin be significantly altered to compensate. syntax xrreferencespace.onreset = eventhandler; eventhandler = xrreferencespace.onreset; value an event handler function which will be called whenever the reset event is received by the xrreferencespace. usage notes see the reset event documentation for further details. specifications specification status comment webxr device apithe definition of 'onreset' in that specification. working draft initial definition. ...
XRReferenceSpace: reset event - Web APIs
rence spaces that are based on the headset's orientation. handling discontinuities you can handle jumps in the viewer's position by watching the boolean xrpose property emulatedposition. if a jump in the viewer's position coincides with emulatedposition toggling from true to false, the viewer has regained tracking, and that their new position represents a correction from the previously emulated values. this is typically the desired behavior if your site or app doesn't simulate motion through the space by expressly changing the position and/or orientation of the viewer (rather than the user's physical movements being used by the xr device to introduce movement). however, if that kind of "teleportation" is being used, you actually want to avoid jumping the user's position after tracking recove...
XRReferenceSpace - Web APIs
t all beyond their starting position, and tracking is optimized for this use case. for devices with six degrees of freedom (6dof) tracking, the local reference space tries to keep the origin stable relative to the environment. xrreferencespace local-floor similar to the local type, except the starting position is placed in a safe location for the viewer to stand, where the value of the y axis is 0 at floor level. if that floor level isn't known, the user agent will estimate the floor level. if the estimated floor level is non-zero, the browser is expected to round it such a way as to avoid fingerprinting (likely to the nearest centimeter). xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely l...
XRReferenceSpaceEvent() - Web APIs
initdict an object based on the xrreferencespaceeventinit dictionary, containing data used to initialize the new event object. the properties of this object are: referencespace the xrreferencespace from which the event originated. transform an xrrigidtransform which maps the old coordinate system (from before the changes indicated by this event) to the new coordiante system. return value a new xrreferencespaceevent object, initialized as defined by the input parameters. specifications specification status comment webxr device apithe definition of 'xrreferencespaceevent()' in that specification. working draft initial definition. ...
XRReferenceSpaceEvent.referenceSpace - Web APIs
the read-only xrreferencespaceevent property referencespace specifies the reference space which is the originator of the event. syntax let refspace = xrreferencespaceevent.referencespace; value an xrreferencespace indicating the source of the event. examples specifications specification status comment webxr device apithe definition of 'xrreferencespaceevent.referencespace' in that specification. working draft initial definition. ...
XRReferenceSpaceEvent.transform - Web APIs
nt property transform indicates the position and orientation of the affected referencespace's native origin after the changes the event represents are applied. the transform is defined using the old coordinate system, which allows it to be used to convert coordinates from the pre-event coordinate system to the post-event coordiante system. syntax let refspace = xrreferencespaceevent.transform; value an xrrigidtransform object providing a transform that can be used to convert coordinates from the pre-event coordinate system to the post-event coordinate system. usage notes upon receiving a reset event, you can apply the transform to cached position or orientation information to shift them into the updated coordinate system. alternatively, you can just discard any cached positional informati...
XRReferenceSpaceEventInit.transform - Web APIs
and orientation of the affected reference space's native origin after the changes the event represents are applied. the transform is defined using the old coordinate system, which allows it to be used to convert coordinates from the pre-event coordinate system to the post-event coordiante system. syntax let eventinitdict = { referencespace: xrreferencespace, transform: xrrigidtransform }); value an xrrigidtransform object providing a transform that can be used to convert coordinates from the pre-event coordinate system to the post-event coordinate system. examples this simple snippet calls the constructor to create a new reference space event of type reset. let refspaceevent = new xrreferencespaceevent("reset", { referencespace: myrefspace, transform: mytransform }); sp...
XRReferenceSpaceEventInit - Web APIs
the xrreferencespaceeventinit dictionary is used when calling the xrreferencespaceevent() constructor to provide the values for its properties. since the properties are read-only, this is the only opportunity available to set their values. you will not usually need to use this, since these events are created by the webxr infrastructure. properties referencespace the xrreferencespace from which the event originated. transform an xrrigidtransform which maps the old coordinate system (from before the changes indicated by this event) to the new coordiante system. usage notes all of this dictionary's properties must have valid values set on them before calling the xrreferencespaceevent() constructor. examples this simple snippet calls the constructor to create a new reference space...
XRRenderState.inlineVerticalFieldOfView - Web APIs
the inlineverticalfieldofview read-only property of the xrrenderstate interface defines the angle of the field of view in radians used when computing projection matrices for "inline" xrsession objects. this option must be null for immersive sessions. syntax var adouble = xrrenderstate.inlineverticalfieldofview; value a number. specifications specification status comment unknownthe definition of 'xrrenderstate.inlineverticalfieldofview' in that specification. unknown initial definition. ...
XRRenderState.baseLayer - Web APIs
the read-only baselayer property of the xrrenderstate interface returns the xrwebgllayer instance that is the source of bitmap images and a description of how the image is to be rendered in the device. this property is read-only; however, you can indirectly change its value using xrsession.updaterenderstate. syntax var xrwebgllayer = xrrenderstate.baselayer; value a xrwebgllayer object which is used as the source of the world's contents when rendering each frame of the scene. see the examples below to see how to use updaterenderstate() to set the current xrwebgllayer used for rendering the scene. examples you can set the xrwebgllayer used for rendering by calling updaterenderstate(), like this: let canvas = document.queryselector("canvas"); gl = canvas.getcontext("webgl", ...
XRRenderState.depthFar - Web APIs
the depthfar read-only property of the xrrenderstate interface returns the distance in meters of the far clip plane from the viewer. syntax var adouble = xrrenderstate.depthfar; value a number. specifications specification status comment unknownthe definition of 'xrrenderstate.depthfar' in that specification. unknown initial definition. ...
XRRenderState.depthNear - Web APIs
the depthnear read-only property of the xrrenderstate interface returns the distance in meters of the near clip plane from the viewer. syntax var adouble = xrrenderstate.depthnear; value a number. specifications specification status comment unknownthe definition of 'xrrenderstate.depthnear' in that specification. unknown initial definition. ...
XRRenderState.inlineVerticalFieldOfView - Web APIs
the read-only inlineverticalfieldofview property of the xrrenderstate interface returns the default vertical field of view for "inline" sessions and null for all immersive sessions. syntax var inlineverticalfieldofview = xrrenderstate.inlineverticalfieldofview; value a number for "inline" sessions, which represents the default field of view, and null for immersive sessions. specifications specification status comment webxr device apithe definition of 'xrrenderstate.inlineverticalfieldofview' in that specification. working draft initial definition. ...
XRRenderState - Web APIs
these properties include the range of distances from the viewer within which content should be rendered, the vertical field of view (for inline presentations), and a reference to the xrwebgllayer being used as the target for rendering the scene prior to it being presented on the xr device's display or displays. when you apply changes using the xrsession method updaterenderstate(), the specified changes take effect after the current animation frame has completed, but before the next one begins. ...
XRRigidTransform.inverse - Web APIs
the read-only inverse property of the xrrigidtransform interface returns another xrrigidtransform object which is the inverse of its owning transform. that is, you can always get the inverse of any xrrigidtransform using its inverse property, instead of having to explicitly generate it. syntax let transforminverse = xrrigidtransform.inverse; value an xrrigidtransform which contains the inverse of the xrrigidtransform on which it's accessed. applying the inverse of a transform to any object previously transformed by the parent xrrigidtransform always undoes the transformation, resulting in the object returning to its previous pose. in other words, its position and orientation both return to their prior configurations. examples in this example, the model view matrix for an object is compu...
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, ...
XRRigidTransform.position - Web APIs
the units are meters. note: the w component of the point is always 1.0. ...
XRSession.oninputsourceschange - Web APIs
the oninputsourcechange attribute of the xrsession object is the event handler for the inputsourcechange event, which is dispatched when session's list of active xr input sources has changed. the list itself is accessible via xrsession.inputsources. note: the xrinputsource objects in xrsession.inputsources array are "live", so values within them are updated in-place. therefore if you wish to compare input states between frames, you should make a copy of the content of the state in question. syntax xrsession.oninputsourceschange = function(event) { ... } example xrsession.oninputsourceschange = function(event) { console.log("the list of active xr input sources has changed.") } specifications specification status comment webxr device apithe def...
XRSession.onselect - Web APIs
ton or trigger, a hand gesture, or a spoken command. the select event is sent after tracking of the primary action begins, as announced by the selectstart event, and immediately before the tracking of the primary action ends, which is announced by the selectend event. to learn more about how webxr actions work, see inputs and input sources. syntax xrsession.onselect = selecthandlerfunction; value an event handler function to be invoked when the xrsession receives a select event. example this example handles select event which occur on the user's main hand (as given by a user object's handedness property); if that value matches the value of the xrinputsource property handedness, we know that the device is held in the user's main hand. xrsession.onselect = event => { let source = even...
XRSession.onsqueezestart - Web APIs
ch is then invoked to handle the squeezestart event that's sent when the user successfully begins a primary squeeze action on a webxr input device. these actions represent the user squeezing or tightly gripping an object or controller. to learn more about how to use and handle webxr controller inputs, see inputs and input sources. syntax xrsession.onsqueezestart = squeezestarthandlerfunction; value a function to be invoked whenever the xrsession receives a squeezestart event. examples this snippet of code adds a simple handler for the squeezestart event, which responds only to events on the user's dominant hand by getting the target ray, then calling a function findobjectusingray() to identify the object that the user is pointing at. this object is then stored in a heldobject variable in...
XRSession.renderState - Web APIs
dered. the information provided covers the minimum and maximum distance at which to render objects, the vertical field of view to use when rendering the in the inline session mode, and the xrwebgllayer to render into for inline composition. while this property is read only, you can call the xrsession method updaterenderstate() to make changes. syntax var xrrenderstate = xrsession.renderstate; value an xrrenderstate object describing how to render the scene. specifications specification status comment webxr device apithe definition of 'xrsession.renderstate' in that specification. working draft initial definition. ...
XRSession.requestAnimationFrame() - Web APIs
arameters: time a domhighrestimestamp indicating the time offset at which the updated viewer state was received from the webxr device. xrframe an xrframe object describing the state of the objects being tracked by the session. this can be used to obtain the poses of the viewer and the scene itself, as well as other information needed to render a frame of an ar or vr scene. return value an integer value which serves as a unique, non-zero id or handle you may pass to cancelanimationframe() if you need to remove the pending animation frame request. example the following example requests xrsession with "inline" mode so that it can be displayed in an html element (without the need for a separate ar or vr device). note: a real application should check that the device and the use...
XRSession: selectend event - Web APIs
e events is received. only after completing those tasks does the onselectionevent() function below dispatch the action out to a specialized function to handle things. after checking to ensure that the received event is a tracked-pointer event (the only kind we handle here), the target ray's pose is obtained using getpose(). if the target ray pose was fetched successfully, the code then uses the value of event property type to route control to an appropriate function to handle the event which arrived: for selectstart events, a mybegintracking() function is called with the target ray pose's matrix. the mybegintracking() function would presumably start the presentation of the object-dragging process, using the transform to perform a hit test, determining which object to pick up. mybegintracki...
XRSession: selectstart event - Web APIs
e events is received. only after completing those tasks does the onselectionevent() function below dispatch the action out to a specialized function to handle things. after checking to ensure that the received event is a tracked-pointer event (the only kind we handle here), the target ray's pose is obtained using getpose(). if the target ray pose was fetched successfully, the code then uses the value of event property type to route control to an appropriate function to handle the event which arrived: for selectstart events, a mybegintracking() function is called with the target ray pose's matrix. the mybegintracking() function would presumably start the presentation of the object-dragging process, using the transform to perform a hit test, determining which object to pick up. mybegintracki...
XRSession: squeezeend event - Web APIs
ree events is received. only after completing those tasks does the onsqueezeevent() function below dispatch the action out to a specialized function to handle things. after checking to ensure that the received event is a tracked-pointer event (the only kind we handle here), the target ray's pose is obtained using getpose(). if the target ray pose was fetched successfully, the code then uses the value of event property type to route control to an appropriate function to handle the event which arrived: for squeezestart events, a mybegintracking() function is called with the target ray pose's matrix. the mybegintracking() function would presumably start the presentation of the object-dragging process, using the transform to perform a hit test, determining which object to pick up. mybegintrack...
XRSession: squeezestart event - Web APIs
ree events is received. only after completing those tasks does the onsqueezeevent() function below dispatch the action out to a specialized function to handle things. after checking to ensure that the received event is a tracked-pointer event (the only kind we handle here), the target ray's pose is obtained using getpose(). if the target ray pose was fetched successfully, the code then uses the value of event property type to route control to an appropriate function to handle the event which arrived: for squeezestart events, a mybegintracking() function is called with the target ray pose's matrix. the mybegintracking() function would presumably start the presentation of the object-dragging process, using the transform to perform a hit test, determining which object to pick up. mybegintrack...
XRSession: visibilitychange event - Web APIs
bubbles yes cancelable no interface xrsessionevent event handler property onvisibilitychange when the xrsession receives this event, the visibility state has already been changed. ...
XRSessionEvent.session - Web APIs
examples in this example, the session property is used to obtain the session object to manage when an event is received. ...
XRSessionEventInit.session - Web APIs
the xrsessioneventinit dictionary's session property specifies the xrsession for which the event describes a state change. syntax let sessioneventinit = { session: xrsession }; mysessionevent = new xrsessionevent(type, sessioneventinit); mysessionevent = new xrsessionevent(type, { session: xrsession }); value an xrsession object indicating which webxr session the event is referring to. specifications specification status comment webxr device apithe definition of 'xrsessioneventinit.session' in that specification. working draft initial definition. ...
XRSessionEventInit - Web APIs
you're unlikely to need to create these events yourself, however, as they're created by the xr system. properties session the xrsession to which the event is to be delivered. ...
XRSessionInit - Web APIs
the webxr device api dictionary xrsessioninit specifies required and/or optional features when requesting a new xrsession by calling the navigator.xr.requestsession() method. properties the following parameters are all optional. if none are included, the device will use a default feature configuration for all options. optionalfeatures optional an array of values identifying features which the returned xrsession may optionally support. at this time, all features are identified using strings from the xrreferencespacetype enumeration, but future updates to the webxr standard may add more features. requiredfeatures optional an array of values which the returned xrsession must support. these values currently must come from the enumerated type xrreferencespacetype. more features may be add...
XRSpace - Web APIs
Web › API › XRSpace
ace of the webxr device api is an abstract interface providing a common basis for every class which represents a virtual coordinate system within the virtual world, in which its origin corresponds to a physical location. spatial data in webxr is always expressed relative to an object based upon one of the descendant interfaces of xrspace, at the time at which a given xrframe takes place. numeric values such as pose positions are thus coordinates in the corresponding xrspace, relative to that space's origin. note: the xrspace interface is never used directly; instead, all spaces are created using one of the interfaces based on xrspace. at this time, those are xrreferencespace and xrboundedreferencespace. interfaces based on xrspace below is a list of interfaces based on the xrspace interfa...
XRSystem: isSessionSupported() - Web APIs
cted with an appropriate domexception. syntax var issupportedpromise = xr.issessionsupported(xrsessionmode) parameters xrsessionmode a domstring specifying the webxr session mode for which support is to be checked. this string must be one of inline (to present the webxr content inline within the context of an html document) or immersive-vr for a fully-immersive virtual experience. return value a promise that resolves to true if the specified session mode is supported; otherwise the promise resolves to false. exceptions rather than throwing true exceptions, issessionsupported() rejects the returned promise, passing to the rejection handler a domexception whose name is one of the following strings. securityerror the document's origin does not have permission to use the xr-spatial-...
XRSystem: ondevicechange - Web APIs
the ondevicechange property of the xrsystem interface is passed a devicechange event whenever availability of an immersive device changes. the event that is fired is a "simple event" that implements the event interface. syntax navigator.xr.ondevicechange = function(event) { ... }; value undefined example navigator.xr.ondevicechange = function(ev) { console.log("the availability of immersive xr devices has changed.") }; specifications specification status comment webxr device apithe definition of 'ondevicechange ' in that specification. working draft initial definition. ...
XRView.projectionMatrix - Web APIs
tion matrix to apply to the underlying view. this should be used to integrate perspective to everything in the scene, in order to ensure the result is consistent with what the eye expects to see. important: failure to apply proper perspective, or inconsistencies in perspective, may result in possibly serious user discomfort or distress. syntax let projectionmatrix = xrview.projectionmatrix; value a float32array object representing the projection matrix for the view. the projection matrix for each eye's view is used to ensure that the correct area of the scene is presented to each eye in order to create a believable 3d scene without introducing discomfort for the user. examples specifications specification status comment webxr device apithe definition of 'xr...
XRView.transform - Web APIs
Web › API › XRView › transform
rreferencespace specified when the xrframe.getviewerpose() method was called to obtain the view object. with the transform, you can then position the view as a camera within the 3d scene. if you instead need the more traditional view matrix, you can get using view.transform.inverse.matrix; this gets the underlying matrix of the transform's inverse. syntax let viewtransform = xrview.transform; value a xrrigidtransform object specifying the position and orientation of the viewpoint represented by the xrview. examples for each view making up the presented scene, the view's transform represents the position and orientation of the viewer or camera relative to the reference space's origin. you can then use the inverse of this matrix to transform the objects in your scene to adjust their placem...
XRViewerPose.views - Web APIs
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. for each frame, you should always use the current length of this array rather than caching the value. stereo views require two views to render properly, with the left eye's view having its eye set to the string left and the right eye's view a value of right. syntax let viewlist = xrviewerpose.views; value an array of xrview objects, one for each view available as part of the scene for the current viewer pose. this array's length may potentially vary over the lifetime of the xrsession (for ...
XRViewport.height - Web APIs
Web › API › XRViewport › height
the read-only xrviewport property height specifies the height, in pixels, of the viewport onto the drawing surface within which the webxr view is to be rendered. along with width and the origin point given by x and y, this defines the area within which rendered content will be drawn. syntax height = xrviewport.height; value the viewport's height in pixels. examples see the main xrviewport page for examples. specifications specification status comment webxr device apithe definition of 'xrviewport.height' in that specification. working draft initial definition. ...
XRViewport.width - Web APIs
Web › API › XRViewport › width
the read-only xrviewport property width specifies the width of the viewport, in pixels, onto the drawing surface the 3d scene is to be rendered into. this is defined using this property along with the viewport's height and its origin given by its properties x and y. syntax width = xrviewport.width; value the viewport's width in pixels. examples see the main xrviewport page for examples. specifications specification status comment webxr device apithe definition of 'xrviewport.width' in that specification. working draft initial definition. ...
XRViewport.x - Web APIs
Web › API › XRViewport › x
the read-only xrviewport interface's x property indicates the offset from the left edge of the destination surface (typically a xrwebgllayer to the left edge of the viewport within the surface into which webxr content is to be rendered. the viewport's y property identifies the y component of the origin, and its is given by the width and height properties. syntax x = xrviewport.x; value the offset from the left edge of the rendering surface to the left edge of the viewport, in pixels. examples see the main xrviewport page for examples. specifications specification status comment webxr device apithe definition of 'xrviewport.x' in that specification. working draft initial definition. ...
XRViewport.y - Web APIs
Web › API › XRViewport › y
the read-only xrviewport interface's y property indicates the offset from the bottom edge of the destination surface (typically a xrwebgllayer to the bottom edge of the viewport within the surface into which webxr content is to be rendered. the viewport's x property identifies the x component of the origin, and its is given by the width and height properties. syntax y = xrviewport.y; value the offset from the bottom edge of the rendering surface to the bottom edge of the viewport, in pixels. note: although other web apis typically consider the y axis to begin at the top and grow larger progressing downward, webgl reverses this, with y growing larger as it goes upward on the screen. examples see the main xrviewport page for examples. specifications specification status ...
XRWebGLLayer.framebufferHeight - Web APIs
each of the framebuffer's attachments (pixel, depth, color, and/or stencil buffers, for example) are all this many pixels tall. examples this snippet simply fetches the framebuffer's width and height for later use. ...
XRWebGLLayer.framebufferWidth - Web APIs
each of the framebuffer's attachments (pixel, depth, color, and/or stencil buffers, for example) are all this many pixels wide. examples this snippet simply fetches the framebuffer's width and height for later use. ...
XRWebGLLayer.getViewport() - Web APIs
ebgl layer. for webxr devices which use a single framebuffer for both the left and right eyes, the returned viewport represents the region of the framebuffer into which the scene should be rendered for the eye represented by the view. syntax let viewport = xrwebgllayer.getviewport(view); parameters view an xrview object indicating the view for which the viewport is to be returned. return value a xrviewport object representing the viewport which will restrict drawing to the portion of the layer corresponding to the specified view. exceptions invalidstateerror either the specified view is not in an active xrframe or that xrframe and the xrwebgllayer are not part of the same webxr session. example this example demonstrates in part what the callback for the requestanimationframe()...
XSLT Basic Example - Web APIs
xample.xsl"?> <article> <title>my article</title> <authors> <author>mr. foo</author> <author>mr. bar</author> </authors> <body>this is my article text.</body> </article> xsl stylesheet (example.xsl) : <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="text"/> <xsl:template match="/"> article - <xsl:value-of select="/article/title"/> authors: <xsl:apply-templates select="/article/authors/author"/> </xsl:template> <xsl:template match="author"> - <xsl:value-of select="." /> </xsl:template> </xsl:stylesheet> browser output : article - my article authors: - mr. foo - mr. bar ...
msCaching - Web APIs
Web › API › msCaching
the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the mscaching read/write property specifies whether stream data downloaded using xmlhttprequestis cached to disk or not. this proprietary method is specific to internet explorer and microsoft edge. syntax cachestate = object.mscaching values type: domstring property value description auto disables caching for stream or ms-stream data. enabled enables caching for stream or ms-stream data. disabled disables caching for any data. see also mscachingenabled microsoft api extensions ...
msCachingEnabled - Web APIs
y change in the future. the mscachingenabled method gets the current caching state for an xmlhttprequest. this proprietary method is specific to internet explorer and microsoft edge. syntax var cachestate = xmlhttprequest.mscachingenabled(); parameters cachestate[out, retval] type = boolean. if true, xmlhttprequest is cached to disk. if false, it is not written to disk. return value type: boolean. if true, xmlhttprequest is cached to disk. if false, it is not written to disk. see also mscaching property microsoft api extensions ...
msCapsLockWarningOff - Web APIs
rite property turns automatic caps lock warning on or off for validated password input fields. this proprietary property is specific to internet explorer and microsoft edge. starting with internet explorer 10, input type=password fields will automatically display a warning if the caps lock is on. this property enables this warning to be disabled. syntax document.mscapslockwarningoff = true; value type: boolean false: default. automatic caps lock warning is turned on. true: automatic caps lock warning is turned off. example fiddle: http://jsfiddle.net/jonathansampson/mqcha/1/ example 2 <html> <head> <title>mscapslockwarningoff example</title> <script type="text/javascript"> function capsoff() { if (document.mscapslockwarningoff == false) { ...
msGetPropertyEnabled - Web APIs
e large incompatibilities between implementations and the behavior may change in the future. the msgetpropertyenabled returns whether a given property in the style object is enabled. this proprietary method is specific to internet explorer browser. syntax var retval = style.msgetpropertyenabled(name); parameters name [in] type: string the name of the property to enable. return value type: boolean if false, the property is not enabled. if true, the property is enabled. see also microsoft api extensions ...
msGetRegionContent - Web APIs
y change in the future. the msgetregioncontent returns an array of range instances corresponding to the content from the region flow that is positioned in the region. this proprietary method is specific to internet explorer browser. syntax var retval = element.msgetregioncontent(); parameters retval [out, reval] type: msrangecollection the name of the property to enable. return value type: boolean returned ranges are sorted by document position and do not overlap. if an element is not a region, this method throws a domexception with the invalidaccesserror error code. this is only available to regions that are document elements and not to regions that are pseudo-elements. see also microsoft api extensions ...
msPutPropertyEnabled - Web APIs
the msputpropertyenabled method sets whether a given property in the style object is enabled or disabled. this proprietary method is specific to internet explorer and microsoft edge. syntax var retval = style.msputpropertyenabled(propertyname, true); parameters name[in]: name of the property. (string) boolean[in]: true = enable the property. false = disable the property. return value type = hresult: if this method succeeds, it returns s_ok. otherwise, it returns an hresult error code. see also css style declaration microsoft api extensions ...
msWriteProfilerMark - Web APIs
be large incompatibilities between implementations and the behavior may change in the future. the mswriteprofilermark method writes a profiling event. this proprietary method is specific to internet explorer and microsoft edge. syntax window.mswriteprofilermark("start-render"); parameters bstrprofilermarkname[in] an event name. type = string. this parameter may be null. return value type: hresult. if this method succeeds, it returns s_ok. otherwise, it returns an hresult error code. notes mswriteprofilermark enables you to inject dom based performance markers in addition to existing javascript api to learn exactly when parts of the page are being rendered, building a waterfall view for every one of our impressions showing latency per object, which can be useful for more a...
Using the aria-describedby attribute - Accessibility
e is not used only for form elements; it is also used to associate static text with widgets, groups of elements, panes, regions that have a heading, definitions, and more. the examples section below provides more information about how to use the attribute in these cases. this attribute can be used with any typical html form element; it is not limited to elements that have an aria role assigned. value a space-separated list of element ids possible effects on user agents and assistive technology note: opinions may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples example 1: application landmark descriptions in the example below, an introductory paragraph describes a calendar app...
Using the aria-hidden attribute - Accessibility
nology cannot be used on a focusable element cannot be used on the parent of an interactive element despite these similarities, the intent behind each attribute is different. aria-hidden="true" will remove the entire element from the accessibility api. role="presentation" and role="none" will remove the semantic meaning of an element while still exposing it to assistive technology. values false (default) the element is exposed to the accessibility api. true the element is not exposed to the accessibility api. undefined (default) the user agent determines if the element is exposed to or hidden from the accessibility api. examples in the example below, the paragraph is not exposed to the accessibility api (e.g. would not be read aloud by a screen reader). <p aria-hidde...
Using the aria-label attribute - Accessibility
the aria-label attribute is used to define a string that labels the current element. use it in cases where a text label is not visible on the screen. if there is visible text labeling the element, use aria-labelledby instead. this attribute can be used with any typical html element; it is not limited to elements that have an aria role assigned. value string possible effects on user agents and assistive technology note: opinions may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples example 1: multiple labels in the example below, a button is styled to look like a typical "close" button, with an x in the middle. since there is nothing indicating that the purpose of the...
Using the aria-required attribute - Accessibility
description the aria-required attribute is used to indicate that user input is required on an element before a form can be submitted. this attribute can be used with any typical html form element; it is not limited to elements that have an aria role assigned. html5 now has the required attribute, but aria-required is still useful for user agents that do not yet support html5. value true or false (default: false) possible effects on user agents and assistive technology screen readers should announce the field as required. note that this attribute will not automatically change the presentation of the field. note: opinions may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. exa...
x-ms-aria-flowfrom - Accessibility
of the previous element in an alternative reading order, allowing assistive technology to override the general default of reading in document source order. the property serves to define element relationships utilizing aria relationship attributes and the aria-flowto property. this proprietary property is specific to internet explorer and microsoft edge. syntax x-ms-aria-flowfrom="elementid"; value the x-ms-aria-flowfrom property value uses an id selector to define which previous element the reading order will flow from. example <div tabindex="0" class="foo" id="element2" role="option" aria-posinset="1" aria-setsize="15" aria-flowto="element8" x-ms-aria-flowfrom="element5"> see also aria relationship attributes microsoft api extensions ...
Using ARIA: Roles, states, and properties - Accessibility
oles alertdialog dialog states and properties widget attributes aria-autocomplete aria-checked aria-current aria-disabled aria-errormessage aria-expanded aria-haspopup aria-hidden aria-invalid aria-label aria-level aria-modal aria-multiline aria-multiselectable aria-orientation aria-placeholder aria-pressed aria-readonly aria-required aria-selected aria-sort aria-valuemax aria-valuemin aria-valuenow aria-valuetext live region attributes aria-live aria-relevant aria-atomic aria-busy drag & drop attributes aria-dropeffect aria-dragged relationship attributes aria-activedescendant aria-colcount aria-colindex aria-colspan aria-controls aria-describedby aria-details aria-errormessage aria-flowto aria-labelledby aria-owns aria-p...
ARIA: alert role - Accessibility
would immediately read out the message. it should not be used on html where the user hasn't interacted with it. for example, if a page loads with multiple visible alerts scattered throughout, none would be read because they are not dynamically triggered. examples the most basic way to trigger an alert is by adding role="alert" to an element that has display: none; by default. when the display value is changed with css or javascript, it would automatically trigger the screen reader to read out the content. <p role="alert" style="display: none;">the alert will trigger when the element becomes visible.</p> while triggering an alert via css alone is possible, it is better to rely on javascript because it has more browser/screen reader support and is often more appropriate as part of a larger ...
ARIA: application role - Accessibility
eys, as well as escape , must be handled by the application. the one exception is if focus is set to a standard widget inside the application that supports keyboard navigation from the browser, for example an input element. required javascript features keypress used to handle keyboard input and control the focus click, touch handle as appropriate for your widget as well changing attribute values aria-activedescendant is used to manage the focus inside the application container. set in response to keyboard or other application events that change focus or point of interaction. the application role does not have a related html widget and thus is completely free form. the author of the application must take full responsibility for not letting users get stuck in a focus limbo or trap foc...
ARIA: article role - Accessibility
ion of this particular article within that feed, based on a count starting at 1. aria-setsize in the context of a feed, indicates how many article items there are within that feed. keyboard interactions this role does not support any specific keyboard interaction. required javascript features event handlers this role does not require any event handlers to be present. changing attribute values when constructing a feed, set the aria-posinset and aria-setsize attributes on each article role to the appropriate values, bearing in mind that aria-posinset is 1-based. always use native element if available. instead of a div with the article role, the <article> element should be used. examples the restaurant recommendations feed display along with its separate documentation from the ...
ARIA: Comment role - Accessibility
multiple comments since aria-details can now accept multiple ids, we can associate multiple comments with the same annotation, like so: <p>the last half of the song is a slow-rising crescendo that peaks at the <mark aria-details="thread-1 thread-2">end of the guitar solo</mark>, before fading away sharply.</p> <div role="comment" id="thread-1" data-au...
ARIA: feed role - Accessibility
ould be contained in an <article> or element with role article. each article should have an aria-labelledby referring to the article title or other child that can serve as a distinguishing label. each article should preferably have aria-describedby referring to one or more elements inside the article that serve as the primary content of the article. each article element has aria-posinset set to a value that represents its position in the feed and an aria-setsize set to a value that represents either the total number of articles that have been loaded or the total number in the feed, depending on which value is more helpful to users. if the total number in the feed is not known, set aria-setsize="-1". required javascript features none, except as required by any attributes. for example, setti...
ARIA: figure role - Accessibility
igure> and <figcaption>. see best practices for a full example. associated wai-aria roles, states, and properties aria-describedby the id of an element containing reference text serving as a caption. aria-labelledby the id of an element containing text serving as a label. aria-label if there is no element containing text that could serve as a label, you can add the label directly as a value on the aria-label on the element with the figure role or on the <figure> element. keyboard interactions no role specific keyboard interactions. required javascript features no role specific javascript requirements. if you don't have control over the html semantics, you can improve the accessibility of html by adding these roles and properties with javascript. examples we could extend the i...
ARIA: grid role - Accessibility
(subclass) if a grid has columns that can expanded or collapsed, a treegrid can be used. row a row inside the grid. rowgroup a group containing one or multiple rows. states and properties aria-level indicates the hierarchical level of the grid within other structures. aria-multiselectable if aria-multiselectable is set to true, multiple items in the grid can be selected. the default value is false. aria-readonly if the user can navigate the grid but not change the value or values of the grid, the aria-readonly should be set to true. the default value is false. for many use cases, an html table element is sufficient as it and its elements already include many aria roles. keyboard interactions when a keyboard user encounters a grid, they navigate the rows and columns using t...
ARIA: Mark role - Accessibility
ent-text">i really think this moment could use more cowbell.</p> <p><time datetime="2019-03-30t19:29">march 30 2019, 19:29</time></p> </div> the related comment is marked up using an html structure wrapped with a <div> containing role="comment". to associate the comment with the text being commented, we need to wrap the commented text with an element containing the aria-details attribute, the value of which should be the id of the comment. accessibility concerns landmark roles are intended to be used sparingly, to identify larger overall sections of the document. using too many landmark roles can create "noise" in screen readers, making it difficult to understand the overall layout of the page. best practices prefer html using the <mark> element will automatically communicate a section...
ARIA: Region role - Accessibility
rom the main content of the document. using the <section> element will automatically communicate a section has a role of region if it is given an accessible name. developers should always prefer using the correct semantic html element, in this case <section>, over using aria. associated wai-aria roles, states, and properties aria-labelledby use this attribute to label the region. often, the value of the aria-labelledby attribute will be the id of the element used to title the section. keyboard interactions none. required javascript features none. examples <div role="region" aria-labelledby="region-heading"> <h2 id="region-heading">this heading's <code>id</code> attribute helps this region have an accessible name</h2> <!-- region content --> </div> accessibility concerns use ...
ARIA: search role - Accessibility
arch form, use the search role instead of form. if a document includes more than one search, each should have a unique label. while there is a input of type search, there is html element that defines a search landmark. examples <form id="search" role="search"> <label for="search-input">search this site</label> <input type="search" id="search-input" name="search" spellcheck="false"> <input value="submit" type="submit"> </form> accessibility concerns landmark roles are intended to be used sparingly, to identify larger overall sections of the document. using too many landmark roles can create "noise" in screen readers, making it difficult to understand the overall layout of the page. best practices prefer html using the <form> element in conjunction with a declaration of role="search...
Multipart labels: Using ARIA for labels with embedded fields inside them - Accessibility
y get better accessibility from the new attribute, but the users of older browsers are not left in the dark this way. example: shut down computer after minutes <input aria-labelledby="labelshutdown shutdowntime shutdownunit" type="checkbox" /> <span id="labelshutdown">shut down computer after</span> <input aria-labelledby="labelshutdown shutdowntime shutdownunit" id="shutdowntime" type="text" value="10" /> <span id="shutdownunit"> minutes</span> a note for jaws 8 users jaws 8.0 has its own logic to find labels, causing it to always override the accessiblename the textbox of an html document gets. with jaws 8, i have not found a way to make it to accept the label from the example above. but nvda and window-eyes do it just fine, and orca on linux also has no problems. tbd: add more compat...
Accessibility: What users can do to browse more safely - Accessibility
hese settings. use reader mode on browsers enable content blockers; gets rid of ads, reduces and/or removes distractions enables text-to-speech in certain browsers, enable fonts by choice enable page zoom turn off animated gifs in the browser browsers offer much power to their users; it's just a matter of knowing where to go. using firefox as an example, it explains that by changing the value the image.animation_mode from "normal" to "none", all animated images will be blocked. to reverse it, you will have to change the value back to "normal" use browser extensions gif blocker for chrome, gif blocker is an extension available at the web store. gif scrubber gif scrubber is a chrome extension that allows you to control gifs like a video player. there is a github repository for it...
An overview of accessible web applications and widgets - Accessibility
es and properties.) developers should use aria states to indicate the state of ui widget elements and use css attribute selectors to alter the visual appearance based on the state changes (rather than using script to change a class name on the element). visibility changes when content visibility is changed (i.e., an element is hidden or shown), developers should change the aria-hidden property value. the techniques described above should be used to declare css to visually hide an element using display:none. here is an example of a tooltip that uses aria-hidden to control the visibility of the tooltip. the example shows a simple web form with tooltips containing instructions associated with the entry fields. in this example, the html for the tooltip has the form shown in example 2a. line 9...
Architecture - Accessibility
the delete key and see if it removes the first char of the next line. therefore, as the user arrows up and down, if you use the accessibletext::caretoffset and retrieve the line with that offset, you may not get the line with the visual caret returned. you are getting the line starting with the logical caret offset, which may be the next line. to get around this problem, mozilla allows the magic value of -2 to be passed into accessibletext/accessiblehypertext methods that take a character offset. this value of -2 means, use the caret position. not only can this save extra calls, but it will always return the visual line of text when used with the gettext methods and line boundaries. the following magic offsets are useful to define in your code: #define char_offset_end_of_line = -1 #define...
Cognitive accessibility - Accessibility
users need to be alerted to the error and informed of what is wrong. if there is client side error detection, observe the following guidelines to make the error as effective as possible when conveyed to the user: the error must be described in the text. ensure that the error message is as specific as possible. provide text to identify incomplete required fields and text descriptions if a value entered is invalid. if the error prevented a form submission, focus on the error. if multiple errors are present, provide a summary, with each error linking to the related input. include text along with use of icons, images, color and so on. some people have difficulty understanding the meaning of icons and other visual cues. other people may have difficulty understanding the text version of ...
Robust - Accessibility
to the criteria practical resource 4.1.1 parsing (a) content should be well-formed so it can be parsed successfully by browsers and other user agents such as screenreaders. to pass this criterion, make sure that your html is as valid as possible. use the w3c validator to validate your markup. see debugging html for a practical guide. 4.1.2 name, role, value (a) the name and role of user interface components (e.g. form inputs, buttons, links, etc.) should be programmatically determinable. when using semantic elements correctly for their intended purpose, this criterion should be passed automatically. when scripting custom components, you will need to use wai-aria roles and other features to make sure your controls will be interpreted and...
Understandable - Accessibility
how to conform to the criteria practical resource 3.1.1 language of page (a) the default human language of each web page should be detectable via code. this is essential for purposes like making sure the reader has arrived at a page written in a language suitable for them. the simplest way to achieve this is to set the lang attribute on the page's <html> element, giving it a value equal to the language code that best represents the language the page is written in. see setting the primary language of the document. 3.1.2 language of parts (aa) in cases where the content of a page includes words or phrases that are in a different language to the primary language, use the lang attribute on an element wrapped around the term in question (e.g. a <span> if no ...
-webkit-text-security - CSS: Cascading Style Sheets
-webkit-text-security is a non-standard css property that obfuscates characters in a <form> field (such as <input> or <textarea>) by replacing them with a shape. it only affects fields that are not of type=password. syntax -webkit-text-security: circle; -webkit-text-security: disc; -webkit-text-security: square; -webkit-text-security: none; formal definition value not found in db! formal syntax syntax not found in db! examples obscuring a text input try typing in the field below. if your browser supports this property, the characters should be visually replaced with squares. html <label for="name">name:</label> <input type="text" name="name" id="name" /> css input { -webkit-text-security: square; } result specifications not part of any standard. ...
:-webkit-autofill - CSS: Cascading Style Sheets
the :-webkit-autofill css pseudo-class matches when an <input> element has its value autofilled by the browser. note: the user agent style sheets of many browsers use !important in their :-webkit-autofill style declarations, making them non-overrideable by webpages without resorting to javascript hacks. syntax :-webkit-autofill specifications not part of any standard. ...
::-moz-color-swatch - CSS: Cascading Style Sheets
the ::-moz-color-swatch css pseudo-element is a mozilla extension that represents the color selected in an <input> of type="color". note: using ::-moz-color-swatch with anything but an <input type="color"> doesn't match anything and has no effect. syntax syntax not found in db! examples html <input type="color" value="#de2020" /> css input[type=color]::-moz-color-swatch { border-radius: 10px; border-style: none; } result specifications not part of any standard. ...
::-moz-focus-inner - CSS: Cascading Style Sheets
the ::-moz-focus-inner css pseudo-element is a mozilla extension that represents an inner focus ring of the <button> element as well as the button, submit, reset, and color types of the <input> element. note: using ::-moz-focus-inner with anything than the buttons that support it doesn't match anything and has no effect. ...
::-moz-progress-bar - CSS: Cascading Style Sheets
the ::-moz-progress-bar css pseudo-element is a mozilla extension that represents the progress bar inside a <progress> element. (the bar represents the amount of progress that has been made.) if you want to select the unfinished part of <progress> in mozilla, please select the <progress> directly. syntax ::-moz-progress-bar examples html <progress value="30" max="100">30%</progress> <progress max="100">indeterminate</progress> css ::-moz-progress-bar { background-color: red; } /* force indeterminate bars to have zero width */ :indeterminate::-moz-progress-bar { width: 0; } result specifications not part of any standard. ...
::-moz-range-progress - CSS: Cascading Style Sheets
the ::-moz-range-progress css pseudo-element is a mozilla extension that represents the lower portion of the track (i.e., groove) in which the indicator slides in an <input> of type="range". this portion corresponds to values lower than the value currently selected by the thumb (i.e., virtual knob). note: using ::-moz-range-progress with anything but an <input type="range"> doesn't match anything and has no effect. syntax ::-moz-range-progress examples html <input type="range" min="0" max="100" step="5" value="50"/> css input[type=range]::-moz-range-progress { background-color: green; height: 1em; } result a progress bar using this style might look something like this: specifications not part of any standard. ...
::-moz-range-thumb - CSS: Cascading Style Sheets
the ::-moz-range-thumb css pseudo-element is a mozilla extension that represents the thumb (i.e., virtual knob) of an <input> of type="range". the user can move the thumb along the input's track to alter its numerical value. note: using ::-moz-range-thumb with anything but an <input type="range"> doesn't match anything and has no effect. syntax ::-moz-range-thumb examples html <input type="range" min="0" max="100" step="5" value="50"/> css input[type=range]::-moz-range-thumb { background-color: green; } result a progress bar using this style might look something like this: specifications not part of any standard. ...
::-moz-range-track - CSS: Cascading Style Sheets
the ::-moz-range-track css pseudo-element is a mozilla extension that represents the track (i.e., groove) in which the indicator slides in an <input> of type="range". note: using ::-moz-range-track with anything but an <input type="range"> doesn't match anything and has no effect. syntax ::-moz-range-track examples html <input type="range" min="0" max="100" step="5" value="50"/> css input[type=range]::-moz-range-track { background-color: green; } result a progress bar using this style might look something like this: specifications not part of any standard. ...
::-webkit-meter-bar - CSS: Cascading Style Sheets
the ::-webkit-meter-bar css pseudo-class is a webkit extension that represents the meter bar in a <meter> element. syntax ::-webkit-meter-bar specifications not part of any standard. ...
::-webkit-meter-inner-element - CSS: Cascading Style Sheets
element for selecting and applying styles to to the outer containing element of a <meter> element. additional markup to render the meter element as read-only. syntax ::-webkit-meter-inner-element specifications not part of any standard. ...
::-webkit-search-cancel-button - CSS: Cascading Style Sheets
the ::-webkit-search-cancel-button css pseudo-element represents a button (the "cancel button") at the edge of an <input> of type="search" which clears away the current value of the <input> element. this button and pseudo-element are non-standard, supported only in webkit and blink, hence the vendor prefix. the clear button is only shown on non-empty search <input> elements. syntax selector::-webkit-search-cancel-button specifications not part of any standard. ...
::-webkit-slider-thumb - CSS: Cascading Style Sheets
syntax ::-webkit-slider-thumb specifications not part of any standard. ...
::before (:before) - CSS: Cascading Style Sheets
Web › CSS › ::before
k', function(ev) { if (ev.target.tagname === 'li') { ev.target.classlist.toggle('done'); } }, false); here is the above code example running live. note that there are no icons used, and the check-mark is actually the ::before that has been styled in css. go ahead and get some stuff done. result special characters as this is css; not html, you can not use markup entities in content values. if you need to use a special character, and can not enter it literally into your css content string, use a unicode escape sequence, consisting of a backslash followed by the hexadecimal unicode value. html <ol> <li>crack eggs into bowl</li> <li>add milk</li> <li>add flour</li> <li aria-current='step'>mix thoroughly into a smooth batter</li> <li>pour a ladleful of batter onto a hot, ...
::placeholder - CSS: Cascading Style Sheets
d the background of the input is high enough that people experiencing low vision conditions will be able to read it while also making sure there is enough of a difference between the placeholder text and input text color that users do not mistake the placeholder for inputed data. color contrast ratio is determined by comparing the luminosity of the placeholder text and the input background color values. in order to meet current web content accessibility guidelines (wcag), a ratio of 4.5:1 is required for text content and 3:1 for larger text such as headings. large text is defined as 18.66px and bold or larger, or 24px or larger. webaim: color contrast checker mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.3 | w3c understanding wcag 2.0 usability ...
::slotted() - CSS: Cascading Style Sheets
Web › CSS › ::slotted
ompound-selector> = [ <type-selector>? <subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!where <type-selector> = <wq-name> | <ns-prefix>? '*'<subclass-selector> = <id-selector> | <class-selector> | <attribute-selector> | <pseudo-class-selector><pseudo-element-selector> = ':' <pseudo-class-selector><pseudo-class-selector> = ':' <ident-token> | ':' <function-token> <any-value> ')'where <wq-name> = <ns-prefix>? <ident-token><ns-prefix> = [ <ident-token> | '*' ]? | <id-selector> = <hash-token><class-selector> = '.' <ident-token><attribute-selector> = '[' <wq-name> ']' | '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'where <attr-matcher> = [ '~' | | | '^' | '$' | '*' ]? '='<attr-modifier> = i | s examples highlighting slotted ele...
:empty - CSS: Cascading Style Sheets
Web › CSS › :empty
. --></p> </div> css body { display: flex; justify-content: space-around; } .box { background: pink; height: 80px; width: 80px; } .box:empty { background: lime; } result accessibility concerns assistive technology such as screen readers cannot parse interactive content that is empty. all interactive content must have an accessible name, which is created by providing a text value for the interactive control's parent element (anchors, buttons, etc.). accessible names expose the interactive control to the accessibility tree, an api that communicates information useful for assistive technologies. the text that provides the interactive control's accessible name can be hidden using a combination of properties that remove it visually from the screen but keep it parseable by as...
:focus - CSS: Cascading Style Sheets
Web › CSS › :focus
cus. it is generally triggered when the user clicks or taps on an element or selects it with the keyboard's tab key. /* selects any <input> when focused */ input:focus { color: red; } note: this pseudo-class applies only to the focused element itself. use :focus-within if you want to select an element that contains a focused element. syntax :focus examples html <input class="red-input" value="i'll be red when focused."><br> <input class="blue-input" value="i'll be blue when focused."> css .red-input:focus { background: yellow; color: red; } .blue-input:focus { background: yellow; color: blue; } result accessibility concerns make sure the visual focus indicator can be seen by people with low vision. this will also benefit anyone use a screen in a brightly lit space (l...
:has() - CSS: Cascading Style Sheets
Web › CSS › :has
ompound-selector> = [ <type-selector>? <subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!where <type-selector> = <wq-name> | <ns-prefix>? '*'<subclass-selector> = <id-selector> | <class-selector> | <attribute-selector> | <pseudo-class-selector><pseudo-element-selector> = ':' <pseudo-class-selector><pseudo-class-selector> = ':' <ident-token> | ':' <function-token> <any-value> ')'where <wq-name> = <ns-prefix>? <ident-token><ns-prefix> = [ <ident-token> | '*' ]? | <id-selector> = <hash-token><class-selector> = '.' <ident-token><attribute-selector> = '[' <wq-name> ']' | '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'where <attr-matcher> = [ '~' | | | '^' | '$' | '*' ]? '='<attr-modifier> = i | s description the :has() pseudo-cla...
:host() - CSS: Cascading Style Sheets
Web › CSS › :host()
ompound-selector> = [ <type-selector>? <subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!where <type-selector> = <wq-name> | <ns-prefix>? '*'<subclass-selector> = <id-selector> | <class-selector> | <attribute-selector> | <pseudo-class-selector><pseudo-element-selector> = ':' <pseudo-class-selector><pseudo-class-selector> = ':' <ident-token> | ':' <function-token> <any-value> ')'where <wq-name> = <ns-prefix>? <ident-token><ns-prefix> = [ <ident-token> | '*' ]? | <id-selector> = <hash-token><class-selector> = '.' <ident-token><attribute-selector> = '[' <wq-name> ']' | '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'where <attr-matcher> = [ '~' | | | '^' | '$' | '*' ]? '='<attr-modifier> = i | s examples selectively styling shad...
:host-context() - CSS: Cascading Style Sheets
ompound-selector> = [ <type-selector>? <subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!where <type-selector> = <wq-name> | <ns-prefix>? '*'<subclass-selector> = <id-selector> | <class-selector> | <attribute-selector> | <pseudo-class-selector><pseudo-element-selector> = ':' <pseudo-class-selector><pseudo-class-selector> = ':' <ident-token> | ':' <function-token> <any-value> ')'where <wq-name> = <ns-prefix>? <ident-token><ns-prefix> = [ <ident-token> | '*' ]? | <id-selector> = <hash-token><class-selector> = '.' <ident-token><attribute-selector> = '[' <wq-name> ']' | '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'where <attr-matcher> = [ '~' | | | '^' | '$' | '*' ]? '='<attr-modifier> = i | s examples selectively styling shad...
:indeterminate - CSS: Cascading Style Sheets
f a group in which all radio buttons are unchecked, and indeterminate <progress> elements. /* selects any <input> whose state is indeterminate */ input:indeterminate { background: lime; } elements targeted by this selector are: <input type="checkbox"> elements whose indeterminate property is set to true by javascript <input type="radio"> elements, when all radio buttons with the same name value in the form are unchecked <progress> elements in an indeterminate state syntax :indeterminate examples checkbox & radio button this example applies special styles to the labels associated with indeterminate 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...
:invalid - CSS: Cascading Style Sheets
Web › CSS › :invalid
ning. typically, descriptive text and/or an icon are used. mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.1 | w3c understanding wcag 2.0 notes radio buttons if any one of the radio buttons in a group is required, the :invalid pseudo-class is applied to all of them if none of the buttons in the group is selected. (grouped radio buttons share the same value for their name attribute.) gecko defaults by default, gecko does not apply a style to the :invalid pseudo-class. however, it does apply a style (a red "glow" using the box-shadow property) to the :-moz-ui-invalid pseudo-class, which applies in a subset of cases for :invalid. specifications specification status comment html living standardthe definition of ':invalid...
:lang() - CSS: Cascading Style Sheets
Web › CSS › :lang
l, the language is determined by a combination of the lang attribute, the <meta> element, and possibly by information from the protocol (such as http headers). for other document types there may be other document methods for determining the language. syntax formal syntax :lang( <language-code> ) parameter <language-code> a <string> representing the language you want to target. acceptable values are specified in the html spec. examples in this example, the :lang() pseudo-class is used to match the parents of quote elements (<q>) using child combinators. note that this doesn't illustrate the only way to do this, and that the best method to use depends on the type of document. also note that unicode values are used to specify some of the special quote characters. html <div lang="en">...
:link - CSS: Cascading Style Sheets
Web › CSS › :link
ass (:active, :hover, or :visited) that has at least equal specificity. to style links appropriately, put the :link rule before all other link-related rules, as defined by the lvha-order: :link — :visited — :hover — :active. note: use :any-link to select an element independent of whether it has been visited or not. syntax :link examples by default, most browsers apply a special color value to visited links. thus, the links in this example will probably have special font colors only before you visit them. (after that, you'll need to clear your browser history to see them again.) however, the background-color values are likely to remain, as most browsers do not set that property on visited links by default. html <a href="#ordinary-target">this is an ordinary link.</a><br> <a href="...
:not() - CSS: Cascading Style Sheets
Web › CSS › :not
subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!<combinator> = '>' | '+' | '~' | [ '|' ]where <type-selector> = <wq-name> | <ns-prefix>? '*'<subclass-selector> = <id-selector> | <class-selector> | <attribute-selector> | <pseudo-class-selector><pseudo-element-selector> = ':' <pseudo-class-selector><pseudo-class-selector> = ':' <ident-token> | ':' <function-token> <any-value> ')'where <wq-name> = <ns-prefix>? <ident-token><ns-prefix> = [ <ident-token> | '*' ]? | <id-selector> = <hash-token><class-selector> = '.' <ident-token><attribute-selector> = '[' <wq-name> ']' | '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'where <attr-matcher> = [ '~' | | | '^' | '$' | '*' ]? '='<attr-modifier> = i | s description there are several unu...
:where() - CSS: Cascading Style Sheets
Web › CSS › :where
subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!<combinator> = '>' | '+' | '~' | [ '|' ]where <type-selector> = <wq-name> | <ns-prefix>? '*'<subclass-selector> = <id-selector> | <class-selector> | <attribute-selector> | <pseudo-class-selector><pseudo-element-selector> = ':' <pseudo-class-selector><pseudo-class-selector> = ':' <ident-token> | ':' <function-token> <any-value> ')'where <wq-name> = <ns-prefix>? <ident-token><ns-prefix> = [ <ident-token> | '*' ]? | <id-selector> = <hash-token><class-selector> = '.' <ident-token><attribute-selector> = '[' <wq-name> ']' | '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'where <attr-matcher> = [ '~' | | | '^' | '$' | '*' ]? '='<attr-modifier> = i | s specifications specifica...
@charset - CSS: Cascading Style Sheets
Web › CSS › @charset
element or inside the <style> element where the character set of the html page is relevant. @charset "utf-8"; this at-rule is useful when using non-ascii characters in some css properties, like content. as there are several ways to define the character encoding of a style sheet, the browser will try the following methods in the following order (and stop as soon as one yields a result) : the value of the unicode byte-order character placed at the beginning of the file. the value given by the charset attribute of the content-type: http header or the equivalent in the protocol used to serve the style sheet. the @charset css at-rule. use the character encoding defined by the referring document: the charset attribute of the <link> element. this method is obsoleted in html5 and must not be u...
font-family - CSS: Cascading Style Sheets
the font-family css descriptor allows authors to specify the font family for the font specified in an @font-face rule. syntax /* <string> values */ font-family: "font family"; font-family: 'another font family'; /* <custom-ident> value */ font-family: examplefont; values <family-name> specifies the name of the font family. formal definition related at-rule@font-faceinitial valuen/a (required)computed valueas specified formal syntax <family-name>where <family-name> = <string> | <custom-ident>+ examples setting the font family name @font-face { font-family: examplefont; src: url('examplefont.ttf'); } specifications specification status comment css fonts module level 3the definition of 'font-family' in that specification. candidate recommenda...
@import - CSS: Cascading Style Sheets
Web › CSS › @import
r> = <media-not> | <media-and> | <media-in-parens>where <media-not> = not <media-in-parens><media-and> = <media-in-parens> [ and <media-in-parens> ]+<media-or> = <media-in-parens> [ or <media-in-parens> ]+<media-in-parens> = ( <media-condition> ) | <media-feature> | <general-enclosed>where <media-feature> = ( [ <mf-plain> | <mf-boolean> | <mf-range> ] )<general-enclosed> = [ <function-token> <any-value> ) ] | ( <ident> <any-value> )where <mf-plain> = <mf-name> : <mf-value><mf-boolean> = <mf-name><mf-range> = <mf-name> [ '<' | '>' ]? '='? <mf-value> | <mf-value> [ '<' | '>' ]? '='? <mf-name> | <mf-value> '<' '='? <mf-name> '<' '='? <mf-value> | <mf-value> '>' '='? <mf-name> '>' '='? <mf-value>where <mf-name> = <ident><mf-value> = <number> | <dimension> | <ident> | <ratio> examples importing cs...
-webkit-device-pixel-ratio - CSS: Cascading Style Sheets
the -webkit-device-pixel-ratio is a non-standard boolean css media feature which is an alternative to the standard resolution media feature. note: this media feature is a webkit feature. if possible, use the resolution media feature query instead. syntax the -webkit-device-pixel-ratio feature is specified as a <number> value. it is a range feature, meaning that you can also use the prefixed -webkit-min-device-pixel-ratio and -webkit-max-device-pixel-ratio variants to query minimum and maximum values, respectively. values <number> the number of device pixels used to represent each css px. although the value is a <number>, and thus doesn't syntactically allow units, its implicit unit is dppx. implementation /* a unit of "dppx" is implied: */ @media (-webkit-min-device-pixe...
-webkit-transition - CSS: Cascading Style Sheets
it was never supported in browsers not based on webkit or blink. apple has a description in safari css reference; this is now called simply transition there. note: you should not use this media feature; it was never specified, has never been widely implemented, and has been removed from all browsers. use an @supports feature query instead. syntax @media (-webkit-transition) { /* css to use if transitions are supported */ } examples use @supports instead do not use the -webkit-transition media feature. ...
any-hover - CSS: Cascading Style Sheets
Web › CSS › @media › any-hover
none none of the available input mechanism(s) can hover conveniently, or there is no pointing input mechanism. hover one or more available input mechanisms can conveniently hover over elements. ...
any-pointer - CSS: Cascading Style Sheets
the any-pointer css media feature tests whether the user has any pointing device (such as a mouse), and if so, how accurate it is. note: if you want to test the accuracy of the primary pointing device, use pointer instead. syntax the any-pointer feature is specified as a keyword value chosen from the list below. none no pointing device is available. coarse at least one input mechanism includes a pointing device of limited accuracy. fine at least one input mechanism includes an accurate pointing device. note: more than one value can match if the available devices have different characteristics, although none only matches when none of them are pointing devices. examples this example creates a small checkbox for users with at least one fine pointer and a large checkbox for user...
color-gamut - CSS: Cascading Style Sheets
srgb the output device can support approximately the srgb gamut or more. this includes the vast majority of color displays. p3 the output device can support approximately the gamut specified by the dci p3 color space or more. the p3 gamut is larger than and includes the srgb gamut. ...
device-aspect-ratio - CSS: Cascading Style Sheets
the device-aspect-ratio css media feature can be used to test the width-to-height aspect ratio of an output device. syntax the device-aspect-ratio feature is specified as a <ratio>. it is a range feature, meaning that you can also use the prefixed min-device-aspect-ratio and max-device-aspect-ratio variants to query minimum and maximum values, respectively. examples article { padding: 1rem; } @media screen and (min-device-aspect-ratio: 16/9) { article { padding: 1rem 5vw; } } specifications specification status comment media queries level 4the definition of 'device-aspect-ratio' in that specification. candidate recommendation deprecated in media queries level 4. media queriesthe definition of 'device-aspect-ratio' in that specificat...
display-mode - CSS: Cascading Style Sheets
to provide a consistent user experience between launching a site from a url and launching it from a desktop icon. this feature corresponds to the web app manifest's display member. both apply to the top-level browsing context and any child browsing contexts. the feature query applies regardless of whether a web app manifest is present. syntax the display-mode feature is specified as a keyword value chosen from the list below. display mode description fallback display mode fullscreen all of the available display area is used and no user agent chrome is shown. standalone standalone the application will look and feel like a standalone application. this can include the application having a different window, its own icon in the application launcher,...
grid - CSS: Cascading Style Sheets
Web › CSS › @media › grid
examples html <p class="unknown">i don't know if you're using a grid device. ...
hover - CSS: Cascading Style Sheets
Web › CSS › @media › hover
none the primary input mechanism cannot hover at all or cannot conveniently hover (e.g., many mobile devices emulate hovering when the user performs an inconvenient long tap), or there is no primary pointing input mechanism. hover the primary input mechanism can conveniently hover over elements. ...
inverted-colors - CSS: Cascading Style Sheets
none colors are displayed normally. inverted all pixels within the displayed area have been inverted. examples html <p>if you're using inverted colors, this text should be blue on white (the inverse of yellow on black). ...
orientation - CSS: Cascading Style Sheets
sed to test the orientation of the viewport (or the page box, for paged media). note: this feature does not correspond to device orientation. opening the soft keyboard on many devices in portrait orientation will cause the viewport to become wider than it is tall, thereby causing the browser to use landscape styles instead of portrait. syntax the orientation feature is specified as a keyword value chosen from the list below. keyword values portrait the viewport is in a portrait orientation, i.e., the height is greater than or equal to the width. landscape the viewport is in a landscape orientation, i.e., the width is greater than the height. examples html <div>box 1</div> <div>box 2</div> <div>box 3</div> css body { display: flex; } div { background: yellow; } @media (...
overflow-block - CSS: Cascading Style Sheets
none content that overflows the block axis is not displayed. scroll content that overflows the block axis can be seen by scrolling to it. ...
overflow-inline - CSS: Cascading Style Sheets
none content that overflows the inline axis is not displayed. scroll content that overflows the inline axis can be seen by scrolling to it. examples html <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. nullam ac turpis eleifend, fringilla velit ac, aliquam tellus. ...
pointer - CSS: Cascading Style Sheets
Web › CSS › @media › pointer
none the primary input mechanism does not include a pointing device. coarse the primary input mechanism includes a pointing device of limited accuracy. ...
prefers-color-scheme - CSS: Cascading Style Sheets
if you have set privacy.resistfingerprinting to true, prefers-color-scheme preference is overridden to light. alternately, users can create the numeric preference ui.systemusesdarktheme to override the default behavior and return light (value: 0), dark (value: 1), or no-preference (value: 2). (any other value causes firefox to return light.) the prefers-color-scheme css media feature is used to detect if the user has requested the system use a light or dark color theme. syntax light indicates that user has notified the system that they prefer an interface that has a light theme, or has not expressed an active preference. dark indicates that user has notified the system that they prefer an interface that has a dark theme. examples the elements below have an initial color th...
prefers-contrast - CSS: Cascading Style Sheets
more indicates that user has notified the system that they prefer an interface that has a higher level of contrast. ...
prefers-reduced-data - CSS: Cascading Style Sheets
note: this feature is not supported by any user agent and its specifics are subject to change. the prefers-reduced-data css media feature is used to detect if the user has requested the web content that consumes less internet traffic. syntax no-preference indicates that the user has made no preference known to the system. this keyword value evaluates as false in the boolean context. reduce indicates that user has expressed the preference for lightweight alternate content. user preferences currently no user agent implements this feature, although various operating systems do support such preferences and if this media query is ever implemented user agents will likely rely on the settings provided by the operating system. examples note: no browser currently implements t...
prefers-reduced-motion - CSS: Cascading Style Sheets
anel > ease of access > make the computer easier to see > turn off all unnecessary animations (when possible). in macos: system preferences > accessibility > display > reduce motion. in ios: settings > general > accessibility > reduce motion. in android 9+: settings > accessibility > remove animations. in firefox about:config: add a number preference called ui.prefersreducedmotion and set its value to 1. changes to this preference take effect immediately. examples this example has a scaling animation by default. if reduce motion is enabled in your accessibility preferences, the animation is toned down to a simple dissolve without vestibular motion triggers. html <div class="animation">animated box</div> css .animation { animation: pulse 1s linear infinite both; } /* tone down the...
prefers-reduced-transparency - CSS: Cascading Style Sheets
reduce indicates that user has notified the system that they prefer an interface that minimizes the amount of transparent or translucent layer effects. ...
resolution - CSS: Cascading Style Sheets
Web › CSS › @media › resolution
the resolution css media feature can be used to test the pixel density of the output device. syntax the resolution feature is specified as a <resolution> value representing the pixel density of the output device. it is a range feature, meaning that you can also use the prefixed min-resolution and max-resolution variants to query minimum and maximum values, respectively. examples html <p>this is a test of your device's pixel density.</p> css /* exact resolution */ @media (resolution: 150dpi) { p { color: red; } } /* minimum resolution */ @media (min-resolution: 72dpi) { p { text-decoration: underline; } } /* maximum resolution */ @media (max-resolution: 300dpi) { p { background: yellow; } } result specifications specification status comment ...
scan - CSS: Cascading Style Sheets
Web › CSS › @media › scan
the scan css media feature can be used to test the scanning process (if any) utilized by the output device. the word scanning used in this context does not refer to an image scanner, such as one used to digitize a photograph. rather, it means the process by which an image is painted onto a television screen (or other device). syntax the scan feature is specified as a single keyword value chosen from the list below. interlace the device draws odd lines and even lines alternately. some televisions use interlaced scanning. progressive the device draws all lines in sequence. all computer screens use progressive scanning. examples html <p>if your screen uses interlaced rendering, this text should be in a sans-serif font. if your screen uses progressive scanning, you should see a s...
scripting - CSS: Cascading Style Sheets
Web › CSS › @media › scripting
none scripting is completely unavailable on the current document. initial-only scripting is enabled during the initial page load, but not afterwards. enabled scripting is supported and active on the current document. examples html <p class="script-none">you do not have scripting available. :-(</p> <p class="script-initial-only">your scripting is only enabled during the initial page load. ...
update - CSS: Cascading Style Sheets
none once it has been rendered, the layout can no longer be updated. example: documents printed on paper. slow the layout may change dynamically according to the usual rules of css, but the output device is not able to render or display changes quickly enough for them to be perceived as a smooth animation. ...
@page - CSS: Cascading Style Sheets
Web › CSS › @page
ottom-center | @bottom-right | @bottom-right-corner | @left-top | @left-middle | @left-bottom | @right-top | @right-middle | @right-bottom examples @page pseudo-class examples please refer to the various pseudo-classes of @page for examples. :blank :first :left :right :recto :verso specifications specification status comment css logical properties and values level 1the definition of ':recto and :verso' in that specification. editor's draft adds the :recto and :verso page selectors css paged media module level 3the definition of '@page' in that specification. working draft no change from css level 2 (revision 1), though more css at-rules can be used inside a @page. css level 2 (revision 1)the definition of '@page' in tha...
@viewport - CSS: Cascading Style Sheets
Web › CSS › @viewport
us any areas owned by the operating system or other applications). @viewport { width: 100vw; /*sets the width of the actual viewport to the device width*/ } note: the use of <meta name="viewport"> tag overrides @viewport syntax the at-rule contains a set of nested descriptors in a css block that is delimited by curly braces. a zoom factor of 1.0 or 100% corresponds to no zooming. larger values zoom in. smaller values zoom out. descriptors browser support for @viewport is weak at this time, with support being largely available in internet explorer and edge. even in those browsers, only a small number of descriptors are available. browsers will ignore @viewport if they don't support it, and will ignore any descriptors that they don't recognize. min-width used in the determination ...
At-rules - CSS: Cascading Style Sheets
Web › CSS › At-rule
escribes the aspect of intermediate steps in a css animation sequence. @viewport — describes the aspects of the viewport for small screen devices. (currently at the working draft stage) @counter-style — defines specific counter styles that are not part of the predefined set of styles. (at the candidate recommendation stage, but only implemented in gecko as of writing) @font-feature-values (plus @swash, @ornaments, @annotation, @stylistic, @styleset and @character-variant) — define common names in font-variant-alternates for feature activated differently in opentype. (at the candidate recommendation stage, but only implemented in gecko as of writing) conditional group rules much like the values of properties, each at-rule has a different syntax. nevertheless, several...
CSS Animations - CSS: Cascading Style Sheets
the behavior of these keyframe animations can be controlled by specifying their timing function, duration, their number of repetitions, and other attributes. reference css properties animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function css at-rules @keyframes guides detecting css animation support describes a technique for detecting if a browser supports css animations. using css animations step-by-step tutorial about how to create animations using css. ...
Using multiple backgrounds - CSS: Cascading Style Sheets
...
CSS Basic User Interface - CSS: Cascading Style Sheets
css basic user interface is a css module that lets you define the rendering and functionality of features related to the user interface. reference properties appearance box-sizing cursor ime-mode nav-down nav-left nav-right nav-up outline outline-width outline-style outline-color outline-offset resize text-overflow user-select guides using url values for the cursor property explains how a url can be used with the cursor property to produce custom cursors. specifications specification status comment css basic user interface module level 4 working draft css basic user interface module level 3 recommendation css level 2 (revision 1) recommendation initial definition. ...
Box alignment in Flexbox - CSS: Cascading Style Sheets
page aims to detail things which are specific to flexbox and box alignment, it should be read in conjunction with the main box alignment page which details the common features of box alignment across layout methods. basic example in this example, three flex items are aligned on the main axis using justify-content and on the cross axis using align-items. the first item overrides the align-items values set on the group by setting align-self to center. the axes and flex-direction flexbox respects the writing mode of the document, therefore if you are working in english and set justify-content to flex-end this will align the items to the end of the flex container. if you are working with flex-direction set to row, this alignment will be in the inline direction. however, in flexbox you can c...
CSS Color - CSS: Cascading Style Sheets
Web › CSS › CSS Color
reference properties color color-adjust opacity data types <color> guides applying color to html elements using css a guide to using css to apply color to a variety of types of content. all color-related css properties are touched upon. ...
Handling Overflow in Multicol - CSS: Cascading Style Sheets
in this guide we look at how multicol deals with overflow, both inside the column boxes and in situations where there is more content than will fit into the container. overflow inside column boxes an overflow situation happens when an item's size is larger than the column box. for example, the situation could happen when an image in a column is wider than the column-width value or the width of the column based on the number of columns declared with column-count. in this situation, the content should visibly overflow into the next column, rather than be clipped by the column box. you can see an example of this below, with an image of the expected rendering as, at the time of writing, browsers deal with this differently. if you want an image to size down to fit the column box, the standa...
Using multi-column layouts - CSS: Cascading Style Sheets
x; } result the exact details are described in the css3 specification. in a multi-column block, content is automatically flowed from one column into the next as needed. all html, css and dom functionality is supported within columns, as are editing and printing. the columns shorthand most of the time, a web designer will use one of the two css properties: column-count or column-width. as values for these properties do not overlap, it is often convenient to use the shorthand columns. e.g. the css declaration column-width: 12em can be replaced by columns: 12em. example 3 html <div id="col_short"> lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullam...
CSS Multi-column Layout - CSS: Cascading Style Sheets
port for multi-column layouts. support is included for establishing the number of columns in a layout, as well as how content should flow from column to column, gap sizes between columns, and column dividing lines (known as column rules) along with their appearance. basic example in the following example the column-count property has been applied to the element with a class of container. as the value of column-count is 3, the content is arranged into 3 columns of equal size. relationship to fragmentation multiple-column layout is closely related to paged media, in that each column box becomes a fragment, much like a printed page becomes a fragment of an overall document. therefore the properties now defined in the css fragmentation specification are required in order to control how conten...
CSS Flexible Box Layout - CSS: Cascading Style Sheets
ren of a flex container can be laid out in any direction, and can “flex” their sizes, either growing to fill unused space or shrinking to avoid overflowing the parent. both horizontal and vertical alignment of the children can be easily manipulated. basic example in the following example a container has been set to display: flex, which means that the three child items become flex items. the value of justify-content has been set to space-between in order to space the items out evenly on the main axis. an equal amount of space is placed between each item with the left and right items being flush with the edges of the flex container. you can also see that the items are stretching on the cross axis, due to the default value of align-items being stretch. the items stretch to the height of the ...
Block and inline layout in normal flow - CSS: Cascading Style Sheets
he paragraphs have a top margin of 20px and a bottom margin of 40px. the size of the margin between the paragraphs is 40px as the smaller top margin on the second paragraph has collapsed with the larger bottom margin of the first. you can read more about margin collapsing in our article mastering margin collapsing. note: if you are not sure whether margins are collapsing, check the box model values in your browser devtools. this will give you the actual size of the margin which can help you to identify what is happening. elements participating in an inline formatting context inline elements display one after the other in the direction that sentences run in that particular writing mode. while we don’t tend to think of inline elements as having a box, as with everything in css they do...
CSS Fonts - CSS: Cascading Style Sheets
Web › CSS › CSS Fonts
opentype font features guide font features or variants refer to different glyphs or character styles contained w...
CSS Generated Content - CSS: Cascading Style Sheets
see the how to guide for generated content to learn more, and the content and quotes properties for implementation information. ...
CSS Grid Layout and Accessibility - CSS: Cascading Style Sheets
markup flattening another issue to be aware of in css grid layout and to a lesser extent in css flexbox, is the temptation to flatten markup. as we have discovered, for an item to become a grid item it needs to be a direct child of the grid container. therefore, where you have a <ul> element inside a grid container, that ul becomes a grid item – the child <li> elements do not. if the subgrid value of display becomes implemented, it would be possible to make these children of a grid item participate in the overall grid layout by declaring the ul element a subgrid. currently the only way to do this is to use display: contents to cause the box generated by the ul to disappear from the dom. for more information about this interaction see the guide on the relationship of grid layout to other la...
CSS Grid Layout - CSS: Cascading Style Sheets
<flex> glossary entries grid grid lines grid tracks grid cell grid area gutters grid axis grid row grid column guides basic concepts of grid layout relationship of grid layout to other layout methods layout using line-based placement grid template areas layout using named grid lines auto-placement in css grid layout box alignment in css grid layout css grid, logical values and writing modes css grid layout and accessibility css grid and progressive enhancement realising common layouts using css grid subgrid external resources css grid and ie11 (polyfill) examples from jen simmons grid by example - a collection of usage examples and video tutorials codrops grid reference firefox devtools css grid inspector css grid playground grid garden - a game fo...
Implementing image sprites in CSS - CSS: Cascading Style Sheets
the same image file, so the number of http requests is reduced. note: when using http/2, it may in fact be more bandwidth-friendly to use multiple small requests. implementation suppose an image is given to every item with class toolbtn: .toolbtn { background: url(myfile.png); display: inline-block; height: 20px; width: 20px; } a background position can be added either as two x, y values after the url()() in the background, or as background-position. for example: #btn1 { background-position: -20px 0px; } #btn2 { background-position: -40px 0px; } this would move the element with the id 'btn1' 20 pixels to the left and the element with the id 'btn2' 40 pixels to the left (assuming they have the class toolbtn assigned and are affected by the image rule above). similarly, yo...
CSS Images - CSS: Cascading Style Sheets
css images module level 4 working draft added image-resolution, conic-gradient(), and image() css images module level 3 candidate recommendation added image-orientation, image-rendering, object-fit and object-position compatibility standardthe definition of 'css gradients' in that specification. living standard standardizes the -webkit prefixed gradient value functions css values and units module level 3the definition of '<url>' in that specification. candidate recommendation css level 2 (revision 1)the definition of '<uri>' in that specification. recommendation css level 1the definition of '<url>' in that specification. recommendation initial definition ...
CSS Overflow - CSS: Cascading Style Sheets
oration, overhanging glyphs, outlines, etc. the overflow that we sometimes need to manage in css is described as scrollable overflow. this is the content appearing outside of the box for which scrolling mechanisms need to be provided. the overflow properties are how we can control what happens when content overflows a box. basic example the following interactive example shows how changing the value of the overflow property, changes how the overflow of a fixed height box is dealt with. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. reference css properties overflow overflow-block overflow-inline overflow-x...
Stacking with floated blocks - CSS: Cascading Style Sheets
affected. this happens according to standard float behaviour. this behavior can be shown with an added rule to the above list: the background and borders of the root element descendant non-positioned blocks, in order of appearance in the html floating blocks descendant non-positioned inline elements descendant positioned elements, in order of appearance in the html note: if an opacity value is applied to the non-positioned block (div #4), then something strange happens: the background and border of that block pops up above the floating blocks and the positioned blocks. this is due to a peculiar part of the specification: applying a opacity value creates a new stacking context (see what no one told you about z-index). source code for the example html <div id="abs1"> <b>div #1</...
Stacking context example 2 - CSS: Cascading Style Sheets
ng context example 2 this is a very simple example, but it is the key for understanding the concept of stacking context. there are the same four divs of the previous example, but now z-index properties are assigned on both levels of the hierarchy. you can see that div #2 (z-index: 2) is above div #3 (z-index: 1), because they both belong to the same stacking context (the root one), so z-index values rule how elements are stacked. what can be considered strange is that div #2 (z-index: 2) is above div #4 (z-index: 10), despite their z-index values. the reason is that they do not belong to the same stacking context. div #4 belongs to the stacking context created by div #3, and as explained previously div #3 (and all its content) is under div #2. to better understand the situation, this is t...
Browser compatibility and Scroll Snap - CSS: Cascading Style Sheets
tial example we have used the old specification alongside the current specification in order to make scroll snapping work in all browsers which support some form of scroll snapping. the example adds the scroll-snap-points-y and scroll-snap-destination properties, which are deprecated, to make scroll snapping work in firefox. we also added the scroll-snap-type property twice, once with the y axis value needed for browsers that support the new spec, and once for firefox pre-68, which supports the property but without the y value. do i need to use both specs? scroll snapping is one of those nice parts of css in which the fallback is that you don't get the enhanced functionality, but everything still works. i would suggest at this point you should implement the new specification only, unless y...
CSS Text - CSS: Cascading Style Sheets
Web › CSS › CSS Text
alignment, white space handling, and text transformation. reference properties hanging-punctuation hyphens letter-spacing line-break overflow-wrap tab-size text-align text-align-last text-indent text-justify text-size-adjust text-transform white-space word-break word-spacing specifications specification status comment css logical properties and values level 1 editor's draft updates some properties to be independent of the directionality of the text. css text module level 3 working draft css level 2 (revision 1) recommendation css level 1 recommendation initial definition ...
CSS Transitions - CSS: Cascading Style Sheets
the behavior of these transitions can be controlled by specifying their timing function, duration, and other attributes. reference properties transition transition-delay transition-duration transition-property transition-timing-function guides using css transitions step-by-step tutorial about how to create transitions using css. this article describes each relevant css property and explains how they interact with each other. ...
Animatable CSS properties - CSS: Cascading Style Sheets
certain css properties can be animated using css animations or css transitions. animation means that their values can be made to change gradually over a given amount of time. the animatable properties are: -moz-outline-radius -moz-outline-radius-bottomleft -moz-outline-radius-bottomright -moz-outline-radius-topleft -moz-outline-radius-topright -webkit-line-clamp -webkit-text-fill-color -webkit-text-stroke -webkit-text-stroke-color all backdrop-filter background background-color background-position background-size block-size border border-block-end border-block-end-color border-block-end-width border-block-start border-block-start-color border-block-start-width border-bo...
ID selectors - CSS: Cascading Style Sheets
the css id selector matches an element based on the value of the element’s id attribute. in order for the element to be selected, its id attribute must match exactly the value given in the selector. /* the element with id="demo" */ #demo { border: red 2px solid; } syntax #id_value { style properties } note that syntactically (but not specificity-wise), this is equivalent to the following attribute selector: [id=id_value] { style properties } examples css #identified { background-color: skyblue; } html <div id="identified">this div has a special id on it!</div> <div>this is just a regular div.</div> result specifications specification status comment selectors level 4the definition of 'id selectors' in that specification. working draft ...
Grid wrapper - CSS: Cascading Style Sheets
r page when desired. requirements items placed on the grid should be able to align to a horizontally-centered max-width wrapper and/or the outer edges of the grid. recipe download this example choices made this recipe uses the css grid minmax() function to define the grid track sizes in the grid-template-columns property. for the central columns with a maximum width we can set a minimum value of 0 or greater and a maximum value that specifies the maximum size the column tracks will grow to. using a numeric unit (pixels, ems, rems) will create a fixed maximum size for the central wrapper, whereas using percentage values or viewport units will mean this wrapper grows or shrinks in response to its context. the outer two columns have a maximum size of 1fr, meaning that they will each exp...
List group with badges - CSS: Cascading Style Sheets
t, no matter how much content the item has. the badge should always be centered vertically whether there is a single line of content, or more than one. recipe download this example choices made flexbox makes this particular pattern straightforward and also makes it easy to make changes to the layout. to ensure the text and badge line up correctly i use the justify-content property with a value of space-between. this places any extra space between the items. in the live example, if you remove this property and you will see the badge move to the end of the text on items with text shorter than the one line. to align the content horizontally, i use the align-items property to align the text and badge on the cross axis. if instead, you want the badge to align to the top of the content, cha...
Using Media Queries for Accessibility - CSS: Cascading Style Sheets
ntrast css media feature is a microsoft extension that describes whether the application is being displayed in high contrast mode, and with what color variation. this will help not only users with low vision and contrast sensitivity issues but also users that are working on a computer or phone with direct sunlight. syntax the -ms-high-contrast media feature is specified as one of the following values. values active indicates that the subsequent styling rules will be applied when the system is placed in high contrast mode with any color variation. black-on-white indicates that the subsequent styling rules will be applied when the system is placed in high contrast mode with a black-on-white color variation. white-on-black indicates that the subsequent styling rules will be a...
Media queries - CSS: Cascading Style Sheets
they are a key component of responsive design. for example, a media query can shrink the font size on small devices, increase the padding between paragraphs when a page is viewed in portrait mode, or bump up the size of buttons on touchscreens. in css, use the @media at-rule to conditionally apply part of a style sheet based on the result of a media query. use @import to conditionally apply an entire style sheet. ...
Microsoft CSS extensions - CSS: Cascading Style Sheets
roll-snap-points-y -ms-scroll-snap-x -ms-scroll-snap-y -ms-scroll-translation -ms-text-autospace -ms-touch-select -ms-wrap-flow -ms-wrap-margin -ms-wrap-through zoom pseudo-elements ::-ms-browse ::-ms-check ::-ms-clear ::-ms-expand ::-ms-fill ::-ms-fill-lower ::-ms-fill-upper ::-ms-reveal ::-ms-thumb ::-ms-ticks-after ::-ms-ticks-before ::-ms-tooltip ::-ms-track ::-ms-value media features -ms-high-contrast css-related dom apis mscontentzoomfactor msgetpropertyenabled msgetregioncontent msrangecollection msregionoverflow ...
Pseudo-classes - CSS: Cascading Style Sheets
xternal factors like the history of the navigator (:visited, for example), the status of its content (like :checked on certain form elements), or the position of the mouse (like :hover, which lets you know if the mouse is over an element or not). note: in contrast to pseudo-classes, pseudo-elements can be used to style a specific part of an element. syntax selector:pseudo-class { property: value; } like regular classes, you can chain together as many pseudo-classes as you want in a selector. index of standard pseudo-classes :active :any-link :blank :checked :current :default :defined :dir() :disabled :drop :empty :enabled :first :first-child :first-of-type :fullscreen :future :focus :focus-visible :focus-within :has() :host :host() :host-co...
Pseudo-elements - CSS: Cascading Style Sheets
le a specific part of the selected element(s). for example, ::first-line can be used to change the font of the first line of a paragraph. /* the first line of every <p> element. */ p::first-line { color: blue; text-transform: uppercase; } note: in contrast to pseudo-elements, pseudo-classes can be used to style an element based on its state. syntax selector::pseudo-element { property: value; } you can use only one pseudo-element in a selector. it must appear after the simple selectors in the statement. note: as a rule, double colons (::) should be used instead of a single colon (:). this distinguishes pseudo-classes from pseudo-elements. however, since this distinction was not present in older versions of the w3c spec, most browsers support both syntaxes for the original pseudo-e...
Replaced elements - CSS: Cascading Style Sheets
d as non-replaced elements (the spec describes their default platform-specific rendering with the term "widgets"). objects inserted using the css content property are anonymous replaced elements. they are "anonymous" because they don't exist in the html markup. using css with replaced elements css handles replaced elements specifically in some cases, like when calculating margins and some auto values. note that some replaced elements, but not all, have intrinsic dimensions or a defined baseline, which is used by some css properties, such as vertical-align. only replaced elements can ever have intrinsic dimensions. controlling object position within the content box certain css properties can be used to specify how the object contained within the replaced element should be positioned within...
Specificity - CSS: Cascading Style Sheets
specificity is based on the matching rules which are composed of different sorts of css selectors. how is specificity calculated? specificity is a weight that is applied to a given css declaration, determined by the number of each selector type in the matching selector. when multiple declarations have equal specificity, the last declaration found in the css is applied to the element. specificity only applies when the same element is targeted by multiple declarations. ...
<angle-percentage> - CSS: Cascading Style Sheets
the <angle-percentage> css data type represents a value that can be either a <angle> or a <percentage>. syntax refer to the documentation for <angle> and <percentage> for details of the individual syntaxes allowed by this type. use in calc() where an <angle-percentage> is specified as an allowable type, this means that the percentage resolves to an angle and therefore can be used in a calc() expression. specifications specification status comment css values and units module level 4the definition of '<angle-percentage>' in that specification. editor's draft css values and units module level 3the definition of '<angle-percentage>' in that specification. candidate recommendation defines <angle-percentage>. adds calc() ...
<display-listitem> - CSS: Cascading Style Sheets
the list-item keyword causes the element to generate a ::marker pseudo-element with the content specified by its list-style properties (for example a bullet point) together with a principal box of the specified type for its own contents. syntax a single value of list-item will cause the element to behave like a list item. this can be used together with list-style-type and list-style-position. list-item can also be combined with any <display-outside> keyword and the flow or flow-root <display-inside> keywords. note: in browsers that support the two-value syntax, if no inner value is specified it will default to flow. if no outer value is specified, the principal box will have an outer display type of block. examples html <div class="fake-list">i will display as a list item</div> css ...
element() - CSS: Cascading Style Sheets
Web › CSS › element
a particularly useful scenario for using this would be to render an image in an html <canvas> element, then use that as a background. on gecko browsers, you can use the non-standard document.mozsetimageelement() method to change the element being used as the background for a given css background element. syntax element(id) where: id the id of an element to use as the background, specified using the html attribute #id on the element. ...
blur() - CSS: Cascading Style Sheets
ian 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) /* blur with 1.17rem ...
brightness() - CSS: Cascading Style Sheets
or darker. its result is a <filter-function>. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax brightness(amount) parameters amount the brightness of the result, specified as a <number> or a <percentage>. a value under 100% darkens the image, while a value over 100% brightens it. a value of 0% will create an image that is completely black, while a value of 100% leaves the input unchanged. the lacuna value for interpolation is 1. examples setting brightness using numbers and percentages brightness(0%) /* completely black */ brightness(0.4) /* 40% brightness */ brightness(1) /* no effect */ bright...
contrast() - CSS: Cascading Style Sheets
he 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 contrast(amount) parameters amount the contrast of the result, specified as a <number> or a <percentage>. a value under 100% decreases the contrast, while a value over 100% increases it. a value of 0% will create an image that is completely gray, while a value of 100% leaves the input unchanged. the lacuna value for interpolation is 1. examples setting contrast using numbers and percentages contrast(0) /* completely gray */ contrast(65%) /* 65% contrast */ contrast(1) /* no effect */ contrast(2...
grayscale() - CSS: Cascading Style Sheets
o grayscale. its result is a <filter-function>. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax grayscale(amount) parameters amount the amount of the conversion, specified as a <number> or a <percentage>. a value of 100% is completely grayscale, while a value of 0% leaves the input unchanged. values between 0% and 100% are linear multipliers on the effect. default value when omitted is 1. the initial value for interpolation is 0. examples grayscale(0) /* no effect */ grayscale(.7) /* 70% grayscale */ grayscale(100%) /* completely grayscale */ specifications specification status ...
hue-rotate() - CSS: Cascading Style Sheets
its contents. 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 hue-rotate(angle) parameters angle the relative change in hue of the input sample, specified as an <angle>. a value of 0deg leaves the input unchanged. a positive hue rotation increases the hue value, while a negative rotation decreases the hue value. the lacuna value for interpolation is 0. there is no minimum or maximum value; hue-rotate(ndeg) evaluates to n modulo 360. examples hue-rotate(-90deg) /* same as 270deg rotation */ hue-rotate(0deg) /* no effect */ hue-rotate(90deg) /* 90deg rotation */ h...
invert() - CSS: Cascading Style Sheets
he input image. its result is a <filter-function>. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax invert(amount) parameters amount the amount of the conversion, specified as a <number> or a <percentage>. a value of 100% is completely inverted, while a value of 0% leaves the input unchanged. values between 0% and 100% are linear multipliers on the effect. the lacuna value for interpolation is 0. examples invert(0) /* no effect */ invert(.6) /* 60% inversion */ invert(100%) /* completely inverted */ specifications specification status filter effects module level 1the d...
opacity() - CSS: Cascading Style Sheets
s project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: this function is similar to the more established opacity property. the difference is that with filters, some browsers provide hardware acceleration for better performance. syntax opacity(amount) parameters amount the amount of the conversion, specified as a <number> or a <percentage>. a value of 0% is completely transparent, while a value of 100% leaves the input unchanged. values between 0% and 100% are linear multipliers on the effect. the lacuna value for interpolation is 1. examples opacity(0%) /* completely transparent */ opacity(50%) /* 50% transparent */ opacity(1) /* no effect */ specifications specification status filter effects module leve...
saturate() - CSS: Cascading Style Sheets
input image. its result is a <filter-function>. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax saturate(amount) parameters amount the amount of the conversion, specified as a <number> or a <percentage>. a value under 100% desaturates the image, while a value over 100% super-saturates it. a value of 0% is completely unsaturated, while a value of 100% leaves the input unchanged. the lacuna value for interpolation is 1. examples saturate(0) /* completely unsaturated */ saturate(.4) /* 40% saturated */ saturate(100%) /* no effect */ saturate(200%) /* double saturation */ specifications ...
sepia() - CSS: Cascading Style Sheets
rown appearance. its result is a <filter-function>. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax sepia(amount) parameters amount the amount of the conversion, specified as a <number> or a <percentage>. a value of 100% is completely sepia, while a value of 0% leaves the input unchanged. values between 0% and 100% are linear multipliers on the effect. the lacuna value for interpolation is 0. examples sepia(0) /* no effect */ sepia(.65) /* 65% sepia */ sepia(100%) /* completely sepia */ specifications specification status filter effects module level 1the definition of ...
fit-content() - CSS: Cascading Style Sheets
max(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 block size of the grid container for row tracks. other...
flex-flow - CSS: Cascading Style Sheets
Web › CSS › flex-flow
-direction flex-wrap syntax /* flex-flow: <'flex-direction'> */ flex-flow: row; flex-flow: row-reverse; flex-flow: column; flex-flow: column-reverse; /* flex-flow: <'flex-wrap'> */ flex-flow: nowrap; flex-flow: wrap; flex-flow: wrap-reverse; /* flex-flow: <'flex-direction'> and <'flex-wrap'> */ flex-flow: row nowrap; flex-flow: column wrap; flex-flow: column-reverse wrap-reverse; /* global values */ flex-flow: inherit; flex-flow: initial; flex-flow: unset; values see flex-direction and flex-wrap for details on the values. formal definition initial valueas each of the properties of the shorthand:flex-direction: rowflex-wrap: nowrapapplies toflex containersinheritednocomputed valueas each of the properties of the shorthand:flex-direction: as specifiedflex-wrap: as specifiedanimation t...
<flex> - CSS: Cascading Style Sheets
ble length within a grid container. it is used in grid-template-columns, grid-template-rows and other related properties. syntax the <flex> data type is specified as a <number> followed by the unit fr. the fr unit represents a fraction of the leftover space in the grid container. as with all css dimensions, there is no space between the unit and the number. examples 1fr /* using an integer value */ 2.5fr /* using a float value */ specifications specification status comment css grid layoutthe definition of '<flex>' in that specification. candidate recommendation initial definition. ...
ident - CSS: Cascading Style Sheets
Web › CSS › ident
bili\.bob a correctly escaped period invalid identifiers 34rem it must not start with a decimal digit. -12rad it must not start with a dash followed by a decimal digit. bili.bob only alphanumeric characters, _, and - needn't be escaped. 'bilibob' this would be a <string>. "bilibob" this would be a <string>. specifications specification status comment css values and units module level 4the definition of '<ident>' in that specification. editor's draft css values and units module level 3the definition of '<ident>' in that specification. candidate recommendation ...
image-set() - CSS: Cascading Style Sheets
Web › CSS › image-set
ction with a high-resolution screen may prefer to receive lower-resolution images rather than waiting for a higher resolution image to load. image-set() allows the author to provide options rather than determining what each individual user needs. syntax image-set() = image-set( <image-set-option># ) where <image-set-option> = [ <image> | <string> ] <resolution> and <string> is an <url> values most commonly you'll see an url() <string> value, but the <image> can be any image type except for an image set. the image-set() function can not be nested inside another image-set() function. <resolution> units include x or dppx, for dots per pixel unit, dpi, for dots per inch, and dpcm for dots per centimeter. every image within an image-set() must have a unique resolution. examples backgr...
<image> - CSS: Cascading Style Sheets
Web › CSS › image
rder-source ? symbols for @counter-style at risk feature. if supported, the browser-defined size matching the usual cursor size on the client's system content for a pseudo-element (::after/::before) a 300px × 150px rectangle the concrete object size is calculated using the following algorithm: if the specified size defines both the width and the height, these values are used as the concrete object size. if the specified size defines only the width or only the height, the missing value is determined using the intrinsic ratio, if there is any, the intrinsic dimensions if the specified value matches, or the default object size for that missing value. if the specified size defines neither the width nor the height, the concrete object size is calculated so tha...
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 stil...
mask-border-mode - CSS: Cascading Style Sheets
the mask-border-mode css property specifies the blending mode used in a mask border. syntax /* keyword values */ mask-border-mode: luminance; mask-border-mode: alpha; /* global values */ mask-border-mode: inherit; mask-border-mode: initial; mask-border-mode: unset; values luminance the luminance values of the mask border image are used as the mask values. alpha the alpha values of the mask border image are used as the mask values. formal definition initial valuealphaapplies toall elements; in svg, it applies to container elements excluding the defs element and all graphics elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax luminance | alpha examples basic usage this property doesn't yet seem to have support anywhere. when browsers support it, i...
paint() - CSS: Cascading Style Sheets
Web › CSS › paint
syntax paint(workletname, parameters) where: workletname the name of the registered worklet. parameters optional additional parameters to pass to the paintworklet examples you can pass additional arguments via the css paint() function. ...
<ratio> - CSS: Cascading Style Sheets
Web › CSS › ratio
the <ratio> css data type, used for describing aspect ratios in media queries, denotes the proportion between two unitless values. syntax in media queries level 3, the <ratio> data type consisted of a strictly positive <integer> followed by a forward slash ('/', unicode u+002f solidus) and a second strictly positive <integer>. spaces before and after the slash are optional. the first number represents the width, while the second represents the height. in media queries level 4, the <ratio> date type is updated to consist of a strictly positive <number> followed by a forward slash ('/', unicode u+002f solidus) and a second strictly positive <number>. in addition a single <number> as a value is allowable. examples use in a media query @media screen and (min-aspect-ratio: 16/9) { ... } comm...
matrix3d() - CSS: Cascading Style Sheets
the matrix3d() css function defines a 3d transformation as a 4x4 homogeneous matrix. its result is a <transform-function> data type. syntax the matrix3d() function is specified with 16 values. they are described in the column-major order. matrix3d(a1, b1, c1, d1, a2, b2, c2, d2, a3, b3, c3, d3, a4, b4, c4, d4) values a1 b1 c1 d1 a2 b2 c2 d2 a3 b3 c3 d3 are <number>s describing the linear transformation. a4 b4 c4 d4 are <number>s describing the translation to apply. note: until firefox 16, gecko accepted a <length> value for a4, b4 and c4. cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coordinates on ℝℙ3 this transformation applies to the 3d space and can't be represented on the plane. ...
rotate() - CSS: Cascading Style Sheets
...
rotate3d() - CSS: Cascading Style Sheets
tations are applied impacts the result. syntax the amount of rotation created by rotate3d() is specified by three <number>s and one <angle>. the <number>s represent the x-, y-, and z-coordinates of the vector denoting the axis of rotation. the <angle> represents the angle of rotation; if positive, the movement will be clockwise; if negative, it will be counter-clockwise. rotate3d(x, y, z, a) values x is a <number> describing the x-coordinate of the vector denoting the axis of rotation which could between 0 and 1. y is a <number> describing the y-coordinate of the vector denoting the axis of rotation which could between 0 and 1. z is a <number> describing the z-coordinate of the vector denoting the axis of rotation which could between 0 and 1. a is an <angle> representing the angl...
rotateX() - CSS: Cascading Style Sheets
uivalent to rotate3d(1, 0, 0, a). note: unlike rotations in the 2d plane, the composition of 3d rotations is usually not commutative. in other words, the order in which the rotations are applied impacts the result. syntax the amount of rotation created by rotatex() is specified by an <angle>. if positive, the movement will be clockwise; if negative, it will be counter-clockwise. rotatex(a) values a is an <angle> representing the angle of the rotation. a positive angle denotes a clockwise rotation, a negative angle a counter-clockwise one. 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. ...
rotateY() - CSS: Cascading Style Sheets
uivalent to rotate3d(0, 1, 0, a). note: unlike rotations in the 2d plane, the composition of 3d rotations is usually not commutative. in other words, the order in which the rotations are applied impacts the result. syntax the amount of rotation created by rotatey() is specified by an <angle>. if positive, the movement will be clockwise; if negative, it will be counter-clockwise. rotatey(a) values a is an <angle> representing the angle of the rotation. a positive angle denotes a clockwise rotation, a negative angle a counter-clockwise one. 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. ...
rotateZ() - CSS: Cascading Style Sheets
otate(a) or rotate3d(0, 0, 1, a). note: unlike rotations in the 2d plane, the composition of 3d rotations is usually not commutative. in other words, the order in which the rotations are applied impacts the result. syntax the amount of rotation created by rotatez() is specified by an <angle>. if positive, the movement will be clockwise; if negative, it will be counter-clockwise. rotatez(a) values a is an <angle> representing the angle of the rotation. a positive angle denotes a clockwise rotation, a negative angle a counter-clockwise one. 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. ...
scaleX() - CSS: Cascading Style Sheets
or, except when the scale factor is 1, in which case the function is the identity transform. the scaling is not isotropic, and the angles of the element are not conserved. scalex(-1) defines an axial symmetry, with a vertical axis passing through the origin (as specified by the transform-origin property). note: scalex(sx) is equivalent to scale(sx, 1) or scale3d(sx, 1, 1). syntax scalex(s) values s is a <number> representing the scaling factor to apply on the abscissa of each point of the element. cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coordinates on ℝℙ3 s0 01 s00010001 s00010001 s000010000100001 [s 0 0 1 0 0] examples html <div>normal</di...
scaleY() - CSS: Cascading Style Sheets
nction is the identity transform. the scaling is not isotropic, and the angles of the element are not conserved. scaley(-1) defines an axial symmetry, with a horizontal axis passing through the origin (as specified by the transform-origin property). note: scaley(sy) is equivalent to scale(1, sy) or scale3d(1, sy, 1). transform: rotatex(180deg); === transform: scaley(-1); syntax scaley(s) values s is a <number> representing the scaling factor to apply on the ordinate of each point of the element. cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coordinates on ℝℙ3 10 0s 1000s0001 1000s0001 10000s0000100001 [1 0 0 s 0 0] examples html <div>normal</div>...
scaleZ() - CSS: Cascading Style Sheets
metry, with the z-axis passing through the origin (as specified by the transform-origin property). in the above interactive examples, perspective: 550px; (to create a 3d space) and transform-style: preserve-3d; (so the children, the 6 sides of the cube, are also positioned in the 3d space), have been set on the cube. note: scalez(sz) is equivalent to to scale3d(1, 1, sz). syntax scalez(s) values s is a <number> representing the scaling factor to apply on the z-coordinate of each point of the element. cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coordinates on ℝℙ3 this transformation applies to the 3d space and can't be represented on the plane. 10001000s 1000010000s00001 ...
skewX() - 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. this transformation is a shear mapping (transvection) that distorts each point within an element by a certain angle in the horizontal direction. the abscissa coordinate of each point is modified by a value proportionate to the specified angle and the distance to the origin; thus, the farther from the origin a point is, the greater will be the value added it. note: skewx(a) is equivalent to skew(a). syntax skewx(a) values a is an <angle> representing the angle to use to distort the element along the abscissa. cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 ...
skewY() - CSS: Cascading Style Sheets
eractive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this transformation is a shear mapping (transvection) that distorts each point within an element by a certain angle in the vertical direction. the ordinate coordinate of each point is modified by a value proportionate to the specified angle and the distance to the origin; thus, the farther from the origin a point is, the greater will be the value added it. syntax skewy(a) values a is an <angle> representing the angle to use to distort the element along the ordinate. cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneo...
translate3d() - CSS: Cascading Style Sheets
...
translateX() - CSS: Cascading Style Sheets
the translatex() css function repositions an element horizontally on the 2d plane. its result is a <transform-function> data type. note: translatex(tx) is equivalent to translate(tx, 0) or translate3d(tx, 0, 0). syntax /* <length-percentage> values */ transform: translatex(200px); transform: translatex(50%); values <length-percentage> is a <length> or <percentage> representing the abscissa of the translating vector. 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-coordina...
translateY() - CSS: Cascading Style Sheets
the translatey() css function repositions an element vertically on the 2d plane. its result is a <transform-function> data type. note: translatey(ty) is equivalent to translate(0, ty) or translate3d(0, ty, 0). syntax /* <length-percentage> values */ transform: translatey(200px); transform: translatey(50%); values <length-percentage> the value is a <length> or <percentage> representing the ordinate of the translating vector. 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...
exsl:node-set() - EXSLT
Web › EXSLT › exsl › node-set
this lets you process the xml created within a variable to process it in multiple steps. ...
exsl:object-type() - EXSLT
xsl:object-type() returns a string that indicates the type of the specified object. note: most xslt object types can be coerced into each other safely; however, certain coercsions to raise error conditions. in particular, treating something that's not a node-set as a node-set will do so. this function lets authors of named templates and extension functions easily provide flexibility in parameter values. syntax exsl:object-type(object) parameters object the object whose type is to be returned. returns the object's type, which will be one of the following: string number boolean node-set rtf external specifications exslt - exsl:object-type ...
Common (exsl) - EXSLT
Web › EXSLT › exsl
nts, exslt functions, xpath functions, xpath axes the exslt common package provides basic functions that expand upon the capabilities of xslt. the namespace for the common package is http://exslt.org/common. exsl:node-set()exsl:node-set() returns a node-set from a result tree fragment, which is what you get when you look at the xsl:variable instead of its select attribute to fetch a variable's value. this lets you process the xml created within a variable to process it in multiple steps.exsl:object-type()exsl:object-type() returns a string that indicates the type of the specified object. ...
math:highest() - EXSLT
Web › EXSLT › math › highest
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes math:highest() returns the node in the specified node-set with the highest value (where the highest value calculated using math:max()). a node has this maximum value if converting its string value to a number equals the maximum value. note: ??? syntax math:highest(nodeset) parameters nodeset the node-set whose highest value is to be returned. returns a result tree fragment consisting of copies of the nodes returned by math:max(). specifications exslt - math:highest ...
math:lowest() - EXSLT
Web › EXSLT › math › lowest
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes math:lowest() returns the node in the specified node-set with the lowest value (where the lowest value calculated using math:min()). a node has this minimum value if converting its string value to a number equals the minimum value. syntax math:lowest(nodeset) parameters nodeset the node-set whose lowest value is to be returned. returns a result tree fragment consisting of copies of the nodes returned by math:min(). specifications exslt - math:lowest ...
math:max() - EXSLT
Web › EXSLT › math › max
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes math:max() returns the maximum value of a node-set. to compute the maximum value of the node-set, the node set is sorted into descending order as it would be using xsl:sort() with a data type of number. the maximum value is then the first node in the sorted list, converted into a number. syntax math:max(nodeset) parameters nodeset the node-set whose highest value is to be returned. returns a result tree fragment representing the highest valued node's numeric value as a string. specifications exslt - math:max ...
math:min() - EXSLT
Web › EXSLT › math › min
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes math:min() returns the minimum value of a node-set. to compute the minimum value of the node-set, the node set is sorted into ascending order as it would be using xsl:sort() with a data type of number. the minimum value is then the first node in the sorted list, converted into a number. note: syntax math:min(nodeset) parameters nodeset the node-set whose lowest value is to be returned. returns a result tree fragment representing the lowest valued node's numeric value as a string. specifications exslt - math:min browser compatibility supported in gecko 1.9 and later. ...
Math (math) - EXSLT
Web › EXSLT › math
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the exslt math package provides functions for working with numeric values and comparing nodes. the namespace for the math package is http://exslt.org/math. math:highest()math:highest() returns the node in the specified node-set with the highest value (where the highest value calculated using math:max()).math:lowest()math:lowest() returns the node in the specified node-set with the lowest value (where the lowest value calculated using math:min()).math:max()math:max() returns the maximum value of a node-set.math:min()math:min() returns the minimum value of a node-set. ...
set:distinct() - EXSLT
Web › EXSLT › set › distinct
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes set:distinct() returns a subset of the nodes in the specified node-set, returning only nodes with unique string values. syntax set:distinct(nodeset) parameters nodeset the node-set in which to find unique nodes. returns a node-set containing the nodes that have unique string values. specifications exslt - set:distinct ...
set:leading() - EXSLT
Web › EXSLT › set › leading
functions, xpath functions, xpath axes set:leading() returns the nodes in one node-set that come before the first node in the other node-set. syntax set:leading(nodeset1, nodeset2) parameters nodeset1 the node set to find nodes in that precede the first node in the second node set. nodeset2 the node set to compare against. returns a node-set containing the nodes from nodeset1 whose values precede the first node in nodeset2. note: if the first node in nodeset2 isn't contained in nodeset1, an empty set is returned. if nodeset2 is empty, then the result is nodeset1. specifications exslt - set:leading ...
set:trailing() - EXSLT
Web › EXSLT › set › trailing
functions, xpath functions, xpath axes set:trailing() returns the nodes in one node-set that come after the first node in the other node-set. syntax set:trailing(nodeset1, nodeset2) parameters nodeset1 the node set to find nodes in that follow the first node in the second node set. nodeset2 the node set to compare against. returns a node-set containing the nodes from nodeset1 whose values follow the first node in nodeset2. note: if the first node in nodeset2 isn't contained in nodeset1, an empty set is returned. if nodeset2 is empty, then the result is nodeset1. specifications exslt - set:trailing ...
Sets (set) - EXSLT
Web › EXSLT › set
ons that let you perform set manipulation. the namespace for these functions is http://exslt.org/sets. set:difference()set:difference() returns the difference between two node-sets. in other words, it returns a node-set whose nodes are in one node-set but not in the other.set:distinct()set:distinct() returns a subset of the nodes in the specified node-set, returning only nodes with unique string values.set:has-same-node()set:has-same-node() determines whether two node-sets have any nodes in common.set:intersection()set:intersection() returns the intersection of two node-sets. in other words, it returns a node-set containing all the nodes that exits in both nodeset1 and nodeset2.set:leading()set:leading() returns the nodes in one node-set that come before the first node in the other node-set.se...
str:concat() - EXSLT
Web › EXSLT › str › concat
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes str:concat() returns a string containing all the string values in a node-set concatenated together. syntax str:concat(nodeset) parameters nodeset the node-set whose nodes' string values should be concatenated into one string. returns a string whose value is all the string values of the nodes in nodeset concatenated together. if nodeset is empty, an empty string is returned. specifications exslt - str:concat ...
Strings (str) - EXSLT
Web › EXSLT › str
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the exslt strings package provides functions that allow the manipulation of strings. the namespace for the strings package is http://exslt.org/strings. str:concat()str:concat() returns a string containing all the string values in a node-set concatenated together.str:split()str:split() splits a string using a pattern string to determine where the splits should occur, returning a node-set containing the resulting strings.str:tokenize()str:tokenize() splits a string using a set of characters as delimiters that determine where the splits should occur, returning a node-set containing the resulting strings. ...
Ajax - Developer guides
Web › Guide › AJAX
messages can be treated as events + data inside the web page. see also: using server-sent events. pure-ajax navigation example this article provides a working (minimalist) example of a pure-ajax website composed only of three pages. sending and receiving binary data the responsetype property of the xmlhttprequest object can be set to change the expected response type from the server. possible values are the empty string (default), arraybuffer, blob, document, json, and text. the response property will contain the entity body according to responsetype, as an arraybuffer, blob, document, json, or string. this article will show some ajax i/o techniques. xml the extensible markup language (xml) is a w3c-recommended general-purpose markup language for creating special-purpose markup languages.
Media buffering, seeking, and time ranges - Developer guides
able.end(myaudio.seekable.length - 1) actually tells us the end point of the last time range that is seekable (not all seekable media). in practice this is good enough as the browser either enables range requests or it doesn't. if it doesn't then audio.seekable will be equivalent to audio.buffered, which will give a valid indication of the end of seekable media. if range requests are enabled this value usually becomes the duration of the media almost instantly. it is better perhaps to give an indication of how much media has actually downloaded — this what the browser's native players seem to display. so let's build this. the html for our player looks like this: <audio id="my-audio" preload controls> <source src="music.mp3" type="audio/mpeg"> </audio> <div class="buffered"> <span id="...
Overview of events and handlers - Developer guides
this code relies on the agreement that there is a kind of event called 'click' which will call any listener (or 'handler') function with an event object argument (actually, in this case a derivative mouseevent object) and which will be fired by html button elements after user interaction. t...
Touch events (Mozilla experimental) - Developer guides
— mouse events, each event included an identifier that allowed you to track multiple fingers moving on the screen at the same time. event fields touch events were based upon mouseevent, and thereby shared all mouse event fields. they included one additional field. streamid a unique integer identifying the finger generating the event. when the moztouchdown event is built, a unique value is assigned to that finger. corresponding moztouchmove and moztouchup events for that finger will have the same streamid value. this lets you track each finger's movements on the touch screen independently. the stream id is unique until the moztouchup event occurs; after that, the value may be recycled for another series of events. types of touch events moztouchdown sent when the ...
Event developer guide - Developer guides
Web › Guide › Events
cial movements that can be made with a mouse or trackpad and can be interpreted to perform specific tasks.mutation eventsmutation events provide a mechanism for a web page or an extension to get notified about changes made to the dom. use mutation observers instead if possible. orientation and motion data explainedwhen using orientation and motion events, it's important to understand what the values you're given by the browser mean. this article provides details about the coordinate systems at play and how you use them.overview of events and handlersevents and event handling provide a core technique in javascript for reacting to incidents occurring when a browser accesses a web page, including events from preparing a web page for display, from interacting with the content of the web page, ...
HTML5 Parser - Developer guides
Web › Guide › HTML › HTML5 › HTML5 Parser
d css selectors using the canonical case, which is camelcase for various parts of svg such as viewbox. the syntax <foo/> opens and immediately closes the foo element if it is a mathml or svg element (i.e. not an html element). attributes are tokenized the same way they are tokenized in html, so you can omit quotes in the same situations where you can omit quotes in html (i.e. when the attribute value is not the empty string and does not contain whitespace, ", ', `, <, =, or >). warning: the two above features do not combine well due to the reuse of legacy-compatible html tokenization. if you omit quotes on the last attribute value, you must have a space before the closing slash. <circle fill=green /> is ok but <circle fill=red/> is not. attributes starting with xmlns have absolutely no effe...
HTML5 - Developer guides
Web › Guide › HTML › HTML5
icated themes. semantics sections and outlines in html5 a look at the new outlining and sectioning elements in html5: <section>, <article>, <nav>, <header>, <footer> and <aside>. using html5 audio and video the <audio> and <video> elements embed and allow the manipulation of new multimedia content. forms improvements a look at the constraint validation api, several new attributes, new values for the <input> attribute type and the new <output> element. new semantic elements beside sections, media and forms elements, there are numerous new elements, like <mark>, <figure>, <figcaption>, <data>, <time>, <output>, <progress>, or <meter> and <main>, increasing the number of valid html5 elements. improvement in <iframe> using the sandbox and srcdoc attributes, authors can now be precis...
Parsing and serializing XML - Developer guides
if the document is html, the code shown above will return a document. if the document is xml, the resulting object is actually a xmldocument. the two types are essentially the same; the difference is largely historical, although differentiating has some practical benefits as well. note: there is in fac...
Developer guides
ithm (bidi) the unicode® bidi algorithm is part of the unicode text standard. it describes how the browser should order characters while rendering unicode text. this guide covers the algorithm in general and how it applies to content you create—especially when you build properly localized and internationalized content. using formdata objects the formdata object lets you compile a set of key/value pairs to send using xmlhttprequest. it's primarily intended for sending form data, but can be used independently from forms to transmit keyed data. the transmission is in the same format that the form's submit() method would use to send the data if the form's encoding type were set to "multipart/form-data". user input and controls modern web user input goes beyond simple mouse and keyboard: thi...
HTML attribute: capture - HTML: Hypertext Markup Language
the capture attribute specifies that, optionally, a new file should be captured, and which device should be used to capture that new media of a type defined by the accept attribute. values include user and environment. the capture attribute is supported on the file input type. the capture attribute takes as it's value a string that specifies which camera to use for capture of image or video data, if the accept attribute indicates that the input should be of one of those types. value description user the user-facing camera and/or microphone should be used. environment the outward-facing camera and/or microphone should be used note: capture was previously a boolean attribute which, if present, requested that the device's media capture device(s) ...
HTML attribute: maxlength - HTML: Hypertext Markup Language
the maxlength attribute defines the maximum number of characters (as utf-16 code units) the user can enter into an <input> or <textarea>. this must be an integer value 0 or higher. if no maxlength is specified, or an invalid value is specified, the input or textarea has no maximum length. any maxlength value must be greater than or equal to the value of minlength, if present and valid. the input will fail constraint validation if the length of the text value of the field is greater than maxlength utf-16 code units long. constraint validation is only applied when the value is changed by the user. constraint validation while the browser will generally prevent user from entering more text than the maxlength attribute allows, should the length be longer than the maxlength allows, the read-only...
<b>: The Bring Attention To element - HTML: Hypertext Markup Language
Web › HTML › Element › b
nage multiple use cases of <b> if your stylistic needs change, without the need to change all of its uses in the html. historically, the <b> element was meant to make text boldface. styling information has been deprecated since html4, so the meaning of the <b> element has been changed. if there is no semantic purpose to using the <b> element, you should use the css font-weight property with the value "bold" instead in order to make text bold. examples <p> this article describes several <b class="keywords">text-level</b> elements. it explains their usage in an <b class="keywords">html</b> document. </p> keywords are displayed with the default style of the <b>element, likely in bold.</b> result specifications specification status comment html living stan...
<base>: The Document Base URL element - HTML: Hypertext Markup Language
Web › HTML › Element › base
rents a <head> that doesn't contain another <base> element. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlbaseelement attributes this element's attributes include the global attributes. if either of the following attributes are specified, this element must come before other elements with attribute values of urls, such as <link>’s href attribute. href the base url to be used throughout the document for relative urls. absolute and relative urls are allowed. target a keyword or author-defined name of the default browsing context to show the results of navigation from <a>, <area>, or <form> elements without explicit target attributes. the following keywords have special meanings: _self...
<basefont> - HTML: Hypertext Markup Language
Web › HTML › Element › basefont
ormat. face this attribute contains a list of one or more font names. the document text in the default style is rendered in the first font face that the client's browser supports. if no font listed is installed on the local system, the browser typically defaults to the proportional or fixed-width font for that system. size this attribute specifies the font size as either a numeric or relative value. numeric values range from 1 to 7 with 1 being the smallest and 3 the default. usage notes do not use this element! though once (imprecisely) normalized in html 3.2, it wasn't supported in all major browsers. further, browsers, and even successive versions of browsers, never implemented it in the same way: practically, using it has always brought indeterminate results. the <basefont> element ...
<bdi>: The Bidirectional Isolate element - HTML: Hypertext Markup Language
Web › HTML › Element › bdi
ndatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes like all other html elements, this element supports the global attributes, except that the dir attribute behaves differently than normal: it defaults to auto, meaning its value is never inherited from the parent element. this means that unless you specify a value of either rtl or ltr for dir, the user agent will determine the correct directionality to use based on the contents of the <bdi>. examples no <bdi> with only ltr this example lists the winners of a competition using <span> elements only. when the names only contain ltr text the results look fine: <ul> <li...
<bdo>: The Bidirectional Text Override element - HTML: Hypertext Markup Language
Web › HTML › Element › bdo
implicit aria role no corresponding role permitted aria roles any dom interface htmlelement up to gecko 1.9.2 (firefox 4) inclusive, firefox implements the htmlspanelement interface for this element. attributes this element's attributes include the global attributes. dir the direction in which text should be rendered in this element's contents. possible values are: ltr: indicates that the text should go in a left-to-right direction. rtl: indicates that the text should go in a right-to-left direction. examples <!-- switch text direction --> <p>this text will go left to right.</p> <p><bdo dir="rtl">this text will go right to left.</bdo></p> result notes the html 4 specification did not specify events for this element; they were added ...
<bgsound>: The Background Sound element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › bgsound
while the page is used; use <audio> instead. do not use this! in order to embed audio in a web page, you should be using the <audio> element. attributes balance this attribute defines a number between -10,000 and +10,000 that determines how the volume will be divided between the speakers. loop this attribute indicates the number of times a sound is to be played and either has a numeric value or the keyword infinite. src this attribute specifies the url of the sound file to be played, which must be one of the following types: .wav, .au, or .mid. volume this attribute defines a number between -10,000 and 0 that determines the loudness of a page's background sound. example <bgsound src="sound1.mid"> <bgsound src="sound2.au" loop="infinite"> usage notes historically, the <embe...
<caption>: The Table Caption element - HTML: Hypertext Markup Language
Web › HTML › Element › caption
ement attributes this element includes the global attributes. deprecated attributes the following attributes are deprecated and should not be used. they are documented below for reference when updating existing code and for historical interest only. align this enumerated attribute indicates how the caption must be aligned with respect to the table. it may have one of the following values: left the caption is displayed to the left of the table. top the caption is displayed above the table. right the caption is displayed to the right of the table. bottom the caption is displayed below the table. usage note: do not use this attribute, as it has been deprecated. the <caption> element should be styled using the css properties caption-side and text-align. usa...
<command>: The HTML Command element - HTML: Hypertext Markup Language
Web › HTML › Element › command
icon gives a picture which represents the command. label the name of the command as shown to the user. radiogroup this attribute gives the name of the group of commands, with a type of radio, that will be toggled when the command itself is toggled. this attribute must be omitted unless the type attribute is radio. type this attribute indicates the kind of command. this can be one of three values. command or empty which is the default state and indicates that this is a normal command. checkbox indicates that the command can be toggled using a checkbox. radio indicates that the command can be toggled using a radio button. examples <command type="command" label="save" icon="icons/save.png" onclick="save()"> specifications specification ...
<datalist>: The HTML Data List element - HTML: Hypertext Markup Language
Web › HTML › Element › datalist
licit aria role listbox permitted aria roles no role permitted dom interface htmldatalistelement attributes this element has no other attributes than the global attributes, common to all elements. examples <label for="mybrowser">choose a browser from this list:</label> <input list="browsers" id="mybrowser" name="mybrowser" /> <datalist id="browsers"> <option value="chrome"> <option value="firefox"> <option value="internet explorer"> <option value="opera"> <option value="safari"> <option value="microsoft edge"> </datalist> result specifications specification status comment html living standardthe definition of '<datalist>' in that specification. living standard html5the definition of '<datalist>' i...
<del>: The Deleted Text element - HTML: Hypertext Markup Language
Web › HTML › Element › del
ole no corresponding role permitted aria roles any dom interface htmlmodelement attributes this element's attributes include the global attributes. cite a uri for a resource that explains the change (for example, meeting minutes). datetime this attribute indicates the time and date of the change and must be a valid date string with an optional time. if the value cannot be parsed as a date with an optional time string, the element does not have an associated time stamp. for the format of the string without a time, see date strings. the format of the string if it includes both date and time is covered in local date and time strings. examples <p><del>this text has been deleted</del>, here is the rest of the paragraph.</p> <del><p>this paragraph has been ...
<dir>: The Directory element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › dir
...
<font> - HTML: Hypertext Markup Language
Web › HTML › Element › font
is attribute contains a comma-separated list of one or more font names. the document text in the default style is rendered in the first font face that the client's browser supports. if no font listed is installed on the local system, the browser typically defaults to the proportional or fixed-width font for that system. size this attribute specifies the font size as either a numeric or relative value. numeric values range from 1 to 7 with 1 being the smallest and 3 the default. it can be defined using a relative value, like +2 or -3, which set it relative to the value of the size attribute of the <basefont> element, or relative to 3, the default value, if none does exist. dom interface this element implements the htmlfontelement interface. ...
<hr>: The Thematic Break (Horizontal Rule) element - HTML: Hypertext Markup Language
Web › HTML › Element › hr
it must have start tag, but must not have an end tag. permitted parents any element that accepts flow content. implicit aria role separator permitted aria roles presentation or none dom interface 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...
<html>: The HTML Document / Root element - HTML: Hypertext Markup Language
Web › HTML › Element › html
resource manifest indicating resources that should be cached locally. see using the application cache for details. version specifies the version of the html document type definition that governs the current document. this attribute is not needed, because it is redundant with the version information in the document type declaration. xmlns specifies the xml namespace of the document. default value is "http://www.w3.org/1999/xhtml". this is required in documents parsed with xml parsers, and optional in text/html documents. example <!doctype html> <html lang="en"> <head>...</head> <body>...</body> </html> accessibility concerns providing a lang attribute with a valid ietf identifying language tag on the <html> element will help screen reading technology determine the proper languag...
<input type="datetime"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › datetime
...
<ins> - HTML: Hypertext Markup Language
Web › HTML › Element › ins
es any dom interface htmlmodelement attributes this element includes the global attributes. cite this attribute defines the uri of a resource that explains the change, such as a link to meeting minutes or a ticket in a troubleshooting system. datetime this attribute indicates the time and date of the change and must be a valid date with an optional time string. if the value cannot be parsed as a date with an optional time string, the element does not have an associated time stamp. for the format of the string without a time, see format of a valid date string. the format of the string if it includes both date and time is covered in format of a valid local date and time string. examples <ins>this text has been inserted</ins> result accessibility concerns the p...
<isindex> - HTML: Hypertext Markup Language
Web › HTML › Element › isindex
pages matching the query. its support depended on both the browser and the server to react to the query. <isindex> is removed html standard. it was deprecated in html 4.01. the same behaviour can be achieved with an html form. all major browsers have now removed <isindex>. attributes like all other html elements, this element accepted the global attributes. prompt this attribute added its value as a prompt for text field. action this attribute determined the server url to which the query was sent. example <head> <isindex prompt="search document..." action="/search"> </head> in past browsers, this would generate, at parse time, a dom tree equivalent to the following html: <form action="/search"> <hr> <label> search document... <input name="isindex"> </label> <hr>...
<listing> - HTML: Hypertext Markup Language
Web › HTML › Element › listing
nd may be rendered by conforming user-agents as the <pre> element, which will interpret the internal html! instead use the <pre> element or if semantically adequate the <code> element, eventually escaping the html '<' and '>' so that they don't get interpreted. a monospaced font can also be obtained on a simple <div> element, by applying an adequate css style using monospace as the generic-font value in a font-family property. attributes this element has no other attributes than the global attributes, common to all elements. dom interface this element implements the htmlelement interface. implementation note: up to gecko 1.9.2 inclusive, firefox implements the htmlspanelement interface for this element. browser compatibility the compatibility table in this page is generated from st...
<map> - HTML: Hypertext Markup Language
Web › HTML › Element › map
d parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlmapelement attributes this element includes the global attributes. name the name attribute gives the map a name so that it can be referenced. the attribute must be present and must have a non-empty value with no space characters. the value of the name attribute must not be a compatibility-caseless match for the value of the name attribute of another <map> element in the same document. if the id attribute is also specified, both attributes must have the same value. examples <map name="primary"> <area shape="circle" coords="75,75,75" href="left.html"> <area shape="circle" coords="275,75,75" ...
<menuitem> - HTML: Hypertext Markup Language
Web › HTML › Element › menuitem
sed to provide a picture to represent the command. label the name of the command as shown to the user. required when a command attribute is not present. radiogroup this attribute specifies the name of a group of commands to be toggled as radio buttons when selected. may only be used where the type attribute is radio. type this attribute indicates the kind of command, and can be one of three values. command: a regular command with an associated action. this is the missing value default. checkbox: represents a command that can be toggled between two different states. radio: represent one selection from a group of commands that can be toggled as radio buttons. example html content <!-- a <div> element with a context menu --> <div contextmenu="popup-menu"> right-click to see...
theme-color - HTML: Hypertext Markup Language
Web › HTML › Element › meta › name › theme-color
if specified, the content attribute must contain a valid css <color>. example <meta name="theme-color" content="#4285f4"> the following image shows the effect that the <meta> element above will have on a document displayed in chrome running on an android mobile device. image credit: from icons & browser colors, created and shared by google and used according to terms described in the creative commons 4.0 attribution license. ...
<plaintext>: The Plain Text element (Deprecated) - HTML: Hypertext Markup Language
stead serve a text file with the text/plain mime-type. instead of <plaintext>, use the <pre> element or, if semantically accurate (such as for inline text), the <code> element. escape any <, > and & characters, to prevent browsers inadvertently parsing content the element content as html. a monospaced font can be applied to any html element via a css font-family style with the monospace generic value. attributes this element has no other attributes than the global attributes common to all elements. dom interface this element implements the htmlelement interface. implementation note: in gecko 1.9.2 and before, firefox implements the interface htmlspanelement for this element. ...
<q>: The Inline Quotation element - HTML: Hypertext Markup Language
Web › HTML › Element › q
ng content. implicit aria role no corresponding role permitted aria roles any dom interface htmlquoteelement usage note: most modern browsers will automatically add quotation marks around text inside a <q> element. a style rule may be needed to add quotation marks in older browsers. attributes this element includes the global attributes. cite the value of this attribute is a url that designates a source document or message for the information quoted. this attribute is intended to point to information explaining the context or the reference for the quote. example <p>according to mozilla's website, <q cite="https://www.mozilla.org/about/history/details/">firefox 1.0 was released in 2004 and became a big success.</q></p> specification...
<span> - HTML: Hypertext Markup Language
Web › HTML › Element › span
it should be used only when no other semantic element is appropriate. <span> is very much like a <div> element, but <div> is a block-level element whereas a <span> is an inline element. the source for this interactive example is stored in a github repository. ...
<template>: The Content Template element - HTML: Hypertext Markup Language
Web › HTML › Element › template
implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmltemplateelement attributes this element only includes the global attributes. however, the htmltemplateelement has a content property, which is a read-only documentfragment containing the dom subtree which the template represents. note that directly using the value of the content could lead to unexpected behavior, see avoiding documentfragment pitfall section below. examples first we start with the html portion of the example. <table id="producttable"> <thead> <tr> <td>upc_code</td> <td>product_name</td> </tr> </thead> <tbody> <!-- existing data could optionally be included here --> </tbody> </table> <template id="product...
<u>: The Unarticulated Annotation (Underline) element - HTML: Hypertext Markup Language
Web › HTML › Element › u
ext has strong importance <cite> to mark the titles of books or other publications <i> to denote technical terms, transliterations, thoughts, or names of vessels in western texts to provide textual annotations (as opposed to the non-textual annotations created with <u>), use the <ruby> element. to apply an underlined appearance without any semantic meaning, use the text-decoration property's value underline. examples indicating a spelling error this example uses the <u> element and some css to display a paragraph which includes a misspelled error, with the error indicated in the red wavy underline style which is fairly commonly used for this purpose. html <p>this paragraph includes a <u class="spelling">wrnogly</u> spelled word.</p> in the html, we see the use of <u> with a class, sp...
<ul>: The Unordered List element - HTML: Hypertext Markup Language
Web › HTML › Element › ul
e global attributes. compact this boolean attribute hints that the list should be rendered in a compact style. the interpretation of this attribute depends on the user agent, and it doesn't work in all browsers. warning: do not use this attribute, as it has been deprecated: use css instead. to give a similar effect as the compact attribute, the css property line-height can be used with a value of 80%. type this attribute sets the bullet style for the list. the values defined under html3.2 and the transitional version of html 4.0/4.01 are: circle disc square a fourth bullet type has been defined in the webtv interface, but not all browsers support it: triangle. if not present and if no css list-style-type property applies to the element, the user agent selects a b...
<xmp> - HTML: Hypertext Markup Language
Web › HTML › Element › xmp
plemented in a consistent way. it was completely removed from the language in html5. use the <pre> element or, if semantically adequate, the <code> element instead. note that you will need to escape the '<' character as '&lt;' to make sure it is not interpreted as markup. a monospaced font can also be obtained on any element, by applying an adequate css style using monospace as the generic-font value for the font-family property. attributes this element has no other attributes than the global attributes, common to all elements. dom interface this element implements the htmlelement interface. implementation note: up to gecko 1.9.2 inclusive, firefox implements the htmlspanelement interface for this element. ...
data-* - HTML: Hypertext Markup Language
the * may be replaced by any name following the production rule of xml names with the following restrictions: the name must not start with xml, whatever case is used for these letters; the name must not contain any semicolon (u+003a); the name must not contain capital letters. note that the htmlelement.dataset property is a domstringmap, and the name of the custom data attribute data-test-value will be accessible via htmlelement.dataset.testvalue (or by htmlelement.dataset["testvalue"]) as any dash (u+002d) is replaced by the capitalization of the next letter, converting the name to camelcase. usage by adding data-* attributes, even ordinary html elements can become rather complex and powerful program-objects. for example, a space-ship "sprite" in a game could be a simple <img> elemen...
draggable - HTML: Hypertext Markup Language
the draggable global attribute is an enumerated attribute that indicates whether the element can be dragged, either with native browser behavior or the html drag and drop api. draggable can have the following values: true: the element can be dragged. false: the element cannot be dragged. this attribute is enumerated and not boolean. a value of true or false is mandatory, and shorthand like <img draggable> is forbidden. the correct usage is <img draggable="false">. if this attribute is not set, its default value is auto, which means drag behavior is the default browser behavior: only text selections, images, and links can be dragged. for other elements, the event ondragstart must be set for drag and drop to work, as shown in this comprehensive example. specifications specif...
dropzone - HTML: Hypertext Markup Language
move, which indicates that the element that was dragged will be moved to this new location. link, which will create a link to the dragged data. ...
hidden - HTML: Hypertext Markup Language
they are not useful on their own, they could be written in such a way that they are useful in the specific context of being referenced from the element that they describe. similarly, a canvas element with the hidden attribute could be used by a scripted graphics engine as an off-screen buffer, and a form control could refer to a hidden form element using its form attribute. note: changing the value of the css display property on an element with the hidden attribute overrides the behavior. for instance, elements styled display: flex will be displayed despite the hidden attribute's presence. specifications specification status comment html living standardthe definition of 'hidden' in that specification. living standard no change from latest snapshot, html 5.1 ...
x-ms-acceleratorkey - HTML: Hypertext Markup Language
t provide the accelerator key behavior. you must provide javascript event handlers, like onkeypress, onkeydown, or onkeyup, to listen for your declared accelerator keys and activate the element accordingly. to provide a keyboard shortcut for an element that does not need javascript, use the accesskey attribute. syntax <button x-ms-acceleratorkey="[explanation of key combination]">…</button> value the accelerator key combination. for example: "ctrl+b" for a combination of the ctrl and b keys. "j" for just the j key. "ctrl+; then k" for a shortcut similar to fogbugz’s old keyboard mode. this approach is more complicated, but does not override existing keyboard shortcuts provided by the user’s browser or operating system. ...
x-ms-format-detection - HTML: Hypertext Markup Language
bute determines whether data formats within the element’s text, like phone numbers, are automatically converted to followable links. existing links, such as ones with the tel: scheme, are unaffected. links created through format detection do not appear in the dom. this proprietary property is specific to internet explorer and microsoft edge. syntax <html x-ms-format-detection="none"> value all all supported data formats are detected. none format detection is turned off. phone phone number patterns are autolinked. ...
Inline elements - HTML: Hypertext Markup Language
lor:#ee3; } rendered using the same css as before, we get: see the difference? the <p> element totally changes the layout of the text, splitting it into three segments: the text before the <p>, then the <p>'s text, and finally the text following the <p>. changing element levels you can change the visual presentation of an element using the css display property. for example, by changing the value of display from "inline" to "block", you can tell the browser to render the inline element in a block box rather than an inline box, and vice versa. however, doing this will not change the category and the content model of the element. for example, even if the display of the span element is changed to "block", it still would not allow to nest a div element inside it. conceptual differences in b...
Reason: invalid token ‘xyz’ in CORS header ‘Access-Control-Allow-Headers’ - HTTP
t wrong? the response to the cors request that was sent by the server includes an access-control-allow-headers header which includes at least one invalid header name. the access-control-allow-headers header is sent by the server in response to a preflight request; it lets the client know which http headers are permitted in cors requests. if the client user agent finds among the comma-delineated values provided by the header any header name it does not recognize, this error occurs. this is a problem that most likely can only be fixed on the server side, by modifying the server's configuration to no longer send the invalid or unknown header name with the access-control-allow-headers header. it may also be worth checking to ensure that the user agent or http library you're using on the client i...
Reason: invalid token ‘xyz’ in CORS header ‘Access-Control-Allow-Methods’ - HTTP
token ‘xyz’ in cors header ‘access-control-allow-methods’ what went wrong? the response to the cors request that was sent by the server includes an access-control-allow-methods header which includes at least one invalid method name. the access-control-allow-methods header is sent by the server to let the client know what http request methods it supports for cors requests. the header's value is a comma-delineated string of http method names, such as get, post, or head. if any of the specified values are not recognized by the client user agent, this error occurs. this is a problem that most likely can only be fixed on the server side, by modifying the server's configuration to no longer send the invalid or unknown method name with the access-control-allow-methods header. it may also ...
Reason: missing token ‘xyz’ in CORS header ‘Access-Control-Allow-Headers’ from CORS preflight channel - HTTP
reason reason: missing token ‘xyz’ in cors header ‘access-control-allow-headers’ from cors preflight channel what went wrong? the access-control-allow-headers header is sent by the server to let the client know which headers it supports for cors requests. the value of access-control-allow-headers should be a comma-delineated list of header names, such as "x-custom-information" or any of the standard but non-basic header names (which are always allowed). this error occurs when attempting to preflight a header that is not expressly allowed (that is, it's not included in the list specified by the access-control-allow-headers header sent by the server). to fix this, the server needs to be updated so that it allows the indicated header, or you need to avoid using that header. ...
Reason: Multiple CORS header 'Access-Control-Allow-Origin' not allowed - HTTP
eason reason: multiple cors header ‘access-control-allow-origin’ not allowed what went wrong? more than one access-control-allow-origin header was sent by the server. this isn't allowed. if you have access to the server you can change your implementation to echo back an origin in the access-control-allow-origin header. you cannot send back a list of origins, because browsers only accept a value that is either a single origin or null ...
Content Security Policy (CSP) - HTTP
Web › HTTP › CSP
but also marking all cookies with the secure attribute and providing automatic redirects from http pages to their https counterparts. sites may also use the strict-transport-security http header to ensure that browsers connect to them only over an encrypted channel. using csp configuring content security policy involves adding the content-security-policy http header to a web page and giving it values to control what resources the user agent is allowed to load for that page. for example, a page that uploads and displays images could allow images from anywhere, but restrict a form action to a specific endpoint. a properly designed content security policy helps protect a page against a cross site scripting attack. this article explains how to construct such headers properly, and provides exampl...
Cross-Origin Resource Policy (CORP) - HTTP
niff mime types. usage note: due to a bug in chrome, setting cross-origin-resource-policy can break pdf rendering, preventing visitors from being able to read past the first page of some pdfs. exercise caution using this header in a production environment. web applications set a cross-origin resource policy via the cross-origin-resource-policy http response header, which accepts one of three values: same-site only requests from the same site can read the resource. warning: this is less secure than an origin. the algorithm for checking if two origins are same site is defined in the html standard and involves checking the registrable domain. same-origin only requests from the same origin (i.e. scheme + host + port) can read the resource. cross-origin requests from any origi...
Feature Policy - HTTP
isabled. newly introduced features may have an explicit api to signal the state. existing features that later integrate with feature policy will typically use existing mechanisms. some approaches include: return "permission denied" for javascript apis that require user permission grants. return false or error from an existing javascript api that provides access to feature. change the default values or options that control the feature behavior. the current set of policy-controlled features fall into two broad categories: enforcing best practices for good user experiences. providing granular control over sensitive or powerful features. best practices for good user experiences there are several policy-controlled features to help enforce best practices for providing good performance a...
Accept-CH-Lifetime - HTTP
header type response header forbidden header name ? note: client hints are accessible only on secure origins (via tls). ...
Accept-Ranges - HTTP
in presence of an accept-ranges header, the browser may try to resume an interrupted download, rather than to start it from the start again. header type response header forbidden header name no syntax accept-ranges: <range-unit> accept-ranges: none directives <range-unit> defines the range unit the server supports. ...
Access-Control-Allow-Headers - HTTP
the request has an access-control-request-headers header. header type response header forbidden header name no syntax access-control-allow-headers: <header-name>[, <header-name>]* access-control-allow-headers: * directives <header-name> the name of a supported request header. the header may list any number of headers, separated by commas. * (wildcard) the value "*" only counts as a special wildcard value for requests without credentials (requests without http cookies or http authentication information). in requests with credentials, it is treated as the literal header name "*" without special semantics. note that the authorization header can't be wildcarded and always needs to be listed explicitly. examples a custom header here's an example of what ...
Access-Control-Allow-Methods - HTTP
sponse header specifies the method or methods allowed when accessing the resource in response to a preflight request. header type response header forbidden header name no syntax access-control-allow-methods: <method>, <method>, ... access-control-allow-methods: * directives <method> comma-delimited list of the allowed http request methods. * (wildcard) the value "*" only counts as a special wildcard value for requests without credentials (requests without http cookies or http authentication information). in requests with credentials, it is treated as the literal method name "*" without special semantics. examples access-control-allow-methods: post, get, options access-control-allow-methods: * specifications specification status comme...
Access-Control-Max-Age - HTTP
type response header forbidden header name no syntax access-control-max-age: <delta-seconds> directives <delta-seconds> maximum number of seconds the results can be cached. uxp caps this at 24 hours (86400 seconds). chromium (prior to v76) caps at 10 minutes (600 seconds). chromium (starting in v76) caps at 2 hours (7200 seconds). chromium also specifies a default value of 5 seconds. a value of -1 will disable caching, requiring a preflight options check for all calls. examples cache results of a preflight request for 10 minutes: access-control-max-age: 600 specifications specification status comment fetchthe definition of 'access-control-max-age' in that specification. living standard initial definition. ...
Alt-Svc - HTTP
Web › HTTP › Headers › Alt-Svc
the alt-svc http response header is used to advertise alternative services through which the same resource can be reached. an alternative service is defined by a protocol/host/port combination. syntax alt-svc: clear alt-svc: <protocol-id>=<alt-authority>; ma=<max-age> alt-svc: <protocol-id>=<alt-authority>; ma=<max-age>; persist=1 clear the special value ''clear" indicates that the origin requests all alternatives for that origin to be invalidated. <protocol-id> the alpn protocol identifier. examples include h2 for http/2 and h3-25 for draft 25 of the http/3 protocol. <alt-authority> the quoted string specifying the alternative authority which consists of an optional host override, a colon, and a mandatory port number. ma=<max-age>optional the number of seconds for which the altern...
Connection - HTTP
connection-specific header fields such as connection and keep-alive are prohibited in http/2. chrome and firefox ignore them in http/2 responses, but safari conforms to the http/2 spec requirements and won’t load any response which contains them. ...
Content-Language - HTTP
nt is intended for all language audiences. multiple language tags are also possible, as well as applying the content-language header to various media types and not only to textual documents. header type entity header forbidden header name no cors-safelisted response header yes cors-safelisted request header yes, with the additional restriction that values can only be 0-9, a-z, a-z, space or *,-.;=. syntax content-language: de-de content-language: en-us content-language: de-de, en-ca directives language-tag multiple language tags are separated by comma. each language tag is a sequence of one or more case-insensitive subtags, each separated by a hyphen character ("-", %x2d). in most cases, a language tag consists of a primary language...
CSP: referrer - HTTP
e http content-security-policy (csp) referrer directive used to specify information in the referer header (with a single r as this was a typo in the original spec) for links away from a page. this api is deprecated and removed from browsers. use the referrer-policy header instead. syntax content-security-policy: referrer <referrer-policy>; where <referrer-policy> can be one of the following values: "no-referrer" the referer header will be omitted entirely. no referrer information is sent along with requests. "none-when-downgrade" this is the user agent's default behavior if no policy is specified. the origin is sent as referrer to a-priori as-much-secure destination (https->https), but isn't sent to a less secure destination (https->http). "origin" only send the origin of the docu...
CSP: report-to - HTTP
tore reporting endpoints for an origin. content-security-policy: ...; report-to groupname the directive has no effect in and of itself, but only gains meaning in combination with other directives. csp version 1 directive type reporting directive this directive is not supported in the <meta> element. syntax content-security-policy: report-to <json-field-value>; examples see content-security-policy-report-only for more information and examples. report-to: { "group": "csp-endpoint", "max_age": 10886400, "endpoints": [ { "url": "https://example.com/csp-reports" } ] }, { "group": "hpkp-endpoint", "max_age": 10886400, "endpoints": [ { "url": "https:...
CSP: sandbox - HTTP
including preventing popups, preventing the execution of plugins and scripts, and enforcing a same-origin policy. csp version 1.1 / 2 directive type document directive this directive is not supported in the <meta> element or by the content-security-policy-report-only header field. syntax content-security-policy: sandbox; content-security-policy: sandbox <value>; where <value> can optionally be one of the following values: allow-downloads-without-user-activation allows for downloads to occur without a gesture from the user. allow-forms allows the page to submit forms. if this keyword is not used, this operation is not allowed. allow-modals allows the page to open modal windows. allow-orientation-lock allows the page to disable the abili...
Cookie - HTTP
Web › HTTP › Headers › Cookie
the cookie http request header contains stored http cookies previously sent by the server with the set-cookie header. the cookie header is optional and may be omitted if, for example, the browser's privacy settings block cookies. header type request header forbidden header name yes syntax cookie: <cookie-list> cookie: name=value cookie: name=value; name2=value2; name3=value3 <cookie-list> a list of name-value pairs in the form of <cookie-name>=<cookie-value>. pairs in the list are separated by a semicolon and a space ('; '). examples cookie: phpsessid=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1 specifications specification title rfc 6265, section 5.4: cookie http state management mechanism ...
Device-Memory - HTTP
ate amount of ram client device has. header type request header forbidden header name ? note: client hints are accessible only on secure origins (via tls). server has to opt in to receive device-memory header from the client by sending accept-ch and accept-ch-lifetime response headers. syntax the amount of device ram can be used as a fingerprinting variable, so values for the header are intentionally coarse to reduce the potential for its misuse. the header takes on the following values: 0.25, 0.5, 1, 2, 4, 8. device-memory: <number> examples server first needs to opt in to receive device-memory header by sending the response headers accept-ch containing device-memory and accept-ch-lifetime. accept-ch: device-memory accept-ch-lifetime: 86400 then on su...
Expect-CT - HTTP
e 2021. header type response header forbidden header name yes syntax expect-ct: report-uri="<uri>", enforce, max-age=<age> directives max-age the number of seconds after reception of the expect-ct header field during which the user agent should regard the host of the received message as a known expect-ct host. if a cache receives a value greater than it can represent, or if any of its subsequent calculations overflows, the cache will consider this value to be either 2,147,483,648 (231) or the greatest positive integer it can represent. report-uri="<uri>" optional the uri where the user agent should report expect-ct failures. when present with the enforce directive, the configuration is referred to as an "enforce-and-report...
Expires - HTTP
Web › HTTP › Headers › Expires
if there is a cache-control header with the max-age or s-maxage directive in the response, the expires header is ignored. header type response header forbidden header name no cors-safelisted response header yes syntax expires: <http-date> directives <http-date> an http-date timestamp. ...
Forwarded - HTTP
ies. host=<host> the host request header field as received by the proxy. proto=<http|https> indicates which protocol was used to make the request (typically "http" or "https"). examples using the forwarded header forwarded: for="_mdn" # case insensitive forwarded: for="[2001:db8:cafe::17]:4711" # separated by semicolon forwarded: for=192.0.2.60;proto=http;by=203.0.113.43 # multiple values can be appended using a comma forwarded: for=192.0.2.43, for=198.51.100.17 transitioning from x-forwarded-for to forwarded if your application, server, or proxy supports the standardized forwarded header, the x-forwarded-for header can be replaced. note that ipv6 address are quoted and enclosed in square brackets in forwarded. x-forwarded-for: 123.34.567.89 forwarded: for=123.34.567.89 x-fo...
Large-Allocation - HTTP
the web content in the to-be-loaded page is going to want to perform a large contiguous memory allocation and the browser can react to this header by starting a dedicated process for the to-be-loaded document, for example. header type response header forbidden header name no syntax large-allocation: 0 large-allocation: <megabytes> directives 0 0 is a special value which represents uncertainty as to what the size of the allocation is. <megabytes> the expected size of the allocation to be performed, in megabytes. examples large-allocation: 0 large-allocation: 500 troubleshooting errors the large-allocation header throws warnings or error messages when used incorrectly. you'll encounter them in the web console. this page was loaded in a new process...
Public-Key-Pins-Report-Only - HTTP
the header is silently ignored in modern browsers as support for hpkp has been removed. use certificate transparency and the expect-ct header instead. for more information, see the public-key-pins header reference page and the http public key pinning article. header type response header forbidden header name no syntax public-key-pins-report-only: pin-sha256="<pin-value>"; max-age=<expire-time>; includesubdomains; report-uri="<uri>" directives pin-sha256="<pin-value>" the quoted string is the base64 encoded subject public key information (spki) fingerprint. it is possible to specify multiple pins for different public keys. some browsers might allow other hashing algorithm...
Public-Key-Pins - HTTP
b server to decrease the risk of mitm attacks with forged certificates, however, it has been removed from modern browsers and is no longer supported. use certificate transparency and expect-ct header instead. for more information, see the http public key pinning article. header type response header forbidden header name no syntax public-key-pins: pin-sha256="<pin-value>"; max-age=<expire-time>; includesubdomains; report-uri="<uri>" directives pin-sha256="<pin-value>" the quoted string is the base64 encoded subject public key information (spki) fingerprint. it is possible to specify multiple pins for different public keys. some browsers might allow other hashing algorithms than sha-256 in the future. max-a...
Range - HTTP
Web › HTTP › Headers › Range
d> range: <unit>=<range-start>-<range-end>, <range-start>-<range-end>, <range-start>-<range-end> range: <unit>=-<suffix-length> directives <unit> the unit in which ranges are specified. this is usually bytes. <range-start> an integer in the given unit indicating the beginning of the request range. <range-end> an integer in the given unit indicating the end of the requested range. this value is optional and, if omitted, the end of the document is taken as the end of the range. <suffix-length> an integer in the given unit indicating the number of units at the end of the file to return. examples requesting three ranges from the file. range: bytes=200-1000, 2000-6576, 19000- requesting the first 500 and last 500 bytes of the file. the request may be rejected by the server if the...
Save-Data - HTTP
the save-data header field is a boolean which, in requests, indicates the client's preference for reduced data usage. this could be for reasons such as high transfer costs, slow connection speeds, etc. a value of on indicates explicit user opt-in into a reduced data usage mode on the client, and when communicated to origins allows them to deliver alternative content to reduce the data downloaded such as smaller image and video resources, different markup and styling, disabled polling and automatic updates, and so on. note: disabling http/2 server push (rfc 7540, section 8.2: server push) might be desirable too for reducing data downloads. syntax save-data: <sd-token> directives <sd-token> a numerical value indicating whether the client wants to opt in to reduced data usage mode. on ...
Sec-Fetch-Dest - HTTP
tch-dest: image sec-fetch-dest: manifest sec-fetch-dest: nested-document sec-fetch-dest: object sec-fetch-dest: paintworklet sec-fetch-dest: report sec-fetch-dest: script sec-fetch-dest: serviceworker sec-fetch-dest: sharedworker sec-fetch-dest: style sec-fetch-dest: track sec-fetch-dest: video sec-fetch-dest: worker sec-fetch-dest: xslt sec-fetch-dest: audioworklet sec-fetch-dest: audioworklet values audio audioworklet document embed empty font image manifest object paintworklet report script serviceworker sharedworker style track video worker xslt nested-document examples todo specifications specification title fetch metadata request headers the sec-fetch-dest http request header ...
Sec-Fetch-Mode - HTTP
-fetch-mode fetch metadata header indicates the request's mode. ...
Sec-Fetch-Site - HTTP
hip between a request initiator's origin and the origin of the resource. header type fetch metadata request header forbidden header name yes, since it has prefix sec- cors-safelisted response header cors-safelisted request header syntax sec-fetch-site: cross-site sec-fetch-site: same-origin sec-fetch-site: same-site sec-fetch-site: none values cross-site same-origin same-site none this request does not relate to any context like site, origin, or frame. this can happen when user had initiated this request by, e.g. directly entering a url in the address bar, opening a bookmark, or draging-and-dropping a file into the browser window. examples todo specifications specification title fetch metadat...
Sec-Fetch-User - HTTP
the sec-fetch-user fetch metadata header indicates whether or not a navigation request was triggered by a user activation. header type fetch metadata request header forbidden header name yes, since it has prefix sec- cors-safelisted request header syntax sec-fetch-user: ?0 sec-fetch-user: ?1 values the value is a boolean structured header. ?0 the navigation request was triggered by a user activation. ?1 the navigation request was triggered by something other than a user activation. examples todo specifications specification title fetch metadata request headers the sec-fetch-user http request header ...
Sec-WebSocket-Accept - HTTP
cept header is used in the websocket opening handshake. it would appear in the response headers. that is, this is header is sent from server to client to inform that server is willing to initiate a websocket connection. header type response header forbidden header name no syntax sec-websocket-accept: <hashed key> directives <hashed key> the server takes the value of the sec-websocket-key sent in the handshake request, appends 258eafa5-e914-47da-95ca-c5ab0dc85b11, takes sha-1 of the new value, and is then base64 encoded. examples sec-websocket-accept: s3pplmbitxaq9kygzzhzrbk+xoo= specification specification title rfc 6455, section 11.3.3: sec-websocket-accept the websocket protocol ...
Server - HTTP
Web › HTTP › Headers › Server
the server header describes the software used by the origin server that handled the request — that is, the server that generated the response. avoid overly-detailed server values, as they can reveal information that might make it (slightly) easier for attackers to exploit known security holes. header type response header forbidden header name no syntax server: <product> directives <product> the name of the software or product that handled the request. usually in a format similar to user-agent. how much detail to include is an interesting balance to strike; exposing the os version is probably a bad idea, as mentioned in the earlier warning about overly-detailed values. however, exposed apache versions helped browsers work around a bug those vers...
Timing-Allow-Origin - HTTP
header type response header forbidden header name no syntax timing-allow-origin: * timing-allow-origin: <origin>[, <origin>]* directives * the server may specify "*" as a wildcard, thereby allowing any origin to see timing resources. <origin> specifies a uri that may see the timing resources. you can specify multiple origins, separated by commas. ...
WWW-Authenticate - HTTP
harset="utf-8"] directives <type> authentication type. a common type is "basic". iana maintains a list of authentication schemes. realm=<realm> a description of the protected area. if no realm is specified, clients often display a formatted hostname instead. charset=<charset> tells the client the server's prefered encoding scheme when submitting a username and password. the only allowed value is the case insensitive string "utf-8". this does not relate to the encoding of the realm string. examples typically, a server response contains a www-authenticate header that looks like these: www-authenticate: basic www-authenticate: basic realm="access to the staging site", charset="utf-8" see also http authentication for examples on how to configure apache or nginx servers to password ...
X-Frame-Options - HTTP
" configuring nginx to configure nginx to send the x-frame-options header, add this either to your http, server or location configuration: add_header x-frame-options sameorigin always; configuring iis to configure iis to send the x-frame-options header, add this to your site's web.config file: <system.webserver> ... <httpprotocol> <customheaders> <add name="x-frame-options" value="sameorigin" /> </customheaders> </httpprotocol> ... </system.webserver> or see this microsoft support article on setting this configuration using the iis manager user interface. configuring haproxy to configure haproxy to send the x-frame-options header, add this to your front-end, listen, or backend configuration: rspadd x-frame-options:\ sameorigin alternatively, in newer versi...
OPTIONS - HTTP
Web › HTTP › Methods › OPTIONS
ess-control-allow-origin the https://foo.example origin is permitted to request the bar.example/resources/post-here/ url via the following: access-control-allow-methods post, get, and options are permitted methods for the url. (this header is similar to the allow response header, but used only for cors.) access-control-allow-headers any script inspecting the response is permitted to read the values of the x-pingother and content-type headers. access-control-max-age the above permissions may be cached for 86,400 seconds (1 day). http/1.1 204 no content date: mon, 01 dec 2008 01:15:39 gmt server: apache/2.0.61 (unix) access-control-allow-origin: https://foo.example access-control-allow-methods: post, get, options access-control-allow-headers: x-pingother, content-type access-control-max-...
TRACE - HTTP
Web › HTTP › Methods › TRACE
loop-back test along the path to the target resource, providing a useful debugging mechanism. the final recipient of the request should reflect the message received, excluding some fields described below, back to the client as the message body of a 200 (ok) response with a content-type of message/http. the final recipient is either the origin server or the first server to receive a max-forwards value of 0 in the request. request has body no successful response has body no safe no idempotent yes cacheable no allowed in html forms no syntax trace /index.html specifications specification title rfc 7231, section 4.3.8: trace hypertext transfer protocol (http/1.1): semantics and content ...
An overview of HTTP - HTTP
Web › HTTP › Overview
the http/1.1 format. there are two types of http messages, requests and responses, each with its own format. requests an example http request: requests consists of the following elements: an http method, usually a verb like get, post or a noun like options or head that defines the operation the client wants to perform. typically, a client wants to fetch a resource (using get) or post the value of an html form (using post), though more operations may be needed in other cases. the path of the resource to fetch; the url of the resource stripped from elements that are obvious from the context, for example without the protocol (http://), the domain (here, developer.mozilla.org), or the tcp port (here, 80). the version of the http protocol. optional headers that convey additional informat...
HTTP resources and specifications - HTTP
l scheme proposed standard rfc 3986 uniform resource identifier (uri): generic syntax internet standard rfc 5988 web linking defines the link header proposed standard experimental spec hypertext transfer protocol (http) keep-alive header informational (expired) draft spec http client hints ietf draft rfc 7578 returning values from forms: multipart/form-data proposed standard rfc 6266 use of the content-disposition header field in the hypertext transfer protocol (http) proposed standard rfc 2183 communicating presentation information in internet messages: the content-disposition header field only a subset of syntax of the content-disposition header can be used in the context of http m...
203 Non-Authoritative Information - HTTP
Web › HTTP › Status › 203
the http 203 non-authoritative information response status indicates that the request was successful but the enclosed payload has been modified by a transforming proxy from that of the origin server's 200 (ok) response . the 203 response is similar to the value 214, meaning transformation applied, of the warning header code, which has the additional advantage of being applicable to responses with any status code. status 203 non-authoritative information specifications specification title rfc 7231, section 6.3.4: 203 non-authoritative information hypertext transfer protocol (http/1.1): semantics and content ...
406 Not Acceptable - HTTP
Web › HTTP › Status › 406
proactive content negotiation headers include: accept accept-charset accept-encoding accept-language in practice, this error is very rarely used. ...
412 Precondition Failed - HTTP
Web › HTTP › Status › 412
avoiding mid-air collisions with the help of the etag and the if-match headers, you can detect mid-air edit collisions. for example, when editing mdn, the current wiki content is hashed and put into an etag in the response: etag: "33a64df551425fcc55e4d42a148795d9f25f89d4" when saving changes to a wiki page (posting data), the post request will contain the if-match header containing the etag values to check freshness against. if-match: "33a64df551425fcc55e4d42a148795d9f25f89d4" if the hashes don't match, it means that the document has been edited in-between and a 412 precondition failed error is thrown. specifications specification title rfc 7232, section 4.2: 412 precondition failed hypertext transfer protocol (http/1.1): conditional requests ...
416 Range Not Satisfiable - HTTP
Web › HTTP › Status › 416
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. ...
HTTP
Web › HTTP
ent-server protocol: what it can do and its intended uses. http cache caching is very important for fast web sites. this article describes different methods of caching and how to use http headers to control them. http cookies how cookies work is defined by rfc 6265. when serving an http request, a server can send a set-cookie http header with the response. the client then returns the cookie's value with every request to the same server in the form of a cookie request header. the cookie can also be set to expire on a certain date, or restricted to a specific domain and path. cross-origin resource sharing (cors) cross-site http requests are http requests for resources from a different domain than the domain of the resource making the request. for instance, an html page from domain a (http:/...
Enumerability and ownership of properties - JavaScript
not available without extra code obtaining properties by enumerability/ownership note that this is not the most efficient algorithm for all cases, but useful for a quick demonstration. ...
Introduction - JavaScript
typing and strong type checking. javascript follows most java expression syntax, naming conventions and basic control-flow constructs which was the reason why it was renamed from livescript to javascript. in contrast to java's compile-time system of classes built by declarations, javascript supports a runtime system based on a small number of data types representing numeric, boolean, and string values. javascript has a prototype-based object model instead of the more common class-based object model. the prototype-based model provides dynamic inheritance; that is, what is inherited can vary for individual objects. javascript also supports functions without any special declarative requirements. functions can be properties of objects, executing as loosely typed methods. javascript is a very fre...
Character classes - JavaScript
matches a nul character. do not follow this with another digit. \cx matches a control character using caret notation, where "x" is a letter from a–z (corresponding to codepoints u+0001–u+001f). for example, /\cm/ matches "\r" in "\r\n". \xhh matches the character with the code hh (two hexadecimal digits). \uhhhh matches a utf-16 code-unit with the value hhhh (four hexadecimal digits). \u{hhhh} or \u{hhhhh} (only when the u flag is set.) matches the character with the unicode value u+hhhh or u+hhhhh (hexadecimal digits). \ indicates that the following character should be treated specially, or "escaped". it behaves one of two ways. for characters that are usually treated literally, indicates that the next ch...
Using Promises - JavaScript
result3) */ timing to avoid surprises, functions passed to...
constructor - JavaScript
nstructor(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) { this.height = value**0.5; this.width = value**0.5; } } another example here the prototype of square class is changed—but the constructor of its base class polygon is still called when a new instance of a square is created. class polygon { constructor() { this.name = "polygon"; } } class square extends polygon { constructor() { super(); } } class...
The legacy Iterator protocol - JavaScript
consider using for..of loops and the iterator protocol. the deprecated firefox-only iterator protocol firefox, prior to version 26 implemented another iterator protocol that is similar to the standard es2015 iterator protocol. an object is an legacy iterator when it implements a next() method with the following semantics, and throws stopiteration at the end of iteration. property value next a zero arguments function that returns an value. difference between 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. simple example with the old protocol function makeiterator(array){ ...
Deprecated and obsolete features - JavaScript
ble matches in a string, or only against the first. ignorecase whether or not to ignore case while attempting a match in a string. lastindex the index at which to start the next match. multiline whether or not to search in strings across multiple lines. source the text of the pattern. regexp methods the compile() method is deprecated. the valueof method is no longer specialized for regexp. use object.valueof(). function properties the caller and arguments properties are deprecated, because they leak the function caller. instead of the arguments property, you should use the arguments object inside function closures. legacy generator legacy generator function statement and legacy generator function expression are deprecated. use...
SyntaxError: return not in function - JavaScript
tside of function (edge) syntaxerror: return not in function (firefox) syntaxerror: yield not in function (firefox) error type syntaxerror. what went wrong? a return or yield statement is called outside of a function. maybe there are missing curly brackets somewhere? the return and yield statements must be in a function, because they end (or pause and resume) function execution and specify a value to be returned to the function caller. examples missing curly brackets var cheer = function(score) { if (score === 147) return 'maximum!'; }; if (score > 100) { return 'century!'; } } // syntaxerror: return not in function the curly brackets look correct at a first glance, but this code snippet is missing a { after the first if statement. correct would be: var cheer = functi...
TypeError: can't assign to property "x" on "y": not an object - JavaScript
the javascript strict mode exception "can't assign to property" occurs when attempting to create a property on primitive value such as a symbol, a string, a number or a boolean. primitive values cannot hold any property. message typeerror: can't assign to property "x" on {y}: not an object (firefox) typeerror: cannot create property 'x' on {y} (chrome) error type typeerror. what went wrong? in strict_mode, a typeerror is raised when attempting to create a property on primitive value such as a symbol, a string, a number or a boolean. primitive values cannot hold any property. the problem might be that an unexpected value is flowing at an unexpected place, or that an object variant of a string or a number is expected. examples invalid cases 'use strict'; var foo = "my string"; // the...
TypeError: can't define property "x": "obj" is not extensible - JavaScript
the "x" property is silently ignored. 'use strict'; var obj = {}; object.preventextensions(obj); obj.x = 'foo'; // typeerror: can't define property "x": "obj" is not extensible in both, strict mode and sloppy mode, a call to object.defineproperty() throws when adding a new property to a non-extensible object. var obj = { }; object.preventextensions(obj); object.defineproperty(obj, 'x', { value: "foo" } ); // typeerror: can't define property "x": "obj" is not extensible to fix this error, you will either need to remove the call to object.preventextensions() entirely, or move it to a position so that the property is added earlier and only later the object is marked as non-extensible. of course you can also remove the property that was attempted to be added, if you don't need it. 'use ...
TypeError: property "x" is non-configurable and can't be deleted - JavaScript
. in non-strict code, the operation returns false. examples attempting to delete non-configurable properties non-configurable properties are not super common, but they can be created using object.defineproperty() or object.freeze(). 'use strict'; var obj = object.freeze({name: 'elsa', score: 157}); delete obj.score; // typeerror 'use strict'; var obj = {}; object.defineproperty(obj, 'foo', {value: 2, configurable: false}); delete obj.foo; // typeerror 'use strict'; var frozenarray = object.freeze([0, 1, 2]); frozenarray.pop(); // typeerror there are also a few non-configurable properties built into javascript. maybe you tried to delete a mathematical constant. 'use strict'; delete math.pi; // typeerror ...
ReferenceError: invalid assignment left-hand side - JavaScript
n there was an unexpected assignment somewhere. for example, a single "=" sign was used instead of "==" or "===". message referenceerror: invalid assignment left-hand side error type referenceerror. what went wrong? there was an unexpected assignment somewhere. this might be due to a mismatch of a assignment operator and a comparison operator, for example. while a single "=" sign assigns a value to a variable, the "==" or "===" operators compare a value. examples typical invalid assignments if (math.pi = 3 || math.pi = 4) { console.log('no way!'); } // referenceerror: invalid assignment left-hand side var str = 'hello, ' += 'is it me ' += 'you\'re looking for?'; // referenceerror: invalid assignment left-hand side in the if statement, you want to use a comparison operator ("=="),...
RangeError: invalid date - JavaScript
the javascript exception "invalid date" occurs when a string leading to an invalid date has been provided to date or date.parse(). message rangeerror: invalid date (edge) rangeerror: invalid date (firefox) rangeerror: invalid time value (chrome) rangeerror: provided date is not in valid range (chrome) error type rangeerror what went wrong? a string leading to an invalid date has been provided to date or date.parse(). examples invalid cases unrecognizable strings or dates containing illegal element values in iso formatted strings usually return nan. however, depending on the implementation, non–conforming iso format strings, may also throw rangeerror: invalid date, like the following cases in firefox: new date('foo-bar 2014'); new date('2014-25-23').toisostring(); new date('foo-bar...
SyntaxError: for-in loop head declarations may not have initializers - JavaScript
in loop head declarations cannot have an initializer (edge) syntaxerror: for-in loop head declarations may not have initializers (firefox) syntaxerror: for-in loop variable declaration may not have an initializer. (chrome) error type syntaxerror in strict mode only. what went wrong? the head of a for...in loop contains an initializer expression. that is, a variable is declared and assigned a value |for (var i = 0 in obj)|. in non-strict mode, this head declaration is silently ignored and behaves like |for (var i in obj)|. in strict mode, however, a syntaxerror is thrown. examples this example throws a syntaxerror: "use strict"; var obj = {a: 1, b: 2, c: 3 }; for (var i = 0 in obj) { console.log(obj[i]); } // syntaxerror: for-in loop head declarations may not have initializers val...
SyntaxError: Malformed formal parameter - JavaScript
at least two arguments passed in the code. the last argument is the source code for the new function you're creating. all the rest make up your new function's argument list. the argument list is invalid somehow. perhaps you accidentally picked a keyword like if or var as an argument name, or perhaps there's some stray punctuation in your argument list. or maybe you accidentally passed an invalid value, like a number or object. ok, that fixed my problem. but why didn't you say that in the first place? admittedly the wording in the error message is slightly strange. "formal parameter" is a fancy way of saying "function argument". and we use the word "malformed" because all firefox engineers are huge fans of 19th-century gothic horror novels. examples invalid cases var f = function('x y', 'r...
RangeError: repeat count must be non-negative - JavaScript
the javascript exception "repeat count must be non-negative" occurs when the string.prototype.repeat() method is used with a count argument that is a negative number. message rangeerror: argument out of range rangeerror: repeat count must be non-negative (firefox) rangeerror: invalid count value (chrome) error type rangeerror what went wrong? the string.prototype.repeat() method has been used. it has a count parameter indicating the number of times to repeat the string. it must be between 0 and less than positive infinity and cannot be a negative number. the range of allowed values can be described like this: [0, +∞). examples invalid cases 'abc'.repeat(-1); // rangeerror valid cases 'abc'.repeat(0); // '' 'abc'.repeat(1); // 'abc' 'abc'.repeat(2); // 'abcabc' 'abc'.rep...
SyntaxError: missing variable name - JavaScript
this won't work: var arr = 1,2,3,4,5; // syntaxerror: missing variable name this would be correct: var arr = [1,2,3,4,5]; ...
RangeError: argument is not a valid code point - JavaScript
the javascript exception "invalid code point" occurs when nan values, negative integers (-1), non-integers (5.4), or values larger than 0x10ffff (1114111) are used with string.fromcodepoint(). message rangeerror: {0} is not a valid code point (firefox) rangeerror: invalid code point {0} (chromium) error type rangeerror what went wrong? string.fromcodepoint() throws this error when passed nan values, negative integers (-1), non-integers (5.4), or values larger than 0x10ffff (1114111). a code point is a value in the unicode codespace; that is, the range of integers from 0 to 0x10ffff. examples invalid cases string.fromcodepoint('_'); // rangeerror string.fromcodepoint(infinity); // rangeerror string.fromcodepoint(-1); // rangeerror string.fromcodepoint(3.14); // rangeer...
TypeError: "x" is read-only - JavaScript
this error happens only in strict mode code. in non-strict code, the assignment is silently ignored. examples invalid cases read-only properties are not super common, but they can be created using object.defineproperty() or object.freeze(). 'use strict'; var obj = object.freeze({name: 'elsa', score: 157}); obj.score = 0; // typeerror 'use strict'; object.defineproperty(this, 'lung_count', {value: 2, writable: false}); lung_count = 3; // typeerror 'use strict'; var frozenarray = object.freeze([0, 1, 2]); frozenarray[0]++; // typeerror there are also a few read-only properties built into javascript. maybe you tried to redefine a mathematical constant. 'use strict'; math.pi = 4; // typeerror sorry, you can't do that. the global variable undefined is also read-only, so you can't si...
SyntaxError: redeclaration of formal parameter "x" - JavaScript
er and is then redeclared using a let assignment in a function body again. redeclaring the same variable within the same function or block scope using let is not allowed in javascript. examples redeclared argument in this case, the variable "arg" redeclares the argument. function f(arg) { let arg = 'foo'; } // syntaxerror: redeclaration of formal parameter "arg" if you want to change the value of "arg" in the function body, you can do so, but you do not need to declare the same variable again. in other words: you can omit the let keyword. if you want to create a new variable, you need to rename it as conflicts with the function parameter already. function f(arg) { arg = 'foo'; } function f(arg) { let bar = 'foo'; } ...
RangeError: repeat count must be less than infinity - JavaScript
the javascript exception "repeat count must be less than infinity" occurs when the string.prototype.repeat() method is used with a count argument that is infinity. message rangeerror: argument out of range (edge) rangeerror: repeat count must be less than infinity and not overflow maximum string size (firefox) rangeerror: invalid count value (chrome) error type rangeerror what went wrong? the string.prototype.repeat() method has been used. it has a count parameter indicating the number of times to repeat the string. it must be between 0 and less than positive infinity and cannot be a negative number. the range of allowed values can be described like this: [0, +∞). the resulting string can also not be larger than the maximum string size, which can differ in javascript engines. in fire...
TypeError: cannot use 'in' operator to search for 'x' in 'y' - JavaScript
var trees = ['redwood', 'bay', 'cedar', 'oak', 'maple']; 3 in trees; // true "oak" in trees; // false ...
arguments[@@iterator]() - JavaScript
syntax arguments[symbol.iterator]() examples iteration using for...of loop function f() { // your browser must support for..of loop // and let-scoped variables in for loops for (let letter of arguments) { console.log(letter); } } f('w', 'y', 'k', 'o', 'p'); specifications specification ecmascript (ecma-262)the definition of 'createunmappedargumentsobject' in that specification. ...
Rest parameters - JavaScript
gs, will be an array that contains the 3rd, 4th, 5th, 6th ... nth — as many arguments that the user includes. function myfun(a, b, ...manymoreargs) { console.log("a", a) console.log("b", b) console.log("manymoreargs", manymoreargs) } myfun("one", "two", "three", "four", "five", "six") // a, one // b, two // manymoreargs, [three, four, five, six] below... even though there is just one value, the last argument 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...
get Array[@@species] - JavaScript
description the species accessor property returns the default constructor for array objects. subclass constructors may override it to change the constructor assignment. examples species in ordinary objects the species property returns the default constructor function, which is the array constructor for array objects: array[symbol.species]; // function array() species in derived objects in a derived collection object (e.g. your custom array myarray), the myarray species is the myarray constructor. ...
Array() constructor - JavaScript
applies to javascript arrays created with the array constructor, not array literals created with the bracket syntax. arraylength if the only argument passed to the array constructor is an integer between 0 and 232-1 (inclusive), this returns a new javascript array with its length property set to that number (note: this implies an array of arraylength empty slots, not slots with actual undefined values). if the argument is any other number, a rangeerror exception is thrown. examples array literal notation arrays can be created using the literal notation: let fruits = ['apple', 'banana']; console.log(fruits.length); // 2 console.log(fruits[0]); // "apple" array constructor with a single parameter arrays can be created using a constructor with a single number parameter. an array wit...
Array.prototype.entries() - JavaScript
the entries() method returns a new array iterator object that contains the key/value pairs for each 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. syntax array.entries() return value a new array iterator object. examples iterating with index and element const a = ['a', 'b', 'c']; for (const [index, element] of a.entries()) console.log(index, element); // 0 'a' // 1 'b' // 2 'c' using a for…of loop var a = ['a', 'b', 'c']; var iterator = a.entries(); for (let e of iterator) { console.log(e); } // [0, 'a'] // [1, 'b'] // [2, 'c'] specifications specification e...
Array.prototype.join() - JavaScript
mples and send us a pull request. syntax arr.join([separator]) parameters separator optional specifies a string to separate each pair of adjacent elements of the array. the separator is converted to a string if necessary. if omitted, the array elements are separated with a comma (","). if separator is an empty string, all elements are joined without any characters in between them. return value a string with all array elements joined. if arr.length is 0, the empty string is returned. description the string conversions of all array elements are joined into one string. if an element is undefined, null or an empty array [], it is converted to an empty string. examples joining an array four different ways the following example creates an array, a, with three elements, then joins th...
Array.prototype.keys() - JavaScript
the keys() method returns a new array iterator object that contains the keys for each 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. syntax arr.keys() return value a new array iterator object. examples key iterator doesn't ignore holes var arr = ['a', , 'c']; var sparsekeys = object.keys(arr); var densekeys = [...arr.keys()]; console.log(sparsekeys); // ['0', '2'] console.log(densekeys); // [0, 1, 2] specifications specification ecmascript (ecma-262)the definition of 'array.prototype.keys' in that specification. ...
Array.of() - JavaScript
ay 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 standard. for more information, see: a...
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. objects which do not contain a length property reflecting the last in a series of consecutive, zero-based numerical properties may not beha...
Array.prototype.push() - JavaScript
y 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. 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, t...
Array.prototype.reverse() - JavaScript
the reverse() method reverses an array in place. the first array element becomes the last, and the last array element becomes the first. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax a.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 ...
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 contai...
ArrayBuffer() constructor - JavaScript
er() 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, will throw a ...
ArrayBuffer.prototype.byteLength - JavaScript
aybuffer 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 bytelength 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 bytelength var buffer = new arraybuffer(8); buffer.bytelength; // 8 specifications specification ecmascript (ecma-262)the definition of 'arraybuffer.prototype.bytelength' in that specification. ...
ArrayBuffer.isView() - JavaScript
the arraybuffer.isview() method determines whether the passed value is one of the arraybuffer views, such as typed array objects or a dataview. the source for this interactive example is stored in a github repository. if 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 arraybuffer.isview(value) parameters value the value to be checked. return value true if the given argument is one of the arraybuffer views; otherwise, false. examples using isview arraybuffer.isview(); // false arraybuffer.isview([]); // false arraybuffer.isview({}); // false arraybuffer.isview(null); // false arraybuffer.isview(undefined); ...
ArrayBuffer.prototype.slice() - JavaScript
interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arraybuffer.slice(begin[, end]) parameters begin zero-based byte index at which to begin slicing. end optional byte index before which to end slicing. if end is unspecified, the new arraybuffer contains all bytes from begin to the end of this arraybuffer. return value a new arraybuffer object. description the slice() method copies up to, but not including, the byte indicated by the end parameter. if either begin or end is negative, it refers to an index from the end of the array, as opposed to from the beginning. the range specified by the begin and end parameters is clamped to the valid index range for the current array. if the computed length of the new ...
AsyncFunction - JavaScript
be obtained with the following code: object.getprototypeof(async function(){}).constructor syntax new asyncfunction([arg1[, arg2[, ...argn]],] functionbody) parameters arg1, arg2, ... argn names to be used by the function as formal argument names. each must be a string that corresponds to a valid javascript identifier or a list of such strings separated with a comma; for example "x", "thevalue", or "a,b". functionbody a string containing the javascript statements comprising the function definition. description async function objects created with the asyncfunction constructor are parsed when the function is created. this is less efficient than declaring an async function with an async function expression and calling it within your code, because such functions are parsed with the re...
Atomics.isLockFree() - JavaScript
iven size is one of the bytes_per_element property of integer typedarray types. the source for this interactive example is stored in a github repository. if 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 atomics.islockfree(size) parameters size the size in bytes to check. return value a boolean indicating whether the operation is lock free. examples using islockfree atomics.islockfree(1); // true atomics.islockfree(2); // true atomics.islockfree(3); // false atomics.islockfree(4); // true atomics.islockfree(5); // false atomics.islockfree(6); // false atomics.islockfree(7); // false atomics.islockfree(8); // true specifications specification ecmascript ...
Atomics.store() - JavaScript
the static atomics.store() method stores a given value at the given position in the array and returns that value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.store(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to store a value in. value the number to store. return value the value that has been stored. exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror,...
BigInt.prototype.toLocaleString() - JavaScript
ions arguments customize the behavior of the function and let applications specify the language whose formatting conventions should be used. in implementations that ignore the locales and options arguments, the locale used and the form of the string returned are entirely implementation-dependent. see the intl.numberformat() constructor for details on these parameters and how to use them. return value a string with a language-sensitive representation of the given bigint. performance when formatting large numbers of numbers, it is better to create a numberformat object and use the function provided by its numberformat.format property. examples using tolocalestring in basic use without specifying a locale, a formatted string in the default locale and with default options is returned. var ...
BigInt.prototype.toString() - JavaScript
tring. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax bigintobj.tostring([radix]) parameters radixoptional optional. an integer in the range 2 through 36 specifying the base to use for representing numeric values. return value a string representing the specified bigint object. exceptions rangeerror if tostring() is given a radix less than 2 or greater than 36, a rangeerror is thrown. description the bigint object overrides the tostring() method of the object object; it does not inherit object.prototype.tostring(). for bigint objects, the tostring() method returns a string representation of the...
BigInt64Array() constructor - JavaScript
(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 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 ...
BigUint64Array() constructor - JavaScript
(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 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 ...
Boolean.prototype.toSource() - JavaScript
the tosource() method returns a string representing the source code of the object. syntax booleanobj.tosource() boolean.tosource() return value a string representing the source code of the object. examples native function for the built-in boolean object, tosource returns the following string indicating that the source code is not available: function boolean() { [native code] } specifications not part of any standard. ...
DataView.prototype.buffer - JavaScript
at construction time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. 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 { bytelength: 8 } specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.buffer' in that specification. ...
DataView.prototype.byteLength - JavaScript
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 bytelength 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 bytelength, the bytelength of the referenced arraybuffer or sharedarraybuffer will be returned. examples using the bytelength property var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.bytelength; // 8 (matches the bytelength of the buffer) var da...
DataView.prototype.byteOffset - JavaScript
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 byteoffset 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. examples using the byteoffset property var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.byteoffset; // 0 (no offset specified) var dataview2 = new dataview(buffer, 3); dataview2.byteoffset; // 3 (as specified when constructing the dataview) specifications specification ecma...
DataView.prototype.getBigInt64() - JavaScript
ve examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dataview.getbigint64(byteoffset [, littleendian]) parameters byteoffset the offset, in bytes, from the start of the view to read the data from. littleendian optional indicates whether the 64-bit int is stored in little- or big-endian format. if false or undefined, a big-endian value is read. return value a bigint. errors thrown rangeerror thrown if the byteoffset is set such that it would read beyond the end of the view. description there is no alignment constraint; multi-byte values may be fetched from any offset. examples using the getbigint64 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getbigint64(0); // 0n specifi...
DataView.prototype.getBigUint64() - JavaScript
e examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dataview.getbiguint64(byteoffset [, littleendian]) parameters byteoffset the offset, in bytes, from the start of the view to read the data from. littleendian optional indicates whether the 64-bit int is stored in little- or big-endian format. if false or undefined, a big-endian value is read. return value a bigint. errors thrown rangeerror thrown if the byteoffset is set such that it would read beyond the end of the view. description there is no alignment constraint; multi-byte values may be fetched from any offset. examples using the getbiguint64 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getbiguint64(0); // 0n speci...
DataView.prototype.getFloat32() - JavaScript
e examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dataview.getfloat32(byteoffset [, littleendian]) parameters byteoffset the offset, in byte, from the start of the view where to read the data. littleendian optional indicates whether the 32-bit float is stored in little- or big-endian format. if false or undefined, a big-endian value is read. return value a signed 32-bit float number. errors thrown rangeerror thrown if the byteoffset is set such as it would read beyond the end of the view. description there is no alignment constraint; multi-byte values may be fetched from any offset. examples using the getfloat32 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getfloat32(1);...
DataView.prototype.getFloat64() - JavaScript
e examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dataview.getfloat64(byteoffset [, littleendian]) parameters byteoffset the offset, in byte, from the start of the view where to read the data. littleendian optional indicates whether the 64-bit float is stored in little- or big-endian format. if false or undefined, a big-endian value is read. return value a signed 64-bit float number. errors thrown rangeerror thrown if the byteoffset is set such as it would read beyond the end of the view. description there is no alignment constraint; multi-byte values may be fetched from any offset. examples using the getfloat64 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getfloat64(0);...
DataView.prototype.getInt16() - JavaScript
ctive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dataview.getint16(byteoffset [, littleendian]) parameters byteoffset the offset, in byte, from the start of the view where to read the data. littleendian optional indicates whether the 16-bit int is stored in little- or big-endian format. if false or undefined, a big-endian value is read. return value a signed 16-bit integer number. errors thrown rangeerror thrown if the byteoffset is set such as it would read beyond the end of the view. description there is no alignment constraint; multi-byte values may be fetched from any offset. examples using the getint16 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getint16(1); /...
DataView.prototype.getInt32() - JavaScript
tive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dataview.getint32(byteoffset [, littleendian]) parameters byteoffset the offset, in bytes, from the start of the view where to read the data. littleendian optional indicates whether the 32-bit int is stored in little- or big-endian format. if false or undefined, a big-endian value is read. return value a signed 32-bit integer number. errors thrown rangeerror thrown if the byteoffset is set such as it would read beyond the end of the view. description there is no alignment constraint; multi-byte values may be fetched from any offset. examples using the getint32 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getint32(1); /...
DataView.prototype.getInt8() - JavaScript
the start of the dataview. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dataview.getint8(byteoffset) parameters byteoffset the offset, in byte, from the start of the view where to read the data. return value a signed 8-bit integer number. errors thrown rangeerror thrown if the byteoffset is set such as it would read beyond the end of the view. description there is no alignment constraint; multi-byte values may be fetched from any offset. examples using the getint8 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getint8(1); // 0 specifications ...
DataView.prototype.getUint16() - JavaScript
tive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dataview.getuint16(byteoffset [, littleendian]) parameters byteoffset the offset, in byte, from the start of the view where to read the data. littleendian optional indicates whether the 16-bit int is stored in little- or big-endian format. if false or undefined, a big-endian value is read. return value an unsigned 16-bit integer number. errors thrown rangeerror thrown if the byteoffset is set such as it would read beyond the end of the view. description there is no alignment constraint; multi-byte values may be fetched from any offset. examples using the getuint16 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getuint16(...
DataView.prototype.getUint32() - JavaScript
tive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dataview.getuint32(byteoffset [, littleendian]) parameters byteoffset the offset, in byte, from the start of the view where to read the data. littleendian optional indicates whether the 32-bit int is stored in little- or big-endian format. if false or undefined, a big-endian value is read. return value an unsigned 32-bit integer number. errors thrown rangeerror thrown if the byteoffset is set such as it would read beyond the end of the view. description there is no alignment constraint; multi-byte values may be fetched from any offset. examples using the getuint32 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getuint32(...
DataView.prototype.getUint8() - JavaScript
he start of the dataview. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dataview.getuint8(byteoffset) parameters byteoffset the offset, in byte, from the start of the view where to read the data. return value an unsigned 8-bit integer number. errors thrown rangeerror thrown if the byteoffset is set such as it would read beyond the end of the view. description there is no alignment constraint; multi-byte values may be fetched from any offset. examples using the getuint8 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getuint8(1); // 0 specifications ...
DataView.prototype.setFloat32() - JavaScript
the setfloat32() method stores a signed 32-bit float (float) value at the specified byte offset from the start of the dataview. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dataview.setfloat32(byteoffset, value [, littleendian]) parameters byteoffset the offset, in byte, from the start of the view where to store the data. value the value to set. littleendian optional indicates whether the 32-bit float is stored in little- or big-endian format. if false or undefined, a big-endian value is written. return value undefined. errors thrown rangeerror thrown if the byteoffset is set such as it wo...
DataView.prototype.setFloat64() - JavaScript
the setfloat64() method stores a signed 64-bit float (double) value at the specified byte offset from the start of the dataview. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dataview.setfloat64(byteoffset, value [, littleendian]) parameters byteoffset the offset, in byte, from the start of the view where to store the data. value the value to set. littleendian optional indicates whether the 64-bit float is stored in little- or big-endian format. if false or undefined, a big-endian value is written. return value undefined. errors thrown rangeerror thrown if the byteoffset is set such as it w...
DataView.prototype.setInt16() - JavaScript
the setint16() method stores a signed 16-bit integer (short) value at the specified byte offset from the start of the dataview. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dataview.setint16(byteoffset, value [, littleendian]) parameters byteoffset the offset, in byte, from the start of the view where to store the data. value the value to set. littleendian optional indicates whether the 16-bit int is stored in little- or big-endian format. if false or undefined, a big-endian value is written. return value undefined. errors thrown rangeerror thrown if the byteoffset is set such as it would ...
DataView.prototype.setInt32() - JavaScript
the setint32() method stores a signed 32-bit integer (long) value at the specified byte offset from the start of the dataview. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dataview.setint32(byteoffset, value [, littleendian]) parameters byteoffset the offset, in byte, from the start of the view where to store the data. value the value to set. littleendian optional indicates whether the 32-bit int is stored in little- or big-endian format. if false or undefined, a big-endian value is written. return value undefined. errors thrown rangeerror thrown if the byteoffset is set such as it would s...
DataView.prototype.setUint16() - JavaScript
the setuint16() method stores an unsigned 16-bit integer (unsigned short) value at the specified byte offset from the start of the dataview. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dataview.setuint16(byteoffset, value [, littleendian]) parameters byteoffset the offset, in byte, from the start of the view where to store the data. value the value to set. littleendian optional indicates whether the 16-bit int is stored in little- or big-endian format. if false or undefined, a big-endian value is written. return value undefined. errors thrown rangeerror thrown if the byteoffset is set suc...
DataView.prototype.setUint32() - JavaScript
the setuint32() method stores an unsigned 32-bit integer (unsigned long) value at the specified byte offset from the start of the dataview. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dataview.setuint32(byteoffset, value [, littleendian]) parameters byteoffset the offset, in byte, from the start of the view where to store the data. value the value to set. littleendian optional indicates whether the 32-bit int is stored in little- or big-endian format. if false or undefined, a big-endian value is written. return value undefined. errors thrown rangeerror thrown if the byteoffset is set such...
Date.prototype.getDate() - JavaScript
the getdate() method returns the day of the month for the specified date according to local time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.getdate() return value an integer number, between 1 and 31, representing the day of the month for the given date according to local time. examples using getdate() the second statement below assigns the value 25 to the variable day, based on the value of the date object xmas95. var xmas95 = new date('december 25, 1995 23:15:30'); var day = xmas95.getdate(); console.log(day); // 25 specifications specification ecmascript (ecma-262)t...
Date.prototype.getDay() - JavaScript
he week for the specified date according to local time, where 0 represents sunday. for the day of the month, see date.prototype.getdate(). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.getday() return value an integer number, between 0 and 6, corresponding to the day of the week for the given date, according to local time: 0 for sunday, 1 for monday, 2 for tuesday, and so on. examples using getday() the second statement below assigns the value 1 to weekday, based on the value of the date object xmas95. december 25, 1995, is a monday. var xmas95 = new date('december 25, 1995 23:15:30'); var week...
Date.prototype.getHours() - JavaScript
the gethours() method returns the hour for the specified date, according to local time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.gethours() return value an integer number, between 0 and 23, representing the hour for the given date according to local time. examples using gethours() the second statement below assigns the value 23 to the variable hours, based on the value of the date object xmas95. let xmas95 = new date('december 25, 1995 23:15:30'); let hours = xmas95.gethours(); console.log(hours); // 23 specifications specification ecmascript (ecma-262)the defini...
Date.prototype.getMilliseconds() - JavaScript
the getmilliseconds() method returns the milliseconds in the specified date according to local time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.getmilliseconds() return value a number, between 0 and 999, representing the milliseconds for the given date according to local time. examples using getmilliseconds() the following example assigns the milliseconds portion of the current time to the variable milliseconds: var today = new date(); var milliseconds = today.getmilliseconds(); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getmilli...
Date.prototype.getMinutes() - JavaScript
the getminutes() method returns the minutes in the specified date according to local time. syntax dateobj.getminutes() return value an integer number, between 0 and 59, representing the minutes in the given date according to local time. examples using getminutes() the second statement below assigns the value 15 to the variable minutes, based on the value of the date object xmas95. var xmas95 = new date('december 25, 1995 23:15:30'); var minutes = xmas95.getminutes(); console.log(minutes); // 15 specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getminutes' in that specification. ...
Date.prototype.getMonth() - JavaScript
the getmonth() method returns the month in the specified date according to local time, as a zero-based value (where zero indicates the first month of the year). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.getmonth() return value an integer number, between 0 and 11, representing the month in the given date according to local time. 0 corresponds to january, 1 to february, and so on. examples using getmonth() the second statement below assigns the value 11 to the variable month, based on the value of the date object xmas95. var xmas95 = new date('december 25, 1995 23:15:30'); var month = xmas95...
Date.prototype.getSeconds() - JavaScript
the getseconds() method returns the seconds in the specified date according to local time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.getseconds() return value an integer number, between 0 and 59, representing the seconds in the given date according to local time. examples using getseconds() the second statement below assigns the value 30 to the variable seconds, based on the value of the date object xmas95. var xmas95 = new date('december 25, 1995 23:15:30'); var seconds = xmas95.getseconds(); console.log(seconds); // 30 specifications specification ecmascript (ecma-2...
Date.prototype.getUTCDate() - JavaScript
examples using getutcdate() the following example assigns the day portion of the current date to the variable day. ...
Date.prototype.getUTCDay() - JavaScript
the getutcday() method returns the day of the week in the specified date according to universal time, where 0 represents sunday. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.getutcday() return value an integer number corresponding to the day of the week for the given date, according to universal time: 0 for sunday, 1 for monday, 2 for tuesday, and so on. examples using getutcday() the following example assigns the weekday portion of the current date to the variable weekday. var today = new date(); var weekday = today.getutcday(); specifications specification ecmascript (e...
Date.prototype.getUTCFullYear() - JavaScript
the getutcfullyear() method returns the year in the specified date according to universal time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.getutcfullyear() return value a number representing the year in the given date according to universal time. description the value returned by getutcfullyear() is an absolute number that is compliant with year-2000, for example, 1995. examples using getutcfullyear() the following example assigns the four-digit value of the current year to the variable year. var today = new date(); var year = today.getutcfullyear(); specifications specificati...
Date.prototype.getUTCHours() - JavaScript
the getutchours() method returns the hours in the specified date according to universal time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.getutchours() return value an integer number, between 0 and 23, representing the hours in the given date according to universal time. examples using getutchours() the following example assigns the hours portion of the current time to the variable hours. var today = new date(); var hours = today.getutchours(); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getutchours' in that specification. ...
Date.prototype.getUTCMilliseconds() - JavaScript
this method is a companion to the other utc based methods that give hour portion, minute portion, etc.; this method gives milliseconds portion. not to be confused with unix epoch time. to get total milliseconds since 1970/01/01, use the method ".gettime()". examples using getutcmilliseconds() the following example assigns the milliseconds portion of the current time to the variable milliseconds. ...
Date.prototype.getUTCMinutes() - JavaScript
examples using getutcminutes() the following example assigns the minutes portion of the current time to the variable minutes. ...
Date.prototype.getUTCSeconds() - JavaScript
examples using getutcseconds() the following example assigns the seconds portion of the current time to the variable seconds. ...
Date.prototype.setMilliseconds() - JavaScript
the setmilliseconds() method sets the milliseconds for a specified date according to local time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.setmilliseconds(millisecondsvalue) parameters millisecondsvalue a number between 0 and 999, representing the milliseconds. return value the number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if you specify a number outside the expected range, the date information in the date object is updated accordingly. for example, if you specify 1005, the number of seconds is incremented by 1, and 5 is used for the milli...
Date.prototype.setTime() - JavaScript
the settime() method sets the date object to the time represented by a number of milliseconds since january 1, 1970, 00:00:00 utc. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.settime(timevalue) parameters timevalue an integer representing the number of milliseconds since 1 january 1970, 00:00:00 utc. return value the number of milliseconds between 1 january 1970 00:00:00 utc and the updated date (effectively, the value of the argument). description use the settime() method to help assign a date and time to another date object. examples using settime() var thebigday = new date('july 1,...
Date.prototype.setYear() - JavaScript
the setyear() method sets the year for a specified date according to local time. because setyear() does not set full years ("year 2000 problem"), it is no longer used and has been replaced by the setfullyear() method. syntax dateobj.setyear(yearvalue) parameters yearvalue an integer. return value the number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if yearvalue is a number between 0 and 99 (inclusive), then the year for dateobj is set to 1900 + yearvalue. otherwise, the year for dateobj is set to yearvalue. examples using setyear() the first two lines set the year to 1996. the third sets the year to 2000. var thebigday = new date(); thebigday.setyear(96); thebigday.setyear(1996); thebigday.setyear(2000); specifications ...
Date.prototype.toDateString() - JavaScript
ed on the left a zero if necessary four digit year (at least), padded on the left with zeros if necessary e.g. "thu jan 01 1970". the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.todatestring() return value a string representing the date portion of the given date object in human readable form in english. description date instances refer to a specific point in time. calling tostring() will return the date formatted in a human readable form in english. in spidermonkey, this consists of the date portion (day, month, and year) followed by the time portion (hours, minutes, seconds, and time zone). som...
Date.prototype.toGMTString() - JavaScript
the togmtstring() method converts a date to a string, using internet greenwich mean time (gmt) conventions. the exact format of the value returned by togmtstring() varies according to the platform and browser, in general it should represent a human readable date string. note: togmtstring() is deprecated and should no longer be used. it remains implemented only for backward compatibility; please use toutcstring() instead. syntax dateobj.togmtstring() return value a string representing the given date following the internet greenwich mean time (gmt) convention. examples simple example in this example, the togmtstring() method converts the date to gmt (utc) using the operating system's time-zone offset and returns a string value that is similar to the following form. the exact format d...
Date.prototype.toJSON() - JavaScript
the tojson() method returns a string representation of the date 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 dateobj.tojson() return value a string representation of the given date. description date instances refer to a specific point in time. calling tojson() returns a string (using toisostring()) representing the date object's value. this method is generally intended to, by default, usefully serialize date objects during json serialization. examples using tojson() var jsondate = (new date()).tojson(); var backtodate = new date(jsondate); console.log(jsondate); //2015-10-26t07:46:36.611z ...
Date.prototype.toLocaleDateString() - JavaScript
ments customize the behavior of the function and let applications specify the language whose formatting conventions should be used. in implementations, which ignore the locales and options arguments, the locale used and the form of the string returned are entirely implementation dependent. see the intl.datetimeformat() constructor for details on these parameters and how to use them. the default value for each date-time component property is undefined, but if the weekday, year, month, day properties are all undefined, then year, month, and day are assumed to be "numeric". return value a string representing the date portion of the given date instance according to language-specific conventions. performance when formatting large numbers of dates, it is better to create an intl.datetimeformat ...
Date.prototype.toLocaleTimeString() - JavaScript
ments customize the behavior of the function and let applications specify the language whose formatting conventions should be used. in implementations, which ignore the locales and options arguments, the locale used and the form of the string returned are entirely implementation dependent. see the intl.datetimeformat() constructor for details on these parameters and how to use them. the default value for each date-time component property is undefined, but if the hour, minute, second properties are all undefined, then hour, minute, and second are assumed to be "numeric". return value a string representing the time portion of the given date instance according to language-specific conventions. performance when formatting large numbers of dates, it is better to create an intl.datetimeformat o...
Date.prototype.toSource() - JavaScript
the tosource() method returns a string representing the source code of the object. syntax dateobj.tosource() date.tosource() return value a string representing the source code of the given date object. examples native function for the built-in date object, tosource() returns the following string indicating that the source code is not available: function date() { [native code] } specifications not part of any standard. ...
Date.prototype.toTimeString() - JavaScript
the totimestring() method returns the time portion of a date object in human readable form in american english. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.totimestring() return value a string representing the time portion of the given date in human readable form in american english. description date instances refer to a specific point in time. calling tostring() will return the date formatted in a human readable form in american english. in spidermonkey, this consists of the date portion (day, month, and year) followed by the time portion (hours, minutes, seconds, and time zone). sometimes it...
Error.prototype.name - JavaScript
description by default, error instances are given the name "error". the name property, in addition to the message property, is used by the error.prototype.tostring() method to create a string representation of the error. ...
Error.prototype.toSource() - JavaScript
examples using tosource calling the tosource method of an error instance (including nativeerrors) will return a string containing the source code of the error. this string can be evaluated to create an (approximately) equal object. naturally, the string containing the source follows the structure of the error constructor. for example: (newname(message ,filename,linenumber)) where these attributes correspond to the respective properties of the error instance. ...
Error - JavaScript
message, filename, linenumber) { var instance = new error(message, filename, linenumber); instance.name = 'customerror'; instance.foo = foo; object.setprototypeof(instance, object.getprototypeof(this)); if (error.capturestacktrace) { error.capturestacktrace(instance, customerror); } return instance; } customerror.prototype = object.create(error.prototype, { constructor: { value: error, enumerable: false, writable: true, configurable: true } }); if (object.setprototypeof){ object.setprototypeof(customerror, error); } else { customerror.__proto__ = error; } try { throw new customerror('baz', 'bazmessage'); } catch(e){ console.error(e.name); //customerror console.error(e.foo); //baz console.error(e.message); //bazmessage } specifications ...
FinalizationRegistry() constructor - JavaScript
nalizationregistry constructor creates a finalizationregistry object that uses the given callback. syntax new finalizationregistry([callback]); parameters callback optional the callback function this registry should use. if provided, this must be a function. examples creating a new registry you create the registry passing in the callback: const registry = new finalizationregistry(heldvalue => { // .... }); specifications specification weakrefsthe definition of 'finalizationregistry constructor' in that specification. ...
Float32Array() constructor - JavaScript
(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 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 ...
Float64Array() constructor - JavaScript
(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 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 ...
Function.arguments - JavaScript
guments passed to a function. use the simple variable arguments instead. this property is restricted to non-strict functions. description the syntax function.arguments is deprecated. the recommended way to access the arguments object available within functions is simply to refer to the variable arguments. in the case of recursion, i.e. if function f appears several times on the call stack, the value of f.arguments represents the arguments corresponding to the most recent invocation of the function. the value of the arguments property is normally null if there is no outstanding invocation of the function in progress (that is, the function has been called but has not yet returned. examples using the arguments object function f(n) { g(n - 1) } function g(n) { console.log('before: ' + g.a...
Function.prototype.toSource() - JavaScript
the tosource() method returns a string representing the source code of the object. this method is usually called internally by javascript and not explicitly in code. you can call tosource() while debugging to examine the contents of an object. syntax function.tosource(); return value a string representing the source code of the object. examples native functions for the built-in function object, tosource() returns the following string indicating that the source code is not available: function function() { [native code] } custom functions for custom functions, tosource() returns the javascript source that defines the object as a string. // for example: function hello() { console.log("hello, world!"); } hello.tosource(); // results in: "function hello() { console...
Function - JavaScript
assed as an array object. function.prototype.bind(thisarg[, arg1[, arg2[, ...argn]]]) creates a new function which, when called, has its this set to the provided thisarg. optionally, a given sequence of arguments will be prepended to arguments provided the newly-bound function is called. function.prototype.call(thisarg[, arg1, arg2, ...argn]) calls a function and sets its this to the provided value. arguments can be passed as they are. function.prototype.tostring() returns a string representing the source code of the function. overrides the object.prototype.tostring method. examples difference between function constructor and function declaration functions created with the function constructor do not create closures to their creation contexts; they always are created in the global sc...
Int16Array() constructor - JavaScript
(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 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 ...
Int32Array() constructor - JavaScript
(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 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 ...
Int8Array() constructor - JavaScript
(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 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 ...
InternalError - JavaScript
that raised this error. inherited from error. internalerror.prototype.stack stack trace. inherited from error. examples too much recursion this recursive function runs 10 times, as per the exit condition. function loop(x) { if (x >= 10) // "x >= 10" is the exit condition return; // do stuff loop(x + 1); // the recursive call } loop(0); setting this condition to an extremely high value, won't work: function loop(x) { if (x >= 1000000000000) return; // do stuff loop(x + 1); } loop(0); // internalerror: too much recursion for more information, see internalerror: too much recursion. specifications not part of any standard. ...
Intl.Collator.prototype.compare() - JavaScript
ples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax collator.compare(string1, string2) parameters string1 string2 the strings to compare against each other. description the compare getter function returns a number indicating how string1 and string2 compare to each other according to the sort order of this collator object: a negative value if string1 comes before string2; a positive value if string1 comes after string2; 0 if they are considered equal. examples using compare for array sort use the compare getter function for sorting arrays. note that the function is bound to the collator from which it was obtained, so it can be passed directly to array.prototype.sort(). var a = ['offenbach', 'Österreich', 'odenwald']; var colla...
Intl.Collator.supportedLocalesOf() - JavaScript
ractive-examples and send us a pull request. syntax intl.collator.supportedlocalesof(locales[, options]) parameters locales a string with a bcp 47 language tag, or an array of such strings. for the general form of the locales argument, see the intl page. options optional. an object that may have the following property: localematcher the locale matching algorithm to use. possible values are "lookup" and "best fit"; the default is "best fit". for information about this option, see the intl page. return value an array of strings representing a subset of the given locale tags that are supported in collation without having to fall back to the runtime's default locale. description returns an array with a subset of the language tags provided in locales. the language tags ret...
Intl.DateTimeFormat.supportedLocalesOf() - JavaScript
e-examples and send us a pull request. syntax intl.datetimeformat.supportedlocalesof(locales[, options]) parameters locales a string with a bcp 47 language tag, or an array of such strings. for the general form of the locales argument, see the intl page. options optional. an object that may have the following property: localematcher the locale matching algorithm to use. possible values are "lookup" and "best fit"; the default is "best fit". for information about this option, see the intl page. return value an array of strings representing a subset of the given locale tags that are supported in date and time formatting without having to fall back to the runtime's default locale. description returns an array with a subset of the language tags provided in locales. the la...
Intl.DisplayNames.prototype.of() - JavaScript
s "language", code should be a languagecode ["-" scriptcode] ["-" regioncode ] *("-" variant ) subsequence of the unicode_language_id grammar in uts 35's unicode language and locale identifiers grammar. languagecode is either a two letters iso 639-1 language code or a three letters iso 639-2 language code. if the type is "currency", code should be a 3-letter iso 4217 currency code. return value a language-specific formatted string. examples using the of method let regionnames = new intl.displaynames(['en'], {type: 'region'}); regionnames.of('419'); // "latin america" let languagenames = new intl.displaynames(['en'], {type: 'language'}); languagenames.of('fr'); // "french" let currencynames = new intl.displaynames(['en'], {type: 'currency'}); currencynames.of('eur'); // "euro" s...
Intl.DisplayNames.supportedLocalesOf() - JavaScript
ll back to the runtime's default locale. syntax intl.displaynames.supportedlocalesof(locales[, options]) parameters locales a string with a bcp 47 language tag, or an array of such strings. for the general form of the locales argument, see the intl page. options optional. an object that may have the following property: localematcher the locale matching algorithm to use. possible values are "lookup" and "best fit"; the default is "best fit". for information about this option, see the intl page. return value an array of strings representing a subset of the given locale tags that are supported in date and time formatting without having to fall back to the runtime's default locale. description returns an array with a subset of the language tags provided in locales. the la...
Intl​.ListFormat.prototype​.format() - JavaScript
the locales and options parameters customize the behavior of format() and let applications specify the language conventions that should be used to format the list. ...
Intl.ListFormat.supportedLocalesOf() - JavaScript
fall back to the runtime's default locale. syntax intl.listformat.supportedlocalesof(locales[, options]) parameters locales a string with a bcp 47 language tag, or an array of such strings. for the general form of the locales argument, see the intl page. options optional. an object that may have the following property: localematcher the locale matching algorithm to use. possible values are "lookup" and "best fit"; the default is "best fit". for information about this option, see the intl page. return value an array of strings representing a subset of the given locale tags that are supported in date and time formatting without having to fall back to the runtime's default locale. description returns an array with a subset of the language tags provided in locales. the la...
Intl.Locale() constructor - JavaScript
the intl.locale constructor is a standard built-in property of the intl object that represents a unicode locale identifier. syntax new intl.locale(tag [, options]) parameters tag the unicode locale identifier string. options an object that contains configuration for the locale. keys are unicode locale tags, values are valid unicode tag values. examples basic usage at its very simplest, the intl.locale constructor takes a locale identifier string as its argument: let us = new intl.locale('en-us'); using the locale constructor with an options object the constructor also takes an optional configuration object argument, which can contain any of several extension types. for example, set the hourcycle property of the configuration object to your desired hour cycle type, and then pa...
Intl.Locale.prototype.hourCycle - JavaScript
...
Intl.Locale.prototype.minimize() - JavaScript
intl.locale.prototype.minimize() method attempts to remove information about the locale that would be added by calling locale.maximize(). the source for this interactive example is stored in a github repository. if 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 locale.minimize() return value a locale instance whose basename property returns the result of the remove likely subtags algorithm executed against locale.basename. description this method carries out the reverse of maximize(), removing any language, script, or region subtags from the locale language identifier (essentially the contents of basename). this is useful when there are superfluous subtags in the language identif...
Intl.Locale.prototype.toString() - JavaScript
the intl.locale.prototype.tostring() returns the locale's full locale identifier 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 locale.tostring() return value the locale's unicode locale identifier string. description the locale object is a javascript representation of a concept unicode locale identifier. information about a particular locale (language, script, calendar type, etc.) can be encoded in a locale identifier string. to make it easier to work with these locale identifiers, the locale object was introduced to javascript. calling the tostring method on a locale object will return the iden...
Intl.Locale - JavaScript
prototype.numeric returns whether the locale has special collation handling for numeric characters. intl.locale.prototype.region returns the region of the world (usually a country) associated with the locale. intl.locale.prototype.script returns the script used for writing the particular language used in the locale. instance methods intl.locale.prototype.maximize() gets the most likely values for the language, script, and region of the locale based on existing values. intl.locale.prototype.minimize() gets the most likely values for the language, script, and region of the locale based on existing values. intl.locale.prototype.tostring() returns the locale's full locale identifier string. examples basic usage at its very simplest, the intl.locale constructor takes a locale iden...
Intl.NumberFormat.prototype.format() - JavaScript
https://github.com/mdn/interactive-examples and send us a pull request. syntax numberformat.format(number) parameters number a number or bigint to format. description the format getter function formats a number into a string according to the locale and formatting options of this numberformat object. examples using format use the format getter function for formatting a single currency value, here for russia: var options = { style: 'currency', currency: 'rub' }; var numberformat = new intl.numberformat('ru-ru', options); console.log(numberformat.format(654321.987)); // → "654 321,99 руб." using format with map use the format getter function for formatting all numbers in an array. note that the function is bound to the numberformat from which it was obtained, so it can be pas...
Intl.NumberFormat.supportedLocalesOf() - JavaScript
ive-examples and send us a pull request. syntax intl.numberformat.supportedlocalesof(locales[, options]) parameters locales a string with a bcp 47 language tag, or an array of such strings. for the general form of the locales argument, see the intl page. options optional. an object that may have the following property: localematcher the locale matching algorithm to use. possible values are "lookup" and "best fit"; the default is "best fit". for information about this option, see the intl page. return value an array of strings representing a subset of the given locale tags that are supported in number formatting without having to fall back to the runtime's default locale. description returns an array with a subset of the language tags provided in locales. the language ...
Intl.PluralRules.select() - JavaScript
description this function selects a pluralization category according to the locale and formatting options of a pluralrules object. ...
Intl.PluralRules.supportedLocalesOf() - JavaScript
all back to the runtime's default locale. syntax intl.pluralrules.supportedlocalesof(locales[, options]) parameters locales a string with a bcp 47 language tag, or an array of such strings. for the general form of the locales argument, see the intl page. options optional. an object that may have the following property: localematcher the locale matching algorithm to use. possible values are lookup and best fit; the default is best fit. for information about this option, see the intl page. return value an array of strings representing a subset of the given locale tags that are supported in plural formatting without having to fall back to the runtime's default locale. description returns an array with a subset of the language tags provided in locales. the language tags r...
Intl.RelativeTimeFormat.supportedLocalesOf() - JavaScript
amples and send us a pull request. syntax intl.relativetimeformat.supportedlocalesof(locales[, options]) parameters locales a string with a bcp 47 language tag, or an array of such strings. for the general form of the locales argument, see the intl page. options optional. an object that may have the following property: localematcher the locale matching algorithm to use. possible values are "lookup" and "best fit"; the default is "best fit". for information about this option, see the intl page. return value an array of strings representing a subset of the given locale tags that are supported in date and time formatting without having to fall back to the runtime's default locale. description returns an array with a subset of the language tags provided in locales. the la...
Intl.getCanonicalLocales() - JavaScript
ates will be omitted and elements will be validated as structurally valid language 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 intl.getcanonicallocales(locales) parameters locales a list of string values for which to get the canonical locale names. return value an array containing the canonical locale names. examples using getcanonicallocales intl.getcanonicallocales('en-us'); // ["en-us"] intl.getcanonicallocales(['en-us', 'fr']); // ["en-us", "fr"] intl.getcanonicallocales('en_us'); // rangeerror:'en_us' is not a structurally valid language tag specifications specification ...
Map.prototype[@@toStringTag] - 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. ...
Map() constructor - JavaScript
the map() constructor creates map objects. syntax new map([iterable]) parameters iterable an array or other iterable object whose elements are key-value pairs. (for example, arrays with two elements, such as [[ 1, 'one' ],[ 2, 'two' ]].) each key-value pair is added to the new map. examples creating a new map let mymap = new map([ [1, 'one'], [2, 'two'], [3, 'three'], ]) specifications specification ecmascript (ecma-262)the definition of 'map constructor' in that specification. ...
Map.prototype.clear() - JavaScript
the clear() method removes all elements from a map 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 mymap.clear(); return value undefined. examples using clear() var mymap = new map(); mymap.set('bar', 'baz'); mymap.set(1, 'foo'); mymap.size; // 2 mymap.has('bar'); // true mymap.clear(); mymap.size; // 0 mymap.has('bar') // false specifications specification ecmascript (ecma-262)the definition of 'map.prototype.clear' in that specification. ...
Map.prototype.delete() - JavaScript
ethod removes the specified element from a map object by key. the source for this interactive example is stored in a github repository. if 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 mymap.delete(key); parameters key the key of the element to remove from the map object. return value true if an element in the map object existed and has been removed, or false if the element does not exist. examples using delete() var mymap = new map(); mymap.set('bar', 'foo'); mymap.delete('bar'); // returns true. successfully removed. mymap.has('bar'); // returns false. the "bar" element is no longer present. specifications specification ecmascript (ecma-262)t...
Map.prototype.get() - JavaScript
the get() method returns a specified element from a map object. if the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the map 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 mymap.get(key) parameters key the key of the element to return from the map object. return value the element associated with the specified key, or undefined if the key can't be found in the map object. examples using get() let mymap = new map(); mymap.set('bar', 'foo'); mymap.get('bar'); // r...
Map.prototype.has() - JavaScript
whether an element with the specified key exists or not. the source for this interactive example is stored in a github repository. if 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 mymap.has(key) parameters key the key of the element to test for presence in the map object. return value true if an element with the specified key exists in the map object; otherwise false. examples using has() let mymap = new map() mymap.set('bar', "foo") mymap.has('bar') // returns true mymap.has('baz') // returns false specifications specification ecmascript (ecma-262)the definition of 'map.prototype.has' in that specification. ...
Map.prototype.set() - JavaScript
the set() method adds or updates an element with a specified key and a value to a map 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 mymap.set(key, value) parameters key the key of the element to add to the map object. value the value of the element to add to the map object. return value the map object. examples using set() let mymap = new map() // add new elements to the map mymap.set('bar', 'foo') mymap.set(1, 'foobar') // update an element in the map mymap.set('bar', 'baz') using the set() with chaining since the set() method returns back the same map object, you can chain the me...
Map.prototype.size - JavaScript
the size accessor property returns the number of elements in a map 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. description the value of size is an integer representing how many entries the map object has. a set accessor function for size is undefined; you can not change this property. examples using size var mymap = new map(); mymap.set('a', 'alpha'); mymap.set('b', 'beta'); mymap.set('g', 'gamma'); mymap.size // 3 specifications specification ecmascript (ecma-262)the definition of 'map.prototype.size' in that specification. ...
Math.asinh() - JavaScript
orname{math.asinh}(x)} = \operatorname{arsinh}(x) = \text{ the unique } \; y \; \text{such that} \; \sinh(y) = x the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.asinh(x) parameters x a number. return value the hyperbolic arcsine of the given number. description because asinh() is a static method of math, you always use it as math.asinh(), rather than as a method of a math object you created (math is not a constructor). polyfill math.asinh can be emulated with the following function: if (!math.asinh) math.asinh = function(x) { var absx = math.abs(x), w if (absx < 3.725290298461914e-9) ...
Math.atan() - JavaScript
n(x) = \text{ the unique } \; y \in \left[-\frac{\pi}{2}; \frac{\pi}{2}\right] \, \text{such that} \; \tan(y) = x the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.atan(x) parameters x a number. return value the arctangent (in radians) of the given number. description the math.atan() method returns a numeric value between -π2-\frac{\pi}{2} and π2\frac{\pi}{2} radians. because atan() is a static method of math, you always use it as math.atan(), rather than as a method of a math object you created (math is not a constructor). examples using math.atan() math.atan(1); // 0.7853981633974483 mat...
Math.atan2() - JavaScript
ay from (0,0) to the point (x,y), for math.atan2(y,x). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.atan2(y, x) parameters y the y coordinate of the point. x the x coordinate of the point return value the angle in radians (in [-π,π][-\pi, \pi]) between the positive x-axis and the ray from (0,0) to the point (x,y). description the math.atan2() method returns a numeric value between -π and π representing the angle theta of an (x, y) point. this is the counterclockwise angle, measured in radians, between the positive x axis, and the point (x, y). note that the arguments to this function pa...
Math.cbrt() - JavaScript
e uniqueysuch thaty3=x\mathtt{math.cbrt(x)} = \sqrt[3]{x} = \text{the unique} \; y \; \text{such that} \; y^3 = x the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.cbrt(x) parameters x a number. return value the cube root of the given number. description because cbrt() is a static method of math, you always use it as math.cbrt(), rather than as a method of a math object you created (math is not a constructor). polyfill for all x≥0x \geq 0, have x3=x1/3\sqrt[3]{x} = x^{1/3} so this can be emulated by the following function: if (!math.cbrt) { math.cbrt = (function(pow) { return function c...
Math.clz32() - JavaScript
e math.clz32() function returns the number of leading zero bits in the 32-bit binary representation of a number. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.clz32(x) parameters x a number. return value the number of leading zero bits in the 32-bit binary representation of the given number. description "clz32" is short for countleadingzeroes32. if x is not a number, then it will be converted to a number first, then converted to a 32-bit unsigned integer. if the converted 32-bit unsigned integer is 0, then return 32, because all bits are 0. this function is particularly useful for systems t...
Math.cos() - JavaScript
the math.cos() static function returns the cosine of the specified angle, which must be specified in radians. this value is length adjacent length hypotenuse . the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.cos(x) parameters x the angle in radians for which to return the cosine. return value the cosine of the given number. description the math.cos() method returns a numeric value between -1 and 1, which represents the cosine of the angle. because cos() is a static method of math, you always use it as math.cos(), rather than as a method of a math object you created (math...
Math.cosh() - JavaScript
xpressed using the constant e: math.cosh(x)=ex+e-x2\mathtt{\operatorname{math.cosh(x)}} = \frac{e^x + e^{-x}}{2} the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.cosh(x) parameters x a number. return value the hyperbolic cosine of the given number. description because cosh() is a static method of math, you always use it as math.cosh(), rather than as a method of a math object you created (math is not a constructor). polyfill this can be emulated with the help of the math.exp() function: math.cosh = math.cosh || function(x) { return (math.exp(x) + math.exp(-x)) / 2; } or using only one cal...
Math.exp() - JavaScript
x is the argument, and e is euler's number (also known as napier's constant), the base of the natural logarithms. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.exp(x) parameters x a number. return value a number representing ex, where e is euler's number and x is the argument. description because exp() is a static method of math, you always use it as math.exp(), rather than as a method of a math object you created (math is not a constructor). examples using math.exp() math.exp(-1); // 0.36787944117144233 math.exp(0); // 1 math.exp(1); // 2.718281828459045 specifications speci...
Math.expm1() - JavaScript
the math.expm1() function returns ex - 1, where x is the argument, and e the base of the natural logarithms. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.expm1(x) parameters x a number. return value a number representing ex - 1, where e is euler's number and x is the argument. description because expm1() is a static method of math, you always use it as math.expm1(), rather than as a method of a math object you created (math is not a constructor). polyfill this can be emulated with the help of the math.exp() function: math.expm1 = math.expm1 || function(x) { return math.exp(x) - 1; }; ...
Math.fround() - JavaScript
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. syntax var singlefloat = math.fround(doublefloat); parameters doublefloat a number. if the parameter is of a different type, it will get converted to a number or to nan if it cannot be converted. return value the nearest 32-bit single precision float representation of the given number. description javascript uses 64-bit double floating-point numbers internally, which offer a very high precision. however, sometimes you may be working with 32-bit floating-point numbers, for example if you are reading values from a float32array. this can create confusion: checking a 64-bit float and a 32-bit float for...
Math.log() - JavaScript
ue} \; y \; \text{such that} \; e^y = x the javascript math.log() function is equivalent to ln(x) in mathematics. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.log(x) parameters x a number. return value the natural logarithm (base e) of the given number. if the number is negative, nan is returned. description if the value of x is 0, the return value is always -infinity. if the value of x is negative, the return value is always nan. because log() is a static method of math, you always use it as math.log(), rather than as a method of a math object you created (math is not a constructor). if ...
Math.log10() - JavaScript
> 0, \mathtt{\operatorname{math.log10}(x)} = \log_10(x) = \text{the unique} \; y \; \text{such that} \; 10^y = x the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.log10(x) parameters x a number. return value the base 10 logarithm of the given number. if the number is negative, nan is returned. description if the value of x is less than 0, the return value is always nan. because log10() is a static method of math, you always use it as math.log10(), rather than as a method of a math object you created (math is not a constructor). this function is the equivalent of math.log(x) / math.log(10). for ...
Math.pow() - JavaScript
the exponent power, that is, baseexponent. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.pow(base, exponent) parameters base the base number. exponent the exponent used to raise the base. return value a number representing the given base taken to the power of the given exponent. description the math.pow() function returns the base to the exponent power, that is, baseexponent, the base and the exponent are in decimal numeral system. because pow() is a static method of math, you always use it as math.pow(), rather than as a method of a math object you created (math has no constructor). if th...
Math.round() - JavaScript
the math.round() function returns the value of a number rounded to the nearest integer. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.round(x) parameters x a number. return value the value of the given number rounded to the nearest integer. description if the fractional portion of the argument is greater than 0.5, the argument is rounded to the integer with the next higher absolute value. if it is less than 0.5, the argument is rounded to the integer with the lower absolute value. if the fractional portion is exactly 0.5, the argument is rounded to the next integer in the direction of +∞. ...
Math.sign() - JavaScript
itive, an explicit (+) will not be returned. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.sign(x) parameters x a number. if this argument is not a number, it is implicitly converted to one. return value a number representing the sign of the given argument: if the argument is positive, returns 1. if the argument is negative, returns -1. if the argument is positive zero, returns 0. if the argument is negative zero, returns -0. otherwise, nan is returned. description because sign() is a static method of math, you always use it as math.sign(), rather than as a method of a math object you ...
Math.sin() - JavaScript
the math.sin() function returns the sine of a number. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.sin(x) parameters x a number (given in radians). return value the sine of the given number. description the math.sin() method returns a numeric value between -1 and 1, which represents the sine of the angle given in radians. because sin() is a static method of math, you always use it as math.sin(), rather than as a method of a math object you created (math is not a constructor). examples using math.sin() math.sin(0); // 0 math.sin(1); // 0.8414709848078965 math.sin(math...
Math.sinh() - JavaScript
xpressed using the constant e: math.sinh(x)=ex-e-x2\mathtt{\operatorname{math.sinh(x)}} = \frac{e^x - e^{-x}}{2} the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.sinh(x) parameters x a number. return value the hyperbolic sine of the given number. description because sinh() is a static method of math, you always use it as math.sinh(), rather than as a method of a math object you created (math is not a constructor). polyfill this can be emulated with the help of the math.exp() function: math.sinh = math.sinh || function(x) { return (math.exp(x) - math.exp(-x)) / 2; } or using only one call...
Math.sqrt() - JavaScript
\forall x \geq 0, \mathtt{math.sqrt(x)} = \sqrt{x} = \text{the unique} \; y \geq 0 \; \text{such that} \; y^2 = x the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.sqrt(x) parameters x a number. return value the square root of the given number. if the number is negative, nan is returned. description if the value of x is negative, math.sqrt() returns nan. because sqrt() is a static method of math, you always use it as math.sqrt(), rather than as a method of a math object you created (math is not a constructor). examples using math.sqrt() math.sqrt(9); // 3 math.sqrt(2); // 1.414213562373095 ma...
Math.tanh() - JavaScript
description because tanh() is a static method of math, you always use it as math.tanh(), rather than as a method of a math object you created (math is not a constructor). ...
Math.trunc() - JavaScript
the math.trunc() function returns the integer part of a number by removing any fractional digits. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.trunc(x) parameters x a number. return value the integer part of the given number. description unlike the other three math methods: math.floor(), math.ceil() and math.round(), the way math.trunc() works is very simple. it truncates (cuts off) the dot and the digits to the right of it, no matter whether the argument is a positive or negative number. the argument passed to this method will be converted to number type implicitly. because trunc() is a ...
Number.EPSILON - 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. property attributes of number.epsilon writable no enumerable no configurable no description the epsilon property has a value of approximately 2.2204460492503130808472633361816e-16, or 2-52. polyfill if (number.epsilon === undefined) { number.epsilon = math.pow(2, -52); } examples testing equality x = 0.2; y = 0.3; z = 0.1; equal = (math.abs(x - y + z) < number.epsilon); specifications specification ecmascript (ecma-262)the definition of 'number.epsilon' in that specification. ...
Number.MIN_SAFE_INTEGER - JavaScript
b repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of number.min_safe_integer writable no enumerable no configurable no description the min_safe_integer constant has a value of -9007199254740991 (-9,007,199,254,740,991 or about -9 quadrillion). the reasoning behind that number is that javascript uses double-precision floating-point format numbers as specified in ieee 754 and can only safely represent numbers between -(253 - 1) and 253 - 1. see number.issafeinteger() for more information. because min_safe_integer is a static property of number, you always use it as ...
Number.NaN - JavaScript
the number.nan property represents not-a-number. equivalent of nan. you do not have to create a number object to access this static property (use number.nan). property attributes of number.nan writable no enumerable no configurable no examples checking whether values are numeric function sanitise(x) { if (isnan(x)) { return number.nan; } return x; } testing against nan see testing against nan on the nan page. specifications specification ecmascript (ecma-262)the definition of 'number.nan' in that specification. ...
Number() constructor - JavaScript
the number() constructor creates a number object. syntax new number(value) parameters value the numeric value of the object being created. examples creating number objects const a = new number('123'); // a === 123 is false const b = number('123'); // b === 123 is true a instanceof number; // is true b instanceof number; // is false specifications specification ecmascript (ecma-262)the definition of 'number constructor' in that specification. ...
Number.parseFloat() - JavaScript
argument and returns a floating point number. if a number cannot be parsed from the argument, it returns nan. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax number.parsefloat(string) parameters string the value to parse. if this argument is not a string, then it is converted to one using the tostring abstract operation. leading whitespace in this argument is ignored. return value a floating point number parsed from the given string. or nan when the first non-whitespace character cannot be converted to a number. polyfill if (number.parsefloat === undefined) { number.parsefloat = parsefloat; } e...
Number.parseInt() - JavaScript
mber.parseint() method parses a string argument and returns an integer of the specified radix or base. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax number.parseint(string,[ radix]) parameters string the value to parse. if this argument is not a string, then it is converted to one using the tostring abstract operation. leading whitespace in this argument is ignored. radix optional an integer between 2 and 36 that represents the radix (the base in mathematical numeral systems) of the string. be careful—this does not default to 10! return value an integer parsed from the given string. if the rad...
Number.prototype.toLocaleString() - JavaScript
arguments customize the behavior of the function and let applications specify the language whose formatting conventions should be used. in implementations, which ignore the locales and options arguments, the locale used and the form of the string returned are entirely implementation dependent. see the intl.numberformat() constructor for details on these parameters and how to use them. return value a string with a language-sensitive representation of the given number. performance when formatting large numbers of numbers, it is better to create a numberformat object and use the function provided by its numberformat.format property. examples using tolocalestring in basic use without specifying a locale, a formatted string in the default locale and with default options is returned. v...
Number.prototype.toSource() - JavaScript
the tosource() method returns a string representing the source code of the object. syntax numobj.tosource() number.tosource() return value a string representing the source code of the object. examples native function for the built-in number object, tosource() returns the following string indicating that the source code is not available: function number() { [native code] } for instances of number, tosource() returns a string representing the source code. this method is usually called internally by javascript and not explicitly in web code. specifications not part of any standard. ...
Number.prototype.toString() - JavaScript
ed number object. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax numobj.tostring([radix]) parameters radix optional. an integer in the range 2 through 36 specifying the base to use for representing numeric values. return value a string representing the specified number object. exceptions rangeerror if tostring() is given a radix less than 2 or greater than 36, a rangeerror is thrown. description the number object overrides the tostring() method of the object object. (it does not inherit object.prototype.tostring()). for number objects, the tostring() method returns a string representation of t...
Object() constructor - JavaScript
the object constructor creates an object wrapper for the given value. if the value is null or undefined, it will create and return an empty object. otherwise, it will return an object of a type that corresponds to the given value. if the value is an object already, it will return the value. when called in a non-constructor context, object behaves identically to new object(). syntax new object() new object(value) parameters value any value. examples creating a new object let o = new object() o.foo = 42 console.log(o) // object { foo: 42 } using object given undefined and null types the following examples store an empty object object in o: let o = new object() let o = new object(undefined) let o = new object(null) specifications specification ecm...
Object.prototype.__defineGetter__() - JavaScript
. this method should not be used since better alternatives exist. the __definegetter__ method binds an object's property to a function to be called when that property is looked up. syntax obj.__definegetter__(prop, func) parameters prop a string containing the name of the property to bind to the given function. func a function to be bound to a lookup of the specified property. return value undefined. description the __definegetter__ allows a getter to be defined on a pre-existing object. examples non-standard and deprecated way var o = {}; o.__definegetter__('gimmefive', function() { return 5; }); console.log(o.gimmefive); // 5 standard-compliant ways // using the get operator var o = { get gimmefive() { return 5; } }; console.log(o.gimmefive); // 5 // using object.define...
Object.prototype.__lookupGetter__() - JavaScript
the __lookupgetter__ method returns the function bound as a getter to the specified property. syntax obj.__lookupgetter__(sprop) parameters sprop a string containing the name of the property whose getter should be returned. return value the function bound as a getter to the specified property. description if a getter has been defined for an object's property, it's not possible to reference the getter function through that property, because that property refers to the return value of that function. __lookupgetter__ can be used to obtain a reference to the getter function. it is now possible to do this in a standardized way using object.getownpropertydescriptor() and object.getprototypeof(). examples standard-compliant and non-standard ways to get a property getter var obj = { ...
Object.getOwnPropertySymbols() - JavaScript
roperties found directly upon a given 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 object.getownpropertysymbols(obj) parameters obj the object whose symbol properties are to be returned. return value an array of all symbol properties found directly upon the given object. description similar to object.getownpropertynames(), you can get all symbol properties of a given object as an array of symbols. note that object.getownpropertynames() itself does not contain the symbol properties of an object and only the string properties. as all objects have no own symbol properties initially, object.g...
Object.isExtensible() - JavaScript
an object is extensible (whether it can have new properties added to it). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.isextensible(obj) parameters obj the object which should be checked. return value a boolean indicating whether or not the given object is extensible. description objects are extensible by default: they can have new properties added to them, and (in engines that support __proto__) their __proto__ property can be modified. an object can be marked as non-extensible using object.preventextensions(), object.seal(), or object.freeze(). examples using object.isextensible // new...
Object.isFrozen() - JavaScript
the object.isfrozen() determines if an object is frozen. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.isfrozen(obj) parameters obj the object which should be checked. return value a boolean indicating whether or not the given object is frozen. description an object is frozen if and only if it is not extensible, all its properties are non-configurable, and all its data properties (that is, properties which are not accessor properties with getter or setter components) are non-writable. examples using object.isfrozen // a new object is extensible, so it is not frozen. object.isfrozen({}); ...
Object.prototype.isPrototypeOf() - JavaScript
tps://github.com/mdn/interactive-examples and send us a pull request. isprototypeof() differs from the instanceof operator. in the expression "object instanceof afunction", the object prototype chain is checked against afunction.prototype, not against afunction itself. syntax prototypeobj.isprototypeof(object) parameters object the object whose prototype chain will be searched. return value a boolean indicating whether the calling object lies in the prototype chain of the specified object. errors thrown typeerror a typeerror is thrown if prototypeobj is undefined or null. description the isprototypeof() method allows you to check whether or not an object exists within another object's prototype chain. examples using isprototypeof this example demonstrates that baz.protot...
Object.isSealed() - JavaScript
the object.issealed() method determines if an object is sealed. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.issealed(obj) parameters obj the object which should be checked. return value a boolean indicating whether or not the given object is sealed. description returns true if the object is sealed, otherwise false. an object is sealed if it is not extensible and if all its properties are non-configurable and therefore not removable (but not necessarily non-writable). examples using object.issealed // objects aren't sealed by default. var empty = {}; object.issealed(empty); // === false...
Object.prototype.propertyIsEnumerable() - JavaScript
e specified property is enumerable and is the object's own property. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax obj.propertyisenumerable(prop) parameters prop the name of the property to test. return value a boolean indicating whether the specified property is enumerable and is the object's own property. description every object has a propertyisenumerable method. this method can determine whether the specified property in an object can be enumerated by a for...in loop, with the exception of properties inherited through the prototype chain. if the object does not have the specified property, this...
Promise.reject() - JavaScript
t() method returns a promise object that is rejected with a given reason. the source for this interactive example is stored in a github repository. if 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 promise.reject(reason); parameters reason reason why this promise rejected. return value a promise that is rejected with the given reason. description the static promise.reject function returns a promise that is rejected. for debugging purposes and selective error catching, it is useful to make reason an instanceof error. examples using the static promise.reject() method promise.reject(new error('fail')).then(function() { // not called }, function(error) { console.error(err...
handler.apply() - JavaScript
/github.com/mdn/interactive-examples and send us a pull request. syntax const p = new proxy(target, { apply: function(target, thisarg, argumentslist) { } }); parameters the following parameters are passed to the apply() method. this is bound to the handler. target the target object. thisarg the this argument for the call. argumentslist the list of arguments for the call. return value the apply() method can return any value. description the handler.apply() method is a trap for a function call. interceptions this trap can intercept these operations: proxy(...args) function.prototype.apply() and function.prototype.call() reflect.apply() invariants if the following invariants are violated, the proxy will throw a typeerror. the target must be a callable itself. that ...
handler.deleteProperty() - JavaScript
les project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax const p = new proxy(target, { deleteproperty: function(target, property) { } }); parameters the following parameters are passed to the deleteproperty() method. this is bound to the handler. target the target object. property the name or symbol of the property to delete. return value the deleteproperty() method must return a boolean indicating whether or not the property has been successfully deleted. description the handler.deleteproperty() method is a trap for the delete operator. interceptions this trap can intercept these operations: property deletion: delete proxy[foo] and delete proxy.foo reflect.deleteproperty() invariants if the following invariants are vi...
handler.has() - JavaScript
the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax const p = new proxy(target, { has: function(target, prop) { } }); parameters the following parameters are passed to has() method. this is bound to the handler. target the target object. prop the name or symbol of the property to check for existence. return value the has() method must return a boolean value. description the handler.has() method is a trap for the in operator. interceptions this trap can intercept these operations: property query: foo in proxy inherited property query: foo in object.create(proxy) with check: with(proxy) { (foo); } reflect.has() invariants if the following invariants are violated, the proxy will throw a typeerr...
handler.preventExtensions() - JavaScript
epository. if 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 const p = new proxy(target, { preventextensions: function(target) { } }); parameters the following parameter is passed to the preventextensions() method. this is bound to the handler. target the target object. return value the preventextensions() method must return a boolean value. description the handler.preventextensions() method is a trap for object.preventextensions(). interceptions this trap can intercept these operations: object.preventextensions() reflect.preventextensions() invariants if the following invariants are violated, the proxy will throw a typeerror: object.preventextensions(proxy) o...
Proxy.revocable() - JavaScript
the proxy.revocable() method is used to create a revocable proxy object. syntax proxy.revocable(target, handler); parameters target a target object to wrap with proxy. it can be any sort of object, including a native array, a function, or even another proxy. handler an object whose properties are functions define the behavior of proxy p when an operation is performed on it. return value a newly created revocable proxy object is returned. description a revocable proxy is an object with following two properties {proxy: proxy, revoke: revoke}. proxy a proxy object created with new proxy(target, handler) call. revoke a function with no argument to invalidate (switch off) the proxy. if the revoke() function gets called, the proxy becomes unusable: any trap to a handler will...
Comparing Reflect and Object methods - JavaScript
bject.defineproperties() returns the objects that were passed to the function. returns a typeerror if any properties were not successfully defined on the object. n/a set() n/a reflect.set() returns true if the property was set successfully on the object and false if it was not. throws a typeerror if the target was not an object. get() n/a reflect.get() returns the value of the property. throws a typeerror if the target was not an object. deleteproperty() n/a reflect.deleteproperty() returns true if the property was deleted from the object and false if it was not. getownpropertydescriptor() object.getownpropertydescriptor() returns a property descriptor of the given property if it exists on the object argument passed in, and returns und...
Reflect.construct() - JavaScript
/interactive-examples and send us a pull request. syntax reflect.construct(target, argumentslist[, newtarget]) parameters target the target function to call. argumentslist an array-like object specifying the arguments with which target should be called. newtarget optional the constructor whose prototype should be used. see also the new.target operator. if newtarget is not present, its value defaults to target. return value a new instance of target (or newtarget, if present), initialized by target as a constructor with the given argumentslist. exceptions a typeerror, if target or newtarget are not constructors. description reflect.construct() allows you to invoke a constructor with a variable number of arguments. (this would also be possible by using the spread syntax combined...
Reflect.deleteProperty() - JavaScript
this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax reflect.deleteproperty(target, propertykey) parameters target the target object on which to delete the property. propertykey the name of the property to be deleted. return value a boolean indicating whether or not the property was successfully deleted. exceptions a typeerror, if target is not an object. description the reflect.deleteproperty method allows you to delete a property on an object. it returns a boolean indicating whether or not the property was successfully deleted. it is almost identical to the non-strict delete operator. examples using reflect.delete...
Reflect.get() - JavaScript
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. syntax reflect.get(target, propertykey[, receiver]) parameters target the target object on which to get the property. propertykey the name of the property to get. receiver optional the value of this provided for the call to target if a getter is encountered. when used with proxy, it can be an object that inherits from target. return value the value of the property. exceptions a typeerror, if target is not an object. description the reflect.get method allows you to get a property on an object. it is like the property accessor syntax as a function. examples using reflect.get()...
Reflect.has() - JavaScript
he source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax reflect.has(target, propertykey) parameters target the target object in which to look for the property. propertykey the name of the property to check. return value a boolean indicating whether or not the target has the property. exceptions a typeerror, if target is not an object. description the reflect.has method allows you to check if a property is in an object. it works like the in operator as a function. examples using reflect.has() reflect.has({x: 0}, 'x') // true reflect.has({x: 0}, 'y') // false // returns true for properties in the protot...
Reflect.isExtensible() - JavaScript
ject.isextensible(), but with some differences. the source for this interactive example is stored in a github repository. if 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 reflect.isextensible(target) parameters target the target object which to check if it is extensible. return value a boolean indicating whether or not the target is extensible. exceptions a typeerror, if target is not an object. description the reflect.isextensible method allows you determine if an object is extensible (whether it can have new properties added to it). it is the same method as object.isextensible(). examples using reflect.isextensible() see also object.isextensible(). // new objects a...
Reflect.ownKeys() - JavaScript
urns an array of the target object's own property keys. the source for this interactive example is stored in a github repository. if 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 reflect.ownkeys(target) parameters target the target object from which to get the own keys. return value an array of the target object's own property keys. exceptions 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)). examples using reflect.ownkeys() reflect.ownkeys({z: 3, y: 2, x: 1}) // [ ...
Reflect.preventExtensions() - JavaScript
reventextensions(), but with some differences. the source for this interactive example is stored in a github repository. if 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 reflect.preventextensions(target) parameters target the target object on which to prevent extensions. return value a boolean indicating whether or not the target was successfully set to prevent extensions. exceptions a typeerror, if target is not an object. description the reflect.preventextensions() method allows you to prevent new properties from ever being added to an object (i.e., prevents future extensions to the object). it is similar to object.preventextensions(). examples using reflect.prevente...
Reflect.setPrototypeOf() - JavaScript
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. syntax reflect.setprototypeof(target, prototype) parameters target the target object of which to set the prototype. prototype the object's new prototype (an object or null). return value a boolean indicating whether or not the prototype was successfully set. exceptions a typeerror, if target is not an object or if prototype is neither an object nor null. description the reflect.setprototypeof method changes the prototype (i.e. the value of the internal [[prototype]] property) of the specified object. examples using reflect.setprototypeof() reflect.setprototypeof({}, objec...
RegExp.prototype[@@match]() - JavaScript
ves the matches when matching a string against a regular expression. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax regexp[symbol.match](str) parameters str a string that is a target of the match. return value an array containing the entire match result and any parentheses-captured matched results, or null if there were no matches. description this method is called internally in string.prototype.match(). for example, the following two examples return same result. 'abc'.match(/a/); /a/[symbol.match]('abc'); this method exists for customizing match behavior within regexp subclasses. examples dir...
RegExp.prototype[@@replace]() - JavaScript
at replaces the substring. a number of special replacement patterns are supported; see the specifying a string as a parameter section in string.prototype.replace() page. function (replacement) a function to be invoked to create the new substring. the arguments supplied to this function are described in the specifying a function as a parameter section in string.prototype.replace() page. return value a new string with some or all matches of a pattern replaced by a replacement. description this method is called internally in string.prototype.replace() if the pattern argument is a regexp object. for example, following two examples return same result. 'abc'.replace(/a/, 'a'); /a/[symbol.replace]('abc', 'a'); this method exists for customizing replace behavior in regexp subclass. if patte...
RegExp.prototype[@@search]() - JavaScript
search for a match between a this regular expression and a 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 regexp[symbol.search](str) parameters str a string that is a target of the search. return value integer if successful, [@@search]() returns the index of the first match of the regular expression inside the string. otherwise, it returns -1. description this method is called internally in string.prototype.search(). for example, the following two examples return the same result. 'abc'.search(/a/); /a/[symbol.search]('abc'); this method exists for customizing the search behavior in re...
RegExp.prototype[@@split]() - JavaScript
quest. syntax regexp[symbol.split](str[, limit]) parameters str the target of the split operation. limit optional integer specifying a limit on the number of splits to be found. the [@@split]() method still splits on every match of this regexp pattern (or, in the syntax above, regexp), until the number of split items match the limit or the string falls short of this pattern. return value an array containing substrings as its elements. description this method is called internally in string.prototype.split() if its separator argument is an object that has a @@split method, such as a regexp. for example, the following two examples return the same result. 'a-b-c'.split(/-/); /-/[symbol.split]('a-b-c'); this method exists for customizing the behavior of split() in regexp subclas...
RegExp.prototype.compile() - JavaScript
the deprecated compile() method is used to (re-)compile a regular expression during execution of a script. it is basically the same as the regexp constructor. syntax regexobj.compile(pattern, flags) parameters pattern the text of the regular expression. flags if specified, flags can have any combination of the following values: g global match i ignore case m multiline; treat beginning and end characters (^ and $) as working over multiple lines (i.e., match the beginning or end of each line (delimited by \n or \r), not only the very beginning or end of the whole input string) y sticky; matches only from the index indicated by the lastindex property of this regular expression in the target string (and does not attempt to match from any later indexes). descri...
RegExp.prototype.dotAll - JavaScript
the dotall property indicates whether or not the "s" flag is used with the regular expression. dotall is a read-only property of an individual regular expression instance. property attributes of regexp.prototype.dotall writable no enumerable no configurable yes description the value of dotall is a boolean and true if the "s" flag was used; otherwise, false. the "s" flag indicates that the dot special character (".") should additionally match the following line terminator ("newline") characters in a string, which it would not match otherwise: u+000a line feed (lf) ("\n") u+000d carriage return (cr) ("\r") u+2028 line separator u+2029 paragraph separator this effectively means the dot wil...
RegExp.prototype.exec() - JavaScript
otype.test() method or string.prototype.search() instead. the source for this interactive example is stored in a github repository. if 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 regexobj.exec(str) parameters str the string against which to match the regular expression. return value if the match succeeds, the exec() method returns an array (with extra properties index and input; see below) and updates the lastindex property of the regular expression object. the returned array has the matched text as the first item, and then one item for each parenthetical capture group of the matched text. if the match fails, the exec() method returns null, and sets lastindex to 0. descri...
RegExp.prototype.global - JavaScript
ve example is stored in a github repository. if 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 regexp.prototype.global writable no enumerable no configurable yes description the value of global is a boolean and true if the "g" flag was used; otherwise, false. the "g" flag indicates that the regular expression should be tested against all possible matches in a string. a regular expression defined as both global ("g") and sticky ("y") will ignore the global flag and perform sticky matches. you cannot change this property directly. examples using global var regex = new regexp...
RegExp.prototype.ignoreCase - JavaScript
xample is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of regexp.prototype.ignorecase writable no enumerable no configurable yes description the value of ignorecase is a boolean and true if the "i" flag was used; otherwise, false. the "i" flag indicates that case should be ignored while attempting a match in a string. you cannot change this property directly. examples using ignorecase var regex = new regexp('foo', 'i'); console.log(regex.ignorecase); // true specifications specification ecmascript (ecma-262)the definit...
RegExp.input ($_) - JavaScript
the non-standard input property is a static property of regular expressions that contains the string against which a regular expression is matched. regexp.$_ is an alias for this property. description the input property is static, it is not a property of an individual regular expression object. instead, you always use it as regexp.input or regexp.$_. the value of the input property is modified whenever the searched string on the regular expression is changed and that string is matching. examples using input and $_ var re = /hi/g; re.test('hi there!'); regexp.input; // "hi there!" re.test('foo'); // new test, non-matching regexp.$_; // "hi there!" re.test('hi world!'); // new test, matching regexp.$_; // "hi world!" specifications ...
RegExp.lastMatch ($&) - JavaScript
the non-standard lastmatch property is a static and read-only property of regular expressions that contains the last matched characters. regexp.$& is an alias for this property. description the lastmatch property is static, it is not a property of an individual regular expression object. instead, you always use it as regexp.lastmatch or regexp['$&']. the value of the lastmatch property is read-only and modified whenever a successful match is made. you can not use the shorthand alias with the dot property accessor (regexp.$&), because the parser expects an expression with "&" in that case and a syntaxerror is thrown. use the bracket notation for property access. examples using lastmatch and $& var re = /hi/g; re.test('hi there!'); regexp.lastmatch; // "hi" regexp['$&']; // ...
RegExp.lastParen ($+) - JavaScript
the non-standard lastparen property is a static and read-only property of regular expressions that contains the last parenthesized substring match, if any. regexp.$+ is an alias for this property. description the lastparen property is static, it is not a property of an individual regular expression object. instead, you always use it as regexp.lastparen or regexp['$+']. the value of the lastparen property is read-only and modified whenever a successful match is made. you can not use the shorthand alias with the dot property accessor (regexp.$+), because the parser expects an expression with "+" in that case and a syntaxerror is thrown. use the bracket notation for property access. examples using lastparen and $+ var re = /(hi)/g; re.test('hi there!'); regexp.lastparen; // "hi" ...
RegExp.leftContext ($`) - JavaScript
the non-standard leftcontext property is a static and read-only property of regular expressions that contains the substring preceding the most recent match. regexp.$` is an alias for this property. description the leftcontext property is static, it is not a property of an individual regular expression object. instead, you always use it as regexp.leftcontext or regexp['$`']. the value of the leftcontext property is read-only and modified whenever a successful match is made. you can not use the shorthand alias with the dot property accessor (regexp.$`), because the parser expects a starting template string in that case and a syntaxerror is thrown. use the bracket notation for property access. examples using leftcontext and $` var re = /world/g; re.test('hello world!'); regexp.le...
RegExp.prototype.multiline - JavaScript
example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of regexp.prototype.multiline writable no enumerable no configurable yes description the value of multiline is a boolean and is true if the "m" flag was used; otherwise, false. the "m" flag indicates that a multiline input string should be treated as multiple lines. for example, if "m" is used, "^" and "$" change from matching at only the start or end of the entire string to the start or end of any line within the string. you cannot change this property directly. examples using multilin...
RegExp.$1-$9 - JavaScript
the legacy regexp $1, $2, $3, $4, $5, $6, $7, $8, $9 properties are static and read-only properties of regular expressions that contain parenthesized substring matches. description the $1, ..., $9 properties are static, they are not a property of an individual regular expression object. instead, you always use them as regexp.$1, ..., regexp.$9. the values of these properties are read-only and modified whenever successful matches are made. the number of possible parenthesized substrings is unlimited, but the regexp object can only hold the first nine. you can access all parenthesized substrings through the returned array's indexes. these properties can be used in the replacement text for the string.replace method. when used this way, do not prepend them with regexp. the example below illus...
RegExp.rightContext ($') - JavaScript
the non-standard rightcontext property is a static and read-only property of regular expressions that contains the substring following the most recent match. regexp.$' is an alias for this property. description the rightcontext property is static, it is not a property of an individual regular expression object. instead, you always use it as regexp.rightcontext or regexp["$'"]. the value of the rightcontext property is read-only and modified whenever a successful match is made. you can not use the shorthand alias with the dot property accessor (regexp.$'), because the parser expects a starting string in that case and a syntaxerror is thrown. use the bracket notation for property access. examples using rightcontext and $' var re = /hello/g; re.test('hello world!'); regexp.rightc...
RegExp.prototype.sticky - JavaScript
ve example is stored in a github repository. if 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 regexp.prototype.sticky writable no enumerable no configurable yes description the value of sticky is a boolean and true if the "y" flag was used; otherwise, false. the "y" flag indicates that it matches only from the index indicated by the lastindex property of this regular expression in the target string (and does not attempt to match from any later indexes). a regular expression defined as both sticky and global ignores the global flag. you cannot change this property directly. i...
RegExp.prototype.toSource() - JavaScript
examples native function for the built-in regexp object, tosource() returns the following string indicating that the source code is not available: function regexp() { [native code] } for instances of regexp, tosource() returns a string representing the source code. ...
RegExp.prototype.unicode - JavaScript
e example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of regexp.prototype.unicode writable no enumerable no configurable yes description the value of unicode is a boolean and true if the "u" flag was used; otherwise false. the "u" flag enables various unicode-related features. with the "u" flag, any unicode code point escapes will be interpreted as such, for example. you cannot change this property directly. it is read-only. examples using the unicode property var regex = new regexp('\u{61}', 'u'); console.log(regex.unicode); // true ...
Set() constructor - JavaScript
the set constructor lets you create set objects that store unique values of any type, whether primitive values or object references. the source for this interactive example is stored in a github repository. if 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 set([iterable]) parameters iterable optional if an iterable object is passed, all of its elements will be added to the new set. if you don't specify this parameter, or its value is null, the new set is empty. return value a new set object. examples using the set object let myset = new set() myset.add(1) // set [ 1 ] myset.add(5) // set [ 1, 5 ] myset.add(5) // set [ 1, 5 ] myset.a...
Set.prototype.add() - JavaScript
the add() method appends a new element with a specified value to the end of a set 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 myset.add(value); parameters value the value of the element to add to the set object. return value the set object. examples using the add method var myset = new set(); myset.add(1); myset.add(5).add('some text'); // chainable console.log(myset); // set [1, 5, "some text"] specifications specification ecmascript (ecma-262)the definition of 'set.prototype.add' in that specification. ...
Set.prototype.clear() - JavaScript
the clear() method removes all elements from a set 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 myset.clear(); return value undefined. examples using the clear method var myset = new set(); myset.add(1); myset.add('foo'); myset.size; // 2 myset.has('foo'); // true myset.clear(); myset.size; // 0 myset.has('bar') // false specifications specification ecmascript (ecma-262)the definition of 'set.prototype.clear' in that specification. ...
Set.prototype.delete() - JavaScript
the delete() method removes the specified element from a set 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 myset.delete(value); parameters value the value to remove from myset. return value returns true if value was successfully removed from myset; otherwise false. examples using the delete() method const myset = new set(); myset.add('foo'); myset.delete('bar'); // returns false. no "bar" element found to be deleted. myset.delete('foo'); // returns true. successfully removed. myset.has('foo'); // returns false. the "foo" element is no longer present. let's checkout below how to de...
Set.prototype.has() - JavaScript
the has() method returns a boolean indicating whether an element with the specified value exists in a set object or not. the source for this interactive example is stored in a github repository. if 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 myset.has(value); parameters value the value to test for presence in the set object. return value returns true if an element with the specified value exists in the set object; otherwise false. note: technically speaking, has() uses the samevaluezero algorithm to determine whether the given element is found. examples using the has method var myset = new set(); myset.add('foo'); myset.has('foo'); // returns true myset.has('bar');...
Set.prototype.size - JavaScript
the size accessor property returns the number of (unique) elements in a set 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. description the value of size is an integer representing how many entries the set object has. a set accessor function for size is undefined; you cannot change this property. examples using size var myset = new set(); myset.add(1); myset.add(5); myset.add('some text') myset.size; // 3 specifications specification ecmascript (ecma-262)the definition of 'set.prototype.size' in that specification. ...
SharedArrayBuffer() constructor - JavaScript
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 sharedarraybuffer object of the specified size. its contents are initialized to 0. examples always use the new operator to create a sharedarraybuffer sharedarraybuffer constructors are required to be constructed with a new operator. calling a sharedarraybuffer constructor as a function without new will throw a typeerror. var sab = sharedarraybuffer(1024); // typeerror: calling a builti...
SharedArrayBuffer.prototype.byteLength - JavaScript
aybuffer 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 bytelength 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 bytelength var sab = new sharedarraybuffer(1024); sab.bytelength; // 1024 specifications specification ecmascript (ecma-262)the definition of 'sharedarraybuffer.prototype.bytelength' in that specification. ...
SharedArrayBuffer.prototype.slice() - JavaScript
t 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 (sab.bytelength). return value a new sharedarraybuffer containing the extracted elements. examples using slice var sab = new sharedarraybuffer(1024); sab.slice(); // sharedarraybuffer { bytelength: 1024 } sab.slice(2); // sharedarraybuffer { bytelength: 1022 } sab.slice(-2); // sharedarraybuffer { bytelength: 2 } sab.slice(0, 1); // sharedarraybuffer { bytelength: 1 } specifications specification ...
String.prototype.anchor() - JavaScript
the anchor() method creates a string beginning with an <a name="..."> start tag, then some text, and then an </a> end tag. don't use this method. use dom apis instead. also, the html specification no longer allows the <a> element to have a name attribute, so this method doesn't even create valid markup. syntax str.anchor(name) parameters name a string representing a name value to put into the generated <a name="..."> start tag. return value a string beginning with an <a name="name"> start tag, then the text str, and then an </a> end tag description don't use this method. use dom apis instead. also, the html specification no longer allows the <a> element to have a name attribute, so this method doesn't even create valid markup. examples using anchor() var mystring = 'table o...
String.prototype.big() - JavaScript
description the big() method embeds a string in a <big> tag: "<big>str</big>". ...
String.prototype.blink() - JavaScript
description the blink() method embeds a string in a <blink> tag: "<blink>str</blink>". ...
String.prototype.bold() - JavaScript
description the bold() method embeds a string in a <b> tag: "<b>str</b>". ...
String.prototype.concat() - JavaScript
ing arguments to the calling string and returns a new 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.concat(str2 [, ...strn]) parameters str2 [, ...strn] strings to concatenate to str. return value a new string containing the combined text of the strings provided. description the concat() function concatenates the string arguments to the calling string and returns a new string. changes to the original string or the returned string don't affect the other. if the arguments are not of the type string, they are converted to string values before concatenating. performance it is strongly re...
String.prototype.endsWith() - JavaScript
in a github repository. if 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. polyfill this method has been added to the ecmascript 6 specification and may not be available in all javascript implementations yet. however, you can polyfill string.prototype.endswith(...
String.prototype.fixed() - JavaScript
description the fixed() method embeds a string in a <tt> tag: "<tt>str</tt>". ...
String.prototype.fontcolor() - JavaScript
o be displayed in the specified font color. usage note: the <font> element has been removed in html5 and shouldn't be used anymore. instead web developers should use css properties. syntax str.fontcolor(color) parameters color a string expressing the color as a hexadecimal rgb triplet or as a string literal. string literals for color names are listed in the css color reference. return value a string containing a <font> html element. description if you express color as a hexadecimal rgb triplet, you must use the format rrggbb. for example, the hexadecimal rgb values for salmon are red=fa, green=80, and blue=72, so the rgb triplet for salmon is "fa8072". examples using fontcolor() the following example uses the fontcolor() method to change the color of a string by producing a st...
String.prototype.fontsize() - JavaScript
the fontsize() method creates a <font> html element that causes a string to be displayed in the specified font size. usage note: the <font> element has been removed in html5 and shouldn't be used anymore. instead web developers should use css properties. syntax str.fontsize(size) parameters size an integer between 1 and 7, a string representing a signed integer between 1 and 7. return value a string containing a <font> html element. description when you specify size as an integer, you set the font size of str to one of the 7 defined sizes. when you specify size as a string such as "-2", you adjust the font size of str relative to the size set in the <basefont> tag. examples using fontsize() the following example uses string methods to change the size of a string: var worldstr...
String.prototype.includes() - JavaScript
pository. if 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.includes(searchstring[, position]) parameters searchstring a string to be searched for within str. position optional the position within the string at which to begin searching for searchstring. (defaults to 0.) return value true if the search string is found anywhere within the given string; otherwise, false if not. description this method lets you determine whether or not a string includes another string. case-sensitivity the includes() method is case sensitive. for example, the following expression returns false: 'blue whale'.includes('blue') // returns false polyfill this method has been added to the ec...
String.prototype.italics() - JavaScript
description the italics() method embeds a string in an <i> tag: "<i>str</i>". ...
String.prototype.link() - JavaScript
the link() method creates a string representing the code for an <a> html element to be used as a hypertext link to another url. syntax str.link(url) parameters url any string that specifies the href attribute of the <a> tag; it should be a valid url (relative or absolute), with any & characters escaped as &amp;, and any " characters escaped as &quot;. return value a string containing an <a> html element. description use the link() method to create an html snippet for a hypertext link. the returned string can then be added to the document via document.write() or element.innerhtml. links created with the link() method become elements in the links array of the document object. see document.links. examples using link() the following example displays the word "mdn" as a hypertext ...
String.prototype.matchAll() - JavaScript
the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.matchall(regexp) parameters regexp a regular expression object. if a non-regexp object obj is passed, it is implicitly converted to a regexp by using new regexp(obj). the regexp object must have the /g flag, otherwise a typeerror will be thrown. return value an iterator (which is not a restartable iterable). examples regexp.exec() and matchall() prior to the addition of matchall to javascript, it was possible to use calls to regexp.exec (and regexes with the /g flag) in a loop to obtain all the matches: const regexp = regexp('foo[a-z]*','g'); const str = 'table football, foosball'; let match; while ((match = regexp.exec(str)) !== null) { cons...
String.prototype.padStart() - JavaScript
rrent 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(targetlength [, padstring]) parameters targetlength 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 targetlength, it will be truncated from the end. the default value is " " (u+0020 'space'). return value a string of the specified targetlength with padstring applied from the start. examples basic examples 'abc'.padstart(10); ...
String.prototype.repeat() - JavaScript
, concatenated together. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.repeat(count) parameters count an integer between 0 and +infinity, indicating the number of times to repeat the string. return value a new string containing the specified number of copies of the given string. exceptions rangeerror: repeat count must be non-negative. rangeerror: repeat count must be less than infinity and not overflow maximum string size. polyfill this method has been added to the ecmascript 2015 specification and may not be available in all javascript implementations yet. however, you can polyfill str...
String.prototype.slice() - JavaScript
is greater than or equal to str.length, slice() returns an empty string. endindex optional the zero-based index before which to end extraction. the character at this index will not be included. if endindex is omitted, slice() extracts to the end of the string. if negative, it is treated as str.length + endindex. (for example, if endindex is -3 it is treated as str.length - 3.) return value a new string containing the extracted section of the string. description slice() extracts the text from one string and returns a new string. changes to the text in one string do not affect the other string. slice() extracts up to but not including endindex. str.slice(1, 4) extracts the second character through the fourth character (characters indexed 1, 2, and 3). as an example, str.slice(2,...
String.prototype.small() - JavaScript
description the small() method embeds a string in a <small> tag: "<small>str</small>". ...
String.prototype.strike() - JavaScript
description the strike() method embeds a string in a <strike> tag: "<strike>str</strike>". ...
String.prototype.sub() - JavaScript
description the sub() method embeds a string in a <sub> tag: "<sub>str</sub>". examples using sub() and sup() methods the following example uses the sub() and sup() methods to format a string: var supertext = 'superscript'; var subtext = 'subscript'; console.log('this is what a ' + supertext.sup() + ' looks like.'); // this is what a <sup>superscript</sup> looks like console.log('this is what a ' + subtext.sub() + ' looks like.'); // this is what a <sub>subscript</sub> looks like. ...
String.prototype.sup() - JavaScript
description the sup() method embeds a string in a <sup> tag: "<sup>str</sup>". ...
String.prototype.toLowerCase() - JavaScript
the tolowercase() method returns the calling string value converted to lower case. the source for this interactive example is stored in a github repository. if 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.tolowercase() return value a new string representing the calling string converted to lower case. description the tolowercase() method returns the value of the string converted to lower case. tolowercase() does not affect the value of the string str itself. examples using tolowercase() console.log('alphabet'.tolowercase()); // 'alphabet' specifications specification ecmascript (ecma-262)the definition of 'string.prototype.tolowercase' in that spe...
String.prototype.toSource() - JavaScript
the tosource() method returns a string representing the source code of the object. syntax string.tosource() str.tosource() return value a string representing the source code of the calling object. examples native function for the built-in string object, tosource() returns the following string indicating that the source code is not available: function string() { [native code] } for instances of string or string literals, tosource() returns a string representing the source code. this method is usually called internally by javascript and not explicitly in web code. specifications not part of any standard. ...
String.prototype.toString() - JavaScript
the tostring() method returns a string representing the specified object. syntax str.tostring() return value a string representing the calling object. description the string object overrides the tostring() method of the object object; it does not inherit object.prototype.tostring(). for string objects, the tostring() method returns a string representation of the object and is the same as the string.prototype.valueof() method. examples using tostring() the following example displays the string value of a string object: var x = new string('hello world'); console.log(x.tostring()); // logs 'hello world' specifications specification ecmascript (ecma-262)the definition of 'string.prototype.tostring' in that specification. ...
String.prototype.trim() - JavaScript
space in this context is all the whitespace characters (space, tab, no-break space, etc.) and all the line terminator characters (lf, cr, etc.). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.trim() return value a new string representing the str stripped of whitespace from both ends. description the trim() method returns the string stripped of whitespace from both ends. trim() does not affect the value of the str itself. polyfill running the following code before any other code will create trim() if it's not natively available. if (!string.prototype.trim) { string.prototype.trim = function () { ...
String.prototype.trimEnd() - JavaScript
the trimend() method removes whitespace from the end of a string. trimright() is an alias of this method. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.trimend(); str.trimright(); return value a new string representing the calling string stripped of whitespace from its (right) end. description the trimend() / trimright() methods return the string stripped of whitespace from its right end. trimend() or trimright() do not affect the value of the string itself. aliasing for consistency with functions like string.prototype.padend the standard method name is trimend. however, for web compatibility reas...
String.prototype.trimStart() - JavaScript
the trimstart() method removes whitespace from the beginning of a string. trimleft() is an alias of this method. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.trimstart(); str.trimleft(); return value a new string representing the calling string stripped of whitespace from its beginning (left end). description the trimstart() / trimleft() methods return the string stripped of whitespace from its left end. trimleft() or trimstart() do not affect the value of the string itself. aliasing for consistency with functions like string.prototype.padstart the standard method name is trimstart. however, for ...
Symbol.prototype[@@toPrimitive] - JavaScript
the [@@toprimitive]() method converts a symbol object to a primitive value. syntax symbol()[symbol.toprimitive](hint) return value the primitive value of the specified symbol object. description the [@@toprimitive]() method of symbol returns the primitive value of a symbol object as a symbol data type. the hint argument is not used. javascript calls the [@@toprimitive]() method to convert an object to a primitive value. you rarely need to invoke the [@@toprimitive]() method yourself; javascript automatically invokes it when encountering an object where a primitive value is expected. examples using @@toprimitive const sym = symbol("example"); sym === sym[symbol.toprimitive](); // true specifications specification ecmascript (ecma-262)the definition of 'symbol.pro...
Symbol.hasInstance - JavaScript
...
Symbol.isConcatSpreadable - JavaScript
using the array.prototype.concat() method. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. description the @@isconcatspreadable symbol (symbol.isconcatspreadable) can be defined as an own or inherited property and its value is a boolean. it can control behavior for arrays and array-like objects: for array objects, the default behavior is to spread (flatten) elements. symbol.isconcatspreadable can avoid flattening in these cases. for array-like objects, the default behavior is no spreading or flattening. symbol.isconcatspreadable can force flattening in these cases. property attributes of symbol.
Symbol.iterator - JavaScript
eractive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. description whenever an object needs to be iterated (such as at the beginning of a for..of loop), its @@iterator method is called with no arguments, and the returned iterator is used to obtain the values to be iterated. some built-in types have a default iteration behavior, while other types (such as object) do not. the built-in types with a @@iterator method are: array.prototype[@@iterator]() typedarray.prototype[@@iterator]() string.prototype[@@iterator]() map.prototype[@@iterator]() set.prototype[@@iterator]() see also iteration protocols for more information. proper...
Symbol.keyFor() - JavaScript
d symbol key from the global symbol registry for the given symbol. the source for this interactive example is stored in a github repository. if 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 symbol.keyfor(sym); parameters sym symbol, required. the symbol to find a key for. return value a string representing the key for the given symbol if one is found on the global registry; otherwise, undefined. examples using keyfor var globalsym = symbol.for('foo'); // create a new global symbol symbol.keyfor(globalsym); // "foo" var localsym = symbol(); symbol.keyfor(localsym); // undefined // well-known symbols are not symbols registered // in the global symbol registry symbol.keyfor...
Symbol.match - JavaScript
s and send us a pull request. description this function is also used to identify if objects have the behavior of regular expressions. for example, the methods string.prototype.startswith(), string.prototype.endswith() and string.prototype.includes(), check if their first argument is a regular expression and will throw a typeerror if they are. now, if the match symbol is set to false (or a falsy value), it indicates that the object is not intended to be used as a regular expression object. property attributes of symbol.match writable no enumerable no configurable no examples disabling the isregexp check the following code will throw a typeerror: '/bar/'.startswith(/bar/); // throws typeerror, ...
Symbol.replace - JavaScript
y. if 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 symbol.replace writable no enumerable no configurable no examples using symbol.replace class customreplacer { constructor(value) { this.value = value; } [symbol.replace](string) { return string.replace(this.value, '#!@?'); } } console.log('football'.replace(new customreplacer('foo'))); // expected output: "#!@?tball" specifications specification ecmascript (ecma-262)the definition of 'symbol.replace' in that specification. ...
Symbol.search - JavaScript
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 symbol.search writable no enumerable no configurable no examples custom string search class caseinsensitivesearch { constructor(value) { this.value = value.tolowercase(); } [symbol.search](string) { return string.tolowercase().indexof(this.value); } } console.log('foobar'.search(new caseinsensitivesearch('bar'))); // expected output: 3 specifications specification ecmascript (ecma-262)the definition of 'symbol.search' in that specification. ...
Symbol.species - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. description the species accessor property allows subclasses to override the default constructor for objects. ...
Symbol.prototype.toSource() - JavaScript
the tosource() method returns a string representing the source code of the object. this method is usually called internally by javascript. syntax symbol.tosource() var sym = symbol() sym.tosource() return value a string representing the source code of the object. examples native function for the built-in symbol object, tosource returns the following string indicating that the source code is not available: "function symbol() { [native code] }" for instances of symbol, tosource returns a string representing the source code. "symbol()" specifications not part of any standard. ...
Symbol.prototype.toString() - JavaScript
the tostring() method returns a string representing the specified symbol 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 symbol().tostring() return value a string representing the specified symbol object. description the symbol object overrides the tostring method of the object object; it does not inherit object.prototype.tostring(). for symbol objects, the tostring method returns a string representation of the object. no string concatenation while you can call tostring() on symbols, you cannot use string concatenation with them: symbol('foo') + 'bar' // typeerror: can't convert symbol t...
Symbol.toStringTag - JavaScript
it is accessed internally by the object.prototype.tostring() method. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
TypeError() constructor - JavaScript
syntax new typeerror([message[, filename[, linenumber]]]) parameters message optional optional. human-readable description of the error filename optional optional. the name of the file containing the code that caused the exception linenumber optional optional. ...
TypedArray.prototype.buffer - JavaScript
at construction time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. 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 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 { bytelength: 8 } specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.buffer' in th...
TypedArray.prototype.byteLength - JavaScript
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 bytelength 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. examples using the bytelength property var buffer = new arraybuffer(8); var uint8 = new uint8array(buffer); uint8.bytelength; // 8 (matches the bytelength of...
TypedArray.prototype.byteOffset - JavaScript
typedarray is one of the typedarray objects. ...
TypedArray.prototype.copyWithin() - JavaScript
se 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 where to start copying elements from. end optional optional. source end index position where to end copying elements from. return value the modified array. description see array.prototype.copywithin for more details. examples using copywithin var buffer = new arraybuffer(8); var uint8 = new uint8array(buffer); uint8.set([1,2,3]); console.log(uint8); // uint8array [ 1, 2, 3, 0, 0, 0, 0, 0 ] uint8.copywithin(3,0,3); console.log(uint8); // uint8array [ 1, 2, 3, 1, 2, 3, 0, 0 ] specifications specification ...
TypedArray.prototype.includes() - JavaScript
ub repository. if 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.includes(searchelement[, fromindex]); parameters searchelement the element to search for. fromindex optional. the position in this array at which to begin searching for searchelement; defaults to 0. return value a boolean. examples using includes var uint8 = new uint8array([1,2,3]); uint8.includes(2); // true uint8.includes(4); // false uint8.includes(3, 3); // false // nan handling (only true for float32 and float64) new uint8array([nan]).includes(nan); // false, since the nan passed to the constructor gets converted to 0 new float32array([nan]).includes(nan); // true; new float64array([na...
TypedArray.prototype.indexOf() - JavaScript
ttps://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). return value the first index of the element in the array; -1 if not found. description i...
TypedArray.prototype.lastIndexOf() - JavaScript
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 typed array. note that even when the index is negative, the typed array is still searched from back to front. if the calculated index is less than 0, -1 is returned, i.e. the typed array will not be searched. return value the last index of the element in the array; -1 if not found. description lastindexof compares searchelement to elements of the typed array using strict equality (the same method used by the ===, or triple-equals, operator). examples using lastindexof var uint8 = new uint8array([2, 5, 9, 2]); uint8.lastindexof(2); // 3 uint8.lastindexof(7); // -1 uint8.lastindexof(2, 3); // 3 uint8.
TypedArray.prototype.length - JavaScript
nts) 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. examples using the length property var buffer = new arraybuffer(8); var uint8 = new uint8array(buffer); uint8.length; // 8 (matches the length of the buffer)...
TypedArray.name - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of typedarray.name writable no enumerable no configurable no description typedarray objects differ from each other in the number of bytes per element and in the way the bytes are interpreted. the name property describes of what data type the array consists. ...
TypedArray.of() - JavaScript
please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.of(element0[, element1[, ...[, elementn]]]) where typedarray is one of: int8array uint8array uint8clampedarray int16array uint16array int32array uint32array float32array float64array bigint64array biguint64array parameters elementn elements of which to create the typed array. return value a new typedarray instance. description some subtle distinctions between array.of() and typedarray.of(): if the this value passed to typedarray.of is not a constructor, typedarray.of will throw a typeerror, where array.of defaults to creating a new array. typedarray.of uses [[put]] where array.of uses [[defineproperty]]. hence, when working with proxy objects, it calls handler.set to create...
TypedArray.prototype.reverse() - JavaScript
becomes the first. this method has the same algorithm as array.prototype.reverse(). 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.reverse(); return value the reversed array. examples using reverse var uint8 = new uint8array([1, 2, 3]); uint8.reverse(); console.log(uint8); // uint8array [3, 2, 1] specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.reverse' in that specification. ...
TypedArray.prototype.sort() - JavaScript
the sort() method sorts the elements of a typed array numerically in place and returns the typed array. this method has the same algorithm as array.prototype.sort(), except that sorts the values numerically instead of as strings. 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.sort([comparefunction]) parameters comparefunction optional specifies a function that defines the sort order. return value the sorted typed array. examples using sort for more examples, see also the array.prototype.sort() method. let numbers = new uint8array([40, 1,...
TypedArray.prototype.subarray() - JavaScript
source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.subarray([begin [,end]]) parameters begin optional element to begin at. the offset is inclusive. the whole array will be included in the new view if this value is not specified. end optional element to end at. the offset is exclusive. if not specified, all elements from the one specified by begin to the end of the array are included in the new view. return value a new typedarray object. description the range specified by begin and end is clamped to the valid index range for the current array; if the computed length of the new array would be negat...
TypedArray.prototype.toLocaleString() - JavaScript
s arguments customize the behavior of the function and let applications specify the language whose formatting conventions should be used. in implementations, which ignore the locales and options arguments, the locale used and the form of the string returned are entirely implementation dependent. see the intl.numberformat() constructor for details on these parameters and how to use them. return value a string representing the elements of the typed array. examples using tolocalestring var uint = new uint32array([2000, 500, 8123, 12, 4212]); uint.tolocalestring(); // if run in a de-de locale // "2.000,500,8.123,12,4.212" uint.tolocalestring('en-us'); // "2,000,500,8,123,12,4,212" uint.tolocalestring('ja-jp', { style: 'currency', currency: 'jpy' }); // "¥2,000,¥500,¥8,123,¥12,¥4...
Uint16Array() constructor - JavaScript
(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 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 ...
Uint32Array() constructor - JavaScript
(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 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 ...
Uint8Array() constructor - JavaScript
(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 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 ...
WeakMap.prototype.delete() - JavaScript
method removes the specified element from a weakmap 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 wm.delete(key); parameters key the key of the element to remove from the weakmap object. return value true if an element in the weakmap object has been removed successfully. false if the key is not found in the weakmap or if the key is not an object. examples using the delete method var wm = new weakmap(); wm.set(window, 'foo'); wm.delete(window); // returns true. successfully removed. wm.has(window); // returns false. the window object is no longer in the weakmap. specifications ...
WeakMap.prototype.get() - JavaScript
od returns a specified element from a weakmap 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 wm.get(key); parameters key required. the key of the element to return from the weakmap object. return value the element associated with the specified key in the weakmap object. if the key can't be found, undefined is returned. examples using the get method var wm = new weakmap(); wm.set(window, 'foo'); wm.get(window); // returns "foo". wm.get('baz'); // returns undefined. specifications specification ecmascript (ecma-262)the definition of 'weakmap.prototype.get' in that speci...
WeakMap.prototype.has() - JavaScript
ied key exists in the weakmap object or not. the source for this interactive example is stored in a github repository. if 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 wm.has(key); parameters key required. the key of the element to test for presence in the weakmap object. return value boolean returns true if an element with the specified key exists in the weakmap object; otherwise false. examples using the has method var wm = new weakmap(); wm.set(window, 'foo'); wm.has(window); // returns true wm.has('baz'); // returns false specifications specification ecmascript (ecma-262)the definition of 'weakmap.prototype.has' in that specification. ...
WeakMap.prototype.set() - JavaScript
the set() method adds a new element with a specified key and value to a weakmap 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 wm.set(key, value); parameters key required. must be object. the key of the element to add to the weakmap object. value required. any value. the value of the element to add to the weakmap object. return value the weakmap object. examples using the set method var wm = new weakmap(); var obj = {}; // add new elements to the weakmap wm.set(obj, 'foo').set(window, 'bar'); // chainable // update an element in the weakmap wm.set(obj, 'baz'); specifications ...
WeakRef.prototype.deref() - JavaScript
notes see the notes on weakrefs section of the weakref page for some important notes. examples using deref see the examples section of the weakref page for the complete example. ...
WeakSet.prototype.delete() - JavaScript
the delete() method removes the specified element from a weakset 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 ws.delete(value); parameters value required. the object remove from the weakset object. return value true if an element in the weakmap object has been removed successfully. false if the key is not found in the weakmap or if the key is not an object. examples using the delete method var ws = new weakset(); var obj = {}; ws.add(window); ws.delete(obj); // returns false. no obj found to be deleted. ws.delete(window); // returns true. successfully removed. ws.has(window); /...
WeakSet.prototype.has() - JavaScript
the has() method returns a boolean indicating whether an object exists in a weakset or not. the source for this interactive example is stored in a github repository. if 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 ws.has(value); parameters value required. the object to test for presence in the weakset. return value boolean returns true if an element with the specified value exists in the weakset object; otherwise false. examples using the has method var ws = new weakset(); var obj = {}; ws.add(window); myset.has(window); // returns true myset.has(obj); // returns false specifications specification ecmascript (ecma-262)the definition of 'wea...
WebAssembly.Instance() constructor - JavaScript
odules can be expensive, developers should only use the instance() constructor when synchronous instantiation is absolutely required; the asynchronous webassembly.instantiatestreaming() method should be used at all other times. new webassembly.instance(module, importobject); parameters module the webassembly.module object to be instantiated. importobject optional an object containing the values to be imported into the newly-created instance, such as functions or webassembly.memory objects. there must be one matching property for each declared import of module or else a webassembly.linkerror is thrown. examples synchronously instantiating a webassembly module the webassembly.instance() constructor function can be called to synchronously instantiate a given webassembly.module object,...
WebAssembly.Memory.prototype.buffer - JavaScript
the buffer prototype property of the webassembly.memory object returns the buffer contained in the memory. examples using buffer the following example (see memory.html on github, and view it live also) fetches and instantiates the loaded memory.wasm byte code using the webassembly.instantiatestreaming() method, while importing the memory created in the line above. it then stores some values in that memory, then exports a function and uses it to sum some values. webassembly.instantiatestreaming(fetch('memory.wasm'), { js: { mem: memory } }) .then(obj => { var i32 = new uint32array(memory.buffer); for (var i = 0; i < 10; i++) { i32[i] = i; } var sum = obj.instance.exports.accumulate(0, 10); console.log(sum); }); specifications specification webassembly j...
WebAssembly.Memory - JavaScript
sembly.memory({initial:10, maximum:100}); the second way to get a webassembly.memory object is to have it exported by a webassembly module. the following example (see memory.html on github, and view it live also) fetches and instantiates the loaded memory.wasm byte code using the webassembly.instantiatestreaming() method, while importing the memory created in the line above. it then stores some values in that memory, then exports a function and uses it to sum some values. webassembly.instantiatestreaming(fetch('memory.wasm'), { js: { mem: memory } }) .then(obj => { var i32 = new uint32array(memory.buffer); for (var i = 0; i < 10; i++) { i32[i] = i; } var sum = obj.instance.exports.accumulate(0, 10); console.log(sum); }); creating a shared memory by default, webassembly memori...
WebAssembly.Module.customSections() - JavaScript
the webassembly.customsections() function returns a copy of the contents of all custom sections in the given module with the given string name. syntax webassembly.module.customsections(module, sectionname); parameters module the webassembly.module object whose custom sections are being considered. sectionname the string name of the desired custom section. return value a (possibly empty) array containing arraybuffer copies of the contents of all custom sections matching sectionname. exceptions if module is not a webassembly.module object instance, a typeerror is thrown. description a wasm module is comprised of a sequence of sections. most of these sections are fully specified and validated by the wasm spec, but modules can also contain custom sections that are ignored and skipp...
WebAssembly.Module.exports() - JavaScript
exceptions if module is not a webassembly.module object instance, a typeerror is thrown. ...
WebAssembly.Module.imports() - JavaScript
exceptions if module is not a webassembly.module object instance, a typeerror is thrown. examples using imports the following example (see imports.html source code; see it live also) compiles the loaded simple.wasm module. ...
WebAssembly.Table.prototype.grow() - JavaScript
exceptions if the grow() operation fails for whatever reason, a rangeerror is thrown. examples using grow the following example creates a new webassembly table instance with an initial size of 2 and a maximum size of 10. ...
WebAssembly.compile() - JavaScript
a webassembly.module object. this function is useful if it is necessary to a compile a module before it can be instantiated (otherwise, the webassembly.instantiate() function should be used). syntax promise<webassembly.module> webassembly.compile(buffersource); parameters buffersource a typed array or arraybuffer containing the binary code of the .wasm module you want to compile. return value a promise that resolves to a webassembly.module object representing the compiled module. exceptions if buffersource is not a typed array, a typeerror is thrown. if compilation fails, the promise rejects with a webassembly.compileerror. examples using compile the following example compiles the loaded simple.wasm byte code using the compile() function and then sends it to a worker using p...
WebAssembly.compileStreaming() - JavaScript
if it is necessary to a compile a module before it can be instantiated (otherwise, the webassembly.instantiatestreaming() function should be used). syntax promise<webassembly.module> webassembly.compilestreaming(source); parameters source a response object or a promise that will fulfill with one, representing the underlying source of a .wasm module you want to stream and compile. return value a promise that resolves to a webassembly.module object representing the compiled module. exceptions if buffersource is not a typed array, a typeerror is thrown. if compilation fails, the promise rejects with a webassembly.compileerror. examples compile streaming the following example (see our compile-streaming.html demo on github, and view it live also) directly streams a .wasm module f...
WebAssembly.instantiateStreaming() - JavaScript
ed underlying source. this is the most efficient, optimized way to load wasm code. syntax promise<resultobject> webassembly.instantiatestreaming(source, importobject); parameters source a response object or a promise that will fulfill with one, representing the underlying source of a .wasm module you want to stream, compile, and instantiate. importobject optional an object containing the values to be imported into the newly-created instance, such as functions or webassembly.memory objects. there must be one matching property for each declared import of the compiled module or else a webassembly.linkerror is thrown. return value a promise that resolves to a resultobject which contains two fields: module: a webassembly.module object representing the compiled webassembly module. this...
WebAssembly.validate() - JavaScript
the webassembly.validate() function validates a given typed array of webassembly binary code, returning whether the bytes form a valid wasm module (true) or not (false). syntax webassembly.validate(buffersource); parameters buffersource a typed array or arraybuffer containing webassembly binary code to be validated. return value a boolean that specifies whether buffersource is valid wasm code (true) or not (false). exceptions if buffersource is not a typed array or arraybuffer, a typeerror is thrown. examples using validate the following example (see the validate.html source code, and see it live too) fetches a .wasm module and converts it into a typed array. the validate() method is then used to check whether the module is valid. fetch('simple.wasm').then(response => respons...
decodeURI() - JavaScript
eviously created by encodeuri() or by a similar routine. the source for this interactive example is stored in a github repository. if 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 decodeuri(encodeduri) parameters encodeduri a complete, encoded uniform resource identifier. return value a new string representing the unencoded version of the given encoded uniform resource identifier (uri). exceptions throws an urierror ("malformed uri sequence") exception when encodeduri contains invalid character sequences. description replaces each escape sequence in the encoded uri with the character that it represents, but does not decode escape sequences that could not have been introdu...
decodeURIComponent() - JavaScript
codeuricomponent or by a similar routine. the source for this interactive example is stored in a github repository. if 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 decodeuricomponent(encodeduri) parameters encodeduri an encoded component of a uniform resource identifier. return value a new string representing the decoded version of the given encoded uniform resource identifier (uri) component. exceptions throws an urierror ("malformed uri sequence") exception when used wrongly. description replaces each escape sequence in the encoded uri component with the character that it represents. examples decoding a cyrillic url component decodeuricomponent('javascript_%d1%88%d0...
encodeURI() - JavaScript
e character (will only be four escape sequences for characters composed of two "surrogate" characters). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax encodeuri(uri) parameters uri a complete uri. return value a new string representing the provided string encoded as a uri. description the encodeuri() function does not encode characters that have special meaning (reserved characters) for a uri. the following example shows all the parts that a uri "scheme" can possibly contain. note how certain characters are used to signify special meaning: http://username:password@www.example.com:80/path/to/file.ph...
escape() - JavaScript
of a url following ?)—not for escaping ordinary string literals, which use the format "\xhh". (hh are two hexadecimal digits, and the form \xhh\xhh is used for higher-plane unicode characters.) escaped characters in string literals can be expanded by replacing the \x with %, then using the decodeuricomponent() function. syntax escape(str) parameters str a string to be encoded. return value a new string in which certain characters have been escaped. description the escape function is a property of the global object. special characters are encoded with the exception of: @*_+-./ the hexadecimal form for characters, whose code unit value is 0xff or less, is a two-digit escape sequence: %xx. for characters with a greater code unit, the four-digit format %uxxxx is used. examples us...
unescape() - JavaScript
unction computes a new string in which hexadecimal escape sequences are replaced with the character that it represents. the escape sequences might be introduced by a function like escape. usually, decodeuri or decodeuricomponent are preferred over unescape. note: do not use unescape to decode uris, use decodeuri instead. syntax unescape(str) parameters str a string to be decoded. return value a new string in which certain characters have been unescaped. description the unescape function is a property of the global object. examples using unescape unescape('abc123'); // "abc123" unescape('%e4%f6%fc'); // "äöü" unescape('%u0107'); // "ć" specifications specification ecmascript (ecma-262)the definition of 'unescape' in that specification. ...
uneval() - JavaScript
note: this will not return a json representation of object. description uneval() is a top-level function and is not associated with any object. ...
Addition assignment (+=) - JavaScript
the types of the two operands determine the behavior of the addition assignment operator. addition or concatenation is possible. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
Decrement (--) - JavaScript
the decrement operator (--) decrements (subtracts one from) its operand and returns a value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax operator: x-- or --x description if used postfix, with operator after operand (for example, x--), the decrement operator decrements and returns the value before decrementing. if used prefix, with operator before operand (for example, --x), the decrement operator decrements and returns the value after decrementing. examples postfix decrement let x = 3; y = x--; // y = 3 // x = 2 prefix decrement let a = 2; b = --a; // a = 1 // b = 1 specifications ...
Division assignment (/=) - 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. ...
Exponentiation assignment (**=) - 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. ...
Increment (++) - JavaScript
the increment operator (++) increments (adds one to) its operand and returns a value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax operator: x++ or ++x description if used postfix, with operator after operand (for example, x++), the increment operator increments and returns the value before incrementing. if used prefix, with operator before operand (for example, ++x), the increment operator increments and returns the value after incrementing. examples postfix increment let x = 3; y = x++; // y = 3 // x = 4 prefix increment let a = 2; b = ++a; // a = 3 // b = 3 specifications specifi...
Multiplication assignment (*=) - 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. ...
Operator precedence - JavaScript
sole.log((3 + 10) * 2); // logs 26 because the parentheses change the order left-associativity (left-to-right) means that it is processed as (a op1 b) op2 c, while right-associativity (right-to-left) means it is interpreted as a op1 (b op2 c). assignment operators are right-associative, so you can write: a = b = 5; // same as writing a = (b = 5); with the expected result that a and b get the value 5. this is because the assignment operator returns the value that is assigned. first, b is set to 5. then the a is also set to 5, the return value of b = 5, aka right operand of the assignment. as another example, the unique exponentiation operator has right-associativity, whereas other arithmetic operators have left-associativity. it is interesting to note that, the order of evaluation is alway...
Remainder assignment (%=) - 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. ...
Strict equality (===) - JavaScript
strict equality operators (=== and !==) use the strict equality comparison algorithm to compare two operands. if the operands are of different types, return false. if both operands are objects, return true only if they refer to the same object. if both operands are null or both operands are undefined, return true. if either operand is nan, return false. otherwise, compare the two operand's values: numbers must have the same numeric values. +0 and -0 are considered to be the same value. strings must have the same characters in the same order. booleans must be both true or both false. the most notable difference between this operator and the equality (==) operator is that if the operands are of different types, the == operator attempts to convert them to the same type be...
Subtraction assignment (-=) - 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. ...
class expression - JavaScript
nd class statements, however: class expressions may omit the class name ("binding identifier"), which is not possible with class statements. class expressions allow you to redefine (re-declare) classes without throwing a syntaxerror. this is not the case with class statements. the constructor method is optional. classes generated with class expressions will always respond to typeof with the value "function". 'use strict'; let foo = class {}; // constructor property is optional foo = class {}; // re-declaration is allowed typeof foo; // returns "function" typeof class {}; // returns "function" foo instanceof object; // true foo instanceof function; // true class foo {} // throws syntaxerror (class declarations do not allow re-declaration) examples...
empty - JavaScript
cript syntax requires one. the opposite 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! kil...
break - JavaScript
preceded by a loop statement. a break statement, with or without a following label, cannot be used within the body of a function that is itself nested within the current loop, switch, or label statement that the break statement is intended to break out of. examples break in while loop the following function has a break statement that terminates the while loop when i is 3, and then returns the value 3 * x. function testbreak(x) { var i = 0; while (i < 6) { if (i == 3) { break; } i += 1; } return i * x; } break in labeled blocks the following code uses break statements with labeled blocks. a break statement must be nested within any label it references. notice that inner_block is nested within outer_block. outer_block: { inner_block: { console.log('1'); ...
continue - JavaScript
te expression. the continue statement can include an optional label that allows the program to jump to the next iteration of a labeled loop statement instead of the current loop. in this case, the continue statement needs to be nested within this labeled statement. examples using continue with while the following example shows a while loop that has a continue statement that executes when the value of i is 3. thus, n takes on the values 1, 3, 7, and 12. var i = 0; var n = 0; while (i < 5) { i++; if (i === 3) { continue; } n += i; } using continue with a label in the following example, a statement labeled checkiandj contains a statement labeled checkj. if continue is encountered, the program continues at the top of the checkj statement. each time continue is encountered, c...
function declaration - JavaScript
he statements which comprise the body of the function. description a function created with a function declaration is a function object and has all the properties, methods and behavior of function objects. see function for detailed information on functions. a function can also be created using an expression (see function expression). by default, functions return undefined. to return any other value, the function must have a return statement that specifies the value to return. conditionally created functions functions can be conditionally declared, that is, a function statement can be nested within an if statement, however the results are inconsistent across implementations and therefore this pattern should not be used in production code. for conditional function creation, use function exp...
if...else - JavaScript
atement1 else if (condition2) statement2 else if (condition3) ... to execute multiple statements within a clause, use a block statement ({ ... }) to group those statements. in general, it is a good practice to always use block statements, especially in code involving nested if statements: if (condition) { statements1 } else { statements2 } do not confuse the primitive boolean values true and false with truthiness or falsiness of the boolean object. any value that is not false, undefined, null, 0, -0, nan, or the empty string (""), and any object, including a boolean object whose value is false, is considered truthy when used as the condition. for example: var b = new boolean(false); if (b) // this condition is truthy examples using if...else if (cipher_char === from_ch...
while - JavaScript
e loop, use a block statement ({ ... }) to group those statements. note: use the break statement to stop a loop before condition evaluates to true. examples using while the following while loop iterates as long as n is less than three. var n = 0; var x = 0; while (n < 3) { n++; x += n; } each iteration, the loop increments n and adds it to x. therefore, x and n take on the following values: after the first pass: n = 1 and x = 1 after the second pass: n = 2 and x = 3 after the third pass: n = 3 and x = 6 after completing the third pass, the condition n < 3 is no longer true, so the loop terminates. specifications specification ecmascript (ecma-262)the definition of 'while statement' in that specification. ...
JavaScript reference - JavaScript
this part of the javascript section on mdn serves as a repository of facts about the javascript language. read more about this reference. built-ins javascript standard built-in objects, along with their methods and properties. ...
JavaScript
how client-side frameworks work and how they fit into your toolset, before moving on to tutorial series covering some of today's most popular ones. a re-introduction to javascript an overview for those who think they know about javascript. javascript data structures overview of available data structures in javascript. equality comparisons and sameness javascript provides three different value-comparison operations: strict equality using ===, loose equality using ==, and the object.is() method. closures a closure is the combination of a function and the lexical environment within which that function was declared. advanced inheritance and the prototype chain explanation of the widely misunderstood and under-estimated prototype-based inheritance. strict mode strict mode def...
background_color - Web app manifests
therefore background_color should match the background-color css property in the site’s stylesheet for a smooth transition between launching the web application and loading the site's content. ...
categories - Web app manifests
type array of strings mandatory no the categories member is an array of strings defining the names of categories that the application supposedly belongs to. there is no standard list of possible values, but the w3c maintains a list of known categories. note: categories are used only as hints for catalogs or stores listing web applications. like search engines and meta keywords, catalogs and stores are free to ignore them. note: categories values are lower-cased by the stores and catalogs before processing, so "news" and "news" are treated as the same value. developers are encouraged to use lower case in the first place. example "categories": ["books", "education", "medical"] specification specification status comment feedback ...
description - Web app manifests
type string mandatory no the description member is a string in which developers can explain what the application does. description is directionality-capable, which means it can be displayed left to right or right to left based on the values of the dir and lang manifest members. examples simple description in left-to-right language: "description": "awesome application that will help you achieve your dreams." description in arabic, which will be displayed right-to-left: "dir": "rtl", "lang": "ar", "description": ".تطبيق رائع سيساعدك على تحقيق أحلامك" specification specification status comment feedback web app manifestthe definition of 'description' in that specification. working dr...
dir - Web app manifests
Web › Manifest › dir
type string mandatory no the base direction in which to display direction-capable members of the manifest. together with the lang member, it helps to correctly display right-to-left languages. the dir member can be set to one of the following values: auto — text direction is determined by the user agent ltr — left to right rtl — right to left the directionality-capable members are: name short_name description note: if the value is omitted or set to auto, the browser will use the unicode bidirectional algorithm to make a best guess about the text's direction. example "dir": "rtl", "lang": "ar", "short_name": "!أنا من التطبيق" specification specification status comment feedback web app manif...
display - Web app manifests
full browser window is shown) to fullscreen (when the app is full-screened). note: if the display member is not specified, it defaults to browser. note: you can selectively apply css to your app based on the display mode, using the display-mode media feature. this can be used to provide a consistent user experience between launching a site from an url and launching it from a desktop icon. values the possible values are: display mode description fallback display mode fullscreen all of the available display area is used and no user agent chrome is shown. standalone standalone the application will look and feel like a standalone application. this can include the application having a different window, its own icon in the application launcher, ...
lang - Web app manifests
Web › Manifest › lang
type string mandatory no the lang member is a string containing a single language tag. it specifies the primary language for the values of the manifest's directionality-capable members, and together with dir determines their directionality. examples "lang": "en-us" specification specification status comment feedback web app manifestthe definition of 'lang' in that specification. working draft initial definition. web app manifest working group drafts ...
name - Web app manifests
Web › Manifest › name
type string mandatory yes the name member is a string that represents the name of the web application as it is usually displayed to the user (e.g., amongst a list of other applications, or as a label for an icon). name is directionality-capable, which means it can be displayed left-to-right or right-to-left based on the values of the dir and lang manifest members. examples simple name in left-to-right language: "name": "awesome application" right-to-left name in arabic: "dir": "rtl", "lang": "ar", "name": "!أنا من التطبيق" specification specification status comment feedback web app manifestthe definition of 'name' in that specification. working draft initial definition. web...
prefer_related_applications - Web app manifests
if the prefer_related_applications member is set to true, the user agent might suggest installing one of the related applications instead of this web app. if omitted, prefer_related_applications defaults to false. examples "prefer_related_applications": true specification specification status comment feedback web app manifestthe definition of 'prefer_related_applications' in that specification. ...
related_applications - Web app manifests
applications are preferred over the web application by setting prefer_related_applications to true. examples "related_applications": [ { "platform": "play", "url": "https://play.google.com/store/apps/details?id=com.example.app1", "id": "com.example.app1" }, { "platform": "itunes", "url": "https://itunes.apple.com/app/example-app1/id123456789" } ] related application values application objects may contain the following values: member description platform the platform on which the application can be found. list of available values url the url at which the application can be found. id the id used to represent the application on the specified platform. specification specification status comme...
short_name - Web app manifests
type string mandatory no the short_name member is a string that represents the name of the web application displayed to the user if there is not enough space to display name (e.g., as a label for an icon on the phone home screen). short_name is directionality-capable, which means it can be displayed left-to-right or right-to-left based on the value of the dir and lang manifest members. examples simple short_name in left-to-right language: "name": "awesome application", "short_name": "awesome app" short_name in arabic, which will be displayed right-to-left: "dir": "rtl", "lang": "ar", "name": "تطبيق رائع", "short_name": "رائع" specification specification status comment feedback web app manifestthe definition...
shortcuts - Web app manifests
when user invokes a shortcut, the user agent will navigate to the address given by shortcut's url member. ...
<menclose> - MathML
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. notation a list of notations, separated by white space, to apply to the child elements. the symbols are each drawn as if the others are not present, and therefore may overlap. possible values are: value sample rendering rendering in your browser description longdiv (default) a2 + b2 long division symbol actuarial a2 + b2 actuarial symbol radical a2 + b2 square root symbol. deprecated. use <msqrt> instead. box a2 + b2 box round...
<mrow> - MathML
Web › MathML › Element › mrow
expression in several ways: it can improve the display by possibly affecting spacing. it allows for more intelligent line-breaking and indentation. it simplifies the interpretation of the expression by automated systems such as computer algebra systems and audio renderers. attributes class, id, style provided for use with stylesheets. dir overall directionality of formulas. possible values are either ltr (left to right) or rtl (right to left). href used to set a hyperlink to a specified uri. 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. examples <math> <mrow> <mn> 1 </mn> <mo> + </mo> <mn> 1 </mn> </mrow> <mrow> <mo> ( </mo> <mrow>...
<mspace> - MathML
Web › MathML › Element › mspace
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 e...
<msub> - MathML
Web › MathML › Element › msub
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.0the ...
<msubsup> - 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 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> &#x222b;<!-...
<msup> - MathML
Web › MathML › Element › msup
utes 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.0the ...
<mtr> - MathML
Web › MathML › Element › mtr
the mathml <mtr> element represents a row in a table or a matrix. it may only appear in a <mtable> element. this element is similar to the <tr> element of html. attributes class, id, style provided for use with stylesheets. columnalign overrides the horizontal alignment of cells specified by <mtable> for this row. possible values are: left, center and right. 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. rowalign overrides the vertical alignment of cells specified by <mtable> for this row. possible values are: axis, baseline, bottom, center and top. specifications specification ...
<munderover> - MathML
the mathml <munderover> element is used to attach accents or limits both under and over an expression. it uses the following syntax: <munderover> base underscript overscript </munderover> attributes accent if true, the overscript is an accent, which is drawn closer to the base expression. if false (default value), the overscript is a limit over the base expression. accentunder if true, the underscript is an accent, which is drawn closer to the base expression. if false (default value), the underscript is a limit under the base expression. align the alignment of both underscript and overscript. possible values are: left, center, and right. this attribute is deprecated and will be removed in the future. use css text-align instead. class, id, style provided for use with styleshee...
Media type and format guide: image, audio, and video content - Web media technologies
Web › Media › Formats
e that are not commonly supported but that you might still run into. it also covers codec capabilities, benefits, limitations, and browser support levels and restrictions. the "codecs" parameter in common media types when specifying the mime type describing a media format, you can provide details using the codecs parameter as part of the type string. this guide describes the format and possible values of the codecs parameter for the common media types. codecs used by webrtc webrtc doesn't use a container, but instead streams the encoded media itself from peer to peer using mediastreamtrack objects to represent each audio or video track. this guide discusses the codecs commonly used with webrtc. guides concepts digital audio concepts an introduction to how audio is converted into di...
Performance budgets - Web Performance
d content of your site, you might choose to focus on other metrics. for a text-heavy site such as a blog or a news site, the first contentful paint metric could reflect more closely the user behavior. (i.e. how fast can users start reading), which will inform file specific budgets (e.g. font size), and their optimizations. (e.g. using font-display to improve perceived performance). the ultimate value of a performance budget is to correlate the impact of performance on business or product goals. when defining metrics, you should focus on user experience, which will dictate not only the bounce or conversion rate but how likely is that user to return. how do i implement a performance budget? during development, there are a few tools to run checks against new or modified assets: a module bun...
Understanding latency - Web Performance
eveloper tools and switch to a lower end network connection. in the developer tools, under the network table, you can switch the throttling option to 2g, 3g, etc. different browser developer tools have different preset options, the characteristics emulated include download speed, upload speed, and minimum latency, or the minimum amount of type it takes to send a packet of data. ...
Using dns-prefetch - Web Performance
his process is known as dns resolution. while dns caching can help to reduce this latency, dns resolution can add significant latency to requests. for websites that open connections to many third parties, this latency can significantly reduce loading performance. dns-prefetch helps developers mask dns resolution latency. the html <link> element offers this functionality by way of a rel attribute value of dns-prefetch. the cross-origin domain is then specified in the href attribute: syntax <link rel="dns-prefetch" href="https://fonts.gstatic.com/" > examples <html> <head> <link rel="dns-prefetch" href="https://fonts.gstatic.com/"> <!-- and all other head elements --> </head> <body> <!-- your page content --> </body> </html> you should place dns-prefetch hints in the <h...
Add to Home screen - Progressive web apps (PWAs)
nd color to be used in some app contexts. the most relevant one to a2hs is the splash screen displayed when the app icon on the home screen is tapped and it first starts to load (this currently appears only when apps have been added to the home screen by chrome). display: specifies how the app should be displayed. to make it feel like a distinct app (and not just a web page), you should choose a value such as fullscreen (no ui is shown at all) or standalone (very similar, but system-level ui elements such as the status bar might be visible). icons: specifies icons for the browser to use when representing the app in different places (such as on the task switcher, or more important, the home screen). we've included only one in our demo. name/short_name: these fields provide an app name to be d...
accent-height - SVG: Scalable Vector Graphics
the accent-height attribute defines the distance from the origin to the top of accent characters, measured by a distance within the font coordinate system. only one element is using this attribute: <font-face> font-face for <font-face>, accent-height defines the distance from the origin to the top of accent characters, measured by a distance within the font coordinate system. value <number> default value value of ascent animatable no specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'accent-height' in that specification. recommendation initial definition ...
alphabetic - SVG: Scalable Vector Graphics
the alphabetic attribute defines the lower baseline of a font. it has the same syntax and semantics as the baseline descriptor within an @font-face. for horizontally oriented glyph layouts, it indicates the alignment coordinate for glyphs to achieve alphabetic baseline alignment. the value is an offset in the font coordinate system. only one element is using this attribute: <font-face> usage notes value <number> default value 0 animatable no specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'alphabetic' in that specification. recommendation initial definition ...
amplitude - SVG: Scalable Vector Graphics
the amplitude attribute controls the amplitude of the gamma function of a component transfer element when its type attribute is gamma. four elements are using this attribute: <fefunca>, <fefuncb>, <fefuncg>, and <fefuncr> usage notes value <number> default value 1 animatable yes specifications specification status comment filter effects module level 1the definition of 'amplitude' in that specification. working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'amplitude' in that specification. recommendation initial definition ...
arabic-form - SVG: Scalable Vector Graphics
the arabic-form attribute indicates which of the four possible forms an arabic glyph represents. only one element is using this attribute: <glyph> context notes value initial | medial | terminal | isolated default value isolated animatable no initial this value indicates that the glyph represents the initial form. medial this value indicates that the glyph represents the medial form. terminal this value indicates that the glyph represents the terminal form. isolated this value indicates that the glyph represents the isolated form. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'arabic-form' in that specification. recommendation initial d...
ascent - SVG: Scalable Vector Graphics
Web › SVG › Attribute › ascent
the ascent attribute defines the maximum unaccented height of the font within the font coordinate system. if the attribute is not specified, the effect is as if the attribute were set to the difference between the units-per-em value and the vert-origin-y value for the corresponding font. only one element is using this attribute: <font-face> font-face for <font-face>, ascent defines the maximum unaccented height of the font within the font coordinate system. value <number> default value difference between units-per-em and vert-origin-y animatable no specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'ascent' in that specification. recommendation init...
baseProfile - SVG: Scalable Vector Graphics
the baseprofile attribute describes the minimum svg language profile that the author believes is necessary to correctly render the content. the attribute does not specify any processing restrictions; it can be considered metadata. for example, the value of the attribute could be used by an authoring tool to warn the user when they are modifying the document beyond the scope of the specified base profile. each svg profile should define the text that is appropriate for this attribute. only one element is using this attribute: <svg> context notes value profile name default value none animatable no example <svg width="120" height="120" version="1.1" xmlns="http://www.w3.org/2000/svg" baseprofile="full"> ... </svg> specifications sp...
bbox - SVG: Scalable Vector Graphics
Web › SVG › Attribute › bbox
the bbox attribute defines the maximal bounding box of a font. only one element is using this attribute: <font-face> usage notes value <string> default value none animatable no <string> a comma-separated list of exactly four numbers specifying, in order, the lower left x, lower left y, upper right x, and upper right y of the bounding box for the complete font. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'bbox' in that specification. recommendation initial definition ...
bias - SVG: Scalable Vector Graphics
Web › SVG › Attribute › bias
the bias attribute shifts the range of the filter. after applying the kernelmatrix of the <feconvolvematrix> element to the input image to yield a number and applied the divisor attribute, the bias attribute is added to each component. this allows representation of values that would otherwise be clamped to 0 or 1. usage notes value <number> default value 0 animatable yes one application of bias is when it is desirable to have 0.5 gray value be the zero response of the filter. specifications specification status comment filter effects module level 1the definition of 'bias' in that specification. working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'bias' in that spec...
cap-height - SVG: Scalable Vector Graphics
the cap-height attribute defines the height of uppercase glyphs of the font within the font coordinate system. note: it was specified to share the syntax and semantics of the obsolete cap-height descriptor of the @font-face at-rule defined in an early version of css 2. only one element is using this attribute: <font-face> usage notes value <number> default value none animatable no specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'cap-height' in that specification. recommendation initial definition ...
clip-rule - SVG: Scalable Vector Graphics
le is specified on the referencing element, not on the object defining the clipping shape: <g> <clippath id="myclip"> <path d="..." /> </clippath> <rect clip-path="url(#myclip)" clip-rule="evenodd" ... /> </g> as a presentation attribute, it also can be used as a property directly inside a css stylesheet usage context categories presentation attribute value nonzero | evenodd | inherit animatable yes normative document svg 1.1 (2nd edition) nonzero see description of fill-rule property. evenodd see description of fill-rule property. example <svg width="100" viewbox="0 0 100 90" xmlns="http://www.w3.org/2000/svg" version="1.1"> <!-- define star path --> <defs> <path d="m50,0 21,90 98,35 2,35 79,90z" id...
color-profile - SVG: Scalable Vector Graphics
the color-profile attribute is used to define which color profile a raster image included through the <image> element should use. note: as a presentation attribute, color-profile can be used as a css property. as a presentation attribute, it can be applied to any element but it only has an effect on the following element: <image> usage notes value auto | srgb | <name> | <iri> default value auto animatable yes auto all colors are presumed to be defined in the srgb color space unless a more precise embedded profile is specified within content data. for images that do have a profile built into their data, that profile is used. for images that do not have a profile, the srgb profile is used. srgb the source profile is assumed to be srgb. this di...
contentScriptType - SVG: Scalable Vector Graphics
the contentscripttype attribute specifies the default scripting language for the given document fragment on the <svg> element. this attribute sets the default scripting language used to process the value strings in event attributes. this language must be used for all instances of script that do not specify their own scripting language. the value specifies a media type, per mime part two: media types [rfc2046]. usage notes value one of the content types specified in the media types default value application/ecmascript animatable no specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'contentscripttype' in that specification. recommendation initial defin...
contentStyleType - SVG: Scalable Vector Graphics
the contentstyletype attribute specifies the style sheet language for the given document fragment on the <svg> element. this language is used for all instances of style that do not specify their own styling language, such as the style attribute that is available on many elements. the value specifies a media type, per mime part two: media types [rfc2046]. usage notes value one of the content types specified in the media types default value text/css animatable no since css is the only widely deployed style sheet language for online styling and it's already defined as default value if contentstyletype is ommitted, the attribute is not well supported in user agents. if other style sheet languages become more popular they might not use the style attri...
cursor - SVG: Scalable Vector Graphics
Web › SVG › Attribute › cursor
r an element. this attribute behaves exactly like the css cursor property except that if the browser supports the <cursor> element, you should be able to use it with the <funciri> notation. as a presentation attribute, it also can be used as a property directly inside a css stylesheet, see css cursor for further information. usage context categories presentation attribute value [[<funciri>,]* [ auto | crosshair | default | pointer | move | e-resize | ne-resize | nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize| text | wait | help ]] | inherit animatable yes normative document svg 1.1 (2nd edition) <funciri> functional notation for a reference. the syntax for this reference is the same as the css uri. elements the...
data-* - SVG: Scalable Vector Graphics
Web › SVG › Attribute › data-*
e available via the svgelement interface of the element the attributes belong to, with the svgelement.dataset property. the * can be replaced by any characters allowed in xml's rules for names, with the following restrictions: can't start with xml. no semicolons (;, u+003a). no capital a to z letters. the svgelement.dataset property is a domstringmap that provides the attribute data-test-value via svgelement.dataset.testvalue. hyphen characters (-, u+002d) are removed and the next letter is capitalized, resulting in the camelcase format. specifications specification status comment scalable vector graphics (svg) 2the definition of 'data-*' in that specification. candidate recommendation custom data attributes are new in svg 2. ...
descent - SVG: Scalable Vector Graphics
Web › SVG › Attribute › descent
the descent attribute defines the maximum unaccented depth of the font. note: it was specified to share the syntax and semantics of the obsolete descent descriptor of the @font-face at-rule defined in an early version of css 2. only one element is using this attribute: <font-face> usage notes value <number> default value value of vert-origin-y animatable no specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'descent' in that specification. recommendation initial definition ...
filter - SVG: Scalable Vector Graphics
Web › SVG › Attribute › filter
nt but it only has effect on container elements without the <defs> element, all graphics elements and the <use> element. html, body, svg { height: 100%; } <svg viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <filter id="blur"> <fegaussianblur stddeviation="2" /> </filter> <rect x="10" y="10" width="80" height="80" filter="url(#blur)" /> </svg> usage notes value none | <filter-function-list> default value none animatable yes for a description of the values see the css filter property. specifications specification status comment filter effects module level 1the definition of 'filter' in that specification. working draft extended the values by several special filter functions. s...
filterUnits - SVG: Scalable Vector Graphics
the filterunits attribute defines the coordinate system for the attributes x, y, width and height. only one element is using this attribute: <filter> usage notes value userspaceonuse | objectboundingbox default value objectboundingbox animatable yes userspaceonuse x, y, width and height represent values in the current coordinate system that results from taking 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). objectboundingbox in that case, x, y, width and height represent fractions or percentages of the bounding box on the referencing element. specifications specification s...
fr - SVG: Scalable Vector Graphics
Web › SVG › Attribute › fr
adient2" cx="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> ...
g1 - SVG: Scalable Vector Graphics
Web › SVG › Attribute › g1
the g1 attribute specifies a list of glyph names which identify a set of possible first glyphs in the kerning pair. all glyphs with the given glyph name are included in the set. the total set of possible first glyphs in the kerning pair is the union of glyphs specified by the u1 and g1 attributes. two elements are using this attribute: <hkern> and <vkern> context notes value <name># default value none animatable no <name># this value indicates a comma-separated sequence of glyph names (i.e., values that match glyph-name attributes on <glyph> elements) which identify a set of possible first glyphs in the kerning pair. specifications specification status comment scalable vector graphics (svg) 1.1 (second editio...
g2 - SVG: Scalable Vector Graphics
Web › SVG › Attribute › g2
the g2 attribute specifies a list of glyph names which identify a set of possible second glyphs in the kerning pair. all glyphs with the given glyph name are included in the set. the total set of possible second glyphs in the kerning pair is the union of glyphs specified by the u2 and g2 attributes. two elements are using this attribute: <hkern> and <vkern> context notes value <name># default value none animatable no <name># this value indicates a comma-separated sequence of glyph names (i.e., values that match glyph-name attributes on <glyph> elements) which identify a set of possible second glyphs in the kerning pair. specifications specification status comment scalable vector graphics (svg) 1.1 (second ed...
glyph-name - SVG: Scalable Vector Graphics
unique within a font. the glyph names can be used in situations where unicode character numbers do not provide sufficient information to access the correct glyph, such as when there are multiple glyphs per unicode character. the glyph names can be referenced in kerning definitions created by <hkern> and <vkern> elements. only one element is using this attribute: <glyph> context notes value <name># default value none animatable no <name># this value specifies a comma-separated list of names for the glyph. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'glyph-name' in that specification. recommendation initial definition ...
hanging - SVG: Scalable Vector Graphics
Web › SVG › Attribute › hanging
the hanging attribute indicates the alignment coordinate for glyphs to achieve hanging baseline alignment for horizontally oriented glyph layouts. the value is an offset in the font coordinate system. only one element is using this attribute: <font-face> usage notes value <number> default value none animatable no <number> this value indicates the alignment coordinate for the glyphs. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'hanging' in that specification. recommendation initial definition ...
horiz-origin-x - SVG: Scalable Vector Graphics
the horiz-origin-x attribute indicates the x-coordinate in the font coordinate system of the origin of a glyph to be used when drawing horizontally oriented text. note: the origin applies to all glyphs in the font. only one element is using this attribute: <font> usage notes value <number> default value 0 animatable no <number> this value indicates the x-coordinate of the origin of a glyph for horizontally oriented text. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'horiz-origin-x' in that specification. recommendation initial definition ...
horiz-origin-y - SVG: Scalable Vector Graphics
the horiz-origin-y attribute indicates the y-coordinate in the font coordinate system of the origin of a glyph to be used when drawing horizontally oriented text. note: the origin applies to all glyphs in the font. only one element is using this attribute: <font> usage notes value <number> default value 0 animatable no <number> this value indicates the x-coordinate of the origin of a glyph for horizontally oriented text. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'horiz-origin-y' in that specification. recommendation initial definition ...
ideographic - SVG: Scalable Vector Graphics
the ideographic attribute indicates the alignment coordinate for glyphs to achieve ideographic baseline alignment for horizontally oriented glyph layouts. the value is an offset in the font coordinate system. only one element is using this attribute: <font-face> usage notes value <number> default value none animatable no <number> this value indicates the alignment coordinate for the glyphs. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'ideographic' in that specification. recommendation initial definition ...
image-rendering - SVG: Scalable Vector Graphics
one in a truecolor (e.g., 24-bit) color space even if the original data and/or the target device is indexed color. note: as a presentation attribute, image-rendering can be used as a css property. see the css image-rendering property for more information. as a presentation attribute, it can be applied to any element but it has effect only on the following element: <image> usage notes value auto | optimizespeed | optimizequality default value auto animatable yes auto indicates that the user agent shall make appropriate tradeoffs to balance speed and quality, but quality shall be given more importance than speed. optimizespeed indicates that the user agent shall emphasize rendering speed over quality. optimizequality indicates that the user ag...
k - SVG: Scalable Vector Graphics
Web › SVG › Attribute › k
the k attribute specifies the amount for decreasing the spacing between the two glyphs in a kerning pair. the value is in the font coordinate system. this attribute is required. two elements are using this attribute: <hkern> and <vkern> context notes value <number> default value none animatable no <number> this value indicates the amount for decreasing the spacing between the two glyphs in the kerning pair. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'k' in that specification. recommendation initial definition ...
lengthAdjust - SVG: Scalable Vector Graphics
<text x="0" y="50" textlength="300" lengthadjust="spacingandglyphs"> stretched using spacing and glyphs. </text> <text x="0" y="80" textlength="100" lengthadjust="spacing"> shrunk using spacing only. </text> <text x="0" y="110" textlength="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 tha...
local - SVG: Scalable Vector Graphics
Web › SVG › Attribute › local
que id for a locally stored color profile as specified by international color consortium. if both the xlink:href and the local attribute are specified, then the local file system is searched for the color profile first, and, if not available locally, then the resource identified by the xlink:href attribute is used. only one element is using this attribute: <color-profile> usage notes value <string> default value none animatable no <string> this value specifies the unique id for a locally stored color profile as specified by international color consortium. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'local' in that specification. recommendation ...
mask - SVG: Scalable Vector Graphics
Web › SVG › Attribute › mask
t, mask-position, mask-clip, mask-origin, mask-size, and mask-composite. as a presentation attribute, it can be applied to any element but it has noticeable effects mostly on the following nineteen elements: <a>, <circle>, <clippath>, <ellipse>, <g>, <glyph>, <image>, <line>, <marker>, <mask>, <path>, <pattern>, <polygon>, <polyline>, <rect>, <svg>, <symbol>, <text>, <use> usage notes value see the css property mask default value none animatable yes specifications specification status comment css masking module level 1the definition of 'mask' in that specification. candidate recommendation extends its usage to html elements. extends its syntax by making it a shorthand for the new mask-* properties defined in th...
mathematical - SVG: Scalable Vector Graphics
the mathematical attribute indicates the alignment coordinate for glyphs to achieve mathematical baseline alignment for horizontally oriented glyph layouts. the value is an offset in the font coordinate system. only one element is using this attribute: <font-face> usage notes value <number> default value none animatable no <number> this value indicates the alignment coordinate for the glyphs. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'mathematical' in that specification. recommendation initial definition ...
orientation - SVG: Scalable Vector Graphics
the orientation attribute indicates that the given glyph is only to be used for a particular text direction, i.e. horizontal or vertical. only one element is using this attribute: <glyph> usage notes value h | v default value none (meaning glyph can be used for both text directions) animatable yes h this value indicates that the glyph is only used for a horizontal text direction. v this value indicates that the glyph is only used for a vertical text direction. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'orientation' in that specification. recommendation initial definition ...
origin - SVG: Scalable Vector Graphics
Web › SVG › Attribute › origin
the origin attribute specifies the origin of motion for an animation. it has no effect in svg. only one element is using this attribute: <animatemotion> context notes value default default value default animatable no specifications specification status comment svg animations level 2the definition of 'origin' in that specification. editor's draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'origin' in that specification. recommendation initial definition (referring to smil animation specification) ...
overline-position - SVG: Scalable Vector Graphics
the overline-position attribute represents the ideal vertical position of the overline. the overline position is expressed in the font's coordinate system. ...
overline-thickness - SVG: Scalable Vector Graphics
the overline-thickness attribute represents the ideal thickness of the overline. the overline thickness is expressed in the font's coordinate system. ...
paint-order - SVG: Scalable Vector Graphics
that the fill, stroke, and markers of a given shape or text element are painted. note: as a presentation attribute, paint-order can be used as a css property. as a presentation attribute, it can be applied to any element but it has effect only on the following ten elements: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, <rect>, <text>, <textpath>, and <tspan> usage notes value normal | [ fill || stroke || markers ] default value normal animatable yes normal this value indicates that the fill will be painted first, then the stroke, and finally the markers. [ fill || stroke || markers ] the order of these three keywords indicates the order in which the painting happens, from left to right. if any of the three painting components is ...
panose-1 - SVG: Scalable Vector Graphics
ry standard truetype font classification and matching technology. the panose system consists of a set of ten numbers that categorize the key attributes of a latin typeface, a classification procedure for creating those numbers, and mapper software that determines the closest possible font match given a set of typefaces. only one element is using this attribute: <font-face> usage notes value <integer>{10} default value 0 0 0 0 0 0 0 0 0 0 animatable no <integer>{10} this value specifies a panose-1 number and consists of ten decimal integers, separated by whitespace. the initial value zero for each panose digit means "any", i.e. all fonts will match the panose number if this value is used. specifications specification status comme...
patternTransform - SVG: Scalable Vector Graphics
fill="url(#p1)" /> </svg> pattern for <pattern>, patterntransform defines a list of transform definitions that are applied to a pattern tile. note: as of svg2, it is also allowed to use the css transform property. however, the current state of implementation isn't very good. for backward compatibility reason, it is highly suggested to keep using the patterntransform attribute. value <transform-list> default value identity transform animatable yes transform functions to know more about the definition of transform functions, see the transform attribute definition. specifications specification status comment scalable vector graphics (svg) 2the definition of 'patterntransform' in that specification. candidate re...
radius - SVG: Scalable Vector Graphics
Web › SVG › Attribute › radius
the radius attribute represents the radius (or radii) for the operation on a given <femorphology> filter primitive. if two numbers are provided, the first number represents the x-radius and the second one the y-radius. if one number is provided, then that value is used for both x and y. the values are in the coordinate system established by the primitiveunits attribute on the <filter> element. a negative or zero value disables the effect of the given filter primitive (i.e., the result is the filter input image). usage notes value <number-optional-number> default value 0 animatable yes specifications specification status comment filter effects module level 1the definition of 'radius' in that specification. working dr...
rotate - SVG: Scalable Vector Graphics
Web › SVG › Attribute › rotate
the rotate attribute specifies how the animated element rotates as it travels along a path specified in an <animatemotion> element. usage notes value auto | auto-reverse | <number> default value 0 animatable no the auto and auto-reverse values allow the animated element's rotation to change dynamically as it travels along the path. if the value of rotate is auto, the element turns to align its right-hand side in the current direction of motion. if the value is auto-reverse, it turns its left-hand side in the current direction of motion. setting rotate's value to a number specifies a constant rotation, in degrees, that does not change with the animation. the default value of 0 keeps the animated element in its original orientation. examples ...
seed - SVG: Scalable Vector Graphics
Web › SVG › Attribute › seed
bulence basefrequency="0.025" seed="0" /> </filter> <filter id="noise2" x="0" y="0" width="100%" height="100%"> <feturbulence basefrequency="0.025" seed="100" /> </filter> <rect x="0" y="0" width="200" height="200" style="filter:url(#noise1);" /> <rect x="0" y="0" width="200" height="200" style="filter:url(#noise2); transform: translatex(220px);" /> </svg> usage notes value <number> default value 0 animatable yes example <svg width="200" height="200" viewbox="0 0 220 220" xmlns="http://www.w3.org/2000/svg"> <filter id="displacementfilter"> <feturbulence basefrequency="0.05" seed="1000" result="turbulence"/> <fedisplacementmap in2="turbulence" in="sourcegraphic" scale="50" xchannelselector="r" ychannel...
slope - SVG: Scalable Vector Graphics
Web › SVG › Attribute › slope
the slope attribute indicates the vertical stroke angle of a font. only one element is using this attribute: <font-face> usage notes value <number> default value 0 animatable no <number> this value indicates the vertical stroke angle of the font. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'slope' in that specification. recommendation initial definition ...
spacing - SVG: Scalable Vector Graphics
Web › SVG › Attribute › spacing
the spacing attribute indicates how the user agent should determine the spacing between typographic characters that are to be rendered along a path. only one element is using this attribute: <textpath> usage notes value auto | exact default value exact animatable yes auto this value indicates that the user agent should use text-on-a-path layout algorithms to adjust the spacing between typographic characters in order to achieve visually appealing results. exact this value indicates that the typographic characters should be rendered exactly according to the spacing rules as specified by the layout rules for text-on-a-path. specifications specification status comment scalable vector graphics (svg) 2the definition of...
spreadMethod - SVG: Scalable Vector Graphics
the spreadmethod attribute determines how a shape is filled beyond the defined edges of a gradient. two elements are using this attribute: <lineargradient> and <radialgradient> context notes value pad | reflect | repeat initial value pad animatable yes pad this value indicates that the final color of the gradient fills the shape beyond the gradient's edges. reflect this value indicates that the gradient repeats in reverse beyond its edges. repeat this value specifies that the gradient repeats in the original order beyond its edges. defining a gradient's edges by default, a gradient reaches to the edges of the shape being filled. to see the effects of this attribute, you will need to set the size of the gradient smaller than the shape. in...
stemh - SVG: Scalable Vector Graphics
Web › SVG › Attribute › stemh
l stems of roman characters will differ from the thin stems on serifed "m" and "n", plus there may be different widths for uppercase and lowercase characters in the same font. also, either by design or by error, all stems may have slightly different widths. if this attribute is used, the units-per-em must also be used. only one element is using this attribute: <font-face> usage notes value <number> default value none animatable no <number> this value indicates the horizontal stem width of the font. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'stemh' in that specification. recommendation initial definition ...
stemv - SVG: Scalable Vector Graphics
Web › SVG › Attribute › stemv
ot be directly accessible in some font formats. the measurement is meant for the dominant vertical stem in the font because there might be different groupings of vertical stems (e.g., one main one, and one lighter weight one as for an uppercase "m" or "n"). if this attribute is used, the units-per-em must also be used. only one element is using this attribute: <font-face> usage notes value <number> default value none animatable no <number> this value indicates the vertical stem width of the font. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'stemv' in that specification. recommendation initial definition ...
strikethrough-position - SVG: Scalable Vector Graphics
« svg attribute reference home the strikethrough-position attribute represents the ideal vertical position of the strikethrough. the strikethrough position is expressed in the font's coordinate system. ...
strikethrough-thickness - SVG: Scalable Vector Graphics
« svg attribute reference home the strikethrough-thickness attribute represents the ideal thickness of the strikethrough. the strikethrough thickness is expressed in the font's coordinate system. ...
stroke-miterlimit - SVG: Scalable Vector Graphics
nts in user space by the formula: stroke-miterlimit = miterlength stroke-width = 1 sin ( θ 2 ) for example, a miter limit of 1.414 converts miters to bevels for theta less than 90 degrees, a limit of 4.0 converts them for theta less than approximately 29 degrees, and a limit of 10.0 converts them for theta less than approximately 11.5 degrees. usage context value <number> default value 4 animatable yes the value of stroke-miterlimit must be greater than or equal to 1. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxin...
style - SVG: Scalable Vector Graphics
Web › SVG › Attribute › style
tribute allows to style an element using css declarations. it functions identically to the style attribute in html. all elements are using this attribute. html,body,svg { height:100% } <svg viewbox="0 0 100 60" xmlns="http://www.w3.org/2000/svg"> <rect width="80" height="40" x="10" y="10" style="fill: skyblue; stroke: cadetblue; stroke-width: 2;"/> </svg> usage notes value <style> default value none animatable no <style> the syntax of style data depends on the style sheet language. by default, the style sheet language is css. note: in theory, the contentstyletype attribute could be used to specify styling languages other than css, like xsl(t). however, this was never implemented satisfactorily in browsers, so you should not r...
tabindex - SVG: Scalable Vector Graphics
ments are using this attribute. html, body, svg { height: 100%; } <?xml version="1.0"?> <svg viewbox="0 0 260 260" xmlns="http://www.w3.org/2000/svg"> <circle cx="60" cy="60" r="15" tabindex="1" /> <circle cx="60" cy="160" r="30" tabindex="3" /> <circle cx="160" cy="60" r="30" tabindex="2" /> <circle cx="160" cy="160" r="60" tabindex="4" /> </svg> usage notes value valid integer default value none animatable no valid integer relative order of the element for the purposes of sequential focus navigation. specifications specification status comment scalable vector graphics (svg) 2the definition of 'tabindex' in that specification. candidate recommendation initial definition ...
targetX - SVG: Scalable Vector Graphics
Web › SVG › Attribute › targetX
the targetx attribute determines the positioning in horizontal direction of the convolution matrix relative to a given target pixel in the input image. the leftmost column of the matrix is column number zero. the value must be such that: 0 <= targetx < orderx. only one element is using this attribute: <feconvolvematrix> usage notes value <integer> default value floor(orderx / 2) animatable yes <integer> this value indicates the positioning in horizontal direction of the convolution matrix relative to a given target pixel in the input image. specifications specification status comment filter effects module level 1the definition of 'targetx' in that specification. working draft no change scalable vecto...
targetY - SVG: Scalable Vector Graphics
Web › SVG › Attribute › targetY
the targety attribute determines the positioning in vertical direction of the convolution matrix relative to a given target pixel in the input image. the topmost row of the matrix is row number zero. the value must be such that: 0 <= targety < ordery. only one element is using this attribute: <feconvolvematrix> usage notes value <integer> default value floor(ordery / 2) animatable yes <integer> this value indicates the positioning in vertical direction of the convolution matrix relative to a given target pixel in the input image. specifications specification status comment filter effects module level 1the definition of 'targety' in that specification. working draft no change scalable vector graphics ...
underline-position - SVG: Scalable Vector Graphics
« svg attribute reference home the underline-position attribute represents the ideal vertical position of the underline. the underline position is expressed in the font's coordinate system. ...
underline-thickness - SVG: Scalable Vector Graphics
« svg attribute reference home the underline-thickness attribute represents the ideal thickness of the underline. the underline thickness is expressed in the font's coordinate system. ...
unicode-bidi - SVG: Scalable Vector Graphics
specifies how the accumulation of the background image is managed. note: as a presentation attribute, unicode-bidi can be used as a css property. see the css unicode-bidi property for more information. as a presentation attribute, it can be applied to any element but it has effect only on the following eleven elements: <altglyph>, <textpath>, <text>, <tref>, and <tspan> context notes value normal | embed | isolate | bidi-override | isolate-override | plaintext default value normal animatable no for a description of the values, please refer to the css unicode-bidi property. specifications specification status comment css writing modes module level 3the definition of 'unicode-bidi' in that specification. proposed reco...
unicode-range - SVG: Scalable Vector Graphics
the unicode-range attribute defines the range of iso 10646 characters possibly covered by the glyphs in a font. only one element is using this attribute: <font-face> usage notes value <urange># default value none animatable no <urange># this value is a comma-separated list of iso 10646 characters possibly covered by the glyphs in the font. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'unicode-range' in that specification. recommendation initial definition ...
unicode - SVG: Scalable Vector Graphics
Web › SVG › Attribute › unicode
de="&#x66;&#x66;&#x6c;" or in decimal notation as unicode="&#102;&#102;&#108;". the unicode attribute contributes to the process for deciding which glyph(s) are used to represent which character(s). if the attribute is not provided for a given <glyph>, then the only way to use this glyph is via an <altglyph> reference. only one element is using this attribute: <glyph> context notes value <string> default value none animatable no <string> this value specifies one or more unicode characters corresponding to a glyph. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'unicode' in that specification. recommendation initial definition ...
units-per-em - SVG: Scalable Vector Graphics
the units-per-em attribute specifies the number of coordinate units on the "em square", an abstract square whose height is the intended distance between lines of type in the same type size. this is the size of the design grid on which glyphs are laid out. note: this value is almost always necessary as nearly every other attribute requires the definition of a design grid. only one element is using this attribute: <font-face> usage notes value <number> default value 1000 animatable no <number> this value indicates the the number of coordinate units on the em square. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'units-per-em' in that specification...
v-alphabetic - SVG: Scalable Vector Graphics
the v-alphabetic attribute defines indicates the alignment coordinate for glyphs to achieve alphabetic baseline alignment. the value is an offset in the font coordinate system relative to the glyph-specific vert-origin-x attribute. only one element is using this attribute: <font-face> usage notes value <number> default value none animatable no specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'v-alphabetic' in that specification. recommendation initial definition ...
v-hanging - SVG: Scalable Vector Graphics
the v-hanging attribute indicates the alignment coordinate for glyphs to achieve hanging baseline alignment. the value is an offset in the font coordinate system relative to the glyph-specific vert-origin-x attribute. only one element is using this attribute: <font-face> usage notes value <number> default value none animatable no <number> this value indicates the alignment coordinate for the glyphs to achieve hanging baseline alignment. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'v-hanging' in that specification. recommendation initial definition ...
v-ideographic - SVG: Scalable Vector Graphics
the v-ideographic attribute indicates the alignment coordinate for glyphs to achieve ideographic baseline alignment for vertically oriented glyph layouts. the value is an offset in the font coordinate system relative to the glyph-specific vert-origin-x attribute. only one element is using this attribute: <font-face> usage notes value <number> default value none animatable no <number> this value indicates the alignment coordinate for the glyphs. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'v-ideographic' in that specification. recommendation initial definition ...
v-mathematical - SVG: Scalable Vector Graphics
the v-mathematical attribute indicates the alignment coordinate for glyphs to achieve mathematical baseline alignment for vertically oriented glyph layouts. the value is an offset in the font coordinate system relative to the glyph-specific vert-origin-x attribute. only one element is using this attribute: <font-face> usage notes value <number> default value none animatable no <number> this value indicates the alignment coordinate for the glyphs. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'v-mathematical' in that specification. recommendation initial definition ...
version - SVG: Scalable Vector Graphics
Web › SVG › Attribute › version
a svg document conforms to. it is only allowed on the root <svg> element. it is purely advisory and has no influence on rendering or processing. while it is specified to accept any number, the only two valid choices are currently 1.0 and 1.1. <svg version="1.1" viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" width="80" height="80"/> </svg> usage notes value <number> default value none animatable no specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'version' in that specification. recommendation initial definition ...
vert-origin-x - SVG: Scalable Vector Graphics
the vert-origin-x attribute indicates the x-coordinate in the font coordinate system of the origin of a glyph to be used when drawing vertically oriented text. only one element is using this attribute: <font> usage notes value <number> default value half of horiz-adv-x value animatable no <number> this value indicates the x-coordinate of the origin of a glyph for vertically oriented text. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'vert-origin-x' in that specification. recommendation initial definition ...
vert-origin-y - SVG: Scalable Vector Graphics
the vert-origin-y attribute indicates the y-coordinate in the font coordinate system of the origin of a glyph to be used when drawing vertically oriented text. only one element is using this attribute: <font> usage notes value <number> default value ascent value animatable no <number> this value indicates the y-coordinate of the origin of a glyph for vertically oriented text. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'vert-origin-y' in that specification. recommendation initial definition ...
viewTarget - SVG: Scalable Vector Graphics
the viewtarget attribute indicates the target object associated with the view. only one element is using this attribute: <view> usage notes value <xml-name> default value none animatable no <xml-name> this value specifies the name of the object associated with the view. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'viewtarget' in that specification. recommendation initial definition ...
widths - SVG: Scalable Vector Graphics
Web › SVG › Attribute › widths
if this attribute is used, the units-per-em attribute must also be used. if the range is omitted, a range of u+0-7fffffff is assumed which covers all characters and their glyphs. if not enough glyph widths are given, the last in the list is replicated to cover that range. if too many widths are provided, the extras are ignored. ...
x-height - SVG: Scalable Vector Graphics
the x-height attribute indicates the height of lowercase glyphs in the font within the font coordinate system. only one element is using this attribute: <font-face> usage notes value <number> default value none animatable no <number> this value indicates the height of lowercase glyphs. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'x-height' in that specification. recommendation initial definition ...
xlink:title - SVG: Scalable Vector Graphics
a <title> child element rather than a xlink:title attribute. these elements are using this attribute: <a>, <altglyph>, <animate>, <animatecolor>, <animatemotion>, <animatetransform>, <color-profile>, <cursor>, <feimage>, <filter>, <font-face-uri>, <glyphref>, <image>, <lineargradient>, <mpath>, <pattern>, <radialgradient>, <script>, <set>, <textpath>, <tref>, and <use> usage context value <anything> default value none animatable no <anything> this value specifies the title used to describe the meaning of the link or resource. specifications specification status comment scalable vector graphics (svg) 2the definition of 'seed' in that specification. candidate recommendation deprecated the attribute and made it...
xlink:type - SVG: Scalable Vector Graphics
f xlink being used. in svg, only simple links are available. twentytwo elements are using this attribute: <a>, <altglyph>, <animate>, <animatecolor>, <animatemotion>, <animatetransform>, <color-profile>, <cursor>, <feimage>, <filter>, <font-face-uri>, <glyphref>, <image>, <lineargradient>, <mpath>, <pattern>, <radialgradient>, <script>, <set>, <textpath>, <tref>, and <use> usage notes value simple default value simple animatable no simple this value specifies that the referred resource is a simple link. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'xlink:type' in that specification. recommendation initial definition ...
xml:base - SVG: Scalable Vector Graphics
the xml:base attribute specifies a base iri other than the base iri of the document or external entity. all elements are using this attribute. usage notes value <iri> default value none animatable no <iri> this value specifies the base iri of the element. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'xml:base' in that specification. recommendation initial definition ...
<animateColor> - SVG: Scalable Vector Graphics
nsformation over time. usage context categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:descriptive elements attributes global attributes conditional processing attributes core attributes animation event attributes xlink attributes animation attribute target attributes animation timing attributes animation value attributes animation addition attributes externalresourcesrequired specific attributes by from to dom interface this element implements the svganimatecolorelement interface. example svg <svg width="120" height="120" xmlns="http://www.w3.org/2000/svg"> <circle cx="60" cy="60" r="50"> <animatecolor attributename="fill" attributetype="xml" from="black" to="red" dur="6s" ...
<animateTransform> - SVG: Scalable Vector Graphics
specifications specification status comment svg animations level 2the definition of '<animatetransform>' in that specification. editor's draft no change ...
<desc> - SVG: Scalable Vector Graphics
Web › SVG › Element › desc
text in a <desc> element is not rendered as part of the graphic. if the element can be described by visible text, it is possible to reference that text with the aria-describedby attribute. if aria-describedby is used, it will take precedence over <desc>. the hidden text of a <desc> element can also be concatenated with the visible text of other elements using multiple ids in an aria-describedby value. in that case, the <desc> element must provide an id for reference. html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <circle cx="5" cy="5" r="4"> <desc> i'm a circle and that description is here to demonstrate how i can be described, but is it really necessary to describe a simple circle like me? </desc> </circle> ...
<feDisplacementMap> - SVG: Scalable Vector Graphics
the <fedisplacementmap> svg filter primitive uses the pixel values from the image from in2 to spatially displace the image from in. the formula for the transformation looks like this: p'(x,y) ← p( x + scale * (xc(x,y) - 0.5), y + scale * (yc(x,y) - 0.5)) where p(x,y) is the input image, in, and p'(x,y) is the destination. xc(x,y) and yc(x,y) are the component values of the channel designated by xchannelselector and ychannelselector. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in in2 scale xchannelselector ychannelselector dom interface this element imp...
<feOffset> - SVG: Scalable Vector Graphics
Web › SVG › Element › feOffset
usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in dx dy dom interface this element implements the svgfeoffsetelement interface. ...
<g> - SVG: Scalable Vector Graphics
Web › SVG › Element › g
bed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, ...
Basic Transformations - SVG: Scalable Vector Graphics
ove an element around, even though you can position it with the according attributes. for this purpose, the translate() transformation stands ready. <svg width="40" height="50" style="background-color:#bff;"> <rect x="0" y="0" width="10" height="10" transform="translate(30,40)" /> </svg> the example will render a rectangle, translated to the point (30,40) instead of (0,0). if the second value is not given, it is assumed to be 0. rotation rotating an element is quite a common task. use the rotate() transformation for this: <svg width="31" height="31"> <rect x="12" y="-10" width="20" height="20" transform="rotate(45)" /> </svg> this example shows a square that is rotated by 45 degrees. the value for rotate() is given in degrees. multiple transformations transformations ca...
Getting started - SVG: Scalable Vector Graphics
ld send the http headers: content-type: image/svg+xml content-encoding: gzip vary: accept-encoding you can check that your server is sending the correct http headers with your svg files by using the network monitor panel or a site such as websniffer.cc. submit the url of one of your svg files and look at the http response headers. if you find that your server is not sending the headers with the values given above, then you should contact your web host. if you have problems convincing them to correctly configure their servers for svg, there may be ways to do it yourself. see the server configuration page on the w3.org for a range of simple solutions. server misconfiguration is a very common reason for svg failing to load, so make sure you check yours. if your server is not configured to send ...
Introduction - SVG: Scalable Vector Graphics
eep up with the differences between gecko and some of the other major implementations. before starting you should have a basic understanding of xml or another markup language such as html. if you are not too familiar with xml, here are some guidelines to keep in mind: svg elements and attributes should all be entered in the case shown here since xml is case-sensitive (unlike html). attribute values in svg must be placed inside quotes, even if they are numbers. svg is a huge specification. this tutorial attempts to cover the basics. once you are familiar you should be able to use the element reference and the interface reference to find out anything else you need to know. flavors of svg since becoming a recommendation in 2003, the most recent "full" svg version is 1.1. it builds on top ...
Paths - SVG: Scalable Vector Graphics
Web › SVG › Tutorial › Paths
because of that, arcs require quite a few parameters: a rx ry x-axis-rotation large-arc-flag sweep-flag x y a rx ry x-axis-rotation large-arc-flag sweep-flag dx dy at its start, the arc element takes in two parameters for the x-radius and y-radius. if needed, see <ellipse>s and how they behave. the final two parameters designate the x and y coordinates to end the stroke. together, these four values define the basic structure of the arc. the third parameter describes the rotation of the arc. this is best explained with an example: <svg width="320" height="320" xmlns="http://www.w3.org/2000/svg"> <path d="m 10 315 l 110 215 a 30 50 0 0 1 162.55 162.45 l 172.55 152.45 a 30 50 -45 0 1 215.1 109.9 l 315 10" stroke="black" fill="green"...
Patterns - SVG: Scalable Vector Graphics
Web › SVG › Tutorial › Patterns
n. there are also x and y attributes available if you want to offset the start point of this rectangle somewhere within your drawing. the reason they've been used here is described below. as with the gradientunits attribute used above, patterns also have an attribute, patternunits, which specifies the units that these attributes will take. it defaults to "objectboundingbox" as it did above, so a value of 1 is scaled to the width/height of the object you're applying the pattern to. since, in this case, we wanted the pattern to repeat 4 times horizontally and vertically, the height and width are set to 0.25. this means the pattern's width/height is only 0.25 of the total box size. unlike gradients, patterns have a second attribute, patterncontentunits, which describes the units system used insi...
SVG In HTML Introduction - SVG: Scalable Vector Graphics
/style> <script> function signalerror() { document.getelementbyid('body').setattribute("class", "invalid"); } </script> </head> <body id="body" style="position:absolute; z-index:0; border:1px solid black; left:5%; top:5%; width:90%; height:90%;"> <form> <fieldset> <legend>html form</legend> <p><label>enter something:</label> <input type="text"> <span id="err">incorrect value!</span></p> <p><input type="button" value="activate!" onclick="signalerror();"></p> </fieldset> </form> <svg viewbox="0 0 100 100" preserveaspectratio="xmidymid slice" style="width:100%; height:100%; position:absolute; top:0; left:0; z-index:-1;"> <lineargradient id="gradient"> <stop class="begin" offset="0%"/> <stop class="end" offset="100%"/> </lineargradient> <rect x="...
SVG and CSS - SVG: Scalable Vector Graphics
ner-petals .segment:hover > .segment-fill { fill: darkseagreen; stroke: none; } #inner-petals .segment:hover > .segment-edge { stroke: green; } open the document in your svg-enabled browser. move your mouse pointer over the graphic to see what happens. result notes about this demonstration: the svg document links the stylesheet in the usual way. svg has its own css properties and values. some of them are similar to css properties for html. challenge change the stylesheet so that the inner petals all turn pink when the mouse pointer is over any one of them, without changing the way the outer petals work. see a solution to this challenge. simplified structure the svg structure shown above could be written much more concise by referencing the individual parts ...
mimeTypes.rdf corruption - SVG: Scalable Vector Graphics
the blue square with the white cross displays when you load this scripting across embed demo, then you are not experiencing this problem. if it doesn't, then you almost certainly are. background mozilla decides if and how it can open files by using their media (mime) type. it obtains the media type for files in various ways. for files loaded over the network via http, it requires and uses the value assigned to the content-type http header. for files loaded locally, it first looks in a cache of filename extension to media type mappings (stored in a mozilla profile file called mimetypes.rdf), and if it doesn't find a media type there, it asks the operating system. actually, in mozilla firefox 1.5, the media type for files embedded into html using the html <embed> and <object> tags is (unfortu...
Mixed content - Web security
with the opportunity to redirect the user to other http pages and steal http cookies from those sites. active content examples this section lists some types of http requests which are considered active content: <script> (src attribute) <link> (href attribute) (this includes css stylesheets) <iframe> (src attribute) xmlhttprequest requests fetch() requests all cases in css where a <url> value is used (@font-face, cursor, background-image, and so forth). <object> (data attribute) navigator.sendbeacon (url attribute) other resource types like web fonts and workers may be considered active mixed content, as they are in chrome. warnings in web console the firefox web console displays a mixed content warning message in the net pane when a page on your website has this issue. the mixe...
Securing your site - Web security
ur site. this article offers an assortment of suggestions, as well as links to other articles providing more useful information. note: this article is a work in progress, and is neither complete nor does following its suggestions guarantee your site will be fully secure. user information security how to turn off form autocompletion form fields support autocompletion in gecko; that is, their values can be remembered and automatically brought back the next time the user visits your site. for certain types of data, you may wish to disable this feature. privacy and the :visited selector this article discusses changes made to the getcomputedstyle() method that eliminates the ability for malicious sites to figure out the user's browsing history. hash passwords using a secure algorithm (owasp...
Using shadow DOM - Web Components
element, but it contains a series of buttons and other controls inside its shadow dom. the shadow dom spec has made it so that you are allowed to actually manipulate the shadow dom of your own custom elements. basic usage you can attach a shadow root to any element using the element.attachshadow() method. ...
Using templates and slots - Web Components
te's paragraph element like this: <p><slot name="my-text">my default text</slot></p> if the slot's content isn't defined when the element is included in the markup, or if the browser doesn't support slots, <my-paragraph> just contains the fallback content "my default text". to define the slot's content, we include an html structure inside the <my-paragraph> element with a slot attribute whose value is equal to the name of the slot we want it to fill. as before, this can be anything you like, for example: <my-paragraph> <span slot="my-text">let's have some different text!</span> </my-paragraph> or <my-paragraph> <ul slot="my-text"> <li>let's have some different text!</li> <li>in a list!</li> </ul> </my-paragraph> note: elements that can be inserted into slots are known as...
id - XPath
Web › XPath › Functions › id
the returned node set is the nodes corresponding to those ids. ...
string - XPath
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the string function converts the given argument to a string. syntax string( [object] ) arguments object(optional) the object to convert to a string. if omitted, the context node is used. returns a string notes if the object is a node-set, the string value of the first node in the set is returned. a number is converted as follows: nan is converted to the string nan. positive zero is converted to the string 0. negative zero is converted to the string 0. positive infinity is converted to the string infinity. negative infinity is converted to the string -infinity. decimal numbers between -1 and 1 are converted to a string with a single leading 0 before the decimal ...
sum - XPath
Web › XPath › Functions › sum
syntax sum(node-set ) arguments node-set the node-set to be evaluated. ...
system-property - XPath
the system-property function returns an object representing the given system-property. syntax system-property(name) arguments name (optional) the name of the system property. the argument must evaluate to a string that is a qname. the qname is expanded into a name using the namespace declarations in scope for the expression. the system-property function returns an object representing the value of the system property identified by the name. if there is no such system property, the empty string should be returned. returns an object representing the given system-property. notes xsl:version, a number giving the version of xslt implemented by the processor; for xslt processors implementing the version of xslt specified by this document, this is the number 1.0 xsl:vendor, a string id...
translate - XPath
haracter in abc that appears in string. returns the translated string. notes xpath notes that the translate function is not a sufficient solution for case conversion in all languages. a future version of xpath may provide additional functions for case conversion. however, this is the closest we have at present to a function that can convert a string to uppercase or lowercase. example <xsl:value-of select="translate('the quick brown fox.', 'abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxyz')" /> output the quick brown fox. if abc is longer than xyz, then every occurrence of characters in abc that do not have a corresponding character in xyz will be removed. example <xsl:value-of select="translate('the quick brown fox.', 'brown', 'red')" /> output the quick red fdx. ...
true - XPath
Web › XPath › Functions › true
syntax true() returns boolean true. defined xpath 1.0 4.3 gecko support supported. ...
XPath snippets - XPath
on id attributes, document.getelementbyid() is still powerful, but it's not nearly as powerful as xpath. here are some examples. ...
XPath
guage document using xpathexpression, such as html and svg, instead of relying on the document.getelementbyid() or parentnode.queryselectorall() methods, the node.childnodes properties, and other dom core features. xpath uses a path notation (as in urls) for navigating through the hierarchical structure of an xml document. it uses a non-xml syntax so that it can be used in uris and xml attribute values. note: support for xpath varies widely; it's supported reasonably well in firefox (although there are no plans to improve support further), while other browsers implement it to a lesser extent, if at all. if you need a polyfill, you may consider js-xpath or wicked-good-xpath. documentation introduction to using xpath in javascript describes a non-xslt use of xpath. xpath:axes list an...
<xsl:decimal-format> - XSLT: Extensible Stylesheet Language Transformations
decimal-separator specifies the decimal point character. the default is (.). grouping-separator specifies the thousands separator character. the default is (,). infinity specifies the string used to represent infinity. the default is the string "infinity". minus-sign specifies the minus sign character. the default is the hyphen (-). nan specifies the string used when the value is not a number. the default is the string "nan". percent specifies the percentage sign character. the default is (%). per-mille specifies the per thousand character. the default is (‰). zero-digit specifies the digit zero character. the default is (0). digit specifies the character used in the format pattern to stand for a digit. the default is (#). pattern-separator s...
<xsl:if> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › if
similar to an if statement in other languages. to achieve the functionality of an if-then-else statement, however, use the <xsl:choose> element with one <xsl:when> and one <xsl:otherwise> children. syntax <xsl:if test=expression> template </xsl:if> required attributes test contains an xpath expression that can be evaluated (using the rules defined for boolean( ) if necessary) to a boolean value. if the value is true, the template is processed; if it is not, no action is taken. optional attributes none. type instruction, appears within a template. defined xsl section 9.1. gecko support supported ...
<xsl:key> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › key
ath axes the <xsl:key> element declares a named key which can be used elsewhere in the stylesheet with the key( ) function. syntax <xsl:key name=name match=expression use=expression /> required attributes name specifies a name for this key. must be a qname. match defines the nodes for which this key is applicable. use specifies an xpath expression that will be used to determine the value of the key for each of the applicable nodes. optional attributes none. type top-level, must be the child of <xsl:stylesheet> or <xsl:transform>. defined xslt, section 12.2. gecko support supported. ...
<xsl:message> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › message
th functions, xpath axes the <xsl:message> element outputs a message (to the javascript console in ns) and optionally terminates execution of the stylesheet. it can be useful for debugging. syntax <xsl:message terminate="yes" | "no" > template </xsl:message> required attributes none. optional attributes terminate set to "yes", indicates that execution should be terminated. the default value is "no", in which case the message is output and execution continues. type instruction, appears within a template. defined xslt, section 13. gecko support supported. ...
<xsl:param> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › param
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:param> element establishes a parameter by name and, optionally, a default value for that parameter. when used as a top-level element, the parameter is global . when used inside an <xsl:template> element, the parameter is local to that template. in this case it must be the first child element of the template. syntax <xsl:param name=name select=expression> template </xsl:param> required attributes name names the parameter. this must be a qname. optional attributes select uses an xpath expression to provide a default value if none is specified. type instruction, can appear as a top-level element or within a template. defined xslt, section 11. gecko support supported. ...
<xsl:sort> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › sort
lang=xml:lang-code data-type="text" | "number" /> required attributes none. optional attributes select uses an xpath expression to specify the nodes to be sorted. order specifies whether the nodes should be processed in "ascending" or "descending" order. the default is "ascending". case-order indicates whether upper- or lowercase letters are to be ordered first. the allowable values are "upper-first" and "lower-first". lang specifies which language is to be used by the sort. data-type defines whether items are to be ordered alphabetically or numerically. the allowable values are "text" and "number" with "text" being the default. type subinstruction, always appears as a child of <xsl:for-each>, where it must appear before the template proper or of <xsl:apply-tem...
<xsl:text> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › text
tput tree. it may contain #pcdata, literal text, and entity references. syntax <xsl:text disable-output-escaping="yes" | "no"> text </xsl:text> required attributes none. optional attributes disable-output-escaping (netscape does not serialize the result of transformation - the "output" below - so this attribute is essentially irrelevant in context. to output html-entities, use numerical values instead, eg &#160; for &nbsp;) specifies whether special characters are escaped when written to the output. the available values are "yes" or "no". if "yes" is set, for example, the character > is output as >, not as &gt;. type instruction, appears within a template. defined xslt, section 7.2 gecko support supported as noted. ...
<xsl:variable> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › variable
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:variable> element declares a global or local variable in a stylesheet and gives it a value. because xslt permits no side-effects, once the value of the variable has been established, it remains the same until the variable goes out of scope syntax <xsl:variable name=name select=expression > template </xsl:variable> required attributes name gives the variable a name. optional attributes select defines the value of the variable through an xpath expression. if the element contains a template, this attribute is ignored. type top-level or instruction. if it occurs as a top-level element, the variable is global in scope, and can be accessed throughout the document. if it occurs w...
The Netscape XSLT/XPath Reference - XSLT: Extensible Stylesheet Language Transformations
amespace-alias (not supported) xsl:number (partially supported) xsl:otherwise (supported) xsl:output (partially supported) xsl:param (supported) xsl:preserve-space (supported) xsl:processing-instruction xsl:sort (supported) xsl:strip-space (supported) xsl:stylesheet (partially supported) xsl:template (supported) xsl:text (partially supported) xsl:transform (supported) xsl:value-of (partially supported) xsl:variable (supported) xsl:when (supported) xsl:with-param (supported) axes ancestor ancestor-or-self attribute child descendant descendant-or-self following following-sibling namespace (not supported) parent preceding preceding-sibling self functions boolean() (supported) ceiling() (supported) concat() (supported) contains() (supported...
Transforming XML with XSLT - XSLT: Extensible Stylesheet Language Transformations
rted) xsl:namespace-alias (not supported) xsl:number (partially supported) xsl:otherwise (supported) xsl:output (partially supported) xsl:param (supported) xsl:preserve-space (supported) xsl:processing-instruction xsl:sort (supported) xsl:strip-space (supported) xsl:stylesheet (partially supported) xsl:template (supported) xsl:text (partially supported) xsl:transform (supported) xsl:value-of (partially supported) xsl:variable (supported) xsl:when (supported) xsl:with-param (supported) axes ancestor ancestor-or-self attribute child descendant descendant-or-self following following-sibling namespace (not supported) parent preceding preceding-sibling self functions boolean() (supported) ceiling() (supported) concat() (supported) contains() (supported) cou...
Using the Mozilla JavaScript interface to XSL Transformations - XSLT: Extensible Stylesheet Language Transformations
will change in a future release. transforming xhtml should work as expected though. setting parameters you can control parameters for the stylesheet using the xsltprocessor.setparameter(), xsltprocessor.getparameter(), and xsltprocessor.removeparameter() methods. these all take a namespace uri and a local name as the first two parameters, with xsltprocessor.setparameter() taking a third - the value of the parameter to be set. see the xslt/javascript interface in gecko for an example. resetting the xsltprocessor object also implements a xsltprocessor.reset() method, which can be used to remove all stylesheets and parameters then put the processor back into its initial state. this method is implemented in mozilla 1.3 and later. resources the following reflect the interface of the xsltproc...
Advanced Example - XSLT: Extensible Stylesheet Language Transformations
ng between ascending and descending order. the javascript loads the .xsl file only on the first sort and sets the xslloaded variable to true once it has finished loading the file. using the xsltprocessor.getparameter() method, the code can figure whether to sort in ascending or descending order. it defaults to ascending if the parameter is empty (the first time the sorting happens, as there is no value for it in the xslt file). the sorting value is set using xsltprocessor.setparameter(). the xslt file has a parameter called myorder that javascript sets to change the sorting method. the xsl:sort element's order attribute can access the value of the parameter using $myorder. however, the value needs to be an xpath expression and not a string, so {$myorder} is used. using {} evaluates the content...
Setting Parameters - XSLT: Extensible Stylesheet Language Transformations
to interact with these parameters: xsltprocessor.setparameter(), xsltprocessor.getparameter() and xsltprocessor.removeparameter(). they all take as the first argument the namespace uri of the xsl:param (usually the param will fall in the default namespace, so passing in null will suffice.) the local name of the xsl:param is the second argument. setparameter requires a third argument - namely the value to which the parameter will be set. figure 7 : parameters /* xslt: <xsl:param name="myorder" /> */ // javascript: var sortval = xsltprocessor.getparameter(null, "myorder"); if (sortval == "" || sortval == "descending") xsltprocessor.setparameter(null, "myorder", "ascending"); else xsltprocessor.setparameter(null, "myorder", "descending"); ...
WebAssembly Concepts - WebAssembly
arraybuffer that contains the linear array of bytes read and written by webassembly’s low-level memory access instructions. table: a resizable typed array of references (e.g. to functions) that could not otherwise be stored as raw bytes in memory (for safety and portability reasons). instance: a module paired with all the state it uses at runtime including a memory, table, and set of imported values. an instance is like an es2015 module that has been loaded into a particular global with a particular set of imports. the javascript api provides developers with the ability to create modules, memories, tables, and instances. given a webassembly instance, javascript code can synchronously call its exports, which are exposed as normal javascript functions. arbitrary javascript functions can als...
Converting WebAssembly text format to wasm - WebAssembly
exported_func: (module (func $i (import "imports" "imported_func") (param i32)) (func (export "exported_func") i32.const 42 call $i ) ) the webassembly function exported_func is exported for use in our environment (e.g. the web app in which we are using our webassembly module). when it is called, it calls an imported javascript function called imported_func, which is run with the value (42) provided as a parameter. converting the text .wat into a binary .wasm file let’s have a go at converting the above .wat text representation example into .wasm assembly format. to start with, make a copy of the above listing inside a text file; call it simple.wat. we need to assemble this textual representation into the assembly language the browser actually reads before we can use it...
WebAssembly
reaming() the webassembly.instantiatestreaming() function is the primary api for compiling and instantiating webassembly code, returning both a module and its first instance. webassembly.memory() a webassembly.memory object is a resizable arraybuffer that holds the raw bytes of memory accessed by an instance. webassembly.table() a webassembly.table object is a resizable typed array of opaque values, like function references, that are accessed by an instance. webassembly.compileerror() creates a new webassembly compileerror object. webassembly.linkerror() creates a new webassembly linkerror object. webassembly.runtimeerror() creates a new webassembly runtimeerror object. examples wasmsobel see our webassembly-examples repo for a number of other examples. specifications ...